diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-04-29 23:56:15 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-04-29 23:56:15 +0200 |
| commit | 1ed2a0504aba38e4b404c776808ee5229cd72615 (patch) | |
| tree | 1d61f6d2e267ac3cbac9c3c5312284d7e6537b9d /embassy-stm32/src/dma | |
| parent | 7fb74ff756a3f4b8f770df6d070ba152439a0c45 (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.rs | 24 | ||||
| -rw-r--r-- | embassy-stm32/src/dma/mod.rs | 2 |
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 | ||
| 22 | pub(crate) trait SealedMuxChannel {} | ||
| 23 | |||
| 24 | /// DMAMUX1 instance. | ||
| 25 | pub struct DMAMUX1; | ||
| 26 | /// DMAMUX2 instance. | ||
| 27 | #[cfg(stm32h7)] | ||
| 28 | pub struct DMAMUX2; | ||
| 29 | |||
| 30 | /// DMAMUX channel trait. | ||
| 31 | #[allow(private_bounds)] | ||
| 32 | pub trait MuxChannel: SealedMuxChannel { | ||
| 33 | /// DMAMUX instance this channel is on. | ||
| 34 | type Mux; | ||
| 35 | } | ||
| 36 | |||
| 37 | macro_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 |
| 47 | pub(crate) unsafe fn init(_cs: critical_section::CriticalSection) { | 23 | pub(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)] |
| 15 | mod dmamux; | 15 | mod dmamux; |
| 16 | #[cfg(dmamux)] | 16 | #[cfg(dmamux)] |
| 17 | pub use dmamux::*; | 17 | pub(crate) use dmamux::*; |
| 18 | 18 | ||
| 19 | mod util; | 19 | mod util; |
| 20 | pub(crate) use util::*; | 20 | pub(crate) use util::*; |
