diff options
Diffstat (limited to 'core/cortex-m0/task.c')
-rw-r--r-- | core/cortex-m0/task.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c index 9d9b049c37..0a229fcbde 100644 --- a/core/cortex-m0/task.c +++ b/core/cortex-m0/task.c @@ -126,9 +126,11 @@ static task_ *current_task = (task_ *)scratchpad; /* * Bitmap of all tasks ready to be run. * - * Currently all tasks are enabled at startup. + * Start off with only the hooks task marked as ready such that all the modules + * can do their init within a task switching context. The hooks task will then + * make a call to enable all tasks. */ -static uint32_t tasks_ready = (1<<TASK_ID_COUNT) - 1; +static uint32_t tasks_ready = (1 << TASK_ID_HOOKS); static int start_called; /* Has task swapping started */ @@ -432,6 +434,14 @@ uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us) return events & event_mask; } +void task_enable_all_tasks(void) +{ + /* Mark all tasks as ready to run. */ + tasks_ready = (1 << TASK_ID_COUNT) - 1; + /* Reschedule the highest priority task. */ + __schedule(0, 0); +} + void task_enable_irq(int irq) { CPU_NVIC_EN(0) = 1 << irq; |