diff options
author | Keith Packard <keithp@keithp.com> | 2016-06-28 17:04:59 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-06-29 19:17:45 -0700 |
commit | a7e0bb5eb661cfde31c383d605cb9cb8ca568bc7 (patch) | |
tree | cd6906fcb623ce67f4bef9799b98d8d7096db7b2 /src/stm/ao_arch_funcs.h | |
parent | 40abb0d1e2f43a60ffa34b055ebb913ee3e20faf (diff) |
altos: Block interrupts while waking tasks sleeping on timers.
Interrupts may not be blocked in the timer ISR, but they need to be
while walking the pending timer list and moving tasks back to the run
queue.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_arch_funcs.h')
-rw-r--r-- | src/stm/ao_arch_funcs.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index 2c017c79..33359857 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -343,6 +343,14 @@ ao_arch_memory_barrier() { asm volatile("" ::: "memory"); } +static inline void +ao_arch_irq_check(void) { + uint32_t primask; + asm("mrs %0,primask" : "=&r" (primask)); + if ((primask & 1) == 0) + ao_panic(AO_PANIC_IRQ); +} + #if HAS_TASK static inline void ao_arch_init_stack(struct ao_task *task, void *start) |