use serde::Deserialize; #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct Chip { pub name: String, pub family: String, pub line: String, pub cores: Vec, pub memory: Vec, pub packages: Vec, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct MemoryRegion { pub name: String, pub kind: MemoryRegionKind, pub address: u32, pub size: u32, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub enum MemoryRegionKind { #[serde(rename = "flash")] Flash, #[serde(rename = "ram")] Ram, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct Core { pub name: String, pub peripherals: Vec, pub interrupts: Vec, pub dma_channels: Vec, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct Interrupt { pub name: String, pub number: u32, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct Package { pub name: String, pub package: String, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct Peripheral { pub name: String, pub address: u64, #[serde(default)] pub registers: Option, #[serde(default)] pub rcc: Option, #[serde(default)] pub pins: Vec, #[serde(default)] pub dma_channels: Vec, #[serde(default)] pub interrupts: Vec, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct PeripheralInterrupt { pub signal: String, pub interrupt: String, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct PeripheralRcc { pub clock: String, #[serde(default)] pub enable: Option, #[serde(default)] pub reset: Option, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct PeripheralRccRegister { pub register: String, pub field: String, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct PeripheralPin { pub pin: String, pub signal: String, pub af: Option, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] pub struct DmaChannel { pub name: String, pub dma: String, pub channel: u32, pub dmamux: Option, pub dmamux_channel: Option, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Hash)] pub struct PeripheralDmaChannel { pub signal: String, pub channel: Option, pub dmamux: Option, pub dma: Option, pub request: Option, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Hash)] pub struct PeripheralRegisters { pub kind: String, pub version: String, pub block: String, }