From a24a7e9fece1768e359621780c0dfdf56ee46805 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Fri, 9 Jul 2021 11:07:53 -0400 Subject: [PATCH] Allow some unused lints given that H7 is still in flight with its multitude of DMA. --- embassy-stm32/src/bdma/v1.rs | 47 +++++++++++++++++++++++++++++++-- embassy-stm32/src/dmamux/mod.rs | 5 ++-- stm32-data | 2 +- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/embassy-stm32/src/bdma/v1.rs b/embassy-stm32/src/bdma/v1.rs index 4488e2e95..9a7cfae19 100644 --- a/embassy-stm32/src/bdma/v1.rs +++ b/embassy-stm32/src/bdma/v1.rs @@ -10,7 +10,6 @@ use crate::dma_traits::{ReadDma, WriteDma}; use crate::interrupt; use crate::pac; use crate::pac::bdma::vals; -use crate::rcc::sealed::RccPeripheral; const CH_COUNT: usize = pac::peripheral_count!(DMA) * 8; const CH_STATUS_NONE: u8 = 0; @@ -41,6 +40,9 @@ pub(crate) async unsafe fn transfer_p2m( state_number: usize, src: *const u8, dst: &mut [u8], + #[cfg(dmamux)] dmamux_regs: pac::dmamux::Dmamux, + #[cfg(dmamux)] dmamux_ch_num: u8, + #[cfg(dmamux)] request: u8, ) { // ndtr is max 16 bits. assert!(dst.len() <= 0xFFFF); @@ -59,7 +61,7 @@ pub(crate) async unsafe fn transfer_p2m( }); #[cfg(dmamux)] - crate::dmamux::configure_channel(1, 2); + crate::dmamux::configure_dmamux(dmamux_regs, dmamux_ch_num, request); regs.par().write_value(src as u32); regs.mar().write_value(dst.as_mut_ptr() as u32); @@ -288,6 +290,7 @@ macro_rules! impl_dma_channel { } } + #[cfg(not(dmamux))] impl ReadDma for crate::peripherals::$channel_peri where T: 'static, @@ -309,6 +312,46 @@ macro_rules! impl_dma_channel { unsafe { transfer_p2m(regs, state_num, src, buf) } } } + + #[cfg(dmamux)] + impl ReadDma for crate::peripherals::$channel_peri + where + Self: crate::dmamux::sealed::PeripheralChannel, + T: 'static, + { + type ReadDmaFuture<'a> = impl Future; + + fn transfer<'a>( + &'a mut self, + src: *const u8, + buf: &'a mut [u8], + ) -> Self::ReadDmaFuture<'a> + where + T: 'a, + { + use sealed::Channel as _Channel; + + let state_num = self.state_num(); + let regs = self.regs(); + + use crate::dmamux::sealed::Channel as _MuxChannel; + use crate::dmamux::sealed::PeripheralChannel; + let dmamux_regs = self.dmamux_regs(); + let dmamux_ch_num = self.dmamux_ch_num(); + let request = PeripheralChannel::::request(self); + unsafe { + transfer_p2m( + regs, + state_num, + src, + buf, + dmamux_regs, + dmamux_ch_num, + request, + ) + } + } + } }; } diff --git a/embassy-stm32/src/dmamux/mod.rs b/embassy-stm32/src/dmamux/mod.rs index 79dea2960..93653b513 100644 --- a/embassy-stm32/src/dmamux/mod.rs +++ b/embassy-stm32/src/dmamux/mod.rs @@ -22,8 +22,6 @@ use core::future::Future; use crate::dma_traits::{ReadDma, WriteDma}; -pub(crate) fn configure_channel(ch_num: u8, request_num: u8) {} - /* #[allow(unused)] pub(crate) async unsafe fn transfer_m2p( @@ -143,6 +141,7 @@ pub trait PeripheralChannel: sealed::Channel {} pub struct P2M; pub struct M2P; +#[allow(unused)] macro_rules! impl_dma_channel { ($channel_peri:ident, $dmamux_peri:ident, $channel_num:expr, $dma_peri: ident, $dma_num:expr) => { impl Channel for peripherals::$channel_peri {} @@ -189,6 +188,7 @@ peripherals! { }; } +#[allow(unused)] macro_rules! impl_usart_dma_requests { ($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { dma_requests! { @@ -239,6 +239,7 @@ macro_rules! impl_usart_dma_requests { }; } +#[allow(unused)] #[cfg(usart)] use crate::usart; diff --git a/stm32-data b/stm32-data index 3d0489cd1..df8726306 160000 --- a/stm32-data +++ b/stm32-data @@ -1 +1 @@ -Subproject commit 3d0489cd17a4ea1d8da289bd5854346fdfbf5f61 +Subproject commit df8726306bacfad53ebcf760d3a4ca9cb0138dc9