Merge branch 'feature/esp32c61_esp_timer_systimer' into 'master'

feat(esp_timer): Updates systimer and esp_timer for ESP32-C61

Closes IDF-9284, IDF-10955, IDF-9307, and IDF-9308

See merge request espressif/esp-idf!33439
This commit is contained in:
Konstantin Kondrashov 2024-09-14 16:08:40 +08:00
commit efdc853b45
10 changed files with 15 additions and 42 deletions

View File

@ -15,36 +15,12 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "esp_ipc.h"
#include "esp_timer.h"
#include "esp_timer_impl.h"
#include "esp_compiler.h"
#include "esp_private/startup_internal.h"
#include "esp_private/esp_timer_private.h"
#include "esp_private/system_internal.h"
//TODO: IDF-9526, refactor this
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C2
#include "esp32c2/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C6
#include "esp32c6/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C61
#include "esp32c61/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32H2
#include "esp32h2/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32P4
#include "esp32p4/rtc.h"
#endif
#include "sdkconfig.h"
#ifdef CONFIG_ESP_TIMER_PROFILING

View File

@ -388,7 +388,6 @@ TEST_CASE("esp_timer for very short intervals", "[esp_timer]")
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}
#if !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-10955, test fail
static void IRAM_ATTR test_esp_timer_get_time_performance(void)
{
int64_t begin = esp_timer_get_time();
@ -405,7 +404,6 @@ TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]")
{
test_esp_timer_get_time_performance();
}
#endif
static int64_t IRAM_ATTR __attribute__((noinline)) get_clock_diff(void)
{

View File

@ -12,8 +12,6 @@
#include "soc/pcr_struct.h"
#include "hal/assert.h"
// TODO: [ESP32C61] IDF-9307, inherit from C6
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -6,4 +6,4 @@
#pragma once
#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200
#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1300

View File

@ -37,7 +37,7 @@
#define SOC_GPSPI_SUPPORTED 1
#define SOC_I2C_SUPPORTED 1
#define SOC_LEDC_SUPPORTED 1
#define SOC_SYSTIMER_SUPPORTED 1 //TODO: [ESP32C61] IDF-9307, IDF-9308
#define SOC_SYSTIMER_SUPPORTED 1
// \#define SOC_SUPPORT_COEXISTENCE 1
// \#define SOC_SHA_SUPPORTED 1 //TODO: [ESP32C61] IDF-9234
#define SOC_ECC_SUPPORTED 1

View File

@ -5,7 +5,7 @@ ESP Timer (High Resolution Timer)
{IDF_TARGET_HR_TIMER:default = "SYSTIMER", esp32 = "LAC timer"}
{IDF_TARGET_HR_TIMER_Resolution:default = "Not updated", esp32 = "64", esp32s2 = "64", esp32c3 = "52", esp32s3 = "52", esp32c2 = "52", esp32c5 = "52", esp32c6 = "52", esp32h2 = "52", esp32p4 = "52"}
{IDF_TARGET_HR_TIMER_Resolution:default = "52", esp32 = "64", esp32s2 = "64"}
.. only:: html

View File

@ -5,7 +5,7 @@ ESP 定时器(高分辨率定时器)
{IDF_TARGET_HR_TIMER:default = "SYSTIMER", esp32 = "LAC 定时器"}
{IDF_TARGET_HR_TIMER_Resolution:default = "未更新", esp32 = "64", esp32s2 = "64", esp32c3 = "52", esp32s3 = "52", esp32c2 = "52", esp32c5 = "52", esp32c6 = "52", esp32h2 = "52", esp32p4 = "52"}
{IDF_TARGET_HR_TIMER_Resolution:default = "52", esp32 = "64", esp32s2 = "64"}
.. only:: html

View File

@ -51,8 +51,6 @@ examples/system/efuse:
- bootloader_support
examples/system/esp_timer:
disable:
- if: SOC_LIGHT_SLEEP_SUPPORTED != 1
depends_components:
- esp_timer

View File

@ -58,6 +58,7 @@ void app_main(void)
usleep(2000000);
}
#if SOC_LIGHT_SLEEP_SUPPORTED
/* Timekeeping continues in light sleep, and timers are scheduled
* correctly after light sleep.
*/
@ -71,6 +72,7 @@ void app_main(void)
ESP_LOGI(TAG, "Woke up from light sleep, time since boot: %lld us", t2);
assert(llabs((t2 - t1) - 500000) < 1200);
#endif
/* Let the timer run for a little bit more */
usleep(2000000);

View File

@ -71,6 +71,7 @@ def test_esp_timer(dut: Dut) -> None:
logging.info('Callback #{}, time: {} us, diff: {} us'.format(i, cur_time, diff))
assert abs(diff) < 100
if dut.app.sdkconfig.get('SOC_LIGHT_SLEEP_SUPPORTED'):
match = dut.expect(LIGHT_SLEEP_ENTER_REGEX, timeout=2)
sleep_enter_time = int(match.group(1))
match = dut.expect(LIGHT_SLEEP_EXIT_REGEX, timeout=2)