228 #if defined (__cplusplus)
235 #define CMEM_VERSION 0x04000000U
240 #define CMEM_CMABLOCKID -1
243 #define CMEM_WB 0x00010000
244 #define CMEM_INV 0x00020000
245 #define CMEM_HEAP 0x00040000
246 #define CMEM_POOL 0x00000000
247 #define CMEM_CACHED 0x00080000
248 #define CMEM_NONCACHED 0x00000000
249 #define CMEM_PHYS 0x00100000
251 #define CMEM_IOCMAGIC 0x0000fe00
254 #define CMEM_IOCALLOC 1
255 #define CMEM_IOCALLOCHEAP 2
256 #define CMEM_IOCFREE 3
257 #define CMEM_IOCGETPHYS 4
258 #define CMEM_IOCGETSIZE 5
259 #define CMEM_IOCGETPOOL 6
260 #define CMEM_IOCCACHE 7
261 #define CMEM_IOCGETVERSION 8
262 #define CMEM_IOCGETBLOCK 9
263 #define CMEM_IOCREGUSER 10
264 #define CMEM_IOCGETNUMBLOCKS 11
271 #define CMEM_IOCCACHEWBINV CMEM_IOCCACHE | CMEM_WB | CMEM_INV
272 #define CMEM_IOCCACHEWB CMEM_IOCCACHE | CMEM_WB
273 #define CMEM_IOCCACHEINV CMEM_IOCCACHE | CMEM_INV
274 #define CMEM_IOCALLOCCACHED CMEM_IOCALLOC | CMEM_CACHED
275 #define CMEM_IOCALLOCHEAPCACHED CMEM_IOCALLOCHEAP | CMEM_CACHED
276 #define CMEM_IOCFREEHEAP CMEM_IOCFREE | CMEM_HEAP
277 #define CMEM_IOCFREEPHYS CMEM_IOCFREE | CMEM_PHYS
278 #define CMEM_IOCFREEHEAPPHYS CMEM_IOCFREE | CMEM_HEAP | CMEM_PHYS
280 #define CMEM_IOCCMDMASK 0x000000ff
305 union CMEM_AllocUnion {
310 } alloc_heap_inparams;
314 } alloc_pool_inparams;
324 unsigned long long physp;
326 } alloc_pool_outparams;
328 unsigned long long physp;
330 } get_block_outparams;
335 unsigned long long physp;
728 void *
CMEM_map(off_t physp,
size_t size);
851 #if defined (__cplusplus)
struct CMEM_BlockAttrs CMEM_BlockAttrs
int CMEM_freePhys(off_t physp, CMEM_AllocParams *params)
Free an unmapped buffer previously allocated with CMEM_allocPhys()/CMEM_allocPoolPhys().
CMEM_AllocParams CMEM_DEFAULTPARAMS
int CMEM_unmap(void *userp, size_t size)
Unmap allocated memory.
int CMEM_cacheWb(void *ptr, size_t size)
Do a cache writeback of the block pointed to by ptr/size.
int CMEM_free(void *ptr, CMEM_AllocParams *params)
Free a buffer previously allocated with CMEM_alloc()/CMEM_allocPool().
off_t CMEM_getPhys(void *ptr)
Get the physical address of a contiguous buffer.
off_t CMEM_allocPhys(size_t size, CMEM_AllocParams *params)
Allocate unmapped memory of a specified size.
size_t alignment
Definition: cmem.h:289
void * CMEM_alloc(size_t size, CMEM_AllocParams *params)
Allocate memory of a specified size.
Parameters for CMEM_alloc(), CMEM_alloc2(), CMEM_allocPool(), CMEM_allocPool2(), CMEM_free().
Definition: cmem.h:286
void * CMEM_allocPool2(int blockid, int poolid, CMEM_AllocParams *params)
Allocate memory from a specified pool in a specified memory block.
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...
off_t phys_base
Definition: cmem.h:297
struct CMEM_AllocParams CMEM_AllocParams
Parameters for CMEM_alloc(), CMEM_alloc2(), CMEM_allocPool(), CMEM_allocPool2(), CMEM_free().
void * CMEM_registerAlloc(off_t physp)
Register shared usage of an already-allocated buffer.
int CMEM_exit(void)
Finalize the CMEM module.
int CMEM_getNumBlocks(int *pnblocks)
Retrieve number of blocks configured into CMEM driver.
off_t CMEM_allocPoolPhys2(int blockid, int poolid, CMEM_AllocParams *params)
Allocate unmapped memory from a specified pool in a specified memory block.
void * CMEM_allocPool(int poolid, CMEM_AllocParams *params)
Allocate memory from a specified pool.
int type
Definition: cmem.h:287
int CMEM_cacheWbInv(void *ptr, size_t size)
Do a cache writeback/invalidate of the block pointed to by ptr/size.
size_t size
Definition: cmem.h:298
int CMEM_getBlock(off_t *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.
void * CMEM_alloc2(int blockid, size_t size, CMEM_AllocParams *params)
Allocate memory of a specified size from a specified memory block.
off_t CMEM_allocPhys2(int blockid, size_t size, CMEM_AllocParams *params)
Allocate unmapped memory of a specified size from a specified memory block.
int CMEM_getPool(size_t size)
Find the pool that best fits a given buffer size and has a buffer available.
int CMEM_getVersion(void)
Retrieve version from CMEM driver.
void * CMEM_map(off_t physp, size_t size)
Map allocated memory.
int flags
Definition: cmem.h:288
int CMEM_unregister(void *ptr, CMEM_AllocParams *params)
Unregister use of a buffer previously registered with CMEM_registerAlloc().
int CMEM_init(void)
Initialize the CMEM module. Must be called before other API calls.
off_t CMEM_allocPoolPhys(int poolid, CMEM_AllocParams *params)
Allocate unmapped memory from a specified pool.
int CMEM_cacheInv(void *ptr, size_t size)
Do a cache invalidate of the block pointed to by ptr/size.