-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkernel.h
46 lines (38 loc) · 1.46 KB
/
kernel.h
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
36
37
38
39
40
41
42
43
44
45
46
//*****************************************************************************
// EXAMPLE: Scheduling a function at 1hz
//*****************************************************************************
//
// void testFunc(void)
// {
// updateDisplay(0, 0, 0, 0);
// }
//
// int main(void)
// {
// Process processes[1] = {*testFunc, 1};
// runKernel(processes, 1);
// }
//
//*****************************************************************************
#ifndef KERNEL_H_
#define KERNEL_H_
#include <stdint.h>
#include <stdbool.h>
//*****************************************************************************
// Constants
//*****************************************************************************
#define KERNEL_MAX_RATE 0
//*****************************************************************************
// Structure to represent a process
//*****************************************************************************
typedef struct Process {
void (*handler)(void); // The function handler for the process.
uint32_t rate; // The rate in HZ to try and schedule the task at.
uint64_t lastRunRef; // Set automatically when the function is run.
} Process;
//*****************************************************************************
// Function declarations
//*****************************************************************************
bool shouldRunProcess(Process process);
void runKernel(Process processes[], int n);
#endif /* KERNEL_H_ */