embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

Module dma

Module dma 

Source
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:

Use the async methods when you want simple, safe DMA transfers:

MethodDescription
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.
InvalidParameters
An error that can occur if the parameters passed were invalid.
RingBuffer
A ring buffer for continuous DMA reception.
ScatterGatherBuilder
A builder for constructing scatter-gather DMA transfer chains.
ScatterGatherResult
A completed scatter-gather transfer result.
Transfer
An in-progress DMA transfer.
TransferErrorIter
Iterator to extract all TransferErrors using TransferErrors::into_iter.
TransferErrors
A collection of TransferError returned by any transfer.
TransferOptions
DMA transfer options.

Enums§

Error
General DMA error types.
Priority
DMA transfer priority.
TransferError
An error that can be returned as the result of a failed transfer.
WordSize
DMA transfer data width.

Constants§

DMA_MAX_TRANSFER_SIZE
Maximum bytes per DMA transfer (eDMA4 CITER/BITER are 15-bit fields).

Traits§

Channel
Marker trait implemented by HAL peripheral tokens that map to a DMA0 channel backed by one EDMA_0_TCD0 TCD slot.
Word
Trait for word-sizes that are supported.