From 17f0f4baa489d87d9862f9ab91dc73530daf5b3e Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Thu, 11 Dec 2025 15:42:46 -0800 Subject: [iMXRT] add a minimal DMA copy example While at that, also update the PACs to their latest versions. --- examples/mimxrt6/src/bin/dma.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 examples/mimxrt6/src/bin/dma.rs (limited to 'examples/mimxrt6/src') diff --git a/examples/mimxrt6/src/bin/dma.rs b/examples/mimxrt6/src/bin/dma.rs new file mode 100644 index 000000000..b490efc6b --- /dev/null +++ b/examples/mimxrt6/src/bin/dma.rs @@ -0,0 +1,26 @@ +#![no_std] +#![no_main] + +extern crate embassy_imxrt_examples; + +use defmt::info; +use embassy_executor::Spawner; +use embassy_imxrt::dma::copy; +use {defmt_rtt as _, panic_probe as _}; + +const BUFLEN: usize = 1024; + +#[embassy_executor::main] +async fn main(_spawner: Spawner) { + let p = embassy_imxrt::init(Default::default()); + + info!("Test memory-to-memory DMA transfers"); + + let src = [0x55u8; BUFLEN]; + let mut dst = [0u8; BUFLEN]; + + unsafe { copy(p.DMA0_CH0, &src, &mut dst) }.await; + assert!(dst == src); + + info!("DMA copy succeeded"); +} -- cgit