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