From 512fee7d94ebb95b5a3700773d86b3ce914ee8d9 Mon Sep 17 00:00:00 2001 From: James Benton Date: Thu, 7 Jan 2016 13:21:00 +0000 Subject: [PATCH] Add unit heap functions. --- include/coreinit/unitheap.h | 41 +++++++++++++++++++++++++++++++++++++ rpl/libcoreinit/exports.h | 9 ++++++++ 2 files changed, 50 insertions(+) create mode 100644 include/coreinit/unitheap.h diff --git a/include/coreinit/unitheap.h b/include/coreinit/unitheap.h new file mode 100644 index 0000000..e1f87cd --- /dev/null +++ b/include/coreinit/unitheap.h @@ -0,0 +1,41 @@ +#pragma once +#include + +WUT_LIB_HEADER_START + +typedef struct MEMUnitHeap MEMUnitHeap; + +struct MEMUnitHeap +{ +}; +UNKNOWN_SIZE(MEMUnitHeap); + +MEMUnitHeap * +MEMCreateUnitHeapEx(MEMUnitHeap *heap, + uint32_t size, + uint32_t blockSize, + int32_t alignment, + uint16_t flags); + +void * +MEMDestroyUnitHeap(MEMUnitHeap *heap); + +void * +MEMAllocFromUnitHeap(MEMUnitHeap *heap); + +void +MEMFreeToUnitHeap(MEMUnitHeap *heap, + void *block); + +void +MEMiDumpUnitHeap(MEMUnitHeap *heap); + +uint32_t +MEMCountFreeBlockForUnitHeap(MEMUnitHeap *heap); + +uint32_t +MEMCalcHeapSizeForUnitHeap(uint32_t blockSize, + uint32_t count, + int32_t alignment); + +WUT_LIB_HEADER_END diff --git a/rpl/libcoreinit/exports.h b/rpl/libcoreinit/exports.h index 17ac2ae..5ea25b9 100644 --- a/rpl/libcoreinit/exports.h +++ b/rpl/libcoreinit/exports.h @@ -218,3 +218,12 @@ EXPORT(OSGetTick); EXPORT(OSGetSystemTick); EXPORT(OSCalendarTimeToTicks); EXPORT(OSTicksToCalendarTime); + +// coreinit/unitheap.h +EXPORT(MEMCreateUnitHeapEx); +EXPORT(MEMDestroyUnitHeap); +EXPORT(MEMAllocFromUnitHeap); +EXPORT(MEMFreeToUnitHeap); +EXPORT(MEMiDumpUnitHeap); +EXPORT(MEMCountFreeBlockForUnitHeap); +EXPORT(MEMCalcHeapSizeForUnitHeap);