aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-02-26 03:00:04 +0100
committerDario Nieuwenhuis <[email protected]>2024-02-26 03:02:58 +0100
commitc83ab20526c0812d738853db015e201120ecce44 (patch)
treed3a6180bdfacfa096308d94a7b38c5f900353ee1
parent72c6f9a101141183fb2de46c2fe40aa979330d9c (diff)
stm32: update metapac.
-rw-r--r--embassy-stm32/src/fmc.rs8
-rw-r--r--embassy-stm32/src/i2s.rs16
-rw-r--r--embassy-stm32/src/lib.rs5
-rw-r--r--embassy-stm32/src/rcc/f013.rs1
-rw-r--r--embassy-stm32/src/rcc/f247.rs1
-rw-r--r--embassy-stm32/src/rcc/g0.rs1
-rw-r--r--embassy-stm32/src/rcc/h.rs1
-rw-r--r--embassy-stm32/src/rcc/u5.rs2
-rw-r--r--embassy-stm32/src/sai/mod.rs58
-rw-r--r--embassy-stm32/src/spi/mod.rs30
10 files changed, 73 insertions, 50 deletions
diff --git a/embassy-stm32/src/fmc.rs b/embassy-stm32/src/fmc.rs
index 873c8a70c..9d731a512 100644
--- a/embassy-stm32/src/fmc.rs
+++ b/embassy-stm32/src/fmc.rs
@@ -36,8 +36,10 @@ where
36 // fmc v1 and v2 does not have the fmcen bit 36 // fmc v1 and v2 does not have the fmcen bit
37 // fsmc v1, v2 and v3 does not have the fmcen bit 37 // fsmc v1, v2 and v3 does not have the fmcen bit
38 // This is a "not" because it is expected that all future versions have this bit 38 // This is a "not" because it is expected that all future versions have this bit
39 #[cfg(not(any(fmc_v1x3, fmc_v2x1, fsmc_v1x0, fsmc_v1x3, fsmc_v2x3, fsmc_v3x1)))] 39 #[cfg(not(any(fmc_v1x3, fmc_v2x1, fsmc_v1x0, fsmc_v1x3, fsmc_v2x3, fsmc_v3x1, fmc_v4)))]
40 T::REGS.bcr1().modify(|r| r.set_fmcen(true)); 40 T::REGS.bcr1().modify(|r| r.set_fmcen(true));
41 #[cfg(any(fmc_v4))]
42 T::REGS.nor_psram().bcr1().modify(|r| r.set_fmcen(true));
41 } 43 }
42 44
43 /// Get the kernel clock currently in use for this FMC instance. 45 /// Get the kernel clock currently in use for this FMC instance.
@@ -60,8 +62,10 @@ where
60 // fmc v1 and v2 does not have the fmcen bit 62 // fmc v1 and v2 does not have the fmcen bit
61 // fsmc v1, v2 and v3 does not have the fmcen bit 63 // fsmc v1, v2 and v3 does not have the fmcen bit
62 // This is a "not" because it is expected that all future versions have this bit 64 // This is a "not" because it is expected that all future versions have this bit
63 #[cfg(not(any(fmc_v1x3, fmc_v2x1, fsmc_v1x0, fsmc_v1x3, fsmc_v2x3, fsmc_v3x1)))] 65 #[cfg(not(any(fmc_v1x3, fmc_v2x1, fsmc_v1x0, fsmc_v1x3, fsmc_v2x3, fsmc_v3x1, fmc_v4)))]
64 T::REGS.bcr1().modify(|r| r.set_fmcen(true)); 66 T::REGS.bcr1().modify(|r| r.set_fmcen(true));
67 #[cfg(any(fmc_v4))]
68 T::REGS.nor_psram().bcr1().modify(|r| r.set_fmcen(true));
65 } 69 }
66 70
67 fn source_clock_hz(&self) -> u32 { 71 fn source_clock_hz(&self) -> u32 {
diff --git a/embassy-stm32/src/i2s.rs b/embassy-stm32/src/i2s.rs
index e9065dce6..fa9ec0532 100644
--- a/embassy-stm32/src/i2s.rs
+++ b/embassy-stm32/src/i2s.rs
@@ -79,20 +79,20 @@ impl Format {
79 #[cfg(any(spi_v1, spi_f1))] 79 #[cfg(any(spi_v1, spi_f1))]
80 const fn datlen(&self) -> vals::Datlen { 80 const fn datlen(&self) -> vals::Datlen {
81 match self { 81 match self {
82 Format::Data16Channel16 => vals::Datlen::SIXTEENBIT, 82 Format::Data16Channel16 => vals::Datlen::BITS16,
83 Format::Data16Channel32 => vals::Datlen::SIXTEENBIT, 83 Format::Data16Channel32 => vals::Datlen::BITS16,
84 Format::Data24Channel32 => vals::Datlen::TWENTYFOURBIT, 84 Format::Data24Channel32 => vals::Datlen::BITS24,
85 Format::Data32Channel32 => vals::Datlen::THIRTYTWOBIT, 85 Format::Data32Channel32 => vals::Datlen::BITS32,
86 } 86 }
87 } 87 }
88 88
89 #[cfg(any(spi_v1, spi_f1))] 89 #[cfg(any(spi_v1, spi_f1))]
90 const fn chlen(&self) -> vals::Chlen { 90 const fn chlen(&self) -> vals::Chlen {
91 match self { 91 match self {
92 Format::Data16Channel16 => vals::Chlen::SIXTEENBIT, 92 Format::Data16Channel16 => vals::Chlen::BITS16,
93 Format::Data16Channel32 => vals::Chlen::THIRTYTWOBIT, 93 Format::Data16Channel32 => vals::Chlen::BITS32,
94 Format::Data24Channel32 => vals::Chlen::THIRTYTWOBIT, 94 Format::Data24Channel32 => vals::Chlen::BITS32,
95 Format::Data32Channel32 => vals::Chlen::THIRTYTWOBIT, 95 Format::Data32Channel32 => vals::Chlen::BITS32,
96 } 96 }
97 } 97 }
98} 98}
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
index cd1ede0fa..15798e115 100644
--- a/embassy-stm32/src/lib.rs
+++ b/embassy-stm32/src/lib.rs
@@ -216,6 +216,11 @@ pub fn init(config: Config) -> Peripherals {
216 216
217 #[cfg(dbgmcu)] 217 #[cfg(dbgmcu)]
218 crate::pac::DBGMCU.cr().modify(|cr| { 218 crate::pac::DBGMCU.cr().modify(|cr| {
219 #[cfg(any(dbgmcu_h5))]
220 {
221 cr.set_stop(config.enable_debug_during_sleep);
222 cr.set_standby(config.enable_debug_during_sleep);
223 }
219 #[cfg(any(dbgmcu_f0, dbgmcu_c0, dbgmcu_g0, dbgmcu_u5, dbgmcu_wba, dbgmcu_l5))] 224 #[cfg(any(dbgmcu_f0, dbgmcu_c0, dbgmcu_g0, dbgmcu_u5, dbgmcu_wba, dbgmcu_l5))]
220 { 225 {
221 cr.set_dbg_stop(config.enable_debug_during_sleep); 226 cr.set_dbg_stop(config.enable_debug_during_sleep);
diff --git a/embassy-stm32/src/rcc/f013.rs b/embassy-stm32/src/rcc/f013.rs
index 56bb2a0d9..5046f0a3a 100644
--- a/embassy-stm32/src/rcc/f013.rs
+++ b/embassy-stm32/src/rcc/f013.rs
@@ -379,6 +379,7 @@ pub(crate) unsafe fn init(config: Config) {
379 pll1_p: pll, 379 pll1_p: pll,
380 #[cfg(stm32f3)] 380 #[cfg(stm32f3)]
381 pll1_p_mul_2: pll_mul_2, 381 pll1_p_mul_2: pll_mul_2,
382 hsi_div_244: hsi.map(|h| h / 244u32),
382 sys: Some(sys), 383 sys: Some(sys),
383 pclk1: Some(pclk1), 384 pclk1: Some(pclk1),
384 pclk2: Some(pclk2), 385 pclk2: Some(pclk2),
diff --git a/embassy-stm32/src/rcc/f247.rs b/embassy-stm32/src/rcc/f247.rs
index e306d478d..343d075cd 100644
--- a/embassy-stm32/src/rcc/f247.rs
+++ b/embassy-stm32/src/rcc/f247.rs
@@ -288,6 +288,7 @@ pub(crate) unsafe fn init(config: Config) {
288 288
289 clk48: pll.q, 289 clk48: pll.q,
290 290
291 hsi_div488: hsi.map(|hsi| hsi/488u32),
291 hsi_hse: None, 292 hsi_hse: None,
292 afif: None, 293 afif: None,
293 ); 294 );
diff --git a/embassy-stm32/src/rcc/g0.rs b/embassy-stm32/src/rcc/g0.rs
index 0b1f34a20..ae502dd9c 100644
--- a/embassy-stm32/src/rcc/g0.rs
+++ b/embassy-stm32/src/rcc/g0.rs
@@ -365,5 +365,6 @@ pub(crate) unsafe fn init(config: Config) {
365 pll1_q: pll1_q_freq, 365 pll1_q: pll1_q_freq,
366 pll1_p: pll1_p_freq, 366 pll1_p: pll1_p_freq,
367 rtc: rtc, 367 rtc: rtc,
368 hsi_div_488: None,
368 ); 369 );
369} 370}
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs
index c2a71eaf1..c6da79afb 100644
--- a/embassy-stm32/src/rcc/h.rs
+++ b/embassy-stm32/src/rcc/h.rs
@@ -617,6 +617,7 @@ pub(crate) unsafe fn init(config: Config) {
617 hsi: hsi, 617 hsi: hsi,
618 hsi48: hsi48, 618 hsi48: hsi48,
619 csi: csi, 619 csi: csi,
620 csi_div_122: csi.map(|c| c / 122u32),
620 hse: hse, 621 hse: hse,
621 622
622 lse: None, 623 lse: None,
diff --git a/embassy-stm32/src/rcc/u5.rs b/embassy-stm32/src/rcc/u5.rs
index 43138f05c..c8814ed69 100644
--- a/embassy-stm32/src/rcc/u5.rs
+++ b/embassy-stm32/src/rcc/u5.rs
@@ -290,6 +290,8 @@ pub(crate) unsafe fn init(config: Config) {
290 lsi: None, 290 lsi: None,
291 msik: None, 291 msik: None,
292 iclk: None, 292 iclk: None,
293 shsi: None,
294 shsi_div_2: None,
293 ); 295 );
294} 296}
295 297
diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs
index b6c3e4028..02f96f8a9 100644
--- a/embassy-stm32/src/sai/mod.rs
+++ b/embassy-stm32/src/sai/mod.rs
@@ -1,5 +1,6 @@
1//! Serial Audio Interface (SAI) 1//! Serial Audio Interface (SAI)
2#![macro_use] 2#![macro_use]
3#![cfg_attr(gpdma, allow(unused))]
3 4
4use core::marker::PhantomData; 5use core::marker::PhantomData;
5 6
@@ -7,6 +8,7 @@ use embassy_hal_internal::{into_ref, PeripheralRef};
7 8
8use self::sealed::WhichSubBlock; 9use self::sealed::WhichSubBlock;
9pub use crate::dma::word; 10pub use crate::dma::word;
11#[cfg(not(gpdma))]
10use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer}; 12use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer};
11use crate::gpio::sealed::{AFType, Pin as _}; 13use crate::gpio::sealed::{AFType, Pin as _};
12use crate::gpio::AnyPin; 14use crate::gpio::AnyPin;
@@ -26,6 +28,7 @@ pub enum Error {
26 Overrun, 28 Overrun,
27} 29}
28 30
31#[cfg(not(gpdma))]
29impl From<ringbuffer::OverrunError> for Error { 32impl From<ringbuffer::OverrunError> for Error {
30 fn from(_: ringbuffer::OverrunError) -> Self { 33 fn from(_: ringbuffer::OverrunError) -> Self {
31 Self::Overrun 34 Self::Overrun
@@ -41,7 +44,7 @@ pub enum Mode {
41} 44}
42 45
43impl Mode { 46impl Mode {
44 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 47 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
45 const fn mode(&self, tx_rx: TxRx) -> vals::Mode { 48 const fn mode(&self, tx_rx: TxRx) -> vals::Mode {
46 match tx_rx { 49 match tx_rx {
47 TxRx::Transmitter => match self { 50 TxRx::Transmitter => match self {
@@ -76,7 +79,7 @@ pub enum SlotSize {
76} 79}
77 80
78impl SlotSize { 81impl SlotSize {
79 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 82 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
80 const fn slotsz(&self) -> vals::Slotsz { 83 const fn slotsz(&self) -> vals::Slotsz {
81 match self { 84 match self {
82 SlotSize::DataSize => vals::Slotsz::DATASIZE, 85 SlotSize::DataSize => vals::Slotsz::DATASIZE,
@@ -99,7 +102,7 @@ pub enum DataSize {
99} 102}
100 103
101impl DataSize { 104impl DataSize {
102 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 105 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
103 const fn ds(&self) -> vals::Ds { 106 const fn ds(&self) -> vals::Ds {
104 match self { 107 match self {
105 DataSize::Data8 => vals::Ds::BIT8, 108 DataSize::Data8 => vals::Ds::BIT8,
@@ -124,7 +127,7 @@ pub enum FifoThreshold {
124} 127}
125 128
126impl FifoThreshold { 129impl FifoThreshold {
127 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 130 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
128 const fn fth(&self) -> vals::Fth { 131 const fn fth(&self) -> vals::Fth {
129 match self { 132 match self {
130 FifoThreshold::Empty => vals::Fth::EMPTY, 133 FifoThreshold::Empty => vals::Fth::EMPTY,
@@ -145,7 +148,7 @@ pub enum MuteValue {
145} 148}
146 149
147impl MuteValue { 150impl MuteValue {
148 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 151 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
149 const fn muteval(&self) -> vals::Muteval { 152 const fn muteval(&self) -> vals::Muteval {
150 match self { 153 match self {
151 MuteValue::Zero => vals::Muteval::SENDZERO, 154 MuteValue::Zero => vals::Muteval::SENDZERO,
@@ -164,7 +167,7 @@ pub enum Protocol {
164} 167}
165 168
166impl Protocol { 169impl Protocol {
167 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 170 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
168 const fn prtcfg(&self) -> vals::Prtcfg { 171 const fn prtcfg(&self) -> vals::Prtcfg {
169 match self { 172 match self {
170 Protocol::Free => vals::Prtcfg::FREE, 173 Protocol::Free => vals::Prtcfg::FREE,
@@ -183,7 +186,7 @@ pub enum SyncInput {
183 /// Syncs with the other A/B sub-block within the SAI unit 186 /// Syncs with the other A/B sub-block within the SAI unit
184 Internal, 187 Internal,
185 /// Syncs with a sub-block in the other SAI unit 188 /// Syncs with a sub-block in the other SAI unit
186 #[cfg(sai_v4)] 189 #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))]
187 External(SyncInputInstance), 190 External(SyncInputInstance),
188} 191}
189 192
@@ -192,14 +195,14 @@ impl SyncInput {
192 match self { 195 match self {
193 SyncInput::None => vals::Syncen::ASYNCHRONOUS, 196 SyncInput::None => vals::Syncen::ASYNCHRONOUS,
194 SyncInput::Internal => vals::Syncen::INTERNAL, 197 SyncInput::Internal => vals::Syncen::INTERNAL,
195 #[cfg(any(sai_v4))] 198 #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))]
196 SyncInput::External(_) => vals::Syncen::EXTERNAL, 199 SyncInput::External(_) => vals::Syncen::EXTERNAL,
197 } 200 }
198 } 201 }
199} 202}
200 203
201/// SAI instance to sync from. 204/// SAI instance to sync from.
202#[cfg(sai_v4)] 205#[cfg(any(sai_v4_2pdm, sai_v4_4pdm))]
203#[derive(Copy, Clone, PartialEq)] 206#[derive(Copy, Clone, PartialEq)]
204#[allow(missing_docs)] 207#[allow(missing_docs)]
205pub enum SyncInputInstance { 208pub enum SyncInputInstance {
@@ -222,7 +225,7 @@ pub enum StereoMono {
222} 225}
223 226
224impl StereoMono { 227impl StereoMono {
225 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 228 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
226 const fn mono(&self) -> vals::Mono { 229 const fn mono(&self) -> vals::Mono {
227 match self { 230 match self {
228 StereoMono::Stereo => vals::Mono::STEREO, 231 StereoMono::Stereo => vals::Mono::STEREO,
@@ -241,7 +244,7 @@ pub enum BitOrder {
241} 244}
242 245
243impl BitOrder { 246impl BitOrder {
244 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 247 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
245 const fn lsbfirst(&self) -> vals::Lsbfirst { 248 const fn lsbfirst(&self) -> vals::Lsbfirst {
246 match self { 249 match self {
247 BitOrder::LsbFirst => vals::Lsbfirst::LSBFIRST, 250 BitOrder::LsbFirst => vals::Lsbfirst::LSBFIRST,
@@ -260,7 +263,7 @@ pub enum FrameSyncOffset {
260} 263}
261 264
262impl FrameSyncOffset { 265impl FrameSyncOffset {
263 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 266 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
264 const fn fsoff(&self) -> vals::Fsoff { 267 const fn fsoff(&self) -> vals::Fsoff {
265 match self { 268 match self {
266 FrameSyncOffset::OnFirstBit => vals::Fsoff::ONFIRST, 269 FrameSyncOffset::OnFirstBit => vals::Fsoff::ONFIRST,
@@ -279,7 +282,7 @@ pub enum FrameSyncPolarity {
279} 282}
280 283
281impl FrameSyncPolarity { 284impl FrameSyncPolarity {
282 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 285 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
283 const fn fspol(&self) -> vals::Fspol { 286 const fn fspol(&self) -> vals::Fspol {
284 match self { 287 match self {
285 FrameSyncPolarity::ActiveLow => vals::Fspol::FALLINGEDGE, 288 FrameSyncPolarity::ActiveLow => vals::Fspol::FALLINGEDGE,
@@ -297,7 +300,7 @@ pub enum FrameSyncDefinition {
297} 300}
298 301
299impl FrameSyncDefinition { 302impl FrameSyncDefinition {
300 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 303 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
301 const fn fsdef(&self) -> bool { 304 const fn fsdef(&self) -> bool {
302 match self { 305 match self {
303 FrameSyncDefinition::StartOfFrame => false, 306 FrameSyncDefinition::StartOfFrame => false,
@@ -315,7 +318,7 @@ pub enum ClockStrobe {
315} 318}
316 319
317impl ClockStrobe { 320impl ClockStrobe {
318 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 321 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
319 const fn ckstr(&self) -> vals::Ckstr { 322 const fn ckstr(&self) -> vals::Ckstr {
320 match self { 323 match self {
321 ClockStrobe::Falling => vals::Ckstr::FALLINGEDGE, 324 ClockStrobe::Falling => vals::Ckstr::FALLINGEDGE,
@@ -333,7 +336,7 @@ pub enum ComplementFormat {
333} 336}
334 337
335impl ComplementFormat { 338impl ComplementFormat {
336 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 339 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
337 const fn cpl(&self) -> vals::Cpl { 340 const fn cpl(&self) -> vals::Cpl {
338 match self { 341 match self {
339 ComplementFormat::OnesComplement => vals::Cpl::ONESCOMPLEMENT, 342 ComplementFormat::OnesComplement => vals::Cpl::ONESCOMPLEMENT,
@@ -352,7 +355,7 @@ pub enum Companding {
352} 355}
353 356
354impl Companding { 357impl Companding {
355 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 358 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
356 const fn comp(&self) -> vals::Comp { 359 const fn comp(&self) -> vals::Comp {
357 match self { 360 match self {
358 Companding::None => vals::Comp::NOCOMPANDING, 361 Companding::None => vals::Comp::NOCOMPANDING,
@@ -371,7 +374,7 @@ pub enum OutputDrive {
371} 374}
372 375
373impl OutputDrive { 376impl OutputDrive {
374 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 377 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
375 const fn outdriv(&self) -> vals::Outdriv { 378 const fn outdriv(&self) -> vals::Outdriv {
376 match self { 379 match self {
377 OutputDrive::OnStart => vals::Outdriv::ONSTART, 380 OutputDrive::OnStart => vals::Outdriv::ONSTART,
@@ -404,7 +407,7 @@ pub enum MasterClockDivider {
404} 407}
405 408
406impl MasterClockDivider { 409impl MasterClockDivider {
407 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 410 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
408 const fn mckdiv(&self) -> u8 { 411 const fn mckdiv(&self) -> u8 {
409 match self { 412 match self {
410 MasterClockDivider::MasterClockDisabled => 0, 413 MasterClockDivider::MasterClockDisabled => 0,
@@ -501,12 +504,12 @@ impl Config {
501 } 504 }
502} 505}
503 506
507#[cfg(not(gpdma))]
504enum RingBuffer<'d, W: word::Word> { 508enum RingBuffer<'d, W: word::Word> {
505 Writable(WritableRingBuffer<'d, W>), 509 Writable(WritableRingBuffer<'d, W>),
506 Readable(ReadableRingBuffer<'d, W>), 510 Readable(ReadableRingBuffer<'d, W>),
507} 511}
508 512
509#[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))]
510fn dr<W: word::Word>(w: crate::pac::sai::Sai, sub_block: WhichSubBlock) -> *mut W { 513fn dr<W: word::Word>(w: crate::pac::sai::Sai, sub_block: WhichSubBlock) -> *mut W {
511 let ch = w.ch(sub_block as usize); 514 let ch = w.ch(sub_block as usize);
512 ch.dr().as_ptr() as _ 515 ch.dr().as_ptr() as _
@@ -528,6 +531,7 @@ fn get_af_types(mode: Mode, tx_rx: TxRx) -> (AFType, AFType) {
528 ) 531 )
529} 532}
530 533
534#[cfg(not(gpdma))]
531fn get_ring_buffer<'d, T: Instance, W: word::Word>( 535fn get_ring_buffer<'d, T: Instance, W: word::Word>(
532 dma: impl Peripheral<P = impl Channel> + 'd, 536 dma: impl Peripheral<P = impl Channel> + 'd,
533 dma_buf: &'d mut [W], 537 dma_buf: &'d mut [W],
@@ -554,12 +558,12 @@ fn update_synchronous_config(config: &mut Config) {
554 config.mode = Mode::Slave; 558 config.mode = Mode::Slave;
555 config.sync_output = false; 559 config.sync_output = false;
556 560
557 #[cfg(any(sai_v1, sai_v2, sai_v3))] 561 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm))]
558 { 562 {
559 config.sync_input = SyncInput::Internal; 563 config.sync_input = SyncInput::Internal;
560 } 564 }
561 565
562 #[cfg(any(sai_v4))] 566 #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))]
563 { 567 {
564 //this must either be Internal or External 568 //this must either be Internal or External
565 //The asynchronous sub-block on the same SAI needs to enable sync_output 569 //The asynchronous sub-block on the same SAI needs to enable sync_output
@@ -599,10 +603,14 @@ pub struct Sai<'d, T: Instance, W: word::Word> {
599 fs: Option<PeripheralRef<'d, AnyPin>>, 603 fs: Option<PeripheralRef<'d, AnyPin>>,
600 sck: Option<PeripheralRef<'d, AnyPin>>, 604 sck: Option<PeripheralRef<'d, AnyPin>>,
601 mclk: Option<PeripheralRef<'d, AnyPin>>, 605 mclk: Option<PeripheralRef<'d, AnyPin>>,
606 #[cfg(gpdma)]
607 ring_buffer: PhantomData<W>,
608 #[cfg(not(gpdma))]
602 ring_buffer: RingBuffer<'d, W>, 609 ring_buffer: RingBuffer<'d, W>,
603 sub_block: WhichSubBlock, 610 sub_block: WhichSubBlock,
604} 611}
605 612
613#[cfg(not(gpdma))]
606impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> { 614impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
607 /// Create a new SAI driver in asynchronous mode with MCLK. 615 /// Create a new SAI driver in asynchronous mode with MCLK.
608 /// 616 ///
@@ -715,13 +723,13 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
715 ring_buffer: RingBuffer<'d, W>, 723 ring_buffer: RingBuffer<'d, W>,
716 config: Config, 724 config: Config,
717 ) -> Self { 725 ) -> Self {
718 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 726 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
719 { 727 {
720 let ch = T::REGS.ch(sub_block as usize); 728 let ch = T::REGS.ch(sub_block as usize);
721 ch.cr1().modify(|w| w.set_saien(false)); 729 ch.cr1().modify(|w| w.set_saien(false));
722 } 730 }
723 731
724 #[cfg(any(sai_v4))] 732 #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))]
725 { 733 {
726 if let SyncInput::External(i) = config.sync_input { 734 if let SyncInput::External(i) = config.sync_input {
727 T::REGS.gcr().modify(|w| { 735 T::REGS.gcr().modify(|w| {
@@ -740,7 +748,7 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
740 } 748 }
741 } 749 }
742 750
743 #[cfg(any(sai_v1, sai_v2, sai_v3, sai_v4))] 751 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
744 { 752 {
745 let ch = T::REGS.ch(sub_block as usize); 753 let ch = T::REGS.ch(sub_block as usize);
746 ch.cr1().modify(|w| { 754 ch.cr1().modify(|w| {
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs
index 23f027e70..172bc8112 100644
--- a/embassy-stm32/src/spi/mod.rs
+++ b/embassy-stm32/src/spi/mod.rs
@@ -1005,8 +1005,8 @@ mod word_impl {
1005 1005
1006 pub type Config = vals::Dff; 1006 pub type Config = vals::Dff;
1007 1007
1008 impl_word!(u8, vals::Dff::EIGHTBIT); 1008 impl_word!(u8, vals::Dff::BITS8);
1009 impl_word!(u16, vals::Dff::SIXTEENBIT); 1009 impl_word!(u16, vals::Dff::BITS16);
1010} 1010}
1011 1011
1012#[cfg(spi_v2)] 1012#[cfg(spi_v2)]
@@ -1015,19 +1015,19 @@ mod word_impl {
1015 1015
1016 pub type Config = (vals::Ds, vals::Frxth); 1016 pub type Config = (vals::Ds, vals::Frxth);
1017 1017
1018 impl_word!(word::U4, (vals::Ds::FOURBIT, vals::Frxth::QUARTER)); 1018 impl_word!(word::U4, (vals::Ds::BITS4, vals::Frxth::QUARTER));
1019 impl_word!(word::U5, (vals::Ds::FIVEBIT, vals::Frxth::QUARTER)); 1019 impl_word!(word::U5, (vals::Ds::BITS5, vals::Frxth::QUARTER));
1020 impl_word!(word::U6, (vals::Ds::SIXBIT, vals::Frxth::QUARTER)); 1020 impl_word!(word::U6, (vals::Ds::BITS6, vals::Frxth::QUARTER));
1021 impl_word!(word::U7, (vals::Ds::SEVENBIT, vals::Frxth::QUARTER)); 1021 impl_word!(word::U7, (vals::Ds::BITS7, vals::Frxth::QUARTER));
1022 impl_word!(u8, (vals::Ds::EIGHTBIT, vals::Frxth::QUARTER)); 1022 impl_word!(u8, (vals::Ds::BITS8, vals::Frxth::QUARTER));
1023 impl_word!(word::U9, (vals::Ds::NINEBIT, vals::Frxth::HALF)); 1023 impl_word!(word::U9, (vals::Ds::BITS9, vals::Frxth::HALF));
1024 impl_word!(word::U10, (vals::Ds::TENBIT, vals::Frxth::HALF)); 1024 impl_word!(word::U10, (vals::Ds::BITS10, vals::Frxth::HALF));
1025 impl_word!(word::U11, (vals::Ds::ELEVENBIT, vals::Frxth::HALF)); 1025 impl_word!(word::U11, (vals::Ds::BITS11, vals::Frxth::HALF));
1026 impl_word!(word::U12, (vals::Ds::TWELVEBIT, vals::Frxth::HALF)); 1026 impl_word!(word::U12, (vals::Ds::BITS12, vals::Frxth::HALF));
1027 impl_word!(word::U13, (vals::Ds::THIRTEENBIT, vals::Frxth::HALF)); 1027 impl_word!(word::U13, (vals::Ds::BITS13, vals::Frxth::HALF));
1028 impl_word!(word::U14, (vals::Ds::FOURTEENBIT, vals::Frxth::HALF)); 1028 impl_word!(word::U14, (vals::Ds::BITS14, vals::Frxth::HALF));
1029 impl_word!(word::U15, (vals::Ds::FIFTEENBIT, vals::Frxth::HALF)); 1029 impl_word!(word::U15, (vals::Ds::BITS15, vals::Frxth::HALF));
1030 impl_word!(u16, (vals::Ds::SIXTEENBIT, vals::Frxth::HALF)); 1030 impl_word!(u16, (vals::Ds::BITS16, vals::Frxth::HALF));
1031} 1031}
1032 1032
1033#[cfg(any(spi_v3, spi_v4, spi_v5))] 1033#[cfg(any(spi_v3, spi_v4, spi_v5))]