PMSIS API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Cluster DMA

Typedefs

typedef struct pi_cl_dma_cmd_s pi_cl_dma_cmd_t
 Structure for DMA commands. More...
 
typedef struct pi_cl_dma_copy_s pi_cl_dma_copy_t
 Structure for 1D DMA copy structure. More...
 
typedef pi_cl_dma_copy_t pi_cl_dma_copy_2d_t
 Structure for 2D DMA copy structure. More...
 

Enumerations

enum  pi_cl_dma_dir_e
 DMA transfer direction. More...
 

Functions

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...
 

Description

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.

Typedef Documentation

typedef struct pi_cl_dma_cmd_s pi_cl_dma_cmd_t

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.

typedef struct pi_cl_dma_copy_s pi_cl_dma_copy_t

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.

Enumeration Type Documentation

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.

Function Documentation

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 
)
inlinestatic

This enqueues a 1D DMA memory transfer (i.e. classic memory copy) with simple completion based on transfer identifier.

Parameters
extAddress in the external memory where to access the data.
locAddress in the cluster memory where to access the data.
sizeNumber of bytes to be transferred.
dirDirection 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.
cmdA 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
extAddress in the external memory where to access the data.
locAddress in the cluster memory where to access the data.
sizeNumber of bytes to be transferred.
stride2D stride, which is the number of bytes which are added to the beginning of the current line to switch to the next one.
length2D length, which is the number of transferred bytes after which the DMA will switch to the next line.
dirDirection 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.
cmdA 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_wait ( pi_cl_dma_cmd_t cmd)
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
cmdThe 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.

static void pi_cl_dma_memcpy ( pi_cl_dma_copy_t copy)
inlinestatic

This enqueues a 1D DMA memory transfer (i.e. classic memory copy) with simple completion based on transfer identifier.

Parameters
copyA 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_memcpy_2d ( pi_cl_dma_copy_2d_t copy)
inlinestatic

This enqueues a 2D DMA memory transfer (rectangle area) with simple completion based on transfer identifier.

Parameters
copyA 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
copyThe copy structure (1d or 2d).