diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kernel/ao.h | 1 | ||||
| -rw-r--r-- | src/kernel/ao_task.c | 15 | ||||
| -rw-r--r-- | src/stm/ao_arch_funcs.h | 8 | 
3 files changed, 17 insertions, 7 deletions
| diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 6ed0299e..27a16606 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -73,6 +73,7 @@ typedef AO_PORT_TYPE ao_port_t;  #define AO_PANIC_EXTI		16	/* Mis-using exti API */  #define AO_PANIC_FAST_TIMER	17	/* Mis-using fast timer API */  #define AO_PANIC_ADC		18	/* Mis-using ADC interface */ +#define AO_PANIC_IRQ		19	/* interrupts not blocked */  #define AO_PANIC_SELF_TEST_CC1120	0x40 | 1	/* Self test failure */  #define AO_PANIC_SELF_TEST_HMC5883	0x40 | 2	/* Self test failure */  #define AO_PANIC_SELF_TEST_MPU6000	0x40 | 3	/* Self test failure */ diff --git a/src/kernel/ao_task.c b/src/kernel/ao_task.c index e430edc6..03d69caa 100644 --- a/src/kernel/ao_task.c +++ b/src/kernel/ao_task.c @@ -165,13 +165,14 @@ ao_task_check_alarm(uint16_t tick)  {  	struct ao_task	*alarm, *next; -	ao_list_for_each_entry_safe(alarm, next, &alarm_queue, struct ao_task, alarm_queue) { -		if ((int16_t) (tick - alarm->alarm) < 0) -			break; -		alarm->alarm = 0; -		ao_task_from_alarm_queue(alarm); -		ao_task_to_run_queue(alarm); -	} +	ao_arch_critical( +		ao_list_for_each_entry_safe(alarm, next, &alarm_queue, struct ao_task, alarm_queue) { +			if ((int16_t) (tick - alarm->alarm) < 0) +				break; +			alarm->alarm = 0; +			ao_task_from_alarm_queue(alarm); +			ao_task_to_run_queue(alarm); +		});  }  void 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) | 
