Download Stellaris Peripheral Driver Library User's Guide

Transcript
uDMA Controller
23.2.1 Detailed Description
The uDMA API functions provide a means to enable and configure the Stellaris microDMA controller
to perform DMA transfers.
The general order of function calls to set up and perform a uDMA transfer is the following:
uDMAEnable() is called once to enable the controller.
uDMAControlBaseSet() is called once to set the channel control table.
uDMAChannelAttributeEnable() is called once or infrequently to configure the behavior of the
channel.
uDMAChannelControlSet() is used to set up characteristics of the data transfer. It only needs
to be called once if the nature of the data transfer does not change.
uDMAChannelTransferSet() is used to set the buffer pointers and size for a transfer. It is called
before each new transfer.
uDMAChannelEnable() enables a channel to perform data transfers.
uDMAChannelRequest() is used to initiate a software based transfer. This is normally not used
for peripheral based transfers.
In order to use the uDMA controller, you must first enable it by calling uDMAEnable(). You can later
disable it, if no longer needed, by calling uDMADisable().
Once the uDMA controller is enabled, you must tell it where to find the channel control structures in
system memory. This is done by using the function uDMAControlBaseSet() and passing a pointer to
the base of the channel control structure. The control structure must be allocated by the application.
One way to do this is to declare an array of data type char or unsigned char. In order to support
all channels and transfer modes, the control table array should be 1024 bytes, but it can be fewer
depending on transfer modes used and number of channels actually used.
Note:
The control table must be aligned on a 1024 byte boundary.
The uDMA controller supports multiple channels. Each channel has a set of attribute flags to
control certain uDMA features and channel behavior. The attribute flags are set with the function
uDMAChannelAttributeEnable() and cleared with uDMAChannelAttributeDisable(). The setting of
the channel attribute flags can be queried by using the function uDMAChannelAttributeGet().
Next, the control parameters of the DMA transfer must be set. These parameters control the size
and address increment of the data items to be transferred. The function uDMAChannelControlSet()
is used to set up these control parameters.
All of the functions mentioned so far are used only once or infrequently to set up the uDMA channel and transfer. In order to set the transfer addresses, transfer size, and transfer mode, use the
function uDMAChannelTransferSet(). This function must be called for each new transfer. Once
everything is set up, the channel is enabled by calling uDMAChannelEnable(), which must be done
before each new transfer. The uDMA controller will automatically disable the channel at the completion of a transfer. A channel can be manually disabled by using uDMAChannelDisable().
There are additional functions that can be used to query the status of a channel, either from an
interrupt handler or in polling fashion. The function uDMAChannelSizeGet() is used to find the
amount of data remaining to transfer on a channel. This will be zero when a transfer is complete.
The function uDMAChannelModeGet() can be used to find the transfer mode of a uDMA channel.
This is usually used to see if the mode indicates stopped which means that a transfer has completed
January 11, 2011
331