summaryrefslogtreecommitdiff
path: root/arm9/lib/include/os_alloc.h
diff options
context:
space:
mode:
authorCleverking2003 <30466983+Cleverking2003@users.noreply.github.com>2020-04-30 19:41:40 +0300
committerGitHub <noreply@github.com>2020-04-30 19:41:40 +0300
commit32c0e050f72df12ec9e3cf1f064d03d741fed977 (patch)
tree92d7a51a90b15de7b7323dd2b66b5aac07976665 /arm9/lib/include/os_alloc.h
parent0dcb9b71fd54d7374dab4012c87a0a4dc5c5ed11 (diff)
parentf0f2ea83dacfd41ed625e2933af3de9696e47699 (diff)
Merge pull request #44 from ProjectRevoTPP/os_lib
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