From 7378690ada37b898abfcb4d73776cfac7e223ee4 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Wed, 12 Jun 2024 21:01:44 +0800 Subject: [PATCH] =?utf8?q?=E5=90=8C=E6=AD=A5=20patch=5Fuapi=5Fcalendar=5Fg?= =?utf8?q?et=5Ftimestamp.zip=EF=BC=8C=E4=BF=AE=E5=A4=8DRC=E6=97=B6?= =?utf8?q?=E9=97=B4=E4=BF=9D=E5=AD=98=E4=B8=8D=E5=87=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- code/sdk/application/brandy/brandy_standard/chip_init.c | 2 ++ .../sdk/drivers/chips/brandy/porting/button/button_porting.c | 5 +++++ .../drivers/chips/brandy/porting/include/button_porting.h | 3 +++ code/sdk/drivers/drivers/hal/calendar/hal_calendar_hw.c | 2 +- .../sdk/middleware/chips/brandy/exception/chip_system_time.c | 1 - 5 files changed, 11 insertions(+), 2 deletions(-) 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); -- 2.17.1