Data Structures | |
struct | CMEM_AllocParams |
Parameters for CMEM_alloc(), CMEM_alloc2(), CMEM_allocPool(), CMEM_allocPool2(), CMEM_free(). More... | |
struct | CMEM_BlockAttrs |
Defines | |
#define | CMEM_VERSION 0x03000100U |
#define | CMEM_WB 0x00010000 |
#define | CMEM_INV 0x00020000 |
#define | CMEM_HEAP 0x00040000 |
#define | CMEM_POOL 0x00000000 |
#define | CMEM_CACHED 0x00080000 |
#define | CMEM_NONCACHED 0x00000000 |
#define | CMEM_PHYS 0x00100000 |
#define | CMEM_IOCMAGIC 0x0000fe00 |
#define | CMEM_IOCALLOC 1 |
#define | CMEM_IOCALLOCHEAP 2 |
#define | CMEM_IOCFREE 3 |
#define | CMEM_IOCGETPHYS 4 |
#define | CMEM_IOCGETSIZE 5 |
#define | CMEM_IOCGETPOOL 6 |
#define | CMEM_IOCCACHE 7 |
#define | CMEM_IOCGETVERSION 8 |
#define | CMEM_IOCGETBLOCK 9 |
#define | CMEM_IOCREGUSER 10 |
#define | CMEM_IOCGETNUMBLOCKS 11 |
#define | CMEM_IOCCACHEWBINV CMEM_IOCCACHE | CMEM_WB | CMEM_INV |
#define | CMEM_IOCCACHEWB CMEM_IOCCACHE | CMEM_WB |
#define | CMEM_IOCCACHEINV CMEM_IOCCACHE | CMEM_INV |
#define | CMEM_IOCALLOCCACHED CMEM_IOCALLOC | CMEM_CACHED |
#define | CMEM_IOCALLOCHEAPCACHED CMEM_IOCALLOCHEAP | CMEM_CACHED |
#define | CMEM_IOCFREEHEAP CMEM_IOCFREE | CMEM_HEAP |
#define | CMEM_IOCFREEPHYS CMEM_IOCFREE | CMEM_PHYS |
#define | CMEM_IOCFREEHEAPPHYS CMEM_IOCFREE | CMEM_HEAP | CMEM_PHYS |
#define | CMEM_IOCCMDMASK 0x000000ff |
Functions | |
int | CMEM_init (void) |
Initialize the CMEM module. Must be called before other API calls. | |
int | CMEM_getPool (size_t size) |
Find the pool that best fits a given buffer size and has a buffer available. | |
int | CMEM_getPool2 (int blockid, size_t size) |
Find the pool in memory block blockid that best fits a given buffer size and has a buffer available. | |
void * | CMEM_allocPool (int poolid, CMEM_AllocParams *params) |
Allocate memory from a specified pool. | |
void * | CMEM_allocPool2 (int blockid, int poolid, CMEM_AllocParams *params) |
Allocate memory from a specified pool in a specified memory block. | |
void * | CMEM_alloc (size_t size, CMEM_AllocParams *params) |
Allocate memory of a specified size. | |
void * | CMEM_alloc2 (int blockid, size_t size, CMEM_AllocParams *params) |
Allocate memory of a specified size from a specified memory block. | |
void * | CMEM_registerAlloc (unsigned long physp) |
Register shared usage of an already-allocated buffer. | |
int | CMEM_free (void *ptr, CMEM_AllocParams *params) |
Free a buffer previously allocated with CMEM_alloc()/CMEM_allocPool(). | |
int | CMEM_unregister (void *ptr, CMEM_AllocParams *params) |
Unregister use of a buffer previously registered with CMEM_registerAlloc(). | |
unsigned long | CMEM_getPhys (void *ptr) |
Get the physical address of a contiguous buffer. | |
int | CMEM_cacheWb (void *ptr, size_t size) |
Do a cache writeback of the block pointed to by ptr/ | |
int | CMEM_cacheInv (void *ptr, size_t size) |
Do a cache invalidate of the block pointed to by ptr/ | |
int | CMEM_cacheWbInv (void *ptr, size_t size) |
Do a cache writeback/invalidate of the block pointed to by ptr/ | |
int | CMEM_getVersion (void) |
Retrieve version from CMEM driver. | |
int | CMEM_getBlock (unsigned long *pphys_base, size_t *psize) |
Retrieve memory block bounds from CMEM driver. | |
int | CMEM_getBlockAttrs (int blockid, CMEM_BlockAttrs *pattrs) |
Retrieve extended memory block attributes from CMEM driver. | |
int | CMEM_getNumBlocks (int *pnblocks) |
Retrieve number of blocks configured into CMEM driver. | |
int | CMEM_exit (void) |
Finalize the CMEM module. | |
Variables | |
CMEM_AllocParams | CMEM_DEFAULTPARAMS |
This is the API for the Contiguous Memory Manager.
#define CMEM_VERSION 0x03000100U |
#define CMEM_WB 0x00010000 |
#define CMEM_INV 0x00020000 |
#define CMEM_HEAP 0x00040000 |
operation applies to heap
#define CMEM_POOL 0x00000000 |
operation applies to a pool
#define CMEM_CACHED 0x00080000 |
allocated buffer is cached
#define CMEM_NONCACHED 0x00000000 |
allocated buffer is not cached
#define CMEM_PHYS 0x00100000 |
#define CMEM_IOCMAGIC 0x0000fe00 |
#define CMEM_IOCALLOC 1 |
#define CMEM_IOCALLOCHEAP 2 |
#define CMEM_IOCFREE 3 |
#define CMEM_IOCGETPHYS 4 |
#define CMEM_IOCGETSIZE 5 |
#define CMEM_IOCGETPOOL 6 |
#define CMEM_IOCCACHE 7 |
#define CMEM_IOCGETVERSION 8 |
#define CMEM_IOCGETBLOCK 9 |
#define CMEM_IOCREGUSER 10 |
#define CMEM_IOCGETNUMBLOCKS 11 |
#define CMEM_IOCCACHEWBINV CMEM_IOCCACHE | CMEM_WB | CMEM_INV |
#define CMEM_IOCCACHEWB CMEM_IOCCACHE | CMEM_WB |
#define CMEM_IOCCACHEINV CMEM_IOCCACHE | CMEM_INV |
#define CMEM_IOCALLOCCACHED CMEM_IOCALLOC | CMEM_CACHED |
#define CMEM_IOCALLOCHEAPCACHED CMEM_IOCALLOCHEAP | CMEM_CACHED |
#define CMEM_IOCFREEHEAP CMEM_IOCFREE | CMEM_HEAP |
#define CMEM_IOCFREEPHYS CMEM_IOCFREE | CMEM_PHYS |
#define CMEM_IOCFREEHEAPPHYS CMEM_IOCFREE | CMEM_HEAP | CMEM_PHYS |
#define CMEM_IOCCMDMASK 0x000000ff |
int CMEM_init | ( | void | ) |
Initialize the CMEM module. Must be called before other API calls.
int CMEM_getPool | ( | size_t | size | ) |
Find the pool that best fits a given buffer size and has a buffer available.
size | The buffer size for which a pool is needed. |
int CMEM_getPool2 | ( | int | blockid, | |
size_t | size | |||
) |
Find the pool in memory block blockid that best fits a given buffer size and has a buffer available.
blockid | Block number | |
size | The buffer size for which a pool is needed. |
void* CMEM_allocPool | ( | int | poolid, | |
CMEM_AllocParams * | params | |||
) |
Allocate memory from a specified pool.
poolid | The pool from which to allocate memory. | |
params | Allocation parameters. |
params->type
is ignored - a pool will always be used. params->alignment
is unused, since pool buffers are already aligned to specific boundaries.void* CMEM_allocPool2 | ( | int | blockid, | |
int | poolid, | |||
CMEM_AllocParams * | params | |||
) |
Allocate memory from a specified pool in a specified memory block.
blockid | The memory block from which to allocate. | |
poolid | The pool from which to allocate memory. | |
params | Allocation parameters. |
params->type
is ignored - a pool will always be used. params->alignment
is unused, since pool buffers are already aligned to specific boundaries.void* CMEM_alloc | ( | size_t | size, | |
CMEM_AllocParams * | params | |||
) |
Allocate memory of a specified size.
size | The size of the buffer to allocate. | |
params | Allocation parameters. |
void* CMEM_alloc2 | ( | int | blockid, | |
size_t | size, | |||
CMEM_AllocParams * | params | |||
) |
Allocate memory of a specified size from a specified memory block.
blockid | The memory block from which to allocate. | |
size | The size of the buffer to allocate. | |
params | Allocation parameters. |
void* CMEM_registerAlloc | ( | unsigned long | physp | ) |
Register shared usage of an already-allocated buffer.
physp | Physical address of the already-allocated buffer. |
int CMEM_free | ( | void * | ptr, | |
CMEM_AllocParams * | params | |||
) |
Free a buffer previously allocated with CMEM_alloc()/CMEM_allocPool().
ptr | The pointer to the buffer. | |
params | Allocation parameters. |
int CMEM_unregister | ( | void * | ptr, | |
CMEM_AllocParams * | params | |||
) |
Unregister use of a buffer previously registered with CMEM_registerAlloc().
ptr | The pointer to the buffer. | |
params | Allocation parameters. |
unsigned long CMEM_getPhys | ( | void * | ptr | ) |
Get the physical address of a contiguous buffer.
ptr | The pointer to the buffer. |
int CMEM_cacheWb | ( | void * | ptr, | |
size_t | size | |||
) |
Do a cache writeback of the block pointed to by ptr/
size
.
ptr | Pointer to block to writeback | |
size | Size in bytes of block to writeback. |
int CMEM_cacheInv | ( | void * | ptr, | |
size_t | size | |||
) |
Do a cache invalidate of the block pointed to by ptr/
size
.
ptr | Pointer to block to invalidate | |
size | Size in bytes of block to invalidate |
int CMEM_cacheWbInv | ( | void * | ptr, | |
size_t | size | |||
) |
Do a cache writeback/invalidate of the block pointed to by ptr/
size
.
ptr | Pointer to block to writeback/invalidate | |
size | Size in bytes of block to writeback/invalidate |
int CMEM_getVersion | ( | void | ) |
Retrieve version from CMEM driver.
int CMEM_getBlock | ( | unsigned long * | pphys_base, | |
size_t * | psize | |||
) |
Retrieve memory block bounds from CMEM driver.
pphys_base | Pointer to storage for base physical address of CMEM's memory block | |
psize | Pointer to storage for size of CMEM's memory block |
int CMEM_getBlockAttrs | ( | int | blockid, | |
CMEM_BlockAttrs * | pattrs | |||
) |
Retrieve extended memory block attributes from CMEM driver.
blockid | Block number | |
pattrs | Pointer to CMEM_BlockAttrs struct |
int CMEM_getNumBlocks | ( | int * | pnblocks | ) |
Retrieve number of blocks configured into CMEM driver.
pnblocks | Pointer to storage for holding number of blocks | |
pattrs | Pointer to CMEM_BlockAttrs struct |
int CMEM_exit | ( | void | ) |
Finalize the CMEM module.