Kernel/task.c

26 lines
No EOL
472 B
C

#include "task.h"
task_t tasks[MAX_TASKS];
int current_task = 0;
void task1() {
while (1);
}
void task2() {
while (1);
}
void task_init() {
tasks[0].context.sp = (unsigned int)&tasks[0].stack[255];
tasks[0].context.lr = (unsigned int)task1;
tasks[1].context.sp = (unsigned int)&tasks[1].stack[255];
tasks[1].context.lr = (unsigned int)task2;
current_task = 0;
}
void task_schedule() {
current_task = (current_task + 1) % MAX_TASKS;
}