1.9.4.18 DMA_ChannelSettingsSet Function

C

bool DMA_ChannelSettingsSet ( DMA_CHANNEL channel, DMA_CHANNEL_CONFIG settings );

Summary

Changes the current transfer settings of the specified DMA channel.

Description

This function changes the current transfer settings of the specified DMA channel. The application can use this function along with the DMA_ChannelSettingsGet function to analyze and if required change the transfer parameters of the DMA channel at run time.

Calling this function while a transfer is in progress could result in unpredictable module operation. The application can use the DMA_ChannelIsBusy() function to check if the channel is not busy and then change the channel settings. The new channel settings will be applicable on the next transfer that is schedule using the DMA_ChannelTransfer() function.

Precondition

DMA should have been initialized by calling DMA_Initialize.

Parameters

Param Description
channel The DMA channel whose channel settings need to be obtained.
settings A DMA_CHANNEL_CONFIG type value containing the channel settings.

Returns

True - The channel settings were updated successfully.

False - The channel settings were not updated.

Example

// Change the priority of DMA Channel 0
DMA_CHANNEL_CONFIG settings = 0;
settings = DMA_ChannelSettingsGet(DMA_CHANNEL_0);
settings = (settings & ~DMA_CHCTRLB_PRI_Msk) | DMA_CHCTRLB_PRI(DMA_CHCTRLB_PRI_PRI_2_Val);
DMA_ChannelSettingsSet(DMA_CHANNEL_0, settings);

Remarks

None.