User manual
...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 69
www.energymicro.com
Table 8.11. DMA cycle of 12 bytes using a halfword increment
Initial values of channel_cfg, prior to the DMA cycle
src_size = b00, dst_inc = b01, n_minus_1 = b1011, cycle_ctrl = 1, R_power = b11
End Pointer Count Difference
1
Address
0x5E7 11 0x16 0x5D1
0x5E7 10 0x14 0x5D3
0x5E7 9 0x12 0x5D5
0x5E7 8 0x10 0x5D7
0x5E7 7 0xE 0x5D9
0x5E7 6 0xC 0x5DB
0x5E7 5 0xA 0x5DD
DMA transfers
0x5E7 4 0x8 0x5DF
Values of channel_cfg after 2
R
DMA transfers
src_size = b00, dst_inc = b01, n_minus_1 = b011, cycle_ctrl = 1, R_power = b11
End Pointer Count Difference Address
0x5E7 3 0x6 0x5E1
0x5E7 2 0x4 0x5E3
0x5E7 1 0x2 0x5E5
DMA transfers
0x5E7 0 0x0 0x5E7
Final values of channel_cfg, after the DMA cycle
src_size = b00, dst_inc = b01, n_minus_1 = 0, cycle_ctrl = 0
2
, R_power = b11
1
This value is the result of count being shifted left by the value of dst_inc.
2
After the controller completes the DMA cycle it invalidates the channel_cfg memory location by clearing the cycle_ctrl field.
8.4.4 Looped Transfers
A regular DMA channel is done when it has performed the number of transfers given by the channel
descriptor. If an application wants a continuous flow of data, one option is to use ping-pong mode,
alternating between two descriptors and having software update one descriptor while the other is being
used. Another way is to use looped transfers.
For DMA channels 0 and 1, looping can be enabled by setting EN in DMA_LOOP0 and DMA_LOOP1
respectively. A looping DMA channel will on completion set the respective DONE interrupt flag, but then
reload n_minus_1 in the channel descriptor with the loop width defined by WIDTH in DMA_LOOPx and
continue transmitting data.
The total length of the transfer is given by the original value of n_minus_1 in the channel descriptor and
WIDTH in DMA_LOOPx times the number of loops taken. The loop feature can for instance be used to
implement a ring buffer, continously overwriting old data when new data is available. To end the loop
clear EN in DMA_LOOPx. The channel will then complete the last loop before stopping.
8.4.5 2D Copy
In addition to looped transfers, DMA channel 0 has the ability to do rectangle transfers, or 2D copy. For
an application working with graphics, this would mean the ability to copy a rectangle of a given width and
height from one picture to another. The DMA also has the ability to copy from linear data to a rectangle,
and from a rectangle to linear data.
To set up rectangle copy for DMA channel 0, configure WIDTH in DMA_LOOP0 to one less than
the rectangle width, and HEIGHT in DMA_RECT0 to one less than the rectangle height. Then