forked from SharpCoder/rpi-kernel
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkmain.cpp
More file actions
executable file
·85 lines (65 loc) · 1.84 KB
/
Copy pathkmain.cpp
File metadata and controls
executable file
·85 lines (65 loc) · 1.84 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// *******************************
// FILE: kmain.cpp
// AUTHOR: SharpCoder
// DATE: 2012-03-18
// ABOUT: This is the entry point for my C++ based
// raspberry pi kernel.
//
// LICENSE: Provided "AS IS". USE AT YOUR OWN RISK.
// *******************************
#include "irq.cpp"
#include "raspberrylib.cpp"
#include "gpu2d.cpp"
#include "console.cpp"
// Include the meta data generate at compile time
// #include "meta.h"
#include "mem.h"
#include "math.h"
#include "meta.h"
using namespace RaspberryLib;
// Define any functions.
void print_header( Console* console );
// Define the entry point for our application.
// Note: It must be marked as "extern" in order for the linker
// to see it properly.
extern "C" void kmain( void ) {
// Create a canvas.
gpu2dCanvas canvas(false);
// Create a console.
Console console(&canvas);
// Wire up the interrupts.
irq_console = &console;
use_irq_console = true;
// Draw to the console.
print_header( &console );
console.kprint("Waiting: ");
int index;
for(index = 18; index > 0; index-- ) {
console.kprint(".");
Wait( 300 );
}
console.kprint("\n[STARTING]\n\n");
// Initialize memory management first.
init_page_table();
console.kout("Initialized page table");
// Turn on the green light to signify the end
// of our initial kernel code.
irq_enable();
Wait(500);
console.kout("Interrupt vectors ENABLED");
console.kprint("About to throw an SWI exception...\n");
Wait( 5000 );
irq_test();
Wait(500);
console.kout("SWI Exception Thrown");
SetGPIO( 16, 1 );
console.kprint("\n\nKernel shutting down...");
return;
}
void print_header( Console* console ) {
meta info = getBuildInfo();
console->kprint("Welcome to Mindflayer, a custom raspberry pi kernel written in C++\n");
console->kprint("Build: ");
console->kprint( info.VERSION );
console->kprint("\n\n\n");
}