Expand description
Direct Memory Access (DMA) driver for i.MX RT processors.
imxrt-dma provides
- an unsafe API for defining and scheduling transfers with DMA
Channels. - safe DMA futures for memcpy, peripheral-to-memory, and memory-to-peripheral transfers.
This DMA driver may be re-exported from a hardware abstraction layer (HAL). If it is, you should use the safer APIs provided by your HAL.
§Getting started
To allocate a Dma driver, you’ll need to know
- the location of the DMA controller registers.
- the location of the DMAMUX registers.
- the number of DMA channels supported by your chip.
These parameters depend on the i.MX RT chip you’re targeting. If you’re
already using imxrt-ral, consider using the
DMA and DMAMUX constants for the addresses. You’re always responsible
for configuring the number of DMA channels.
With those three parameters, assign a Dma to a static. Then, use that
object to create DMA Channels.
use imxrt_dma::Dma;
// Safety: addresses and channel count are valid for this target.
static DMA: Dma<32> = unsafe { Dma::new(DMA_PTR, DMAMUX_PTR) };
// Safety: we only allocate one DMA channel 7 object.
let mut channel = unsafe { DMA.channel(7) };Once you have a channel, you can use the higher-level DMA APIs, like
memcpyfor memory copies.writeto transmit data from memory to a peripheral.readto receive data from a peripheral.full_duplexto read / write with a peripheral using a single buffer.
Peripheral transfers depends on a peripheral’s DMA support. These are signaled
through various peripheral traits.
For a lower-level API, use the channel objects and helper
functions.
§License
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Modules§
- channel
- DMA channels
- memcpy
- DMA-powered memcpy
- peripheral
- DMA support for hardware peripherals.
Structs§
Enums§
- Bandwidth
Control - Throttles the amount of bus bandwidth consumed by the eDMA
Traits§
- Element
- Describes a transferrable DMA element; basically, an unsigned integer of any size.
Type Aliases§
- Result
- A DMA result