同步 patch_uapi_calendar_get_timestamp.zip,修复RC时间保存不准问题
authorSnickerSun <snickersun@163.com>
Wed, 12 Jun 2024 13:01:44 +0000 (21:01 +0800)
committerSnickerSun <snickersun@163.com>
Wed, 12 Jun 2024 13:01:44 +0000 (21:01 +0800)
code/sdk/application/brandy/brandy_standard/chip_init.c
code/sdk/drivers/chips/brandy/porting/button/button_porting.c
code/sdk/drivers/chips/brandy/porting/include/button_porting.h
code/sdk/drivers/drivers/hal/calendar/hal_calendar_hw.c
code/sdk/middleware/chips/brandy/exception/chip_system_time.c

index bf42362..af0324d 100755 (executable)
@@ -192,4 +192,6 @@ void chip_init(void)
     pmu_control_cldo1_sleep_bypass(TURN_OFF);\r
 #endif\r
     chip_get_tempe();\r
+\r
+    uapi_ulp_systick_soc_calibration();\r
 }
\ No newline at end of file
index 2487a60..448e4ef 100755 (executable)
@@ -89,6 +89,11 @@ uint32_t uapi_ulp_systick_soc_calibration(void)
     return g_clock_ulp;
 }
 
+uint32_t uapi_ulp_systick_get_frequency(void)
+{
+    return g_clock_ulp;
+}
+
 uint64_t uapi_ulp_systick_get_ms(void)
 {
     uint64_t count = 0;
index d5ab5f1..f43eedc 100755 (executable)
@@ -100,6 +100,9 @@ bool  uapi_get_charger_plug_status(void);
  * @brief  RC32K clock calibration. Do not call this API when the clock is in use.
  */
 uint32_t uapi_ulp_systick_soc_calibration(void);
+
+uint32_t uapi_ulp_systick_get_frequency(void);
+
 /**
  * @}
  */
index 5156f87..94e1025 100755 (executable)
@@ -44,7 +44,7 @@ static uint64_t hal_calendar_get_timestamp(void)
     cnt_h = hal_calendar_get_cnt_h();\r
     counter = (cnt_h << HAL_CLC_H_OFFSET) | cnt_l;\r
     timeout = ((uapi_ulp_systick_get_count() - counter) * (MS_PER_S * CALIBRATION_CLOCK_MUL)) /\r
-               uapi_ulp_systick_soc_calibration();\r
+               uapi_ulp_systick_get_frequency();\r
     timestamp = ((data_h << HAL_CLC_H_OFFSET) | data_l) + timeout;\r
 \r
     /* get时补偿刷新 */\r
index 3ca6d5c..e3ce9be 100644 (file)
@@ -95,7 +95,6 @@ void get_current_time(struct timeval *tv, struct tm *tm)
 
 void restore_time(void)
 {
-    uapi_ulp_systick_soc_calibration();
     calendar_t date;
     uapi_calendar_get_datetime(&date);
     print_time(&date);