aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/sai
diff options
context:
space:
mode:
authorelagil <[email protected]>2025-08-25 21:10:59 +0200
committerDario Nieuwenhuis <[email protected]>2025-09-05 14:43:29 +0200
commit3c3b43fb00355a5db64a34416dc2f19042a3fc5a (patch)
treef3cfef9a81d56f6e86524bd83a7df6ea8d386749 /embassy-stm32/src/sai
parent70aaa82e490a8c5637de7e38cb636f04c1d187f7 (diff)
feat: GPDAM linked-list + ringbuffer support
Diffstat (limited to 'embassy-stm32/src/sai')
-rw-r--r--embassy-stm32/src/sai/mod.rs9
1 files changed, 0 insertions, 9 deletions
diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs
index 4965f8b04..88cc225dd 100644
--- a/embassy-stm32/src/sai/mod.rs
+++ b/embassy-stm32/src/sai/mod.rs
@@ -1,13 +1,11 @@
1//! Serial Audio Interface (SAI) 1//! Serial Audio Interface (SAI)
2#![macro_use] 2#![macro_use]
3#![cfg_attr(gpdma, allow(unused))]
4 3
5use core::marker::PhantomData; 4use core::marker::PhantomData;
6 5
7use embassy_hal_internal::PeripheralType; 6use embassy_hal_internal::PeripheralType;
8 7
9pub use crate::dma::word; 8pub use crate::dma::word;
10#[cfg(not(gpdma))]
11use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer}; 9use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer};
12use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; 10use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed};
13use crate::pac::sai::{vals, Sai as Regs}; 11use crate::pac::sai::{vals, Sai as Regs};
@@ -26,7 +24,6 @@ pub enum Error {
26 Overrun, 24 Overrun,
27} 25}
28 26
29#[cfg(not(gpdma))]
30impl From<ringbuffer::Error> for Error { 27impl From<ringbuffer::Error> for Error {
31 fn from(#[allow(unused)] err: ringbuffer::Error) -> Self { 28 fn from(#[allow(unused)] err: ringbuffer::Error) -> Self {
32 #[cfg(feature = "defmt")] 29 #[cfg(feature = "defmt")]
@@ -652,7 +649,6 @@ impl Config {
652 } 649 }
653} 650}
654 651
655#[cfg(not(gpdma))]
656enum RingBuffer<'d, W: word::Word> { 652enum RingBuffer<'d, W: word::Word> {
657 Writable(WritableRingBuffer<'d, W>), 653 Writable(WritableRingBuffer<'d, W>),
658 Readable(ReadableRingBuffer<'d, W>), 654 Readable(ReadableRingBuffer<'d, W>),
@@ -679,7 +675,6 @@ fn get_af_types(mode: Mode, tx_rx: TxRx) -> (AfType, AfType) {
679 ) 675 )
680} 676}
681 677
682#[cfg(not(gpdma))]
683fn get_ring_buffer<'d, T: Instance, W: word::Word>( 678fn get_ring_buffer<'d, T: Instance, W: word::Word>(
684 dma: Peri<'d, impl Channel>, 679 dma: Peri<'d, impl Channel>,
685 dma_buf: &'d mut [W], 680 dma_buf: &'d mut [W],
@@ -750,14 +745,10 @@ pub struct Sai<'d, T: Instance, W: word::Word> {
750 fs: Option<Peri<'d, AnyPin>>, 745 fs: Option<Peri<'d, AnyPin>>,
751 sck: Option<Peri<'d, AnyPin>>, 746 sck: Option<Peri<'d, AnyPin>>,
752 mclk: Option<Peri<'d, AnyPin>>, 747 mclk: Option<Peri<'d, AnyPin>>,
753 #[cfg(gpdma)]
754 ring_buffer: PhantomData<W>,
755 #[cfg(not(gpdma))]
756 ring_buffer: RingBuffer<'d, W>, 748 ring_buffer: RingBuffer<'d, W>,
757 sub_block: WhichSubBlock, 749 sub_block: WhichSubBlock,
758} 750}
759 751
760#[cfg(not(gpdma))]
761impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> { 752impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
762 /// Create a new SAI driver in asynchronous mode with MCLK. 753 /// Create a new SAI driver in asynchronous mode with MCLK.
763 /// 754 ///