2026-02-08 21:23:47 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stddef.h>
|
2026-02-08 22:06:36 +00:00
|
|
|
#include <drivers/uart.h>
|
|
|
|
|
#include <syscon/syscon.h>
|
2026-02-10 01:21:49 +00:00
|
|
|
#include <kernel/plic.h>
|
2026-02-09 19:33:11 +00:00
|
|
|
#include <kernel/interrupts.h>
|
2026-02-08 23:51:37 +00:00
|
|
|
#include <kernel/memory.h>
|
2026-05-01 23:14:44 +01:00
|
|
|
#include <kernel/timer.h>
|
2026-02-08 21:23:47 +00:00
|
|
|
|
2026-02-09 18:55:51 +00:00
|
|
|
void kmain()
|
|
|
|
|
{
|
2026-02-11 00:12:14 +00:00
|
|
|
zero_bss();
|
2026-02-10 01:21:49 +00:00
|
|
|
plic_init();
|
2026-05-01 23:14:44 +01:00
|
|
|
timer_init();
|
2026-02-10 01:21:49 +00:00
|
|
|
uart_init();
|
2026-02-08 23:51:37 +00:00
|
|
|
page_init();
|
2026-02-10 01:21:49 +00:00
|
|
|
interrupt_init();
|
2026-02-11 00:12:14 +00:00
|
|
|
kputs("----------------------");
|
|
|
|
|
kprintf("Hello, from %s!", "SquidgeOS");
|
|
|
|
|
kputs("----------------------");
|
|
|
|
|
knewline();
|
2026-05-01 23:14:44 +01:00
|
|
|
while (1) {
|
|
|
|
|
uint64_t ticks = timer_get_ms();
|
|
|
|
|
kputchar('T');
|
|
|
|
|
kputchar(':'); // Print "T:1234" every second
|
|
|
|
|
kprint_int(ticks);
|
|
|
|
|
knewline();
|
|
|
|
|
delay_ms(1000);
|
|
|
|
|
}
|
2026-02-08 21:23:47 +00:00
|
|
|
}
|