SWCU193A April 2023 – August 2024 CC2340R2 , CC2340R5 , CC2340R5-Q1
The μDMA controller uses an area of system memory to store a set of channel control structures in a table. The control table can have one or two entries for each μDMA channel. Each entry in the table structure contains source and destination pointers, transfer size, and transfer mode. The control table can be located anywhere in system memory, but the control table must be contiguous and aligned on a 256-byte boundary.
Table 15-3 describes the memory layout of the channel control table. Each channel can have one or two control structures in the control table—a primary control structure and an optional, alternate control structure. The table is organized with all of the primary entries in the first half of the table, and with all the alternate structures in the second half of the table. The primary entry is used for simple transfer modes where transfers can be reconfigured and restarted after each transfer completes. In this case, the alternate control structures are not used and only the first half of the table must be allocated in memory. The rest of the memory can be used for something else. If a more complex transfer mode is used, such as ping-pong or scatter-gather, then the alternate control structure is also used and memory space must be allocated for the entire table.
Any unused memory in the control table can be used by the application, which includes the control structures for any channels that are unused by the application, as well as the unused control word for each channel.
Offset | Channel |
---|---|
0x0 | 0, Primary |
0x10 | 1, Primary |
... | ... |
0x70 | 7, Primary |
0x80 | 0, Alternate |
0x90 | 1, Alternate |
... | ... |
0xF00 | 7, Alternate |
Table 15-4 describes an individual control-structure entry in the control table. Each entry is aligned on a 16-byte boundary. The entry contains four 4-byte long words: the source end pointer, the destination end pointer, the control word, and an unused entry. The inclusive end pointers point to the ending address of the transfer. If the source or destination is non-incrementing (as for a peripheral register), then the pointer must point to the transfer address.
Offset | Description |
---|---|
0x000 | Source end pointer |
0x004 | Destination end pointer |
0x008 | Control word |
0x00C | Unused entry |
The control word contains the following fields:
The control parameters for a channel can be set using the driver library function:
void uDMAChannelControlSet();
The μDMA controller updates the transfer size and transfer mode fields as the transfer is performed. At the end of a transfer, the transfer size indicates 0, and the transfer mode indicates stopped. Because the control word is modified by the μDMA controller, the control word must be reconfigured before each new transfer. The source and destination end pointers are not modified, so the source and destination end pointers can be left unchanged if the source or destination addresses remain the same.Before starting a transfer, a μDMA channel must be enabled by setting the appropriate bit in the DMA.SETCHANNELEN register. A channel can be disabled by setting the channel bit in the DMA.CLEARCHANNELEN register. At the end of a complete μDMA transfer, the controller automatically disables the channel.