2016-07-28 19:02:54 +00:00
|
|
|
/*
|
|
|
|
* schedule.c
|
|
|
|
*
|
|
|
|
* Created on: Feb 20, 2015
|
|
|
|
* Author: tkl
|
|
|
|
*/
|
|
|
|
#include <stdbool.h>
|
2016-07-29 04:54:34 +00:00
|
|
|
#include <stddef.h>
|
2016-07-28 19:02:54 +00:00
|
|
|
|
|
|
|
#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]; /* 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();
|
|
|
|
}
|