Эх сурвалжийг харах

time: Fix gettimeofday for ESP32-S3

Konstantin Kondrashov 5 жил өмнө
parent
commit
9386cafbc3

+ 5 - 2
components/esp32/Kconfig

@@ -523,14 +523,17 @@ menu "ESP32-specific"
 
 
         config ESP32_TIME_SYSCALL_USE_RTC_FRC1
         config ESP32_TIME_SYSCALL_USE_RTC_FRC1
             bool "RTC and high-resolution timer"
             bool "RTC and high-resolution timer"
-            select ESP_TIMER_RTC_USE
+            select ESP_TIME_FUNCS_USE_RTC_TIMER
+            select ESP_TIME_FUNCS_USE_ESP_TIMER
         config ESP32_TIME_SYSCALL_USE_RTC
         config ESP32_TIME_SYSCALL_USE_RTC
             bool "RTC"
             bool "RTC"
-            select ESP_TIMER_RTC_USE
+            select ESP_TIME_FUNCS_USE_RTC_TIMER
         config ESP32_TIME_SYSCALL_USE_FRC1
         config ESP32_TIME_SYSCALL_USE_FRC1
             bool "High-resolution timer"
             bool "High-resolution timer"
+            select ESP_TIME_FUNCS_USE_ESP_TIMER
         config ESP32_TIME_SYSCALL_USE_NONE
         config ESP32_TIME_SYSCALL_USE_NONE
             bool "None"
             bool "None"
+            select ESP_TIME_FUNCS_USE_NONE
     endchoice
     endchoice
 
 
     choice ESP32_RTC_CLK_SRC
     choice ESP32_RTC_CLK_SRC

+ 5 - 2
components/esp32s2/Kconfig

@@ -392,14 +392,17 @@ menu "ESP32S2-specific"
 
 
         config ESP32S2_TIME_SYSCALL_USE_RTC_FRC1
         config ESP32S2_TIME_SYSCALL_USE_RTC_FRC1
             bool "RTC and high-resolution timer"
             bool "RTC and high-resolution timer"
-            select ESP_TIMER_RTC_USE
+            select ESP_TIME_FUNCS_USE_RTC_TIMER
+            select ESP_TIME_FUNCS_USE_ESP_TIMER
         config ESP32S2_TIME_SYSCALL_USE_RTC
         config ESP32S2_TIME_SYSCALL_USE_RTC
             bool "RTC"
             bool "RTC"
-            select ESP_TIMER_RTC_USE
+            select ESP_TIME_FUNCS_USE_RTC_TIMER
         config ESP32S2_TIME_SYSCALL_USE_FRC1
         config ESP32S2_TIME_SYSCALL_USE_FRC1
             bool "High-resolution timer"
             bool "High-resolution timer"
+            select ESP_TIME_FUNCS_USE_ESP_TIMER
         config ESP32S2_TIME_SYSCALL_USE_NONE
         config ESP32S2_TIME_SYSCALL_USE_NONE
             bool "None"
             bool "None"
+            select ESP_TIME_FUNCS_USE_NONE
     endchoice
     endchoice
 
 
     choice ESP32S2_RTC_CLK_SRC
     choice ESP32S2_RTC_CLK_SRC

+ 5 - 2
components/esp32s3/Kconfig

@@ -430,14 +430,17 @@ menu "ESP32S3-Specific"
 
 
         config ESP32S3_TIME_SYSCALL_USE_RTC_FRC1
         config ESP32S3_TIME_SYSCALL_USE_RTC_FRC1
             bool "RTC and high-resolution timer"
             bool "RTC and high-resolution timer"
-            select ESP_TIMER_RTC_USE
+            select ESP_TIME_FUNCS_USE_RTC_TIMER
+            select ESP_TIME_FUNCS_USE_ESP_TIMER
         config ESP32S3_TIME_SYSCALL_USE_RTC
         config ESP32S3_TIME_SYSCALL_USE_RTC
             bool "RTC"
             bool "RTC"
