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

@ -252,6 +252,7 @@ pub fn gen(options: Options) {
let mut peripheral_pins_table: Vec<Vec<String>> = Vec::new();
let mut peripheral_rcc_table: Vec<Vec<String>> = Vec::new();
let mut dma_channels_table: Vec<Vec<String>> = Vec::new();
let mut bdma_channels_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_counts: HashMap<String, u8> = HashMap::new();
@ -266,13 +267,7 @@ pub fn gen(options: Options) {
let gpio_base = core.peripherals.get(&"GPIOA".to_string()).unwrap().address;
let gpio_stride = 0x400;
for (id, channel_info) in &core.dma_channels {
let mut row = Vec::new();
row.push(id.clone());
row.push(channel_info.dma.clone());
row.push(channel_info.channel.to_string());
dma_channels_table.push(row);
}
let number_suffix_re = Regex::new("^(.*?)[0-9]*$").unwrap();
@ -449,6 +444,24 @@ pub fn gen(options: Options) {
dev.peripherals.push(ir_peri);
}
for (id, channel_info) in &core.dma_channels {
let mut row = Vec::new();
let dma_peri = core.peripherals.get(&channel_info.dma);
row.push(id.clone());
row.push(channel_info.dma.clone());
row.push(channel_info.channel.to_string());
if let Some(dma_peri) = dma_peri {
if let Some(ref block) = dma_peri.block {
let bi = BlockInfo::parse(block);
if bi.module == "bdma" {
bdma_channels_table.push(row);
} else {
dma_channels_table.push(row);
}
}
}
}
for (name, &num) in &core.interrupts {
dev.interrupts.push(ir::Interrupt {
name: name.clone(),
@ -495,6 +508,7 @@ pub fn gen(options: Options) {
);
make_table(&mut extra, "peripheral_rcc", &peripheral_rcc_table);
make_table(&mut extra, "dma_channels", &dma_channels_table);
make_table(&mut extra, "bdma_channels", &bdma_channels_table);
make_table(&mut extra, "dma_requests", &dma_requests_table);
make_peripheral_counts(&mut extra, &peripheral_counts);