Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract DMA remapping data for F0/F3 #548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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