Merge pull request #2058 from xoviat/rcc

rcc: remove mux_prefix from clocks
This commit is contained in:
xoviat 2023-10-14 17:57:44 +00:00 committed by GitHub
commit ba62037642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 74 deletions

View File

@ -58,7 +58,7 @@ rand_core = "0.6.3"
sdio-host = "0.5.0"
embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true }
critical-section = "1.1"
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e4a769aa67aa82603448377daa579d67a789983a" }
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e6e51db6cdd7d533e52ca7a3237f7816a0486cd4" }
vcell = "0.1.3"
bxcan = "0.7.0"
nb = "1.0.0"
@ -76,7 +76,7 @@ critical-section = { version = "1.1", features = ["std"] }
[build-dependencies]
proc-macro2 = "1.0.36"
quote = "1.0.15"
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e4a769aa67aa82603448377daa579d67a789983a", default-features = false, features = ["metadata"]}
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e6e51db6cdd7d533e52ca7a3237f7816a0486cd4", default-features = false, features = ["metadata"]}
[features]

View File

@ -520,11 +520,17 @@ fn main() {
let variant_name = format_ident!("{}", v.name);
// temporary hack to restrict the scope of the implementation until clock names can be stabilized
let clock_name = format_ident!("mux_{}", v.name.to_ascii_lowercase());
let clock_name = format_ident!("{}", v.name.to_ascii_lowercase());
if v.name.starts_with("AHB") || v.name.starts_with("APB") {
quote! {
#enum_name::#variant_name => unsafe { crate::rcc::get_freqs().#clock_name },
}
} else {
quote! {
#enum_name::#variant_name => unsafe { crate::rcc::get_freqs().#clock_name.unwrap() },
}
}
})
.collect();

View File

@ -541,61 +541,55 @@ pub(crate) unsafe fn init(config: Config) {
apb3,
#[cfg(stm32h7)]
apb4,
#[cfg(stm32h5)]
apb4: Hertz(1),
apb1_tim,
apb2_tim,
adc,
rtc,
#[cfg(stm32h5)]
mux_apb1: Some(apb1),
hsi: None,
#[cfg(stm32h5)]
mux_apb2: Some(apb2),
hsi48: None,
#[cfg(stm32h5)]
mux_apb3: Some(apb3),
lsi: None,
#[cfg(stm32h5)]
mux_apb4: None,
csi: None,
#[cfg(stm32h5)]
mux_rcc_hclk4: None,
lse: None,
#[cfg(stm32h5)]
hse: None,
#[cfg(stm32h5)]
mux_pll2_q: None,
pll1_q: pll1.q,
#[cfg(stm32h5)]
mux_pll3_q: None,
pll2_q: pll2.q,
#[cfg(stm32h5)]
mux_hsi: None,
pll2_p: pll2.p,
#[cfg(stm32h5)]
mux_csi: None,
#[cfg(stm32h5)]
mux_lse: None,
#[cfg(stm32h5)]
mux_pll1_q: pll1.q,
#[cfg(stm32h5)]
mux_pll2_p: pll2.p,
pll2_r: pll2.r,
#[cfg(rcc_h5)]
mux_pll3_p: pll3.p,
#[cfg(stm32h5)]
mux_audioclk: None,
#[cfg(stm32h5)]
mux_per: None,
pll3_p: pll3.p,
#[cfg(rcc_h5)]
mux_pll3_r: pll3.r,
#[cfg(all(not(rcc_h5), stm32h5))]
mux_pll3_r: None,
pll3_q: pll3.q,
#[cfg(rcc_h5)]
pll3_r: pll3.r,
#[cfg(stm32h5)]
mux_pll3_1: None,
#[cfg(stm32h5)]
mux_hsi48_ker: None,
#[cfg(stm32h5)]
mux_lsi: None,
#[cfg(stm32h5)]
mux_pll2_r: pll2.r,
#[cfg(stm32h5)]
mux_hse: hse,
pll3_1: None,
#[cfg(rcc_h50)]
pll3_p: None,
#[cfg(rcc_h50)]
pll3_q: None,
#[cfg(rcc_h50)]
pll3_r: None,
#[cfg(stm32h5)]
mux_hsi48: None,
audioclk: None,
#[cfg(stm32h5)]
per: None,
});
}

View File

@ -56,7 +56,7 @@ pub struct Clocks {
pub apb2_tim: Hertz,
#[cfg(any(rcc_wl5, rcc_wle, rcc_h5, rcc_h50, rcc_h7, rcc_h7rm0433, rcc_h7ab, rcc_u5))]
pub apb3: Hertz,
#[cfg(any(rcc_h7, rcc_h7rm0433, rcc_h7ab))]
#[cfg(any(rcc_h7, rcc_h7rm0433, rcc_h7ab, stm32h5))]
pub apb4: Hertz,
#[cfg(any(rcc_wba))]
pub apb7: Hertz,
@ -136,54 +136,40 @@ pub struct Clocks {
pub rtc: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_apb1: Option<Hertz>,
pub hsi: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_apb2: Option<Hertz>,
pub hsi48: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_apb3: Option<Hertz>,
pub lsi: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_apb4: Option<Hertz>,
pub csi: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_rcc_hclk4: Option<Hertz>,
pub lse: Option<Hertz>,
#[cfg(stm32h5)]
pub hse: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_pll2_q: Option<Hertz>,
pub pll1_q: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_pll3_q: Option<Hertz>,
pub pll2_q: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_hsi: Option<Hertz>,
pub pll2_p: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_csi: Option<Hertz>,
pub pll2_r: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_lse: Option<Hertz>,
pub pll3_p: Option<Hertz>,
#[cfg(stm32h5)]
pub pll3_q: Option<Hertz>,
#[cfg(stm32h5)]
pub pll3_r: Option<Hertz>,
#[cfg(stm32h5)]
pub pll3_1: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_pll1_q: Option<Hertz>,
pub audioclk: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_pll2_p: Option<Hertz>,
#[cfg(rcc_h5)]
pub mux_pll3_p: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_audioclk: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_per: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_pll3_r: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_pll3_1: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_hsi48_ker: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_lsi: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_pll2_r: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_hse: Option<Hertz>,
#[cfg(stm32h5)]
pub mux_hsi48: Option<Hertz>,
pub per: Option<Hertz>,
}
#[cfg(feature = "low-power")]