From: SnickerSun Date: Wed, 12 Jun 2024 13:01:44 +0000 (+0800) Subject: 同步 patch_uapi_calendar_get_timestamp.zip,修复RC时间保存不准问题 X-Git-Tag: release_V1.2.70_20241020_135402~989^2~16 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=7378690ada37b898abfcb4d73776cfac7e223ee4;p=mirrors%2FFD230.git 同步 patch_uapi_calendar_get_timestamp.zip,修复RC时间保存不准问题 --- diff --git a/code/sdk/application/brandy/brandy_standard/chip_init.c b/code/sdk/application/brandy/brandy_standard/chip_init.c index bf42362a5..af0324d93 100755 --- a/code/sdk/application/brandy/brandy_standard/chip_init.c +++ b/code/sdk/application/brandy/brandy_standard/chip_init.c @@ -192,4 +192,6 @@ void chip_init(void) pmu_control_cldo1_sleep_bypass(TURN_OFF); #endif chip_get_tempe(); + + uapi_ulp_systick_soc_calibration(); } \ No newline at end of file diff --git a/code/sdk/drivers/chips/brandy/porting/button/button_porting.c b/code/sdk/drivers/chips/brandy/porting/button/button_porting.c index 2487a60b1..448e4efa5 100755 --- a/code/sdk/drivers/chips/brandy/porting/button/button_porting.c +++ b/code/sdk/drivers/chips/brandy/porting/button/button_porting.c @@ -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; diff --git a/code/sdk/drivers/chips/brandy/porting/include/button_porting.h b/code/sdk/drivers/chips/brandy/porting/include/button_porting.h index d5ab5f19c..f43eedc35 100755 --- a/code/sdk/drivers/chips/brandy/porting/include/button_porting.h +++ b/code/sdk/drivers/chips/brandy/porting/include/button_porting.h @@ -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); + /** * @} */ diff --git a/code/sdk/drivers/drivers/hal/calendar/hal_calendar_hw.c b/code/sdk/drivers/drivers/hal/calendar/hal_calendar_hw.c index 5156f8773..94e1025f2 100755 --- a/code/sdk/drivers/drivers/hal/calendar/hal_calendar_hw.c +++ b/code/sdk/drivers/drivers/hal/calendar/hal_calendar_hw.c @@ -44,7 +44,7 @@ static uint64_t hal_calendar_get_timestamp(void) cnt_h = hal_calendar_get_cnt_h(); counter = (cnt_h << HAL_CLC_H_OFFSET) | cnt_l; timeout = ((uapi_ulp_systick_get_count() - counter) * (MS_PER_S * CALIBRATION_CLOCK_MUL)) / - uapi_ulp_systick_soc_calibration(); + uapi_ulp_systick_get_frequency(); timestamp = ((data_h << HAL_CLC_H_OFFSET) | data_l) + timeout; /* get时补偿刷新 */ diff --git a/code/sdk/middleware/chips/brandy/exception/chip_system_time.c b/code/sdk/middleware/chips/brandy/exception/chip_system_time.c index 3ca6d5c3d..e3ce9be13 100644 --- a/code/sdk/middleware/chips/brandy/exception/chip_system_time.c +++ b/code/sdk/middleware/chips/brandy/exception/chip_system_time.c @@ -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);