-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkernel.c
More file actions
62 lines (51 loc) · 823 Bytes
/
kernel.c
File metadata and controls
62 lines (51 loc) · 823 Bytes
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "hw.h"
#include "vmem.h"
#include "kalloc.h"
#include "sched.h"
#include "syscall.h"
#include "fb.h"
void ledOn() {
int cptA = 0;
while(1) {
cptA++;
hw_led_on();
}
}
void ledOff() {
int cptB = 0;
while(1) {
cptB++;
hw_led_off();
}
}
void red() {
while(1) {
drawRed();
}
}
void blue() {
while(1) {
drawBlue();
}
}
bool fb_init() {
FramebufferInitialize();
return true;
}
bool kinit() {
return hw_init() &&
vmem_setup() &&
kalloc_setup() &&
fb_init() &&
sched_new_proc(ledOn, NULL, STACK_SIZE, 99) &&
sched_new_proc(ledOff, NULL, STACK_SIZE, 95) &&
sched_new_proc(red, NULL, STACK_SIZE, 99) &&
sched_new_proc(blue, NULL, STACK_SIZE, 95) &&
sched_start();
}
int kmain(void) {
if(kinit()) {
return 0;
}
return 1;
}