diff options
Diffstat (limited to 'embassy-stm32/src/dma')
| -rw-r--r-- | embassy-stm32/src/dma/dma_bdma.rs | 9 | ||||
| -rw-r--r-- | embassy-stm32/src/dma/gpdma.rs | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/embassy-stm32/src/dma/dma_bdma.rs b/embassy-stm32/src/dma/dma_bdma.rs index 8a6aa53a0..8e2964f94 100644 --- a/embassy-stm32/src/dma/dma_bdma.rs +++ b/embassy-stm32/src/dma/dma_bdma.rs | |||
| @@ -15,6 +15,8 @@ use crate::{interrupt, pac}; | |||
| 15 | pub(crate) struct ChannelInfo { | 15 | pub(crate) struct ChannelInfo { |
| 16 | pub(crate) dma: DmaInfo, | 16 | pub(crate) dma: DmaInfo, |
| 17 | pub(crate) num: usize, | 17 | pub(crate) num: usize, |
| 18 | #[cfg(feature = "_dual-core")] | ||
| 19 | pub(crate) irq: pac::Interrupt, | ||
| 18 | #[cfg(dmamux)] | 20 | #[cfg(dmamux)] |
| 19 | pub(crate) dmamux: super::DmamuxInfo, | 21 | pub(crate) dmamux: super::DmamuxInfo, |
| 20 | } | 22 | } |
| @@ -259,10 +261,12 @@ pub(crate) unsafe fn init( | |||
| 259 | foreach_interrupt! { | 261 | foreach_interrupt! { |
| 260 | ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => { | 262 | ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => { |
| 261 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, dma_priority); | 263 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, dma_priority); |
| 264 | #[cfg(not(feature = "_dual-core"))] | ||
| 262 | crate::interrupt::typelevel::$irq::enable(); | 265 | crate::interrupt::typelevel::$irq::enable(); |
| 263 | }; | 266 | }; |
| 264 | ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => { | 267 | ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => { |
| 265 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, bdma_priority); | 268 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, bdma_priority); |
| 269 | #[cfg(not(feature = "_dual-core"))] | ||
| 266 | crate::interrupt::typelevel::$irq::enable(); | 270 | crate::interrupt::typelevel::$irq::enable(); |
| 267 | }; | 271 | }; |
| 268 | } | 272 | } |
| @@ -341,6 +345,11 @@ impl AnyChannel { | |||
| 341 | options: TransferOptions, | 345 | options: TransferOptions, |
| 342 | ) { | 346 | ) { |
| 343 | let info = self.info(); | 347 | let info = self.info(); |
| 348 | #[cfg(feature = "_dual-core")] | ||
| 349 | { | ||
| 350 | use embassy_hal_internal::interrupt::InterruptExt as _; | ||
| 351 | info.irq.enable(); | ||
| 352 | } | ||
| 344 | 353 | ||
| 345 | #[cfg(dmamux)] | 354 | #[cfg(dmamux)] |
| 346 | super::dmamux::configure_dmamux(&info.dmamux, _request); | 355 | super::dmamux::configure_dmamux(&info.dmamux, _request); |
diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs index 13d5d15be..f9d66ca86 100644 --- a/embassy-stm32/src/dma/gpdma.rs +++ b/embassy-stm32/src/dma/gpdma.rs | |||
| @@ -18,6 +18,8 @@ use crate::pac::gpdma::vals; | |||
| 18 | pub(crate) struct ChannelInfo { | 18 | pub(crate) struct ChannelInfo { |
| 19 | pub(crate) dma: pac::gpdma::Gpdma, | 19 | pub(crate) dma: pac::gpdma::Gpdma, |
| 20 | pub(crate) num: usize, | 20 | pub(crate) num: usize, |
| 21 | #[cfg(feature = "_dual-core")] | ||
| 22 | pub(crate) irq: pac::Interrupt, | ||
| 21 | } | 23 | } |
| 22 | 24 | ||
| 23 | /// GPDMA transfer options. | 25 | /// GPDMA transfer options. |
| @@ -57,6 +59,7 @@ pub(crate) unsafe fn init(cs: critical_section::CriticalSection, irq_priority: P | |||
| 57 | foreach_interrupt! { | 59 | foreach_interrupt! { |
| 58 | ($peri:ident, gpdma, $block:ident, $signal_name:ident, $irq:ident) => { | 60 | ($peri:ident, gpdma, $block:ident, $signal_name:ident, $irq:ident) => { |
| 59 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, irq_priority); | 61 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, irq_priority); |
| 62 | #[cfg(not(feature = "_dual-core"))] | ||
| 60 | crate::interrupt::typelevel::$irq::enable(); | 63 | crate::interrupt::typelevel::$irq::enable(); |
| 61 | }; | 64 | }; |
| 62 | } | 65 | } |
| @@ -67,6 +70,12 @@ impl AnyChannel { | |||
| 67 | /// Safety: Must be called with a matching set of parameters for a valid dma channel | 70 | /// Safety: Must be called with a matching set of parameters for a valid dma channel |
| 68 | pub(crate) unsafe fn on_irq(&self) { | 71 | pub(crate) unsafe fn on_irq(&self) { |
| 69 | let info = self.info(); | 72 | let info = self.info(); |
| 73 | #[cfg(feature = "_dual-core")] | ||
| 74 | { | ||
| 75 | use embassy_hal_internal::interrupt::InterruptExt as _; | ||
| 76 | info.irq.enable(); | ||
| 77 | } | ||
| 78 | |||
| 70 | let state = &STATE[self.id as usize]; | 79 | let state = &STATE[self.id as usize]; |
| 71 | 80 | ||
| 72 | let ch = info.dma.ch(info.num); | 81 | let ch = info.dma.ch(info.num); |
