cmem.h File Reference


Detailed Description

Describes the interface to the contiguous memory allocator.

The cmem user interface library wraps file system calls to an associated kernel dll (cmemk.dll), which needs to be loaded in order for calls to this library to succeed.

#include <windows.h>

Include dependency graph for cmem.h:

Go to the source code of this file.

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   0x02200000U
#define CMEM_WB   0x0100
#define CMEM_INV   0x0200
#define CMEM_HEAP   0x0400
#define CMEM_POOL   0x0000
#define CMEM_CACHED   0x0800
#define CMEM_NONCACHED   0x0000
#define CMEM_PHYS   0x1000
#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_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.
int CMEM_free (void *ptr, CMEM_AllocParams *params)
 Free a buffer previously allocated with CMEM_alloc()/ CMEM_allocPool().
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/size.
int CMEM_cacheInv (void *ptr, size_t size)
 Do a cache invalidate of the block pointed to by ptr/size.
int CMEM_cacheWbInv (void *ptr, size_t size)
 Do a cache writeback/invalidate of the block pointed to by ptr/size.
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_exit (void)
 Finalize the CMEM module.

Variables

CMEM_AllocParams CMEM_DEFAULTPARAMS


Copyright 2009, Texas Instruments Incorporated