Jump to main content

##

# 2.32.12 DMAC_LinkedListDescriptorSetup Function

## C

    void DMAC_LinkedListDescriptorSetup (dmac_descriptor_registers_t* currentDescriptor,
    DMAC_CHANNEL_CONFIG setting,
    const void *srcAddr,
    const void *destAddr,
    size_t blockSize,
    dmac_descriptor_registers_t* nextDescriptor);

## Summary

Sets up linked list descriptor

## Description

This function sets up DMA linked list descriptor. Once the descriptor is setup, DMAC_ChannelLinkedListTransfer API can be used to initiate the linked list mode of DMA transfer.

## Precondition

- DMAC should have been initialized by calling the DMAC_Initialize.

- The Linked List option should have been enabled in MCC DMA manager

## Parameters

Param | Description
--- | ---
currentDescriptor | Address of current descriptor
setting | Block transfer setting of current descriptor
srcAddr | Source address of the DMAC transfer
destAddr | Destination address of the DMAC transfer. If the CRC engine is enabled and configured in Memory mode then store the seed to be used by CRC engine in the destination address.
blockSize | Size of the transfer block in bytes.
nextDescriptor | Address of next descriptor. if user wants to stop the transfer, this argument should be NULL.

## Returns

None.

## Example

    uint8_t txPingBuffer[] = "INITIAL_DMA_DATA_FROM_PING_BUFFER";
    uint8_t txPongBuffer[] = "initial_dma_data_from_pong_buffer";

    __attribute__((__aligned__(16))) static dmac_descriptor_registers_t pTxLinkedListDesc[2];

    #define BUFEER0_TX_BTCTRL (DMAC_BTCTRL_STEPSIZE_X1 | DMAC_BTCTRL_SRCINC_Msk | \
    DMAC_BTCTRL_BEATSIZE_BYTE | DMAC_BTCTRL_BLOCKACT_INT | DMAC_BTCTRL_VALID_Msk)

    // Setup DMA linked list
    DMAC_LinkedListDescriptorSetup (&pTxLinkedListDesc[0],
    BUFEER0_TX_BTCTRL,
    (void *)&txPingBuffer[0],
    (void *)&SERCOM1_REGS->SPIM.SERCOM_DATA,
    sizeof(txPingBuffer),
    &pTxLinkedListDesc[1]);
    DMAC_LinkedListDescriptorSetup (&pTxLinkedListDesc[1],
    BUFEER0_TX_BTCTRL,
    (void *)&txPongBuffer[0],
    (void *)&SERCOM1_REGS->SPIM.SERCOM_DATA,
    sizeof(txPongBuffer),
    // this setting will enable continuous transfer, to stop the transfer this argument should be NULL.
    &pTxLinkedListDesc[0]);

    // Start the DMA in linked list mode
    DMAC_ChannelLinkedListTransfer(DMAC_CHANNEL_1, &pTxLinkedListDesc[0]);

## Remarks

None.