summaryrefslogtreecommitdiff
path: root/arm9/lib/include/os_alloc.h
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2020-04-30 12:35:00 -0400
committerProjectRevoTPP <projectrevotpp@hotmail.com>2020-04-30 12:35:00 -0400
commitf0f2ea83dacfd41ed625e2933af3de9696e47699 (patch)
tree92d7a51a90b15de7b7323dd2b66b5aac07976665 /arm9/lib/include/os_alloc.h
parent0dcb9b71fd54d7374dab4012c87a0a4dc5c5ed11 (diff)
example compilation for OS_arena
Diffstat (limited to 'arm9/lib/include/os_alloc.h')
-rw-r--r--arm9/lib/include/os_alloc.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/arm9/lib/include/os_alloc.h b/arm9/lib/include/os_alloc.h
new file mode 100644
index 00000000..1c4b6122
--- /dev/null
+++ b/arm9/lib/include/os_alloc.h
@@ -0,0 +1,38 @@
+//
+// Created by mart on 4/23/20.
+//
+
+#ifndef POKEDIAMOND_OS_ALLOC_H
+#define POKEDIAMOND_OS_ALLOC_H
+
+#include "types.h"
+#include "os_arena.h"
+
+typedef int OSHeapHandle;
+
+typedef struct Cell Cell;
+
+struct Cell {
+ Cell* prev;
+ Cell* next;
+ long size;
+};
+
+typedef struct {
+ long size;
+ Cell *free;
+ Cell *allocated;
+} HeapDesc;
+
+typedef struct {
+ volatile OSHeapHandle currentHeap;
+ int numHeaps;
+ void* arenaStart;
+ void* arenaEnd;
+ HeapDesc* heapArray;
+} OSHeapInfo;
+
+void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void *ptr);
+void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size);
+
+#endif //POKEDIAMOND_OS_ALLOC_H