Skip to content

Commit fe17d87

Browse files
authored
WWDT: finalize generation (#10)
* WWDT: extend YAML transform config * WWDT: add code generation & cleanup - transofrm YAML config cleanup - add some helper write keys to the code generation - add wwwt to the perimap.rs & peripheral.rs
1 parent d546503 commit fe17d87

File tree

4 files changed

+477
-1
lines changed

4 files changed

+477
-1
lines changed

data/registers/wwdt_v1.yaml

Lines changed: 372 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,372 @@
1+
block/CPU_INT:
2+
items:
3+
- name: IIDX
4+
description: Interrupt index.
5+
byte_offset: 0
6+
access: Read
7+
fieldset: IIDX
8+
- name: IMASK
9+
description: Interrupt mask.
10+
byte_offset: 8
11+
fieldset: INT
12+
- name: RIS
13+
description: Raw interrupt status.
14+
byte_offset: 16
15+
access: Read
16+
fieldset: INT
17+
- name: MIS
18+
description: Masked interrupt status.
19+
byte_offset: 24
20+
access: Read
21+
fieldset: INT
22+
- name: ISET
23+
description: Interrupt set.
24+
byte_offset: 32
25+
access: Write
26+
fieldset: INT
27+
- name: ICLR
28+
description: Interrupt clear.
29+
byte_offset: 40
30+
access: Write
31+
fieldset: INT
32+
block/GPRCM:
33+
items:
34+
- name: PWREN
35+
description: Power enable.
36+
byte_offset: 0
37+
fieldset: PWREN
38+
- name: RSTCTL
39+
description: Reset Control.
40+
byte_offset: 4
41+
access: Write
42+
fieldset: RSTCTL
43+
- name: STAT
44+
description: Status Register.
45+
byte_offset: 20
46+
access: Read
47+
fieldset: STAT
48+
block/WWDT:
49+
description: WWDT.
50+
items:
51+
- name: GPRCM
52+
array:
53+
len: 1
54+
stride: 24
55+
byte_offset: 2048
56+
block: GPRCM
57+
- name: PDBGCTL
58+
description: Peripheral Debug Control.
59+
byte_offset: 4120
60+
fieldset: PDBGCTL
61+
- name: CPU_INT
62+
array:
63+
len: 1
64+
stride: 44
65+
byte_offset: 4128
66+
block: CPU_INT
67+
- name: EVT_MODE
68+
description: Event Mode.
69+
byte_offset: 4320
70+
fieldset: EVT_MODE
71+
- name: DESC
72+
description: Module Description.
73+
byte_offset: 4348
74+
access: Read
75+
fieldset: DESC
76+
- name: WWDTCTL0
77+
description: Window Watchdog Timer Control Register 0.
78+
byte_offset: 4352
79+
fieldset: WWDTCTL0
80+
- name: WWDTCTL1
81+
description: Window Watchdog Timer Control Register 0.
82+
byte_offset: 4356
83+
fieldset: WWDTCTL1
84+
- name: WWDTCNTRST
85+
description: Window Watchdog Timer Counter Reset Register.
86+
byte_offset: 4360
87+
fieldset: WWDTCNTRST
88+
- name: WWDTSTAT
89+
description: Window Watchdog Timer Status Register.
90+
byte_offset: 4364
91+
access: Read
92+
fieldset: WWDTSTAT
93+
fieldset/DESC:
94+
description: Module Description.
95+
fields:
96+
- name: MINREV
97+
description: Minor rev of the IP.
98+
bit_offset: 0
99+
bit_size: 4
100+
- name: MAJREV
101+
description: Major rev of the IP.
102+
bit_offset: 4
103+
bit_size: 4
104+
- name: INSTNUM
105+
description: Instance Number within the device. This will be a parameter to the RTL for modules that can have multiple instances.
106+
bit_offset: 8
107+
bit_size: 4
108+
- name: FEATUREVER
109+
description: Feature Set for the module *instance*.
110+
bit_offset: 12
111+
bit_size: 4
112+
- name: MODULEID
113+
description: Module identification contains a unique peripheral identification number. The assignments are maintained in a central database for all of the platform modules to ensure uniqueness.
114+
bit_offset: 16
115+
bit_size: 16
116+
fieldset/EVT_MODE:
117+
description: Event Mode.
118+
fields:
119+
- name: INT0_CFG
120+
description: Event line mode select for event corresponding to [IPSTANDARD.INT_EVENT][0].
121+
bit_offset: 0
122+
bit_size: 2
123+
enum: INT_CFG
124+
fieldset/IIDX:
125+
description: Interrupt index.
126+
fields:
127+
- name: STAT
128+
description: Module Interrupt Vector Value. This register provides the highest priority interrupt index. A read clears the corresponding interrupt flag in RIS and MISC.
129+
bit_offset: 0
130+
bit_size: 5
131+
enum: STAT
132+
fieldset/INT:
133+
description: Interrupt clear.
134+
fields:
135+
- name: INTTIM
136+
description: Interval Timer Interrupt.
137+
bit_offset: 0
138+
bit_size: 1
139+
fieldset/PDBGCTL:
140+
description: Peripheral Debug Control.
141+
fields:
142+
- name: FREE
143+
description: Free run control.
144+
bit_offset: 0
145+
bit_size: 1
146+
fieldset/PWREN:
147+
description: Power enable.
148+
fields:
149+
- name: ENABLE
150+
description: 'Enable the power Note: For safety devices the power cannot be disabled once enabled.'
151+
bit_offset: 0
152+
bit_size: 1
153+
- name: KEY
154+
description: KEY to allow Power State Change 26h = KEY to allow write access to this register
155+
bit_offset: 24
156+
bit_size: 8
157+
enum: PWREN_KEY
158+
fieldset/RSTCTL:
159+
description: Reset Control.
160+
fields:
161+
- name: RESETASSERT
162+
description: 'Assert reset to the peripheral Note: For safety devices a watchdog reset by software is not possible.'
163+
bit_offset: 0
164+
bit_size: 1
165+
- name: RESETSTKYCLR
166+
description: Clear [GPRCM.STAT.RESETSTKY].
167+
bit_offset: 1
168+
bit_size: 1
169+
- name: KEY
170+
description: Unlock key B1h = KEY to allow write access to this register
171+
bit_offset: 24
172+
bit_size: 8
173+
enum: RESET_KEY
174+
fieldset/STAT:
175+
description: Status Register.
176+
fields:
177+
- name: RESETSTKY
178+
description: This bit indicates, if the peripheral was reset, since this bit was cleared by RESETSTKYCLR in the RSTCTL register.
179+
bit_offset: 16
180+
bit_size: 1
181+
fieldset/WWDTCNTRST:
182+
description: Window Watchdog Timer Counter Reset Register.
183+
fields:
184+
- name: RESTART
185+
description: Window Watchdog Timer Counter Restart Writing 00A7h to this register restarts the WWDT Counter.
186+
bit_offset: 0
187+
bit_size: 32
188+
enum: WWDTCNTRST_RESTART
189+
fieldset/WWDTCTL0:
190+
description: Window Watchdog Timer Control Register 0.
191+
fields:
192+
- name: CLKDIV
193+
description: Module Clock Divider, Divide the clock source by CLKDIV+1. Divider values from /1 to /8 are possible. The clock divider is currently 4 bits. Bit 4 has no effect and should always be written with 0.
194+
bit_offset: 0
195+
bit_size: 3
196+
- name: PER
197+
description: Timer Period of the WWDT. These bits select the total watchdog timer count.
198+
bit_offset: 4
199+
bit_size: 3
200+
enum: PER
201+
- name: WINDOW0
202+
description: Closed window period in percentage of the timer interval. WWDTCTL1.WINSEL determines the active window setting (WWDTCTL0.WINDOW0 or WWDTCTL0.WINDOW1).
203+
bit_offset: 8
204+
bit_size: 3
205+
enum: WINDOW
206+
- name: WINDOW1
207+
description: Closed window period in percentage of the timer interval. WWDTCTL1.WINSEL determines the active window setting (WWDTCTL0.WINDOW0 or WWDTCTL0.WINDOW1).
208+
bit_offset: 12
209+
bit_size: 3
210+
enum: WINDOW
211+
- name: MODE
212+
description: Window Watchdog Timer Mode.
213+
bit_offset: 16
214+
bit_size: 1
215+
enum: MODE
216+
- name: STISM
217+
description: 'Stop In Sleep Mode. The functionality of this bit requires that POLICY.HWCEN = 0. If POLICY.HWCEN = 1 the WWDT resets during sleep and needs re-configuration. Note: This bit has no effect for the global Window Watchdog as Sleep Mode is not supported.'
218+
bit_offset: 17
219+
bit_size: 1
220+
enum: STISM
221+
- name: KEY
222+
description: KEY to allow write access to WWDTCTL0 = C9h.
223+
bit_offset: 24
224+
bit_size: 8
225+
enum: WWDTCTL0_KEY
226+
fieldset/WWDTCTL1:
227+
description: Window Watchdog Timer Control Register 0.
228+
fields:
229+
- name: WINSEL
230+
description: Close Window Select.
231+
bit_offset: 0
232+
bit_size: 1
233+
enum: WINSEL
234+
- name: KEY
235+
description: KEY to allow write access to WWDTCTL1 = BEh.
236+
bit_offset: 24
237+
bit_size: 8
238+
enum: WWDTCTL1_KEY
239+
fieldset/WWDTSTAT:
240+
description: Window Watchdog Timer Status Register.
241+
fields:
242+
- name: RUN
243+
description: Watchdog running status flag.
244+
bit_offset: 0
245+
bit_size: 1
246+
enum/INT_CFG:
247+
bit_size: 2
248+
variants:
249+
- name: DISABLE
250+
description: The interrupt or event line is disabled.
251+
value: 0
252+
- name: SOFTWARE
253+
description: The interrupt or event line is in software mode. Software must clear the RIS.
254+
value: 1
255+
- name: HARDWARE
256+
description: The interrupt or event line is in hardware mode. The hardware (another module) clears automatically the associated RIS flag.
257+
value: 2
258+
enum/MODE:
259+
bit_size: 1
260+
variants:
261+
- name: WINDOW
262+
description: 'Window Watchdog Timer Mode. The WWDT will generate a error signal to the ESM when following conditions occur: - Timer Expiration (Timeout) - Reset WWDT during the active window closed period - Keyword violation.'
263+
value: 0
264+
- name: INTERVAL
265+
description: Interval Timer Mode. The WWDT acts as an interval timer. It generates an interrupt on timeout.
266+
value: 1
267+
enum/PER:
268+
bit_size: 3
269+
variants:
270+
- name: EN_25
271+
description: Total timer count is 2^25.
272+
value: 0
273+
- name: EN_21
274+
description: Total timer count is 2^21.
275+
value: 1
276+
- name: EN_18
277+
description: Total timer count is 2^18.
278+
value: 2
279+
- name: EN_15
280+
description: Total timer count is 2^15.
281+
value: 3
282+
- name: EN_12
283+
description: Total timer count is 2^12 (default).
284+
value: 4
285+
- name: EN_10
286+
description: Total timer count is 2^10.
287+
value: 5
288+
- name: EN_8
289+
description: Total timer count is 2^8.
290+
value: 6
291+
- name: EN_6
292+
description: Total timer count is 2^6.
293+
value: 7
294+
enum/PWREN_KEY:
295+
bit_size: 8
296+
variants:
297+
- name: KEY
298+
value: 38
299+
enum/RESET_KEY:
300+
bit_size: 8
301+
variants:
302+
- name: KEY
303+
value: 177
304+
enum/STAT:
305+
bit_size: 5
306+
variants:
307+
- name: NO_INTR
308+
description: No interrupt pending.
309+
value: 0
310+
- name: INTTIM
311+
description: 'Interval Timer Interrupt; Interrupt Flag: INTTIM; Interrupt Priority: Highest.'
312+
value: 1
313+
enum/STISM:
314+
bit_size: 1
315+
variants:
316+
- name: CONT
317+
description: The WWDT continues to function in Sleep mode.
318+
value: 0
319+
- name: STOP
320+
description: The WWDT stops in Sleep mode and resumes where it was stopped after wakeup.
321+
value: 1
322+
enum/WINDOW:
323+
bit_size: 3
324+
variants:
325+
- name: SIZE_0
326+
description: 0% (No closed Window).
327+
value: 0
328+
- name: SIZE_12
329+
description: 12.50% of the total timer period is closed window.
330+
value: 1
331+
- name: SIZE_18
332+
description: 18.75% of the total timer period is closed window.
333+
value: 2
334+
- name: SIZE_25
335+
description: 25% of the total timer period is closed window.
336+
value: 3
337+
- name: SIZE_50
338+
description: 50% of the total timer period is closed window.
339+
value: 4
340+
- name: SIZE_75
341+
description: 75% of the total timer period is closed window.
342+
value: 5
343+
- name: SIZE_81
344+
description: 81.25% of the total timer period is closed window.
345+
value: 6
346+
- name: SIZE_87
347+
description: 87.50% of the total timer period is closed window.
348+
value: 7
349+
enum/WINSEL:
350+
bit_size: 1
351+
variants:
352+
- name: WIN0
353+
description: In window mode field WINDOW0 of WDDTCTL0 defines the closed window size.
354+
value: 0
355+
- name: WIN1
356+
description: In window mode field WINDOW1 of WDDTCTL0 defines the closed window size.
357+
value: 1
358+
enum/WWDTCNTRST_RESTART:
359+
bit_size: 32
360+
variants:
361+
- name: RESTART
362+
value: 167
363+
enum/WWDTCTL0_KEY:
364+
bit_size: 8
365+
variants:
366+
- name: KEY
367+
value: 201
368+
enum/WWDTCTL1_KEY:
369+
bit_size: 8
370+
variants:
371+
- name: KEY
372+
value: 190

mspm0-data-gen/src/perimap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub static PERIMAP: RegexMap<&str> = RegexMap::new(&[
1010
(".*:iomux", "v1"),
1111
(".*:tim", "v1"),
1212
(".*:adc", "v1"),
13+
(".*:wwdt", "v1"),
1314
("mspm0c110x:sysctl", "c110x"),
1415
("msps003fx:sysctl", "c110x"),
1516
("mspm0g..0x:sysctl", "g350x_g310x_g150x_g110x"),

mspm0-metapac-gen/src/peripheral.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const GENERATE_PERIPHERALS: &[PeripheralType] = &[
1818
PeripheralType::Sysctl,
1919
PeripheralType::Tim,
2020
PeripheralType::Uart,
21+
PeripheralType::Wwdt,
2122
];
2223

2324
pub fn generate(chip: &Chip, all_versions: &mut BTreeMap<String, BTreeSet<String>>) -> TokenStream {

0 commit comments

Comments
 (0)