uDMA Library
The mikroC PRO for ARM provides a library for working with uDMA module.
The TM4C129xxxxx series microcontroller includes a Direct Memory Access (DMA) controller, known as micro-DMA (uDMA). The uDMA controller provides a way to offload data transfer tasks from the
processor, allowing for more efficient use of the processor and the available bus bandwidth.
The uDMA controller can perform transfers between memory and peripherals. It has dedicated channels for each supported on-chip module and can be programmed to automatically perform transfers between peripherals and memory as the peripheral is ready to transfer more data.
Library Routines
- uDMA_Enable
- uDMA_Disable
- uDMA_ErrorStatusGet
- uDMA_ErrorStatusClear
- uDMA_ChannelEnable
- uDMA_ChannelDisable
- uDMA_ChannelIsEnabled
- uDMA_ControlBaseSet
- uDMA_ControlBaseGet
- uDMA_ControlAlternateBaseGet
- uDMA_ChannelRequest
- uDMA_ChannelAttributeEnable
- uDMA_ChannelAttributeDisable
- uDMA_ChannelAttributeGet
- uDMA_ChannelControlSet
- uDMA_ChannelTransferSet
- uDMA_ChannelSizeGet
- uDMA_ChannelModeGet
- uDMA_ChannelAssign
- uDMA_Init
uDMA_Enable
Prototype |
void uDMA_Enable(); |
---|---|
Description |
This function enables the uDMA controller. The uDMA controller must be enabled before it can be configured and used. |
Parameters |
None. |
Returns |
none. |
Requires |
Nothing. |
Notes |
None. |
uDMA_Disable
Prototype |
void uDMA_Disable(); |
---|---|
Description |
This function disables the uDMA controller. Once disabled, the uDMA controller cannot operate until re-enabled with uDMA_Enable. |
Parameters |
None. |
Returns |
none. |
Requires |
Nothing. |
Notes |
None. |
uDMA_ErrorStatusGet
Prototype |
unsigned long uDMA_ErrorStatusGet(); |
---|---|
Description |
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 |
None. |
Returns |
Returns non-zero if a uDMA error is pending. |
Requires |
Nothing. |
Notes |
None. |
uDMA_ErrorStatusClear
Prototype |
void uDMA_ErrorStatusClear(); |
---|---|
Description |
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 |
None. |
Returns |
Nothing. |
Requires |
Nothing. |
Notes |
None. |
uDMA_ChannelEnable
Prototype |
unsigned short uDMA_ChannelEnable(unsigned long channelNum); |
---|---|
Description |
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 |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
uDMA_ChannelDisable
Prototype |
unsigned short uDMA_ChannelDisable(unsigned long channelNum); |
---|---|
Description |
This function disables a specific uDMA channel. Once disabled, a channel cannot respond to uDMA transfer requests until re-enabled via uDMA_ChannelEnable. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
uDMA_ChannelIsEnabled
Prototype |
unsigned short uDMA_ChannelIsEnabled(unsigned long channelNum); |
---|---|
Description |
his 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 |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
uDMA_ControlBaseSet
Prototype |
unsigned short uDMA_ControlBaseSet(unsigned long psControlTable); |
---|---|
Description |
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 size of the channel control table depends on the number of uDMA channels and the transfer modes that are used.
|
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
uDMA_ControlBaseGet
Prototype |
unsigned long uDMA_ControlBaseGet(); |
---|---|
Description |
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 |
None. |
Returns |
Returns a pointer to the base address of the channel control table. |
Requires |
Nothing. |
Notes |
None. |
uDMA_ControlAlternateBaseGet
Prototype |
unsigned long uDMA_ControlAlternateBaseGet(); |
---|---|
Description |
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 |
None. |
Returns |
Returns a pointer to the base address of the second half of the channel control table. |
Requires |
Nothing. |
Notes |
None. |
uDMA_ChannelRequest
Prototype |
unsigned short uDMA_ChannelRequest(unsigned long channelNum); |
---|---|
Description |
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,
|
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
If the channel is |
uDMA_ChannelAttributeEnable
Prototype |
unsigned short uDMA_ChannelAttributeEnable(unsigned long channelNum, unsigned long attr); |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function is used to disable attributes of a uDMA channel. |
||||||||||||||||||
Parameters |
|
||||||||||||||||||
Returns |
|
||||||||||||||||||
Requires |
Nothing. |
||||||||||||||||||
Notes |
None. |
uDMA_ChannelAttributeDisable
Prototype |
unsigned short uDMA_ChannelAttributeDisable(unsigned long channelNum, unsigned long attr); |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function is used to enable attributes of a uDMA channel. |
||||||||||||||||||
Parameters |
|
||||||||||||||||||
Returns |
|
||||||||||||||||||
Requires |
Nothing. |
||||||||||||||||||
Notes |
None. |
uDMA_ChannelAttributeGet
Prototype |
unsigned long uDMA_ChannelAttributeGet(unsigned long channelNum); |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function returns a combination of flags representing the attributes of the uDMA channel. |
||||||||||||||||||
Parameters |
|
||||||||||||||||||
Returns |
|
||||||||||||||||||
Requires |
Nothing. |
||||||||||||||||||
Notes |
None. |
uDMA_ChannelControlSet
Prototype |
unsigned short uDMA_ChannelControlSet(unsigned long channelStructIndex, unsigned long control); |
||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function is used to set control parameters for a uDMA transfer. These parameters are typically not changed often. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Parameters |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
Requires |
Nothing. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Notes |
The address increment cannot be smaller than the data size. |
uDMA_ChannelTransferSet
Prototype |
unsigned short uDMA_ChannelTransferSet(unsigned long channelStructIndex, unsigned long mode, void *pvSrcAddr, void *pvDstAddr, unsigned long transferSize); |
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function is used to configure the parameters for a uDMA transfer. These parameters are typically changed often.
|
||||||||||||||
Parameters |
|
||||||||||||||
Returns |
|
||||||||||||||
Requires |
Nothing. |
||||||||||||||
Notes |
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 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 two scatter-gather modes, memory and peripheral, are actually different depending on whether the primary or alternate control structure is selected.
The channel must also be enabled using uDMA_ChannelEnable after calling this function. The transfer does not begin until the channel has been configured and enabled.
|
uDMA_ChannelSizeGet
Prototype |
unsigned long uDMA_ChannelSizeGet(unsigned long channelStructIndex); |
---|---|
Description |
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. |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
uDMA_ChannelModeGet
Prototype |
unsigned long uDMA_ChannelModeGet(unsigned long channelStructIndex); |
---|---|
Description |
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 |
Parameters |
|
Returns |
|
Requires |
Nothing. |
Notes |
None. |
uDMA_ChannelAssign
Prototype |
void uDMA_ChannelAssign(unsigned long mapping); |
---|---|
Description |
This function assigns a peripheral mapping to a uDMA channel. It is used to select which peripheral is used for a uDMA channel. |
Parameters |
|
Returns |
None. |
Requires |
Nothing. |
Notes |
None. |
uDMA_Init
Prototype |
void uDMA_Init(); |
---|---|
Description |
This function initializes uDMA controller. |
Parameters |
None. |
Returns |
None. |
Requires |
Nothing. |
Notes |
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. |
What do you think about this topic ? Send us feedback!