dma_xfer function

The dma_xfer function initiates a DMA transmit, receive, or exchange transaction. The prototype for this function is:

int dma_xfer( void *hdl,
              uint32_t device,
              spi_dma_paddr_t *paddr,
              int len );

The arguments are:

The handle of the low-level module that the init function returned.
The device ID.
A pointer to the DMA buffer address, which is defined as:
typedef struct {
    uint64_t    rpaddr;
    uint64_t    wpaddr;
} spi_dma_paddr_t;

The rpaddr and wpaddr are physical addresses.

The length, in bytes, of the data for this DMA transaction.

This function must return the number of bytes that have been successfully transferred by DMA, or -1 if an error occurred. It's the responsibility of the application to manage the DMA buffer.