diff options
| author | Bob McWhirter <[email protected]> | 2021-07-16 13:51:53 -0400 |
|---|---|---|
| committer | Bob McWhirter <[email protected]> | 2021-07-16 14:41:20 -0400 |
| commit | 1254e99be12b8a2520b46936a016480d5f689dd7 (patch) | |
| tree | bf51bf62fa810e6155775c7dda0064035d4ede3f | |
| parent | ae948415a79937c30ff5774b2483926287dad962 (diff) | |
Be able to scrub out BDMA-centric IRQs.
Further refine distinction between DMA and BDMA interrupts in the table.
| -rw-r--r-- | stm32-metapac-gen/src/lib.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs index a9ee88002..3cfb884ce 100644 --- a/stm32-metapac-gen/src/lib.rs +++ b/stm32-metapac-gen/src/lib.rs | |||
| @@ -284,6 +284,9 @@ pub fn gen(options: Options) { | |||
| 284 | 284 | ||
| 285 | let number_suffix_re = Regex::new("^(.*?)[0-9]*$").unwrap(); | 285 | let number_suffix_re = Regex::new("^(.*?)[0-9]*$").unwrap(); |
| 286 | 286 | ||
| 287 | let mut has_bdma = false; | ||
| 288 | let mut has_dma = false; | ||
| 289 | |||
| 287 | for (name, p) in &core.peripherals { | 290 | for (name, p) in &core.peripherals { |
| 288 | let captures = number_suffix_re.captures(&name).unwrap(); | 291 | let captures = number_suffix_re.captures(&name).unwrap(); |
| 289 | let root_peri_name = captures.get(1).unwrap().as_str().to_string(); | 292 | let root_peri_name = captures.get(1).unwrap().as_str().to_string(); |
| @@ -303,6 +306,12 @@ pub fn gen(options: Options) { | |||
| 303 | if let Some(block) = &p.block { | 306 | if let Some(block) = &p.block { |
| 304 | let bi = BlockInfo::parse(block); | 307 | let bi = BlockInfo::parse(block); |
| 305 | 308 | ||
| 309 | if bi.module == "bdma" { | ||
| 310 | has_bdma = true | ||
| 311 | } else if bi.module == "dma" { | ||
| 312 | has_dma = true | ||
| 313 | } | ||
| 314 | |||
| 306 | peripheral_counts.insert( | 315 | peripheral_counts.insert( |
| 307 | bi.module.clone(), | 316 | bi.module.clone(), |
| 308 | peripheral_counts.get(&bi.module).map_or(1, |v| v + 1), | 317 | peripheral_counts.get(&bi.module).map_or(1, |v| v + 1), |
| @@ -522,8 +531,16 @@ pub fn gen(options: Options) { | |||
| 522 | 531 | ||
| 523 | interrupt_table.push(vec![name.clone()]); | 532 | interrupt_table.push(vec![name.clone()]); |
| 524 | 533 | ||
| 525 | if name.starts_with("DMA") || name.contains("_DMA") { | 534 | if name.starts_with("DMA1_") || name.starts_with("DMA2_") || name.contains("_DMA") { |
| 526 | interrupt_table.push(vec!["DMA".to_string(), name.clone()]); | 535 | if has_dma { |
| 536 | interrupt_table.push(vec!["DMA".to_string(), name.clone()]); | ||
| 537 | } else if has_bdma { | ||
| 538 | interrupt_table.push(vec!["BDMA".to_string(), name.clone()]); | ||
| 539 | } | ||
| 540 | } | ||
| 541 | |||
| 542 | if name.starts_with("BDMA_") || name.starts_with("BDMA1_") || name.starts_with("BDMA2_") { | ||
| 543 | interrupt_table.push(vec!["BDMA".to_string(), name.clone()]); | ||
| 527 | } | 544 | } |
| 528 | 545 | ||
| 529 | if name.contains("EXTI") { | 546 | if name.contains("EXTI") { |
