diff options
| -rw-r--r-- | embassy-stm32/src/dma/dma_bdma.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/sai/mod.rs | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/embassy-stm32/src/dma/dma_bdma.rs b/embassy-stm32/src/dma/dma_bdma.rs index 6144db0d6..d31f4d01a 100644 --- a/embassy-stm32/src/dma/dma_bdma.rs +++ b/embassy-stm32/src/dma/dma_bdma.rs | |||
| @@ -359,11 +359,13 @@ impl AnyChannel { | |||
| 359 | match self.info().dma { | 359 | match self.info().dma { |
| 360 | #[cfg(dma)] | 360 | #[cfg(dma)] |
| 361 | DmaInfo::Dma(r) => { | 361 | DmaInfo::Dma(r) => { |
| 362 | let state: &ChannelState = &STATE[self.id as usize]; | ||
| 362 | let ch = r.st(info.num); | 363 | let ch = r.st(info.num); |
| 363 | 364 | ||
| 364 | // "Preceding reads and writes cannot be moved past subsequent writes." | 365 | // "Preceding reads and writes cannot be moved past subsequent writes." |
| 365 | fence(Ordering::SeqCst); | 366 | fence(Ordering::SeqCst); |
| 366 | 367 | ||
| 368 | state.complete_count.store(0, Ordering::Release); | ||
| 367 | self.clear_irqs(); | 369 | self.clear_irqs(); |
| 368 | 370 | ||
| 369 | ch.par().write_value(peri_addr as u32); | 371 | ch.par().write_value(peri_addr as u32); |
diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs index 18d5d7568..0dc8b62d0 100644 --- a/embassy-stm32/src/sai/mod.rs +++ b/embassy-stm32/src/sai/mod.rs | |||
| @@ -190,7 +190,7 @@ pub enum SyncInput { | |||
| 190 | /// Syncs with the other A/B sub-block within the SAI unit | 190 | /// Syncs with the other A/B sub-block within the SAI unit |
| 191 | Internal, | 191 | Internal, |
| 192 | /// Syncs with a sub-block in the other SAI unit | 192 | /// Syncs with a sub-block in the other SAI unit |
| 193 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 193 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 194 | External(SyncInputInstance), | 194 | External(SyncInputInstance), |
| 195 | } | 195 | } |
| 196 | 196 | ||
| @@ -199,14 +199,14 @@ impl SyncInput { | |||
| 199 | match self { | 199 | match self { |
| 200 | SyncInput::None => vals::Syncen::ASYNCHRONOUS, | 200 | SyncInput::None => vals::Syncen::ASYNCHRONOUS, |
| 201 | SyncInput::Internal => vals::Syncen::INTERNAL, | 201 | SyncInput::Internal => vals::Syncen::INTERNAL, |
| 202 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 202 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 203 | SyncInput::External(_) => vals::Syncen::EXTERNAL, | 203 | SyncInput::External(_) => vals::Syncen::EXTERNAL, |
| 204 | } | 204 | } |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | /// SAI instance to sync from. | 208 | /// SAI instance to sync from. |
| 209 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 209 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 210 | #[derive(Copy, Clone, PartialEq)] | 210 | #[derive(Copy, Clone, PartialEq)] |
| 211 | #[allow(missing_docs)] | 211 | #[allow(missing_docs)] |
| 212 | pub enum SyncInputInstance { | 212 | pub enum SyncInputInstance { |
| @@ -704,12 +704,12 @@ fn update_synchronous_config(config: &mut Config) { | |||
| 704 | config.mode = Mode::Slave; | 704 | config.mode = Mode::Slave; |
| 705 | config.sync_output = false; | 705 | config.sync_output = false; |
| 706 | 706 | ||
| 707 | #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm))] | 707 | #[cfg(any(sai_v1, sai_v2))] |
| 708 | { | 708 | { |
| 709 | config.sync_input = SyncInput::Internal; | 709 | config.sync_input = SyncInput::Internal; |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 712 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 713 | { | 713 | { |
| 714 | //this must either be Internal or External | 714 | //this must either be Internal or External |
| 715 | //The asynchronous sub-block on the same SAI needs to enable sync_output | 715 | //The asynchronous sub-block on the same SAI needs to enable sync_output |
| @@ -870,7 +870,7 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> { | |||
| 870 | 870 | ||
| 871 | ch.cr2().modify(|w| w.set_fflush(true)); | 871 | ch.cr2().modify(|w| w.set_fflush(true)); |
| 872 | 872 | ||
| 873 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 873 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 874 | { | 874 | { |
| 875 | if let SyncInput::External(i) = config.sync_input { | 875 | if let SyncInput::External(i) = config.sync_input { |
| 876 | T::REGS.gcr().modify(|w| { | 876 | T::REGS.gcr().modify(|w| { |
