7.4.6 2D Copy
The LDMA can easily perform a 2D copy using a descriptor list with looping. This set up is visualized in
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.
2D Copy Descriptors in Memory
B
Source Buffer
Destination Buffer
SRCSTRIDE
DSTSTRIDE
WIDTH
HEIGHT
HEIGHT
Source
Address
Destination
Address
A
CTRL
SRC
DST
LINK
CTRL
SRC
DST
LINK
Descriptor A
Descriptor B
WIDTH
Destination
Address
Descriptor A
Descriptor B
XFERCNT = WIDTH - 1
SRCMD = DSTMD = 0
SRC = SRCADDR
DST = DSTADDR
LINK = 0x00000013
XFERCNT = WIDTH - 1
SRCMD = DSTMD = 1
SRCADDR = SRCSTRIDE - WIDTH
DSTADDR = DSTSTRIDE - WIDTH
LINK = 0x00000001
A
B
LINKADDR->B
DECLOOPCNT=1
LINK=0
LINKADDR->B
Figure 7.9. 2D copy
The first descriptor will use absolute addressing mode and the source and destination addresses should point to the desired target ad-
dresses. The first descriptor will copy only the first row. The XFERCNT of the first descriptor is set to the desired width minus one.
• CTRL
• XFERCNT = WIDTH - 1
• SRCMD = 0 (absolute)
• DSTMD = 0 (absolute)
• SRCADDR = target source address
• DSTADDR = target destination address
• LINK = 0x00000013
• LINK=1
• LINKMD=1
• LINKADDR=0x00000010 (point to next descriptor)
The second descriptor will use relative addressing and the source and destination addresses are set to the desired offset. After the
completion of the first descriptor, the address registers will point to the last address transferred. Thus, the width must be subtracted
from the stride to get the offset. The second descriptor uses looping and the link register has not offset.
• CTRL
• XFERCNT = WIDTH - 1
• SRCMD = 1 (relative)
• DSTMD = 1 (relative)
• DECLOOPCNT = 1
• SRCADDR = desired source offset (SRCSTRIDE-WIDTH)
• DSTADDR = desired destination offset (DSTSTRIDE-WIDTH)
• LINK = 0x00000001
• LINK=0
• LINKMD=1 (relative)
• LINKADDR=0x000000000 (no offset)
EFM32JG1 Reference Manual
LDMA - Linked DMA Controller
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 116