diff options
| author | Felipe Balbi <[email protected]> | 2025-12-11 15:42:46 -0800 |
|---|---|---|
| committer | Felipe Balbi <[email protected]> | 2025-12-11 15:42:46 -0800 |
| commit | 17f0f4baa489d87d9862f9ab91dc73530daf5b3e (patch) | |
| tree | 25e20753b50cbc9da6f459a5991bca125e24f2fd /examples/mimxrt6/src/bin | |
| parent | 4c5986e6d06f8e7dc421e1c3b3b8793351df1fef (diff) | |
[iMXRT] add a minimal DMA copy example
While at that, also update the PACs to their latest versions.
Diffstat (limited to 'examples/mimxrt6/src/bin')
| -rw-r--r-- | examples/mimxrt6/src/bin/dma.rs | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | extern crate embassy_imxrt_examples; | ||
| 5 | |||
| 6 | use defmt::info; | ||
| 7 | use embassy_executor::Spawner; | ||
| 8 | use embassy_imxrt::dma::copy; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | ||
| 10 | |||
| 11 | const BUFLEN: usize = 1024; | ||
| 12 | |||
| 13 | #[embassy_executor::main] | ||
| 14 | async fn main(_spawner: Spawner) { | ||
| 15 | let p = embassy_imxrt::init(Default::default()); | ||
| 16 | |||
| 17 | info!("Test memory-to-memory DMA transfers"); | ||
| 18 | |||
| 19 | let src = [0x55u8; BUFLEN]; | ||
| 20 | let mut dst = [0u8; BUFLEN]; | ||
| 21 | |||
| 22 | unsafe { copy(p.DMA0_CH0, &src, &mut dst) }.await; | ||
| 23 | assert!(dst == src); | ||
| 24 | |||
| 25 | info!("DMA copy succeeded"); | ||
| 26 | } | ||
