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 | |
| parent | 4c5986e6d06f8e7dc421e1c3b3b8793351df1fef (diff) | |
[iMXRT] add a minimal DMA copy example
While at that, also update the PACs to their latest versions.
| -rw-r--r-- | embassy-imxrt/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/mimxrt6/src/bin/dma.rs | 26 |
2 files changed, 28 insertions, 2 deletions
diff --git a/embassy-imxrt/Cargo.toml b/embassy-imxrt/Cargo.toml index c47756f10..81377579b 100644 --- a/embassy-imxrt/Cargo.toml +++ b/embassy-imxrt/Cargo.toml | |||
| @@ -103,5 +103,5 @@ document-features = "0.2.7" | |||
| 103 | paste = "1.0" | 103 | paste = "1.0" |
| 104 | 104 | ||
| 105 | # PACs | 105 | # PACs |
| 106 | mimxrt685s-pac = { version = "0.4.0", optional = true, features = ["rt", "critical-section"] } | 106 | mimxrt685s-pac = { version = "0.5.0", optional = true, features = ["rt", "critical-section"] } |
| 107 | mimxrt633s-pac = { version = "0.4.0", optional = true, features = ["rt", "critical-section"] } | 107 | mimxrt633s-pac = { version = "0.5.0", optional = true, features = ["rt", "critical-section"] } |
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 | } | ||
