1.2.6.3 SYS_DMA_ChannelIsBusy Function

C

bool SYS_DMA_ChannelIsBusy (SYS_DMA_CHANNEL channel)

Summary

Returns the busy status of a specific DMA Channel.

Description

This function returns the busy status of the DMA channel. DMA channel will be busy if any transfer is in progress.

This function can be used to check the status of the channel prior to submitting a transfer request. And this can also be used to check the status of the submitted request if callback mechanism is not preferred.

Precondition

DMA Controller should have been initialized.

Parameters

ParamDescription
channelA specific DMA channel

Returns

Busy status of the specific channel. - True - Channel is busy

- False - Channel is free

Example

// Transfer 10 bytes of data to UART TX using DMA channel 1
// DMA Channel has been configured and initialized by appropriate PLIB call.

uint8_t buf[10] = {0,1,2,3,4,5,6,7,8,9};
    void *srcAddr = (uint8_t *) buf;
    void *destAddr = (uin8_t*) &U1TXREG;
    size_t size = 10;
    
    if(false == SYS_DMA_ChannelIsBusy(SYS_DMA_CHANNEL_1))
    {
        SYS_DMA_ChannelTransfer(SYS_DMA_CHANNEL_1, srcAddr, destAddr, size);
    }

Remarks

None.