Twizzle our DMA vs BDMA channels.

This commit is contained in:
Bob McWhirter
2021-07-12 10:32:57 -04:00
parent a24a7e9fec
commit 97ad434d38
3 changed files with 38 additions and 18 deletions

View File

@ -236,7 +236,6 @@ macro_rules! impl_dma_channel {
#[cfg(not(dmamux))]
impl<T> WriteDma<T> for crate::peripherals::$channel_peri
where
Self: crate::dmamux::sealed::PeripheralChannel<T, crate::dmamux::M2P>,
T: 'static,
{
type WriteDmaFuture<'a> = impl Future<Output = ()>;
@ -358,7 +357,7 @@ macro_rules! impl_dma_channel {
pac::peripherals! {
(bdma, DMA1) => {
impl_dma!(DMA1, 0);
pac::dma_channels! {
pac::bdma_channels! {
($channel_peri:ident, DMA1, $channel_num:expr) => {
impl_dma_channel!($channel_peri, DMA1, 0, $channel_num);
};
@ -366,7 +365,7 @@ pac::peripherals! {
};
(bdma, DMA2) => {
impl_dma!(DMA2, 1);
pac::dma_channels! {
pac::bdma_channels! {
($channel_peri:ident, DMA2, $channel_num:expr) => {
impl_dma_channel!($channel_peri, DMA2, 1, $channel_num);
};
@ -375,8 +374,8 @@ pac::peripherals! {
// Because H7cm changes the naming
(bdma, BDMA) => {
impl_dma!(BDMA, 0);
pac::dma_channels! {
($channel_peri:ident, DMA1, $channel_num:expr) => {
pac::bdma_channels! {
($channel_peri:ident, BDMA, $channel_num:expr) => {
impl_dma_channel!($channel_peri, BDMA, 0, $channel_num);
};
}
@ -421,7 +420,7 @@ pac::peripheral_dma_channels! {
#[cfg(dmamux)]
pac::peripherals! {
(usart, $peri:ident) => {
pac::dma_channels! {
pac::bdma_channels! {
($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => {
impl usart::TxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }
impl usart::sealed::TxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }
@ -429,7 +428,7 @@ pac::peripherals! {
}
};
(uart, $peri:ident) => {
pac::dma_channels! {
pac::bdma_channels! {
($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => {
impl usart::TxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }
impl usart::sealed::TxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }

View File

@ -11,7 +11,7 @@ use crate::interrupt;
use crate::pac::bdma::{regs, vals};
use crate::pac;
use crate::pac::dma_channels;
use crate::pac::bdma_channels;
use crate::pac::dma_requests;
use crate::pac::interrupts;
use crate::pac::peripheral_count;
@ -170,19 +170,26 @@ macro_rules! impl_dmamux {
peripherals! {
(bdma, DMA1) => {
dma_channels! {
bdma_channels! {
($channel_peri:ident, DMA1, $channel_num:expr) => {
impl_dma_channel!($channel_peri, DMAMUX1, $channel_num, DMA1, 0);
};
}
};
(bdma, DMA2) => {
dma_channels! {
bdma_channels! {
($channel_peri:ident, DMA2, $channel_num:expr) => {
impl_dma_channel!($channel_peri, DMAMUX1, $channel_num, DMA2, 1);
};
}
};
(bdma, BDMA) => {
bdma_channels! {
($channel_peri:ident, BDMA, $channel_num:expr) => {
impl_dma_channel!($channel_peri, DMAMUX1, $channel_num, DMA2, 1);
};
}
};
(dmamux, DMAMUX1) => {
impl_dmamux!(DMAMUX1);
};
@ -243,7 +250,7 @@ macro_rules! impl_usart_dma_requests {
#[cfg(usart)]
use crate::usart;
dma_channels! {
bdma_channels! {
($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => {
impl_usart_dma_requests!($channel_peri, $dma_peri, $channel_num);
};