aboutsummaryrefslogtreecommitdiff
path: root/src/sys/schedule.h
blob: c8e938d9af3767ae04fab31e6547c031cd94e74c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef SYS_SCHEDULE_H
#define SYS_SCHEDULE_H

#define STACK_SIZE 0x1000
struct TaskMemory {
	unsigned long reg[16];
	unsigned char stack[STACK_SIZE];
};

struct Task {
	unsigned char priority;
	void (*task)(void);
};

#ifdef FLAT
struct Scheduler {
	struct Task** tasks;
};
#elseif LL
#include "../lib/ll.h"
struct Scheduler {
	struct LL* tasks;
};
#else
#include "../lib/q.h"
struct Scheduler {
	struct Q_base* tasks;
};
#endif

void add_fxn(void (*task)(void), unsigned char priority);
unsigned int get_task_length(void);
void execute_task(void);

#endif