Skip to content

Commit efdc853

Browse files
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
2 parents f4dd74e + 3081a4e commit efdc853

File tree

10 files changed

+15
-42
lines changed

10 files changed

+15
-42
lines changed

components/esp_timer/src/esp_timer.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,12 @@
1515
#include "freertos/FreeRTOS.h"
1616
#include "freertos/task.h"
1717
#include "freertos/semphr.h"
18-
#include "esp_ipc.h"
1918
#include "esp_timer.h"
2019
#include "esp_timer_impl.h"
2120
#include "esp_compiler.h"
22-
2321
#include "esp_private/startup_internal.h"
2422
#include "esp_private/esp_timer_private.h"
2523
#include "esp_private/system_internal.h"
26-
27-
//TODO: IDF-9526, refactor this
28-
#if CONFIG_IDF_TARGET_ESP32
29-
#include "esp32/rtc.h"
30-
#elif CONFIG_IDF_TARGET_ESP32S2
31-
#include "esp32s2/rtc.h"
32-
#elif CONFIG_IDF_TARGET_ESP32S3
33-
#include "esp32s3/rtc.h"
34-
#elif CONFIG_IDF_TARGET_ESP32C3
35-
#include "esp32c3/rtc.h"
36-
#elif CONFIG_IDF_TARGET_ESP32C2
37-
#include "esp32c2/rtc.h"
38-
#elif CONFIG_IDF_TARGET_ESP32C6
39-
#include "esp32c6/rtc.h"
40-
#elif CONFIG_IDF_TARGET_ESP32C61
41-
#include "esp32c61/rtc.h"
42-
#elif CONFIG_IDF_TARGET_ESP32H2
43-
#include "esp32h2/rtc.h"
44-
#elif CONFIG_IDF_TARGET_ESP32P4
45-
#include "esp32p4/rtc.h"
46-
#endif
47-
4824
#include "sdkconfig.h"
4925

5026
#ifdef CONFIG_ESP_TIMER_PROFILING

components/esp_timer/test_apps/main/test_esp_timer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ TEST_CASE("esp_timer for very short intervals", "[esp_timer]")
388388
vTaskDelay(3); // wait for the esp_timer task to delete all timers
389389
}
390390

391-
#if !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-10955, test fail
392391
static void IRAM_ATTR test_esp_timer_get_time_performance(void)
393392
{
394393
int64_t begin = esp_timer_get_time();
@@ -405,7 +404,6 @@ TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]")
405404
{
406405
test_esp_timer_get_time_performance();
407406
}
408-
#endif
409407

410408
static int64_t IRAM_ATTR __attribute__((noinline)) get_clock_diff(void)
411409
{

components/hal/esp32c61/include/hal/systimer_ll.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include "soc/pcr_struct.h"
1313
#include "hal/assert.h"
1414

15-
// TODO: [ESP32C61] IDF-9307, inherit from C6
16-
1715
#ifdef __cplusplus
1816
extern "C" {
1917
#endif

components/idf_test/include/esp32c61/idf_performance_target.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
#pragma once
88

9-
#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200
9+
#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1300

components/soc/esp32c61/include/soc/soc_caps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define SOC_GPSPI_SUPPORTED 1
3838
#define SOC_I2C_SUPPORTED 1
3939
#define SOC_LEDC_SUPPORTED 1
40-
#define SOC_SYSTIMER_SUPPORTED 1 //TODO: [ESP32C61] IDF-9307, IDF-9308
40+
#define SOC_SYSTIMER_SUPPORTED 1
4141
// \#define SOC_SUPPORT_COEXISTENCE 1
4242
// \#define SOC_SHA_SUPPORTED 1 //TODO: [ESP32C61] IDF-9234
4343
#define SOC_ECC_SUPPORTED 1

docs/en/api-reference/system/esp_timer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ESP Timer (High Resolution Timer)
55

66
{IDF_TARGET_HR_TIMER:default = "SYSTIMER", esp32 = "LAC timer"}
77

8-
{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"}
8+
{IDF_TARGET_HR_TIMER_Resolution:default = "52", esp32 = "64", esp32s2 = "64"}
99

1010
.. only:: html
1111

docs/zh_CN/api-reference/system/esp_timer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ESP 定时器(高分辨率定时器)
55

66
{IDF_TARGET_HR_TIMER:default = "SYSTIMER", esp32 = "LAC 定时器"}
77

8-
{IDF_TARGET_HR_TIMER_Resolution:default = "未更新", esp32 = "64", esp32s2 = "64", esp32c3 = "52", esp32s3 = "52", esp32c2 = "52", esp32c5 = "52", esp32c6 = "52", esp32h2 = "52", esp32p4 = "52"}
8+
{IDF_TARGET_HR_TIMER_Resolution:default = "52", esp32 = "64", esp32s2 = "64"}
99

1010
.. only:: html
1111

examples/system/.build-test-rules.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ examples/system/efuse:
5151
- bootloader_support
5252

5353
examples/system/esp_timer:
54-
disable:
55-
- if: SOC_LIGHT_SLEEP_SUPPORTED != 1
5654
depends_components:
5755
- esp_timer
5856

examples/system/esp_timer/main/esp_timer_example_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void app_main(void)
5858
usleep(2000000);
5959
}
6060

61+
#if SOC_LIGHT_SLEEP_SUPPORTED
6162
/* Timekeeping continues in light sleep, and timers are scheduled
6263
* correctly after light sleep.
6364
*/
@@ -71,6 +72,7 @@ void app_main(void)
7172
ESP_LOGI(TAG, "Woke up from light sleep, time since boot: %lld us", t2);
7273

7374
assert(llabs((t2 - t1) - 500000) < 1200);
75+
#endif
7476

7577
/* Let the timer run for a little bit more */
7678
usleep(2000000);

examples/system/esp_timer/pytest_esp_timer.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,17 @@ def test_esp_timer(dut: Dut) -> None:
7171
logging.info('Callback #{}, time: {} us, diff: {} us'.format(i, cur_time, diff))
7272
assert abs(diff) < 100
7373

74-
match = dut.expect(LIGHT_SLEEP_ENTER_REGEX, timeout=2)
75-
sleep_enter_time = int(match.group(1))
76-
match = dut.expect(LIGHT_SLEEP_EXIT_REGEX, timeout=2)
77-
sleep_exit_time = int(match.group(1))
78-
sleep_time = sleep_exit_time - sleep_enter_time
74+
if dut.app.sdkconfig.get('SOC_LIGHT_SLEEP_SUPPORTED'):
75+
match = dut.expect(LIGHT_SLEEP_ENTER_REGEX, timeout=2)
76+
sleep_enter_time = int(match.group(1))
77+
match = dut.expect(LIGHT_SLEEP_EXIT_REGEX, timeout=2)
78+
sleep_exit_time = int(match.group(1))
79+
sleep_time = sleep_exit_time - sleep_enter_time
7980

80-
logging.info('Enter sleep: {}, exit sleep: {}, slept: {}'.format(
81-
sleep_enter_time, sleep_exit_time, sleep_time))
81+
logging.info('Enter sleep: {}, exit sleep: {}, slept: {}'.format(
82+
sleep_enter_time, sleep_exit_time, sleep_time))
8283

83-
assert abs(sleep_time - LIGHT_SLEEP_TIME) < 1200
84+
assert abs(sleep_time - LIGHT_SLEEP_TIME) < 1200
8485

8586
for i in range(5, 7):
8687
match = dut.expect(PERIODIC_TIMER_REGEX, timeout=2)

0 commit comments

Comments
 (0)