rtc/rpmsg: Add sync parameter to control whether call clock_synchronize

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-01-15 14:29:47 +08:00 committed by Petro Karashchenko
parent 6121f15d51
commit 41b9cf3cd8
4 changed files with 9 additions and 6 deletions

View File

@ -128,6 +128,6 @@ int up_rtc_initialize(void)
#ifdef CONFIG_RTC_RPMSG_SERVER
rtc = rpmsg_rtc_server_initialize(rtc);
#endif
up_rtc_set_lowerhalf(rtc);
up_rtc_set_lowerhalf(rtc, true);
return rtc_initialize(0, rtc);
}

View File

@ -450,7 +450,7 @@ int sim_bringup(void)
#if defined(CONFIG_RTC_RPMSG) && !defined(CONFIG_RTC_RPMSG_SERVER)
rtc = rpmsg_rtc_initialize();
up_rtc_set_lowerhalf(rtc);
up_rtc_set_lowerhalf(rtc, true);
rtc_initialize(0, rtc);
#endif

View File

@ -50,13 +50,16 @@ volatile bool g_rtc_enabled = false;
* Public Functions
****************************************************************************/
void up_rtc_set_lowerhalf(FAR struct rtc_lowerhalf_s *lower)
void up_rtc_set_lowerhalf(FAR struct rtc_lowerhalf_s *lower, bool sync)
{
g_rtc_lower = lower;
g_rtc_enabled = true;
#ifdef CONFIG_RTC_EXTERNAL
if (sync)
{
clock_synchronize();
}
#endif
}

View File

@ -42,11 +42,11 @@ extern "C"
#ifdef CONFIG_RTC_ARCH
void up_rtc_set_lowerhalf(FAR struct rtc_lowerhalf_s *lower);
void up_rtc_set_lowerhalf(FAR struct rtc_lowerhalf_s *lower, bool sync);
#else
# define up_rtc_set_lowerhalf(lower)
# define up_rtc_set_lowerhalf(lower, sync)
#endif /* CONFIG_RTC_ARCH */