summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-06-17 13:05:15 -0500
committerNathan Lee <me@nwlee.tech>2026-06-17 13:05:15 -0500
commitb106df2447d23d6b3fcffa7cc87edde218d054f3 (patch)
tree85b01191beada41b85bc391482cee7294b73f89b /kernel/kernel.c
parent2fb81f37d20fd442d1954a7356e3ab7f88314a9c (diff)
create wdt device discovery
discuss: per wrv32em status, consider moving custom wdt format to dtb or pci device discovery (potentially both: we have the framework for pci.ko extension after using dtb to discover memory and pci devices)
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 753f4a5..3dbf0d1 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -1,3 +1,5 @@
+#include <types.h>
+#include <wdt.h>
#define UART_BASE 0x10000000 // Example UART address
static inline void putchar(char c) {
@@ -11,10 +13,19 @@ static void print_string(const char *str) {
}
}
-void kernel_main(void) {
- print_string("Hello from RISC-V kernel!\n");
-
- while (1) {
- // Wait
+void kernel_main(void *wdt) {
+ struct wdt_root *root = wdt;
+ print_string("deserialized all!\n");
+ uint32_t count = root->count;
+ for (uint32_t i = 0; i < count; i++) {
+ print_string("deserializing wdt node!\n");
+ print_string("device type: ");
+ if (root->devices[i].type == 0) {
+ print_string("mem");
+ } else {
+ print_string("unknown");
+ }
+ print_string("\n");
}
+ while(1);
}