Expand description
DMA driver.
This module provides a typed channel abstraction over the EDMA_0_TCD0 array and helpers for configuring the channel MUX. The driver supports higher-level async transfer APIs.
§Architecture
The MCXA276 has 8 DMA channels (0-7), each with its own interrupt vector. Each channel has a Transfer Control Descriptor (TCD) that defines the transfer parameters.
§Choosing the Right API
This module provides several API levels to match different use cases:
§High-Level Async API (Recommended for Most Users)
Use the async methods when you want simple, safe DMA transfers:
| Method | Description |
|---|---|
DmaChannel::mem_to_mem() | Memory-to-memory copy |
DmaChannel::memset() | Fill memory with a pattern |
DmaChannel::write_to_peripheral() | Memory-to-peripheral (TX) |
DmaChannel::read_from_peripheral() | Peripheral-to-memory (RX) |
These return a Transfer future that can be .awaited:
let dma_ch = DmaChannel::new(p.DMA_CH0);
dma_ch.mem_to_mem(&src, &mut dst, TransferOptions::default()).await;§Scatter-Gather Builder (For Chained Transfers)
Use ScatterGatherBuilder for complex multi-segment transfers:
let mut builder = ScatterGatherBuilder::<u32>::new();
builder.add_transfer(&src1, &mut dst1);
builder.add_transfer(&src2, &mut dst2);
let transfer = builder.build(&dma_ch).unwrap();
transfer.await;Structs§
- AnyChannel
- Type-erased DMA channel peripheral.
- DmaChannel
- DMA channel driver.
- Invalid
Parameters - An error that can occur if the parameters passed were invalid.
- Ring
Buffer - A ring buffer for continuous DMA reception.
- Scatter
Gather Builder - A builder for constructing scatter-gather DMA transfer chains.
- Scatter
Gather Result - A completed scatter-gather transfer result.
- Transfer
- An in-progress DMA transfer.
- Transfer
Error Iter - Iterator to extract all TransferErrors using TransferErrors::into_iter.
- Transfer
Errors - A collection of TransferError returned by any transfer.
- Transfer
Options - DMA transfer options.
Enums§
- Error
- General DMA error types.
- Priority
- DMA transfer priority.
- Transfer
Error - An error that can be returned as the result of a failed transfer.
- Word
Size - DMA transfer data width.
Constants§
- DMA_
MAX_ TRANSFER_ SIZE - Maximum bytes per DMA transfer (eDMA4 CITER/BITER are 15-bit fields).