From 84d53391ea92fc142df39d692bdcff55d9b938e5 Mon Sep 17 00:00:00 2001 From: Fabian Wolter Date: Sun, 15 Dec 2024 20:52:12 +0100 Subject: [PATCH] Extract DMA remapping data for F07/F3 This is the basis to fix embassy-rs/embassy#3643 --- stm32-data-gen/src/dma.rs | 13 +++++++++++++ stm32-data-serde/src/lib.rs | 2 ++ stm32-metapac-gen/res/src/metadata.rs | 1 + stm32-metapac-gen/src/data.rs | 1 + 4 files changed, 17 insertions(+) diff --git a/stm32-data-gen/src/dma.rs b/stm32-data-gen/src/dma.rs index 6c217e8e1..182fc5a54 100644 --- a/stm32-data-gen/src/dma.rs +++ b/stm32-data-gen/src/dma.rs @@ -164,6 +164,7 @@ impl DmaChannels { signal: request.to_string(), channel: None, dmamux: Some(req_dmamux.to_string()), + syscfg_cfgr1_remap_bit: None, request: Some(request_num), dma: None, }) @@ -246,6 +247,16 @@ impl DmaChannels { let parts: Vec<_> = original_target_name.split(':').collect(); let target_name = parts[0]; + let syscfg_cfgr1_remap_bit = if parts.len() > 1 && parts[1].contains("Remap") { + match parts[1].chars().last().unwrap() { + '0' => Some(false), + '1' => Some(true), + _ => None, + } + } else { + None + }; + // Chips with single DAC refer to channels by DAC1/DAC2 let target_name = match target_name { "DAC1" => "DAC_CH1", @@ -274,6 +285,7 @@ impl DmaChannels { signal: request.to_string(), channel: Some(format!("{dma_peri_name}_CH{channel_name}")), dmamux: None, + syscfg_cfgr1_remap_bit, request: requests.get(&original_target_name).copied(), dma: None, }; @@ -339,6 +351,7 @@ impl DmaChannels { dma: Some(instance.to_string()), channel: None, dmamux: None, + syscfg_cfgr1_remap_bit: None, request: Some(request_num), }); } diff --git a/stm32-data-serde/src/lib.rs b/stm32-data-serde/src/lib.rs index b45cbc128..c8e9492de 100644 --- a/stm32-data-serde/src/lib.rs +++ b/stm32-data-serde/src/lib.rs @@ -228,6 +228,8 @@ pub mod chip { #[serde(skip_serializing_if = "Option::is_none")] pub dmamux: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub syscfg_cfgr1_remap_bit: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub request: Option, } } diff --git a/stm32-metapac-gen/res/src/metadata.rs b/stm32-metapac-gen/res/src/metadata.rs index 96802ed6e..42f746e56 100644 --- a/stm32-metapac-gen/res/src/metadata.rs +++ b/stm32-metapac-gen/res/src/metadata.rs @@ -243,5 +243,6 @@ pub struct PeripheralDmaChannel { pub channel: Option<&'static str>, pub dmamux: Option<&'static str>, pub dma: Option<&'static str>, + pub syscfg_cfgr1_remap_bit: Option, pub request: Option, } diff --git a/stm32-metapac-gen/src/data.rs b/stm32-metapac-gen/src/data.rs index dc24d63fe..a8f44d625 100644 --- a/stm32-metapac-gen/src/data.rs +++ b/stm32-metapac-gen/src/data.rs @@ -449,6 +449,7 @@ pub struct PeripheralDmaChannel { pub signal: String, pub channel: Option, pub dmamux: Option, + pub syscfg_cfgr1_remap_bit: Option, pub dma: Option, pub request: Option, }