|
static void | pi_cl_dma_cmd (uint32_t ext, uint32_t loc, uint32_t size, pi_cl_dma_dir_e dir, pi_cl_dma_cmd_t *cmd) |
| 1D DMA memory transfer. More...
|
|
static void | pi_cl_dma_cmd_2d (uint32_t ext, uint32_t loc, uint32_t size, uint32_t stride, uint32_t length, pi_cl_dma_dir_e dir, pi_cl_dma_cmd_t *cmd) |
| 2D DMA memory transfer. More...
|
|
static void | pi_cl_dma_cmd_wait (pi_cl_dma_cmd_t *cmd) |
| Simple DMA transfer completion wait. More...
|
|
static void | pi_cl_dma_flush () |
| Simple DMA transfer completion flush. More...
|
|
static void | pi_cl_dma_memcpy (pi_cl_dma_copy_t *copy) |
| 1D DMA memory transfer. More...
|
|
static void | pi_cl_dma_memcpy_2d (pi_cl_dma_copy_2d_t *copy) |
| 2D DMA memory transfer. More...
|
|
static void | pi_cl_dma_wait (void *copy) |
| Simple DMA transfer completion wait. More...
|
|
This set of functions provides support for controlling the cluster DMA. The cluster has its own local memory for fast access from the cluster cores while the other memories are relatively slow if accessed by the cluster. To keep all the cores available for computation each cluster contains a DMA unit whose role is to asynchronously transfer data between a remote memory and the cluster memory.
The DMA is using HW counters to track the termination of transfers. Each transfer is by default allocating one counter, which is freed when the wait function is called and returns, which is limiting the maximum number of transfers which can be done at the same time. You can check the chip-specific section to know the number of HW counters.
This structure is used by the runtime to manage a DMA command. It must be instantiated once for each copy and must be kept alive until the copy is finished. It can be instantiated as a normal variable, for example as a global variable, a local one on the stack, or through the memory allocator.
This structure is used by the runtime to manage a 2D DMA copy. It must be instantiated once for each copy and must be kept alive until the copy is finished. It can be instantiated as a normal variable, for example as a global variable, a local one on the stack, or through the memory allocator.
This structure is used by the runtime to manage a 1D DMA copy. It must be instantiated once for each copy and must be kept alive until the copy is finished. It can be instantiated as a normal variable, for example as a global variable, a local one on the stack, or through the memory allocator.
Describes the direction for a DMA transfer.
Enumerator |
---|
PI_CL_DMA_DIR_LOC2EXT |
Transfer from cluster memory to external memory.
|
PI_CL_DMA_DIR_EXT2LOC |
Transfer from external memory to cluster memory.
|
This enqueues a 1D DMA memory transfer (i.e. classic memory copy) with simple completion based on transfer identifier.
- Parameters
-
ext | Address in the external memory where to access the data. |
loc | Address in the cluster memory where to access the data. |
size | Number of bytes to be transferred. |
dir | Direction of the transfer. If it is PI_CL_DMA_DIR_EXT2LOC, the transfer is loading data from external memory and storing to cluster memory. If it is PI_CL_DMA_DIR_LOC2EXT, it is the opposite. |
cmd | A pointer to the structure for the copy. This can be used with pi_cl_dma_wait to wait for the completion of this transfer. |
static void pi_cl_dma_cmd_2d |
( |
uint32_t |
ext, |
|
|
uint32_t |
loc, |
|
|
uint32_t |
size, |
|
|
uint32_t |
stride, |
|
|
uint32_t |
length, |
|
|
pi_cl_dma_dir_e |
dir, |
|
|
pi_cl_dma_cmd_t * |
cmd |
|
) |
| |
|
inlinestatic |
This enqueues a 2D DMA memory transfer (rectangle) with simple completion based on transfer identifier.
- Parameters
-
ext | Address in the external memory where to access the data. |
loc | Address in the cluster memory where to access the data. |
size | Number of bytes to be transferred. |
stride | 2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one. |
length | 2D length, which is the number of transferred bytes after which the DMA will switch to the next line. |
dir | Direction of the transfer. If it is PI_CL_DMA_DIR_EXT2LOC, the transfer is loading data from external memory and storing to cluster memory. If it is PI_CL_DMA_DIR_LOC2EXT, it is the opposite. |
cmd | A pointer to the structure for the copy. This can be used with pi_cl_dma_wait to wait for the completion of this transfer. |
This blocks the core until the specified transfer is finished. The transfer must be described trough the identifier given to the copy function.
- Parameters
-
cmd | The copy structure (1d or 2d). |
static void pi_cl_dma_flush |
( |
| ) |
|
|
inlinestatic |
This blocks the core until the DMA does not have any pending transfer.
This enqueues a 1D DMA memory transfer (i.e. classic memory copy) with simple completion based on transfer identifier.
- Parameters
-
copy | A pointer to the structure describing the transfer. The same structure can be used with pi_cl_dma_wait to wait for the completion of this transfer. |
This enqueues a 2D DMA memory transfer (rectangle area) with simple completion based on transfer identifier.
- Parameters
-
copy | A pointer to the structure describing the transfer. The same structure can be used with pi_cl_dma_wait to wait for the completion of this transfer. |
static void pi_cl_dma_wait |
( |
void * |
copy | ) |
|
|
inlinestatic |
This blocks the core until the specified transfer is finished. The transfer must be described trough the identifier given to the copy function.
- Parameters
-
copy | The copy structure (1d or 2d). |