rpmsg_rtc: merge the rpmsg_rtc_init to same place

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-01-17 11:49:48 +08:00 committed by Xiang Xiao
parent 4e1df81fa8
commit 0a51f13ca5
4 changed files with 9 additions and 14 deletions

View file

@ -124,10 +124,14 @@ static bool sim_rtc_havesettime(FAR struct rtc_lowerhalf_s *lower)
int up_rtc_initialize(void)
{
FAR struct rtc_lowerhalf_s *rtc = &g_sim_rtc;
bool sync = true;
#ifdef CONFIG_RTC_RPMSG_SERVER
rtc = rpmsg_rtc_server_initialize(rtc);
#elif defined(CONFIG_RTC_RPMSG)
rtc = rpmsg_rtc_initialize();
sync = false;
#endif
up_rtc_set_lowerhalf(rtc, true);
up_rtc_set_lowerhalf(rtc, sync);
return rtc_initialize(0, rtc);
}

View file

@ -44,9 +44,7 @@
#include <nuttx/sensors/wtgahrs2.h>
#include <nuttx/serial/uart_rpmsg.h>
#include <nuttx/syslog/syslog_rpmsg.h>
#include <nuttx/timers/arch_rtc.h>
#include <nuttx/timers/oneshot.h>
#include <nuttx/timers/rpmsg_rtc.h>
#include <nuttx/video/fb.h>
#include <nuttx/timers/oneshot.h>
#include <nuttx/wireless/pktradio.h>
@ -104,9 +102,6 @@ int sim_bringup(void)
#endif
#ifdef CONFIG_SIM_SPI
FAR struct spi_dev_s *spidev;
#endif
#if defined(CONFIG_RTC_RPMSG) && !defined(CONFIG_RTC_RPMSG_SERVER)
FAR struct rtc_lowerhalf_s *rtc;
#endif
int ret = OK;
@ -448,12 +443,6 @@ int sim_bringup(void)
syslog_rpmsg_server_init();
#endif
#if defined(CONFIG_RTC_RPMSG) && !defined(CONFIG_RTC_RPMSG_SERVER)
rtc = rpmsg_rtc_initialize();
up_rtc_set_lowerhalf(rtc, true);
rtc_initialize(0, rtc);
#endif
#if defined(CONFIG_FS_RPMSGFS) && defined(CONFIG_SIM_RPTUN_MASTER)
rpmsgfs_server_init();
#endif

View file

@ -2321,7 +2321,7 @@ size_t up_check_intstack_remain(void);
*
****************************************************************************/
#if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL)
#if defined(CONFIG_RTC)
int up_rtc_initialize(void);
#endif

View file

@ -202,17 +202,19 @@ void clock_initialize(void)
up_timer_initialize();
#endif
#if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL)
#if defined(CONFIG_RTC)
/* Initialize the internal RTC hardware. Initialization of external RTC
* must be deferred until the system has booted.
*/
up_rtc_initialize();
#if !defined(CONFIG_RTC_EXTERNAL)
/* Initialize the time value to match the RTC */
clock_inittime();
#endif
#endif
}
/****************************************************************************