kosmos/source/firmware/kernel/schedule.c

39 lines
717 B
C
Raw Permalink Normal View History

2016-07-28 19:02:54 +00:00
/*
* schedule.c
*
* Created on: Feb 20, 2015
* Author: tkl
*/
#include <stdbool.h>
#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;
2016-08-16 07:33:49 +00:00
static stack_t idle_stack[22];
2016-07-28 19:02:54 +00:00
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();
}