diff options
| -rw-r--r-- | embassy-stm32/src/adc/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/hsem/mod.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/ipcc.rs | 13 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/l.rs | 9 |
4 files changed, 18 insertions, 9 deletions
diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs index a6af1175a..da432f6ce 100644 --- a/embassy-stm32/src/adc/mod.rs +++ b/embassy-stm32/src/adc/mod.rs | |||
| @@ -208,7 +208,7 @@ impl<'d, T: Instance> Adc<'d, T> { | |||
| 208 | T::regs().enable(); | 208 | T::regs().enable(); |
| 209 | T::regs().convert(); | 209 | T::regs().convert(); |
| 210 | 210 | ||
| 211 | unsafe { *T::regs().data() } | 211 | unsafe { core::ptr::read_volatile(T::regs().data()) } |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | #[cfg(any(adc_g4, adc_v3, adc_g0, adc_h5, adc_h7rs, adc_u0, adc_v4, adc_u5, adc_wba, adc_c0))] | 214 | #[cfg(any(adc_g4, adc_v3, adc_g0, adc_h5, adc_h7rs, adc_u0, adc_v4, adc_u5, adc_wba, adc_c0))] |
diff --git a/embassy-stm32/src/hsem/mod.rs b/embassy-stm32/src/hsem/mod.rs index e62de0454..b5fa3c897 100644 --- a/embassy-stm32/src/hsem/mod.rs +++ b/embassy-stm32/src/hsem/mod.rs | |||
| @@ -148,6 +148,7 @@ impl<'a, T: Instance> HardwareSemaphoreChannel<'a, T> { | |||
| 148 | /// The 2-step lock procedure consists in a write to lock the semaphore, followed by a read to | 148 | /// The 2-step lock procedure consists in a write to lock the semaphore, followed by a read to |
| 149 | /// check if the lock has been successful, carried out from the HSEM_Rx register. | 149 | /// check if the lock has been successful, carried out from the HSEM_Rx register. |
| 150 | pub async fn lock(&mut self, process_id: u8) -> HardwareSemaphoreMutex<'a, T> { | 150 | pub async fn lock(&mut self, process_id: u8) -> HardwareSemaphoreMutex<'a, T> { |
| 151 | let _scoped_block_stop = T::RCC_INFO.block_stop(); | ||
| 151 | let core_id = CoreId::current(); | 152 | let core_id = CoreId::current(); |
| 152 | 153 | ||
| 153 | poll_fn(|cx| { | 154 | poll_fn(|cx| { |
| @@ -241,7 +242,7 @@ impl<T: Instance> HardwareSemaphore<T> { | |||
| 241 | _peripheral: Peri<'d, T>, | 242 | _peripheral: Peri<'d, T>, |
| 242 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, HardwareSemaphoreInterruptHandler<T>> + 'd, | 243 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, HardwareSemaphoreInterruptHandler<T>> + 'd, |
| 243 | ) -> Self { | 244 | ) -> Self { |
| 244 | rcc::enable_and_reset::<T>(); | 245 | rcc::enable_and_reset_without_stop::<T>(); |
| 245 | 246 | ||
| 246 | HardwareSemaphore { _type: PhantomData } | 247 | HardwareSemaphore { _type: PhantomData } |
| 247 | } | 248 | } |
diff --git a/embassy-stm32/src/ipcc.rs b/embassy-stm32/src/ipcc.rs index 183986fdc..74ce0b29e 100644 --- a/embassy-stm32/src/ipcc.rs +++ b/embassy-stm32/src/ipcc.rs | |||
| @@ -10,6 +10,7 @@ use embassy_sync::waitqueue::AtomicWaker; | |||
| 10 | 10 | ||
| 11 | use crate::interrupt::typelevel::Interrupt; | 11 | use crate::interrupt::typelevel::Interrupt; |
| 12 | use crate::peripherals::IPCC; | 12 | use crate::peripherals::IPCC; |
| 13 | use crate::rcc::SealedRccPeripheral; | ||
| 13 | use crate::{interrupt, rcc}; | 14 | use crate::{interrupt, rcc}; |
| 14 | 15 | ||
| 15 | /// Interrupt handler. | 16 | /// Interrupt handler. |
| @@ -84,6 +85,7 @@ impl<'a> IpccTxChannel<'a> { | |||
| 84 | 85 | ||
| 85 | /// Send data to an IPCC channel. The closure is called to write the data when appropriate. | 86 | /// Send data to an IPCC channel. The closure is called to write the data when appropriate. |
| 86 | pub async fn send(&mut self, f: impl FnOnce()) { | 87 | pub async fn send(&mut self, f: impl FnOnce()) { |
| 88 | let _scoped_block_stop = IPCC::RCC_INFO.block_stop(); | ||
| 87 | let regs = IPCC::regs(); | 89 | let regs = IPCC::regs(); |
| 88 | 90 | ||
| 89 | self.flush().await; | 91 | self.flush().await; |
| @@ -98,6 +100,7 @@ impl<'a> IpccTxChannel<'a> { | |||
| 98 | 100 | ||
| 99 | /// Wait for the tx channel to become clear | 101 | /// Wait for the tx channel to become clear |
| 100 | pub async fn flush(&mut self) { | 102 | pub async fn flush(&mut self) { |
| 103 | let _scoped_block_stop = IPCC::RCC_INFO.block_stop(); | ||
| 101 | let regs = IPCC::regs(); | 104 | let regs = IPCC::regs(); |
| 102 | 105 | ||
| 103 | // This is a race, but is nice for debugging | 106 | // This is a race, but is nice for debugging |
| @@ -143,6 +146,7 @@ impl<'a> IpccRxChannel<'a> { | |||
| 143 | 146 | ||
| 144 | /// Receive data from an IPCC channel. The closure is called to read the data when appropriate. | 147 | /// Receive data from an IPCC channel. The closure is called to read the data when appropriate. |
| 145 | pub async fn receive<R>(&mut self, mut f: impl FnMut() -> Option<R>) -> R { | 148 | pub async fn receive<R>(&mut self, mut f: impl FnMut() -> Option<R>) -> R { |
| 149 | let _scoped_block_stop = IPCC::RCC_INFO.block_stop(); | ||
| 146 | let regs = IPCC::regs(); | 150 | let regs = IPCC::regs(); |
| 147 | 151 | ||
| 148 | loop { | 152 | loop { |
| @@ -220,14 +224,11 @@ impl Ipcc { | |||
| 220 | + 'd, | 224 | + 'd, |
| 221 | _config: Config, | 225 | _config: Config, |
| 222 | ) -> Self { | 226 | ) -> Self { |
| 223 | rcc::enable_and_reset::<IPCC>(); | 227 | rcc::enable_and_reset_without_stop::<IPCC>(); |
| 224 | IPCC::set_cpu2(true); | 228 | IPCC::set_cpu2(true); |
| 225 | 229 | ||
| 226 | #[cfg(stm32wb)] | 230 | // Verify rfwkpsel is set |
| 227 | // DO NOT REMOVE THIS UNLESS YOU FIX THE EXAMPLES AND TEST FIRST | 231 | let _ = IPCC::frequency(); |
| 228 | crate::pac::RCC | ||
| 229 | .csr() | ||
| 230 | .modify(|w| w.set_rfwkpsel(stm32_metapac::rcc::vals::Rfwkpsel::LSE)); | ||
| 231 | 232 | ||
| 232 | let regs = IPCC::regs(); | 233 | let regs = IPCC::regs(); |
| 233 | 234 | ||
diff --git a/embassy-stm32/src/rcc/l.rs b/embassy-stm32/src/rcc/l.rs index 2e1cbd702..0d668103c 100644 --- a/embassy-stm32/src/rcc/l.rs +++ b/embassy-stm32/src/rcc/l.rs | |||
| @@ -135,7 +135,14 @@ pub const WPAN_DEFAULT: Config = Config { | |||
| 135 | apb1_pre: APBPrescaler::DIV1, | 135 | apb1_pre: APBPrescaler::DIV1, |
| 136 | apb2_pre: APBPrescaler::DIV1, | 136 | apb2_pre: APBPrescaler::DIV1, |
| 137 | 137 | ||
| 138 | mux: super::mux::ClockMux::default(), | 138 | mux: { |
| 139 | use crate::pac::rcc::vals::Rfwkpsel; | ||
| 140 | |||
| 141 | let mut mux = super::mux::ClockMux::default(); | ||
| 142 | |||
| 143 | mux.rfwkpsel = Rfwkpsel::LSE; | ||
| 144 | mux | ||
| 145 | }, | ||
| 139 | }; | 146 | }; |
| 140 | 147 | ||
| 141 | fn msi_enable(range: MSIRange) { | 148 | fn msi_enable(range: MSIRange) { |
