From 0bca634f7e70b05239f46f3bd40bb37468d67957 Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Sun, 24 Oct 2021 18:47:28 +0200 Subject: Fixing keyboard, changes to Makefile and string.h, trying to add heap... --- src/heap.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/heap.h (limited to 'src/heap.h') diff --git a/src/heap.h b/src/heap.h new file mode 100644 index 0000000..2f66501 --- /dev/null +++ b/src/heap.h @@ -0,0 +1,23 @@ +#include"types.h" + +typedef struct _KHEAPBLOCKBM { + struct _KHEAPBLOCKBM *next; + uint32_t size; + uint32_t used; + uint32_t bsize; + uint32_t lfb; +} KHEAPBLOCKBM; + +typedef struct _KHEAPBM { + KHEAPBLOCKBM *fblock; +} KHEAPBM; + +void k_heapBMInit(KHEAPBM *heap); +int k_heapBMAddBlock(KHEAPBM *heap, uintptr_t addr, uint32_t size, uint32_t bsize); +void *k_heapBMAlloc(KHEAPBM *heap, uint32_t size); +void k_heapBMFree(KHEAPBM *heap, void *ptr); + +extern KHEAPBM kheap; + +#define kmalloc k_heapBMAlloc +#define kfree k_heapBMFree -- cgit v1.2.3