7.4.2 Descriptor Linked List
This example shows how to use a Linked List of descriptors. Each descriptor has a link address which points to the next descriptor in
the list. A descriptor may be removed from the Linked list by altering the Link address of the one before it to point to the one after it.
Descriptor Linked lists are useful when handling an array of buffers for communication data. For example, a bad packet can be re-
moved from a receiver queue by simply removing the descriptor from the linked list.
Software loads the first descriptor into the DMA by writing the descriptor address to LDMA_CHx_LINK and setting the bit for that chan-
nel in the LDMA_LINKLOAD register. This method is prefered when using a linked list in memory since it treats the first descriptor just
like all the others. However, it is also allowed acceptable for software to write the first descriptor directoy to the LDMA registers.
In this example 4 descriptors are executed in series. the interrupt flag is set after the 2nd and 4th (last) descriptors have completed.
• Prepare a list of descriptors using the XFER structure type in RAM
• Initialize the CTRL, SRC, and DST members as desired
• Setting STRUCTREQ in the CTRL word for descritpors 2-4 will cause them to begin transfering data as soon as they are loaded.
• Write 0x00000013 to the LINK member of all but the last descriptor
• LINKMODE = 1 (relative addressing)
• LINK = 1 (Link to the next descriptor)
• LINKADDR = 0x00000010 (size of descriptor)
• Set the DONEIFSEN bit in the CTRL member of the 2nd structure so that the interrupt flag will be set when it completes
• Write 0x00000000 to the LINK member of the last descriptor
• LINK = 0 (Do not link to the next descriptor)
• LINKMODE = 0 (don't care)
• LINKADDR = 0x00000000 (don't care)
Each descriptor now points to the start of the next descriptor as shown on the left in
Figure 7.5 Descriptor Linked List on page 110
. To
remove a descriptor from the linked list modify the LINK address of the descriptor of the one before to point to the one after. For exam-
ple to remove the third descriptor, add 0x00000010 to the LINK register of the second descriptor. The second descriptor will now point
to the forth descriptor and skip over the third descriptor as shown on the right in
Figure 7.5 Descriptor Linked List on page 110
.
B
C
A
Ctrl
Src
Dst
Link
Ctrl
Src
Dst
Link
Ctrl
Src
Dst
Link
Ctrl
Src
Dst
Link
D
0x00000013
0x00000013
0x00000013
0x00000000
B
C
A
Ctrl
Src
Dst
Link
Ctrl
Src
Dst
Link
Ctrl
Src
Dst
Link
Ctrl
Src
Dst
Link
D
0x00000013
0x00000023
0x00000013
0x00000000
Linked
List
Third
Descriptor
Deleted
A
B
C
D
A
B
C
D
Figure 7.5. Descriptor Linked List
EFM32JG1 Reference Manual
LDMA - Linked DMA Controller
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 110