diff options
| author | Alexandros Liarokapis <[email protected]> | 2024-08-17 00:26:33 +0300 |
|---|---|---|
| committer | Alexandros Liarokapis <[email protected]> | 2024-08-17 16:54:41 +0300 |
| commit | 2b7e76efe9916170cba69da964d53c19a246ae45 (patch) | |
| tree | 10f1b8973e80af44dd81a65aad4f1e7456a3ca30 /embassy-stm32/src/dma/dma_bdma.rs | |
| parent | 6d9ed4c0807c977aa6d3c852360d52128f8c459a (diff) | |
Fix dma nvic issues on dual core lines
This commit addresses #3256 by disabling dma NVIC interrupt enablement at startup.
Instead, per-channel NVIC interrupt enablement is now done with the rest of the dma channel configuration.
This ensures that each core will only handle the interrupts of the DMA channels that it uses.
Diffstat (limited to 'embassy-stm32/src/dma/dma_bdma.rs')
| -rw-r--r-- | embassy-stm32/src/dma/dma_bdma.rs | 9 |
1 files changed, 9 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); |
