#include "mm.h"
Functions | |
void | mmDumpMemInfo (const struct mem_block *heap) |
For debuging purpose. | |
struct mem_block * | mmInit (unsigned ofs, unsigned size) |
input: total size in bytes return: a heap pointer if OK, NULL if error | |
static struct mem_block * | SliceBlock (struct mem_block *p, unsigned startofs, unsigned size, unsigned reserved, unsigned alignment) |
struct mem_block * | mmAllocMem (struct mem_block *heap, unsigned size, unsigned align2, unsigned startSearch) |
Allocate 'size' bytes with 2^align2 bytes alignment, restrict the search to free memory after 'startSearch' depth and back buffers should be in different 4mb banks to get better page hits if possible input: size = size of block align2 = 2^align2 bytes alignment startSearch = linear offset from start of heap to begin search return: pointer to the allocated block, 0 if error. | |
struct mem_block * | mmFindBlock (struct mem_block *heap, unsigned start) |
Free block starts at offset input: pointer to a heap, start offset return: pointer to a block. | |
static INLINE int | Join2Blocks (struct mem_block *p) |
int | mmFreeMem (struct mem_block *b) |
Free block starts at offset input: pointer to a block return: 0 if OK, -1 if error. | |
void | mmDestroy (struct mem_block *heap) |
destroy MM |
static INLINE int Join2Blocks | ( | struct mem_block * | p | ) | [static] |
struct mem_block* mmAllocMem | ( | struct mem_block * | heap, | |
unsigned | size, | |||
unsigned | align2, | |||
unsigned | startSearch | |||
) | [read] |
Allocate 'size' bytes with 2^align2 bytes alignment, restrict the search to free memory after 'startSearch' depth and back buffers should be in different 4mb banks to get better page hits if possible input: size = size of block align2 = 2^align2 bytes alignment startSearch = linear offset from start of heap to begin search return: pointer to the allocated block, 0 if error.
void mmDestroy | ( | struct mem_block * | heap | ) |
destroy MM
void mmDumpMemInfo | ( | const struct mem_block * | heap | ) |
For debuging purpose.
Free block starts at offset input: pointer to a heap, start offset return: pointer to a block.
int mmFreeMem | ( | struct mem_block * | b | ) |
Free block starts at offset input: pointer to a block return: 0 if OK, -1 if error.
struct mem_block* mmInit | ( | unsigned | ofs, | |
unsigned | size | |||
) | [read] |
input: total size in bytes return: a heap pointer if OK, NULL if error
static struct mem_block* SliceBlock | ( | struct mem_block * | p, | |
unsigned | startofs, | |||
unsigned | size, | |||
unsigned | reserved, | |||
unsigned | alignment | |||
) | [static, read] |