timer: Make sure to reset the timer repeat checks on a shutdown
Reset the timer repeat checks on shutdown, otherwise it is possible to get into an infinite shutdown loop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
f8b0c884b0
commit
2b735daae5
|
@ -95,15 +95,6 @@ timer_init(void)
|
|||
}
|
||||
DECL_INIT(timer_init);
|
||||
|
||||
static void
|
||||
timer_shutdown(void)
|
||||
{
|
||||
// Reenable timer irq
|
||||
timer_set(timer_get() + 50);
|
||||
TIFR1 = 1<<OCF1A;
|
||||
}
|
||||
DECL_SHUTDOWN(timer_shutdown);
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* 32bit timer wrappers
|
||||
|
@ -208,3 +199,13 @@ timer_task(void)
|
|||
irq_enable();
|
||||
}
|
||||
DECL_TASK(timer_task);
|
||||
|
||||
static void
|
||||
timer_shutdown(void)
|
||||
{
|
||||
// Reenable timer irq
|
||||
timer_set(timer_get() + 50);
|
||||
TIFR1 = 1<<OCF1A;
|
||||
timer_repeat_set(timer_get() + TIMER_IDLE_REPEAT_TICKS);
|
||||
}
|
||||
DECL_SHUTDOWN(timer_shutdown);
|
||||
|
|
|
@ -94,3 +94,10 @@ timer_task(void)
|
|||
irq_enable();
|
||||
}
|
||||
DECL_TASK(timer_task);
|
||||
|
||||
static void
|
||||
timer_irq_shutdown(void)
|
||||
{
|
||||
timer_repeat_until = timer_read_time() + TIMER_IDLE_REPEAT_TICKS;
|
||||
}
|
||||
DECL_SHUTDOWN(timer_irq_shutdown);
|
||||
|
|
Loading…
Reference in New Issue