Let's count channels per DMA peripheral, shall we now?
This commit is contained in:
parent
b0b61d99e6
commit
2e10ab2e5c
2 changed files with 24 additions and 3 deletions
|
@ -152,7 +152,7 @@ unsafe fn on_irq() {
|
||||||
pac::$dma.ifcr().write_value(isr);
|
pac::$dma.ifcr().write_value(isr);
|
||||||
let dman = <crate::peripherals::$dma as sealed::Dma>::num() as usize;
|
let dman = <crate::peripherals::$dma as sealed::Dma>::num() as usize;
|
||||||
|
|
||||||
for chn in 0..7 {
|
for chn in 0..crate::pac::dma_channels_count!($dma) {
|
||||||
let n = dman * 8 + chn;
|
let n = dman * 8 + chn;
|
||||||
if isr.teif(chn) {
|
if isr.teif(chn) {
|
||||||
STATE.ch_status[n].store(CH_STATUS_ERROR, Ordering::Relaxed);
|
STATE.ch_status[n].store(CH_STATUS_ERROR, Ordering::Relaxed);
|
||||||
|
|
|
@ -141,6 +141,21 @@ macro_rules! peripheral_count {{
|
||||||
write!(out, " }}\n").unwrap();
|
write!(out, " }}\n").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn make_dma_channel_counts(out: &mut String, data: &HashMap<String, u8>) {
|
||||||
|
write!(out,
|
||||||
|
"#[macro_export]
|
||||||
|
macro_rules! dma_channels_count {{
|
||||||
|
").unwrap();
|
||||||
|
for (name, count) in data {
|
||||||
|
write!(out,
|
||||||
|
"({}) => ({});\n",
|
||||||
|
name, count,
|
||||||
|
).unwrap();
|
||||||
|
}
|
||||||
|
write!(out,
|
||||||
|
" }}\n").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
fn make_table(out: &mut String, name: &str, data: &Vec<Vec<String>>) {
|
fn make_table(out: &mut String, name: &str, data: &Vec<Vec<String>>) {
|
||||||
write!(
|
write!(
|
||||||
out,
|
out,
|
||||||
|
@ -256,6 +271,7 @@ pub fn gen(options: Options) {
|
||||||
let mut dma_requests_table: Vec<Vec<String>> = Vec::new();
|
let mut dma_requests_table: Vec<Vec<String>> = Vec::new();
|
||||||
let mut peripheral_dma_channels_table: Vec<Vec<String>> = Vec::new();
|
let mut peripheral_dma_channels_table: Vec<Vec<String>> = Vec::new();
|
||||||
let mut peripheral_counts: HashMap<String, u8> = HashMap::new();
|
let mut peripheral_counts: HashMap<String, u8> = HashMap::new();
|
||||||
|
let mut dma_channel_counts: HashMap<String, u8> = HashMap::new();
|
||||||
|
|
||||||
let dma_base = core
|
let dma_base = core
|
||||||
.peripherals
|
.peripherals
|
||||||
|
@ -267,8 +283,6 @@ pub fn gen(options: Options) {
|
||||||
let gpio_base = core.peripherals.get(&"GPIOA".to_string()).unwrap().address;
|
let gpio_base = core.peripherals.get(&"GPIOA".to_string()).unwrap().address;
|
||||||
let gpio_stride = 0x400;
|
let gpio_stride = 0x400;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let number_suffix_re = Regex::new("^(.*?)[0-9]*$").unwrap();
|
let number_suffix_re = Regex::new("^(.*?)[0-9]*$").unwrap();
|
||||||
|
|
||||||
for (name, p) in &core.peripherals {
|
for (name, p) in &core.peripherals {
|
||||||
|
@ -460,6 +474,12 @@ pub fn gen(options: Options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let dma_peri_name = channel_info.dma.clone();
|
||||||
|
dma_channel_counts.insert(
|
||||||
|
dma_peri_name.clone(),
|
||||||
|
dma_channel_counts.get(&dma_peri_name).map_or(1, |v| v + 1),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name, &num) in &core.interrupts {
|
for (name, &num) in &core.interrupts {
|
||||||
|
@ -511,6 +531,7 @@ pub fn gen(options: Options) {
|
||||||
make_table(&mut extra, "bdma_channels", &bdma_channels_table);
|
make_table(&mut extra, "bdma_channels", &bdma_channels_table);
|
||||||
make_table(&mut extra, "dma_requests", &dma_requests_table);
|
make_table(&mut extra, "dma_requests", &dma_requests_table);
|
||||||
make_peripheral_counts(&mut extra, &peripheral_counts);
|
make_peripheral_counts(&mut extra, &peripheral_counts);
|
||||||
|
make_dma_channel_counts(&mut extra, &dma_channel_counts);
|
||||||
|
|
||||||
for (module, version) in peripheral_versions {
|
for (module, version) in peripheral_versions {
|
||||||
all_peripheral_versions.insert((module.clone(), version.clone()));
|
all_peripheral_versions.insert((module.clone(), version.clone()));
|
||||||
|
|
Loading…
Reference in a new issue