summaryrefslogtreecommitdiff
path: root/stm32-metapac-gen
diff options
context:
space:
mode:
authorBob McWhirter <bmcwhirt@redhat.com>2021-07-27 12:52:01 -0400
committerBob McWhirter <bmcwhirt@redhat.com>2021-07-27 12:52:01 -0400
commitb910551c9ac9857e77eea79a4845a38f38111d83 (patch)
treec14ddfe9e6bb5f94cf8be92094f09e6d980dbc86 /stm32-metapac-gen
parent9fec792a6af4bc7707983eb9772cb4a0d09ee1f5 (diff)
downloadembassy-b910551c9ac9857e77eea79a4845a38f38111d83.zip
Generate more rows in the interrupts! table.
Adjust DMA/BDMA to use the new style.
Diffstat (limited to 'stm32-metapac-gen')
-rw-r--r--stm32-metapac-gen/src/lib.rs34
1 files changed, 12 insertions, 22 deletions
diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs
index 203d943d..ce720c67 100644
--- a/stm32-metapac-gen/src/lib.rs
+++ b/stm32-metapac-gen/src/lib.rs
@@ -50,6 +50,8 @@ pub struct Peripheral {
pub pins: Vec<Pin>,
#[serde(default)]
pub dma_channels: HashMap<String, Vec<PeripheralDmaChannel>>,
+ #[serde(default)]
+ pub interrupts: HashMap<String, String>
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
@@ -306,9 +308,6 @@ pub fn gen(options: Options) {
}
}
- let mut has_bdma = false;
- let mut has_dma = false;
-
for (name, p) in &core.peripherals {
let captures = number_suffix_re.captures(&name).unwrap();
let root_peri_name = captures.get(1).unwrap().as_str().to_string();
@@ -328,12 +327,6 @@ pub fn gen(options: Options) {
if let Some(block) = &p.block {
let bi = BlockInfo::parse(block);
- if bi.module == "bdma" {
- has_bdma = true
- } else if bi.module == "dma" {
- has_dma = true
- }
-
peripheral_counts.insert(
bi.module.clone(),
peripheral_counts.get(&bi.module).map_or(1, |v| v + 1),
@@ -352,6 +345,16 @@ pub fn gen(options: Options) {
peripheral_pins_table.push(row);
}
+ for (signal, irq_name) in &p.interrupts {
+ let mut row = Vec::new();
+ row.push(name.clone());
+ row.push(bi.module.clone());
+ row.push(bi.block.clone());
+ row.push( signal.clone() );
+ row.push( irq_name.to_ascii_uppercase() );
+ interrupt_table.push(row)
+ }
+
for (request, dma_channels) in &p.dma_channels {
for channel in dma_channels.iter() {
let mut row = Vec::new();
@@ -553,19 +556,6 @@ pub fn gen(options: Options) {
interrupt_table.push(vec![name.clone()]);
- if name.starts_with("DMA1_") || name.starts_with("DMA2_") || name.contains("_DMA") {
- if has_dma {
- interrupt_table.push(vec!["DMA".to_string(), name.clone()]);
- } else if has_bdma {
- interrupt_table.push(vec!["BDMA".to_string(), name.clone()]);
- }
- }
-
- if name.starts_with("BDMA_") || name.starts_with("BDMA1_") || name.starts_with("BDMA2_")
- {
- interrupt_table.push(vec!["BDMA".to_string(), name.clone()]);
- }
-
if name.contains("EXTI") {
interrupt_table.push(vec!["EXTI".to_string(), name.clone()]);
}