engine_control/source/firmware/kernel/schedule.c
2016-07-23 07:59:54 +02:00

38 lines
740 B
C
Executable File

/*
* schedule.c
*
* Created on: Feb 20, 2015
* Author: tkl
*/
#include <stdbool.h>
#include "board.h"
#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"
extern volatile struct thread_list threads;
volatile struct thread_context *current_thread;
static struct thread_context idle_task;
static stack_t idle_stack[22]; /* 30 didn't work with tx test app. why? */
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();
}