aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob McWhirter <[email protected]>2021-07-27 12:52:01 -0400
committerBob McWhirter <[email protected]>2021-07-27 12:52:01 -0400
commitb910551c9ac9857e77eea79a4845a38f38111d83 (patch)
treec14ddfe9e6bb5f94cf8be92094f09e6d980dbc86
parent9fec792a6af4bc7707983eb9772cb4a0d09ee1f5 (diff)
Generate more rows in the interrupts! table.
Adjust DMA/BDMA to use the new style.
-rw-r--r--embassy-stm32/src/dma/bdma.rs2
-rw-r--r--embassy-stm32/src/dma/dma.rs2
-rw-r--r--stm32-metapac-gen/src/lib.rs34
3 files changed, 14 insertions, 24 deletions
diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs
index c52188c36..5b8f31c21 100644
--- a/embassy-stm32/src/dma/bdma.rs
+++ b/embassy-stm32/src/dma/bdma.rs
@@ -242,7 +242,7 @@ pac::dma_channels! {
242} 242}
243 243
244pac::interrupts! { 244pac::interrupts! {
245 (BDMA, $irq:ident) => { 245 ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => {
246 #[crate::interrupt] 246 #[crate::interrupt]
247 unsafe fn $irq () { 247 unsafe fn $irq () {
248 on_irq() 248 on_irq()
diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs
index 606c9d3d7..c6d35dc46 100644
--- a/embassy-stm32/src/dma/dma.rs
+++ b/embassy-stm32/src/dma/dma.rs
@@ -248,7 +248,7 @@ pac::dma_channels! {
248} 248}
249 249
250pac::interrupts! { 250pac::interrupts! {
251 (DMA, $irq:ident) => { 251 ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => {
252 #[crate::interrupt] 252 #[crate::interrupt]
253 unsafe fn $irq () { 253 unsafe fn $irq () {
254 on_irq() 254 on_irq()
diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs
index 203d943de..ce720c677 100644
--- a/stm32-metapac-gen/src/lib.rs
+++ b/stm32-metapac-gen/src/lib.rs
@@ -50,6 +50,8 @@ pub struct Peripheral {
50 pub pins: Vec<Pin>, 50 pub pins: Vec<Pin>,
51 #[serde(default)] 51 #[serde(default)]
52 pub dma_channels: HashMap<String, Vec<PeripheralDmaChannel>>, 52 pub dma_channels: HashMap<String, Vec<PeripheralDmaChannel>>,
53 #[serde(default)]
54 pub interrupts: HashMap<String, String>
53} 55}
54 56
55#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] 57#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
@@ -306,9 +308,6 @@ pub fn gen(options: Options) {
306 } 308 }
307 } 309 }
308 310
309 let mut has_bdma = false;
310 let mut has_dma = false;
311
312 for (name, p) in &core.peripherals { 311 for (name, p) in &core.peripherals {
313 let captures = number_suffix_re.captures(&name).unwrap(); 312 let captures = number_suffix_re.captures(&name).unwrap();
314 let root_peri_name = captures.get(1).unwrap().as_str().to_string(); 313 let root_peri_name = captures.get(1).unwrap().as_str().to_string();
@@ -328,12 +327,6 @@ pub fn gen(options: Options) {
328 if let Some(block) = &p.block { 327 if let Some(block) = &p.block {
329 let bi = BlockInfo::parse(block); 328 let bi = BlockInfo::parse(block);
330 329
331 if bi.module == "bdma" {
332 has_bdma = true
333 } else if bi.module == "dma" {
334 has_dma = true
335 }
336
337 peripheral_counts.insert( 330 peripheral_counts.insert(
338 bi.module.clone(), 331 bi.module.clone(),
339 peripheral_counts.get(&bi.module).map_or(1, |v| v + 1), 332 peripheral_counts.get(&bi.module).map_or(1, |v| v + 1),
@@ -352,6 +345,16 @@ pub fn gen(options: Options) {
352 peripheral_pins_table.push(row); 345 peripheral_pins_table.push(row);
353 } 346 }
354 347
348 for (signal, irq_name) in &p.interrupts {
349 let mut row = Vec::new();
350 row.push(name.clone());
351 row.push(bi.module.clone());
352 row.push(bi.block.clone());
353 row.push( signal.clone() );
354 row.push( irq_name.to_ascii_uppercase() );
355 interrupt_table.push(row)
356 }
357
355 for (request, dma_channels) in &p.dma_channels { 358 for (request, dma_channels) in &p.dma_channels {
356 for channel in dma_channels.iter() { 359 for channel in dma_channels.iter() {
357 let mut row = Vec::new(); 360 let mut row = Vec::new();
@@ -553,19 +556,6 @@ pub fn gen(options: Options) {
553 556
554 interrupt_table.push(vec![name.clone()]); 557 interrupt_table.push(vec![name.clone()]);
555 558
556 if name.starts_with("DMA1_") || name.starts_with("DMA2_") || name.contains("_DMA") {
557 if has_dma {
558 interrupt_table.push(vec!["DMA".to_string(), name.clone()]);
559 } else if has_bdma {
560 interrupt_table.push(vec!["BDMA".to_string(), name.clone()]);
561 }
562 }
563
564 if name.starts_with("BDMA_") || name.starts_with("BDMA1_") || name.starts_with("BDMA2_")
565 {
566 interrupt_table.push(vec!["BDMA".to_string(), name.clone()]);
567 }
568
569 if name.contains("EXTI") { 559 if name.contains("EXTI") {
570 interrupt_table.push(vec!["EXTI".to_string(), name.clone()]); 560 interrupt_table.push(vec!["EXTI".to_string(), name.clone()]);
571 } 561 }