Skip to content

Commit

Permalink
Extract DMA remapping data for F07/F3
Browse files Browse the repository at this point in the history
This is the basis to fix embassy-rs/embassy#3643
  • Loading branch information
fwolter committed Dec 15, 2024
1 parent 583744a commit 84d5339
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions stm32-data-gen/src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
};
Expand Down Expand Up @@ -339,6 +351,7 @@ impl DmaChannels {
dma: Some(instance.to_string()),
channel: None,
dmamux: None,
syscfg_cfgr1_remap_bit: None,
request: Some(request_num),
});
}
Expand Down
2 changes: 2 additions & 0 deletions stm32-data-serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ pub mod chip {
#[serde(skip_serializing_if = "Option::is_none")]
pub dmamux: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub syscfg_cfgr1_remap_bit: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub request: Option<u8>,
}
}
Expand Down
1 change: 1 addition & 0 deletions stm32-metapac-gen/res/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>,
pub request: Option<u32>,
}
1 change: 1 addition & 0 deletions stm32-metapac-gen/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ pub struct PeripheralDmaChannel {
pub signal: String,
pub channel: Option<String>,
pub dmamux: Option<String>,
pub syscfg_cfgr1_remap_bit: Option<bool>,
pub dma: Option<String>,
pub request: Option<u32>,
}
Expand Down

0 comments on commit 84d5339

Please sign in to comment.