add man impl. pin signals

This commit is contained in:
xoviat 2023-10-01 13:28:31 -05:00
parent 8ee2862086
commit 4a893c37da
3 changed files with 25 additions and 4 deletions

View File

@ -6,3 +6,15 @@ peripherals:
kind: vrefintcal kind: vrefintcal
version: v1 version: v1
block: VREFINTCAL block: VREFINTCAL
- name: OPAMP2
pins:
- pin: PA5
signal: VM1
- pin: PC5
signal: VM0
- pin: PA7
signal: VP0
- pin: PD14
signal: VP1
- pin: PB0
signal: VP2

View File

@ -927,7 +927,7 @@ fn process_core(
pins.sort(); pins.sort();
pins.dedup(); pins.dedup();
} }
let mut peripherals = Vec::new(); let mut peripherals = HashMap::new();
for (pname, pkind) in peri_kinds { for (pname, pkind) in peri_kinds {
// We cannot add this to FAKE peripherals because we need the pins // We cannot add this to FAKE peripherals because we need the pins
if pname.starts_with("I2S") { if pname.starts_with("I2S") {
@ -1045,7 +1045,7 @@ fn process_core(
p.interrupts = Some(irqs); p.interrupts = Some(irqs);
} }
peripherals.push(p); peripherals.insert(p.name.clone(), p);
} }
if let Ok(extra_f) = std::fs::read(format!("data/extra/family/{}.yaml", group.family.as_ref().unwrap())) { if let Ok(extra_f) = std::fs::read(format!("data/extra/family/{}.yaml", group.family.as_ref().unwrap())) {
#[derive(serde::Deserialize)] #[derive(serde::Deserialize)]
@ -1054,10 +1054,18 @@ fn process_core(
} }
let extra: Extra = serde_yaml::from_slice(&extra_f).unwrap(); let extra: Extra = serde_yaml::from_slice(&extra_f).unwrap();
for p in extra.peripherals { for mut p in extra.peripherals {
peripherals.push(p); if let Some(peripheral) = peripherals.get_mut(&p.name) {
// Modify the generated peripheral
peripheral.pins.append(&mut p.pins);
} else if p.address != 0 {
// Only insert the peripheral if the address is not the default
peripherals.insert(p.name.clone(), p);
} }
} }
}
let mut peripherals: Vec<_> = peripherals.into_values().collect();
peripherals.sort_by_key(|x| x.name.clone()); peripherals.sort_by_key(|x| x.name.clone());
let have_peris: HashSet<_> = peripherals.iter_mut().map(|p| p.name.clone()).collect(); let have_peris: HashSet<_> = peripherals.iter_mut().map(|p| p.name.clone()).collect();
// Collect DMA versions in the chip // Collect DMA versions in the chip

View File

@ -84,6 +84,7 @@ pub mod chip {
#[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)] #[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
pub struct Peripheral { pub struct Peripheral {
pub name: String, pub name: String,
#[serde(default)]
pub address: u32, pub address: u32,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub registers: Option<peripheral::Registers>, pub registers: Option<peripheral::Registers>,