summaryrefslogtreecommitdiff
path: root/arm9/lib/include/OS_alloc.h
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2020-05-01 17:54:04 +0100
committerred031000 <rubenru09@aol.com>2020-05-01 17:54:04 +0100
commitf04501a417999dddd7ec5963b90ab2e152ac3477 (patch)
treee4cff97cd3b2b43238e60de733286aa98caaef4c /arm9/lib/include/OS_alloc.h
parent10b569f131fc58959d7c50dd4b07f01a52b5e162 (diff)
match OS_protectionRegion
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..08fb3224
--- /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