Allow some unused lints given that H7 is still in flight with its multitude of DMA.

This commit is contained in:
Bob McWhirter 2021-07-09 11:07:53 -04:00
parent 13975a0818
commit a24a7e9fec
3 changed files with 49 additions and 5 deletions

View File

@ -10,7 +10,6 @@ use crate::dma_traits::{ReadDma, WriteDma};
use crate::interrupt; use crate::interrupt;
use crate::pac; use crate::pac;
use crate::pac::bdma::vals; use crate::pac::bdma::vals;
use crate::rcc::sealed::RccPeripheral;
const CH_COUNT: usize = pac::peripheral_count!(DMA) * 8; const CH_COUNT: usize = pac::peripheral_count!(DMA) * 8;
const CH_STATUS_NONE: u8 = 0; const CH_STATUS_NONE: u8 = 0;
@ -41,6 +40,9 @@ pub(crate) async unsafe fn transfer_p2m(
state_number: usize, state_number: usize,
src: *const u8, src: *const u8,
dst: &mut [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. // ndtr is max 16 bits.
assert!(dst.len() <= 0xFFFF); assert!(dst.len() <= 0xFFFF);
@ -59,7 +61,7 @@ pub(crate) async unsafe fn transfer_p2m(
}); });
#[cfg(dmamux)] #[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.par().write_value(src as u32);
regs.mar().write_value(dst.as_mut_ptr() 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<T> ReadDma<T> for crate::peripherals::$channel_peri impl<T> ReadDma<T> for crate::peripherals::$channel_peri
where where
T: 'static, T: 'static,
@ -309,6 +312,46 @@ macro_rules! impl_dma_channel {
unsafe { transfer_p2m(regs, state_num, src, buf) } unsafe { transfer_p2m(regs, state_num, src, buf) }
} }
} }
#[cfg(dmamux)]
impl<T> ReadDma<T> for crate::peripherals::$channel_peri
where
Self: crate::dmamux::sealed::PeripheralChannel<T, crate::dmamux::M2P>,
T: 'static,
{
type ReadDmaFuture<'a> = impl Future<Output = ()>;
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::<T, crate::dmamux::M2P>::request(self);
unsafe {
transfer_p2m(
regs,
state_num,
src,
buf,
dmamux_regs,
dmamux_ch_num,
request,
)
}
}
}
}; };
} }

View File

@ -22,8 +22,6 @@ use core::future::Future;
use crate::dma_traits::{ReadDma, WriteDma}; use crate::dma_traits::{ReadDma, WriteDma};
pub(crate) fn configure_channel(ch_num: u8, request_num: u8) {}
/* /*
#[allow(unused)] #[allow(unused)]
pub(crate) async unsafe fn transfer_m2p( pub(crate) async unsafe fn transfer_m2p(
@ -143,6 +141,7 @@ pub trait PeripheralChannel<PERI, OP>: sealed::Channel {}
pub struct P2M; pub struct P2M;
pub struct M2P; pub struct M2P;
#[allow(unused)]
macro_rules! impl_dma_channel { macro_rules! impl_dma_channel {
($channel_peri:ident, $dmamux_peri:ident, $channel_num:expr, $dma_peri: ident, $dma_num:expr) => { ($channel_peri:ident, $dmamux_peri:ident, $channel_num:expr, $dma_peri: ident, $dma_num:expr) => {
impl Channel for peripherals::$channel_peri {} impl Channel for peripherals::$channel_peri {}
@ -189,6 +188,7 @@ peripherals! {
}; };
} }
#[allow(unused)]
macro_rules! impl_usart_dma_requests { macro_rules! impl_usart_dma_requests {
($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { ($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => {
dma_requests! { dma_requests! {
@ -239,6 +239,7 @@ macro_rules! impl_usart_dma_requests {
}; };
} }
#[allow(unused)]
#[cfg(usart)] #[cfg(usart)]
use crate::usart; use crate::usart;

@ -1 +1 @@
Subproject commit 3d0489cd17a4ea1d8da289bd5854346fdfbf5f61 Subproject commit df8726306bacfad53ebcf760d3a4ca9cb0138dc9