uDMA Library
The mikroPascal 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 |
procedure 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 |
procedure 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 |
function uDMA_ErrorStatusGet() : dword; |
---|---|
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 |
procedure 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 |
function uDMA_ChannelEnable(channelNum : dword) : byte; |
---|---|
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 |
function uDMA_ChannelDisable(channelNum : dword) : byte; |
---|---|
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 |
function uDMA_ChannelIsEnabled(channelNum : dword) : byte; |
---|---|
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 |
function uDMA_ControlBaseSet(psControlTable : dword) : byte; |
---|---|
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 |
function uDMA_ControlBaseGet() : dword; |
---|---|
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 |
function uDMA_ControlAlternateBaseGet() : dword; |
---|---|
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 |
function uDMA_ChannelRequest(channelNum : dword) : byte; |
---|---|
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 |
function uDMA_ChannelAttributeEnable(channelNum : dword; attr : dword) : byte; |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function is used to disable attributes of a uDMA channel. |
||||||||||||||||||
Parameters |
|
||||||||||||||||||
Returns |
|
||||||||||||||||||
Requires |
Nothing. |
||||||||||||||||||
Notes |
None. |
uDMA_ChannelAttributeDisable
Prototype |
function uDMA_ChannelAttributeDisable(channelNum : dword; attr : dword) : byte; |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function is used to enable attributes of a uDMA channel. |
||||||||||||||||||
Parameters |
|
||||||||||||||||||
Returns |
|
||||||||||||||||||
Requires |
Nothing. |
||||||||||||||||||
Notes |
None. |
uDMA_ChannelAttributeGet
Prototype |
function uDMA_ChannelAttributeGet(channelNum : dword) : dword; |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This function returns a combination of flags representing the attributes of the uDMA channel. |
||||||||||||||||||
Parameters |
|
||||||||||||||||||
Returns |
|
||||||||||||||||||
Requires |
Nothing. |
||||||||||||||||||
Notes |
None. |
uDMA_ChannelControlSet
Prototype |
function uDMA_ChannelControlSet(channelStructIndex : dword; control : dword) : byte; |
||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
function uDMA_ChannelTransferSet(channelStructIndex : dword; mode : dword; pvSrcAddr : ^dword; pvDstAddr : ^dword; transferSize : dword) : byte; |
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
function uDMA_ChannelSizeGet(channelStructIndex : dword) : dword; |
---|---|
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 |
function uDMA_ChannelModeGet(channelStructIndex : dword) : dword; |
---|---|
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 |
procedure uDMA_ChannelAssign(mapping : dword); |
---|---|
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 |
procedure 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. |