32 lines
No EOL
633 B
C
32 lines
No EOL
633 B
C
#include "uart.h"
|
|
#include "task.h"
|
|
#include "shell.h"
|
|
|
|
#define TIMER_BASE 0x101E2000
|
|
#define TIMER_LOAD (*(volatile unsigned int *)(TIMER_BASE + 0x00))
|
|
#define TIMER_CTRL (*(volatile unsigned int *)(TIMER_BASE + 0x08))
|
|
|
|
void timer_init() {
|
|
TIMER_LOAD = 0x10000;
|
|
TIMER_CTRL = (1 << 7) | (1 << 6) | (1 << 5) | 1;
|
|
}
|
|
|
|
void enable_interrupts() {
|
|
__asm__ volatile (
|
|
"mrs r0, cpsr\n"
|
|
"bic r0, r0, #0x80\n"
|
|
"msr cpsr_c, r0\n"
|
|
);
|
|
}
|
|
|
|
void kernel_main(void) {
|
|
uart_init();
|
|
uart_write("MiniOS Kernel Booted\n");
|
|
|
|
timer_init();
|
|
enable_interrupts();
|
|
|
|
task_init();
|
|
|
|
shell_run();
|
|
} |