stm32/dma: Remove channel index tracking
This commit is contained in:
parent
fb53d74c57
commit
62eb675a3f
@ -602,29 +602,15 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dma_channel_count: usize = 0;
|
|
||||||
let mut bdma_channel_count: usize = 0;
|
|
||||||
let mut gpdma_channel_count: usize = 0;
|
|
||||||
|
|
||||||
for ch in METADATA.dma_channels {
|
for ch in METADATA.dma_channels {
|
||||||
let mut row = Vec::new();
|
let mut row = Vec::new();
|
||||||
let dma_peri = METADATA.peripherals.iter().find(|p| p.name == ch.dma).unwrap();
|
let dma_peri = METADATA.peripherals.iter().find(|p| p.name == ch.dma).unwrap();
|
||||||
let bi = dma_peri.registers.as_ref().unwrap();
|
let bi = dma_peri.registers.as_ref().unwrap();
|
||||||
|
|
||||||
let num;
|
|
||||||
match bi.kind {
|
match bi.kind {
|
||||||
"dma" => {
|
"dma" => {}
|
||||||
num = dma_channel_count;
|
"bdma" => {}
|
||||||
dma_channel_count += 1;
|
"gpdma" => {}
|
||||||
}
|
|
||||||
"bdma" => {
|
|
||||||
num = bdma_channel_count;
|
|
||||||
bdma_channel_count += 1;
|
|
||||||
}
|
|
||||||
"gpdma" => {
|
|
||||||
num = gpdma_channel_count;
|
|
||||||
gpdma_channel_count += 1;
|
|
||||||
}
|
|
||||||
_ => panic!("bad dma channel kind {}", bi.kind),
|
_ => panic!("bad dma channel kind {}", bi.kind),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +618,6 @@ fn main() {
|
|||||||
row.push(ch.dma.to_string());
|
row.push(ch.dma.to_string());
|
||||||
row.push(bi.kind.to_string());
|
row.push(bi.kind.to_string());
|
||||||
row.push(ch.channel.to_string());
|
row.push(ch.channel.to_string());
|
||||||
row.push(num.to_string());
|
|
||||||
if let Some(dmamux) = &ch.dmamux {
|
if let Some(dmamux) = &ch.dmamux {
|
||||||
let dmamux_channel = ch.dmamux_channel.unwrap();
|
let dmamux_channel = ch.dmamux_channel.unwrap();
|
||||||
row.push(format!("{{dmamux: {}, dmamux_channel: {}}}", dmamux, dmamux_channel));
|
row.push(format!("{{dmamux: {}, dmamux_channel: {}}}", dmamux, dmamux_channel));
|
||||||
@ -643,12 +628,6 @@ fn main() {
|
|||||||
dma_channels_table.push(row);
|
dma_channels_table.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
g.extend(quote! {
|
|
||||||
pub(crate) const DMA_CHANNEL_COUNT: usize = #dma_channel_count;
|
|
||||||
pub(crate) const BDMA_CHANNEL_COUNT: usize = #bdma_channel_count;
|
|
||||||
pub(crate) const GPDMA_CHANNEL_COUNT: usize = #gpdma_channel_count;
|
|
||||||
});
|
|
||||||
|
|
||||||
for irq in METADATA.interrupts {
|
for irq in METADATA.interrupts {
|
||||||
let name = irq.name.to_ascii_uppercase();
|
let name = irq.name.to_ascii_uppercase();
|
||||||
interrupts_table.push(vec![name.clone()]);
|
interrupts_table.push(vec![name.clone()]);
|
||||||
|
@ -32,10 +32,10 @@ pub(crate) unsafe fn init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach_dma_channel! {
|
foreach_dma_channel! {
|
||||||
($channel_peri:ident, BDMA1, bdma, $channel_num:expr, $index:expr, $dmamux:tt) => {
|
($channel_peri:ident, BDMA1, bdma, $channel_num:expr, $dmamux:tt) => {
|
||||||
// BDMA1 in H7 doesn't use DMAMUX, which breaks
|
// BDMA1 in H7 doesn't use DMAMUX, which breaks
|
||||||
};
|
};
|
||||||
($channel_peri:ident, $dma_peri:ident, bdma, $channel_num:expr, $index:expr, $dmamux:tt) => {
|
($channel_peri:ident, $dma_peri:ident, bdma, $channel_num:expr, $dmamux:tt) => {
|
||||||
impl crate::peripherals::$channel_peri {
|
impl crate::peripherals::$channel_peri {
|
||||||
fn waker() -> &'static AtomicWaker {
|
fn waker() -> &'static AtomicWaker {
|
||||||
static WAKER: AtomicWaker = AtomicWaker::new();
|
static WAKER: AtomicWaker = AtomicWaker::new();
|
||||||
|
@ -49,7 +49,7 @@ pub(crate) unsafe fn init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach_dma_channel! {
|
foreach_dma_channel! {
|
||||||
($channel_peri:ident, $dma_peri:ident, dma, $channel_num:expr, $index:expr, $dmamux:tt) => {
|
($channel_peri:ident, $dma_peri:ident, dma, $channel_num:expr, $dmamux:tt) => {
|
||||||
impl crate::peripherals::$channel_peri {
|
impl crate::peripherals::$channel_peri {
|
||||||
fn waker() -> &'static AtomicWaker {
|
fn waker() -> &'static AtomicWaker {
|
||||||
static WAKER: AtomicWaker = AtomicWaker::new();
|
static WAKER: AtomicWaker = AtomicWaker::new();
|
||||||
|
@ -31,7 +31,7 @@ pub trait MuxChannel: sealed::MuxChannel + super::Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach_dma_channel! {
|
foreach_dma_channel! {
|
||||||
($channel_peri:ident, $dma_peri:ident, $version:ident, $channel_num:expr, $index:expr, {dmamux: $dmamux:ident, dmamux_channel: $dmamux_channel:expr}) => {
|
($channel_peri:ident, $dma_peri:ident, $version:ident, $channel_num:expr, {dmamux: $dmamux:ident, dmamux_channel: $dmamux_channel:expr}) => {
|
||||||
impl sealed::MuxChannel for peripherals::$channel_peri {
|
impl sealed::MuxChannel for peripherals::$channel_peri {
|
||||||
const DMAMUX_CH_NUM: u8 = $dmamux_channel;
|
const DMAMUX_CH_NUM: u8 = $dmamux_channel;
|
||||||
const DMAMUX_REGS: pac::dmamux::Dmamux = pac::$dmamux;
|
const DMAMUX_REGS: pac::dmamux::Dmamux = pac::$dmamux;
|
||||||
|
@ -29,7 +29,7 @@ pub(crate) unsafe fn init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach_dma_channel! {
|
foreach_dma_channel! {
|
||||||
($channel_peri:ident, $dma_peri:ident, gpdma, $channel_num:expr, $index:expr, $dmamux:tt) => {
|
($channel_peri:ident, $dma_peri:ident, gpdma, $channel_num:expr, $dmamux:tt) => {
|
||||||
impl crate::peripherals::$channel_peri {
|
impl crate::peripherals::$channel_peri {
|
||||||
fn waker() -> &'static AtomicWaker {
|
fn waker() -> &'static AtomicWaker {
|
||||||
static WAKER: AtomicWaker = AtomicWaker::new();
|
static WAKER: AtomicWaker = AtomicWaker::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user