diff --git a/data/registers/rcc_l4.yaml b/data/registers/rcc_l4.yaml index 3a674af..0d94017 100644 --- a/data/registers/rcc_l4.yaml +++ b/data/registers/rcc_l4.yaml @@ -2267,7 +2267,7 @@ enum/SW: - name: HSE description: HSE selected as system clock value: 2 - - name: PLL1_P + - name: PLL1_R description: PLL selected as system clock value: 3 enum/SWPMI1SEL: diff --git a/stm32-data-gen/src/rcc.rs b/stm32-data-gen/src/rcc.rs index 749f5cb..845316a 100644 --- a/stm32-data-gen/src/rcc.rs +++ b/stm32-data-gen/src/rcc.rs @@ -1,3 +1,4 @@ +use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use anyhow::{anyhow, Ok}; @@ -256,7 +257,24 @@ impl PeripheralToClock { mux, }; - family_clocks.insert(peri.to_string(), res); + match family_clocks.entry(peri.to_string()) { + Entry::Vacant(e) => { + e.insert(res); + } + Entry::Occupied(mut e) => { + if (e.get().clock != "pclk1" || e.get().clock != "hclk1") + && (res.clock == "pclk1" || res.clock == "hclk1") + { + e.insert(res); + } else if !(e.get().clock == "pclk1" || e.get().clock == "hclk1") { + return Err(anyhow!( + "rcc: duplicate entry for peri {} for rcc_{}", + peri.to_string(), + rcc_name + )); + } + } + } } } }