Data Structures | |
struct | ti_sdo_ce_osal_Memory_AllocParams |
Parameters for ti_sdo_ce_osal_Memory_alloc() & ti_sdo_ce_osal_Memory_free() More... | |
Defines | |
#define | ti_sdo_ce_osal_Memory_DEFAULTALIGNMENT ((UInt)(-1)) |
Default Alignment. | |
#define | Memory_MODNAME "ti.sdo.ce.osal.Memory" |
Name to pass to Diags_setMask() to enable logging for Memory functions. For example, Diags_setMask(Memory_MODNAME"+EX1234567"); turns on all Log statements in this module. Diags_setMask() must be called after initialization to take effect. | |
#define | ti_sdo_ce_osal_Memory_GTNAME "OM" |
GT name containing the trace mask for this module. | |
#define | ti_sdo_ce_osal_Memory_CACHED 0x00000000 |
Cached allocation. | |
#define | ti_sdo_ce_osal_Memory_NONCACHED 0x00000001 |
Non-cached allocation. | |
#define | ti_sdo_ce_osal_Memory_CACHEDMASK 0x00000001 |
Mask to isolate cache flag. | |
Typedefs | |
typedef struct ti_sdo_ce_osal_Memory_AllocParams | ti_sdo_ce_osal_Memory_AllocParams |
Parameters for ti_sdo_ce_osal_Memory_alloc() & ti_sdo_ce_osal_Memory_free() | |
Enumerations | |
enum | ti_sdo_ce_osal_Memory_type { ti_sdo_ce_osal_Memory_MALLOC = 0, ti_sdo_ce_osal_Memory_SEG = 1, ti_sdo_ce_osal_Memory_CONTIGPOOL = 2, ti_sdo_ce_osal_Memory_CONTIGHEAP = 3 } |
Enum values for ti_sdo_ce_osal_Memory_AllocParams.type. More... | |
Functions | |
Ptr | ti_sdo_ce_osal_Memory_alloc (UInt size, ti_sdo_ce_osal_Memory_AllocParams *params) |
General memory allocation. | |
Void | ti_sdo_ce_osal_Memory_cacheInv (Ptr addr, Int sizeInBytes) |
Invalidate a range of cache. | |
Void | ti_sdo_ce_osal_Memory_cacheWb (Ptr addr, Int sizeInBytes) |
Write back cache. | |
Void | ti_sdo_ce_osal_Memory_cacheWbInv (Ptr addr, Int sizeInBytes) |
Write back and invalidate cache. | |
Void | ti_sdo_ce_osal_Memory_cacheWbInvAll () |
Write back and invalidate the entire cache. Not supported yet on all OS's. | |
Ptr | ti_sdo_ce_osal_Memory_contigAlloc (UInt size, UInt align) |
Allocate physically contiguous blocks of memory. | |
Bool | ti_sdo_ce_osal_Memory_contigFree (Ptr addr, UInt size) |
Free memory allocated by ti_sdo_ce_osal_Memory_contigAlloc() | |
Bool | ti_sdo_ce_osal_Memory_free (Ptr addr, UInt size, ti_sdo_ce_osal_Memory_AllocParams *params) |
Free memory allocated with ti_sdo_ce_osal_Memory_alloc(). | |
Void | ti_sdo_ce_osal_Memory_dumpKnownContigBufsList (Void) |
Dumps the list of all translated/registered bufs. | |
UInt32 | ti_sdo_ce_osal_Memory_getBufferPhysicalAddress (Ptr virtualAddress, Int sizeInBytes, Bool *isContiguous) |
Converts application virtual address to a physical address. | |
Int | ti_sdo_ce_osal_Memory_getHeapId (String name) |
Get the heap heap ID corresponding to a heap name. This number will be between 0 and the value returned by ti_sdo_ce_osal_Memory_getNumHeaps(). The heap Id can be passed to ti_sdo_ce_osal_Memory_redefine() and ti_sdo_ce_osal_Memory_restoreHeap(). | |
Int | ti_sdo_ce_osal_Memory_getNumHeaps () |
Get the number of memory heaps. | |
Ptr | ti_sdo_ce_osal_Memory_getBufferVirtualAddress (UInt32 physicalAddress, Int sizeInBytes) |
Obtains the virtual address of a physically contiguous buffer. | |
Void | ti_sdo_ce_osal_Memory_registerContigBuf (UInt32 virtualAddress, UInt32 sizeInBytes, UInt32 physicalAddress) |
Register a physical buffer allocated without ti_sdo_ce_osal_Memory_contigAlloc() | |
Void | ti_sdo_ce_osal_Memory_unregisterContigBuf (UInt32 virtualAddress, UInt32 sizeInBytes) |
Unregisters a physical buffer allocated without ti_sdo_ce_osal_Memory_contigAlloc(). | |
Variables | |
ti_sdo_ce_osal_Memory_AllocParams | ti_sdo_ce_osal_Memory_DEFAULTPARAMS |
Default parameters for ti_sdo_ce_osal_Memory_alloc() & ti_sdo_ce_osal_Memory_free() |
This Memory module provides services to manage memory in OS independent environments.
In order to avoid global namespace collisions, this module prefixes all its exports with the globally unique package name it's contained in (ti_sdo_ce_osal). As a usability feature (and to remain backward compatible with previous releases), these exports are also made available via the more traditional 'short' name - without the package name prefix.
For example, although the actual export may be named 'ti_sdo_ce_osal_Memory_alloc', it's generally usable via the shorter name 'Memory_alloc'. In the rare case where a namespace collision occurs, users can disable the definitions of the 'short' name by defining the symbol 'ti_sdo_ce_osal_Memory__nolocalnames' before including this module's header. For example:
#define ti_sdo_ce_osal_Memory__nolocalnames #include <ti/sdo/ce/osal/Memory.h>
This follows the same approach the XDCtools takes, and further explaination is available here: http://rtsc.eclipse.org/docs-tip/Integrating_RTSC_Modules#Eliminating_Identifier_Conflicts.
#define ti_sdo_ce_osal_Memory_DEFAULTALIGNMENT ((UInt)(-1)) |
Default Alignment.
#define Memory_MODNAME "ti.sdo.ce.osal.Memory" |
Name to pass to Diags_setMask() to enable logging for Memory functions. For example, Diags_setMask(Memory_MODNAME"+EX1234567"); turns on all Log statements in this module. Diags_setMask() must be called after initialization to take effect.
#define ti_sdo_ce_osal_Memory_GTNAME "OM" |
GT name containing the trace mask for this module.
#define ti_sdo_ce_osal_Memory_CACHED 0x00000000 |
Cached allocation.
#define ti_sdo_ce_osal_Memory_NONCACHED 0x00000001 |
Non-cached allocation.
#define ti_sdo_ce_osal_Memory_CACHEDMASK 0x00000001 |
Mask to isolate cache flag.
Parameters for ti_sdo_ce_osal_Memory_alloc() & ti_sdo_ce_osal_Memory_free()
Enum values for ti_sdo_ce_osal_Memory_AllocParams.type.
Ptr ti_sdo_ce_osal_Memory_alloc | ( | UInt | size, |
ti_sdo_ce_osal_Memory_AllocParams * | params | ||
) |
General memory allocation.
[in] | size | Number of bytes to allocate. |
[in] | params | Parameters controlling the allocation. |
NULL | The memory request failed. |
non-NULL | The pointer to a buffer containing the requested memory. |
Void ti_sdo_ce_osal_Memory_cacheInv | ( | Ptr | addr, |
Int | sizeInBytes | ||
) |
Invalidate a range of cache.
[in] | addr | Address of the beginning of the buffer to invalidate. |
[in] | sizeInBytes | Size of the buffer to invalidate. |
Void ti_sdo_ce_osal_Memory_cacheWb | ( | Ptr | addr, |
Int | sizeInBytes | ||
) |
Write back cache.
[in] | addr | Address of the beginning of the buffer to writeback. |
[in] | sizeInBytes | Size of the buffer to writeback. |
Void ti_sdo_ce_osal_Memory_cacheWbInv | ( | Ptr | addr, |
Int | sizeInBytes | ||
) |
Write back and invalidate cache.
[in] | addr | Address of the beginning of the buffer to writeback and invalidate. |
[in] | sizeInBytes | Size of the buffer to writeback invalidate. |
Void ti_sdo_ce_osal_Memory_cacheWbInvAll | ( | ) |
Write back and invalidate the entire cache. Not supported yet on all OS's.
Ptr ti_sdo_ce_osal_Memory_contigAlloc | ( | UInt | size, |
UInt | align | ||
) |
Allocate physically contiguous blocks of memory.
[in] | size | Size of the buffer to allocate. |
[in] | align | Alignment of the buffer; must be divisible by a power of two. |
align
must be divisible by a power of two.non-NULL | Address of a physically contiguous buffer. |
NULL | Unable to obtain the requested buffer. |
Bool ti_sdo_ce_osal_Memory_contigFree | ( | Ptr | addr, |
UInt | size | ||
) |
Free memory allocated by ti_sdo_ce_osal_Memory_contigAlloc()
[in] | addr | Address of a buffer allocated by ti_sdo_ce_osal_Memory_contigAlloc() |
[in] | size | Size of the buffer to free. |
TRUE | The buffer was freed and the memory pointed to by addr is no longer valid. |
FALSE | The buffer couldn't be freed. |
addr
must be a valid address returned by ti_sdo_ce_osal_Memory_contigAlloc()size
must be equivalent to the size
passed in during the ti_sdo_ce_osal_Memory_contigAlloc() allocation.Bool ti_sdo_ce_osal_Memory_free | ( | Ptr | addr, |
UInt | size, | ||
ti_sdo_ce_osal_Memory_AllocParams * | params | ||
) |
Free memory allocated with ti_sdo_ce_osal_Memory_alloc().
[in] | addr | Address of a buffer allocated by ti_sdo_ce_osal_Memory_alloc(). |
[in] | size | Size of the buffer to free. |
[in] | params | Parameters controlling the free operation. |
TRUE | The buffer was freed and the memory pointed to by addr is no longer valid. |
FALSE | The buffer couldn't be freed. |
addr
must be a valid address returned by ti_sdo_ce_osal_Memory_alloc().size
must be equivalent to the size
passed in during the ti_sdo_ce_osal_Memory_alloc() allocation.params
must be equivalent to the params
passed in during the ti_sdo_ce_osal_Memory_alloc() allocation.Void ti_sdo_ce_osal_Memory_dumpKnownContigBufsList | ( | Void | ) |
Dumps the list of all translated/registered bufs.
Diags_setMask(Memory_MODNAME"+5");
UInt32 ti_sdo_ce_osal_Memory_getBufferPhysicalAddress | ( | Ptr | virtualAddress, |
Int | sizeInBytes, | ||
Bool * | isContiguous | ||
) |
Converts application virtual address to a physical address.
This API also checks verifies that the buffer is really contiguous.
[in] | virtualAddress | Address of a buffer. |
[in] | sizeInBytes | Size of the buffer. |
[out] | isContiguous | Optional flag indicating whether the buffer was physically contiguous or not. |
0 | Failure, the physical address could not be obtained. |
non-zero | The physical address of the buffer. |
sizeInBytes
must be non-zero.isContiguous
is an optional parameter, and can be NULL if the caller doesn't want the results of this check. If isContiguous
is NULL but the buffer is not contiguous, error trace will be generated.virtualAddress
, zero will be returned. And if isContiguous
is non-null, it will be set to FALSE.Int ti_sdo_ce_osal_Memory_getHeapId | ( | String | name ) |
Get the heap heap ID corresponding to a heap name. This number will be between 0 and the value returned by ti_sdo_ce_osal_Memory_getNumHeaps(). The heap Id can be passed to ti_sdo_ce_osal_Memory_redefine() and ti_sdo_ce_osal_Memory_restoreHeap().
>= | 0 The heap number. |
< | 0 No heap with the given name was found. |
Int ti_sdo_ce_osal_Memory_getNumHeaps | ( | ) |
Get the number of memory heaps.
The | number of memroy heaps. |
Ptr ti_sdo_ce_osal_Memory_getBufferVirtualAddress | ( | UInt32 | physicalAddress, |
Int | sizeInBytes | ||
) |
Obtains the virtual address of a physically contiguous buffer.
[in] | physicalAddress | Physical address of a buffer. |
[in] | sizeInBytes | Size of the buffer. |
NULL | Failure, the virtual address could not be obtained. |
non-zero | The virtual address of the buffer. |
sizeInBytes
must be non-zero.virtualAddress
, was not acquired by ti_sdo_ce_osal_Memory_getBufferPhysicalAddress(), no attempt is made to map the physically contiguous buffer into the application's virtual memory space.Void ti_sdo_ce_osal_Memory_registerContigBuf | ( | UInt32 | virtualAddress, |
UInt32 | sizeInBytes, | ||
UInt32 | physicalAddress | ||
) |
Register a physical buffer allocated without ti_sdo_ce_osal_Memory_contigAlloc()
[in] | virtualAddress | Address of the buffer mapped into the process space |
[in] | sizeInBytes | Size of the region |
[in] | physicalAddress | Physical address of the buffer |
Void ti_sdo_ce_osal_Memory_unregisterContigBuf | ( | UInt32 | virtualAddress, |
UInt32 | sizeInBytes | ||
) |
Unregisters a physical buffer allocated without ti_sdo_ce_osal_Memory_contigAlloc().
[in] | virtualAddress | beginning address of the buffer mapped into the process space |
[in] | sizeInBytes | size of the region |
Default parameters for ti_sdo_ce_osal_Memory_alloc() & ti_sdo_ce_osal_Memory_free()
Memory_AllocParams myParams; myParams = Memory_DEFAULTPARAMS; myParams.type = Memory_CONTIGHEAP;