API Documentation


Direct Memory Access support

group dma

Typedefs

typedef uint32_t dma_transfer_handle_t

DMA transfer handle

The DMA transfer handle is used when calling the DMA functions

Enums

enum dma_success_t

OpTiMSoC dma success code

The OpTiMSoC dma success code indicated the success of an operation.

Values:

DMA_SUCCESS = 0

Successful operation

DMA_ERR_NOTINITIALIZED = 1

Driver not initialized

DMA_ERR_NOSLOT = 2

No slot available

DMA_ERR_NOTALLOCATED = 3

Slot not allocated

enum dma_direction_t

The direction of a DMA transfer

The direction of a DMA transfer is either from local to a remote tile or vice versa

Values:

LOCAL2REMOTE =0

Transfer data from local to remote

REMOTE2LOCAL =1

Transfer data from remore to local

Functions

void dma_init(void)

Initialize DMA driver

Initialize the DMA driver. Necessary before calling it the first time

dma_success_t dma_alloc(dma_transfer_handle_t * id)

Allocate a DMA transfer slot and get handle

This function allocates a DMA slot. DMA transfers are handled asynchronously and each of the ongoing transfers is controlled by one slot in the DMA controller. You therefore need to allocate a slot before starting transfers.

Return
Success code
Parameters
  • id: The handle of this slot

dma_success_t dma_free(dma_transfer_handle_t id)

Free a pre-allocated DMA transfer slot

Return
DMA_SUCCESS if successful, any other value indicates an error
Parameters
  • id: the handle to free

dma_success_t dma_transfer(void * local, uint32_t remote_tile, void * remote, size_t size, dma_direction_t dir, dma_transfer_handle_t id)

Initiate a DMA transfer

This function initiates a DMA transfer between the local address in this tile to remote_tile address remote of size. The direction of the transfer is determined by dir. The slot id will be used for this transfer.

Return
Success code
Parameters
  • local: Local address
  • remote_tile: Remote tile
  • remote: Remote address
  • size: Size of the transfer
  • dir: Direction of the transfer
  • id: Handle of the slot as allocated by dma_alloc

dma_success_t dma_wait(dma_transfer_handle_t id)

Blocking wait for DMA transfer

Wait for a DMA transfer to finish and block.

Return
Success code
Parameters
  • id: The handle of the transfer slot