Jump to main content

##

# 2.133.4 XDMACn_ChannelLinkedListTransfer Function

## C

    // n is instance of the peripheral and it is applicable only for devices having multiple instances of the peripheral.
    bool XDMACn_ChannelLinkedListTransfer
    (
    XDMAC_CHANNEL channel,
    uint32_t descriptor,
    XDMAC_DESCRIPTOR_CONTROL* descriptorControl
    )

## Summary

Sets up a multi-block data transfer on a specified XDMAC channel using linked list feature.

## Description

This function sets up multi-block data transfer for a XDMAC channel by linked list operation mode if channel is not busy already. That is each block of data to be transferred is configured as descriptors of a linked list. Each descriptor can be defined in any available descriptor view formats and the views are available as XDMAC_DESCRIPTOR_VIEW_x.

Specified XDMAC channel will be enabled by default upon linked list addition. Upon each block transfer completion XDMAC PLIB will call event handler if the event handler is registered through XDMAC_ChannelCallbackRegister.

## Precondition

XDMAC should have been initialized by calling XDMACn_Initialize. Linked list with descriptors in any available descriptor view formats must be defined.

## Parameters

Param | Description
--- | ---
channel | A specific XDMAC channel
firstDescriptorAddress | Address of the first descriptor of the linked list. All descriptors must be defined in the device specific view formats available as XDMAC_DESCRIPTOR_VIEW_x and must be cache line aligned.
firstDescriptorControl | Control settings for the first descriptor. This must be defined in device specific view format, XDMAC_DESCRIPTOR_CONTROL and must be cache line aligned.

## Returns

- True - If transfer request is accepted.

- False - If previous transfer is in progress and the request is rejected.

## Example

    // Transfer 2 blocks of data to UART TX, each 10 bytes.

    //Two blocks of data
    char src1[11] = {"1234567890"};
    char src2[11] = {"ABCDEFGHIJ"};

        //Cache line aligned first descriptor control, "descptr_crtl"
        //Cache line aligned linked list with descriptors in any supported view,
        //"linkedList1[2]" with 2 descriptors of different source addresses.

        // User registers an event handler with PLIB.
        XDMAC_ChannelCallbackRegister(handle, APP_XDMAC_TransferEventHandler,
        NULL);

        // Add linked list to the XDMAC PLIB, channel will be enabled by default.
        if(XDMAC_ChannelLinkedListTransfer(XDMAC_CHANNEL_1, (uint32_t)&linkedList1[0], &descptr_crtl) == true)
        {
            // do something else
        }
        else
        {
            // try again?
        }

## Remarks

This is supported by only the devices with multi-block transfer feature. The "descriptorControl" parameter is a XDMAC hardware version specific requirement and may not be needed in some of the devices.