aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob McWhirter <[email protected]>2021-07-09 11:07:53 -0400
committerBob McWhirter <[email protected]>2021-07-13 10:09:35 -0400
commita24a7e9fece1768e359621780c0dfdf56ee46805 (patch)
treeae0d985858b55866ca61aa17fd9532933cc57ae6
parent13975a08184b51b91edcb67b96694129389717f2 (diff)
Allow some unused lints given that H7 is still in flight with its multitude of DMA.
-rw-r--r--embassy-stm32/src/bdma/v1.rs47
-rw-r--r--embassy-stm32/src/dmamux/mod.rs5
m---------stm32-data0
3 files changed, 48 insertions, 4 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};
10use crate::interrupt; 10use crate::interrupt;
11use crate::pac; 11use crate::pac;
12use crate::pac::bdma::vals; 12use crate::pac::bdma::vals;
13use crate::rcc::sealed::RccPeripheral;
14 13
15const CH_COUNT: usize = pac::peripheral_count!(DMA) * 8; 14const CH_COUNT: usize = pac::peripheral_count!(DMA) * 8;
16const CH_STATUS_NONE: u8 = 0; 15const CH_STATUS_NONE: u8 = 0;
@@ -41,6 +40,9 @@ pub(crate) async unsafe fn transfer_p2m(
41 state_number: usize, 40 state_number: usize,
42 src: *const u8, 41 src: *const u8,
43 dst: &mut [u8], 42 dst: &mut [u8],
43 #[cfg(dmamux)] dmamux_regs: pac::dmamux::Dmamux,
44 #[cfg(dmamux)] dmamux_ch_num: u8,
45 #[cfg(dmamux)] request: u8,
44) { 46) {
45 // ndtr is max 16 bits. 47 // ndtr is max 16 bits.
46 assert!(dst.len() <= 0xFFFF); 48 assert!(dst.len() <= 0xFFFF);
@@ -59,7 +61,7 @@ pub(crate) async unsafe fn transfer_p2m(
59 }); 61 });
60 62
61 #[cfg(dmamux)] 63 #[cfg(dmamux)]
62 crate::dmamux::configure_channel(1, 2); 64 crate::dmamux::configure_dmamux(dmamux_regs, dmamux_ch_num, request);
63 65
64 regs.par().write_value(src as u32); 66 regs.par().write_value(src as u32);
65 regs.mar().write_value(dst.as_mut_ptr() as u32); 67 regs.mar().write_value(dst.as_mut_ptr() as u32);
@@ -288,6 +290,7 @@ macro_rules! impl_dma_channel {
288 } 290 }
289 } 291 }
290 292
293 #[cfg(not(dmamux))]
291 impl<T> ReadDma<T> for crate::peripherals::$channel_peri 294 impl<T> ReadDma<T> for crate::peripherals::$channel_peri
292 where 295 where
293 T: 'static, 296 T: 'static,
@@ -309,6 +312,46 @@ macro_rules! impl_dma_channel {
309 unsafe { transfer_p2m(regs, state_num, src, buf) } 312 unsafe { transfer_p2m(regs, state_num, src, buf) }
310 } 313 }
311 } 314 }
315
316 #[cfg(dmamux)]
317 impl<T> ReadDma<T> for crate::peripherals::$channel_peri
318 where
319 Self: crate::dmamux::sealed::PeripheralChannel<T, crate::dmamux::M2P>,
320 T: 'static,
321 {
322 type ReadDmaFuture<'a> = impl Future<Output = ()>;
323
324 fn transfer<'a>(
325 &'a mut self,
326 src: *const u8,
327 buf: &'a mut [u8],
328 ) -> Self::ReadDmaFuture<'a>
329 where
330 T: 'a,
331 {
332 use sealed::Channel as _Channel;
333
334 let state_num = self.state_num();
335 let regs = self.regs();
336
337 use crate::dmamux::sealed::Channel as _MuxChannel;
338 use crate::dmamux::sealed::PeripheralChannel;
339 let dmamux_regs = self.dmamux_regs();
340 let dmamux_ch_num = self.dmamux_ch_num();
341 let request = PeripheralChannel::<T, crate::dmamux::M2P>::request(self);
342 unsafe {
343 transfer_p2m(
344 regs,
345 state_num,
346 src,
347 buf,
348 dmamux_regs,
349 dmamux_ch_num,
350 request,
351 )
352 }
353 }
354 }
312 }; 355 };
313} 356}
314 357
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;
22 22
23use crate::dma_traits::{ReadDma, WriteDma}; 23use crate::dma_traits::{ReadDma, WriteDma};
24 24
25pub(crate) fn configure_channel(ch_num: u8, request_num: u8) {}
26
27/* 25/*
28#[allow(unused)] 26#[allow(unused)]
29pub(crate) async unsafe fn transfer_m2p( 27pub(crate) async unsafe fn transfer_m2p(
@@ -143,6 +141,7 @@ pub trait PeripheralChannel<PERI, OP>: sealed::Channel {}
143pub struct P2M; 141pub struct P2M;
144pub struct M2P; 142pub struct M2P;
145 143
144#[allow(unused)]
146macro_rules! impl_dma_channel { 145macro_rules! impl_dma_channel {
147 ($channel_peri:ident, $dmamux_peri:ident, $channel_num:expr, $dma_peri: ident, $dma_num:expr) => { 146 ($channel_peri:ident, $dmamux_peri:ident, $channel_num:expr, $dma_peri: ident, $dma_num:expr) => {
148 impl Channel for peripherals::$channel_peri {} 147 impl Channel for peripherals::$channel_peri {}
@@ -189,6 +188,7 @@ peripherals! {
189 }; 188 };
190} 189}
191 190
191#[allow(unused)]
192macro_rules! impl_usart_dma_requests { 192macro_rules! impl_usart_dma_requests {
193 ($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { 193 ($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => {
194 dma_requests! { 194 dma_requests! {
@@ -239,6 +239,7 @@ macro_rules! impl_usart_dma_requests {
239 }; 239 };
240} 240}
241 241
242#[allow(unused)]
242#[cfg(usart)] 243#[cfg(usart)]
243use crate::usart; 244use crate::usart;
244 245
diff --git a/stm32-data b/stm32-data
Subproject 3d0489cd17a4ea1d8da289bd5854346fdfbf5f6 Subproject df8726306bacfad53ebcf760d3a4ca9cb0138dc