Address Pointer and Transfer Control
920
SPRUH22I – April 2012 – Revised November 2019
Copyright © 2012–2019, Texas Instruments Incorporated
C28 Direct Memory Access (DMA) Module
NOTE:
High-priority mode and ONESHOT mode may not be used at the same time on channel 1.
Other channels may use ONESHOT mode when channel 1 is in high-priority mode.
11.6 Address Pointer and Transfer Control
The DMA state machine is, at its most basic level, two nested loops. The inner loop transfers a burst of
data when a peripheral interrupt trigger is received. A burst is the smallest amount of data that can be
transferred at one time and its size is defined by the BURST_SIZE register for each channel. The
BURST_SIZE register allows a maximum of 32 sixteen-bit words to be transferred in one burst. The outer
loop, whose size is set by the TRANSFER_SIZE register for each channel, defines how many bursts are
performed in the entire transfer. Since TRANSFER_SIZE is a 16-bit register, the total size of a transfer
allowed is well beyond any practical requirement. One CPU interrupt is generated, if enabled, for each
transfer. This interrupt can be configured to occur at the beginning or the end of the transfer via the
MODE.CHx[CHINTMODE] bit.
In the default setting of the MODE.CHx[ONESHOT] bit, the DMA transfers one burst of data each time a
peripheral interrupt trigger is received. After the burst is completed, the state machine moves on to the
next pending channel in the priority scheme, even if another trigger for the channel just completed is
pending. This feature keeps any single channel from monopolizing the DMA bus. If a transfer of more than
the maximum number of words per burst is desired for a single trigger, the MODE.CHx[ONESHOT] bit can
be set to complete the entire transfer when triggered. Care is advised when using this mode, since this
can create a condition where one trigger uses up the majority of the DMA bandwidth.
Each DMA channel contains a shadowed address pointer for the source and the destination address.
These pointers, SRC_ADDR and DST_ADDR, can be independently controlled during the state machine
operation. At the beginning of each transfer, the shadowed version of each pointer is copied into its
respective active register. During the burst loop, after each word is transferred, the signed value contained
in the appropriate source or destination BURST_STEP register is added to the active SRC/DST_ADDR
register. During the transfer loop, after each burst is complete, there are two methods that can be used to
modify the active address pointer. The first, and default, method is by adding the signed value contained
in the SRC/DST_TRANSFER_STEP register to the appropriate pointer. The second is via a process
called wrapping, where a wrap address is loaded into the active address pointer. When a wrap procedure
occurs, the associated SRC/DST_TRANSFER_STEP register has no effect.
Address wrapping occurs when a number of bursts specified by the appropriate SRC/DST_WRAP_SIZE
register completes. Each DMA channel contains two shadowed wrap address pointers, SRC_BEG_ADDR
and DST_BEG_ADDR, allowing the source and destination wrapping to be independent of each other.
Like the SRC_ADDR and DST_ADDR registers, the active SRC/DST_BEG_ADDR registers are loaded
from their shadow counterpart at the beginning of a transfer. When the specified number of bursts has
occurred, a two part wrap procedure takes place:
•
The appropriate active SRC/DST_BEG_ADDR register is incremented by the signed value contained in
the SRC/DST_WRAP_STEP register, then
•
The new active SRC/DST_BEG_ADDR register is loaded into the active SRC/DST_ADDR register.
Additionally the wrap counter (SRC/DST_WRAP_COUNT) register is reloaded with the
SRC/DST_WRAP_SIZE value to setup the next wrap period. This allows the channel to wrap multiple
times within a single transfer. Combined with the first bullet above, this allows the channel to address
multiple buffers within a single transfer.
The DMA contains both an active and shadow set of the following address pointers. When a DMA transfer
begins, the shadow register set is copied to the active working set of registers. This allows you to program
the values of the shadow registers for the next transfer while the DMA works with the active set. It also
allows you to implement Ping-Pong buffer schemes without disrupting the DMA channel execution.
Source/Destination Address Pointers (SRC/DST_ADDR)—
The value written into the shadow register
is the start address of the first location where data is read or written to.
At the beginning of a transfer the shadow register is copied into the active register. The active
register performs as the current address pointer.
Source/Destination Begin Address Pointers (SRC/DST_BEG_ADDR)—
This is the wrap pointer.