Data Structures | |
struct | Memory_AllocParams |
Parameters for Memory_alloc() & Memory_free(). More... | |
Defines | |
#define | Memory_DEFAULTALIGNMENT ((UInt)(-1)) |
#define | Memory_GTNAME "OM" |
#define | Memory_CACHED 0x00000000 |
#define | Memory_NONCACHED 0x00000001 |
#define | Memory_CACHEDMASK 0x00000001 |
Enumerations | |
enum | Memory_type { Memory_MALLOC = 0, Memory_SEG = 1, Memory_CONTIGPOOL = 2, Memory_CONTIGHEAP = 3 } |
Enum values for Memory_AllocParams.type. More... | |
Functions | |
Ptr | Memory_alloc (UInt size, Memory_AllocParams *params) |
General memory allocation. | |
Void | Memory_cacheInv (Ptr addr, Int sizeInBytes) |
Invalidate a range of cache. | |
Void | Memory_cacheWb (Ptr addr, Int sizeInBytes) |
Write back cache. | |
Void | Memory_cacheWbInv (Ptr addr, Int sizeInBytes) |
Write back and invalidate cache. | |
Ptr | Memory_contigAlloc (UInt size, UInt align) |
Allocate physically contiguous blocks of memory. | |
Bool | Memory_contigFree (Ptr addr, UInt size) |
Free memory allocated by Memory_contigAlloc(). | |
Bool | Memory_free (Ptr addr, UInt size, Memory_AllocParams *params) |
Free memory allocated with Memory_alloc(). | |
Void | Memory_dumpKnownContigBufsList (Void) |
Dumps the list of all translated/registered bufs. | |
UInt32 | Memory_getBufferPhysicalAddress (Ptr virtualAddress, Int sizeInBytes, Bool *isContiguous) |
Converts application virtual address to a physical address. | |
Int | 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 Memory_getNumHeaps(). The heap Id can be passed to Memory_redefine(), Memory_restoreHeap(), and Memory_segStat(). | |
Int | Memory_getNumHeaps () |
Get the number of memory heaps. | |
Ptr | Memory_getBufferVirtualAddress (UInt32 physicalAddress, Int sizeInBytes) |
Obtains the virtual address of a physically contiguous buffer. | |
Void | Memory_registerContigBuf (UInt32 virtualAddress, UInt32 sizeInBytes, UInt32 physicalAddress) |
Register a physical buffer allocated without Memory_contigAlloc(). | |
Void | Memory_unregisterContigBuf (UInt32 virtualAddress, UInt32 sizeInBytes) |
Unregisters a physical buffer allocated without Memory_contigAlloc(). | |
Variables | |
Memory_AllocParams | Memory_DEFAULTPARAMS |
Default parameters for Memory_alloc() & Memory_free(). |
#define Memory_DEFAULTALIGNMENT ((UInt)(-1)) |
#define Memory_GTNAME "OM" |
#define Memory_CACHED 0x00000000 |
Cached allocation.
#define Memory_NONCACHED 0x00000001 |
Non-cached allocation.
#define Memory_CACHEDMASK 0x00000001 |
Mask to isolate cache flag.
enum Memory_type |
Enum values for Memory_AllocParams.type.
Ptr Memory_alloc | ( | UInt | size, | |
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 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 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 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. |
Ptr 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 Memory_contigFree | ( | Ptr | addr, | |
UInt | size | |||
) |
Free memory allocated by Memory_contigAlloc().
[in] | addr | Address of a buffer allocated by 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 Memory_contigAlloc()size
must be equivalent to the size
passed in during the Memory_contigAlloc() allocation.Bool Memory_free | ( | Ptr | addr, | |
UInt | size, | |||
Memory_AllocParams * | params | |||
) |
Free memory allocated with Memory_alloc().
[in] | addr | Address of a buffer allocated by 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 Memory_alloc().size
must be equivalent to the size
passed in during the Memory_alloc() allocation.Void Memory_dumpKnownContigBufsList | ( | Void | ) |
Dumps the list of all translated/registered bufs.
GT_set(Memory_GTNAME "+5");
UInt32 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 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 Memory_getNumHeaps(). The heap Id can be passed to Memory_redefine(), Memory_restoreHeap(), and Memory_segStat().
>= | 0 The heap number. | |
< | 0 No heap with the given name was found. |
Int Memory_getNumHeaps | ( | ) |
Get the number of memory heaps.
The | number of memroy heaps. |
Ptr 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 Memory_getBufferPhysicalAddress(), no attempt is made to map the physically contiguous buffer into a the application's virtual memory space.Void Memory_registerContigBuf | ( | UInt32 | virtualAddress, | |
UInt32 | sizeInBytes, | |||
UInt32 | physicalAddress | |||
) |
Register a physical buffer allocated without 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 Memory_unregisterContigBuf | ( | UInt32 | virtualAddress, | |
UInt32 | sizeInBytes | |||
) |
Unregisters a physical buffer allocated without Memory_contigAlloc().
[in] | virtualAddress | beginning address of the buffer mapped into the process space |
[in] | sizeInBytes | size of the region |
Default parameters for Memory_alloc() & Memory_free().
Memory_AllocParams myParams; myParams = Memory_DEFAULTPARAMS; myParams.type = Memory_CONTIGHEAP;