aboutsummaryrefslogtreecommitdiff
path: root/examples/mcxa/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/mcxa/src')
-rw-r--r--examples/mcxa/src/bin/dma_scatter_gather_builder.rs20
1 files changed, 2 insertions, 18 deletions
diff --git a/examples/mcxa/src/bin/dma_scatter_gather_builder.rs b/examples/mcxa/src/bin/dma_scatter_gather_builder.rs
index ba8682cee..1691129f6 100644
--- a/examples/mcxa/src/bin/dma_scatter_gather_builder.rs
+++ b/examples/mcxa/src/bin/dma_scatter_gather_builder.rs
@@ -20,8 +20,6 @@
20#![no_std] 20#![no_std]
21#![no_main] 21#![no_main]
22 22
23use core::fmt::Write as _;
24
25use embassy_executor::Spawner; 23use embassy_executor::Spawner;
26use embassy_mcxa::clocks::config::Div8; 24use embassy_mcxa::clocks::config::Div8;
27use embassy_mcxa::dma::{DmaChannel, ScatterGatherBuilder}; 25use embassy_mcxa::dma::{DmaChannel, ScatterGatherBuilder};
@@ -97,28 +95,14 @@ async fn main(_spawner: Spawner) {
97 defmt::info!("Added 3 transfer segments to chain."); 95 defmt::info!("Added 3 transfer segments to chain.");
98 defmt::info!("Starting scatter-gather transfer with .await..."); 96 defmt::info!("Starting scatter-gather transfer with .await...");
99 97
100 // TODO START
101 defmt::info!("Destination buffers (after):");
102 defmt::info!(" DST1: {=[?]}", dst1.as_slice());
103 defmt::info!(" DST2: {=[?]}", dst2.as_slice());
104 defmt::info!(" DST3: {=[?]}", dst3.as_slice());
105 // TODO: If we want to make the `builder.build()` below safe, the above prints SHOULD NOT
106 // compile. We need to make sure that the lifetime of the builder reflects that it is
107 // "consuming" the slices until the builder is dropped, since we can access them to print here,
108 // that means that the borrow checker isn't enforcing that yet.
109 todo!("ABOVE CODE SHOULDN'T COMPILE");
110 // TODO END
111
112 // Build and execute the scatter-gather chain 98 // Build and execute the scatter-gather chain
113 // The build() method: 99 // The build() method:
114 // - Links all TCDs together with ESG bit 100 // - Links all TCDs together with ESG bit
115 // - Sets INTMAJOR on all TCDs 101 // - Sets INTMAJOR on all TCDs
116 // - Loads the first TCD into hardware 102 // - Loads the first TCD into hardware
117 // - Returns a Transfer future 103 // - Returns a Transfer future
118 unsafe { 104 let transfer = builder.build(&dma_ch0).expect("Failed to build scatter-gather");
119 let transfer = builder.build(&dma_ch0).expect("Failed to build scatter-gather"); 105 transfer.blocking_wait();
120 transfer.blocking_wait();
121 }
122 106
123 defmt::info!("Scatter-gather transfer complete!"); 107 defmt::info!("Scatter-gather transfer complete!");
124 108