esp_metadata_generated/
_generated_esp32c3.rs

1// Do NOT edit this file directly. Make your changes to esp-metadata,
2// then run `cargo xtask update-metadata`.
3
4/// The name of the chip as `&str`
5///
6/// # Example
7///
8/// ```rust, no_run
9/// use esp_hal::chip;
10/// let chip_name = chip!();
11#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
12/// ```
13#[macro_export]
14#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
15macro_rules! chip {
16    () => {
17        "esp32c3"
18    };
19}
20/// The properties of this chip and its drivers.
21#[macro_export]
22#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
23macro_rules! property {
24    ("chip") => {
25        "esp32c3"
26    };
27    ("arch") => {
28        "riscv"
29    };
30    ("cores") => {
31        1
32    };
33    ("cores", str) => {
34        stringify!(1)
35    };
36    ("trm") => {
37        "https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf"
38    };
39    ("soc.cpu_has_csr_pc") => {
40        true
41    };
42    ("soc.cpu_has_prv_mode") => {
43        false
44    };
45    ("soc.rc_fast_clk_default") => {
46        17500000
47    };
48    ("soc.rc_fast_clk_default", str) => {
49        stringify!(17500000)
50    };
51    ("soc.rc_slow_clock") => {
52        136000
53    };
54    ("soc.rc_slow_clock", str) => {
55        stringify!(136000)
56    };
57    ("soc.xtal_frequency") => {
58        40
59    };
60    ("soc.xtal_frequency", str) => {
61        stringify!(40)
62    };
63    ("aes.dma") => {
64        true
65    };
66    ("aes.has_split_text_registers") => {
67        true
68    };
69    ("aes.endianness_configurable") => {
70        false
71    };
72    ("assist_debug.has_sp_monitor") => {
73        true
74    };
75    ("assist_debug.has_region_monitor") => {
76        true
77    };
78    ("gpio.has_bank_1") => {
79        false
80    };
81    ("gpio.gpio_function") => {
82        1
83    };
84    ("gpio.gpio_function", str) => {
85        stringify!(1)
86    };
87    ("gpio.constant_0_input") => {
88        31
89    };
90    ("gpio.constant_0_input", str) => {
91        stringify!(31)
92    };
93    ("gpio.constant_1_input") => {
94        30
95    };
96    ("gpio.constant_1_input", str) => {
97        stringify!(30)
98    };
99    ("gpio.remap_iomux_pin_registers") => {
100        false
101    };
102    ("gpio.func_in_sel_offset") => {
103        0
104    };
105    ("gpio.func_in_sel_offset", str) => {
106        stringify!(0)
107    };
108    ("gpio.input_signal_max") => {
109        100
110    };
111    ("gpio.input_signal_max", str) => {
112        stringify!(100)
113    };
114    ("gpio.output_signal_max") => {
115        128
116    };
117    ("gpio.output_signal_max", str) => {
118        stringify!(128)
119    };
120    ("i2c_master.has_fsm_timeouts") => {
121        true
122    };
123    ("i2c_master.has_hw_bus_clear") => {
124        true
125    };
126    ("i2c_master.has_bus_timeout_enable") => {
127        true
128    };
129    ("i2c_master.separate_filter_config_registers") => {
130        false
131    };
132    ("i2c_master.can_estimate_nack_reason") => {
133        false
134    };
135    ("i2c_master.has_conf_update") => {
136        true
137    };
138    ("i2c_master.has_reliable_fsm_reset") => {
139        false
140    };
141    ("i2c_master.has_arbitration_en") => {
142        true
143    };
144    ("i2c_master.has_tx_fifo_watermark") => {
145        true
146    };
147    ("i2c_master.bus_timeout_is_exponential") => {
148        true
149    };
150    ("i2c_master.max_bus_timeout") => {
151        31
152    };
153    ("i2c_master.max_bus_timeout", str) => {
154        stringify!(31)
155    };
156    ("i2c_master.ll_intr_mask") => {
157        262143
158    };
159    ("i2c_master.ll_intr_mask", str) => {
160        stringify!(262143)
161    };
162    ("i2c_master.fifo_size") => {
163        32
164    };
165    ("i2c_master.fifo_size", str) => {
166        stringify!(32)
167    };
168    ("interrupts.status_registers") => {
169        2
170    };
171    ("interrupts.status_registers", str) => {
172        stringify!(2)
173    };
174    ("rmt.ram_start") => {
175        1610703872
176    };
177    ("rmt.ram_start", str) => {
178        stringify!(1610703872)
179    };
180    ("rmt.channel_ram_size") => {
181        48
182    };
183    ("rmt.channel_ram_size", str) => {
184        stringify!(48)
185    };
186    ("rmt.has_tx_immediate_stop") => {
187        true
188    };
189    ("rmt.has_tx_loop_count") => {
190        true
191    };
192    ("rmt.has_tx_loop_auto_stop") => {
193        false
194    };
195    ("rmt.has_tx_carrier_data_only") => {
196        true
197    };
198    ("rmt.has_tx_sync") => {
199        true
200    };
201    ("rmt.has_rx_wrap") => {
202        true
203    };
204    ("rmt.has_rx_demodulation") => {
205        true
206    };
207    ("rmt.has_dma") => {
208        false
209    };
210    ("rmt.has_per_channel_clock") => {
211        false
212    };
213    ("rng.apb_cycle_wait_num") => {
214        16
215    };
216    ("rng.apb_cycle_wait_num", str) => {
217        stringify!(16)
218    };
219    ("rsa.size_increment") => {
220        32
221    };
222    ("rsa.size_increment", str) => {
223        stringify!(32)
224    };
225    ("rsa.memory_size_bytes") => {
226        384
227    };
228    ("rsa.memory_size_bytes", str) => {
229        stringify!(384)
230    };
231    ("sha.dma") => {
232        true
233    };
234    ("spi_master.has_octal") => {
235        false
236    };
237    ("timergroup.timg_has_timer1") => {
238        false
239    };
240    ("timergroup.timg_has_divcnt_rst") => {
241        true
242    };
243    ("timergroup.default_clock_source") => {
244        0
245    };
246    ("timergroup.default_clock_source", str) => {
247        stringify!(0)
248    };
249    ("timergroup.default_wdt_clock_source") => {
250        0
251    };
252    ("timergroup.default_wdt_clock_source", str) => {
253        stringify!(0)
254    };
255    ("uart.ram_size") => {
256        128
257    };
258    ("uart.ram_size", str) => {
259        stringify!(128)
260    };
261    ("wifi.has_wifi6") => {
262        false
263    };
264    ("bt.controller") => {
265        "btdm"
266    };
267    ("phy.combo_module") => {
268        true
269    };
270    ("phy.backed_up_digital_register_count") => {
271        21
272    };
273    ("phy.backed_up_digital_register_count", str) => {
274        stringify!(21)
275    };
276}
277/// Macro to get the address range of the given memory region.
278#[macro_export]
279#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
280macro_rules! memory_range {
281    ("DRAM") => {
282        1070071808..1070465024
283    };
284}
285#[macro_export]
286#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
287macro_rules! for_each_soc_xtal_options {
288    ($($pattern:tt => $code:tt;)*) => {
289        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
290        _for_each_inner!((40)); _for_each_inner!((all(40)));
291    };
292}
293#[macro_export]
294#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
295macro_rules! for_each_aes_key_length {
296    ($($pattern:tt => $code:tt;)*) => {
297        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
298        _for_each_inner!((128)); _for_each_inner!((256)); _for_each_inner!((128, 0, 4));
299        _for_each_inner!((256, 2, 6)); _for_each_inner!((bits(128), (256)));
300        _for_each_inner!((modes(128, 0, 4), (256, 2, 6)));
301    };
302}
303/// This macro can be used to generate code for each channel of the RMT peripheral.
304///
305/// For an explanation on the general syntax, as well as usage of individual/repeated
306/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
307///
308/// This macro has three options for its "Individual matcher" case:
309///
310/// - `all`: `($num:literal)`
311/// - `tx`: `($num:literal, $idx:literal)`
312/// - `rx`: `($num:literal, $idx:literal)`
313///
314/// Macro fragments:
315///
316/// - `$num`: number of the channel, e.g. `0`
317/// - `$idx`: index of the channel among channels of the same capability, e.g. `0`
318///
319/// Example data:
320///
321/// - `all`: `(0)`
322/// - `tx`: `(1, 1)`
323/// - `rx`: `(2, 0)`
324#[macro_export]
325#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
326macro_rules! for_each_rmt_channel {
327    ($($pattern:tt => $code:tt;)*) => {
328        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
329        _for_each_inner!((0)); _for_each_inner!((1)); _for_each_inner!((2));
330        _for_each_inner!((3)); _for_each_inner!((0, 0)); _for_each_inner!((1, 1));
331        _for_each_inner!((2, 0)); _for_each_inner!((3, 1)); _for_each_inner!((all(0),
332        (1), (2), (3))); _for_each_inner!((tx(0, 0), (1, 1))); _for_each_inner!((rx(2,
333        0), (3, 1)));
334    };
335}
336#[macro_export]
337#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
338macro_rules! for_each_rmt_clock_source {
339    ($($pattern:tt => $code:tt;)*) => {
340        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
341        _for_each_inner!((Apb, 1)); _for_each_inner!((RcFast, 2));
342        _for_each_inner!((Xtal, 3)); _for_each_inner!((Apb)); _for_each_inner!((all(Apb,
343        1), (RcFast, 2), (Xtal, 3))); _for_each_inner!((default(Apb)));
344    };
345}
346#[macro_export]
347#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
348macro_rules! for_each_rsa_exponentiation {
349    ($($pattern:tt => $code:tt;)*) => {
350        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
351        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
352        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
353        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
354        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
355        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
356        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
357        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
358        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
359        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
360        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
361        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
362        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
363        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
364        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
365        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
366        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
367        _for_each_inner!((1568)); _for_each_inner!((1600)); _for_each_inner!((1632));
368        _for_each_inner!((1664)); _for_each_inner!((1696)); _for_each_inner!((1728));
369        _for_each_inner!((1760)); _for_each_inner!((1792)); _for_each_inner!((1824));
370        _for_each_inner!((1856)); _for_each_inner!((1888)); _for_each_inner!((1920));
371        _for_each_inner!((1952)); _for_each_inner!((1984)); _for_each_inner!((2016));
372        _for_each_inner!((2048)); _for_each_inner!((2080)); _for_each_inner!((2112));
373        _for_each_inner!((2144)); _for_each_inner!((2176)); _for_each_inner!((2208));
374        _for_each_inner!((2240)); _for_each_inner!((2272)); _for_each_inner!((2304));
375        _for_each_inner!((2336)); _for_each_inner!((2368)); _for_each_inner!((2400));
376        _for_each_inner!((2432)); _for_each_inner!((2464)); _for_each_inner!((2496));
377        _for_each_inner!((2528)); _for_each_inner!((2560)); _for_each_inner!((2592));
378        _for_each_inner!((2624)); _for_each_inner!((2656)); _for_each_inner!((2688));
379        _for_each_inner!((2720)); _for_each_inner!((2752)); _for_each_inner!((2784));
380        _for_each_inner!((2816)); _for_each_inner!((2848)); _for_each_inner!((2880));
381        _for_each_inner!((2912)); _for_each_inner!((2944)); _for_each_inner!((2976));
382        _for_each_inner!((3008)); _for_each_inner!((3040)); _for_each_inner!((3072));
383        _for_each_inner!((all(32), (64), (96), (128), (160), (192), (224), (256), (288),
384        (320), (352), (384), (416), (448), (480), (512), (544), (576), (608), (640),
385        (672), (704), (736), (768), (800), (832), (864), (896), (928), (960), (992),
386        (1024), (1056), (1088), (1120), (1152), (1184), (1216), (1248), (1280), (1312),
387        (1344), (1376), (1408), (1440), (1472), (1504), (1536), (1568), (1600), (1632),
388        (1664), (1696), (1728), (1760), (1792), (1824), (1856), (1888), (1920), (1952),
389        (1984), (2016), (2048), (2080), (2112), (2144), (2176), (2208), (2240), (2272),
390        (2304), (2336), (2368), (2400), (2432), (2464), (2496), (2528), (2560), (2592),
391        (2624), (2656), (2688), (2720), (2752), (2784), (2816), (2848), (2880), (2912),
392        (2944), (2976), (3008), (3040), (3072)));
393    };
394}
395#[macro_export]
396#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
397macro_rules! for_each_rsa_multiplication {
398    ($($pattern:tt => $code:tt;)*) => {
399        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
400        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
401        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
402        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
403        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
404        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
405        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
406        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
407        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
408        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
409        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
410        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
411        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
412        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
413        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
414        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
415        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
416        _for_each_inner!((all(32), (64), (96), (128), (160), (192), (224), (256), (288),
417        (320), (352), (384), (416), (448), (480), (512), (544), (576), (608), (640),
418        (672), (704), (736), (768), (800), (832), (864), (896), (928), (960), (992),
419        (1024), (1056), (1088), (1120), (1152), (1184), (1216), (1248), (1280), (1312),
420        (1344), (1376), (1408), (1440), (1472), (1504), (1536)));
421    };
422}
423#[macro_export]
424#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
425macro_rules! for_each_sha_algorithm {
426    ($($pattern:tt => $code:tt;)*) => {
427        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
428        _for_each_inner!((Sha1, "SHA-1"(sizes : 64, 20, 8) (insecure_against :
429        "collision", "length extension"), 0)); _for_each_inner!((Sha224, "SHA-224"(sizes
430        : 64, 28, 8) (insecure_against : "length extension"), 1));
431        _for_each_inner!((Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against :
432        "length extension"), 2)); _for_each_inner!((algos(Sha1, "SHA-1"(sizes : 64, 20,
433        8) (insecure_against : "collision", "length extension"), 0), (Sha224,
434        "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
435        (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
436        2)));
437    };
438}
439/// This macro can be used to generate code for each peripheral instance of the I2C master driver.
440///
441/// For an explanation on the general syntax, as well as usage of individual/repeated
442/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
443///
444/// This macro has one option for its "Individual matcher" case:
445///
446/// Syntax: `($instance:ident, $sys:ident, $scl:ident, $sda:ident)`
447///
448/// Macro fragments:
449///
450/// - `$instance`: the name of the I2C instance
451/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
452/// - `$scl`, `$sda`: peripheral signal names.
453///
454/// Example data: `(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)`
455#[macro_export]
456#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
457macro_rules! for_each_i2c_master {
458    ($($pattern:tt => $code:tt;)*) => {
459        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
460        _for_each_inner!((I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA));
461        _for_each_inner!((all(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)));
462    };
463}
464/// This macro can be used to generate code for each peripheral instance of the UART driver.
465///
466/// For an explanation on the general syntax, as well as usage of individual/repeated
467/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
468///
469/// This macro has one option for its "Individual matcher" case:
470///
471/// Syntax: `($instance:ident, $sys:ident, $rx:ident, $tx:ident, $cts:ident, $rts:ident)`
472///
473/// Macro fragments:
474///
475/// - `$instance`: the name of the UART instance
476/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
477/// - `$rx`, `$tx`, `$cts`, `$rts`: signal names.
478///
479/// Example data: `(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS)`
480#[macro_export]
481#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
482macro_rules! for_each_uart {
483    ($($pattern:tt => $code:tt;)*) => {
484        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
485        _for_each_inner!((UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS));
486        _for_each_inner!((UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS));
487        _for_each_inner!((all(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS), (UART1, Uart1,
488        U1RXD, U1TXD, U1CTS, U1RTS)));
489    };
490}
491/// This macro can be used to generate code for each peripheral instance of the SPI master driver.
492///
493/// For an explanation on the general syntax, as well as usage of individual/repeated
494/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
495///
496/// This macro has one option for its "Individual matcher" case:
497///
498/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, [$($cs:ident),*] [$($sio:ident),*
499/// $($is_qspi:iteral)?])`
500///
501/// Macro fragments:
502///
503/// - `$instance`: the name of the SPI instance
504/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
505/// - `$cs`, `$sio`: chip select and SIO signal names.
506/// - `$is_qspi`: a `true` literal present if the SPI instance supports QSPI.
507///
508/// Example data:
509/// - `(SPI2, Spi2, FSPICLK [FSPICS0, FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ,
510///   FSPIWP, FSPIHD, FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7], true)`
511/// - `(SPI3, Spi3, SPI3_CLK [SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q])`
512#[macro_export]
513#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
514macro_rules! for_each_spi_master {
515    ($($pattern:tt => $code:tt;)*) => {
516        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
517        _for_each_inner!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3,
518        FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD], true));
519        _for_each_inner!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3,
520        FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD], true)));
521    };
522}
523/// This macro can be used to generate code for each peripheral instance of the SPI slave driver.
524///
525/// For an explanation on the general syntax, as well as usage of individual/repeated
526/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
527///
528/// This macro has one option for its "Individual matcher" case:
529///
530/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, $mosi:ident, $miso:ident, $cs:ident)`
531///
532/// Macro fragments:
533///
534/// - `$instance`: the name of the I2C instance
535/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
536/// - `$mosi`, `$miso`, `$cs`: signal names.
537///
538/// Example data: `(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)`
539#[macro_export]
540#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
541macro_rules! for_each_spi_slave {
542    ($($pattern:tt => $code:tt;)*) => {
543        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
544        _for_each_inner!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
545        _for_each_inner!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)));
546    };
547}
548#[macro_export]
549#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
550macro_rules! for_each_peripheral {
551    ($($pattern:tt => $code:tt;)*) => {
552        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
553        _for_each_inner!((GPIO0 <= virtual())); _for_each_inner!((GPIO1 <= virtual()));
554        _for_each_inner!((GPIO2 <= virtual())); _for_each_inner!((GPIO3 <= virtual()));
555        _for_each_inner!((GPIO4 <= virtual())); _for_each_inner!((GPIO5 <= virtual()));
556        _for_each_inner!((GPIO6 <= virtual())); _for_each_inner!((GPIO7 <= virtual()));
557        _for_each_inner!((GPIO8 <= virtual())); _for_each_inner!((GPIO9 <= virtual()));
558        _for_each_inner!((GPIO10 <= virtual())); _for_each_inner!((GPIO18 <= virtual()));
559        _for_each_inner!((GPIO19 <= virtual())); _for_each_inner!((GPIO20 <= virtual()));
560        _for_each_inner!((GPIO21 <= virtual())); _for_each_inner!((AES <= AES(AES : {
561        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
562        (unstable))); _for_each_inner!((APB_CTRL <= APB_CTRL() (unstable)));
563        _for_each_inner!((APB_SARADC <= APB_SARADC() (unstable)));
564        _for_each_inner!((ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
565        _for_each_inner!((BB <= BB() (unstable))); _for_each_inner!((DMA <= DMA()
566        (unstable))); _for_each_inner!((DS <= DS() (unstable))); _for_each_inner!((EFUSE
567        <= EFUSE() (unstable))); _for_each_inner!((EXTMEM <= EXTMEM() (unstable)));
568        _for_each_inner!((FE <= FE() (unstable))); _for_each_inner!((FE2 <= FE2()
569        (unstable))); _for_each_inner!((GPIO <= GPIO() (unstable)));
570        _for_each_inner!((GPIO_SD <= GPIO_SD() (unstable))); _for_each_inner!((HMAC <=
571        HMAC() (unstable))); _for_each_inner!((I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
572        _for_each_inner!((I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
573        enable_peri_interrupt, disable_peri_interrupt }))); _for_each_inner!((I2S0 <=
574        I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
575        }) (unstable))); _for_each_inner!((INTERRUPT_CORE0 <= INTERRUPT_CORE0()
576        (unstable))); _for_each_inner!((IO_MUX <= IO_MUX() (unstable)));
577        _for_each_inner!((LEDC <= LEDC() (unstable))); _for_each_inner!((NRX <= NRX()
578        (unstable))); _for_each_inner!((RMT <= RMT() (unstable))); _for_each_inner!((RNG
579        <= RNG() (unstable))); _for_each_inner!((RSA <= RSA(RSA : { bind_peri_interrupt,
580        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
581        _for_each_inner!((LPWR <= RTC_CNTL() (unstable))); _for_each_inner!((SENSITIVE <=
582        SENSITIVE() (unstable))); _for_each_inner!((SHA <= SHA(SHA : {
583        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
584        (unstable))); _for_each_inner!((SPI0 <= SPI0() (unstable)));
585        _for_each_inner!((SPI1 <= SPI1() (unstable))); _for_each_inner!((SPI2 <=
586        SPI2(SPI2 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
587        }))); _for_each_inner!((SYSTEM <= SYSTEM() (unstable)));
588        _for_each_inner!((SYSTIMER <= SYSTIMER() (unstable))); _for_each_inner!((TIMG0 <=
589        TIMG0() (unstable))); _for_each_inner!((TIMG1 <= TIMG1() (unstable)));
590        _for_each_inner!((TWAI0 <= TWAI0() (unstable))); _for_each_inner!((UART0 <=
591        UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
592        disable_peri_interrupt }))); _for_each_inner!((UART1 <= UART1(UART1 : {
593        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })));
594        _for_each_inner!((UHCI0 <= UHCI0() (unstable))); _for_each_inner!((USB_DEVICE <=
595        USB_DEVICE(USB_DEVICE : { bind_peri_interrupt, enable_peri_interrupt,
596        disable_peri_interrupt }) (unstable))); _for_each_inner!((XTS_AES <= XTS_AES()
597        (unstable))); _for_each_inner!((DMA_CH0 <= virtual() (unstable)));
598        _for_each_inner!((DMA_CH1 <= virtual() (unstable))); _for_each_inner!((DMA_CH2 <=
599        virtual() (unstable))); _for_each_inner!((ADC1 <= virtual() (unstable)));
600        _for_each_inner!((ADC2 <= virtual() (unstable))); _for_each_inner!((BT <=
601        virtual() (unstable))); _for_each_inner!((FLASH <= virtual() (unstable)));
602        _for_each_inner!((SW_INTERRUPT <= virtual() (unstable))); _for_each_inner!((TSENS
603        <= virtual() (unstable))); _for_each_inner!((WIFI <= virtual() (unstable)));
604        _for_each_inner!((all(GPIO0 <= virtual()), (GPIO1 <= virtual()), (GPIO2 <=
605        virtual()), (GPIO3 <= virtual()), (GPIO4 <= virtual()), (GPIO5 <= virtual()),
606        (GPIO6 <= virtual()), (GPIO7 <= virtual()), (GPIO8 <= virtual()), (GPIO9 <=
607        virtual()), (GPIO10 <= virtual()), (GPIO18 <= virtual()), (GPIO19 <= virtual()),
608        (GPIO20 <= virtual()), (GPIO21 <= virtual()), (AES <= AES(AES : {
609        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
610        (unstable)), (APB_CTRL <= APB_CTRL() (unstable)), (APB_SARADC <= APB_SARADC()
611        (unstable)), (ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)), (BB <= BB()
612        (unstable)), (DMA <= DMA() (unstable)), (DS <= DS() (unstable)), (EFUSE <=
613        EFUSE() (unstable)), (EXTMEM <= EXTMEM() (unstable)), (FE <= FE() (unstable)),
614        (FE2 <= FE2() (unstable)), (GPIO <= GPIO() (unstable)), (GPIO_SD <= GPIO_SD()
615        (unstable)), (HMAC <= HMAC() (unstable)), (I2C_ANA_MST <= I2C_ANA_MST()
616        (unstable)), (I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
617        enable_peri_interrupt, disable_peri_interrupt })), (I2S0 <= I2S0(I2S0 : {
618        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
619        (unstable)), (INTERRUPT_CORE0 <= INTERRUPT_CORE0() (unstable)), (IO_MUX <=
620        IO_MUX() (unstable)), (LEDC <= LEDC() (unstable)), (NRX <= NRX() (unstable)),
621        (RMT <= RMT() (unstable)), (RNG <= RNG() (unstable)), (RSA <= RSA(RSA : {
622        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
623        (unstable)), (LPWR <= RTC_CNTL() (unstable)), (SENSITIVE <= SENSITIVE()
624        (unstable)), (SHA <= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt,
625        disable_peri_interrupt }) (unstable)), (SPI0 <= SPI0() (unstable)), (SPI1 <=
626        SPI1() (unstable)), (SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
627        enable_peri_interrupt, disable_peri_interrupt })), (SYSTEM <= SYSTEM()
628        (unstable)), (SYSTIMER <= SYSTIMER() (unstable)), (TIMG0 <= TIMG0() (unstable)),
629        (TIMG1 <= TIMG1() (unstable)), (TWAI0 <= TWAI0() (unstable)), (UART0 <=
630        UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
631        disable_peri_interrupt })), (UART1 <= UART1(UART1 : { bind_peri_interrupt,
632        enable_peri_interrupt, disable_peri_interrupt })), (UHCI0 <= UHCI0() (unstable)),
633        (USB_DEVICE <= USB_DEVICE(USB_DEVICE : { bind_peri_interrupt,
634        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (XTS_AES <=
635        XTS_AES() (unstable)), (DMA_CH0 <= virtual() (unstable)), (DMA_CH1 <= virtual()
636        (unstable)), (DMA_CH2 <= virtual() (unstable)), (ADC1 <= virtual() (unstable)),
637        (ADC2 <= virtual() (unstable)), (BT <= virtual() (unstable)), (FLASH <= virtual()
638        (unstable)), (SW_INTERRUPT <= virtual() (unstable)), (TSENS <= virtual()
639        (unstable)), (WIFI <= virtual() (unstable))));
640    };
641}
642/// This macro can be used to generate code for each `GPIOn` instance.
643///
644/// For an explanation on the general syntax, as well as usage of individual/repeated
645/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
646///
647/// This macro has one option for its "Individual matcher" case:
648///
649/// Syntax: `($n:literal, $gpio:ident ($($digital_input_function:ident =>
650/// $digital_input_signal:ident)*) ($($digital_output_function:ident =>
651/// $digital_output_signal:ident)*) ($([$pin_attribute:ident])*))`
652///
653/// Macro fragments:
654///
655/// - `$n`: the number of the GPIO. For `GPIO0`, `$n` is 0.
656/// - `$gpio`: the name of the GPIO.
657/// - `$digital_input_function`: the number of the digital function, as an identifier (i.e. for
658///   function 0 this is `_0`).
659/// - `$digital_input_function`: the name of the digital function, as an identifier.
660/// - `$digital_output_function`: the number of the digital function, as an identifier (i.e. for
661///   function 0 this is `_0`).
662/// - `$digital_output_function`: the name of the digital function, as an identifier.
663/// - `$pin_attribute`: `Input` and/or `Output`, marks the possible directions of the GPIO.
664///   Bracketed so that they can also be matched as optional fragments. Order is always Input first.
665///
666/// Example data: `(0, GPIO0 (_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input]
667/// [Output]))`
668#[macro_export]
669#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
670macro_rules! for_each_gpio {
671    ($($pattern:tt => $code:tt;)*) => {
672        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
673        _for_each_inner!((0, GPIO0() () ([Input] [Output]))); _for_each_inner!((1,
674        GPIO1() () ([Input] [Output]))); _for_each_inner!((2, GPIO2(_2 => FSPIQ) (_2 =>
675        FSPIQ) ([Input] [Output]))); _for_each_inner!((3, GPIO3() () ([Input]
676        [Output]))); _for_each_inner!((4, GPIO4(_0 => MTMS _2 => FSPIHD) (_2 => FSPIHD)
677        ([Input] [Output]))); _for_each_inner!((5, GPIO5(_0 => MTDI _2 => FSPIWP) (_2 =>
678        FSPIWP) ([Input] [Output]))); _for_each_inner!((6, GPIO6(_0 => MTCK _2 =>
679        FSPICLK) (_2 => FSPICLK) ([Input] [Output]))); _for_each_inner!((7, GPIO7(_2 =>
680        FSPID) (_0 => MTDO _2 => FSPID) ([Input] [Output]))); _for_each_inner!((8,
681        GPIO8() () ([Input] [Output]))); _for_each_inner!((9, GPIO9() () ([Input]
682        [Output]))); _for_each_inner!((10, GPIO10(_2 => FSPICS0) (_2 => FSPICS0) ([Input]
683        [Output]))); _for_each_inner!((18, GPIO18() () ([Input] [Output])));
684        _for_each_inner!((19, GPIO19() () ([Input] [Output]))); _for_each_inner!((20,
685        GPIO20(_0 => U0RXD) () ([Input] [Output]))); _for_each_inner!((21, GPIO21() (_0
686        => U0TXD) ([Input] [Output]))); _for_each_inner!((all(0, GPIO0() () ([Input]
687        [Output])), (1, GPIO1() () ([Input] [Output])), (2, GPIO2(_2 => FSPIQ) (_2 =>
688        FSPIQ) ([Input] [Output])), (3, GPIO3() () ([Input] [Output])), (4, GPIO4(_0 =>
689        MTMS _2 => FSPIHD) (_2 => FSPIHD) ([Input] [Output])), (5, GPIO5(_0 => MTDI _2 =>
690        FSPIWP) (_2 => FSPIWP) ([Input] [Output])), (6, GPIO6(_0 => MTCK _2 => FSPICLK)
691        (_2 => FSPICLK) ([Input] [Output])), (7, GPIO7(_2 => FSPID) (_0 => MTDO _2 =>
692        FSPID) ([Input] [Output])), (8, GPIO8() () ([Input] [Output])), (9, GPIO9() ()
693        ([Input] [Output])), (10, GPIO10(_2 => FSPICS0) (_2 => FSPICS0) ([Input]
694        [Output])), (18, GPIO18() () ([Input] [Output])), (19, GPIO19() () ([Input]
695        [Output])), (20, GPIO20(_0 => U0RXD) () ([Input] [Output])), (21, GPIO21() (_0 =>
696        U0TXD) ([Input] [Output]))));
697    };
698}
699/// This macro can be used to generate code for each analog function of each GPIO.
700///
701/// For an explanation on the general syntax, as well as usage of individual/repeated
702/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
703///
704/// This macro has two options for its "Individual matcher" case:
705///
706/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
707/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
708///   expanded signal case, where you need the number(s) of a signal, or the general group to which
709///   the signal belongs. For example, in case of `ADC2_CH3` the expanded form looks like
710///   `(ADC2_CH3, ADCn_CHm, 2, 3)`.
711///
712/// Macro fragments:
713///
714/// - `$signal`: the name of the signal.
715/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
716///   is `ADCn_CHm`.
717/// - `$number`: the numbers extracted from `$signal`.
718/// - `$gpio`: the name of the GPIO.
719///
720/// Example data:
721/// - `(ADC2_CH5, GPIO12)`
722/// - `((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12)`
723///
724/// The expanded syntax is only available when the signal has at least one numbered component.
725#[macro_export]
726#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
727macro_rules! for_each_analog_function {
728    ($($pattern:tt => $code:tt;)*) => {
729        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
730        _for_each_inner!((ADC1_CH0, GPIO0)); _for_each_inner!((ADC1_CH1, GPIO1));
731        _for_each_inner!((ADC1_CH2, GPIO2)); _for_each_inner!((ADC1_CH3, GPIO3));
732        _for_each_inner!((ADC1_CH4, GPIO4)); _for_each_inner!((ADC2_CH0, GPIO5));
733        _for_each_inner!((USB_DM, GPIO18)); _for_each_inner!((USB_DP, GPIO19));
734        _for_each_inner!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO0));
735        _for_each_inner!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO1));
736        _for_each_inner!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO2));
737        _for_each_inner!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO3));
738        _for_each_inner!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO4));
739        _for_each_inner!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO5));
740        _for_each_inner!((all(ADC1_CH0, GPIO0), (ADC1_CH1, GPIO1), (ADC1_CH2, GPIO2),
741        (ADC1_CH3, GPIO3), (ADC1_CH4, GPIO4), (ADC2_CH0, GPIO5), (USB_DM, GPIO18),
742        (USB_DP, GPIO19))); _for_each_inner!((all_expanded((ADC1_CH0, ADCn_CHm, 1, 0),
743        GPIO0), ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO1), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO2),
744        ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO3), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO4),
745        ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO5)));
746    };
747}
748/// This macro can be used to generate code for each LP/RTC function of each GPIO.
749///
750/// For an explanation on the general syntax, as well as usage of individual/repeated
751/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
752///
753/// This macro has two options for its "Individual matcher" case:
754///
755/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
756/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
757///   expanded signal case, where you need the number(s) of a signal, or the general group to which
758///   the signal belongs. For example, in case of `SAR_I2C_SCL_1` the expanded form looks like
759///   `(SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1)`.
760///
761/// Macro fragments:
762///
763/// - `$signal`: the name of the signal.
764/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
765///   is `ADCn_CHm`.
766/// - `$number`: the numbers extracted from `$signal`.
767/// - `$gpio`: the name of the GPIO.
768///
769/// Example data:
770/// - `(RTC_GPIO15, GPIO12)`
771/// - `((RTC_GPIO15, RTC_GPIOn, 15), GPIO12)`
772///
773/// The expanded syntax is only available when the signal has at least one numbered component.
774#[macro_export]
775#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
776macro_rules! for_each_lp_function {
777    ($($pattern:tt => $code:tt;)*) => {
778        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
779        _for_each_inner!((RTC_GPIO0, GPIO0)); _for_each_inner!((RTC_GPIO1, GPIO1));
780        _for_each_inner!((RTC_GPIO2, GPIO2)); _for_each_inner!((RTC_GPIO3, GPIO3));
781        _for_each_inner!((RTC_GPIO4, GPIO4)); _for_each_inner!((RTC_GPIO5, GPIO5));
782        _for_each_inner!(((RTC_GPIO0, RTC_GPIOn, 0), GPIO0));
783        _for_each_inner!(((RTC_GPIO1, RTC_GPIOn, 1), GPIO1));
784        _for_each_inner!(((RTC_GPIO2, RTC_GPIOn, 2), GPIO2));
785        _for_each_inner!(((RTC_GPIO3, RTC_GPIOn, 3), GPIO3));
786        _for_each_inner!(((RTC_GPIO4, RTC_GPIOn, 4), GPIO4));
787        _for_each_inner!(((RTC_GPIO5, RTC_GPIOn, 5), GPIO5));
788        _for_each_inner!((all(RTC_GPIO0, GPIO0), (RTC_GPIO1, GPIO1), (RTC_GPIO2, GPIO2),
789        (RTC_GPIO3, GPIO3), (RTC_GPIO4, GPIO4), (RTC_GPIO5, GPIO5)));
790        _for_each_inner!((all_expanded((RTC_GPIO0, RTC_GPIOn, 0), GPIO0), ((RTC_GPIO1,
791        RTC_GPIOn, 1), GPIO1), ((RTC_GPIO2, RTC_GPIOn, 2), GPIO2), ((RTC_GPIO3,
792        RTC_GPIOn, 3), GPIO3), ((RTC_GPIO4, RTC_GPIOn, 4), GPIO4), ((RTC_GPIO5,
793        RTC_GPIOn, 5), GPIO5)));
794    };
795}
796/// Defines the `InputSignal` and `OutputSignal` enums.
797///
798/// This macro is intended to be called in esp-hal only.
799#[macro_export]
800#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
801macro_rules! define_io_mux_signals {
802    () => {
803        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
804        #[derive(Debug, PartialEq, Copy, Clone)]
805        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
806        #[doc(hidden)]
807        pub enum InputSignal {
808            SPIQ             = 0,
809            SPID             = 1,
810            SPIHD            = 2,
811            SPIWP            = 3,
812            U0RXD            = 6,
813            U0CTS            = 7,
814            U0DSR            = 8,
815            U1RXD            = 9,
816            U1CTS            = 10,
817            U1DSR            = 11,
818            I2S_MCLK         = 12,
819            I2SO_BCK         = 13,
820            I2SO_WS          = 14,
821            I2SI_SD          = 15,
822            I2SI_BCK         = 16,
823            I2SI_WS          = 17,
824            GPIO_BT_PRIORITY = 18,
825            GPIO_BT_ACTIVE   = 19,
826            CPU_GPIO_0       = 28,
827            CPU_GPIO_1       = 29,
828            CPU_GPIO_2       = 30,
829            CPU_GPIO_3       = 31,
830            CPU_GPIO_4       = 32,
831            CPU_GPIO_5       = 33,
832            CPU_GPIO_6       = 34,
833            CPU_GPIO_7       = 35,
834            EXT_ADC_START    = 45,
835            RMT_SIG_0        = 51,
836            RMT_SIG_1        = 52,
837            I2CEXT0_SCL      = 53,
838            I2CEXT0_SDA      = 54,
839            FSPICLK          = 63,
840            FSPIQ            = 64,
841            FSPID            = 65,
842            FSPIHD           = 66,
843            FSPIWP           = 67,
844            FSPICS0          = 68,
845            TWAI_RX          = 74,
846            SIG_FUNC_97      = 97,
847            SIG_FUNC_98      = 98,
848            SIG_FUNC_99      = 99,
849            SIG_FUNC_100     = 100,
850            MTCK,
851            MTMS,
852            MTDI,
853        }
854        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
855        #[derive(Debug, PartialEq, Copy, Clone)]
856        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
857        #[doc(hidden)]
858        pub enum OutputSignal {
859            SPIQ             = 0,
860            SPID             = 1,
861            SPIHD            = 2,
862            SPIWP            = 3,
863            SPICLK           = 4,
864            SPICS0           = 5,
865            U0TXD            = 6,
866            U0RTS            = 7,
867            U0DTR            = 8,
868            U1TXD            = 9,
869            U1RTS            = 10,
870            U1DTR            = 11,
871            I2S_MCLK         = 12,
872            I2SO_BCK         = 13,
873            I2SO_WS          = 14,
874            I2SO_SD          = 15,
875            I2SI_BCK         = 16,
876            I2SI_WS          = 17,
877            GPIO_WLAN_PRIO   = 18,
878            GPIO_WLAN_ACTIVE = 19,
879            CPU_GPIO_0       = 28,
880            CPU_GPIO_1       = 29,
881            CPU_GPIO_2       = 30,
882            CPU_GPIO_3       = 31,
883            CPU_GPIO_4       = 32,
884            CPU_GPIO_5       = 33,
885            CPU_GPIO_6       = 34,
886            CPU_GPIO_7       = 35,
887            USB_JTAG_TCK     = 36,
888            USB_JTAG_TMS     = 37,
889            USB_JTAG_TDI     = 38,
890            USB_JTAG_TDO     = 39,
891            LEDC_LS_SIG0     = 45,
892            LEDC_LS_SIG1     = 46,
893            LEDC_LS_SIG2     = 47,
894            LEDC_LS_SIG3     = 48,
895            LEDC_LS_SIG4     = 49,
896            LEDC_LS_SIG5     = 50,
897            RMT_SIG_0        = 51,
898            RMT_SIG_1        = 52,
899            I2CEXT0_SCL      = 53,
900            I2CEXT0_SDA      = 54,
901            GPIO_SD0         = 55,
902            GPIO_SD1         = 56,
903            GPIO_SD2         = 57,
904            GPIO_SD3         = 58,
905            I2SO_SD1         = 59,
906            FSPICLK          = 63,
907            FSPIQ            = 64,
908            FSPID            = 65,
909            FSPIHD           = 66,
910            FSPIWP           = 67,
911            FSPICS0          = 68,
912            FSPICS1          = 69,
913            FSPICS3          = 70,
914            FSPICS2          = 71,
915            FSPICS4          = 72,
916            FSPICS5          = 73,
917            TWAI_TX          = 74,
918            TWAI_BUS_OFF_ON  = 75,
919            TWAI_CLKOUT      = 76,
920            ANT_SEL0         = 89,
921            ANT_SEL1         = 90,
922            ANT_SEL2         = 91,
923            ANT_SEL3         = 92,
924            ANT_SEL4         = 93,
925            ANT_SEL5         = 94,
926            ANT_SEL6         = 95,
927            ANT_SEL7         = 96,
928            SIG_FUNC_97      = 97,
929            SIG_FUNC_98      = 98,
930            SIG_FUNC_99      = 99,
931            SIG_FUNC_100     = 100,
932            CLK_OUT1         = 123,
933            CLK_OUT2         = 124,
934            CLK_OUT3         = 125,
935            SPICS1           = 126,
936            USB_JTAG_TRST    = 127,
937            GPIO             = 128,
938            MTDO,
939        }
940    };
941}
942/// Defines and implements the `io_mux_reg` function.
943///
944/// The generated function has the following signature:
945///
946/// ```rust,ignore
947/// pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO0 {
948///     // ...
949/// # unimplemented!()
950/// }
951/// ```
952///
953/// This macro is intended to be called in esp-hal only.
954#[macro_export]
955#[expect(clippy::crate_in_macro_def)]
956#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
957macro_rules! define_io_mux_reg {
958    () => {
959        pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
960            crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
961        }
962    };
963}