]> granicus.if.org Git - esp-idf/commitdiff
newlib: rename esp_setup_time_syscalls to esp_set_time_from_rtc
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 29 Aug 2017 03:48:18 +0000 (11:48 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Fri, 1 Sep 2017 02:36:14 +0000 (10:36 +0800)
This function no longer sets up syscalls, and new name reflects its
purpose better.

components/esp32/cpu_start.c
components/esp32/sleep_modes.c
components/newlib/platform_include/esp_newlib.h
components/newlib/time.c

index 86af32b6908171378fd740b47973e96d522070b3..9f3a3bb22a81e8f82b94835d11106fb7ac7f5c5a 100644 (file)
@@ -268,7 +268,7 @@ void start_cpu0_default(void)
     _GLOBAL_REENT->_stderr = (FILE*) &__sf_fake_stderr;
 #endif
     esp_timer_init();
-    esp_setup_time_syscalls();
+    esp_set_time_from_rtc();
 #if CONFIG_ESP32_APPTRACE_ENABLE
     esp_err_t err = esp_apptrace_init();
     if (err != ESP_OK) {
index 3c9a8484d18451c994087c7558e71ce80860deca..9cf88672267f1af74c3ebb839eaa11b1b4b4ba55 100644 (file)
@@ -248,7 +248,7 @@ esp_err_t esp_light_sleep_start()
 
     // At this point, if FRC1 is used for timekeeping, time will be lagging behind.
     // This will update the microsecond count based on RTC timer.
-    esp_setup_time_syscalls();
+    esp_set_time_from_rtc();
 
     // However, we do not advance RTOS ticks here; doing so would be rather messy,
     // as ticks can only be advanced on CPU0.
index eac3544259c3c8598203be359a8b1827073b78c9..192844393b05557c6340b53316ea18475bcd625d 100644 (file)
@@ -34,10 +34,8 @@ void esp_reent_init(struct _reent* r);
 void esp_setup_syscall_table();
 
 /**
- * Initialize hardware timer used as time source for newlib time functions.
- *
- * Called from the startup code, not intended to be called from application.
+ * Update current microsecond time from RTC
  */
-void esp_setup_time_syscalls();
+void esp_set_time_from_rtc();
 
 #endif //__ESP_NEWLIB_H__
index d7eecbfba4ca47e450a32fe0a5627b696ac993cb..1655c0b8e635e63184108ff013466b7c8a0b69b3 100644 (file)
@@ -137,14 +137,12 @@ uint32_t esp_clk_slowclk_cal_get()
     return REG_READ(RTC_SLOW_CLK_CAL_REG);
 }
 
-void esp_setup_time_syscalls()
+void esp_set_time_from_rtc()
 {
-#if defined( WITH_FRC1 )
-#if defined( WITH_RTC )
+#if defined( WITH_FRC1 ) && defined( WITH_RTC )
     // initialize time from RTC clock
     s_microseconds_offset = get_rtc_time_us() - esp_timer_get_time();
-#endif //WITH_RTC
-#endif // WITH_FRC1
+#endif // WITH_FRC1 && WITH_RTC
 }
 
 clock_t IRAM_ATTR _times_r(struct _reent *r, struct tms *ptms)