diff options
| author | Nathan Lee <me@nwlee.tech> | 2026-06-17 13:05:15 -0500 |
|---|---|---|
| committer | Nathan Lee <me@nwlee.tech> | 2026-06-17 13:05:15 -0500 |
| commit | b106df2447d23d6b3fcffa7cc87edde218d054f3 (patch) | |
| tree | 85b01191beada41b85bc391482cee7294b73f89b /include | |
| parent | 2fb81f37d20fd442d1954a7356e3ab7f88314a9c (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 'include')
| -rw-r--r-- | include/mem.h | 22 | ||||
| -rw-r--r-- | include/types.h | 17 | ||||
| -rw-r--r-- | include/wdt.h | 18 |
3 files changed, 57 insertions, 0 deletions
diff --git a/include/mem.h b/include/mem.h new file mode 100644 index 0000000..12976df --- /dev/null +++ b/include/mem.h @@ -0,0 +1,22 @@ +#pragma once +#include <types.h> + +#define EHEAP_SIZE (512 * 1024) + +typedef enum { + PAGE_FREE, + PAGE_ALLOCATED +} MemoryPageAvailability; + +struct page { + void* locator; + MemoryPageAvailability availability; + struct page* next; +}; + +void* kmalloc(size_t size); +void* memcpy(void* to, const void* from,size_t size); + +void* kemalloc(size_t size); + +extern struct page root; diff --git a/include/types.h b/include/types.h new file mode 100644 index 0000000..4c7965c --- /dev/null +++ b/include/types.h @@ -0,0 +1,17 @@ +#pragma once + +#define NULL (void*)0 + +#define size_t __wk_size_t +#define uint8_t __wk_uint8_t +#define uint16_t __wk_uint16_t +#define uint32_t __wk_uint32_t +#define uint64_t __wk_uint64_t +#define be32_to_cpu(x) __builtin_bswap32(x) + +typedef __UINTPTR_TYPE__ __wk_size_t; +typedef __UINT8_TYPE__ __wk_uint8_t; +typedef __UINT16_TYPE__ __wk_uint16_t; +typedef __UINT32_TYPE__ __wk_uint32_t; +typedef __UINT64_TYPE__ __wk_uint64_t; + diff --git a/include/wdt.h b/include/wdt.h new file mode 100644 index 0000000..31739ab --- /dev/null +++ b/include/wdt.h @@ -0,0 +1,18 @@ +#pragma once +#include <types.h> + +#define WDT_MAGIC 0x67674141 + +struct wdt_device { + uint32_t type; + uint32_t driver_id; + uint32_t start; + uint32_t size; +}; + +struct wdt_root { + uint32_t magic; + uint32_t count; + struct wdt_device devices[]; +}; + |
