esp_metadata_generated/
_generated_esp32h2.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        "esp32h2"
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        "esp32h2"
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-h2_technical_reference_manual_en.pdf"
38    };
39    ("soc.cpu_has_csr_pc") => {
40        true
41    };
42    ("soc.cpu_has_prv_mode") => {
43        true
44    };
45    ("soc.rc_fast_clk_default") => {
46        8500000
47    };
48    ("soc.rc_fast_clk_default", str) => {
49        stringify!(8500000)
50    };
51    ("soc.rc_slow_clock") => {
52        136000
53    };
54    ("soc.rc_slow_clock", str) => {
55        stringify!(136000)
56    };
57    ("soc.xtal_frequency") => {
58        32
59    };
60    ("soc.xtal_frequency", str) => {
61        stringify!(32)
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        60
89    };
90    ("gpio.constant_0_input", str) => {
91        stringify!(60)
92    };
93    ("gpio.constant_1_input") => {
94        56
95    };
96    ("gpio.constant_1_input", str) => {
97        stringify!(56)
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        124
110    };
111    ("gpio.input_signal_max", str) => {
112        stringify!(124)
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        true
134    };
135    ("i2c_master.has_conf_update") => {
136        true
137    };
138    ("i2c_master.has_reliable_fsm_reset") => {
139        true
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        1610642432
176    };
177    ("rmt.ram_start", str) => {
178        stringify!(1610642432)
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        true
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        2
245    };
246    ("timergroup.default_clock_source", str) => {
247        stringify!(2)
248    };
249    ("timergroup.default_wdt_clock_source") => {
250        2
251    };
252    ("timergroup.default_wdt_clock_source", str) => {
253        stringify!(2)
254    };
255    ("uart.ram_size") => {
256        128
257    };
258    ("uart.ram_size", str) => {
259        stringify!(128)
260    };
261    ("uart.peripheral_controls_mem_clk") => {
262        true
263    };
264    ("bt.controller") => {
265        "npl"
266    };
267    ("phy.combo_module") => {
268        false
269    };
270}
271#[macro_export]
272#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
273macro_rules! for_each_soc_xtal_options {
274    ($($pattern:tt => $code:tt;)*) => {
275        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
276        _for_each_inner!((32)); _for_each_inner!((all(32)));
277    };
278}
279/// Implement the `Peripheral` enum and enable/disable/reset functions.
280///
281/// This macro is intended to be placed in `esp_hal::system`.
282#[macro_export]
283#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
284macro_rules! implement_peripheral_clocks {
285    () => {
286        #[doc(hidden)]
287        #[derive(Debug, Clone, Copy, PartialEq, Eq)]
288        #[repr(u8)]
289        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
290        pub enum Peripheral {
291            #[doc = "AES peripheral clock signal"]
292            Aes,
293            #[doc = "APB_SAR_ADC peripheral clock signal"]
294            ApbSarAdc,
295            #[doc = "DMA peripheral clock signal"]
296            Dma,
297            #[doc = "DS peripheral clock signal"]
298            Ds,
299            #[doc = "ECC peripheral clock signal"]
300            Ecc,
301            #[doc = "ECDSA peripheral clock signal"]
302            Ecdsa,
303            #[doc = "ETM peripheral clock signal"]
304            Etm,
305            #[doc = "HMAC peripheral clock signal"]
306            Hmac,
307            #[doc = "I2C_EXT0 peripheral clock signal"]
308            I2cExt0,
309            #[doc = "I2C_EXT1 peripheral clock signal"]
310            I2cExt1,
311            #[doc = "I2S0 peripheral clock signal"]
312            I2s0,
313            #[doc = "LEDC peripheral clock signal"]
314            Ledc,
315            #[doc = "MCPWM0 peripheral clock signal"]
316            Mcpwm0,
317            #[doc = "PARL_IO peripheral clock signal"]
318            ParlIo,
319            #[doc = "PCNT peripheral clock signal"]
320            Pcnt,
321            #[doc = "RMT peripheral clock signal"]
322            Rmt,
323            #[doc = "RSA peripheral clock signal"]
324            Rsa,
325            #[doc = "SHA peripheral clock signal"]
326            Sha,
327            #[doc = "SPI2 peripheral clock signal"]
328            Spi2,
329            #[doc = "SYSTIMER peripheral clock signal"]
330            Systimer,
331            #[doc = "TIMG0 peripheral clock signal"]
332            Timg0,
333            #[doc = "TIMG1 peripheral clock signal"]
334            Timg1,
335            #[doc = "TRACE0 peripheral clock signal"]
336            Trace0,
337            #[doc = "TSENS peripheral clock signal"]
338            Tsens,
339            #[doc = "TWAI0 peripheral clock signal"]
340            Twai0,
341            #[doc = "UART0 peripheral clock signal"]
342            Uart0,
343            #[doc = "UART1 peripheral clock signal"]
344            Uart1,
345            #[doc = "UHCI0 peripheral clock signal"]
346            Uhci0,
347            #[doc = "USB_DEVICE peripheral clock signal"]
348            UsbDevice,
349        }
350        impl Peripheral {
351            const KEEP_ENABLED: &[Peripheral] =
352                &[Self::Systimer, Self::Timg0, Self::Uart0, Self::UsbDevice];
353            const COUNT: usize = Self::ALL.len();
354            const ALL: &[Self] = &[
355                Self::Aes,
356                Self::ApbSarAdc,
357                Self::Dma,
358                Self::Ds,
359                Self::Ecc,
360                Self::Ecdsa,
361                Self::Etm,
362                Self::Hmac,
363                Self::I2cExt0,
364                Self::I2cExt1,
365                Self::I2s0,
366                Self::Ledc,
367                Self::Mcpwm0,
368                Self::ParlIo,
369                Self::Pcnt,
370                Self::Rmt,
371                Self::Rsa,
372                Self::Sha,
373                Self::Spi2,
374                Self::Systimer,
375                Self::Timg0,
376                Self::Timg1,
377                Self::Trace0,
378                Self::Tsens,
379                Self::Twai0,
380                Self::Uart0,
381                Self::Uart1,
382                Self::Uhci0,
383                Self::UsbDevice,
384            ];
385        }
386        unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
387            match peripheral {
388                Peripheral::Aes => {
389                    crate::peripherals::SYSTEM::regs()
390                        .aes_conf()
391                        .modify(|_, w| w.aes_clk_en().bit(enable));
392                }
393                Peripheral::ApbSarAdc => {
394                    crate::peripherals::SYSTEM::regs()
395                        .saradc_conf()
396                        .modify(|_, w| w.saradc_reg_clk_en().bit(enable));
397                }
398                Peripheral::Dma => {
399                    crate::peripherals::SYSTEM::regs()
400                        .gdma_conf()
401                        .modify(|_, w| w.gdma_clk_en().bit(enable));
402                }
403                Peripheral::Ds => {
404                    crate::peripherals::SYSTEM::regs()
405                        .ds_conf()
406                        .modify(|_, w| w.ds_clk_en().bit(enable));
407                }
408                Peripheral::Ecc => {
409                    crate::peripherals::SYSTEM::regs()
410                        .ecc_conf()
411                        .modify(|_, w| w.ecc_clk_en().bit(enable));
412                }
413                Peripheral::Ecdsa => {
414                    crate::peripherals::SYSTEM::regs()
415                        .ecdsa_conf()
416                        .modify(|_, w| w.ecdsa_clk_en().bit(enable));
417                }
418                Peripheral::Etm => {
419                    crate::peripherals::SYSTEM::regs()
420                        .etm_conf()
421                        .modify(|_, w| w.etm_clk_en().bit(enable));
422                }
423                Peripheral::Hmac => {
424                    crate::peripherals::SYSTEM::regs()
425                        .hmac_conf()
426                        .modify(|_, w| w.hmac_clk_en().bit(enable));
427                }
428                Peripheral::I2cExt0 => {
429                    crate::peripherals::SYSTEM::regs()
430                        .i2c0_conf()
431                        .modify(|_, w| w.i2c0_clk_en().bit(enable));
432                }
433                Peripheral::I2cExt1 => {
434                    crate::peripherals::SYSTEM::regs()
435                        .i2c1_conf()
436                        .modify(|_, w| w.i2c1_clk_en().bit(enable));
437                }
438                Peripheral::I2s0 => {
439                    crate::peripherals::SYSTEM::regs()
440                        .i2s_conf()
441                        .modify(|_, w| w.i2s_clk_en().bit(enable));
442                }
443                Peripheral::Ledc => {
444                    crate::peripherals::SYSTEM::regs()
445                        .ledc_conf()
446                        .modify(|_, w| w.ledc_clk_en().bit(enable));
447                }
448                Peripheral::Mcpwm0 => {
449                    crate::peripherals::SYSTEM::regs()
450                        .pwm_conf()
451                        .modify(|_, w| w.pwm_clk_en().bit(enable));
452                }
453                Peripheral::ParlIo => {
454                    crate::peripherals::SYSTEM::regs()
455                        .parl_io_conf()
456                        .modify(|_, w| w.parl_clk_en().bit(enable));
457                }
458                Peripheral::Pcnt => {
459                    crate::peripherals::SYSTEM::regs()
460                        .pcnt_conf()
461                        .modify(|_, w| w.pcnt_clk_en().bit(enable));
462                }
463                Peripheral::Rmt => {
464                    crate::peripherals::SYSTEM::regs()
465                        .rmt_conf()
466                        .modify(|_, w| w.rmt_clk_en().bit(enable));
467                }
468                Peripheral::Rsa => {
469                    crate::peripherals::SYSTEM::regs()
470                        .rsa_conf()
471                        .modify(|_, w| w.rsa_clk_en().bit(enable));
472                }
473                Peripheral::Sha => {
474                    crate::peripherals::SYSTEM::regs()
475                        .sha_conf()
476                        .modify(|_, w| w.sha_clk_en().bit(enable));
477                }
478                Peripheral::Spi2 => {
479                    crate::peripherals::SYSTEM::regs()
480                        .spi2_conf()
481                        .modify(|_, w| w.spi2_clk_en().bit(enable));
482                }
483                Peripheral::Systimer => {
484                    crate::peripherals::SYSTEM::regs()
485                        .systimer_conf()
486                        .modify(|_, w| w.systimer_clk_en().bit(enable));
487                }
488                Peripheral::Timg0 => {
489                    crate::peripherals::SYSTEM::regs()
490                        .timergroup0_conf()
491                        .modify(|_, w| w.tg0_clk_en().bit(enable));
492                    crate::peripherals::SYSTEM::regs()
493                        .timergroup0_timer_clk_conf()
494                        .modify(|_, w| w.tg0_timer_clk_en().bit(enable));
495                }
496                Peripheral::Timg1 => {
497                    crate::peripherals::SYSTEM::regs()
498                        .timergroup1_conf()
499                        .modify(|_, w| w.tg1_clk_en().bit(enable));
500                    crate::peripherals::SYSTEM::regs()
501                        .timergroup1_timer_clk_conf()
502                        .modify(|_, w| w.tg1_timer_clk_en().bit(enable));
503                }
504                Peripheral::Trace0 => {
505                    crate::peripherals::SYSTEM::regs()
506                        .trace_conf()
507                        .modify(|_, w| w.trace_clk_en().bit(enable));
508                }
509                Peripheral::Tsens => {
510                    crate::peripherals::SYSTEM::regs()
511                        .tsens_clk_conf()
512                        .modify(|_, w| w.tsens_clk_en().bit(enable));
513                }
514                Peripheral::Twai0 => {
515                    crate::peripherals::SYSTEM::regs()
516                        .twai0_conf()
517                        .modify(|_, w| w.twai0_clk_en().bit(enable));
518                    crate::peripherals::SYSTEM::regs()
519                        .twai0_func_clk_conf()
520                        .modify(|_, w| w.twai0_func_clk_en().bit(enable));
521                }
522                Peripheral::Uart0 => {
523                    crate::peripherals::SYSTEM::regs()
524                        .uart(0)
525                        .conf()
526                        .modify(|_, w| w.clk_en().bit(enable));
527                }
528                Peripheral::Uart1 => {
529                    crate::peripherals::SYSTEM::regs()
530                        .uart(1)
531                        .conf()
532                        .modify(|_, w| w.clk_en().bit(enable));
533                }
534                Peripheral::Uhci0 => {
535                    crate::peripherals::SYSTEM::regs()
536                        .uhci_conf()
537                        .modify(|_, w| w.uhci_clk_en().bit(enable));
538                }
539                Peripheral::UsbDevice => {
540                    crate::peripherals::SYSTEM::regs()
541                        .usb_device_conf()
542                        .modify(|_, w| w.usb_device_clk_en().bit(enable));
543                }
544            }
545        }
546        unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
547            match peripheral {
548                Peripheral::Aes => {
549                    crate::peripherals::SYSTEM::regs()
550                        .aes_conf()
551                        .modify(|_, w| w.aes_rst_en().bit(reset));
552                }
553                Peripheral::ApbSarAdc => {
554                    crate::peripherals::SYSTEM::regs()
555                        .saradc_conf()
556                        .modify(|_, w| w.saradc_reg_rst_en().bit(reset));
557                }
558                Peripheral::Dma => {
559                    crate::peripherals::SYSTEM::regs()
560                        .gdma_conf()
561                        .modify(|_, w| w.gdma_rst_en().bit(reset));
562                }
563                Peripheral::Ds => {
564                    crate::peripherals::SYSTEM::regs()
565                        .ds_conf()
566                        .modify(|_, w| w.ds_rst_en().bit(reset));
567                }
568                Peripheral::Ecc => {
569                    crate::peripherals::SYSTEM::regs()
570                        .ecc_conf()
571                        .modify(|_, w| w.ecc_rst_en().bit(reset));
572                }
573                Peripheral::Ecdsa => {
574                    crate::peripherals::SYSTEM::regs()
575                        .ecdsa_conf()
576                        .modify(|_, w| w.ecdsa_rst_en().bit(reset));
577                }
578                Peripheral::Etm => {
579                    crate::peripherals::SYSTEM::regs()
580                        .etm_conf()
581                        .modify(|_, w| w.etm_rst_en().bit(reset));
582                }
583                Peripheral::Hmac => {
584                    crate::peripherals::SYSTEM::regs()
585                        .hmac_conf()
586                        .modify(|_, w| w.hmac_rst_en().bit(reset));
587                }
588                Peripheral::I2cExt0 => {
589                    crate::peripherals::SYSTEM::regs()
590                        .i2c0_conf()
591                        .modify(|_, w| w.i2c0_rst_en().bit(reset));
592                }
593                Peripheral::I2cExt1 => {
594                    crate::peripherals::SYSTEM::regs()
595                        .i2c1_conf()
596                        .modify(|_, w| w.i2c1_rst_en().bit(reset));
597                }
598                Peripheral::I2s0 => {
599                    crate::peripherals::SYSTEM::regs()
600                        .i2s_conf()
601                        .modify(|_, w| w.i2s_rst_en().bit(reset));
602                }
603                Peripheral::Ledc => {
604                    crate::peripherals::SYSTEM::regs()
605                        .ledc_conf()
606                        .modify(|_, w| w.ledc_rst_en().bit(reset));
607                }
608                Peripheral::Mcpwm0 => {
609                    crate::peripherals::SYSTEM::regs()
610                        .pwm_conf()
611                        .modify(|_, w| w.pwm_rst_en().bit(reset));
612                }
613                Peripheral::ParlIo => {
614                    crate::peripherals::SYSTEM::regs()
615                        .parl_io_conf()
616                        .modify(|_, w| w.parl_rst_en().bit(reset));
617                }
618                Peripheral::Pcnt => {
619                    crate::peripherals::SYSTEM::regs()
620                        .pcnt_conf()
621                        .modify(|_, w| w.pcnt_rst_en().bit(reset));
622                }
623                Peripheral::Rmt => {
624                    crate::peripherals::SYSTEM::regs()
625                        .rmt_conf()
626                        .modify(|_, w| w.rmt_rst_en().bit(reset));
627                }
628                Peripheral::Rsa => {
629                    crate::peripherals::SYSTEM::regs()
630                        .rsa_conf()
631                        .modify(|_, w| w.rsa_rst_en().bit(reset));
632                }
633                Peripheral::Sha => {
634                    crate::peripherals::SYSTEM::regs()
635                        .sha_conf()
636                        .modify(|_, w| w.sha_rst_en().bit(reset));
637                }
638                Peripheral::Spi2 => {
639                    crate::peripherals::SYSTEM::regs()
640                        .spi2_conf()
641                        .modify(|_, w| w.spi2_rst_en().bit(reset));
642                }
643                Peripheral::Systimer => {
644                    crate::peripherals::SYSTEM::regs()
645                        .systimer_conf()
646                        .modify(|_, w| w.systimer_rst_en().bit(reset));
647                }
648                Peripheral::Timg0 => {
649                    crate::peripherals::SYSTEM::regs()
650                        .timergroup0_conf()
651                        .modify(|_, w| w.tg0_rst_en().bit(reset));
652                }
653                Peripheral::Timg1 => {
654                    crate::peripherals::SYSTEM::regs()
655                        .timergroup1_conf()
656                        .modify(|_, w| w.tg1_rst_en().bit(reset));
657                }
658                Peripheral::Trace0 => {
659                    crate::peripherals::SYSTEM::regs()
660                        .trace_conf()
661                        .modify(|_, w| w.trace_rst_en().bit(reset));
662                }
663                Peripheral::Tsens => {
664                    crate::peripherals::SYSTEM::regs()
665                        .tsens_clk_conf()
666                        .modify(|_, w| w.tsens_rst_en().bit(reset));
667                }
668                Peripheral::Twai0 => {
669                    crate::peripherals::SYSTEM::regs()
670                        .twai0_conf()
671                        .modify(|_, w| w.twai0_rst_en().bit(reset));
672                }
673                Peripheral::Uart0 => {
674                    crate::peripherals::SYSTEM::regs()
675                        .uart(0)
676                        .conf()
677                        .modify(|_, w| w.rst_en().bit(reset));
678                }
679                Peripheral::Uart1 => {
680                    crate::peripherals::SYSTEM::regs()
681                        .uart(1)
682                        .conf()
683                        .modify(|_, w| w.rst_en().bit(reset));
684                }
685                Peripheral::Uhci0 => {
686                    crate::peripherals::SYSTEM::regs()
687                        .uhci_conf()
688                        .modify(|_, w| w.uhci_rst_en().bit(reset));
689                }
690                Peripheral::UsbDevice => {
691                    crate::peripherals::SYSTEM::regs()
692                        .usb_device_conf()
693                        .modify(|_, w| w.usb_device_rst_en().bit(reset));
694                }
695            }
696        }
697    };
698}
699/// Macro to get the address range of the given memory region.
700///
701/// This macro provides two syntax options for each memory region:
702///
703/// - `memory_range!("region_name")` returns the address range as a range expression (`start..end`).
704/// - `memory_range!(size as str, "region_name")` returns the size of the region as a string
705///   literal.
706#[macro_export]
707#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
708macro_rules! memory_range {
709    ("DRAM") => {
710        1082130432..1082458112
711    };
712    (size as str, "DRAM") => {
713        "327680"
714    };
715    ("DRAM2_UNINIT") => {
716        1082388432..1082457824
717    };
718    (size as str, "DRAM2_UNINIT") => {
719        "69392"
720    };
721}
722#[macro_export]
723#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
724macro_rules! for_each_aes_key_length {
725    ($($pattern:tt => $code:tt;)*) => {
726        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
727        _for_each_inner!((128)); _for_each_inner!((256)); _for_each_inner!((128, 0, 4));
728        _for_each_inner!((256, 2, 6)); _for_each_inner!((bits(128), (256)));
729        _for_each_inner!((modes(128, 0, 4), (256, 2, 6)));
730    };
731}
732/// This macro can be used to generate code for each channel of the RMT peripheral.
733///
734/// For an explanation on the general syntax, as well as usage of individual/repeated
735/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
736///
737/// This macro has three options for its "Individual matcher" case:
738///
739/// - `all`: `($num:literal)`
740/// - `tx`: `($num:literal, $idx:literal)`
741/// - `rx`: `($num:literal, $idx:literal)`
742///
743/// Macro fragments:
744///
745/// - `$num`: number of the channel, e.g. `0`
746/// - `$idx`: index of the channel among channels of the same capability, e.g. `0`
747///
748/// Example data:
749///
750/// - `all`: `(0)`
751/// - `tx`: `(1, 1)`
752/// - `rx`: `(2, 0)`
753#[macro_export]
754#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
755macro_rules! for_each_rmt_channel {
756    ($($pattern:tt => $code:tt;)*) => {
757        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
758        _for_each_inner!((0)); _for_each_inner!((1)); _for_each_inner!((2));
759        _for_each_inner!((3)); _for_each_inner!((0, 0)); _for_each_inner!((1, 1));
760        _for_each_inner!((2, 0)); _for_each_inner!((3, 1)); _for_each_inner!((all(0),
761        (1), (2), (3))); _for_each_inner!((tx(0, 0), (1, 1))); _for_each_inner!((rx(2,
762        0), (3, 1)));
763    };
764}
765#[macro_export]
766#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
767macro_rules! for_each_rmt_clock_source {
768    ($($pattern:tt => $code:tt;)*) => {
769        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
770        _for_each_inner!((Xtal, 0)); _for_each_inner!((RcFast, 1));
771        _for_each_inner!((Xtal)); _for_each_inner!((all(Xtal, 0), (RcFast, 1)));
772        _for_each_inner!((default(Xtal))); _for_each_inner!((is_boolean));
773    };
774}
775#[macro_export]
776#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
777macro_rules! for_each_rsa_exponentiation {
778    ($($pattern:tt => $code:tt;)*) => {
779        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
780        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
781        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
782        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
783        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
784        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
785        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
786        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
787        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
788        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
789        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
790        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
791        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
792        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
793        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
794        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
795        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
796        _for_each_inner!((1568)); _for_each_inner!((1600)); _for_each_inner!((1632));
797        _for_each_inner!((1664)); _for_each_inner!((1696)); _for_each_inner!((1728));
798        _for_each_inner!((1760)); _for_each_inner!((1792)); _for_each_inner!((1824));
799        _for_each_inner!((1856)); _for_each_inner!((1888)); _for_each_inner!((1920));
800        _for_each_inner!((1952)); _for_each_inner!((1984)); _for_each_inner!((2016));
801        _for_each_inner!((2048)); _for_each_inner!((2080)); _for_each_inner!((2112));
802        _for_each_inner!((2144)); _for_each_inner!((2176)); _for_each_inner!((2208));
803        _for_each_inner!((2240)); _for_each_inner!((2272)); _for_each_inner!((2304));
804        _for_each_inner!((2336)); _for_each_inner!((2368)); _for_each_inner!((2400));
805        _for_each_inner!((2432)); _for_each_inner!((2464)); _for_each_inner!((2496));
806        _for_each_inner!((2528)); _for_each_inner!((2560)); _for_each_inner!((2592));
807        _for_each_inner!((2624)); _for_each_inner!((2656)); _for_each_inner!((2688));
808        _for_each_inner!((2720)); _for_each_inner!((2752)); _for_each_inner!((2784));
809        _for_each_inner!((2816)); _for_each_inner!((2848)); _for_each_inner!((2880));
810        _for_each_inner!((2912)); _for_each_inner!((2944)); _for_each_inner!((2976));
811        _for_each_inner!((3008)); _for_each_inner!((3040)); _for_each_inner!((3072));
812        _for_each_inner!((all(32), (64), (96), (128), (160), (192), (224), (256), (288),
813        (320), (352), (384), (416), (448), (480), (512), (544), (576), (608), (640),
814        (672), (704), (736), (768), (800), (832), (864), (896), (928), (960), (992),
815        (1024), (1056), (1088), (1120), (1152), (1184), (1216), (1248), (1280), (1312),
816        (1344), (1376), (1408), (1440), (1472), (1504), (1536), (1568), (1600), (1632),
817        (1664), (1696), (1728), (1760), (1792), (1824), (1856), (1888), (1920), (1952),
818        (1984), (2016), (2048), (2080), (2112), (2144), (2176), (2208), (2240), (2272),
819        (2304), (2336), (2368), (2400), (2432), (2464), (2496), (2528), (2560), (2592),
820        (2624), (2656), (2688), (2720), (2752), (2784), (2816), (2848), (2880), (2912),
821        (2944), (2976), (3008), (3040), (3072)));
822    };
823}
824#[macro_export]
825#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
826macro_rules! for_each_rsa_multiplication {
827    ($($pattern:tt => $code:tt;)*) => {
828        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
829        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
830        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
831        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
832        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
833        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
834        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
835        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
836        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
837        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
838        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
839        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
840        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
841        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
842        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
843        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
844        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
845        _for_each_inner!((all(32), (64), (96), (128), (160), (192), (224), (256), (288),
846        (320), (352), (384), (416), (448), (480), (512), (544), (576), (608), (640),
847        (672), (704), (736), (768), (800), (832), (864), (896), (928), (960), (992),
848        (1024), (1056), (1088), (1120), (1152), (1184), (1216), (1248), (1280), (1312),
849        (1344), (1376), (1408), (1440), (1472), (1504), (1536)));
850    };
851}
852#[macro_export]
853#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
854macro_rules! for_each_sha_algorithm {
855    ($($pattern:tt => $code:tt;)*) => {
856        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
857        _for_each_inner!((Sha1, "SHA-1"(sizes : 64, 20, 8) (insecure_against :
858        "collision", "length extension"), 0)); _for_each_inner!((Sha224, "SHA-224"(sizes
859        : 64, 28, 8) (insecure_against : "length extension"), 1));
860        _for_each_inner!((Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against :
861        "length extension"), 2)); _for_each_inner!((algos(Sha1, "SHA-1"(sizes : 64, 20,
862        8) (insecure_against : "collision", "length extension"), 0), (Sha224,
863        "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
864        (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
865        2)));
866    };
867}
868/// This macro can be used to generate code for each peripheral instance of the I2C master driver.
869///
870/// For an explanation on the general syntax, as well as usage of individual/repeated
871/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
872///
873/// This macro has one option for its "Individual matcher" case:
874///
875/// Syntax: `($instance:ident, $sys:ident, $scl:ident, $sda:ident)`
876///
877/// Macro fragments:
878///
879/// - `$instance`: the name of the I2C instance
880/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
881/// - `$scl`, `$sda`: peripheral signal names.
882///
883/// Example data: `(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)`
884#[macro_export]
885#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
886macro_rules! for_each_i2c_master {
887    ($($pattern:tt => $code:tt;)*) => {
888        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
889        _for_each_inner!((I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA));
890        _for_each_inner!((I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA));
891        _for_each_inner!((all(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA), (I2C1, I2cExt1,
892        I2CEXT1_SCL, I2CEXT1_SDA)));
893    };
894}
895/// This macro can be used to generate code for each peripheral instance of the UART driver.
896///
897/// For an explanation on the general syntax, as well as usage of individual/repeated
898/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
899///
900/// This macro has one option for its "Individual matcher" case:
901///
902/// Syntax: `($instance:ident, $sys:ident, $rx:ident, $tx:ident, $cts:ident, $rts:ident)`
903///
904/// Macro fragments:
905///
906/// - `$instance`: the name of the UART instance
907/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
908/// - `$rx`, `$tx`, `$cts`, `$rts`: signal names.
909///
910/// Example data: `(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS)`
911#[macro_export]
912#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
913macro_rules! for_each_uart {
914    ($($pattern:tt => $code:tt;)*) => {
915        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
916        _for_each_inner!((UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS));
917        _for_each_inner!((UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS));
918        _for_each_inner!((all(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS), (UART1, Uart1,
919        U1RXD, U1TXD, U1CTS, U1RTS)));
920    };
921}
922/// This macro can be used to generate code for each peripheral instance of the SPI master driver.
923///
924/// For an explanation on the general syntax, as well as usage of individual/repeated
925/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
926///
927/// This macro has one option for its "Individual matcher" case:
928///
929/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, [$($cs:ident),*] [$($sio:ident),*
930/// $($is_qspi:iteral)?])`
931///
932/// Macro fragments:
933///
934/// - `$instance`: the name of the SPI instance
935/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
936/// - `$cs`, `$sio`: chip select and SIO signal names.
937/// - `$is_qspi`: a `true` literal present if the SPI instance supports QSPI.
938///
939/// Example data:
940/// - `(SPI2, Spi2, FSPICLK [FSPICS0, FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ,
941///   FSPIWP, FSPIHD, FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7], true)`
942/// - `(SPI3, Spi3, SPI3_CLK [SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q])`
943#[macro_export]
944#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
945macro_rules! for_each_spi_master {
946    ($($pattern:tt => $code:tt;)*) => {
947        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
948        _for_each_inner!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3,
949        FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD], true));
950        _for_each_inner!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3,
951        FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD], true)));
952    };
953}
954/// This macro can be used to generate code for each peripheral instance of the SPI slave driver.
955///
956/// For an explanation on the general syntax, as well as usage of individual/repeated
957/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
958///
959/// This macro has one option for its "Individual matcher" case:
960///
961/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, $mosi:ident, $miso:ident, $cs:ident)`
962///
963/// Macro fragments:
964///
965/// - `$instance`: the name of the I2C instance
966/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
967/// - `$mosi`, `$miso`, `$cs`: signal names.
968///
969/// Example data: `(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)`
970#[macro_export]
971#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
972macro_rules! for_each_spi_slave {
973    ($($pattern:tt => $code:tt;)*) => {
974        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
975        _for_each_inner!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
976        _for_each_inner!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)));
977    };
978}
979#[macro_export]
980#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
981macro_rules! for_each_peripheral {
982    ($($pattern:tt => $code:tt;)*) => {
983        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
984        _for_each_inner!((GPIO0 <= virtual())); _for_each_inner!((GPIO1 <= virtual()));
985        _for_each_inner!((GPIO2 <= virtual())); _for_each_inner!((GPIO3 <= virtual()));
986        _for_each_inner!((GPIO4 <= virtual())); _for_each_inner!((GPIO5 <= virtual()));
987        _for_each_inner!((GPIO8 <= virtual())); _for_each_inner!((GPIO9 <= virtual()));
988        _for_each_inner!((GPIO10 <= virtual())); _for_each_inner!((GPIO11 <= virtual()));
989        _for_each_inner!((GPIO12 <= virtual())); _for_each_inner!((GPIO13 <= virtual()));
990        _for_each_inner!((GPIO14 <= virtual())); _for_each_inner!((GPIO22 <= virtual()));
991        _for_each_inner!((GPIO23 <= virtual())); _for_each_inner!((GPIO24 <= virtual()));
992        _for_each_inner!((GPIO25 <= virtual())); _for_each_inner!((GPIO26 <= virtual()));
993        _for_each_inner!((GPIO27 <= virtual())); _for_each_inner!((AES <= AES(AES : {
994        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
995        (unstable))); _for_each_inner!((APB_SARADC <= APB_SARADC() (unstable)));
996        _for_each_inner!((ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
997        _for_each_inner!((DMA <= DMA() (unstable))); _for_each_inner!((DS <= DS()
998        (unstable))); _for_each_inner!((ECC <= ECC() (unstable)));
999        _for_each_inner!((EFUSE <= EFUSE() (unstable))); _for_each_inner!((GPIO <= GPIO()
1000        (unstable))); _for_each_inner!((GPIO_SD <= GPIO_SD() (unstable)));
1001        _for_each_inner!((HMAC <= HMAC() (unstable))); _for_each_inner!((HP_APM <=
1002        HP_APM() (unstable))); _for_each_inner!((HP_SYS <= HP_SYS() (unstable)));
1003        _for_each_inner!((I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
1004        _for_each_inner!((I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
1005        enable_peri_interrupt, disable_peri_interrupt }))); _for_each_inner!((I2C1 <=
1006        I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
1007        disable_peri_interrupt }))); _for_each_inner!((I2S0 <= I2S0(I2S0 : {
1008        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
1009        (unstable))); _for_each_inner!((IEEE802154 <= IEEE802154() (unstable)));
1010        _for_each_inner!((INTERRUPT_CORE0 <= INTERRUPT_CORE0() (unstable)));
1011        _for_each_inner!((INTPRI <= INTPRI() (unstable))); _for_each_inner!((IO_MUX <=
1012        IO_MUX() (unstable))); _for_each_inner!((LEDC <= LEDC() (unstable)));
1013        _for_each_inner!((LPWR <= LP_CLKRST() (unstable))); _for_each_inner!((LP_ANA <=
1014        LP_ANA() (unstable))); _for_each_inner!((LP_AON <= LP_AON() (unstable)));
1015        _for_each_inner!((LP_APM <= LP_APM() (unstable))); _for_each_inner!((LP_APM0 <=
1016        LP_APM0() (unstable))); _for_each_inner!((LP_CLKRST <= LP_CLKRST() (unstable)));
1017        _for_each_inner!((LP_PERI <= LP_PERI() (unstable))); _for_each_inner!((LP_TIMER
1018        <= LP_TIMER() (unstable))); _for_each_inner!((LP_WDT <= LP_WDT() (unstable)));
1019        _for_each_inner!((MCPWM0 <= MCPWM0() (unstable))); _for_each_inner!((MEM_MONITOR
1020        <= MEM_MONITOR() (unstable))); _for_each_inner!((MODEM_LPCON <= MODEM_LPCON()
1021        (unstable))); _for_each_inner!((MODEM_SYSCON <= MODEM_SYSCON() (unstable)));
1022        _for_each_inner!((OTP_DEBUG <= OTP_DEBUG() (unstable)));
1023        _for_each_inner!((PARL_IO <= PARL_IO(PARL_IO_RX : { bind_rx_interrupt,
1024        enable_rx_interrupt, disable_rx_interrupt }, PARL_IO_TX : { bind_tx_interrupt,
1025        enable_tx_interrupt, disable_tx_interrupt }) (unstable))); _for_each_inner!((PAU
1026        <= PAU() (unstable))); _for_each_inner!((PCNT <= PCNT() (unstable)));
1027        _for_each_inner!((PCR <= PCR() (unstable))); _for_each_inner!((PLIC_MX <=
1028        PLIC_MX() (unstable))); _for_each_inner!((PMU <= PMU() (unstable)));
1029        _for_each_inner!((RMT <= RMT() (unstable))); _for_each_inner!((RNG <= RNG()
1030        (unstable))); _for_each_inner!((RSA <= RSA(RSA : { bind_peri_interrupt,
1031        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
1032        _for_each_inner!((SHA <= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt,
1033        disable_peri_interrupt }) (unstable))); _for_each_inner!((ETM <= SOC_ETM()
1034        (unstable))); _for_each_inner!((SPI0 <= SPI0() (unstable)));
1035        _for_each_inner!((SPI1 <= SPI1() (unstable))); _for_each_inner!((SPI2 <=
1036        SPI2(SPI2 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
1037        }))); _for_each_inner!((SYSTEM <= PCR() (unstable))); _for_each_inner!((SYSTIMER
1038        <= SYSTIMER() (unstable))); _for_each_inner!((TEE <= TEE() (unstable)));
1039        _for_each_inner!((TIMG0 <= TIMG0() (unstable))); _for_each_inner!((TIMG1 <=
1040        TIMG1() (unstable))); _for_each_inner!((TRACE0 <= TRACE() (unstable)));
1041        _for_each_inner!((TWAI0 <= TWAI0() (unstable))); _for_each_inner!((UART0 <=
1042        UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
1043        disable_peri_interrupt }))); _for_each_inner!((UART1 <= UART1(UART1 : {
1044        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })));
1045        _for_each_inner!((UHCI0 <= UHCI0() (unstable))); _for_each_inner!((USB_DEVICE <=
1046        USB_DEVICE(USB_DEVICE : { bind_peri_interrupt, enable_peri_interrupt,
1047        disable_peri_interrupt }) (unstable))); _for_each_inner!((DMA_CH0 <= virtual()
1048        (unstable))); _for_each_inner!((DMA_CH1 <= virtual() (unstable)));
1049        _for_each_inner!((DMA_CH2 <= virtual() (unstable))); _for_each_inner!((ADC1 <=
1050        virtual() (unstable))); _for_each_inner!((BT <= virtual() (unstable)));
1051        _for_each_inner!((FLASH <= virtual() (unstable))); _for_each_inner!((SW_INTERRUPT
1052        <= virtual() (unstable))); _for_each_inner!((MEM2MEM1 <= virtual() (unstable)));
1053        _for_each_inner!((MEM2MEM4 <= virtual() (unstable))); _for_each_inner!((MEM2MEM5
1054        <= virtual() (unstable))); _for_each_inner!((MEM2MEM10 <= virtual() (unstable)));
1055        _for_each_inner!((MEM2MEM11 <= virtual() (unstable)));
1056        _for_each_inner!((MEM2MEM12 <= virtual() (unstable)));
1057        _for_each_inner!((MEM2MEM13 <= virtual() (unstable)));
1058        _for_each_inner!((MEM2MEM14 <= virtual() (unstable)));
1059        _for_each_inner!((MEM2MEM15 <= virtual() (unstable)));
1060        _for_each_inner!((all(GPIO0 <= virtual()), (GPIO1 <= virtual()), (GPIO2 <=
1061        virtual()), (GPIO3 <= virtual()), (GPIO4 <= virtual()), (GPIO5 <= virtual()),
1062        (GPIO8 <= virtual()), (GPIO9 <= virtual()), (GPIO10 <= virtual()), (GPIO11 <=
1063        virtual()), (GPIO12 <= virtual()), (GPIO13 <= virtual()), (GPIO14 <= virtual()),
1064        (GPIO22 <= virtual()), (GPIO23 <= virtual()), (GPIO24 <= virtual()), (GPIO25 <=
1065        virtual()), (GPIO26 <= virtual()), (GPIO27 <= virtual()), (AES <= AES(AES : {
1066        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
1067        (unstable)), (APB_SARADC <= APB_SARADC() (unstable)), (ASSIST_DEBUG <=
1068        ASSIST_DEBUG() (unstable)), (DMA <= DMA() (unstable)), (DS <= DS() (unstable)),
1069        (ECC <= ECC() (unstable)), (EFUSE <= EFUSE() (unstable)), (GPIO <= GPIO()
1070        (unstable)), (GPIO_SD <= GPIO_SD() (unstable)), (HMAC <= HMAC() (unstable)),
1071        (HP_APM <= HP_APM() (unstable)), (HP_SYS <= HP_SYS() (unstable)), (I2C_ANA_MST <=
1072        I2C_ANA_MST() (unstable)), (I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
1073        enable_peri_interrupt, disable_peri_interrupt })), (I2C1 <= I2C1(I2C_EXT1 : {
1074        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (I2S0 <=
1075        I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
1076        }) (unstable)), (IEEE802154 <= IEEE802154() (unstable)), (INTERRUPT_CORE0 <=
1077        INTERRUPT_CORE0() (unstable)), (INTPRI <= INTPRI() (unstable)), (IO_MUX <=
1078        IO_MUX() (unstable)), (LEDC <= LEDC() (unstable)), (LPWR <= LP_CLKRST()
1079        (unstable)), (LP_ANA <= LP_ANA() (unstable)), (LP_AON <= LP_AON() (unstable)),
1080        (LP_APM <= LP_APM() (unstable)), (LP_APM0 <= LP_APM0() (unstable)), (LP_CLKRST <=
1081        LP_CLKRST() (unstable)), (LP_PERI <= LP_PERI() (unstable)), (LP_TIMER <=
1082        LP_TIMER() (unstable)), (LP_WDT <= LP_WDT() (unstable)), (MCPWM0 <= MCPWM0()
1083        (unstable)), (MEM_MONITOR <= MEM_MONITOR() (unstable)), (MODEM_LPCON <=
1084        MODEM_LPCON() (unstable)), (MODEM_SYSCON <= MODEM_SYSCON() (unstable)),
1085        (OTP_DEBUG <= OTP_DEBUG() (unstable)), (PARL_IO <= PARL_IO(PARL_IO_RX : {
1086        bind_rx_interrupt, enable_rx_interrupt, disable_rx_interrupt }, PARL_IO_TX : {
1087        bind_tx_interrupt, enable_tx_interrupt, disable_tx_interrupt }) (unstable)), (PAU
1088        <= PAU() (unstable)), (PCNT <= PCNT() (unstable)), (PCR <= PCR() (unstable)),
1089        (PLIC_MX <= PLIC_MX() (unstable)), (PMU <= PMU() (unstable)), (RMT <= RMT()
1090        (unstable)), (RNG <= RNG() (unstable)), (RSA <= RSA(RSA : { bind_peri_interrupt,
1091        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (SHA <= SHA(SHA : {
1092        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
1093        (unstable)), (ETM <= SOC_ETM() (unstable)), (SPI0 <= SPI0() (unstable)), (SPI1 <=
1094        SPI1() (unstable)), (SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
1095        enable_peri_interrupt, disable_peri_interrupt })), (SYSTEM <= PCR() (unstable)),
1096        (SYSTIMER <= SYSTIMER() (unstable)), (TEE <= TEE() (unstable)), (TIMG0 <= TIMG0()
1097        (unstable)), (TIMG1 <= TIMG1() (unstable)), (TRACE0 <= TRACE() (unstable)),
1098        (TWAI0 <= TWAI0() (unstable)), (UART0 <= UART0(UART0 : { bind_peri_interrupt,
1099        enable_peri_interrupt, disable_peri_interrupt })), (UART1 <= UART1(UART1 : {
1100        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (UHCI0 <=
1101        UHCI0() (unstable)), (USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
1102        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
1103        (unstable)), (DMA_CH0 <= virtual() (unstable)), (DMA_CH1 <= virtual()
1104        (unstable)), (DMA_CH2 <= virtual() (unstable)), (ADC1 <= virtual() (unstable)),
1105        (BT <= virtual() (unstable)), (FLASH <= virtual() (unstable)), (SW_INTERRUPT <=
1106        virtual() (unstable)), (MEM2MEM1 <= virtual() (unstable)), (MEM2MEM4 <= virtual()
1107        (unstable)), (MEM2MEM5 <= virtual() (unstable)), (MEM2MEM10 <= virtual()
1108        (unstable)), (MEM2MEM11 <= virtual() (unstable)), (MEM2MEM12 <= virtual()
1109        (unstable)), (MEM2MEM13 <= virtual() (unstable)), (MEM2MEM14 <= virtual()
1110        (unstable)), (MEM2MEM15 <= virtual() (unstable))));
1111    };
1112}
1113/// This macro can be used to generate code for each `GPIOn` instance.
1114///
1115/// For an explanation on the general syntax, as well as usage of individual/repeated
1116/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
1117///
1118/// This macro has one option for its "Individual matcher" case:
1119///
1120/// Syntax: `($n:literal, $gpio:ident ($($digital_input_function:ident =>
1121/// $digital_input_signal:ident)*) ($($digital_output_function:ident =>
1122/// $digital_output_signal:ident)*) ($([$pin_attribute:ident])*))`
1123///
1124/// Macro fragments:
1125///
1126/// - `$n`: the number of the GPIO. For `GPIO0`, `$n` is 0.
1127/// - `$gpio`: the name of the GPIO.
1128/// - `$digital_input_function`: the number of the digital function, as an identifier (i.e. for
1129///   function 0 this is `_0`).
1130/// - `$digital_input_function`: the name of the digital function, as an identifier.
1131/// - `$digital_output_function`: the number of the digital function, as an identifier (i.e. for
1132///   function 0 this is `_0`).
1133/// - `$digital_output_function`: the name of the digital function, as an identifier.
1134/// - `$pin_attribute`: `Input` and/or `Output`, marks the possible directions of the GPIO.
1135///   Bracketed so that they can also be matched as optional fragments. Order is always Input first.
1136///
1137/// Example data: `(0, GPIO0 (_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input]
1138/// [Output]))`
1139#[macro_export]
1140#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1141macro_rules! for_each_gpio {
1142    ($($pattern:tt => $code:tt;)*) => {
1143        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
1144        _for_each_inner!((0, GPIO0(_2 => FSPIQ) (_2 => FSPIQ) ([Input] [Output])));
1145        _for_each_inner!((1, GPIO1(_2 => FSPICS0) (_2 => FSPICS0) ([Input] [Output])));
1146        _for_each_inner!((2, GPIO2(_0 => MTMS _2 => FSPIWP) (_2 => FSPIWP) ([Input]
1147        [Output]))); _for_each_inner!((3, GPIO3(_0 => MTDI _2 => FSPIHD) (_2 => FSPIHD)
1148        ([Input] [Output]))); _for_each_inner!((4, GPIO4(_0 => MTCK _2 => FSPICLK) (_2 =>
1149        FSPICLK) ([Input] [Output]))); _for_each_inner!((5, GPIO5(_2 => FSPID) (_0 =>
1150        MTDO _2 => FSPID) ([Input] [Output]))); _for_each_inner!((8, GPIO8() () ([Input]
1151        [Output]))); _for_each_inner!((9, GPIO9() () ([Input] [Output])));
1152        _for_each_inner!((10, GPIO10() () ([Input] [Output]))); _for_each_inner!((11,
1153        GPIO11() () ([Input] [Output]))); _for_each_inner!((12, GPIO12() () ([Input]
1154        [Output]))); _for_each_inner!((13, GPIO13() () ([Input] [Output])));
1155        _for_each_inner!((14, GPIO14() () ([Input] [Output]))); _for_each_inner!((22,
1156        GPIO22() () ([Input] [Output]))); _for_each_inner!((23, GPIO23(_0 => U0RXD) (_2
1157        => FSPICS1) ([Input] [Output]))); _for_each_inner!((24, GPIO24() (_0 => U0TXD _2
1158        => FSPICS2) ([Input] [Output]))); _for_each_inner!((25, GPIO25() (_2 => FSPICS3)
1159        ([Input] [Output]))); _for_each_inner!((26, GPIO26() (_2 => FSPICS4) ([Input]
1160        [Output]))); _for_each_inner!((27, GPIO27() (_2 => FSPICS5) ([Input] [Output])));
1161        _for_each_inner!((all(0, GPIO0(_2 => FSPIQ) (_2 => FSPIQ) ([Input] [Output])),
1162        (1, GPIO1(_2 => FSPICS0) (_2 => FSPICS0) ([Input] [Output])), (2, GPIO2(_0 =>
1163        MTMS _2 => FSPIWP) (_2 => FSPIWP) ([Input] [Output])), (3, GPIO3(_0 => MTDI _2 =>
1164        FSPIHD) (_2 => FSPIHD) ([Input] [Output])), (4, GPIO4(_0 => MTCK _2 => FSPICLK)
1165        (_2 => FSPICLK) ([Input] [Output])), (5, GPIO5(_2 => FSPID) (_0 => MTDO _2 =>
1166        FSPID) ([Input] [Output])), (8, GPIO8() () ([Input] [Output])), (9, GPIO9() ()
1167        ([Input] [Output])), (10, GPIO10() () ([Input] [Output])), (11, GPIO11() ()
1168        ([Input] [Output])), (12, GPIO12() () ([Input] [Output])), (13, GPIO13() ()
1169        ([Input] [Output])), (14, GPIO14() () ([Input] [Output])), (22, GPIO22() ()
1170        ([Input] [Output])), (23, GPIO23(_0 => U0RXD) (_2 => FSPICS1) ([Input]
1171        [Output])), (24, GPIO24() (_0 => U0TXD _2 => FSPICS2) ([Input] [Output])), (25,
1172        GPIO25() (_2 => FSPICS3) ([Input] [Output])), (26, GPIO26() (_2 => FSPICS4)
1173        ([Input] [Output])), (27, GPIO27() (_2 => FSPICS5) ([Input] [Output]))));
1174    };
1175}
1176/// This macro can be used to generate code for each analog function of each GPIO.
1177///
1178/// For an explanation on the general syntax, as well as usage of individual/repeated
1179/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
1180///
1181/// This macro has two options for its "Individual matcher" case:
1182///
1183/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
1184/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
1185///   expanded signal case, where you need the number(s) of a signal, or the general group to which
1186///   the signal belongs. For example, in case of `ADC2_CH3` the expanded form looks like
1187///   `(ADC2_CH3, ADCn_CHm, 2, 3)`.
1188///
1189/// Macro fragments:
1190///
1191/// - `$signal`: the name of the signal.
1192/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
1193///   is `ADCn_CHm`.
1194/// - `$number`: the numbers extracted from `$signal`.
1195/// - `$gpio`: the name of the GPIO.
1196///
1197/// Example data:
1198/// - `(ADC2_CH5, GPIO12)`
1199/// - `((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12)`
1200///
1201/// The expanded syntax is only available when the signal has at least one numbered component.
1202#[macro_export]
1203#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1204macro_rules! for_each_analog_function {
1205    ($($pattern:tt => $code:tt;)*) => {
1206        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
1207        _for_each_inner!((ADC1_CH0, GPIO1)); _for_each_inner!((ADC1_CH1, GPIO2));
1208        _for_each_inner!((ADC1_CH2, GPIO3)); _for_each_inner!((ADC1_CH3, GPIO4));
1209        _for_each_inner!((ADC1_CH4, GPIO5)); _for_each_inner!((ZCD0, GPIO10));
1210        _for_each_inner!((ZCD1, GPIO11)); _for_each_inner!((XTAL_32K_P, GPIO13));
1211        _for_each_inner!((XTAL_32K_N, GPIO14)); _for_each_inner!((USB_DM, GPIO26));
1212        _for_each_inner!((USB_DP, GPIO27)); _for_each_inner!(((ADC1_CH0, ADCn_CHm, 1, 0),
1213        GPIO1)); _for_each_inner!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2));
1214        _for_each_inner!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3));
1215        _for_each_inner!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4));
1216        _for_each_inner!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5)); _for_each_inner!(((ZCD0,
1217        ZCDn, 0), GPIO10)); _for_each_inner!(((ZCD1, ZCDn, 1), GPIO11));
1218        _for_each_inner!((all(ADC1_CH0, GPIO1), (ADC1_CH1, GPIO2), (ADC1_CH2, GPIO3),
1219        (ADC1_CH3, GPIO4), (ADC1_CH4, GPIO5), (ZCD0, GPIO10), (ZCD1, GPIO11),
1220        (XTAL_32K_P, GPIO13), (XTAL_32K_N, GPIO14), (USB_DM, GPIO26), (USB_DP, GPIO27)));
1221        _for_each_inner!((all_expanded((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1), ((ADC1_CH1,
1222        ADCn_CHm, 1, 1), GPIO2), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3), ((ADC1_CH3,
1223        ADCn_CHm, 1, 3), GPIO4), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5), ((ZCD0, ZCDn, 0),
1224        GPIO10), ((ZCD1, ZCDn, 1), GPIO11)));
1225    };
1226}
1227/// This macro can be used to generate code for each LP/RTC function of each GPIO.
1228///
1229/// For an explanation on the general syntax, as well as usage of individual/repeated
1230/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
1231///
1232/// This macro has two options for its "Individual matcher" case:
1233///
1234/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
1235/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
1236///   expanded signal case, where you need the number(s) of a signal, or the general group to which
1237///   the signal belongs. For example, in case of `SAR_I2C_SCL_1` the expanded form looks like
1238///   `(SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1)`.
1239///
1240/// Macro fragments:
1241///
1242/// - `$signal`: the name of the signal.
1243/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
1244///   is `ADCn_CHm`.
1245/// - `$number`: the numbers extracted from `$signal`.
1246/// - `$gpio`: the name of the GPIO.
1247///
1248/// Example data:
1249/// - `(RTC_GPIO15, GPIO12)`
1250/// - `((RTC_GPIO15, RTC_GPIOn, 15), GPIO12)`
1251///
1252/// The expanded syntax is only available when the signal has at least one numbered component.
1253#[macro_export]
1254#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1255macro_rules! for_each_lp_function {
1256    ($($pattern:tt => $code:tt;)*) => {
1257        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
1258        _for_each_inner!((all)); _for_each_inner!((all_expanded));
1259    };
1260}
1261/// Defines the `InputSignal` and `OutputSignal` enums.
1262///
1263/// This macro is intended to be called in esp-hal only.
1264#[macro_export]
1265#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1266macro_rules! define_io_mux_signals {
1267    () => {
1268        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
1269        #[derive(Debug, PartialEq, Copy, Clone)]
1270        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1271        #[doc(hidden)]
1272        pub enum InputSignal {
1273            EXT_ADC_START       = 0,
1274            U0RXD               = 6,
1275            U0CTS               = 7,
1276            U0DSR               = 8,
1277            U1RXD               = 9,
1278            U1CTS               = 10,
1279            U1DSR               = 11,
1280            I2S_MCLK            = 12,
1281            I2SO_BCK            = 13,
1282            I2SO_WS             = 14,
1283            I2SI_SD             = 15,
1284            I2SI_BCK            = 16,
1285            I2SI_WS             = 17,
1286            USB_JTAG_TDO_BRIDGE = 19,
1287            CPU_GPIO0           = 28,
1288            CPU_GPIO1           = 29,
1289            CPU_GPIO2           = 30,
1290            CPU_GPIO3           = 31,
1291            CPU_GPIO4           = 32,
1292            CPU_GPIO5           = 33,
1293            CPU_GPIO6           = 34,
1294            CPU_GPIO7           = 35,
1295            I2CEXT0_SCL         = 45,
1296            I2CEXT0_SDA         = 46,
1297            PARL_RX_DATA0       = 47,
1298            PARL_RX_DATA1       = 48,
1299            PARL_RX_DATA2       = 49,
1300            PARL_RX_DATA3       = 50,
1301            PARL_RX_DATA4       = 51,
1302            PARL_RX_DATA5       = 52,
1303            PARL_RX_DATA6       = 53,
1304            PARL_RX_DATA7       = 54,
1305            I2CEXT1_SCL         = 55,
1306            I2CEXT1_SDA         = 56,
1307            FSPICLK             = 63,
1308            FSPIQ               = 64,
1309            FSPID               = 65,
1310            FSPIHD              = 66,
1311            FSPIWP              = 67,
1312            FSPICS0             = 68,
1313            PARL_RX_CLK         = 69,
1314            PARL_TX_CLK         = 70,
1315            RMT_SIG_0           = 71,
1316            RMT_SIG_1           = 72,
1317            TWAI0_RX            = 73,
1318            PWM0_SYNC0          = 87,
1319            PWM0_SYNC1          = 88,
1320            PWM0_SYNC2          = 89,
1321            PWM0_F0             = 90,
1322            PWM0_F1             = 91,
1323            PWM0_F2             = 92,
1324            PWM0_CAP0           = 93,
1325            PWM0_CAP1           = 94,
1326            PWM0_CAP2           = 95,
1327            SIG_FUNC_97         = 97,
1328            SIG_FUNC_98         = 98,
1329            SIG_FUNC_99         = 99,
1330            SIG_FUNC_100        = 100,
1331            PCNT0_SIG_CH0       = 101,
1332            PCNT0_SIG_CH1       = 102,
1333            PCNT0_CTRL_CH0      = 103,
1334            PCNT0_CTRL_CH1      = 104,
1335            PCNT1_SIG_CH0       = 105,
1336            PCNT1_SIG_CH1       = 106,
1337            PCNT1_CTRL_CH0      = 107,
1338            PCNT1_CTRL_CH1      = 108,
1339            PCNT2_SIG_CH0       = 109,
1340            PCNT2_SIG_CH1       = 110,
1341            PCNT2_CTRL_CH0      = 111,
1342            PCNT2_CTRL_CH1      = 112,
1343            PCNT3_SIG_CH0       = 113,
1344            PCNT3_SIG_CH1       = 114,
1345            PCNT3_CTRL_CH0      = 115,
1346            PCNT3_CTRL_CH1      = 116,
1347            SPIQ                = 121,
1348            SPID                = 122,
1349            SPIHD               = 123,
1350            SPIWP               = 124,
1351            MTDI,
1352            MTCK,
1353            MTMS,
1354        }
1355        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
1356        #[derive(Debug, PartialEq, Copy, Clone)]
1357        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1358        #[doc(hidden)]
1359        pub enum OutputSignal {
1360            LEDC_LS_SIG0     = 0,
1361            LEDC_LS_SIG1     = 1,
1362            LEDC_LS_SIG2     = 2,
1363            LEDC_LS_SIG3     = 3,
1364            LEDC_LS_SIG4     = 4,
1365            LEDC_LS_SIG5     = 5,
1366            U0TXD            = 6,
1367            U0RTS            = 7,
1368            U0DTR            = 8,
1369            U1TXD            = 9,
1370            U1RTS            = 10,
1371            U1DTR            = 11,
1372            I2S_MCLK         = 12,
1373            I2SO_BCK         = 13,
1374            I2SO_WS          = 14,
1375            I2SO_SD          = 15,
1376            I2SI_BCK         = 16,
1377            I2SI_WS          = 17,
1378            I2SO_SD1         = 18,
1379            USB_JTAG_TRST    = 19,
1380            CPU_GPIO_OUT0    = 28,
1381            CPU_GPIO_OUT1    = 29,
1382            CPU_GPIO_OUT2    = 30,
1383            CPU_GPIO_OUT3    = 31,
1384            CPU_GPIO_OUT4    = 32,
1385            CPU_GPIO_OUT5    = 33,
1386            CPU_GPIO_OUT6    = 34,
1387            CPU_GPIO_OUT7    = 35,
1388            I2CEXT0_SCL      = 45,
1389            I2CEXT0_SDA      = 46,
1390            PARL_TX_DATA0    = 47,
1391            PARL_TX_DATA1    = 48,
1392            PARL_TX_DATA2    = 49,
1393            PARL_TX_DATA3    = 50,
1394            PARL_TX_DATA4    = 51,
1395            PARL_TX_DATA5    = 52,
1396            PARL_TX_DATA6    = 53,
1397            PARL_TX_DATA7    = 54,
1398            I2CEXT1_SCL      = 55,
1399            I2CEXT1_SDA      = 56,
1400            FSPICLK          = 63,
1401            FSPIQ            = 64,
1402            FSPID            = 65,
1403            FSPIHD           = 66,
1404            FSPIWP           = 67,
1405            FSPICS0          = 68,
1406            PARL_RX_CLK      = 69,
1407            PARL_TX_CLK      = 70,
1408            RMT_SIG_0        = 71,
1409            RMT_SIG_1        = 72,
1410            TWAI0_TX         = 73,
1411            TWAI0_BUS_OFF_ON = 74,
1412            TWAI0_CLKOUT     = 75,
1413            TWAI0_STANDBY    = 76,
1414            CTE_ANT7         = 78,
1415            CTE_ANT8         = 79,
1416            CTE_ANT9         = 80,
1417            GPIO_SD0         = 83,
1418            GPIO_SD1         = 84,
1419            GPIO_SD2         = 85,
1420            GPIO_SD3         = 86,
1421            PWM0_0A          = 87,
1422            PWM0_0B          = 88,
1423            PWM0_1A          = 89,
1424            PWM0_1B          = 90,
1425            PWM0_2A          = 91,
1426            PWM0_2B          = 92,
1427            SIG_IN_FUNC97    = 97,
1428            SIG_IN_FUNC98    = 98,
1429            SIG_IN_FUNC99    = 99,
1430            SIG_IN_FUNC100   = 100,
1431            FSPICS1          = 101,
1432            FSPICS2          = 102,
1433            FSPICS3          = 103,
1434            FSPICS4          = 104,
1435            FSPICS5          = 105,
1436            CTE_ANT10        = 106,
1437            CTE_ANT11        = 107,
1438            CTE_ANT12        = 108,
1439            CTE_ANT13        = 109,
1440            CTE_ANT14        = 110,
1441            CTE_ANT15        = 111,
1442            SPICLK           = 114,
1443            SPICS0           = 115,
1444            SPICS1           = 116,
1445            SPIQ             = 121,
1446            SPID             = 122,
1447            SPIHD            = 123,
1448            SPIWP            = 124,
1449            CLK_OUT_OUT1     = 125,
1450            CLK_OUT_OUT2     = 126,
1451            CLK_OUT_OUT3     = 127,
1452            GPIO             = 128,
1453            MTDO,
1454        }
1455    };
1456}
1457/// Defines and implements the `io_mux_reg` function.
1458///
1459/// The generated function has the following signature:
1460///
1461/// ```rust,ignore
1462/// pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO0 {
1463///     // ...
1464/// # unimplemented!()
1465/// }
1466/// ```
1467///
1468/// This macro is intended to be called in esp-hal only.
1469#[macro_export]
1470#[expect(clippy::crate_in_macro_def)]
1471#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1472macro_rules! define_io_mux_reg {
1473    () => {
1474        pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
1475            crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
1476        }
1477    };
1478}