LLI和DMA

What are linked lists and why are they used in the DMA controller?

A linked list is a list of elements that include pointers to the next element in the list. This means that elements can be placed anywhere in memory and created and removed individually without affecting elements around them. They can be used to create arrays of unknown size in memory.

Linked lists are used in the DMA controller to support scatter/gathering through the DMACCxLLI register. This means that the source and destination areas do not need to occupy contiguous areas in memory. Where scatter/gather is not required, the DMACCxLLI register must be set to 0.

The source and destination data areas are defined by a series of linked lists and each LLI controls the transfer of one block of data, and then optionally loads a further LLI to continue the DMA operation, or stops the DMA stream. An example is given in Appendix C of the Technical Reference Manual.

Note that the DMACCxConfiguration DMA channel configuration register is not part of the linked list item and that the configuration registers are not updated when a new LLI is requested.

Note also that programming the DMACCxLLI register when the DMA channel is enabled has unpredictable side effects.

The LLI in the DMA controller consists of four words containing the Source address, Destination Address, LLI register and Control register in that order. For some systems, the LLI data structures can and should be made four-word aligned, to make the loading of LLIs more efficient. How to pogram the PrimeCell DMA controller for scatter/gather is given, in Section 3.6 on page 3-35 of the Technical Reference Manual.

How should the Linked Lists be Used With An MMU?

When using the DMAC with a MMU (Memory Management Unit) based system, the scatter/gather linked list is created and managed by application code running on the ARM core in virtual memory and is read by the DMAC in physical memory.

It must be ensured that the memory used for the linked list is flat-mapped, that is where virtual addresses and physical addresses are the same.

作者: hunterzy416   发布时间: 2010-09-14