lowrisc/registers/
pinmux_regs.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// Generated register constants for pinmux.
6// Built for Earlgrey-M2.5.1-RC1-493-gedf5e35f5d
7// https://github.com/lowRISC/opentitan/tree/edf5e35f5d50a5377641c90a315109a351de7635
8// Tree status: clean
9// Build date: 2023-10-18T10:11:37
10
11// Original reference file: hw/ip/pinmux/data/pinmux.hjson
12use kernel::utilities::registers::ReadWrite;
13use kernel::utilities::registers::{register_bitfields, register_structs};
14/// Pad attribute data width
15pub const PINMUX_PARAM_ATTR_DW: u32 = 10;
16/// Number of muxed peripheral inputs
17pub const PINMUX_PARAM_N_MIO_PERIPH_IN: u32 = 33;
18/// Number of muxed peripheral outputs
19pub const PINMUX_PARAM_N_MIO_PERIPH_OUT: u32 = 32;
20/// Number of muxed IO pads
21pub const PINMUX_PARAM_N_MIO_PADS: u32 = 32;
22/// Number of dedicated IO pads
23pub const PINMUX_PARAM_N_DIO_PADS: u32 = 16;
24/// Number of wakeup detectors
25pub const PINMUX_PARAM_N_WKUP_DETECT: u32 = 8;
26/// Number of wakeup counter bits
27pub const PINMUX_PARAM_WKUP_CNT_WIDTH: u32 = 8;
28/// Number of alerts
29pub const PINMUX_PARAM_NUM_ALERTS: u32 = 1;
30/// Register width
31pub const PINMUX_PARAM_REG_WIDTH: u32 = 32;
32
33register_structs! {
34    pub PinmuxRegisters {
35        /// Alert Test Register
36        (0x0000 => pub(crate) alert_test: ReadWrite<u32, ALERT_TEST::Register>),
37        /// Register write enable for MIO peripheral input selects.
38        (0x0004 => pub(crate) mio_periph_insel_regwen: [ReadWrite<u32, MIO_PERIPH_INSEL_REGWEN::Register>; 33]),
39        /// For each peripheral input, this selects the muxable pad input.
40        (0x0088 => pub(crate) mio_periph_insel: [ReadWrite<u32, MIO_PERIPH_INSEL::Register>; 33]),
41        /// Register write enable for MIO output selects.
42        (0x010c => pub(crate) mio_outsel_regwen: [ReadWrite<u32, MIO_OUTSEL_REGWEN::Register>; 32]),
43        /// For each muxable pad, this selects the peripheral output.
44        (0x018c => pub(crate) mio_outsel: [ReadWrite<u32, MIO_OUTSEL::Register>; 32]),
45        /// Register write enable for MIO PAD attributes.
46        (0x020c => pub(crate) mio_pad_attr_regwen: [ReadWrite<u32, MIO_PAD_ATTR_REGWEN::Register>; 32]),
47        /// Muxed pad attributes.
48        (0x028c => pub(crate) mio_pad_attr: [ReadWrite<u32, MIO_PAD_ATTR::Register>; 32]),
49        /// Register write enable for DIO PAD attributes.
50        (0x030c => pub(crate) dio_pad_attr_regwen: [ReadWrite<u32, DIO_PAD_ATTR_REGWEN::Register>; 16]),
51        /// Dedicated pad attributes.
52        (0x034c => pub(crate) dio_pad_attr: [ReadWrite<u32, DIO_PAD_ATTR::Register>; 16]),
53        /// Register indicating whether the corresponding pad is in sleep mode.
54        (0x038c => pub(crate) mio_pad_sleep_status: [ReadWrite<u32, MIO_PAD_SLEEP_STATUS::Register>; 1]),
55        /// Register write enable for MIO sleep value configuration.
56        (0x0390 => pub(crate) mio_pad_sleep_regwen: [ReadWrite<u32, MIO_PAD_SLEEP_REGWEN::Register>; 32]),
57        /// Enables the sleep mode of the corresponding muxed pad.
58        (0x0410 => pub(crate) mio_pad_sleep_en: [ReadWrite<u32, MIO_PAD_SLEEP_EN::Register>; 32]),
59        /// Defines sleep behavior of the corresponding muxed pad.
60        (0x0490 => pub(crate) mio_pad_sleep_mode: [ReadWrite<u32, MIO_PAD_SLEEP_MODE::Register>; 32]),
61        /// Register indicating whether the corresponding pad is in sleep mode.
62        (0x0510 => pub(crate) dio_pad_sleep_status: [ReadWrite<u32, DIO_PAD_SLEEP_STATUS::Register>; 1]),
63        /// Register write enable for DIO sleep value configuration.
64        (0x0514 => pub(crate) dio_pad_sleep_regwen: [ReadWrite<u32, DIO_PAD_SLEEP_REGWEN::Register>; 16]),
65        /// Enables the sleep mode of the corresponding dedicated pad.
66        (0x0554 => pub(crate) dio_pad_sleep_en: [ReadWrite<u32, DIO_PAD_SLEEP_EN::Register>; 16]),
67        /// Defines sleep behavior of the corresponding dedicated pad.
68        (0x0594 => pub(crate) dio_pad_sleep_mode: [ReadWrite<u32, DIO_PAD_SLEEP_MODE::Register>; 16]),
69        /// Register write enable for wakeup detectors.
70        (0x05d4 => pub(crate) wkup_detector_regwen: [ReadWrite<u32, WKUP_DETECTOR_REGWEN::Register>; 8]),
71        /// Enables for the wakeup detectors.
72        (0x05f4 => pub(crate) wkup_detector_en: [ReadWrite<u32, WKUP_DETECTOR_EN::Register>; 8]),
73        /// Configuration of wakeup condition detectors.
74        (0x0614 => pub(crate) wkup_detector: [ReadWrite<u32, WKUP_DETECTOR::Register>; 8]),
75        /// Counter thresholds for wakeup condition detectors.
76        (0x0634 => pub(crate) wkup_detector_cnt_th: [ReadWrite<u32, WKUP_DETECTOR_CNT_TH::Register>; 8]),
77        /// Pad selects for pad wakeup condition detectors.
78        (0x0654 => pub(crate) wkup_detector_padsel: [ReadWrite<u32, WKUP_DETECTOR_PADSEL::Register>; 8]),
79        /// Cause registers for wakeup detectors.
80        (0x0674 => pub(crate) wkup_cause: [ReadWrite<u32, WKUP_CAUSE::Register>; 1]),
81        (0x0678 => @END),
82    }
83}
84
85register_bitfields![u32,
86    pub(crate) ALERT_TEST [
87        FATAL_FAULT OFFSET(0) NUMBITS(1) [],
88    ],
89    pub(crate) MIO_PERIPH_INSEL_REGWEN [
90        EN_0 OFFSET(0) NUMBITS(1) [],
91    ],
92    pub(crate) MIO_PERIPH_INSEL [
93        IN_0 OFFSET(0) NUMBITS(6) [],
94    ],
95    pub(crate) MIO_OUTSEL_REGWEN [
96        EN_0 OFFSET(0) NUMBITS(1) [],
97    ],
98    pub(crate) MIO_OUTSEL [
99        OUT_0 OFFSET(0) NUMBITS(6) [],
100    ],
101    pub(crate) MIO_PAD_ATTR_REGWEN [
102        EN_0 OFFSET(0) NUMBITS(1) [],
103    ],
104    pub(crate) MIO_PAD_ATTR [
105        INVERT_0 OFFSET(0) NUMBITS(1) [],
106        VIRTUAL_OD_EN_0 OFFSET(1) NUMBITS(1) [],
107        PULL_EN_0 OFFSET(2) NUMBITS(1) [],
108        PULL_SELECT_0 OFFSET(3) NUMBITS(1) [
109            PULL_DOWN = 0,
110            PULL_UP = 1,
111        ],
112        KEEPER_EN_0 OFFSET(4) NUMBITS(1) [],
113        SCHMITT_EN_0 OFFSET(5) NUMBITS(1) [],
114        OD_EN_0 OFFSET(6) NUMBITS(1) [],
115        SLEW_RATE_0 OFFSET(16) NUMBITS(2) [],
116        DRIVE_STRENGTH_0 OFFSET(20) NUMBITS(4) [],
117    ],
118    pub(crate) DIO_PAD_ATTR_REGWEN [
119        EN_0 OFFSET(0) NUMBITS(1) [],
120    ],
121    pub(crate) DIO_PAD_ATTR [
122        INVERT_0 OFFSET(0) NUMBITS(1) [],
123        VIRTUAL_OD_EN_0 OFFSET(1) NUMBITS(1) [],
124        PULL_EN_0 OFFSET(2) NUMBITS(1) [],
125        PULL_SELECT_0 OFFSET(3) NUMBITS(1) [
126            PULL_DOWN = 0,
127            PULL_UP = 1,
128        ],
129        KEEPER_EN_0 OFFSET(4) NUMBITS(1) [],
130        SCHMITT_EN_0 OFFSET(5) NUMBITS(1) [],
131        OD_EN_0 OFFSET(6) NUMBITS(1) [],
132        SLEW_RATE_0 OFFSET(16) NUMBITS(2) [],
133        DRIVE_STRENGTH_0 OFFSET(20) NUMBITS(4) [],
134    ],
135    pub(crate) MIO_PAD_SLEEP_STATUS [
136        EN_0 OFFSET(0) NUMBITS(1) [],
137        EN_1 OFFSET(1) NUMBITS(1) [],
138        EN_2 OFFSET(2) NUMBITS(1) [],
139        EN_3 OFFSET(3) NUMBITS(1) [],
140        EN_4 OFFSET(4) NUMBITS(1) [],
141        EN_5 OFFSET(5) NUMBITS(1) [],
142        EN_6 OFFSET(6) NUMBITS(1) [],
143        EN_7 OFFSET(7) NUMBITS(1) [],
144        EN_8 OFFSET(8) NUMBITS(1) [],
145        EN_9 OFFSET(9) NUMBITS(1) [],
146        EN_10 OFFSET(10) NUMBITS(1) [],
147        EN_11 OFFSET(11) NUMBITS(1) [],
148        EN_12 OFFSET(12) NUMBITS(1) [],
149        EN_13 OFFSET(13) NUMBITS(1) [],
150        EN_14 OFFSET(14) NUMBITS(1) [],
151        EN_15 OFFSET(15) NUMBITS(1) [],
152        EN_16 OFFSET(16) NUMBITS(1) [],
153        EN_17 OFFSET(17) NUMBITS(1) [],
154        EN_18 OFFSET(18) NUMBITS(1) [],
155        EN_19 OFFSET(19) NUMBITS(1) [],
156        EN_20 OFFSET(20) NUMBITS(1) [],
157        EN_21 OFFSET(21) NUMBITS(1) [],
158        EN_22 OFFSET(22) NUMBITS(1) [],
159        EN_23 OFFSET(23) NUMBITS(1) [],
160        EN_24 OFFSET(24) NUMBITS(1) [],
161        EN_25 OFFSET(25) NUMBITS(1) [],
162        EN_26 OFFSET(26) NUMBITS(1) [],
163        EN_27 OFFSET(27) NUMBITS(1) [],
164        EN_28 OFFSET(28) NUMBITS(1) [],
165        EN_29 OFFSET(29) NUMBITS(1) [],
166        EN_30 OFFSET(30) NUMBITS(1) [],
167        EN_31 OFFSET(31) NUMBITS(1) [],
168    ],
169    pub(crate) MIO_PAD_SLEEP_REGWEN [
170        EN_0 OFFSET(0) NUMBITS(1) [],
171    ],
172    pub(crate) MIO_PAD_SLEEP_EN [
173        EN_0 OFFSET(0) NUMBITS(1) [],
174    ],
175    pub(crate) MIO_PAD_SLEEP_MODE [
176        OUT_0 OFFSET(0) NUMBITS(2) [
177            TIE_LOW = 0,
178            TIE_HIGH = 1,
179            HIGH_Z = 2,
180            KEEP = 3,
181        ],
182    ],
183    pub(crate) DIO_PAD_SLEEP_STATUS [
184        EN_0 OFFSET(0) NUMBITS(1) [],
185        EN_1 OFFSET(1) NUMBITS(1) [],
186        EN_2 OFFSET(2) NUMBITS(1) [],
187        EN_3 OFFSET(3) NUMBITS(1) [],
188        EN_4 OFFSET(4) NUMBITS(1) [],
189        EN_5 OFFSET(5) NUMBITS(1) [],
190        EN_6 OFFSET(6) NUMBITS(1) [],
191        EN_7 OFFSET(7) NUMBITS(1) [],
192        EN_8 OFFSET(8) NUMBITS(1) [],
193        EN_9 OFFSET(9) NUMBITS(1) [],
194        EN_10 OFFSET(10) NUMBITS(1) [],
195        EN_11 OFFSET(11) NUMBITS(1) [],
196        EN_12 OFFSET(12) NUMBITS(1) [],
197        EN_13 OFFSET(13) NUMBITS(1) [],
198        EN_14 OFFSET(14) NUMBITS(1) [],
199        EN_15 OFFSET(15) NUMBITS(1) [],
200    ],
201    pub(crate) DIO_PAD_SLEEP_REGWEN [
202        EN_0 OFFSET(0) NUMBITS(1) [],
203    ],
204    pub(crate) DIO_PAD_SLEEP_EN [
205        EN_0 OFFSET(0) NUMBITS(1) [],
206    ],
207    pub(crate) DIO_PAD_SLEEP_MODE [
208        OUT_0 OFFSET(0) NUMBITS(2) [
209            TIE_LOW = 0,
210            TIE_HIGH = 1,
211            HIGH_Z = 2,
212            KEEP = 3,
213        ],
214    ],
215    pub(crate) WKUP_DETECTOR_REGWEN [
216        EN_0 OFFSET(0) NUMBITS(1) [],
217    ],
218    pub(crate) WKUP_DETECTOR_EN [
219        EN_0 OFFSET(0) NUMBITS(1) [],
220    ],
221    pub(crate) WKUP_DETECTOR [
222        MODE_0 OFFSET(0) NUMBITS(3) [
223            POSEDGE = 0,
224            NEGEDGE = 1,
225            EDGE = 2,
226            TIMEDHIGH = 3,
227            TIMEDLOW = 4,
228        ],
229        FILTER_0 OFFSET(3) NUMBITS(1) [],
230        MIODIO_0 OFFSET(4) NUMBITS(1) [],
231    ],
232    pub(crate) WKUP_DETECTOR_CNT_TH [
233        TH_0 OFFSET(0) NUMBITS(8) [],
234    ],
235    pub(crate) WKUP_DETECTOR_PADSEL [
236        SEL_0 OFFSET(0) NUMBITS(6) [],
237    ],
238    pub(crate) WKUP_CAUSE [
239        CAUSE_0 OFFSET(0) NUMBITS(1) [],
240        CAUSE_1 OFFSET(1) NUMBITS(1) [],
241        CAUSE_2 OFFSET(2) NUMBITS(1) [],
242        CAUSE_3 OFFSET(3) NUMBITS(1) [],
243        CAUSE_4 OFFSET(4) NUMBITS(1) [],
244        CAUSE_5 OFFSET(5) NUMBITS(1) [],
245        CAUSE_6 OFFSET(6) NUMBITS(1) [],
246        CAUSE_7 OFFSET(7) NUMBITS(1) [],
247    ],
248];
249
250// End generated register constants for pinmux