UDMA Module¶
The microDMA(UDMA) API provides a set of functions for configuring and using the UDMA module. Functions are provided to configure which event triggers a DMA transfer, to configure the locations, sizes, and behaviors of the transfers, and to set up and handle interrupts.
-
group
udma_api This module is used for configuring the microDMA.
Defines
-
UDMA_SW_INT41U¶
-
UDMA_ERR_INT42U¶
-
UDMA_CHANNEL_00U¶
-
UDMA_CHANNEL_11U¶
-
UDMA_CHANNEL_22U¶
-
UDMA_CHANNEL_33U¶
-
UDMA_CHANNEL_44U¶
-
UDMA_CHANNEL_55U¶
-
UDMA_CHANNEL_66U¶
-
UDMA_CHANNEL_77U¶
-
UDMA_CHANNEL_88U¶
-
UDMA_CHANNEL_99U¶
-
UDMA_CHANNEL_1010U¶
-
UDMA_CHANNEL_1111U¶
-
UDMA_CHANNEL_1212U¶
-
UDMA_CHANNEL_1313U¶
-
UDMA_CHANNEL_1414U¶
-
UDMA_CHANNEL_1515U¶
-
UDMA_CHANNEL_1616U¶
-
UDMA_CHANNEL_1717U¶
-
UDMA_CHANNEL_1818U¶
-
UDMA_CHANNEL_1919U¶
-
UDMA_CHANNEL_2020U¶
-
UDMA_CHANNEL_2121U¶
-
UDMA_CHANNEL_2222U¶
-
UDMA_CHANNEL_2323U¶
-
UDMA_CHANNEL_2424U¶
-
UDMA_CHANNEL_2525U¶
-
UDMA_CHANNEL_2626U¶
-
UDMA_CHANNEL_2727U¶
-
UDMA_CHANNEL_2828U¶
-
UDMA_CHANNEL_2929U¶
-
UDMA_CHANNEL_3030U¶
-
UDMA_CHANNEL_3131U¶
-
UDMA_CHANNEL_USBEP1_RXUDMA_CHANNEL_0¶
-
UDMA_CHANNEL_USBEP1_TXUDMA_CHANNEL_1¶
-
UDMA_CHANNEL_USBEP2_RXUDMA_CHANNEL_2¶
-
UDMA_CHANNEL_USBEP2_TXUDMA_CHANNEL_3¶
-
UDMA_CHANNEL_USBEP3_RXUDMA_CHANNEL_4¶
-
UDMA_CHANNEL_USBEP3_TXUDMA_CHANNEL_5¶
-
UDMA_CHANNEL_UART0_RXUDMA_CHANNEL_8¶
-
UDMA_CHANNEL_UART0_TXUDMA_CHANNEL_9¶
-
UDMA_CHANNEL_SSI0_RXUDMA_CHANNEL_10¶
-
UDMA_CHANNEL_SSI0_TXUDMA_CHANNEL_11¶
-
UDMA_CHANNEL_SW_CH12UDMA_CHANNEL_12¶
-
UDMA_CHANNEL_SW_CH13UDMA_CHANNEL_13¶
-
UDMA_CHANNEL_AES_CTXINUDMA_CHANNEL_21¶
-
UDMA_CHANNEL_AES_DINUDMA_CHANNEL_22¶
-
UDMA_CHANNEL_AES_CTXOUTUDMA_CHANNEL_23¶
-
UDMA_CHANNEL_AES_DOUTUDMA_CHANNEL_24¶
-
UDMA_CHANNEL_SW_CH26UDMA_CHANNEL_26¶
-
UDMA_CHANNEL_SW_CH27UDMA_CHANNEL_27¶
-
UDMA_CHANNEL_I2C0_RXUDMA_CHANNEL_28¶
-
UDMA_CHANNEL_I2C0_TXUDMA_CHANNEL_29¶
-
UDMA_CHANNEL_SW_CH30UDMA_CHANNEL_30¶
-
UDMA_CH_MAPPING_00x0U¶
-
UDMA_CH_MAPPING_10x1U¶
-
UDMA_CH_ATTR_USEBURST0x00000001U¶ burst requests only
uDMA channel responds to
-
UDMA_CH_ATTR_ALTSELECT0x00000002U¶ alternate control structure
uDMA channel is using
-
UDMA_CH_ATTR_HIGH_PRIORITY0x00000004U¶ priority level
uDMA channel uses high
-
UDMA_CH_ATTR_REQMASK0x00000008U¶ for associated peripheral
uDMA channel is masked
-
UDMA_CH_ATTR_ALL0x0000000FU¶ attributes
OR of all the above
-
UDMA_MODE_STOP0x00000000U¶ Stop Mode.
-
UDMA_MODE_BASIC0x00000001U¶ Basic Mode.
-
UDMA_MODE_AUTO0x00000002U¶ Auto-Request Mode.
-
UDMA_MODE_PINGPONG0x00000003U¶ Ping-Pong Mode.
-
UDMA_MODE_MEM_SCATTER_GATHER0x00000004U¶ Mem Scatter-Gather Mode.
-
UDMA_MODE_PER_SCATTER_GATHER0x00000006U¶ Per Scatter-Gather Mode.
-
UDMA_MODE_ALT_SELECT0x00000001U¶ Specifies Alternate Scatter-Gather Mode when OR’d with either of above two attributes
-
UDMA_DST_INC_80x00000000U¶ Dest addr increment of 8-bit.
-
UDMA_DST_INC_160x40000000U¶ Dest addr increment of 16-bit.
-
UDMA_DST_INC_320x80000000U¶ Dest addr increment of 32-bit.
-
UDMA_DST_INC_NONE0xc0000000U¶ Dest addr increment of 0-bit.
-
UDMA_SRC_INC_80x00000000U¶ Src add increment of 8-bit.
-
UDMA_SRC_INC_160x04000000U¶ Src add increment of 16-bit.
-
UDMA_SRC_INC_320x08000000U¶ Src add increment of 32-bit.
-
UDMA_SRC_INC_NONE0x0C000000U¶ Src add increment of 0-bit.
-
UDMA_SIZE_80x00000000U¶ Src & dest Data size is 8-bit.
-
UDMA_SIZE_160x11000000U¶ Src & dest data size is 16-bit.
-
UDMA_SIZE_320x22000000U¶ Src & dest data size is 32-bit.
-
UDMA_DST_PROT_PRIV0x00200000U¶ Dest addr access is privileged.
-
UDMA_SRC_PROT_PRIV0x00040000U¶ Src addr access is privileged.
-
UDMA_ARB_10x00000000U¶ Arbitrate after 1 transfer.
-
UDMA_ARB_20x00004000U¶ Arbitrate after 2 transfers.
-
UDMA_ARB_40x00008000U¶ Arbitrate after 4 transfers.
-
UDMA_ARB_80x0000c000U¶ Arbitrate after 8 transfers.
-
UDMA_ARB_160x00010000U¶ Arbitrate after 16 transfers.
-
UDMA_ARB_320x00014000U¶ Arbitrate after 32 transfers.
-
UDMA_ARB_640x00018000U¶ Arbitrate after 64 transfers.
-
UDMA_ARB_1280x0001c000U¶ Arbitrate after 128 transfers.
-
UDMA_ARB_2560x00020000U¶ Arbitrate after 256 transfers.
-
UDMA_ARB_5120x00024000U¶ Arbitrate after 512 transfers.
-
UDMA_ARB_10240x00028000U¶ Arbitrate after 1024 transfers.
-
UDMA_NEXT_USEBURST0x00000008U¶ last transfer.
Use burst transfer to complete
-
UDMA_PRI_SELECT0x00000000U¶ Use primary control structure.
-
UDMA_ALT_SELECT0x00000020U¶ Use alternate control structure.
-
UDMA_TASK_STRUCT_ENTRY(transferCount, itemSize, srcIncrement, srcAddr, dstIncrement, dstAddr, arbSize, mode){ \
(((srcIncrement) ==
UDMA_SRC_INC_NONE) ? (void *)(srcAddr) : \
((void *)(&((uint8_t *)(srcAddr))[((transferCount) << \
((srcIncrement) >>
UDMA_DMACHCTL_SRCINC_S)) - 1]))), \
(((dstIncrement) ==
UDMA_DST_INC_NONE) ? (void *)(dstAddr) : \
((void *)(&((uint8_t *)(dstAddr))[((transferCount) << \
((dstIncrement) >>
UDMA_DMACHCTL_DSTINC_S)) - 1]))), \
(srcIncrement) | (dstIncrement) | (itemSize) | (arbSize) | \
(((transferCount) - 1) << 4) | \
((((mode) ==
UDMA_MODE_MEM_SCATTER_GATHER) || \
((mode) ==
UDMA_MODE_PER_SCATTER_GATHER)) ? \
(mode) |
UDMA_MODE_ALT_SELECT: (mode)), 0 \
}
¶ A helper macro for building scatter-gather task table entries.
This macro is intended to be used to help populate a table of uDMA tasks for a scatter-gather transfer. This macro will calculate the values for the fields of a task structure entry based on the input parameters.
- Parameters
transferCount: is the count of items to transfer for this task.itemSize: is the bit size of the items to transfer for this task.srcIncrement: is the bit size increment for source data.srcAddr: is the starting address of the data to transfer.dstIncrement: is the bit size increment for destination data.dstAddr: is the starting address of the destination data.arbSize: is the arbitration size to use for the transfer task.mode: is the transfer mode for this task.
There are specific requirements for the values of each parameter. No checking is done so it is up to the caller to ensure that correct values are used for the parameters.
The transferCount parameter is the number of items that will be transferred by this task. It must be in the range 1-1024.
The itemSize parameter is the bit size of the transfer data. It must be one of UDMA_SIZE_8, UDMA_SIZE_16, or UDMA_SIZE_32.
The srcIncrement parameter is the increment size for the source data. It must be one of UDMA_SRC_INC_8, UDMA_SRC_INC_16, UDMA_SRC_INC_32, or UDMA_SRC_INC_NONE.
The srcAddr parameter is a void pointer to the beginning of the source data.
The dstIncrement parameter is the increment size for the destination data. It must be one of UDMA_DST_INC_8, UDMA_DST_INC_16, UDMA_DST_INC_32, or UDMA_DST_INC_NONE.
The dstAddr parameter is a void pointer to the beginning of the location where the data will be transferred.
The arbSize parameter is the arbitration size for the transfer, and must be one of UDMA_ARB_1, UDMA_ARB_2, UDMA_ARB_4, and so on up to UDMA_ARB_1024. This is used to select the arbitration size in powers of 2, from 1 to 1024.
The mode parameter is the mode to use for this transfer task. It must be one of UDMA_MODE_BASIC, UDMA_MODE_AUTO, UDMA_MODE_MEM_SCATTER_GATHER, or UDMA_MODE_PER_SCATTER_GATHER. Note that normally all tasks will be one of the scatter-gather modes while the last task is a task list will be AUTO or BASIC.
This macro is intended to be used to initialize individual entries of a structure of UDMA_ControlTable type, like this:
//! UDMA_ControlTable MyTaskList[] = //! { //! UDMA_TASK_STRUCT_ENTRY(Task1Count, UDMA_SIZE_8, //! UDMA_SRC_INC_8, MySourceBuf, //! UDMA_DST_INC_8, MyDestBuf, //! UDMA_ARB_8, UDMA_MODE_MEM_SCATTER_GATHER), //! UDMA_TASK_STRUCT_ENTRY(Task2Count, ...), //! } //!
\return Nothing; this is not a function.
Functions
-
void
UDMA_enable(uint32_t base)¶ Enables the uDMA controller for use.
This function enables the uDMA controller. The uDMA controller must be enabled before it can be configured and used.
- Parameters
base: is the base address of the uDMA instance used.
- Return
None.
-
void
UDMA_disable(uint32_t base)¶ Disables the uDMA controller for use.
This function disables the uDMA controller. Once disabled, the uDMA controller cannot operate until re-enabled with
UDMA_enable().- Parameters
base: is the base address of the uDMA instance used.
- Return
None.
-
uint32_t
UDMA_getErrorStatus(uint32_t base)¶ Gets the uDMA error status.
This function returns the uDMA error status. It should be called from within the uDMA error interrupt handler to determine if a uDMA error occurred.
- Parameters
base: is the base address of the uDMA instance used.
- Return
Returns non-zero if a uDMA error is pending.
-
void
UDMA_clearErrorStatus(uint32_t base)¶ Clears the uDMA error interrupt.
This function clears a pending uDMA error interrupt. This function should be called from within the uDMA error interrupt handler to clear the interrupt.
- Parameters
base: is the base address of the uDMA instance used.
- Return
None.
-
void
UDMA_enableChannel(uint32_t base, uint32_t channelNum)¶ Enables a uDMA channel for operation.
This function enables a specific uDMA channel for use. This function must be used to enable a channel before it can be used to perform a uDMA transfer.
- Parameters
base: is the base address of the uDMA instance used.channelNum: is the channel number to enable.
When a uDMA transfer is completed, the channel is automatically disabled by the uDMA controller. Therefore, this function should be called prior to starting up any new transfer.
- Return
None.
-
void
UDMA_disableChannel(uint32_t base, uint32_t channelNum)¶ Disables a uDMA channel for operation.
This function disables a specific uDMA channel. Once disabled, a channel cannot respond to uDMA transfer requests until re-enabled via
UDMA_enableChannel().- Parameters
base: is the base address of the uDMA instance used.channelNum: is the channel number to disable.
- Return
None.
-
bool
UDMA_isChannelEnabled(uint32_t base, uint32_t channelNum)¶ Checks if a uDMA channel is enabled for operation.
This function checks to see if a specific uDMA channel is enabled. This function can be used to check the status of a transfer, as the channel is automatically disabled at the end of a transfer.
- Parameters
base: is the base address of the uDMA instance used.channelNum: is the channel number to check.
- Return
Returns true if the channel is enabled, false if disabled.
-
void
UDMA_setControlBase(uint32_t base, const void *controlTable)¶ Sets the base address for the channel control table.
This function configures the base address of the channel control table. This table resides in system memory and holds control information for each uDMA channel. The table must be aligned on a 1024-byte boundary. The base address must be configured before any of the channel functions can be used.
- Parameters
base: is the base address of the uDMA instance used.controlTable: is a pointer to the 1024-byte-aligned base address of the uDMA channel control table.
The size of the channel control table depends on the number of uDMA channels and the transfer modes that are used. Refer to the introductory text and the microcontroller datasheet for more information about the channel control table.
- Return
None.
-
void *
UDMA_getControlBase(uint32_t base)¶ Gets the base address for the channel control table.
This function gets the base address of the channel control table. This table resides in system memory and holds control information for each uDMA channel.
- Parameters
base: is the base address of the uDMA instance used.
- Return
Returns a pointer to the base address of the channel control table.
-
void *
UDMA_getAlternateControlBase(uint32_t base)¶ Gets the base address for the channel control table alternate structures.
This function gets the base address of the second half of the channel control table that holds the alternate control structures for each channel.
- Parameters
base: is the base address of the uDMA instance used.
- Return
Returns a pointer to the base address of the second half of the channel control table.
-
void
UDMA_requestSoftwareTransfer(uint32_t base, uint32_t channelNum)¶ Requests a uDMA channel to start a transfer.
This function allows software to request a uDMA channel to begin a transfer. This function could be used for performing a memory-to-memory transfer, or if for some reason a transfer needs to be initiated by software instead of the peripheral associated with that channel.
- Parameters
base: is the base address of the uDMA instance used.channelNum: is the channel number on which to request a uDMA transfer.
- Note
If the software channel and interrupts are used, then the completion is signaled on the uDMA dedicated interrupt. If a peripheral channel is used, then the completion is signaled on the peripheral’s interrupt.
- Return
None.
-
void
UDMA_setChannelControlParams(uint32_t base, uint32_t index, uint32_t chControlAttr)¶ Sets the control parameters for a uDMA channel control structure.
This function is used to set control parameters for a uDMA transfer. These parameters are typically not changed often.
- Parameters
base: is the base address of the uDMA instance used.index: is the control table structure index.chControlAttr: specifies the channel control parameters.
The index parameter should be the logical OR of the channel number with one of UDMA_PRI_SELECT or UDMA_ALT_SELECT to choose whether the primary or alternate data structure is used.
The chControlAttr parameter is the logical OR of five values: the data size, the source address increment, the destination address increment, the arbitration size, and the use burst flag. The choices available for each of these values is described below.
Choose the data size from one of UDMA_SIZE_8, UDMA_SIZE_16, or UDMA_SIZE_32 to select a data size of 8, 16, or 32 bits.
Choose the source address increment from one of UDMA_SRC_INC_8, UDMA_SRC_INC_16, UDMA_SRC_INC_32, or UDMA_SRC_INC_NONE to select an address increment of 8-bit bytes, 16-bit half-words, 32-bit words, or to select non-incrementing.
Choose the destination address increment from one of UDMA_DST_INC_8, UDMA_DST_INC_16, UDMA_DST_INC_32, or UDMA_DST_INC_NONE to select an address increment of 8-bit bytes, 16-bit half-words, 32-bit words, or to select non-incrementing.
The arbitration size determines how many items are transferred before the uDMA controller re-arbitrates for the bus. Choose the arbitration size from one of UDMA_ARB_1, UDMA_ARB_2, UDMA_ARB_4, UDMA_ARB_8, through UDMA_ARB_1024 to select the arbitration size from 1 to 1024 items, in powers of 2.
The value UDMA_NEXT_USEBURST is used to force the channel to only respond to burst requests at the tail end of a scatter-gather transfer.
- Note
The address increment cannot be smaller than the data size.
- Return
None.
-
uint32_t
UDMA_getChannelTransferMode(uint32_t base, uint32_t index)¶ Gets the transfer mode for a uDMA channel control structure.
This function is used to get the transfer mode for the uDMA channel and to query the status of a transfer on a channel. When the transfer is complete the mode is
UDMA_MODE_STOP.- Parameters
base: is the base address of the uDMA instance used.index: is the index for channel control structure.
- Return
Returns the transfer mode of the specified channel and control structure, which is one of the following values: UDMA_MODE_STOP, UDMA_MODE_BASIC, UDMA_MODE_AUTO, UDMA_MODE_PINGPONG, UDMA_MODE_MEM_SCATTER_GATHER, UDMA_MODE_PER_SCATTER_GATHER.
-
void
UDMA_changeChannelMapping(uint32_t base, uint32_t channelNum, uint32_t chMapping)¶ Configures peripheral mapping for any uDMA channel.
This function configures peripheral mapping for any uDMA channel. Each uDMA channel can be mapped to a fixed set of peripherals. Refer device datasheet for all the possible configurations for a channel. The param
channelNum can take values 0U-31U specifying uDMA channels. The param chMapping specifies possible peripheral assignmentes for a channel. For selecting primary or secondary channel assignment UDMA_CH_MAPPING_0 or UDMA_CH_MAPPING_1 macros can be used.- Parameters
base: is the base address of the uDMA instance used.channelNum: is the uDMA channel to be assigned.chMapping: specifies the peripheral assignment for the channel.
- Note
This function is only available on devices that have the DMA Channel Map Select registers (DMACHMAP0-3). Please consult the data sheet for your part.
- Return
None.
-
void
UDMA_registerInterrupt(uint32_t channelInt, void (*fnHandler)(void))¶ Registers an interrupt handler for the uDMA controller.
This function registers and enables the handler to be called when the uDMA controller generates an interrupt. The param
channelInt can take following values: UDMA_SW_INT or UDMA_ERR_INT.- Parameters
channelInt: identifies which uDMA interrupt is to be registered.fnHandler: is a pointer to the function to be called when the interrupt is activated.
- See
Interrupt_registerHandler() for important information about registering interrupt handlers.
- Note
The interrupt handler for the uDMA is for transfer completion when the software channel is used and for error interrupts. The interrupts for each peripheral channel are handled through the individual peripheral interrupt handlers.
- Return
None.
-
void
UDMA_unregisterInterrupt(uint32_t channelInt)¶ Unregisters an interrupt handler for the uDMA controller.
This function disables and unregisters the handler to be called for the specified uDMA interrupt. The param
channelInt can take following values: UDMA_SW_INT or UDMA_ERR_INT.- Parameters
channelInt: identifies which uDMA interrupt to unregister.
- See
Interrupt_registerHandler() for important information about registering interrupt handlers.
- Return
None.
-
void
UDMA_enableChannelAttribute(uint32_t base, uint32_t channelNum, uint32_t channelAttr)¶ Enables attributes of a uDMA channel.
This function is used to enable attributes of a uDMA channel.
- Parameters
base: is the base address of the uDMA instance used.channelNum: is the channel to configure.channelAttr: is a combination of attributes for the channel.
The channelAttr parameter is the logical OR of any of the following:
UDMA_CH_ATTR_USEBURST is used to restrict transfers to use only burst mode
UDMA_CH_ATTR_ALTSELECT is used to select the alternate control structure for this channel (it is very unlikely that this flag should be used)
UDMA_CH_ATTR_HIGH_PRIORITY is used to set this channel to high priority
UDMA_CH_ATTR_REQMASK is used to mask the hardware request signal from the peripheral for this channel.
- Return
None.
-
void
UDMA_disableChannelAttribute(uint32_t base, uint32_t channelNum, uint32_t channelAttr)¶ Disables attributes of a uDMA channel.
This function is used to disable attributes of a uDMA channel.
- Parameters
base: is the base address of the uDMA instance used.channelNum: is the channel to configure.channelAttr: is a combination of attributes for the channel.
The channelAttr parameter is the logical OR of any of the following:
UDMA_CH_ATTR_USEBURST is used to restrict transfers to use only burst mode.
UDMA_CH_ATTR_ALTSELECT is used to select the alternate control structure for this channel.
UDMA_CH_ATTR_HIGH_PRIORITY is used to set this channel to high priority.
UDMA_CH_ATTR_REQMASK is used to mask the hardware request signal from the peripheral for this channel.
- Return
None.
-
uint32_t
UDMA_getChannelAttribute(uint32_t base, uint32_t channelNum)¶ Gets the enabled attributes of a uDMA channel.
This function returns a combination of flags representing the attributes of the uDMA channel.
- Parameters
base: is the base address of the uDMA instance used.channelNum: is the channel to configure.
- Return
Returns the logical OR of the attributes of the uDMA channel, which can be any of the following:
UDMA_CH_ATTR_USEBURST is used to restrict transfers to use only burst mode
UDMA_CH_ATTR_ALTSELECT is used to select the alternate control structure for this channel
UDMA_CH_ATTR_HIGH_PRIORITY is used to set this channel to high priority
UDMA_CH_ATTR_REQMASK is used to mask the hardware request signal from the peripheral for this channel
-
void
UDMA_setChannelTransferParams(uint32_t base, uint32_t index, void *srcAddr, void *dstAddr, uint32_t transferMode, uint32_t transferSize)¶ Sets the transfer parameters for a uDMA channel control structure.
This function is used to configure the parameters for a uDMA transfer. These parameters are not typically changed often. The function
UDMA_setChannelControlParams() MUST be called at least once for this channel prior to calling this function.- Parameters
base: is the base address of the uDMA instance used.index: is the index for channel control structure.transferMode: is the type of uDMA transfer mode.srcAddr: is the source address for the transfer.dstAddr: is the destination address for the transfer.transferSize: is the number of data items to transfer.
The index parameter should be the logical OR of the channel number with one of UDMA_PRI_SELECT or UDMA_ALT_SELECT to choose whether the primary or alternate data structure is used.
The mode parameter should be one of the following values:
UDMA_MODE_STOP stops the uDMA transfer. The controller sets the mode to this value at the end of a transfer.
UDMA_MODE_BASIC to perform a basic transfer based on request.
UDMA_MODE_AUTO to perform a transfer that always completes once started even if the request is removed.
UDMA_MODE_PINGPONG to set up a transfer that switches between the primary and alternate control structures for the channel. This mode allows use of ping-pong buffering for uDMA transfers.
UDMA_MODE_MEM_SCATTER_GATHER to set up a memory scatter-gather transfer.
UDMA_MODE_PER_SCATTER_GATHER to set up a peripheral scatter-gather transfer.
The srcAddr and dstAddr parameters are pointers to the first location of the data to be transferred. These addresses should be aligned according to the item size. The compiler takes care of this alignment if the pointers are pointing to storage of the appropriate data type.
The transferSize parameter is the number of data items, not the number of bytes.
The two scatter-gather modes, memory and peripheral, are actually different depending on whether the primary or alternate control structure is selected. This function looks for the UDMA_PRI_SELECT and UDMA_ALT_SELECT flag along with the channel number and sets the scatter-gather mode as appropriate for the primary or alternate control structure.
The channel must also be enabled using UDMA_enableChannel() after calling this function. The transfer does not begin until the channel has been configured and enabled. Note that the channel is automatically disabled after the transfer is completed, meaning that UDMA_enableChannel() must be called again after setting up the next transfer.
- Note
Great care must be taken to not modify a channel control structure that is in use or else the results are unpredictable, including the possibility of undesired data transfers to or from memory or peripherals. For BASIC and AUTO modes, it is safe to make changes when the channel is disabled, or the uDMA_getChannelMode() returns UDMA_MODE_STOP. For PINGPONG or one of the SCATTER_GATHER modes, it is safe to modify the primary or alternate control structure only when the other is being used. The uDMA_getChannelMode() function returns UDMA_MODE_STOP when a channel control structure is inactive and safe to modify.
- Return
None.
-
uint32_t
UDMA_getChannelTransferSize(uint32_t base, uint32_t index)¶ Gets the current transfer size for a uDMA channel control structure.
This function is used to get the uDMA transfer size for a channel. The transfer size is the number of items to transfer, where the size of an item might be 8, 16, or 32 bits. If a partial transfer has already occurred, then the number of remaining items is returned. If the transfer is complete, then 0 is returned.
- Parameters
base: is the base address of the uDMA instance used.index: is the index for channel control structure.
- Return
Returns the number of items remaining to transfer.
-
void
UDMA_setChannelScatterGatherMode(uint32_t base, uint32_t channelNum, uint32_t taskCount, UDMA_ControlTable *taskList, bool isPeriphScatterGather)¶ Configures a uDMA channel for scatter-gather mode.
This function is used to configure a channel for scatter-gather mode. The caller must have already set up a task list and must pass a pointer to the start of the task list as the
taskList parameter. The taskCount parameter is the count of tasks in the task list, not the size of the task list. The flag isPeriphScatterGather should be used to indicate if scatter-gather should be configured for peripheral or memory operation.- Parameters
base: is the base address of the uDMA instance used.channelNum: is the uDMA channel number.taskCount: is the number of scatter-gather tasks to execute.taskList: is a pointer to the beginning of the scatter-gather task list.isPeriphScatterGather: is a flag to indicate it is a peripheral scatter-gather transfer (else it is memory scatter-gather transfer)
- See
- Return
None.
-
struct
UDMA_ControlTable¶ - #include <udma.h>
A structure that defines an entry in the channel control table. These fields are used by the uDMA controller and normally it is not necessary for software to directly read or write fields in the table.
-
The code for this module is contained in driverlib_cm/udma.c, with driverlib_cm/udma.h containing the API declarations for use by applications.