rtc: move preinit call to RTC_Initialise()

This commit is contained in:
Miroslav Lichvar 2014-08-18 11:25:16 +02:00
parent c52e9085d1
commit c6e064200d
3 changed files with 9 additions and 20 deletions

6
main.c
View file

@ -452,16 +452,12 @@ int main
* be done *AFTER* the daemon-creation fork() */ * be done *AFTER* the daemon-creation fork() */
write_lockfile(); write_lockfile();
if (do_init_rtc) {
RTC_TimePreInit();
}
LCL_Initialise(); LCL_Initialise();
SCH_Initialise(); SCH_Initialise();
SYS_Initialise(); SYS_Initialise();
NIO_Initialise(address_family); NIO_Initialise(address_family);
CAM_Initialise(address_family); CAM_Initialise(address_family);
RTC_Initialise(); RTC_Initialise(do_init_rtc);
SRC_Initialise(); SRC_Initialise();
RCL_Initialise(); RCL_Initialise();
KEY_Initialise(); KEY_Initialise();

20
rtc.c
View file

@ -74,10 +74,16 @@ static struct {
/* ================================================== */ /* ================================================== */
void void
RTC_Initialise(void) RTC_Initialise(int initial_set)
{ {
char *file_name; char *file_name;
/* Do an initial read of the RTC and set the system time to it. This
is analogous to what /sbin/hwclock -s would do on Linux. */
if (initial_set && driver.time_pre_init) {
(driver.time_pre_init)();
}
driver_initialised = 0; driver_initialised = 0;
/* This is how we tell whether the user wants to load the RTC /* This is how we tell whether the user wants to load the RTC
@ -130,18 +136,6 @@ RTC_TimeInit(void (*after_hook)(void *), void *anything)
} }
} }
/* ================================================== */
/* Do an initial read of the RTC and set the system time to it. This
is analogous to what /sbin/hwclock -s would do on Linux. */
void
RTC_TimePreInit(void)
{
if (driver.time_pre_init) {
(driver.time_pre_init)();
}
}
/* ================================================== */ /* ================================================== */
/* Start the RTC measurement process */ /* Start the RTC measurement process */

3
rtc.h
View file

@ -28,9 +28,8 @@
#include "reports.h" #include "reports.h"
extern void RTC_Initialise(void); extern void RTC_Initialise(int initial_set);
extern void RTC_Finalise(void); extern void RTC_Finalise(void);
extern void RTC_TimePreInit(void);
extern void RTC_TimeInit(void (*after_hook)(void *), void *anything); extern void RTC_TimeInit(void (*after_hook)(void *), void *anything);
extern void RTC_StartMeasurements(void); extern void RTC_StartMeasurements(void);
extern int RTC_GetReport(RPT_RTC_Report *report); extern int RTC_GetReport(RPT_RTC_Report *report);