-            select ESP_TIMER_RTC_USE
+            select ESP_TIME_FUNCS_USE_RTC_TIMER
         config ESP32S3_TIME_SYSCALL_USE_FRC1
         config ESP32S3_TIME_SYSCALL_USE_FRC1
             bool "High-resolution timer"
             bool "High-resolution timer"
+            select ESP_TIME_FUNCS_USE_ESP_TIMER
         config ESP32S3_TIME_SYSCALL_USE_NONE
         config ESP32S3_TIME_SYSCALL_USE_NONE
             bool "None"
             bool "None"
+            select ESP_TIME_FUNCS_USE_NONE
     endchoice
     endchoice
 
 
     choice ESP32S3_RTC_CLK_SRC
     choice ESP32S3_RTC_CLK_SRC

+ 1 - 1
components/esp_pm/Kconfig

@@ -23,7 +23,7 @@ menu "Power Management"
 
 
     config PM_USE_RTC_TIMER_REF
     config PM_USE_RTC_TIMER_REF
         bool "Use RTC timer to prevent time drift (EXPERIMENTAL)"
         bool "Use RTC timer to prevent time drift (EXPERIMENTAL)"
-        depends on (PM_ENABLE && ESP_TIMER_IMPL_FRC2 && ESP_TIMER_RTC_USE)
+        depends on (PM_ENABLE && ESP_TIMER_IMPL_FRC2 && ESP_TIME_FUNCS_USE_RTC_TIMER)
         default n
         default n
         help
         help
             When APB clock frequency changes, high-resolution timer (esp_timer)
             When APB clock frequency changes, high-resolution timer (esp_timer)

+ 7 - 1
components/esp_timer/Kconfig

@@ -9,7 +9,13 @@ menu "High resolution timer (esp_timer)"
             This option has some effect on timer performance and the amount of memory used for timer
             This option has some effect on timer performance and the amount of memory used for timer
             storage, and should only be used for debugging/testing purposes.
             storage, and should only be used for debugging/testing purposes.
 
 
-    config ESP_TIMER_RTC_USE  # [refactor-todo] remove when timekeeping and persistence are separate
+    config ESP_TIME_FUNCS_USE_RTC_TIMER  # [refactor-todo] remove when timekeeping and persistence are separate
+        bool
+
+    config ESP_TIME_FUNCS_USE_ESP_TIMER  # [refactor-todo] remove when timekeeping and persistence are separate
+        bool
+
+    config ESP_TIME_FUNCS_USE_NONE  # [refactor-todo] remove when timekeeping and persistence are separate
         bool
         bool
 
 
     config ESP_TIMER_TASK_STACK_SIZE
     config ESP_TIMER_TASK_STACK_SIZE

+ 4 - 9
components/esp_timer/src/esp_timer.c

@@ -36,17 +36,12 @@
 #include "esp32/rtc.h"
 #include "esp32/rtc.h"
 #elif CONFIG_IDF_TARGET_ESP32S2
 #elif CONFIG_IDF_TARGET_ESP32S2
 #include "esp32s2/rtc.h"
 #include "esp32s2/rtc.h"
+#elif CONFIG_IDF_TARGET_ESP32S3
+#include "esp32s3/rtc.h"
 #endif
 #endif
 
 
 #include "sdkconfig.h"
 #include "sdkconfig.h"
 
 
-#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 ) || \
-    defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) || \
-    defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 ) || \
-    defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 )
-#define WITH_FRC 1
-#endif
-
 #ifdef CONFIG_ESP_TIMER_PROFILING
 #ifdef CONFIG_ESP_TIMER_PROFILING
 #define WITH_PROFILING 1
 #define WITH_PROFILING 1
 #endif
 #endif
@@ -396,7 +391,7 @@ esp_err_t esp_timer_init(void)
         goto out;
         goto out;
     }
     }
 
 
