TIOVX User Guide
|
APIs for memory mapping on host and target.
Data Structures | |
struct | tivx_shared_mem_ptr_t |
Structure describing a shared memory pointer. More... | |
struct | tivx_mem_stats |
Structure describing a memory stats pointer. More... | |
Enumerations | |
enum | tivx_mem_heap_region_e { TIVX_MEM_EXTERNAL, TIVX_MEM_INTERNAL_L3, TIVX_MEM_INTERNAL_L2, TIVX_MEM_INTERNAL_L1, TIVX_MEM_EXTERNAL_SCRATCH, TIVX_MEM_EXTERNAL_PERSISTENT_NON_CACHEABLE, TIVX_MEM_EXTERNAL_SCRATCH_NON_CACHEABLE } |
Enum that list all possible memory regions from which allocations are possible. More... | |
enum | tivx_memory_type_e { TIVX_MEMORY_TYPE_DMA = VX_ENUM_BASE(VX_ID_TI, VX_ENUM_MEMORY_TYPE) + 0x0 } |
An enumeration of TI extension memory import types. More... | |
Functions | |
vx_status | tivxMemBufferAlloc (tivx_shared_mem_ptr_t *mem_ptr, uint32_t size, vx_enum mem_heap_region) |
Alloc buffer from shared memory. More... | |
vx_status | tivxMemBufferFree (tivx_shared_mem_ptr_t *mem_ptr, uint32_t size) |
Free buffer from shared memory. More... | |
vx_status | tivxMemBufferMap (void *host_ptr, uint32_t size, vx_enum mem_type, vx_enum maptype) |
Map an allocated buffer address. More... | |
vx_status | tivxMemBufferUnmap (void *host_ptr, uint32_t size, vx_enum mem_type, vx_enum maptype) |
UnMap a buffer address. More... | |
uint64_t | tivxMemHost2SharedPtr (uint64_t host_ptr, vx_enum mem_heap_region) |
Convert Host pointer to shared pointer. More... | |
void * | tivxMemShared2TargetPtr (const tivx_shared_mem_ptr_t *shared_ptr) |
Convert shared pointer to target pointer. More... | |
uint64_t | tivxMemShared2PhysPtr (uint64_t shared_ptr, vx_enum mem_heap_region) |
Convert shared pointer to system physical memory location This is mainly used for configuring physical address to HW. More... | |
void * | tivxMemAlloc (vx_uint32 size, vx_enum mem_heap_region) |
Allocates memory of given size. More... | |
void | tivxMemFree (void *ptr, vx_uint32 size, vx_enum mem_heap_region) |
Frees already allocated memory. More... | |
void | tivxMemStats (tivx_mem_stats *stats, vx_enum mem_type) |
Get memory segment information. More... | |
int32_t | tivxMemResetScratchHeap (vx_enum mem_heap_region) |
Reset scratch memory. More... | |
vx_status | tivxMemTranslateVirtAddr (const void *virtAddr, uint64_t *fd, void **phyAddr) |
Translates a given virtual address to a file descriptor and a physical address. The following conditions regarding 'virt_addr' must be TRUE: More... | |
vx_status | tivxMemTranslateFd (uint64_t dmaBufFd, uint32_t size, void **virtAddr, void **phyAddr) |
Translates a given file descriptor to a virtual and physical addresss. The following conditions regarding 'fd' must be TRUE: More... | |
void | tivxEnableL1DandL2CacheWb (void) |
For J784S4, the C7X cache coherency model is different than other Jacinto SoC's. While other SoC's C7X cache was coherent, the J784S4 C7X requires cache operations to be performed on the buffers when using them within the OpenVX shared region. This API allows the entire L1D and L2 cache to be written back for J784S4. | |
Enum that list all possible memory regions from which allocations are possible.
Enumerator | |
---|---|
TIVX_MEM_EXTERNAL | External memory. Typically large in size and can be used by kernels. as well as applications. |
TIVX_MEM_INTERNAL_L3 | Internal memory at L3 level. Typically visiable to all CPUs, limited in size. Typically used by kernels and in very rare cases by applications. |
TIVX_MEM_INTERNAL_L2 | Internal memory at L2 level. Typically local to CPU, very limited in size. Typically used by kernels. This is used as scratch memory by kernels, i.e memory contents are not preserved across kernel function calls tivxMemAlloc() API will linearly allocate from this memory segement. After each allocatation an internal offset will be incremented. tivxMemFree() resets this offset to zero. i.e tivxMemAlloc() and tivxMemFree() are not heap like memory alloc and free functions. NOT to be used by applications. |
TIVX_MEM_INTERNAL_L1 | Internal memory at L1 level. Typically local to CPU, very limited in size. Typically used by kernels. This is used as scratch memory by kernels, i.e memory contents are not preserved across kernel function calls tivxMemAlloc() API will linearly allocate from this memory segement. After each allocatation an internal offset will be incremented. tivxMemFree() resets this offset to zero. i.e tivxMemAlloc() and tivxMemFree() are not heap like memory alloc and free functions. NOT to be used by applications. |
TIVX_MEM_EXTERNAL_SCRATCH | External scratch memory. Typically large in size and can be used by kernels. as well as applications. Must be reset and allocated each time it is used. |
TIVX_MEM_EXTERNAL_PERSISTENT_NON_CACHEABLE | External persistent non cachable memory. Typically large in size and can be used by kernels. as well as applications. Must be reset and allocated each time it is used. |
TIVX_MEM_EXTERNAL_SCRATCH_NON_CACHEABLE | External scratch non cachable memory. Typically large in size and can be used by kernels. as well as applications. Must be reset and allocated each time it is used. |
Definition at line 86 of file tivx_mem.h.
enum tivx_memory_type_e |
An enumeration of TI extension memory import types.
Enumerator | |
---|---|
TIVX_MEMORY_TYPE_DMA | Memory type when a DMA will access the memory rather than the HOST. |
Definition at line 170 of file tivx_mem.h.
vx_status tivxMemBufferAlloc | ( | tivx_shared_mem_ptr_t * | mem_ptr, |
uint32_t | size, | ||
vx_enum | mem_heap_region | ||
) |
Alloc buffer from shared memory.
[out] | mem_ptr | Allocated memory pointer |
[in] | size | Size of memory to allocate in bytes |
[in] | mem_heap_region | Memory region to which this allocation belongs, see tivx_mem_heap_region_e |
vx_status tivxMemBufferFree | ( | tivx_shared_mem_ptr_t * | mem_ptr, |
uint32_t | size | ||
) |
Free buffer from shared memory.
[in,out] | mem_ptr | Allocated memory pointer |
[in] | size | Size of memory allocated in bytes |
Map an allocated buffer address.
This is to ensure the memory pointed by the buffer is accesible to the caller and brought to a coherent state wrt caller by performing a cahce invalidate when necessary.
[in] | host_ptr | Buffer memory to map |
[in] | size | Size of memory to map in units of bytes |
[in] | mem_type | Memory type to which this pointer belongs, see vx_memory_type_e and tivx_memory_type_e |
[in] | maptype | Mapping type as defined by vx_accessor_e |
UnMap a buffer address.
This is to ensure the memory pointed by the buffer pointer is made coherent with other possible readers of this buffer
Performs a cache writeback of host_ptr when maptype is VX_WRITE_ONLY or VX_READ_AND_WRITE and the CPU is not cache coherent.
[in] | host_ptr | Buffer memory to unmap |
[in] | size | Size of memory to unmap in units of bytes |
[in] | mem_type | Memory type to which this pointer belongs, see vx_memory_type_e and tivx_memory_type_e |
[in] | maptype | Mapping type as defined by vx_accessor_e |
uint64_t tivxMemHost2SharedPtr | ( | uint64_t | host_ptr, |
vx_enum | mem_heap_region | ||
) |
Convert Host pointer to shared pointer.
[in] | host_ptr | Host memory pointer |
[in] | mem_heap_region | Memory region to which this pointer belongs, see tivx_mem_heap_region_e |
void* tivxMemShared2TargetPtr | ( | const tivx_shared_mem_ptr_t * | shared_ptr | ) |
Convert shared pointer to target pointer.
[in] | shared_ptr | Shared memory pointer |
uint64_t tivxMemShared2PhysPtr | ( | uint64_t | shared_ptr, |
vx_enum | mem_heap_region | ||
) |
Convert shared pointer to system physical memory location This is mainly used for configuring physical address to HW.
[in] | shared_ptr | Host memory pointer |
[in] | mem_heap_region | Memory region to which this pointer belongs, see tivx_mem_heap_region_e |
Allocates memory of given size.
[in] | size | size of the memory to be allocated |
[in] | mem_heap_region | memory heap region |
Frees already allocated memory.
[in] | ptr | Pointer to the memory |
[in] | size | size of the memory to be freed |
[in] | mem_heap_region | Memory segment ID |
void tivxMemStats | ( | tivx_mem_stats * | stats, |
vx_enum | mem_type | ||
) |
Get memory segment information.
[out] | stats | Memory segment information |
[in] | mem_type | Memory type |
int32_t tivxMemResetScratchHeap | ( | vx_enum | mem_heap_region | ) |
Reset scratch memory.
[in] | mem_heap_region | Memory segment ID |
vx_status tivxMemTranslateVirtAddr | ( | const void * | virtAddr, |
uint64_t * | fd, | ||
void ** | phyAddr | ||
) |
Translates a given virtual address to a file descriptor and a physical address. The following conditions regarding 'virt_addr' must be TRUE:
virt_addr | [in] Virtual address to translate. |
fd | [out] File descriptor corresponding to 'virt_addr'. |
phys_addr | [out] Physical address corresponding to 'virt_addr'. |
vx_status tivxMemTranslateFd | ( | uint64_t | dmaBufFd, |
uint32_t | size, | ||
void ** | virtAddr, | ||
void ** | phyAddr | ||
) |
Translates a given file descriptor to a virtual and physical addresss. The following conditions regarding 'fd' must be TRUE:
dmaBufFd | [in] File descriptor to translate. |
size | [in] Size of the memory block corresponding to 'dmaBufFd' in bytes. |
virt_addr | [out] File descriptor corresponding to 'dmaBufFd'. |
phys_addr | [out] Physical address corresponding to 'dmaBufFd'. |