#include <nnsys/fnd.h>
NNSFndHeapHandle NNS_FndCreateUnitHeapEx( void* startAddress , u32 heapSize, u32 memBlockSize, int alignment, u16 optFlag );
| startAddress | Starting address of the memory region allocated to the heap. |
| heapSize | Size (in bytes) of the memory region allocated to the heap. |
| memBlockSize | Memory block size (in bytes) |
| alignment | Memory block alignment. Can take any of the following values: 4, 8, 16, 32. |
| optFlag | Heap options |
In the case that it was possible to create a heap, a value of 0 or greater will be returned, which is the handle to the heap. If the function fails, it returns NNS_FND_HEAP_INVALID_HANDLE (a NULL value).
Creates the unit heap. The region for the heap is a memory region of a size designated by heapSize from the address designated with startAddress.
The size of each memory block is a fixed size designated with memBlockSize. The alignment of each memory block can be designated with alignment, and can take any of the following values:
You can set the heap options with optFlag.
| NNS_FND_HEAP_OPT_0_CLEAR | The allocated memory block is filled with 0s at the time the memory is allocated from the heap. |
| NNS_FND_HEAP_OPT_DEBUG_FILL | When the heap is created, and when the memory block is allocated or deallocated, each is filled with a different 32-bit value in the memory region. This flag is for debugging, and is used in finding memory access bugs caused by a failure to initialize memory and invalid memory regions. This has no function with the FINALROM library. |
04/28/2004 The value for when it could not create a heap was incorrect. Revised.
04/01/2004 Initial version.
CONFIDENTIAL