rcc: remove mux_prefix from clocks

This commit is contained in:
xoviat 2023-10-14 12:51:45 -05:00
parent f7c0ec66d2
commit 824556c9c8
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" sdio-host = "0.5.0"
embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true }
critical-section = "1.1" 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" vcell = "0.1.3"
bxcan = "0.7.0" bxcan = "0.7.0"
nb = "1.0.0" nb = "1.0.0"
@ -76,7 +76,7 @@ critical-section = { version = "1.1", features = ["std"] }
[build-dependencies] [build-dependencies]
proc-macro2 = "1.0.36" proc-macro2 = "1.0.36"
quote = "1.0.15" 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] [features]

View File

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

View File

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

View File

@ -56,7 +56,7 @@ pub struct Clocks {
pub apb2_tim: Hertz, pub apb2_tim: Hertz,
#[cfg(any(rcc_wl5, rcc_wle, rcc_h5, rcc_h50, rcc_h7, rcc_h7rm0433, rcc_h7ab, rcc_u5))] #[cfg(any(rcc_wl5, rcc_wle, rcc_h5, rcc_h50, rcc_h7, rcc_h7rm0433, rcc_h7ab, rcc_u5))]
pub apb3: Hertz, pub apb3: Hertz,
#[cfg(any(rcc_h7, rcc_h7rm0433, rcc_h7ab))] #[cfg(any(rcc_h7, rcc_h7rm0433, rcc_h7ab, stm32h5))]
pub apb4: Hertz, pub apb4: Hertz,
#[cfg(any(rcc_wba))] #[cfg(any(rcc_wba))]
pub apb7: Hertz, pub apb7: Hertz,
@ -136,54 +136,40 @@ pub struct Clocks {
pub rtc: Option<Hertz>, pub rtc: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_apb1: Option<Hertz>, pub hsi: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_apb2: Option<Hertz>, pub hsi48: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_apb3: Option<Hertz>, pub lsi: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_apb4: Option<Hertz>, pub csi: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_rcc_hclk4: Option<Hertz>, pub lse: Option<Hertz>,
#[cfg(stm32h5)]
pub hse: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_pll2_q: Option<Hertz>, pub pll1_q: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_pll3_q: Option<Hertz>, pub pll2_q: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_hsi: Option<Hertz>, pub pll2_p: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_csi: Option<Hertz>, pub pll2_r: Option<Hertz>,
#[cfg(stm32h5)] #[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)] #[cfg(stm32h5)]
pub mux_pll1_q: Option<Hertz>, pub audioclk: Option<Hertz>,
#[cfg(stm32h5)] #[cfg(stm32h5)]
pub mux_pll2_p: Option<Hertz>, pub per: 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>,
} }
#[cfg(feature = "low-power")] #[cfg(feature = "low-power")]