From ccf0faa7d26d56deca7928b521d07be40504466a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 Oct 2012 13:40:54 -0700 Subject: altos: Leave interrupts disabled while checking for task to run Otherwise, we run the risk of an interrupt waking a task after we've decided to idle the CPU. Signed-off-by: Keith Packard --- src/stm/ao_arch_funcs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/stm') diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index ca451a53..d6ab1465 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -299,8 +299,10 @@ static inline void ao_arch_restore_stack(void) { #define ao_arch_isr_stack() -#define ao_arch_cpu_idle() do { \ +#define ao_arch_wait_interrupt() do { \ asm(".global ao_idle_loc\n\twfi\nao_idle_loc:"); \ + ao_arch_release_interrupts(); \ + ao_arch_block_interrupts(); \ } while (0) #define ao_arch_critical(b) do { \ -- cgit v1.2.3