sched: Implement generic sleep mechanism based on tasks pending
Track when tasks are pending and spin in irq_wait() when no tasks are pending. This improves the mechanism for sleeping the processor - it's simpler for the board specific code and it reduces the possibility of the processor sleeping when tasks are busy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -49,6 +49,7 @@ void
|
||||
irq_wait(void)
|
||||
{
|
||||
asm("slp 1");
|
||||
irq_poll();
|
||||
}
|
||||
|
||||
// Set the next timer wake up time
|
||||
@@ -58,13 +59,6 @@ timer_set(uint32_t value)
|
||||
CT_IEP.TMR_CMP0 = value;
|
||||
}
|
||||
|
||||
// Return the next scheduled wake up time
|
||||
uint32_t
|
||||
timer_get_next(void)
|
||||
{
|
||||
return CT_IEP.TMR_CMP0;
|
||||
}
|
||||
|
||||
// Return the current time (in absolute clock ticks).
|
||||
uint32_t
|
||||
timer_read_time(void)
|
||||
|
||||
Reference in New Issue
Block a user