Skip to main content

esp_metadata_generated/
_generated_esp32s31.rs

1// Do NOT edit this file directly. Make your changes to esp-metadata,
2// then run `cargo 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        "esp32s31"
18    };
19}
20/// The pretty name of the chip as `&str`
21///
22/// # Example
23///
24/// ```rust, no_run
25/// use esp_hal::chip;
26/// let chip_name = chip_pretty!();
27#[doc = concat!("assert_eq!(chip_name, ", chip_pretty!(), ")")]
28/// ```
29#[macro_export]
30#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
31macro_rules! chip_pretty {
32    () => {
33        "ESP32-S31"
34    };
35}
36/// The properties of this chip and its drivers.
37#[macro_export]
38#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
39macro_rules! property {
40    ("chip") => {
41        "esp32s31"
42    };
43    ("arch") => {
44        "riscv"
45    };
46    ("cores") => {
47        2
48    };
49    ("cores", str) => {
50        stringify!(2)
51    };
52    ("trm") => {
53        "https://www.espressif.com/sites/default/files/documentation/esp32-s31_technical_reference_manual_en.pdf"
54    };
55    ("gpio.version") => {
56        3
57    };
58    ("gpio.version", str) => {
59        stringify!(3)
60    };
61    ("gpio.has_input_sync") => {
62        true
63    };
64    ("gpio.gpio_function") => {
65        1
66    };
67    ("gpio.gpio_function", str) => {
68        stringify!(1)
69    };
70    ("gpio.constant_0_input") => {
71        192
72    };
73    ("gpio.constant_0_input", str) => {
74        stringify!(192)
75    };
76    ("gpio.constant_1_input") => {
77        128
78    };
79    ("gpio.constant_1_input", str) => {
80        stringify!(128)
81    };
82    ("gpio.remap_iomux_pin_registers") => {
83        false
84    };
85    ("gpio.func_in_sel_offset") => {
86        0
87    };
88    ("gpio.func_in_sel_offset", str) => {
89        stringify!(0)
90    };
91    ("gpio.has_bank_1") => {
92        true
93    };
94    ("gpio.input_signal_max") => {
95        255
96    };
97    ("gpio.input_signal_max", str) => {
98        stringify!(255)
99    };
100    ("gpio.output_signal_max") => {
101        256
102    };
103    ("gpio.output_signal_max", str) => {
104        stringify!(256)
105    };
106    ("dedicated_gpio.version") => {
107        "riscv_v2"
108    };
109    ("dedicated_gpio.needs_initialization") => {
110        false
111    };
112    ("dedicated_gpio.channel_count") => {
113        8
114    };
115    ("dedicated_gpio.channel_count", str) => {
116        stringify!(8)
117    };
118    ("lp_io.version") => {
119        "esp32s31"
120    };
121    ("lp_io.has_gpio_matrix") => {
122        true
123    };
124    ("uart.ram_size") => {
125        128
126    };
127    ("uart.ram_size", str) => {
128        stringify!(128)
129    };
130    ("uart.version") => {
131        2
132    };
133    ("uart.version", str) => {
134        stringify!(2)
135    };
136    ("uart.peripheral_controls_mem_clk") => {
137        true
138    };
139    ("uart.has_sclk_divider") => {
140        false
141    };
142    ("uart.has_sclk_enable") => {
143        true
144    };
145    ("uhci.combined_uart_selector_field") => {
146        true
147    };
148    ("i2c_master.version") => {
149        4
150    };
151    ("i2c_master.version", str) => {
152        stringify!(4)
153    };
154    ("i2c_master.has_fsm_timeouts") => {
155        true
156    };
157    ("i2c_master.has_hw_bus_clear") => {
158        true
159    };
160    ("i2c_master.has_bus_timeout_enable") => {
161        true
162    };
163    ("i2c_master.separate_filter_config_registers") => {
164        false
165    };
166    ("i2c_master.can_estimate_nack_reason") => {
167        true
168    };
169    ("i2c_master.has_conf_update") => {
170        true
171    };
172    ("i2c_master.has_reliable_fsm_reset") => {
173        true
174    };
175    ("i2c_master.has_arbitration_en") => {
176        true
177    };
178    ("i2c_master.has_tx_fifo_watermark") => {
179        true
180    };
181    ("i2c_master.bus_timeout_is_exponential") => {
182        true
183    };
184    ("i2c_master.has_pd_en") => {
185        true
186    };
187    ("i2c_master.max_bus_timeout") => {
188        31
189    };
190    ("i2c_master.max_bus_timeout", str) => {
191        stringify!(31)
192    };
193    ("i2c_master.ll_intr_mask") => {
194        262143
195    };
196    ("i2c_master.ll_intr_mask", str) => {
197        stringify!(262143)
198    };
199    ("i2c_master.fifo_size") => {
200        32
201    };
202    ("i2c_master.fifo_size", str) => {
203        stringify!(32)
204    };
205    ("spi_master.version") => {
206        3
207    };
208    ("spi_master.version", str) => {
209        stringify!(3)
210    };
211    ("spi_master.fifo_size") => {
212        64
213    };
214    ("spi_master.fifo_size", str) => {
215        stringify!(64)
216    };
217    ("spi_master.bit_order_is_bool") => {
218        false
219    };
220    ("spi_master.has_octal") => {
221        true
222    };
223    ("spi_master.has_app_interrupts") => {
224        true
225    };
226    ("spi_master.has_dma_segmented_transfer") => {
227        true
228    };
229    ("spi_master.has_clk_pre_div") => {
230        false
231    };
232    ("spi_master.dma_can_access_flash") => {
233        false
234    };
235    ("i2s.version") => {
236        3
237    };
238    ("i2s.version", str) => {
239        stringify!(3)
240    };
241    ("i2s.mclk_divider_bit_width") => {
242        8
243    };
244    ("i2s.mclk_divider_bit_width", str) => {
245        stringify!(8)
246    };
247    ("i2s.max_ws_width") => {
248        512
249    };
250    ("i2s.max_ws_width", str) => {
251        stringify!(512)
252    };
253    ("i2s.clock_configured_by_pcr") => {
254        false
255    };
256    ("i2s.clock_configured_by_hp_sys_clkrst") => {
257        true
258    };
259    ("i2s.supports_pdm_rx_hp_filter") => {
260        true
261    };
262    ("i2s.supports_pdm_tx") => {
263        true
264    };
265    ("i2s.supports_pdm_rx") => {
266        true
267    };
268    ("i2s.supports_pcm2pdm") => {
269        true
270    };
271    ("i2s.supports_pdm2pcm") => {
272        true
273    };
274    ("rmt.ram_start") => {
275        540366848
276    };
277    ("rmt.ram_start", str) => {
278        stringify!(540366848)
279    };
280    ("rmt.channel_ram_size") => {
281        48
282    };
283    ("rmt.channel_ram_size", str) => {
284        stringify!(48)
285    };
286    ("rmt.has_tx_immediate_stop") => {
287        true
288    };
289    ("rmt.has_tx_loop_count") => {
290        true
291    };
292    ("rmt.has_tx_loop_auto_stop") => {
293        true
294    };
295    ("rmt.has_tx_carrier_data_only") => {
296        true
297    };
298    ("rmt.has_tx_sync") => {
299        true
300    };
301    ("rmt.has_rx_wrap") => {
302        true
303    };
304    ("rmt.has_rx_demodulation") => {
305        true
306    };
307    ("rmt.has_per_channel_clock") => {
308        false
309    };
310    ("sdmmc.delay_phase_num") => {
311        8
312    };
313    ("sdmmc.delay_phase_num", str) => {
314        stringify!(8)
315    };
316    ("sdmmc.has_iomux") => {
317        true
318    };
319    ("sdmmc.has_gpio_matrix") => {
320        false
321    };
322    ("sdmmc.psram_dma") => {
323        true
324    };
325    ("sdmmc.uhs") => {
326        false
327    };
328    ("usb_otg_hs.fifo_depth_words") => {
329        896
330    };
331    ("usb_otg_hs.fifo_depth_words", str) => {
332        stringify!(896)
333    };
334    ("wifi.has_wifi6") => {
335        true
336    };
337    ("wifi.mac_version") => {
338        3
339    };
340    ("wifi.mac_version", str) => {
341        stringify!(3)
342    };
343    ("wifi.has_5g") => {
344        false
345    };
346    ("wifi.csi_supported") => {
347        true
348    };
349    ("ethernet.mii_via_gpio_matrix") => {
350        true
351    };
352    ("ethernet.rx_store_and_forward") => {
353        false
354    };
355    ("ethernet.rx_checksum_offload") => {
356        true
357    };
358    ("ethernet.tx_checksum_offload") => {
359        false
360    };
361    ("ethernet.dma_burst_len") => {
362        16
363    };
364    ("ethernet.dma_burst_len", str) => {
365        stringify!(16)
366    };
367    ("ethernet.has_rgmii") => {
368        true
369    };
370    ("phy.combo_module") => {
371        false
372    };
373    ("rgb_display.output_lines") => {
374        24
375    };
376    ("rgb_display.output_lines", str) => {
377        stringify!(24)
378    };
379    ("sdm.channel_count") => {
380        8
381    };
382    ("sdm.channel_count", str) => {
383        stringify!(8)
384    };
385    ("timergroup.timg_has_timer1") => {
386        false
387    };
388    ("timergroup.timg_has_divcnt_rst") => {
389        true
390    };
391    ("timergroup.rc_fast_calibration_divider_min_rev") => {
392        0
393    };
394    ("timergroup.rc_fast_calibration_divider") => {
395        50
396    };
397    ("timergroup.rc_fast_calibration_tick_enable") => {
398        false
399    };
400    ("aes.has_split_text_registers") => {
401        true
402    };
403    ("aes.endianness_configurable") => {
404        false
405    };
406    ("ecc.zero_extend_writes") => {
407        false
408    };
409    ("ecc.separate_jacobian_point_memory") => {
410        true
411    };
412    ("ecc.has_memory_clock_gate") => {
413        true
414    };
415    ("ecc.supports_enhanced_security") => {
416        true
417    };
418    ("ecc.mem_block_size") => {
419        48
420    };
421    ("rng.apb_cycle_wait_num") => {
422        16
423    };
424    ("rng.apb_cycle_wait_num", str) => {
425        stringify!(16)
426    };
427    ("rng.trng_supported") => {
428        false
429    };
430    ("rng.is_lp_sys") => {
431        false
432    };
433    ("rsa.version") => {
434        3
435    };
436    ("rsa.version", str) => {
437        stringify!(3)
438    };
439    ("rsa.size_increment") => {
440        32
441    };
442    ("rsa.size_increment", str) => {
443        stringify!(32)
444    };
445    ("rsa.memory_size_bytes") => {
446        512
447    };
448    ("rsa.memory_size_bytes", str) => {
449        stringify!(512)
450    };
451    ("sleep.light_sleep") => {
452        true
453    };
454    ("sleep.deep_sleep") => {
455        true
456    };
457    ("sleep.rejectable_mask") => {
458        46150029
459    };
460    ("sleep.ext1_version") => {
461        3
462    };
463    ("sleep.ext1_version", str) => {
464        stringify!(3)
465    };
466    ("sleep.pin_wakeup_version") => {
467        3
468    };
469    ("sleep.pin_wakeup_version", str) => {
470        stringify!(3)
471    };
472    ("sleep.deep_sleep_needs_gpio_isolation") => {
473        false
474    };
475    ("dma.mem2mem_requires_peripheral") => {
476        false
477    };
478    ("dma.ext_mem_configurable_block_size") => {
479        false
480    };
481    ("dma.separate_in_out_interrupts") => {
482        true
483    };
484    ("dma.gdma_version") => {
485        3
486    };
487    ("dma.gdma_version", str) => {
488        stringify!(3)
489    };
490    ("interrupts.status_registers") => {
491        6
492    };
493    ("interrupts.status_registers", str) => {
494        stringify!(6)
495    };
496    ("interrupts.disabled_interrupt") => {
497        0
498    };
499    ("mmu.page_size") => {
500        65536
501    };
502    ("mmu.page_size", str) => {
503        stringify!(65536)
504    };
505    ("mmu.entry_num") => {
506        1024
507    };
508    ("mmu.entry_num", str) => {
509        stringify!(1024)
510    };
511    ("psram.octal_spi") => {
512        true
513    };
514    ("psram.hex_spi") => {
515        false
516    };
517    ("psram.extmem_origin") => {
518        1342177280
519    };
520    ("psram.extmem_origin", str) => {
521        stringify!(1342177280)
522    };
523    ("rom.has_crc_le") => {
524        true
525    };
526    ("rom.has_crc_be") => {
527        true
528    };
529    ("rom.has_md5_bsd") => {
530        true
531    };
532    ("rom.has_md5_mbedtls") => {
533        false
534    };
535    ("soc.cpu_has_branch_predictor") => {
536        true
537    };
538    ("soc.cpu_has_csr_pc") => {
539        false
540    };
541    ("soc.multi_core_enabled") => {
542        true
543    };
544    ("soc.cpu_csr_prv_mode") => {
545        2064
546    };
547    ("soc.cpu_csr_prv_mode", str) => {
548        stringify!(2064)
549    };
550    ("soc.internal_memory_cached") => {
551        false
552    };
553    ("soc.has_swd_watchdog") => {
554        true
555    };
556    ("soc.cpu_mcause_mask") => {
557        63
558    };
559    ("soc.cpu_mcause_mask", str) => {
560        stringify!(63)
561    };
562    ("clock_tree.cpu_root_clk") => {
563        [crate ::soc::clocks::CpuRootClkConfig::Xtal, crate
564        ::soc::clocks::CpuRootClkConfig::Cpll, crate
565        ::soc::clocks::CpuRootClkConfig::RcFast, crate
566        ::soc::clocks::CpuRootClkConfig::PllF240m]
567    };
568    ("clock_tree.cpu_clk.divisor") => {
569        (0, 255)
570    };
571    ("clock_tree.mem_clk.divisor") => {
572        (0, 1)
573    };
574    ("clock_tree.sys_clk.divisor") => {
575        (0, 255)
576    };
577    ("clock_tree.apb_clk.divisor") => {
578        (0, 255)
579    };
580    ("clock_tree.lp_fast_clk") => {
581        [crate ::soc::clocks::LpFastClkConfig::RcFast, crate
582        ::soc::clocks::LpFastClkConfig::Xtal]
583    };
584    ("clock_tree.lp_slow_clk") => {
585        [crate ::soc::clocks::LpSlowClkConfig::RcSlow, #[cfg(use_xtal32k)] crate
586        ::soc::clocks::LpSlowClkConfig::Xtal32k]
587    };
588    ("clock_tree.crypto_clk") => {
589        [crate ::soc::clocks::CryptoClkConfig::Xtal, crate
590        ::soc::clocks::CryptoClkConfig::RcFast, crate
591        ::soc::clocks::CryptoClkConfig::PllF240m]
592    };
593    ("clock_tree.iomux_function_clock.source") => {
594        [crate ::soc::clocks::IomuxFunctionClockSource::XtalClk, crate
595        ::soc::clocks::IomuxFunctionClockSource::PllF80m]
596    };
597    ("clock_tree.iomux_function_clock.div_num") => {
598        (0, 255)
599    };
600    ("clock_tree.timg_calibration_clock") => {
601        [crate ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, crate
602        ::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
603        crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
604    };
605    ("clock_tree.psram.function_clock") => {
606        [crate ::soc::clocks::PsramFunctionClockConfig::Xtal, crate
607        ::soc::clocks::PsramFunctionClockConfig::Mpll, crate
608        ::soc::clocks::PsramFunctionClockConfig::Cpll]
609    };
610    ("clock_tree.uart.function_clock.sclk") => {
611        [crate ::soc::clocks::UartFunctionClockSclk::PllF80m, crate
612        ::soc::clocks::UartFunctionClockSclk::Xtal, crate
613        ::soc::clocks::UartFunctionClockSclk::RcFast]
614    };
615    ("clock_tree.uart.function_clock.div_num") => {
616        (0, 255)
617    };
618    ("clock_tree.uart.baud_rate_generator.fractional") => {
619        (0, 15)
620    };
621    ("clock_tree.uart.baud_rate_generator.integral") => {
622        (0, 4095)
623    };
624    ("clock_tree.timg.function_clock") => {
625        [crate ::soc::clocks::TimgFunctionClockConfig::PllF80m, crate
626        ::soc::clocks::TimgFunctionClockConfig::RcFastClk, crate
627        ::soc::clocks::TimgFunctionClockConfig::XtalClk]
628    };
629    ("clock_tree.timg.wdt_clock") => {
630        [crate ::soc::clocks::TimgWdtClockConfig::XtalClk, crate
631        ::soc::clocks::TimgWdtClockConfig::PllF80m, crate
632        ::soc::clocks::TimgWdtClockConfig::RcFastClk]
633    };
634    ("clock_tree.spi.function_clock") => {
635        [crate ::soc::clocks::SpiFunctionClockConfig::Bbpll, crate
636        ::soc::clocks::SpiFunctionClockConfig::Xtal, crate
637        ::soc::clocks::SpiFunctionClockConfig::RcFast]
638    };
639    ("clock_tree.i2c.function_clock.sclk") => {
640        [crate ::soc::clocks::I2cFunctionClockSclk::Xtal, crate
641        ::soc::clocks::I2cFunctionClockSclk::RcFast]
642    };
643    ("clock_tree.i2c.function_clock.div_num") => {
644        (0, 255)
645    };
646    ("clock_tree.i2s.tx_clk.sclk") => {
647        [crate ::soc::clocks::I2sClkSclk::Xtal]
648    };
649    ("clock_tree.i2s.tx_clk.div_num") => {
650        (1, 256)
651    };
652    ("clock_tree.i2s.tx_clk.div_a") => {
653        (1, 511)
654    };
655    ("clock_tree.i2s.tx_clk.div_b") => {
656        (0, 511)
657    };
658    ("clock_tree.i2s.rx_clk.sclk") => {
659        [crate ::soc::clocks::I2sClkSclk::Xtal]
660    };
661    ("clock_tree.i2s.rx_clk.div_num") => {
662        (1, 256)
663    };
664    ("clock_tree.i2s.rx_clk.div_a") => {
665        (1, 511)
666    };
667    ("clock_tree.i2s.rx_clk.div_b") => {
668        (0, 511)
669    };
670    ("clock_tree.i2s.mclk_out") => {
671        [crate ::soc::clocks::I2sMclkOutConfig::Tx, crate
672        ::soc::clocks::I2sMclkOutConfig::Rx]
673    };
674    ("clock_tree.rmt.sclk") => {
675        [crate ::soc::clocks::RmtSclkConfig::PllF80m, crate
676        ::soc::clocks::RmtSclkConfig::RcFastClk, crate
677        ::soc::clocks::RmtSclkConfig::XtalClk]
678    };
679    ("clock_tree.lcd_cam.lcd_clock.sclk") => {
680        [crate ::soc::clocks::LcdCamLcdClockSclk::XtalClk, crate
681        ::soc::clocks::LcdCamLcdClockSclk::PllF160m]
682    };
683    ("clock_tree.lcd_cam.lcd_clock.div_num") => {
684        (1, 256)
685    };
686    ("clock_tree.lcd_cam.lcd_clock.div_a") => {
687        (1, 255)
688    };
689    ("clock_tree.lcd_cam.lcd_clock.div_b") => {
690        (0, 255)
691    };
692    ("clock_tree.lcd_cam.cam_clock.sclk") => {
693        [crate ::soc::clocks::LcdCamCamClockSclk::XtalClk, crate
694        ::soc::clocks::LcdCamCamClockSclk::PllF160m]
695    };
696    ("clock_tree.lcd_cam.cam_clock.div_num") => {
697        (1, 256)
698    };
699    ("clock_tree.lcd_cam.cam_clock.div_a") => {
700        (1, 255)
701    };
702    ("clock_tree.lcd_cam.cam_clock.div_b") => {
703        (0, 255)
704    };
705}
706#[macro_export]
707#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
708macro_rules! for_each_dedicated_gpio {
709    ($($pattern:tt => $code:tt;)*) => {
710        macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
711        tt) => {} } _for_each_inner_dedicated_gpio!((0));
712        _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
713        _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
714        _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
715        _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
716        CPU_GPIO_0)); _for_each_inner_dedicated_gpio!((0, 1, CPU_GPIO_1));
717        _for_each_inner_dedicated_gpio!((0, 2, CPU_GPIO_2));
718        _for_each_inner_dedicated_gpio!((0, 3, CPU_GPIO_3));
719        _for_each_inner_dedicated_gpio!((0, 4, CPU_GPIO_4));
720        _for_each_inner_dedicated_gpio!((0, 5, CPU_GPIO_5));
721        _for_each_inner_dedicated_gpio!((0, 6, CPU_GPIO_6));
722        _for_each_inner_dedicated_gpio!((0, 7, CPU_GPIO_7));
723        _for_each_inner_dedicated_gpio!((1, 0, CPU_GPIO_8));
724        _for_each_inner_dedicated_gpio!((1, 1, CPU_GPIO_9));
725        _for_each_inner_dedicated_gpio!((1, 2, CPU_GPIO_10));
726        _for_each_inner_dedicated_gpio!((1, 3, CPU_GPIO_11));
727        _for_each_inner_dedicated_gpio!((1, 4, CPU_GPIO_12));
728        _for_each_inner_dedicated_gpio!((1, 5, CPU_GPIO_13));
729        _for_each_inner_dedicated_gpio!((1, 6, CPU_GPIO_14));
730        _for_each_inner_dedicated_gpio!((1, 7, CPU_GPIO_15));
731        _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
732        (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, CPU_GPIO_0), (0, 1,
733        CPU_GPIO_1), (0, 2, CPU_GPIO_2), (0, 3, CPU_GPIO_3), (0, 4, CPU_GPIO_4), (0, 5,
734        CPU_GPIO_5), (0, 6, CPU_GPIO_6), (0, 7, CPU_GPIO_7), (1, 0, CPU_GPIO_8), (1, 1,
735        CPU_GPIO_9), (1, 2, CPU_GPIO_10), (1, 3, CPU_GPIO_11), (1, 4, CPU_GPIO_12), (1,
736        5, CPU_GPIO_13), (1, 6, CPU_GPIO_14), (1, 7, CPU_GPIO_15)));
737    };
738}
739/// Defines the `LpInputSignal` and `LpOutputSignal` enums.
740///
741/// This macro is intended to be called in esp-hal only.
742#[macro_export]
743#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
744macro_rules! define_lp_io_signals {
745    () => {
746        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
747        #[derive(Debug, PartialEq, Copy, Clone)]
748        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
749        #[doc(hidden)]
750        pub enum LpInputSignal {
751            LP_I2C_SCL   = 0,
752            LP_I2C_SDA   = 1,
753            LP_UART_RXD  = 2,
754            LP_UART_CTSN = 3,
755            LP_UART_DSRN = 4,
756            LP_SPI_CK    = 5,
757            LP_SPI_CS    = 6,
758            LP_SPI_D     = 7,
759            LP_SPI_Q     = 8,
760        }
761        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
762        #[derive(Debug, PartialEq, Copy, Clone)]
763        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
764        #[doc(hidden)]
765        pub enum LpOutputSignal {
766            LP_I2C_SCL   = 0,
767            LP_I2C_SDA   = 1,
768            LP_UART_TXD  = 2,
769            LP_UART_RTSN = 3,
770            LP_UART_DTRN = 4,
771            LP_SPI_CK    = 5,
772            LP_SPI_CS    = 6,
773            LP_SPI_D     = 7,
774            LP_SPI_Q     = 8,
775        }
776    };
777}
778/// This macro can be used to generate code for each channel of the RMT peripheral.
779///
780/// For an explanation on the general syntax, as well as usage of individual/repeated
781/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
782///
783/// This macro has three options for its "Individual matcher" case:
784///
785/// - `all`: `($num:literal)`
786/// - `tx`: `($num:literal, $idx:literal)`
787/// - `rx`: `($num:literal, $idx:literal)`
788///
789/// Macro fragments:
790///
791/// - `$num`: number of the channel, e.g. `0`
792/// - `$idx`: index of the channel among channels of the same capability, e.g. `0`
793///
794/// Example data:
795///
796/// - `all`: `(0)`
797/// - `tx`: `(1, 1)`
798/// - `rx`: `(2, 0)`
799#[macro_export]
800#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
801macro_rules! for_each_rmt_channel {
802    ($($pattern:tt => $code:tt;)*) => {
803        macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
804        => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
805        _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
806        _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
807        _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
808        _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
809        _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
810        _for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
811        _for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
812        _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
813        _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
814        _for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
815    };
816}
817/// This macro can be used to generate code for each slot of the SDMMC/SDIO host driver.
818///
819/// For an explanation on the general syntax, as well as usage of individual/repeated
820/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
821///
822/// This macro has one option for its "Individual matcher" case:
823///
824/// Syntax: `($slot:ident, $idx:literal, $iomux:literal, [$($clk:ident)?]
825/// [$($cmd_in:ident)?] [$($cmd_out:ident)?] [$($data_in:ident),*] [$($data_out:ident),*]
826/// [$($cd:ident)?] [$($wp:ident)?] [$($card_int:ident)?] [$($data_strobe:ident)?]
827/// [$($rst:ident)?])`
828///
829/// Macro fragments:
830///
831/// - `$slot`: the name of the slot (`slot0`, `slot1`).
832/// - `$idx`: the zero-based slot index.
833/// - `$iomux`: `true` if the slot's clock/command/data signals are IO_MUX-routed.
834/// - `$clk`, `$cmd_in`, `$cmd_out`, `$data_in`, `$data_out`: GPIO-matrix bus signal names (absent
835///   for IO_MUX-routed slots).
836/// - `$cd`, `$wp`, `$card_int`, `$data_strobe`, `$rst`: auxiliary signal names, each present only
837///   when the slot routes that signal through the GPIO matrix.
838///
839/// Each optional signal is wrapped in brackets so the branch shape stays uniform: a set
840/// signal appears as `[SIGNAL]`, an absent one as `[]`.
841#[macro_export]
842#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
843macro_rules! for_each_sdmmc {
844    ($($pattern:tt => $code:tt;)*) => {
845        macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
846        } _for_each_inner_sdmmc!((slot0, 0, true, [], [], [], [], [],
847        [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
848        [SDHOST_DATA_STROBE_1], [SD_RST_N_1])); _for_each_inner_sdmmc!((slot1, 1, true,
849        [], [], [], [], [], [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2],
850        [SDHOST_CARD_INT_N_2], [SDHOST_DATA_STROBE_2], [SD_RST_N_2]));
851        _for_each_inner_sdmmc!((all(slot0, 0, true, [], [], [], [], [],
852        [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
853        [SDHOST_DATA_STROBE_1], [SD_RST_N_1]), (slot1, 1, true, [], [], [], [], [],
854        [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2],
855        [SDHOST_DATA_STROBE_2], [SD_RST_N_2])));
856    };
857}
858#[macro_export]
859#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
860macro_rules! for_each_sdm_channel {
861    ($($pattern:tt => $code:tt;)*) => {
862        macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
863        => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
864        _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
865        _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
866        _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
867        _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
868        _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
869        _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
870        _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
871        _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
872        SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
873        GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
874        SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
875    };
876}
877#[macro_export]
878#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
879macro_rules! for_each_aes_key_length {
880    ($($pattern:tt => $code:tt;)*) => {
881        macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
882        tt) => {} } _for_each_inner_aes_key_length!((128));
883        _for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
884        4)); _for_each_inner_aes_key_length!((256, 2, 6));
885        _for_each_inner_aes_key_length!((bits(128), (256)));
886        _for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
887    };
888}
889#[macro_export]
890#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
891macro_rules! for_each_ecc_working_mode {
892    ($($pattern:tt => $code:tt;)*) => {
893        macro_rules! _for_each_inner_ecc_working_mode { $(($pattern) => $code;)* ($other
894        : tt) => {} } _for_each_inner_ecc_working_mode!((0, AffinePointMultiplication));
895        _for_each_inner_ecc_working_mode!((2, AffinePointVerification));
896        _for_each_inner_ecc_working_mode!((3, AffinePointVerificationAndMultiplication));
897        _for_each_inner_ecc_working_mode!((4, JacobianPointMultiplication));
898        _for_each_inner_ecc_working_mode!((5, AffinePointAddition));
899        _for_each_inner_ecc_working_mode!((6, JacobianPointVerification));
900        _for_each_inner_ecc_working_mode!((7,
901        AffinePointVerificationAndJacobianPointMultiplication));
902        _for_each_inner_ecc_working_mode!((8, ModularAddition));
903        _for_each_inner_ecc_working_mode!((9, ModularSubtraction));
904        _for_each_inner_ecc_working_mode!((10, ModularMultiplication));
905        _for_each_inner_ecc_working_mode!((11, ModularDivision));
906        _for_each_inner_ecc_working_mode!((all(0, AffinePointMultiplication), (2,
907        AffinePointVerification), (3, AffinePointVerificationAndMultiplication), (4,
908        JacobianPointMultiplication), (5, AffinePointAddition), (6,
909        JacobianPointVerification), (7,
910        AffinePointVerificationAndJacobianPointMultiplication), (8, ModularAddition), (9,
911        ModularSubtraction), (10, ModularMultiplication), (11, ModularDivision)));
912    };
913}
914#[macro_export]
915#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
916macro_rules! for_each_ecc_curve {
917    ($($pattern:tt => $code:tt;)*) => {
918        macro_rules! _for_each_inner_ecc_curve { $(($pattern) => $code;)* ($other : tt)
919        => {} } _for_each_inner_ecc_curve!((0, P192, 192));
920        _for_each_inner_ecc_curve!((1, P256, 256)); _for_each_inner_ecc_curve!((2, P384,
921        384)); _for_each_inner_ecc_curve!((all(0, P192, 192), (1, P256, 256), (2, P384,
922        384)));
923    };
924}
925#[macro_export]
926#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
927macro_rules! for_each_rsa_exponentiation {
928    ($($pattern:tt => $code:tt;)*) => {
929        macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
930        ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
931        _for_each_inner_rsa_exponentiation!((64));
932        _for_each_inner_rsa_exponentiation!((96));
933        _for_each_inner_rsa_exponentiation!((128));
934        _for_each_inner_rsa_exponentiation!((160));
935        _for_each_inner_rsa_exponentiation!((192));
936        _for_each_inner_rsa_exponentiation!((224));
937        _for_each_inner_rsa_exponentiation!((256));
938        _for_each_inner_rsa_exponentiation!((288));
939        _for_each_inner_rsa_exponentiation!((320));
940        _for_each_inner_rsa_exponentiation!((352));
941        _for_each_inner_rsa_exponentiation!((384));
942        _for_each_inner_rsa_exponentiation!((416));
943        _for_each_inner_rsa_exponentiation!((448));
944        _for_each_inner_rsa_exponentiation!((480));
945        _for_each_inner_rsa_exponentiation!((512));
946        _for_each_inner_rsa_exponentiation!((544));
947        _for_each_inner_rsa_exponentiation!((576));
948        _for_each_inner_rsa_exponentiation!((608));
949        _for_each_inner_rsa_exponentiation!((640));
950        _for_each_inner_rsa_exponentiation!((672));
951        _for_each_inner_rsa_exponentiation!((704));
952        _for_each_inner_rsa_exponentiation!((736));
953        _for_each_inner_rsa_exponentiation!((768));
954        _for_each_inner_rsa_exponentiation!((800));
955        _for_each_inner_rsa_exponentiation!((832));
956        _for_each_inner_rsa_exponentiation!((864));
957        _for_each_inner_rsa_exponentiation!((896));
958        _for_each_inner_rsa_exponentiation!((928));
959        _for_each_inner_rsa_exponentiation!((960));
960        _for_each_inner_rsa_exponentiation!((992));
961        _for_each_inner_rsa_exponentiation!((1024));
962        _for_each_inner_rsa_exponentiation!((1056));
963        _for_each_inner_rsa_exponentiation!((1088));
964        _for_each_inner_rsa_exponentiation!((1120));
965        _for_each_inner_rsa_exponentiation!((1152));
966        _for_each_inner_rsa_exponentiation!((1184));
967        _for_each_inner_rsa_exponentiation!((1216));
968        _for_each_inner_rsa_exponentiation!((1248));
969        _for_each_inner_rsa_exponentiation!((1280));
970        _for_each_inner_rsa_exponentiation!((1312));
971        _for_each_inner_rsa_exponentiation!((1344));
972        _for_each_inner_rsa_exponentiation!((1376));
973        _for_each_inner_rsa_exponentiation!((1408));
974        _for_each_inner_rsa_exponentiation!((1440));
975        _for_each_inner_rsa_exponentiation!((1472));
976        _for_each_inner_rsa_exponentiation!((1504));
977        _for_each_inner_rsa_exponentiation!((1536));
978        _for_each_inner_rsa_exponentiation!((1568));
979        _for_each_inner_rsa_exponentiation!((1600));
980        _for_each_inner_rsa_exponentiation!((1632));
981        _for_each_inner_rsa_exponentiation!((1664));
982        _for_each_inner_rsa_exponentiation!((1696));
983        _for_each_inner_rsa_exponentiation!((1728));
984        _for_each_inner_rsa_exponentiation!((1760));
985        _for_each_inner_rsa_exponentiation!((1792));
986        _for_each_inner_rsa_exponentiation!((1824));
987        _for_each_inner_rsa_exponentiation!((1856));
988        _for_each_inner_rsa_exponentiation!((1888));
989        _for_each_inner_rsa_exponentiation!((1920));
990        _for_each_inner_rsa_exponentiation!((1952));
991        _for_each_inner_rsa_exponentiation!((1984));
992        _for_each_inner_rsa_exponentiation!((2016));
993        _for_each_inner_rsa_exponentiation!((2048));
994        _for_each_inner_rsa_exponentiation!((2080));
995        _for_each_inner_rsa_exponentiation!((2112));
996        _for_each_inner_rsa_exponentiation!((2144));
997        _for_each_inner_rsa_exponentiation!((2176));
998        _for_each_inner_rsa_exponentiation!((2208));
999        _for_each_inner_rsa_exponentiation!((2240));
1000        _for_each_inner_rsa_exponentiation!((2272));
1001        _for_each_inner_rsa_exponentiation!((2304));
1002        _for_each_inner_rsa_exponentiation!((2336));
1003        _for_each_inner_rsa_exponentiation!((2368));
1004        _for_each_inner_rsa_exponentiation!((2400));
1005        _for_each_inner_rsa_exponentiation!((2432));
1006        _for_each_inner_rsa_exponentiation!((2464));
1007        _for_each_inner_rsa_exponentiation!((2496));
1008        _for_each_inner_rsa_exponentiation!((2528));
1009        _for_each_inner_rsa_exponentiation!((2560));
1010        _for_each_inner_rsa_exponentiation!((2592));
1011        _for_each_inner_rsa_exponentiation!((2624));
1012        _for_each_inner_rsa_exponentiation!((2656));
1013        _for_each_inner_rsa_exponentiation!((2688));
1014        _for_each_inner_rsa_exponentiation!((2720));
1015        _for_each_inner_rsa_exponentiation!((2752));
1016        _for_each_inner_rsa_exponentiation!((2784));
1017        _for_each_inner_rsa_exponentiation!((2816));
1018        _for_each_inner_rsa_exponentiation!((2848));
1019        _for_each_inner_rsa_exponentiation!((2880));
1020        _for_each_inner_rsa_exponentiation!((2912));
1021        _for_each_inner_rsa_exponentiation!((2944));
1022        _for_each_inner_rsa_exponentiation!((2976));
1023        _for_each_inner_rsa_exponentiation!((3008));
1024        _for_each_inner_rsa_exponentiation!((3040));
1025        _for_each_inner_rsa_exponentiation!((3072));
1026        _for_each_inner_rsa_exponentiation!((3104));
1027        _for_each_inner_rsa_exponentiation!((3136));
1028        _for_each_inner_rsa_exponentiation!((3168));
1029        _for_each_inner_rsa_exponentiation!((3200));
1030        _for_each_inner_rsa_exponentiation!((3232));
1031        _for_each_inner_rsa_exponentiation!((3264));
1032        _for_each_inner_rsa_exponentiation!((3296));
1033        _for_each_inner_rsa_exponentiation!((3328));
1034        _for_each_inner_rsa_exponentiation!((3360));
1035        _for_each_inner_rsa_exponentiation!((3392));
1036        _for_each_inner_rsa_exponentiation!((3424));
1037        _for_each_inner_rsa_exponentiation!((3456));
1038        _for_each_inner_rsa_exponentiation!((3488));
1039        _for_each_inner_rsa_exponentiation!((3520));
1040        _for_each_inner_rsa_exponentiation!((3552));
1041        _for_each_inner_rsa_exponentiation!((3584));
1042        _for_each_inner_rsa_exponentiation!((3616));
1043        _for_each_inner_rsa_exponentiation!((3648));
1044        _for_each_inner_rsa_exponentiation!((3680));
1045        _for_each_inner_rsa_exponentiation!((3712));
1046        _for_each_inner_rsa_exponentiation!((3744));
1047        _for_each_inner_rsa_exponentiation!((3776));
1048        _for_each_inner_rsa_exponentiation!((3808));
1049        _for_each_inner_rsa_exponentiation!((3840));
1050        _for_each_inner_rsa_exponentiation!((3872));
1051        _for_each_inner_rsa_exponentiation!((3904));
1052        _for_each_inner_rsa_exponentiation!((3936));
1053        _for_each_inner_rsa_exponentiation!((3968));
1054        _for_each_inner_rsa_exponentiation!((4000));
1055        _for_each_inner_rsa_exponentiation!((4032));
1056        _for_each_inner_rsa_exponentiation!((4064));
1057        _for_each_inner_rsa_exponentiation!((4096));
1058        _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
1059        (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1060        (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1061        (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1062        (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1063        (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1064        (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
1065        (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
1066        (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
1067        (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
1068        (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
1069        (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
1070        (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
1071    };
1072}
1073#[macro_export]
1074#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1075macro_rules! for_each_rsa_multiplication {
1076    ($($pattern:tt => $code:tt;)*) => {
1077        macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
1078        ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
1079        _for_each_inner_rsa_multiplication!((64));
1080        _for_each_inner_rsa_multiplication!((96));
1081        _for_each_inner_rsa_multiplication!((128));
1082        _for_each_inner_rsa_multiplication!((160));
1083        _for_each_inner_rsa_multiplication!((192));
1084        _for_each_inner_rsa_multiplication!((224));
1085        _for_each_inner_rsa_multiplication!((256));
1086        _for_each_inner_rsa_multiplication!((288));
1087        _for_each_inner_rsa_multiplication!((320));
1088        _for_each_inner_rsa_multiplication!((352));
1089        _for_each_inner_rsa_multiplication!((384));
1090        _for_each_inner_rsa_multiplication!((416));
1091        _for_each_inner_rsa_multiplication!((448));
1092        _for_each_inner_rsa_multiplication!((480));
1093        _for_each_inner_rsa_multiplication!((512));
1094        _for_each_inner_rsa_multiplication!((544));
1095        _for_each_inner_rsa_multiplication!((576));
1096        _for_each_inner_rsa_multiplication!((608));
1097        _for_each_inner_rsa_multiplication!((640));
1098        _for_each_inner_rsa_multiplication!((672));
1099        _for_each_inner_rsa_multiplication!((704));
1100        _for_each_inner_rsa_multiplication!((736));
1101        _for_each_inner_rsa_multiplication!((768));
1102        _for_each_inner_rsa_multiplication!((800));
1103        _for_each_inner_rsa_multiplication!((832));
1104        _for_each_inner_rsa_multiplication!((864));
1105        _for_each_inner_rsa_multiplication!((896));
1106        _for_each_inner_rsa_multiplication!((928));
1107        _for_each_inner_rsa_multiplication!((960));
1108        _for_each_inner_rsa_multiplication!((992));
1109        _for_each_inner_rsa_multiplication!((1024));
1110        _for_each_inner_rsa_multiplication!((1056));
1111        _for_each_inner_rsa_multiplication!((1088));
1112        _for_each_inner_rsa_multiplication!((1120));
1113        _for_each_inner_rsa_multiplication!((1152));
1114        _for_each_inner_rsa_multiplication!((1184));
1115        _for_each_inner_rsa_multiplication!((1216));
1116        _for_each_inner_rsa_multiplication!((1248));
1117        _for_each_inner_rsa_multiplication!((1280));
1118        _for_each_inner_rsa_multiplication!((1312));
1119        _for_each_inner_rsa_multiplication!((1344));
1120        _for_each_inner_rsa_multiplication!((1376));
1121        _for_each_inner_rsa_multiplication!((1408));
1122        _for_each_inner_rsa_multiplication!((1440));
1123        _for_each_inner_rsa_multiplication!((1472));
1124        _for_each_inner_rsa_multiplication!((1504));
1125        _for_each_inner_rsa_multiplication!((1536));
1126        _for_each_inner_rsa_multiplication!((1568));
1127        _for_each_inner_rsa_multiplication!((1600));
1128        _for_each_inner_rsa_multiplication!((1632));
1129        _for_each_inner_rsa_multiplication!((1664));
1130        _for_each_inner_rsa_multiplication!((1696));
1131        _for_each_inner_rsa_multiplication!((1728));
1132        _for_each_inner_rsa_multiplication!((1760));
1133        _for_each_inner_rsa_multiplication!((1792));
1134        _for_each_inner_rsa_multiplication!((1824));
1135        _for_each_inner_rsa_multiplication!((1856));
1136        _for_each_inner_rsa_multiplication!((1888));
1137        _for_each_inner_rsa_multiplication!((1920));
1138        _for_each_inner_rsa_multiplication!((1952));
1139        _for_each_inner_rsa_multiplication!((1984));
1140        _for_each_inner_rsa_multiplication!((2016));
1141        _for_each_inner_rsa_multiplication!((2048));
1142        _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
1143        (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1144        (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1145        (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1146        (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1147        (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1148        (1888), (1920), (1952), (1984), (2016), (2048)));
1149    };
1150}
1151#[macro_export]
1152#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1153macro_rules! for_each_sha_algorithm {
1154    ($($pattern:tt => $code:tt;)*) => {
1155        macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
1156        tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
1157        (insecure_against : "collision", "length extension"), 0));
1158        _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
1159        (insecure_against : "length extension"), 1));
1160        _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
1161        (insecure_against : "length extension"), 2));
1162        _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
1163        (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
1164        "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
1165        _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
1166        (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
1167        "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
1168        _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
1169        (insecure_against : "collision", "length extension"), 0), (Sha224,
1170        "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
1171        (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
1172        2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
1173        "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
1174        (Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
1175        (Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
1176    };
1177}
1178#[macro_export]
1179#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1180macro_rules! for_each_wakeup_source {
1181    ($($pattern:tt => $code:tt;)*) => {
1182        macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
1183        tt) => {} } _for_each_inner_wakeup_source!((LpCore, 0));
1184        _for_each_inner_wakeup_source!((Gpio, 2)); _for_each_inner_wakeup_source!((Usb,
1185        3)); _for_each_inner_wakeup_source!((Uart1, 7));
1186        _for_each_inner_wakeup_source!((Uart0, 8)); _for_each_inner_wakeup_source!((Ext1,
1187        12)); _for_each_inner_wakeup_source!((Timer, 13));
1188        _for_each_inner_wakeup_source!((Wifi, 22));
1189        _for_each_inner_wakeup_source!((WifiBeacon, 23));
1190        _for_each_inner_wakeup_source!((Bt, 25));
1191        _for_each_inner_wakeup_source!((all(LpCore, 0), (Gpio, 2), (Usb, 3), (Uart1, 7),
1192        (Uart0, 8), (Ext1, 12), (Timer, 13), (Wifi, 22), (WifiBeacon, 23), (Bt, 25)));
1193    };
1194}
1195#[macro_export]
1196#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1197macro_rules! for_each_dma_engine {
1198    ($($pattern:tt => $code:tt;)*) => {
1199        macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
1200        => {} } _for_each_inner_dma_engine!(("AHB_GDMA"));
1201        _for_each_inner_dma_engine!(("AXI_GDMA"));
1202        _for_each_inner_dma_engine!((all("AHB_GDMA"), ("AXI_GDMA")));
1203    };
1204}
1205#[macro_export]
1206#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1207macro_rules! for_each_dma_channel {
1208    ($($pattern:tt => $code:tt;)*) => {
1209        macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
1210        => {} } _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0));
1211        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1));
1212        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2));
1213        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3));
1214        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4));
1215        _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0));
1216        _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH1));
1217        _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH2));
1218        _for_each_inner_dma_channel!(("AHB_GDMA", any_channel = AhbGdmaChannel));
1219        _for_each_inner_dma_channel!(("AXI_GDMA", any_channel = AxiGdmaChannel));
1220        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1221        AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0, I2S0,
1222        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1, 1, interrupt_in =
1223        AHB_PDMA_IN_CH1, interrupt_out = AHB_PDMA_OUT_CH1, compatible = [UHCI0, I2S0,
1224        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2, 2, interrupt_in =
1225        AHB_PDMA_IN_CH2, interrupt_out = AHB_PDMA_OUT_CH2, compatible = [UHCI0, I2S0,
1226        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3, 3, interrupt_in =
1227        AHB_PDMA_IN_CH3, interrupt_out = AHB_PDMA_OUT_CH3, compatible = [UHCI0, I2S0,
1228        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4, 4, interrupt_in =
1229        AHB_PDMA_IN_CH4, interrupt_out = AHB_PDMA_OUT_CH4, compatible = [UHCI0, I2S0,
1230        I2S1])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0, 0, interrupt_in =
1231        AXI_PDMA_IN_CH0, interrupt_out = AXI_PDMA_OUT_CH0, compatible = [LCD_CAM, SPI2,
1232        SPI3, AES, SHA])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH1, 1,
1233        interrupt_in = AXI_PDMA_IN_CH1, interrupt_out = AXI_PDMA_OUT_CH1, compatible =
1234        [LCD_CAM, SPI2, SPI3, AES, SHA])); _for_each_inner_dma_channel!(("AXI_GDMA",
1235        DMA_AXI_CH2, 2, interrupt_in = AXI_PDMA_IN_CH2, interrupt_out = AXI_PDMA_OUT_CH2,
1236        compatible = [LCD_CAM, SPI2, SPI3, AES, SHA]));
1237        _for_each_inner_dma_channel!((names("AHB_GDMA", DMA_CH0), ("AHB_GDMA", DMA_CH1),
1238        ("AHB_GDMA", DMA_CH2), ("AHB_GDMA", DMA_CH3), ("AHB_GDMA", DMA_CH4), ("AXI_GDMA",
1239        DMA_AXI_CH0), ("AXI_GDMA", DMA_AXI_CH1), ("AXI_GDMA", DMA_AXI_CH2)));
1240        _for_each_inner_dma_channel!((separate_any_type("AHB_GDMA", any_channel =
1241        AhbGdmaChannel), ("AXI_GDMA", any_channel = AxiGdmaChannel)));
1242        _for_each_inner_dma_channel!((shared));
1243        _for_each_inner_dma_channel!((split("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1244        AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0, I2S0,
1245        I2S1]), ("AHB_GDMA", DMA_CH1, 1, interrupt_in = AHB_PDMA_IN_CH1, interrupt_out =
1246        AHB_PDMA_OUT_CH1, compatible = [UHCI0, I2S0, I2S1]), ("AHB_GDMA", DMA_CH2, 2,
1247        interrupt_in = AHB_PDMA_IN_CH2, interrupt_out = AHB_PDMA_OUT_CH2, compatible =
1248        [UHCI0, I2S0, I2S1]), ("AHB_GDMA", DMA_CH3, 3, interrupt_in = AHB_PDMA_IN_CH3,
1249        interrupt_out = AHB_PDMA_OUT_CH3, compatible = [UHCI0, I2S0, I2S1]), ("AHB_GDMA",
1250        DMA_CH4, 4, interrupt_in = AHB_PDMA_IN_CH4, interrupt_out = AHB_PDMA_OUT_CH4,
1251        compatible = [UHCI0, I2S0, I2S1]), ("AXI_GDMA", DMA_AXI_CH0, 0, interrupt_in =
1252        AXI_PDMA_IN_CH0, interrupt_out = AXI_PDMA_OUT_CH0, compatible = [LCD_CAM, SPI2,
1253        SPI3, AES, SHA]), ("AXI_GDMA", DMA_AXI_CH1, 1, interrupt_in = AXI_PDMA_IN_CH1,
1254        interrupt_out = AXI_PDMA_OUT_CH1, compatible = [LCD_CAM, SPI2, SPI3, AES, SHA]),
1255        ("AXI_GDMA", DMA_AXI_CH2, 2, interrupt_in = AXI_PDMA_IN_CH2, interrupt_out =
1256        AXI_PDMA_OUT_CH2, compatible = [LCD_CAM, SPI2, SPI3, AES, SHA])));
1257        _for_each_inner_dma_channel!((no_own_interrupt));
1258    };
1259}
1260#[macro_export]
1261#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1262macro_rules! for_each_dma_channel_peri_pair {
1263    ($($pattern:tt => $code:tt;)*) => {
1264        macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1265        ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1266        DMA_CH0, UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0,
1267        I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S1));
1268        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, UHCI0));
1269        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S0));
1270        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S1));
1271        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, UHCI0));
1272        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S0));
1273        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S1));
1274        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, UHCI0));
1275        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S0));
1276        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S1));
1277        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, UHCI0));
1278        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S0));
1279        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S1));
1280        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, LCD_CAM));
1281        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI2));
1282        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI3));
1283        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, AES));
1284        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SHA));
1285        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, LCD_CAM));
1286        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI2));
1287        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI3));
1288        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, AES));
1289        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SHA));
1290        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, LCD_CAM));
1291        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI2));
1292        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI3));
1293        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, AES));
1294        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SHA));
1295        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1296        UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1297        AhbGdmaChannel, I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1298        any_channel = AhbGdmaChannel, I2S1));
1299        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel = AxiGdmaChannel,
1300        LCD_CAM)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1301        AxiGdmaChannel, SPI2)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA",
1302        any_channel = AxiGdmaChannel, SPI3));
1303        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel = AxiGdmaChannel,
1304        AES)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1305        AxiGdmaChannel, SHA));
1306        _for_each_inner_dma_channel_peri_pair!((channels("AHB_GDMA", DMA_CH0, UHCI0),
1307        ("AHB_GDMA", DMA_CH0, I2S0), ("AHB_GDMA", DMA_CH0, I2S1), ("AHB_GDMA", DMA_CH1,
1308        UHCI0), ("AHB_GDMA", DMA_CH1, I2S0), ("AHB_GDMA", DMA_CH1, I2S1), ("AHB_GDMA",
1309        DMA_CH2, UHCI0), ("AHB_GDMA", DMA_CH2, I2S0), ("AHB_GDMA", DMA_CH2, I2S1),
1310        ("AHB_GDMA", DMA_CH3, UHCI0), ("AHB_GDMA", DMA_CH3, I2S0), ("AHB_GDMA", DMA_CH3,
1311        I2S1), ("AHB_GDMA", DMA_CH4, UHCI0), ("AHB_GDMA", DMA_CH4, I2S0), ("AHB_GDMA",
1312        DMA_CH4, I2S1), ("AXI_GDMA", DMA_AXI_CH0, LCD_CAM), ("AXI_GDMA", DMA_AXI_CH0,
1313        SPI2), ("AXI_GDMA", DMA_AXI_CH0, SPI3), ("AXI_GDMA", DMA_AXI_CH0, AES),
1314        ("AXI_GDMA", DMA_AXI_CH0, SHA), ("AXI_GDMA", DMA_AXI_CH1, LCD_CAM), ("AXI_GDMA",
1315        DMA_AXI_CH1, SPI2), ("AXI_GDMA", DMA_AXI_CH1, SPI3), ("AXI_GDMA", DMA_AXI_CH1,
1316        AES), ("AXI_GDMA", DMA_AXI_CH1, SHA), ("AXI_GDMA", DMA_AXI_CH2, LCD_CAM),
1317        ("AXI_GDMA", DMA_AXI_CH2, SPI2), ("AXI_GDMA", DMA_AXI_CH2, SPI3), ("AXI_GDMA",
1318        DMA_AXI_CH2, AES), ("AXI_GDMA", DMA_AXI_CH2, SHA)));
1319        _for_each_inner_dma_channel_peri_pair!((any_channels("AHB_GDMA", any_channel =
1320        AhbGdmaChannel, UHCI0), ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S0),
1321        ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S1), ("AXI_GDMA", any_channel =
1322        AxiGdmaChannel, LCD_CAM), ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI2),
1323        ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI3), ("AXI_GDMA", any_channel =
1324        AxiGdmaChannel, AES), ("AXI_GDMA", any_channel = AxiGdmaChannel, SHA)));
1325    };
1326}
1327#[macro_export]
1328#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1329macro_rules! for_each_mem2mem_channel {
1330    ($($pattern:tt => $code:tt;)*) => {
1331        macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
1332        tt) => {} } _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1333        AhbGdmaChannel, DMA_CH0, 9)); _for_each_inner_mem2mem_channel!(("AXI_GDMA",
1334        AxiGdma, AxiGdmaChannel, DMA_AXI_CH0, 6));
1335        _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1336        DMA_AXI_CH1, 7)); _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma,
1337        AxiGdmaChannel, DMA_AXI_CH2, 8)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1338        AhbGdma, AhbGdmaChannel, 0, 9)); _for_each_inner_mem2mem_channel!(("AXI_GDMA",
1339        AxiGdma, AxiGdmaChannel, 0, 6, 1, 7, 2, 8));
1340        _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel));
1341        _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel));
1342        _for_each_inner_mem2mem_channel!((channels("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1343        DMA_CH0, 9), ("AXI_GDMA", AxiGdma, AxiGdmaChannel, DMA_AXI_CH0, 6), ("AXI_GDMA",
1344        AxiGdma, AxiGdmaChannel, DMA_AXI_CH1, 7), ("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1345        DMA_AXI_CH2, 8))); _for_each_inner_mem2mem_channel!((erased("AHB_GDMA", AhbGdma,
1346        AhbGdmaChannel, 0, 9), ("AXI_GDMA", AxiGdma, AxiGdmaChannel, 0, 6, 1, 7, 2, 8)));
1347        _for_each_inner_mem2mem_channel!((engines("AHB_GDMA", AhbGdma, AhbGdmaChannel),
1348        ("AXI_GDMA", AxiGdma, AxiGdmaChannel)));
1349    };
1350}
1351#[macro_export]
1352#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1353macro_rules! with_aes_dma_engine {
1354    ($($pattern:tt => $code:tt;)*) => {
1355        macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
1356        => {} } _with_inner_aes_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1357    };
1358}
1359#[macro_export]
1360#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1361macro_rules! with_i2s_dma_engine {
1362    ($($pattern:tt => $code:tt;)*) => {
1363        macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
1364        => {} } _with_inner_i2s_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1365    };
1366}
1367#[macro_export]
1368#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1369macro_rules! with_lcd_cam_dma_engine {
1370    ($($pattern:tt => $code:tt;)*) => {
1371        macro_rules! _with_inner_lcd_cam_dma_engine { $(($pattern) => $code;)* ($other :
1372        tt) => {} } _with_inner_lcd_cam_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1373    };
1374}
1375#[macro_export]
1376#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1377macro_rules! with_spi_master_dma_engine {
1378    ($($pattern:tt => $code:tt;)*) => {
1379        macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1380        : tt) => {} } _with_inner_spi_master_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1381    };
1382}
1383#[macro_export]
1384#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1385macro_rules! with_spi_slave_dma_engine {
1386    ($($pattern:tt => $code:tt;)*) => {
1387        macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1388        : tt) => {} } _with_inner_spi_slave_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1389    };
1390}
1391#[macro_export]
1392#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1393macro_rules! with_uhci_dma_engine {
1394    ($($pattern:tt => $code:tt;)*) => {
1395        macro_rules! _with_inner_uhci_dma_engine { $(($pattern) => $code;)* ($other : tt)
1396        => {} } _with_inner_uhci_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1397    };
1398}
1399#[macro_export]
1400#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1401macro_rules! for_each_interrupt {
1402    ($($pattern:tt => $code:tt;)*) => {
1403        macro_rules! _for_each_inner_interrupt { $(($pattern) => $code;)* ($other : tt)
1404        => {} } _for_each_inner_interrupt!(([disabled 0] 0));
1405        _for_each_inner_interrupt!(([reserved 0] 1));
1406        _for_each_inner_interrupt!(([reserved 1] 2));
1407        _for_each_inner_interrupt!(([reserved 2] 3));
1408        _for_each_inner_interrupt!(([reserved 3] 4));
1409        _for_each_inner_interrupt!(([reserved 4] 5));
1410        _for_each_inner_interrupt!(([reserved 5] 6));
1411        _for_each_inner_interrupt!(([reserved 6] 7));
1412        _for_each_inner_interrupt!(([reserved 7] 8));
1413        _for_each_inner_interrupt!(([reserved 8] 9));
1414        _for_each_inner_interrupt!(([reserved 9] 10));
1415        _for_each_inner_interrupt!(([reserved 10] 11));
1416        _for_each_inner_interrupt!(([reserved 11] 12));
1417        _for_each_inner_interrupt!(([reserved 12] 13));
1418        _for_each_inner_interrupt!(([reserved 13] 14));
1419        _for_each_inner_interrupt!(([reserved 14] 15));
1420        _for_each_inner_interrupt!(([vector 0] 16)); _for_each_inner_interrupt!(([vector
1421        1] 17)); _for_each_inner_interrupt!(([vector 2] 18));
1422        _for_each_inner_interrupt!(([vector 3] 19)); _for_each_inner_interrupt!(([vector
1423        4] 20)); _for_each_inner_interrupt!(([vector 5] 21));
1424        _for_each_inner_interrupt!(([vector 6] 22)); _for_each_inner_interrupt!(([vector
1425        7] 23)); _for_each_inner_interrupt!(([direct_bindable 0] 24));
1426        _for_each_inner_interrupt!(([direct_bindable 1] 25));
1427        _for_each_inner_interrupt!(([direct_bindable 2] 26));
1428        _for_each_inner_interrupt!(([direct_bindable 3] 27));
1429        _for_each_inner_interrupt!(([direct_bindable 4] 28));
1430        _for_each_inner_interrupt!(([direct_bindable 5] 29));
1431        _for_each_inner_interrupt!(([direct_bindable 6] 30));
1432        _for_each_inner_interrupt!(([direct_bindable 7] 31));
1433        _for_each_inner_interrupt!(([direct_bindable 8] 32));
1434        _for_each_inner_interrupt!(([direct_bindable 9] 33));
1435        _for_each_inner_interrupt!(([direct_bindable 10] 34));
1436        _for_each_inner_interrupt!(([direct_bindable 11] 35));
1437        _for_each_inner_interrupt!(([direct_bindable 12] 36));
1438        _for_each_inner_interrupt!(([direct_bindable 13] 37));
1439        _for_each_inner_interrupt!(([direct_bindable 14] 38));
1440        _for_each_inner_interrupt!(([direct_bindable 15] 39));
1441        _for_each_inner_interrupt!(([direct_bindable 16] 40));
1442        _for_each_inner_interrupt!(([direct_bindable 17] 41));
1443        _for_each_inner_interrupt!(([direct_bindable 18] 42));
1444        _for_each_inner_interrupt!(([direct_bindable 19] 43));
1445        _for_each_inner_interrupt!(([direct_bindable 20] 44));
1446        _for_each_inner_interrupt!(([direct_bindable 21] 45));
1447        _for_each_inner_interrupt!(([direct_bindable 22] 46));
1448        _for_each_inner_interrupt!(([direct_bindable 23] 47));
1449        _for_each_inner_interrupt!((all([disabled 0] 0), ([reserved 0] 1), ([reserved 1]
1450        2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5), ([reserved 5] 6),
1451        ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9), ([reserved 9] 10),
1452        ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13), ([reserved 13] 14),
1453        ([reserved 14] 15), ([vector 0] 16), ([vector 1] 17), ([vector 2] 18), ([vector
1454        3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6] 22), ([vector 7] 23),
1455        ([direct_bindable 0] 24), ([direct_bindable 1] 25), ([direct_bindable 2] 26),
1456        ([direct_bindable 3] 27), ([direct_bindable 4] 28), ([direct_bindable 5] 29),
1457        ([direct_bindable 6] 30), ([direct_bindable 7] 31), ([direct_bindable 8] 32),
1458        ([direct_bindable 9] 33), ([direct_bindable 10] 34), ([direct_bindable 11] 35),
1459        ([direct_bindable 12] 36), ([direct_bindable 13] 37), ([direct_bindable 14] 38),
1460        ([direct_bindable 15] 39), ([direct_bindable 16] 40), ([direct_bindable 17] 41),
1461        ([direct_bindable 18] 42), ([direct_bindable 19] 43), ([direct_bindable 20] 44),
1462        ([direct_bindable 21] 45), ([direct_bindable 22] 46), ([direct_bindable 23]
1463        47)));
1464    };
1465}
1466#[macro_export]
1467#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1468macro_rules! for_each_classified_interrupt {
1469    ($($pattern:tt => $code:tt;)*) => {
1470        macro_rules! _for_each_inner_classified_interrupt { $(($pattern) => $code;)*
1471        ($other : tt) => {} } _for_each_inner_classified_interrupt!(([direct_bindable 0]
1472        24)); _for_each_inner_classified_interrupt!(([direct_bindable 1] 25));
1473        _for_each_inner_classified_interrupt!(([direct_bindable 2] 26));
1474        _for_each_inner_classified_interrupt!(([direct_bindable 3] 27));
1475        _for_each_inner_classified_interrupt!(([direct_bindable 4] 28));
1476        _for_each_inner_classified_interrupt!(([direct_bindable 5] 29));
1477        _for_each_inner_classified_interrupt!(([direct_bindable 6] 30));
1478        _for_each_inner_classified_interrupt!(([direct_bindable 7] 31));
1479        _for_each_inner_classified_interrupt!(([direct_bindable 8] 32));
1480        _for_each_inner_classified_interrupt!(([direct_bindable 9] 33));
1481        _for_each_inner_classified_interrupt!(([direct_bindable 10] 34));
1482        _for_each_inner_classified_interrupt!(([direct_bindable 11] 35));
1483        _for_each_inner_classified_interrupt!(([direct_bindable 12] 36));
1484        _for_each_inner_classified_interrupt!(([direct_bindable 13] 37));
1485        _for_each_inner_classified_interrupt!(([direct_bindable 14] 38));
1486        _for_each_inner_classified_interrupt!(([direct_bindable 15] 39));
1487        _for_each_inner_classified_interrupt!(([direct_bindable 16] 40));
1488        _for_each_inner_classified_interrupt!(([direct_bindable 17] 41));
1489        _for_each_inner_classified_interrupt!(([direct_bindable 18] 42));
1490        _for_each_inner_classified_interrupt!(([direct_bindable 19] 43));
1491        _for_each_inner_classified_interrupt!(([direct_bindable 20] 44));
1492        _for_each_inner_classified_interrupt!(([direct_bindable 21] 45));
1493        _for_each_inner_classified_interrupt!(([direct_bindable 22] 46));
1494        _for_each_inner_classified_interrupt!(([direct_bindable 23] 47));
1495        _for_each_inner_classified_interrupt!(([vector 0] 16));
1496        _for_each_inner_classified_interrupt!(([vector 1] 17));
1497        _for_each_inner_classified_interrupt!(([vector 2] 18));
1498        _for_each_inner_classified_interrupt!(([vector 3] 19));
1499        _for_each_inner_classified_interrupt!(([vector 4] 20));
1500        _for_each_inner_classified_interrupt!(([vector 5] 21));
1501        _for_each_inner_classified_interrupt!(([vector 6] 22));
1502        _for_each_inner_classified_interrupt!(([vector 7] 23));
1503        _for_each_inner_classified_interrupt!(([reserved 0] 1));
1504        _for_each_inner_classified_interrupt!(([reserved 1] 2));
1505        _for_each_inner_classified_interrupt!(([reserved 2] 3));
1506        _for_each_inner_classified_interrupt!(([reserved 3] 4));
1507        _for_each_inner_classified_interrupt!(([reserved 4] 5));
1508        _for_each_inner_classified_interrupt!(([reserved 5] 6));
1509        _for_each_inner_classified_interrupt!(([reserved 6] 7));
1510        _for_each_inner_classified_interrupt!(([reserved 7] 8));
1511        _for_each_inner_classified_interrupt!(([reserved 8] 9));
1512        _for_each_inner_classified_interrupt!(([reserved 9] 10));
1513        _for_each_inner_classified_interrupt!(([reserved 10] 11));
1514        _for_each_inner_classified_interrupt!(([reserved 11] 12));
1515        _for_each_inner_classified_interrupt!(([reserved 12] 13));
1516        _for_each_inner_classified_interrupt!(([reserved 13] 14));
1517        _for_each_inner_classified_interrupt!(([reserved 14] 15));
1518        _for_each_inner_classified_interrupt!((direct_bindable([direct_bindable 0] 24),
1519        ([direct_bindable 1] 25), ([direct_bindable 2] 26), ([direct_bindable 3] 27),
1520        ([direct_bindable 4] 28), ([direct_bindable 5] 29), ([direct_bindable 6] 30),
1521        ([direct_bindable 7] 31), ([direct_bindable 8] 32), ([direct_bindable 9] 33),
1522        ([direct_bindable 10] 34), ([direct_bindable 11] 35), ([direct_bindable 12] 36),
1523        ([direct_bindable 13] 37), ([direct_bindable 14] 38), ([direct_bindable 15] 39),
1524        ([direct_bindable 16] 40), ([direct_bindable 17] 41), ([direct_bindable 18] 42),
1525        ([direct_bindable 19] 43), ([direct_bindable 20] 44), ([direct_bindable 21] 45),
1526        ([direct_bindable 22] 46), ([direct_bindable 23] 47)));
1527        _for_each_inner_classified_interrupt!((vector([vector 0] 16), ([vector 1] 17),
1528        ([vector 2] 18), ([vector 3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6]
1529        22), ([vector 7] 23))); _for_each_inner_classified_interrupt!((reserved([reserved
1530        0] 1), ([reserved 1] 2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5),
1531        ([reserved 5] 6), ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9),
1532        ([reserved 9] 10), ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13),
1533        ([reserved 13] 14), ([reserved 14] 15)));
1534        _for_each_inner_classified_interrupt!((context_switch));
1535    };
1536}
1537#[macro_export]
1538#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1539macro_rules! for_each_interrupt_priority {
1540    ($($pattern:tt => $code:tt;)*) => {
1541        macro_rules! _for_each_inner_interrupt_priority { $(($pattern) => $code;)*
1542        ($other : tt) => {} } _for_each_inner_interrupt_priority!((0, 1, Priority1,
1543        Level1)); _for_each_inner_interrupt_priority!((1, 2, Priority2, Level2));
1544        _for_each_inner_interrupt_priority!((2, 3, Priority3, Level3));
1545        _for_each_inner_interrupt_priority!((3, 4, Priority4, Level4));
1546        _for_each_inner_interrupt_priority!((4, 5, Priority5, Level5));
1547        _for_each_inner_interrupt_priority!((5, 6, Priority6, Level6));
1548        _for_each_inner_interrupt_priority!((6, 7, Priority7, Level7));
1549        _for_each_inner_interrupt_priority!((7, 8, Priority8, Level8));
1550        _for_each_inner_interrupt_priority!((all(0, 1, Priority1, Level1), (1, 2,
1551        Priority2, Level2), (2, 3, Priority3, Level3), (3, 4, Priority4, Level4), (4, 5,
1552        Priority5, Level5), (5, 6, Priority6, Level6), (6, 7, Priority7, Level7), (7, 8,
1553        Priority8, Level8)));
1554    };
1555}
1556#[macro_export]
1557#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1558macro_rules! for_each_sw_interrupt {
1559    ($($pattern:tt => $code:tt;)*) => {
1560        macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1561        tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1562        software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1563        software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1564        software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1565        software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1566        software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1567        FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1568    };
1569}
1570#[macro_export]
1571/// ESP-HAL must provide implementation for the following functions:
1572/// ```rust, no_run
1573/// // XTAL_CLK
1574///
1575/// // BBPLL_CLK
1576///
1577/// fn enable_bbpll_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1578///     todo!()
1579/// }
1580///
1581/// // CPLL_CLK
1582///
1583/// fn enable_cpll_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1584///     todo!()
1585/// }
1586///
1587/// // MPLL_CLK
1588///
1589/// fn enable_mpll_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1590///     todo!()
1591/// }
1592///
1593/// // RC_FAST_CLK
1594///
1595/// fn enable_rc_fast_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1596///     todo!()
1597/// }
1598///
1599/// // XTAL32K_CLK
1600///
1601/// #[cfg(use_xtal32k)]
1602/// fn enable_xtal32k_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1603///     todo!()
1604/// }
1605///
1606/// // RC_SLOW_CLK
1607///
1608/// fn enable_rc_slow_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1609///     todo!()
1610/// }
1611///
1612/// // PLL_F20M
1613///
1614/// fn enable_pll_f20m_impl(_clocks: &mut ClockTree, _en: bool) {
1615///     todo!()
1616/// }
1617///
1618/// // PLL_F80M
1619///
1620/// fn enable_pll_f80m_impl(_clocks: &mut ClockTree, _en: bool) {
1621///     todo!()
1622/// }
1623///
1624/// // PLL_F120M
1625///
1626/// fn enable_pll_f120m_impl(_clocks: &mut ClockTree, _en: bool) {
1627///     todo!()
1628/// }
1629///
1630/// // PLL_F160M
1631///
1632/// fn enable_pll_f160m_impl(_clocks: &mut ClockTree, _en: bool) {
1633///     todo!()
1634/// }
1635///
1636/// // PLL_F240M
1637///
1638/// fn enable_pll_f240m_impl(_clocks: &mut ClockTree, _en: bool) {
1639///     todo!()
1640/// }
1641///
1642/// // BBPLL_D3_CLOCK
1643///
1644/// fn enable_bbpll_d3_clock_impl(_clocks: &mut ClockTree, _en: bool) {
1645///     todo!()
1646/// }
1647///
1648/// // PLL_F25M
1649///
1650/// fn enable_pll_f25m_impl(_clocks: &mut ClockTree, _en: bool) {
1651///     todo!()
1652/// }
1653///
1654/// // PLL_F50M
1655///
1656/// fn enable_pll_f50m_impl(_clocks: &mut ClockTree, _en: bool) {
1657///     todo!()
1658/// }
1659///
1660/// // XTAL_D2_CLK
1661///
1662/// fn enable_xtal_d2_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1663///     todo!()
1664/// }
1665///
1666/// // CPU_ROOT_CLK
1667///
1668/// fn enable_cpu_root_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1669///     todo!()
1670/// }
1671///
1672/// fn configure_cpu_root_clk_impl(
1673///     _clocks: &mut ClockTree,
1674///     _old_config: Option<CpuRootClkConfig>,
1675///     _new_config: CpuRootClkConfig,
1676/// ) {
1677///     todo!()
1678/// }
1679///
1680/// // CPU_CLK
1681///
1682/// fn enable_cpu_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1683///     todo!()
1684/// }
1685///
1686/// fn configure_cpu_clk_impl(
1687///     _clocks: &mut ClockTree,
1688///     _old_config: Option<CpuClkConfig>,
1689///     _new_config: CpuClkConfig,
1690/// ) {
1691///     todo!()
1692/// }
1693///
1694/// // MEM_CLK
1695///
1696/// fn enable_mem_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1697///     todo!()
1698/// }
1699///
1700/// fn configure_mem_clk_impl(
1701///     _clocks: &mut ClockTree,
1702///     _old_config: Option<MemClkConfig>,
1703///     _new_config: MemClkConfig,
1704/// ) {
1705///     todo!()
1706/// }
1707///
1708/// // SYS_CLK
1709///
1710/// fn enable_sys_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1711///     todo!()
1712/// }
1713///
1714/// fn configure_sys_clk_impl(
1715///     _clocks: &mut ClockTree,
1716///     _old_config: Option<SysClkConfig>,
1717///     _new_config: SysClkConfig,
1718/// ) {
1719///     todo!()
1720/// }
1721///
1722/// // APB_CLK
1723///
1724/// fn configure_apb_clk_impl(
1725///     _clocks: &mut ClockTree,
1726///     _old_config: Option<ApbClkConfig>,
1727///     _new_config: ApbClkConfig,
1728/// ) {
1729///     todo!()
1730/// }
1731///
1732/// // LP_FAST_CLK
1733///
1734/// fn enable_lp_fast_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1735///     todo!()
1736/// }
1737///
1738/// fn configure_lp_fast_clk_impl(
1739///     _clocks: &mut ClockTree,
1740///     _old_config: Option<LpFastClkConfig>,
1741///     _new_config: LpFastClkConfig,
1742/// ) {
1743///     todo!()
1744/// }
1745///
1746/// // LP_SLOW_CLK
1747///
1748/// fn enable_lp_slow_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1749///     todo!()
1750/// }
1751///
1752/// fn configure_lp_slow_clk_impl(
1753///     _clocks: &mut ClockTree,
1754///     _old_config: Option<LpSlowClkConfig>,
1755///     _new_config: LpSlowClkConfig,
1756/// ) {
1757///     todo!()
1758/// }
1759///
1760/// // CRYPTO_CLK
1761///
1762/// fn enable_crypto_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1763///     todo!()
1764/// }
1765///
1766/// fn configure_crypto_clk_impl(
1767///     _clocks: &mut ClockTree,
1768///     _old_config: Option<CryptoClkConfig>,
1769///     _new_config: CryptoClkConfig,
1770/// ) {
1771///     todo!()
1772/// }
1773///
1774/// // IOMUX_FUNCTION_CLOCK
1775///
1776/// fn configure_iomux_function_clock_impl(
1777///     _clocks: &mut ClockTree,
1778///     _old_config: Option<IomuxFunctionClockConfig>,
1779///     _new_config: IomuxFunctionClockConfig,
1780/// ) {
1781///     todo!()
1782/// }
1783///
1784/// // TIMG_CALIBRATION_CLOCK
1785///
1786/// fn enable_timg_calibration_clock_impl(_clocks: &mut ClockTree, _en: bool) {
1787///     todo!()
1788/// }
1789///
1790/// fn configure_timg_calibration_clock_impl(
1791///     _clocks: &mut ClockTree,
1792///     _old_config: Option<TimgCalibrationClockConfig>,
1793///     _new_config: TimgCalibrationClockConfig,
1794/// ) {
1795///     todo!()
1796/// }
1797///
1798/// impl SdmInstance {
1799///     // SDM_FUNCTION_CLOCK
1800///
1801///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1802///         todo!()
1803///     }
1804/// }
1805/// impl I2cInstance {
1806///     // I2C_FUNCTION_CLOCK
1807///
1808///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1809///         todo!()
1810///     }
1811///
1812///     fn configure_function_clock_impl(
1813///         self,
1814///         _clocks: &mut ClockTree,
1815///         _old_config: Option<I2cFunctionClockConfig>,
1816///         _new_config: I2cFunctionClockConfig,
1817///     ) {
1818///         todo!()
1819///     }
1820/// }
1821/// impl I2sInstance {
1822///     // I2S_TX_CLK
1823///
1824///     fn enable_tx_clk_impl(self, _clocks: &mut ClockTree, _en: bool) {
1825///         todo!()
1826///     }
1827///
1828///     fn configure_tx_clk_impl(
1829///         self,
1830///         _clocks: &mut ClockTree,
1831///         _old_config: Option<I2sClkConfig>,
1832///         _new_config: I2sClkConfig,
1833///     ) {
1834///         todo!()
1835///     }
1836///
1837///     // I2S_RX_CLK
1838///
1839///     fn enable_rx_clk_impl(self, _clocks: &mut ClockTree, _en: bool) {
1840///         todo!()
1841///     }
1842///
1843///     fn configure_rx_clk_impl(
1844///         self,
1845///         _clocks: &mut ClockTree,
1846///         _old_config: Option<I2sClkConfig>,
1847///         _new_config: I2sClkConfig,
1848///     ) {
1849///         todo!()
1850///     }
1851///
1852///     // I2S_MCLK_OUT
1853///
1854///     fn enable_mclk_out_impl(self, _clocks: &mut ClockTree, _en: bool) {
1855///         todo!()
1856///     }
1857///
1858///     fn configure_mclk_out_impl(
1859///         self,
1860///         _clocks: &mut ClockTree,
1861///         _old_config: Option<I2sMclkOutConfig>,
1862///         _new_config: I2sMclkOutConfig,
1863///     ) {
1864///         todo!()
1865///     }
1866/// }
1867/// impl LcdCamInstance {
1868///     // LCD_CAM_LCD_CLOCK
1869///
1870///     fn enable_lcd_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1871///         todo!()
1872///     }
1873///
1874///     fn configure_lcd_clock_impl(
1875///         self,
1876///         _clocks: &mut ClockTree,
1877///         _old_config: Option<LcdCamLcdClockConfig>,
1878///         _new_config: LcdCamLcdClockConfig,
1879///     ) {
1880///         todo!()
1881///     }
1882///
1883///     // LCD_CAM_CAM_CLOCK
1884///
1885///     fn enable_cam_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1886///         todo!()
1887///     }
1888///
1889///     fn configure_cam_clock_impl(
1890///         self,
1891///         _clocks: &mut ClockTree,
1892///         _old_config: Option<LcdCamCamClockConfig>,
1893///         _new_config: LcdCamCamClockConfig,
1894///     ) {
1895///         todo!()
1896///     }
1897/// }
1898/// impl RmtInstance {
1899///     // RMT_SCLK
1900///
1901///     fn enable_sclk_impl(self, _clocks: &mut ClockTree, _en: bool) {
1902///         todo!()
1903///     }
1904///
1905///     fn configure_sclk_impl(
1906///         self,
1907///         _clocks: &mut ClockTree,
1908///         _old_config: Option<RmtSclkConfig>,
1909///         _new_config: RmtSclkConfig,
1910///     ) {
1911///         todo!()
1912///     }
1913/// }
1914/// impl SpiInstance {
1915///     // SPI_FUNCTION_CLOCK
1916///
1917///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1918///         todo!()
1919///     }
1920///
1921///     fn configure_function_clock_impl(
1922///         self,
1923///         _clocks: &mut ClockTree,
1924///         _old_config: Option<SpiFunctionClockConfig>,
1925///         _new_config: SpiFunctionClockConfig,
1926///     ) {
1927///         todo!()
1928///     }
1929/// }
1930/// impl TimgInstance {
1931///     // TIMG_FUNCTION_CLOCK
1932///
1933///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1934///         todo!()
1935///     }
1936///
1937///     fn configure_function_clock_impl(
1938///         self,
1939///         _clocks: &mut ClockTree,
1940///         _old_config: Option<TimgFunctionClockConfig>,
1941///         _new_config: TimgFunctionClockConfig,
1942///     ) {
1943///         todo!()
1944///     }
1945///
1946///     // TIMG_WDT_CLOCK
1947///
1948///     fn enable_wdt_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1949///         todo!()
1950///     }
1951///
1952///     fn configure_wdt_clock_impl(
1953///         self,
1954///         _clocks: &mut ClockTree,
1955///         _old_config: Option<TimgWdtClockConfig>,
1956///         _new_config: TimgWdtClockConfig,
1957///     ) {
1958///         todo!()
1959///     }
1960/// }
1961/// impl UartInstance {
1962///     // UART_FUNCTION_CLOCK
1963///
1964///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1965///         todo!()
1966///     }
1967///
1968///     fn configure_function_clock_impl(
1969///         self,
1970///         _clocks: &mut ClockTree,
1971///         _old_config: Option<UartFunctionClockConfig>,
1972///         _new_config: UartFunctionClockConfig,
1973///     ) {
1974///         todo!()
1975///     }
1976///
1977///     // UART_BAUD_RATE_GENERATOR
1978///
1979///     fn enable_baud_rate_generator_impl(self, _clocks: &mut ClockTree, _en: bool) {
1980///         todo!()
1981///     }
1982///
1983///     fn configure_baud_rate_generator_impl(
1984///         self,
1985///         _clocks: &mut ClockTree,
1986///         _old_config: Option<UartBaudRateGeneratorConfig>,
1987///         _new_config: UartBaudRateGeneratorConfig,
1988///     ) {
1989///         todo!()
1990///     }
1991///
1992///     // UART_MEM_CLOCK
1993///
1994///     fn enable_mem_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
1995///         todo!()
1996///     }
1997/// }
1998/// impl PsramInstance {
1999///     // PSRAM_FUNCTION_CLOCK
2000///
2001///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2002///         todo!()
2003///     }
2004///
2005///     fn configure_function_clock_impl(
2006///         self,
2007///         _clocks: &mut ClockTree,
2008///         _old_config: Option<PsramFunctionClockConfig>,
2009///         _new_config: PsramFunctionClockConfig,
2010///     ) {
2011///         todo!()
2012///     }
2013/// }
2014/// ```
2015macro_rules! define_clock_tree_types {
2016    () => {
2017        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2018        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2019        pub enum SdmInstance {
2020            GpioSd = 0,
2021        }
2022        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2023        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2024        pub enum I2cInstance {
2025            I2c0 = 0,
2026            I2c1 = 1,
2027        }
2028        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2029        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2030        pub enum I2sInstance {
2031            I2s0 = 0,
2032            I2s1 = 1,
2033        }
2034        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2035        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2036        pub enum LcdCamInstance {
2037            LcdCam = 0,
2038        }
2039        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2040        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2041        pub enum RmtInstance {
2042            Rmt = 0,
2043        }
2044        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2045        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2046        pub enum SpiInstance {
2047            Spi2 = 0,
2048            Spi3 = 1,
2049        }
2050        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2051        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2052        pub enum TimgInstance {
2053            Timg0 = 0,
2054            Timg1 = 1,
2055        }
2056        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2057        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2058        pub enum UartInstance {
2059            Uart0 = 0,
2060            Uart1 = 1,
2061            Uart2 = 2,
2062            Uart3 = 3,
2063        }
2064        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2065        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2066        pub enum PsramInstance {
2067            Psram = 0,
2068        }
2069        /// The list of clock signals that the `CPU_ROOT_CLK` multiplexer can output.
2070        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2071        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2072        pub enum CpuRootClkConfig {
2073            /// Selects `XTAL_CLK`.
2074            Xtal,
2075            /// Selects `CPLL_CLK`.
2076            Cpll,
2077            /// Selects `RC_FAST_CLK`.
2078            RcFast,
2079            /// Selects `PLL_F240M`.
2080            PllF240m,
2081        }
2082        /// Configures the `CPU_CLK` clock node.
2083        ///
2084        /// The output is calculated as `OUTPUT = CPU_ROOT_CLK / (divisor + 1)`.
2085        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2086        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2087        pub struct CpuClkConfig {
2088            divisor: u32,
2089        }
2090        impl CpuClkConfig {
2091            /// Creates a new configuration for the CPU_CLK clock node.
2092            ///
2093            /// ## Panics
2094            ///
2095            /// Panics if the divisor value is outside the
2096            /// valid range (0 ..= 255).
2097            pub const fn new(divisor: u32) -> Self {
2098                ::core::assert!(
2099                    divisor <= 255,
2100                    "`CPU_CLK` divisor must be between 0 and 255 (inclusive)."
2101                );
2102                Self { divisor }
2103            }
2104            pub(crate) fn divisor(self) -> u32 {
2105                self.divisor as u32
2106            }
2107        }
2108        /// Configures the `MEM_CLK` clock node.
2109        ///
2110        /// The output is calculated as `OUTPUT = CPU_CLK / (divisor + 1)`.
2111        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2112        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2113        pub struct MemClkConfig {
2114            divisor: u32,
2115        }
2116        impl MemClkConfig {
2117            /// Creates a new configuration for the MEM_CLK clock node.
2118            ///
2119            /// ## Panics
2120            ///
2121            /// Panics if the divisor value is outside the
2122            /// valid range (0 ..= 1).
2123            pub const fn new(divisor: u32) -> Self {
2124                ::core::assert!(
2125                    divisor <= 1,
2126                    "`MEM_CLK` divisor must be between 0 and 1 (inclusive)."
2127                );
2128                Self { divisor }
2129            }
2130            pub(crate) fn divisor(self) -> u32 {
2131                self.divisor as u32
2132            }
2133        }
2134        /// Configures the `SYS_CLK` clock node.
2135        ///
2136        /// The output is calculated as `OUTPUT = CPU_CLK / (divisor + 1)`.
2137        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2138        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2139        pub struct SysClkConfig {
2140            divisor: u32,
2141        }
2142        impl SysClkConfig {
2143            /// Creates a new configuration for the SYS_CLK clock node.
2144            ///
2145            /// ## Panics
2146            ///
2147            /// Panics if the divisor value is outside the
2148            /// valid range (0 ..= 255).
2149            pub const fn new(divisor: u32) -> Self {
2150                ::core::assert!(
2151                    divisor <= 255,
2152                    "`SYS_CLK` divisor must be between 0 and 255 (inclusive)."
2153                );
2154                Self { divisor }
2155            }
2156            pub(crate) fn divisor(self) -> u32 {
2157                self.divisor as u32
2158            }
2159        }
2160        /// Configures the `APB_CLK` clock node.
2161        ///
2162        /// The output is calculated as `OUTPUT = SYS_CLK / (divisor + 1)`.
2163        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2164        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2165        pub struct ApbClkConfig {
2166            divisor: u32,
2167        }
2168        impl ApbClkConfig {
2169            /// Creates a new configuration for the APB_CLK clock node.
2170            ///
2171            /// ## Panics
2172            ///
2173            /// Panics if the divisor value is outside the
2174            /// valid range (0 ..= 255).
2175            pub const fn new(divisor: u32) -> Self {
2176                ::core::assert!(
2177                    divisor <= 255,
2178                    "`APB_CLK` divisor must be between 0 and 255 (inclusive)."
2179                );
2180                Self { divisor }
2181            }
2182            pub(crate) fn divisor(self) -> u32 {
2183                self.divisor as u32
2184            }
2185        }
2186        /// The list of clock signals that the `LP_FAST_CLK` multiplexer can output.
2187        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2188        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2189        pub enum LpFastClkConfig {
2190            /// Selects `RC_FAST_CLK`.
2191            RcFast,
2192            /// Selects `XTAL_CLK`.
2193            Xtal,
2194        }
2195        /// The list of clock signals that the `LP_SLOW_CLK` multiplexer can output.
2196        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2197        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2198        pub enum LpSlowClkConfig {
2199            /// Selects `RC_SLOW_CLK`.
2200            RcSlow,
2201            #[cfg(use_xtal32k)]
2202            /// Selects `XTAL32K_CLK`.
2203            Xtal32k,
2204        }
2205        /// The list of clock signals that the `CRYPTO_CLK` multiplexer can output.
2206        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2207        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2208        pub enum CryptoClkConfig {
2209            /// Selects `XTAL_CLK`.
2210            Xtal,
2211            /// Selects `RC_FAST_CLK`.
2212            RcFast,
2213            /// Selects `PLL_F240M`.
2214            PllF240m,
2215        }
2216        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2217        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2218        pub enum IomuxFunctionClockSource {
2219            /// Selects `XTAL_CLK`.
2220            XtalClk,
2221            #[default]
2222            /// Selects `PLL_F80M`.
2223            PllF80m,
2224        }
2225        /// Configures the `IOMUX_FUNCTION_CLOCK` clock node.
2226        ///
2227        /// The output is calculated as `OUTPUT = source / (div_num + 1)`.
2228        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2229        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2230        pub struct IomuxFunctionClockConfig {
2231            source: IomuxFunctionClockSource,
2232            div_num: u32,
2233        }
2234        impl IomuxFunctionClockConfig {
2235            /// Creates a new configuration for the IOMUX_FUNCTION_CLOCK clock node.
2236            ///
2237            /// ## Panics
2238            ///
2239            /// Panics if the div_num value is outside the
2240            /// valid range (0 ..= 255).
2241            pub const fn new(source: IomuxFunctionClockSource, div_num: u32) -> Self {
2242                ::core::assert!(
2243                    div_num <= 255,
2244                    "`IOMUX_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2245                );
2246                Self { source, div_num }
2247            }
2248            pub(crate) fn source(self) -> IomuxFunctionClockSource {
2249                self.source
2250            }
2251            pub(crate) fn div_num(self) -> u32 {
2252                self.div_num as u32
2253            }
2254        }
2255        /// The list of clock signals that the `TIMG_CALIBRATION_CLOCK` multiplexer can output.
2256        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2257        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2258        pub enum TimgCalibrationClockConfig {
2259            /// Selects `RC_SLOW_CLK`.
2260            RcSlowClk,
2261            /// Selects `RC_FAST_CLK`.
2262            RcFastDivClk,
2263            #[cfg(use_xtal32k)]
2264            /// Selects `XTAL32K_CLK`.
2265            Xtal32kClk,
2266        }
2267        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2268        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2269        pub enum I2cFunctionClockSclk {
2270            #[default]
2271            /// Selects `XTAL_CLK`.
2272            Xtal,
2273            /// Selects `RC_FAST_CLK`.
2274            RcFast,
2275        }
2276        /// Configures the `I2C0_FUNCTION_CLOCK` clock node.
2277        ///
2278        /// The output is calculated as `OUTPUT = sclk / (div_num + 1)`.
2279        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2280        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2281        pub struct I2cFunctionClockConfig {
2282            sclk: I2cFunctionClockSclk,
2283            div_num: u32,
2284        }
2285        impl I2cFunctionClockConfig {
2286            /// Creates a new configuration for the FUNCTION_CLOCK clock node.
2287            ///
2288            /// ## Panics
2289            ///
2290            /// Panics if the div_num value is outside the
2291            /// valid range (0 ..= 255).
2292            pub const fn new(sclk: I2cFunctionClockSclk, div_num: u32) -> Self {
2293                ::core::assert!(
2294                    div_num <= 255,
2295                    "`I2C0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2296                );
2297                Self { sclk, div_num }
2298            }
2299            pub(crate) fn sclk(self) -> I2cFunctionClockSclk {
2300                self.sclk
2301            }
2302            pub(crate) fn div_num(self) -> u32 {
2303                self.div_num as u32
2304            }
2305        }
2306        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2307        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2308        pub enum I2sClkSclk {
2309            #[default]
2310            /// Selects `XTAL_CLK`.
2311            Xtal,
2312        }
2313        /// Configures the `I2S0_TX_CLK` clock node.
2314        ///
2315        /// The output is calculated as `OUTPUT = (sclk * div_a) / (div_num * div_a + div_b)`.
2316        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2317        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2318        pub struct I2sClkConfig {
2319            sclk: I2sClkSclk,
2320            div_num: u32,
2321            div_a: u32,
2322            div_b: u32,
2323        }
2324        impl I2sClkConfig {
2325            /// Creates a new configuration for the TX_CLK clock node.
2326            ///
2327            /// ## Panics
2328            ///
2329            /// Panics if the div_num value is outside the
2330            /// valid range (1 ..= 256).
2331            ///
2332            /// Panics if the div_a value is outside the
2333            /// valid range (1 ..= 511).
2334            ///
2335            /// Panics if the div_b value is outside the
2336            /// valid range (0 ..= 511).
2337            pub const fn new(sclk: I2sClkSclk, div_num: u32, div_a: u32, div_b: u32) -> Self {
2338                ::core::assert!(
2339                    div_num >= 1 && div_num <= 256,
2340                    "`I2S0_TX_CLK` div_num must be between 1 and 256 (inclusive)."
2341                );
2342                ::core::assert!(
2343                    div_a >= 1 && div_a <= 511,
2344                    "`I2S0_TX_CLK` div_a must be between 1 and 511 (inclusive)."
2345                );
2346                ::core::assert!(
2347                    div_b <= 511,
2348                    "`I2S0_TX_CLK` div_b must be between 0 and 511 (inclusive)."
2349                );
2350                Self {
2351                    sclk,
2352                    div_num,
2353                    div_a,
2354                    div_b,
2355                }
2356            }
2357            pub(crate) fn sclk(self) -> I2sClkSclk {
2358                self.sclk
2359            }
2360            pub(crate) fn div_num(self) -> u32 {
2361                self.div_num as u32
2362            }
2363            pub(crate) fn div_a(self) -> u32 {
2364                self.div_a as u32
2365            }
2366            pub(crate) fn div_b(self) -> u32 {
2367                self.div_b as u32
2368            }
2369        }
2370        /// The list of clock signals that the `I2S0_MCLK_OUT` multiplexer can output.
2371        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2372        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2373        pub enum I2sMclkOutConfig {
2374            /// Selects `TX_CLK`.
2375            Tx,
2376            #[default]
2377            /// Selects `RX_CLK`.
2378            Rx,
2379        }
2380        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2381        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2382        pub enum LcdCamLcdClockSclk {
2383            #[default]
2384            /// Selects `XTAL_CLK`.
2385            XtalClk,
2386            /// Selects `PLL_F160M`.
2387            PllF160m,
2388        }
2389        /// Configures the `LCD_CAM_LCD_CLOCK` clock node.
2390        ///
2391        /// The output is calculated as `OUTPUT = (sclk * div_a) / (div_num * div_a + div_b)`.
2392        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2393        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2394        pub struct LcdCamLcdClockConfig {
2395            sclk: LcdCamLcdClockSclk,
2396            div_num: u32,
2397            div_a: u32,
2398            div_b: u32,
2399        }
2400        impl LcdCamLcdClockConfig {
2401            /// Creates a new configuration for the LCD_CLOCK clock node.
2402            ///
2403            /// ## Panics
2404            ///
2405            /// Panics if the div_num value is outside the
2406            /// valid range (1 ..= 256).
2407            ///
2408            /// Panics if the div_a value is outside the
2409            /// valid range (1 ..= 255).
2410            ///
2411            /// Panics if the div_b value is outside the
2412            /// valid range (0 ..= 255).
2413            pub const fn new(
2414                sclk: LcdCamLcdClockSclk,
2415                div_num: u32,
2416                div_a: u32,
2417                div_b: u32,
2418            ) -> Self {
2419                ::core::assert!(
2420                    div_num >= 1 && div_num <= 256,
2421                    "`LCD_CAM_LCD_CLOCK` div_num must be between 1 and 256 (inclusive)."
2422                );
2423                ::core::assert!(
2424                    div_a >= 1 && div_a <= 255,
2425                    "`LCD_CAM_LCD_CLOCK` div_a must be between 1 and 255 (inclusive)."
2426                );
2427                ::core::assert!(
2428                    div_b <= 255,
2429                    "`LCD_CAM_LCD_CLOCK` div_b must be between 0 and 255 (inclusive)."
2430                );
2431                Self {
2432                    sclk,
2433                    div_num,
2434                    div_a,
2435                    div_b,
2436                }
2437            }
2438            pub(crate) fn sclk(self) -> LcdCamLcdClockSclk {
2439                self.sclk
2440            }
2441            pub(crate) fn div_num(self) -> u32 {
2442                self.div_num as u32
2443            }
2444            pub(crate) fn div_a(self) -> u32 {
2445                self.div_a as u32
2446            }
2447            pub(crate) fn div_b(self) -> u32 {
2448                self.div_b as u32
2449            }
2450        }
2451        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2452        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2453        pub enum LcdCamCamClockSclk {
2454            #[default]
2455            /// Selects `XTAL_CLK`.
2456            XtalClk,
2457            /// Selects `PLL_F160M`.
2458            PllF160m,
2459        }
2460        /// Configures the `LCD_CAM_CAM_CLOCK` clock node.
2461        ///
2462        /// The output is calculated as `OUTPUT = (sclk * div_a) / (div_num * div_a + div_b)`.
2463        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2464        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2465        pub struct LcdCamCamClockConfig {
2466            sclk: LcdCamCamClockSclk,
2467            div_num: u32,
2468            div_a: u32,
2469            div_b: u32,
2470        }
2471        impl LcdCamCamClockConfig {
2472            /// Creates a new configuration for the CAM_CLOCK clock node.
2473            ///
2474            /// ## Panics
2475            ///
2476            /// Panics if the div_num value is outside the
2477            /// valid range (1 ..= 256).
2478            ///
2479            /// Panics if the div_a value is outside the
2480            /// valid range (1 ..= 255).
2481            ///
2482            /// Panics if the div_b value is outside the
2483            /// valid range (0 ..= 255).
2484            pub const fn new(
2485                sclk: LcdCamCamClockSclk,
2486                div_num: u32,
2487                div_a: u32,
2488                div_b: u32,
2489            ) -> Self {
2490                ::core::assert!(
2491                    div_num >= 1 && div_num <= 256,
2492                    "`LCD_CAM_CAM_CLOCK` div_num must be between 1 and 256 (inclusive)."
2493                );
2494                ::core::assert!(
2495                    div_a >= 1 && div_a <= 255,
2496                    "`LCD_CAM_CAM_CLOCK` div_a must be between 1 and 255 (inclusive)."
2497                );
2498                ::core::assert!(
2499                    div_b <= 255,
2500                    "`LCD_CAM_CAM_CLOCK` div_b must be between 0 and 255 (inclusive)."
2501                );
2502                Self {
2503                    sclk,
2504                    div_num,
2505                    div_a,
2506                    div_b,
2507                }
2508            }
2509            pub(crate) fn sclk(self) -> LcdCamCamClockSclk {
2510                self.sclk
2511            }
2512            pub(crate) fn div_num(self) -> u32 {
2513                self.div_num as u32
2514            }
2515            pub(crate) fn div_a(self) -> u32 {
2516                self.div_a as u32
2517            }
2518            pub(crate) fn div_b(self) -> u32 {
2519                self.div_b as u32
2520            }
2521        }
2522        /// The list of clock signals that the `RMT_SCLK` multiplexer can output.
2523        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2524        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2525        pub enum RmtSclkConfig {
2526            #[default]
2527            /// Selects `PLL_F80M`.
2528            PllF80m,
2529            /// Selects `RC_FAST_CLK`.
2530            RcFastClk,
2531            /// Selects `XTAL_CLK`.
2532            XtalClk,
2533        }
2534        /// The list of clock signals that the `SPI2_FUNCTION_CLOCK` multiplexer can output.
2535        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2536        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2537        pub enum SpiFunctionClockConfig {
2538            #[default]
2539            /// Selects `BBPLL_D3_CLOCK`.
2540            Bbpll,
2541            /// Selects `XTAL_CLK`.
2542            Xtal,
2543            /// Selects `RC_FAST_CLK`.
2544            RcFast,
2545        }
2546        /// The list of clock signals that the `TIMG0_FUNCTION_CLOCK` multiplexer can output.
2547        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2548        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2549        pub enum TimgFunctionClockConfig {
2550            #[default]
2551            /// Selects `PLL_F80M`.
2552            PllF80m,
2553            /// Selects `RC_FAST_CLK`.
2554            RcFastClk,
2555            /// Selects `XTAL_CLK`.
2556            XtalClk,
2557        }
2558        /// The list of clock signals that the `TIMG0_WDT_CLOCK` multiplexer can output.
2559        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2560        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2561        pub enum TimgWdtClockConfig {
2562            #[default]
2563            /// Selects `XTAL_CLK`.
2564            XtalClk,
2565            /// Selects `PLL_F80M`.
2566            PllF80m,
2567            /// Selects `RC_FAST_CLK`.
2568            RcFastClk,
2569        }
2570        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2571        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2572        pub enum UartFunctionClockSclk {
2573            #[default]
2574            /// Selects `PLL_F80M`.
2575            PllF80m,
2576            /// Selects `XTAL_CLK`.
2577            Xtal,
2578            /// Selects `RC_FAST_CLK`.
2579            RcFast,
2580        }
2581        /// Configures the `UART0_FUNCTION_CLOCK` clock node.
2582        ///
2583        /// The output is calculated as `OUTPUT = sclk / (div_num + 1)`.
2584        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2585        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2586        pub struct UartFunctionClockConfig {
2587            sclk: UartFunctionClockSclk,
2588            div_num: u32,
2589        }
2590        impl UartFunctionClockConfig {
2591            /// Creates a new configuration for the FUNCTION_CLOCK clock node.
2592            ///
2593            /// ## Panics
2594            ///
2595            /// Panics if the div_num value is outside the
2596            /// valid range (0 ..= 255).
2597            pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
2598                ::core::assert!(
2599                    div_num <= 255,
2600                    "`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2601                );
2602                Self { sclk, div_num }
2603            }
2604            pub(crate) fn sclk(self) -> UartFunctionClockSclk {
2605                self.sclk
2606            }
2607            pub(crate) fn div_num(self) -> u32 {
2608                self.div_num as u32
2609            }
2610        }
2611        /// Configures the `UART0_BAUD_RATE_GENERATOR` clock node.
2612        ///
2613        /// The output is calculated as `OUTPUT = (FUNCTION_CLOCK * 16) / (integral * 16 +
2614        /// fractional)`.
2615        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2616        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2617        pub struct UartBaudRateGeneratorConfig {
2618            fractional: u32,
2619            integral: u32,
2620        }
2621        impl UartBaudRateGeneratorConfig {
2622            /// Creates a new configuration for the BAUD_RATE_GENERATOR clock node.
2623            ///
2624            /// ## Panics
2625            ///
2626            /// Panics if the fractional value is outside the
2627            /// valid range (0 ..= 15).
2628            ///
2629            /// Panics if the integral value is outside the
2630            /// valid range (0 ..= 4095).
2631            pub const fn new(fractional: u32, integral: u32) -> Self {
2632                ::core::assert!(
2633                    fractional <= 15,
2634                    "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
2635                );
2636                ::core::assert!(
2637                    integral <= 4095,
2638                    "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
2639                );
2640                Self {
2641                    fractional,
2642                    integral,
2643                }
2644            }
2645            pub(crate) fn fractional(self) -> u32 {
2646                self.fractional as u32
2647            }
2648            pub(crate) fn integral(self) -> u32 {
2649                self.integral as u32
2650            }
2651        }
2652        /// The list of clock signals that the `PSRAM_FUNCTION_CLOCK` multiplexer can output.
2653        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2654        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2655        pub enum PsramFunctionClockConfig {
2656            #[default]
2657            /// Selects `XTAL_CLK`.
2658            Xtal,
2659            /// Selects `MPLL_CLK`.
2660            Mpll,
2661            /// Selects `CPLL_CLK`.
2662            Cpll,
2663        }
2664        /// Represents the device's clock tree.
2665        pub struct ClockTree {
2666            cpu_root_clk: Option<CpuRootClkConfig>,
2667            cpu_clk: Option<CpuClkConfig>,
2668            mem_clk: Option<MemClkConfig>,
2669            sys_clk: Option<SysClkConfig>,
2670            apb_clk: Option<ApbClkConfig>,
2671            lp_fast_clk: Option<LpFastClkConfig>,
2672            lp_slow_clk: Option<LpSlowClkConfig>,
2673            crypto_clk: Option<CryptoClkConfig>,
2674            iomux_function_clock: Option<IomuxFunctionClockConfig>,
2675            timg_calibration_clock: Option<TimgCalibrationClockConfig>,
2676            i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
2677            i2s_tx_clk: [Option<I2sClkConfig>; 2],
2678            i2s_rx_clk: [Option<I2sClkConfig>; 2],
2679            i2s_mclk_out: [Option<I2sMclkOutConfig>; 2],
2680            lcd_cam_lcd_clock: [Option<LcdCamLcdClockConfig>; 1],
2681            lcd_cam_cam_clock: [Option<LcdCamCamClockConfig>; 1],
2682            rmt_sclk: [Option<RmtSclkConfig>; 1],
2683            spi_function_clock: [Option<SpiFunctionClockConfig>; 2],
2684            timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
2685            timg_wdt_clock: [Option<TimgWdtClockConfig>; 2],
2686            uart_function_clock: [Option<UartFunctionClockConfig>; 4],
2687            uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 4],
2688            psram_function_clock: [Option<PsramFunctionClockConfig>; 1],
2689            bbpll_clk_refcount: u32,
2690            cpll_clk_refcount: u32,
2691            mpll_clk_refcount: u32,
2692            rc_fast_clk_refcount: u32,
2693            #[cfg(use_xtal32k)]
2694            xtal32k_clk_refcount: u32,
2695            rc_slow_clk_refcount: u32,
2696            pll_f20m_refcount: u32,
2697            pll_f80m_refcount: u32,
2698            pll_f120m_refcount: u32,
2699            pll_f160m_refcount: u32,
2700            pll_f240m_refcount: u32,
2701            bbpll_d3_clock_refcount: u32,
2702            pll_f25m_refcount: u32,
2703            pll_f50m_refcount: u32,
2704            xtal_d2_clk_refcount: u32,
2705            cpu_clk_refcount: u32,
2706            mem_clk_refcount: u32,
2707            lp_fast_clk_refcount: u32,
2708            lp_slow_clk_refcount: u32,
2709            crypto_clk_refcount: u32,
2710            timg_calibration_clock_refcount: u32,
2711            sdm_function_clock_refcount: [u32; 1],
2712            i2c_function_clock_refcount: [u32; 2],
2713            i2s_tx_clk_refcount: [u32; 2],
2714            i2s_rx_clk_refcount: [u32; 2],
2715            i2s_mclk_out_refcount: [u32; 2],
2716            lcd_cam_lcd_clock_refcount: [u32; 1],
2717            lcd_cam_cam_clock_refcount: [u32; 1],
2718            rmt_sclk_refcount: [u32; 1],
2719            spi_function_clock_refcount: [u32; 2],
2720            timg_function_clock_refcount: [u32; 2],
2721            timg_wdt_clock_refcount: [u32; 2],
2722            uart_function_clock_refcount: [u32; 4],
2723            uart_baud_rate_generator_refcount: [u32; 4],
2724            uart_mem_clock_refcount: [u32; 4],
2725            psram_function_clock_refcount: [u32; 1],
2726        }
2727        impl ClockTree {
2728            /// Locks the clock tree for exclusive access.
2729            pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
2730                CLOCK_TREE.with(f)
2731            }
2732            /// Returns the current configuration of the CPU_ROOT_CLK clock tree node
2733            pub fn cpu_root_clk(&self) -> Option<CpuRootClkConfig> {
2734                self.cpu_root_clk
2735            }
2736            /// Returns the current configuration of the CPU_CLK clock tree node
2737            pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
2738                self.cpu_clk
2739            }
2740            /// Returns the current configuration of the MEM_CLK clock tree node
2741            pub fn mem_clk(&self) -> Option<MemClkConfig> {
2742                self.mem_clk
2743            }
2744            /// Returns the current configuration of the SYS_CLK clock tree node
2745            pub fn sys_clk(&self) -> Option<SysClkConfig> {
2746                self.sys_clk
2747            }
2748            /// Returns the current configuration of the APB_CLK clock tree node
2749            pub fn apb_clk(&self) -> Option<ApbClkConfig> {
2750                self.apb_clk
2751            }
2752            /// Returns the current configuration of the LP_FAST_CLK clock tree node
2753            pub fn lp_fast_clk(&self) -> Option<LpFastClkConfig> {
2754                self.lp_fast_clk
2755            }
2756            /// Returns the current configuration of the LP_SLOW_CLK clock tree node
2757            pub fn lp_slow_clk(&self) -> Option<LpSlowClkConfig> {
2758                self.lp_slow_clk
2759            }
2760            /// Returns the current configuration of the CRYPTO_CLK clock tree node
2761            pub fn crypto_clk(&self) -> Option<CryptoClkConfig> {
2762                self.crypto_clk
2763            }
2764            /// Returns the current configuration of the IOMUX_FUNCTION_CLOCK clock tree node
2765            pub fn iomux_function_clock(&self) -> Option<IomuxFunctionClockConfig> {
2766                self.iomux_function_clock
2767            }
2768            /// Returns the current configuration of the TIMG_CALIBRATION_CLOCK clock tree node
2769            pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
2770                self.timg_calibration_clock
2771            }
2772            /// Returns the current configuration of the I2C0_FUNCTION_CLOCK clock tree node
2773            pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2774                self.i2c_function_clock[I2cInstance::I2c0 as usize]
2775            }
2776            /// Returns the current configuration of the I2C1_FUNCTION_CLOCK clock tree node
2777            pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2778                self.i2c_function_clock[I2cInstance::I2c1 as usize]
2779            }
2780            /// Returns the current configuration of the I2S0_TX_CLK clock tree node
2781            pub fn i2s0_tx_clk(&self) -> Option<I2sClkConfig> {
2782                self.i2s_tx_clk[I2sInstance::I2s0 as usize]
2783            }
2784            /// Returns the current configuration of the I2S0_RX_CLK clock tree node
2785            pub fn i2s0_rx_clk(&self) -> Option<I2sClkConfig> {
2786                self.i2s_rx_clk[I2sInstance::I2s0 as usize]
2787            }
2788            /// Returns the current configuration of the I2S0_MCLK_OUT clock tree node
2789            pub fn i2s0_mclk_out(&self) -> Option<I2sMclkOutConfig> {
2790                self.i2s_mclk_out[I2sInstance::I2s0 as usize]
2791            }
2792            /// Returns the current configuration of the I2S1_TX_CLK clock tree node
2793            pub fn i2s1_tx_clk(&self) -> Option<I2sClkConfig> {
2794                self.i2s_tx_clk[I2sInstance::I2s1 as usize]
2795            }
2796            /// Returns the current configuration of the I2S1_RX_CLK clock tree node
2797            pub fn i2s1_rx_clk(&self) -> Option<I2sClkConfig> {
2798                self.i2s_rx_clk[I2sInstance::I2s1 as usize]
2799            }
2800            /// Returns the current configuration of the I2S1_MCLK_OUT clock tree node
2801            pub fn i2s1_mclk_out(&self) -> Option<I2sMclkOutConfig> {
2802                self.i2s_mclk_out[I2sInstance::I2s1 as usize]
2803            }
2804            /// Returns the current configuration of the LCD_CAM_LCD_CLOCK clock tree node
2805            pub fn lcd_cam_lcd_clock(&self) -> Option<LcdCamLcdClockConfig> {
2806                self.lcd_cam_lcd_clock[LcdCamInstance::LcdCam as usize]
2807            }
2808            /// Returns the current configuration of the LCD_CAM_CAM_CLOCK clock tree node
2809            pub fn lcd_cam_cam_clock(&self) -> Option<LcdCamCamClockConfig> {
2810                self.lcd_cam_cam_clock[LcdCamInstance::LcdCam as usize]
2811            }
2812            /// Returns the current configuration of the RMT_SCLK clock tree node
2813            pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
2814                self.rmt_sclk[RmtInstance::Rmt as usize]
2815            }
2816            /// Returns the current configuration of the SPI2_FUNCTION_CLOCK clock tree node
2817            pub fn spi2_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2818                self.spi_function_clock[SpiInstance::Spi2 as usize]
2819            }
2820            /// Returns the current configuration of the SPI3_FUNCTION_CLOCK clock tree node
2821            pub fn spi3_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2822                self.spi_function_clock[SpiInstance::Spi3 as usize]
2823            }
2824            /// Returns the current configuration of the TIMG0_FUNCTION_CLOCK clock tree node
2825            pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2826                self.timg_function_clock[TimgInstance::Timg0 as usize]
2827            }
2828            /// Returns the current configuration of the TIMG0_WDT_CLOCK clock tree node
2829            pub fn timg0_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
2830                self.timg_wdt_clock[TimgInstance::Timg0 as usize]
2831            }
2832            /// Returns the current configuration of the TIMG1_FUNCTION_CLOCK clock tree node
2833            pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2834                self.timg_function_clock[TimgInstance::Timg1 as usize]
2835            }
2836            /// Returns the current configuration of the TIMG1_WDT_CLOCK clock tree node
2837            pub fn timg1_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
2838                self.timg_wdt_clock[TimgInstance::Timg1 as usize]
2839            }
2840            /// Returns the current configuration of the UART0_FUNCTION_CLOCK clock tree node
2841            pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
2842                self.uart_function_clock[UartInstance::Uart0 as usize]
2843            }
2844            /// Returns the current configuration of the UART0_BAUD_RATE_GENERATOR clock tree node
2845            pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2846                self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
2847            }
2848            /// Returns the current configuration of the UART1_FUNCTION_CLOCK clock tree node
2849            pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
2850                self.uart_function_clock[UartInstance::Uart1 as usize]
2851            }
2852            /// Returns the current configuration of the UART1_BAUD_RATE_GENERATOR clock tree node
2853            pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2854                self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
2855            }
2856            /// Returns the current configuration of the UART2_FUNCTION_CLOCK clock tree node
2857            pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
2858                self.uart_function_clock[UartInstance::Uart2 as usize]
2859            }
2860            /// Returns the current configuration of the UART2_BAUD_RATE_GENERATOR clock tree node
2861            pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2862                self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
2863            }
2864            /// Returns the current configuration of the UART3_FUNCTION_CLOCK clock tree node
2865            pub fn uart3_function_clock(&self) -> Option<UartFunctionClockConfig> {
2866                self.uart_function_clock[UartInstance::Uart3 as usize]
2867            }
2868            /// Returns the current configuration of the UART3_BAUD_RATE_GENERATOR clock tree node
2869            pub fn uart3_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2870                self.uart_baud_rate_generator[UartInstance::Uart3 as usize]
2871            }
2872            /// Returns the current configuration of the PSRAM_FUNCTION_CLOCK clock tree node
2873            pub fn psram_function_clock(&self) -> Option<PsramFunctionClockConfig> {
2874                self.psram_function_clock[PsramInstance::Psram as usize]
2875            }
2876        }
2877        static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
2878            ::esp_sync::NonReentrantMutex::new(ClockTree {
2879                cpu_root_clk: None,
2880                cpu_clk: None,
2881                mem_clk: None,
2882                sys_clk: None,
2883                apb_clk: None,
2884                lp_fast_clk: None,
2885                lp_slow_clk: None,
2886                crypto_clk: None,
2887                iomux_function_clock: None,
2888                timg_calibration_clock: None,
2889                i2c_function_clock: [None; 2],
2890                i2s_tx_clk: [None; 2],
2891                i2s_rx_clk: [None; 2],
2892                i2s_mclk_out: [None; 2],
2893                lcd_cam_lcd_clock: [None; 1],
2894                lcd_cam_cam_clock: [None; 1],
2895                rmt_sclk: [None; 1],
2896                spi_function_clock: [None; 2],
2897                timg_function_clock: [None; 2],
2898                timg_wdt_clock: [None; 2],
2899                uart_function_clock: [None; 4],
2900                uart_baud_rate_generator: [None; 4],
2901                psram_function_clock: [None; 1],
2902                bbpll_clk_refcount: 0,
2903                cpll_clk_refcount: 0,
2904                mpll_clk_refcount: 0,
2905                rc_fast_clk_refcount: 0,
2906                #[cfg(use_xtal32k)]
2907                xtal32k_clk_refcount: 0,
2908                rc_slow_clk_refcount: 0,
2909                pll_f20m_refcount: 0,
2910                pll_f80m_refcount: 0,
2911                pll_f120m_refcount: 0,
2912                pll_f160m_refcount: 0,
2913                pll_f240m_refcount: 0,
2914                bbpll_d3_clock_refcount: 0,
2915                pll_f25m_refcount: 0,
2916                pll_f50m_refcount: 0,
2917                xtal_d2_clk_refcount: 0,
2918                cpu_clk_refcount: 0,
2919                mem_clk_refcount: 0,
2920                lp_fast_clk_refcount: 0,
2921                lp_slow_clk_refcount: 0,
2922                crypto_clk_refcount: 0,
2923                timg_calibration_clock_refcount: 0,
2924                sdm_function_clock_refcount: [0; 1],
2925                i2c_function_clock_refcount: [0; 2],
2926                i2s_tx_clk_refcount: [0; 2],
2927                i2s_rx_clk_refcount: [0; 2],
2928                i2s_mclk_out_refcount: [0; 2],
2929                lcd_cam_lcd_clock_refcount: [0; 1],
2930                lcd_cam_cam_clock_refcount: [0; 1],
2931                rmt_sclk_refcount: [0; 1],
2932                spi_function_clock_refcount: [0; 2],
2933                timg_function_clock_refcount: [0; 2],
2934                timg_wdt_clock_refcount: [0; 2],
2935                uart_function_clock_refcount: [0; 4],
2936                uart_baud_rate_generator_refcount: [0; 4],
2937                uart_mem_clock_refcount: [0; 4],
2938                psram_function_clock_refcount: [0; 1],
2939            });
2940        static CPU_ROOT_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2941            ::core::sync::atomic::AtomicU32::new(0);
2942        static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2943            ::core::sync::atomic::AtomicU32::new(0);
2944        static MEM_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2945            ::core::sync::atomic::AtomicU32::new(0);
2946        static SYS_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2947            ::core::sync::atomic::AtomicU32::new(0);
2948        static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2949            ::core::sync::atomic::AtomicU32::new(0);
2950        static LP_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2951            ::core::sync::atomic::AtomicU32::new(0);
2952        static LP_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2953            ::core::sync::atomic::AtomicU32::new(0);
2954        static CRYPTO_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2955            ::core::sync::atomic::AtomicU32::new(0);
2956        static IOMUX_FUNCTION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2957            ::core::sync::atomic::AtomicU32::new(0);
2958        static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2959            ::core::sync::atomic::AtomicU32::new(0);
2960        static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2961            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2962        static I2S_TX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2963            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2964        static I2S_RX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2965            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2966        static I2S_MCLK_OUT_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2967            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2968        static LCD_CAM_LCD_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2969            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2970        static LCD_CAM_CAM_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2971            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2972        static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2973            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2974        static SPI_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2975            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2976        static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2977            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2978        static TIMG_WDT_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2979            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2980        static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 4] =
2981            [const { ::core::sync::atomic::AtomicU32::new(0) }; 4];
2982        static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 4] =
2983            [const { ::core::sync::atomic::AtomicU32::new(0) }; 4];
2984        static PSRAM_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2985            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2986        fn request_xtal_clk(_clocks: &mut ClockTree) {}
2987        fn release_xtal_clk(_clocks: &mut ClockTree) {}
2988        pub fn xtal_clk_frequency() -> u32 {
2989            40000000
2990        }
2991        pub fn request_bbpll_clk(clocks: &mut ClockTree) {
2992            trace!("Requesting BBPLL_CLK");
2993            if increment_reference_count(&mut clocks.bbpll_clk_refcount) {
2994                trace!("Enabling BBPLL_CLK");
2995                request_xtal_clk(clocks);
2996                enable_bbpll_clk_impl(clocks, true);
2997            }
2998        }
2999        pub fn release_bbpll_clk(clocks: &mut ClockTree) {
3000            trace!("Releasing BBPLL_CLK");
3001            if decrement_reference_count(&mut clocks.bbpll_clk_refcount) {
3002                trace!("Disabling BBPLL_CLK");
3003                enable_bbpll_clk_impl(clocks, false);
3004                release_xtal_clk(clocks);
3005            }
3006        }
3007        pub fn bbpll_clk_frequency() -> u32 {
3008            (480 * 1000000)
3009        }
3010        pub fn bbpll_clk_source_frequency() -> u32 {
3011            xtal_clk_frequency()
3012        }
3013        pub fn request_cpll_clk(clocks: &mut ClockTree) {
3014            trace!("Requesting CPLL_CLK");
3015            if increment_reference_count(&mut clocks.cpll_clk_refcount) {
3016                trace!("Enabling CPLL_CLK");
3017                request_xtal_clk(clocks);
3018                enable_cpll_clk_impl(clocks, true);
3019            }
3020        }
3021        pub fn release_cpll_clk(clocks: &mut ClockTree) {
3022            trace!("Releasing CPLL_CLK");
3023            if decrement_reference_count(&mut clocks.cpll_clk_refcount) {
3024                trace!("Disabling CPLL_CLK");
3025                enable_cpll_clk_impl(clocks, false);
3026                release_xtal_clk(clocks);
3027            }
3028        }
3029        pub fn cpll_clk_frequency() -> u32 {
3030            (320 * 1000000)
3031        }
3032        pub fn cpll_clk_source_frequency() -> u32 {
3033            xtal_clk_frequency()
3034        }
3035        pub fn request_mpll_clk(clocks: &mut ClockTree) {
3036            trace!("Requesting MPLL_CLK");
3037            if increment_reference_count(&mut clocks.mpll_clk_refcount) {
3038                trace!("Enabling MPLL_CLK");
3039                request_xtal_clk(clocks);
3040                enable_mpll_clk_impl(clocks, true);
3041            }
3042        }
3043        pub fn release_mpll_clk(clocks: &mut ClockTree) {
3044            trace!("Releasing MPLL_CLK");
3045            if decrement_reference_count(&mut clocks.mpll_clk_refcount) {
3046                trace!("Disabling MPLL_CLK");
3047                enable_mpll_clk_impl(clocks, false);
3048                release_xtal_clk(clocks);
3049            }
3050        }
3051        pub fn mpll_clk_frequency() -> u32 {
3052            (500 * 1000000)
3053        }
3054        pub fn mpll_clk_source_frequency() -> u32 {
3055            xtal_clk_frequency()
3056        }
3057        pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
3058            trace!("Requesting RC_FAST_CLK");
3059            if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
3060                trace!("Enabling RC_FAST_CLK");
3061                enable_rc_fast_clk_impl(clocks, true);
3062            }
3063        }
3064        pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
3065            trace!("Releasing RC_FAST_CLK");
3066            if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
3067                trace!("Disabling RC_FAST_CLK");
3068                enable_rc_fast_clk_impl(clocks, false);
3069            }
3070        }
3071        pub fn rc_fast_clk_frequency() -> u32 {
3072            17500000
3073        }
3074        #[cfg(use_xtal32k)]
3075        pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
3076            trace!("Requesting XTAL32K_CLK");
3077            if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
3078                trace!("Enabling XTAL32K_CLK");
3079                enable_xtal32k_clk_impl(clocks, true);
3080            }
3081        }
3082        #[cfg(use_xtal32k)]
3083        pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
3084            trace!("Releasing XTAL32K_CLK");
3085            if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
3086                trace!("Disabling XTAL32K_CLK");
3087                enable_xtal32k_clk_impl(clocks, false);
3088            }
3089        }
3090        #[cfg(use_xtal32k)]
3091        pub fn xtal32k_clk_frequency() -> u32 {
3092            32768
3093        }
3094        pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
3095            trace!("Requesting RC_SLOW_CLK");
3096            if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
3097                trace!("Enabling RC_SLOW_CLK");
3098                enable_rc_slow_clk_impl(clocks, true);
3099            }
3100        }
3101        pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
3102            trace!("Releasing RC_SLOW_CLK");
3103            if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
3104                trace!("Disabling RC_SLOW_CLK");
3105                enable_rc_slow_clk_impl(clocks, false);
3106            }
3107        }
3108        pub fn rc_slow_clk_frequency() -> u32 {
3109            136000
3110        }
3111        pub fn request_pll_f20m(clocks: &mut ClockTree) {
3112            trace!("Requesting PLL_F20M");
3113            if increment_reference_count(&mut clocks.pll_f20m_refcount) {
3114                trace!("Enabling PLL_F20M");
3115                request_bbpll_clk(clocks);
3116                enable_pll_f20m_impl(clocks, true);
3117            }
3118        }
3119        pub fn release_pll_f20m(clocks: &mut ClockTree) {
3120            trace!("Releasing PLL_F20M");
3121            if decrement_reference_count(&mut clocks.pll_f20m_refcount) {
3122                trace!("Disabling PLL_F20M");
3123                enable_pll_f20m_impl(clocks, false);
3124                release_bbpll_clk(clocks);
3125            }
3126        }
3127        pub fn pll_f20m_frequency() -> u32 {
3128            (bbpll_clk_frequency() / 24)
3129        }
3130        pub fn pll_f20m_source_frequency() -> u32 {
3131            bbpll_clk_frequency()
3132        }
3133        pub fn request_pll_f80m(clocks: &mut ClockTree) {
3134            trace!("Requesting PLL_F80M");
3135            if increment_reference_count(&mut clocks.pll_f80m_refcount) {
3136                trace!("Enabling PLL_F80M");
3137                request_bbpll_clk(clocks);
3138                enable_pll_f80m_impl(clocks, true);
3139            }
3140        }
3141        pub fn release_pll_f80m(clocks: &mut ClockTree) {
3142            trace!("Releasing PLL_F80M");
3143            if decrement_reference_count(&mut clocks.pll_f80m_refcount) {
3144                trace!("Disabling PLL_F80M");
3145                enable_pll_f80m_impl(clocks, false);
3146                release_bbpll_clk(clocks);
3147            }
3148        }
3149        pub fn pll_f80m_frequency() -> u32 {
3150            (bbpll_clk_frequency() / 6)
3151        }
3152        pub fn pll_f80m_source_frequency() -> u32 {
3153            bbpll_clk_frequency()
3154        }
3155        pub fn request_pll_f120m(clocks: &mut ClockTree) {
3156            trace!("Requesting PLL_F120M");
3157            if increment_reference_count(&mut clocks.pll_f120m_refcount) {
3158                trace!("Enabling PLL_F120M");
3159                request_bbpll_clk(clocks);
3160                enable_pll_f120m_impl(clocks, true);
3161            }
3162        }
3163        pub fn release_pll_f120m(clocks: &mut ClockTree) {
3164            trace!("Releasing PLL_F120M");
3165            if decrement_reference_count(&mut clocks.pll_f120m_refcount) {
3166                trace!("Disabling PLL_F120M");
3167                enable_pll_f120m_impl(clocks, false);
3168                release_bbpll_clk(clocks);
3169            }
3170        }
3171        pub fn pll_f120m_frequency() -> u32 {
3172            (bbpll_clk_frequency() / 4)
3173        }
3174        pub fn pll_f120m_source_frequency() -> u32 {
3175            bbpll_clk_frequency()
3176        }
3177        pub fn request_pll_f160m(clocks: &mut ClockTree) {
3178            trace!("Requesting PLL_F160M");
3179            if increment_reference_count(&mut clocks.pll_f160m_refcount) {
3180                trace!("Enabling PLL_F160M");
3181                request_bbpll_clk(clocks);
3182                enable_pll_f160m_impl(clocks, true);
3183            }
3184        }
3185        pub fn release_pll_f160m(clocks: &mut ClockTree) {
3186            trace!("Releasing PLL_F160M");
3187            if decrement_reference_count(&mut clocks.pll_f160m_refcount) {
3188                trace!("Disabling PLL_F160M");
3189                enable_pll_f160m_impl(clocks, false);
3190                release_bbpll_clk(clocks);
3191            }
3192        }
3193        pub fn pll_f160m_frequency() -> u32 {
3194            (bbpll_clk_frequency() / 3)
3195        }
3196        pub fn pll_f160m_source_frequency() -> u32 {
3197            bbpll_clk_frequency()
3198        }
3199        pub fn request_pll_f240m(clocks: &mut ClockTree) {
3200            trace!("Requesting PLL_F240M");
3201            if increment_reference_count(&mut clocks.pll_f240m_refcount) {
3202                trace!("Enabling PLL_F240M");
3203                request_bbpll_clk(clocks);
3204                enable_pll_f240m_impl(clocks, true);
3205            }
3206        }
3207        pub fn release_pll_f240m(clocks: &mut ClockTree) {
3208            trace!("Releasing PLL_F240M");
3209            if decrement_reference_count(&mut clocks.pll_f240m_refcount) {
3210                trace!("Disabling PLL_F240M");
3211                enable_pll_f240m_impl(clocks, false);
3212                release_bbpll_clk(clocks);
3213            }
3214        }
3215        pub fn pll_f240m_frequency() -> u32 {
3216            (bbpll_clk_frequency() / 2)
3217        }
3218        pub fn pll_f240m_source_frequency() -> u32 {
3219            bbpll_clk_frequency()
3220        }
3221        pub fn request_bbpll_d3_clock(clocks: &mut ClockTree) {
3222            trace!("Requesting BBPLL_D3_CLOCK");
3223            if increment_reference_count(&mut clocks.bbpll_d3_clock_refcount) {
3224                trace!("Enabling BBPLL_D3_CLOCK");
3225                request_bbpll_clk(clocks);
3226                enable_bbpll_d3_clock_impl(clocks, true);
3227            }
3228        }
3229        pub fn release_bbpll_d3_clock(clocks: &mut ClockTree) {
3230            trace!("Releasing BBPLL_D3_CLOCK");
3231            if decrement_reference_count(&mut clocks.bbpll_d3_clock_refcount) {
3232                trace!("Disabling BBPLL_D3_CLOCK");
3233                enable_bbpll_d3_clock_impl(clocks, false);
3234                release_bbpll_clk(clocks);
3235            }
3236        }
3237        pub fn bbpll_d3_clock_frequency() -> u32 {
3238            (bbpll_clk_frequency() / 3)
3239        }
3240        pub fn bbpll_d3_clock_source_frequency() -> u32 {
3241            bbpll_clk_frequency()
3242        }
3243        pub fn request_pll_f25m(clocks: &mut ClockTree) {
3244            trace!("Requesting PLL_F25M");
3245            if increment_reference_count(&mut clocks.pll_f25m_refcount) {
3246                trace!("Enabling PLL_F25M");
3247                request_mpll_clk(clocks);
3248                enable_pll_f25m_impl(clocks, true);
3249            }
3250        }
3251        pub fn release_pll_f25m(clocks: &mut ClockTree) {
3252            trace!("Releasing PLL_F25M");
3253            if decrement_reference_count(&mut clocks.pll_f25m_refcount) {
3254                trace!("Disabling PLL_F25M");
3255                enable_pll_f25m_impl(clocks, false);
3256                release_mpll_clk(clocks);
3257            }
3258        }
3259        pub fn pll_f25m_frequency() -> u32 {
3260            (mpll_clk_frequency() / 20)
3261        }
3262        pub fn pll_f25m_source_frequency() -> u32 {
3263            mpll_clk_frequency()
3264        }
3265        pub fn request_pll_f50m(clocks: &mut ClockTree) {
3266            trace!("Requesting PLL_F50M");
3267            if increment_reference_count(&mut clocks.pll_f50m_refcount) {
3268                trace!("Enabling PLL_F50M");
3269                request_mpll_clk(clocks);
3270                enable_pll_f50m_impl(clocks, true);
3271            }
3272        }
3273        pub fn release_pll_f50m(clocks: &mut ClockTree) {
3274            trace!("Releasing PLL_F50M");
3275            if decrement_reference_count(&mut clocks.pll_f50m_refcount) {
3276                trace!("Disabling PLL_F50M");
3277                enable_pll_f50m_impl(clocks, false);
3278                release_mpll_clk(clocks);
3279            }
3280        }
3281        pub fn pll_f50m_frequency() -> u32 {
3282            (mpll_clk_frequency() / 10)
3283        }
3284        pub fn pll_f50m_source_frequency() -> u32 {
3285            mpll_clk_frequency()
3286        }
3287        pub fn request_xtal_d2_clk(clocks: &mut ClockTree) {
3288            trace!("Requesting XTAL_D2_CLK");
3289            if increment_reference_count(&mut clocks.xtal_d2_clk_refcount) {
3290                trace!("Enabling XTAL_D2_CLK");
3291                request_xtal_clk(clocks);
3292                enable_xtal_d2_clk_impl(clocks, true);
3293            }
3294        }
3295        pub fn release_xtal_d2_clk(clocks: &mut ClockTree) {
3296            trace!("Releasing XTAL_D2_CLK");
3297            if decrement_reference_count(&mut clocks.xtal_d2_clk_refcount) {
3298                trace!("Disabling XTAL_D2_CLK");
3299                enable_xtal_d2_clk_impl(clocks, false);
3300                release_xtal_clk(clocks);
3301            }
3302        }
3303        pub fn xtal_d2_clk_frequency() -> u32 {
3304            (xtal_clk_frequency() / 2)
3305        }
3306        pub fn xtal_d2_clk_source_frequency() -> u32 {
3307            xtal_clk_frequency()
3308        }
3309        pub fn configure_cpu_root_clk(clocks: &mut ClockTree, new_selector: CpuRootClkConfig) {
3310            let old_selector = clocks.cpu_root_clk.replace(new_selector);
3311            refresh_cpu_root_clk_downstream(clocks);
3312            match new_selector {
3313                CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
3314                CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
3315                CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
3316                CpuRootClkConfig::PllF240m => request_pll_f240m(clocks),
3317            }
3318            configure_cpu_root_clk_impl(clocks, old_selector, new_selector);
3319            if let Some(old_selector) = old_selector {
3320                match old_selector {
3321                    CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
3322                    CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
3323                    CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
3324                    CpuRootClkConfig::PllF240m => release_pll_f240m(clocks),
3325                }
3326            }
3327        }
3328        pub fn cpu_root_clk_config(clocks: &mut ClockTree) -> Option<CpuRootClkConfig> {
3329            clocks.cpu_root_clk
3330        }
3331        pub fn request_cpu_root_clk(clocks: &mut ClockTree) {
3332            trace!("Requesting CPU_ROOT_CLK");
3333            trace!("Enabling CPU_ROOT_CLK");
3334            match unwrap!(clocks.cpu_root_clk) {
3335                CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
3336                CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
3337                CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
3338                CpuRootClkConfig::PllF240m => request_pll_f240m(clocks),
3339            }
3340            enable_cpu_root_clk_impl(clocks, true);
3341        }
3342        pub fn release_cpu_root_clk(clocks: &mut ClockTree) {
3343            trace!("Releasing CPU_ROOT_CLK");
3344            trace!("Disabling CPU_ROOT_CLK");
3345            enable_cpu_root_clk_impl(clocks, false);
3346            match unwrap!(clocks.cpu_root_clk) {
3347                CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
3348                CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
3349                CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
3350                CpuRootClkConfig::PllF240m => release_pll_f240m(clocks),
3351            }
3352        }
3353        #[allow(unused_variables)]
3354        pub fn cpu_root_clk_config_frequency(
3355            clocks: &mut ClockTree,
3356            config: CpuRootClkConfig,
3357        ) -> u32 {
3358            match config {
3359                CpuRootClkConfig::Xtal => xtal_clk_frequency(),
3360                CpuRootClkConfig::Cpll => cpll_clk_frequency(),
3361                CpuRootClkConfig::RcFast => rc_fast_clk_frequency(),
3362                CpuRootClkConfig::PllF240m => pll_f240m_frequency(),
3363            }
3364        }
3365        pub fn cpu_root_clk_frequency() -> u32 {
3366            CPU_ROOT_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3367        }
3368        pub fn cpu_root_clk_source_frequency(source: CpuRootClkConfig) -> u32 {
3369            match source {
3370                CpuRootClkConfig::Xtal => xtal_clk_frequency(),
3371                CpuRootClkConfig::Cpll => cpll_clk_frequency(),
3372                CpuRootClkConfig::RcFast => rc_fast_clk_frequency(),
3373                CpuRootClkConfig::PllF240m => pll_f240m_frequency(),
3374            }
3375        }
3376        pub fn configure_cpu_clk(clocks: &mut ClockTree, config: CpuClkConfig) {
3377            let old_config = clocks.cpu_clk.replace(config);
3378            refresh_cpu_clk_downstream(clocks);
3379            configure_cpu_clk_impl(clocks, old_config, config);
3380        }
3381        pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
3382            clocks.cpu_clk
3383        }
3384        pub fn request_cpu_clk(clocks: &mut ClockTree) {
3385            trace!("Requesting CPU_CLK");
3386            if increment_reference_count(&mut clocks.cpu_clk_refcount) {
3387                trace!("Enabling CPU_CLK");
3388                request_cpu_root_clk(clocks);
3389                enable_cpu_clk_impl(clocks, true);
3390            }
3391        }
3392        pub fn release_cpu_clk(clocks: &mut ClockTree) {
3393            trace!("Releasing CPU_CLK");
3394            if decrement_reference_count(&mut clocks.cpu_clk_refcount) {
3395                trace!("Disabling CPU_CLK");
3396                enable_cpu_clk_impl(clocks, false);
3397                release_cpu_root_clk(clocks);
3398            }
3399        }
3400        #[allow(unused_variables)]
3401        pub fn cpu_clk_config_frequency(clocks: &mut ClockTree, config: CpuClkConfig) -> u32 {
3402            (cpu_root_clk_frequency() / (config.divisor() + 1))
3403        }
3404        pub fn cpu_clk_frequency() -> u32 {
3405            CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3406        }
3407        pub fn cpu_clk_source_frequency() -> u32 {
3408            cpu_root_clk_frequency()
3409        }
3410        pub fn configure_mem_clk(clocks: &mut ClockTree, config: MemClkConfig) {
3411            let old_config = clocks.mem_clk.replace(config);
3412            refresh_mem_clk_downstream(clocks);
3413            configure_mem_clk_impl(clocks, old_config, config);
3414        }
3415        pub fn mem_clk_config(clocks: &mut ClockTree) -> Option<MemClkConfig> {
3416            clocks.mem_clk
3417        }
3418        pub fn request_mem_clk(clocks: &mut ClockTree) {
3419            trace!("Requesting MEM_CLK");
3420            if increment_reference_count(&mut clocks.mem_clk_refcount) {
3421                trace!("Enabling MEM_CLK");
3422                request_cpu_clk(clocks);
3423                enable_mem_clk_impl(clocks, true);
3424            }
3425        }
3426        pub fn release_mem_clk(clocks: &mut ClockTree) {
3427            trace!("Releasing MEM_CLK");
3428            if decrement_reference_count(&mut clocks.mem_clk_refcount) {
3429                trace!("Disabling MEM_CLK");
3430                enable_mem_clk_impl(clocks, false);
3431                release_cpu_clk(clocks);
3432            }
3433        }
3434        #[allow(unused_variables)]
3435        pub fn mem_clk_config_frequency(clocks: &mut ClockTree, config: MemClkConfig) -> u32 {
3436            (cpu_clk_frequency() / (config.divisor() + 1))
3437        }
3438        pub fn mem_clk_frequency() -> u32 {
3439            MEM_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3440        }
3441        pub fn mem_clk_source_frequency() -> u32 {
3442            cpu_clk_frequency()
3443        }
3444        pub fn configure_sys_clk(clocks: &mut ClockTree, config: SysClkConfig) {
3445            let old_config = clocks.sys_clk.replace(config);
3446            refresh_sys_clk_downstream(clocks);
3447            configure_sys_clk_impl(clocks, old_config, config);
3448        }
3449        pub fn sys_clk_config(clocks: &mut ClockTree) -> Option<SysClkConfig> {
3450            clocks.sys_clk
3451        }
3452        pub fn request_sys_clk(clocks: &mut ClockTree) {
3453            trace!("Requesting SYS_CLK");
3454            trace!("Enabling SYS_CLK");
3455            request_cpu_clk(clocks);
3456            enable_sys_clk_impl(clocks, true);
3457        }
3458        pub fn release_sys_clk(clocks: &mut ClockTree) {
3459            trace!("Releasing SYS_CLK");
3460            trace!("Disabling SYS_CLK");
3461            enable_sys_clk_impl(clocks, false);
3462            release_cpu_clk(clocks);
3463        }
3464        #[allow(unused_variables)]
3465        pub fn sys_clk_config_frequency(clocks: &mut ClockTree, config: SysClkConfig) -> u32 {
3466            (cpu_clk_frequency() / (config.divisor() + 1))
3467        }
3468        pub fn sys_clk_frequency() -> u32 {
3469            SYS_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3470        }
3471        pub fn sys_clk_source_frequency() -> u32 {
3472            cpu_clk_frequency()
3473        }
3474        pub fn configure_apb_clk(clocks: &mut ClockTree, config: ApbClkConfig) {
3475            let old_config = clocks.apb_clk.replace(config);
3476            refresh_apb_clk_downstream(clocks);
3477            configure_apb_clk_impl(clocks, old_config, config);
3478        }
3479        pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
3480            clocks.apb_clk
3481        }
3482        fn request_apb_clk(_clocks: &mut ClockTree) {}
3483        fn release_apb_clk(_clocks: &mut ClockTree) {}
3484        #[allow(unused_variables)]
3485        pub fn apb_clk_config_frequency(clocks: &mut ClockTree, config: ApbClkConfig) -> u32 {
3486            (sys_clk_frequency() / (config.divisor() + 1))
3487        }
3488        pub fn apb_clk_frequency() -> u32 {
3489            APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3490        }
3491        pub fn apb_clk_source_frequency() -> u32 {
3492            sys_clk_frequency()
3493        }
3494        pub fn configure_lp_fast_clk(clocks: &mut ClockTree, new_selector: LpFastClkConfig) {
3495            let old_selector = clocks.lp_fast_clk.replace(new_selector);
3496            refresh_lp_fast_clk_downstream(clocks);
3497            if clocks.lp_fast_clk_refcount > 0 {
3498                match new_selector {
3499                    LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
3500                    LpFastClkConfig::Xtal => request_xtal_clk(clocks),
3501                }
3502                configure_lp_fast_clk_impl(clocks, old_selector, new_selector);
3503                if let Some(old_selector) = old_selector {
3504                    match old_selector {
3505                        LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
3506                        LpFastClkConfig::Xtal => release_xtal_clk(clocks),
3507                    }
3508                }
3509            } else {
3510                configure_lp_fast_clk_impl(clocks, old_selector, new_selector);
3511            }
3512        }
3513        pub fn lp_fast_clk_config(clocks: &mut ClockTree) -> Option<LpFastClkConfig> {
3514            clocks.lp_fast_clk
3515        }
3516        pub fn request_lp_fast_clk(clocks: &mut ClockTree) {
3517            trace!("Requesting LP_FAST_CLK");
3518            if increment_reference_count(&mut clocks.lp_fast_clk_refcount) {
3519                trace!("Enabling LP_FAST_CLK");
3520                match unwrap!(clocks.lp_fast_clk) {
3521                    LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
3522                    LpFastClkConfig::Xtal => request_xtal_clk(clocks),
3523                }
3524                enable_lp_fast_clk_impl(clocks, true);
3525            }
3526        }
3527        pub fn release_lp_fast_clk(clocks: &mut ClockTree) {
3528            trace!("Releasing LP_FAST_CLK");
3529            if decrement_reference_count(&mut clocks.lp_fast_clk_refcount) {
3530                trace!("Disabling LP_FAST_CLK");
3531                enable_lp_fast_clk_impl(clocks, false);
3532                match unwrap!(clocks.lp_fast_clk) {
3533                    LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
3534                    LpFastClkConfig::Xtal => release_xtal_clk(clocks),
3535                }
3536            }
3537        }
3538        #[allow(unused_variables)]
3539        pub fn lp_fast_clk_config_frequency(
3540            clocks: &mut ClockTree,
3541            config: LpFastClkConfig,
3542        ) -> u32 {
3543            match config {
3544                LpFastClkConfig::RcFast => rc_fast_clk_frequency(),
3545                LpFastClkConfig::Xtal => xtal_clk_frequency(),
3546            }
3547        }
3548        pub fn lp_fast_clk_frequency() -> u32 {
3549            LP_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3550        }
3551        pub fn lp_fast_clk_source_frequency(source: LpFastClkConfig) -> u32 {
3552            match source {
3553                LpFastClkConfig::RcFast => rc_fast_clk_frequency(),
3554                LpFastClkConfig::Xtal => xtal_clk_frequency(),
3555            }
3556        }
3557        pub fn configure_lp_slow_clk(clocks: &mut ClockTree, new_selector: LpSlowClkConfig) {
3558            let old_selector = clocks.lp_slow_clk.replace(new_selector);
3559            refresh_lp_slow_clk_downstream(clocks);
3560            if clocks.lp_slow_clk_refcount > 0 {
3561                match new_selector {
3562                    LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3563                    #[cfg(use_xtal32k)]
3564                    LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3565                }
3566                configure_lp_slow_clk_impl(clocks, old_selector, new_selector);
3567                if let Some(old_selector) = old_selector {
3568                    match old_selector {
3569                        LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3570                        #[cfg(use_xtal32k)]
3571                        LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3572                    }
3573                }
3574            } else {
3575                configure_lp_slow_clk_impl(clocks, old_selector, new_selector);
3576            }
3577        }
3578        pub fn lp_slow_clk_config(clocks: &mut ClockTree) -> Option<LpSlowClkConfig> {
3579            clocks.lp_slow_clk
3580        }
3581        pub fn request_lp_slow_clk(clocks: &mut ClockTree) {
3582            trace!("Requesting LP_SLOW_CLK");
3583            if increment_reference_count(&mut clocks.lp_slow_clk_refcount) {
3584                trace!("Enabling LP_SLOW_CLK");
3585                match unwrap!(clocks.lp_slow_clk) {
3586                    LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3587                    #[cfg(use_xtal32k)]
3588                    LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3589                }
3590                enable_lp_slow_clk_impl(clocks, true);
3591            }
3592        }
3593        pub fn release_lp_slow_clk(clocks: &mut ClockTree) {
3594            trace!("Releasing LP_SLOW_CLK");
3595            if decrement_reference_count(&mut clocks.lp_slow_clk_refcount) {
3596                trace!("Disabling LP_SLOW_CLK");
3597                enable_lp_slow_clk_impl(clocks, false);
3598                match unwrap!(clocks.lp_slow_clk) {
3599                    LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3600                    #[cfg(use_xtal32k)]
3601                    LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3602                }
3603            }
3604        }
3605        #[allow(unused_variables)]
3606        pub fn lp_slow_clk_config_frequency(
3607            clocks: &mut ClockTree,
3608            config: LpSlowClkConfig,
3609        ) -> u32 {
3610            match config {
3611                LpSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3612                #[cfg(use_xtal32k)]
3613                LpSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3614            }
3615        }
3616        pub fn lp_slow_clk_frequency() -> u32 {
3617            LP_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3618        }
3619        pub fn lp_slow_clk_source_frequency(source: LpSlowClkConfig) -> u32 {
3620            match source {
3621                LpSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3622                #[cfg(use_xtal32k)]
3623                LpSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3624            }
3625        }
3626        pub fn configure_crypto_clk(clocks: &mut ClockTree, new_selector: CryptoClkConfig) {
3627            let old_selector = clocks.crypto_clk.replace(new_selector);
3628            refresh_crypto_clk_downstream(clocks);
3629            if clocks.crypto_clk_refcount > 0 {
3630                match new_selector {
3631                    CryptoClkConfig::Xtal => request_xtal_clk(clocks),
3632                    CryptoClkConfig::RcFast => request_rc_fast_clk(clocks),
3633                    CryptoClkConfig::PllF240m => request_pll_f240m(clocks),
3634                }
3635                configure_crypto_clk_impl(clocks, old_selector, new_selector);
3636                if let Some(old_selector) = old_selector {
3637                    match old_selector {
3638                        CryptoClkConfig::Xtal => release_xtal_clk(clocks),
3639                        CryptoClkConfig::RcFast => release_rc_fast_clk(clocks),
3640                        CryptoClkConfig::PllF240m => release_pll_f240m(clocks),
3641                    }
3642                }
3643            } else {
3644                configure_crypto_clk_impl(clocks, old_selector, new_selector);
3645            }
3646        }
3647        pub fn crypto_clk_config(clocks: &mut ClockTree) -> Option<CryptoClkConfig> {
3648            clocks.crypto_clk
3649        }
3650        pub fn request_crypto_clk(clocks: &mut ClockTree) {
3651            trace!("Requesting CRYPTO_CLK");
3652            if increment_reference_count(&mut clocks.crypto_clk_refcount) {
3653                trace!("Enabling CRYPTO_CLK");
3654                match unwrap!(clocks.crypto_clk) {
3655                    CryptoClkConfig::Xtal => request_xtal_clk(clocks),
3656                    CryptoClkConfig::RcFast => request_rc_fast_clk(clocks),
3657                    CryptoClkConfig::PllF240m => request_pll_f240m(clocks),
3658                }
3659                enable_crypto_clk_impl(clocks, true);
3660            }
3661        }
3662        pub fn release_crypto_clk(clocks: &mut ClockTree) {
3663            trace!("Releasing CRYPTO_CLK");
3664            if decrement_reference_count(&mut clocks.crypto_clk_refcount) {
3665                trace!("Disabling CRYPTO_CLK");
3666                enable_crypto_clk_impl(clocks, false);
3667                match unwrap!(clocks.crypto_clk) {
3668                    CryptoClkConfig::Xtal => release_xtal_clk(clocks),
3669                    CryptoClkConfig::RcFast => release_rc_fast_clk(clocks),
3670                    CryptoClkConfig::PllF240m => release_pll_f240m(clocks),
3671                }
3672            }
3673        }
3674        #[allow(unused_variables)]
3675        pub fn crypto_clk_config_frequency(clocks: &mut ClockTree, config: CryptoClkConfig) -> u32 {
3676            match config {
3677                CryptoClkConfig::Xtal => xtal_clk_frequency(),
3678                CryptoClkConfig::RcFast => rc_fast_clk_frequency(),
3679                CryptoClkConfig::PllF240m => pll_f240m_frequency(),
3680            }
3681        }
3682        pub fn crypto_clk_frequency() -> u32 {
3683            CRYPTO_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3684        }
3685        pub fn crypto_clk_source_frequency(source: CryptoClkConfig) -> u32 {
3686            match source {
3687                CryptoClkConfig::Xtal => xtal_clk_frequency(),
3688                CryptoClkConfig::RcFast => rc_fast_clk_frequency(),
3689                CryptoClkConfig::PllF240m => pll_f240m_frequency(),
3690            }
3691        }
3692        pub fn configure_iomux_function_clock(
3693            clocks: &mut ClockTree,
3694            config: IomuxFunctionClockConfig,
3695        ) {
3696            let old_config = clocks.iomux_function_clock.replace(config);
3697            refresh_iomux_function_clock_downstream(clocks);
3698            match config.source {
3699                IomuxFunctionClockSource::XtalClk => request_xtal_clk(clocks),
3700                IomuxFunctionClockSource::PllF80m => request_pll_f80m(clocks),
3701            }
3702            configure_iomux_function_clock_impl(clocks, old_config, config);
3703            if let Some(old_config) = old_config {
3704                match old_config.source {
3705                    IomuxFunctionClockSource::XtalClk => release_xtal_clk(clocks),
3706                    IomuxFunctionClockSource::PllF80m => release_pll_f80m(clocks),
3707                }
3708            }
3709        }
3710        pub fn iomux_function_clock_config(
3711            clocks: &mut ClockTree,
3712        ) -> Option<IomuxFunctionClockConfig> {
3713            clocks.iomux_function_clock
3714        }
3715        fn request_iomux_function_clock(_clocks: &mut ClockTree) {}
3716        fn release_iomux_function_clock(_clocks: &mut ClockTree) {}
3717        #[allow(unused_variables)]
3718        pub fn iomux_function_clock_config_frequency(
3719            clocks: &mut ClockTree,
3720            config: IomuxFunctionClockConfig,
3721        ) -> u32 {
3722            (match config.source {
3723                IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
3724                IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
3725            } / (config.div_num() + 1))
3726        }
3727        pub fn iomux_function_clock_frequency() -> u32 {
3728            IOMUX_FUNCTION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3729        }
3730        pub fn iomux_function_clock_source_frequency(source: IomuxFunctionClockSource) -> u32 {
3731            match source {
3732                IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
3733                IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
3734            }
3735        }
3736        pub fn configure_timg_calibration_clock(
3737            clocks: &mut ClockTree,
3738            new_selector: TimgCalibrationClockConfig,
3739        ) {
3740            let old_selector = clocks.timg_calibration_clock.replace(new_selector);
3741            refresh_timg_calibration_clock_downstream(clocks);
3742            if clocks.timg_calibration_clock_refcount > 0 {
3743                match new_selector {
3744                    TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3745                    TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
3746                    #[cfg(use_xtal32k)]
3747                    TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3748                }
3749                configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3750                if let Some(old_selector) = old_selector {
3751                    match old_selector {
3752                        TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3753                        TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
3754                        #[cfg(use_xtal32k)]
3755                        TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3756                    }
3757                }
3758            } else {
3759                configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3760            }
3761        }
3762        pub fn timg_calibration_clock_config(
3763            clocks: &mut ClockTree,
3764        ) -> Option<TimgCalibrationClockConfig> {
3765            clocks.timg_calibration_clock
3766        }
3767        pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
3768            trace!("Requesting TIMG_CALIBRATION_CLOCK");
3769            if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3770                trace!("Enabling TIMG_CALIBRATION_CLOCK");
3771                crate::rtc_cntl::WakeLock::acquire();
3772                match unwrap!(clocks.timg_calibration_clock) {
3773                    TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3774                    TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
3775                    #[cfg(use_xtal32k)]
3776                    TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3777                }
3778                enable_timg_calibration_clock_impl(clocks, true);
3779            }
3780        }
3781        pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
3782            trace!("Releasing TIMG_CALIBRATION_CLOCK");
3783            if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3784                trace!("Disabling TIMG_CALIBRATION_CLOCK");
3785                crate::rtc_cntl::WakeLock::release();
3786                enable_timg_calibration_clock_impl(clocks, false);
3787                match unwrap!(clocks.timg_calibration_clock) {
3788                    TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3789                    TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
3790                    #[cfg(use_xtal32k)]
3791                    TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3792                }
3793            }
3794        }
3795        #[allow(unused_variables)]
3796        pub fn timg_calibration_clock_config_frequency(
3797            clocks: &mut ClockTree,
3798            config: TimgCalibrationClockConfig,
3799        ) -> u32 {
3800            match config {
3801                TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
3802                TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_frequency(),
3803                #[cfg(use_xtal32k)]
3804                TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3805            }
3806        }
3807        pub fn timg_calibration_clock_frequency() -> u32 {
3808            TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3809        }
3810        pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
3811            match source {
3812                TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
3813                TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_frequency(),
3814                #[cfg(use_xtal32k)]
3815                TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3816            }
3817        }
3818        impl SdmInstance {
3819            pub fn request_function_clock(self, clocks: &mut ClockTree) {
3820                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3821                if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3822                {
3823                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3824                    request_iomux_function_clock(clocks);
3825                    self.enable_function_clock_impl(clocks, true);
3826                }
3827            }
3828            pub fn release_function_clock(self, clocks: &mut ClockTree) {
3829                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3830                if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3831                {
3832                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3833                    self.enable_function_clock_impl(clocks, false);
3834                    release_iomux_function_clock(clocks);
3835                }
3836            }
3837            pub fn function_clock_frequency(self) -> u32 {
3838                iomux_function_clock_frequency()
3839            }
3840            pub fn function_clock_source_frequency() -> u32 {
3841                iomux_function_clock_frequency()
3842            }
3843        }
3844        impl I2cInstance {
3845            pub fn configure_function_clock(
3846                self,
3847                clocks: &mut ClockTree,
3848                config: I2cFunctionClockConfig,
3849            ) {
3850                let old_config = clocks.i2c_function_clock[self as usize].replace(config);
3851                refresh_i2c_function_clock_downstream(clocks, self);
3852                if clocks.i2c_function_clock_refcount[self as usize] > 0 {
3853                    match config.sclk {
3854                        I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3855                        I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3856                    }
3857                    self.configure_function_clock_impl(clocks, old_config, config);
3858                    if let Some(old_config) = old_config {
3859                        match old_config.sclk {
3860                            I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3861                            I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3862                        }
3863                    }
3864                } else {
3865                    self.configure_function_clock_impl(clocks, old_config, config);
3866                }
3867            }
3868            pub fn function_clock_config(
3869                self,
3870                clocks: &mut ClockTree,
3871            ) -> Option<I2cFunctionClockConfig> {
3872                clocks.i2c_function_clock[self as usize]
3873            }
3874            pub fn request_function_clock(self, clocks: &mut ClockTree) {
3875                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3876                if increment_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3877                {
3878                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3879                    match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3880                        I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3881                        I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3882                    }
3883                    self.enable_function_clock_impl(clocks, true);
3884                }
3885            }
3886            pub fn release_function_clock(self, clocks: &mut ClockTree) {
3887                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3888                if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3889                {
3890                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3891                    self.enable_function_clock_impl(clocks, false);
3892                    match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3893                        I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3894                        I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3895                    }
3896                }
3897            }
3898            #[allow(unused_variables)]
3899            pub fn function_clock_config_frequency(
3900                clocks: &mut ClockTree,
3901                config: I2cFunctionClockConfig,
3902            ) -> u32 {
3903                (match config.sclk {
3904                    I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3905                    I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3906                } / (config.div_num() + 1))
3907            }
3908            pub fn function_clock_frequency(self) -> u32 {
3909                I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3910                    .load(::core::sync::atomic::Ordering::Acquire)
3911            }
3912            pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
3913                match sclk {
3914                    I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3915                    I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3916                }
3917            }
3918        }
3919        impl I2sInstance {
3920            pub fn configure_tx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
3921                let old_config = clocks.i2s_tx_clk[self as usize].replace(config);
3922                refresh_i2s_tx_clk_downstream(clocks, self);
3923                self.configure_tx_clk_impl(clocks, old_config, config);
3924            }
3925            pub fn tx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
3926                clocks.i2s_tx_clk[self as usize]
3927            }
3928            pub fn request_tx_clk(self, clocks: &mut ClockTree) {
3929                trace!("Requesting {:?}::TX_CLK", self);
3930                if increment_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
3931                    trace!("Enabling {:?}::TX_CLK", self);
3932                    crate::rtc_cntl::WakeLock::acquire();
3933                    match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
3934                        I2sClkSclk::Xtal => request_xtal_clk(clocks),
3935                    }
3936                    self.enable_tx_clk_impl(clocks, true);
3937                }
3938            }
3939            pub fn release_tx_clk(self, clocks: &mut ClockTree) {
3940                trace!("Releasing {:?}::TX_CLK", self);
3941                if decrement_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
3942                    trace!("Disabling {:?}::TX_CLK", self);
3943                    crate::rtc_cntl::WakeLock::release();
3944                    self.enable_tx_clk_impl(clocks, false);
3945                    match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
3946                        I2sClkSclk::Xtal => release_xtal_clk(clocks),
3947                    }
3948                }
3949            }
3950            #[allow(unused_variables)]
3951            pub fn tx_clk_config_frequency(clocks: &mut ClockTree, config: I2sClkConfig) -> u32 {
3952                (((xtal_clk_frequency() as u64) * (config.div_a() as u64))
3953                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3954                    as u32
3955            }
3956            pub fn tx_clk_frequency(self) -> u32 {
3957                I2S_TX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3958            }
3959            pub fn tx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
3960                match sclk {
3961                    I2sClkSclk::Xtal => xtal_clk_frequency(),
3962                }
3963            }
3964            pub fn configure_rx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
3965                let old_config = clocks.i2s_rx_clk[self as usize].replace(config);
3966                refresh_i2s_rx_clk_downstream(clocks, self);
3967                self.configure_rx_clk_impl(clocks, old_config, config);
3968            }
3969            pub fn rx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
3970                clocks.i2s_rx_clk[self as usize]
3971            }
3972            pub fn request_rx_clk(self, clocks: &mut ClockTree) {
3973                trace!("Requesting {:?}::RX_CLK", self);
3974                if increment_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
3975                    trace!("Enabling {:?}::RX_CLK", self);
3976                    crate::rtc_cntl::WakeLock::acquire();
3977                    match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
3978                        I2sClkSclk::Xtal => request_xtal_clk(clocks),
3979                    }
3980                    self.enable_rx_clk_impl(clocks, true);
3981                }
3982            }
3983            pub fn release_rx_clk(self, clocks: &mut ClockTree) {
3984                trace!("Releasing {:?}::RX_CLK", self);
3985                if decrement_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
3986                    trace!("Disabling {:?}::RX_CLK", self);
3987                    crate::rtc_cntl::WakeLock::release();
3988                    self.enable_rx_clk_impl(clocks, false);
3989                    match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
3990                        I2sClkSclk::Xtal => release_xtal_clk(clocks),
3991                    }
3992                }
3993            }
3994            #[allow(unused_variables)]
3995            pub fn rx_clk_config_frequency(clocks: &mut ClockTree, config: I2sClkConfig) -> u32 {
3996                (((xtal_clk_frequency() as u64) * (config.div_a() as u64))
3997                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3998                    as u32
3999            }
4000            pub fn rx_clk_frequency(self) -> u32 {
4001                I2S_RX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4002            }
4003            pub fn rx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
4004                match sclk {
4005                    I2sClkSclk::Xtal => xtal_clk_frequency(),
4006                }
4007            }
4008            pub fn configure_mclk_out(
4009                self,
4010                clocks: &mut ClockTree,
4011                new_selector: I2sMclkOutConfig,
4012            ) {
4013                let old_selector = clocks.i2s_mclk_out[self as usize].replace(new_selector);
4014                refresh_i2s_mclk_out_downstream(clocks, self);
4015                if clocks.i2s_mclk_out_refcount[self as usize] > 0 {
4016                    match new_selector {
4017                        I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
4018                        I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
4019                    }
4020                    self.configure_mclk_out_impl(clocks, old_selector, new_selector);
4021                    if let Some(old_selector) = old_selector {
4022                        match old_selector {
4023                            I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
4024                            I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
4025                        }
4026                    }
4027                } else {
4028                    self.configure_mclk_out_impl(clocks, old_selector, new_selector);
4029                }
4030            }
4031            pub fn mclk_out_config(self, clocks: &mut ClockTree) -> Option<I2sMclkOutConfig> {
4032                clocks.i2s_mclk_out[self as usize]
4033            }
4034            pub fn request_mclk_out(self, clocks: &mut ClockTree) {
4035                trace!("Requesting {:?}::MCLK_OUT", self);
4036                if increment_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
4037                    trace!("Enabling {:?}::MCLK_OUT", self);
4038                    match unwrap!(clocks.i2s_mclk_out[self as usize]) {
4039                        I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
4040                        I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
4041                    }
4042                    self.enable_mclk_out_impl(clocks, true);
4043                }
4044            }
4045            pub fn release_mclk_out(self, clocks: &mut ClockTree) {
4046                trace!("Releasing {:?}::MCLK_OUT", self);
4047                if decrement_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
4048                    trace!("Disabling {:?}::MCLK_OUT", self);
4049                    self.enable_mclk_out_impl(clocks, false);
4050                    match unwrap!(clocks.i2s_mclk_out[self as usize]) {
4051                        I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
4052                        I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
4053                    }
4054                }
4055            }
4056            #[allow(unused_variables)]
4057            pub fn mclk_out_config_frequency(
4058                self,
4059                clocks: &mut ClockTree,
4060                config: I2sMclkOutConfig,
4061            ) -> u32 {
4062                match config {
4063                    I2sMclkOutConfig::Tx => self.tx_clk_frequency(),
4064                    I2sMclkOutConfig::Rx => self.rx_clk_frequency(),
4065                }
4066            }
4067            pub fn mclk_out_frequency(self) -> u32 {
4068                I2S_MCLK_OUT_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4069            }
4070        }
4071        impl LcdCamInstance {
4072            pub fn configure_lcd_clock(self, clocks: &mut ClockTree, config: LcdCamLcdClockConfig) {
4073                let old_config = clocks.lcd_cam_lcd_clock[self as usize].replace(config);
4074                refresh_lcd_cam_lcd_clock_downstream(clocks, self);
4075                if clocks.lcd_cam_lcd_clock_refcount[self as usize] > 0 {
4076                    match config.sclk {
4077                        LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
4078                        LcdCamLcdClockSclk::PllF160m => request_pll_f160m(clocks),
4079                    }
4080                    self.configure_lcd_clock_impl(clocks, old_config, config);
4081                    if let Some(old_config) = old_config {
4082                        match old_config.sclk {
4083                            LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
4084                            LcdCamLcdClockSclk::PllF160m => release_pll_f160m(clocks),
4085                        }
4086                    }
4087                } else {
4088                    self.configure_lcd_clock_impl(clocks, old_config, config);
4089                }
4090            }
4091            pub fn lcd_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamLcdClockConfig> {
4092                clocks.lcd_cam_lcd_clock[self as usize]
4093            }
4094            pub fn request_lcd_clock(self, clocks: &mut ClockTree) {
4095                trace!("Requesting {:?}::LCD_CLOCK", self);
4096                if increment_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
4097                {
4098                    trace!("Enabling {:?}::LCD_CLOCK", self);
4099                    crate::rtc_cntl::WakeLock::acquire();
4100                    match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
4101                        LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
4102                        LcdCamLcdClockSclk::PllF160m => request_pll_f160m(clocks),
4103                    }
4104                    self.enable_lcd_clock_impl(clocks, true);
4105                }
4106            }
4107            pub fn release_lcd_clock(self, clocks: &mut ClockTree) {
4108                trace!("Releasing {:?}::LCD_CLOCK", self);
4109                if decrement_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
4110                {
4111                    trace!("Disabling {:?}::LCD_CLOCK", self);
4112                    crate::rtc_cntl::WakeLock::release();
4113                    self.enable_lcd_clock_impl(clocks, false);
4114                    match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
4115                        LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
4116                        LcdCamLcdClockSclk::PllF160m => release_pll_f160m(clocks),
4117                    }
4118                }
4119            }
4120            #[allow(unused_variables)]
4121            pub fn lcd_clock_config_frequency(
4122                clocks: &mut ClockTree,
4123                config: LcdCamLcdClockConfig,
4124            ) -> u32 {
4125                (((match config.sclk {
4126                    LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
4127                    LcdCamLcdClockSclk::PllF160m => pll_f160m_frequency(),
4128                } as u64)
4129                    * (config.div_a() as u64))
4130                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4131                    as u32
4132            }
4133            pub fn lcd_clock_frequency(self) -> u32 {
4134                LCD_CAM_LCD_CLOCK_FREQ_CACHE[self as usize]
4135                    .load(::core::sync::atomic::Ordering::Acquire)
4136            }
4137            pub fn lcd_clock_source_frequency(sclk: LcdCamLcdClockSclk) -> u32 {
4138                match sclk {
4139                    LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
4140                    LcdCamLcdClockSclk::PllF160m => pll_f160m_frequency(),
4141                }
4142            }
4143            pub fn configure_cam_clock(self, clocks: &mut ClockTree, config: LcdCamCamClockConfig) {
4144                let old_config = clocks.lcd_cam_cam_clock[self as usize].replace(config);
4145                refresh_lcd_cam_cam_clock_downstream(clocks, self);
4146                if clocks.lcd_cam_cam_clock_refcount[self as usize] > 0 {
4147                    match config.sclk {
4148                        LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
4149                        LcdCamCamClockSclk::PllF160m => request_pll_f160m(clocks),
4150                    }
4151                    self.configure_cam_clock_impl(clocks, old_config, config);
4152                    if let Some(old_config) = old_config {
4153                        match old_config.sclk {
4154                            LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
4155                            LcdCamCamClockSclk::PllF160m => release_pll_f160m(clocks),
4156                        }
4157                    }
4158                } else {
4159                    self.configure_cam_clock_impl(clocks, old_config, config);
4160                }
4161            }
4162            pub fn cam_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamCamClockConfig> {
4163                clocks.lcd_cam_cam_clock[self as usize]
4164            }
4165            pub fn request_cam_clock(self, clocks: &mut ClockTree) {
4166                trace!("Requesting {:?}::CAM_CLOCK", self);
4167                if increment_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
4168                {
4169                    trace!("Enabling {:?}::CAM_CLOCK", self);
4170                    crate::rtc_cntl::WakeLock::acquire();
4171                    match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
4172                        LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
4173                        LcdCamCamClockSclk::PllF160m => request_pll_f160m(clocks),
4174                    }
4175                    self.enable_cam_clock_impl(clocks, true);
4176                }
4177            }
4178            pub fn release_cam_clock(self, clocks: &mut ClockTree) {
4179                trace!("Releasing {:?}::CAM_CLOCK", self);
4180                if decrement_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
4181                {
4182                    trace!("Disabling {:?}::CAM_CLOCK", self);
4183                    crate::rtc_cntl::WakeLock::release();
4184                    self.enable_cam_clock_impl(clocks, false);
4185                    match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
4186                        LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
4187                        LcdCamCamClockSclk::PllF160m => release_pll_f160m(clocks),
4188                    }
4189                }
4190            }
4191            #[allow(unused_variables)]
4192            pub fn cam_clock_config_frequency(
4193                clocks: &mut ClockTree,
4194                config: LcdCamCamClockConfig,
4195            ) -> u32 {
4196                (((match config.sclk {
4197                    LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
4198                    LcdCamCamClockSclk::PllF160m => pll_f160m_frequency(),
4199                } as u64)
4200                    * (config.div_a() as u64))
4201                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4202                    as u32
4203            }
4204            pub fn cam_clock_frequency(self) -> u32 {
4205                LCD_CAM_CAM_CLOCK_FREQ_CACHE[self as usize]
4206                    .load(::core::sync::atomic::Ordering::Acquire)
4207            }
4208            pub fn cam_clock_source_frequency(sclk: LcdCamCamClockSclk) -> u32 {
4209                match sclk {
4210                    LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
4211                    LcdCamCamClockSclk::PllF160m => pll_f160m_frequency(),
4212                }
4213            }
4214        }
4215        impl RmtInstance {
4216            pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
4217                let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
4218                refresh_rmt_sclk_downstream(clocks, self);
4219                if clocks.rmt_sclk_refcount[self as usize] > 0 {
4220                    match new_selector {
4221                        RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
4222                        RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
4223                        RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
4224                    }
4225                    self.configure_sclk_impl(clocks, old_selector, new_selector);
4226                    if let Some(old_selector) = old_selector {
4227                        match old_selector {
4228                            RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
4229                            RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
4230                            RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
4231                        }
4232                    }
4233                } else {
4234                    self.configure_sclk_impl(clocks, old_selector, new_selector);
4235                }
4236            }
4237            pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
4238                clocks.rmt_sclk[self as usize]
4239            }
4240            pub fn request_sclk(self, clocks: &mut ClockTree) {
4241                trace!("Requesting {:?}::SCLK", self);
4242                if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
4243                    trace!("Enabling {:?}::SCLK", self);
4244                    crate::rtc_cntl::WakeLock::acquire();
4245                    match unwrap!(clocks.rmt_sclk[self as usize]) {
4246                        RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
4247                        RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
4248                        RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
4249                    }
4250                    self.enable_sclk_impl(clocks, true);
4251                }
4252            }
4253            pub fn release_sclk(self, clocks: &mut ClockTree) {
4254                trace!("Releasing {:?}::SCLK", self);
4255                if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
4256                    trace!("Disabling {:?}::SCLK", self);
4257                    crate::rtc_cntl::WakeLock::release();
4258                    self.enable_sclk_impl(clocks, false);
4259                    match unwrap!(clocks.rmt_sclk[self as usize]) {
4260                        RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
4261                        RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
4262                        RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
4263                    }
4264                }
4265            }
4266            #[allow(unused_variables)]
4267            pub fn sclk_config_frequency(clocks: &mut ClockTree, config: RmtSclkConfig) -> u32 {
4268                match config {
4269                    RmtSclkConfig::PllF80m => pll_f80m_frequency(),
4270                    RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
4271                    RmtSclkConfig::XtalClk => xtal_clk_frequency(),
4272                }
4273            }
4274            pub fn sclk_frequency(self) -> u32 {
4275                RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4276            }
4277            pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
4278                match source {
4279                    RmtSclkConfig::PllF80m => pll_f80m_frequency(),
4280                    RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
4281                    RmtSclkConfig::XtalClk => xtal_clk_frequency(),
4282                }
4283            }
4284        }
4285        impl SpiInstance {
4286            pub fn configure_function_clock(
4287                self,
4288                clocks: &mut ClockTree,
4289                new_selector: SpiFunctionClockConfig,
4290            ) {
4291                let old_selector = clocks.spi_function_clock[self as usize].replace(new_selector);
4292                refresh_spi_function_clock_downstream(clocks, self);
4293                if clocks.spi_function_clock_refcount[self as usize] > 0 {
4294                    match new_selector {
4295                        SpiFunctionClockConfig::Bbpll => request_bbpll_d3_clock(clocks),
4296                        SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4297                        SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
4298                    }
4299                    self.configure_function_clock_impl(clocks, old_selector, new_selector);
4300                    if let Some(old_selector) = old_selector {
4301                        match old_selector {
4302                            SpiFunctionClockConfig::Bbpll => release_bbpll_d3_clock(clocks),
4303                            SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4304                            SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
4305                        }
4306                    }
4307                } else {
4308                    self.configure_function_clock_impl(clocks, old_selector, new_selector);
4309                }
4310            }
4311            pub fn function_clock_config(
4312                self,
4313                clocks: &mut ClockTree,
4314            ) -> Option<SpiFunctionClockConfig> {
4315                clocks.spi_function_clock[self as usize]
4316            }
4317            pub fn request_function_clock(self, clocks: &mut ClockTree) {
4318                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4319                if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
4320                {
4321                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4322                    match unwrap!(clocks.spi_function_clock[self as usize]) {
4323                        SpiFunctionClockConfig::Bbpll => request_bbpll_d3_clock(clocks),
4324                        SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4325                        SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
4326                    }
4327                    self.enable_function_clock_impl(clocks, true);
4328                }
4329            }
4330            pub fn release_function_clock(self, clocks: &mut ClockTree) {
4331                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4332                if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
4333                {
4334                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4335                    self.enable_function_clock_impl(clocks, false);
4336                    match unwrap!(clocks.spi_function_clock[self as usize]) {
4337                        SpiFunctionClockConfig::Bbpll => release_bbpll_d3_clock(clocks),
4338                        SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4339                        SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
4340                    }
4341                }
4342            }
4343            #[allow(unused_variables)]
4344            pub fn function_clock_config_frequency(
4345                clocks: &mut ClockTree,
4346                config: SpiFunctionClockConfig,
4347            ) -> u32 {
4348                match config {
4349                    SpiFunctionClockConfig::Bbpll => bbpll_d3_clock_frequency(),
4350                    SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
4351                    SpiFunctionClockConfig::RcFast => rc_fast_clk_frequency(),
4352                }
4353            }
4354            pub fn function_clock_frequency(self) -> u32 {
4355                SPI_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4356                    .load(::core::sync::atomic::Ordering::Acquire)
4357            }
4358            pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
4359                match source {
4360                    SpiFunctionClockConfig::Bbpll => bbpll_d3_clock_frequency(),
4361                    SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
4362                    SpiFunctionClockConfig::RcFast => rc_fast_clk_frequency(),
4363                }
4364            }
4365        }
4366        impl TimgInstance {
4367            pub fn configure_function_clock(
4368                self,
4369                clocks: &mut ClockTree,
4370                new_selector: TimgFunctionClockConfig,
4371            ) {
4372                let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
4373                refresh_timg_function_clock_downstream(clocks, self);
4374                if clocks.timg_function_clock_refcount[self as usize] > 0 {
4375                    match new_selector {
4376                        TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
4377                        TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4378                        TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
4379                    }
4380                    self.configure_function_clock_impl(clocks, old_selector, new_selector);
4381                    if let Some(old_selector) = old_selector {
4382                        match old_selector {
4383                            TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
4384                            TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4385                            TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
4386                        }
4387                    }
4388                } else {
4389                    self.configure_function_clock_impl(clocks, old_selector, new_selector);
4390                }
4391            }
4392            pub fn function_clock_config(
4393                self,
4394                clocks: &mut ClockTree,
4395            ) -> Option<TimgFunctionClockConfig> {
4396                clocks.timg_function_clock[self as usize]
4397            }
4398            pub fn request_function_clock(self, clocks: &mut ClockTree) {
4399                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4400                if increment_reference_count(
4401                    &mut clocks.timg_function_clock_refcount[self as usize],
4402                ) {
4403                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4404                    match unwrap!(clocks.timg_function_clock[self as usize]) {
4405                        TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
4406                        TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4407                        TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
4408                    }
4409                    self.enable_function_clock_impl(clocks, true);
4410                }
4411            }
4412            pub fn release_function_clock(self, clocks: &mut ClockTree) {
4413                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4414                if decrement_reference_count(
4415                    &mut clocks.timg_function_clock_refcount[self as usize],
4416                ) {
4417                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4418                    self.enable_function_clock_impl(clocks, false);
4419                    match unwrap!(clocks.timg_function_clock[self as usize]) {
4420                        TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
4421                        TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4422                        TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
4423                    }
4424                }
4425            }
4426            #[allow(unused_variables)]
4427            pub fn function_clock_config_frequency(
4428                clocks: &mut ClockTree,
4429                config: TimgFunctionClockConfig,
4430            ) -> u32 {
4431                match config {
4432                    TimgFunctionClockConfig::PllF80m => pll_f80m_frequency(),
4433                    TimgFunctionClockConfig::RcFastClk => rc_fast_clk_frequency(),
4434                    TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
4435                }
4436            }
4437            pub fn function_clock_frequency(self) -> u32 {
4438                TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4439                    .load(::core::sync::atomic::Ordering::Acquire)
4440            }
4441            pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
4442                match source {
4443                    TimgFunctionClockConfig::PllF80m => pll_f80m_frequency(),
4444                    TimgFunctionClockConfig::RcFastClk => rc_fast_clk_frequency(),
4445                    TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
4446                }
4447            }
4448            pub fn configure_wdt_clock(
4449                self,
4450                clocks: &mut ClockTree,
4451                new_selector: TimgWdtClockConfig,
4452            ) {
4453                let old_selector = clocks.timg_wdt_clock[self as usize].replace(new_selector);
4454                refresh_timg_wdt_clock_downstream(clocks, self);
4455                if clocks.timg_wdt_clock_refcount[self as usize] > 0 {
4456                    match new_selector {
4457                        TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
4458                        TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
4459                        TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4460                    }
4461                    self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
4462                    if let Some(old_selector) = old_selector {
4463                        match old_selector {
4464                            TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
4465                            TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
4466                            TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4467                        }
4468                    }
4469                } else {
4470                    self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
4471                }
4472            }
4473            pub fn wdt_clock_config(self, clocks: &mut ClockTree) -> Option<TimgWdtClockConfig> {
4474                clocks.timg_wdt_clock[self as usize]
4475            }
4476            pub fn request_wdt_clock(self, clocks: &mut ClockTree) {
4477                trace!("Requesting {:?}::WDT_CLOCK", self);
4478                if increment_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
4479                    trace!("Enabling {:?}::WDT_CLOCK", self);
4480                    match unwrap!(clocks.timg_wdt_clock[self as usize]) {
4481                        TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
4482                        TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
4483                        TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4484                    }
4485                    self.enable_wdt_clock_impl(clocks, true);
4486                }
4487            }
4488            pub fn release_wdt_clock(self, clocks: &mut ClockTree) {
4489                trace!("Releasing {:?}::WDT_CLOCK", self);
4490                if decrement_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
4491                    trace!("Disabling {:?}::WDT_CLOCK", self);
4492                    self.enable_wdt_clock_impl(clocks, false);
4493                    match unwrap!(clocks.timg_wdt_clock[self as usize]) {
4494                        TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
4495                        TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
4496                        TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4497                    }
4498                }
4499            }
4500            #[allow(unused_variables)]
4501            pub fn wdt_clock_config_frequency(
4502                clocks: &mut ClockTree,
4503                config: TimgWdtClockConfig,
4504            ) -> u32 {
4505                match config {
4506                    TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
4507                    TimgWdtClockConfig::PllF80m => pll_f80m_frequency(),
4508                    TimgWdtClockConfig::RcFastClk => rc_fast_clk_frequency(),
4509                }
4510            }
4511            pub fn wdt_clock_frequency(self) -> u32 {
4512                TIMG_WDT_CLOCK_FREQ_CACHE[self as usize]
4513                    .load(::core::sync::atomic::Ordering::Acquire)
4514            }
4515            pub fn wdt_clock_source_frequency(source: TimgWdtClockConfig) -> u32 {
4516                match source {
4517                    TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
4518                    TimgWdtClockConfig::PllF80m => pll_f80m_frequency(),
4519                    TimgWdtClockConfig::RcFastClk => rc_fast_clk_frequency(),
4520                }
4521            }
4522        }
4523        impl UartInstance {
4524            pub fn configure_function_clock(
4525                self,
4526                clocks: &mut ClockTree,
4527                config: UartFunctionClockConfig,
4528            ) {
4529                let old_config = clocks.uart_function_clock[self as usize].replace(config);
4530                refresh_uart_function_clock_downstream(clocks, self);
4531                if clocks.uart_function_clock_refcount[self as usize] > 0 {
4532                    match config.sclk {
4533                        UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
4534                        UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4535                        UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4536                    }
4537                    self.configure_function_clock_impl(clocks, old_config, config);
4538                    if let Some(old_config) = old_config {
4539                        match old_config.sclk {
4540                            UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
4541                            UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4542                            UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4543                        }
4544                    }
4545                } else {
4546                    self.configure_function_clock_impl(clocks, old_config, config);
4547                }
4548            }
4549            pub fn function_clock_config(
4550                self,
4551                clocks: &mut ClockTree,
4552            ) -> Option<UartFunctionClockConfig> {
4553                clocks.uart_function_clock[self as usize]
4554            }
4555            pub fn request_function_clock(self, clocks: &mut ClockTree) {
4556                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4557                if increment_reference_count(
4558                    &mut clocks.uart_function_clock_refcount[self as usize],
4559                ) {
4560                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4561                    match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
4562                        UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
4563                        UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4564                        UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4565                    }
4566                    self.enable_function_clock_impl(clocks, true);
4567                }
4568            }
4569            pub fn release_function_clock(self, clocks: &mut ClockTree) {
4570                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4571                if decrement_reference_count(
4572                    &mut clocks.uart_function_clock_refcount[self as usize],
4573                ) {
4574                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4575                    self.enable_function_clock_impl(clocks, false);
4576                    match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
4577                        UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
4578                        UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4579                        UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4580                    }
4581                }
4582            }
4583            #[allow(unused_variables)]
4584            pub fn function_clock_config_frequency(
4585                clocks: &mut ClockTree,
4586                config: UartFunctionClockConfig,
4587            ) -> u32 {
4588                (match config.sclk {
4589                    UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
4590                    UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
4591                    UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4592                } / (config.div_num() + 1))
4593            }
4594            pub fn function_clock_frequency(self) -> u32 {
4595                UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4596                    .load(::core::sync::atomic::Ordering::Acquire)
4597            }
4598            pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
4599                match sclk {
4600                    UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
4601                    UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
4602                    UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4603                }
4604            }
4605            pub fn configure_baud_rate_generator(
4606                self,
4607                clocks: &mut ClockTree,
4608                config: UartBaudRateGeneratorConfig,
4609            ) {
4610                let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
4611                refresh_uart_baud_rate_generator_downstream(clocks, self);
4612                self.configure_baud_rate_generator_impl(clocks, old_config, config);
4613            }
4614            pub fn baud_rate_generator_config(
4615                self,
4616                clocks: &mut ClockTree,
4617            ) -> Option<UartBaudRateGeneratorConfig> {
4618                clocks.uart_baud_rate_generator[self as usize]
4619            }
4620            pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
4621                trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
4622                if increment_reference_count(
4623                    &mut clocks.uart_baud_rate_generator_refcount[self as usize],
4624                ) {
4625                    trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
4626                    self.request_function_clock(clocks);
4627                    self.enable_baud_rate_generator_impl(clocks, true);
4628                }
4629            }
4630            pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
4631                trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
4632                if decrement_reference_count(
4633                    &mut clocks.uart_baud_rate_generator_refcount[self as usize],
4634                ) {
4635                    trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
4636                    self.enable_baud_rate_generator_impl(clocks, false);
4637                    self.release_function_clock(clocks);
4638                }
4639            }
4640            #[allow(unused_variables)]
4641            pub fn baud_rate_generator_config_frequency(
4642                self,
4643                clocks: &mut ClockTree,
4644                config: UartBaudRateGeneratorConfig,
4645            ) -> u32 {
4646                ((self.function_clock_frequency() * 16)
4647                    / ((config.integral() * 16) + config.fractional()))
4648            }
4649            pub fn baud_rate_generator_frequency(self) -> u32 {
4650                UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
4651                    .load(::core::sync::atomic::Ordering::Acquire)
4652            }
4653            pub fn request_mem_clock(self, clocks: &mut ClockTree) {
4654                trace!("Requesting {:?}::MEM_CLOCK", self);
4655                if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
4656                    trace!("Enabling {:?}::MEM_CLOCK", self);
4657                    request_apb_clk(clocks);
4658                    self.enable_mem_clock_impl(clocks, true);
4659                }
4660            }
4661            pub fn release_mem_clock(self, clocks: &mut ClockTree) {
4662                trace!("Releasing {:?}::MEM_CLOCK", self);
4663                if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
4664                    trace!("Disabling {:?}::MEM_CLOCK", self);
4665                    self.enable_mem_clock_impl(clocks, false);
4666                    release_apb_clk(clocks);
4667                }
4668            }
4669            pub fn mem_clock_frequency(self) -> u32 {
4670                apb_clk_frequency()
4671            }
4672            pub fn mem_clock_source_frequency() -> u32 {
4673                apb_clk_frequency()
4674            }
4675        }
4676        impl PsramInstance {
4677            pub fn configure_function_clock(
4678                self,
4679                clocks: &mut ClockTree,
4680                new_selector: PsramFunctionClockConfig,
4681            ) {
4682                let old_selector = clocks.psram_function_clock[self as usize].replace(new_selector);
4683                refresh_psram_function_clock_downstream(clocks, self);
4684                if clocks.psram_function_clock_refcount[self as usize] > 0 {
4685                    match new_selector {
4686                        PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4687                        PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
4688                        PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
4689                    }
4690                    self.configure_function_clock_impl(clocks, old_selector, new_selector);
4691                    if let Some(old_selector) = old_selector {
4692                        match old_selector {
4693                            PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4694                            PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
4695                            PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
4696                        }
4697                    }
4698                } else {
4699                    self.configure_function_clock_impl(clocks, old_selector, new_selector);
4700                }
4701            }
4702            pub fn function_clock_config(
4703                self,
4704                clocks: &mut ClockTree,
4705            ) -> Option<PsramFunctionClockConfig> {
4706                clocks.psram_function_clock[self as usize]
4707            }
4708            pub fn request_function_clock(self, clocks: &mut ClockTree) {
4709                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4710                if increment_reference_count(
4711                    &mut clocks.psram_function_clock_refcount[self as usize],
4712                ) {
4713                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4714                    match unwrap!(clocks.psram_function_clock[self as usize]) {
4715                        PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4716                        PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
4717                        PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
4718                    }
4719                    self.enable_function_clock_impl(clocks, true);
4720                }
4721            }
4722            pub fn release_function_clock(self, clocks: &mut ClockTree) {
4723                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4724                if decrement_reference_count(
4725                    &mut clocks.psram_function_clock_refcount[self as usize],
4726                ) {
4727                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4728                    self.enable_function_clock_impl(clocks, false);
4729                    match unwrap!(clocks.psram_function_clock[self as usize]) {
4730                        PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4731                        PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
4732                        PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
4733                    }
4734                }
4735            }
4736            #[allow(unused_variables)]
4737            pub fn function_clock_config_frequency(
4738                clocks: &mut ClockTree,
4739                config: PsramFunctionClockConfig,
4740            ) -> u32 {
4741                match config {
4742                    PsramFunctionClockConfig::Xtal => xtal_clk_frequency(),
4743                    PsramFunctionClockConfig::Mpll => mpll_clk_frequency(),
4744                    PsramFunctionClockConfig::Cpll => cpll_clk_frequency(),
4745                }
4746            }
4747            pub fn function_clock_frequency(self) -> u32 {
4748                PSRAM_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4749                    .load(::core::sync::atomic::Ordering::Acquire)
4750            }
4751            pub fn function_clock_source_frequency(source: PsramFunctionClockConfig) -> u32 {
4752                match source {
4753                    PsramFunctionClockConfig::Xtal => xtal_clk_frequency(),
4754                    PsramFunctionClockConfig::Mpll => mpll_clk_frequency(),
4755                    PsramFunctionClockConfig::Cpll => cpll_clk_frequency(),
4756                }
4757            }
4758        }
4759        /// Clock tree configuration.
4760        ///
4761        /// The fields of this struct are optional, with the following caveats:
4762        /// - If `XTAL_CLK` is not specified, the crystal frequency will be automatically detected
4763        ///   if possible.
4764        /// - The CPU and its upstream clock nodes will be set to a default configuration.
4765        /// - Other unspecified clock sources will not be useable by peripherals.
4766        #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4767        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4768        #[instability::unstable]
4769        pub struct ClockConfig {
4770            /// `CPU_ROOT_CLK` configuration.
4771            pub cpu_root_clk: Option<CpuRootClkConfig>,
4772            /// `CPU_CLK` configuration.
4773            pub cpu_clk: Option<CpuClkConfig>,
4774            /// `MEM_CLK` configuration.
4775            pub mem_clk: Option<MemClkConfig>,
4776            /// `SYS_CLK` configuration.
4777            pub sys_clk: Option<SysClkConfig>,
4778            /// `APB_CLK` configuration.
4779            pub apb_clk: Option<ApbClkConfig>,
4780            /// `LP_FAST_CLK` configuration.
4781            pub lp_fast_clk: Option<LpFastClkConfig>,
4782            /// `LP_SLOW_CLK` configuration.
4783            pub lp_slow_clk: Option<LpSlowClkConfig>,
4784            /// `CRYPTO_CLK` configuration.
4785            pub crypto_clk: Option<CryptoClkConfig>,
4786            /// `IOMUX_FUNCTION_CLOCK` configuration.
4787            pub iomux_function_clock: Option<IomuxFunctionClockConfig>,
4788            /// `TIMG_CALIBRATION_CLOCK` configuration.
4789            pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
4790        }
4791        impl ClockConfig {
4792            fn apply(&self, clocks: &mut ClockTree) {
4793                if let Some(config) = self.cpu_root_clk {
4794                    configure_cpu_root_clk(clocks, config);
4795                }
4796                if let Some(config) = self.cpu_clk {
4797                    configure_cpu_clk(clocks, config);
4798                }
4799                if let Some(config) = self.mem_clk {
4800                    configure_mem_clk(clocks, config);
4801                }
4802                if let Some(config) = self.sys_clk {
4803                    configure_sys_clk(clocks, config);
4804                }
4805                if let Some(config) = self.apb_clk {
4806                    configure_apb_clk(clocks, config);
4807                }
4808                if let Some(config) = self.lp_fast_clk {
4809                    configure_lp_fast_clk(clocks, config);
4810                }
4811                if let Some(config) = self.lp_slow_clk {
4812                    configure_lp_slow_clk(clocks, config);
4813                }
4814                if let Some(config) = self.crypto_clk {
4815                    configure_crypto_clk(clocks, config);
4816                }
4817                if let Some(config) = self.iomux_function_clock {
4818                    configure_iomux_function_clock(clocks, config);
4819                }
4820                if let Some(config) = self.timg_calibration_clock {
4821                    configure_timg_calibration_clock(clocks, config);
4822                }
4823            }
4824        }
4825        fn increment_reference_count(refcount: &mut u32) -> bool {
4826            let first = *refcount == 0;
4827            *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
4828            first
4829        }
4830        fn decrement_reference_count(refcount: &mut u32) -> bool {
4831            *refcount = refcount.saturating_sub(1);
4832            let last = *refcount == 0;
4833            last
4834        }
4835        fn refresh_cpu_root_clk_downstream(clocks: &mut ClockTree) {
4836            if let Some(config) = clocks.cpu_root_clk {
4837                CPU_ROOT_CLK_FREQ_CACHE.store(
4838                    cpu_root_clk_config_frequency(clocks, config),
4839                    ::core::sync::atomic::Ordering::Release,
4840                );
4841            }
4842            refresh_cpu_clk_downstream(clocks);
4843        }
4844        fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
4845            if let Some(config) = clocks.cpu_clk {
4846                CPU_CLK_FREQ_CACHE.store(
4847                    cpu_clk_config_frequency(clocks, config),
4848                    ::core::sync::atomic::Ordering::Release,
4849                );
4850            }
4851            refresh_mem_clk_downstream(clocks);
4852            refresh_sys_clk_downstream(clocks);
4853        }
4854        fn refresh_mem_clk_downstream(clocks: &mut ClockTree) {
4855            if let Some(config) = clocks.mem_clk {
4856                MEM_CLK_FREQ_CACHE.store(
4857                    mem_clk_config_frequency(clocks, config),
4858                    ::core::sync::atomic::Ordering::Release,
4859                );
4860            }
4861        }
4862        fn refresh_sys_clk_downstream(clocks: &mut ClockTree) {
4863            if let Some(config) = clocks.sys_clk {
4864                SYS_CLK_FREQ_CACHE.store(
4865                    sys_clk_config_frequency(clocks, config),
4866                    ::core::sync::atomic::Ordering::Release,
4867                );
4868            }
4869            refresh_apb_clk_downstream(clocks);
4870        }
4871        fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
4872            if let Some(config) = clocks.apb_clk {
4873                APB_CLK_FREQ_CACHE.store(
4874                    apb_clk_config_frequency(clocks, config),
4875                    ::core::sync::atomic::Ordering::Release,
4876                );
4877            }
4878        }
4879        fn refresh_lp_fast_clk_downstream(clocks: &mut ClockTree) {
4880            if let Some(config) = clocks.lp_fast_clk {
4881                LP_FAST_CLK_FREQ_CACHE.store(
4882                    lp_fast_clk_config_frequency(clocks, config),
4883                    ::core::sync::atomic::Ordering::Release,
4884                );
4885            }
4886        }
4887        fn refresh_lp_slow_clk_downstream(clocks: &mut ClockTree) {
4888            if let Some(config) = clocks.lp_slow_clk {
4889                LP_SLOW_CLK_FREQ_CACHE.store(
4890                    lp_slow_clk_config_frequency(clocks, config),
4891                    ::core::sync::atomic::Ordering::Release,
4892                );
4893            }
4894        }
4895        fn refresh_crypto_clk_downstream(clocks: &mut ClockTree) {
4896            if let Some(config) = clocks.crypto_clk {
4897                CRYPTO_CLK_FREQ_CACHE.store(
4898                    crypto_clk_config_frequency(clocks, config),
4899                    ::core::sync::atomic::Ordering::Release,
4900                );
4901            }
4902        }
4903        fn refresh_iomux_function_clock_downstream(clocks: &mut ClockTree) {
4904            if let Some(config) = clocks.iomux_function_clock {
4905                IOMUX_FUNCTION_CLOCK_FREQ_CACHE.store(
4906                    iomux_function_clock_config_frequency(clocks, config),
4907                    ::core::sync::atomic::Ordering::Release,
4908                );
4909            }
4910        }
4911        fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
4912            if let Some(config) = clocks.timg_calibration_clock {
4913                TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
4914                    timg_calibration_clock_config_frequency(clocks, config),
4915                    ::core::sync::atomic::Ordering::Release,
4916                );
4917            }
4918        }
4919        fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
4920            if let Some(config) = clocks.i2c_function_clock[instance as usize] {
4921                I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4922                    I2cInstance::function_clock_config_frequency(clocks, config),
4923                    ::core::sync::atomic::Ordering::Release,
4924                );
4925            }
4926        }
4927        fn refresh_i2s_tx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
4928            if let Some(config) = clocks.i2s_tx_clk[instance as usize] {
4929                I2S_TX_CLK_FREQ_CACHE[instance as usize].store(
4930                    I2sInstance::tx_clk_config_frequency(clocks, config),
4931                    ::core::sync::atomic::Ordering::Release,
4932                );
4933            }
4934            refresh_i2s_mclk_out_downstream(clocks, instance);
4935        }
4936        fn refresh_i2s_rx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
4937            if let Some(config) = clocks.i2s_rx_clk[instance as usize] {
4938                I2S_RX_CLK_FREQ_CACHE[instance as usize].store(
4939                    I2sInstance::rx_clk_config_frequency(clocks, config),
4940                    ::core::sync::atomic::Ordering::Release,
4941                );
4942            }
4943            refresh_i2s_mclk_out_downstream(clocks, instance);
4944        }
4945        fn refresh_i2s_mclk_out_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
4946            if let Some(config) = clocks.i2s_mclk_out[instance as usize] {
4947                I2S_MCLK_OUT_FREQ_CACHE[instance as usize].store(
4948                    instance.mclk_out_config_frequency(clocks, config),
4949                    ::core::sync::atomic::Ordering::Release,
4950                );
4951            }
4952        }
4953        fn refresh_lcd_cam_lcd_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
4954            if let Some(config) = clocks.lcd_cam_lcd_clock[instance as usize] {
4955                LCD_CAM_LCD_CLOCK_FREQ_CACHE[instance as usize].store(
4956                    LcdCamInstance::lcd_clock_config_frequency(clocks, config),
4957                    ::core::sync::atomic::Ordering::Release,
4958                );
4959            }
4960        }
4961        fn refresh_lcd_cam_cam_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
4962            if let Some(config) = clocks.lcd_cam_cam_clock[instance as usize] {
4963                LCD_CAM_CAM_CLOCK_FREQ_CACHE[instance as usize].store(
4964                    LcdCamInstance::cam_clock_config_frequency(clocks, config),
4965                    ::core::sync::atomic::Ordering::Release,
4966                );
4967            }
4968        }
4969        fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
4970            if let Some(config) = clocks.rmt_sclk[instance as usize] {
4971                RMT_SCLK_FREQ_CACHE[instance as usize].store(
4972                    RmtInstance::sclk_config_frequency(clocks, config),
4973                    ::core::sync::atomic::Ordering::Release,
4974                );
4975            }
4976        }
4977        fn refresh_spi_function_clock_downstream(clocks: &mut ClockTree, instance: SpiInstance) {
4978            if let Some(config) = clocks.spi_function_clock[instance as usize] {
4979                SPI_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4980                    SpiInstance::function_clock_config_frequency(clocks, config),
4981                    ::core::sync::atomic::Ordering::Release,
4982                );
4983            }
4984        }
4985        fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
4986            if let Some(config) = clocks.timg_function_clock[instance as usize] {
4987                TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4988                    TimgInstance::function_clock_config_frequency(clocks, config),
4989                    ::core::sync::atomic::Ordering::Release,
4990                );
4991            }
4992        }
4993        fn refresh_timg_wdt_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
4994            if let Some(config) = clocks.timg_wdt_clock[instance as usize] {
4995                TIMG_WDT_CLOCK_FREQ_CACHE[instance as usize].store(
4996                    TimgInstance::wdt_clock_config_frequency(clocks, config),
4997                    ::core::sync::atomic::Ordering::Release,
4998                );
4999            }
5000        }
5001        fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
5002            if let Some(config) = clocks.uart_function_clock[instance as usize] {
5003                UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5004                    UartInstance::function_clock_config_frequency(clocks, config),
5005                    ::core::sync::atomic::Ordering::Release,
5006                );
5007            }
5008            refresh_uart_baud_rate_generator_downstream(clocks, instance);
5009        }
5010        fn refresh_uart_baud_rate_generator_downstream(
5011            clocks: &mut ClockTree,
5012            instance: UartInstance,
5013        ) {
5014            if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
5015                UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
5016                    instance.baud_rate_generator_config_frequency(clocks, config),
5017                    ::core::sync::atomic::Ordering::Release,
5018                );
5019            }
5020        }
5021        fn refresh_psram_function_clock_downstream(
5022            clocks: &mut ClockTree,
5023            instance: PsramInstance,
5024        ) {
5025            if let Some(config) = clocks.psram_function_clock[instance as usize] {
5026                PSRAM_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5027                    PsramInstance::function_clock_config_frequency(clocks, config),
5028                    ::core::sync::atomic::Ordering::Release,
5029                );
5030            }
5031        }
5032    };
5033}
5034/// Implement the `Peripheral` enum and enable/disable/reset functions.
5035///
5036/// This macro is intended to be placed in `esp_hal::system`.
5037#[macro_export]
5038#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5039macro_rules! implement_peripheral_clocks {
5040    () => {
5041        #[doc(hidden)]
5042        #[derive(Debug, Clone, Copy, PartialEq, Eq)]
5043        #[repr(u8)]
5044        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
5045        pub enum Peripheral {
5046            /// AES peripheral clock signal
5047            Aes,
5048            /// AHB_GDMA peripheral clock signal
5049            AhbGdma,
5050            /// APB_SAR_ADC peripheral clock signal
5051            ApbSarAdc,
5052            /// AXI_GDMA peripheral clock signal
5053            AxiGdma,
5054            /// ECC peripheral clock signal
5055            Ecc,
5056            /// EMAC peripheral clock signal
5057            Emac,
5058            /// GPIO_SD peripheral clock signal
5059            GpioSd,
5060            /// I2C0 peripheral clock signal
5061            I2c0,
5062            /// I2C1 peripheral clock signal
5063            I2c1,
5064            /// I2S0 peripheral clock signal
5065            I2s0,
5066            /// I2S1 peripheral clock signal
5067            I2s1,
5068            /// LCD_CAM peripheral clock signal
5069            LcdCam,
5070            /// PCNT peripheral clock signal
5071            Pcnt,
5072            /// PCNT1 peripheral clock signal
5073            Pcnt1,
5074            /// RMT peripheral clock signal
5075            Rmt,
5076            /// RSA peripheral clock signal
5077            Rsa,
5078            /// SDIO_HOST peripheral clock signal
5079            SdioHost,
5080            /// SHA peripheral clock signal
5081            Sha,
5082            /// SPI2 peripheral clock signal
5083            Spi2,
5084            /// SPI3 peripheral clock signal
5085            Spi3,
5086            /// SYSTIMER peripheral clock signal
5087            Systimer,
5088            /// TIMG0 peripheral clock signal
5089            Timg0,
5090            /// TIMG1 peripheral clock signal
5091            Timg1,
5092            /// UART0 peripheral clock signal
5093            Uart0,
5094            /// UART1 peripheral clock signal
5095            Uart1,
5096            /// UART2 peripheral clock signal
5097            Uart2,
5098            /// UART3 peripheral clock signal
5099            Uart3,
5100            /// UHCI0 peripheral clock signal
5101            Uhci0,
5102            /// USB_DEVICE peripheral clock signal
5103            UsbDevice,
5104            /// USB_HS peripheral clock signal
5105            UsbHs,
5106        }
5107        impl Peripheral {
5108            const KEEP_ENABLED: &[Peripheral] =
5109                &[Self::Systimer, Self::Timg0, Self::Uart0, Self::UsbDevice];
5110            const COUNT: usize = Self::ALL.len();
5111            const ALL: &[Self] = &[
5112                Self::Aes,
5113                Self::AhbGdma,
5114                Self::ApbSarAdc,
5115                Self::AxiGdma,
5116                Self::Ecc,
5117                Self::Emac,
5118                Self::GpioSd,
5119                Self::I2c0,
5120                Self::I2c1,
5121                Self::I2s0,
5122                Self::I2s1,
5123                Self::LcdCam,
5124                Self::Pcnt,
5125                Self::Pcnt1,
5126                Self::Rmt,
5127                Self::Rsa,
5128                Self::SdioHost,
5129                Self::Sha,
5130                Self::Spi2,
5131                Self::Spi3,
5132                Self::Systimer,
5133                Self::Timg0,
5134                Self::Timg1,
5135                Self::Uart0,
5136                Self::Uart1,
5137                Self::Uart2,
5138                Self::Uart3,
5139                Self::Uhci0,
5140                Self::UsbDevice,
5141                Self::UsbHs,
5142            ];
5143        }
5144        unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
5145            match peripheral {
5146                Peripheral::Aes => {
5147                    crate::peripherals::HP_SYS_CLKRST::regs()
5148                        .crypto_ctrl0()
5149                        .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
5150                }
5151                Peripheral::AhbGdma => {
5152                    crate::peripherals::HP_SYS_CLKRST::regs()
5153                        .ahb_pdma_ctrl0()
5154                        .modify(|_, w| w.sys_clk_en().bit(enable));
5155                }
5156                Peripheral::ApbSarAdc => {
5157                    crate::peripherals::LP_PERI::regs()
5158                        .adc_ctrl()
5159                        .modify(|_, w| w.lp_adc_clk_en().bit(enable));
5160                }
5161                Peripheral::AxiGdma => {
5162                    crate::peripherals::HP_SYS_CLKRST::regs()
5163                        .axi_pdma_ctrl0()
5164                        .modify(|_, w| w.sys_clk_en().bit(enable));
5165                }
5166                Peripheral::Ecc => {
5167                    crate::peripherals::HP_SYS_CLKRST::regs()
5168                        .crypto_ctrl0()
5169                        .modify(|_, w| w.crypto_ecc_clk_en().bit(enable));
5170                }
5171                Peripheral::Emac => {
5172                    crate::peripherals::HP_SYS_CLKRST::regs()
5173                        .emac_ctrl0()
5174                        .modify(|_, w| w.sys_clk_en().bit(enable));
5175                }
5176                Peripheral::GpioSd => {
5177                    crate::peripherals::GPIO_SD::regs()
5178                        .clock_gate()
5179                        .modify(|_, w| w.clk_en().bit(enable));
5180                }
5181                Peripheral::I2c0 => {
5182                    crate::peripherals::HP_SYS_CLKRST::regs()
5183                        .i2c_ctrl0(0)
5184                        .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
5185                }
5186                Peripheral::I2c1 => {
5187                    crate::peripherals::HP_SYS_CLKRST::regs()
5188                        .i2c_ctrl0(1)
5189                        .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
5190                }
5191                Peripheral::I2s0 => {
5192                    crate::peripherals::HP_SYS_CLKRST::regs()
5193                        .i2s0_ctrl0()
5194                        .modify(|_, w| w.apb_clk_en().bit(enable));
5195                    crate::peripherals::HP_ALIVE_SYS::regs()
5196                        .hp_pad_i2s0_ctrl()
5197                        .modify(|_, w| w.hp_pad_i2s0_mclk_en().bit(enable));
5198                }
5199                Peripheral::I2s1 => {
5200                    crate::peripherals::HP_SYS_CLKRST::regs()
5201                        .i2s1_ctrl0()
5202                        .modify(|_, w| w.apb_clk_en().bit(enable));
5203                    crate::peripherals::HP_ALIVE_SYS::regs()
5204                        .hp_pad_i2s1_ctrl()
5205                        .modify(|_, w| w.hp_pad_i2s1_mclk_en().bit(enable));
5206                }
5207                Peripheral::LcdCam => {
5208                    crate::peripherals::HP_SYS_CLKRST::regs()
5209                        .lcdcam_ctrl0()
5210                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5211                }
5212                Peripheral::Pcnt => {
5213                    crate::peripherals::HP_SYS_CLKRST::regs()
5214                        .pcnt_ctrl0()
5215                        .modify(|_, w| w.pcnt0_apb_clk_en().bit(enable));
5216                }
5217                Peripheral::Pcnt1 => {
5218                    crate::peripherals::HP_SYS_CLKRST::regs()
5219                        .pcnt_ctrl0()
5220                        .modify(|_, w| w.pcnt1_apb_clk_en().bit(enable));
5221                }
5222                Peripheral::Rmt => {
5223                    crate::peripherals::HP_SYS_CLKRST::regs()
5224                        .rmt_ctrl0()
5225                        .modify(|_, w| w.sys_clk_en().bit(enable));
5226                }
5227                Peripheral::Rsa => {
5228                    crate::peripherals::HP_SYS_CLKRST::regs()
5229                        .crypto_ctrl0()
5230                        .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
5231                }
5232                Peripheral::SdioHost => {
5233                    crate::peripherals::HP_SYS_CLKRST::regs()
5234                        .sdio_host_ctrl0()
5235                        .modify(|_, w| w.sys_clk_en().bit(enable));
5236                }
5237                Peripheral::Sha => {
5238                    crate::peripherals::HP_SYS_CLKRST::regs()
5239                        .crypto_ctrl0()
5240                        .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
5241                }
5242                Peripheral::Spi2 => {
5243                    crate::peripherals::HP_SYS_CLKRST::regs()
5244                        .gpspi2_ctrl0()
5245                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5246                }
5247                Peripheral::Spi3 => {
5248                    crate::peripherals::HP_SYS_CLKRST::regs()
5249                        .gpspi3_ctrl0()
5250                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5251                }
5252                Peripheral::Systimer => {
5253                    crate::peripherals::HP_SYS_CLKRST::regs()
5254                        .systimer_ctrl0()
5255                        .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
5256                }
5257                Peripheral::Timg0 => {
5258                    crate::peripherals::HP_SYS_CLKRST::regs()
5259                        .timergrp0_ctrl0()
5260                        .modify(|_, w| w.apb_clk_en().bit(enable));
5261                }
5262                Peripheral::Timg1 => {
5263                    crate::peripherals::HP_SYS_CLKRST::regs()
5264                        .timergrp1_ctrl0()
5265                        .modify(|_, w| w.apb_clk_en().bit(enable));
5266                }
5267                Peripheral::Uart0 => {
5268                    crate::peripherals::HP_SYS_CLKRST::regs()
5269                        .uart_ctrl0(0)
5270                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5271                }
5272                Peripheral::Uart1 => {
5273                    crate::peripherals::HP_SYS_CLKRST::regs()
5274                        .uart_ctrl0(1)
5275                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5276                }
5277                Peripheral::Uart2 => {
5278                    crate::peripherals::HP_SYS_CLKRST::regs()
5279                        .uart_ctrl0(2)
5280                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5281                }
5282                Peripheral::Uart3 => {
5283                    crate::peripherals::HP_SYS_CLKRST::regs()
5284                        .uart_ctrl0(3)
5285                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5286                }
5287                Peripheral::Uhci0 => {
5288                    crate::peripherals::HP_SYS_CLKRST::regs()
5289                        .uhci_ctrl0()
5290                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5291                }
5292                Peripheral::UsbDevice => {
5293                    crate::peripherals::HP_SYS_CLKRST::regs()
5294                        .usb_device_ctrl0()
5295                        .modify(|_, w| w.apb_clk_en().bit(enable));
5296                    crate::peripherals::CNNT_SYS::regs()
5297                        .sys_hp_usb_device_ctrl()
5298                        .modify(|_, w| w.sys_usb_device_48m_clk_en().bit(enable));
5299                }
5300                Peripheral::UsbHs => {
5301                    crate::peripherals::HP_SYS_CLKRST::regs()
5302                        .usb_otghs_ctrl0()
5303                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
5304                }
5305            }
5306        }
5307        unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
5308            match peripheral {
5309                Peripheral::Aes => {
5310                    crate::peripherals::HP_SYS_CLKRST::regs()
5311                        .crypto_ctrl0()
5312                        .modify(|_, w| w.crypto_aes_rst_en().bit(reset));
5313                }
5314                Peripheral::AhbGdma => {
5315                    crate::peripherals::HP_SYS_CLKRST::regs()
5316                        .ahb_pdma_ctrl0()
5317                        .modify(|_, w| w.rst_en().bit(reset));
5318                }
5319                Peripheral::ApbSarAdc => {
5320                    crate::peripherals::LP_PERI::regs()
5321                        .adc_ctrl()
5322                        .modify(|_, w| w.lp_adc_rst_en().bit(reset));
5323                }
5324                Peripheral::AxiGdma => {
5325                    crate::peripherals::HP_SYS_CLKRST::regs()
5326                        .axi_pdma_ctrl0()
5327                        .modify(|_, w| w.rst_en().bit(reset));
5328                }
5329                Peripheral::Ecc => {
5330                    crate::peripherals::HP_SYS_CLKRST::regs()
5331                        .crypto_ctrl0()
5332                        .modify(|_, w| w.crypto_ecc_rst_en().bit(reset));
5333                }
5334                Peripheral::Emac => {
5335                    let _ = reset;
5336                }
5337                Peripheral::GpioSd => {
5338                    let _ = reset;
5339                }
5340                Peripheral::I2c0 => {
5341                    crate::peripherals::HP_SYS_CLKRST::regs()
5342                        .i2c_ctrl0(0)
5343                        .modify(|_, w| w.rst_en().bit(reset));
5344                }
5345                Peripheral::I2c1 => {
5346                    crate::peripherals::HP_SYS_CLKRST::regs()
5347                        .i2c_ctrl0(1)
5348                        .modify(|_, w| w.rst_en().bit(reset));
5349                }
5350                Peripheral::I2s0 => {
5351                    crate::peripherals::HP_SYS_CLKRST::regs()
5352                        .i2s0_ctrl0()
5353                        .modify(|_, w| w.apb_rst_en().bit(reset));
5354                }
5355                Peripheral::I2s1 => {
5356                    crate::peripherals::HP_SYS_CLKRST::regs()
5357                        .i2s1_ctrl0()
5358                        .modify(|_, w| w.apb_rst_en().bit(reset));
5359                }
5360                Peripheral::LcdCam => {
5361                    crate::peripherals::HP_SYS_CLKRST::regs()
5362                        .lcdcam_ctrl0()
5363                        .modify(|_, w| w.apb_rst_en().bit(reset).rst_en().bit(reset));
5364                }
5365                Peripheral::Pcnt => {
5366                    crate::peripherals::HP_SYS_CLKRST::regs()
5367                        .pcnt_ctrl0()
5368                        .modify(|_, w| w.pcnt0_rst_en().bit(reset));
5369                }
5370                Peripheral::Pcnt1 => {
5371                    crate::peripherals::HP_SYS_CLKRST::regs()
5372                        .pcnt_ctrl0()
5373                        .modify(|_, w| w.pcnt1_rst_en().bit(reset));
5374                }
5375                Peripheral::Rmt => {
5376                    crate::peripherals::HP_SYS_CLKRST::regs()
5377                        .rmt_ctrl0()
5378                        .modify(|_, w| w.rst_en().bit(reset));
5379                }
5380                Peripheral::Rsa => {
5381                    crate::peripherals::HP_SYS_CLKRST::regs()
5382                        .crypto_ctrl0()
5383                        .modify(|_, w| w.crypto_rsa_rst_en().bit(reset));
5384                }
5385                Peripheral::SdioHost => {
5386                    crate::peripherals::CNNT_SYS::regs()
5387                        .sys_hp_sdmmc_ctrl()
5388                        .modify(|_, w| w.sys_sdmmc_rst_en().bit(reset));
5389                }
5390                Peripheral::Sha => {
5391                    crate::peripherals::HP_SYS_CLKRST::regs()
5392                        .crypto_ctrl0()
5393                        .modify(|_, w| w.crypto_sha_rst_en().bit(reset));
5394                }
5395                Peripheral::Spi2 => {
5396                    crate::peripherals::HP_SYS_CLKRST::regs()
5397                        .gpspi2_ctrl0()
5398                        .modify(|_, w| w.rst_en().bit(reset));
5399                }
5400                Peripheral::Spi3 => {
5401                    crate::peripherals::HP_SYS_CLKRST::regs()
5402                        .gpspi3_ctrl0()
5403                        .modify(|_, w| w.rst_en().bit(reset));
5404                }
5405                Peripheral::Systimer => {
5406                    crate::peripherals::HP_SYS_CLKRST::regs()
5407                        .systimer_ctrl0()
5408                        .modify(|_, w| w.rst_en().bit(reset));
5409                }
5410                Peripheral::Timg0 => {
5411                    crate::peripherals::HP_SYS_CLKRST::regs()
5412                        .timergrp0_ctrl0()
5413                        .modify(|_, w| w.rst_en().bit(reset));
5414                }
5415                Peripheral::Timg1 => {
5416                    crate::peripherals::HP_SYS_CLKRST::regs()
5417                        .timergrp1_ctrl0()
5418                        .modify(|_, w| w.rst_en().bit(reset));
5419                }
5420                Peripheral::Uart0 => {
5421                    crate::peripherals::HP_SYS_CLKRST::regs()
5422                        .uart_ctrl0(0)
5423                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
5424                }
5425                Peripheral::Uart1 => {
5426                    crate::peripherals::HP_SYS_CLKRST::regs()
5427                        .uart_ctrl0(1)
5428                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
5429                }
5430                Peripheral::Uart2 => {
5431                    crate::peripherals::HP_SYS_CLKRST::regs()
5432                        .uart_ctrl0(2)
5433                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
5434                }
5435                Peripheral::Uart3 => {
5436                    crate::peripherals::HP_SYS_CLKRST::regs()
5437                        .uart_ctrl0(3)
5438                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
5439                }
5440                Peripheral::Uhci0 => {
5441                    crate::peripherals::HP_SYS_CLKRST::regs()
5442                        .uhci_ctrl0()
5443                        .modify(|_, w| w.rst_en().bit(reset));
5444                }
5445                Peripheral::UsbDevice => {
5446                    crate::peripherals::CNNT_SYS::regs()
5447                        .sys_hp_usb_device_ctrl()
5448                        .modify(|_, w| w.sys_usb_device_rst_en().bit(reset));
5449                }
5450                Peripheral::UsbHs => {
5451                    let _ = reset;
5452                }
5453            }
5454        }
5455    };
5456}
5457/// Macro to get the address range of the given memory region.
5458///
5459/// This macro provides two syntax options for each memory region:
5460///
5461/// - `memory_range!("region_name")` returns the address range as a range expression (`start..end`).
5462/// - `memory_range!(size as str, "region_name")` returns the size of the region as a string
5463///   literal.
5464#[macro_export]
5465#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5466macro_rules! memory_range {
5467    ("DRAM") => {
5468        0x2F000000..0x2F07AFC0
5469    };
5470    (size as str, "DRAM") => {
5471        "503744"
5472    };
5473    ("DRAM2_UNINIT") => {
5474        0x2F07AFC0..0x2F07CFB0
5475    };
5476    (size as str, "DRAM2_UNINIT") => {
5477        "8176"
5478    };
5479    ("IROM") => {
5480        0x40000000..0x50000000
5481    };
5482    (size as str, "IROM") => {
5483        "268435456"
5484    };
5485    ("DROM") => {
5486        0x40000000..0x50000000
5487    };
5488    (size as str, "DROM") => {
5489        "268435456"
5490    };
5491}
5492/// This macro can be used to generate code for each peripheral instance of the I2C master driver.
5493///
5494/// For an explanation on the general syntax, as well as usage of individual/repeated
5495/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
5496///
5497/// This macro has one option for its "Individual matcher" case:
5498///
5499/// Syntax: `($id:literal, $instance:ident, $sys:ident, $scl:ident, $sda:ident)`
5500///
5501/// Macro fragments:
5502/// - `$id`: the index of the I2C instance
5503/// - `$instance`: the name of the I2C instance
5504/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
5505/// - `$scl`, `$sda`: peripheral signal names.
5506///
5507/// Example data: `(0, I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)`
5508#[macro_export]
5509#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5510macro_rules! for_each_i2c_master {
5511    ($($pattern:tt => $code:tt;)*) => {
5512        macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
5513        => {} } _for_each_inner_i2c_master!((0, I2C0, I2c0, I2CEXT0_SCL, I2CEXT0_SDA));
5514        _for_each_inner_i2c_master!((1, I2C1, I2c1, I2CEXT1_SCL, I2CEXT1_SDA));
5515        _for_each_inner_i2c_master!((all(0, I2C0, I2c0, I2CEXT0_SCL, I2CEXT0_SDA), (1,
5516        I2C1, I2c1, I2CEXT1_SCL, I2CEXT1_SDA)));
5517    };
5518}
5519/// This macro can be used to generate code for each peripheral instance of the I2S driver.
5520///
5521/// For an explanation on the general syntax, as well as usage of individual/repeated
5522/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
5523///
5524/// This macro has one option for its "Individual matcher" case:
5525///
5526/// Syntax: `($instance:ident, $sys:ident, $mclk:ident, $bclk:ident, $ws:ident, $bclk_rx:ident,
5527/// $ws_rx:ident, [$($dout:ident),*], [$($din:ident),*], $pdm_tx:literal, $pdm_rx:literal,
5528/// $pcm2pdm:literal, $pdm2pcm:literal)`
5529///
5530/// Macro fragments:
5531///
5532/// - `$instance`: the name of the I2S instance
5533/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
5534/// - `$mclk`: the MCLK output signal (a placeholder on chips without a GPIO-matrix MCLK).
5535/// - `$bclk`, `$ws`: TX bit clock and word select output signals.
5536/// - `$bclk_rx`, `$ws_rx`: RX bit clock and word select output signals.
5537/// - `$dout`, `$din`: data-out and data-in signal names.
5538/// - `$pdm_tx`, `$pdm_rx`: whether the instance supports PDM TX/RX.
5539/// - `$pcm2pdm`, `$pdm2pcm`: whether the instance supports the hardware PCM<->PDM format conversion
5540///   filter on TX/RX.
5541///
5542/// Example data:
5543/// - `(I2S0, I2s0, I2S_MCLK, I2SO_BCK, I2SO_WS, I2SI_BCK, I2SI_WS, [I2SO_SD], [I2SI_SD], true,
5544///   true, true, true)`
5545#[macro_export]
5546#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5547macro_rules! for_each_i2s {
5548    ($($pattern:tt => $code:tt;)*) => {
5549        macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
5550        _for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S1));
5551        _for_each_inner_i2s!((I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
5552        I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
5553        true, true, true, true)); _for_each_inner_i2s!((I2S1, I2s1, I2S1_MCLK, I2S1O_BCK,
5554        I2S1O_WS, I2S1I_BCK, I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false,
5555        false)); _for_each_inner_i2s!((names(I2S0), (I2S1)));
5556        _for_each_inner_i2s!((all(I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
5557        I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
5558        true, true, true, true), (I2S1, I2s1, I2S1_MCLK, I2S1O_BCK, I2S1O_WS, I2S1I_BCK,
5559        I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false, false)));
5560    };
5561}
5562/// This macro can be used to generate code for each peripheral instance of the UART driver.
5563///
5564/// For an explanation on the general syntax, as well as usage of individual/repeated
5565/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
5566///
5567/// This macro has one option for its "Individual matcher" case:
5568///
5569/// Syntax: `($id:literal, $instance:ident, $sys:ident, $rx:ident, $tx:ident, $cts:ident,
5570/// $rts:ident)`
5571///
5572/// Macro fragments:
5573///
5574/// - `$id`: the index of the UART instance
5575/// - `$instance`: the name of the UART instance
5576/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
5577/// - `$rx`, `$tx`, `$cts`, `$rts`: signal names.
5578///
5579/// Example data: `(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS)`
5580#[macro_export]
5581#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5582macro_rules! for_each_uart {
5583    ($($pattern:tt => $code:tt;)*) => {
5584        macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
5585        } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
5586        wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
5587        U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((2, UART2, Uart2,
5588        U2RXD, U2TXD, U2CTS, U2RTS, wakeup_source = false)); _for_each_inner_uart!((3,
5589        UART3, Uart3, U3RXD, U3TXD, U3CTS, U3RTS, wakeup_source = false));
5590        _for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
5591        wakeup_source = true), (1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS,
5592        wakeup_source = true), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS,
5593        wakeup_source = false), (3, UART3, Uart3, U3RXD, U3TXD, U3CTS, U3RTS,
5594        wakeup_source = false)));
5595    };
5596}
5597/// This macro can be used to generate code for each peripheral instance of the SPI master driver.
5598///
5599/// For an explanation on the general syntax, as well as usage of individual/repeated
5600/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
5601///
5602/// This macro has one option for its "Individual matcher" case:
5603///
5604/// Syntax: `($instance:ident, $sys:ident, $sclk:ident [$($cs:ident),*] [$($sio:ident),*]
5605/// $($is_qspi:literal)?)`
5606///
5607/// Macro fragments:
5608///
5609/// - `$instance`: the name of the SPI instance
5610/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
5611/// - `$cs`, `$sio`: chip select and SIO signal names.
5612/// - `$is_qspi`: a `true` literal present if the SPI instance supports QSPI.
5613///
5614/// Example data:
5615/// - `(SPI2, Spi2, FSPICLK [FSPICS0, FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ,
5616///   FSPIWP, FSPIHD, FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7], true)`
5617/// - `(SPI3, Spi3, SPI3_CLK [SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q])`
5618#[macro_export]
5619#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5620macro_rules! for_each_spi_master {
5621    ($($pattern:tt => $code:tt;)*) => {
5622        macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
5623        => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
5624        _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
5625        FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
5626        FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
5627        SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD],
5628        true)); _for_each_inner_spi_master!((names(SPI2), (SPI3)));
5629        _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
5630        FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
5631        FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2]
5632        [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD], true)));
5633    };
5634}
5635/// This macro can be used to generate code for each peripheral instance of the SPI slave driver.
5636///
5637/// For an explanation on the general syntax, as well as usage of individual/repeated
5638/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
5639///
5640/// This macro has one option for its "Individual matcher" case:
5641///
5642/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, $mosi:ident, $miso:ident, $cs:ident)`
5643///
5644/// Macro fragments:
5645///
5646/// - `$instance`: the name of the SPI instance
5647/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
5648/// - `$sclk`, `$mosi`, `$miso`, `$cs`: signal names.
5649///
5650/// Example data: `(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)`
5651#[macro_export]
5652#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5653macro_rules! for_each_spi_slave {
5654    ($($pattern:tt => $code:tt;)*) => {
5655        macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
5656        => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
5657        _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
5658        _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS));
5659        _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
5660        _for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
5661        (SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS)));
5662    };
5663}
5664/// This macro can be used to generate code for each PCNT unit.
5665///
5666/// For an explanation on the general syntax, as well as usage of individual/repeated
5667/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
5668///
5669/// This macro has four options for its "Individual matcher" case:
5670///
5671/// - `names`: `($instance:ident)`
5672/// - `all`: `($peri:ident, $variant:ident, $sys:ident, $regs:ident, $unit:literal,
5673///   $interrupt:ident, $sig_ch0:ident, $sig_ch1:ident, $ctrl_ch0:ident, $ctrl_ch1:ident)`
5674/// - `interrupt`: `($interrupt:ident)` (repeated: one ident per unique IRQ)
5675/// - `regs`: `($regs:ident)` (repeated: one ident per register block)
5676///
5677/// Macro fragments:
5678///
5679/// - `$peri`: unit singleton name (`PCNT0_UNIT0`, `PCNT1_UNIT0`, …)
5680/// - `$variant`: `AnyPcntUnit` enum variant (`Pcnt0Unit0`, `Pcnt1Unit0`, …)
5681/// - `$sys`: `esp_hal::system::Peripheral` variant for clocks
5682/// - `$regs`: register-block singleton (`PCNT`, `PCNT1`)
5683/// - `$unit`: hardware unit index within that register block
5684/// - `$interrupt`: shared peripheral interrupt
5685/// - `$sig_ch0`, `$sig_ch1`, `$ctrl_ch0`, `$ctrl_ch1`: GPIO matrix input signals
5686#[macro_export]
5687#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5688macro_rules! for_each_pcnt_unit {
5689    ($($pattern:tt => $code:tt;)*) => {
5690        macro_rules! _for_each_inner_pcnt_unit { $(($pattern) => $code;)* ($other : tt)
5691        => {} } _for_each_inner_pcnt_unit!((PCNT0_UNIT0));
5692        _for_each_inner_pcnt_unit!((PCNT0_UNIT1));
5693        _for_each_inner_pcnt_unit!((PCNT0_UNIT2));
5694        _for_each_inner_pcnt_unit!((PCNT0_UNIT3));
5695        _for_each_inner_pcnt_unit!((PCNT1_UNIT0));
5696        _for_each_inner_pcnt_unit!((PCNT1_UNIT1));
5697        _for_each_inner_pcnt_unit!((PCNT1_UNIT2));
5698        _for_each_inner_pcnt_unit!((PCNT1_UNIT3));
5699        _for_each_inner_pcnt_unit!((PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT0,
5700        PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1));
5701        _for_each_inner_pcnt_unit!((PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT0,
5702        PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0, PCNT1_CTRL_CH1));
5703        _for_each_inner_pcnt_unit!((PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT0,
5704        PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1));
5705        _for_each_inner_pcnt_unit!((PCNT0_UNIT3, Pcnt0Unit3, Pcnt, PCNT, 3, PCNT0,
5706        PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1));
5707        _for_each_inner_pcnt_unit!((PCNT1_UNIT0, Pcnt1Unit0, Pcnt1, PCNT1, 0, PCNT1,
5708        PCNT1_U0_SIG_CH0, PCNT1_U0_SIG_CH1, PCNT1_U0_CTRL_CH0, PCNT1_U0_CTRL_CH1));
5709        _for_each_inner_pcnt_unit!((PCNT1_UNIT1, Pcnt1Unit1, Pcnt1, PCNT1, 1, PCNT1,
5710        PCNT1_U1_SIG_CH0, PCNT1_U1_SIG_CH1, PCNT1_U1_CTRL_CH0, PCNT1_U1_CTRL_CH1));
5711        _for_each_inner_pcnt_unit!((PCNT1_UNIT2, Pcnt1Unit2, Pcnt1, PCNT1, 2, PCNT1,
5712        PCNT1_U2_SIG_CH0, PCNT1_U2_SIG_CH1, PCNT1_U2_CTRL_CH0, PCNT1_U2_CTRL_CH1));
5713        _for_each_inner_pcnt_unit!((PCNT1_UNIT3, Pcnt1Unit3, Pcnt1, PCNT1, 3, PCNT1,
5714        PCNT1_U3_SIG_CH0, PCNT1_U3_SIG_CH1, PCNT1_U3_CTRL_CH0, PCNT1_U3_CTRL_CH1));
5715        _for_each_inner_pcnt_unit!((PCNT0)); _for_each_inner_pcnt_unit!((PCNT1));
5716        _for_each_inner_pcnt_unit!((PCNT)); _for_each_inner_pcnt_unit!((PCNT1));
5717        _for_each_inner_pcnt_unit!((names(PCNT0_UNIT0), (PCNT0_UNIT1), (PCNT0_UNIT2),
5718        (PCNT0_UNIT3), (PCNT1_UNIT0), (PCNT1_UNIT1), (PCNT1_UNIT2), (PCNT1_UNIT3)));
5719        _for_each_inner_pcnt_unit!((all(PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT0,
5720        PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1), (PCNT0_UNIT1,
5721        Pcnt0Unit1, Pcnt, PCNT, 1, PCNT0, PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0,
5722        PCNT1_CTRL_CH1), (PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT0, PCNT2_SIG_CH0,
5723        PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1), (PCNT0_UNIT3, Pcnt0Unit3, Pcnt,
5724        PCNT, 3, PCNT0, PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1),
5725        (PCNT1_UNIT0, Pcnt1Unit0, Pcnt1, PCNT1, 0, PCNT1, PCNT1_U0_SIG_CH0,
5726        PCNT1_U0_SIG_CH1, PCNT1_U0_CTRL_CH0, PCNT1_U0_CTRL_CH1), (PCNT1_UNIT1,
5727        Pcnt1Unit1, Pcnt1, PCNT1, 1, PCNT1, PCNT1_U1_SIG_CH0, PCNT1_U1_SIG_CH1,
5728        PCNT1_U1_CTRL_CH0, PCNT1_U1_CTRL_CH1), (PCNT1_UNIT2, Pcnt1Unit2, Pcnt1, PCNT1, 2,
5729        PCNT1, PCNT1_U2_SIG_CH0, PCNT1_U2_SIG_CH1, PCNT1_U2_CTRL_CH0, PCNT1_U2_CTRL_CH1),
5730        (PCNT1_UNIT3, Pcnt1Unit3, Pcnt1, PCNT1, 3, PCNT1, PCNT1_U3_SIG_CH0,
5731        PCNT1_U3_SIG_CH1, PCNT1_U3_CTRL_CH0, PCNT1_U3_CTRL_CH1)));
5732        _for_each_inner_pcnt_unit!((interrupt(PCNT0), (PCNT1)));
5733        _for_each_inner_pcnt_unit!((regs(PCNT), (PCNT1)));
5734    };
5735}
5736#[macro_export]
5737#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5738macro_rules! for_each_peripheral {
5739    ($($pattern:tt => $code:tt;)*) => {
5740        macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
5741        => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
5742        "GPIO0 peripheral singleton"] GPIO0 <= virtual()));
5743        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
5744        GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5745        "GPIO2 peripheral singleton"] GPIO2 <= virtual()));
5746        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO3 peripheral singleton"]
5747        GPIO3 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5748        "GPIO4 peripheral singleton"] GPIO4 <= virtual()));
5749        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO5 peripheral singleton"]
5750        GPIO5 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5751        "GPIO6 peripheral singleton"] GPIO6 <= virtual()));
5752        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO7 peripheral singleton"]
5753        GPIO7 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5754        "GPIO8 peripheral singleton"] GPIO8 <= virtual()));
5755        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO9 peripheral singleton"]
5756        GPIO9 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5757        "GPIO10 peripheral singleton"] GPIO10 <= virtual()));
5758        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO11 peripheral singleton"]
5759        GPIO11 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5760        "GPIO12 peripheral singleton"] GPIO12 <= virtual()));
5761        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO13 peripheral singleton"]
5762        GPIO13 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5763        "GPIO14 peripheral singleton"] GPIO14 <= virtual()));
5764        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO15 peripheral singleton"]
5765        GPIO15 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5766        "GPIO16 peripheral singleton"] GPIO16 <= virtual()));
5767        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO17 peripheral singleton"]
5768        GPIO17 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5769        "GPIO18 peripheral singleton"] GPIO18 <= virtual()));
5770        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO19 peripheral singleton"]
5771        GPIO19 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5772        "GPIO20 peripheral singleton"] GPIO20 <= virtual()));
5773        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO21 peripheral singleton"]
5774        GPIO21 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5775        "GPIO22 peripheral singleton"] GPIO22 <= virtual()));
5776        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO23 peripheral singleton"]
5777        GPIO23 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5778        "GPIO24 peripheral singleton"] GPIO24 <= virtual()));
5779        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO25 peripheral singleton"]
5780        GPIO25 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5781        "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5782        "<section class=\"warning\">"] #[doc =
5783        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5784        #[doc = "<ul>"] #[doc =
5785        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5786        "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
5787        _for_each_inner_peripheral!((@ peri_type #[doc =
5788        "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5789        "<section class=\"warning\">"] #[doc =
5790        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5791        #[doc = "<ul>"] #[doc =
5792        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5793        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5794        = "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
5795        _for_each_inner_peripheral!((@ peri_type #[doc =
5796        "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5797        "<section class=\"warning\">"] #[doc =
5798        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5799        #[doc = "<ul>"] #[doc =
5800        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5801        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5802        = "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
5803        _for_each_inner_peripheral!((@ peri_type #[doc =
5804        "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5805        "<section class=\"warning\">"] #[doc =
5806        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5807        #[doc = "<ul>"] #[doc =
5808        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5809        "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
5810        _for_each_inner_peripheral!((@ peri_type #[doc =
5811        "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5812        "<section class=\"warning\">"] #[doc =
5813        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5814        #[doc = "<ul>"] #[doc =
5815        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5816        "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
5817        _for_each_inner_peripheral!((@ peri_type #[doc =
5818        "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5819        "<section class=\"warning\">"] #[doc =
5820        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5821        #[doc = "<ul>"] #[doc =
5822        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5823        "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
5824        _for_each_inner_peripheral!((@ peri_type #[doc =
5825        "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5826        "<section class=\"warning\">"] #[doc =
5827        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5828        #[doc = "<ul>"] #[doc =
5829        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5830        #[doc = "</section>"] GPIO33 <= virtual())); _for_each_inner_peripheral!((@
5831        peri_type #[doc = "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""]
5832        #[doc = "<section class=\"warning\">"] #[doc =
5833        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5834        #[doc = "<ul>"] #[doc =
5835        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5836        #[doc = "</section>"] GPIO34 <= virtual())); _for_each_inner_peripheral!((@
5837        peri_type #[doc = "GPIO35 peripheral singleton"] GPIO35 <= virtual()));
5838        _for_each_inner_peripheral!((@ peri_type #[doc =
5839        "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5840        "<section class=\"warning\">"] #[doc =
5841        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5842        #[doc = "<ul>"] #[doc =
5843        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5844        = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
5845        _for_each_inner_peripheral!((@ peri_type #[doc =
5846        "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5847        "<section class=\"warning\">"] #[doc =
5848        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5849        #[doc = "<ul>"] #[doc =
5850        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5851        = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
5852        _for_each_inner_peripheral!((@ peri_type #[doc =
5853        "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5854        "<section class=\"warning\">"] #[doc =
5855        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5856        #[doc = "<ul>"] #[doc =
5857        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5858        = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()));
5859        _for_each_inner_peripheral!((@ peri_type #[doc =
5860        "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5861        "<section class=\"warning\">"] #[doc =
5862        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5863        #[doc = "<ul>"] #[doc =
5864        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5865        = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
5866        _for_each_inner_peripheral!((@ peri_type #[doc =
5867        "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5868        "<section class=\"warning\">"] #[doc =
5869        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5870        #[doc = "<ul>"] #[doc =
5871        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5872        = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
5873        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO42 peripheral singleton"]
5874        GPIO42 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5875        "GPIO43 peripheral singleton"] GPIO43 <= virtual()));
5876        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO44 peripheral singleton"]
5877        GPIO44 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5878        "GPIO45 peripheral singleton"] GPIO45 <= virtual()));
5879        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO46 peripheral singleton"]
5880        GPIO46 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5881        "GPIO47 peripheral singleton"] GPIO47 <= virtual()));
5882        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO48 peripheral singleton"]
5883        GPIO48 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5884        "GPIO49 peripheral singleton"] GPIO49 <= virtual()));
5885        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO50 peripheral singleton"]
5886        GPIO50 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5887        "GPIO51 peripheral singleton"] GPIO51 <= virtual()));
5888        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO52 peripheral singleton"]
5889        GPIO52 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5890        "GPIO53 peripheral singleton"] GPIO53 <= virtual()));
5891        _for_each_inner_peripheral!((@ peri_type #[doc =
5892        "GPIO54 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5893        "<section class=\"warning\">"] #[doc =
5894        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5895        #[doc = "<ul>"] #[doc =
5896        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5897        #[doc = "</ul>"] #[doc = "</section>"] GPIO54 <= virtual()));
5898        _for_each_inner_peripheral!((@ peri_type #[doc =
5899        "GPIO55 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5900        "<section class=\"warning\">"] #[doc =
5901        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5902        #[doc = "<ul>"] #[doc =
5903        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5904        #[doc = "</ul>"] #[doc = "</section>"] GPIO55 <= virtual()));
5905        _for_each_inner_peripheral!((@ peri_type #[doc =
5906        "GPIO56 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5907        "<section class=\"warning\">"] #[doc =
5908        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5909        #[doc = "<ul>"] #[doc =
5910        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5911        #[doc = "</ul>"] #[doc = "</section>"] GPIO56 <= virtual()));
5912        _for_each_inner_peripheral!((@ peri_type #[doc =
5913        "GPIO57 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5914        "<section class=\"warning\">"] #[doc =
5915        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5916        #[doc = "<ul>"] #[doc =
5917        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5918        #[doc = "</ul>"] #[doc = "</section>"] GPIO57 <= virtual()));
5919        _for_each_inner_peripheral!((@ peri_type #[doc =
5920        "GPIO58 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5921        "<section class=\"warning\">"] #[doc =
5922        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5923        #[doc = "<ul>"] #[doc =
5924        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5925        = "</ul>"] #[doc = "</section>"] GPIO58 <= virtual()));
5926        _for_each_inner_peripheral!((@ peri_type #[doc =
5927        "GPIO59 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5928        "<section class=\"warning\">"] #[doc =
5929        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5930        #[doc = "<ul>"] #[doc =
5931        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5932        = "</ul>"] #[doc = "</section>"] GPIO59 <= virtual()));
5933        _for_each_inner_peripheral!((@ peri_type #[doc =
5934        "GPIO60 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5935        "<section class=\"warning\">"] #[doc =
5936        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5937        #[doc = "<ul>"] #[doc =
5938        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5939        = "</ul>"] #[doc = "</section>"] GPIO60 <= virtual()));
5940        _for_each_inner_peripheral!((@ peri_type #[doc =
5941        "GPIO61 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5942        "<section class=\"warning\">"] #[doc =
5943        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5944        #[doc = "<ul>"] #[doc =
5945        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5946        = "</ul>"] #[doc = "</section>"] GPIO61 <= virtual()));
5947        _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
5948        DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : { bind_dma_in_interrupt,
5949        enable_dma_in_interrupt, disable_dma_in_interrupt }, AHB_PDMA_OUT_CH0 : {
5950        bind_dma_out_interrupt, enable_dma_out_interrupt, disable_dma_out_interrupt })
5951        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5952        "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
5953        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5954        AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5955        disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
5956        peri_type #[doc = "DMA_CH2 peripheral singleton"] DMA_CH2 <=
5957        virtual(AHB_PDMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5958        disable_dma_in_interrupt }, AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt,
5959        enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5960        _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH3 peripheral singleton"]
5961        DMA_CH3 <= virtual(AHB_PDMA_IN_CH3 : { bind_dma_in_interrupt,
5962        enable_dma_in_interrupt, disable_dma_in_interrupt }, AHB_PDMA_OUT_CH3 : {
5963        bind_dma_out_interrupt, enable_dma_out_interrupt, disable_dma_out_interrupt })
5964        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5965        "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(AHB_PDMA_IN_CH4 : {
5966        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5967        AHB_PDMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5968        disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
5969        peri_type #[doc = "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <=
5970        virtual(AXI_PDMA_IN_CH0 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5971        disable_dma_in_interrupt }, AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt,
5972        enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5973        _for_each_inner_peripheral!((@ peri_type #[doc =
5974        "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <= virtual(AXI_PDMA_IN_CH1 : {
5975        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5976        AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5977        disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
5978        peri_type #[doc = "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <=
5979        virtual(AXI_PDMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5980        disable_dma_in_interrupt }, AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt,
5981        enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5982        _for_each_inner_peripheral!((@ peri_type #[doc =
5983        "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)));
5984        _for_each_inner_peripheral!((@ peri_type #[doc =
5985        "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual() (unstable)));
5986        _for_each_inner_peripheral!((@ peri_type #[doc =
5987        "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)));
5988        _for_each_inner_peripheral!((@ peri_type #[doc =
5989        "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)));
5990        _for_each_inner_peripheral!((@ peri_type #[doc =
5991        "PCNT1_UNIT0 peripheral singleton"] PCNT1_UNIT0 <= virtual() (unstable)));
5992        _for_each_inner_peripheral!((@ peri_type #[doc =
5993        "PCNT1_UNIT1 peripheral singleton"] PCNT1_UNIT1 <= virtual() (unstable)));
5994        _for_each_inner_peripheral!((@ peri_type #[doc =
5995        "PCNT1_UNIT2 peripheral singleton"] PCNT1_UNIT2 <= virtual() (unstable)));
5996        _for_each_inner_peripheral!((@ peri_type #[doc =
5997        "PCNT1_UNIT3 peripheral singleton"] PCNT1_UNIT3 <= virtual() (unstable)));
5998        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
5999        SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6000        = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
6001        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
6002        SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6003        = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
6004        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
6005        SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6006        = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
6007        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
6008        SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6009        = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
6010        _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
6011        <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
6012        }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6013        "APB_SARADC peripheral singleton"] APB_SARADC <= ADC() (unstable)));
6014        _for_each_inner_peripheral!((@ peri_type #[doc =
6015        "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
6016        _for_each_inner_peripheral!((@ peri_type #[doc = "CACHE peripheral singleton"]
6017        CACHE <= CACHE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6018        "CLIC peripheral singleton"] CLIC <= CLIC() (unstable)));
6019        _for_each_inner_peripheral!((@ peri_type #[doc = "CLINT peripheral singleton"]
6020        CLINT <= CLINT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6021        "CLINT_OTHER_CORE peripheral singleton"] CLINT_OTHER_CORE <= CLINT_OTHER_CORE()
6022        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6023        "CNNT_SYS peripheral singleton"] CNNT_SYS <= CNNT_SYS() (unstable)));
6024        _for_each_inner_peripheral!((@ peri_type #[doc =
6025        "CNNT_IO_MUX peripheral singleton"] CNNT_IO_MUX <= CNNT_IO_MUX() (unstable)));
6026        _for_each_inner_peripheral!((@ peri_type #[doc = "ETH peripheral singleton"] ETH
6027        <= virtual(SBD : { bind_peri_interrupt, enable_peri_interrupt,
6028        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6029        #[doc = "EMAC_DMA peripheral singleton"] EMAC_DMA <= GMAC_DMA() (unstable)));
6030        _for_each_inner_peripheral!((@ peri_type #[doc = "EMAC_MAC peripheral singleton"]
6031        EMAC_MAC <= GMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6032        "ECC peripheral singleton"] ECC <= ECC() (unstable)));
6033        _for_each_inner_peripheral!((@ peri_type #[doc = "EFUSE peripheral singleton"]
6034        EFUSE <= EFUSE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6035        "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)));
6036        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO_SD peripheral singleton"]
6037        GPIO_SD <= GPIO_EXT() (unstable))); _for_each_inner_peripheral!((@ peri_type
6038        #[doc = "HP_APM peripheral singleton"] HP_APM <= HP_APM() (unstable)));
6039        _for_each_inner_peripheral!((@ peri_type #[doc =
6040        "HP_MEM_APM peripheral singleton"] HP_MEM_APM <= HP_MEM_APM() (unstable)));
6041        _for_each_inner_peripheral!((@ peri_type #[doc = "HP_SYS peripheral singleton"]
6042        HP_SYS <= HP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6043        "HP_ALIVE_SYS peripheral singleton"] HP_ALIVE_SYS <= HP_ALIVE_SYS() (unstable)));
6044        _for_each_inner_peripheral!((@ peri_type #[doc =
6045        "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
6046        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6047        "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0 : { bind_peri_interrupt,
6048        enable_peri_interrupt, disable_peri_interrupt })));
6049        _for_each_inner_peripheral!((@ peri_type #[doc = "I2C1 peripheral singleton"]
6050        I2C1 <= I2C1(I2C1 : { bind_peri_interrupt, enable_peri_interrupt,
6051        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6052        "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
6053        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6054        _for_each_inner_peripheral!((@ peri_type #[doc = "I2S1 peripheral singleton"]
6055        I2S1 <= I2S1(I2S1 : { bind_peri_interrupt, enable_peri_interrupt,
6056        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6057        #[doc = "IEEE802154 peripheral singleton"] IEEE802154 <= IEEE802154(MODEM_ZB_MAC
6058        : { bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt })
6059        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6060        "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
6061        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6062        "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
6063        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6064        "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
6065        _for_each_inner_peripheral!((@ peri_type #[doc = "LCD_CAM peripheral singleton"]
6066        LCD_CAM <= LCD_CAM(LCD_CAM : { bind_peri_interrupt, enable_peri_interrupt,
6067        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6068        #[doc = "IOMUX_MSPI_PIN peripheral singleton"] IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN()
6069        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6070        "LP_AON_CLK_RST peripheral singleton"] LP_AON_CLK_RST <= LP_AON_CLKRST()
6071        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6072        "LP_APM peripheral singleton"] LP_APM <= LP_APM() (unstable)));
6073        _for_each_inner_peripheral!((@ peri_type #[doc = "LP_GPIO peripheral singleton"]
6074        LP_GPIO <= LP_GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6075        = "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)));
6076        _for_each_inner_peripheral!((@ peri_type #[doc = "LP_PERI peripheral singleton"]
6077        LP_PERI <= LP_PERICLKRST() (unstable))); _for_each_inner_peripheral!((@ peri_type
6078        #[doc = "LP_SYS peripheral singleton"] LP_SYS <= LP_SYS() (unstable)));
6079        _for_each_inner_peripheral!((@ peri_type #[doc = "LP_TEE peripheral singleton"]
6080        LP_TEE <= LP_TEE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6081        "LP_WDT peripheral singleton"] LP_WDT <= LP_WDT() (unstable)));
6082        _for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
6083        LPWR <= PMU() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6084        "MEM_MONITOR peripheral singleton"] MEM_MONITOR <= MEM_MONITOR0() (unstable)));
6085        _for_each_inner_peripheral!((@ peri_type #[doc =
6086        "MODEM_LPCON peripheral singleton"] MODEM_LPCON <= MODEM_LPCON() (unstable)));
6087        _for_each_inner_peripheral!((@ peri_type #[doc =
6088        "MODEM_SYSCON peripheral singleton"] MODEM_SYSCON <= MODEM_SYSCON() (unstable)));
6089        _for_each_inner_peripheral!((@ peri_type #[doc = "PAU peripheral singleton"] PAU
6090        <= PAU() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6091        "PCNT peripheral singleton"] PCNT <= PCNT(PCNT0 : { bind_peri_interrupt,
6092        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6093        _for_each_inner_peripheral!((@ peri_type #[doc = "PCNT1 peripheral singleton"]
6094        PCNT1 <= PCNT1(PCNT1 : { bind_peri_interrupt, enable_peri_interrupt,
6095        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6096        #[doc = "PMU peripheral singleton"] PMU <= PMU() (unstable)));
6097        _for_each_inner_peripheral!((@ peri_type #[doc =
6098        "RTC_TIMER peripheral singleton"] RTC_TIMER <= LP_TIMER() (unstable)));
6099        _for_each_inner_peripheral!((@ peri_type #[doc = "RNG peripheral singleton"] RNG
6100        <= TRNG() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6101        "RMT peripheral singleton"] RMT <= RMT(RMT : { bind_peri_interrupt,
6102        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6103        _for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
6104        <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
6105        }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6106        "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
6107        _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
6108        SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6109        "MEMSPI2 peripheral singleton"] MEMSPI2 <= MEMSPI2() (unstable)));
6110        _for_each_inner_peripheral!((@ peri_type #[doc = "MEMSPI3 peripheral singleton"]
6111        MEMSPI3 <= MEMSPI3() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6112        = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
6113        enable_peri_interrupt, disable_peri_interrupt })));
6114        _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
6115        SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
6116        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6117        "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)));
6118        _for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
6119        <= AHB_DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6120        "SHA peripheral singleton"] SHA <= SHA() (unstable)));
6121        _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTEM peripheral singleton"]
6122        SYSTEM <= HP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6123        "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER() (unstable)));
6124        _for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
6125        SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6126        "TEE peripheral singleton"] TEE <= TEE() (unstable)));
6127        _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG0 peripheral singleton"]
6128        TIMG0 <= TIMG0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6129        "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)));
6130        _for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
6131        UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
6132        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6133        "UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
6134        enable_peri_interrupt, disable_peri_interrupt })));
6135        _for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
6136        UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
6137        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6138        "UART3 peripheral singleton"] UART3 <= UART3(UART3 : { bind_peri_interrupt,
6139        enable_peri_interrupt, disable_peri_interrupt })));
6140        _for_each_inner_peripheral!((@ peri_type #[doc = "UHCI0 peripheral singleton"]
6141        UHCI0 <= UHCI0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6142        "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
6143        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6144        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6145        "USB_HS peripheral singleton"] USB_HS <= USB_OTG_HS(USB_OTG_HS : {
6146        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6147        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6148        "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)));
6149        _for_each_inner_peripheral!((@ peri_type #[doc = "ADC2 peripheral singleton"]
6150        ADC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6151        "FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
6152        _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
6153        PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6154        "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
6155        _for_each_inner_peripheral!((@ peri_type #[doc = "WIFI peripheral singleton"]
6156        WIFI <= virtual(MODEM_WIFI_BB : { bind_bb_interrupt, enable_bb_interrupt,
6157        disable_bb_interrupt }, MODEM_WIFI_MAC : { bind_mac_interrupt,
6158        enable_mac_interrupt, disable_mac_interrupt }, MODEM_WIFI_PWR : {
6159        bind_pwr_interrupt, enable_pwr_interrupt, disable_pwr_interrupt })));
6160        _for_each_inner_peripheral!((@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
6161        CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
6162        #[doc = "IPC peripheral singleton"] IPC <= virtual() (unstable)));
6163        _for_each_inner_peripheral!((@ peri_type #[doc =
6164        "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)));
6165        _for_each_inner_peripheral!((@ peri_type #[doc =
6166        "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
6167        _for_each_inner_peripheral!((@ peri_type #[doc =
6168        "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
6169        _for_each_inner_peripheral!((@ peri_type #[doc =
6170        "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
6171        _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO0));
6172        _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO1));
6173        _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
6174        _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
6175        _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
6176        _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
6177        _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
6178        _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
6179        _for_each_inner_peripheral!((GPIO14)); _for_each_inner_peripheral!((GPIO15));
6180        _for_each_inner_peripheral!((GPIO16)); _for_each_inner_peripheral!((GPIO17));
6181        _for_each_inner_peripheral!((GPIO18)); _for_each_inner_peripheral!((GPIO19));
6182        _for_each_inner_peripheral!((GPIO20)); _for_each_inner_peripheral!((GPIO21));
6183        _for_each_inner_peripheral!((GPIO22)); _for_each_inner_peripheral!((GPIO23));
6184        _for_each_inner_peripheral!((GPIO24)); _for_each_inner_peripheral!((GPIO25));
6185        _for_each_inner_peripheral!((GPIO26)); _for_each_inner_peripheral!((GPIO27));
6186        _for_each_inner_peripheral!((GPIO28)); _for_each_inner_peripheral!((GPIO30));
6187        _for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
6188        _for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
6189        _for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
6190        _for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
6191        _for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
6192        _for_each_inner_peripheral!((GPIO42)); _for_each_inner_peripheral!((GPIO43));
6193        _for_each_inner_peripheral!((GPIO44)); _for_each_inner_peripheral!((GPIO45));
6194        _for_each_inner_peripheral!((GPIO46)); _for_each_inner_peripheral!((GPIO47));
6195        _for_each_inner_peripheral!((GPIO48)); _for_each_inner_peripheral!((GPIO49));
6196        _for_each_inner_peripheral!((GPIO50)); _for_each_inner_peripheral!((GPIO51));
6197        _for_each_inner_peripheral!((GPIO52)); _for_each_inner_peripheral!((GPIO53));
6198        _for_each_inner_peripheral!((GPIO54)); _for_each_inner_peripheral!((GPIO55));
6199        _for_each_inner_peripheral!((GPIO56)); _for_each_inner_peripheral!((GPIO57));
6200        _for_each_inner_peripheral!((GPIO58)); _for_each_inner_peripheral!((GPIO59));
6201        _for_each_inner_peripheral!((GPIO60)); _for_each_inner_peripheral!((GPIO61));
6202        _for_each_inner_peripheral!((DMA_CH0(unstable)));
6203        _for_each_inner_peripheral!((DMA_CH1(unstable)));
6204        _for_each_inner_peripheral!((DMA_CH2(unstable)));
6205        _for_each_inner_peripheral!((DMA_CH3(unstable)));
6206        _for_each_inner_peripheral!((DMA_CH4(unstable)));
6207        _for_each_inner_peripheral!((DMA_AXI_CH0(unstable)));
6208        _for_each_inner_peripheral!((DMA_AXI_CH1(unstable)));
6209        _for_each_inner_peripheral!((DMA_AXI_CH2(unstable)));
6210        _for_each_inner_peripheral!((PCNT0_UNIT0(unstable)));
6211        _for_each_inner_peripheral!((PCNT0_UNIT1(unstable)));
6212        _for_each_inner_peripheral!((PCNT0_UNIT2(unstable)));
6213        _for_each_inner_peripheral!((PCNT0_UNIT3(unstable)));
6214        _for_each_inner_peripheral!((PCNT1_UNIT0(unstable)));
6215        _for_each_inner_peripheral!((PCNT1_UNIT1(unstable)));
6216        _for_each_inner_peripheral!((PCNT1_UNIT2(unstable)));
6217        _for_each_inner_peripheral!((PCNT1_UNIT3(unstable)));
6218        _for_each_inner_peripheral!((SDM_CH0(unstable)));
6219        _for_each_inner_peripheral!((SDM_CH1(unstable)));
6220        _for_each_inner_peripheral!((SDM_CH2(unstable)));
6221        _for_each_inner_peripheral!((SDM_CH3(unstable)));
6222        _for_each_inner_peripheral!((SDM_CH4(unstable)));
6223        _for_each_inner_peripheral!((SDM_CH5(unstable)));
6224        _for_each_inner_peripheral!((SDM_CH6(unstable)));
6225        _for_each_inner_peripheral!((SDM_CH7(unstable)));
6226        _for_each_inner_peripheral!((AES(unstable)));
6227        _for_each_inner_peripheral!((APB_SARADC(unstable)));
6228        _for_each_inner_peripheral!((ASSIST_DEBUG(unstable)));
6229        _for_each_inner_peripheral!((CACHE(unstable)));
6230        _for_each_inner_peripheral!((CLIC(unstable)));
6231        _for_each_inner_peripheral!((CLINT(unstable)));
6232        _for_each_inner_peripheral!((CLINT_OTHER_CORE(unstable)));
6233        _for_each_inner_peripheral!((ETH(unstable)));
6234        _for_each_inner_peripheral!((ECC(unstable)));
6235        _for_each_inner_peripheral!((GPIO(unstable)));
6236        _for_each_inner_peripheral!((GPIO_SD(unstable)));
6237        _for_each_inner_peripheral!((HP_APM(unstable)));
6238        _for_each_inner_peripheral!((HP_MEM_APM(unstable)));
6239        _for_each_inner_peripheral!((HP_SYS(unstable)));
6240        _for_each_inner_peripheral!((HP_ALIVE_SYS(unstable)));
6241        _for_each_inner_peripheral!((HP_SYS_CLKRST(unstable)));
6242        _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
6243        _for_each_inner_peripheral!((I2S0(unstable)));
6244        _for_each_inner_peripheral!((I2S1(unstable)));
6245        _for_each_inner_peripheral!((IEEE802154(unstable)));
6246        _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
6247        _for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
6248        _for_each_inner_peripheral!((IO_MUX(unstable)));
6249        _for_each_inner_peripheral!((LCD_CAM(unstable)));
6250        _for_each_inner_peripheral!((LP_AON_CLK_RST(unstable)));
6251        _for_each_inner_peripheral!((LP_APM(unstable)));
6252        _for_each_inner_peripheral!((LP_GPIO(unstable)));
6253        _for_each_inner_peripheral!((LP_IO_MUX(unstable)));
6254        _for_each_inner_peripheral!((LP_PERI(unstable)));
6255        _for_each_inner_peripheral!((LP_SYS(unstable)));
6256        _for_each_inner_peripheral!((LP_TEE(unstable)));
6257        _for_each_inner_peripheral!((LP_WDT(unstable)));
6258        _for_each_inner_peripheral!((LPWR(unstable)));
6259        _for_each_inner_peripheral!((MEM_MONITOR(unstable)));
6260        _for_each_inner_peripheral!((MODEM_LPCON(unstable)));
6261        _for_each_inner_peripheral!((MODEM_SYSCON(unstable)));
6262        _for_each_inner_peripheral!((PAU(unstable)));
6263        _for_each_inner_peripheral!((PCNT(unstable)));
6264        _for_each_inner_peripheral!((PCNT1(unstable)));
6265        _for_each_inner_peripheral!((PMU(unstable)));
6266        _for_each_inner_peripheral!((RTC_TIMER(unstable)));
6267        _for_each_inner_peripheral!((RNG(unstable)));
6268        _for_each_inner_peripheral!((RMT(unstable)));
6269        _for_each_inner_peripheral!((RSA(unstable)));
6270        _for_each_inner_peripheral!((SPI0(unstable)));
6271        _for_each_inner_peripheral!((SPI1(unstable)));
6272        _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
6273        _for_each_inner_peripheral!((AXI_GDMA(unstable)));
6274        _for_each_inner_peripheral!((DMA(unstable)));
6275        _for_each_inner_peripheral!((SHA(unstable)));
6276        _for_each_inner_peripheral!((SYSTEM(unstable)));
6277        _for_each_inner_peripheral!((SYSTIMER(unstable)));
6278        _for_each_inner_peripheral!((SDHOST(unstable)));
6279        _for_each_inner_peripheral!((TEE(unstable)));
6280        _for_each_inner_peripheral!((TIMG0(unstable)));
6281        _for_each_inner_peripheral!((TIMG1(unstable)));
6282        _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
6283        _for_each_inner_peripheral!((UART2)); _for_each_inner_peripheral!((UART3));
6284        _for_each_inner_peripheral!((UHCI0(unstable)));
6285        _for_each_inner_peripheral!((USB_DEVICE(unstable)));
6286        _for_each_inner_peripheral!((USB_HS(unstable)));
6287        _for_each_inner_peripheral!((ADC1(unstable)));
6288        _for_each_inner_peripheral!((ADC2(unstable)));
6289        _for_each_inner_peripheral!((FLASH(unstable)));
6290        _for_each_inner_peripheral!((PSRAM(unstable)));
6291        _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
6292        _for_each_inner_peripheral!((WIFI));
6293        _for_each_inner_peripheral!((CPU_CTRL(unstable)));
6294        _for_each_inner_peripheral!((IPC(unstable)));
6295        _for_each_inner_peripheral!((FROM_CPU_INTR0(unstable)));
6296        _for_each_inner_peripheral!((FROM_CPU_INTR1(unstable)));
6297        _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
6298        _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
6299        _for_each_inner_peripheral!((UHCI0, Uhci0, 0, AhbGdmaChannel));
6300        _for_each_inner_peripheral!((LCD_CAM, LcdCam, 0, AxiGdmaChannel));
6301        _for_each_inner_peripheral!((I2S0, I2s0, 1, AhbGdmaChannel));
6302        _for_each_inner_peripheral!((SPI2, Spi2, 1, AxiGdmaChannel));
6303        _for_each_inner_peripheral!((SPI3, Spi3, 2, AxiGdmaChannel));
6304        _for_each_inner_peripheral!((AES, Aes, 4, AxiGdmaChannel));
6305        _for_each_inner_peripheral!((I2S1, I2s1, 5, AhbGdmaChannel));
6306        _for_each_inner_peripheral!((SHA, Sha, 5, AxiGdmaChannel));
6307        _for_each_inner_peripheral!((all(@ peri_type #[doc =
6308        "GPIO0 peripheral singleton"] GPIO0 <= virtual()), (@ peri_type #[doc =
6309        "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
6310        "GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
6311        "GPIO3 peripheral singleton"] GPIO3 <= virtual()), (@ peri_type #[doc =
6312        "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
6313        "GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
6314        "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
6315        "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
6316        "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
6317        "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
6318        "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
6319        "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
6320        "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
6321        "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
6322        "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
6323        "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
6324        "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
6325        "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
6326        "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
6327        "GPIO19 peripheral singleton"] GPIO19 <= virtual()), (@ peri_type #[doc =
6328        "GPIO20 peripheral singleton"] GPIO20 <= virtual()), (@ peri_type #[doc =
6329        "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
6330        "GPIO22 peripheral singleton"] GPIO22 <= virtual()), (@ peri_type #[doc =
6331        "GPIO23 peripheral singleton"] GPIO23 <= virtual()), (@ peri_type #[doc =
6332        "GPIO24 peripheral singleton"] GPIO24 <= virtual()), (@ peri_type #[doc =
6333        "GPIO25 peripheral singleton"] GPIO25 <= virtual()), (@ peri_type #[doc =
6334        "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6335        "<section class=\"warning\">"] #[doc =
6336        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6337        #[doc = "<ul>"] #[doc =
6338        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6339        "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
6340        "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6341        "<section class=\"warning\">"] #[doc =
6342        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6343        #[doc = "<ul>"] #[doc =
6344        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6345        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6346        = "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
6347        "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6348        "<section class=\"warning\">"] #[doc =
6349        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6350        #[doc = "<ul>"] #[doc =
6351        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6352        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6353        = "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
6354        "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6355        "<section class=\"warning\">"] #[doc =
6356        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6357        #[doc = "<ul>"] #[doc =
6358        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6359        "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
6360        "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6361        "<section class=\"warning\">"] #[doc =
6362        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6363        #[doc = "<ul>"] #[doc =
6364        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6365        "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
6366        "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6367        "<section class=\"warning\">"] #[doc =
6368        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6369        #[doc = "<ul>"] #[doc =
6370        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6371        "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
6372        "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6373        "<section class=\"warning\">"] #[doc =
6374        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6375        #[doc = "<ul>"] #[doc =
6376        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6377        #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
6378        "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6379        "<section class=\"warning\">"] #[doc =
6380        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6381        #[doc = "<ul>"] #[doc =
6382        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6383        #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
6384        "GPIO35 peripheral singleton"] GPIO35 <= virtual()), (@ peri_type #[doc =
6385        "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6386        "<section class=\"warning\">"] #[doc =
6387        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6388        #[doc = "<ul>"] #[doc =
6389        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6390        = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
6391        "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6392        "<section class=\"warning\">"] #[doc =
6393        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6394        #[doc = "<ul>"] #[doc =
6395        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6396        = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
6397        "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6398        "<section class=\"warning\">"] #[doc =
6399        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6400        #[doc = "<ul>"] #[doc =
6401        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6402        = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()), (@ peri_type #[doc =
6403        "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6404        "<section class=\"warning\">"] #[doc =
6405        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6406        #[doc = "<ul>"] #[doc =
6407        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6408        = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
6409        "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6410        "<section class=\"warning\">"] #[doc =
6411        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6412        #[doc = "<ul>"] #[doc =
6413        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6414        = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
6415        "GPIO42 peripheral singleton"] GPIO42 <= virtual()), (@ peri_type #[doc =
6416        "GPIO43 peripheral singleton"] GPIO43 <= virtual()), (@ peri_type #[doc =
6417        "GPIO44 peripheral singleton"] GPIO44 <= virtual()), (@ peri_type #[doc =
6418        "GPIO45 peripheral singleton"] GPIO45 <= virtual()), (@ peri_type #[doc =
6419        "GPIO46 peripheral singleton"] GPIO46 <= virtual()), (@ peri_type #[doc =
6420        "GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
6421        "GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
6422        "GPIO49 peripheral singleton"] GPIO49 <= virtual()), (@ peri_type #[doc =
6423        "GPIO50 peripheral singleton"] GPIO50 <= virtual()), (@ peri_type #[doc =
6424        "GPIO51 peripheral singleton"] GPIO51 <= virtual()), (@ peri_type #[doc =
6425        "GPIO52 peripheral singleton"] GPIO52 <= virtual()), (@ peri_type #[doc =
6426        "GPIO53 peripheral singleton"] GPIO53 <= virtual()), (@ peri_type #[doc =
6427        "GPIO54 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6428        "<section class=\"warning\">"] #[doc =
6429        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6430        #[doc = "<ul>"] #[doc =
6431        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6432        #[doc = "</ul>"] #[doc = "</section>"] GPIO54 <= virtual()), (@ peri_type #[doc =
6433        "GPIO55 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6434        "<section class=\"warning\">"] #[doc =
6435        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6436        #[doc = "<ul>"] #[doc =
6437        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6438        #[doc = "</ul>"] #[doc = "</section>"] GPIO55 <= virtual()), (@ peri_type #[doc =
6439        "GPIO56 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6440        "<section class=\"warning\">"] #[doc =
6441        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6442        #[doc = "<ul>"] #[doc =
6443        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6444        #[doc = "</ul>"] #[doc = "</section>"] GPIO56 <= virtual()), (@ peri_type #[doc =
6445        "GPIO57 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6446        "<section class=\"warning\">"] #[doc =
6447        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6448        #[doc = "<ul>"] #[doc =
6449        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6450        #[doc = "</ul>"] #[doc = "</section>"] GPIO57 <= virtual()), (@ peri_type #[doc =
6451        "GPIO58 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6452        "<section class=\"warning\">"] #[doc =
6453        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6454        #[doc = "<ul>"] #[doc =
6455        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
6456        = "</ul>"] #[doc = "</section>"] GPIO58 <= virtual()), (@ peri_type #[doc =
6457        "GPIO59 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6458        "<section class=\"warning\">"] #[doc =
6459        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6460        #[doc = "<ul>"] #[doc =
6461        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
6462        = "</ul>"] #[doc = "</section>"] GPIO59 <= virtual()), (@ peri_type #[doc =
6463        "GPIO60 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6464        "<section class=\"warning\">"] #[doc =
6465        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6466        #[doc = "<ul>"] #[doc =
6467        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6468        = "</ul>"] #[doc = "</section>"] GPIO60 <= virtual()), (@ peri_type #[doc =
6469        "GPIO61 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6470        "<section class=\"warning\">"] #[doc =
6471        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6472        #[doc = "<ul>"] #[doc =
6473        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6474        = "</ul>"] #[doc = "</section>"] GPIO61 <= virtual()), (@ peri_type #[doc =
6475        "DMA_CH0 peripheral singleton"] DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : {
6476        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6477        AHB_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6478        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6479        "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
6480        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6481        AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6482        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6483        "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual(AHB_PDMA_IN_CH2 : {
6484        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6485        AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6486        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6487        "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual(AHB_PDMA_IN_CH3 : {
6488        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6489        AHB_PDMA_OUT_CH3 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6490        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6491        "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(AHB_PDMA_IN_CH4 : {
6492        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6493        AHB_PDMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6494        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6495        "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <= virtual(AXI_PDMA_IN_CH0 : {
6496        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6497        AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6498        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6499        "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <= virtual(AXI_PDMA_IN_CH1 : {
6500        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6501        AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6502        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6503        "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <= virtual(AXI_PDMA_IN_CH2 : {
6504        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6505        AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6506        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6507        "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)), (@
6508        peri_type #[doc = "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual()
6509        (unstable)), (@ peri_type #[doc = "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2
6510        <= virtual() (unstable)), (@ peri_type #[doc =
6511        "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)), (@
6512        peri_type #[doc = "PCNT1_UNIT0 peripheral singleton"] PCNT1_UNIT0 <= virtual()
6513        (unstable)), (@ peri_type #[doc = "PCNT1_UNIT1 peripheral singleton"] PCNT1_UNIT1
6514        <= virtual() (unstable)), (@ peri_type #[doc =
6515        "PCNT1_UNIT2 peripheral singleton"] PCNT1_UNIT2 <= virtual() (unstable)), (@
6516        peri_type #[doc = "PCNT1_UNIT3 peripheral singleton"] PCNT1_UNIT3 <= virtual()
6517        (unstable)), (@ peri_type #[doc = "SDM_CH0 peripheral singleton"] SDM_CH0 <=
6518        virtual() (unstable)), (@ peri_type #[doc = "SDM_CH1 peripheral singleton"]
6519        SDM_CH1 <= virtual() (unstable)), (@ peri_type #[doc =
6520        "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual() (unstable)), (@ peri_type
6521        #[doc = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)), (@
6522        peri_type #[doc = "SDM_CH4 peripheral singleton"] SDM_CH4 <= virtual()
6523        (unstable)), (@ peri_type #[doc = "SDM_CH5 peripheral singleton"] SDM_CH5 <=
6524        virtual() (unstable)), (@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
6525        SDM_CH6 <= virtual() (unstable)), (@ peri_type #[doc =
6526        "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)), (@ peri_type
6527        #[doc = "AES peripheral singleton"] AES <= AES(AES : { bind_peri_interrupt,
6528        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
6529        = "APB_SARADC peripheral singleton"] APB_SARADC <= ADC() (unstable)), (@
6530        peri_type #[doc = "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <=
6531        ASSIST_DEBUG() (unstable)), (@ peri_type #[doc = "CACHE peripheral singleton"]
6532        CACHE <= CACHE() (unstable)), (@ peri_type #[doc = "CLIC peripheral singleton"]
6533        CLIC <= CLIC() (unstable)), (@ peri_type #[doc = "CLINT peripheral singleton"]
6534        CLINT <= CLINT() (unstable)), (@ peri_type #[doc =
6535        "CLINT_OTHER_CORE peripheral singleton"] CLINT_OTHER_CORE <= CLINT_OTHER_CORE()
6536        (unstable)), (@ peri_type #[doc = "CNNT_SYS peripheral singleton"] CNNT_SYS <=
6537        CNNT_SYS() (unstable)), (@ peri_type #[doc = "CNNT_IO_MUX peripheral singleton"]
6538        CNNT_IO_MUX <= CNNT_IO_MUX() (unstable)), (@ peri_type #[doc =
6539        "ETH peripheral singleton"] ETH <= virtual(SBD : { bind_peri_interrupt,
6540        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
6541        = "EMAC_DMA peripheral singleton"] EMAC_DMA <= GMAC_DMA() (unstable)), (@
6542        peri_type #[doc = "EMAC_MAC peripheral singleton"] EMAC_MAC <= GMAC()
6543        (unstable)), (@ peri_type #[doc = "ECC peripheral singleton"] ECC <= ECC()
6544        (unstable)), (@ peri_type #[doc = "EFUSE peripheral singleton"] EFUSE <= EFUSE()
6545        (unstable)), (@ peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO()
6546        (unstable)), (@ peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <=
6547        GPIO_EXT() (unstable)), (@ peri_type #[doc = "HP_APM peripheral singleton"]
6548        HP_APM <= HP_APM() (unstable)), (@ peri_type #[doc =
6549        "HP_MEM_APM peripheral singleton"] HP_MEM_APM <= HP_MEM_APM() (unstable)), (@
6550        peri_type #[doc = "HP_SYS peripheral singleton"] HP_SYS <= HP_SYS() (unstable)),
6551        (@ peri_type #[doc = "HP_ALIVE_SYS peripheral singleton"] HP_ALIVE_SYS <=
6552        HP_ALIVE_SYS() (unstable)), (@ peri_type #[doc =
6553        "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
6554        (unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0
6555        : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6556        peri_type #[doc = "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C1 : {
6557        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6558        peri_type #[doc = "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : {
6559        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6560        (unstable)), (@ peri_type #[doc = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1
6561        : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6562        (unstable)), (@ peri_type #[doc = "IEEE802154 peripheral singleton"] IEEE802154
6563        <= IEEE802154(MODEM_ZB_MAC : { bind_mac_interrupt, enable_mac_interrupt,
6564        disable_mac_interrupt }) (unstable)), (@ peri_type #[doc =
6565        "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
6566        (unstable)), (@ peri_type #[doc = "INTERRUPT_CORE1 peripheral singleton"]
6567        INTERRUPT_CORE1 <= INTERRUPT_CORE1() (unstable)), (@ peri_type #[doc =
6568        "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type #[doc
6569        = "LCD_CAM peripheral singleton"] LCD_CAM <= LCD_CAM(LCD_CAM : {
6570        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6571        (unstable)), (@ peri_type #[doc = "IOMUX_MSPI_PIN peripheral singleton"]
6572        IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN() (unstable)), (@ peri_type #[doc =
6573        "LP_AON_CLK_RST peripheral singleton"] LP_AON_CLK_RST <= LP_AON_CLKRST()
6574        (unstable)), (@ peri_type #[doc = "LP_APM peripheral singleton"] LP_APM <=
6575        LP_APM() (unstable)), (@ peri_type #[doc = "LP_GPIO peripheral singleton"]
6576        LP_GPIO <= LP_GPIO() (unstable)), (@ peri_type #[doc =
6577        "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)), (@
6578        peri_type #[doc = "LP_PERI peripheral singleton"] LP_PERI <= LP_PERICLKRST()
6579        (unstable)), (@ peri_type #[doc = "LP_SYS peripheral singleton"] LP_SYS <=
6580        LP_SYS() (unstable)), (@ peri_type #[doc = "LP_TEE peripheral singleton"] LP_TEE
6581        <= LP_TEE() (unstable)), (@ peri_type #[doc = "LP_WDT peripheral singleton"]
6582        LP_WDT <= LP_WDT() (unstable)), (@ peri_type #[doc = "LPWR peripheral singleton"]
6583        LPWR <= PMU() (unstable)), (@ peri_type #[doc =
6584        "MEM_MONITOR peripheral singleton"] MEM_MONITOR <= MEM_MONITOR0() (unstable)), (@
6585        peri_type #[doc = "MODEM_LPCON peripheral singleton"] MODEM_LPCON <=
6586        MODEM_LPCON() (unstable)), (@ peri_type #[doc =
6587        "MODEM_SYSCON peripheral singleton"] MODEM_SYSCON <= MODEM_SYSCON() (unstable)),
6588        (@ peri_type #[doc = "PAU peripheral singleton"] PAU <= PAU() (unstable)), (@
6589        peri_type #[doc = "PCNT peripheral singleton"] PCNT <= PCNT(PCNT0 : {
6590        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6591        (unstable)), (@ peri_type #[doc = "PCNT1 peripheral singleton"] PCNT1 <=
6592        PCNT1(PCNT1 : { bind_peri_interrupt, enable_peri_interrupt,
6593        disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
6594        "PMU peripheral singleton"] PMU <= PMU() (unstable)), (@ peri_type #[doc =
6595        "RTC_TIMER peripheral singleton"] RTC_TIMER <= LP_TIMER() (unstable)), (@
6596        peri_type #[doc = "RNG peripheral singleton"] RNG <= TRNG() (unstable)), (@
6597        peri_type #[doc = "RMT peripheral singleton"] RMT <= RMT(RMT : {
6598        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6599        (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <= RSA(RSA : {
6600        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6601        (unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0()
6602        (unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1()
6603        (unstable)), (@ peri_type #[doc = "MEMSPI2 peripheral singleton"] MEMSPI2 <=
6604        MEMSPI2() (unstable)), (@ peri_type #[doc = "MEMSPI3 peripheral singleton"]
6605        MEMSPI3 <= MEMSPI3() (unstable)), (@ peri_type #[doc =
6606        "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
6607        enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
6608        "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : { bind_peri_interrupt,
6609        enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
6610        "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)), (@ peri_type
6611        #[doc = "DMA peripheral singleton"] DMA <= AHB_DMA() (unstable)), (@ peri_type
6612        #[doc = "SHA peripheral singleton"] SHA <= SHA() (unstable)), (@ peri_type #[doc
6613        = "SYSTEM peripheral singleton"] SYSTEM <= HP_SYS() (unstable)), (@ peri_type
6614        #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER() (unstable)), (@
6615        peri_type #[doc = "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)),
6616        (@ peri_type #[doc = "TEE peripheral singleton"] TEE <= TEE() (unstable)), (@
6617        peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)), (@
6618        peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)), (@
6619        peri_type #[doc = "UART0 peripheral singleton"] UART0 <= UART0(UART0 : {
6620        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6621        peri_type #[doc = "UART1 peripheral singleton"] UART1 <= UART1(UART1 : {
6622        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6623        peri_type #[doc = "UART2 peripheral singleton"] UART2 <= UART2(UART2 : {
6624        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6625        peri_type #[doc = "UART3 peripheral singleton"] UART3 <= UART3(UART3 : {
6626        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6627        peri_type #[doc = "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)), (@
6628        peri_type #[doc = "USB_DEVICE peripheral singleton"] USB_DEVICE <=
6629        USB_DEVICE(USB_DEVICE : { bind_peri_interrupt, enable_peri_interrupt,
6630        disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
6631        "USB_HS peripheral singleton"] USB_HS <= USB_OTG_HS(USB_OTG_HS : {
6632        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6633        (unstable)), (@ peri_type #[doc = "ADC1 peripheral singleton"] ADC1 <= virtual()
6634        (unstable)), (@ peri_type #[doc = "ADC2 peripheral singleton"] ADC2 <= virtual()
6635        (unstable)), (@ peri_type #[doc = "FLASH peripheral singleton"] FLASH <=
6636        virtual() (unstable)), (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM
6637        <= virtual() (unstable)), (@ peri_type #[doc =
6638        "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
6639        (@ peri_type #[doc = "WIFI peripheral singleton"] WIFI <= virtual(MODEM_WIFI_BB :
6640        { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt }, MODEM_WIFI_MAC
6641        : { bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt },
6642        MODEM_WIFI_PWR : { bind_pwr_interrupt, enable_pwr_interrupt,
6643        disable_pwr_interrupt })), (@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
6644        CPU_CTRL <= virtual() (unstable)), (@ peri_type #[doc =
6645        "IPC peripheral singleton"] IPC <= virtual() (unstable)), (@ peri_type #[doc =
6646        "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)),
6647        (@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <=
6648        virtual() (unstable)), (@ peri_type #[doc =
6649        "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
6650        (@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
6651        virtual() (unstable))));
6652        _for_each_inner_peripheral!((singletons(#[cfg(not(use_xtal32k))] GPIO0),
6653        (#[cfg(not(use_xtal32k))] GPIO1), (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6),
6654        (GPIO7), (GPIO8), (GPIO9), (GPIO10), (GPIO11), (GPIO12), (GPIO13), (GPIO14),
6655        (GPIO15), (GPIO16), (GPIO17), (GPIO18), (GPIO19), (GPIO20), (GPIO21), (GPIO22),
6656        (GPIO23), (GPIO24), (GPIO25), (GPIO26), (GPIO27), (GPIO28), (GPIO30), (GPIO31),
6657        (GPIO32), (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39),
6658        (GPIO40), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47), (GPIO48),
6659        (GPIO49), (GPIO50), (GPIO51), (GPIO52), (GPIO53), (GPIO54), (GPIO55), (GPIO56),
6660        (GPIO57), (GPIO58), (GPIO59), (GPIO60), (GPIO61), (DMA_CH0(unstable)),
6661        (DMA_CH1(unstable)), (DMA_CH2(unstable)), (DMA_CH3(unstable)),
6662        (DMA_CH4(unstable)), (DMA_AXI_CH0(unstable)), (DMA_AXI_CH1(unstable)),
6663        (DMA_AXI_CH2(unstable)), (PCNT0_UNIT0(unstable)), (PCNT0_UNIT1(unstable)),
6664        (PCNT0_UNIT2(unstable)), (PCNT0_UNIT3(unstable)), (PCNT1_UNIT0(unstable)),
6665        (PCNT1_UNIT1(unstable)), (PCNT1_UNIT2(unstable)), (PCNT1_UNIT3(unstable)),
6666        (SDM_CH0(unstable)), (SDM_CH1(unstable)), (SDM_CH2(unstable)),
6667        (SDM_CH3(unstable)), (SDM_CH4(unstable)), (SDM_CH5(unstable)),
6668        (SDM_CH6(unstable)), (SDM_CH7(unstable)), (AES(unstable)),
6669        (APB_SARADC(unstable)), (ASSIST_DEBUG(unstable)), (CACHE(unstable)),
6670        (CLIC(unstable)), (CLINT(unstable)), (CLINT_OTHER_CORE(unstable)),
6671        (ETH(unstable)), (ECC(unstable)), (GPIO(unstable)), (GPIO_SD(unstable)),
6672        (HP_APM(unstable)), (HP_MEM_APM(unstable)), (HP_SYS(unstable)),
6673        (HP_ALIVE_SYS(unstable)), (HP_SYS_CLKRST(unstable)), (I2C0), (I2C1),
6674        (I2S0(unstable)), (I2S1(unstable)), (IEEE802154(unstable)),
6675        (INTERRUPT_CORE0(unstable)), (INTERRUPT_CORE1(unstable)), (IO_MUX(unstable)),
6676        (LCD_CAM(unstable)), (LP_AON_CLK_RST(unstable)), (LP_APM(unstable)),
6677        (LP_GPIO(unstable)), (LP_IO_MUX(unstable)), (LP_PERI(unstable)),
6678        (LP_SYS(unstable)), (LP_TEE(unstable)), (LP_WDT(unstable)), (LPWR(unstable)),
6679        (MEM_MONITOR(unstable)), (MODEM_LPCON(unstable)), (MODEM_SYSCON(unstable)),
6680        (PAU(unstable)), (PCNT(unstable)), (PCNT1(unstable)), (PMU(unstable)),
6681        (RTC_TIMER(unstable)), (RNG(unstable)), (RMT(unstable)), (RSA(unstable)),
6682        (SPI0(unstable)), (SPI1(unstable)), (SPI2), (SPI3), (AXI_GDMA(unstable)),
6683        (DMA(unstable)), (SHA(unstable)), (SYSTEM(unstable)), (SYSTIMER(unstable)),
6684        (SDHOST(unstable)), (TEE(unstable)), (TIMG0(unstable)), (TIMG1(unstable)),
6685        (UART0), (UART1), (UART2), (UART3), (UHCI0(unstable)), (USB_DEVICE(unstable)),
6686        (USB_HS(unstable)), (ADC1(unstable)), (ADC2(unstable)), (FLASH(unstable)),
6687        (PSRAM(unstable)), (GPIO_DEDICATED(unstable)), (WIFI), (CPU_CTRL(unstable)),
6688        (IPC(unstable)), (FROM_CPU_INTR0(unstable)), (FROM_CPU_INTR1(unstable)),
6689        (FROM_CPU_INTR2(unstable)), (FROM_CPU_INTR3(unstable))));
6690        _for_each_inner_peripheral!((dma_eligible(UHCI0, Uhci0, 0, AhbGdmaChannel),
6691        (LCD_CAM, LcdCam, 0, AxiGdmaChannel), (I2S0, I2s0, 1, AhbGdmaChannel), (SPI2,
6692        Spi2, 1, AxiGdmaChannel), (SPI3, Spi3, 2, AxiGdmaChannel), (AES, Aes, 4,
6693        AxiGdmaChannel), (I2S1, I2s1, 5, AhbGdmaChannel), (SHA, Sha, 5,
6694        AxiGdmaChannel)));
6695    };
6696}
6697/// This macro can be used to generate code for each `GPIOn` instance.
6698///
6699/// For an explanation on the general syntax, as well as usage of individual/repeated
6700/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6701///
6702/// This macro has one option for its "Individual matcher" case:
6703///
6704/// Syntax: `($n:literal, $gpio:ident ($($digital_input_function:ident =>
6705/// $digital_input_signal:ident)*) ($($digital_output_function:ident =>
6706/// $digital_output_signal:ident)*) ($([$pin_attribute:ident])*))`
6707///
6708/// Macro fragments:
6709///
6710/// - `$n`: the number of the GPIO. For `GPIO0`, `$n` is 0.
6711/// - `$gpio`: the name of the GPIO.
6712/// - `$digital_input_function`: the number of the digital function, as an identifier (i.e. for
6713///   function 0 this is `_0`).
6714/// - `$digital_input_function`: the name of the digital function, as an identifier.
6715/// - `$digital_output_function`: the number of the digital function, as an identifier (i.e. for
6716///   function 0 this is `_0`).
6717/// - `$digital_output_function`: the name of the digital function, as an identifier.
6718/// - `$pin_attribute`: `Input` and/or `Output`, marks the possible directions of the GPIO.
6719///   Bracketed so that they can also be matched as optional fragments. Order is always Input first.
6720///
6721/// Example data: `(0, GPIO0 (_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input]
6722/// [Output]))`
6723#[macro_export]
6724#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6725macro_rules! for_each_gpio {
6726    ($($pattern:tt => $code:tt;)*) => {
6727        macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
6728        } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
6729        _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
6730        _for_each_inner_gpio!((2, GPIO2() (_3 => LCD_DATA_19) ([Input] [Output])));
6731        _for_each_inner_gpio!((3, GPIO3() (_3 => LCD_DATA_20) ([Input] [Output])));
6732        _for_each_inner_gpio!((4, GPIO4() (_3 => LCD_DATA_21) ([Input] [Output])));
6733        _for_each_inner_gpio!((5, GPIO5() (_3 => LCD_DATA_22) ([Input] [Output])));
6734        _for_each_inner_gpio!((6, GPIO6() () ([Input] [Output])));
6735        _for_each_inner_gpio!((7, GPIO7() (_3 => LCD_DATA_23) ([Input] [Output])));
6736        _for_each_inner_gpio!((8, GPIO8() (_2 => EMAC_TXD0 _3 => LCD_DATA_0) ([Input]
6737        [Output]))); _for_each_inner_gpio!((9, GPIO9(_0 => FSPIHD _4 => DBG_PSRAM_CK) (_0
6738        => FSPIHD _2 => EMAC_TXD1 _3 => LCD_DATA_1 _4 => DBG_PSRAM_CK) ([Input]
6739        [Output]))); _for_each_inner_gpio!((10, GPIO10(_0 => FSPICS0 _4 => DBG_PSRAM_CS)
6740        (_0 => FSPICS0 _2 => EMAC_TXD2 _3 => LCD_DATA_2 _4 => DBG_PSRAM_CS) ([Input]
6741        [Output]))); _for_each_inner_gpio!((11, GPIO11(_0 => FSPID _4 => DBG_PSRAM_D) (_0
6742        => FSPID _2 => EMAC_TXD3 _3 => LCD_DATA_3 _4 => DBG_PSRAM_D) ([Input]
6743        [Output]))); _for_each_inner_gpio!((12, GPIO12(_0 => FSPICLK _4 => DBG_PSRAM_Q)
6744        (_0 => FSPICLK _2 => EMAC_TXEN _3 => LCD_DATA_4 _4 => DBG_PSRAM_Q) ([Input]
6745        [Output]))); _for_each_inner_gpio!((13, GPIO13(_0 => FSPIQ _2 => EMAC_RMII_CLK _4
6746        => DBG_PSRAM_WP) (_0 => FSPIQ _2 => EMAC_RMII_CLK _3 => LCD_DATA_5 _4 =>
6747        DBG_PSRAM_WP) ([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14(_0 =>
6748        FSPIWP _2 => EMAC_RX_CLK _4 => DBG_PSRAM_HOLD) (_0 => FSPIWP _3 => LCD_DATA_6 _4
6749        => DBG_PSRAM_HOLD) ([Input] [Output]))); _for_each_inner_gpio!((15, GPIO15(_0 =>
6750        FSPIIO4 _2 => EMAC_RXDV _4 => DBG_PSRAM_DQ4) (_0 => FSPIIO4 _3 => LCD_DATA_7 _4
6751        => DBG_PSRAM_DQ4) ([Input] [Output]))); _for_each_inner_gpio!((16, GPIO16(_0 =>
6752        FSPIIO5 _2 => EMAC_RXD3 _4 => DBG_PSRAM_DQ5) (_0 => FSPIIO5 _3 => LCD_DATA_8 _4
6753        => DBG_PSRAM_DQ5) ([Input] [Output]))); _for_each_inner_gpio!((17, GPIO17(_0 =>
6754        FSPIIO6 _2 => EMAC_RXD2 _4 => DBG_PSRAM_DQ6) (_0 => FSPIIO6 _3 => LCD_DATA_9 _4
6755        => DBG_PSRAM_DQ6) ([Input] [Output]))); _for_each_inner_gpio!((18, GPIO18(_0 =>
6756        FSPIIO7 _2 => EMAC_RXD1 _4 => DBG_PSRAM_DQ7) (_0 => FSPIIO7 _3 => LCD_DATA_10 _4
6757        => DBG_PSRAM_DQ7) ([Input] [Output]))); _for_each_inner_gpio!((19, GPIO19(_2 =>
6758        EMAC_RXD0 _4 => DBG_PSRAM_DQS_0) (_0 => FSPIDQS _3 => LCD_DATA_11 _4 =>
6759        DBG_PSRAM_DQS_0) ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20(_0 =>
6760        SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) (_0 => SD1_DATA0 _2 => FSPICLK _4 =>
6761        DBG_FLASH_CK) ([Input] [Output]))); _for_each_inner_gpio!((21, GPIO21(_0 =>
6762        SD1_DATA1 _2 => FSPID _4 => DBG_FLASH_D) (_0 => SD1_DATA1 _2 => FSPID _4 =>
6763        DBG_FLASH_D) ([Input] [Output]))); _for_each_inner_gpio!((22, GPIO22(_0 =>
6764        SD1_DATA2 _2 => FSPIQ _4 => DBG_FLASH_CS) (_0 => SD1_DATA2 _2 => FSPIQ _4 =>
6765        DBG_FLASH_CS) ([Input] [Output]))); _for_each_inner_gpio!((23, GPIO23(_0 =>
6766        SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) (_0 => SD1_DATA3 _2 => FSPICS0 _4 =>
6767        DBG_FLASH_Q) ([Input] [Output]))); _for_each_inner_gpio!((24, GPIO24(_0 =>
6768        SD1_CLK _2 => FSPIHD _4 => DBG_FLASH_WP) (_0 => SD1_CLK _2 => FSPIHD _4 =>
6769        DBG_FLASH_WP) ([Input] [Output]))); _for_each_inner_gpio!((25, GPIO25(_0 =>
6770        SD1_CMD _2 => FSPIWP _4 => DBG_FLASH_HOLD) (_0 => SD1_CMD _2 => FSPIWP _4 =>
6771        DBG_FLASH_HOLD) ([Input] [Output]))); _for_each_inner_gpio!((26, GPIO26(_0 =>
6772        SPICS0) (_0 => SPICS0) ([Input] [Output]))); _for_each_inner_gpio!((27, GPIO27(_0
6773        => SPIQ) (_0 => SPIQ) ([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0
6774        => SPIWP) (_0 => SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((30,
6775        GPIO30(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])));
6776        _for_each_inner_gpio!((31, GPIO31(_0 => SPICLK) (_0 => SPICLK) ([Input]
6777        [Output]))); _for_each_inner_gpio!((32, GPIO32(_0 => SPID) (_0 => SPID) ([Input]
6778        [Output]))); _for_each_inner_gpio!((33, GPIO33() (_3 => LCD_DATA_12) ([Input]
6779        [Output]))); _for_each_inner_gpio!((34, GPIO34() (_3 => LCD_DATA_13) ([Input]
6780        [Output]))); _for_each_inner_gpio!((35, GPIO35(_2 => REF_50M_CLK _4 =>
6781        SD2_CDATA0) (_2 => REF_50M_CLK _3 => LCD_DATA_14 _4 => SD2_CDATA0) ([Input]
6782        [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => EMAC_RXDV _4 => SD2_CDATA1)
6783        (_3 => LCD_DATA_15 _4 => SD2_CDATA1) ([Input] [Output])));
6784        _for_each_inner_gpio!((37, GPIO37(_4 => SD2_CDATA2) (_2 => EMAC_TXEN _3 =>
6785        LCD_DATA_16 _4 => SD2_CDATA2) ([Input] [Output]))); _for_each_inner_gpio!((38,
6786        GPIO38(_2 => EMAC_RXD3 _4 => SD2_CDATA3) (_3 => LCD_DATA_17 _4 => SD2_CDATA3)
6787        ([Input] [Output]))); _for_each_inner_gpio!((39, GPIO39(_2 => EMAC_RXD2 _4 =>
6788        SD2_CCLK) (_3 => LCD_DATA_18 _4 => SD2_CCLK) ([Input] [Output])));
6789        _for_each_inner_gpio!((40, GPIO40(_2 => EMAC_RXD1 _4 => SD2_CCMD) (_3 => LCD_PCLK
6790        _4 => SD2_CCMD) ([Input] [Output]))); _for_each_inner_gpio!((42, GPIO42(_2 =>
6791        EMAC_RX_CLK) () ([Input] [Output]))); _for_each_inner_gpio!((43, GPIO43(_2 =>
6792        EMAC_RMII_CLK) (_2 => EMAC_RMII_CLK _3 => LCD_H_ENABLE) ([Input] [Output])));
6793        _for_each_inner_gpio!((44, GPIO44() (_2 => EMAC_TXD0 _3 => LCD_H_SYNC) ([Input]
6794        [Output]))); _for_each_inner_gpio!((45, GPIO45() (_2 => EMAC_TXD1 _3 =>
6795        LCD_V_SYNC) ([Input] [Output]))); _for_each_inner_gpio!((46, GPIO46(_3 =>
6796        CAM_DATA_0) (_2 => EMAC_TXD2) ([Input] [Output]))); _for_each_inner_gpio!((47,
6797        GPIO47(_3 => CAM_DATA_1) (_2 => EMAC_TXD3) ([Input] [Output])));
6798        _for_each_inner_gpio!((48, GPIO48(_3 => CAM_DATA_2) () ([Input] [Output])));
6799        _for_each_inner_gpio!((49, GPIO49(_3 => CAM_DATA_3) () ([Input] [Output])));
6800        _for_each_inner_gpio!((50, GPIO50(_3 => CAM_DATA_4) () ([Input] [Output])));
6801        _for_each_inner_gpio!((51, GPIO51(_3 => CAM_DATA_5) () ([Input] [Output])));
6802        _for_each_inner_gpio!((52, GPIO52(_2 => FSPICS0 _3 => CAM_DATA_6) (_2 => FSPICS0)
6803        ([Input] [Output]))); _for_each_inner_gpio!((53, GPIO53(_2 => FSPICLK _3 =>
6804        CAM_DATA_7) (_2 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((54,
6805        GPIO54(_0 => MTDO _2 => FSPID _3 => CAM_PCLK) (_0 => MTDO _2 => FSPID) ([Input]
6806        [Output]))); _for_each_inner_gpio!((55, GPIO55(_0 => MTCK _2 => FSPIQ _3 =>
6807        CAM_XCLK) (_0 => MTCK _2 => FSPIQ _3 => CAM_XCLK) ([Input] [Output])));
6808        _for_each_inner_gpio!((56, GPIO56(_0 => MTDI _2 => FSPIHD _3 => CAM_V_SYNC) (_0
6809        => MTDI _2 => FSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((57, GPIO57(_0
6810        => MTMS _2 => FSPIWP _3 => CAM_H_SYNC) (_0 => MTMS _2 => FSPIWP) ([Input]
6811        [Output]))); _for_each_inner_gpio!((58, GPIO58() (_0 => U0TXD) ([Input]
6812        [Output]))); _for_each_inner_gpio!((59, GPIO59(_0 => U0RXD) () ([Input]
6813        [Output]))); _for_each_inner_gpio!((60, GPIO60() () ([Input] [Output])));
6814        _for_each_inner_gpio!((61, GPIO61() () ([Input] [Output])));
6815        _for_each_inner_gpio!((all(0, GPIO0() () ([Input] [Output])), (1, GPIO1() ()
6816        ([Input] [Output])), (2, GPIO2() (_3 => LCD_DATA_19) ([Input] [Output])), (3,
6817        GPIO3() (_3 => LCD_DATA_20) ([Input] [Output])), (4, GPIO4() (_3 => LCD_DATA_21)
6818        ([Input] [Output])), (5, GPIO5() (_3 => LCD_DATA_22) ([Input] [Output])), (6,
6819        GPIO6() () ([Input] [Output])), (7, GPIO7() (_3 => LCD_DATA_23) ([Input]
6820        [Output])), (8, GPIO8() (_2 => EMAC_TXD0 _3 => LCD_DATA_0) ([Input] [Output])),
6821        (9, GPIO9(_0 => FSPIHD _4 => DBG_PSRAM_CK) (_0 => FSPIHD _2 => EMAC_TXD1 _3 =>
6822        LCD_DATA_1 _4 => DBG_PSRAM_CK) ([Input] [Output])), (10, GPIO10(_0 => FSPICS0 _4
6823        => DBG_PSRAM_CS) (_0 => FSPICS0 _2 => EMAC_TXD2 _3 => LCD_DATA_2 _4 =>
6824        DBG_PSRAM_CS) ([Input] [Output])), (11, GPIO11(_0 => FSPID _4 => DBG_PSRAM_D) (_0
6825        => FSPID _2 => EMAC_TXD3 _3 => LCD_DATA_3 _4 => DBG_PSRAM_D) ([Input] [Output])),
6826        (12, GPIO12(_0 => FSPICLK _4 => DBG_PSRAM_Q) (_0 => FSPICLK _2 => EMAC_TXEN _3 =>
6827        LCD_DATA_4 _4 => DBG_PSRAM_Q) ([Input] [Output])), (13, GPIO13(_0 => FSPIQ _2 =>
6828        EMAC_RMII_CLK _4 => DBG_PSRAM_WP) (_0 => FSPIQ _2 => EMAC_RMII_CLK _3 =>
6829        LCD_DATA_5 _4 => DBG_PSRAM_WP) ([Input] [Output])), (14, GPIO14(_0 => FSPIWP _2
6830        => EMAC_RX_CLK _4 => DBG_PSRAM_HOLD) (_0 => FSPIWP _3 => LCD_DATA_6 _4 =>
6831        DBG_PSRAM_HOLD) ([Input] [Output])), (15, GPIO15(_0 => FSPIIO4 _2 => EMAC_RXDV _4
6832        => DBG_PSRAM_DQ4) (_0 => FSPIIO4 _3 => LCD_DATA_7 _4 => DBG_PSRAM_DQ4) ([Input]
6833        [Output])), (16, GPIO16(_0 => FSPIIO5 _2 => EMAC_RXD3 _4 => DBG_PSRAM_DQ5) (_0 =>
6834        FSPIIO5 _3 => LCD_DATA_8 _4 => DBG_PSRAM_DQ5) ([Input] [Output])), (17, GPIO17(_0
6835        => FSPIIO6 _2 => EMAC_RXD2 _4 => DBG_PSRAM_DQ6) (_0 => FSPIIO6 _3 => LCD_DATA_9
6836        _4 => DBG_PSRAM_DQ6) ([Input] [Output])), (18, GPIO18(_0 => FSPIIO7 _2 =>
6837        EMAC_RXD1 _4 => DBG_PSRAM_DQ7) (_0 => FSPIIO7 _3 => LCD_DATA_10 _4 =>
6838        DBG_PSRAM_DQ7) ([Input] [Output])), (19, GPIO19(_2 => EMAC_RXD0 _4 =>
6839        DBG_PSRAM_DQS_0) (_0 => FSPIDQS _3 => LCD_DATA_11 _4 => DBG_PSRAM_DQS_0) ([Input]
6840        [Output])), (20, GPIO20(_0 => SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) (_0 =>
6841        SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) ([Input] [Output])), (21, GPIO21(_0
6842        => SD1_DATA1 _2 => FSPID _4 => DBG_FLASH_D) (_0 => SD1_DATA1 _2 => FSPID _4 =>
6843        DBG_FLASH_D) ([Input] [Output])), (22, GPIO22(_0 => SD1_DATA2 _2 => FSPIQ _4 =>
6844        DBG_FLASH_CS) (_0 => SD1_DATA2 _2 => FSPIQ _4 => DBG_FLASH_CS) ([Input]
6845        [Output])), (23, GPIO23(_0 => SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) (_0 =>
6846        SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) ([Input] [Output])), (24, GPIO24(_0 =>
6847        SD1_CLK _2 => FSPIHD _4 => DBG_FLASH_WP) (_0 => SD1_CLK _2 => FSPIHD _4 =>
6848        DBG_FLASH_WP) ([Input] [Output])), (25, GPIO25(_0 => SD1_CMD _2 => FSPIWP _4 =>
6849        DBG_FLASH_HOLD) (_0 => SD1_CMD _2 => FSPIWP _4 => DBG_FLASH_HOLD) ([Input]
6850        [Output])), (26, GPIO26(_0 => SPICS0) (_0 => SPICS0) ([Input] [Output])), (27,
6851        GPIO27(_0 => SPIQ) (_0 => SPIQ) ([Input] [Output])), (28, GPIO28(_0 => SPIWP) (_0
6852        => SPIWP) ([Input] [Output])), (30, GPIO30(_0 => SPIHD) (_0 => SPIHD) ([Input]
6853        [Output])), (31, GPIO31(_0 => SPICLK) (_0 => SPICLK) ([Input] [Output])), (32,
6854        GPIO32(_0 => SPID) (_0 => SPID) ([Input] [Output])), (33, GPIO33() (_3 =>
6855        LCD_DATA_12) ([Input] [Output])), (34, GPIO34() (_3 => LCD_DATA_13) ([Input]
6856        [Output])), (35, GPIO35(_2 => REF_50M_CLK _4 => SD2_CDATA0) (_2 => REF_50M_CLK _3
6857        => LCD_DATA_14 _4 => SD2_CDATA0) ([Input] [Output])), (36, GPIO36(_2 => EMAC_RXDV
6858        _4 => SD2_CDATA1) (_3 => LCD_DATA_15 _4 => SD2_CDATA1) ([Input] [Output])), (37,
6859        GPIO37(_4 => SD2_CDATA2) (_2 => EMAC_TXEN _3 => LCD_DATA_16 _4 => SD2_CDATA2)
6860        ([Input] [Output])), (38, GPIO38(_2 => EMAC_RXD3 _4 => SD2_CDATA3) (_3 =>
6861        LCD_DATA_17 _4 => SD2_CDATA3) ([Input] [Output])), (39, GPIO39(_2 => EMAC_RXD2 _4
6862        => SD2_CCLK) (_3 => LCD_DATA_18 _4 => SD2_CCLK) ([Input] [Output])), (40,
6863        GPIO40(_2 => EMAC_RXD1 _4 => SD2_CCMD) (_3 => LCD_PCLK _4 => SD2_CCMD) ([Input]
6864        [Output])), (42, GPIO42(_2 => EMAC_RX_CLK) () ([Input] [Output])), (43, GPIO43(_2
6865        => EMAC_RMII_CLK) (_2 => EMAC_RMII_CLK _3 => LCD_H_ENABLE) ([Input] [Output])),
6866        (44, GPIO44() (_2 => EMAC_TXD0 _3 => LCD_H_SYNC) ([Input] [Output])), (45,
6867        GPIO45() (_2 => EMAC_TXD1 _3 => LCD_V_SYNC) ([Input] [Output])), (46, GPIO46(_3
6868        => CAM_DATA_0) (_2 => EMAC_TXD2) ([Input] [Output])), (47, GPIO47(_3 =>
6869        CAM_DATA_1) (_2 => EMAC_TXD3) ([Input] [Output])), (48, GPIO48(_3 => CAM_DATA_2)
6870        () ([Input] [Output])), (49, GPIO49(_3 => CAM_DATA_3) () ([Input] [Output])),
6871        (50, GPIO50(_3 => CAM_DATA_4) () ([Input] [Output])), (51, GPIO51(_3 =>
6872        CAM_DATA_5) () ([Input] [Output])), (52, GPIO52(_2 => FSPICS0 _3 => CAM_DATA_6)
6873        (_2 => FSPICS0) ([Input] [Output])), (53, GPIO53(_2 => FSPICLK _3 => CAM_DATA_7)
6874        (_2 => FSPICLK) ([Input] [Output])), (54, GPIO54(_0 => MTDO _2 => FSPID _3 =>
6875        CAM_PCLK) (_0 => MTDO _2 => FSPID) ([Input] [Output])), (55, GPIO55(_0 => MTCK _2
6876        => FSPIQ _3 => CAM_XCLK) (_0 => MTCK _2 => FSPIQ _3 => CAM_XCLK) ([Input]
6877        [Output])), (56, GPIO56(_0 => MTDI _2 => FSPIHD _3 => CAM_V_SYNC) (_0 => MTDI _2
6878        => FSPIHD) ([Input] [Output])), (57, GPIO57(_0 => MTMS _2 => FSPIWP _3 =>
6879        CAM_H_SYNC) (_0 => MTMS _2 => FSPIWP) ([Input] [Output])), (58, GPIO58() (_0 =>
6880        U0TXD) ([Input] [Output])), (59, GPIO59(_0 => U0RXD) () ([Input] [Output])), (60,
6881        GPIO60() () ([Input] [Output])), (61, GPIO61() () ([Input] [Output]))));
6882    };
6883}
6884/// This macro can be used to generate code for each analog function of each GPIO.
6885///
6886/// For an explanation on the general syntax, as well as usage of individual/repeated
6887/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6888///
6889/// This macro has two options for its "Individual matcher" case:
6890///
6891/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
6892/// - group: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` - expanded signal
6893///   case, where you need the number(s) of a signal, or the general group to which the signal
6894///   belongs. For example, in case of `ADC2_CH3` the expanded form looks like `(ADC2_CH3, ADCn_CHm,
6895///   2, 3)`.
6896///
6897/// Macro fragments:
6898///
6899/// - `$signal`: the name of the signal.
6900/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
6901///   is `ADCn_CHm`.
6902/// - `$number`: the numbers extracted from `$signal`.
6903/// - `$gpio`: the name of the GPIO.
6904///
6905/// Example data:
6906/// - `(ADC2_CH5, GPIO12)`
6907/// - `((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12)`
6908///
6909/// The expanded syntax is only available when the signal has at least one numbered component.
6910#[macro_export]
6911#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6912macro_rules! for_each_analog_function {
6913    ($($pattern:tt => $code:tt;)*) => {
6914        macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
6915        tt) => {} } _for_each_inner_analog_function!((XTAL_32K_N, GPIO0));
6916        _for_each_inner_analog_function!((XTAL_32K_P, GPIO1));
6917        _for_each_inner_analog_function!((USJ_DM, GPIO33));
6918        _for_each_inner_analog_function!((USJ_DP, GPIO34));
6919        _for_each_inner_analog_function!((ADC1_CH0, GPIO42));
6920        _for_each_inner_analog_function!((ADC1_CH1, GPIO43));
6921        _for_each_inner_analog_function!((ADC1_CH2, GPIO44));
6922        _for_each_inner_analog_function!((ADC1_CH3, GPIO45));
6923        _for_each_inner_analog_function!((ADC1_CH4, GPIO46));
6924        _for_each_inner_analog_function!((ADC1_CH5, GPIO47));
6925        _for_each_inner_analog_function!((ADC1_CH6, GPIO48));
6926        _for_each_inner_analog_function!((ADC1_CH7, GPIO49));
6927        _for_each_inner_analog_function!((ADC2_CH0, GPIO50));
6928        _for_each_inner_analog_function!((ADC2_CH1, GPIO51));
6929        _for_each_inner_analog_function!((ADC2_CH2, GPIO52));
6930        _for_each_inner_analog_function!((ADC2_CH3, GPIO53));
6931        _for_each_inner_analog_function!((ADC2_CH4, GPIO54));
6932        _for_each_inner_analog_function!((ADC2_CH5, GPIO55));
6933        _for_each_inner_analog_function!((ADC2_CH6, GPIO56));
6934        _for_each_inner_analog_function!((ADC2_CH7, GPIO57));
6935        _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO42));
6936        _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO43));
6937        _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO44));
6938        _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO45));
6939        _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO46));
6940        _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO47));
6941        _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO48));
6942        _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO49));
6943        _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO50));
6944        _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO51));
6945        _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO52));
6946        _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO53));
6947        _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO54));
6948        _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO55));
6949        _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO56));
6950        _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO57));
6951        _for_each_inner_analog_function!((all(XTAL_32K_N, GPIO0), (XTAL_32K_P, GPIO1),
6952        (USJ_DM, GPIO33), (USJ_DP, GPIO34), (ADC1_CH0, GPIO42), (ADC1_CH1, GPIO43),
6953        (ADC1_CH2, GPIO44), (ADC1_CH3, GPIO45), (ADC1_CH4, GPIO46), (ADC1_CH5, GPIO47),
6954        (ADC1_CH6, GPIO48), (ADC1_CH7, GPIO49), (ADC2_CH0, GPIO50), (ADC2_CH1, GPIO51),
6955        (ADC2_CH2, GPIO52), (ADC2_CH3, GPIO53), (ADC2_CH4, GPIO54), (ADC2_CH5, GPIO55),
6956        (ADC2_CH6, GPIO56), (ADC2_CH7, GPIO57)));
6957        _for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0, ADCn_CHm, 1, 0), GPIO42),
6958        ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO43), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO44),
6959        ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO45), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO46),
6960        ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO47), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO48),
6961        ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO49), ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO50),
6962        ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO51), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO52),
6963        ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO53), ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO54),
6964        ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO55), ((ADC2_CH6, ADCn_CHm, 2, 6), GPIO56),
6965        ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO57)));
6966    };
6967}
6968/// This macro can be used to generate code for each LP function of each GPIO.
6969///
6970/// For an explanation on the general syntax, as well as usage of individual/repeated
6971/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6972///
6973/// This macro has two options for its "Individual matcher" case:
6974///
6975/// - `all`: `($signal:ident, $gpio:ident, $af:ident)` - simple case where you only need
6976///   identifiers, and maybe the function.
6977/// - group: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident, $af:ident, ($(
6978///   $lp_input_af:ident => $lp_input_signal:ident )*) ($( $lp_output_af:ident =>
6979///   $lp_output_signal:ident )*))` - expanded signal case, where you need the number(s) of a
6980///   signal, or the general group to which the signal belongs. Every expanded branch ends with the
6981///   pad's LP input and output function groups (empty on chips without an LP GPIO matrix).
6982///
6983/// Macro fragments:
6984///
6985/// - `$signal`: the name of the signal.
6986/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
6987///   is `ADCn_CHm`.
6988/// - `$number`: the numbers extracted from `$signal`.
6989/// - `$gpio`: the name of the GPIO.
6990/// - `$af`: the LP IO MUX function, as an identifier (i.e. for function 0 this is `_0`). This is
6991///   the name of an `LpFunction` variant, and its number is the value to write to the pad's
6992///   function select field.
6993/// - `$lp_input_af`: the LP IO MUX function for an LP peripheral input on this pad.
6994/// - `$lp_input_signal`: the LP peripheral input signal name.
6995/// - `$lp_output_af`: the LP IO MUX function for an LP peripheral output on this pad.
6996/// - `$lp_output_signal`: the LP peripheral output signal name.
6997///
6998/// Example data:
6999/// - `(LP_GPIO15, GPIO12, _0)`
7000/// - `((LP_GPIO15, LP_GPIOn, 15), GPIO12, _0, () ())`
7001/// - `((LP_GPIO14, LP_GPIOn, 14), GPIO14, _1, () (_0 => LP_UART_TXD))`
7002/// - `((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2, _3, () ())`
7003///
7004/// The expanded syntax is only available when the signal has at least one numbered component.
7005#[macro_export]
7006#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7007macro_rules! for_each_lp_function {
7008    ($($pattern:tt => $code:tt;)*) => {
7009        macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
7010        => {} } _for_each_inner_lp_function!((LP_GPIO0, GPIO0, _1));
7011        _for_each_inner_lp_function!((LP_GPIO1, GPIO1, _1));
7012        _for_each_inner_lp_function!((LP_GPIO2, GPIO2, _1));
7013        _for_each_inner_lp_function!((LP_GPIO3, GPIO3, _1));
7014        _for_each_inner_lp_function!((LP_GPIO4, GPIO4, _1));
7015        _for_each_inner_lp_function!((LP_GPIO5, GPIO5, _1));
7016        _for_each_inner_lp_function!((LP_GPIO6, GPIO6, _1));
7017        _for_each_inner_lp_function!((LP_GPIO7, GPIO7, _1));
7018        _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _1, () ()));
7019        _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _1, () ()));
7020        _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _1, () ()));
7021        _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _1, () ()));
7022        _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _1, () ()));
7023        _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _1, () ()));
7024        _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO6, _1, () ()));
7025        _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO7, _1, () ()));
7026        _for_each_inner_lp_function!((all(LP_GPIO0, GPIO0, _1), (LP_GPIO1, GPIO1, _1),
7027        (LP_GPIO2, GPIO2, _1), (LP_GPIO3, GPIO3, _1), (LP_GPIO4, GPIO4, _1), (LP_GPIO5,
7028        GPIO5, _1), (LP_GPIO6, GPIO6, _1), (LP_GPIO7, GPIO7, _1)));
7029        _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0, LP_GPIOn, 0), GPIO0, _1, ()
7030        ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _1, () ()), ((LP_GPIO2, LP_GPIOn, 2),
7031        GPIO2, _1, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _1, () ()), ((LP_GPIO4,
7032        LP_GPIOn, 4), GPIO4, _1, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO5, _1, () ()),
7033        ((LP_GPIO6, LP_GPIOn, 6), GPIO6, _1, () ()), ((LP_GPIO7, LP_GPIOn, 7), GPIO7, _1,
7034        () ())));
7035    };
7036}
7037/// This macro can be used to generate code for each IOMUX digital function of each GPIO.
7038///
7039/// IOMUX functions are the alternate digital functions configured via the IO_MUX registers.
7040/// Use this to implement signal-specific traits for peripherals whose pins must bypass the
7041/// GPIO matrix (e.g., EMAC, USB).
7042///
7043/// For an explanation on the general syntax, as well as usage of individual/repeated
7044/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
7045///
7046/// This macro has two options for its "Individual matcher" case:
7047///
7048/// - `all`: `($signal:ident, $gpio:ident, $af:ident)` - simple case where you only need
7049///   identifiers, and maybe the alternate function.
7050/// - group: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident, $af:ident)` -
7051///   expanded signal case, where you need the number(s) of a signal, or the general group to which
7052///   the signal belongs.
7053///
7054/// Macro fragments:
7055///
7056/// - `$signal`: the name of the signal.
7057/// - `$group`: the name of the signal, with numbers replaced by placeholders.
7058/// - `$number`: the numbers extracted from `$signal`.
7059/// - `$gpio`: the name of the GPIO.
7060/// - `$af`: the alternate function number, as an identifier (e.g. `_5`).
7061///
7062/// Example data:
7063/// - `(EMAC_RXD0, GPIO25, _5)`
7064/// - `((EMAC_RXDn, EMAC_RXDn, 0), GPIO25, _5)`
7065///
7066/// The expanded syntax is only available when the signal has at least one numbered component.
7067#[macro_export]
7068#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7069macro_rules! for_each_iomux_function {
7070    ($($pattern:tt => $code:tt;)*) => {
7071        macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
7072        tt) => {} } _for_each_inner_iomux_function!((LCD_DATA_19, GPIO2, _3));
7073        _for_each_inner_iomux_function!((LCD_DATA_20, GPIO3, _3));
7074        _for_each_inner_iomux_function!((LCD_DATA_21, GPIO4, _3));
7075        _for_each_inner_iomux_function!((LCD_DATA_22, GPIO5, _3));
7076        _for_each_inner_iomux_function!((LCD_DATA_23, GPIO7, _3));
7077        _for_each_inner_iomux_function!((EMAC_TXD0, GPIO8, _2));
7078        _for_each_inner_iomux_function!((LCD_DATA_0, GPIO8, _3));
7079        _for_each_inner_iomux_function!((FSPIHD, GPIO9, _0));
7080        _for_each_inner_iomux_function!((EMAC_TXD1, GPIO9, _2));
7081        _for_each_inner_iomux_function!((LCD_DATA_1, GPIO9, _3));
7082        _for_each_inner_iomux_function!((DBG_PSRAM_CK, GPIO9, _4));
7083        _for_each_inner_iomux_function!((FSPICS0, GPIO10, _0));
7084        _for_each_inner_iomux_function!((EMAC_TXD2, GPIO10, _2));
7085        _for_each_inner_iomux_function!((LCD_DATA_2, GPIO10, _3));
7086        _for_each_inner_iomux_function!((DBG_PSRAM_CS, GPIO10, _4));
7087        _for_each_inner_iomux_function!((FSPID, GPIO11, _0));
7088        _for_each_inner_iomux_function!((EMAC_TXD3, GPIO11, _2));
7089        _for_each_inner_iomux_function!((LCD_DATA_3, GPIO11, _3));
7090        _for_each_inner_iomux_function!((DBG_PSRAM_D, GPIO11, _4));
7091        _for_each_inner_iomux_function!((FSPICLK, GPIO12, _0));
7092        _for_each_inner_iomux_function!((EMAC_TXEN, GPIO12, _2));
7093        _for_each_inner_iomux_function!((LCD_DATA_4, GPIO12, _3));
7094        _for_each_inner_iomux_function!((DBG_PSRAM_Q, GPIO12, _4));
7095        _for_each_inner_iomux_function!((FSPIQ, GPIO13, _0));
7096        _for_each_inner_iomux_function!((EMAC_RMII_CLK, GPIO13, _2));
7097        _for_each_inner_iomux_function!((LCD_DATA_5, GPIO13, _3));
7098        _for_each_inner_iomux_function!((DBG_PSRAM_WP, GPIO13, _4));
7099        _for_each_inner_iomux_function!((FSPIWP, GPIO14, _0));
7100        _for_each_inner_iomux_function!((EMAC_RX_CLK, GPIO14, _2));
7101        _for_each_inner_iomux_function!((LCD_DATA_6, GPIO14, _3));
7102        _for_each_inner_iomux_function!((DBG_PSRAM_HOLD, GPIO14, _4));
7103        _for_each_inner_iomux_function!((FSPIIO4, GPIO15, _0));
7104        _for_each_inner_iomux_function!((EMAC_RXDV, GPIO15, _2));
7105        _for_each_inner_iomux_function!((LCD_DATA_7, GPIO15, _3));
7106        _for_each_inner_iomux_function!((DBG_PSRAM_DQ4, GPIO15, _4));
7107        _for_each_inner_iomux_function!((FSPIIO5, GPIO16, _0));
7108        _for_each_inner_iomux_function!((EMAC_RXD3, GPIO16, _2));
7109        _for_each_inner_iomux_function!((LCD_DATA_8, GPIO16, _3));
7110        _for_each_inner_iomux_function!((DBG_PSRAM_DQ5, GPIO16, _4));
7111        _for_each_inner_iomux_function!((FSPIIO6, GPIO17, _0));
7112        _for_each_inner_iomux_function!((EMAC_RXD2, GPIO17, _2));
7113        _for_each_inner_iomux_function!((LCD_DATA_9, GPIO17, _3));
7114        _for_each_inner_iomux_function!((DBG_PSRAM_DQ6, GPIO17, _4));
7115        _for_each_inner_iomux_function!((FSPIIO7, GPIO18, _0));
7116        _for_each_inner_iomux_function!((EMAC_RXD1, GPIO18, _2));
7117        _for_each_inner_iomux_function!((LCD_DATA_10, GPIO18, _3));
7118        _for_each_inner_iomux_function!((DBG_PSRAM_DQ7, GPIO18, _4));
7119        _for_each_inner_iomux_function!((FSPIDQS, GPIO19, _0));
7120        _for_each_inner_iomux_function!((EMAC_RXD0, GPIO19, _2));
7121        _for_each_inner_iomux_function!((LCD_DATA_11, GPIO19, _3));
7122        _for_each_inner_iomux_function!((DBG_PSRAM_DQS_0, GPIO19, _4));
7123        _for_each_inner_iomux_function!((SD1_DATA0, GPIO20, _0));
7124        _for_each_inner_iomux_function!((FSPICLK, GPIO20, _2));
7125        _for_each_inner_iomux_function!((DBG_FLASH_CK, GPIO20, _4));
7126        _for_each_inner_iomux_function!((SD1_DATA1, GPIO21, _0));
7127        _for_each_inner_iomux_function!((FSPID, GPIO21, _2));
7128        _for_each_inner_iomux_function!((DBG_FLASH_D, GPIO21, _4));
7129        _for_each_inner_iomux_function!((SD1_DATA2, GPIO22, _0));
7130        _for_each_inner_iomux_function!((FSPIQ, GPIO22, _2));
7131        _for_each_inner_iomux_function!((DBG_FLASH_CS, GPIO22, _4));
7132        _for_each_inner_iomux_function!((SD1_DATA3, GPIO23, _0));
7133        _for_each_inner_iomux_function!((FSPICS0, GPIO23, _2));
7134        _for_each_inner_iomux_function!((DBG_FLASH_Q, GPIO23, _4));
7135        _for_each_inner_iomux_function!((SD1_CLK, GPIO24, _0));
7136        _for_each_inner_iomux_function!((FSPIHD, GPIO24, _2));
7137        _for_each_inner_iomux_function!((DBG_FLASH_WP, GPIO24, _4));
7138        _for_each_inner_iomux_function!((SD1_CMD, GPIO25, _0));
7139        _for_each_inner_iomux_function!((FSPIWP, GPIO25, _2));
7140        _for_each_inner_iomux_function!((DBG_FLASH_HOLD, GPIO25, _4));
7141        _for_each_inner_iomux_function!((SPICS0, GPIO26, _0));
7142        _for_each_inner_iomux_function!((SPIQ, GPIO27, _0));
7143        _for_each_inner_iomux_function!((SPIWP, GPIO28, _0));
7144        _for_each_inner_iomux_function!((SPIHD, GPIO30, _0));
7145        _for_each_inner_iomux_function!((SPICLK, GPIO31, _0));
7146        _for_each_inner_iomux_function!((SPID, GPIO32, _0));
7147        _for_each_inner_iomux_function!((LCD_DATA_12, GPIO33, _3));
7148        _for_each_inner_iomux_function!((LCD_DATA_13, GPIO34, _3));
7149        _for_each_inner_iomux_function!((REF_50M_CLK, GPIO35, _2));
7150        _for_each_inner_iomux_function!((LCD_DATA_14, GPIO35, _3));
7151        _for_each_inner_iomux_function!((SD2_CDATA0, GPIO35, _4));
7152        _for_each_inner_iomux_function!((EMAC_RXDV, GPIO36, _2));
7153        _for_each_inner_iomux_function!((LCD_DATA_15, GPIO36, _3));
7154        _for_each_inner_iomux_function!((SD2_CDATA1, GPIO36, _4));
7155        _for_each_inner_iomux_function!((EMAC_TXEN, GPIO37, _2));
7156        _for_each_inner_iomux_function!((LCD_DATA_16, GPIO37, _3));
7157        _for_each_inner_iomux_function!((SD2_CDATA2, GPIO37, _4));
7158        _for_each_inner_iomux_function!((EMAC_RXD3, GPIO38, _2));
7159        _for_each_inner_iomux_function!((LCD_DATA_17, GPIO38, _3));
7160        _for_each_inner_iomux_function!((SD2_CDATA3, GPIO38, _4));
7161        _for_each_inner_iomux_function!((EMAC_RXD2, GPIO39, _2));
7162        _for_each_inner_iomux_function!((LCD_DATA_18, GPIO39, _3));
7163        _for_each_inner_iomux_function!((SD2_CCLK, GPIO39, _4));
7164        _for_each_inner_iomux_function!((EMAC_RXD1, GPIO40, _2));
7165        _for_each_inner_iomux_function!((LCD_PCLK, GPIO40, _3));
7166        _for_each_inner_iomux_function!((SD2_CCMD, GPIO40, _4));
7167        _for_each_inner_iomux_function!((EMAC_RX_CLK, GPIO42, _2));
7168        _for_each_inner_iomux_function!((EMAC_RMII_CLK, GPIO43, _2));
7169        _for_each_inner_iomux_function!((LCD_H_ENABLE, GPIO43, _3));
7170        _for_each_inner_iomux_function!((EMAC_TXD0, GPIO44, _2));
7171        _for_each_inner_iomux_function!((LCD_H_SYNC, GPIO44, _3));
7172        _for_each_inner_iomux_function!((EMAC_TXD1, GPIO45, _2));
7173        _for_each_inner_iomux_function!((LCD_V_SYNC, GPIO45, _3));
7174        _for_each_inner_iomux_function!((EMAC_TXD2, GPIO46, _2));
7175        _for_each_inner_iomux_function!((CAM_DATA_0, GPIO46, _3));
7176        _for_each_inner_iomux_function!((EMAC_TXD3, GPIO47, _2));
7177        _for_each_inner_iomux_function!((CAM_DATA_1, GPIO47, _3));
7178        _for_each_inner_iomux_function!((CAM_DATA_2, GPIO48, _3));
7179        _for_each_inner_iomux_function!((CAM_DATA_3, GPIO49, _3));
7180        _for_each_inner_iomux_function!((CAM_DATA_4, GPIO50, _3));
7181        _for_each_inner_iomux_function!((CAM_DATA_5, GPIO51, _3));
7182        _for_each_inner_iomux_function!((FSPICS0, GPIO52, _2));
7183        _for_each_inner_iomux_function!((CAM_DATA_6, GPIO52, _3));
7184        _for_each_inner_iomux_function!((FSPICLK, GPIO53, _2));
7185        _for_each_inner_iomux_function!((CAM_DATA_7, GPIO53, _3));
7186        _for_each_inner_iomux_function!((MTDO, GPIO54, _0));
7187        _for_each_inner_iomux_function!((FSPID, GPIO54, _2));
7188        _for_each_inner_iomux_function!((CAM_PCLK, GPIO54, _3));
7189        _for_each_inner_iomux_function!((MTCK, GPIO55, _0));
7190        _for_each_inner_iomux_function!((FSPIQ, GPIO55, _2));
7191        _for_each_inner_iomux_function!((CAM_XCLK, GPIO55, _3));
7192        _for_each_inner_iomux_function!((MTDI, GPIO56, _0));
7193        _for_each_inner_iomux_function!((FSPIHD, GPIO56, _2));
7194        _for_each_inner_iomux_function!((CAM_V_SYNC, GPIO56, _3));
7195        _for_each_inner_iomux_function!((MTMS, GPIO57, _0));
7196        _for_each_inner_iomux_function!((FSPIWP, GPIO57, _2));
7197        _for_each_inner_iomux_function!((CAM_H_SYNC, GPIO57, _3));
7198        _for_each_inner_iomux_function!((U0TXD, GPIO58, _0));
7199        _for_each_inner_iomux_function!((U0RXD, GPIO59, _0));
7200        _for_each_inner_iomux_function!(((LCD_DATA_19, LCD_DATA_n, 19), GPIO2, _3));
7201        _for_each_inner_iomux_function!(((LCD_DATA_20, LCD_DATA_n, 20), GPIO3, _3));
7202        _for_each_inner_iomux_function!(((LCD_DATA_21, LCD_DATA_n, 21), GPIO4, _3));
7203        _for_each_inner_iomux_function!(((LCD_DATA_22, LCD_DATA_n, 22), GPIO5, _3));
7204        _for_each_inner_iomux_function!(((LCD_DATA_23, LCD_DATA_n, 23), GPIO7, _3));
7205        _for_each_inner_iomux_function!(((LCD_DATA_0, LCD_DATA_n, 0), GPIO8, _3));
7206        _for_each_inner_iomux_function!(((LCD_DATA_1, LCD_DATA_n, 1), GPIO9, _3));
7207        _for_each_inner_iomux_function!(((LCD_DATA_2, LCD_DATA_n, 2), GPIO10, _3));
7208        _for_each_inner_iomux_function!(((LCD_DATA_3, LCD_DATA_n, 3), GPIO11, _3));
7209        _for_each_inner_iomux_function!(((LCD_DATA_4, LCD_DATA_n, 4), GPIO12, _3));
7210        _for_each_inner_iomux_function!(((LCD_DATA_5, LCD_DATA_n, 5), GPIO13, _3));
7211        _for_each_inner_iomux_function!(((LCD_DATA_6, LCD_DATA_n, 6), GPIO14, _3));
7212        _for_each_inner_iomux_function!(((LCD_DATA_7, LCD_DATA_n, 7), GPIO15, _3));
7213        _for_each_inner_iomux_function!(((LCD_DATA_8, LCD_DATA_n, 8), GPIO16, _3));
7214        _for_each_inner_iomux_function!(((LCD_DATA_9, LCD_DATA_n, 9), GPIO17, _3));
7215        _for_each_inner_iomux_function!(((LCD_DATA_10, LCD_DATA_n, 10), GPIO18, _3));
7216        _for_each_inner_iomux_function!(((LCD_DATA_11, LCD_DATA_n, 11), GPIO19, _3));
7217        _for_each_inner_iomux_function!(((LCD_DATA_12, LCD_DATA_n, 12), GPIO33, _3));
7218        _for_each_inner_iomux_function!(((LCD_DATA_13, LCD_DATA_n, 13), GPIO34, _3));
7219        _for_each_inner_iomux_function!(((LCD_DATA_14, LCD_DATA_n, 14), GPIO35, _3));
7220        _for_each_inner_iomux_function!(((LCD_DATA_15, LCD_DATA_n, 15), GPIO36, _3));
7221        _for_each_inner_iomux_function!(((LCD_DATA_16, LCD_DATA_n, 16), GPIO37, _3));
7222        _for_each_inner_iomux_function!(((LCD_DATA_17, LCD_DATA_n, 17), GPIO38, _3));
7223        _for_each_inner_iomux_function!(((LCD_DATA_18, LCD_DATA_n, 18), GPIO39, _3));
7224        _for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO8, _2));
7225        _for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO9, _2));
7226        _for_each_inner_iomux_function!(((EMAC_TXD2, EMAC_TXDn, 2), GPIO10, _2));
7227        _for_each_inner_iomux_function!(((EMAC_TXD3, EMAC_TXDn, 3), GPIO11, _2));
7228        _for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO44, _2));
7229        _for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO45, _2));
7230        _for_each_inner_iomux_function!(((EMAC_TXD2, EMAC_TXDn, 2), GPIO46, _2));
7231        _for_each_inner_iomux_function!(((EMAC_TXD3, EMAC_TXDn, 3), GPIO47, _2));
7232        _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO10, _0));
7233        _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO23, _2));
7234        _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO52, _2));
7235        _for_each_inner_iomux_function!(((FSPIIO4, FSPIIOn, 4), GPIO15, _0));
7236        _for_each_inner_iomux_function!(((FSPIIO5, FSPIIOn, 5), GPIO16, _0));
7237        _for_each_inner_iomux_function!(((FSPIIO6, FSPIIOn, 6), GPIO17, _0));
7238        _for_each_inner_iomux_function!(((FSPIIO7, FSPIIOn, 7), GPIO18, _0));
7239        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4), GPIO15, _4));
7240        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO16, _4));
7241        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ6, DBG_PSRAM_DQn, 6), GPIO17, _4));
7242        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO18, _4));
7243        _for_each_inner_iomux_function!(((EMAC_RXD3, EMAC_RXDn, 3), GPIO16, _2));
7244        _for_each_inner_iomux_function!(((EMAC_RXD2, EMAC_RXDn, 2), GPIO17, _2));
7245        _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO18, _2));
7246        _for_each_inner_iomux_function!(((EMAC_RXD0, EMAC_RXDn, 0), GPIO19, _2));
7247        _for_each_inner_iomux_function!(((EMAC_RXD3, EMAC_RXDn, 3), GPIO38, _2));
7248        _for_each_inner_iomux_function!(((EMAC_RXD2, EMAC_RXDn, 2), GPIO39, _2));
7249        _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO40, _2));
7250        _for_each_inner_iomux_function!(((DBG_PSRAM_DQS_0, DBG_PSRAM_DQS_n, 0), GPIO19,
7251        _4)); _for_each_inner_iomux_function!(((SD1_DATA0, SDn_DATAm, 1, 0), GPIO20,
7252        _0)); _for_each_inner_iomux_function!(((SD1_DATA1, SDn_DATAm, 1, 1), GPIO21,
7253        _0)); _for_each_inner_iomux_function!(((SD1_DATA2, SDn_DATAm, 1, 2), GPIO22,
7254        _0)); _for_each_inner_iomux_function!(((SD1_DATA3, SDn_DATAm, 1, 3), GPIO23,
7255        _0)); _for_each_inner_iomux_function!(((SD1_CLK, SDn_CLK, 1), GPIO24, _0));
7256        _for_each_inner_iomux_function!(((SD1_CMD, SDn_CMD, 1), GPIO25, _0));
7257        _for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO26, _0));
7258        _for_each_inner_iomux_function!(((SD2_CDATA0, SDn_CDATAm, 2, 0), GPIO35, _4));
7259        _for_each_inner_iomux_function!(((SD2_CDATA1, SDn_CDATAm, 2, 1), GPIO36, _4));
7260        _for_each_inner_iomux_function!(((SD2_CDATA2, SDn_CDATAm, 2, 2), GPIO37, _4));
7261        _for_each_inner_iomux_function!(((SD2_CDATA3, SDn_CDATAm, 2, 3), GPIO38, _4));
7262        _for_each_inner_iomux_function!(((SD2_CCLK, SDn_CCLK, 2), GPIO39, _4));
7263        _for_each_inner_iomux_function!(((SD2_CCMD, SDn_CCMD, 2), GPIO40, _4));
7264        _for_each_inner_iomux_function!(((CAM_DATA_0, CAM_DATA_n, 0), GPIO46, _3));
7265        _for_each_inner_iomux_function!(((CAM_DATA_1, CAM_DATA_n, 1), GPIO47, _3));
7266        _for_each_inner_iomux_function!(((CAM_DATA_2, CAM_DATA_n, 2), GPIO48, _3));
7267        _for_each_inner_iomux_function!(((CAM_DATA_3, CAM_DATA_n, 3), GPIO49, _3));
7268        _for_each_inner_iomux_function!(((CAM_DATA_4, CAM_DATA_n, 4), GPIO50, _3));
7269        _for_each_inner_iomux_function!(((CAM_DATA_5, CAM_DATA_n, 5), GPIO51, _3));
7270        _for_each_inner_iomux_function!(((CAM_DATA_6, CAM_DATA_n, 6), GPIO52, _3));
7271        _for_each_inner_iomux_function!(((CAM_DATA_7, CAM_DATA_n, 7), GPIO53, _3));
7272        _for_each_inner_iomux_function!((all(LCD_DATA_19, GPIO2, _3), (LCD_DATA_20,
7273        GPIO3, _3), (LCD_DATA_21, GPIO4, _3), (LCD_DATA_22, GPIO5, _3), (LCD_DATA_23,
7274        GPIO7, _3), (EMAC_TXD0, GPIO8, _2), (LCD_DATA_0, GPIO8, _3), (FSPIHD, GPIO9, _0),
7275        (EMAC_TXD1, GPIO9, _2), (LCD_DATA_1, GPIO9, _3), (DBG_PSRAM_CK, GPIO9, _4),
7276        (FSPICS0, GPIO10, _0), (EMAC_TXD2, GPIO10, _2), (LCD_DATA_2, GPIO10, _3),
7277        (DBG_PSRAM_CS, GPIO10, _4), (FSPID, GPIO11, _0), (EMAC_TXD3, GPIO11, _2),
7278        (LCD_DATA_3, GPIO11, _3), (DBG_PSRAM_D, GPIO11, _4), (FSPICLK, GPIO12, _0),
7279        (EMAC_TXEN, GPIO12, _2), (LCD_DATA_4, GPIO12, _3), (DBG_PSRAM_Q, GPIO12, _4),
7280        (FSPIQ, GPIO13, _0), (EMAC_RMII_CLK, GPIO13, _2), (LCD_DATA_5, GPIO13, _3),
7281        (DBG_PSRAM_WP, GPIO13, _4), (FSPIWP, GPIO14, _0), (EMAC_RX_CLK, GPIO14, _2),
7282        (LCD_DATA_6, GPIO14, _3), (DBG_PSRAM_HOLD, GPIO14, _4), (FSPIIO4, GPIO15, _0),
7283        (EMAC_RXDV, GPIO15, _2), (LCD_DATA_7, GPIO15, _3), (DBG_PSRAM_DQ4, GPIO15, _4),
7284        (FSPIIO5, GPIO16, _0), (EMAC_RXD3, GPIO16, _2), (LCD_DATA_8, GPIO16, _3),
7285        (DBG_PSRAM_DQ5, GPIO16, _4), (FSPIIO6, GPIO17, _0), (EMAC_RXD2, GPIO17, _2),
7286        (LCD_DATA_9, GPIO17, _3), (DBG_PSRAM_DQ6, GPIO17, _4), (FSPIIO7, GPIO18, _0),
7287        (EMAC_RXD1, GPIO18, _2), (LCD_DATA_10, GPIO18, _3), (DBG_PSRAM_DQ7, GPIO18, _4),
7288        (FSPIDQS, GPIO19, _0), (EMAC_RXD0, GPIO19, _2), (LCD_DATA_11, GPIO19, _3),
7289        (DBG_PSRAM_DQS_0, GPIO19, _4), (SD1_DATA0, GPIO20, _0), (FSPICLK, GPIO20, _2),
7290        (DBG_FLASH_CK, GPIO20, _4), (SD1_DATA1, GPIO21, _0), (FSPID, GPIO21, _2),
7291        (DBG_FLASH_D, GPIO21, _4), (SD1_DATA2, GPIO22, _0), (FSPIQ, GPIO22, _2),
7292        (DBG_FLASH_CS, GPIO22, _4), (SD1_DATA3, GPIO23, _0), (FSPICS0, GPIO23, _2),
7293        (DBG_FLASH_Q, GPIO23, _4), (SD1_CLK, GPIO24, _0), (FSPIHD, GPIO24, _2),
7294        (DBG_FLASH_WP, GPIO24, _4), (SD1_CMD, GPIO25, _0), (FSPIWP, GPIO25, _2),
7295        (DBG_FLASH_HOLD, GPIO25, _4), (SPICS0, GPIO26, _0), (SPIQ, GPIO27, _0), (SPIWP,
7296        GPIO28, _0), (SPIHD, GPIO30, _0), (SPICLK, GPIO31, _0), (SPID, GPIO32, _0),
7297        (LCD_DATA_12, GPIO33, _3), (LCD_DATA_13, GPIO34, _3), (REF_50M_CLK, GPIO35, _2),
7298        (LCD_DATA_14, GPIO35, _3), (SD2_CDATA0, GPIO35, _4), (EMAC_RXDV, GPIO36, _2),
7299        (LCD_DATA_15, GPIO36, _3), (SD2_CDATA1, GPIO36, _4), (EMAC_TXEN, GPIO37, _2),
7300        (LCD_DATA_16, GPIO37, _3), (SD2_CDATA2, GPIO37, _4), (EMAC_RXD3, GPIO38, _2),
7301        (LCD_DATA_17, GPIO38, _3), (SD2_CDATA3, GPIO38, _4), (EMAC_RXD2, GPIO39, _2),
7302        (LCD_DATA_18, GPIO39, _3), (SD2_CCLK, GPIO39, _4), (EMAC_RXD1, GPIO40, _2),
7303        (LCD_PCLK, GPIO40, _3), (SD2_CCMD, GPIO40, _4), (EMAC_RX_CLK, GPIO42, _2),
7304        (EMAC_RMII_CLK, GPIO43, _2), (LCD_H_ENABLE, GPIO43, _3), (EMAC_TXD0, GPIO44, _2),
7305        (LCD_H_SYNC, GPIO44, _3), (EMAC_TXD1, GPIO45, _2), (LCD_V_SYNC, GPIO45, _3),
7306        (EMAC_TXD2, GPIO46, _2), (CAM_DATA_0, GPIO46, _3), (EMAC_TXD3, GPIO47, _2),
7307        (CAM_DATA_1, GPIO47, _3), (CAM_DATA_2, GPIO48, _3), (CAM_DATA_3, GPIO49, _3),
7308        (CAM_DATA_4, GPIO50, _3), (CAM_DATA_5, GPIO51, _3), (FSPICS0, GPIO52, _2),
7309        (CAM_DATA_6, GPIO52, _3), (FSPICLK, GPIO53, _2), (CAM_DATA_7, GPIO53, _3), (MTDO,
7310        GPIO54, _0), (FSPID, GPIO54, _2), (CAM_PCLK, GPIO54, _3), (MTCK, GPIO55, _0),
7311        (FSPIQ, GPIO55, _2), (CAM_XCLK, GPIO55, _3), (MTDI, GPIO56, _0), (FSPIHD, GPIO56,
7312        _2), (CAM_V_SYNC, GPIO56, _3), (MTMS, GPIO57, _0), (FSPIWP, GPIO57, _2),
7313        (CAM_H_SYNC, GPIO57, _3), (U0TXD, GPIO58, _0), (U0RXD, GPIO59, _0)));
7314        _for_each_inner_iomux_function!((LCD_DATA_n((LCD_DATA_19, LCD_DATA_n, 19), GPIO2,
7315        _3), ((LCD_DATA_20, LCD_DATA_n, 20), GPIO3, _3), ((LCD_DATA_21, LCD_DATA_n, 21),
7316        GPIO4, _3), ((LCD_DATA_22, LCD_DATA_n, 22), GPIO5, _3), ((LCD_DATA_23,
7317        LCD_DATA_n, 23), GPIO7, _3), ((LCD_DATA_0, LCD_DATA_n, 0), GPIO8, _3),
7318        ((LCD_DATA_1, LCD_DATA_n, 1), GPIO9, _3), ((LCD_DATA_2, LCD_DATA_n, 2), GPIO10,
7319        _3), ((LCD_DATA_3, LCD_DATA_n, 3), GPIO11, _3), ((LCD_DATA_4, LCD_DATA_n, 4),
7320        GPIO12, _3), ((LCD_DATA_5, LCD_DATA_n, 5), GPIO13, _3), ((LCD_DATA_6, LCD_DATA_n,
7321        6), GPIO14, _3), ((LCD_DATA_7, LCD_DATA_n, 7), GPIO15, _3), ((LCD_DATA_8,
7322        LCD_DATA_n, 8), GPIO16, _3), ((LCD_DATA_9, LCD_DATA_n, 9), GPIO17, _3),
7323        ((LCD_DATA_10, LCD_DATA_n, 10), GPIO18, _3), ((LCD_DATA_11, LCD_DATA_n, 11),
7324        GPIO19, _3), ((LCD_DATA_12, LCD_DATA_n, 12), GPIO33, _3), ((LCD_DATA_13,
7325        LCD_DATA_n, 13), GPIO34, _3), ((LCD_DATA_14, LCD_DATA_n, 14), GPIO35, _3),
7326        ((LCD_DATA_15, LCD_DATA_n, 15), GPIO36, _3), ((LCD_DATA_16, LCD_DATA_n, 16),
7327        GPIO37, _3), ((LCD_DATA_17, LCD_DATA_n, 17), GPIO38, _3), ((LCD_DATA_18,
7328        LCD_DATA_n, 18), GPIO39, _3)));
7329        _for_each_inner_iomux_function!((EMAC_TXDn((EMAC_TXD0, EMAC_TXDn, 0), GPIO8, _2),
7330        ((EMAC_TXD1, EMAC_TXDn, 1), GPIO9, _2), ((EMAC_TXD2, EMAC_TXDn, 2), GPIO10, _2),
7331        ((EMAC_TXD3, EMAC_TXDn, 3), GPIO11, _2), ((EMAC_TXD0, EMAC_TXDn, 0), GPIO44, _2),
7332        ((EMAC_TXD1, EMAC_TXDn, 1), GPIO45, _2), ((EMAC_TXD2, EMAC_TXDn, 2), GPIO46, _2),
7333        ((EMAC_TXD3, EMAC_TXDn, 3), GPIO47, _2)));
7334        _for_each_inner_iomux_function!((FSPICSn((FSPICS0, FSPICSn, 0), GPIO10, _0),
7335        ((FSPICS0, FSPICSn, 0), GPIO23, _2), ((FSPICS0, FSPICSn, 0), GPIO52, _2)));
7336        _for_each_inner_iomux_function!((FSPIIOn((FSPIIO4, FSPIIOn, 4), GPIO15, _0),
7337        ((FSPIIO5, FSPIIOn, 5), GPIO16, _0), ((FSPIIO6, FSPIIOn, 6), GPIO17, _0),
7338        ((FSPIIO7, FSPIIOn, 7), GPIO18, _0)));
7339        _for_each_inner_iomux_function!((DBG_PSRAM_DQn((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4),
7340        GPIO15, _4), ((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO16, _4), ((DBG_PSRAM_DQ6,
7341        DBG_PSRAM_DQn, 6), GPIO17, _4), ((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO18,
7342        _4))); _for_each_inner_iomux_function!((EMAC_RXDn((EMAC_RXD3, EMAC_RXDn, 3),
7343        GPIO16, _2), ((EMAC_RXD2, EMAC_RXDn, 2), GPIO17, _2), ((EMAC_RXD1, EMAC_RXDn, 1),
7344        GPIO18, _2), ((EMAC_RXD0, EMAC_RXDn, 0), GPIO19, _2), ((EMAC_RXD3, EMAC_RXDn, 3),
7345        GPIO38, _2), ((EMAC_RXD2, EMAC_RXDn, 2), GPIO39, _2), ((EMAC_RXD1, EMAC_RXDn, 1),
7346        GPIO40, _2))); _for_each_inner_iomux_function!((DBG_PSRAM_DQS_n((DBG_PSRAM_DQS_0,
7347        DBG_PSRAM_DQS_n, 0), GPIO19, _4)));
7348        _for_each_inner_iomux_function!((SDn_DATAm((SD1_DATA0, SDn_DATAm, 1, 0), GPIO20,
7349        _0), ((SD1_DATA1, SDn_DATAm, 1, 1), GPIO21, _0), ((SD1_DATA2, SDn_DATAm, 1, 2),
7350        GPIO22, _0), ((SD1_DATA3, SDn_DATAm, 1, 3), GPIO23, _0)));
7351        _for_each_inner_iomux_function!((SDn_CLK((SD1_CLK, SDn_CLK, 1), GPIO24, _0)));
7352        _for_each_inner_iomux_function!((SDn_CMD((SD1_CMD, SDn_CMD, 1), GPIO25, _0)));
7353        _for_each_inner_iomux_function!((SPICSn((SPICS0, SPICSn, 0), GPIO26, _0)));
7354        _for_each_inner_iomux_function!((SDn_CDATAm((SD2_CDATA0, SDn_CDATAm, 2, 0),
7355        GPIO35, _4), ((SD2_CDATA1, SDn_CDATAm, 2, 1), GPIO36, _4), ((SD2_CDATA2,
7356        SDn_CDATAm, 2, 2), GPIO37, _4), ((SD2_CDATA3, SDn_CDATAm, 2, 3), GPIO38, _4)));
7357        _for_each_inner_iomux_function!((SDn_CCLK((SD2_CCLK, SDn_CCLK, 2), GPIO39, _4)));
7358        _for_each_inner_iomux_function!((SDn_CCMD((SD2_CCMD, SDn_CCMD, 2), GPIO40, _4)));
7359        _for_each_inner_iomux_function!((CAM_DATA_n((CAM_DATA_0, CAM_DATA_n, 0), GPIO46,
7360        _3), ((CAM_DATA_1, CAM_DATA_n, 1), GPIO47, _3), ((CAM_DATA_2, CAM_DATA_n, 2),
7361        GPIO48, _3), ((CAM_DATA_3, CAM_DATA_n, 3), GPIO49, _3), ((CAM_DATA_4, CAM_DATA_n,
7362        4), GPIO50, _3), ((CAM_DATA_5, CAM_DATA_n, 5), GPIO51, _3), ((CAM_DATA_6,
7363        CAM_DATA_n, 6), GPIO52, _3), ((CAM_DATA_7, CAM_DATA_n, 7), GPIO53, _3)));
7364    };
7365}
7366/// Returns the name of the GPIO that provides the given signal, as a string.
7367///
7368/// The macro takes the name of a direct function - a digital IO MUX function, an analog
7369/// function, or an LP IO MUX function - and expands to a string literal like `"GPIO4"`. It
7370/// is meant to keep documentation free of per-chip pin lists.
7371///
7372/// Signals that are not wired to a pad on this chip have to be routed through the GPIO
7373/// matrix, which can reach any pad. The macro has no pad to return for those, so it accepts
7374/// an optional fallback to expand to instead. The fallback is not validated.
7375///
7376/// If multiple pads provide the signal, the macro returns one that is not reserved for some
7377/// other purpose, such as booting or interfacing with flash.
7378///
7379/// Example usage:
7380/// - `gpio_for_signal!(ADC1_CH0)`
7381/// - `gpio_for_signal!(LP_I2C_SDA, "GPIO6")`
7382#[macro_export]
7383#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7384macro_rules! gpio_for_signal {
7385    (XTAL_32K_N $(, $_fallback:literal)?) => {
7386        "GPIO0"
7387    };
7388    (LP_GPIO0 $(, $_fallback:literal)?) => {
7389        "GPIO0"
7390    };
7391    (XTAL_32K_P $(, $_fallback:literal)?) => {
7392        "GPIO1"
7393    };
7394    (LP_GPIO1 $(, $_fallback:literal)?) => {
7395        "GPIO1"
7396    };
7397    (LCD_DATA_19 $(, $_fallback:literal)?) => {
7398        "GPIO2"
7399    };
7400    (LP_GPIO2 $(, $_fallback:literal)?) => {
7401        "GPIO2"
7402    };
7403    (LCD_DATA_20 $(, $_fallback:literal)?) => {
7404        "GPIO3"
7405    };
7406    (LP_GPIO3 $(, $_fallback:literal)?) => {
7407        "GPIO3"
7408    };
7409    (LCD_DATA_21 $(, $_fallback:literal)?) => {
7410        "GPIO4"
7411    };
7412    (LP_GPIO4 $(, $_fallback:literal)?) => {
7413        "GPIO4"
7414    };
7415    (LCD_DATA_22 $(, $_fallback:literal)?) => {
7416        "GPIO5"
7417    };
7418    (LP_GPIO5 $(, $_fallback:literal)?) => {
7419        "GPIO5"
7420    };
7421    (LP_GPIO6 $(, $_fallback:literal)?) => {
7422        "GPIO6"
7423    };
7424    (LCD_DATA_23 $(, $_fallback:literal)?) => {
7425        "GPIO7"
7426    };
7427    (LP_GPIO7 $(, $_fallback:literal)?) => {
7428        "GPIO7"
7429    };
7430    (EMAC_TXD0 $(, $_fallback:literal)?) => {
7431        "GPIO8"
7432    };
7433    (LCD_DATA_0 $(, $_fallback:literal)?) => {
7434        "GPIO8"
7435    };
7436    (FSPIHD $(, $_fallback:literal)?) => {
7437        "GPIO9"
7438    };
7439    (EMAC_TXD1 $(, $_fallback:literal)?) => {
7440        "GPIO9"
7441    };
7442    (LCD_DATA_1 $(, $_fallback:literal)?) => {
7443        "GPIO9"
7444    };
7445    (DBG_PSRAM_CK $(, $_fallback:literal)?) => {
7446        "GPIO9"
7447    };
7448    (FSPICS0 $(, $_fallback:literal)?) => {
7449        "GPIO10"
7450    };
7451    (EMAC_TXD2 $(, $_fallback:literal)?) => {
7452        "GPIO10"
7453    };
7454    (LCD_DATA_2 $(, $_fallback:literal)?) => {
7455        "GPIO10"
7456    };
7457    (DBG_PSRAM_CS $(, $_fallback:literal)?) => {
7458        "GPIO10"
7459    };
7460    (FSPID $(, $_fallback:literal)?) => {
7461        "GPIO11"
7462    };
7463    (EMAC_TXD3 $(, $_fallback:literal)?) => {
7464        "GPIO11"
7465    };
7466    (LCD_DATA_3 $(, $_fallback:literal)?) => {
7467        "GPIO11"
7468    };
7469    (DBG_PSRAM_D $(, $_fallback:literal)?) => {
7470        "GPIO11"
7471    };
7472    (FSPICLK $(, $_fallback:literal)?) => {
7473        "GPIO12"
7474    };
7475    (EMAC_TXEN $(, $_fallback:literal)?) => {
7476        "GPIO12"
7477    };
7478    (LCD_DATA_4 $(, $_fallback:literal)?) => {
7479        "GPIO12"
7480    };
7481    (DBG_PSRAM_Q $(, $_fallback:literal)?) => {
7482        "GPIO12"
7483    };
7484    (FSPIQ $(, $_fallback:literal)?) => {
7485        "GPIO13"
7486    };
7487    (EMAC_RMII_CLK $(, $_fallback:literal)?) => {
7488        "GPIO13"
7489    };
7490    (LCD_DATA_5 $(, $_fallback:literal)?) => {
7491        "GPIO13"
7492    };
7493    (DBG_PSRAM_WP $(, $_fallback:literal)?) => {
7494        "GPIO13"
7495    };
7496    (FSPIWP $(, $_fallback:literal)?) => {
7497        "GPIO14"
7498    };
7499    (EMAC_RX_CLK $(, $_fallback:literal)?) => {
7500        "GPIO14"
7501    };
7502    (LCD_DATA_6 $(, $_fallback:literal)?) => {
7503        "GPIO14"
7504    };
7505    (DBG_PSRAM_HOLD $(, $_fallback:literal)?) => {
7506        "GPIO14"
7507    };
7508    (FSPIIO4 $(, $_fallback:literal)?) => {
7509        "GPIO15"
7510    };
7511    (EMAC_RXDV $(, $_fallback:literal)?) => {
7512        "GPIO15"
7513    };
7514    (LCD_DATA_7 $(, $_fallback:literal)?) => {
7515        "GPIO15"
7516    };
7517    (DBG_PSRAM_DQ4 $(, $_fallback:literal)?) => {
7518        "GPIO15"
7519    };
7520    (FSPIIO5 $(, $_fallback:literal)?) => {
7521        "GPIO16"
7522    };
7523    (EMAC_RXD3 $(, $_fallback:literal)?) => {
7524        "GPIO16"
7525    };
7526    (LCD_DATA_8 $(, $_fallback:literal)?) => {
7527        "GPIO16"
7528    };
7529    (DBG_PSRAM_DQ5 $(, $_fallback:literal)?) => {
7530        "GPIO16"
7531    };
7532    (FSPIIO6 $(, $_fallback:literal)?) => {
7533        "GPIO17"
7534    };
7535    (EMAC_RXD2 $(, $_fallback:literal)?) => {
7536        "GPIO17"
7537    };
7538    (LCD_DATA_9 $(, $_fallback:literal)?) => {
7539        "GPIO17"
7540    };
7541    (DBG_PSRAM_DQ6 $(, $_fallback:literal)?) => {
7542        "GPIO17"
7543    };
7544    (FSPIIO7 $(, $_fallback:literal)?) => {
7545        "GPIO18"
7546    };
7547    (EMAC_RXD1 $(, $_fallback:literal)?) => {
7548        "GPIO18"
7549    };
7550    (LCD_DATA_10 $(, $_fallback:literal)?) => {
7551        "GPIO18"
7552    };
7553    (DBG_PSRAM_DQ7 $(, $_fallback:literal)?) => {
7554        "GPIO18"
7555    };
7556    (FSPIDQS $(, $_fallback:literal)?) => {
7557        "GPIO19"
7558    };
7559    (EMAC_RXD0 $(, $_fallback:literal)?) => {
7560        "GPIO19"
7561    };
7562    (LCD_DATA_11 $(, $_fallback:literal)?) => {
7563        "GPIO19"
7564    };
7565    (DBG_PSRAM_DQS_0 $(, $_fallback:literal)?) => {
7566        "GPIO19"
7567    };
7568    (SD1_DATA0 $(, $_fallback:literal)?) => {
7569        "GPIO20"
7570    };
7571    (DBG_FLASH_CK $(, $_fallback:literal)?) => {
7572        "GPIO20"
7573    };
7574    (SD1_DATA1 $(, $_fallback:literal)?) => {
7575        "GPIO21"
7576    };
7577    (DBG_FLASH_D $(, $_fallback:literal)?) => {
7578        "GPIO21"
7579    };
7580    (SD1_DATA2 $(, $_fallback:literal)?) => {
7581        "GPIO22"
7582    };
7583    (DBG_FLASH_CS $(, $_fallback:literal)?) => {
7584        "GPIO22"
7585    };
7586    (SD1_DATA3 $(, $_fallback:literal)?) => {
7587        "GPIO23"
7588    };
7589    (DBG_FLASH_Q $(, $_fallback:literal)?) => {
7590        "GPIO23"
7591    };
7592    (SD1_CLK $(, $_fallback:literal)?) => {
7593        "GPIO24"
7594    };
7595    (DBG_FLASH_WP $(, $_fallback:literal)?) => {
7596        "GPIO24"
7597    };
7598    (SD1_CMD $(, $_fallback:literal)?) => {
7599        "GPIO25"
7600    };
7601    (DBG_FLASH_HOLD $(, $_fallback:literal)?) => {
7602        "GPIO25"
7603    };
7604    (SPICS0 $(, $_fallback:literal)?) => {
7605        "GPIO26"
7606    };
7607    (SPIQ $(, $_fallback:literal)?) => {
7608        "GPIO27"
7609    };
7610    (SPIWP $(, $_fallback:literal)?) => {
7611        "GPIO28"
7612    };
7613    (SPIHD $(, $_fallback:literal)?) => {
7614        "GPIO30"
7615    };
7616    (SPICLK $(, $_fallback:literal)?) => {
7617        "GPIO31"
7618    };
7619    (SPID $(, $_fallback:literal)?) => {
7620        "GPIO32"
7621    };
7622    (LCD_DATA_12 $(, $_fallback:literal)?) => {
7623        "GPIO33"
7624    };
7625    (USJ_DM $(, $_fallback:literal)?) => {
7626        "GPIO33"
7627    };
7628    (LCD_DATA_13 $(, $_fallback:literal)?) => {
7629        "GPIO34"
7630    };
7631    (USJ_DP $(, $_fallback:literal)?) => {
7632        "GPIO34"
7633    };
7634    (REF_50M_CLK $(, $_fallback:literal)?) => {
7635        "GPIO35"
7636    };
7637    (LCD_DATA_14 $(, $_fallback:literal)?) => {
7638        "GPIO35"
7639    };
7640    (SD2_CDATA0 $(, $_fallback:literal)?) => {
7641        "GPIO35"
7642    };
7643    (LCD_DATA_15 $(, $_fallback:literal)?) => {
7644        "GPIO36"
7645    };
7646    (SD2_CDATA1 $(, $_fallback:literal)?) => {
7647        "GPIO36"
7648    };
7649    (LCD_DATA_16 $(, $_fallback:literal)?) => {
7650        "GPIO37"
7651    };
7652    (SD2_CDATA2 $(, $_fallback:literal)?) => {
7653        "GPIO37"
7654    };
7655    (LCD_DATA_17 $(, $_fallback:literal)?) => {
7656        "GPIO38"
7657    };
7658    (SD2_CDATA3 $(, $_fallback:literal)?) => {
7659        "GPIO38"
7660    };
7661    (LCD_DATA_18 $(, $_fallback:literal)?) => {
7662        "GPIO39"
7663    };
7664    (SD2_CCLK $(, $_fallback:literal)?) => {
7665        "GPIO39"
7666    };
7667    (LCD_PCLK $(, $_fallback:literal)?) => {
7668        "GPIO40"
7669    };
7670    (SD2_CCMD $(, $_fallback:literal)?) => {
7671        "GPIO40"
7672    };
7673    (ADC1_CH0 $(, $_fallback:literal)?) => {
7674        "GPIO42"
7675    };
7676    (LCD_H_ENABLE $(, $_fallback:literal)?) => {
7677        "GPIO43"
7678    };
7679    (ADC1_CH1 $(, $_fallback:literal)?) => {
7680        "GPIO43"
7681    };
7682    (LCD_H_SYNC $(, $_fallback:literal)?) => {
7683        "GPIO44"
7684    };
7685    (ADC1_CH2 $(, $_fallback:literal)?) => {
7686        "GPIO44"
7687    };
7688    (LCD_V_SYNC $(, $_fallback:literal)?) => {
7689        "GPIO45"
7690    };
7691    (ADC1_CH3 $(, $_fallback:literal)?) => {
7692        "GPIO45"
7693    };
7694    (CAM_DATA_0 $(, $_fallback:literal)?) => {
7695        "GPIO46"
7696    };
7697    (ADC1_CH4 $(, $_fallback:literal)?) => {
7698        "GPIO46"
7699    };
7700    (CAM_DATA_1 $(, $_fallback:literal)?) => {
7701        "GPIO47"
7702    };
7703    (ADC1_CH5 $(, $_fallback:literal)?) => {
7704        "GPIO47"
7705    };
7706    (CAM_DATA_2 $(, $_fallback:literal)?) => {
7707        "GPIO48"
7708    };
7709    (ADC1_CH6 $(, $_fallback:literal)?) => {
7710        "GPIO48"
7711    };
7712    (CAM_DATA_3 $(, $_fallback:literal)?) => {
7713        "GPIO49"
7714    };
7715    (ADC1_CH7 $(, $_fallback:literal)?) => {
7716        "GPIO49"
7717    };
7718    (CAM_DATA_4 $(, $_fallback:literal)?) => {
7719        "GPIO50"
7720    };
7721    (ADC2_CH0 $(, $_fallback:literal)?) => {
7722        "GPIO50"
7723    };
7724    (CAM_DATA_5 $(, $_fallback:literal)?) => {
7725        "GPIO51"
7726    };
7727    (ADC2_CH1 $(, $_fallback:literal)?) => {
7728        "GPIO51"
7729    };
7730    (CAM_DATA_6 $(, $_fallback:literal)?) => {
7731        "GPIO52"
7732    };
7733    (ADC2_CH2 $(, $_fallback:literal)?) => {
7734        "GPIO52"
7735    };
7736    (CAM_DATA_7 $(, $_fallback:literal)?) => {
7737        "GPIO53"
7738    };
7739    (ADC2_CH3 $(, $_fallback:literal)?) => {
7740        "GPIO53"
7741    };
7742    (MTDO $(, $_fallback:literal)?) => {
7743        "GPIO54"
7744    };
7745    (CAM_PCLK $(, $_fallback:literal)?) => {
7746        "GPIO54"
7747    };
7748    (ADC2_CH4 $(, $_fallback:literal)?) => {
7749        "GPIO54"
7750    };
7751    (MTCK $(, $_fallback:literal)?) => {
7752        "GPIO55"
7753    };
7754    (CAM_XCLK $(, $_fallback:literal)?) => {
7755        "GPIO55"
7756    };
7757    (ADC2_CH5 $(, $_fallback:literal)?) => {
7758        "GPIO55"
7759    };
7760    (MTDI $(, $_fallback:literal)?) => {
7761        "GPIO56"
7762    };
7763    (CAM_V_SYNC $(, $_fallback:literal)?) => {
7764        "GPIO56"
7765    };
7766    (ADC2_CH6 $(, $_fallback:literal)?) => {
7767        "GPIO56"
7768    };
7769    (MTMS $(, $_fallback:literal)?) => {
7770        "GPIO57"
7771    };
7772    (CAM_H_SYNC $(, $_fallback:literal)?) => {
7773        "GPIO57"
7774    };
7775    (ADC2_CH7 $(, $_fallback:literal)?) => {
7776        "GPIO57"
7777    };
7778    (U0TXD $(, $_fallback:literal)?) => {
7779        "GPIO58"
7780    };
7781    (U0RXD $(, $_fallback:literal)?) => {
7782        "GPIO59"
7783    };
7784    ($_signal:ident, $fallback:literal) => {
7785        $fallback
7786    };
7787}
7788/// Defines the `InputSignal` and `OutputSignal` enums.
7789///
7790/// This macro is intended to be called in esp-hal only.
7791#[macro_export]
7792#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7793macro_rules! define_io_mux_signals {
7794    () => {
7795        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
7796        #[derive(Debug, PartialEq, Copy, Clone)]
7797        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
7798        #[doc(hidden)]
7799        pub enum InputSignal {
7800            U0RXD                   = 10,
7801            U0CTS                   = 11,
7802            U0DSR                   = 12,
7803            U1RXD                   = 13,
7804            U1CTS                   = 14,
7805            U1DSR                   = 15,
7806            U2RXD                   = 16,
7807            U2CTS                   = 17,
7808            U2DSR                   = 18,
7809            U3RXD                   = 137,
7810            U3CTS                   = 138,
7811            U3DSR                   = 139,
7812            I2S0O_BCK               = 25,
7813            I2S0_MCLK               = 26,
7814            I2S0O_WS                = 27,
7815            I2S0I_SD                = 28,
7816            I2S0I_BCK               = 29,
7817            I2S0I_WS                = 30,
7818            I2S0I_SD1               = 43,
7819            I2S0I_SD2               = 44,
7820            I2S0I_SD3               = 45,
7821            I2S1O_BCK               = 31,
7822            I2S1_MCLK               = 32,
7823            I2S1O_WS                = 33,
7824            I2S1I_SD                = 34,
7825            I2S1I_BCK               = 35,
7826            I2S1I_WS                = 36,
7827            FSPICLK                 = 53,
7828            FSPIQ                   = 54,
7829            FSPID                   = 55,
7830            FSPIHD                  = 56,
7831            FSPIWP                  = 57,
7832            FSPIIO4                 = 58,
7833            FSPIIO5                 = 59,
7834            FSPIIO6                 = 60,
7835            FSPIIO7                 = 61,
7836            FSPICS0                 = 62,
7837            FSPICS1                 = 63,
7838            FSPICS2                 = 64,
7839            FSPICS3                 = 65,
7840            FSPICS4                 = 66,
7841            FSPICS5                 = 67,
7842            SPI3_CK                 = 47,
7843            SPI3_Q                  = 48,
7844            SPI3_D                  = 49,
7845            SPI3_HOLD               = 50,
7846            SPI3_WP                 = 51,
7847            SPI3_CS                 = 52,
7848            I2CEXT0_SCL             = 68,
7849            I2CEXT0_SDA             = 69,
7850            I2CEXT1_SCL             = 70,
7851            I2CEXT1_SDA             = 71,
7852            USB_JTAG_TDO_BRIDGE     = 140,
7853            PCNT0_SIG_CH0           = 141,
7854            PCNT1_SIG_CH0           = 142,
7855            PCNT2_SIG_CH0           = 143,
7856            PCNT3_SIG_CH0           = 144,
7857            PCNT0_SIG_CH1           = 145,
7858            PCNT1_SIG_CH1           = 146,
7859            PCNT2_SIG_CH1           = 147,
7860            PCNT3_SIG_CH1           = 148,
7861            PCNT0_CTRL_CH0          = 149,
7862            PCNT1_CTRL_CH0          = 150,
7863            PCNT2_CTRL_CH0          = 151,
7864            PCNT3_CTRL_CH0          = 152,
7865            PCNT0_CTRL_CH1          = 153,
7866            PCNT1_CTRL_CH1          = 154,
7867            PCNT2_CTRL_CH1          = 155,
7868            PCNT3_CTRL_CH1          = 156,
7869            PCNT1_U0_CTRL_CH0       = 72,
7870            PCNT1_U1_CTRL_CH0       = 73,
7871            PCNT1_U2_CTRL_CH0       = 74,
7872            PCNT1_U3_CTRL_CH0       = 75,
7873            PCNT1_U0_CTRL_CH1       = 76,
7874            PCNT1_U1_CTRL_CH1       = 77,
7875            PCNT1_U2_CTRL_CH1       = 78,
7876            PCNT1_U3_CTRL_CH1       = 79,
7877            PCNT1_U0_SIG_CH0        = 204,
7878            PCNT1_U1_SIG_CH0        = 205,
7879            PCNT1_U2_SIG_CH0        = 206,
7880            PCNT1_U3_SIG_CH0        = 207,
7881            PCNT1_U0_SIG_CH1        = 208,
7882            PCNT1_U1_SIG_CH1        = 209,
7883            PCNT1_U2_SIG_CH1        = 210,
7884            PCNT1_U3_SIG_CH1        = 211,
7885            CPU_GPIO_0              = 214,
7886            CPU_GPIO_1              = 215,
7887            CPU_GPIO_2              = 216,
7888            CPU_GPIO_3              = 217,
7889            CPU_GPIO_4              = 218,
7890            CPU_GPIO_5              = 219,
7891            CPU_GPIO_6              = 220,
7892            CPU_GPIO_7              = 221,
7893            CPU_GPIO_8              = 222,
7894            CPU_GPIO_9              = 223,
7895            CPU_GPIO_10             = 224,
7896            CPU_GPIO_11             = 225,
7897            CPU_GPIO_12             = 226,
7898            CPU_GPIO_13             = 227,
7899            CPU_GPIO_14             = 228,
7900            CPU_GPIO_15             = 229,
7901            RMT_SIG_0               = 246,
7902            RMT_SIG_1               = 247,
7903            RMT_SIG_2               = 248,
7904            RMT_SIG_3               = 249,
7905            CAM_PCLK                = 158,
7906            CAM_H_ENABLE            = 159,
7907            CAM_H_SYNC              = 160,
7908            CAM_V_SYNC              = 161,
7909            CAM_DATA_0              = 162,
7910            CAM_DATA_1              = 163,
7911            CAM_DATA_2              = 164,
7912            CAM_DATA_3              = 165,
7913            CAM_DATA_4              = 166,
7914            CAM_DATA_5              = 167,
7915            CAM_DATA_6              = 168,
7916            CAM_DATA_7              = 169,
7917            CAM_DATA_8              = 170,
7918            CAM_DATA_9              = 171,
7919            CAM_DATA_10             = 172,
7920            CAM_DATA_11             = 173,
7921            CAM_DATA_12             = 174,
7922            CAM_DATA_13             = 175,
7923            CAM_DATA_14             = 176,
7924            CAM_DATA_15             = 177,
7925            SDHOST_CDATA_IN_41      = 0,
7926            SDHOST_CDATA_IN_51      = 1,
7927            SDHOST_CDATA_IN_61      = 2,
7928            SDHOST_CDATA_IN_71      = 3,
7929            SDHOST_CDATA_IN_42      = 4,
7930            SDHOST_CDATA_IN_52      = 5,
7931            SDHOST_CDATA_IN_62      = 6,
7932            SDHOST_CDATA_IN_72      = 7,
7933            SDHOST_CARD_DETECT_N_1  = 126,
7934            SDHOST_CARD_DETECT_N_2  = 127,
7935            SDHOST_CARD_INT_N_1     = 128,
7936            SDHOST_CARD_INT_N_2     = 129,
7937            SDHOST_CARD_WRITE_PRT_1 = 130,
7938            SDHOST_CARD_WRITE_PRT_2 = 131,
7939            SDHOST_DATA_STROBE_1    = 132,
7940            SDHOST_DATA_STROBE_2    = 133,
7941            EMAC_MDI                = 107,
7942            EMAC_COL                = 108,
7943            EMAC_CRS                = 109,
7944            EMAC_RXDV               = 178,
7945            EMAC_RXD0               = 179,
7946            EMAC_RXD1               = 180,
7947            EMAC_RXD2               = 181,
7948            EMAC_RXD3               = 182,
7949            EMAC_RXER               = 183,
7950            EMAC_RX_CLK             = 184,
7951            EMAC_TX_CLK             = 185,
7952            SIG_IN_FUNC251          = 251,
7953            SIG_IN_FUNC252          = 252,
7954            SIG_IN_FUNC253          = 253,
7955            SIG_IN_FUNC254          = 254,
7956            SIG_IN_FUNC255          = 255,
7957            MTDO,
7958            MTCK,
7959            MTDI,
7960            MTMS,
7961            SD1_DATA0,
7962            SD1_DATA1,
7963            SD1_DATA2,
7964            SD1_DATA3,
7965            SD1_CLK,
7966            SD1_CMD,
7967            SPICS0,
7968            SPIQ,
7969            SPIWP,
7970            SPIHD,
7971            SPICLK,
7972            SPID,
7973            EMAC_RMII_CLK,
7974            REF_50M_CLK,
7975            CAM_XCLK,
7976            SD2_CDATA0,
7977            SD2_CDATA1,
7978            SD2_CDATA2,
7979            SD2_CDATA3,
7980            SD2_CCLK,
7981            SD2_CCMD,
7982            DBG_PSRAM_CK,
7983            DBG_PSRAM_CS,
7984            DBG_PSRAM_D,
7985            DBG_PSRAM_Q,
7986            DBG_PSRAM_WP,
7987            DBG_PSRAM_HOLD,
7988            DBG_PSRAM_DQ4,
7989            DBG_PSRAM_DQ5,
7990            DBG_PSRAM_DQ6,
7991            DBG_PSRAM_DQ7,
7992            DBG_PSRAM_DQS_0,
7993            DBG_FLASH_CK,
7994            DBG_FLASH_D,
7995            DBG_FLASH_CS,
7996            DBG_FLASH_Q,
7997            DBG_FLASH_WP,
7998            DBG_FLASH_HOLD,
7999        }
8000        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
8001        #[derive(Debug, PartialEq, Copy, Clone)]
8002        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
8003        #[doc(hidden)]
8004        pub enum OutputSignal {
8005            SDHOST_CDATA_OUT_41    = 0,
8006            SDHOST_CDATA_OUT_51    = 1,
8007            SDHOST_CDATA_OUT_61    = 2,
8008            SDHOST_CDATA_OUT_71    = 3,
8009            SDHOST_CDATA_OUT_42    = 4,
8010            SDHOST_CDATA_OUT_52    = 5,
8011            SDHOST_CDATA_OUT_62    = 6,
8012            SDHOST_CDATA_OUT_72    = 7,
8013            SD_RST_N_1             = 146,
8014            SD_RST_N_2             = 147,
8015            SD_CCMD_OD_PULLUP_EN_N = 148,
8016            U0TXD                  = 10,
8017            U0RTS                  = 11,
8018            U0DTR                  = 12,
8019            U1TXD                  = 13,
8020            U1RTS                  = 14,
8021            U1DTR                  = 15,
8022            U2TXD                  = 16,
8023            U2RTS                  = 17,
8024            U2DTR                  = 18,
8025            U3TXD                  = 137,
8026            U3RTS                  = 138,
8027            U3DTR                  = 116,
8028            I2S0O_BCK              = 25,
8029            I2S0_MCLK              = 26,
8030            I2S0O_WS               = 27,
8031            I2S0O_SD               = 28,
8032            I2S0I_BCK              = 29,
8033            I2S0I_WS               = 30,
8034            I2S0O_SD1              = 43,
8035            I2S1O_BCK              = 31,
8036            I2S1_MCLK              = 32,
8037            I2S1O_WS               = 33,
8038            I2S1O_SD               = 34,
8039            I2S1I_BCK              = 35,
8040            I2S1I_WS               = 36,
8041            FSPICLK                = 53,
8042            FSPIQ                  = 54,
8043            FSPID                  = 55,
8044            FSPIHD                 = 56,
8045            FSPIWP                 = 57,
8046            FSPIIO4                = 58,
8047            FSPIIO5                = 59,
8048            FSPIIO6                = 60,
8049            FSPIIO7                = 61,
8050            FSPIDQS                = 44,
8051            FSPICS0                = 62,
8052            FSPICS1                = 63,
8053            FSPICS2                = 64,
8054            FSPICS3                = 65,
8055            FSPICS4                = 66,
8056            FSPICS5                = 67,
8057            SPI3_CS2               = 45,
8058            SPI3_CS1               = 46,
8059            SPI3_CK                = 47,
8060            SPI3_Q                 = 48,
8061            SPI3_D                 = 49,
8062            SPI3_HOLD              = 50,
8063            SPI3_WP                = 51,
8064            SPI3_CS                = 52,
8065            I2CEXT0_SCL            = 68,
8066            I2CEXT0_SDA            = 69,
8067            I2CEXT1_SCL            = 70,
8068            I2CEXT1_SDA            = 71,
8069            GPIO_SD0               = 72,
8070            GPIO_SD1               = 73,
8071            GPIO_SD2               = 74,
8072            GPIO_SD3               = 75,
8073            GPIO_SD4               = 76,
8074            GPIO_SD5               = 77,
8075            GPIO_SD6               = 78,
8076            GPIO_SD7               = 79,
8077            CPU_GPIO_0             = 214,
8078            CPU_GPIO_1             = 215,
8079            CPU_GPIO_2             = 216,
8080            CPU_GPIO_3             = 217,
8081            CPU_GPIO_4             = 218,
8082            CPU_GPIO_5             = 219,
8083            CPU_GPIO_6             = 220,
8084            CPU_GPIO_7             = 221,
8085            CPU_GPIO_8             = 222,
8086            CPU_GPIO_9             = 223,
8087            CPU_GPIO_10            = 224,
8088            CPU_GPIO_11            = 225,
8089            CPU_GPIO_12            = 226,
8090            CPU_GPIO_13            = 227,
8091            CPU_GPIO_14            = 228,
8092            CPU_GPIO_15            = 229,
8093            RMT_SIG_0              = 246,
8094            RMT_SIG_1              = 247,
8095            RMT_SIG_2              = 248,
8096            RMT_SIG_3              = 249,
8097            LCD_CS                 = 144,
8098            LCD_DC                 = 145,
8099            LCD_PCLK               = 149,
8100            CAM_CLK                = 150,
8101            LCD_H_ENABLE           = 151,
8102            LCD_H_SYNC             = 152,
8103            LCD_V_SYNC             = 153,
8104            LCD_DATA_0             = 154,
8105            LCD_DATA_1             = 155,
8106            LCD_DATA_2             = 156,
8107            LCD_DATA_3             = 157,
8108            LCD_DATA_4             = 158,
8109            LCD_DATA_5             = 159,
8110            LCD_DATA_6             = 160,
8111            LCD_DATA_7             = 161,
8112            LCD_DATA_8             = 162,
8113            LCD_DATA_9             = 163,
8114            LCD_DATA_10            = 164,
8115            LCD_DATA_11            = 165,
8116            LCD_DATA_12            = 166,
8117            LCD_DATA_13            = 167,
8118            LCD_DATA_14            = 168,
8119            LCD_DATA_15            = 169,
8120            LCD_DATA_16            = 170,
8121            LCD_DATA_17            = 171,
8122            LCD_DATA_18            = 172,
8123            LCD_DATA_19            = 173,
8124            LCD_DATA_20            = 174,
8125            LCD_DATA_21            = 175,
8126            LCD_DATA_22            = 176,
8127            LCD_DATA_23            = 177,
8128            EMAC_PTP_PPS           = 105,
8129            EMAC_MDC               = 108,
8130            EMAC_MDO               = 109,
8131            EMAC_TXEN              = 178,
8132            EMAC_TXD0              = 179,
8133            EMAC_TXD1              = 180,
8134            EMAC_TXD2              = 181,
8135            EMAC_TXD3              = 182,
8136            EMAC_TXER              = 183,
8137            GPIO                   = 256,
8138            MTDO,
8139            MTCK,
8140            MTDI,
8141            MTMS,
8142            SD1_DATA0,
8143            SD1_DATA1,
8144            SD1_DATA2,
8145            SD1_DATA3,
8146            SD1_CLK,
8147            SD1_CMD,
8148            SPICS0,
8149            SPIQ,
8150            SPIWP,
8151            SPIHD,
8152            SPICLK,
8153            SPID,
8154            EMAC_RMII_CLK,
8155            REF_50M_CLK,
8156            CAM_XCLK,
8157            SD2_CDATA0,
8158            SD2_CDATA1,
8159            SD2_CDATA2,
8160            SD2_CDATA3,
8161            SD2_CCLK,
8162            SD2_CCMD,
8163            DBG_PSRAM_CK,
8164            DBG_PSRAM_CS,
8165            DBG_PSRAM_D,
8166            DBG_PSRAM_Q,
8167            DBG_PSRAM_WP,
8168            DBG_PSRAM_HOLD,
8169            DBG_PSRAM_DQ4,
8170            DBG_PSRAM_DQ5,
8171            DBG_PSRAM_DQ6,
8172            DBG_PSRAM_DQ7,
8173            DBG_PSRAM_DQS_0,
8174            DBG_FLASH_CK,
8175            DBG_FLASH_D,
8176            DBG_FLASH_CS,
8177            DBG_FLASH_Q,
8178            DBG_FLASH_WP,
8179            DBG_FLASH_HOLD,
8180        }
8181    };
8182}
8183/// Defines the `LpFunction` enum.
8184///
8185/// The enum only contains the LP IO MUX functions that the chip implements. It is
8186/// empty on chips without an LP IO peripheral.
8187///
8188/// This macro is intended to be called in esp-hal only.
8189#[macro_export]
8190#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8191macro_rules! define_lp_functions {
8192    () => {
8193        /// LP IO MUX function of a pad.
8194        ///
8195        /// This is the low-power counterpart of `AlternateFunction`: it selects which function
8196        /// drives a pad while the pad belongs to the low-power domain.
8197        #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
8198        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
8199        #[doc(hidden)]
8200        pub enum LpFunction {
8201            /// LP IO MUX function 1.
8202            _1 = 1,
8203        }
8204        impl LpFunction {
8205            /// The function that connects the pad to the LP GPIO peripheral.
8206            pub const LP_GPIO: Self = Self::_1;
8207        }
8208    };
8209}
8210/// Defines and implements the `io_mux_reg` function.
8211///
8212/// The generated function has the following signature:
8213///
8214/// ```rust,ignore
8215/// pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO0 {
8216///     // ...
8217/// # unimplemented!()
8218/// }
8219/// ```
8220///
8221/// This macro is intended to be called in esp-hal only.
8222#[macro_export]
8223#[expect(clippy::crate_in_macro_def)]
8224#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8225macro_rules! define_io_mux_reg {
8226    () => {
8227        pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
8228            crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
8229        }
8230    };
8231}