nanokernel: add interface for obtaining earliest timer deadline
This interface can be called by the microkernel to obtain the earliest expiring nanokernel between the timers and timeouts, to allow the idle code to take the correct decision w.r.t. tickless idle. Change-Id: I9598ec2a0dd013a6a8ccc95d50105bb98ca27f54 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
f5f09608f9
commit
101fee8dde
1 changed files with 23 additions and 0 deletions
|
@ -249,4 +249,27 @@ void _nano_sys_clock_tick_announce(uint32_t ticks)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* get closest nano timers deadline expiry, (uint32_t)TICKS_UNLIMITED if none */
|
||||
#ifdef CONFIG_NANO_TIMERS
|
||||
static inline uint32_t _nano_get_earliest_timers_deadline(void)
|
||||
{
|
||||
return _nano_timer_list ? _nano_timer_list->ticks : TICKS_UNLIMITED;
|
||||
}
|
||||
#else
|
||||
static inline uint32_t _nano_get_earliest_timers_deadline(void)
|
||||
{
|
||||
return TICKS_UNLIMITED;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get closest nano timeouts/timers deadline expiry, (uint32_t)TICKS_UNLIMITED
|
||||
* if none.
|
||||
*/
|
||||
uint32_t _nano_get_earliest_deadline(void)
|
||||
{
|
||||
return min(_nano_get_earliest_timeouts_deadline(),
|
||||
_nano_get_earliest_timers_deadline());
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NANOKERNEL */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue