From 386ad4f82955d389ae347bc50f7efca5edb9d9a8 Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 21 Apr 2023 21:56:45 -0400 Subject: actually got libfdt working --- sys/dev/dev_init.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sys/dev/dev_init.c (limited to 'sys/dev/dev_init.c') diff --git a/sys/dev/dev_init.c b/sys/dev/dev_init.c new file mode 100644 index 0000000..fc70853 --- /dev/null +++ b/sys/dev/dev_init.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include +#include +#include + +void +dev_init(struct fdt_header *fdt) +{ + if (fdt_check_header(fdt) == 0) + printf("[dev_init] valid fdt at %p\n", fdt); + else + printf("[dev_init] error: fdt_check_header()\n"); + + int offset = fdt_next_node(fdt, offset, 0); + do { + printf("[dev_init] found %s\n", fdt_get_name(fdt, offset, NULL)); + offset = fdt_next_node(fdt, offset, 0); + } while (offset != -FDT_ERR_NOTFOUND); +} + -- cgit v1.2.3