/* * schedule.c * * Created on: Feb 20, 2015 * Author: tkl */ #include #include #include "ctx.h" #include "cpu.h" #include "stack.h" #include "queue.h" #include "thread.h" #include "irq.h" #include "schedule.h" #include "low_power.h" #include "kernel.h" extern volatile struct thread_list threads; volatile struct thread_context *current_thread; static struct thread_context idle_task; static stack_t idle_stack[22]; void idle_func(void *arg) { while(1) { enter_low_power(); } } void schedule_start(void) { thread_create(&idle_task, idle_stack, sizeof(idle_stack), idle_func, NULL, THREAD_PRIO_IDLE); current_thread = threads.list[0]; enable_irq(); start_first_task(); }