-#if WITH_FRC
+#if CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER
     // [refactor-todo] this logic, "esp_rtc_get_time_us() - g_startup_time", is also
     // [refactor-todo] this logic, "esp_rtc_get_time_us() - g_startup_time", is also
     // the weak definition of esp_system_get_time; find a way to remove this duplication.
     // the weak definition of esp_system_get_time; find a way to remove this duplication.
     esp_timer_private_advance(esp_rtc_get_time_us() - g_startup_time);
     esp_timer_private_advance(esp_rtc_get_time_us() - g_startup_time);
@@ -531,7 +526,7 @@ int64_t IRAM_ATTR esp_timer_get_next_alarm(void)
 
 
 // Provides strong definition for system time functions relied upon
 // Provides strong definition for system time functions relied upon
 // by core components.
 // by core components.
-#if WITH_FRC
+#if CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER
 int64_t IRAM_ATTR esp_system_get_time(void)
 int64_t IRAM_ATTR esp_system_get_time(void)
 {
 {
     return esp_timer_get_time();
     return esp_timer_get_time();

+ 1 - 1
components/mbedtls/Kconfig

@@ -296,7 +296,7 @@ menu "mbedTLS"
 
 
     config MBEDTLS_HAVE_TIME
     config MBEDTLS_HAVE_TIME
         bool "Enable mbedtls time"
         bool "Enable mbedtls time"
-        depends on !ESP32_TIME_SYSCALL_USE_NONE
+        depends on !ESP_TIME_FUNCS_USE_NONE
         default y
         default y
         help
         help
             System has time.h and time().
             System has time.h and time().

+ 20 - 34
components/newlib/port/esp_time_impl.c

@@ -41,69 +41,55 @@
 #include "esp32s3/rtc.h"
 #include "esp32s3/rtc.h"
 #endif
 #endif
 
 
-#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) \
-    || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) \
-    || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC ) \
-    || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 ) \
-    || defined( CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC ) \
-    || defined( CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_FRC1 )
-#define WITH_RTC 1
-#endif
 
 
-#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 ) \
-    || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) \
-    || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 ) \
-    || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 )
-#define WITH_FRC 1
-#endif
 
 
 // Offset between FRC timer and the RTC.
 // Offset between FRC timer and the RTC.
 // Initialized after reset or light sleep.
 // Initialized after reset or light sleep.
-#if defined(WITH_RTC) && defined(WITH_FRC)
+#if defined(CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER) && defined(CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER)
 uint64_t s_microseconds_offset;
 uint64_t s_microseconds_offset;
 #endif
 #endif
 
 
-#ifndef WITH_RTC
+#ifndef CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
 static uint64_t s_boot_time; // when RTC is used to persist time, two RTC_STORE registers are used to store boot time instead
 static uint64_t s_boot_time; // when RTC is used to persist time, two RTC_STORE registers are used to store boot time instead
 #endif
 #endif
 
 
 static _lock_t s_boot_time_lock;
 static _lock_t s_boot_time_lock;
 
 
-#if defined( WITH_FRC ) || defined( WITH_RTC )
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER ) || defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
 uint64_t esp_time_impl_get_time_since_boot(void)
 uint64_t esp_time_impl_get_time_since_boot(void)
 {
 {
     uint64_t microseconds = 0;
     uint64_t microseconds = 0;
 
 
-#ifdef WITH_FRC
-#ifdef WITH_RTC
+#ifdef CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER
+#ifdef CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
     microseconds = s_microseconds_offset + esp_system_get_time();
     microseconds = s_microseconds_offset + esp_system_get_time();
 #else
 #else
     microseconds = esp_system_get_time();
     microseconds = esp_system_get_time();
-#endif // WITH_RTC
-#elif defined(WITH_RTC)
+#endif // CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
+#elif defined(CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER)
     microseconds = esp_rtc_get_time_us();
     microseconds = esp_rtc_get_time_us();
-#endif // WITH_FRC
+#endif // CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER
     return microseconds;
     return microseconds;
 }
 }
 
 
 uint64_t esp_time_impl_get_time(void)
 uint64_t esp_time_impl_get_time(void)
 {
 {
     uint64_t microseconds = 0;
     uint64_t microseconds = 0;
-#if defined( WITH_FRC )
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER )
     microseconds = esp_system_get_time();
     microseconds = esp_system_get_time();
-#elif defined( WITH_RTC )
+#elif defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
     microseconds = esp_rtc_get_time_us();
     microseconds = esp_rtc_get_time_us();
-#endif // WITH_FRC
+#endif // CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER
     return microseconds;
     return microseconds;
 }
 }
 
 
