earlgrey/registers/top_earlgrey.rs
1// Licensed under the Apache License, Version 2.0 or the MIT License.
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3// Copyright lowRISC contributors 2023.
4
5// Built for Earlgrey-M2.5.1-RC1-493-gedf5e35f5d
6// https://github.com/lowRISC/opentitan/tree/edf5e35f5d50a5377641c90a315109a351de7635
7// Tree status: clean
8// Build date: 2023-10-18T10:18:57.529279
9
10// This file was generated automatically.
11// Please do not modify content of this file directly.
12// File generated by using template: "toplevel.rs.tpl"
13// To regenerate this file follow OpenTitan topgen documentations.
14
15#![allow(dead_code)]
16
17//! This file contains enums and consts for use within the Rust codebase.
18//!
19//! These definitions are for information that depends on the top-specific chip
20//! configuration, which includes:
21//! - Device Memory Information (for Peripherals and Memory)
22//! - PLIC Interrupt ID Names and Source Mappings
23//! - Alert ID Names and Source Mappings
24//! - Pinmux Pin/Select Names
25//! - Power Manager Wakeups
26
27/// Peripheral base address for uart0 in top earlgrey.
28///
29/// This should be used with #mmio_region_from_addr to access the memory-mapped
30/// registers associated with the peripheral (usually via a DIF).
31pub const UART0_BASE_ADDR: usize = 0x40000000;
32
33/// Peripheral size for uart0 in top earlgrey.
34///
35/// This is the size (in bytes) of the peripheral's reserved memory area. All
36/// memory-mapped registers associated with this peripheral should have an
37/// address between #UART0_BASE_ADDR and
38/// `UART0_BASE_ADDR + UART0_SIZE_BYTES`.
39pub const UART0_SIZE_BYTES: usize = 0x40;
40
41/// Peripheral base address for uart1 in top earlgrey.
42///
43/// This should be used with #mmio_region_from_addr to access the memory-mapped
44/// registers associated with the peripheral (usually via a DIF).
45pub const UART1_BASE_ADDR: usize = 0x40010000;
46
47/// Peripheral size for uart1 in top earlgrey.
48///
49/// This is the size (in bytes) of the peripheral's reserved memory area. All
50/// memory-mapped registers associated with this peripheral should have an
51/// address between #UART1_BASE_ADDR and
52/// `UART1_BASE_ADDR + UART1_SIZE_BYTES`.
53pub const UART1_SIZE_BYTES: usize = 0x40;
54
55/// Peripheral base address for uart2 in top earlgrey.
56///
57/// This should be used with #mmio_region_from_addr to access the memory-mapped
58/// registers associated with the peripheral (usually via a DIF).
59pub const UART2_BASE_ADDR: usize = 0x40020000;
60
61/// Peripheral size for uart2 in top earlgrey.
62///
63/// This is the size (in bytes) of the peripheral's reserved memory area. All
64/// memory-mapped registers associated with this peripheral should have an
65/// address between #UART2_BASE_ADDR and
66/// `UART2_BASE_ADDR + UART2_SIZE_BYTES`.
67pub const UART2_SIZE_BYTES: usize = 0x40;
68
69/// Peripheral base address for uart3 in top earlgrey.
70///
71/// This should be used with #mmio_region_from_addr to access the memory-mapped
72/// registers associated with the peripheral (usually via a DIF).
73pub const UART3_BASE_ADDR: usize = 0x40030000;
74
75/// Peripheral size for uart3 in top earlgrey.
76///
77/// This is the size (in bytes) of the peripheral's reserved memory area. All
78/// memory-mapped registers associated with this peripheral should have an
79/// address between #UART3_BASE_ADDR and
80/// `UART3_BASE_ADDR + UART3_SIZE_BYTES`.
81pub const UART3_SIZE_BYTES: usize = 0x40;
82
83/// Peripheral base address for gpio in top earlgrey.
84///
85/// This should be used with #mmio_region_from_addr to access the memory-mapped
86/// registers associated with the peripheral (usually via a DIF).
87pub const GPIO_BASE_ADDR: usize = 0x40040000;
88
89/// Peripheral size for gpio in top earlgrey.
90///
91/// This is the size (in bytes) of the peripheral's reserved memory area. All
92/// memory-mapped registers associated with this peripheral should have an
93/// address between #GPIO_BASE_ADDR and
94/// `GPIO_BASE_ADDR + GPIO_SIZE_BYTES`.
95pub const GPIO_SIZE_BYTES: usize = 0x40;
96
97/// Peripheral base address for spi_device in top earlgrey.
98///
99/// This should be used with #mmio_region_from_addr to access the memory-mapped
100/// registers associated with the peripheral (usually via a DIF).
101pub const SPI_DEVICE_BASE_ADDR: usize = 0x40050000;
102
103/// Peripheral size for spi_device in top earlgrey.
104///
105/// This is the size (in bytes) of the peripheral's reserved memory area. All
106/// memory-mapped registers associated with this peripheral should have an
107/// address between #SPI_DEVICE_BASE_ADDR and
108/// `SPI_DEVICE_BASE_ADDR + SPI_DEVICE_SIZE_BYTES`.
109pub const SPI_DEVICE_SIZE_BYTES: usize = 0x2000;
110
111/// Peripheral base address for i2c0 in top earlgrey.
112///
113/// This should be used with #mmio_region_from_addr to access the memory-mapped
114/// registers associated with the peripheral (usually via a DIF).
115pub const I2C0_BASE_ADDR: usize = 0x40080000;
116
117/// Peripheral size for i2c0 in top earlgrey.
118///
119/// This is the size (in bytes) of the peripheral's reserved memory area. All
120/// memory-mapped registers associated with this peripheral should have an
121/// address between #I2C0_BASE_ADDR and
122/// `I2C0_BASE_ADDR + I2C0_SIZE_BYTES`.
123pub const I2C0_SIZE_BYTES: usize = 0x80;
124
125/// Peripheral base address for i2c1 in top earlgrey.
126///
127/// This should be used with #mmio_region_from_addr to access the memory-mapped
128/// registers associated with the peripheral (usually via a DIF).
129pub const I2C1_BASE_ADDR: usize = 0x40090000;
130
131/// Peripheral size for i2c1 in top earlgrey.
132///
133/// This is the size (in bytes) of the peripheral's reserved memory area. All
134/// memory-mapped registers associated with this peripheral should have an
135/// address between #I2C1_BASE_ADDR and
136/// `I2C1_BASE_ADDR + I2C1_SIZE_BYTES`.
137pub const I2C1_SIZE_BYTES: usize = 0x80;
138
139/// Peripheral base address for i2c2 in top earlgrey.
140///
141/// This should be used with #mmio_region_from_addr to access the memory-mapped
142/// registers associated with the peripheral (usually via a DIF).
143pub const I2C2_BASE_ADDR: usize = 0x400A0000;
144
145/// Peripheral size for i2c2 in top earlgrey.
146///
147/// This is the size (in bytes) of the peripheral's reserved memory area. All
148/// memory-mapped registers associated with this peripheral should have an
149/// address between #I2C2_BASE_ADDR and
150/// `I2C2_BASE_ADDR + I2C2_SIZE_BYTES`.
151pub const I2C2_SIZE_BYTES: usize = 0x80;
152
153/// Peripheral base address for pattgen in top earlgrey.
154///
155/// This should be used with #mmio_region_from_addr to access the memory-mapped
156/// registers associated with the peripheral (usually via a DIF).
157pub const PATTGEN_BASE_ADDR: usize = 0x400E0000;
158
159/// Peripheral size for pattgen in top earlgrey.
160///
161/// This is the size (in bytes) of the peripheral's reserved memory area. All
162/// memory-mapped registers associated with this peripheral should have an
163/// address between #PATTGEN_BASE_ADDR and
164/// `PATTGEN_BASE_ADDR + PATTGEN_SIZE_BYTES`.
165pub const PATTGEN_SIZE_BYTES: usize = 0x40;
166
167/// Peripheral base address for rv_timer in top earlgrey.
168///
169/// This should be used with #mmio_region_from_addr to access the memory-mapped
170/// registers associated with the peripheral (usually via a DIF).
171pub const RV_TIMER_BASE_ADDR: usize = 0x40100000;
172
173/// Peripheral size for rv_timer in top earlgrey.
174///
175/// This is the size (in bytes) of the peripheral's reserved memory area. All
176/// memory-mapped registers associated with this peripheral should have an
177/// address between #RV_TIMER_BASE_ADDR and
178/// `RV_TIMER_BASE_ADDR + RV_TIMER_SIZE_BYTES`.
179pub const RV_TIMER_SIZE_BYTES: usize = 0x200;
180
181/// Peripheral base address for core device on otp_ctrl in top earlgrey.
182///
183/// This should be used with #mmio_region_from_addr to access the memory-mapped
184/// registers associated with the peripheral (usually via a DIF).
185pub const OTP_CTRL_CORE_BASE_ADDR: usize = 0x40130000;
186
187/// Peripheral size for core device on otp_ctrl in top earlgrey.
188///
189/// This is the size (in bytes) of the peripheral's reserved memory area. All
190/// memory-mapped registers associated with this peripheral should have an
191/// address between #OTP_CTRL_CORE_BASE_ADDR and
192/// `OTP_CTRL_CORE_BASE_ADDR + OTP_CTRL_CORE_SIZE_BYTES`.
193pub const OTP_CTRL_CORE_SIZE_BYTES: usize = 0x2000;
194
195/// Peripheral base address for prim device on otp_ctrl in top earlgrey.
196///
197/// This should be used with #mmio_region_from_addr to access the memory-mapped
198/// registers associated with the peripheral (usually via a DIF).
199pub const OTP_CTRL_PRIM_BASE_ADDR: usize = 0x40132000;
200
201/// Peripheral size for prim device on otp_ctrl in top earlgrey.
202///
203/// This is the size (in bytes) of the peripheral's reserved memory area. All
204/// memory-mapped registers associated with this peripheral should have an
205/// address between #OTP_CTRL_PRIM_BASE_ADDR and
206/// `OTP_CTRL_PRIM_BASE_ADDR + OTP_CTRL_PRIM_SIZE_BYTES`.
207pub const OTP_CTRL_PRIM_SIZE_BYTES: usize = 0x20;
208
209/// Peripheral base address for lc_ctrl in top earlgrey.
210///
211/// This should be used with #mmio_region_from_addr to access the memory-mapped
212/// registers associated with the peripheral (usually via a DIF).
213pub const LC_CTRL_BASE_ADDR: usize = 0x40140000;
214
215/// Peripheral size for lc_ctrl in top earlgrey.
216///
217/// This is the size (in bytes) of the peripheral's reserved memory area. All
218/// memory-mapped registers associated with this peripheral should have an
219/// address between #LC_CTRL_BASE_ADDR and
220/// `LC_CTRL_BASE_ADDR + LC_CTRL_SIZE_BYTES`.
221pub const LC_CTRL_SIZE_BYTES: usize = 0x100;
222
223/// Peripheral base address for alert_handler in top earlgrey.
224///
225/// This should be used with #mmio_region_from_addr to access the memory-mapped
226/// registers associated with the peripheral (usually via a DIF).
227pub const ALERT_HANDLER_BASE_ADDR: usize = 0x40150000;
228
229/// Peripheral size for alert_handler in top earlgrey.
230///
231/// This is the size (in bytes) of the peripheral's reserved memory area. All
232/// memory-mapped registers associated with this peripheral should have an
233/// address between #ALERT_HANDLER_BASE_ADDR and
234/// `ALERT_HANDLER_BASE_ADDR + ALERT_HANDLER_SIZE_BYTES`.
235pub const ALERT_HANDLER_SIZE_BYTES: usize = 0x800;
236
237/// Peripheral base address for spi_host0 in top earlgrey.
238///
239/// This should be used with #mmio_region_from_addr to access the memory-mapped
240/// registers associated with the peripheral (usually via a DIF).
241pub const SPI_HOST0_BASE_ADDR: usize = 0x40300000;
242
243/// Peripheral size for spi_host0 in top earlgrey.
244///
245/// This is the size (in bytes) of the peripheral's reserved memory area. All
246/// memory-mapped registers associated with this peripheral should have an
247/// address between #SPI_HOST0_BASE_ADDR and
248/// `SPI_HOST0_BASE_ADDR + SPI_HOST0_SIZE_BYTES`.
249pub const SPI_HOST0_SIZE_BYTES: usize = 0x40;
250
251/// Peripheral base address for spi_host1 in top earlgrey.
252///
253/// This should be used with #mmio_region_from_addr to access the memory-mapped
254/// registers associated with the peripheral (usually via a DIF).
255pub const SPI_HOST1_BASE_ADDR: usize = 0x40310000;
256
257/// Peripheral size for spi_host1 in top earlgrey.
258///
259/// This is the size (in bytes) of the peripheral's reserved memory area. All
260/// memory-mapped registers associated with this peripheral should have an
261/// address between #SPI_HOST1_BASE_ADDR and
262/// `SPI_HOST1_BASE_ADDR + SPI_HOST1_SIZE_BYTES`.
263pub const SPI_HOST1_SIZE_BYTES: usize = 0x40;
264
265/// Peripheral base address for usbdev in top earlgrey.
266///
267/// This should be used with #mmio_region_from_addr to access the memory-mapped
268/// registers associated with the peripheral (usually via a DIF).
269pub const USBDEV_BASE_ADDR: usize = 0x40320000;
270
271/// Peripheral size for usbdev in top earlgrey.
272///
273/// This is the size (in bytes) of the peripheral's reserved memory area. All
274/// memory-mapped registers associated with this peripheral should have an
275/// address between #USBDEV_BASE_ADDR and
276/// `USBDEV_BASE_ADDR + USBDEV_SIZE_BYTES`.
277pub const USBDEV_SIZE_BYTES: usize = 0x1000;
278
279/// Peripheral base address for pwrmgr_aon in top earlgrey.
280///
281/// This should be used with #mmio_region_from_addr to access the memory-mapped
282/// registers associated with the peripheral (usually via a DIF).
283pub const PWRMGR_AON_BASE_ADDR: usize = 0x40400000;
284
285/// Peripheral size for pwrmgr_aon in top earlgrey.
286///
287/// This is the size (in bytes) of the peripheral's reserved memory area. All
288/// memory-mapped registers associated with this peripheral should have an
289/// address between #PWRMGR_AON_BASE_ADDR and
290/// `PWRMGR_AON_BASE_ADDR + PWRMGR_AON_SIZE_BYTES`.
291pub const PWRMGR_AON_SIZE_BYTES: usize = 0x80;
292
293/// Peripheral base address for rstmgr_aon in top earlgrey.
294///
295/// This should be used with #mmio_region_from_addr to access the memory-mapped
296/// registers associated with the peripheral (usually via a DIF).
297pub const RSTMGR_AON_BASE_ADDR: usize = 0x40410000;
298
299/// Peripheral size for rstmgr_aon in top earlgrey.
300///
301/// This is the size (in bytes) of the peripheral's reserved memory area. All
302/// memory-mapped registers associated with this peripheral should have an
303/// address between #RSTMGR_AON_BASE_ADDR and
304/// `RSTMGR_AON_BASE_ADDR + RSTMGR_AON_SIZE_BYTES`.
305pub const RSTMGR_AON_SIZE_BYTES: usize = 0x80;
306
307/// Peripheral base address for clkmgr_aon in top earlgrey.
308///
309/// This should be used with #mmio_region_from_addr to access the memory-mapped
310/// registers associated with the peripheral (usually via a DIF).
311pub const CLKMGR_AON_BASE_ADDR: usize = 0x40420000;
312
313/// Peripheral size for clkmgr_aon in top earlgrey.
314///
315/// This is the size (in bytes) of the peripheral's reserved memory area. All
316/// memory-mapped registers associated with this peripheral should have an
317/// address between #CLKMGR_AON_BASE_ADDR and
318/// `CLKMGR_AON_BASE_ADDR + CLKMGR_AON_SIZE_BYTES`.
319pub const CLKMGR_AON_SIZE_BYTES: usize = 0x80;
320
321/// Peripheral base address for sysrst_ctrl_aon in top earlgrey.
322///
323/// This should be used with #mmio_region_from_addr to access the memory-mapped
324/// registers associated with the peripheral (usually via a DIF).
325pub const SYSRST_CTRL_AON_BASE_ADDR: usize = 0x40430000;
326
327/// Peripheral size for sysrst_ctrl_aon in top earlgrey.
328///
329/// This is the size (in bytes) of the peripheral's reserved memory area. All
330/// memory-mapped registers associated with this peripheral should have an
331/// address between #SYSRST_CTRL_AON_BASE_ADDR and
332/// `SYSRST_CTRL_AON_BASE_ADDR + SYSRST_CTRL_AON_SIZE_BYTES`.
333pub const SYSRST_CTRL_AON_SIZE_BYTES: usize = 0x100;
334
335/// Peripheral base address for adc_ctrl_aon in top earlgrey.
336///
337/// This should be used with #mmio_region_from_addr to access the memory-mapped
338/// registers associated with the peripheral (usually via a DIF).
339pub const ADC_CTRL_AON_BASE_ADDR: usize = 0x40440000;
340
341/// Peripheral size for adc_ctrl_aon in top earlgrey.
342///
343/// This is the size (in bytes) of the peripheral's reserved memory area. All
344/// memory-mapped registers associated with this peripheral should have an
345/// address between #ADC_CTRL_AON_BASE_ADDR and
346/// `ADC_CTRL_AON_BASE_ADDR + ADC_CTRL_AON_SIZE_BYTES`.
347pub const ADC_CTRL_AON_SIZE_BYTES: usize = 0x80;
348
349/// Peripheral base address for pwm_aon in top earlgrey.
350///
351/// This should be used with #mmio_region_from_addr to access the memory-mapped
352/// registers associated with the peripheral (usually via a DIF).
353pub const PWM_AON_BASE_ADDR: usize = 0x40450000;
354
355/// Peripheral size for pwm_aon in top earlgrey.
356///
357/// This is the size (in bytes) of the peripheral's reserved memory area. All
358/// memory-mapped registers associated with this peripheral should have an
359/// address between #PWM_AON_BASE_ADDR and
360/// `PWM_AON_BASE_ADDR + PWM_AON_SIZE_BYTES`.
361pub const PWM_AON_SIZE_BYTES: usize = 0x80;
362
363/// Peripheral base address for pinmux_aon in top earlgrey.
364///
365/// This should be used with #mmio_region_from_addr to access the memory-mapped
366/// registers associated with the peripheral (usually via a DIF).
367pub const PINMUX_AON_BASE_ADDR: usize = 0x40460000;
368
369/// Peripheral size for pinmux_aon in top earlgrey.
370///
371/// This is the size (in bytes) of the peripheral's reserved memory area. All
372/// memory-mapped registers associated with this peripheral should have an
373/// address between #PINMUX_AON_BASE_ADDR and
374/// `PINMUX_AON_BASE_ADDR + PINMUX_AON_SIZE_BYTES`.
375pub const PINMUX_AON_SIZE_BYTES: usize = 0x1000;
376
377/// Peripheral base address for aon_timer_aon in top earlgrey.
378///
379/// This should be used with #mmio_region_from_addr to access the memory-mapped
380/// registers associated with the peripheral (usually via a DIF).
381pub const AON_TIMER_AON_BASE_ADDR: usize = 0x40470000;
382
383/// Peripheral size for aon_timer_aon in top earlgrey.
384///
385/// This is the size (in bytes) of the peripheral's reserved memory area. All
386/// memory-mapped registers associated with this peripheral should have an
387/// address between #AON_TIMER_AON_BASE_ADDR and
388/// `AON_TIMER_AON_BASE_ADDR + AON_TIMER_AON_SIZE_BYTES`.
389pub const AON_TIMER_AON_SIZE_BYTES: usize = 0x40;
390
391/// Peripheral base address for ast in top earlgrey.
392///
393/// This should be used with #mmio_region_from_addr to access the memory-mapped
394/// registers associated with the peripheral (usually via a DIF).
395pub const AST_BASE_ADDR: usize = 0x40480000;
396
397/// Peripheral size for ast in top earlgrey.
398///
399/// This is the size (in bytes) of the peripheral's reserved memory area. All
400/// memory-mapped registers associated with this peripheral should have an
401/// address between #AST_BASE_ADDR and
402/// `AST_BASE_ADDR + AST_SIZE_BYTES`.
403pub const AST_SIZE_BYTES: usize = 0x400;
404
405/// Peripheral base address for sensor_ctrl in top earlgrey.
406///
407/// This should be used with #mmio_region_from_addr to access the memory-mapped
408/// registers associated with the peripheral (usually via a DIF).
409pub const SENSOR_CTRL_BASE_ADDR: usize = 0x40490000;
410
411/// Peripheral size for sensor_ctrl in top earlgrey.
412///
413/// This is the size (in bytes) of the peripheral's reserved memory area. All
414/// memory-mapped registers associated with this peripheral should have an
415/// address between #SENSOR_CTRL_BASE_ADDR and
416/// `SENSOR_CTRL_BASE_ADDR + SENSOR_CTRL_SIZE_BYTES`.
417pub const SENSOR_CTRL_SIZE_BYTES: usize = 0x40;
418
419/// Peripheral base address for regs device on sram_ctrl_ret_aon in top earlgrey.
420///
421/// This should be used with #mmio_region_from_addr to access the memory-mapped
422/// registers associated with the peripheral (usually via a DIF).
423pub const SRAM_CTRL_RET_AON_REGS_BASE_ADDR: usize = 0x40500000;
424
425/// Peripheral size for regs device on sram_ctrl_ret_aon in top earlgrey.
426///
427/// This is the size (in bytes) of the peripheral's reserved memory area. All
428/// memory-mapped registers associated with this peripheral should have an
429/// address between #SRAM_CTRL_RET_AON_REGS_BASE_ADDR and
430/// `SRAM_CTRL_RET_AON_REGS_BASE_ADDR + SRAM_CTRL_RET_AON_REGS_SIZE_BYTES`.
431pub const SRAM_CTRL_RET_AON_REGS_SIZE_BYTES: usize = 0x20;
432
433/// Peripheral base address for ram device on sram_ctrl_ret_aon in top earlgrey.
434///
435/// This should be used with #mmio_region_from_addr to access the memory-mapped
436/// registers associated with the peripheral (usually via a DIF).
437pub const SRAM_CTRL_RET_AON_RAM_BASE_ADDR: usize = 0x40600000;
438
439/// Peripheral size for ram device on sram_ctrl_ret_aon in top earlgrey.
440///
441/// This is the size (in bytes) of the peripheral's reserved memory area. All
442/// memory-mapped registers associated with this peripheral should have an
443/// address between #SRAM_CTRL_RET_AON_RAM_BASE_ADDR and
444/// `SRAM_CTRL_RET_AON_RAM_BASE_ADDR + SRAM_CTRL_RET_AON_RAM_SIZE_BYTES`.
445pub const SRAM_CTRL_RET_AON_RAM_SIZE_BYTES: usize = 0x1000;
446
447/// Peripheral base address for core device on flash_ctrl in top earlgrey.
448///
449/// This should be used with #mmio_region_from_addr to access the memory-mapped
450/// registers associated with the peripheral (usually via a DIF).
451pub const FLASH_CTRL_CORE_BASE_ADDR: usize = 0x41000000;
452
453/// Peripheral size for core device on flash_ctrl in top earlgrey.
454///
455/// This is the size (in bytes) of the peripheral's reserved memory area. All
456/// memory-mapped registers associated with this peripheral should have an
457/// address between #FLASH_CTRL_CORE_BASE_ADDR and
458/// `FLASH_CTRL_CORE_BASE_ADDR + FLASH_CTRL_CORE_SIZE_BYTES`.
459pub const FLASH_CTRL_CORE_SIZE_BYTES: usize = 0x200;
460
461/// Peripheral base address for prim device on flash_ctrl in top earlgrey.
462///
463/// This should be used with #mmio_region_from_addr to access the memory-mapped
464/// registers associated with the peripheral (usually via a DIF).
465pub const FLASH_CTRL_PRIM_BASE_ADDR: usize = 0x41008000;
466
467/// Peripheral size for prim device on flash_ctrl in top earlgrey.
468///
469/// This is the size (in bytes) of the peripheral's reserved memory area. All
470/// memory-mapped registers associated with this peripheral should have an
471/// address between #FLASH_CTRL_PRIM_BASE_ADDR and
472/// `FLASH_CTRL_PRIM_BASE_ADDR + FLASH_CTRL_PRIM_SIZE_BYTES`.
473pub const FLASH_CTRL_PRIM_SIZE_BYTES: usize = 0x80;
474
475/// Peripheral base address for mem device on flash_ctrl in top earlgrey.
476///
477/// This should be used with #mmio_region_from_addr to access the memory-mapped
478/// registers associated with the peripheral (usually via a DIF).
479pub const FLASH_CTRL_MEM_BASE_ADDR: usize = 0x20000000;
480
481/// Peripheral size for mem device on flash_ctrl in top earlgrey.
482///
483/// This is the size (in bytes) of the peripheral's reserved memory area. All
484/// memory-mapped registers associated with this peripheral should have an
485/// address between #FLASH_CTRL_MEM_BASE_ADDR and
486/// `FLASH_CTRL_MEM_BASE_ADDR + FLASH_CTRL_MEM_SIZE_BYTES`.
487pub const FLASH_CTRL_MEM_SIZE_BYTES: usize = 0x100000;
488
489/// Peripheral base address for regs device on rv_dm in top earlgrey.
490///
491/// This should be used with #mmio_region_from_addr to access the memory-mapped
492/// registers associated with the peripheral (usually via a DIF).
493pub const RV_DM_REGS_BASE_ADDR: usize = 0x41200000;
494
495/// Peripheral size for regs device on rv_dm in top earlgrey.
496///
497/// This is the size (in bytes) of the peripheral's reserved memory area. All
498/// memory-mapped registers associated with this peripheral should have an
499/// address between #RV_DM_REGS_BASE_ADDR and
500/// `RV_DM_REGS_BASE_ADDR + RV_DM_REGS_SIZE_BYTES`.
501pub const RV_DM_REGS_SIZE_BYTES: usize = 0x4;
502
503/// Peripheral base address for mem device on rv_dm in top earlgrey.
504///
505/// This should be used with #mmio_region_from_addr to access the memory-mapped
506/// registers associated with the peripheral (usually via a DIF).
507pub const RV_DM_MEM_BASE_ADDR: usize = 0x10000;
508
509/// Peripheral size for mem device on rv_dm in top earlgrey.
510///
511/// This is the size (in bytes) of the peripheral's reserved memory area. All
512/// memory-mapped registers associated with this peripheral should have an
513/// address between #RV_DM_MEM_BASE_ADDR and
514/// `RV_DM_MEM_BASE_ADDR + RV_DM_MEM_SIZE_BYTES`.
515pub const RV_DM_MEM_SIZE_BYTES: usize = 0x1000;
516
517/// Peripheral base address for rv_plic in top earlgrey.
518///
519/// This should be used with #mmio_region_from_addr to access the memory-mapped
520/// registers associated with the peripheral (usually via a DIF).
521pub const RV_PLIC_BASE_ADDR: usize = 0x48000000;
522
523/// Peripheral size for rv_plic in top earlgrey.
524///
525/// This is the size (in bytes) of the peripheral's reserved memory area. All
526/// memory-mapped registers associated with this peripheral should have an
527/// address between #RV_PLIC_BASE_ADDR and
528/// `RV_PLIC_BASE_ADDR + RV_PLIC_SIZE_BYTES`.
529pub const RV_PLIC_SIZE_BYTES: usize = 0x8000000;
530
531/// Peripheral base address for aes in top earlgrey.
532///
533/// This should be used with #mmio_region_from_addr to access the memory-mapped
534/// registers associated with the peripheral (usually via a DIF).
535pub const AES_BASE_ADDR: usize = 0x41100000;
536
537/// Peripheral size for aes in top earlgrey.
538///
539/// This is the size (in bytes) of the peripheral's reserved memory area. All
540/// memory-mapped registers associated with this peripheral should have an
541/// address between #AES_BASE_ADDR and
542/// `AES_BASE_ADDR + AES_SIZE_BYTES`.
543pub const AES_SIZE_BYTES: usize = 0x100;
544
545/// Peripheral base address for hmac in top earlgrey.
546///
547/// This should be used with #mmio_region_from_addr to access the memory-mapped
548/// registers associated with the peripheral (usually via a DIF).
549pub const HMAC_BASE_ADDR: usize = 0x41110000;
550
551/// Peripheral size for hmac in top earlgrey.
552///
553/// This is the size (in bytes) of the peripheral's reserved memory area. All
554/// memory-mapped registers associated with this peripheral should have an
555/// address between #HMAC_BASE_ADDR and
556/// `HMAC_BASE_ADDR + HMAC_SIZE_BYTES`.
557pub const HMAC_SIZE_BYTES: usize = 0x1000;
558
559/// Peripheral base address for kmac in top earlgrey.
560///
561/// This should be used with #mmio_region_from_addr to access the memory-mapped
562/// registers associated with the peripheral (usually via a DIF).
563pub const KMAC_BASE_ADDR: usize = 0x41120000;
564
565/// Peripheral size for kmac in top earlgrey.
566///
567/// This is the size (in bytes) of the peripheral's reserved memory area. All
568/// memory-mapped registers associated with this peripheral should have an
569/// address between #KMAC_BASE_ADDR and
570/// `KMAC_BASE_ADDR + KMAC_SIZE_BYTES`.
571pub const KMAC_SIZE_BYTES: usize = 0x1000;
572
573/// Peripheral base address for otbn in top earlgrey.
574///
575/// This should be used with #mmio_region_from_addr to access the memory-mapped
576/// registers associated with the peripheral (usually via a DIF).
577pub const OTBN_BASE_ADDR: usize = 0x41130000;
578
579/// Peripheral size for otbn in top earlgrey.
580///
581/// This is the size (in bytes) of the peripheral's reserved memory area. All
582/// memory-mapped registers associated with this peripheral should have an
583/// address between #OTBN_BASE_ADDR and
584/// `OTBN_BASE_ADDR + OTBN_SIZE_BYTES`.
585pub const OTBN_SIZE_BYTES: usize = 0x10000;
586
587/// Peripheral base address for keymgr in top earlgrey.
588///
589/// This should be used with #mmio_region_from_addr to access the memory-mapped
590/// registers associated with the peripheral (usually via a DIF).
591pub const KEYMGR_BASE_ADDR: usize = 0x41140000;
592
593/// Peripheral size for keymgr in top earlgrey.
594///
595/// This is the size (in bytes) of the peripheral's reserved memory area. All
596/// memory-mapped registers associated with this peripheral should have an
597/// address between #KEYMGR_BASE_ADDR and
598/// `KEYMGR_BASE_ADDR + KEYMGR_SIZE_BYTES`.
599pub const KEYMGR_SIZE_BYTES: usize = 0x100;
600
601/// Peripheral base address for csrng in top earlgrey.
602///
603/// This should be used with #mmio_region_from_addr to access the memory-mapped
604/// registers associated with the peripheral (usually via a DIF).
605pub const CSRNG_BASE_ADDR: usize = 0x41150000;
606
607/// Peripheral size for csrng in top earlgrey.
608///
609/// This is the size (in bytes) of the peripheral's reserved memory area. All
610/// memory-mapped registers associated with this peripheral should have an
611/// address between #CSRNG_BASE_ADDR and
612/// `CSRNG_BASE_ADDR + CSRNG_SIZE_BYTES`.
613pub const CSRNG_SIZE_BYTES: usize = 0x80;
614
615/// Peripheral base address for entropy_src in top earlgrey.
616///
617/// This should be used with #mmio_region_from_addr to access the memory-mapped
618/// registers associated with the peripheral (usually via a DIF).
619pub const ENTROPY_SRC_BASE_ADDR: usize = 0x41160000;
620
621/// Peripheral size for entropy_src in top earlgrey.
622///
623/// This is the size (in bytes) of the peripheral's reserved memory area. All
624/// memory-mapped registers associated with this peripheral should have an
625/// address between #ENTROPY_SRC_BASE_ADDR and
626/// `ENTROPY_SRC_BASE_ADDR + ENTROPY_SRC_SIZE_BYTES`.
627pub const ENTROPY_SRC_SIZE_BYTES: usize = 0x100;
628
629/// Peripheral base address for edn0 in top earlgrey.
630///
631/// This should be used with #mmio_region_from_addr to access the memory-mapped
632/// registers associated with the peripheral (usually via a DIF).
633pub const EDN0_BASE_ADDR: usize = 0x41170000;
634
635/// Peripheral size for edn0 in top earlgrey.
636///
637/// This is the size (in bytes) of the peripheral's reserved memory area. All
638/// memory-mapped registers associated with this peripheral should have an
639/// address between #EDN0_BASE_ADDR and
640/// `EDN0_BASE_ADDR + EDN0_SIZE_BYTES`.
641pub const EDN0_SIZE_BYTES: usize = 0x80;
642
643/// Peripheral base address for edn1 in top earlgrey.
644///
645/// This should be used with #mmio_region_from_addr to access the memory-mapped
646/// registers associated with the peripheral (usually via a DIF).
647pub const EDN1_BASE_ADDR: usize = 0x41180000;
648
649/// Peripheral size for edn1 in top earlgrey.
650///
651/// This is the size (in bytes) of the peripheral's reserved memory area. All
652/// memory-mapped registers associated with this peripheral should have an
653/// address between #EDN1_BASE_ADDR and
654/// `EDN1_BASE_ADDR + EDN1_SIZE_BYTES`.
655pub const EDN1_SIZE_BYTES: usize = 0x80;
656
657/// Peripheral base address for regs device on sram_ctrl_main in top earlgrey.
658///
659/// This should be used with #mmio_region_from_addr to access the memory-mapped
660/// registers associated with the peripheral (usually via a DIF).
661pub const SRAM_CTRL_MAIN_REGS_BASE_ADDR: usize = 0x411C0000;
662
663/// Peripheral size for regs device on sram_ctrl_main in top earlgrey.
664///
665/// This is the size (in bytes) of the peripheral's reserved memory area. All
666/// memory-mapped registers associated with this peripheral should have an
667/// address between #SRAM_CTRL_MAIN_REGS_BASE_ADDR and
668/// `SRAM_CTRL_MAIN_REGS_BASE_ADDR + SRAM_CTRL_MAIN_REGS_SIZE_BYTES`.
669pub const SRAM_CTRL_MAIN_REGS_SIZE_BYTES: usize = 0x20;
670
671/// Peripheral base address for ram device on sram_ctrl_main in top earlgrey.
672///
673/// This should be used with #mmio_region_from_addr to access the memory-mapped
674/// registers associated with the peripheral (usually via a DIF).
675pub const SRAM_CTRL_MAIN_RAM_BASE_ADDR: usize = 0x10000000;
676
677/// Peripheral size for ram device on sram_ctrl_main in top earlgrey.
678///
679/// This is the size (in bytes) of the peripheral's reserved memory area. All
680/// memory-mapped registers associated with this peripheral should have an
681/// address between #SRAM_CTRL_MAIN_RAM_BASE_ADDR and
682/// `SRAM_CTRL_MAIN_RAM_BASE_ADDR + SRAM_CTRL_MAIN_RAM_SIZE_BYTES`.
683pub const SRAM_CTRL_MAIN_RAM_SIZE_BYTES: usize = 0x20000;
684
685/// Peripheral base address for regs device on rom_ctrl in top earlgrey.
686///
687/// This should be used with #mmio_region_from_addr to access the memory-mapped
688/// registers associated with the peripheral (usually via a DIF).
689pub const ROM_CTRL_REGS_BASE_ADDR: usize = 0x411E0000;
690
691/// Peripheral size for regs device on rom_ctrl in top earlgrey.
692///
693/// This is the size (in bytes) of the peripheral's reserved memory area. All
694/// memory-mapped registers associated with this peripheral should have an
695/// address between #ROM_CTRL_REGS_BASE_ADDR and
696/// `ROM_CTRL_REGS_BASE_ADDR + ROM_CTRL_REGS_SIZE_BYTES`.
697pub const ROM_CTRL_REGS_SIZE_BYTES: usize = 0x80;
698
699/// Peripheral base address for rom device on rom_ctrl in top earlgrey.
700///
701/// This should be used with #mmio_region_from_addr to access the memory-mapped
702/// registers associated with the peripheral (usually via a DIF).
703pub const ROM_CTRL_ROM_BASE_ADDR: usize = 0x8000;
704
705/// Peripheral size for rom device on rom_ctrl in top earlgrey.
706///
707/// This is the size (in bytes) of the peripheral's reserved memory area. All
708/// memory-mapped registers associated with this peripheral should have an
709/// address between #ROM_CTRL_ROM_BASE_ADDR and
710/// `ROM_CTRL_ROM_BASE_ADDR + ROM_CTRL_ROM_SIZE_BYTES`.
711pub const ROM_CTRL_ROM_SIZE_BYTES: usize = 0x8000;
712
713/// Peripheral base address for cfg device on rv_core_ibex in top earlgrey.
714///
715/// This should be used with #mmio_region_from_addr to access the memory-mapped
716/// registers associated with the peripheral (usually via a DIF).
717pub const RV_CORE_IBEX_CFG_BASE_ADDR: usize = 0x411F0000;
718
719/// Peripheral size for cfg device on rv_core_ibex in top earlgrey.
720///
721/// This is the size (in bytes) of the peripheral's reserved memory area. All
722/// memory-mapped registers associated with this peripheral should have an
723/// address between #RV_CORE_IBEX_CFG_BASE_ADDR and
724/// `RV_CORE_IBEX_CFG_BASE_ADDR + RV_CORE_IBEX_CFG_SIZE_BYTES`.
725pub const RV_CORE_IBEX_CFG_SIZE_BYTES: usize = 0x100;
726
727/// Memory base address for ram_ret_aon in top earlgrey.
728pub const RAM_RET_AON_BASE_ADDR: usize = 0x40600000;
729
730/// Memory size for ram_ret_aon in top earlgrey.
731pub const RAM_RET_AON_SIZE_BYTES: usize = 0x1000;
732
733/// Memory base address for eflash in top earlgrey.
734pub const EFLASH_BASE_ADDR: usize = 0x20000000;
735
736/// Memory size for eflash in top earlgrey.
737pub const EFLASH_SIZE_BYTES: usize = 0x100000;
738
739/// Memory base address for ram_main in top earlgrey.
740pub const RAM_MAIN_BASE_ADDR: usize = 0x10000000;
741
742/// Memory size for ram_main in top earlgrey.
743pub const RAM_MAIN_SIZE_BYTES: usize = 0x20000;
744
745/// Memory base address for rom in top earlgrey.
746pub const ROM_BASE_ADDR: usize = 0x8000;
747
748/// Memory size for rom in top earlgrey.
749pub const ROM_SIZE_BYTES: usize = 0x8000;
750
751/// PLIC Interrupt Source Peripheral.
752///
753/// Enumeration used to determine which peripheral asserted the corresponding
754/// interrupt.
755#[derive(Copy, Clone, PartialEq, Eq)]
756#[repr(u32)]
757pub enum PlicPeripheral {
758 /// Unknown Peripheral
759 Unknown = 0,
760 /// uart0
761 Uart0 = 1,
762 /// uart1
763 Uart1 = 2,
764 /// uart2
765 Uart2 = 3,
766 /// uart3
767 Uart3 = 4,
768 /// gpio
769 Gpio = 5,
770 /// spi_device
771 SpiDevice = 6,
772 /// i2c0
773 I2c0 = 7,
774 /// i2c1
775 I2c1 = 8,
776 /// i2c2
777 I2c2 = 9,
778 /// pattgen
779 Pattgen = 10,
780 /// rv_timer
781 RvTimer = 11,
782 /// otp_ctrl
783 OtpCtrl = 12,
784 /// alert_handler
785 AlertHandler = 13,
786 /// spi_host0
787 SpiHost0 = 14,
788 /// spi_host1
789 SpiHost1 = 15,
790 /// usbdev
791 Usbdev = 16,
792 /// pwrmgr_aon
793 PwrmgrAon = 17,
794 /// sysrst_ctrl_aon
795 SysrstCtrlAon = 18,
796 /// adc_ctrl_aon
797 AdcCtrlAon = 19,
798 /// aon_timer_aon
799 AonTimerAon = 20,
800 /// sensor_ctrl
801 SensorCtrl = 21,
802 /// flash_ctrl
803 FlashCtrl = 22,
804 /// hmac
805 Hmac = 23,
806 /// kmac
807 Kmac = 24,
808 /// otbn
809 Otbn = 25,
810 /// keymgr
811 Keymgr = 26,
812 /// csrng
813 Csrng = 27,
814 /// entropy_src
815 EntropySrc = 28,
816 /// edn0
817 Edn0 = 29,
818 /// edn1
819 Edn1 = 30,
820}
821
822impl TryFrom<u32> for PlicPeripheral {
823 type Error = u32;
824 fn try_from(val: u32) -> Result<Self, Self::Error> {
825 match val {
826 0 => Ok(Self::Unknown),
827 1 => Ok(Self::Uart0),
828 2 => Ok(Self::Uart1),
829 3 => Ok(Self::Uart2),
830 4 => Ok(Self::Uart3),
831 5 => Ok(Self::Gpio),
832 6 => Ok(Self::SpiDevice),
833 7 => Ok(Self::I2c0),
834 8 => Ok(Self::I2c1),
835 9 => Ok(Self::I2c2),
836 10 => Ok(Self::Pattgen),
837 11 => Ok(Self::RvTimer),
838 12 => Ok(Self::OtpCtrl),
839 13 => Ok(Self::AlertHandler),
840 14 => Ok(Self::SpiHost0),
841 15 => Ok(Self::SpiHost1),
842 16 => Ok(Self::Usbdev),
843 17 => Ok(Self::PwrmgrAon),
844 18 => Ok(Self::SysrstCtrlAon),
845 19 => Ok(Self::AdcCtrlAon),
846 20 => Ok(Self::AonTimerAon),
847 21 => Ok(Self::SensorCtrl),
848 22 => Ok(Self::FlashCtrl),
849 23 => Ok(Self::Hmac),
850 24 => Ok(Self::Kmac),
851 25 => Ok(Self::Otbn),
852 26 => Ok(Self::Keymgr),
853 27 => Ok(Self::Csrng),
854 28 => Ok(Self::EntropySrc),
855 29 => Ok(Self::Edn0),
856 30 => Ok(Self::Edn1),
857 _ => Err(val),
858 }
859 }
860}
861
862/// PLIC Interrupt Source.
863///
864/// Enumeration of all PLIC interrupt sources. The interrupt sources belonging to
865/// the same peripheral are guaranteed to be consecutive.
866#[derive(Copy, Clone, PartialEq, Eq)]
867#[repr(u32)]
868pub enum PlicIrqId {
869 /// No Interrupt
870 None = 0,
871 /// uart0_tx_watermark
872 Uart0TxWatermark = 1,
873 /// uart0_rx_watermark
874 Uart0RxWatermark = 2,
875 /// uart0_tx_empty
876 Uart0TxEmpty = 3,
877 /// uart0_rx_overflow
878 Uart0RxOverflow = 4,
879 /// uart0_rx_frame_err
880 Uart0RxFrameErr = 5,
881 /// uart0_rx_break_err
882 Uart0RxBreakErr = 6,
883 /// uart0_rx_timeout
884 Uart0RxTimeout = 7,
885 /// uart0_rx_parity_err
886 Uart0RxParityErr = 8,
887 /// uart1_tx_watermark
888 Uart1TxWatermark = 9,
889 /// uart1_rx_watermark
890 Uart1RxWatermark = 10,
891 /// uart1_tx_empty
892 Uart1TxEmpty = 11,
893 /// uart1_rx_overflow
894 Uart1RxOverflow = 12,
895 /// uart1_rx_frame_err
896 Uart1RxFrameErr = 13,
897 /// uart1_rx_break_err
898 Uart1RxBreakErr = 14,
899 /// uart1_rx_timeout
900 Uart1RxTimeout = 15,
901 /// uart1_rx_parity_err
902 Uart1RxParityErr = 16,
903 /// uart2_tx_watermark
904 Uart2TxWatermark = 17,
905 /// uart2_rx_watermark
906 Uart2RxWatermark = 18,
907 /// uart2_tx_empty
908 Uart2TxEmpty = 19,
909 /// uart2_rx_overflow
910 Uart2RxOverflow = 20,
911 /// uart2_rx_frame_err
912 Uart2RxFrameErr = 21,
913 /// uart2_rx_break_err
914 Uart2RxBreakErr = 22,
915 /// uart2_rx_timeout
916 Uart2RxTimeout = 23,
917 /// uart2_rx_parity_err
918 Uart2RxParityErr = 24,
919 /// uart3_tx_watermark
920 Uart3TxWatermark = 25,
921 /// uart3_rx_watermark
922 Uart3RxWatermark = 26,
923 /// uart3_tx_empty
924 Uart3TxEmpty = 27,
925 /// uart3_rx_overflow
926 Uart3RxOverflow = 28,
927 /// uart3_rx_frame_err
928 Uart3RxFrameErr = 29,
929 /// uart3_rx_break_err
930 Uart3RxBreakErr = 30,
931 /// uart3_rx_timeout
932 Uart3RxTimeout = 31,
933 /// uart3_rx_parity_err
934 Uart3RxParityErr = 32,
935 /// gpio_gpio 0
936 GpioGpio0 = 33,
937 /// gpio_gpio 1
938 GpioGpio1 = 34,
939 /// gpio_gpio 2
940 GpioGpio2 = 35,
941 /// gpio_gpio 3
942 GpioGpio3 = 36,
943 /// gpio_gpio 4
944 GpioGpio4 = 37,
945 /// gpio_gpio 5
946 GpioGpio5 = 38,
947 /// gpio_gpio 6
948 GpioGpio6 = 39,
949 /// gpio_gpio 7
950 GpioGpio7 = 40,
951 /// gpio_gpio 8
952 GpioGpio8 = 41,
953 /// gpio_gpio 9
954 GpioGpio9 = 42,
955 /// gpio_gpio 10
956 GpioGpio10 = 43,
957 /// gpio_gpio 11
958 GpioGpio11 = 44,
959 /// gpio_gpio 12
960 GpioGpio12 = 45,
961 /// gpio_gpio 13
962 GpioGpio13 = 46,
963 /// gpio_gpio 14
964 GpioGpio14 = 47,
965 /// gpio_gpio 15
966 GpioGpio15 = 48,
967 /// gpio_gpio 16
968 GpioGpio16 = 49,
969 /// gpio_gpio 17
970 GpioGpio17 = 50,
971 /// gpio_gpio 18
972 GpioGpio18 = 51,
973 /// gpio_gpio 19
974 GpioGpio19 = 52,
975 /// gpio_gpio 20
976 GpioGpio20 = 53,
977 /// gpio_gpio 21
978 GpioGpio21 = 54,
979 /// gpio_gpio 22
980 GpioGpio22 = 55,
981 /// gpio_gpio 23
982 GpioGpio23 = 56,
983 /// gpio_gpio 24
984 GpioGpio24 = 57,
985 /// gpio_gpio 25
986 GpioGpio25 = 58,
987 /// gpio_gpio 26
988 GpioGpio26 = 59,
989 /// gpio_gpio 27
990 GpioGpio27 = 60,
991 /// gpio_gpio 28
992 GpioGpio28 = 61,
993 /// gpio_gpio 29
994 GpioGpio29 = 62,
995 /// gpio_gpio 30
996 GpioGpio30 = 63,
997 /// gpio_gpio 31
998 GpioGpio31 = 64,
999 /// spi_device_generic_rx_full
1000 SpiDeviceGenericRxFull = 65,
1001 /// spi_device_generic_rx_watermark
1002 SpiDeviceGenericRxWatermark = 66,
1003 /// spi_device_generic_tx_watermark
1004 SpiDeviceGenericTxWatermark = 67,
1005 /// spi_device_generic_rx_error
1006 SpiDeviceGenericRxError = 68,
1007 /// spi_device_generic_rx_overflow
1008 SpiDeviceGenericRxOverflow = 69,
1009 /// spi_device_generic_tx_underflow
1010 SpiDeviceGenericTxUnderflow = 70,
1011 /// spi_device_upload_cmdfifo_not_empty
1012 SpiDeviceUploadCmdfifoNotEmpty = 71,
1013 /// spi_device_upload_payload_not_empty
1014 SpiDeviceUploadPayloadNotEmpty = 72,
1015 /// spi_device_upload_payload_overflow
1016 SpiDeviceUploadPayloadOverflow = 73,
1017 /// spi_device_readbuf_watermark
1018 SpiDeviceReadbufWatermark = 74,
1019 /// spi_device_readbuf_flip
1020 SpiDeviceReadbufFlip = 75,
1021 /// spi_device_tpm_header_not_empty
1022 SpiDeviceTpmHeaderNotEmpty = 76,
1023 /// i2c0_fmt_threshold
1024 I2c0FmtThreshold = 77,
1025 /// i2c0_rx_threshold
1026 I2c0RxThreshold = 78,
1027 /// i2c0_fmt_overflow
1028 I2c0FmtOverflow = 79,
1029 /// i2c0_rx_overflow
1030 I2c0RxOverflow = 80,
1031 /// i2c0_nak
1032 I2c0Nak = 81,
1033 /// i2c0_scl_interference
1034 I2c0SclInterference = 82,
1035 /// i2c0_sda_interference
1036 I2c0SdaInterference = 83,
1037 /// i2c0_stretch_timeout
1038 I2c0StretchTimeout = 84,
1039 /// i2c0_sda_unstable
1040 I2c0SdaUnstable = 85,
1041 /// i2c0_cmd_complete
1042 I2c0CmdComplete = 86,
1043 /// i2c0_tx_stretch
1044 I2c0TxStretch = 87,
1045 /// i2c0_tx_overflow
1046 I2c0TxOverflow = 88,
1047 /// i2c0_acq_full
1048 I2c0AcqFull = 89,
1049 /// i2c0_unexp_stop
1050 I2c0UnexpStop = 90,
1051 /// i2c0_host_timeout
1052 I2c0HostTimeout = 91,
1053 /// i2c1_fmt_threshold
1054 I2c1FmtThreshold = 92,
1055 /// i2c1_rx_threshold
1056 I2c1RxThreshold = 93,
1057 /// i2c1_fmt_overflow
1058 I2c1FmtOverflow = 94,
1059 /// i2c1_rx_overflow
1060 I2c1RxOverflow = 95,
1061 /// i2c1_nak
1062 I2c1Nak = 96,
1063 /// i2c1_scl_interference
1064 I2c1SclInterference = 97,
1065 /// i2c1_sda_interference
1066 I2c1SdaInterference = 98,
1067 /// i2c1_stretch_timeout
1068 I2c1StretchTimeout = 99,
1069 /// i2c1_sda_unstable
1070 I2c1SdaUnstable = 100,
1071 /// i2c1_cmd_complete
1072 I2c1CmdComplete = 101,
1073 /// i2c1_tx_stretch
1074 I2c1TxStretch = 102,
1075 /// i2c1_tx_overflow
1076 I2c1TxOverflow = 103,
1077 /// i2c1_acq_full
1078 I2c1AcqFull = 104,
1079 /// i2c1_unexp_stop
1080 I2c1UnexpStop = 105,
1081 /// i2c1_host_timeout
1082 I2c1HostTimeout = 106,
1083 /// i2c2_fmt_threshold
1084 I2c2FmtThreshold = 107,
1085 /// i2c2_rx_threshold
1086 I2c2RxThreshold = 108,
1087 /// i2c2_fmt_overflow
1088 I2c2FmtOverflow = 109,
1089 /// i2c2_rx_overflow
1090 I2c2RxOverflow = 110,
1091 /// i2c2_nak
1092 I2c2Nak = 111,
1093 /// i2c2_scl_interference
1094 I2c2SclInterference = 112,
1095 /// i2c2_sda_interference
1096 I2c2SdaInterference = 113,
1097 /// i2c2_stretch_timeout
1098 I2c2StretchTimeout = 114,
1099 /// i2c2_sda_unstable
1100 I2c2SdaUnstable = 115,
1101 /// i2c2_cmd_complete
1102 I2c2CmdComplete = 116,
1103 /// i2c2_tx_stretch
1104 I2c2TxStretch = 117,
1105 /// i2c2_tx_overflow
1106 I2c2TxOverflow = 118,
1107 /// i2c2_acq_full
1108 I2c2AcqFull = 119,
1109 /// i2c2_unexp_stop
1110 I2c2UnexpStop = 120,
1111 /// i2c2_host_timeout
1112 I2c2HostTimeout = 121,
1113 /// pattgen_done_ch0
1114 PattgenDoneCh0 = 122,
1115 /// pattgen_done_ch1
1116 PattgenDoneCh1 = 123,
1117 /// rv_timer_timer_expired_hart0_timer0
1118 RvTimerTimerExpiredHart0Timer0 = 124,
1119 /// otp_ctrl_otp_operation_done
1120 OtpCtrlOtpOperationDone = 125,
1121 /// otp_ctrl_otp_error
1122 OtpCtrlOtpError = 126,
1123 /// alert_handler_classa
1124 AlertHandlerClassa = 127,
1125 /// alert_handler_classb
1126 AlertHandlerClassb = 128,
1127 /// alert_handler_classc
1128 AlertHandlerClassc = 129,
1129 /// alert_handler_classd
1130 AlertHandlerClassd = 130,
1131 /// spi_host0_error
1132 SpiHost0Error = 131,
1133 /// spi_host0_spi_event
1134 SpiHost0SpiEvent = 132,
1135 /// spi_host1_error
1136 SpiHost1Error = 133,
1137 /// spi_host1_spi_event
1138 SpiHost1SpiEvent = 134,
1139 /// usbdev_pkt_received
1140 UsbdevPktReceived = 135,
1141 /// usbdev_pkt_sent
1142 UsbdevPktSent = 136,
1143 /// usbdev_disconnected
1144 UsbdevDisconnected = 137,
1145 /// usbdev_host_lost
1146 UsbdevHostLost = 138,
1147 /// usbdev_link_reset
1148 UsbdevLinkReset = 139,
1149 /// usbdev_link_suspend
1150 UsbdevLinkSuspend = 140,
1151 /// usbdev_link_resume
1152 UsbdevLinkResume = 141,
1153 /// usbdev_av_empty
1154 UsbdevAvEmpty = 142,
1155 /// usbdev_rx_full
1156 UsbdevRxFull = 143,
1157 /// usbdev_av_overflow
1158 UsbdevAvOverflow = 144,
1159 /// usbdev_link_in_err
1160 UsbdevLinkInErr = 145,
1161 /// usbdev_rx_crc_err
1162 UsbdevRxCrcErr = 146,
1163 /// usbdev_rx_pid_err
1164 UsbdevRxPidErr = 147,
1165 /// usbdev_rx_bitstuff_err
1166 UsbdevRxBitstuffErr = 148,
1167 /// usbdev_frame
1168 UsbdevFrame = 149,
1169 /// usbdev_powered
1170 UsbdevPowered = 150,
1171 /// usbdev_link_out_err
1172 UsbdevLinkOutErr = 151,
1173 /// pwrmgr_aon_wakeup
1174 PwrmgrAonWakeup = 152,
1175 /// sysrst_ctrl_aon_event_detected
1176 SysrstCtrlAonEventDetected = 153,
1177 /// adc_ctrl_aon_match_done
1178 AdcCtrlAonMatchDone = 154,
1179 /// aon_timer_aon_wkup_timer_expired
1180 AonTimerAonWkupTimerExpired = 155,
1181 /// aon_timer_aon_wdog_timer_bark
1182 AonTimerAonWdogTimerBark = 156,
1183 /// sensor_ctrl_io_status_change
1184 SensorCtrlIoStatusChange = 157,
1185 /// sensor_ctrl_init_status_change
1186 SensorCtrlInitStatusChange = 158,
1187 /// flash_ctrl_prog_empty
1188 FlashCtrlProgEmpty = 159,
1189 /// flash_ctrl_prog_lvl
1190 FlashCtrlProgLvl = 160,
1191 /// flash_ctrl_rd_full
1192 FlashCtrlRdFull = 161,
1193 /// flash_ctrl_rd_lvl
1194 FlashCtrlRdLvl = 162,
1195 /// flash_ctrl_op_done
1196 FlashCtrlOpDone = 163,
1197 /// flash_ctrl_corr_err
1198 FlashCtrlCorrErr = 164,
1199 /// hmac_hmac_done
1200 HmacHmacDone = 165,
1201 /// hmac_fifo_empty
1202 HmacFifoEmpty = 166,
1203 /// hmac_hmac_err
1204 HmacHmacErr = 167,
1205 /// kmac_kmac_done
1206 KmacKmacDone = 168,
1207 /// kmac_fifo_empty
1208 KmacFifoEmpty = 169,
1209 /// kmac_kmac_err
1210 KmacKmacErr = 170,
1211 /// otbn_done
1212 OtbnDone = 171,
1213 /// keymgr_op_done
1214 KeymgrOpDone = 172,
1215 /// csrng_cs_cmd_req_done
1216 CsrngCsCmdReqDone = 173,
1217 /// csrng_cs_entropy_req
1218 CsrngCsEntropyReq = 174,
1219 /// csrng_cs_hw_inst_exc
1220 CsrngCsHwInstExc = 175,
1221 /// csrng_cs_fatal_err
1222 CsrngCsFatalErr = 176,
1223 /// entropy_src_es_entropy_valid
1224 EntropySrcEsEntropyValid = 177,
1225 /// entropy_src_es_health_test_failed
1226 EntropySrcEsHealthTestFailed = 178,
1227 /// entropy_src_es_observe_fifo_ready
1228 EntropySrcEsObserveFifoReady = 179,
1229 /// entropy_src_es_fatal_err
1230 EntropySrcEsFatalErr = 180,
1231 /// edn0_edn_cmd_req_done
1232 Edn0EdnCmdReqDone = 181,
1233 /// edn0_edn_fatal_err
1234 Edn0EdnFatalErr = 182,
1235 /// edn1_edn_cmd_req_done
1236 Edn1EdnCmdReqDone = 183,
1237 /// edn1_edn_fatal_err
1238 Edn1EdnFatalErr = 184,
1239}
1240
1241impl TryFrom<u32> for PlicIrqId {
1242 type Error = u32;
1243 fn try_from(val: u32) -> Result<Self, Self::Error> {
1244 match val {
1245 0 => Ok(Self::None),
1246 1 => Ok(Self::Uart0TxWatermark),
1247 2 => Ok(Self::Uart0RxWatermark),
1248 3 => Ok(Self::Uart0TxEmpty),
1249 4 => Ok(Self::Uart0RxOverflow),
1250 5 => Ok(Self::Uart0RxFrameErr),
1251 6 => Ok(Self::Uart0RxBreakErr),
1252 7 => Ok(Self::Uart0RxTimeout),
1253 8 => Ok(Self::Uart0RxParityErr),
1254 9 => Ok(Self::Uart1TxWatermark),
1255 10 => Ok(Self::Uart1RxWatermark),
1256 11 => Ok(Self::Uart1TxEmpty),
1257 12 => Ok(Self::Uart1RxOverflow),
1258 13 => Ok(Self::Uart1RxFrameErr),
1259 14 => Ok(Self::Uart1RxBreakErr),
1260 15 => Ok(Self::Uart1RxTimeout),
1261 16 => Ok(Self::Uart1RxParityErr),
1262 17 => Ok(Self::Uart2TxWatermark),
1263 18 => Ok(Self::Uart2RxWatermark),
1264 19 => Ok(Self::Uart2TxEmpty),
1265 20 => Ok(Self::Uart2RxOverflow),
1266 21 => Ok(Self::Uart2RxFrameErr),
1267 22 => Ok(Self::Uart2RxBreakErr),
1268 23 => Ok(Self::Uart2RxTimeout),
1269 24 => Ok(Self::Uart2RxParityErr),
1270 25 => Ok(Self::Uart3TxWatermark),
1271 26 => Ok(Self::Uart3RxWatermark),
1272 27 => Ok(Self::Uart3TxEmpty),
1273 28 => Ok(Self::Uart3RxOverflow),
1274 29 => Ok(Self::Uart3RxFrameErr),
1275 30 => Ok(Self::Uart3RxBreakErr),
1276 31 => Ok(Self::Uart3RxTimeout),
1277 32 => Ok(Self::Uart3RxParityErr),
1278 33 => Ok(Self::GpioGpio0),
1279 34 => Ok(Self::GpioGpio1),
1280 35 => Ok(Self::GpioGpio2),
1281 36 => Ok(Self::GpioGpio3),
1282 37 => Ok(Self::GpioGpio4),
1283 38 => Ok(Self::GpioGpio5),
1284 39 => Ok(Self::GpioGpio6),
1285 40 => Ok(Self::GpioGpio7),
1286 41 => Ok(Self::GpioGpio8),
1287 42 => Ok(Self::GpioGpio9),
1288 43 => Ok(Self::GpioGpio10),
1289 44 => Ok(Self::GpioGpio11),
1290 45 => Ok(Self::GpioGpio12),
1291 46 => Ok(Self::GpioGpio13),
1292 47 => Ok(Self::GpioGpio14),
1293 48 => Ok(Self::GpioGpio15),
1294 49 => Ok(Self::GpioGpio16),
1295 50 => Ok(Self::GpioGpio17),
1296 51 => Ok(Self::GpioGpio18),
1297 52 => Ok(Self::GpioGpio19),
1298 53 => Ok(Self::GpioGpio20),
1299 54 => Ok(Self::GpioGpio21),
1300 55 => Ok(Self::GpioGpio22),
1301 56 => Ok(Self::GpioGpio23),
1302 57 => Ok(Self::GpioGpio24),
1303 58 => Ok(Self::GpioGpio25),
1304 59 => Ok(Self::GpioGpio26),
1305 60 => Ok(Self::GpioGpio27),
1306 61 => Ok(Self::GpioGpio28),
1307 62 => Ok(Self::GpioGpio29),
1308 63 => Ok(Self::GpioGpio30),
1309 64 => Ok(Self::GpioGpio31),
1310 65 => Ok(Self::SpiDeviceGenericRxFull),
1311 66 => Ok(Self::SpiDeviceGenericRxWatermark),
1312 67 => Ok(Self::SpiDeviceGenericTxWatermark),
1313 68 => Ok(Self::SpiDeviceGenericRxError),
1314 69 => Ok(Self::SpiDeviceGenericRxOverflow),
1315 70 => Ok(Self::SpiDeviceGenericTxUnderflow),
1316 71 => Ok(Self::SpiDeviceUploadCmdfifoNotEmpty),
1317 72 => Ok(Self::SpiDeviceUploadPayloadNotEmpty),
1318 73 => Ok(Self::SpiDeviceUploadPayloadOverflow),
1319 74 => Ok(Self::SpiDeviceReadbufWatermark),
1320 75 => Ok(Self::SpiDeviceReadbufFlip),
1321 76 => Ok(Self::SpiDeviceTpmHeaderNotEmpty),
1322 77 => Ok(Self::I2c0FmtThreshold),
1323 78 => Ok(Self::I2c0RxThreshold),
1324 79 => Ok(Self::I2c0FmtOverflow),
1325 80 => Ok(Self::I2c0RxOverflow),
1326 81 => Ok(Self::I2c0Nak),
1327 82 => Ok(Self::I2c0SclInterference),
1328 83 => Ok(Self::I2c0SdaInterference),
1329 84 => Ok(Self::I2c0StretchTimeout),
1330 85 => Ok(Self::I2c0SdaUnstable),
1331 86 => Ok(Self::I2c0CmdComplete),
1332 87 => Ok(Self::I2c0TxStretch),
1333 88 => Ok(Self::I2c0TxOverflow),
1334 89 => Ok(Self::I2c0AcqFull),
1335 90 => Ok(Self::I2c0UnexpStop),
1336 91 => Ok(Self::I2c0HostTimeout),
1337 92 => Ok(Self::I2c1FmtThreshold),
1338 93 => Ok(Self::I2c1RxThreshold),
1339 94 => Ok(Self::I2c1FmtOverflow),
1340 95 => Ok(Self::I2c1RxOverflow),
1341 96 => Ok(Self::I2c1Nak),
1342 97 => Ok(Self::I2c1SclInterference),
1343 98 => Ok(Self::I2c1SdaInterference),
1344 99 => Ok(Self::I2c1StretchTimeout),
1345 100 => Ok(Self::I2c1SdaUnstable),
1346 101 => Ok(Self::I2c1CmdComplete),
1347 102 => Ok(Self::I2c1TxStretch),
1348 103 => Ok(Self::I2c1TxOverflow),
1349 104 => Ok(Self::I2c1AcqFull),
1350 105 => Ok(Self::I2c1UnexpStop),
1351 106 => Ok(Self::I2c1HostTimeout),
1352 107 => Ok(Self::I2c2FmtThreshold),
1353 108 => Ok(Self::I2c2RxThreshold),
1354 109 => Ok(Self::I2c2FmtOverflow),
1355 110 => Ok(Self::I2c2RxOverflow),
1356 111 => Ok(Self::I2c2Nak),
1357 112 => Ok(Self::I2c2SclInterference),
1358 113 => Ok(Self::I2c2SdaInterference),
1359 114 => Ok(Self::I2c2StretchTimeout),
1360 115 => Ok(Self::I2c2SdaUnstable),
1361 116 => Ok(Self::I2c2CmdComplete),
1362 117 => Ok(Self::I2c2TxStretch),
1363 118 => Ok(Self::I2c2TxOverflow),
1364 119 => Ok(Self::I2c2AcqFull),
1365 120 => Ok(Self::I2c2UnexpStop),
1366 121 => Ok(Self::I2c2HostTimeout),
1367 122 => Ok(Self::PattgenDoneCh0),
1368 123 => Ok(Self::PattgenDoneCh1),
1369 124 => Ok(Self::RvTimerTimerExpiredHart0Timer0),
1370 125 => Ok(Self::OtpCtrlOtpOperationDone),
1371 126 => Ok(Self::OtpCtrlOtpError),
1372 127 => Ok(Self::AlertHandlerClassa),
1373 128 => Ok(Self::AlertHandlerClassb),
1374 129 => Ok(Self::AlertHandlerClassc),
1375 130 => Ok(Self::AlertHandlerClassd),
1376 131 => Ok(Self::SpiHost0Error),
1377 132 => Ok(Self::SpiHost0SpiEvent),
1378 133 => Ok(Self::SpiHost1Error),
1379 134 => Ok(Self::SpiHost1SpiEvent),
1380 135 => Ok(Self::UsbdevPktReceived),
1381 136 => Ok(Self::UsbdevPktSent),
1382 137 => Ok(Self::UsbdevDisconnected),
1383 138 => Ok(Self::UsbdevHostLost),
1384 139 => Ok(Self::UsbdevLinkReset),
1385 140 => Ok(Self::UsbdevLinkSuspend),
1386 141 => Ok(Self::UsbdevLinkResume),
1387 142 => Ok(Self::UsbdevAvEmpty),
1388 143 => Ok(Self::UsbdevRxFull),
1389 144 => Ok(Self::UsbdevAvOverflow),
1390 145 => Ok(Self::UsbdevLinkInErr),
1391 146 => Ok(Self::UsbdevRxCrcErr),
1392 147 => Ok(Self::UsbdevRxPidErr),
1393 148 => Ok(Self::UsbdevRxBitstuffErr),
1394 149 => Ok(Self::UsbdevFrame),
1395 150 => Ok(Self::UsbdevPowered),
1396 151 => Ok(Self::UsbdevLinkOutErr),
1397 152 => Ok(Self::PwrmgrAonWakeup),
1398 153 => Ok(Self::SysrstCtrlAonEventDetected),
1399 154 => Ok(Self::AdcCtrlAonMatchDone),
1400 155 => Ok(Self::AonTimerAonWkupTimerExpired),
1401 156 => Ok(Self::AonTimerAonWdogTimerBark),
1402 157 => Ok(Self::SensorCtrlIoStatusChange),
1403 158 => Ok(Self::SensorCtrlInitStatusChange),
1404 159 => Ok(Self::FlashCtrlProgEmpty),
1405 160 => Ok(Self::FlashCtrlProgLvl),
1406 161 => Ok(Self::FlashCtrlRdFull),
1407 162 => Ok(Self::FlashCtrlRdLvl),
1408 163 => Ok(Self::FlashCtrlOpDone),
1409 164 => Ok(Self::FlashCtrlCorrErr),
1410 165 => Ok(Self::HmacHmacDone),
1411 166 => Ok(Self::HmacFifoEmpty),
1412 167 => Ok(Self::HmacHmacErr),
1413 168 => Ok(Self::KmacKmacDone),
1414 169 => Ok(Self::KmacFifoEmpty),
1415 170 => Ok(Self::KmacKmacErr),
1416 171 => Ok(Self::OtbnDone),
1417 172 => Ok(Self::KeymgrOpDone),
1418 173 => Ok(Self::CsrngCsCmdReqDone),
1419 174 => Ok(Self::CsrngCsEntropyReq),
1420 175 => Ok(Self::CsrngCsHwInstExc),
1421 176 => Ok(Self::CsrngCsFatalErr),
1422 177 => Ok(Self::EntropySrcEsEntropyValid),
1423 178 => Ok(Self::EntropySrcEsHealthTestFailed),
1424 179 => Ok(Self::EntropySrcEsObserveFifoReady),
1425 180 => Ok(Self::EntropySrcEsFatalErr),
1426 181 => Ok(Self::Edn0EdnCmdReqDone),
1427 182 => Ok(Self::Edn0EdnFatalErr),
1428 183 => Ok(Self::Edn1EdnCmdReqDone),
1429 184 => Ok(Self::Edn1EdnFatalErr),
1430 _ => Err(val),
1431 }
1432 }
1433}
1434
1435/// PLIC Interrupt Target.
1436///
1437/// Enumeration used to determine which set of IE, CC, threshold registers to
1438/// access for a given interrupt target.
1439#[derive(Copy, Clone, PartialEq, Eq)]
1440#[repr(u32)]
1441pub enum PlicTarget {
1442 /// Ibex Core 0
1443 Ibex0 = 0,
1444}
1445
1446/// Alert Handler Source Peripheral.
1447///
1448/// Enumeration used to determine which peripheral asserted the corresponding
1449/// alert.
1450#[derive(Copy, Clone, PartialEq, Eq)]
1451#[repr(u32)]
1452pub enum AlertPeripheral {
1453 /// uart0
1454 Uart0 = 0,
1455 /// uart1
1456 Uart1 = 1,
1457 /// uart2
1458 Uart2 = 2,
1459 /// uart3
1460 Uart3 = 3,
1461 /// gpio
1462 Gpio = 4,
1463 /// spi_device
1464 SpiDevice = 5,
1465 /// i2c0
1466 I2c0 = 6,
1467 /// i2c1
1468 I2c1 = 7,
1469 /// i2c2
1470 I2c2 = 8,
1471 /// pattgen
1472 Pattgen = 9,
1473 /// rv_timer
1474 RvTimer = 10,
1475 /// otp_ctrl
1476 OtpCtrl = 11,
1477 /// lc_ctrl
1478 LcCtrl = 12,
1479 /// spi_host0
1480 SpiHost0 = 13,
1481 /// spi_host1
1482 SpiHost1 = 14,
1483 /// usbdev
1484 Usbdev = 15,
1485 /// pwrmgr_aon
1486 PwrmgrAon = 16,
1487 /// rstmgr_aon
1488 RstmgrAon = 17,
1489 /// clkmgr_aon
1490 ClkmgrAon = 18,
1491 /// sysrst_ctrl_aon
1492 SysrstCtrlAon = 19,
1493 /// adc_ctrl_aon
1494 AdcCtrlAon = 20,
1495 /// pwm_aon
1496 PwmAon = 21,
1497 /// pinmux_aon
1498 PinmuxAon = 22,
1499 /// aon_timer_aon
1500 AonTimerAon = 23,
1501 /// sensor_ctrl
1502 SensorCtrl = 24,
1503 /// sram_ctrl_ret_aon
1504 SramCtrlRetAon = 25,
1505 /// flash_ctrl
1506 FlashCtrl = 26,
1507 /// rv_dm
1508 RvDm = 27,
1509 /// rv_plic
1510 RvPlic = 28,
1511 /// aes
1512 Aes = 29,
1513 /// hmac
1514 Hmac = 30,
1515 /// kmac
1516 Kmac = 31,
1517 /// otbn
1518 Otbn = 32,
1519 /// keymgr
1520 Keymgr = 33,
1521 /// csrng
1522 Csrng = 34,
1523 /// entropy_src
1524 EntropySrc = 35,
1525 /// edn0
1526 Edn0 = 36,
1527 /// edn1
1528 Edn1 = 37,
1529 /// sram_ctrl_main
1530 SramCtrlMain = 38,
1531 /// rom_ctrl
1532 RomCtrl = 39,
1533 /// rv_core_ibex
1534 RvCoreIbex = 40,
1535}
1536
1537/// Alert Handler Alert Source.
1538///
1539/// Enumeration of all Alert Handler Alert Sources. The alert sources belonging to
1540/// the same peripheral are guaranteed to be consecutive.
1541#[derive(Copy, Clone, PartialEq, Eq)]
1542#[repr(u32)]
1543pub enum AlertId {
1544 /// uart0_fatal_fault
1545 Uart0FatalFault = 0,
1546 /// uart1_fatal_fault
1547 Uart1FatalFault = 1,
1548 /// uart2_fatal_fault
1549 Uart2FatalFault = 2,
1550 /// uart3_fatal_fault
1551 Uart3FatalFault = 3,
1552 /// gpio_fatal_fault
1553 GpioFatalFault = 4,
1554 /// spi_device_fatal_fault
1555 SpiDeviceFatalFault = 5,
1556 /// i2c0_fatal_fault
1557 I2c0FatalFault = 6,
1558 /// i2c1_fatal_fault
1559 I2c1FatalFault = 7,
1560 /// i2c2_fatal_fault
1561 I2c2FatalFault = 8,
1562 /// pattgen_fatal_fault
1563 PattgenFatalFault = 9,
1564 /// rv_timer_fatal_fault
1565 RvTimerFatalFault = 10,
1566 /// otp_ctrl_fatal_macro_error
1567 OtpCtrlFatalMacroError = 11,
1568 /// otp_ctrl_fatal_check_error
1569 OtpCtrlFatalCheckError = 12,
1570 /// otp_ctrl_fatal_bus_integ_error
1571 OtpCtrlFatalBusIntegError = 13,
1572 /// otp_ctrl_fatal_prim_otp_alert
1573 OtpCtrlFatalPrimOtpAlert = 14,
1574 /// otp_ctrl_recov_prim_otp_alert
1575 OtpCtrlRecovPrimOtpAlert = 15,
1576 /// lc_ctrl_fatal_prog_error
1577 LcCtrlFatalProgError = 16,
1578 /// lc_ctrl_fatal_state_error
1579 LcCtrlFatalStateError = 17,
1580 /// lc_ctrl_fatal_bus_integ_error
1581 LcCtrlFatalBusIntegError = 18,
1582 /// spi_host0_fatal_fault
1583 SpiHost0FatalFault = 19,
1584 /// spi_host1_fatal_fault
1585 SpiHost1FatalFault = 20,
1586 /// usbdev_fatal_fault
1587 UsbdevFatalFault = 21,
1588 /// pwrmgr_aon_fatal_fault
1589 PwrmgrAonFatalFault = 22,
1590 /// rstmgr_aon_fatal_fault
1591 RstmgrAonFatalFault = 23,
1592 /// rstmgr_aon_fatal_cnsty_fault
1593 RstmgrAonFatalCnstyFault = 24,
1594 /// clkmgr_aon_recov_fault
1595 ClkmgrAonRecovFault = 25,
1596 /// clkmgr_aon_fatal_fault
1597 ClkmgrAonFatalFault = 26,
1598 /// sysrst_ctrl_aon_fatal_fault
1599 SysrstCtrlAonFatalFault = 27,
1600 /// adc_ctrl_aon_fatal_fault
1601 AdcCtrlAonFatalFault = 28,
1602 /// pwm_aon_fatal_fault
1603 PwmAonFatalFault = 29,
1604 /// pinmux_aon_fatal_fault
1605 PinmuxAonFatalFault = 30,
1606 /// aon_timer_aon_fatal_fault
1607 AonTimerAonFatalFault = 31,
1608 /// sensor_ctrl_recov_alert
1609 SensorCtrlRecovAlert = 32,
1610 /// sensor_ctrl_fatal_alert
1611 SensorCtrlFatalAlert = 33,
1612 /// sram_ctrl_ret_aon_fatal_error
1613 SramCtrlRetAonFatalError = 34,
1614 /// flash_ctrl_recov_err
1615 FlashCtrlRecovErr = 35,
1616 /// flash_ctrl_fatal_std_err
1617 FlashCtrlFatalStdErr = 36,
1618 /// flash_ctrl_fatal_err
1619 FlashCtrlFatalErr = 37,
1620 /// flash_ctrl_fatal_prim_flash_alert
1621 FlashCtrlFatalPrimFlashAlert = 38,
1622 /// flash_ctrl_recov_prim_flash_alert
1623 FlashCtrlRecovPrimFlashAlert = 39,
1624 /// rv_dm_fatal_fault
1625 RvDmFatalFault = 40,
1626 /// rv_plic_fatal_fault
1627 RvPlicFatalFault = 41,
1628 /// aes_recov_ctrl_update_err
1629 AesRecovCtrlUpdateErr = 42,
1630 /// aes_fatal_fault
1631 AesFatalFault = 43,
1632 /// hmac_fatal_fault
1633 HmacFatalFault = 44,
1634 /// kmac_recov_operation_err
1635 KmacRecovOperationErr = 45,
1636 /// kmac_fatal_fault_err
1637 KmacFatalFaultErr = 46,
1638 /// otbn_fatal
1639 OtbnFatal = 47,
1640 /// otbn_recov
1641 OtbnRecov = 48,
1642 /// keymgr_recov_operation_err
1643 KeymgrRecovOperationErr = 49,
1644 /// keymgr_fatal_fault_err
1645 KeymgrFatalFaultErr = 50,
1646 /// csrng_recov_alert
1647 CsrngRecovAlert = 51,
1648 /// csrng_fatal_alert
1649 CsrngFatalAlert = 52,
1650 /// entropy_src_recov_alert
1651 EntropySrcRecovAlert = 53,
1652 /// entropy_src_fatal_alert
1653 EntropySrcFatalAlert = 54,
1654 /// edn0_recov_alert
1655 Edn0RecovAlert = 55,
1656 /// edn0_fatal_alert
1657 Edn0FatalAlert = 56,
1658 /// edn1_recov_alert
1659 Edn1RecovAlert = 57,
1660 /// edn1_fatal_alert
1661 Edn1FatalAlert = 58,
1662 /// sram_ctrl_main_fatal_error
1663 SramCtrlMainFatalError = 59,
1664 /// rom_ctrl_fatal
1665 RomCtrlFatal = 60,
1666 /// rv_core_ibex_fatal_sw_err
1667 RvCoreIbexFatalSwErr = 61,
1668 /// rv_core_ibex_recov_sw_err
1669 RvCoreIbexRecovSwErr = 62,
1670 /// rv_core_ibex_fatal_hw_err
1671 RvCoreIbexFatalHwErr = 63,
1672 /// rv_core_ibex_recov_hw_err
1673 RvCoreIbexRecovHwErr = 64,
1674}
1675
1676impl TryFrom<u32> for AlertId {
1677 type Error = u32;
1678 fn try_from(val: u32) -> Result<Self, Self::Error> {
1679 match val {
1680 0 => Ok(Self::Uart0FatalFault),
1681 1 => Ok(Self::Uart1FatalFault),
1682 2 => Ok(Self::Uart2FatalFault),
1683 3 => Ok(Self::Uart3FatalFault),
1684 4 => Ok(Self::GpioFatalFault),
1685 5 => Ok(Self::SpiDeviceFatalFault),
1686 6 => Ok(Self::I2c0FatalFault),
1687 7 => Ok(Self::I2c1FatalFault),
1688 8 => Ok(Self::I2c2FatalFault),
1689 9 => Ok(Self::PattgenFatalFault),
1690 10 => Ok(Self::RvTimerFatalFault),
1691 11 => Ok(Self::OtpCtrlFatalMacroError),
1692 12 => Ok(Self::OtpCtrlFatalCheckError),
1693 13 => Ok(Self::OtpCtrlFatalBusIntegError),
1694 14 => Ok(Self::OtpCtrlFatalPrimOtpAlert),
1695 15 => Ok(Self::OtpCtrlRecovPrimOtpAlert),
1696 16 => Ok(Self::LcCtrlFatalProgError),
1697 17 => Ok(Self::LcCtrlFatalStateError),
1698 18 => Ok(Self::LcCtrlFatalBusIntegError),
1699 19 => Ok(Self::SpiHost0FatalFault),
1700 20 => Ok(Self::SpiHost1FatalFault),
1701 21 => Ok(Self::UsbdevFatalFault),
1702 22 => Ok(Self::PwrmgrAonFatalFault),
1703 23 => Ok(Self::RstmgrAonFatalFault),
1704 24 => Ok(Self::RstmgrAonFatalCnstyFault),
1705 25 => Ok(Self::ClkmgrAonRecovFault),
1706 26 => Ok(Self::ClkmgrAonFatalFault),
1707 27 => Ok(Self::SysrstCtrlAonFatalFault),
1708 28 => Ok(Self::AdcCtrlAonFatalFault),
1709 29 => Ok(Self::PwmAonFatalFault),
1710 30 => Ok(Self::PinmuxAonFatalFault),
1711 31 => Ok(Self::AonTimerAonFatalFault),
1712 32 => Ok(Self::SensorCtrlRecovAlert),
1713 33 => Ok(Self::SensorCtrlFatalAlert),
1714 34 => Ok(Self::SramCtrlRetAonFatalError),
1715 35 => Ok(Self::FlashCtrlRecovErr),
1716 36 => Ok(Self::FlashCtrlFatalStdErr),
1717 37 => Ok(Self::FlashCtrlFatalErr),
1718 38 => Ok(Self::FlashCtrlFatalPrimFlashAlert),
1719 39 => Ok(Self::FlashCtrlRecovPrimFlashAlert),
1720 40 => Ok(Self::RvDmFatalFault),
1721 41 => Ok(Self::RvPlicFatalFault),
1722 42 => Ok(Self::AesRecovCtrlUpdateErr),
1723 43 => Ok(Self::AesFatalFault),
1724 44 => Ok(Self::HmacFatalFault),
1725 45 => Ok(Self::KmacRecovOperationErr),
1726 46 => Ok(Self::KmacFatalFaultErr),
1727 47 => Ok(Self::OtbnFatal),
1728 48 => Ok(Self::OtbnRecov),
1729 49 => Ok(Self::KeymgrRecovOperationErr),
1730 50 => Ok(Self::KeymgrFatalFaultErr),
1731 51 => Ok(Self::CsrngRecovAlert),
1732 52 => Ok(Self::CsrngFatalAlert),
1733 53 => Ok(Self::EntropySrcRecovAlert),
1734 54 => Ok(Self::EntropySrcFatalAlert),
1735 55 => Ok(Self::Edn0RecovAlert),
1736 56 => Ok(Self::Edn0FatalAlert),
1737 57 => Ok(Self::Edn1RecovAlert),
1738 58 => Ok(Self::Edn1FatalAlert),
1739 59 => Ok(Self::SramCtrlMainFatalError),
1740 60 => Ok(Self::RomCtrlFatal),
1741 61 => Ok(Self::RvCoreIbexFatalSwErr),
1742 62 => Ok(Self::RvCoreIbexRecovSwErr),
1743 63 => Ok(Self::RvCoreIbexFatalHwErr),
1744 64 => Ok(Self::RvCoreIbexRecovHwErr),
1745 _ => Err(val),
1746 }
1747 }
1748}
1749
1750/// PLIC Interrupt Source to Peripheral Map
1751///
1752/// This array is a mapping from `PlicIrqId` to
1753/// `PlicPeripheral`.
1754pub const PLIC_INTERRUPT_FOR_PERIPHERAL: [PlicPeripheral; 185] = [
1755 // None -> PlicPeripheral::Unknown
1756 PlicPeripheral::Unknown,
1757 // Uart0TxWatermark -> PlicPeripheral::Uart0
1758 PlicPeripheral::Uart0,
1759 // Uart0RxWatermark -> PlicPeripheral::Uart0
1760 PlicPeripheral::Uart0,
1761 // Uart0TxEmpty -> PlicPeripheral::Uart0
1762 PlicPeripheral::Uart0,
1763 // Uart0RxOverflow -> PlicPeripheral::Uart0
1764 PlicPeripheral::Uart0,
1765 // Uart0RxFrameErr -> PlicPeripheral::Uart0
1766 PlicPeripheral::Uart0,
1767 // Uart0RxBreakErr -> PlicPeripheral::Uart0
1768 PlicPeripheral::Uart0,
1769 // Uart0RxTimeout -> PlicPeripheral::Uart0
1770 PlicPeripheral::Uart0,
1771 // Uart0RxParityErr -> PlicPeripheral::Uart0
1772 PlicPeripheral::Uart0,
1773 // Uart1TxWatermark -> PlicPeripheral::Uart1
1774 PlicPeripheral::Uart1,
1775 // Uart1RxWatermark -> PlicPeripheral::Uart1
1776 PlicPeripheral::Uart1,
1777 // Uart1TxEmpty -> PlicPeripheral::Uart1
1778 PlicPeripheral::Uart1,
1779 // Uart1RxOverflow -> PlicPeripheral::Uart1
1780 PlicPeripheral::Uart1,
1781 // Uart1RxFrameErr -> PlicPeripheral::Uart1
1782 PlicPeripheral::Uart1,
1783 // Uart1RxBreakErr -> PlicPeripheral::Uart1
1784 PlicPeripheral::Uart1,
1785 // Uart1RxTimeout -> PlicPeripheral::Uart1
1786 PlicPeripheral::Uart1,
1787 // Uart1RxParityErr -> PlicPeripheral::Uart1
1788 PlicPeripheral::Uart1,
1789 // Uart2TxWatermark -> PlicPeripheral::Uart2
1790 PlicPeripheral::Uart2,
1791 // Uart2RxWatermark -> PlicPeripheral::Uart2
1792 PlicPeripheral::Uart2,
1793 // Uart2TxEmpty -> PlicPeripheral::Uart2
1794 PlicPeripheral::Uart2,
1795 // Uart2RxOverflow -> PlicPeripheral::Uart2
1796 PlicPeripheral::Uart2,
1797 // Uart2RxFrameErr -> PlicPeripheral::Uart2
1798 PlicPeripheral::Uart2,
1799 // Uart2RxBreakErr -> PlicPeripheral::Uart2
1800 PlicPeripheral::Uart2,
1801 // Uart2RxTimeout -> PlicPeripheral::Uart2
1802 PlicPeripheral::Uart2,
1803 // Uart2RxParityErr -> PlicPeripheral::Uart2
1804 PlicPeripheral::Uart2,
1805 // Uart3TxWatermark -> PlicPeripheral::Uart3
1806 PlicPeripheral::Uart3,
1807 // Uart3RxWatermark -> PlicPeripheral::Uart3
1808 PlicPeripheral::Uart3,
1809 // Uart3TxEmpty -> PlicPeripheral::Uart3
1810 PlicPeripheral::Uart3,
1811 // Uart3RxOverflow -> PlicPeripheral::Uart3
1812 PlicPeripheral::Uart3,
1813 // Uart3RxFrameErr -> PlicPeripheral::Uart3
1814 PlicPeripheral::Uart3,
1815 // Uart3RxBreakErr -> PlicPeripheral::Uart3
1816 PlicPeripheral::Uart3,
1817 // Uart3RxTimeout -> PlicPeripheral::Uart3
1818 PlicPeripheral::Uart3,
1819 // Uart3RxParityErr -> PlicPeripheral::Uart3
1820 PlicPeripheral::Uart3,
1821 // GpioGpio0 -> PlicPeripheral::Gpio
1822 PlicPeripheral::Gpio,
1823 // GpioGpio1 -> PlicPeripheral::Gpio
1824 PlicPeripheral::Gpio,
1825 // GpioGpio2 -> PlicPeripheral::Gpio
1826 PlicPeripheral::Gpio,
1827 // GpioGpio3 -> PlicPeripheral::Gpio
1828 PlicPeripheral::Gpio,
1829 // GpioGpio4 -> PlicPeripheral::Gpio
1830 PlicPeripheral::Gpio,
1831 // GpioGpio5 -> PlicPeripheral::Gpio
1832 PlicPeripheral::Gpio,
1833 // GpioGpio6 -> PlicPeripheral::Gpio
1834 PlicPeripheral::Gpio,
1835 // GpioGpio7 -> PlicPeripheral::Gpio
1836 PlicPeripheral::Gpio,
1837 // GpioGpio8 -> PlicPeripheral::Gpio
1838 PlicPeripheral::Gpio,
1839 // GpioGpio9 -> PlicPeripheral::Gpio
1840 PlicPeripheral::Gpio,
1841 // GpioGpio10 -> PlicPeripheral::Gpio
1842 PlicPeripheral::Gpio,
1843 // GpioGpio11 -> PlicPeripheral::Gpio
1844 PlicPeripheral::Gpio,
1845 // GpioGpio12 -> PlicPeripheral::Gpio
1846 PlicPeripheral::Gpio,
1847 // GpioGpio13 -> PlicPeripheral::Gpio
1848 PlicPeripheral::Gpio,
1849 // GpioGpio14 -> PlicPeripheral::Gpio
1850 PlicPeripheral::Gpio,
1851 // GpioGpio15 -> PlicPeripheral::Gpio
1852 PlicPeripheral::Gpio,
1853 // GpioGpio16 -> PlicPeripheral::Gpio
1854 PlicPeripheral::Gpio,
1855 // GpioGpio17 -> PlicPeripheral::Gpio
1856 PlicPeripheral::Gpio,
1857 // GpioGpio18 -> PlicPeripheral::Gpio
1858 PlicPeripheral::Gpio,
1859 // GpioGpio19 -> PlicPeripheral::Gpio
1860 PlicPeripheral::Gpio,
1861 // GpioGpio20 -> PlicPeripheral::Gpio
1862 PlicPeripheral::Gpio,
1863 // GpioGpio21 -> PlicPeripheral::Gpio
1864 PlicPeripheral::Gpio,
1865 // GpioGpio22 -> PlicPeripheral::Gpio
1866 PlicPeripheral::Gpio,
1867 // GpioGpio23 -> PlicPeripheral::Gpio
1868 PlicPeripheral::Gpio,
1869 // GpioGpio24 -> PlicPeripheral::Gpio
1870 PlicPeripheral::Gpio,
1871 // GpioGpio25 -> PlicPeripheral::Gpio
1872 PlicPeripheral::Gpio,
1873 // GpioGpio26 -> PlicPeripheral::Gpio
1874 PlicPeripheral::Gpio,
1875 // GpioGpio27 -> PlicPeripheral::Gpio
1876 PlicPeripheral::Gpio,
1877 // GpioGpio28 -> PlicPeripheral::Gpio
1878 PlicPeripheral::Gpio,
1879 // GpioGpio29 -> PlicPeripheral::Gpio
1880 PlicPeripheral::Gpio,
1881 // GpioGpio30 -> PlicPeripheral::Gpio
1882 PlicPeripheral::Gpio,
1883 // GpioGpio31 -> PlicPeripheral::Gpio
1884 PlicPeripheral::Gpio,
1885 // SpiDeviceGenericRxFull -> PlicPeripheral::SpiDevice
1886 PlicPeripheral::SpiDevice,
1887 // SpiDeviceGenericRxWatermark -> PlicPeripheral::SpiDevice
1888 PlicPeripheral::SpiDevice,
1889 // SpiDeviceGenericTxWatermark -> PlicPeripheral::SpiDevice
1890 PlicPeripheral::SpiDevice,
1891 // SpiDeviceGenericRxError -> PlicPeripheral::SpiDevice
1892 PlicPeripheral::SpiDevice,
1893 // SpiDeviceGenericRxOverflow -> PlicPeripheral::SpiDevice
1894 PlicPeripheral::SpiDevice,
1895 // SpiDeviceGenericTxUnderflow -> PlicPeripheral::SpiDevice
1896 PlicPeripheral::SpiDevice,
1897 // SpiDeviceUploadCmdfifoNotEmpty -> PlicPeripheral::SpiDevice
1898 PlicPeripheral::SpiDevice,
1899 // SpiDeviceUploadPayloadNotEmpty -> PlicPeripheral::SpiDevice
1900 PlicPeripheral::SpiDevice,
1901 // SpiDeviceUploadPayloadOverflow -> PlicPeripheral::SpiDevice
1902 PlicPeripheral::SpiDevice,
1903 // SpiDeviceReadbufWatermark -> PlicPeripheral::SpiDevice
1904 PlicPeripheral::SpiDevice,
1905 // SpiDeviceReadbufFlip -> PlicPeripheral::SpiDevice
1906 PlicPeripheral::SpiDevice,
1907 // SpiDeviceTpmHeaderNotEmpty -> PlicPeripheral::SpiDevice
1908 PlicPeripheral::SpiDevice,
1909 // I2c0FmtThreshold -> PlicPeripheral::I2c0
1910 PlicPeripheral::I2c0,
1911 // I2c0RxThreshold -> PlicPeripheral::I2c0
1912 PlicPeripheral::I2c0,
1913 // I2c0FmtOverflow -> PlicPeripheral::I2c0
1914 PlicPeripheral::I2c0,
1915 // I2c0RxOverflow -> PlicPeripheral::I2c0
1916 PlicPeripheral::I2c0,
1917 // I2c0Nak -> PlicPeripheral::I2c0
1918 PlicPeripheral::I2c0,
1919 // I2c0SclInterference -> PlicPeripheral::I2c0
1920 PlicPeripheral::I2c0,
1921 // I2c0SdaInterference -> PlicPeripheral::I2c0
1922 PlicPeripheral::I2c0,
1923 // I2c0StretchTimeout -> PlicPeripheral::I2c0
1924 PlicPeripheral::I2c0,
1925 // I2c0SdaUnstable -> PlicPeripheral::I2c0
1926 PlicPeripheral::I2c0,
1927 // I2c0CmdComplete -> PlicPeripheral::I2c0
1928 PlicPeripheral::I2c0,
1929 // I2c0TxStretch -> PlicPeripheral::I2c0
1930 PlicPeripheral::I2c0,
1931 // I2c0TxOverflow -> PlicPeripheral::I2c0
1932 PlicPeripheral::I2c0,
1933 // I2c0AcqFull -> PlicPeripheral::I2c0
1934 PlicPeripheral::I2c0,
1935 // I2c0UnexpStop -> PlicPeripheral::I2c0
1936 PlicPeripheral::I2c0,
1937 // I2c0HostTimeout -> PlicPeripheral::I2c0
1938 PlicPeripheral::I2c0,
1939 // I2c1FmtThreshold -> PlicPeripheral::I2c1
1940 PlicPeripheral::I2c1,
1941 // I2c1RxThreshold -> PlicPeripheral::I2c1
1942 PlicPeripheral::I2c1,
1943 // I2c1FmtOverflow -> PlicPeripheral::I2c1
1944 PlicPeripheral::I2c1,
1945 // I2c1RxOverflow -> PlicPeripheral::I2c1
1946 PlicPeripheral::I2c1,
1947 // I2c1Nak -> PlicPeripheral::I2c1
1948 PlicPeripheral::I2c1,
1949 // I2c1SclInterference -> PlicPeripheral::I2c1
1950 PlicPeripheral::I2c1,
1951 // I2c1SdaInterference -> PlicPeripheral::I2c1
1952 PlicPeripheral::I2c1,
1953 // I2c1StretchTimeout -> PlicPeripheral::I2c1
1954 PlicPeripheral::I2c1,
1955 // I2c1SdaUnstable -> PlicPeripheral::I2c1
1956 PlicPeripheral::I2c1,
1957 // I2c1CmdComplete -> PlicPeripheral::I2c1
1958 PlicPeripheral::I2c1,
1959 // I2c1TxStretch -> PlicPeripheral::I2c1
1960 PlicPeripheral::I2c1,
1961 // I2c1TxOverflow -> PlicPeripheral::I2c1
1962 PlicPeripheral::I2c1,
1963 // I2c1AcqFull -> PlicPeripheral::I2c1
1964 PlicPeripheral::I2c1,
1965 // I2c1UnexpStop -> PlicPeripheral::I2c1
1966 PlicPeripheral::I2c1,
1967 // I2c1HostTimeout -> PlicPeripheral::I2c1
1968 PlicPeripheral::I2c1,
1969 // I2c2FmtThreshold -> PlicPeripheral::I2c2
1970 PlicPeripheral::I2c2,
1971 // I2c2RxThreshold -> PlicPeripheral::I2c2
1972 PlicPeripheral::I2c2,
1973 // I2c2FmtOverflow -> PlicPeripheral::I2c2
1974 PlicPeripheral::I2c2,
1975 // I2c2RxOverflow -> PlicPeripheral::I2c2
1976 PlicPeripheral::I2c2,
1977 // I2c2Nak -> PlicPeripheral::I2c2
1978 PlicPeripheral::I2c2,
1979 // I2c2SclInterference -> PlicPeripheral::I2c2
1980 PlicPeripheral::I2c2,
1981 // I2c2SdaInterference -> PlicPeripheral::I2c2
1982 PlicPeripheral::I2c2,
1983 // I2c2StretchTimeout -> PlicPeripheral::I2c2
1984 PlicPeripheral::I2c2,
1985 // I2c2SdaUnstable -> PlicPeripheral::I2c2
1986 PlicPeripheral::I2c2,
1987 // I2c2CmdComplete -> PlicPeripheral::I2c2
1988 PlicPeripheral::I2c2,
1989 // I2c2TxStretch -> PlicPeripheral::I2c2
1990 PlicPeripheral::I2c2,
1991 // I2c2TxOverflow -> PlicPeripheral::I2c2
1992 PlicPeripheral::I2c2,
1993 // I2c2AcqFull -> PlicPeripheral::I2c2
1994 PlicPeripheral::I2c2,
1995 // I2c2UnexpStop -> PlicPeripheral::I2c2
1996 PlicPeripheral::I2c2,
1997 // I2c2HostTimeout -> PlicPeripheral::I2c2
1998 PlicPeripheral::I2c2,
1999 // PattgenDoneCh0 -> PlicPeripheral::Pattgen
2000 PlicPeripheral::Pattgen,
2001 // PattgenDoneCh1 -> PlicPeripheral::Pattgen
2002 PlicPeripheral::Pattgen,
2003 // RvTimerTimerExpiredHart0Timer0 -> PlicPeripheral::RvTimer
2004 PlicPeripheral::RvTimer,
2005 // OtpCtrlOtpOperationDone -> PlicPeripheral::OtpCtrl
2006 PlicPeripheral::OtpCtrl,
2007 // OtpCtrlOtpError -> PlicPeripheral::OtpCtrl
2008 PlicPeripheral::OtpCtrl,
2009 // AlertHandlerClassa -> PlicPeripheral::AlertHandler
2010 PlicPeripheral::AlertHandler,
2011 // AlertHandlerClassb -> PlicPeripheral::AlertHandler
2012 PlicPeripheral::AlertHandler,
2013 // AlertHandlerClassc -> PlicPeripheral::AlertHandler
2014 PlicPeripheral::AlertHandler,
2015 // AlertHandlerClassd -> PlicPeripheral::AlertHandler
2016 PlicPeripheral::AlertHandler,
2017 // SpiHost0Error -> PlicPeripheral::SpiHost0
2018 PlicPeripheral::SpiHost0,
2019 // SpiHost0SpiEvent -> PlicPeripheral::SpiHost0
2020 PlicPeripheral::SpiHost0,
2021 // SpiHost1Error -> PlicPeripheral::SpiHost1
2022 PlicPeripheral::SpiHost1,
2023 // SpiHost1SpiEvent -> PlicPeripheral::SpiHost1
2024 PlicPeripheral::SpiHost1,
2025 // UsbdevPktReceived -> PlicPeripheral::Usbdev
2026 PlicPeripheral::Usbdev,
2027 // UsbdevPktSent -> PlicPeripheral::Usbdev
2028 PlicPeripheral::Usbdev,
2029 // UsbdevDisconnected -> PlicPeripheral::Usbdev
2030 PlicPeripheral::Usbdev,
2031 // UsbdevHostLost -> PlicPeripheral::Usbdev
2032 PlicPeripheral::Usbdev,
2033 // UsbdevLinkReset -> PlicPeripheral::Usbdev
2034 PlicPeripheral::Usbdev,
2035 // UsbdevLinkSuspend -> PlicPeripheral::Usbdev
2036 PlicPeripheral::Usbdev,
2037 // UsbdevLinkResume -> PlicPeripheral::Usbdev
2038 PlicPeripheral::Usbdev,
2039 // UsbdevAvEmpty -> PlicPeripheral::Usbdev
2040 PlicPeripheral::Usbdev,
2041 // UsbdevRxFull -> PlicPeripheral::Usbdev
2042 PlicPeripheral::Usbdev,
2043 // UsbdevAvOverflow -> PlicPeripheral::Usbdev
2044 PlicPeripheral::Usbdev,
2045 // UsbdevLinkInErr -> PlicPeripheral::Usbdev
2046 PlicPeripheral::Usbdev,
2047 // UsbdevRxCrcErr -> PlicPeripheral::Usbdev
2048 PlicPeripheral::Usbdev,
2049 // UsbdevRxPidErr -> PlicPeripheral::Usbdev
2050 PlicPeripheral::Usbdev,
2051 // UsbdevRxBitstuffErr -> PlicPeripheral::Usbdev
2052 PlicPeripheral::Usbdev,
2053 // UsbdevFrame -> PlicPeripheral::Usbdev
2054 PlicPeripheral::Usbdev,
2055 // UsbdevPowered -> PlicPeripheral::Usbdev
2056 PlicPeripheral::Usbdev,
2057 // UsbdevLinkOutErr -> PlicPeripheral::Usbdev
2058 PlicPeripheral::Usbdev,
2059 // PwrmgrAonWakeup -> PlicPeripheral::PwrmgrAon
2060 PlicPeripheral::PwrmgrAon,
2061 // SysrstCtrlAonEventDetected -> PlicPeripheral::SysrstCtrlAon
2062 PlicPeripheral::SysrstCtrlAon,
2063 // AdcCtrlAonMatchDone -> PlicPeripheral::AdcCtrlAon
2064 PlicPeripheral::AdcCtrlAon,
2065 // AonTimerAonWkupTimerExpired -> PlicPeripheral::AonTimerAon
2066 PlicPeripheral::AonTimerAon,
2067 // AonTimerAonWdogTimerBark -> PlicPeripheral::AonTimerAon
2068 PlicPeripheral::AonTimerAon,
2069 // SensorCtrlIoStatusChange -> PlicPeripheral::SensorCtrl
2070 PlicPeripheral::SensorCtrl,
2071 // SensorCtrlInitStatusChange -> PlicPeripheral::SensorCtrl
2072 PlicPeripheral::SensorCtrl,
2073 // FlashCtrlProgEmpty -> PlicPeripheral::FlashCtrl
2074 PlicPeripheral::FlashCtrl,
2075 // FlashCtrlProgLvl -> PlicPeripheral::FlashCtrl
2076 PlicPeripheral::FlashCtrl,
2077 // FlashCtrlRdFull -> PlicPeripheral::FlashCtrl
2078 PlicPeripheral::FlashCtrl,
2079 // FlashCtrlRdLvl -> PlicPeripheral::FlashCtrl
2080 PlicPeripheral::FlashCtrl,
2081 // FlashCtrlOpDone -> PlicPeripheral::FlashCtrl
2082 PlicPeripheral::FlashCtrl,
2083 // FlashCtrlCorrErr -> PlicPeripheral::FlashCtrl
2084 PlicPeripheral::FlashCtrl,
2085 // HmacHmacDone -> PlicPeripheral::Hmac
2086 PlicPeripheral::Hmac,
2087 // HmacFifoEmpty -> PlicPeripheral::Hmac
2088 PlicPeripheral::Hmac,
2089 // HmacHmacErr -> PlicPeripheral::Hmac
2090 PlicPeripheral::Hmac,
2091 // KmacKmacDone -> PlicPeripheral::Kmac
2092 PlicPeripheral::Kmac,
2093 // KmacFifoEmpty -> PlicPeripheral::Kmac
2094 PlicPeripheral::Kmac,
2095 // KmacKmacErr -> PlicPeripheral::Kmac
2096 PlicPeripheral::Kmac,
2097 // OtbnDone -> PlicPeripheral::Otbn
2098 PlicPeripheral::Otbn,
2099 // KeymgrOpDone -> PlicPeripheral::Keymgr
2100 PlicPeripheral::Keymgr,
2101 // CsrngCsCmdReqDone -> PlicPeripheral::Csrng
2102 PlicPeripheral::Csrng,
2103 // CsrngCsEntropyReq -> PlicPeripheral::Csrng
2104 PlicPeripheral::Csrng,
2105 // CsrngCsHwInstExc -> PlicPeripheral::Csrng
2106 PlicPeripheral::Csrng,
2107 // CsrngCsFatalErr -> PlicPeripheral::Csrng
2108 PlicPeripheral::Csrng,
2109 // EntropySrcEsEntropyValid -> PlicPeripheral::EntropySrc
2110 PlicPeripheral::EntropySrc,
2111 // EntropySrcEsHealthTestFailed -> PlicPeripheral::EntropySrc
2112 PlicPeripheral::EntropySrc,
2113 // EntropySrcEsObserveFifoReady -> PlicPeripheral::EntropySrc
2114 PlicPeripheral::EntropySrc,
2115 // EntropySrcEsFatalErr -> PlicPeripheral::EntropySrc
2116 PlicPeripheral::EntropySrc,
2117 // Edn0EdnCmdReqDone -> PlicPeripheral::Edn0
2118 PlicPeripheral::Edn0,
2119 // Edn0EdnFatalErr -> PlicPeripheral::Edn0
2120 PlicPeripheral::Edn0,
2121 // Edn1EdnCmdReqDone -> PlicPeripheral::Edn1
2122 PlicPeripheral::Edn1,
2123 // Edn1EdnFatalErr -> PlicPeripheral::Edn1
2124 PlicPeripheral::Edn1,
2125];
2126
2127/// Alert Handler Alert Source to Peripheral Map
2128///
2129/// This array is a mapping from `AlertId` to
2130/// `AlertPeripheral`.
2131pub const ALERT_FOR_PERIPHERAL: [AlertPeripheral; 65] = [
2132 // Uart0FatalFault -> AlertPeripheral::Uart0
2133 AlertPeripheral::Uart0,
2134 // Uart1FatalFault -> AlertPeripheral::Uart1
2135 AlertPeripheral::Uart1,
2136 // Uart2FatalFault -> AlertPeripheral::Uart2
2137 AlertPeripheral::Uart2,
2138 // Uart3FatalFault -> AlertPeripheral::Uart3
2139 AlertPeripheral::Uart3,
2140 // GpioFatalFault -> AlertPeripheral::Gpio
2141 AlertPeripheral::Gpio,
2142 // SpiDeviceFatalFault -> AlertPeripheral::SpiDevice
2143 AlertPeripheral::SpiDevice,
2144 // I2c0FatalFault -> AlertPeripheral::I2c0
2145 AlertPeripheral::I2c0,
2146 // I2c1FatalFault -> AlertPeripheral::I2c1
2147 AlertPeripheral::I2c1,
2148 // I2c2FatalFault -> AlertPeripheral::I2c2
2149 AlertPeripheral::I2c2,
2150 // PattgenFatalFault -> AlertPeripheral::Pattgen
2151 AlertPeripheral::Pattgen,
2152 // RvTimerFatalFault -> AlertPeripheral::RvTimer
2153 AlertPeripheral::RvTimer,
2154 // OtpCtrlFatalMacroError -> AlertPeripheral::OtpCtrl
2155 AlertPeripheral::OtpCtrl,
2156 // OtpCtrlFatalCheckError -> AlertPeripheral::OtpCtrl
2157 AlertPeripheral::OtpCtrl,
2158 // OtpCtrlFatalBusIntegError -> AlertPeripheral::OtpCtrl
2159 AlertPeripheral::OtpCtrl,
2160 // OtpCtrlFatalPrimOtpAlert -> AlertPeripheral::OtpCtrl
2161 AlertPeripheral::OtpCtrl,
2162 // OtpCtrlRecovPrimOtpAlert -> AlertPeripheral::OtpCtrl
2163 AlertPeripheral::OtpCtrl,
2164 // LcCtrlFatalProgError -> AlertPeripheral::LcCtrl
2165 AlertPeripheral::LcCtrl,
2166 // LcCtrlFatalStateError -> AlertPeripheral::LcCtrl
2167 AlertPeripheral::LcCtrl,
2168 // LcCtrlFatalBusIntegError -> AlertPeripheral::LcCtrl
2169 AlertPeripheral::LcCtrl,
2170 // SpiHost0FatalFault -> AlertPeripheral::SpiHost0
2171 AlertPeripheral::SpiHost0,
2172 // SpiHost1FatalFault -> AlertPeripheral::SpiHost1
2173 AlertPeripheral::SpiHost1,
2174 // UsbdevFatalFault -> AlertPeripheral::Usbdev
2175 AlertPeripheral::Usbdev,
2176 // PwrmgrAonFatalFault -> AlertPeripheral::PwrmgrAon
2177 AlertPeripheral::PwrmgrAon,
2178 // RstmgrAonFatalFault -> AlertPeripheral::RstmgrAon
2179 AlertPeripheral::RstmgrAon,
2180 // RstmgrAonFatalCnstyFault -> AlertPeripheral::RstmgrAon
2181 AlertPeripheral::RstmgrAon,
2182 // ClkmgrAonRecovFault -> AlertPeripheral::ClkmgrAon
2183 AlertPeripheral::ClkmgrAon,
2184 // ClkmgrAonFatalFault -> AlertPeripheral::ClkmgrAon
2185 AlertPeripheral::ClkmgrAon,
2186 // SysrstCtrlAonFatalFault -> AlertPeripheral::SysrstCtrlAon
2187 AlertPeripheral::SysrstCtrlAon,
2188 // AdcCtrlAonFatalFault -> AlertPeripheral::AdcCtrlAon
2189 AlertPeripheral::AdcCtrlAon,
2190 // PwmAonFatalFault -> AlertPeripheral::PwmAon
2191 AlertPeripheral::PwmAon,
2192 // PinmuxAonFatalFault -> AlertPeripheral::PinmuxAon
2193 AlertPeripheral::PinmuxAon,
2194 // AonTimerAonFatalFault -> AlertPeripheral::AonTimerAon
2195 AlertPeripheral::AonTimerAon,
2196 // SensorCtrlRecovAlert -> AlertPeripheral::SensorCtrl
2197 AlertPeripheral::SensorCtrl,
2198 // SensorCtrlFatalAlert -> AlertPeripheral::SensorCtrl
2199 AlertPeripheral::SensorCtrl,
2200 // SramCtrlRetAonFatalError -> AlertPeripheral::SramCtrlRetAon
2201 AlertPeripheral::SramCtrlRetAon,
2202 // FlashCtrlRecovErr -> AlertPeripheral::FlashCtrl
2203 AlertPeripheral::FlashCtrl,
2204 // FlashCtrlFatalStdErr -> AlertPeripheral::FlashCtrl
2205 AlertPeripheral::FlashCtrl,
2206 // FlashCtrlFatalErr -> AlertPeripheral::FlashCtrl
2207 AlertPeripheral::FlashCtrl,
2208 // FlashCtrlFatalPrimFlashAlert -> AlertPeripheral::FlashCtrl
2209 AlertPeripheral::FlashCtrl,
2210 // FlashCtrlRecovPrimFlashAlert -> AlertPeripheral::FlashCtrl
2211 AlertPeripheral::FlashCtrl,
2212 // RvDmFatalFault -> AlertPeripheral::RvDm
2213 AlertPeripheral::RvDm,
2214 // RvPlicFatalFault -> AlertPeripheral::RvPlic
2215 AlertPeripheral::RvPlic,
2216 // AesRecovCtrlUpdateErr -> AlertPeripheral::Aes
2217 AlertPeripheral::Aes,
2218 // AesFatalFault -> AlertPeripheral::Aes
2219 AlertPeripheral::Aes,
2220 // HmacFatalFault -> AlertPeripheral::Hmac
2221 AlertPeripheral::Hmac,
2222 // KmacRecovOperationErr -> AlertPeripheral::Kmac
2223 AlertPeripheral::Kmac,
2224 // KmacFatalFaultErr -> AlertPeripheral::Kmac
2225 AlertPeripheral::Kmac,
2226 // OtbnFatal -> AlertPeripheral::Otbn
2227 AlertPeripheral::Otbn,
2228 // OtbnRecov -> AlertPeripheral::Otbn
2229 AlertPeripheral::Otbn,
2230 // KeymgrRecovOperationErr -> AlertPeripheral::Keymgr
2231 AlertPeripheral::Keymgr,
2232 // KeymgrFatalFaultErr -> AlertPeripheral::Keymgr
2233 AlertPeripheral::Keymgr,
2234 // CsrngRecovAlert -> AlertPeripheral::Csrng
2235 AlertPeripheral::Csrng,
2236 // CsrngFatalAlert -> AlertPeripheral::Csrng
2237 AlertPeripheral::Csrng,
2238 // EntropySrcRecovAlert -> AlertPeripheral::EntropySrc
2239 AlertPeripheral::EntropySrc,
2240 // EntropySrcFatalAlert -> AlertPeripheral::EntropySrc
2241 AlertPeripheral::EntropySrc,
2242 // Edn0RecovAlert -> AlertPeripheral::Edn0
2243 AlertPeripheral::Edn0,
2244 // Edn0FatalAlert -> AlertPeripheral::Edn0
2245 AlertPeripheral::Edn0,
2246 // Edn1RecovAlert -> AlertPeripheral::Edn1
2247 AlertPeripheral::Edn1,
2248 // Edn1FatalAlert -> AlertPeripheral::Edn1
2249 AlertPeripheral::Edn1,
2250 // SramCtrlMainFatalError -> AlertPeripheral::SramCtrlMain
2251 AlertPeripheral::SramCtrlMain,
2252 // RomCtrlFatal -> AlertPeripheral::RomCtrl
2253 AlertPeripheral::RomCtrl,
2254 // RvCoreIbexFatalSwErr -> AlertPeripheral::RvCoreIbex
2255 AlertPeripheral::RvCoreIbex,
2256 // RvCoreIbexRecovSwErr -> AlertPeripheral::RvCoreIbex
2257 AlertPeripheral::RvCoreIbex,
2258 // RvCoreIbexFatalHwErr -> AlertPeripheral::RvCoreIbex
2259 AlertPeripheral::RvCoreIbex,
2260 // RvCoreIbexRecovHwErr -> AlertPeripheral::RvCoreIbex
2261 AlertPeripheral::RvCoreIbex,
2262];
2263
2264// PERIPH_INSEL ranges from 0 to NUM_MIO_PADS + 2 -1}
2265// 0 and 1 are tied to value 0 and 1
2266pub const NUM_MIO_PADS: usize = 47;
2267pub const NUM_DIO_PADS: usize = 16;
2268
2269pub const PINMUX_MIO_PERIPH_INSEL_IDX_OFFSET: usize = 2;
2270pub const PINMUX_PERIPH_OUTSEL_IDX_OFFSET: usize = 3;
2271
2272/// Pinmux Peripheral Input.
2273#[derive(Copy, Clone, PartialEq, Eq)]
2274#[repr(u32)]
2275pub enum PinmuxPeripheralIn {
2276 /// Peripheral Input 0
2277 GpioGpio0 = 0,
2278 /// Peripheral Input 1
2279 GpioGpio1 = 1,
2280 /// Peripheral Input 2
2281 GpioGpio2 = 2,
2282 /// Peripheral Input 3
2283 GpioGpio3 = 3,
2284 /// Peripheral Input 4
2285 GpioGpio4 = 4,
2286 /// Peripheral Input 5
2287 GpioGpio5 = 5,
2288 /// Peripheral Input 6
2289 GpioGpio6 = 6,
2290 /// Peripheral Input 7
2291 GpioGpio7 = 7,
2292 /// Peripheral Input 8
2293 GpioGpio8 = 8,
2294 /// Peripheral Input 9
2295 GpioGpio9 = 9,
2296 /// Peripheral Input 10
2297 GpioGpio10 = 10,
2298 /// Peripheral Input 11
2299 GpioGpio11 = 11,
2300 /// Peripheral Input 12
2301 GpioGpio12 = 12,
2302 /// Peripheral Input 13
2303 GpioGpio13 = 13,
2304 /// Peripheral Input 14
2305 GpioGpio14 = 14,
2306 /// Peripheral Input 15
2307 GpioGpio15 = 15,
2308 /// Peripheral Input 16
2309 GpioGpio16 = 16,
2310 /// Peripheral Input 17
2311 GpioGpio17 = 17,
2312 /// Peripheral Input 18
2313 GpioGpio18 = 18,
2314 /// Peripheral Input 19
2315 GpioGpio19 = 19,
2316 /// Peripheral Input 20
2317 GpioGpio20 = 20,
2318 /// Peripheral Input 21
2319 GpioGpio21 = 21,
2320 /// Peripheral Input 22
2321 GpioGpio22 = 22,
2322 /// Peripheral Input 23
2323 GpioGpio23 = 23,
2324 /// Peripheral Input 24
2325 GpioGpio24 = 24,
2326 /// Peripheral Input 25
2327 GpioGpio25 = 25,
2328 /// Peripheral Input 26
2329 GpioGpio26 = 26,
2330 /// Peripheral Input 27
2331 GpioGpio27 = 27,
2332 /// Peripheral Input 28
2333 GpioGpio28 = 28,
2334 /// Peripheral Input 29
2335 GpioGpio29 = 29,
2336 /// Peripheral Input 30
2337 GpioGpio30 = 30,
2338 /// Peripheral Input 31
2339 GpioGpio31 = 31,
2340 /// Peripheral Input 32
2341 I2c0Sda = 32,
2342 /// Peripheral Input 33
2343 I2c0Scl = 33,
2344 /// Peripheral Input 34
2345 I2c1Sda = 34,
2346 /// Peripheral Input 35
2347 I2c1Scl = 35,
2348 /// Peripheral Input 36
2349 I2c2Sda = 36,
2350 /// Peripheral Input 37
2351 I2c2Scl = 37,
2352 /// Peripheral Input 38
2353 SpiHost1Sd0 = 38,
2354 /// Peripheral Input 39
2355 SpiHost1Sd1 = 39,
2356 /// Peripheral Input 40
2357 SpiHost1Sd2 = 40,
2358 /// Peripheral Input 41
2359 SpiHost1Sd3 = 41,
2360 /// Peripheral Input 42
2361 Uart0Rx = 42,
2362 /// Peripheral Input 43
2363 Uart1Rx = 43,
2364 /// Peripheral Input 44
2365 Uart2Rx = 44,
2366 /// Peripheral Input 45
2367 Uart3Rx = 45,
2368 /// Peripheral Input 46
2369 SpiDeviceTpmCsb = 46,
2370 /// Peripheral Input 47
2371 FlashCtrlTck = 47,
2372 /// Peripheral Input 48
2373 FlashCtrlTms = 48,
2374 /// Peripheral Input 49
2375 FlashCtrlTdi = 49,
2376 /// Peripheral Input 50
2377 SysrstCtrlAonAcPresent = 50,
2378 /// Peripheral Input 51
2379 SysrstCtrlAonKey0In = 51,
2380 /// Peripheral Input 52
2381 SysrstCtrlAonKey1In = 52,
2382 /// Peripheral Input 53
2383 SysrstCtrlAonKey2In = 53,
2384 /// Peripheral Input 54
2385 SysrstCtrlAonPwrbIn = 54,
2386 /// Peripheral Input 55
2387 SysrstCtrlAonLidOpen = 55,
2388 /// Peripheral Input 56
2389 UsbdevSense = 56,
2390}
2391
2392impl TryFrom<u32> for PinmuxPeripheralIn {
2393 type Error = u32;
2394 fn try_from(val: u32) -> Result<Self, Self::Error> {
2395 match val {
2396 0 => Ok(Self::GpioGpio0),
2397 1 => Ok(Self::GpioGpio1),
2398 2 => Ok(Self::GpioGpio2),
2399 3 => Ok(Self::GpioGpio3),
2400 4 => Ok(Self::GpioGpio4),
2401 5 => Ok(Self::GpioGpio5),
2402 6 => Ok(Self::GpioGpio6),
2403 7 => Ok(Self::GpioGpio7),
2404 8 => Ok(Self::GpioGpio8),
2405 9 => Ok(Self::GpioGpio9),
2406 10 => Ok(Self::GpioGpio10),
2407 11 => Ok(Self::GpioGpio11),
2408 12 => Ok(Self::GpioGpio12),
2409 13 => Ok(Self::GpioGpio13),
2410 14 => Ok(Self::GpioGpio14),
2411 15 => Ok(Self::GpioGpio15),
2412 16 => Ok(Self::GpioGpio16),
2413 17 => Ok(Self::GpioGpio17),
2414 18 => Ok(Self::GpioGpio18),
2415 19 => Ok(Self::GpioGpio19),
2416 20 => Ok(Self::GpioGpio20),
2417 21 => Ok(Self::GpioGpio21),
2418 22 => Ok(Self::GpioGpio22),
2419 23 => Ok(Self::GpioGpio23),
2420 24 => Ok(Self::GpioGpio24),
2421 25 => Ok(Self::GpioGpio25),
2422 26 => Ok(Self::GpioGpio26),
2423 27 => Ok(Self::GpioGpio27),
2424 28 => Ok(Self::GpioGpio28),
2425 29 => Ok(Self::GpioGpio29),
2426 30 => Ok(Self::GpioGpio30),
2427 31 => Ok(Self::GpioGpio31),
2428 32 => Ok(Self::I2c0Sda),
2429 33 => Ok(Self::I2c0Scl),
2430 34 => Ok(Self::I2c1Sda),
2431 35 => Ok(Self::I2c1Scl),
2432 36 => Ok(Self::I2c2Sda),
2433 37 => Ok(Self::I2c2Scl),
2434 38 => Ok(Self::SpiHost1Sd0),
2435 39 => Ok(Self::SpiHost1Sd1),
2436 40 => Ok(Self::SpiHost1Sd2),
2437 41 => Ok(Self::SpiHost1Sd3),
2438 42 => Ok(Self::Uart0Rx),
2439 43 => Ok(Self::Uart1Rx),
2440 44 => Ok(Self::Uart2Rx),
2441 45 => Ok(Self::Uart3Rx),
2442 46 => Ok(Self::SpiDeviceTpmCsb),
2443 47 => Ok(Self::FlashCtrlTck),
2444 48 => Ok(Self::FlashCtrlTms),
2445 49 => Ok(Self::FlashCtrlTdi),
2446 50 => Ok(Self::SysrstCtrlAonAcPresent),
2447 51 => Ok(Self::SysrstCtrlAonKey0In),
2448 52 => Ok(Self::SysrstCtrlAonKey1In),
2449 53 => Ok(Self::SysrstCtrlAonKey2In),
2450 54 => Ok(Self::SysrstCtrlAonPwrbIn),
2451 55 => Ok(Self::SysrstCtrlAonLidOpen),
2452 56 => Ok(Self::UsbdevSense),
2453 _ => Err(val),
2454 }
2455 }
2456}
2457
2458/// Pinmux MIO Input Selector.
2459#[derive(Copy, Clone, PartialEq, Eq)]
2460#[repr(u32)]
2461pub enum PinmuxInsel {
2462 /// Tie constantly to zero
2463 ConstantZero = 0,
2464 /// Tie constantly to one
2465 ConstantOne = 1,
2466 /// MIO Pad 0
2467 Ioa0 = 2,
2468 /// MIO Pad 1
2469 Ioa1 = 3,
2470 /// MIO Pad 2
2471 Ioa2 = 4,
2472 /// MIO Pad 3
2473 Ioa3 = 5,
2474 /// MIO Pad 4
2475 Ioa4 = 6,
2476 /// MIO Pad 5
2477 Ioa5 = 7,
2478 /// MIO Pad 6
2479 Ioa6 = 8,
2480 /// MIO Pad 7
2481 Ioa7 = 9,
2482 /// MIO Pad 8
2483 Ioa8 = 10,
2484 /// MIO Pad 9
2485 Iob0 = 11,
2486 /// MIO Pad 10
2487 Iob1 = 12,
2488 /// MIO Pad 11
2489 Iob2 = 13,
2490 /// MIO Pad 12
2491 Iob3 = 14,
2492 /// MIO Pad 13
2493 Iob4 = 15,
2494 /// MIO Pad 14
2495 Iob5 = 16,
2496 /// MIO Pad 15
2497 Iob6 = 17,
2498 /// MIO Pad 16
2499 Iob7 = 18,
2500 /// MIO Pad 17
2501 Iob8 = 19,
2502 /// MIO Pad 18
2503 Iob9 = 20,
2504 /// MIO Pad 19
2505 Iob10 = 21,
2506 /// MIO Pad 20
2507 Iob11 = 22,
2508 /// MIO Pad 21
2509 Iob12 = 23,
2510 /// MIO Pad 22
2511 Ioc0 = 24,
2512 /// MIO Pad 23
2513 Ioc1 = 25,
2514 /// MIO Pad 24
2515 Ioc2 = 26,
2516 /// MIO Pad 25
2517 Ioc3 = 27,
2518 /// MIO Pad 26
2519 Ioc4 = 28,
2520 /// MIO Pad 27
2521 Ioc5 = 29,
2522 /// MIO Pad 28
2523 Ioc6 = 30,
2524 /// MIO Pad 29
2525 Ioc7 = 31,
2526 /// MIO Pad 30
2527 Ioc8 = 32,
2528 /// MIO Pad 31
2529 Ioc9 = 33,
2530 /// MIO Pad 32
2531 Ioc10 = 34,
2532 /// MIO Pad 33
2533 Ioc11 = 35,
2534 /// MIO Pad 34
2535 Ioc12 = 36,
2536 /// MIO Pad 35
2537 Ior0 = 37,
2538 /// MIO Pad 36
2539 Ior1 = 38,
2540 /// MIO Pad 37
2541 Ior2 = 39,
2542 /// MIO Pad 38
2543 Ior3 = 40,
2544 /// MIO Pad 39
2545 Ior4 = 41,
2546 /// MIO Pad 40
2547 Ior5 = 42,
2548 /// MIO Pad 41
2549 Ior6 = 43,
2550 /// MIO Pad 42
2551 Ior7 = 44,
2552 /// MIO Pad 43
2553 Ior10 = 45,
2554 /// MIO Pad 44
2555 Ior11 = 46,
2556 /// MIO Pad 45
2557 Ior12 = 47,
2558 /// MIO Pad 46
2559 Ior13 = 48,
2560}
2561
2562impl TryFrom<u32> for PinmuxInsel {
2563 type Error = u32;
2564 fn try_from(val: u32) -> Result<Self, Self::Error> {
2565 match val {
2566 0 => Ok(Self::ConstantZero),
2567 1 => Ok(Self::ConstantOne),
2568 2 => Ok(Self::Ioa0),
2569 3 => Ok(Self::Ioa1),
2570 4 => Ok(Self::Ioa2),
2571 5 => Ok(Self::Ioa3),
2572 6 => Ok(Self::Ioa4),
2573 7 => Ok(Self::Ioa5),
2574 8 => Ok(Self::Ioa6),
2575 9 => Ok(Self::Ioa7),
2576 10 => Ok(Self::Ioa8),
2577 11 => Ok(Self::Iob0),
2578 12 => Ok(Self::Iob1),
2579 13 => Ok(Self::Iob2),
2580 14 => Ok(Self::Iob3),
2581 15 => Ok(Self::Iob4),
2582 16 => Ok(Self::Iob5),
2583 17 => Ok(Self::Iob6),
2584 18 => Ok(Self::Iob7),
2585 19 => Ok(Self::Iob8),
2586 20 => Ok(Self::Iob9),
2587 21 => Ok(Self::Iob10),
2588 22 => Ok(Self::Iob11),
2589 23 => Ok(Self::Iob12),
2590 24 => Ok(Self::Ioc0),
2591 25 => Ok(Self::Ioc1),
2592 26 => Ok(Self::Ioc2),
2593 27 => Ok(Self::Ioc3),
2594 28 => Ok(Self::Ioc4),
2595 29 => Ok(Self::Ioc5),
2596 30 => Ok(Self::Ioc6),
2597 31 => Ok(Self::Ioc7),
2598 32 => Ok(Self::Ioc8),
2599 33 => Ok(Self::Ioc9),
2600 34 => Ok(Self::Ioc10),
2601 35 => Ok(Self::Ioc11),
2602 36 => Ok(Self::Ioc12),
2603 37 => Ok(Self::Ior0),
2604 38 => Ok(Self::Ior1),
2605 39 => Ok(Self::Ior2),
2606 40 => Ok(Self::Ior3),
2607 41 => Ok(Self::Ior4),
2608 42 => Ok(Self::Ior5),
2609 43 => Ok(Self::Ior6),
2610 44 => Ok(Self::Ior7),
2611 45 => Ok(Self::Ior10),
2612 46 => Ok(Self::Ior11),
2613 47 => Ok(Self::Ior12),
2614 48 => Ok(Self::Ior13),
2615 _ => Err(val),
2616 }
2617 }
2618}
2619
2620/// Pinmux MIO Output.
2621#[derive(Copy, Clone, PartialEq, Eq)]
2622#[repr(u32)]
2623pub enum PinmuxMioOut {
2624 /// MIO Pad 0
2625 Ioa0 = 0,
2626 /// MIO Pad 1
2627 Ioa1 = 1,
2628 /// MIO Pad 2
2629 Ioa2 = 2,
2630 /// MIO Pad 3
2631 Ioa3 = 3,
2632 /// MIO Pad 4
2633 Ioa4 = 4,
2634 /// MIO Pad 5
2635 Ioa5 = 5,
2636 /// MIO Pad 6
2637 Ioa6 = 6,
2638 /// MIO Pad 7
2639 Ioa7 = 7,
2640 /// MIO Pad 8
2641 Ioa8 = 8,
2642 /// MIO Pad 9
2643 Iob0 = 9,
2644 /// MIO Pad 10
2645 Iob1 = 10,
2646 /// MIO Pad 11
2647 Iob2 = 11,
2648 /// MIO Pad 12
2649 Iob3 = 12,
2650 /// MIO Pad 13
2651 Iob4 = 13,
2652 /// MIO Pad 14
2653 Iob5 = 14,
2654 /// MIO Pad 15
2655 Iob6 = 15,
2656 /// MIO Pad 16
2657 Iob7 = 16,
2658 /// MIO Pad 17
2659 Iob8 = 17,
2660 /// MIO Pad 18
2661 Iob9 = 18,
2662 /// MIO Pad 19
2663 Iob10 = 19,
2664 /// MIO Pad 20
2665 Iob11 = 20,
2666 /// MIO Pad 21
2667 Iob12 = 21,
2668 /// MIO Pad 22
2669 Ioc0 = 22,
2670 /// MIO Pad 23
2671 Ioc1 = 23,
2672 /// MIO Pad 24
2673 Ioc2 = 24,
2674 /// MIO Pad 25
2675 Ioc3 = 25,
2676 /// MIO Pad 26
2677 Ioc4 = 26,
2678 /// MIO Pad 27
2679 Ioc5 = 27,
2680 /// MIO Pad 28
2681 Ioc6 = 28,
2682 /// MIO Pad 29
2683 Ioc7 = 29,
2684 /// MIO Pad 30
2685 Ioc8 = 30,
2686 /// MIO Pad 31
2687 Ioc9 = 31,
2688 /// MIO Pad 32
2689 Ioc10 = 32,
2690 /// MIO Pad 33
2691 Ioc11 = 33,
2692 /// MIO Pad 34
2693 Ioc12 = 34,
2694 /// MIO Pad 35
2695 Ior0 = 35,
2696 /// MIO Pad 36
2697 Ior1 = 36,
2698 /// MIO Pad 37
2699 Ior2 = 37,
2700 /// MIO Pad 38
2701 Ior3 = 38,
2702 /// MIO Pad 39
2703 Ior4 = 39,
2704 /// MIO Pad 40
2705 Ior5 = 40,
2706 /// MIO Pad 41
2707 Ior6 = 41,
2708 /// MIO Pad 42
2709 Ior7 = 42,
2710 /// MIO Pad 43
2711 Ior10 = 43,
2712 /// MIO Pad 44
2713 Ior11 = 44,
2714 /// MIO Pad 45
2715 Ior12 = 45,
2716 /// MIO Pad 46
2717 Ior13 = 46,
2718}
2719
2720impl TryFrom<u32> for PinmuxMioOut {
2721 type Error = u32;
2722 fn try_from(val: u32) -> Result<Self, Self::Error> {
2723 match val {
2724 0 => Ok(Self::Ioa0),
2725 1 => Ok(Self::Ioa1),
2726 2 => Ok(Self::Ioa2),
2727 3 => Ok(Self::Ioa3),
2728 4 => Ok(Self::Ioa4),
2729 5 => Ok(Self::Ioa5),
2730 6 => Ok(Self::Ioa6),
2731 7 => Ok(Self::Ioa7),
2732 8 => Ok(Self::Ioa8),
2733 9 => Ok(Self::Iob0),
2734 10 => Ok(Self::Iob1),
2735 11 => Ok(Self::Iob2),
2736 12 => Ok(Self::Iob3),
2737 13 => Ok(Self::Iob4),
2738 14 => Ok(Self::Iob5),
2739 15 => Ok(Self::Iob6),
2740 16 => Ok(Self::Iob7),
2741 17 => Ok(Self::Iob8),
2742 18 => Ok(Self::Iob9),
2743 19 => Ok(Self::Iob10),
2744 20 => Ok(Self::Iob11),
2745 21 => Ok(Self::Iob12),
2746 22 => Ok(Self::Ioc0),
2747 23 => Ok(Self::Ioc1),
2748 24 => Ok(Self::Ioc2),
2749 25 => Ok(Self::Ioc3),
2750 26 => Ok(Self::Ioc4),
2751 27 => Ok(Self::Ioc5),
2752 28 => Ok(Self::Ioc6),
2753 29 => Ok(Self::Ioc7),
2754 30 => Ok(Self::Ioc8),
2755 31 => Ok(Self::Ioc9),
2756 32 => Ok(Self::Ioc10),
2757 33 => Ok(Self::Ioc11),
2758 34 => Ok(Self::Ioc12),
2759 35 => Ok(Self::Ior0),
2760 36 => Ok(Self::Ior1),
2761 37 => Ok(Self::Ior2),
2762 38 => Ok(Self::Ior3),
2763 39 => Ok(Self::Ior4),
2764 40 => Ok(Self::Ior5),
2765 41 => Ok(Self::Ior6),
2766 42 => Ok(Self::Ior7),
2767 43 => Ok(Self::Ior10),
2768 44 => Ok(Self::Ior11),
2769 45 => Ok(Self::Ior12),
2770 46 => Ok(Self::Ior13),
2771 _ => Err(val),
2772 }
2773 }
2774}
2775
2776/// Pinmux Peripheral Output Selector.
2777#[derive(Copy, Clone, PartialEq, Eq)]
2778#[repr(u32)]
2779pub enum PinmuxOutsel {
2780 /// Tie constantly to zero
2781 ConstantZero = 0,
2782 /// Tie constantly to one
2783 ConstantOne = 1,
2784 /// Tie constantly to high-Z
2785 ConstantHighZ = 2,
2786 /// Peripheral Output 0
2787 GpioGpio0 = 3,
2788 /// Peripheral Output 1
2789 GpioGpio1 = 4,
2790 /// Peripheral Output 2
2791 GpioGpio2 = 5,
2792 /// Peripheral Output 3
2793 GpioGpio3 = 6,
2794 /// Peripheral Output 4
2795 GpioGpio4 = 7,
2796 /// Peripheral Output 5
2797 GpioGpio5 = 8,
2798 /// Peripheral Output 6
2799 GpioGpio6 = 9,
2800 /// Peripheral Output 7
2801 GpioGpio7 = 10,
2802 /// Peripheral Output 8
2803 GpioGpio8 = 11,
2804 /// Peripheral Output 9
2805 GpioGpio9 = 12,
2806 /// Peripheral Output 10
2807 GpioGpio10 = 13,
2808 /// Peripheral Output 11
2809 GpioGpio11 = 14,
2810 /// Peripheral Output 12
2811 GpioGpio12 = 15,
2812 /// Peripheral Output 13
2813 GpioGpio13 = 16,
2814 /// Peripheral Output 14
2815 GpioGpio14 = 17,
2816 /// Peripheral Output 15
2817 GpioGpio15 = 18,
2818 /// Peripheral Output 16
2819 GpioGpio16 = 19,
2820 /// Peripheral Output 17
2821 GpioGpio17 = 20,
2822 /// Peripheral Output 18
2823 GpioGpio18 = 21,
2824 /// Peripheral Output 19
2825 GpioGpio19 = 22,
2826 /// Peripheral Output 20
2827 GpioGpio20 = 23,
2828 /// Peripheral Output 21
2829 GpioGpio21 = 24,
2830 /// Peripheral Output 22
2831 GpioGpio22 = 25,
2832 /// Peripheral Output 23
2833 GpioGpio23 = 26,
2834 /// Peripheral Output 24
2835 GpioGpio24 = 27,
2836 /// Peripheral Output 25
2837 GpioGpio25 = 28,
2838 /// Peripheral Output 26
2839 GpioGpio26 = 29,
2840 /// Peripheral Output 27
2841 GpioGpio27 = 30,
2842 /// Peripheral Output 28
2843 GpioGpio28 = 31,
2844 /// Peripheral Output 29
2845 GpioGpio29 = 32,
2846 /// Peripheral Output 30
2847 GpioGpio30 = 33,
2848 /// Peripheral Output 31
2849 GpioGpio31 = 34,
2850 /// Peripheral Output 32
2851 I2c0Sda = 35,
2852 /// Peripheral Output 33
2853 I2c0Scl = 36,
2854 /// Peripheral Output 34
2855 I2c1Sda = 37,
2856 /// Peripheral Output 35
2857 I2c1Scl = 38,
2858 /// Peripheral Output 36
2859 I2c2Sda = 39,
2860 /// Peripheral Output 37
2861 I2c2Scl = 40,
2862 /// Peripheral Output 38
2863 SpiHost1Sd0 = 41,
2864 /// Peripheral Output 39
2865 SpiHost1Sd1 = 42,
2866 /// Peripheral Output 40
2867 SpiHost1Sd2 = 43,
2868 /// Peripheral Output 41
2869 SpiHost1Sd3 = 44,
2870 /// Peripheral Output 42
2871 Uart0Tx = 45,
2872 /// Peripheral Output 43
2873 Uart1Tx = 46,
2874 /// Peripheral Output 44
2875 Uart2Tx = 47,
2876 /// Peripheral Output 45
2877 Uart3Tx = 48,
2878 /// Peripheral Output 46
2879 PattgenPda0Tx = 49,
2880 /// Peripheral Output 47
2881 PattgenPcl0Tx = 50,
2882 /// Peripheral Output 48
2883 PattgenPda1Tx = 51,
2884 /// Peripheral Output 49
2885 PattgenPcl1Tx = 52,
2886 /// Peripheral Output 50
2887 SpiHost1Sck = 53,
2888 /// Peripheral Output 51
2889 SpiHost1Csb = 54,
2890 /// Peripheral Output 52
2891 FlashCtrlTdo = 55,
2892 /// Peripheral Output 53
2893 SensorCtrlAstDebugOut0 = 56,
2894 /// Peripheral Output 54
2895 SensorCtrlAstDebugOut1 = 57,
2896 /// Peripheral Output 55
2897 SensorCtrlAstDebugOut2 = 58,
2898 /// Peripheral Output 56
2899 SensorCtrlAstDebugOut3 = 59,
2900 /// Peripheral Output 57
2901 SensorCtrlAstDebugOut4 = 60,
2902 /// Peripheral Output 58
2903 SensorCtrlAstDebugOut5 = 61,
2904 /// Peripheral Output 59
2905 SensorCtrlAstDebugOut6 = 62,
2906 /// Peripheral Output 60
2907 SensorCtrlAstDebugOut7 = 63,
2908 /// Peripheral Output 61
2909 SensorCtrlAstDebugOut8 = 64,
2910 /// Peripheral Output 62
2911 PwmAonPwm0 = 65,
2912 /// Peripheral Output 63
2913 PwmAonPwm1 = 66,
2914 /// Peripheral Output 64
2915 PwmAonPwm2 = 67,
2916 /// Peripheral Output 65
2917 PwmAonPwm3 = 68,
2918 /// Peripheral Output 66
2919 PwmAonPwm4 = 69,
2920 /// Peripheral Output 67
2921 PwmAonPwm5 = 70,
2922 /// Peripheral Output 68
2923 OtpCtrlTest0 = 71,
2924 /// Peripheral Output 69
2925 SysrstCtrlAonBatDisable = 72,
2926 /// Peripheral Output 70
2927 SysrstCtrlAonKey0Out = 73,
2928 /// Peripheral Output 71
2929 SysrstCtrlAonKey1Out = 74,
2930 /// Peripheral Output 72
2931 SysrstCtrlAonKey2Out = 75,
2932 /// Peripheral Output 73
2933 SysrstCtrlAonPwrbOut = 76,
2934 /// Peripheral Output 74
2935 SysrstCtrlAonZ3Wakeup = 77,
2936}
2937
2938impl TryFrom<u32> for PinmuxOutsel {
2939 type Error = u32;
2940 fn try_from(val: u32) -> Result<Self, Self::Error> {
2941 match val {
2942 0 => Ok(Self::ConstantZero),
2943 1 => Ok(Self::ConstantOne),
2944 2 => Ok(Self::ConstantHighZ),
2945 3 => Ok(Self::GpioGpio0),
2946 4 => Ok(Self::GpioGpio1),
2947 5 => Ok(Self::GpioGpio2),
2948 6 => Ok(Self::GpioGpio3),
2949 7 => Ok(Self::GpioGpio4),
2950 8 => Ok(Self::GpioGpio5),
2951 9 => Ok(Self::GpioGpio6),
2952 10 => Ok(Self::GpioGpio7),
2953 11 => Ok(Self::GpioGpio8),
2954 12 => Ok(Self::GpioGpio9),
2955 13 => Ok(Self::GpioGpio10),
2956 14 => Ok(Self::GpioGpio11),
2957 15 => Ok(Self::GpioGpio12),
2958 16 => Ok(Self::GpioGpio13),
2959 17 => Ok(Self::GpioGpio14),
2960 18 => Ok(Self::GpioGpio15),
2961 19 => Ok(Self::GpioGpio16),
2962 20 => Ok(Self::GpioGpio17),
2963 21 => Ok(Self::GpioGpio18),
2964 22 => Ok(Self::GpioGpio19),
2965 23 => Ok(Self::GpioGpio20),
2966 24 => Ok(Self::GpioGpio21),
2967 25 => Ok(Self::GpioGpio22),
2968 26 => Ok(Self::GpioGpio23),
2969 27 => Ok(Self::GpioGpio24),
2970 28 => Ok(Self::GpioGpio25),
2971 29 => Ok(Self::GpioGpio26),
2972 30 => Ok(Self::GpioGpio27),
2973 31 => Ok(Self::GpioGpio28),
2974 32 => Ok(Self::GpioGpio29),
2975 33 => Ok(Self::GpioGpio30),
2976 34 => Ok(Self::GpioGpio31),
2977 35 => Ok(Self::I2c0Sda),
2978 36 => Ok(Self::I2c0Scl),
2979 37 => Ok(Self::I2c1Sda),
2980 38 => Ok(Self::I2c1Scl),
2981 39 => Ok(Self::I2c2Sda),
2982 40 => Ok(Self::I2c2Scl),
2983 41 => Ok(Self::SpiHost1Sd0),
2984 42 => Ok(Self::SpiHost1Sd1),
2985 43 => Ok(Self::SpiHost1Sd2),
2986 44 => Ok(Self::SpiHost1Sd3),
2987 45 => Ok(Self::Uart0Tx),
2988 46 => Ok(Self::Uart1Tx),
2989 47 => Ok(Self::Uart2Tx),
2990 48 => Ok(Self::Uart3Tx),
2991 49 => Ok(Self::PattgenPda0Tx),
2992 50 => Ok(Self::PattgenPcl0Tx),
2993 51 => Ok(Self::PattgenPda1Tx),
2994 52 => Ok(Self::PattgenPcl1Tx),
2995 53 => Ok(Self::SpiHost1Sck),
2996 54 => Ok(Self::SpiHost1Csb),
2997 55 => Ok(Self::FlashCtrlTdo),
2998 56 => Ok(Self::SensorCtrlAstDebugOut0),
2999 57 => Ok(Self::SensorCtrlAstDebugOut1),
3000 58 => Ok(Self::SensorCtrlAstDebugOut2),
3001 59 => Ok(Self::SensorCtrlAstDebugOut3),
3002 60 => Ok(Self::SensorCtrlAstDebugOut4),
3003 61 => Ok(Self::SensorCtrlAstDebugOut5),
3004 62 => Ok(Self::SensorCtrlAstDebugOut6),
3005 63 => Ok(Self::SensorCtrlAstDebugOut7),
3006 64 => Ok(Self::SensorCtrlAstDebugOut8),
3007 65 => Ok(Self::PwmAonPwm0),
3008 66 => Ok(Self::PwmAonPwm1),
3009 67 => Ok(Self::PwmAonPwm2),
3010 68 => Ok(Self::PwmAonPwm3),
3011 69 => Ok(Self::PwmAonPwm4),
3012 70 => Ok(Self::PwmAonPwm5),
3013 71 => Ok(Self::OtpCtrlTest0),
3014 72 => Ok(Self::SysrstCtrlAonBatDisable),
3015 73 => Ok(Self::SysrstCtrlAonKey0Out),
3016 74 => Ok(Self::SysrstCtrlAonKey1Out),
3017 75 => Ok(Self::SysrstCtrlAonKey2Out),
3018 76 => Ok(Self::SysrstCtrlAonPwrbOut),
3019 77 => Ok(Self::SysrstCtrlAonZ3Wakeup),
3020 _ => Err(val),
3021 }
3022 }
3023}
3024
3025/// Dedicated Pad Selects
3026#[derive(Copy, Clone, PartialEq, Eq)]
3027#[repr(u32)]
3028pub enum DirectPads {
3029 UsbdevUsbDp = 0,
3030 UsbdevUsbDn = 1,
3031 SpiHost0Sd0 = 2,
3032 SpiHost0Sd1 = 3,
3033 SpiHost0Sd2 = 4,
3034 SpiHost0Sd3 = 5,
3035 SpiDeviceSd0 = 6,
3036 SpiDeviceSd1 = 7,
3037 SpiDeviceSd2 = 8,
3038 SpiDeviceSd3 = 9,
3039 SysrstCtrlAonEcRstL = 10,
3040 SysrstCtrlAonFlashWpL = 11,
3041 SpiDeviceSck = 12,
3042 SpiDeviceCsb = 13,
3043 SpiHost0Sck = 14,
3044 SpiHost0Csb = 15,
3045}
3046
3047impl TryFrom<u32> for DirectPads {
3048 type Error = u32;
3049 fn try_from(val: u32) -> Result<Self, Self::Error> {
3050 match val {
3051 0 => Ok(Self::UsbdevUsbDp),
3052 1 => Ok(Self::UsbdevUsbDn),
3053 2 => Ok(Self::SpiHost0Sd0),
3054 3 => Ok(Self::SpiHost0Sd1),
3055 4 => Ok(Self::SpiHost0Sd2),
3056 5 => Ok(Self::SpiHost0Sd3),
3057 6 => Ok(Self::SpiDeviceSd0),
3058 7 => Ok(Self::SpiDeviceSd1),
3059 8 => Ok(Self::SpiDeviceSd2),
3060 9 => Ok(Self::SpiDeviceSd3),
3061 10 => Ok(Self::SysrstCtrlAonEcRstL),
3062 11 => Ok(Self::SysrstCtrlAonFlashWpL),
3063 12 => Ok(Self::SpiDeviceSck),
3064 13 => Ok(Self::SpiDeviceCsb),
3065 14 => Ok(Self::SpiHost0Sck),
3066 15 => Ok(Self::SpiHost0Csb),
3067 _ => Err(val),
3068 }
3069 }
3070}
3071
3072/// Muxed Pad Selects
3073#[derive(Copy, Clone, PartialEq, Eq)]
3074#[repr(u32)]
3075pub enum MuxedPads {
3076 Ioa0 = 0,
3077 Ioa1 = 1,
3078 Ioa2 = 2,
3079 Ioa3 = 3,
3080 Ioa4 = 4,
3081 Ioa5 = 5,
3082 Ioa6 = 6,
3083 Ioa7 = 7,
3084 Ioa8 = 8,
3085 Iob0 = 9,
3086 Iob1 = 10,
3087 Iob2 = 11,
3088 Iob3 = 12,
3089 Iob4 = 13,
3090 Iob5 = 14,
3091 Iob6 = 15,
3092 Iob7 = 16,
3093 Iob8 = 17,
3094 Iob9 = 18,
3095 Iob10 = 19,
3096 Iob11 = 20,
3097 Iob12 = 21,
3098 Ioc0 = 22,
3099 Ioc1 = 23,
3100 Ioc2 = 24,
3101 Ioc3 = 25,
3102 Ioc4 = 26,
3103 Ioc5 = 27,
3104 Ioc6 = 28,
3105 Ioc7 = 29,
3106 Ioc8 = 30,
3107 Ioc9 = 31,
3108 Ioc10 = 32,
3109 Ioc11 = 33,
3110 Ioc12 = 34,
3111 Ior0 = 35,
3112 Ior1 = 36,
3113 Ior2 = 37,
3114 Ior3 = 38,
3115 Ior4 = 39,
3116 Ior5 = 40,
3117 Ior6 = 41,
3118 Ior7 = 42,
3119 Ior10 = 43,
3120 Ior11 = 44,
3121 Ior12 = 45,
3122 Ior13 = 46,
3123}
3124
3125impl TryFrom<u32> for MuxedPads {
3126 type Error = u32;
3127 fn try_from(val: u32) -> Result<Self, Self::Error> {
3128 match val {
3129 0 => Ok(Self::Ioa0),
3130 1 => Ok(Self::Ioa1),
3131 2 => Ok(Self::Ioa2),
3132 3 => Ok(Self::Ioa3),
3133 4 => Ok(Self::Ioa4),
3134 5 => Ok(Self::Ioa5),
3135 6 => Ok(Self::Ioa6),
3136 7 => Ok(Self::Ioa7),
3137 8 => Ok(Self::Ioa8),
3138 9 => Ok(Self::Iob0),
3139 10 => Ok(Self::Iob1),
3140 11 => Ok(Self::Iob2),
3141 12 => Ok(Self::Iob3),
3142 13 => Ok(Self::Iob4),
3143 14 => Ok(Self::Iob5),
3144 15 => Ok(Self::Iob6),
3145 16 => Ok(Self::Iob7),
3146 17 => Ok(Self::Iob8),
3147 18 => Ok(Self::Iob9),
3148 19 => Ok(Self::Iob10),
3149 20 => Ok(Self::Iob11),
3150 21 => Ok(Self::Iob12),
3151 22 => Ok(Self::Ioc0),
3152 23 => Ok(Self::Ioc1),
3153 24 => Ok(Self::Ioc2),
3154 25 => Ok(Self::Ioc3),
3155 26 => Ok(Self::Ioc4),
3156 27 => Ok(Self::Ioc5),
3157 28 => Ok(Self::Ioc6),
3158 29 => Ok(Self::Ioc7),
3159 30 => Ok(Self::Ioc8),
3160 31 => Ok(Self::Ioc9),
3161 32 => Ok(Self::Ioc10),
3162 33 => Ok(Self::Ioc11),
3163 34 => Ok(Self::Ioc12),
3164 35 => Ok(Self::Ior0),
3165 36 => Ok(Self::Ior1),
3166 37 => Ok(Self::Ior2),
3167 38 => Ok(Self::Ior3),
3168 39 => Ok(Self::Ior4),
3169 40 => Ok(Self::Ior5),
3170 41 => Ok(Self::Ior6),
3171 42 => Ok(Self::Ior7),
3172 43 => Ok(Self::Ior10),
3173 44 => Ok(Self::Ior11),
3174 45 => Ok(Self::Ior12),
3175 46 => Ok(Self::Ior13),
3176 _ => Err(val),
3177 }
3178 }
3179}
3180
3181/// Power Manager Wakeup Signals
3182#[derive(Copy, Clone, PartialEq, Eq)]
3183#[repr(u32)]
3184pub enum PowerManagerWakeUps {
3185 SysrstCtrlAonWkupReq = 0,
3186 AdcCtrlAonWkupReq = 1,
3187 PinmuxAonPinWkupReq = 2,
3188 PinmuxAonUsbWkupReq = 3,
3189 AonTimerAonWkupReq = 4,
3190 SensorCtrlWkupReq = 5,
3191}
3192
3193/// Reset Manager Software Controlled Resets
3194#[derive(Copy, Clone, PartialEq, Eq)]
3195#[repr(u32)]
3196pub enum ResetManagerSwResets {
3197 SpiDevice = 0,
3198 SpiHost0 = 1,
3199 SpiHost1 = 2,
3200 Usb = 3,
3201 UsbAon = 4,
3202 I2c0 = 5,
3203 I2c1 = 6,
3204 I2c2 = 7,
3205}
3206
3207/// Power Manager Reset Request Signals
3208#[derive(Copy, Clone, PartialEq, Eq)]
3209#[repr(u32)]
3210pub enum PowerManagerResetRequests {
3211 SysrstCtrlAonRstReq = 0,
3212 AonTimerAonAonTimerRstReq = 1,
3213}
3214
3215/// Clock Manager Software-Controlled ("Gated") Clocks.
3216///
3217/// The Software has full control over these clocks.
3218#[derive(Copy, Clone, PartialEq, Eq)]
3219#[repr(u32)]
3220pub enum GateableClocks {
3221 /// Clock clk_io_div4_peri in group peri
3222 IoDiv4Peri = 0,
3223 /// Clock clk_io_div2_peri in group peri
3224 IoDiv2Peri = 1,
3225 /// Clock clk_io_peri in group peri
3226 IoPeri = 2,
3227 /// Clock clk_usb_peri in group peri
3228 UsbPeri = 3,
3229}
3230
3231/// Clock Manager Software-Hinted Clocks.
3232///
3233/// The Software has partial control over these clocks. It can ask them to stop,
3234/// but the clock manager is in control of whether the clock actually is stopped.
3235#[derive(Copy, Clone, PartialEq, Eq)]
3236#[repr(u32)]
3237pub enum HintableClocks {
3238 /// Clock clk_main_aes in group trans
3239 MainAes = 0,
3240 /// Clock clk_main_hmac in group trans
3241 MainHmac = 1,
3242 /// Clock clk_main_kmac in group trans
3243 MainKmac = 2,
3244 /// Clock clk_main_otbn in group trans
3245 MainOtbn = 3,
3246}
3247
3248/// MMIO Region
3249///
3250/// MMIO region excludes any memory that is separate from the module
3251/// configuration space, i.e. ROM, main SRAM, and flash are excluded but
3252/// retention SRAM, spi_device memory, or usbdev memory are included.
3253pub const MMIO_BASE_ADDR: usize = 0x40000000;
3254pub const MMIO_SIZE_BYTES: usize = 0x10000000;