wut/include/coreinit/unitheap.h

69 lines
1.3 KiB
C
Raw Normal View History

2016-01-07 14:21:00 +01:00
#pragma once
#include <wut.h>
#include "memheap.h"
2016-01-07 14:21:00 +01:00
2016-01-07 17:02:54 +01:00
/**
* \defgroup coreinit_unitheap Unit Heap
* \ingroup coreinit
* @{
*/
2016-01-07 15:09:43 +01:00
#ifdef __cplusplus
extern "C" {
#endif
2016-01-07 14:21:00 +01:00
typedef struct MEMUnitHeap MEMUnitHeap;
typedef struct MEMUnitHeapFreeBlock MEMUnitHeapFreeBlock;
struct MEMUnitHeapFreeBlock
{
MEMUnitHeapFreeBlock *next;
};
CHECK_OFFSET(MEMUnitHeapFreeBlock, 0x00, next);
CHECK_SIZE(MEMUnitHeapFreeBlock, 0x04);
2016-01-07 14:21:00 +01:00
struct MEMUnitHeap
{
MEMHeapHeader header;
MEMUnitHeapFreeBlock *freeBlocks;
uint32_t blockSize;
2016-01-07 14:21:00 +01:00
};
CHECK_OFFSET(MEMUnitHeap, 0x00, header);
CHECK_OFFSET(MEMUnitHeap, 0x40, freeBlocks);
CHECK_OFFSET(MEMUnitHeap, 0x44, blockSize);
CHECK_SIZE(MEMUnitHeap, 0x48);
2016-01-07 14:21:00 +01:00
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);
2016-01-07 15:09:43 +01:00
#ifdef __cplusplus
}
#endif
2016-01-07 17:02:54 +01:00
/** @} */