-#endif // defined( WITH_FRC ) || defined( WITH_RTC )
+#endif // defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER ) || defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
 
 
 
 
 void esp_time_impl_set_boot_time(uint64_t time_us)
 void esp_time_impl_set_boot_time(uint64_t time_us)
 {
 {
     _lock_acquire(&s_boot_time_lock);
     _lock_acquire(&s_boot_time_lock);
-#ifdef WITH_RTC
+#ifdef CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
     REG_WRITE(RTC_BOOT_TIME_LOW_REG, (uint32_t) (time_us & 0xffffffff));
     REG_WRITE(RTC_BOOT_TIME_LOW_REG, (uint32_t) (time_us & 0xffffffff));
     REG_WRITE(RTC_BOOT_TIME_HIGH_REG, (uint32_t) (time_us >> 32));
     REG_WRITE(RTC_BOOT_TIME_HIGH_REG, (uint32_t) (time_us >> 32));
 #else
 #else
@@ -114,7 +100,7 @@ void esp_time_impl_set_boot_time(uint64_t time_us)
 
 
 uint64_t esp_clk_rtc_time(void)
 uint64_t esp_clk_rtc_time(void)
 {
 {
-#ifdef WITH_RTC
+#ifdef CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
     return esp_rtc_get_time_us();
     return esp_rtc_get_time_us();
 #else
 #else
     return 0;
     return 0;
@@ -125,7 +111,7 @@ uint64_t esp_time_impl_get_boot_time(void)
 {
 {
     uint64_t result;
     uint64_t result;
     _lock_acquire(&s_boot_time_lock);
     _lock_acquire(&s_boot_time_lock);
-#ifdef WITH_RTC
+#ifdef CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
     result = ((uint64_t) REG_READ(RTC_BOOT_TIME_LOW_REG)) + (((uint64_t) REG_READ(RTC_BOOT_TIME_HIGH_REG)) << 32);
     result = ((uint64_t) REG_READ(RTC_BOOT_TIME_LOW_REG)) + (((uint64_t) REG_READ(RTC_BOOT_TIME_HIGH_REG)) << 32);
 #else
 #else
     result = s_boot_time;
     result = s_boot_time;
@@ -162,7 +148,7 @@ uint64_t esp_rtc_get_time_us(void)
 
 
 void esp_clk_slowclk_cal_set(uint32_t new_cal)
 void esp_clk_slowclk_cal_set(uint32_t new_cal)
 {
 {
-#if defined(WITH_RTC)
+#if defined(CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER)
     /* To force monotonic time values even when clock calibration value changes,
     /* To force monotonic time values even when clock calibration value changes,
      * we adjust boot time, given current time and the new calibration value:
      * we adjust boot time, given current time and the new calibration value:
      *      T = boot_time_old + cur_cal * ticks / 2^19
      *      T = boot_time_old + cur_cal * ticks / 2^19
@@ -176,21 +162,21 @@ void esp_clk_slowclk_cal_set(uint32_t new_cal)
     int64_t boot_time_diff = ticks * cal_diff / (1LL << RTC_CLK_CAL_FRACT);
     int64_t boot_time_diff = ticks * cal_diff / (1LL << RTC_CLK_CAL_FRACT);
     uint64_t boot_time_adj = esp_time_impl_get_boot_time() + boot_time_diff;
     uint64_t boot_time_adj = esp_time_impl_get_boot_time() + boot_time_diff;
     esp_time_impl_set_boot_time(boot_time_adj);
     esp_time_impl_set_boot_time(boot_time_adj);
-#endif // WITH_RTC
+#endif // CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
     REG_WRITE(RTC_SLOW_CLK_CAL_REG, new_cal);
     REG_WRITE(RTC_SLOW_CLK_CAL_REG, new_cal);
 }
 }
 
 
 void esp_set_time_from_rtc(void)
 void esp_set_time_from_rtc(void)
 {
 {
-#if defined( WITH_FRC ) && defined( WITH_RTC )
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER ) && defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
     // initialize time from RTC clock
     // initialize time from RTC clock
     s_microseconds_offset = esp_rtc_get_time_us() - esp_system_get_time();
     s_microseconds_offset = esp_rtc_get_time_us() - esp_system_get_time();
-#endif // WITH_FRC && WITH_RTC
+#endif // CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER && CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER
 }
 }
 
 
 void esp_sync_counters_rtc_and_frc(void)
 void esp_sync_counters_rtc_and_frc(void)
 {
 {
-#if defined( WITH_FRC ) && defined( WITH_RTC )
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER ) && defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
     struct timeval tv;
     struct timeval tv;
     gettimeofday(&tv, NULL);
     gettimeofday(&tv, NULL);
     settimeofday(&tv, NULL);
     settimeofday(&tv, NULL);

+ 9 - 16
components/newlib/test/test_time.c

@@ -336,25 +336,18 @@ TEST_CASE("test time adjustment happens linearly", "[newlib][timeout=35]")
 }
 }
 #endif
 #endif
 
 
-#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 )
-#define WITH_RTC 1
-#endif
-
-#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 )
-#define WITH_FRC 1
-#endif
 void test_posix_timers_clock (void)
 void test_posix_timers_clock (void)
 {
 {
 #ifndef _POSIX_TIMERS
 #ifndef _POSIX_TIMERS
     TEST_ASSERT_MESSAGE(false, "_POSIX_TIMERS - is not defined");
     TEST_ASSERT_MESSAGE(false, "_POSIX_TIMERS - is not defined");
 #endif
 #endif
 
 
-#if defined( WITH_FRC )
-    printf("WITH_FRC    ");
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER )
+    printf("CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER    ");
 #endif
 #endif
 
 
-#if defined( WITH_RTC )
-    printf("WITH_RTC    ");
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
+    printf("CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER    ");
 #endif
 #endif
 
 
 #ifdef CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS
 #ifdef CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS
@@ -371,7 +364,7 @@ void test_posix_timers_clock (void)
     TEST_ASSERT(clock_gettime(CLOCK_MONOTONIC, NULL) == -1);
     TEST_ASSERT(clock_gettime(CLOCK_MONOTONIC, NULL) == -1);
     TEST_ASSERT(clock_getres(CLOCK_MONOTONIC,  NULL) == -1);
     TEST_ASSERT(clock_getres(CLOCK_MONOTONIC,  NULL) == -1);
 
 
-#if defined( WITH_FRC ) || defined( WITH_RTC )
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER ) || defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
     struct timeval now = {0};
     struct timeval now = {0};
     now.tv_sec  = 10L;
     now.tv_sec  = 10L;
     now.tv_usec = 100000L;
     now.tv_usec = 100000L;
@@ -398,7 +391,7 @@ void test_posix_timers_clock (void)
     TEST_ASSERT(clock_settime(CLOCK_MONOTONIC, &ts) == -1);
     TEST_ASSERT(clock_settime(CLOCK_MONOTONIC, &ts) == -1);
 
 
     uint64_t delta_monotonic_us = 0;
     uint64_t delta_monotonic_us = 0;
-#if defined( WITH_FRC )
+#if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER )
 
 
     TEST_ASSERT(clock_getres(CLOCK_REALTIME, &ts) == 0);
     TEST_ASSERT(clock_getres(CLOCK_REALTIME, &ts) == 0);
     TEST_ASSERT_EQUAL_INT(1000, ts.tv_nsec);
     TEST_ASSERT_EQUAL_INT(1000, ts.tv_nsec);
@@ -410,7 +403,7 @@ void test_posix_timers_clock (void)
     TEST_ASSERT(delta_monotonic_us > 0 || delta_monotonic_us == 0);
     TEST_ASSERT(delta_monotonic_us > 0 || delta_monotonic_us == 0);
     TEST_ASSERT_INT_WITHIN(5000L, 0, delta_monotonic_us);
     TEST_ASSERT_INT_WITHIN(5000L, 0, delta_monotonic_us);
 
 
-    #elif defined( WITH_RTC )
+#elif defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
 
 
     TEST_ASSERT(clock_getres(CLOCK_REALTIME, &ts) == 0);
     TEST_ASSERT(clock_getres(CLOCK_REALTIME, &ts) == 0);
     TEST_ASSERT_EQUAL_INT(1000000000L / rtc_clk_slow_freq_get_hz(), ts.tv_nsec);
     TEST_ASSERT_EQUAL_INT(1000000000L / rtc_clk_slow_freq_get_hz(), ts.tv_nsec);
@@ -422,7 +415,7 @@ void test_posix_timers_clock (void)
     TEST_ASSERT(delta_monotonic_us > 0 || delta_monotonic_us == 0);
     TEST_ASSERT(delta_monotonic_us > 0 || delta_monotonic_us == 0);
     TEST_ASSERT_INT_WITHIN(5000L, 0, delta_monotonic_us);
     TEST_ASSERT_INT_WITHIN(5000L, 0, delta_monotonic_us);
 
 
-#endif // WITH_FRC
+#endif // CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER
 
 
 #else
 #else
     struct timespec ts = {0};
     struct timespec ts = {0};
@@ -433,7 +426,7 @@ void test_posix_timers_clock (void)
     TEST_ASSERT(clock_settime(CLOCK_MONOTONIC, &ts) == -1);
     TEST_ASSERT(clock_settime(CLOCK_MONOTONIC, &ts) == -1);
     TEST_ASSERT(clock_gettime(CLOCK_MONOTONIC, &ts) == -1);
     TEST_ASSERT(clock_gettime(CLOCK_MONOTONIC, &ts) == -1);
     TEST_ASSERT(clock_getres(CLOCK_MONOTONIC,  &ts) == -1);
     TEST_ASSERT(clock_getres(CLOCK_MONOTONIC,  &ts) == -1);
-#endif // defined( WITH_FRC ) || defined( WITH_RTC )
+#endif // defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER ) || defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER )
 }
 }
 
 
 TEST_CASE("test posix_timers clock_... functions", "[newlib]")
 TEST_CASE("test posix_timers clock_... functions", "[newlib]")

+ 1 - 1
components/newlib/time.c

@@ -42,7 +42,7 @@ _Static_assert(sizeof(time_t) == 8, "The toolchain does not support time_t wide
 _Static_assert(sizeof(time_t) == 4, "The toolchain supports time_t wide 64-bits. Please enable CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS.");
 _Static_assert(sizeof(time_t) == 4, "The toolchain supports time_t wide 64-bits. Please enable CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS.");
 #endif
 #endif
 
 
-#if !CONFIG_ESP32_TIME_SYSCALL_USE_NONE && !CONFIG_ESP32S2_TIME_SYSCALL_USE_NONE
+#if !CONFIG_ESP_TIME_FUNCS_USE_NONE
 #define IMPL_NEWLIB_TIME_FUNCS 1
 #define IMPL_NEWLIB_TIME_FUNCS 1
 #endif
 #endif