sched/clock/clock_initialize.c: clock_inittime() needs to be done with CONFIG_SCHED_TICKLESS and clock_initialize should skip clock_inittime() for external RTC case since the RTC isn't ready yet.
This commit is contained in:
parent
f0c5c75042
commit
2bc709d4b9
@ -65,9 +65,9 @@
|
|||||||
|
|
||||||
#ifndef CONFIG_SCHED_TICKLESS
|
#ifndef CONFIG_SCHED_TICKLESS
|
||||||
#ifdef CONFIG_SYSTEM_TIME64
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
volatile uint64_t g_system_timer;
|
volatile uint64_t g_system_timer = INITIAL_SYSTEM_TIMER_TICKS;
|
||||||
#else
|
#else
|
||||||
volatile uint32_t g_system_timer;
|
volatile uint32_t g_system_timer = INITIAL_SYSTEM_TIMER_TICKS;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -170,21 +170,16 @@ static inline int clock_basetime(FAR struct timespec *tp)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_RTC
|
||||||
static void clock_inittime(void)
|
static void clock_inittime(void)
|
||||||
{
|
{
|
||||||
/* (Re-)initialize the time value to match the RTC */
|
/* (Re-)initialize the time value to match the RTC */
|
||||||
|
|
||||||
#ifndef CONFIG_CLOCK_TIMEKEEPING
|
#ifndef CONFIG_CLOCK_TIMEKEEPING
|
||||||
#ifndef CONFIG_RTC_HIRES
|
|
||||||
clock_basetime(&g_basetime);
|
|
||||||
#endif
|
|
||||||
#ifndef CONFIG_SCHED_TICKLESS
|
|
||||||
g_system_timer = INITIAL_SYSTEM_TIMER_TICKS;
|
|
||||||
if (g_system_timer > 0)
|
|
||||||
{
|
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
(void)clock_ticks2time((sclock_t)g_system_timer, &ts);
|
clock_basetime(&g_basetime);
|
||||||
|
clock_systimespec(&ts);
|
||||||
|
|
||||||
/* Adjust base time to hide initial timer ticks. */
|
/* Adjust base time to hide initial timer ticks. */
|
||||||
|
|
||||||
@ -195,12 +190,11 @@ static void clock_inittime(void)
|
|||||||
g_basetime.tv_nsec += NSEC_PER_SEC;
|
g_basetime.tv_nsec += NSEC_PER_SEC;
|
||||||
g_basetime.tv_sec--;
|
g_basetime.tv_sec--;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif /* !CONFIG_SCHED_TICKLESS */
|
|
||||||
#else
|
#else
|
||||||
clock_inittimekeeping();
|
clock_inittimekeeping();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -222,11 +216,11 @@ void clock_initialize(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
up_rtc_initialize();
|
up_rtc_initialize();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize the time value to match the RTC */
|
/* Initialize the time value to match the RTC */
|
||||||
|
|
||||||
clock_inittime();
|
clock_inittime();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user