1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
use serde::Deserialize;
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
pub struct Chip {
pub name: String,
pub family: String,
pub line: String,
pub cores: Vec<Core>,
pub memory: Vec<MemoryRegion>,
pub packages: Vec<Package>,
}
#[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<Peripheral>,
pub interrupts: Vec<Interrupt>,
pub dma_channels: Vec<DmaChannel>,
}
#[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<PeripheralRegisters>,
#[serde(default)]
pub rcc: Option<PeripheralRcc>,
#[serde(default)]
pub pins: Vec<PeripheralPin>,
#[serde(default)]
pub dma_channels: Vec<PeripheralDmaChannel>,
#[serde(default)]
pub interrupts: Vec<PeripheralInterrupt>,
}
#[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<PeripheralRccRegister>,
#[serde(default)]
pub reset: Option<PeripheralRccRegister>,
}
#[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<u8>,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
pub struct DmaChannel {
pub name: String,
pub dma: String,
pub channel: u32,
pub dmamux: Option<String>,
pub dmamux_channel: Option<u32>,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Hash)]
pub struct PeripheralDmaChannel {
pub signal: String,
pub channel: Option<String>,
pub dmamux: Option<String>,
pub request: Option<u32>,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Hash)]
pub struct PeripheralRegisters {
pub kind: String,
pub version: String,
pub block: String,
}
|