aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/dma
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-04-29 23:56:15 +0200
committerDario Nieuwenhuis <[email protected]>2024-04-29 23:56:15 +0200
commit1ed2a0504aba38e4b404c776808ee5229cd72615 (patch)
tree1d61f6d2e267ac3cbac9c3c5312284d7e6537b9d /embassy-stm32/src/dma
parent7fb74ff756a3f4b8f770df6d070ba152439a0c45 (diff)
stm32/dma: add support for same channel with different req in different DMAs/DMAMUXes.
Diffstat (limited to 'embassy-stm32/src/dma')
-rw-r--r--embassy-stm32/src/dma/dmamux.rs24
-rw-r--r--embassy-stm32/src/dma/mod.rs2
2 files changed, 1 insertions, 25 deletions
diff --git a/embassy-stm32/src/dma/dmamux.rs b/embassy-stm32/src/dma/dmamux.rs
index dc7cd3a66..1585b30d4 100644
--- a/embassy-stm32/src/dma/dmamux.rs
+++ b/embassy-stm32/src/dma/dmamux.rs
@@ -19,30 +19,6 @@ pub(crate) fn configure_dmamux(info: &DmamuxInfo, request: u8) {
19 }); 19 });
20} 20}
21 21
22pub(crate) trait SealedMuxChannel {}
23
24/// DMAMUX1 instance.
25pub struct DMAMUX1;
26/// DMAMUX2 instance.
27#[cfg(stm32h7)]
28pub struct DMAMUX2;
29
30/// DMAMUX channel trait.
31#[allow(private_bounds)]
32pub trait MuxChannel: SealedMuxChannel {
33 /// DMAMUX instance this channel is on.
34 type Mux;
35}
36
37macro_rules! dmamux_channel_impl {
38 ($channel_peri:ident, $dmamux:ident) => {
39 impl crate::dma::SealedMuxChannel for crate::peripherals::$channel_peri {}
40 impl crate::dma::MuxChannel for crate::peripherals::$channel_peri {
41 type Mux = crate::dma::$dmamux;
42 }
43 };
44}
45
46/// safety: must be called only once 22/// safety: must be called only once
47pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) { 23pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) {
48 crate::_generated::init_dmamux(); 24 crate::_generated::init_dmamux();
diff --git a/embassy-stm32/src/dma/mod.rs b/embassy-stm32/src/dma/mod.rs
index 8766d0a60..3f5687a62 100644
--- a/embassy-stm32/src/dma/mod.rs
+++ b/embassy-stm32/src/dma/mod.rs
@@ -14,7 +14,7 @@ pub use gpdma::*;
14#[cfg(dmamux)] 14#[cfg(dmamux)]
15mod dmamux; 15mod dmamux;
16#[cfg(dmamux)] 16#[cfg(dmamux)]
17pub use dmamux::*; 17pub(crate) use dmamux::*;
18 18
19mod util; 19mod util;
20pub(crate) use util::*; 20pub(crate) use util::*;