Merge pull request #270 from xoviat/periph-pins

add man impl. pin signals
This commit is contained in:
xoviat 2023-10-01 20:30:15 +00:00 committed by GitHub
commit dfb25f393c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 5 deletions

View File

@ -6,3 +6,15 @@ peripherals:
kind: vrefintcal
version: v1
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.dedup();
}
let mut peripherals = Vec::new();
let mut peripherals = HashMap::new();
for (pname, pkind) in peri_kinds {
// We cannot add this to FAKE peripherals because we need the pins
if pname.starts_with("I2S") {
@ -1045,7 +1045,7 @@ fn process_core(
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())) {
#[derive(serde::Deserialize)]
@ -1054,12 +1054,20 @@ fn process_core(
}
let extra: Extra = serde_yaml::from_slice(&extra_f).unwrap();
for p in extra.peripherals {
peripherals.push(p);
for mut p in extra.peripherals {
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 have_peris: HashSet<_> = peripherals.keys().cloned().collect();
let mut peripherals: Vec<_> = peripherals.into_values().collect();
peripherals.sort_by_key(|x| x.name.clone());
let have_peris: HashSet<_> = peripherals.iter_mut().map(|p| p.name.clone()).collect();
// Collect DMA versions in the chip
let mut chip_dmas: Vec<_> = group
.ips

View File

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