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.need_soft_isolate_during_pd") => {
92        true
93    };
94    ("gpio.has_bank_1") => {
95        true
96    };
97    ("gpio.input_signal_max") => {
98        255
99    };
100    ("gpio.input_signal_max", str) => {
101        stringify!(255)
102    };
103    ("gpio.output_signal_max") => {
104        256
105    };
106    ("gpio.output_signal_max", str) => {
107        stringify!(256)
108    };
109    ("dedicated_gpio.version") => {
110        "riscv_v2"
111    };
112    ("dedicated_gpio.needs_initialization") => {
113        false
114    };
115    ("dedicated_gpio.channel_count") => {
116        8
117    };
118    ("dedicated_gpio.channel_count", str) => {
119        stringify!(8)
120    };
121    ("lp_io.version") => {
122        "esp32s31"
123    };
124    ("lp_io.has_gpio_matrix") => {
125        true
126    };
127    ("uart.ram_size") => {
128        128
129    };
130    ("uart.ram_size", str) => {
131        stringify!(128)
132    };
133    ("uart.version") => {
134        2
135    };
136    ("uart.version", str) => {
137        stringify!(2)
138    };
139    ("uart.peripheral_controls_mem_clk") => {
140        true
141    };
142    ("uart.has_sclk_divider") => {
143        false
144    };
145    ("uart.has_sclk_enable") => {
146        true
147    };
148    ("uhci.combined_uart_selector_field") => {
149        true
150    };
151    ("i2c_master.version") => {
152        4
153    };
154    ("i2c_master.version", str) => {
155        stringify!(4)
156    };
157    ("i2c_master.has_fsm_timeouts") => {
158        true
159    };
160    ("i2c_master.has_hw_bus_clear") => {
161        true
162    };
163    ("i2c_master.has_bus_timeout_enable") => {
164        true
165    };
166    ("i2c_master.separate_filter_config_registers") => {
167        false
168    };
169    ("i2c_master.can_estimate_nack_reason") => {
170        true
171    };
172    ("i2c_master.has_conf_update") => {
173        true
174    };
175    ("i2c_master.has_reliable_fsm_reset") => {
176        true
177    };
178    ("i2c_master.has_arbitration_en") => {
179        true
180    };
181    ("i2c_master.has_tx_fifo_watermark") => {
182        true
183    };
184    ("i2c_master.bus_timeout_is_exponential") => {
185        true
186    };
187    ("i2c_master.has_pd_en") => {
188        true
189    };
190    ("i2c_master.max_bus_timeout") => {
191        31
192    };
193    ("i2c_master.max_bus_timeout", str) => {
194        stringify!(31)
195    };
196    ("i2c_master.ll_intr_mask") => {
197        262143
198    };
199    ("i2c_master.ll_intr_mask", str) => {
200        stringify!(262143)
201    };
202    ("i2c_master.fifo_size") => {
203        32
204    };
205    ("i2c_master.fifo_size", str) => {
206        stringify!(32)
207    };
208    ("spi_master.version") => {
209        3
210    };
211    ("spi_master.version", str) => {
212        stringify!(3)
213    };
214    ("spi_master.fifo_size") => {
215        64
216    };
217    ("spi_master.fifo_size", str) => {
218        stringify!(64)
219    };
220    ("spi_master.bit_order_is_bool") => {
221        false
222    };
223    ("spi_master.has_octal") => {
224        true
225    };
226    ("spi_master.has_app_interrupts") => {
227        true
228    };
229    ("spi_master.has_dma_segmented_transfer") => {
230        true
231    };
232    ("spi_master.has_clk_pre_div") => {
233        false
234    };
235    ("spi_master.dma_can_access_flash") => {
236        false
237    };
238    ("i2s.version") => {
239        3
240    };
241    ("i2s.version", str) => {
242        stringify!(3)
243    };
244    ("i2s.mclk_divider_bit_width") => {
245        8
246    };
247    ("i2s.mclk_divider_bit_width", str) => {
248        stringify!(8)
249    };
250    ("i2s.max_ws_width") => {
251        512
252    };
253    ("i2s.max_ws_width", str) => {
254        stringify!(512)
255    };
256    ("i2s.clock_configured_by_pcr") => {
257        false
258    };
259    ("i2s.clock_configured_by_hp_sys_clkrst") => {
260        true
261    };
262    ("i2s.supports_pdm_rx_hp_filter") => {
263        true
264    };
265    ("i2s.supports_pdm_tx") => {
266        true
267    };
268    ("i2s.supports_pdm_rx") => {
269        true
270    };
271    ("i2s.supports_pcm2pdm") => {
272        true
273    };
274    ("i2s.supports_pdm2pcm") => {
275        true
276    };
277    ("parl_io.version") => {
278        2
279    };
280    ("parl_io.version", str) => {
281        stringify!(2)
282    };
283    ("parl_io.max_data_width") => {
284        16
285    };
286    ("parl_io.max_data_width", str) => {
287        stringify!(16)
288    };
289    ("parl_io.has_tx_cs") => {
290        true
291    };
292    ("rmt.ram_start") => {
293        540366848
294    };
295    ("rmt.ram_start", str) => {
296        stringify!(540366848)
297    };
298    ("rmt.channel_ram_size") => {
299        48
300    };
301    ("rmt.channel_ram_size", str) => {
302        stringify!(48)
303    };
304    ("rmt.has_tx_immediate_stop") => {
305        true
306    };
307    ("rmt.has_tx_loop_count") => {
308        true
309    };
310    ("rmt.has_tx_loop_auto_stop") => {
311        true
312    };
313    ("rmt.has_tx_carrier_data_only") => {
314        true
315    };
316    ("rmt.has_tx_sync") => {
317        true
318    };
319    ("rmt.has_rx_wrap") => {
320        true
321    };
322    ("rmt.has_rx_demodulation") => {
323        true
324    };
325    ("rmt.has_per_channel_clock") => {
326        false
327    };
328    ("sdmmc.delay_phase_num") => {
329        8
330    };
331    ("sdmmc.delay_phase_num", str) => {
332        stringify!(8)
333    };
334    ("sdmmc.has_iomux") => {
335        true
336    };
337    ("sdmmc.has_gpio_matrix") => {
338        false
339    };
340    ("sdmmc.psram_dma") => {
341        true
342    };
343    ("sdmmc.uhs") => {
344        false
345    };
346    ("usb_otg_hs.fifo_depth_words") => {
347        896
348    };
349    ("usb_otg_hs.fifo_depth_words", str) => {
350        stringify!(896)
351    };
352    ("bt.controller") => {
353        "btdm2"
354    };
355    ("bt.requires_fast_cpu") => {
356        true
357    };
358    ("wifi.has_wifi6") => {
359        true
360    };
361    ("wifi.mac_version") => {
362        3
363    };
364    ("wifi.mac_version", str) => {
365        stringify!(3)
366    };
367    ("wifi.has_5g") => {
368        false
369    };
370    ("wifi.csi_supported") => {
371        true
372    };
373    ("wifi.has_nan") => {
374        true
375    };
376    ("wifi.has_ftm") => {
377        true
378    };
379    ("wifi.requires_fast_cpu") => {
380        false
381    };
382    ("ieee802154.requires_fast_cpu") => {
383        false
384    };
385    ("ethernet.mii_via_gpio_matrix") => {
386        true
387    };
388    ("ethernet.rx_store_and_forward") => {
389        false
390    };
391    ("ethernet.rx_checksum_offload") => {
392        true
393    };
394    ("ethernet.tx_checksum_offload") => {
395        false
396    };
397    ("ethernet.dma_burst_len") => {
398        16
399    };
400    ("ethernet.dma_burst_len", str) => {
401        stringify!(16)
402    };
403    ("ethernet.dma_alignment") => {
404        8
405    };
406    ("ethernet.dma_alignment", str) => {
407        stringify!(8)
408    };
409    ("ethernet.has_rgmii") => {
410        true
411    };
412    ("phy.combo_module") => {
413        false
414    };
415    ("rgb_display.output_lines") => {
416        24
417    };
418    ("rgb_display.output_lines", str) => {
419        stringify!(24)
420    };
421    ("adc.line_calibration") => {
422        false
423    };
424    ("adc.curve_calibration") => {
425        false
426    };
427    ("adc.basic_calibration") => {
428        false
429    };
430    ("adc.calibration_v1_scheme_supported") => {
431        false
432    };
433    ("adc.channel_compensation") => {
434        false
435    };
436    ("adc.pcr_clock") => {
437        false
438    };
439    ("adc.pcr_sar_clk_div") => {
440        false
441    };
442    ("adc.sar_power_override") => {
443        false
444    };
445    ("dac.version") => {
446        2
447    };
448    ("dac.version", str) => {
449        stringify!(2)
450    };
451    ("dac.channel_count") => {
452        2
453    };
454    ("dac.channel_count", str) => {
455        stringify!(2)
456    };
457    ("dac.resolution") => {
458        12
459    };
460    ("dac.resolution", str) => {
461        stringify!(12)
462    };
463    ("sdm.channel_count") => {
464        8
465    };
466    ("sdm.channel_count", str) => {
467        stringify!(8)
468    };
469    ("timergroup.timg_has_timer1") => {
470        true
471    };
472    ("timergroup.timg_has_divcnt_rst") => {
473        true
474    };
475    ("timergroup.wdt_has_conf_update") => {
476        true
477    };
478    ("timergroup.rc_fast_calibration_divider_min_rev") => {
479        0
480    };
481    ("timergroup.rc_fast_calibration_divider") => {
482        50
483    };
484    ("timergroup.rc_fast_calibration_tick_enable") => {
485        false
486    };
487    ("aes.has_split_text_registers") => {
488        true
489    };
490    ("aes.endianness_configurable") => {
491        false
492    };
493    ("ecc.zero_extend_writes") => {
494        false
495    };
496    ("ecc.separate_jacobian_point_memory") => {
497        true
498    };
499    ("ecc.has_memory_clock_gate") => {
500        true
501    };
502    ("ecc.supports_enhanced_security") => {
503        true
504    };
505    ("ecc.mem_block_size") => {
506        48
507    };
508    ("rng.apb_cycle_wait_num") => {
509        16
510    };
511    ("rng.apb_cycle_wait_num", str) => {
512        stringify!(16)
513    };
514    ("rng.trng_supported") => {
515        true
516    };
517    ("rng.is_lp_sys") => {
518        false
519    };
520    ("rsa.version") => {
521        3
522    };
523    ("rsa.version", str) => {
524        stringify!(3)
525    };
526    ("rsa.size_increment") => {
527        32
528    };
529    ("rsa.size_increment", str) => {
530        stringify!(32)
531    };
532    ("rsa.memory_size_bytes") => {
533        512
534    };
535    ("rsa.memory_size_bytes", str) => {
536        stringify!(512)
537    };
538    ("sleep.light_sleep") => {
539        true
540    };
541    ("sleep.deep_sleep") => {
542        true
543    };
544    ("sleep.rejectable_mask") => {
545        46150029
546    };
547    ("sleep.ext1_version") => {
548        3
549    };
550    ("sleep.ext1_version", str) => {
551        stringify!(3)
552    };
553    ("sleep.pin_wakeup_version") => {
554        3
555    };
556    ("sleep.pin_wakeup_version", str) => {
557        stringify!(3)
558    };
559    ("sleep.deep_sleep_needs_gpio_isolation") => {
560        false
561    };
562    ("sleep.idle_frequency_scaling") => {
563        true
564    };
565    ("dma.mem2mem_requires_peripheral") => {
566        false
567    };
568    ("dma.ext_mem_configurable_block_size") => {
569        false
570    };
571    ("dma.separate_in_out_interrupts") => {
572        true
573    };
574    ("dma.gdma_version") => {
575        3
576    };
577    ("dma.gdma_version", str) => {
578        stringify!(3)
579    };
580    ("interrupts.status_registers") => {
581        6
582    };
583    ("interrupts.status_registers", str) => {
584        stringify!(6)
585    };
586    ("interrupts.disabled_interrupt") => {
587        0
588    };
589    ("mmu.page_size") => {
590        65536
591    };
592    ("mmu.page_size", str) => {
593        stringify!(65536)
594    };
595    ("mmu.entry_num") => {
596        1024
597    };
598    ("mmu.entry_num", str) => {
599        stringify!(1024)
600    };
601    ("psram.octal_spi") => {
602        true
603    };
604    ("psram.hex_spi") => {
605        false
606    };
607    ("psram.has_timing_tuning") => {
608        true
609    };
610    ("psram.extmem_origin") => {
611        1342177280
612    };
613    ("psram.extmem_origin", str) => {
614        stringify!(1342177280)
615    };
616    ("psram.idle_low_speed_switch") => {
617        true
618    };
619    ("rom.has_crc_le") => {
620        true
621    };
622    ("rom.has_crc_be") => {
623        true
624    };
625    ("rom.has_md5_bsd") => {
626        true
627    };
628    ("rom.has_md5_mbedtls") => {
629        false
630    };
631    ("rom.no_libgcc") => {
632        false
633    };
634    ("soc.cpu_has_branch_predictor") => {
635        true
636    };
637    ("soc.cpu_has_csr_pc") => {
638        false
639    };
640    ("soc.cpu_has_zcmp_workaround") => {
641        true
642    };
643    ("soc.multi_core_enabled") => {
644        true
645    };
646    ("soc.cpu_pma_needs_core1_setup") => {
647        true
648    };
649    ("soc.cpu_csr_prv_mode") => {
650        2064
651    };
652    ("soc.cpu_csr_prv_mode", str) => {
653        stringify!(2064)
654    };
655    ("soc.internal_memory_cached") => {
656        false
657    };
658    ("soc.cpu_powers_down_cache") => {
659        true
660    };
661    ("soc.has_swd_watchdog") => {
662        true
663    };
664    ("soc.has_bus_clock_update") => {
665        true
666    };
667    ("soc.has_apb_frequency_reduction") => {
668        false
669    };
670    ("soc.cpu_mcause_mask") => {
671        63
672    };
673    ("soc.cpu_mcause_mask", str) => {
674        stringify!(63)
675    };
676    ("soc.cpu_pmp_granularity") => {
677        128
678    };
679    ("soc.cpu_pmp_granularity", str) => {
680        stringify!(128)
681    };
682    ("clock_tree.cpu_root_clk") => {
683        [crate ::soc::clocks::CpuRootClkConfig::Xtal, crate
684        ::soc::clocks::CpuRootClkConfig::Cpll, crate
685        ::soc::clocks::CpuRootClkConfig::RcFast, crate
686        ::soc::clocks::CpuRootClkConfig::PllF240m]
687    };
688    ("clock_tree.cpu_clk.divisor") => {
689        (0, 255)
690    };
691    ("clock_tree.mem_clk.divisor") => {
692        (0, 1)
693    };
694    ("clock_tree.sys_clk.divisor") => {
695        (0, 255)
696    };
697    ("clock_tree.apb_clk.divisor") => {
698        (0, 255)
699    };
700    ("clock_tree.lp_fast_clk") => {
701        [crate ::soc::clocks::LpFastClkConfig::RcFast, crate
702        ::soc::clocks::LpFastClkConfig::Xtal]
703    };
704    ("clock_tree.lp_slow_clk") => {
705        [crate ::soc::clocks::LpSlowClkConfig::RcSlow, #[cfg(use_xtal32k)] crate
706        ::soc::clocks::LpSlowClkConfig::Xtal32k]
707    };
708    ("clock_tree.lp_peri_clk.divisor") => {
709        (0, 7)
710    };
711    ("clock_tree.ble_lp_clk") => {
712        [crate ::soc::clocks::BleLpClkConfig::Xtal, #[cfg(use_xtal32k)] crate
713        ::soc::clocks::BleLpClkConfig::Xtal32k]
714    };
715    ("clock_tree.crypto_clk") => {
716        [crate ::soc::clocks::CryptoClkConfig::Xtal, crate
717        ::soc::clocks::CryptoClkConfig::RcFast, crate
718        ::soc::clocks::CryptoClkConfig::PllF240m]
719    };
720    ("clock_tree.iomux_function_clock.source") => {
721        [crate ::soc::clocks::IomuxFunctionClockSource::XtalClk, crate
722        ::soc::clocks::IomuxFunctionClockSource::PllF80m]
723    };
724    ("clock_tree.iomux_function_clock.div_num") => {
725        (0, 255)
726    };
727    ("clock_tree.timg_calibration_clock") => {
728        [crate ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, crate
729        ::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
730        crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
731    };
732    ("clock_tree.psram.function_clock") => {
733        [crate ::soc::clocks::PsramFunctionClockConfig::Xtal, crate
734        ::soc::clocks::PsramFunctionClockConfig::Mpll, crate
735        ::soc::clocks::PsramFunctionClockConfig::Cpll]
736    };
737    ("clock_tree.uart.function_clock.sclk") => {
738        [crate ::soc::clocks::UartFunctionClockSclk::PllF80m, crate
739        ::soc::clocks::UartFunctionClockSclk::Xtal, crate
740        ::soc::clocks::UartFunctionClockSclk::RcFast]
741    };
742    ("clock_tree.uart.function_clock.div_num") => {
743        (0, 255)
744    };
745    ("clock_tree.uart.baud_rate_generator.fractional") => {
746        (0, 15)
747    };
748    ("clock_tree.uart.baud_rate_generator.integral") => {
749        (0, 4095)
750    };
751    ("clock_tree.timg.function_clock") => {
752        [crate ::soc::clocks::TimgFunctionClockConfig::PllF80m, crate
753        ::soc::clocks::TimgFunctionClockConfig::RcFastClk, crate
754        ::soc::clocks::TimgFunctionClockConfig::XtalClk]
755    };
756    ("clock_tree.timg.wdt_clock") => {
757        [crate ::soc::clocks::TimgWdtClockConfig::XtalClk, crate
758        ::soc::clocks::TimgWdtClockConfig::PllF80m, crate
759        ::soc::clocks::TimgWdtClockConfig::RcFastClk]
760    };
761    ("clock_tree.spi.function_clock") => {
762        [crate ::soc::clocks::SpiFunctionClockConfig::Bbpll, crate
763        ::soc::clocks::SpiFunctionClockConfig::Xtal, crate
764        ::soc::clocks::SpiFunctionClockConfig::RcFast]
765    };
766    ("clock_tree.i2c.function_clock.sclk") => {
767        [crate ::soc::clocks::I2cFunctionClockSclk::Xtal, crate
768        ::soc::clocks::I2cFunctionClockSclk::RcFast]
769    };
770    ("clock_tree.i2c.function_clock.div_num") => {
771        (0, 255)
772    };
773    ("clock_tree.i2s.tx_clk.sclk") => {
774        [crate ::soc::clocks::I2sClkSclk::Xtal]
775    };
776    ("clock_tree.i2s.tx_clk.div_num") => {
777        (1, 256)
778    };
779    ("clock_tree.i2s.tx_clk.div_a") => {
780        (1, 511)
781    };
782    ("clock_tree.i2s.tx_clk.div_b") => {
783        (0, 511)
784    };
785    ("clock_tree.i2s.rx_clk.sclk") => {
786        [crate ::soc::clocks::I2sClkSclk::Xtal]
787    };
788    ("clock_tree.i2s.rx_clk.div_num") => {
789        (1, 256)
790    };
791    ("clock_tree.i2s.rx_clk.div_a") => {
792        (1, 511)
793    };
794    ("clock_tree.i2s.rx_clk.div_b") => {
795        (0, 511)
796    };
797    ("clock_tree.i2s.mclk_out") => {
798        [crate ::soc::clocks::I2sMclkOutConfig::Tx, crate
799        ::soc::clocks::I2sMclkOutConfig::Rx]
800    };
801    ("clock_tree.rmt.sclk") => {
802        [crate ::soc::clocks::RmtSclkConfig::PllF80m, crate
803        ::soc::clocks::RmtSclkConfig::RcFastClk, crate
804        ::soc::clocks::RmtSclkConfig::XtalClk]
805    };
806    ("clock_tree.parl_io.rx_clock") => {
807        [crate ::soc::clocks::ParlIoClkConfig::XtalClk, crate
808        ::soc::clocks::ParlIoClkConfig::RcFastClk, crate
809        ::soc::clocks::ParlIoClkConfig::PllF160m]
810    };
811    ("clock_tree.parl_io.tx_clock") => {
812        [crate ::soc::clocks::ParlIoClkConfig::XtalClk, crate
813        ::soc::clocks::ParlIoClkConfig::RcFastClk, crate
814        ::soc::clocks::ParlIoClkConfig::PllF160m]
815    };
816    ("clock_tree.cordic.function_clock.source") => {
817        [crate ::soc::clocks::CordicFunctionClockSource::Xtal, crate
818        ::soc::clocks::CordicFunctionClockSource::RcFast, crate
819        ::soc::clocks::CordicFunctionClockSource::PllF160m]
820    };
821    ("clock_tree.cordic.function_clock.divider") => {
822        (1, 256)
823    };
824    ("clock_tree.cordic.function_clock.numerator") => {
825        (0, 254)
826    };
827    ("clock_tree.cordic.function_clock.denominator") => {
828        (1, 255)
829    };
830    ("clock_tree.lcd_cam.lcd_clock.sclk") => {
831        [crate ::soc::clocks::LcdCamLcdClockSclk::XtalClk, crate
832        ::soc::clocks::LcdCamLcdClockSclk::PllF160m]
833    };
834    ("clock_tree.lcd_cam.lcd_clock.div_num") => {
835        (1, 256)
836    };
837    ("clock_tree.lcd_cam.lcd_clock.div_a") => {
838        (1, 255)
839    };
840    ("clock_tree.lcd_cam.lcd_clock.div_b") => {
841        (0, 255)
842    };
843    ("clock_tree.lcd_cam.cam_clock.sclk") => {
844        [crate ::soc::clocks::LcdCamCamClockSclk::XtalClk, crate
845        ::soc::clocks::LcdCamCamClockSclk::PllF160m]
846    };
847    ("clock_tree.lcd_cam.cam_clock.div_num") => {
848        (1, 256)
849    };
850    ("clock_tree.lcd_cam.cam_clock.div_a") => {
851        (1, 255)
852    };
853    ("clock_tree.lcd_cam.cam_clock.div_b") => {
854        (0, 255)
855    };
856}
857#[macro_export]
858#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
859macro_rules! for_each_dedicated_gpio {
860    ($($pattern:tt => $code:tt;)*) => {
861        macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
862        tt) => {} } _for_each_inner_dedicated_gpio!((0));
863        _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
864        _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
865        _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
866        _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
867        CPU_GPIO_0)); _for_each_inner_dedicated_gpio!((0, 1, CPU_GPIO_1));
868        _for_each_inner_dedicated_gpio!((0, 2, CPU_GPIO_2));
869        _for_each_inner_dedicated_gpio!((0, 3, CPU_GPIO_3));
870        _for_each_inner_dedicated_gpio!((0, 4, CPU_GPIO_4));
871        _for_each_inner_dedicated_gpio!((0, 5, CPU_GPIO_5));
872        _for_each_inner_dedicated_gpio!((0, 6, CPU_GPIO_6));
873        _for_each_inner_dedicated_gpio!((0, 7, CPU_GPIO_7));
874        _for_each_inner_dedicated_gpio!((1, 0, CPU_GPIO_8));
875        _for_each_inner_dedicated_gpio!((1, 1, CPU_GPIO_9));
876        _for_each_inner_dedicated_gpio!((1, 2, CPU_GPIO_10));
877        _for_each_inner_dedicated_gpio!((1, 3, CPU_GPIO_11));
878        _for_each_inner_dedicated_gpio!((1, 4, CPU_GPIO_12));
879        _for_each_inner_dedicated_gpio!((1, 5, CPU_GPIO_13));
880        _for_each_inner_dedicated_gpio!((1, 6, CPU_GPIO_14));
881        _for_each_inner_dedicated_gpio!((1, 7, CPU_GPIO_15));
882        _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
883        (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, CPU_GPIO_0), (0, 1,
884        CPU_GPIO_1), (0, 2, CPU_GPIO_2), (0, 3, CPU_GPIO_3), (0, 4, CPU_GPIO_4), (0, 5,
885        CPU_GPIO_5), (0, 6, CPU_GPIO_6), (0, 7, CPU_GPIO_7), (1, 0, CPU_GPIO_8), (1, 1,
886        CPU_GPIO_9), (1, 2, CPU_GPIO_10), (1, 3, CPU_GPIO_11), (1, 4, CPU_GPIO_12), (1,
887        5, CPU_GPIO_13), (1, 6, CPU_GPIO_14), (1, 7, CPU_GPIO_15)));
888    };
889}
890/// Defines the `LpInputSignal` and `LpOutputSignal` enums.
891///
892/// This macro is intended to be called in esp-hal only.
893#[macro_export]
894#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
895macro_rules! define_lp_io_signals {
896    () => {
897        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
898        #[derive(Debug, PartialEq, Copy, Clone)]
899        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
900        #[doc(hidden)]
901        pub enum LpInputSignal {
902            LP_I2C_SCL   = 0,
903            LP_I2C_SDA   = 1,
904            LP_UART_RXD  = 2,
905            LP_UART_CTSN = 3,
906            LP_UART_DSRN = 4,
907            LP_SPI_CK    = 5,
908            LP_SPI_CS    = 6,
909            LP_SPI_D     = 7,
910            LP_SPI_Q     = 8,
911        }
912        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
913        #[derive(Debug, PartialEq, Copy, Clone)]
914        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
915        #[doc(hidden)]
916        pub enum LpOutputSignal {
917            LP_I2C_SCL   = 0,
918            LP_I2C_SDA   = 1,
919            LP_UART_TXD  = 2,
920            LP_UART_RTSN = 3,
921            LP_UART_DTRN = 4,
922            LP_SPI_CK    = 5,
923            LP_SPI_CS    = 6,
924            LP_SPI_D     = 7,
925            LP_SPI_Q     = 8,
926        }
927    };
928}
929/// This macro can be used to generate code for each channel of the RMT peripheral.
930///
931/// For an explanation on the general syntax, as well as usage of individual/repeated
932/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
933///
934/// This macro has three options for its "Individual matcher" case:
935///
936/// - `all`: `($num:literal)`
937/// - `tx`: `($num:literal, $idx:literal)`
938/// - `rx`: `($num:literal, $idx:literal)`
939///
940/// Macro fragments:
941///
942/// - `$num`: number of the channel, e.g. `0`
943/// - `$idx`: index of the channel among channels of the same capability, e.g. `0`
944///
945/// Example data:
946///
947/// - `all`: `(0)`
948/// - `tx`: `(1, 1)`
949/// - `rx`: `(2, 0)`
950#[macro_export]
951#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
952macro_rules! for_each_rmt_channel {
953    ($($pattern:tt => $code:tt;)*) => {
954        macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
955        => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
956        _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
957        _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
958        _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
959        _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
960        _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
961        _for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
962        _for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
963        _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
964        _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
965        _for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
966    };
967}
968/// This macro can be used to generate code for each slot of the SDMMC/SDIO host driver.
969///
970/// For an explanation on the general syntax, as well as usage of individual/repeated
971/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
972///
973/// This macro has one option for its "Individual matcher" case:
974///
975/// Syntax: `($slot:ident, $idx:literal, $iomux:literal, [$($clk:ident)?]
976/// [$($cmd_in:ident)?] [$($cmd_out:ident)?] [$($data_in:ident),*] [$($data_out:ident),*]
977/// [$($cd:ident)?] [$($wp:ident)?] [$($card_int:ident)?] [$($data_strobe:ident)?]
978/// [$($rst:ident)?])`
979///
980/// Macro fragments:
981///
982/// - `$slot`: the name of the slot (`slot0`, `slot1`).
983/// - `$idx`: the zero-based slot index.
984/// - `$iomux`: `true` if the slot's clock/command/data signals are IO_MUX-routed.
985/// - `$clk`, `$cmd_in`, `$cmd_out`, `$data_in`, `$data_out`: GPIO-matrix bus signal names (absent
986///   for IO_MUX-routed slots).
987/// - `$cd`, `$wp`, `$card_int`, `$data_strobe`, `$rst`: auxiliary signal names, each present only
988///   when the slot routes that signal through the GPIO matrix.
989///
990/// Each optional signal is wrapped in brackets so the branch shape stays uniform: a set
991/// signal appears as `[SIGNAL]`, an absent one as `[]`.
992#[macro_export]
993#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
994macro_rules! for_each_sdmmc {
995    ($($pattern:tt => $code:tt;)*) => {
996        macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
997        } _for_each_inner_sdmmc!((slot0, 0, true, [], [], [], [], [],
998        [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
999        [SDHOST_DATA_STROBE_1], [SD_RST_N_1])); _for_each_inner_sdmmc!((slot1, 1, true,
1000        [], [], [], [], [], [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2],
1001        [SDHOST_CARD_INT_N_2], [SDHOST_DATA_STROBE_2], [SD_RST_N_2]));
1002        _for_each_inner_sdmmc!((all(slot0, 0, true, [], [], [], [], [],
1003        [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
1004        [SDHOST_DATA_STROBE_1], [SD_RST_N_1]), (slot1, 1, true, [], [], [], [], [],
1005        [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2],
1006        [SDHOST_DATA_STROBE_2], [SD_RST_N_2])));
1007    };
1008}
1009#[macro_export]
1010#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1011macro_rules! for_each_sdm_channel {
1012    ($($pattern:tt => $code:tt;)*) => {
1013        macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
1014        => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
1015        _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
1016        _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
1017        _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
1018        _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
1019        _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
1020        _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
1021        _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
1022        _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
1023        SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
1024        GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
1025        SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
1026    };
1027}
1028#[macro_export]
1029#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1030macro_rules! for_each_aes_key_length {
1031    ($($pattern:tt => $code:tt;)*) => {
1032        macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
1033        tt) => {} } _for_each_inner_aes_key_length!((128));
1034        _for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
1035        4)); _for_each_inner_aes_key_length!((256, 2, 6));
1036        _for_each_inner_aes_key_length!((bits(128), (256)));
1037        _for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
1038    };
1039}
1040#[macro_export]
1041#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1042macro_rules! for_each_ecc_working_mode {
1043    ($($pattern:tt => $code:tt;)*) => {
1044        macro_rules! _for_each_inner_ecc_working_mode { $(($pattern) => $code;)* ($other
1045        : tt) => {} } _for_each_inner_ecc_working_mode!((0, AffinePointMultiplication));
1046        _for_each_inner_ecc_working_mode!((2, AffinePointVerification));
1047        _for_each_inner_ecc_working_mode!((3, AffinePointVerificationAndMultiplication));
1048        _for_each_inner_ecc_working_mode!((4, JacobianPointMultiplication));
1049        _for_each_inner_ecc_working_mode!((5, AffinePointAddition));
1050        _for_each_inner_ecc_working_mode!((6, JacobianPointVerification));
1051        _for_each_inner_ecc_working_mode!((7,
1052        AffinePointVerificationAndJacobianPointMultiplication));
1053        _for_each_inner_ecc_working_mode!((8, ModularAddition));
1054        _for_each_inner_ecc_working_mode!((9, ModularSubtraction));
1055        _for_each_inner_ecc_working_mode!((10, ModularMultiplication));
1056        _for_each_inner_ecc_working_mode!((11, ModularDivision));
1057        _for_each_inner_ecc_working_mode!((all(0, AffinePointMultiplication), (2,
1058        AffinePointVerification), (3, AffinePointVerificationAndMultiplication), (4,
1059        JacobianPointMultiplication), (5, AffinePointAddition), (6,
1060        JacobianPointVerification), (7,
1061        AffinePointVerificationAndJacobianPointMultiplication), (8, ModularAddition), (9,
1062        ModularSubtraction), (10, ModularMultiplication), (11, ModularDivision)));
1063    };
1064}
1065#[macro_export]
1066#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1067macro_rules! for_each_ecc_curve {
1068    ($($pattern:tt => $code:tt;)*) => {
1069        macro_rules! _for_each_inner_ecc_curve { $(($pattern) => $code;)* ($other : tt)
1070        => {} } _for_each_inner_ecc_curve!((0, P192, 192));
1071        _for_each_inner_ecc_curve!((1, P256, 256)); _for_each_inner_ecc_curve!((2, P384,
1072        384)); _for_each_inner_ecc_curve!((3, Sm2, 256));
1073        _for_each_inner_ecc_curve!((all(0, P192, 192), (1, P256, 256), (2, P384, 384),
1074        (3, Sm2, 256)));
1075    };
1076}
1077#[macro_export]
1078#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1079macro_rules! for_each_rsa_exponentiation {
1080    ($($pattern:tt => $code:tt;)*) => {
1081        macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
1082        ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
1083        _for_each_inner_rsa_exponentiation!((64));
1084        _for_each_inner_rsa_exponentiation!((96));
1085        _for_each_inner_rsa_exponentiation!((128));
1086        _for_each_inner_rsa_exponentiation!((160));
1087        _for_each_inner_rsa_exponentiation!((192));
1088        _for_each_inner_rsa_exponentiation!((224));
1089        _for_each_inner_rsa_exponentiation!((256));
1090        _for_each_inner_rsa_exponentiation!((288));
1091        _for_each_inner_rsa_exponentiation!((320));
1092        _for_each_inner_rsa_exponentiation!((352));
1093        _for_each_inner_rsa_exponentiation!((384));
1094        _for_each_inner_rsa_exponentiation!((416));
1095        _for_each_inner_rsa_exponentiation!((448));
1096        _for_each_inner_rsa_exponentiation!((480));
1097        _for_each_inner_rsa_exponentiation!((512));
1098        _for_each_inner_rsa_exponentiation!((544));
1099        _for_each_inner_rsa_exponentiation!((576));
1100        _for_each_inner_rsa_exponentiation!((608));
1101        _for_each_inner_rsa_exponentiation!((640));
1102        _for_each_inner_rsa_exponentiation!((672));
1103        _for_each_inner_rsa_exponentiation!((704));
1104        _for_each_inner_rsa_exponentiation!((736));
1105        _for_each_inner_rsa_exponentiation!((768));
1106        _for_each_inner_rsa_exponentiation!((800));
1107        _for_each_inner_rsa_exponentiation!((832));
1108        _for_each_inner_rsa_exponentiation!((864));
1109        _for_each_inner_rsa_exponentiation!((896));
1110        _for_each_inner_rsa_exponentiation!((928));
1111        _for_each_inner_rsa_exponentiation!((960));
1112        _for_each_inner_rsa_exponentiation!((992));
1113        _for_each_inner_rsa_exponentiation!((1024));
1114        _for_each_inner_rsa_exponentiation!((1056));
1115        _for_each_inner_rsa_exponentiation!((1088));
1116        _for_each_inner_rsa_exponentiation!((1120));
1117        _for_each_inner_rsa_exponentiation!((1152));
1118        _for_each_inner_rsa_exponentiation!((1184));
1119        _for_each_inner_rsa_exponentiation!((1216));
1120        _for_each_inner_rsa_exponentiation!((1248));
1121        _for_each_inner_rsa_exponentiation!((1280));
1122        _for_each_inner_rsa_exponentiation!((1312));
1123        _for_each_inner_rsa_exponentiation!((1344));
1124        _for_each_inner_rsa_exponentiation!((1376));
1125        _for_each_inner_rsa_exponentiation!((1408));
1126        _for_each_inner_rsa_exponentiation!((1440));
1127        _for_each_inner_rsa_exponentiation!((1472));
1128        _for_each_inner_rsa_exponentiation!((1504));
1129        _for_each_inner_rsa_exponentiation!((1536));
1130        _for_each_inner_rsa_exponentiation!((1568));
1131        _for_each_inner_rsa_exponentiation!((1600));
1132        _for_each_inner_rsa_exponentiation!((1632));
1133        _for_each_inner_rsa_exponentiation!((1664));
1134        _for_each_inner_rsa_exponentiation!((1696));
1135        _for_each_inner_rsa_exponentiation!((1728));
1136        _for_each_inner_rsa_exponentiation!((1760));
1137        _for_each_inner_rsa_exponentiation!((1792));
1138        _for_each_inner_rsa_exponentiation!((1824));
1139        _for_each_inner_rsa_exponentiation!((1856));
1140        _for_each_inner_rsa_exponentiation!((1888));
1141        _for_each_inner_rsa_exponentiation!((1920));
1142        _for_each_inner_rsa_exponentiation!((1952));
1143        _for_each_inner_rsa_exponentiation!((1984));
1144        _for_each_inner_rsa_exponentiation!((2016));
1145        _for_each_inner_rsa_exponentiation!((2048));
1146        _for_each_inner_rsa_exponentiation!((2080));
1147        _for_each_inner_rsa_exponentiation!((2112));
1148        _for_each_inner_rsa_exponentiation!((2144));
1149        _for_each_inner_rsa_exponentiation!((2176));
1150        _for_each_inner_rsa_exponentiation!((2208));
1151        _for_each_inner_rsa_exponentiation!((2240));
1152        _for_each_inner_rsa_exponentiation!((2272));
1153        _for_each_inner_rsa_exponentiation!((2304));
1154        _for_each_inner_rsa_exponentiation!((2336));
1155        _for_each_inner_rsa_exponentiation!((2368));
1156        _for_each_inner_rsa_exponentiation!((2400));
1157        _for_each_inner_rsa_exponentiation!((2432));
1158        _for_each_inner_rsa_exponentiation!((2464));
1159        _for_each_inner_rsa_exponentiation!((2496));
1160        _for_each_inner_rsa_exponentiation!((2528));
1161        _for_each_inner_rsa_exponentiation!((2560));
1162        _for_each_inner_rsa_exponentiation!((2592));
1163        _for_each_inner_rsa_exponentiation!((2624));
1164        _for_each_inner_rsa_exponentiation!((2656));
1165        _for_each_inner_rsa_exponentiation!((2688));
1166        _for_each_inner_rsa_exponentiation!((2720));
1167        _for_each_inner_rsa_exponentiation!((2752));
1168        _for_each_inner_rsa_exponentiation!((2784));
1169        _for_each_inner_rsa_exponentiation!((2816));
1170        _for_each_inner_rsa_exponentiation!((2848));
1171        _for_each_inner_rsa_exponentiation!((2880));
1172        _for_each_inner_rsa_exponentiation!((2912));
1173        _for_each_inner_rsa_exponentiation!((2944));
1174        _for_each_inner_rsa_exponentiation!((2976));
1175        _for_each_inner_rsa_exponentiation!((3008));
1176        _for_each_inner_rsa_exponentiation!((3040));
1177        _for_each_inner_rsa_exponentiation!((3072));
1178        _for_each_inner_rsa_exponentiation!((3104));
1179        _for_each_inner_rsa_exponentiation!((3136));
1180        _for_each_inner_rsa_exponentiation!((3168));
1181        _for_each_inner_rsa_exponentiation!((3200));
1182        _for_each_inner_rsa_exponentiation!((3232));
1183        _for_each_inner_rsa_exponentiation!((3264));
1184        _for_each_inner_rsa_exponentiation!((3296));
1185        _for_each_inner_rsa_exponentiation!((3328));
1186        _for_each_inner_rsa_exponentiation!((3360));
1187        _for_each_inner_rsa_exponentiation!((3392));
1188        _for_each_inner_rsa_exponentiation!((3424));
1189        _for_each_inner_rsa_exponentiation!((3456));
1190        _for_each_inner_rsa_exponentiation!((3488));
1191        _for_each_inner_rsa_exponentiation!((3520));
1192        _for_each_inner_rsa_exponentiation!((3552));
1193        _for_each_inner_rsa_exponentiation!((3584));
1194        _for_each_inner_rsa_exponentiation!((3616));
1195        _for_each_inner_rsa_exponentiation!((3648));
1196        _for_each_inner_rsa_exponentiation!((3680));
1197        _for_each_inner_rsa_exponentiation!((3712));
1198        _for_each_inner_rsa_exponentiation!((3744));
1199        _for_each_inner_rsa_exponentiation!((3776));
1200        _for_each_inner_rsa_exponentiation!((3808));
1201        _for_each_inner_rsa_exponentiation!((3840));
1202        _for_each_inner_rsa_exponentiation!((3872));
1203        _for_each_inner_rsa_exponentiation!((3904));
1204        _for_each_inner_rsa_exponentiation!((3936));
1205        _for_each_inner_rsa_exponentiation!((3968));
1206        _for_each_inner_rsa_exponentiation!((4000));
1207        _for_each_inner_rsa_exponentiation!((4032));
1208        _for_each_inner_rsa_exponentiation!((4064));
1209        _for_each_inner_rsa_exponentiation!((4096));
1210        _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
1211        (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1212        (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1213        (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1214        (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1215        (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1216        (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
1217        (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
1218        (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
1219        (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
1220        (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
1221        (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
1222        (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
1223    };
1224}
1225#[macro_export]
1226#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1227macro_rules! for_each_rsa_multiplication {
1228    ($($pattern:tt => $code:tt;)*) => {
1229        macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
1230        ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
1231        _for_each_inner_rsa_multiplication!((64));
1232        _for_each_inner_rsa_multiplication!((96));
1233        _for_each_inner_rsa_multiplication!((128));
1234        _for_each_inner_rsa_multiplication!((160));
1235        _for_each_inner_rsa_multiplication!((192));
1236        _for_each_inner_rsa_multiplication!((224));
1237        _for_each_inner_rsa_multiplication!((256));
1238        _for_each_inner_rsa_multiplication!((288));
1239        _for_each_inner_rsa_multiplication!((320));
1240        _for_each_inner_rsa_multiplication!((352));
1241        _for_each_inner_rsa_multiplication!((384));
1242        _for_each_inner_rsa_multiplication!((416));
1243        _for_each_inner_rsa_multiplication!((448));
1244        _for_each_inner_rsa_multiplication!((480));
1245        _for_each_inner_rsa_multiplication!((512));
1246        _for_each_inner_rsa_multiplication!((544));
1247        _for_each_inner_rsa_multiplication!((576));
1248        _for_each_inner_rsa_multiplication!((608));
1249        _for_each_inner_rsa_multiplication!((640));
1250        _for_each_inner_rsa_multiplication!((672));
1251        _for_each_inner_rsa_multiplication!((704));
1252        _for_each_inner_rsa_multiplication!((736));
1253        _for_each_inner_rsa_multiplication!((768));
1254        _for_each_inner_rsa_multiplication!((800));
1255        _for_each_inner_rsa_multiplication!((832));
1256        _for_each_inner_rsa_multiplication!((864));
1257        _for_each_inner_rsa_multiplication!((896));
1258        _for_each_inner_rsa_multiplication!((928));
1259        _for_each_inner_rsa_multiplication!((960));
1260        _for_each_inner_rsa_multiplication!((992));
1261        _for_each_inner_rsa_multiplication!((1024));
1262        _for_each_inner_rsa_multiplication!((1056));
1263        _for_each_inner_rsa_multiplication!((1088));
1264        _for_each_inner_rsa_multiplication!((1120));
1265        _for_each_inner_rsa_multiplication!((1152));
1266        _for_each_inner_rsa_multiplication!((1184));
1267        _for_each_inner_rsa_multiplication!((1216));
1268        _for_each_inner_rsa_multiplication!((1248));
1269        _for_each_inner_rsa_multiplication!((1280));
1270        _for_each_inner_rsa_multiplication!((1312));
1271        _for_each_inner_rsa_multiplication!((1344));
1272        _for_each_inner_rsa_multiplication!((1376));
1273        _for_each_inner_rsa_multiplication!((1408));
1274        _for_each_inner_rsa_multiplication!((1440));
1275        _for_each_inner_rsa_multiplication!((1472));
1276        _for_each_inner_rsa_multiplication!((1504));
1277        _for_each_inner_rsa_multiplication!((1536));
1278        _for_each_inner_rsa_multiplication!((1568));
1279        _for_each_inner_rsa_multiplication!((1600));
1280        _for_each_inner_rsa_multiplication!((1632));
1281        _for_each_inner_rsa_multiplication!((1664));
1282        _for_each_inner_rsa_multiplication!((1696));
1283        _for_each_inner_rsa_multiplication!((1728));
1284        _for_each_inner_rsa_multiplication!((1760));
1285        _for_each_inner_rsa_multiplication!((1792));
1286        _for_each_inner_rsa_multiplication!((1824));
1287        _for_each_inner_rsa_multiplication!((1856));
1288        _for_each_inner_rsa_multiplication!((1888));
1289        _for_each_inner_rsa_multiplication!((1920));
1290        _for_each_inner_rsa_multiplication!((1952));
1291        _for_each_inner_rsa_multiplication!((1984));
1292        _for_each_inner_rsa_multiplication!((2016));
1293        _for_each_inner_rsa_multiplication!((2048));
1294        _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
1295        (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1296        (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1297        (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1298        (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1299        (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1300        (1888), (1920), (1952), (1984), (2016), (2048)));
1301    };
1302}
1303#[macro_export]
1304#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1305macro_rules! for_each_sha_algorithm {
1306    ($($pattern:tt => $code:tt;)*) => {
1307        macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
1308        tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
1309        (insecure_against : "collision", "length extension"), 0));
1310        _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
1311        (insecure_against : "length extension"), 1));
1312        _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
1313        (insecure_against : "length extension"), 2));
1314        _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
1315        (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
1316        "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
1317        _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
1318        (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
1319        "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
1320        _for_each_inner_sha_algorithm!((Sm3, "SM3"(sizes : 64, 32, 8) (insecure_against :
1321        "length extension"), 14)); _for_each_inner_sha_algorithm!((algos(Sha1,
1322        "SHA-1"(sizes : 64, 20, 8) (insecure_against : "collision", "length extension"),
1323        0), (Sha224, "SHA-224"(sizes : 64, 28, 8) (insecure_against :
1324        "length extension"), 1), (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against
1325        : "length extension"), 2), (Sha384, "SHA-384"(sizes : 128, 48, 16)
1326        (insecure_against :), 3), (Sha512, "SHA-512"(sizes : 128, 64, 16)
1327        (insecure_against : "length extension"), 4), (Sha512_224, "SHA-512/224"(sizes :
1328        128, 28, 16) (insecure_against :), 5), (Sha512_256, "SHA-512/256"(sizes : 128,
1329        32, 16) (insecure_against :), 6), (Sm3, "SM3"(sizes : 64, 32, 8)
1330        (insecure_against : "length extension"), 14)));
1331    };
1332}
1333#[macro_export]
1334#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1335macro_rules! for_each_wakeup_source {
1336    ($($pattern:tt => $code:tt;)*) => {
1337        macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
1338        tt) => {} } _for_each_inner_wakeup_source!((LpCore, 0));
1339        _for_each_inner_wakeup_source!((Gpio, 2)); _for_each_inner_wakeup_source!((Usb,
1340        3)); _for_each_inner_wakeup_source!((Uart1, 7));
1341        _for_each_inner_wakeup_source!((Uart0, 8)); _for_each_inner_wakeup_source!((Ext1,
1342        12)); _for_each_inner_wakeup_source!((Timer, 13));
1343        _for_each_inner_wakeup_source!((Wifi, 22));
1344        _for_each_inner_wakeup_source!((WifiBeacon, 23));
1345        _for_each_inner_wakeup_source!((Bt, 25));
1346        _for_each_inner_wakeup_source!((all(LpCore, 0), (Gpio, 2), (Usb, 3), (Uart1, 7),
1347        (Uart0, 8), (Ext1, 12), (Timer, 13), (Wifi, 22), (WifiBeacon, 23), (Bt, 25)));
1348    };
1349}
1350#[macro_export]
1351#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1352macro_rules! for_each_dma_engine {
1353    ($($pattern:tt => $code:tt;)*) => {
1354        macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
1355        => {} } _for_each_inner_dma_engine!(("AHB_GDMA"));
1356        _for_each_inner_dma_engine!(("AXI_GDMA"));
1357        _for_each_inner_dma_engine!((all("AHB_GDMA"), ("AXI_GDMA")));
1358    };
1359}
1360#[macro_export]
1361#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1362macro_rules! for_each_dma_channel {
1363    ($($pattern:tt => $code:tt;)*) => {
1364        macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
1365        => {} } _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0));
1366        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1));
1367        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2));
1368        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3));
1369        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4));
1370        _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0));
1371        _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH1));
1372        _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH2));
1373        _for_each_inner_dma_channel!(("AHB_GDMA", any_channel = AhbGdmaChannel));
1374        _for_each_inner_dma_channel!(("AXI_GDMA", any_channel = AxiGdmaChannel));
1375        _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1376        AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0, I2S0,
1377        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1, 1, interrupt_in =
1378        AHB_PDMA_IN_CH1, interrupt_out = AHB_PDMA_OUT_CH1, compatible = [UHCI0, I2S0,
1379        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2, 2, interrupt_in =
1380        AHB_PDMA_IN_CH2, interrupt_out = AHB_PDMA_OUT_CH2, compatible = [UHCI0, I2S0,
1381        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3, 3, interrupt_in =
1382        AHB_PDMA_IN_CH3, interrupt_out = AHB_PDMA_OUT_CH3, compatible = [UHCI0, I2S0,
1383        I2S1])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4, 4, interrupt_in =
1384        AHB_PDMA_IN_CH4, interrupt_out = AHB_PDMA_OUT_CH4, compatible = [UHCI0, I2S0,
1385        I2S1])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0, 0, interrupt_in =
1386        AXI_PDMA_IN_CH0, interrupt_out = AXI_PDMA_OUT_CH0, compatible = [LCD_CAM, SPI2,
1387        SPI3, PARL_IO, AES, SHA])); _for_each_inner_dma_channel!(("AXI_GDMA",
1388        DMA_AXI_CH1, 1, interrupt_in = AXI_PDMA_IN_CH1, interrupt_out = AXI_PDMA_OUT_CH1,
1389        compatible = [LCD_CAM, SPI2, SPI3, PARL_IO, AES, SHA]));
1390        _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH2, 2, interrupt_in =
1391        AXI_PDMA_IN_CH2, interrupt_out = AXI_PDMA_OUT_CH2, compatible = [LCD_CAM, SPI2,
1392        SPI3, PARL_IO, AES, SHA])); _for_each_inner_dma_channel!((names("AHB_GDMA",
1393        DMA_CH0), ("AHB_GDMA", DMA_CH1), ("AHB_GDMA", DMA_CH2), ("AHB_GDMA", DMA_CH3),
1394        ("AHB_GDMA", DMA_CH4), ("AXI_GDMA", DMA_AXI_CH0), ("AXI_GDMA", DMA_AXI_CH1),
1395        ("AXI_GDMA", DMA_AXI_CH2)));
1396        _for_each_inner_dma_channel!((separate_any_type("AHB_GDMA", any_channel =
1397        AhbGdmaChannel), ("AXI_GDMA", any_channel = AxiGdmaChannel)));
1398        _for_each_inner_dma_channel!((shared));
1399        _for_each_inner_dma_channel!((split("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1400        AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0, I2S0,
1401        I2S1]), ("AHB_GDMA", DMA_CH1, 1, interrupt_in = AHB_PDMA_IN_CH1, interrupt_out =
1402        AHB_PDMA_OUT_CH1, compatible = [UHCI0, I2S0, I2S1]), ("AHB_GDMA", DMA_CH2, 2,
1403        interrupt_in = AHB_PDMA_IN_CH2, interrupt_out = AHB_PDMA_OUT_CH2, compatible =
1404        [UHCI0, I2S0, I2S1]), ("AHB_GDMA", DMA_CH3, 3, interrupt_in = AHB_PDMA_IN_CH3,
1405        interrupt_out = AHB_PDMA_OUT_CH3, compatible = [UHCI0, I2S0, I2S1]), ("AHB_GDMA",
1406        DMA_CH4, 4, interrupt_in = AHB_PDMA_IN_CH4, interrupt_out = AHB_PDMA_OUT_CH4,
1407        compatible = [UHCI0, I2S0, I2S1]), ("AXI_GDMA", DMA_AXI_CH0, 0, interrupt_in =
1408        AXI_PDMA_IN_CH0, interrupt_out = AXI_PDMA_OUT_CH0, compatible = [LCD_CAM, SPI2,
1409        SPI3, PARL_IO, AES, SHA]), ("AXI_GDMA", DMA_AXI_CH1, 1, interrupt_in =
1410        AXI_PDMA_IN_CH1, interrupt_out = AXI_PDMA_OUT_CH1, compatible = [LCD_CAM, SPI2,
1411        SPI3, PARL_IO, AES, SHA]), ("AXI_GDMA", DMA_AXI_CH2, 2, interrupt_in =
1412        AXI_PDMA_IN_CH2, interrupt_out = AXI_PDMA_OUT_CH2, compatible = [LCD_CAM, SPI2,
1413        SPI3, PARL_IO, AES, SHA]))); _for_each_inner_dma_channel!((no_own_interrupt));
1414    };
1415}
1416#[macro_export]
1417#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1418macro_rules! for_each_dma_channel_peri_pair {
1419    ($($pattern:tt => $code:tt;)*) => {
1420        macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1421        ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1422        DMA_CH0, UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0,
1423        I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S1));
1424        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, UHCI0));
1425        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S0));
1426        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S1));
1427        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, UHCI0));
1428        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S0));
1429        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S1));
1430        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, UHCI0));
1431        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S0));
1432        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S1));
1433        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, UHCI0));
1434        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S0));
1435        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S1));
1436        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, LCD_CAM));
1437        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI2));
1438        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI3));
1439        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, PARL_IO));
1440        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, AES));
1441        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SHA));
1442        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, LCD_CAM));
1443        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI2));
1444        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI3));
1445        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, PARL_IO));
1446        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, AES));
1447        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SHA));
1448        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, LCD_CAM));
1449        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI2));
1450        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI3));
1451        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, PARL_IO));
1452        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, AES));
1453        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SHA));
1454        _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1455        UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1456        AhbGdmaChannel, I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1457        any_channel = AhbGdmaChannel, I2S1));
1458        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel = AxiGdmaChannel,
1459        LCD_CAM)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1460        AxiGdmaChannel, SPI2)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA",
1461        any_channel = AxiGdmaChannel, SPI3));
1462        _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel = AxiGdmaChannel,
1463        PARL_IO)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1464        AxiGdmaChannel, AES)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA",
1465        any_channel = AxiGdmaChannel, SHA));
1466        _for_each_inner_dma_channel_peri_pair!((channels("AHB_GDMA", DMA_CH0, UHCI0),
1467        ("AHB_GDMA", DMA_CH0, I2S0), ("AHB_GDMA", DMA_CH0, I2S1), ("AHB_GDMA", DMA_CH1,
1468        UHCI0), ("AHB_GDMA", DMA_CH1, I2S0), ("AHB_GDMA", DMA_CH1, I2S1), ("AHB_GDMA",
1469        DMA_CH2, UHCI0), ("AHB_GDMA", DMA_CH2, I2S0), ("AHB_GDMA", DMA_CH2, I2S1),
1470        ("AHB_GDMA", DMA_CH3, UHCI0), ("AHB_GDMA", DMA_CH3, I2S0), ("AHB_GDMA", DMA_CH3,
1471        I2S1), ("AHB_GDMA", DMA_CH4, UHCI0), ("AHB_GDMA", DMA_CH4, I2S0), ("AHB_GDMA",
1472        DMA_CH4, I2S1), ("AXI_GDMA", DMA_AXI_CH0, LCD_CAM), ("AXI_GDMA", DMA_AXI_CH0,
1473        SPI2), ("AXI_GDMA", DMA_AXI_CH0, SPI3), ("AXI_GDMA", DMA_AXI_CH0, PARL_IO),
1474        ("AXI_GDMA", DMA_AXI_CH0, AES), ("AXI_GDMA", DMA_AXI_CH0, SHA), ("AXI_GDMA",
1475        DMA_AXI_CH1, LCD_CAM), ("AXI_GDMA", DMA_AXI_CH1, SPI2), ("AXI_GDMA", DMA_AXI_CH1,
1476        SPI3), ("AXI_GDMA", DMA_AXI_CH1, PARL_IO), ("AXI_GDMA", DMA_AXI_CH1, AES),
1477        ("AXI_GDMA", DMA_AXI_CH1, SHA), ("AXI_GDMA", DMA_AXI_CH2, LCD_CAM), ("AXI_GDMA",
1478        DMA_AXI_CH2, SPI2), ("AXI_GDMA", DMA_AXI_CH2, SPI3), ("AXI_GDMA", DMA_AXI_CH2,
1479        PARL_IO), ("AXI_GDMA", DMA_AXI_CH2, AES), ("AXI_GDMA", DMA_AXI_CH2, SHA)));
1480        _for_each_inner_dma_channel_peri_pair!((any_channels("AHB_GDMA", any_channel =
1481        AhbGdmaChannel, UHCI0), ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S0),
1482        ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S1), ("AXI_GDMA", any_channel =
1483        AxiGdmaChannel, LCD_CAM), ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI2),
1484        ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI3), ("AXI_GDMA", any_channel =
1485        AxiGdmaChannel, PARL_IO), ("AXI_GDMA", any_channel = AxiGdmaChannel, AES),
1486        ("AXI_GDMA", any_channel = AxiGdmaChannel, SHA)));
1487    };
1488}
1489#[macro_export]
1490#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1491macro_rules! for_each_mem2mem_channel {
1492    ($($pattern:tt => $code:tt;)*) => {
1493        macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
1494        tt) => {} } _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1495        AhbGdmaChannel, DMA_CH0, 9)); _for_each_inner_mem2mem_channel!(("AXI_GDMA",
1496        AxiGdma, AxiGdmaChannel, DMA_AXI_CH0, 6));
1497        _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1498        DMA_AXI_CH1, 7)); _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma,
1499        AxiGdmaChannel, DMA_AXI_CH2, 8)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1500        AhbGdma, AhbGdmaChannel, 0, 9)); _for_each_inner_mem2mem_channel!(("AXI_GDMA",
1501        AxiGdma, AxiGdmaChannel, 0, 6, 1, 7, 2, 8));
1502        _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel));
1503        _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel));
1504        _for_each_inner_mem2mem_channel!((channels("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1505        DMA_CH0, 9), ("AXI_GDMA", AxiGdma, AxiGdmaChannel, DMA_AXI_CH0, 6), ("AXI_GDMA",
1506        AxiGdma, AxiGdmaChannel, DMA_AXI_CH1, 7), ("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1507        DMA_AXI_CH2, 8))); _for_each_inner_mem2mem_channel!((erased("AHB_GDMA", AhbGdma,
1508        AhbGdmaChannel, 0, 9), ("AXI_GDMA", AxiGdma, AxiGdmaChannel, 0, 6, 1, 7, 2, 8)));
1509        _for_each_inner_mem2mem_channel!((engines("AHB_GDMA", AhbGdma, AhbGdmaChannel),
1510        ("AXI_GDMA", AxiGdma, AxiGdmaChannel)));
1511    };
1512}
1513#[macro_export]
1514#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1515macro_rules! with_aes_dma_engine {
1516    ($($pattern:tt => $code:tt;)*) => {
1517        macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
1518        => {} } _with_inner_aes_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1519    };
1520}
1521#[macro_export]
1522#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1523macro_rules! with_i2s_dma_engine {
1524    ($($pattern:tt => $code:tt;)*) => {
1525        macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
1526        => {} } _with_inner_i2s_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1527    };
1528}
1529#[macro_export]
1530#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1531macro_rules! with_lcd_cam_dma_engine {
1532    ($($pattern:tt => $code:tt;)*) => {
1533        macro_rules! _with_inner_lcd_cam_dma_engine { $(($pattern) => $code;)* ($other :
1534        tt) => {} } _with_inner_lcd_cam_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1535    };
1536}
1537#[macro_export]
1538#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1539macro_rules! with_parl_io_dma_engine {
1540    ($($pattern:tt => $code:tt;)*) => {
1541        macro_rules! _with_inner_parl_io_dma_engine { $(($pattern) => $code;)* ($other :
1542        tt) => {} } _with_inner_parl_io_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1543    };
1544}
1545#[macro_export]
1546#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1547macro_rules! with_spi_master_dma_engine {
1548    ($($pattern:tt => $code:tt;)*) => {
1549        macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1550        : tt) => {} } _with_inner_spi_master_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1551    };
1552}
1553#[macro_export]
1554#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1555macro_rules! with_spi_slave_dma_engine {
1556    ($($pattern:tt => $code:tt;)*) => {
1557        macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1558        : tt) => {} } _with_inner_spi_slave_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1559    };
1560}
1561#[macro_export]
1562#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1563macro_rules! with_uhci_dma_engine {
1564    ($($pattern:tt => $code:tt;)*) => {
1565        macro_rules! _with_inner_uhci_dma_engine { $(($pattern) => $code;)* ($other : tt)
1566        => {} } _with_inner_uhci_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1567    };
1568}
1569#[macro_export]
1570#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1571macro_rules! for_each_interrupt {
1572    ($($pattern:tt => $code:tt;)*) => {
1573        macro_rules! _for_each_inner_interrupt { $(($pattern) => $code;)* ($other : tt)
1574        => {} } _for_each_inner_interrupt!(([disabled 0] 0));
1575        _for_each_inner_interrupt!(([reserved 0] 1));
1576        _for_each_inner_interrupt!(([reserved 1] 2));
1577        _for_each_inner_interrupt!(([reserved 2] 3));
1578        _for_each_inner_interrupt!(([reserved 3] 4));
1579        _for_each_inner_interrupt!(([reserved 4] 5));
1580        _for_each_inner_interrupt!(([reserved 5] 6));
1581        _for_each_inner_interrupt!(([reserved 6] 7));
1582        _for_each_inner_interrupt!(([reserved 7] 8));
1583        _for_each_inner_interrupt!(([reserved 8] 9));
1584        _for_each_inner_interrupt!(([reserved 9] 10));
1585        _for_each_inner_interrupt!(([reserved 10] 11));
1586        _for_each_inner_interrupt!(([reserved 11] 12));
1587        _for_each_inner_interrupt!(([reserved 12] 13));
1588        _for_each_inner_interrupt!(([reserved 13] 14));
1589        _for_each_inner_interrupt!(([reserved 14] 15));
1590        _for_each_inner_interrupt!(([vector 0] 16)); _for_each_inner_interrupt!(([vector
1591        1] 17)); _for_each_inner_interrupt!(([vector 2] 18));
1592        _for_each_inner_interrupt!(([vector 3] 19)); _for_each_inner_interrupt!(([vector
1593        4] 20)); _for_each_inner_interrupt!(([vector 5] 21));
1594        _for_each_inner_interrupt!(([vector 6] 22)); _for_each_inner_interrupt!(([vector
1595        7] 23)); _for_each_inner_interrupt!(([direct_bindable 0] 24));
1596        _for_each_inner_interrupt!(([direct_bindable 1] 25));
1597        _for_each_inner_interrupt!(([direct_bindable 2] 26));
1598        _for_each_inner_interrupt!(([direct_bindable 3] 27));
1599        _for_each_inner_interrupt!(([direct_bindable 4] 28));
1600        _for_each_inner_interrupt!(([direct_bindable 5] 29));
1601        _for_each_inner_interrupt!(([direct_bindable 6] 30));
1602        _for_each_inner_interrupt!(([direct_bindable 7] 31));
1603        _for_each_inner_interrupt!(([direct_bindable 8] 32));
1604        _for_each_inner_interrupt!(([direct_bindable 9] 33));
1605        _for_each_inner_interrupt!(([direct_bindable 10] 34));
1606        _for_each_inner_interrupt!(([direct_bindable 11] 35));
1607        _for_each_inner_interrupt!(([direct_bindable 12] 36));
1608        _for_each_inner_interrupt!(([direct_bindable 13] 37));
1609        _for_each_inner_interrupt!(([direct_bindable 14] 38));
1610        _for_each_inner_interrupt!(([direct_bindable 15] 39));
1611        _for_each_inner_interrupt!(([direct_bindable 16] 40));
1612        _for_each_inner_interrupt!(([direct_bindable 17] 41));
1613        _for_each_inner_interrupt!(([direct_bindable 18] 42));
1614        _for_each_inner_interrupt!(([direct_bindable 19] 43));
1615        _for_each_inner_interrupt!(([direct_bindable 20] 44));
1616        _for_each_inner_interrupt!(([direct_bindable 21] 45));
1617        _for_each_inner_interrupt!(([direct_bindable 22] 46));
1618        _for_each_inner_interrupt!(([direct_bindable 23] 47));
1619        _for_each_inner_interrupt!((all([disabled 0] 0), ([reserved 0] 1), ([reserved 1]
1620        2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5), ([reserved 5] 6),
1621        ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9), ([reserved 9] 10),
1622        ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13), ([reserved 13] 14),
1623        ([reserved 14] 15), ([vector 0] 16), ([vector 1] 17), ([vector 2] 18), ([vector
1624        3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6] 22), ([vector 7] 23),
1625        ([direct_bindable 0] 24), ([direct_bindable 1] 25), ([direct_bindable 2] 26),
1626        ([direct_bindable 3] 27), ([direct_bindable 4] 28), ([direct_bindable 5] 29),
1627        ([direct_bindable 6] 30), ([direct_bindable 7] 31), ([direct_bindable 8] 32),
1628        ([direct_bindable 9] 33), ([direct_bindable 10] 34), ([direct_bindable 11] 35),
1629        ([direct_bindable 12] 36), ([direct_bindable 13] 37), ([direct_bindable 14] 38),
1630        ([direct_bindable 15] 39), ([direct_bindable 16] 40), ([direct_bindable 17] 41),
1631        ([direct_bindable 18] 42), ([direct_bindable 19] 43), ([direct_bindable 20] 44),
1632        ([direct_bindable 21] 45), ([direct_bindable 22] 46), ([direct_bindable 23]
1633        47)));
1634    };
1635}
1636#[macro_export]
1637#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1638macro_rules! for_each_classified_interrupt {
1639    ($($pattern:tt => $code:tt;)*) => {
1640        macro_rules! _for_each_inner_classified_interrupt { $(($pattern) => $code;)*
1641        ($other : tt) => {} } _for_each_inner_classified_interrupt!(([direct_bindable 0]
1642        24)); _for_each_inner_classified_interrupt!(([direct_bindable 1] 25));
1643        _for_each_inner_classified_interrupt!(([direct_bindable 2] 26));
1644        _for_each_inner_classified_interrupt!(([direct_bindable 3] 27));
1645        _for_each_inner_classified_interrupt!(([direct_bindable 4] 28));
1646        _for_each_inner_classified_interrupt!(([direct_bindable 5] 29));
1647        _for_each_inner_classified_interrupt!(([direct_bindable 6] 30));
1648        _for_each_inner_classified_interrupt!(([direct_bindable 7] 31));
1649        _for_each_inner_classified_interrupt!(([direct_bindable 8] 32));
1650        _for_each_inner_classified_interrupt!(([direct_bindable 9] 33));
1651        _for_each_inner_classified_interrupt!(([direct_bindable 10] 34));
1652        _for_each_inner_classified_interrupt!(([direct_bindable 11] 35));
1653        _for_each_inner_classified_interrupt!(([direct_bindable 12] 36));
1654        _for_each_inner_classified_interrupt!(([direct_bindable 13] 37));
1655        _for_each_inner_classified_interrupt!(([direct_bindable 14] 38));
1656        _for_each_inner_classified_interrupt!(([direct_bindable 15] 39));
1657        _for_each_inner_classified_interrupt!(([direct_bindable 16] 40));
1658        _for_each_inner_classified_interrupt!(([direct_bindable 17] 41));
1659        _for_each_inner_classified_interrupt!(([direct_bindable 18] 42));
1660        _for_each_inner_classified_interrupt!(([direct_bindable 19] 43));
1661        _for_each_inner_classified_interrupt!(([direct_bindable 20] 44));
1662        _for_each_inner_classified_interrupt!(([direct_bindable 21] 45));
1663        _for_each_inner_classified_interrupt!(([direct_bindable 22] 46));
1664        _for_each_inner_classified_interrupt!(([direct_bindable 23] 47));
1665        _for_each_inner_classified_interrupt!(([vector 0] 16));
1666        _for_each_inner_classified_interrupt!(([vector 1] 17));
1667        _for_each_inner_classified_interrupt!(([vector 2] 18));
1668        _for_each_inner_classified_interrupt!(([vector 3] 19));
1669        _for_each_inner_classified_interrupt!(([vector 4] 20));
1670        _for_each_inner_classified_interrupt!(([vector 5] 21));
1671        _for_each_inner_classified_interrupt!(([vector 6] 22));
1672        _for_each_inner_classified_interrupt!(([vector 7] 23));
1673        _for_each_inner_classified_interrupt!(([reserved 0] 1));
1674        _for_each_inner_classified_interrupt!(([reserved 1] 2));
1675        _for_each_inner_classified_interrupt!(([reserved 2] 3));
1676        _for_each_inner_classified_interrupt!(([reserved 3] 4));
1677        _for_each_inner_classified_interrupt!(([reserved 4] 5));
1678        _for_each_inner_classified_interrupt!(([reserved 5] 6));
1679        _for_each_inner_classified_interrupt!(([reserved 6] 7));
1680        _for_each_inner_classified_interrupt!(([reserved 7] 8));
1681        _for_each_inner_classified_interrupt!(([reserved 8] 9));
1682        _for_each_inner_classified_interrupt!(([reserved 9] 10));
1683        _for_each_inner_classified_interrupt!(([reserved 10] 11));
1684        _for_each_inner_classified_interrupt!(([reserved 11] 12));
1685        _for_each_inner_classified_interrupt!(([reserved 12] 13));
1686        _for_each_inner_classified_interrupt!(([reserved 13] 14));
1687        _for_each_inner_classified_interrupt!(([reserved 14] 15));
1688        _for_each_inner_classified_interrupt!((direct_bindable([direct_bindable 0] 24),
1689        ([direct_bindable 1] 25), ([direct_bindable 2] 26), ([direct_bindable 3] 27),
1690        ([direct_bindable 4] 28), ([direct_bindable 5] 29), ([direct_bindable 6] 30),
1691        ([direct_bindable 7] 31), ([direct_bindable 8] 32), ([direct_bindable 9] 33),
1692        ([direct_bindable 10] 34), ([direct_bindable 11] 35), ([direct_bindable 12] 36),
1693        ([direct_bindable 13] 37), ([direct_bindable 14] 38), ([direct_bindable 15] 39),
1694        ([direct_bindable 16] 40), ([direct_bindable 17] 41), ([direct_bindable 18] 42),
1695        ([direct_bindable 19] 43), ([direct_bindable 20] 44), ([direct_bindable 21] 45),
1696        ([direct_bindable 22] 46), ([direct_bindable 23] 47)));
1697        _for_each_inner_classified_interrupt!((vector([vector 0] 16), ([vector 1] 17),
1698        ([vector 2] 18), ([vector 3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6]
1699        22), ([vector 7] 23))); _for_each_inner_classified_interrupt!((reserved([reserved
1700        0] 1), ([reserved 1] 2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5),
1701        ([reserved 5] 6), ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9),
1702        ([reserved 9] 10), ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13),
1703        ([reserved 13] 14), ([reserved 14] 15)));
1704        _for_each_inner_classified_interrupt!((context_switch));
1705    };
1706}
1707#[macro_export]
1708#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1709macro_rules! for_each_interrupt_priority {
1710    ($($pattern:tt => $code:tt;)*) => {
1711        macro_rules! _for_each_inner_interrupt_priority { $(($pattern) => $code;)*
1712        ($other : tt) => {} } _for_each_inner_interrupt_priority!((0, 1, Priority1,
1713        Level1)); _for_each_inner_interrupt_priority!((1, 2, Priority2, Level2));
1714        _for_each_inner_interrupt_priority!((2, 3, Priority3, Level3));
1715        _for_each_inner_interrupt_priority!((3, 4, Priority4, Level4));
1716        _for_each_inner_interrupt_priority!((4, 5, Priority5, Level5));
1717        _for_each_inner_interrupt_priority!((5, 6, Priority6, Level6));
1718        _for_each_inner_interrupt_priority!((6, 7, Priority7, Level7));
1719        _for_each_inner_interrupt_priority!((7, 8, Priority8, Level8));
1720        _for_each_inner_interrupt_priority!((all(0, 1, Priority1, Level1), (1, 2,
1721        Priority2, Level2), (2, 3, Priority3, Level3), (3, 4, Priority4, Level4), (4, 5,
1722        Priority5, Level5), (5, 6, Priority6, Level6), (6, 7, Priority7, Level7), (7, 8,
1723        Priority8, Level8)));
1724    };
1725}
1726#[macro_export]
1727#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1728macro_rules! for_each_sw_interrupt {
1729    ($($pattern:tt => $code:tt;)*) => {
1730        macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1731        tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1732        software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1733        software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1734        software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1735        software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1736        software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1737        FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1738    };
1739}
1740#[macro_export]
1741/// ESP-HAL must provide implementation for the following functions:
1742/// ```rust, no_run
1743/// // XTAL_CLK
1744///
1745/// // BBPLL_CLK
1746///
1747/// fn enable_bbpll_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1748///     todo!()
1749/// }
1750///
1751/// // CPLL_CLK
1752///
1753/// fn enable_cpll_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1754///     todo!()
1755/// }
1756///
1757/// // MPLL_CLK
1758///
1759/// fn enable_mpll_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1760///     todo!()
1761/// }
1762///
1763/// fn configure_mpll_clk_impl(
1764///     _clocks: &mut ClockTree,
1765///     _old_config: Option<MpllClkConfig>,
1766///     _new_config: MpllClkConfig,
1767/// ) {
1768///     todo!()
1769/// }
1770///
1771/// // RC_FAST_CLK
1772///
1773/// fn enable_rc_fast_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1774///     todo!()
1775/// }
1776///
1777/// // XTAL32K_CLK
1778///
1779/// #[cfg(use_xtal32k)]
1780/// fn enable_xtal32k_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1781///     todo!()
1782/// }
1783///
1784/// // RC_SLOW_CLK
1785///
1786/// fn enable_rc_slow_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1787///     todo!()
1788/// }
1789///
1790/// // PLL_F20M
1791///
1792/// fn enable_pll_f20m_impl(_clocks: &mut ClockTree, _en: bool) {
1793///     todo!()
1794/// }
1795///
1796/// // PLL_F80M
1797///
1798/// fn enable_pll_f80m_impl(_clocks: &mut ClockTree, _en: bool) {
1799///     todo!()
1800/// }
1801///
1802/// // PLL_F120M
1803///
1804/// fn enable_pll_f120m_impl(_clocks: &mut ClockTree, _en: bool) {
1805///     todo!()
1806/// }
1807///
1808/// // PLL_F160M
1809///
1810/// fn enable_pll_f160m_impl(_clocks: &mut ClockTree, _en: bool) {
1811///     todo!()
1812/// }
1813///
1814/// // PLL_F240M
1815///
1816/// fn enable_pll_f240m_impl(_clocks: &mut ClockTree, _en: bool) {
1817///     todo!()
1818/// }
1819///
1820/// // BBPLL_D3_CLOCK
1821///
1822/// fn enable_bbpll_d3_clock_impl(_clocks: &mut ClockTree, _en: bool) {
1823///     todo!()
1824/// }
1825///
1826/// // PLL_F25M
1827///
1828/// fn enable_pll_f25m_impl(_clocks: &mut ClockTree, _en: bool) {
1829///     todo!()
1830/// }
1831///
1832/// // PLL_F50M
1833///
1834/// fn enable_pll_f50m_impl(_clocks: &mut ClockTree, _en: bool) {
1835///     todo!()
1836/// }
1837///
1838/// // XTAL_D2_CLK
1839///
1840/// fn enable_xtal_d2_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1841///     todo!()
1842/// }
1843///
1844/// // CPU_ROOT_CLK
1845///
1846/// fn enable_cpu_root_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1847///     todo!()
1848/// }
1849///
1850/// fn configure_cpu_root_clk_impl(
1851///     _clocks: &mut ClockTree,
1852///     _old_config: Option<CpuRootClkConfig>,
1853///     _new_config: CpuRootClkConfig,
1854/// ) {
1855///     todo!()
1856/// }
1857///
1858/// // CPU_CLK
1859///
1860/// fn configure_cpu_clk_impl(
1861///     _clocks: &mut ClockTree,
1862///     _old_config: Option<CpuClkConfig>,
1863///     _new_config: CpuClkConfig,
1864/// ) {
1865///     todo!()
1866/// }
1867///
1868/// // MEM_CLK
1869///
1870/// fn configure_mem_clk_impl(
1871///     _clocks: &mut ClockTree,
1872///     _old_config: Option<MemClkConfig>,
1873///     _new_config: MemClkConfig,
1874/// ) {
1875///     todo!()
1876/// }
1877///
1878/// // SYS_CLK
1879///
1880/// fn configure_sys_clk_impl(
1881///     _clocks: &mut ClockTree,
1882///     _old_config: Option<SysClkConfig>,
1883///     _new_config: SysClkConfig,
1884/// ) {
1885///     todo!()
1886/// }
1887///
1888/// // APB_CLK
1889///
1890/// fn enable_apb_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1891///     todo!()
1892/// }
1893///
1894/// fn configure_apb_clk_impl(
1895///     _clocks: &mut ClockTree,
1896///     _old_config: Option<ApbClkConfig>,
1897///     _new_config: ApbClkConfig,
1898/// ) {
1899///     todo!()
1900/// }
1901///
1902/// // LP_FAST_CLK
1903///
1904/// fn enable_lp_fast_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1905///     todo!()
1906/// }
1907///
1908/// fn configure_lp_fast_clk_impl(
1909///     _clocks: &mut ClockTree,
1910///     _old_config: Option<LpFastClkConfig>,
1911///     _new_config: LpFastClkConfig,
1912/// ) {
1913///     todo!()
1914/// }
1915///
1916/// // LP_SLOW_CLK
1917///
1918/// fn enable_lp_slow_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1919///     todo!()
1920/// }
1921///
1922/// fn configure_lp_slow_clk_impl(
1923///     _clocks: &mut ClockTree,
1924///     _old_config: Option<LpSlowClkConfig>,
1925///     _new_config: LpSlowClkConfig,
1926/// ) {
1927///     todo!()
1928/// }
1929///
1930/// // LP_PERI_CLK
1931///
1932/// fn configure_lp_peri_clk_impl(
1933///     _clocks: &mut ClockTree,
1934///     _old_config: Option<LpPeriClkConfig>,
1935///     _new_config: LpPeriClkConfig,
1936/// ) {
1937///     todo!()
1938/// }
1939///
1940/// // BLE_LP_XTAL_CLK
1941///
1942/// fn enable_ble_lp_xtal_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1943///     todo!()
1944/// }
1945///
1946/// // BLE_LP_CLK
1947///
1948/// fn enable_ble_lp_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1949///     todo!()
1950/// }
1951///
1952/// fn configure_ble_lp_clk_impl(
1953///     _clocks: &mut ClockTree,
1954///     _old_config: Option<BleLpClkConfig>,
1955///     _new_config: BleLpClkConfig,
1956/// ) {
1957///     todo!()
1958/// }
1959///
1960/// // CRYPTO_CLK
1961///
1962/// fn enable_crypto_clk_impl(_clocks: &mut ClockTree, _en: bool) {
1963///     todo!()
1964/// }
1965///
1966/// fn configure_crypto_clk_impl(
1967///     _clocks: &mut ClockTree,
1968///     _old_config: Option<CryptoClkConfig>,
1969///     _new_config: CryptoClkConfig,
1970/// ) {
1971///     todo!()
1972/// }
1973///
1974/// // IOMUX_FUNCTION_CLOCK
1975///
1976/// fn configure_iomux_function_clock_impl(
1977///     _clocks: &mut ClockTree,
1978///     _old_config: Option<IomuxFunctionClockConfig>,
1979///     _new_config: IomuxFunctionClockConfig,
1980/// ) {
1981///     todo!()
1982/// }
1983///
1984/// // TIMG_CALIBRATION_CLOCK
1985///
1986/// fn enable_timg_calibration_clock_impl(_clocks: &mut ClockTree, _en: bool) {
1987///     todo!()
1988/// }
1989///
1990/// fn configure_timg_calibration_clock_impl(
1991///     _clocks: &mut ClockTree,
1992///     _old_config: Option<TimgCalibrationClockConfig>,
1993///     _new_config: TimgCalibrationClockConfig,
1994/// ) {
1995///     todo!()
1996/// }
1997///
1998/// impl CordicInstance {
1999///     // CORDIC_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<CordicFunctionClockConfig>,
2009///         _new_config: CordicFunctionClockConfig,
2010///     ) {
2011///         todo!()
2012///     }
2013/// }
2014/// impl SdmInstance {
2015///     // SDM_FUNCTION_CLOCK
2016///
2017///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2018///         todo!()
2019///     }
2020/// }
2021/// impl I2cInstance {
2022///     // I2C_FUNCTION_CLOCK
2023///
2024///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2025///         todo!()
2026///     }
2027///
2028///     fn configure_function_clock_impl(
2029///         self,
2030///         _clocks: &mut ClockTree,
2031///         _old_config: Option<I2cFunctionClockConfig>,
2032///         _new_config: I2cFunctionClockConfig,
2033///     ) {
2034///         todo!()
2035///     }
2036/// }
2037/// impl I2sInstance {
2038///     // I2S_TX_CLK
2039///
2040///     fn enable_tx_clk_impl(self, _clocks: &mut ClockTree, _en: bool) {
2041///         todo!()
2042///     }
2043///
2044///     fn configure_tx_clk_impl(
2045///         self,
2046///         _clocks: &mut ClockTree,
2047///         _old_config: Option<I2sClkConfig>,
2048///         _new_config: I2sClkConfig,
2049///     ) {
2050///         todo!()
2051///     }
2052///
2053///     // I2S_RX_CLK
2054///
2055///     fn enable_rx_clk_impl(self, _clocks: &mut ClockTree, _en: bool) {
2056///         todo!()
2057///     }
2058///
2059///     fn configure_rx_clk_impl(
2060///         self,
2061///         _clocks: &mut ClockTree,
2062///         _old_config: Option<I2sClkConfig>,
2063///         _new_config: I2sClkConfig,
2064///     ) {
2065///         todo!()
2066///     }
2067///
2068///     // I2S_MCLK_OUT
2069///
2070///     fn enable_mclk_out_impl(self, _clocks: &mut ClockTree, _en: bool) {
2071///         todo!()
2072///     }
2073///
2074///     fn configure_mclk_out_impl(
2075///         self,
2076///         _clocks: &mut ClockTree,
2077///         _old_config: Option<I2sMclkOutConfig>,
2078///         _new_config: I2sMclkOutConfig,
2079///     ) {
2080///         todo!()
2081///     }
2082/// }
2083/// impl LcdCamInstance {
2084///     // LCD_CAM_LCD_CLOCK
2085///
2086///     fn enable_lcd_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2087///         todo!()
2088///     }
2089///
2090///     fn configure_lcd_clock_impl(
2091///         self,
2092///         _clocks: &mut ClockTree,
2093///         _old_config: Option<LcdCamLcdClockConfig>,
2094///         _new_config: LcdCamLcdClockConfig,
2095///     ) {
2096///         todo!()
2097///     }
2098///
2099///     // LCD_CAM_CAM_CLOCK
2100///
2101///     fn enable_cam_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2102///         todo!()
2103///     }
2104///
2105///     fn configure_cam_clock_impl(
2106///         self,
2107///         _clocks: &mut ClockTree,
2108///         _old_config: Option<LcdCamCamClockConfig>,
2109///         _new_config: LcdCamCamClockConfig,
2110///     ) {
2111///         todo!()
2112///     }
2113/// }
2114/// impl ParlIoInstance {
2115///     // PARL_IO_RX_CLOCK
2116///
2117///     fn enable_rx_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2118///         todo!()
2119///     }
2120///
2121///     fn configure_rx_clock_impl(
2122///         self,
2123///         _clocks: &mut ClockTree,
2124///         _old_config: Option<ParlIoClkConfig>,
2125///         _new_config: ParlIoClkConfig,
2126///     ) {
2127///         todo!()
2128///     }
2129///
2130///     // PARL_IO_TX_CLOCK
2131///
2132///     fn enable_tx_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2133///         todo!()
2134///     }
2135///
2136///     fn configure_tx_clock_impl(
2137///         self,
2138///         _clocks: &mut ClockTree,
2139///         _old_config: Option<ParlIoClkConfig>,
2140///         _new_config: ParlIoClkConfig,
2141///     ) {
2142///         todo!()
2143///     }
2144/// }
2145/// impl PcntInstance {
2146///     // PCNT_FUNCTION_CLOCK
2147///
2148///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2149///         todo!()
2150///     }
2151/// }
2152/// impl RmtInstance {
2153///     // RMT_SCLK
2154///
2155///     fn enable_sclk_impl(self, _clocks: &mut ClockTree, _en: bool) {
2156///         todo!()
2157///     }
2158///
2159///     fn configure_sclk_impl(
2160///         self,
2161///         _clocks: &mut ClockTree,
2162///         _old_config: Option<RmtSclkConfig>,
2163///         _new_config: RmtSclkConfig,
2164///     ) {
2165///         todo!()
2166///     }
2167/// }
2168/// impl SpiInstance {
2169///     // SPI_FUNCTION_CLOCK
2170///
2171///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2172///         todo!()
2173///     }
2174///
2175///     fn configure_function_clock_impl(
2176///         self,
2177///         _clocks: &mut ClockTree,
2178///         _old_config: Option<SpiFunctionClockConfig>,
2179///         _new_config: SpiFunctionClockConfig,
2180///     ) {
2181///         todo!()
2182///     }
2183/// }
2184/// impl TimgInstance {
2185///     // TIMG_FUNCTION_CLOCK
2186///
2187///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2188///         todo!()
2189///     }
2190///
2191///     fn configure_function_clock_impl(
2192///         self,
2193///         _clocks: &mut ClockTree,
2194///         _old_config: Option<TimgFunctionClockConfig>,
2195///         _new_config: TimgFunctionClockConfig,
2196///     ) {
2197///         todo!()
2198///     }
2199///
2200///     // TIMG_WDT_CLOCK
2201///
2202///     fn enable_wdt_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2203///         todo!()
2204///     }
2205///
2206///     fn configure_wdt_clock_impl(
2207///         self,
2208///         _clocks: &mut ClockTree,
2209///         _old_config: Option<TimgWdtClockConfig>,
2210///         _new_config: TimgWdtClockConfig,
2211///     ) {
2212///         todo!()
2213///     }
2214/// }
2215/// impl TsensInstance {
2216///     // TSENS_SCLK
2217///
2218///     fn enable_sclk_impl(self, _clocks: &mut ClockTree, _en: bool) {
2219///         todo!()
2220///     }
2221/// }
2222/// impl UartInstance {
2223///     // UART_FUNCTION_CLOCK
2224///
2225///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2226///         todo!()
2227///     }
2228///
2229///     fn configure_function_clock_impl(
2230///         self,
2231///         _clocks: &mut ClockTree,
2232///         _old_config: Option<UartFunctionClockConfig>,
2233///         _new_config: UartFunctionClockConfig,
2234///     ) {
2235///         todo!()
2236///     }
2237///
2238///     // UART_BAUD_RATE_GENERATOR
2239///
2240///     fn enable_baud_rate_generator_impl(self, _clocks: &mut ClockTree, _en: bool) {
2241///         todo!()
2242///     }
2243///
2244///     fn configure_baud_rate_generator_impl(
2245///         self,
2246///         _clocks: &mut ClockTree,
2247///         _old_config: Option<UartBaudRateGeneratorConfig>,
2248///         _new_config: UartBaudRateGeneratorConfig,
2249///     ) {
2250///         todo!()
2251///     }
2252///
2253///     // UART_MEM_CLOCK
2254///
2255///     fn enable_mem_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2256///         todo!()
2257///     }
2258/// }
2259/// impl PsramInstance {
2260///     // PSRAM_FUNCTION_CLOCK
2261///
2262///     fn enable_function_clock_impl(self, _clocks: &mut ClockTree, _en: bool) {
2263///         todo!()
2264///     }
2265///
2266///     fn configure_function_clock_impl(
2267///         self,
2268///         _clocks: &mut ClockTree,
2269///         _old_config: Option<PsramFunctionClockConfig>,
2270///         _new_config: PsramFunctionClockConfig,
2271///     ) {
2272///         todo!()
2273///     }
2274/// }
2275/// ```
2276macro_rules! define_clock_tree_types {
2277    () => {
2278        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2279        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2280        pub enum CordicInstance {
2281            Cordic = 0,
2282        }
2283        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2284        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2285        pub enum SdmInstance {
2286            GpioSd = 0,
2287        }
2288        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2289        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2290        pub enum I2cInstance {
2291            I2c0 = 0,
2292            I2c1 = 1,
2293        }
2294        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2295        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2296        pub enum I2sInstance {
2297            I2s0 = 0,
2298            I2s1 = 1,
2299        }
2300        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2301        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2302        pub enum LcdCamInstance {
2303            LcdCam = 0,
2304        }
2305        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2306        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2307        pub enum ParlIoInstance {
2308            ParlIo = 0,
2309        }
2310        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2311        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2312        pub enum PcntInstance {
2313            Pcnt  = 0,
2314            Pcnt1 = 1,
2315        }
2316        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2317        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2318        pub enum RmtInstance {
2319            Rmt = 0,
2320        }
2321        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2322        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2323        pub enum SpiInstance {
2324            Spi2 = 0,
2325            Spi3 = 1,
2326        }
2327        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2328        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2329        pub enum TimgInstance {
2330            Timg0 = 0,
2331            Timg1 = 1,
2332        }
2333        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2334        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2335        pub enum TsensInstance {
2336            Tsens = 0,
2337        }
2338        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2339        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2340        pub enum UartInstance {
2341            Uart0 = 0,
2342            Uart1 = 1,
2343            Uart2 = 2,
2344            Uart3 = 3,
2345        }
2346        #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2347        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2348        pub enum PsramInstance {
2349            Psram = 0,
2350        }
2351        /// Selects the output frequency of `MPLL_CLK`. Depends on `XTAL_CLK`.
2352        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2353        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2354        pub enum MpllClkConfig {
2355            /// 400 MHz
2356            _400,
2357            /// 500 MHz
2358            _500,
2359        }
2360        impl MpllClkConfig {
2361            pub fn value(&self) -> u32 {
2362                match self {
2363                    MpllClkConfig::_400 => 400000000,
2364                    MpllClkConfig::_500 => 500000000,
2365                }
2366            }
2367        }
2368        /// The list of clock signals that the `CPU_ROOT_CLK` multiplexer can output.
2369        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2370        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2371        pub enum CpuRootClkConfig {
2372            /// Selects `XTAL_CLK`.
2373            Xtal,
2374            /// Selects `CPLL_CLK`.
2375            Cpll,
2376            /// Selects `RC_FAST_CLK`.
2377            RcFast,
2378            /// Selects `PLL_F240M`.
2379            PllF240m,
2380        }
2381        /// Configures the `CPU_CLK` clock node.
2382        ///
2383        /// The output is calculated as `OUTPUT = CPU_ROOT_CLK / (divisor + 1)`.
2384        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2385        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2386        pub struct CpuClkConfig {
2387            divisor: u32,
2388        }
2389        impl CpuClkConfig {
2390            /// Creates a new configuration for the CPU_CLK clock node.
2391            ///
2392            /// ## Panics
2393            ///
2394            /// Panics if the divisor value is outside the
2395            /// valid range (0 ..= 255).
2396            pub const fn new(divisor: u32) -> Self {
2397                ::core::assert!(
2398                    divisor <= 255,
2399                    "`CPU_CLK` divisor must be between 0 and 255 (inclusive)."
2400                );
2401                Self { divisor }
2402            }
2403            pub fn divisor(self) -> u32 {
2404                self.divisor as u32
2405            }
2406        }
2407        /// Configures the `MEM_CLK` clock node.
2408        ///
2409        /// The output is calculated as `OUTPUT = CPU_CLK / (divisor + 1)`.
2410        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2411        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2412        pub struct MemClkConfig {
2413            divisor: u32,
2414        }
2415        impl MemClkConfig {
2416            /// Creates a new configuration for the MEM_CLK clock node.
2417            ///
2418            /// ## Panics
2419            ///
2420            /// Panics if the divisor value is outside the
2421            /// valid range (0 ..= 1).
2422            pub const fn new(divisor: u32) -> Self {
2423                ::core::assert!(
2424                    divisor <= 1,
2425                    "`MEM_CLK` divisor must be between 0 and 1 (inclusive)."
2426                );
2427                Self { divisor }
2428            }
2429            pub fn divisor(self) -> u32 {
2430                self.divisor as u32
2431            }
2432        }
2433        /// Configures the `SYS_CLK` clock node.
2434        ///
2435        /// The output is calculated as `OUTPUT = CPU_CLK / (divisor + 1)`.
2436        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2437        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2438        pub struct SysClkConfig {
2439            divisor: u32,
2440        }
2441        impl SysClkConfig {
2442            /// Creates a new configuration for the SYS_CLK clock node.
2443            ///
2444            /// ## Panics
2445            ///
2446            /// Panics if the divisor value is outside the
2447            /// valid range (0 ..= 255).
2448            pub const fn new(divisor: u32) -> Self {
2449                ::core::assert!(
2450                    divisor <= 255,
2451                    "`SYS_CLK` divisor must be between 0 and 255 (inclusive)."
2452                );
2453                Self { divisor }
2454            }
2455            pub fn divisor(self) -> u32 {
2456                self.divisor as u32
2457            }
2458        }
2459        /// Configures the `APB_CLK` clock node.
2460        ///
2461        /// The output is calculated as `OUTPUT = SYS_CLK / (divisor + 1)`.
2462        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2463        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2464        pub struct ApbClkConfig {
2465            divisor: u32,
2466        }
2467        impl ApbClkConfig {
2468            /// Creates a new configuration for the APB_CLK clock node.
2469            ///
2470            /// ## Panics
2471            ///
2472            /// Panics if the divisor value is outside the
2473            /// valid range (0 ..= 255).
2474            pub const fn new(divisor: u32) -> Self {
2475                ::core::assert!(
2476                    divisor <= 255,
2477                    "`APB_CLK` divisor must be between 0 and 255 (inclusive)."
2478                );
2479                Self { divisor }
2480            }
2481            pub fn divisor(self) -> u32 {
2482                self.divisor as u32
2483            }
2484        }
2485        /// The list of clock signals that the `LP_FAST_CLK` multiplexer can output.
2486        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2487        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2488        pub enum LpFastClkConfig {
2489            /// Selects `RC_FAST_CLK`.
2490            RcFast,
2491            /// Selects `XTAL_CLK`.
2492            Xtal,
2493        }
2494        /// The list of clock signals that the `LP_SLOW_CLK` multiplexer can output.
2495        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2496        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2497        pub enum LpSlowClkConfig {
2498            /// Selects `RC_SLOW_CLK`.
2499            RcSlow,
2500            #[cfg(use_xtal32k)]
2501            /// Selects `XTAL32K_CLK`.
2502            Xtal32k,
2503        }
2504        /// Configures the `LP_PERI_CLK` clock node.
2505        ///
2506        /// The output is calculated as `OUTPUT = LP_FAST_CLK / (divisor + 1)`.
2507        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2508        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2509        pub struct LpPeriClkConfig {
2510            divisor: u32,
2511        }
2512        impl LpPeriClkConfig {
2513            /// Creates a new configuration for the LP_PERI_CLK clock node.
2514            ///
2515            /// ## Panics
2516            ///
2517            /// Panics if the divisor value is outside the
2518            /// valid range (0 ..= 7).
2519            pub const fn new(divisor: u32) -> Self {
2520                ::core::assert!(
2521                    divisor <= 7,
2522                    "`LP_PERI_CLK` divisor must be between 0 and 7 (inclusive)."
2523                );
2524                Self { divisor }
2525            }
2526            pub fn divisor(self) -> u32 {
2527                self.divisor as u32
2528            }
2529        }
2530        /// The list of clock signals that the `BLE_LP_CLK` multiplexer can output.
2531        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2532        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2533        pub enum BleLpClkConfig {
2534            /// Selects `BLE_LP_XTAL_CLK`.
2535            Xtal,
2536            #[cfg(use_xtal32k)]
2537            /// Selects `XTAL32K_CLK`.
2538            Xtal32k,
2539        }
2540        /// The list of clock signals that the `CRYPTO_CLK` multiplexer can output.
2541        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2542        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2543        pub enum CryptoClkConfig {
2544            /// Selects `XTAL_CLK`.
2545            Xtal,
2546            /// Selects `RC_FAST_CLK`.
2547            RcFast,
2548            /// Selects `PLL_F240M`.
2549            PllF240m,
2550        }
2551        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2552        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2553        pub enum IomuxFunctionClockSource {
2554            /// Selects `XTAL_CLK`.
2555            XtalClk,
2556            #[default]
2557            /// Selects `PLL_F80M`.
2558            PllF80m,
2559        }
2560        /// Configures the `IOMUX_FUNCTION_CLOCK` clock node.
2561        ///
2562        /// The output is calculated as `OUTPUT = source / (div_num + 1)`.
2563        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2564        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2565        pub struct IomuxFunctionClockConfig {
2566            source: IomuxFunctionClockSource,
2567            div_num: u32,
2568        }
2569        impl IomuxFunctionClockConfig {
2570            /// Creates a new configuration for the IOMUX_FUNCTION_CLOCK clock node.
2571            ///
2572            /// ## Panics
2573            ///
2574            /// Panics if the div_num value is outside the
2575            /// valid range (0 ..= 255).
2576            pub const fn new(source: IomuxFunctionClockSource, div_num: u32) -> Self {
2577                ::core::assert!(
2578                    div_num <= 255,
2579                    "`IOMUX_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2580                );
2581                Self { source, div_num }
2582            }
2583            pub fn source(self) -> IomuxFunctionClockSource {
2584                self.source
2585            }
2586            pub fn div_num(self) -> u32 {
2587                self.div_num as u32
2588            }
2589        }
2590        /// The list of clock signals that the `TIMG_CALIBRATION_CLOCK` multiplexer can output.
2591        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2592        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2593        pub enum TimgCalibrationClockConfig {
2594            /// Selects `RC_SLOW_CLK`.
2595            RcSlowClk,
2596            /// Selects `RC_FAST_CLK`.
2597            RcFastDivClk,
2598            #[cfg(use_xtal32k)]
2599            /// Selects `XTAL32K_CLK`.
2600            Xtal32kClk,
2601        }
2602        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2603        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2604        pub enum CordicFunctionClockSource {
2605            /// Selects `XTAL_CLK`.
2606            Xtal,
2607            /// Selects `RC_FAST_CLK`.
2608            RcFast,
2609            #[default]
2610            /// Selects `PLL_F160M`.
2611            PllF160m,
2612        }
2613        /// Configures the `CORDIC_FUNCTION_CLOCK` clock node.
2614        ///
2615        /// The output is calculated as `OUTPUT = (source * denominator) / (divider * denominator +
2616        /// numerator)`.
2617        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2618        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2619        pub struct CordicFunctionClockConfig {
2620            source: CordicFunctionClockSource,
2621            divider: u32,
2622            numerator: u32,
2623            denominator: u32,
2624        }
2625        impl CordicFunctionClockConfig {
2626            /// Creates a new configuration for the FUNCTION_CLOCK clock node.
2627            ///
2628            /// ## Panics
2629            ///
2630            /// Panics if the divider value is outside the
2631            /// valid range (1 ..= 256).
2632            ///
2633            /// Panics if the numerator value is outside the
2634            /// valid range (0 ..= 254).
2635            ///
2636            /// Panics if the denominator value is outside the
2637            /// valid range (1 ..= 255).
2638            pub const fn new(
2639                source: CordicFunctionClockSource,
2640                divider: u32,
2641                numerator: u32,
2642                denominator: u32,
2643            ) -> Self {
2644                ::core::assert!(
2645                    divider >= 1 && divider <= 256,
2646                    "`CORDIC_FUNCTION_CLOCK` divider must be between 1 and 256 (inclusive)."
2647                );
2648                ::core::assert!(
2649                    numerator <= 254,
2650                    "`CORDIC_FUNCTION_CLOCK` numerator must be between 0 and 254 (inclusive)."
2651                );
2652                ::core::assert!(
2653                    denominator >= 1 && denominator <= 255,
2654                    "`CORDIC_FUNCTION_CLOCK` denominator must be between 1 and 255 (inclusive)."
2655                );
2656                Self {
2657                    source,
2658                    divider,
2659                    numerator,
2660                    denominator,
2661                }
2662            }
2663            pub fn source(self) -> CordicFunctionClockSource {
2664                self.source
2665            }
2666            pub fn divider(self) -> u32 {
2667                self.divider as u32
2668            }
2669            pub fn numerator(self) -> u32 {
2670                self.numerator as u32
2671            }
2672            pub fn denominator(self) -> u32 {
2673                self.denominator as u32
2674            }
2675        }
2676        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2677        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2678        pub enum I2cFunctionClockSclk {
2679            #[default]
2680            /// Selects `XTAL_CLK`.
2681            Xtal,
2682            /// Selects `RC_FAST_CLK`.
2683            RcFast,
2684        }
2685        /// Configures the `I2C0_FUNCTION_CLOCK` clock node.
2686        ///
2687        /// The output is calculated as `OUTPUT = sclk / (div_num + 1)`.
2688        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2689        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2690        pub struct I2cFunctionClockConfig {
2691            sclk: I2cFunctionClockSclk,
2692            div_num: u32,
2693        }
2694        impl I2cFunctionClockConfig {
2695            /// Creates a new configuration for the FUNCTION_CLOCK clock node.
2696            ///
2697            /// ## Panics
2698            ///
2699            /// Panics if the div_num value is outside the
2700            /// valid range (0 ..= 255).
2701            pub const fn new(sclk: I2cFunctionClockSclk, div_num: u32) -> Self {
2702                ::core::assert!(
2703                    div_num <= 255,
2704                    "`I2C0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2705                );
2706                Self { sclk, div_num }
2707            }
2708            pub fn sclk(self) -> I2cFunctionClockSclk {
2709                self.sclk
2710            }
2711            pub fn div_num(self) -> u32 {
2712                self.div_num as u32
2713            }
2714        }
2715        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2716        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2717        pub enum I2sClkSclk {
2718            #[default]
2719            /// Selects `XTAL_CLK`.
2720            Xtal,
2721        }
2722        /// Configures the `I2S0_TX_CLK` clock node.
2723        ///
2724        /// The output is calculated as `OUTPUT = (sclk * div_a) / (div_num * div_a + div_b)`.
2725        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2726        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2727        pub struct I2sClkConfig {
2728            sclk: I2sClkSclk,
2729            div_num: u32,
2730            div_a: u32,
2731            div_b: u32,
2732        }
2733        impl I2sClkConfig {
2734            /// Creates a new configuration for the TX_CLK clock node.
2735            ///
2736            /// ## Panics
2737            ///
2738            /// Panics if the div_num value is outside the
2739            /// valid range (1 ..= 256).
2740            ///
2741            /// Panics if the div_a value is outside the
2742            /// valid range (1 ..= 511).
2743            ///
2744            /// Panics if the div_b value is outside the
2745            /// valid range (0 ..= 511).
2746            pub const fn new(sclk: I2sClkSclk, div_num: u32, div_a: u32, div_b: u32) -> Self {
2747                ::core::assert!(
2748                    div_num >= 1 && div_num <= 256,
2749                    "`I2S0_TX_CLK` div_num must be between 1 and 256 (inclusive)."
2750                );
2751                ::core::assert!(
2752                    div_a >= 1 && div_a <= 511,
2753                    "`I2S0_TX_CLK` div_a must be between 1 and 511 (inclusive)."
2754                );
2755                ::core::assert!(
2756                    div_b <= 511,
2757                    "`I2S0_TX_CLK` div_b must be between 0 and 511 (inclusive)."
2758                );
2759                Self {
2760                    sclk,
2761                    div_num,
2762                    div_a,
2763                    div_b,
2764                }
2765            }
2766            pub fn sclk(self) -> I2sClkSclk {
2767                self.sclk
2768            }
2769            pub fn div_num(self) -> u32 {
2770                self.div_num as u32
2771            }
2772            pub fn div_a(self) -> u32 {
2773                self.div_a as u32
2774            }
2775            pub fn div_b(self) -> u32 {
2776                self.div_b as u32
2777            }
2778        }
2779        /// The list of clock signals that the `I2S0_MCLK_OUT` multiplexer can output.
2780        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2781        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2782        pub enum I2sMclkOutConfig {
2783            /// Selects `TX_CLK`.
2784            Tx,
2785            #[default]
2786            /// Selects `RX_CLK`.
2787            Rx,
2788        }
2789        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2790        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2791        pub enum LcdCamLcdClockSclk {
2792            #[default]
2793            /// Selects `XTAL_CLK`.
2794            XtalClk,
2795            /// Selects `PLL_F160M`.
2796            PllF160m,
2797        }
2798        /// Configures the `LCD_CAM_LCD_CLOCK` clock node.
2799        ///
2800        /// The output is calculated as `OUTPUT = (sclk * div_a) / (div_num * div_a + div_b)`.
2801        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2802        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2803        pub struct LcdCamLcdClockConfig {
2804            sclk: LcdCamLcdClockSclk,
2805            div_num: u32,
2806            div_a: u32,
2807            div_b: u32,
2808        }
2809        impl LcdCamLcdClockConfig {
2810            /// Creates a new configuration for the LCD_CLOCK clock node.
2811            ///
2812            /// ## Panics
2813            ///
2814            /// Panics if the div_num value is outside the
2815            /// valid range (1 ..= 256).
2816            ///
2817            /// Panics if the div_a value is outside the
2818            /// valid range (1 ..= 255).
2819            ///
2820            /// Panics if the div_b value is outside the
2821            /// valid range (0 ..= 255).
2822            pub const fn new(
2823                sclk: LcdCamLcdClockSclk,
2824                div_num: u32,
2825                div_a: u32,
2826                div_b: u32,
2827            ) -> Self {
2828                ::core::assert!(
2829                    div_num >= 1 && div_num <= 256,
2830                    "`LCD_CAM_LCD_CLOCK` div_num must be between 1 and 256 (inclusive)."
2831                );
2832                ::core::assert!(
2833                    div_a >= 1 && div_a <= 255,
2834                    "`LCD_CAM_LCD_CLOCK` div_a must be between 1 and 255 (inclusive)."
2835                );
2836                ::core::assert!(
2837                    div_b <= 255,
2838                    "`LCD_CAM_LCD_CLOCK` div_b must be between 0 and 255 (inclusive)."
2839                );
2840                Self {
2841                    sclk,
2842                    div_num,
2843                    div_a,
2844                    div_b,
2845                }
2846            }
2847            pub fn sclk(self) -> LcdCamLcdClockSclk {
2848                self.sclk
2849            }
2850            pub fn div_num(self) -> u32 {
2851                self.div_num as u32
2852            }
2853            pub fn div_a(self) -> u32 {
2854                self.div_a as u32
2855            }
2856            pub fn div_b(self) -> u32 {
2857                self.div_b as u32
2858            }
2859        }
2860        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2861        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2862        pub enum LcdCamCamClockSclk {
2863            #[default]
2864            /// Selects `XTAL_CLK`.
2865            XtalClk,
2866            /// Selects `PLL_F160M`.
2867            PllF160m,
2868        }
2869        /// Configures the `LCD_CAM_CAM_CLOCK` clock node.
2870        ///
2871        /// The output is calculated as `OUTPUT = (sclk * div_a) / (div_num * div_a + div_b)`.
2872        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2873        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2874        pub struct LcdCamCamClockConfig {
2875            sclk: LcdCamCamClockSclk,
2876            div_num: u32,
2877            div_a: u32,
2878            div_b: u32,
2879        }
2880        impl LcdCamCamClockConfig {
2881            /// Creates a new configuration for the CAM_CLOCK clock node.
2882            ///
2883            /// ## Panics
2884            ///
2885            /// Panics if the div_num value is outside the
2886            /// valid range (1 ..= 256).
2887            ///
2888            /// Panics if the div_a value is outside the
2889            /// valid range (1 ..= 255).
2890            ///
2891            /// Panics if the div_b value is outside the
2892            /// valid range (0 ..= 255).
2893            pub const fn new(
2894                sclk: LcdCamCamClockSclk,
2895                div_num: u32,
2896                div_a: u32,
2897                div_b: u32,
2898            ) -> Self {
2899                ::core::assert!(
2900                    div_num >= 1 && div_num <= 256,
2901                    "`LCD_CAM_CAM_CLOCK` div_num must be between 1 and 256 (inclusive)."
2902                );
2903                ::core::assert!(
2904                    div_a >= 1 && div_a <= 255,
2905                    "`LCD_CAM_CAM_CLOCK` div_a must be between 1 and 255 (inclusive)."
2906                );
2907                ::core::assert!(
2908                    div_b <= 255,
2909                    "`LCD_CAM_CAM_CLOCK` div_b must be between 0 and 255 (inclusive)."
2910                );
2911                Self {
2912                    sclk,
2913                    div_num,
2914                    div_a,
2915                    div_b,
2916                }
2917            }
2918            pub fn sclk(self) -> LcdCamCamClockSclk {
2919                self.sclk
2920            }
2921            pub fn div_num(self) -> u32 {
2922                self.div_num as u32
2923            }
2924            pub fn div_a(self) -> u32 {
2925                self.div_a as u32
2926            }
2927            pub fn div_b(self) -> u32 {
2928                self.div_b as u32
2929            }
2930        }
2931        /// The list of clock signals that the `PARL_IO_RX_CLOCK` multiplexer can output.
2932        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2933        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2934        pub enum ParlIoClkConfig {
2935            /// Selects `XTAL_CLK`.
2936            XtalClk,
2937            /// Selects `RC_FAST_CLK`.
2938            RcFastClk,
2939            #[default]
2940            /// Selects `PLL_F160M`.
2941            PllF160m,
2942        }
2943        /// The list of clock signals that the `RMT_SCLK` multiplexer can output.
2944        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2945        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2946        pub enum RmtSclkConfig {
2947            #[default]
2948            /// Selects `PLL_F80M`.
2949            PllF80m,
2950            /// Selects `RC_FAST_CLK`.
2951            RcFastClk,
2952            /// Selects `XTAL_CLK`.
2953            XtalClk,
2954        }
2955        /// The list of clock signals that the `SPI2_FUNCTION_CLOCK` multiplexer can output.
2956        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2957        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2958        pub enum SpiFunctionClockConfig {
2959            #[default]
2960            /// Selects `BBPLL_D3_CLOCK`.
2961            Bbpll,
2962            /// Selects `XTAL_CLK`.
2963            Xtal,
2964            /// Selects `RC_FAST_CLK`.
2965            RcFast,
2966        }
2967        /// The list of clock signals that the `TIMG0_FUNCTION_CLOCK` multiplexer can output.
2968        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2969        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2970        pub enum TimgFunctionClockConfig {
2971            #[default]
2972            /// Selects `PLL_F80M`.
2973            PllF80m,
2974            /// Selects `RC_FAST_CLK`.
2975            RcFastClk,
2976            /// Selects `XTAL_CLK`.
2977            XtalClk,
2978        }
2979        /// The list of clock signals that the `TIMG0_WDT_CLOCK` multiplexer can output.
2980        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2981        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2982        pub enum TimgWdtClockConfig {
2983            #[default]
2984            /// Selects `XTAL_CLK`.
2985            XtalClk,
2986            /// Selects `PLL_F80M`.
2987            PllF80m,
2988            /// Selects `RC_FAST_CLK`.
2989            RcFastClk,
2990        }
2991        /// The list of clock signals that the `TSENS_SCLK` multiplexer can output.
2992        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2993        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2994        pub enum TsensSclkConfig {
2995            #[default]
2996            /// Selects `LP_PERI_CLK`.
2997            LpPeri,
2998        }
2999        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
3000        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3001        pub enum UartFunctionClockSclk {
3002            #[default]
3003            /// Selects `PLL_F80M`.
3004            PllF80m,
3005            /// Selects `XTAL_CLK`.
3006            Xtal,
3007            /// Selects `RC_FAST_CLK`.
3008            RcFast,
3009        }
3010        /// Configures the `UART0_FUNCTION_CLOCK` clock node.
3011        ///
3012        /// The output is calculated as `OUTPUT = sclk / (div_num + 1)`.
3013        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
3014        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3015        pub struct UartFunctionClockConfig {
3016            sclk: UartFunctionClockSclk,
3017            div_num: u32,
3018        }
3019        impl UartFunctionClockConfig {
3020            /// Creates a new configuration for the FUNCTION_CLOCK clock node.
3021            ///
3022            /// ## Panics
3023            ///
3024            /// Panics if the div_num value is outside the
3025            /// valid range (0 ..= 255).
3026            pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
3027                ::core::assert!(
3028                    div_num <= 255,
3029                    "`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
3030                );
3031                Self { sclk, div_num }
3032            }
3033            pub fn sclk(self) -> UartFunctionClockSclk {
3034                self.sclk
3035            }
3036            pub fn div_num(self) -> u32 {
3037                self.div_num as u32
3038            }
3039        }
3040        /// Configures the `UART0_BAUD_RATE_GENERATOR` clock node.
3041        ///
3042        /// The output is calculated as `OUTPUT = (FUNCTION_CLOCK * 16) / (integral * 16 +
3043        /// fractional)`.
3044        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
3045        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3046        pub struct UartBaudRateGeneratorConfig {
3047            fractional: u32,
3048            integral: u32,
3049        }
3050        impl UartBaudRateGeneratorConfig {
3051            /// Creates a new configuration for the BAUD_RATE_GENERATOR clock node.
3052            ///
3053            /// ## Panics
3054            ///
3055            /// Panics if the fractional value is outside the
3056            /// valid range (0 ..= 15).
3057            ///
3058            /// Panics if the integral value is outside the
3059            /// valid range (0 ..= 4095).
3060            pub const fn new(fractional: u32, integral: u32) -> Self {
3061                ::core::assert!(
3062                    fractional <= 15,
3063                    "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
3064                );
3065                ::core::assert!(
3066                    integral <= 4095,
3067                    "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
3068                );
3069                Self {
3070                    fractional,
3071                    integral,
3072                }
3073            }
3074            pub fn fractional(self) -> u32 {
3075                self.fractional as u32
3076            }
3077            pub fn integral(self) -> u32 {
3078                self.integral as u32
3079            }
3080        }
3081        /// The list of clock signals that the `PSRAM_FUNCTION_CLOCK` multiplexer can output.
3082        #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
3083        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3084        pub enum PsramFunctionClockConfig {
3085            #[default]
3086            /// Selects `XTAL_CLK`.
3087            Xtal,
3088            /// Selects `MPLL_CLK`.
3089            Mpll,
3090            /// Selects `CPLL_CLK`.
3091            Cpll,
3092        }
3093        /// Represents the device's clock tree.
3094        pub struct ClockTree {
3095            mpll_clk: Option<MpllClkConfig>,
3096            cpu_root_clk: Option<CpuRootClkConfig>,
3097            cpu_clk: Option<CpuClkConfig>,
3098            mem_clk: Option<MemClkConfig>,
3099            sys_clk: Option<SysClkConfig>,
3100            apb_clk: Option<ApbClkConfig>,
3101            lp_fast_clk: Option<LpFastClkConfig>,
3102            lp_slow_clk: Option<LpSlowClkConfig>,
3103            lp_peri_clk: Option<LpPeriClkConfig>,
3104            ble_lp_clk: Option<BleLpClkConfig>,
3105            crypto_clk: Option<CryptoClkConfig>,
3106            iomux_function_clock: Option<IomuxFunctionClockConfig>,
3107            timg_calibration_clock: Option<TimgCalibrationClockConfig>,
3108            cordic_function_clock: [Option<CordicFunctionClockConfig>; 1],
3109            i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
3110            i2s_tx_clk: [Option<I2sClkConfig>; 2],
3111            i2s_rx_clk: [Option<I2sClkConfig>; 2],
3112            i2s_mclk_out: [Option<I2sMclkOutConfig>; 2],
3113            lcd_cam_lcd_clock: [Option<LcdCamLcdClockConfig>; 1],
3114            lcd_cam_cam_clock: [Option<LcdCamCamClockConfig>; 1],
3115            parl_io_rx_clock: [Option<ParlIoClkConfig>; 1],
3116            parl_io_tx_clock: [Option<ParlIoClkConfig>; 1],
3117            rmt_sclk: [Option<RmtSclkConfig>; 1],
3118            spi_function_clock: [Option<SpiFunctionClockConfig>; 2],
3119            timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
3120            timg_wdt_clock: [Option<TimgWdtClockConfig>; 2],
3121            uart_function_clock: [Option<UartFunctionClockConfig>; 4],
3122            uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 4],
3123            psram_function_clock: [Option<PsramFunctionClockConfig>; 1],
3124            pub(crate) bbpll_clk_refcount: u32,
3125            pub(crate) cpll_clk_refcount: u32,
3126            pub(crate) mpll_clk_refcount: u32,
3127            pub(crate) rc_fast_clk_refcount: u32,
3128            #[cfg(use_xtal32k)]
3129            pub(crate) xtal32k_clk_refcount: u32,
3130            pub(crate) rc_slow_clk_refcount: u32,
3131            pub(crate) pll_f20m_refcount: u32,
3132            pub(crate) pll_f80m_refcount: u32,
3133            pub(crate) pll_f120m_refcount: u32,
3134            pub(crate) pll_f160m_refcount: u32,
3135            pub(crate) pll_f240m_refcount: u32,
3136            pub(crate) bbpll_d3_clock_refcount: u32,
3137            pub(crate) pll_f25m_refcount: u32,
3138            pub(crate) pll_f50m_refcount: u32,
3139            pub(crate) xtal_d2_clk_refcount: u32,
3140            pub(crate) apb_clk_refcount: u32,
3141            pub(crate) lp_slow_clk_refcount: u32,
3142            pub(crate) ble_lp_clk_refcount: u32,
3143            pub(crate) crypto_clk_refcount: u32,
3144            pub(crate) timg_calibration_clock_refcount: u32,
3145            pub(crate) cordic_function_clock_refcount: [u32; 1],
3146            pub(crate) sdm_function_clock_refcount: [u32; 1],
3147            pub(crate) i2c_function_clock_refcount: [u32; 2],
3148            pub(crate) i2s_tx_clk_refcount: [u32; 2],
3149            pub(crate) i2s_rx_clk_refcount: [u32; 2],
3150            pub(crate) i2s_mclk_out_refcount: [u32; 2],
3151            pub(crate) lcd_cam_lcd_clock_refcount: [u32; 1],
3152            pub(crate) lcd_cam_cam_clock_refcount: [u32; 1],
3153            pub(crate) parl_io_rx_clock_refcount: [u32; 1],
3154            pub(crate) parl_io_tx_clock_refcount: [u32; 1],
3155            pub(crate) pcnt_function_clock_refcount: [u32; 2],
3156            pub(crate) rmt_sclk_refcount: [u32; 1],
3157            pub(crate) spi_function_clock_refcount: [u32; 2],
3158            pub(crate) timg_function_clock_refcount: [u32; 2],
3159            pub(crate) timg_wdt_clock_refcount: [u32; 2],
3160            pub(crate) tsens_sclk_refcount: [u32; 1],
3161            pub(crate) uart_function_clock_refcount: [u32; 4],
3162            pub(crate) uart_baud_rate_generator_refcount: [u32; 4],
3163            pub(crate) uart_mem_clock_refcount: [u32; 4],
3164            pub(crate) psram_function_clock_refcount: [u32; 1],
3165        }
3166        impl ClockTree {
3167            /// Locks the clock tree for exclusive access.
3168            pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
3169                CLOCK_TREE.with(f)
3170            }
3171            /// Returns the current configuration of the MPLL_CLK clock tree node
3172            pub fn mpll_clk(&self) -> Option<MpllClkConfig> {
3173                self.mpll_clk
3174            }
3175            /// Returns the current configuration of the CPU_ROOT_CLK clock tree node
3176            pub fn cpu_root_clk(&self) -> Option<CpuRootClkConfig> {
3177                self.cpu_root_clk
3178            }
3179            /// Returns the current configuration of the CPU_CLK clock tree node
3180            pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
3181                self.cpu_clk
3182            }
3183            /// Returns the current configuration of the MEM_CLK clock tree node
3184            pub fn mem_clk(&self) -> Option<MemClkConfig> {
3185                self.mem_clk
3186            }
3187            /// Returns the current configuration of the SYS_CLK clock tree node
3188            pub fn sys_clk(&self) -> Option<SysClkConfig> {
3189                self.sys_clk
3190            }
3191            /// Returns the current configuration of the APB_CLK clock tree node
3192            pub fn apb_clk(&self) -> Option<ApbClkConfig> {
3193                self.apb_clk
3194            }
3195            /// Returns the current configuration of the LP_FAST_CLK clock tree node
3196            pub fn lp_fast_clk(&self) -> Option<LpFastClkConfig> {
3197                self.lp_fast_clk
3198            }
3199            /// Returns the current configuration of the LP_SLOW_CLK clock tree node
3200            pub fn lp_slow_clk(&self) -> Option<LpSlowClkConfig> {
3201                self.lp_slow_clk
3202            }
3203            /// Returns the current configuration of the LP_PERI_CLK clock tree node
3204            pub fn lp_peri_clk(&self) -> Option<LpPeriClkConfig> {
3205                self.lp_peri_clk
3206            }
3207            /// Returns the current configuration of the BLE_LP_CLK clock tree node
3208            pub fn ble_lp_clk(&self) -> Option<BleLpClkConfig> {
3209                self.ble_lp_clk
3210            }
3211            /// Returns the current configuration of the CRYPTO_CLK clock tree node
3212            pub fn crypto_clk(&self) -> Option<CryptoClkConfig> {
3213                self.crypto_clk
3214            }
3215            /// Returns the current configuration of the IOMUX_FUNCTION_CLOCK clock tree node
3216            pub fn iomux_function_clock(&self) -> Option<IomuxFunctionClockConfig> {
3217                self.iomux_function_clock
3218            }
3219            /// Returns the current configuration of the TIMG_CALIBRATION_CLOCK clock tree node
3220            pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
3221                self.timg_calibration_clock
3222            }
3223            /// Returns the current configuration of the CORDIC_FUNCTION_CLOCK clock tree node
3224            pub fn cordic_function_clock(&self) -> Option<CordicFunctionClockConfig> {
3225                self.cordic_function_clock[CordicInstance::Cordic as usize]
3226            }
3227            /// Returns the current configuration of the I2C0_FUNCTION_CLOCK clock tree node
3228            pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
3229                self.i2c_function_clock[I2cInstance::I2c0 as usize]
3230            }
3231            /// Returns the current configuration of the I2C1_FUNCTION_CLOCK clock tree node
3232            pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
3233                self.i2c_function_clock[I2cInstance::I2c1 as usize]
3234            }
3235            /// Returns the current configuration of the I2S0_TX_CLK clock tree node
3236            pub fn i2s0_tx_clk(&self) -> Option<I2sClkConfig> {
3237                self.i2s_tx_clk[I2sInstance::I2s0 as usize]
3238            }
3239            /// Returns the current configuration of the I2S0_RX_CLK clock tree node
3240            pub fn i2s0_rx_clk(&self) -> Option<I2sClkConfig> {
3241                self.i2s_rx_clk[I2sInstance::I2s0 as usize]
3242            }
3243            /// Returns the current configuration of the I2S0_MCLK_OUT clock tree node
3244            pub fn i2s0_mclk_out(&self) -> Option<I2sMclkOutConfig> {
3245                self.i2s_mclk_out[I2sInstance::I2s0 as usize]
3246            }
3247            /// Returns the current configuration of the I2S1_TX_CLK clock tree node
3248            pub fn i2s1_tx_clk(&self) -> Option<I2sClkConfig> {
3249                self.i2s_tx_clk[I2sInstance::I2s1 as usize]
3250            }
3251            /// Returns the current configuration of the I2S1_RX_CLK clock tree node
3252            pub fn i2s1_rx_clk(&self) -> Option<I2sClkConfig> {
3253                self.i2s_rx_clk[I2sInstance::I2s1 as usize]
3254            }
3255            /// Returns the current configuration of the I2S1_MCLK_OUT clock tree node
3256            pub fn i2s1_mclk_out(&self) -> Option<I2sMclkOutConfig> {
3257                self.i2s_mclk_out[I2sInstance::I2s1 as usize]
3258            }
3259            /// Returns the current configuration of the LCD_CAM_LCD_CLOCK clock tree node
3260            pub fn lcd_cam_lcd_clock(&self) -> Option<LcdCamLcdClockConfig> {
3261                self.lcd_cam_lcd_clock[LcdCamInstance::LcdCam as usize]
3262            }
3263            /// Returns the current configuration of the LCD_CAM_CAM_CLOCK clock tree node
3264            pub fn lcd_cam_cam_clock(&self) -> Option<LcdCamCamClockConfig> {
3265                self.lcd_cam_cam_clock[LcdCamInstance::LcdCam as usize]
3266            }
3267            /// Returns the current configuration of the PARL_IO_RX_CLOCK clock tree node
3268            pub fn parl_io_rx_clock(&self) -> Option<ParlIoClkConfig> {
3269                self.parl_io_rx_clock[ParlIoInstance::ParlIo as usize]
3270            }
3271            /// Returns the current configuration of the PARL_IO_TX_CLOCK clock tree node
3272            pub fn parl_io_tx_clock(&self) -> Option<ParlIoClkConfig> {
3273                self.parl_io_tx_clock[ParlIoInstance::ParlIo as usize]
3274            }
3275            /// Returns the current configuration of the RMT_SCLK clock tree node
3276            pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
3277                self.rmt_sclk[RmtInstance::Rmt as usize]
3278            }
3279            /// Returns the current configuration of the SPI2_FUNCTION_CLOCK clock tree node
3280            pub fn spi2_function_clock(&self) -> Option<SpiFunctionClockConfig> {
3281                self.spi_function_clock[SpiInstance::Spi2 as usize]
3282            }
3283            /// Returns the current configuration of the SPI3_FUNCTION_CLOCK clock tree node
3284            pub fn spi3_function_clock(&self) -> Option<SpiFunctionClockConfig> {
3285                self.spi_function_clock[SpiInstance::Spi3 as usize]
3286            }
3287            /// Returns the current configuration of the TIMG0_FUNCTION_CLOCK clock tree node
3288            pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
3289                self.timg_function_clock[TimgInstance::Timg0 as usize]
3290            }
3291            /// Returns the current configuration of the TIMG0_WDT_CLOCK clock tree node
3292            pub fn timg0_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
3293                self.timg_wdt_clock[TimgInstance::Timg0 as usize]
3294            }
3295            /// Returns the current configuration of the TIMG1_FUNCTION_CLOCK clock tree node
3296            pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
3297                self.timg_function_clock[TimgInstance::Timg1 as usize]
3298            }
3299            /// Returns the current configuration of the TIMG1_WDT_CLOCK clock tree node
3300            pub fn timg1_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
3301                self.timg_wdt_clock[TimgInstance::Timg1 as usize]
3302            }
3303            /// Returns the current configuration of the UART0_FUNCTION_CLOCK clock tree node
3304            pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
3305                self.uart_function_clock[UartInstance::Uart0 as usize]
3306            }
3307            /// Returns the current configuration of the UART0_BAUD_RATE_GENERATOR clock tree node
3308            pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
3309                self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
3310            }
3311            /// Returns the current configuration of the UART1_FUNCTION_CLOCK clock tree node
3312            pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
3313                self.uart_function_clock[UartInstance::Uart1 as usize]
3314            }
3315            /// Returns the current configuration of the UART1_BAUD_RATE_GENERATOR clock tree node
3316            pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
3317                self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
3318            }
3319            /// Returns the current configuration of the UART2_FUNCTION_CLOCK clock tree node
3320            pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
3321                self.uart_function_clock[UartInstance::Uart2 as usize]
3322            }
3323            /// Returns the current configuration of the UART2_BAUD_RATE_GENERATOR clock tree node
3324            pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
3325                self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
3326            }
3327            /// Returns the current configuration of the UART3_FUNCTION_CLOCK clock tree node
3328            pub fn uart3_function_clock(&self) -> Option<UartFunctionClockConfig> {
3329                self.uart_function_clock[UartInstance::Uart3 as usize]
3330            }
3331            /// Returns the current configuration of the UART3_BAUD_RATE_GENERATOR clock tree node
3332            pub fn uart3_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
3333                self.uart_baud_rate_generator[UartInstance::Uart3 as usize]
3334            }
3335            /// Returns the current configuration of the PSRAM_FUNCTION_CLOCK clock tree node
3336            pub fn psram_function_clock(&self) -> Option<PsramFunctionClockConfig> {
3337                self.psram_function_clock[PsramInstance::Psram as usize]
3338            }
3339        }
3340        static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
3341            ::esp_sync::NonReentrantMutex::new(ClockTree {
3342                mpll_clk: None,
3343                cpu_root_clk: None,
3344                cpu_clk: None,
3345                mem_clk: None,
3346                sys_clk: None,
3347                apb_clk: None,
3348                lp_fast_clk: None,
3349                lp_slow_clk: None,
3350                lp_peri_clk: None,
3351                ble_lp_clk: None,
3352                crypto_clk: None,
3353                iomux_function_clock: None,
3354                timg_calibration_clock: None,
3355                cordic_function_clock: [None; 1],
3356                i2c_function_clock: [None; 2],
3357                i2s_tx_clk: [None; 2],
3358                i2s_rx_clk: [None; 2],
3359                i2s_mclk_out: [None; 2],
3360                lcd_cam_lcd_clock: [None; 1],
3361                lcd_cam_cam_clock: [None; 1],
3362                parl_io_rx_clock: [None; 1],
3363                parl_io_tx_clock: [None; 1],
3364                rmt_sclk: [None; 1],
3365                spi_function_clock: [None; 2],
3366                timg_function_clock: [None; 2],
3367                timg_wdt_clock: [None; 2],
3368                uart_function_clock: [None; 4],
3369                uart_baud_rate_generator: [None; 4],
3370                psram_function_clock: [None; 1],
3371                bbpll_clk_refcount: 0,
3372                cpll_clk_refcount: 0,
3373                mpll_clk_refcount: 0,
3374                rc_fast_clk_refcount: 0,
3375                #[cfg(use_xtal32k)]
3376                xtal32k_clk_refcount: 0,
3377                rc_slow_clk_refcount: 0,
3378                pll_f20m_refcount: 0,
3379                pll_f80m_refcount: 0,
3380                pll_f120m_refcount: 0,
3381                pll_f160m_refcount: 0,
3382                pll_f240m_refcount: 0,
3383                bbpll_d3_clock_refcount: 0,
3384                pll_f25m_refcount: 0,
3385                pll_f50m_refcount: 0,
3386                xtal_d2_clk_refcount: 0,
3387                apb_clk_refcount: 0,
3388                lp_slow_clk_refcount: 0,
3389                ble_lp_clk_refcount: 0,
3390                crypto_clk_refcount: 0,
3391                timg_calibration_clock_refcount: 0,
3392                cordic_function_clock_refcount: [0; 1],
3393                sdm_function_clock_refcount: [0; 1],
3394                i2c_function_clock_refcount: [0; 2],
3395                i2s_tx_clk_refcount: [0; 2],
3396                i2s_rx_clk_refcount: [0; 2],
3397                i2s_mclk_out_refcount: [0; 2],
3398                lcd_cam_lcd_clock_refcount: [0; 1],
3399                lcd_cam_cam_clock_refcount: [0; 1],
3400                parl_io_rx_clock_refcount: [0; 1],
3401                parl_io_tx_clock_refcount: [0; 1],
3402                pcnt_function_clock_refcount: [0; 2],
3403                rmt_sclk_refcount: [0; 1],
3404                spi_function_clock_refcount: [0; 2],
3405                timg_function_clock_refcount: [0; 2],
3406                timg_wdt_clock_refcount: [0; 2],
3407                tsens_sclk_refcount: [0; 1],
3408                uart_function_clock_refcount: [0; 4],
3409                uart_baud_rate_generator_refcount: [0; 4],
3410                uart_mem_clock_refcount: [0; 4],
3411                psram_function_clock_refcount: [0; 1],
3412            });
3413        static MPLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3414            ::core::sync::atomic::AtomicU32::new(0);
3415        static CPU_ROOT_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3416            ::core::sync::atomic::AtomicU32::new(0);
3417        static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3418            ::core::sync::atomic::AtomicU32::new(0);
3419        static MEM_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3420            ::core::sync::atomic::AtomicU32::new(0);
3421        static SYS_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3422            ::core::sync::atomic::AtomicU32::new(0);
3423        static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3424            ::core::sync::atomic::AtomicU32::new(0);
3425        static LP_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3426            ::core::sync::atomic::AtomicU32::new(0);
3427        static LP_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3428            ::core::sync::atomic::AtomicU32::new(0);
3429        static LP_PERI_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3430            ::core::sync::atomic::AtomicU32::new(0);
3431        static BLE_LP_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3432            ::core::sync::atomic::AtomicU32::new(0);
3433        static CRYPTO_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3434            ::core::sync::atomic::AtomicU32::new(0);
3435        static IOMUX_FUNCTION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3436            ::core::sync::atomic::AtomicU32::new(0);
3437        static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3438            ::core::sync::atomic::AtomicU32::new(0);
3439        static CORDIC_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3440            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3441        static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3442            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3443        static I2S_TX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3444            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3445        static I2S_RX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3446            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3447        static I2S_MCLK_OUT_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3448            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3449        static LCD_CAM_LCD_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3450            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3451        static LCD_CAM_CAM_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3452            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3453        static PARL_IO_RX_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3454            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3455        static PARL_IO_TX_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3456            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3457        static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3458            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3459        static SPI_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3460            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3461        static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3462            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3463        static TIMG_WDT_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3464            [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3465        static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 4] =
3466            [const { ::core::sync::atomic::AtomicU32::new(0) }; 4];
3467        static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 4] =
3468            [const { ::core::sync::atomic::AtomicU32::new(0) }; 4];
3469        static PSRAM_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3470            [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3471        /// The clock sources of the device.
3472        ///
3473        /// A clock source is a node of the clock tree that other nodes derive their output
3474        /// from. Ask a node which source it runs on with its `..._root_source` function.
3475        #[derive(Debug, enumset::EnumSetType)]
3476        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3477        pub enum ClockSource {
3478            /// `XTAL_CLK`.
3479            XtalClk,
3480            /// `RC_FAST_CLK`.
3481            RcFastClk,
3482            #[cfg(use_xtal32k)]
3483            /// `XTAL32K_CLK`.
3484            Xtal32kClk,
3485            /// `RC_SLOW_CLK`.
3486            RcSlowClk,
3487        }
3488        /// Returns the clock source that `XTAL_CLK` currently runs on.
3489        pub fn xtal_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3490            Some(ClockSource::XtalClk)
3491        }
3492        /// Returns the clock source that `BBPLL_CLK` currently runs on.
3493        pub fn bbpll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3494            xtal_clk_root_source(clocks)
3495        }
3496        /// Returns the clock source that `CPLL_CLK` currently runs on.
3497        pub fn cpll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3498            xtal_clk_root_source(clocks)
3499        }
3500        /// Returns the clock source that `MPLL_CLK` currently runs on.
3501        pub fn mpll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3502            xtal_clk_root_source(clocks)
3503        }
3504        /// Returns the clock source that `RC_FAST_CLK` currently runs on.
3505        pub fn rc_fast_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3506            Some(ClockSource::RcFastClk)
3507        }
3508        #[cfg(use_xtal32k)]
3509        /// Returns the clock source that `XTAL32K_CLK` currently runs on.
3510        pub fn xtal32k_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3511            Some(ClockSource::Xtal32kClk)
3512        }
3513        /// Returns the clock source that `RC_SLOW_CLK` currently runs on.
3514        pub fn rc_slow_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3515            Some(ClockSource::RcSlowClk)
3516        }
3517        /// Returns the clock source that `PLL_F20M` currently runs on.
3518        pub fn pll_f20m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3519            bbpll_clk_root_source(clocks)
3520        }
3521        /// Returns the clock source that `PLL_F80M` currently runs on.
3522        pub fn pll_f80m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3523            bbpll_clk_root_source(clocks)
3524        }
3525        /// Returns the clock source that `PLL_F120M` currently runs on.
3526        pub fn pll_f120m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3527            bbpll_clk_root_source(clocks)
3528        }
3529        /// Returns the clock source that `PLL_F160M` currently runs on.
3530        pub fn pll_f160m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3531            bbpll_clk_root_source(clocks)
3532        }
3533        /// Returns the clock source that `PLL_F240M` currently runs on.
3534        pub fn pll_f240m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3535            bbpll_clk_root_source(clocks)
3536        }
3537        /// Returns the clock source that `BBPLL_D3_CLOCK` currently runs on.
3538        pub fn bbpll_d3_clock_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3539            bbpll_clk_root_source(clocks)
3540        }
3541        /// Returns the clock source that `PLL_F25M` currently runs on.
3542        pub fn pll_f25m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3543            mpll_clk_root_source(clocks)
3544        }
3545        /// Returns the clock source that `PLL_F50M` currently runs on.
3546        pub fn pll_f50m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3547            mpll_clk_root_source(clocks)
3548        }
3549        /// Returns the clock source that `XTAL_D2_CLK` currently runs on.
3550        pub fn xtal_d2_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3551            xtal_clk_root_source(clocks)
3552        }
3553        /// Returns the clock source that `CPU_ROOT_CLK` currently runs on.
3554        pub fn cpu_root_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3555            let config = clocks.cpu_root_clk?;
3556            match config {
3557                CpuRootClkConfig::Xtal => xtal_clk_root_source(clocks),
3558                CpuRootClkConfig::Cpll => cpll_clk_root_source(clocks),
3559                CpuRootClkConfig::RcFast => rc_fast_clk_root_source(clocks),
3560                CpuRootClkConfig::PllF240m => pll_f240m_root_source(clocks),
3561            }
3562        }
3563        /// Returns the clock source that `CPU_CLK` currently runs on.
3564        pub fn cpu_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3565            cpu_root_clk_root_source(clocks)
3566        }
3567        /// Returns the clock source that `MEM_CLK` currently runs on.
3568        pub fn mem_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3569            cpu_clk_root_source(clocks)
3570        }
3571        /// Returns the clock source that `SYS_CLK` currently runs on.
3572        pub fn sys_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3573            cpu_clk_root_source(clocks)
3574        }
3575        /// Returns the clock source that `APB_CLK` currently runs on.
3576        pub fn apb_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3577            sys_clk_root_source(clocks)
3578        }
3579        /// Returns the clock source that `LP_FAST_CLK` currently runs on.
3580        pub fn lp_fast_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3581            let config = clocks.lp_fast_clk?;
3582            match config {
3583                LpFastClkConfig::RcFast => rc_fast_clk_root_source(clocks),
3584                LpFastClkConfig::Xtal => xtal_clk_root_source(clocks),
3585            }
3586        }
3587        /// Returns the clock source that `LP_SLOW_CLK` currently runs on.
3588        pub fn lp_slow_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3589            let config = clocks.lp_slow_clk?;
3590            match config {
3591                LpSlowClkConfig::RcSlow => rc_slow_clk_root_source(clocks),
3592                #[cfg(use_xtal32k)]
3593                LpSlowClkConfig::Xtal32k => xtal32k_clk_root_source(clocks),
3594            }
3595        }
3596        /// Returns the clock source that `LP_PERI_CLK` currently runs on.
3597        pub fn lp_peri_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3598            lp_fast_clk_root_source(clocks)
3599        }
3600        /// Returns the clock source that `BLE_LP_XTAL_CLK` currently runs on.
3601        pub fn ble_lp_xtal_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3602            xtal_clk_root_source(clocks)
3603        }
3604        /// Returns the clock source that `BLE_LP_CLK` currently runs on.
3605        pub fn ble_lp_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3606            let config = clocks.ble_lp_clk?;
3607            match config {
3608                BleLpClkConfig::Xtal => ble_lp_xtal_clk_root_source(clocks),
3609                #[cfg(use_xtal32k)]
3610                BleLpClkConfig::Xtal32k => xtal32k_clk_root_source(clocks),
3611            }
3612        }
3613        /// Returns the clock source that `CRYPTO_CLK` currently runs on.
3614        pub fn crypto_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3615            let config = clocks.crypto_clk?;
3616            match config {
3617                CryptoClkConfig::Xtal => xtal_clk_root_source(clocks),
3618                CryptoClkConfig::RcFast => rc_fast_clk_root_source(clocks),
3619                CryptoClkConfig::PllF240m => pll_f240m_root_source(clocks),
3620            }
3621        }
3622        /// Returns the clock source that `IOMUX_FUNCTION_CLOCK` currently runs on.
3623        pub fn iomux_function_clock_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3624            let config = clocks.iomux_function_clock?;
3625            match config.source() {
3626                IomuxFunctionClockSource::XtalClk => xtal_clk_root_source(clocks),
3627                IomuxFunctionClockSource::PllF80m => pll_f80m_root_source(clocks),
3628            }
3629        }
3630        /// Returns the clock source that `TIMG_CALIBRATION_CLOCK` currently runs on.
3631        pub fn timg_calibration_clock_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3632            let config = clocks.timg_calibration_clock?;
3633            match config {
3634                TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_root_source(clocks),
3635                TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_root_source(clocks),
3636                #[cfg(use_xtal32k)]
3637                TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_root_source(clocks),
3638            }
3639        }
3640        fn request_xtal_clk(_clocks: &mut ClockTree) {}
3641        fn release_xtal_clk(_clocks: &mut ClockTree) {}
3642        pub fn xtal_clk_frequency() -> u32 {
3643            40000000
3644        }
3645        pub fn request_bbpll_clk(clocks: &mut ClockTree) {
3646            trace!("Requesting BBPLL_CLK");
3647            if increment_reference_count(&mut clocks.bbpll_clk_refcount) {
3648                trace!("Enabling BBPLL_CLK");
3649                request_xtal_clk(clocks);
3650                enable_bbpll_clk_impl(clocks, true);
3651            }
3652        }
3653        pub fn release_bbpll_clk(clocks: &mut ClockTree) {
3654            trace!("Releasing BBPLL_CLK");
3655            if decrement_reference_count(&mut clocks.bbpll_clk_refcount) {
3656                trace!("Disabling BBPLL_CLK");
3657                enable_bbpll_clk_impl(clocks, false);
3658                release_xtal_clk(clocks);
3659            }
3660        }
3661        pub fn bbpll_clk_frequency() -> u32 {
3662            (480 * 1000000)
3663        }
3664        pub fn bbpll_clk_source_frequency() -> u32 {
3665            xtal_clk_frequency()
3666        }
3667        pub fn request_cpll_clk(clocks: &mut ClockTree) {
3668            trace!("Requesting CPLL_CLK");
3669            if increment_reference_count(&mut clocks.cpll_clk_refcount) {
3670                trace!("Enabling CPLL_CLK");
3671                request_xtal_clk(clocks);
3672                enable_cpll_clk_impl(clocks, true);
3673            }
3674        }
3675        pub fn release_cpll_clk(clocks: &mut ClockTree) {
3676            trace!("Releasing CPLL_CLK");
3677            if decrement_reference_count(&mut clocks.cpll_clk_refcount) {
3678                trace!("Disabling CPLL_CLK");
3679                enable_cpll_clk_impl(clocks, false);
3680                release_xtal_clk(clocks);
3681            }
3682        }
3683        pub fn cpll_clk_frequency() -> u32 {
3684            (320 * 1000000)
3685        }
3686        pub fn cpll_clk_source_frequency() -> u32 {
3687            xtal_clk_frequency()
3688        }
3689        pub fn configure_mpll_clk(clocks: &mut ClockTree, config: MpllClkConfig) {
3690            let old_config = clocks.mpll_clk.replace(config);
3691            refresh_mpll_clk_downstream(clocks);
3692            configure_mpll_clk_impl(clocks, old_config, config);
3693        }
3694        pub fn mpll_clk_config(clocks: &mut ClockTree) -> Option<MpllClkConfig> {
3695            clocks.mpll_clk
3696        }
3697        pub fn request_mpll_clk(clocks: &mut ClockTree) {
3698            trace!("Requesting MPLL_CLK");
3699            if increment_reference_count(&mut clocks.mpll_clk_refcount) {
3700                trace!("Enabling MPLL_CLK");
3701                request_xtal_clk(clocks);
3702                enable_mpll_clk_impl(clocks, true);
3703            }
3704        }
3705        pub fn release_mpll_clk(clocks: &mut ClockTree) {
3706            trace!("Releasing MPLL_CLK");
3707            if decrement_reference_count(&mut clocks.mpll_clk_refcount) {
3708                trace!("Disabling MPLL_CLK");
3709                enable_mpll_clk_impl(clocks, false);
3710                release_xtal_clk(clocks);
3711            }
3712        }
3713        pub fn mpll_clk_config_frequency(config: MpllClkConfig) -> u32 {
3714            config.value()
3715        }
3716        pub fn mpll_clk_frequency() -> u32 {
3717            MPLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3718        }
3719        pub fn mpll_clk_source_frequency() -> u32 {
3720            xtal_clk_frequency()
3721        }
3722        pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
3723            trace!("Requesting RC_FAST_CLK");
3724            if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
3725                trace!("Enabling RC_FAST_CLK");
3726                enable_rc_fast_clk_impl(clocks, true);
3727            }
3728        }
3729        pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
3730            trace!("Releasing RC_FAST_CLK");
3731            if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
3732                trace!("Disabling RC_FAST_CLK");
3733                enable_rc_fast_clk_impl(clocks, false);
3734            }
3735        }
3736        static RC_FAST_CLK_FREQUENCY: ::core::sync::atomic::AtomicU32 =
3737            ::core::sync::atomic::AtomicU32::new(rc_fast_clk_nominal_frequency());
3738        pub const fn rc_fast_clk_nominal_frequency() -> u32 {
3739            17500000
3740        }
3741        pub fn rc_fast_clk_frequency() -> u32 {
3742            RC_FAST_CLK_FREQUENCY.load(::core::sync::atomic::Ordering::Acquire)
3743        }
3744        pub fn set_rc_fast_clk_frequency(clocks: &mut ClockTree, frequency: u32) {
3745            if !(8750000..=26250000).contains(&frequency) {
3746                warn!(
3747                    "Ignoring out-of-range RC_FAST_CLK frequency: {} Hz",
3748                    frequency
3749                );
3750                return;
3751            }
3752            debug!(
3753                "Updating RC_FAST_CLK frequency to {} Hz (nominal {} Hz)",
3754                frequency,
3755                rc_fast_clk_nominal_frequency()
3756            );
3757            RC_FAST_CLK_FREQUENCY.store(frequency, ::core::sync::atomic::Ordering::Release);
3758            refresh_rc_fast_clk_downstream(clocks);
3759        }
3760        #[cfg(use_xtal32k)]
3761        pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
3762            trace!("Requesting XTAL32K_CLK");
3763            if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
3764                trace!("Enabling XTAL32K_CLK");
3765                enable_xtal32k_clk_impl(clocks, true);
3766            }
3767        }
3768        #[cfg(use_xtal32k)]
3769        pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
3770            trace!("Releasing XTAL32K_CLK");
3771            if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
3772                trace!("Disabling XTAL32K_CLK");
3773                enable_xtal32k_clk_impl(clocks, false);
3774            }
3775        }
3776        #[cfg(use_xtal32k)]
3777        pub fn xtal32k_clk_frequency() -> u32 {
3778            32768
3779        }
3780        pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
3781            trace!("Requesting RC_SLOW_CLK");
3782            if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
3783                trace!("Enabling RC_SLOW_CLK");
3784                enable_rc_slow_clk_impl(clocks, true);
3785            }
3786        }
3787        pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
3788            trace!("Releasing RC_SLOW_CLK");
3789            if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
3790                trace!("Disabling RC_SLOW_CLK");
3791                enable_rc_slow_clk_impl(clocks, false);
3792            }
3793        }
3794        static RC_SLOW_CLK_FREQUENCY: ::core::sync::atomic::AtomicU32 =
3795            ::core::sync::atomic::AtomicU32::new(rc_slow_clk_nominal_frequency());
3796        pub const fn rc_slow_clk_nominal_frequency() -> u32 {
3797            136000
3798        }
3799        pub fn rc_slow_clk_frequency() -> u32 {
3800            RC_SLOW_CLK_FREQUENCY.load(::core::sync::atomic::Ordering::Acquire)
3801        }
3802        pub fn set_rc_slow_clk_frequency(clocks: &mut ClockTree, frequency: u32) {
3803            if !(68000..=204000).contains(&frequency) {
3804                warn!(
3805                    "Ignoring out-of-range RC_SLOW_CLK frequency: {} Hz",
3806                    frequency
3807                );
3808                return;
3809            }
3810            debug!(
3811                "Updating RC_SLOW_CLK frequency to {} Hz (nominal {} Hz)",
3812                frequency,
3813                rc_slow_clk_nominal_frequency()
3814            );
3815            RC_SLOW_CLK_FREQUENCY.store(frequency, ::core::sync::atomic::Ordering::Release);
3816            refresh_rc_slow_clk_downstream(clocks);
3817        }
3818        pub fn request_pll_f20m(clocks: &mut ClockTree) {
3819            trace!("Requesting PLL_F20M");
3820            if increment_reference_count(&mut clocks.pll_f20m_refcount) {
3821                trace!("Enabling PLL_F20M");
3822                request_bbpll_clk(clocks);
3823                enable_pll_f20m_impl(clocks, true);
3824            }
3825        }
3826        pub fn release_pll_f20m(clocks: &mut ClockTree) {
3827            trace!("Releasing PLL_F20M");
3828            if decrement_reference_count(&mut clocks.pll_f20m_refcount) {
3829                trace!("Disabling PLL_F20M");
3830                enable_pll_f20m_impl(clocks, false);
3831                release_bbpll_clk(clocks);
3832            }
3833        }
3834        pub fn pll_f20m_frequency() -> u32 {
3835            (bbpll_clk_frequency() / 24)
3836        }
3837        pub fn pll_f20m_source_frequency() -> u32 {
3838            bbpll_clk_frequency()
3839        }
3840        pub fn request_pll_f80m(clocks: &mut ClockTree) {
3841            trace!("Requesting PLL_F80M");
3842            if increment_reference_count(&mut clocks.pll_f80m_refcount) {
3843                trace!("Enabling PLL_F80M");
3844                request_bbpll_clk(clocks);
3845                enable_pll_f80m_impl(clocks, true);
3846            }
3847        }
3848        pub fn release_pll_f80m(clocks: &mut ClockTree) {
3849            trace!("Releasing PLL_F80M");
3850            if decrement_reference_count(&mut clocks.pll_f80m_refcount) {
3851                trace!("Disabling PLL_F80M");
3852                enable_pll_f80m_impl(clocks, false);
3853                release_bbpll_clk(clocks);
3854            }
3855        }
3856        pub fn pll_f80m_frequency() -> u32 {
3857            (bbpll_clk_frequency() / 6)
3858        }
3859        pub fn pll_f80m_source_frequency() -> u32 {
3860            bbpll_clk_frequency()
3861        }
3862        pub fn request_pll_f120m(clocks: &mut ClockTree) {
3863            trace!("Requesting PLL_F120M");
3864            if increment_reference_count(&mut clocks.pll_f120m_refcount) {
3865                trace!("Enabling PLL_F120M");
3866                request_bbpll_clk(clocks);
3867                enable_pll_f120m_impl(clocks, true);
3868            }
3869        }
3870        pub fn release_pll_f120m(clocks: &mut ClockTree) {
3871            trace!("Releasing PLL_F120M");
3872            if decrement_reference_count(&mut clocks.pll_f120m_refcount) {
3873                trace!("Disabling PLL_F120M");
3874                enable_pll_f120m_impl(clocks, false);
3875                release_bbpll_clk(clocks);
3876            }
3877        }
3878        pub fn pll_f120m_frequency() -> u32 {
3879            (bbpll_clk_frequency() / 4)
3880        }
3881        pub fn pll_f120m_source_frequency() -> u32 {
3882            bbpll_clk_frequency()
3883        }
3884        pub fn request_pll_f160m(clocks: &mut ClockTree) {
3885            trace!("Requesting PLL_F160M");
3886            if increment_reference_count(&mut clocks.pll_f160m_refcount) {
3887                trace!("Enabling PLL_F160M");
3888                request_bbpll_clk(clocks);
3889                enable_pll_f160m_impl(clocks, true);
3890            }
3891        }
3892        pub fn release_pll_f160m(clocks: &mut ClockTree) {
3893            trace!("Releasing PLL_F160M");
3894            if decrement_reference_count(&mut clocks.pll_f160m_refcount) {
3895                trace!("Disabling PLL_F160M");
3896                enable_pll_f160m_impl(clocks, false);
3897                release_bbpll_clk(clocks);
3898            }
3899        }
3900        pub fn pll_f160m_frequency() -> u32 {
3901            (bbpll_clk_frequency() / 3)
3902        }
3903        pub fn pll_f160m_source_frequency() -> u32 {
3904            bbpll_clk_frequency()
3905        }
3906        pub fn request_pll_f240m(clocks: &mut ClockTree) {
3907            trace!("Requesting PLL_F240M");
3908            if increment_reference_count(&mut clocks.pll_f240m_refcount) {
3909                trace!("Enabling PLL_F240M");
3910                request_bbpll_clk(clocks);
3911                enable_pll_f240m_impl(clocks, true);
3912            }
3913        }
3914        pub fn release_pll_f240m(clocks: &mut ClockTree) {
3915            trace!("Releasing PLL_F240M");
3916            if decrement_reference_count(&mut clocks.pll_f240m_refcount) {
3917                trace!("Disabling PLL_F240M");
3918                enable_pll_f240m_impl(clocks, false);
3919                release_bbpll_clk(clocks);
3920            }
3921        }
3922        pub fn pll_f240m_frequency() -> u32 {
3923            (bbpll_clk_frequency() / 2)
3924        }
3925        pub fn pll_f240m_source_frequency() -> u32 {
3926            bbpll_clk_frequency()
3927        }
3928        pub fn request_bbpll_d3_clock(clocks: &mut ClockTree) {
3929            trace!("Requesting BBPLL_D3_CLOCK");
3930            if increment_reference_count(&mut clocks.bbpll_d3_clock_refcount) {
3931                trace!("Enabling BBPLL_D3_CLOCK");
3932                request_bbpll_clk(clocks);
3933                enable_bbpll_d3_clock_impl(clocks, true);
3934            }
3935        }
3936        pub fn release_bbpll_d3_clock(clocks: &mut ClockTree) {
3937            trace!("Releasing BBPLL_D3_CLOCK");
3938            if decrement_reference_count(&mut clocks.bbpll_d3_clock_refcount) {
3939                trace!("Disabling BBPLL_D3_CLOCK");
3940                enable_bbpll_d3_clock_impl(clocks, false);
3941                release_bbpll_clk(clocks);
3942            }
3943        }
3944        pub fn bbpll_d3_clock_frequency() -> u32 {
3945            (bbpll_clk_frequency() / 3)
3946        }
3947        pub fn bbpll_d3_clock_source_frequency() -> u32 {
3948            bbpll_clk_frequency()
3949        }
3950        pub fn request_pll_f25m(clocks: &mut ClockTree) {
3951            trace!("Requesting PLL_F25M");
3952            if increment_reference_count(&mut clocks.pll_f25m_refcount) {
3953                trace!("Enabling PLL_F25M");
3954                request_mpll_clk(clocks);
3955                enable_pll_f25m_impl(clocks, true);
3956            }
3957        }
3958        pub fn release_pll_f25m(clocks: &mut ClockTree) {
3959            trace!("Releasing PLL_F25M");
3960            if decrement_reference_count(&mut clocks.pll_f25m_refcount) {
3961                trace!("Disabling PLL_F25M");
3962                enable_pll_f25m_impl(clocks, false);
3963                release_mpll_clk(clocks);
3964            }
3965        }
3966        pub fn pll_f25m_frequency() -> u32 {
3967            25000000
3968        }
3969        pub fn pll_f25m_source_frequency() -> u32 {
3970            mpll_clk_frequency()
3971        }
3972        pub fn request_pll_f50m(clocks: &mut ClockTree) {
3973            trace!("Requesting PLL_F50M");
3974            if increment_reference_count(&mut clocks.pll_f50m_refcount) {
3975                trace!("Enabling PLL_F50M");
3976                request_mpll_clk(clocks);
3977                enable_pll_f50m_impl(clocks, true);
3978            }
3979        }
3980        pub fn release_pll_f50m(clocks: &mut ClockTree) {
3981            trace!("Releasing PLL_F50M");
3982            if decrement_reference_count(&mut clocks.pll_f50m_refcount) {
3983                trace!("Disabling PLL_F50M");
3984                enable_pll_f50m_impl(clocks, false);
3985                release_mpll_clk(clocks);
3986            }
3987        }
3988        pub fn pll_f50m_frequency() -> u32 {
3989            50000000
3990        }
3991        pub fn pll_f50m_source_frequency() -> u32 {
3992            mpll_clk_frequency()
3993        }
3994        pub fn request_xtal_d2_clk(clocks: &mut ClockTree) {
3995            trace!("Requesting XTAL_D2_CLK");
3996            if increment_reference_count(&mut clocks.xtal_d2_clk_refcount) {
3997                trace!("Enabling XTAL_D2_CLK");
3998                request_xtal_clk(clocks);
3999                enable_xtal_d2_clk_impl(clocks, true);
4000            }
4001        }
4002        pub fn release_xtal_d2_clk(clocks: &mut ClockTree) {
4003            trace!("Releasing XTAL_D2_CLK");
4004            if decrement_reference_count(&mut clocks.xtal_d2_clk_refcount) {
4005                trace!("Disabling XTAL_D2_CLK");
4006                enable_xtal_d2_clk_impl(clocks, false);
4007                release_xtal_clk(clocks);
4008            }
4009        }
4010        pub fn xtal_d2_clk_frequency() -> u32 {
4011            (xtal_clk_frequency() / 2)
4012        }
4013        pub fn xtal_d2_clk_source_frequency() -> u32 {
4014            xtal_clk_frequency()
4015        }
4016        pub fn configure_cpu_root_clk(clocks: &mut ClockTree, new_selector: CpuRootClkConfig) {
4017            let old_selector = clocks.cpu_root_clk.replace(new_selector);
4018            refresh_cpu_root_clk_downstream(clocks);
4019            match new_selector {
4020                CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
4021                CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
4022                CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
4023                CpuRootClkConfig::PllF240m => request_pll_f240m(clocks),
4024            }
4025            configure_cpu_root_clk_impl(clocks, old_selector, new_selector);
4026            if let Some(old_selector) = old_selector {
4027                match old_selector {
4028                    CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
4029                    CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
4030                    CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
4031                    CpuRootClkConfig::PllF240m => release_pll_f240m(clocks),
4032                }
4033            }
4034        }
4035        pub fn cpu_root_clk_config(clocks: &mut ClockTree) -> Option<CpuRootClkConfig> {
4036            clocks.cpu_root_clk
4037        }
4038        pub fn request_cpu_root_clk(clocks: &mut ClockTree) {
4039            trace!("Enabling CPU_ROOT_CLK");
4040            match unwrap!(clocks.cpu_root_clk) {
4041                CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
4042                CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
4043                CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
4044                CpuRootClkConfig::PllF240m => request_pll_f240m(clocks),
4045            }
4046            enable_cpu_root_clk_impl(clocks, true);
4047        }
4048        pub fn release_cpu_root_clk(clocks: &mut ClockTree) {
4049            trace!("Disabling CPU_ROOT_CLK");
4050            enable_cpu_root_clk_impl(clocks, false);
4051            match unwrap!(clocks.cpu_root_clk) {
4052                CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
4053                CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
4054                CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
4055                CpuRootClkConfig::PllF240m => release_pll_f240m(clocks),
4056            }
4057        }
4058        pub fn cpu_root_clk_config_frequency(config: CpuRootClkConfig) -> u32 {
4059            match config {
4060                CpuRootClkConfig::Xtal => xtal_clk_frequency(),
4061                CpuRootClkConfig::Cpll => cpll_clk_frequency(),
4062                CpuRootClkConfig::RcFast => rc_fast_clk_frequency(),
4063                CpuRootClkConfig::PllF240m => pll_f240m_frequency(),
4064            }
4065        }
4066        pub fn cpu_root_clk_frequency() -> u32 {
4067            CPU_ROOT_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4068        }
4069        pub fn cpu_root_clk_source_frequency(source: CpuRootClkConfig) -> u32 {
4070            cpu_root_clk_config_frequency(source)
4071        }
4072        pub fn configure_cpu_clk(clocks: &mut ClockTree, config: CpuClkConfig) {
4073            let old_config = clocks.cpu_clk.replace(config);
4074            refresh_cpu_clk_downstream(clocks);
4075            if old_config.is_none() {
4076                request_cpu_root_clk(clocks);
4077            }
4078            configure_cpu_clk_impl(clocks, old_config, config);
4079        }
4080        pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
4081            clocks.cpu_clk
4082        }
4083        fn request_cpu_clk(_clocks: &mut ClockTree) {}
4084        fn release_cpu_clk(_clocks: &mut ClockTree) {}
4085        pub fn cpu_clk_config_frequency(config: CpuClkConfig) -> u32 {
4086            (cpu_root_clk_frequency() / (config.divisor() + 1))
4087        }
4088        pub fn cpu_clk_frequency() -> u32 {
4089            CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4090        }
4091        pub fn cpu_clk_source_frequency() -> u32 {
4092            cpu_root_clk_frequency()
4093        }
4094        pub fn configure_mem_clk(clocks: &mut ClockTree, config: MemClkConfig) {
4095            let old_config = clocks.mem_clk.replace(config);
4096            refresh_mem_clk_downstream(clocks);
4097            if old_config.is_none() {
4098                request_cpu_clk(clocks);
4099            }
4100            configure_mem_clk_impl(clocks, old_config, config);
4101        }
4102        pub fn mem_clk_config(clocks: &mut ClockTree) -> Option<MemClkConfig> {
4103            clocks.mem_clk
4104        }
4105        fn request_mem_clk(_clocks: &mut ClockTree) {}
4106        fn release_mem_clk(_clocks: &mut ClockTree) {}
4107        pub fn mem_clk_config_frequency(config: MemClkConfig) -> u32 {
4108            (cpu_clk_frequency() / (config.divisor() + 1))
4109        }
4110        pub fn mem_clk_frequency() -> u32 {
4111            MEM_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4112        }
4113        pub fn mem_clk_source_frequency() -> u32 {
4114            cpu_clk_frequency()
4115        }
4116        pub fn configure_sys_clk(clocks: &mut ClockTree, config: SysClkConfig) {
4117            let old_config = clocks.sys_clk.replace(config);
4118            refresh_sys_clk_downstream(clocks);
4119            if old_config.is_none() {
4120                request_cpu_clk(clocks);
4121            }
4122            configure_sys_clk_impl(clocks, old_config, config);
4123        }
4124        pub fn sys_clk_config(clocks: &mut ClockTree) -> Option<SysClkConfig> {
4125            clocks.sys_clk
4126        }
4127        fn request_sys_clk(_clocks: &mut ClockTree) {}
4128        fn release_sys_clk(_clocks: &mut ClockTree) {}
4129        pub fn sys_clk_config_frequency(config: SysClkConfig) -> u32 {
4130            (cpu_clk_frequency() / (config.divisor() + 1))
4131        }
4132        pub fn sys_clk_frequency() -> u32 {
4133            SYS_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4134        }
4135        pub fn sys_clk_source_frequency() -> u32 {
4136            cpu_clk_frequency()
4137        }
4138        pub fn configure_apb_clk(clocks: &mut ClockTree, config: ApbClkConfig) {
4139            let old_config = clocks.apb_clk.replace(config);
4140            refresh_apb_clk_downstream(clocks);
4141            if old_config.is_none() {
4142                request_sys_clk(clocks);
4143            }
4144            configure_apb_clk_impl(clocks, old_config, config);
4145        }
4146        pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
4147            clocks.apb_clk
4148        }
4149        pub fn request_apb_clk(clocks: &mut ClockTree) {
4150            trace!("Requesting APB_CLK");
4151            if increment_reference_count(&mut clocks.apb_clk_refcount) {
4152                enable_apb_clk_impl(clocks, true);
4153            }
4154        }
4155        pub fn release_apb_clk(clocks: &mut ClockTree) {
4156            trace!("Releasing APB_CLK");
4157            if decrement_reference_count(&mut clocks.apb_clk_refcount) {
4158                enable_apb_clk_impl(clocks, false);
4159            }
4160        }
4161        pub fn apb_clk_config_frequency(config: ApbClkConfig) -> u32 {
4162            (sys_clk_frequency() / (config.divisor() + 1))
4163        }
4164        pub fn apb_clk_frequency() -> u32 {
4165            APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4166        }
4167        pub fn apb_clk_source_frequency() -> u32 {
4168            sys_clk_frequency()
4169        }
4170        pub fn configure_lp_fast_clk(clocks: &mut ClockTree, new_selector: LpFastClkConfig) {
4171            let old_selector = clocks.lp_fast_clk.replace(new_selector);
4172            refresh_lp_fast_clk_downstream(clocks);
4173            match new_selector {
4174                LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
4175                LpFastClkConfig::Xtal => request_xtal_clk(clocks),
4176            }
4177            configure_lp_fast_clk_impl(clocks, old_selector, new_selector);
4178            if let Some(old_selector) = old_selector {
4179                match old_selector {
4180                    LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
4181                    LpFastClkConfig::Xtal => release_xtal_clk(clocks),
4182                }
4183            }
4184        }
4185        pub fn lp_fast_clk_config(clocks: &mut ClockTree) -> Option<LpFastClkConfig> {
4186            clocks.lp_fast_clk
4187        }
4188        pub fn request_lp_fast_clk(clocks: &mut ClockTree) {
4189            trace!("Enabling LP_FAST_CLK");
4190            match unwrap!(clocks.lp_fast_clk) {
4191                LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
4192                LpFastClkConfig::Xtal => request_xtal_clk(clocks),
4193            }
4194            enable_lp_fast_clk_impl(clocks, true);
4195        }
4196        pub fn release_lp_fast_clk(clocks: &mut ClockTree) {
4197            trace!("Disabling LP_FAST_CLK");
4198            enable_lp_fast_clk_impl(clocks, false);
4199            match unwrap!(clocks.lp_fast_clk) {
4200                LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
4201                LpFastClkConfig::Xtal => release_xtal_clk(clocks),
4202            }
4203        }
4204        pub fn lp_fast_clk_config_frequency(config: LpFastClkConfig) -> u32 {
4205            match config {
4206                LpFastClkConfig::RcFast => rc_fast_clk_frequency(),
4207                LpFastClkConfig::Xtal => xtal_clk_frequency(),
4208            }
4209        }
4210        pub fn lp_fast_clk_frequency() -> u32 {
4211            LP_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4212        }
4213        pub fn lp_fast_clk_source_frequency(source: LpFastClkConfig) -> u32 {
4214            lp_fast_clk_config_frequency(source)
4215        }
4216        pub fn configure_lp_slow_clk(clocks: &mut ClockTree, new_selector: LpSlowClkConfig) {
4217            let old_selector = clocks.lp_slow_clk.replace(new_selector);
4218            refresh_lp_slow_clk_downstream(clocks);
4219            let active = clocks.lp_slow_clk_refcount > 0;
4220            if active {
4221                match new_selector {
4222                    LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
4223                    #[cfg(use_xtal32k)]
4224                    LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
4225                }
4226            }
4227            configure_lp_slow_clk_impl(clocks, old_selector, new_selector);
4228            if active && let Some(old_selector) = old_selector {
4229                match old_selector {
4230                    LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
4231                    #[cfg(use_xtal32k)]
4232                    LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
4233                }
4234            }
4235        }
4236        pub fn lp_slow_clk_config(clocks: &mut ClockTree) -> Option<LpSlowClkConfig> {
4237            clocks.lp_slow_clk
4238        }
4239        pub fn request_lp_slow_clk(clocks: &mut ClockTree) {
4240            trace!("Requesting LP_SLOW_CLK");
4241            if increment_reference_count(&mut clocks.lp_slow_clk_refcount) {
4242                trace!("Enabling LP_SLOW_CLK");
4243                match unwrap!(clocks.lp_slow_clk) {
4244                    LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
4245                    #[cfg(use_xtal32k)]
4246                    LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
4247                }
4248                enable_lp_slow_clk_impl(clocks, true);
4249            }
4250        }
4251        pub fn release_lp_slow_clk(clocks: &mut ClockTree) {
4252            trace!("Releasing LP_SLOW_CLK");
4253            if decrement_reference_count(&mut clocks.lp_slow_clk_refcount) {
4254                trace!("Disabling LP_SLOW_CLK");
4255                enable_lp_slow_clk_impl(clocks, false);
4256                match unwrap!(clocks.lp_slow_clk) {
4257                    LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
4258                    #[cfg(use_xtal32k)]
4259                    LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
4260                }
4261            }
4262        }
4263        pub fn lp_slow_clk_config_frequency(config: LpSlowClkConfig) -> u32 {
4264            match config {
4265                LpSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
4266                #[cfg(use_xtal32k)]
4267                LpSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
4268            }
4269        }
4270        pub fn lp_slow_clk_frequency() -> u32 {
4271            LP_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4272        }
4273        pub fn lp_slow_clk_source_frequency(source: LpSlowClkConfig) -> u32 {
4274            lp_slow_clk_config_frequency(source)
4275        }
4276        pub fn configure_lp_peri_clk(clocks: &mut ClockTree, config: LpPeriClkConfig) {
4277            let old_config = clocks.lp_peri_clk.replace(config);
4278            refresh_lp_peri_clk_downstream(clocks);
4279            if old_config.is_none() {
4280                request_lp_fast_clk(clocks);
4281            }
4282            configure_lp_peri_clk_impl(clocks, old_config, config);
4283        }
4284        pub fn lp_peri_clk_config(clocks: &mut ClockTree) -> Option<LpPeriClkConfig> {
4285            clocks.lp_peri_clk
4286        }
4287        fn request_lp_peri_clk(_clocks: &mut ClockTree) {}
4288        fn release_lp_peri_clk(_clocks: &mut ClockTree) {}
4289        pub fn lp_peri_clk_config_frequency(config: LpPeriClkConfig) -> u32 {
4290            (lp_fast_clk_frequency() / (config.divisor() + 1))
4291        }
4292        pub fn lp_peri_clk_frequency() -> u32 {
4293            LP_PERI_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4294        }
4295        pub fn lp_peri_clk_source_frequency() -> u32 {
4296            lp_fast_clk_frequency()
4297        }
4298        pub fn request_ble_lp_xtal_clk(clocks: &mut ClockTree) {
4299            trace!("Enabling BLE_LP_XTAL_CLK");
4300            request_xtal_clk(clocks);
4301            enable_ble_lp_xtal_clk_impl(clocks, true);
4302        }
4303        pub fn release_ble_lp_xtal_clk(clocks: &mut ClockTree) {
4304            trace!("Disabling BLE_LP_XTAL_CLK");
4305            enable_ble_lp_xtal_clk_impl(clocks, false);
4306            release_xtal_clk(clocks);
4307        }
4308        pub fn ble_lp_xtal_clk_frequency() -> u32 {
4309            100000
4310        }
4311        pub fn ble_lp_xtal_clk_source_frequency() -> u32 {
4312            xtal_clk_frequency()
4313        }
4314        pub fn configure_ble_lp_clk(clocks: &mut ClockTree, new_selector: BleLpClkConfig) {
4315            let old_selector = clocks.ble_lp_clk.replace(new_selector);
4316            refresh_ble_lp_clk_downstream(clocks);
4317            let active = clocks.ble_lp_clk_refcount > 0;
4318            if active {
4319                match new_selector {
4320                    BleLpClkConfig::Xtal => request_ble_lp_xtal_clk(clocks),
4321                    #[cfg(use_xtal32k)]
4322                    BleLpClkConfig::Xtal32k => request_xtal32k_clk(clocks),
4323                }
4324            }
4325            configure_ble_lp_clk_impl(clocks, old_selector, new_selector);
4326            if active && let Some(old_selector) = old_selector {
4327                match old_selector {
4328                    BleLpClkConfig::Xtal => release_ble_lp_xtal_clk(clocks),
4329                    #[cfg(use_xtal32k)]
4330                    BleLpClkConfig::Xtal32k => release_xtal32k_clk(clocks),
4331                }
4332            }
4333        }
4334        pub fn ble_lp_clk_config(clocks: &mut ClockTree) -> Option<BleLpClkConfig> {
4335            clocks.ble_lp_clk
4336        }
4337        pub fn request_ble_lp_clk(clocks: &mut ClockTree) {
4338            trace!("Requesting BLE_LP_CLK");
4339            if increment_reference_count(&mut clocks.ble_lp_clk_refcount) {
4340                trace!("Enabling BLE_LP_CLK");
4341                match unwrap!(clocks.ble_lp_clk) {
4342                    BleLpClkConfig::Xtal => request_ble_lp_xtal_clk(clocks),
4343                    #[cfg(use_xtal32k)]
4344                    BleLpClkConfig::Xtal32k => request_xtal32k_clk(clocks),
4345                }
4346                enable_ble_lp_clk_impl(clocks, true);
4347            }
4348        }
4349        pub fn release_ble_lp_clk(clocks: &mut ClockTree) {
4350            trace!("Releasing BLE_LP_CLK");
4351            if decrement_reference_count(&mut clocks.ble_lp_clk_refcount) {
4352                trace!("Disabling BLE_LP_CLK");
4353                enable_ble_lp_clk_impl(clocks, false);
4354                match unwrap!(clocks.ble_lp_clk) {
4355                    BleLpClkConfig::Xtal => release_ble_lp_xtal_clk(clocks),
4356                    #[cfg(use_xtal32k)]
4357                    BleLpClkConfig::Xtal32k => release_xtal32k_clk(clocks),
4358                }
4359            }
4360        }
4361        pub fn ble_lp_clk_config_frequency(config: BleLpClkConfig) -> u32 {
4362            match config {
4363                BleLpClkConfig::Xtal => ble_lp_xtal_clk_frequency(),
4364                #[cfg(use_xtal32k)]
4365                BleLpClkConfig::Xtal32k => xtal32k_clk_frequency(),
4366            }
4367        }
4368        pub fn ble_lp_clk_frequency() -> u32 {
4369            BLE_LP_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4370        }
4371        pub fn ble_lp_clk_source_frequency(source: BleLpClkConfig) -> u32 {
4372            ble_lp_clk_config_frequency(source)
4373        }
4374        pub fn configure_crypto_clk(clocks: &mut ClockTree, new_selector: CryptoClkConfig) {
4375            let old_selector = clocks.crypto_clk.replace(new_selector);
4376            refresh_crypto_clk_downstream(clocks);
4377            let active = clocks.crypto_clk_refcount > 0;
4378            if active {
4379                match new_selector {
4380                    CryptoClkConfig::Xtal => request_xtal_clk(clocks),
4381                    CryptoClkConfig::RcFast => request_rc_fast_clk(clocks),
4382                    CryptoClkConfig::PllF240m => request_pll_f240m(clocks),
4383                }
4384            }
4385            configure_crypto_clk_impl(clocks, old_selector, new_selector);
4386            if active && let Some(old_selector) = old_selector {
4387                match old_selector {
4388                    CryptoClkConfig::Xtal => release_xtal_clk(clocks),
4389                    CryptoClkConfig::RcFast => release_rc_fast_clk(clocks),
4390                    CryptoClkConfig::PllF240m => release_pll_f240m(clocks),
4391                }
4392            }
4393        }
4394        pub fn crypto_clk_config(clocks: &mut ClockTree) -> Option<CryptoClkConfig> {
4395            clocks.crypto_clk
4396        }
4397        pub fn request_crypto_clk(clocks: &mut ClockTree) {
4398            trace!("Requesting CRYPTO_CLK");
4399            if increment_reference_count(&mut clocks.crypto_clk_refcount) {
4400                trace!("Enabling CRYPTO_CLK");
4401                match unwrap!(clocks.crypto_clk) {
4402                    CryptoClkConfig::Xtal => request_xtal_clk(clocks),
4403                    CryptoClkConfig::RcFast => request_rc_fast_clk(clocks),
4404                    CryptoClkConfig::PllF240m => request_pll_f240m(clocks),
4405                }
4406                enable_crypto_clk_impl(clocks, true);
4407            }
4408        }
4409        pub fn release_crypto_clk(clocks: &mut ClockTree) {
4410            trace!("Releasing CRYPTO_CLK");
4411            if decrement_reference_count(&mut clocks.crypto_clk_refcount) {
4412                trace!("Disabling CRYPTO_CLK");
4413                enable_crypto_clk_impl(clocks, false);
4414                match unwrap!(clocks.crypto_clk) {
4415                    CryptoClkConfig::Xtal => release_xtal_clk(clocks),
4416                    CryptoClkConfig::RcFast => release_rc_fast_clk(clocks),
4417                    CryptoClkConfig::PllF240m => release_pll_f240m(clocks),
4418                }
4419            }
4420        }
4421        pub fn crypto_clk_config_frequency(config: CryptoClkConfig) -> u32 {
4422            match config {
4423                CryptoClkConfig::Xtal => xtal_clk_frequency(),
4424                CryptoClkConfig::RcFast => rc_fast_clk_frequency(),
4425                CryptoClkConfig::PllF240m => pll_f240m_frequency(),
4426            }
4427        }
4428        pub fn crypto_clk_frequency() -> u32 {
4429            CRYPTO_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4430        }
4431        pub fn crypto_clk_source_frequency(source: CryptoClkConfig) -> u32 {
4432            crypto_clk_config_frequency(source)
4433        }
4434        pub fn configure_iomux_function_clock(
4435            clocks: &mut ClockTree,
4436            config: IomuxFunctionClockConfig,
4437        ) {
4438            let old_config = clocks.iomux_function_clock.replace(config);
4439            refresh_iomux_function_clock_downstream(clocks);
4440            match config.source {
4441                IomuxFunctionClockSource::XtalClk => request_xtal_clk(clocks),
4442                IomuxFunctionClockSource::PllF80m => request_pll_f80m(clocks),
4443            }
4444            configure_iomux_function_clock_impl(clocks, old_config, config);
4445            if let Some(old_config) = old_config {
4446                match old_config.source {
4447                    IomuxFunctionClockSource::XtalClk => release_xtal_clk(clocks),
4448                    IomuxFunctionClockSource::PllF80m => release_pll_f80m(clocks),
4449                }
4450            }
4451        }
4452        pub fn iomux_function_clock_config(
4453            clocks: &mut ClockTree,
4454        ) -> Option<IomuxFunctionClockConfig> {
4455            clocks.iomux_function_clock
4456        }
4457        fn request_iomux_function_clock(_clocks: &mut ClockTree) {}
4458        fn release_iomux_function_clock(_clocks: &mut ClockTree) {}
4459        pub fn iomux_function_clock_config_frequency(config: IomuxFunctionClockConfig) -> u32 {
4460            (match config.source {
4461                IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
4462                IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
4463            } / (config.div_num() + 1))
4464        }
4465        pub fn iomux_function_clock_frequency() -> u32 {
4466            IOMUX_FUNCTION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4467        }
4468        pub fn iomux_function_clock_source_frequency(source: IomuxFunctionClockSource) -> u32 {
4469            match source {
4470                IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
4471                IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
4472            }
4473        }
4474        pub fn configure_timg_calibration_clock(
4475            clocks: &mut ClockTree,
4476            new_selector: TimgCalibrationClockConfig,
4477        ) {
4478            let old_selector = clocks.timg_calibration_clock.replace(new_selector);
4479            refresh_timg_calibration_clock_downstream(clocks);
4480            let active = clocks.timg_calibration_clock_refcount > 0;
4481            if active {
4482                match new_selector {
4483                    TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
4484                    TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
4485                    #[cfg(use_xtal32k)]
4486                    TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
4487                }
4488            }
4489            configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
4490            if active && let Some(old_selector) = old_selector {
4491                match old_selector {
4492                    TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
4493                    TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
4494                    #[cfg(use_xtal32k)]
4495                    TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
4496                }
4497            }
4498        }
4499        pub fn timg_calibration_clock_config(
4500            clocks: &mut ClockTree,
4501        ) -> Option<TimgCalibrationClockConfig> {
4502            clocks.timg_calibration_clock
4503        }
4504        pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
4505            trace!("Requesting TIMG_CALIBRATION_CLOCK");
4506            if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
4507                trace!("Enabling TIMG_CALIBRATION_CLOCK");
4508                crate::rtc_cntl::WakeLock::acquire();
4509                match unwrap!(clocks.timg_calibration_clock) {
4510                    TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
4511                    TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
4512                    #[cfg(use_xtal32k)]
4513                    TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
4514                }
4515                enable_timg_calibration_clock_impl(clocks, true);
4516            }
4517        }
4518        pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
4519            trace!("Releasing TIMG_CALIBRATION_CLOCK");
4520            if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
4521                trace!("Disabling TIMG_CALIBRATION_CLOCK");
4522                crate::rtc_cntl::WakeLock::release();
4523                enable_timg_calibration_clock_impl(clocks, false);
4524                match unwrap!(clocks.timg_calibration_clock) {
4525                    TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
4526                    TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
4527                    #[cfg(use_xtal32k)]
4528                    TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
4529                }
4530            }
4531        }
4532        pub fn timg_calibration_clock_config_frequency(config: TimgCalibrationClockConfig) -> u32 {
4533            match config {
4534                TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
4535                TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_frequency(),
4536                #[cfg(use_xtal32k)]
4537                TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
4538            }
4539        }
4540        pub fn timg_calibration_clock_frequency() -> u32 {
4541            TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4542        }
4543        pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
4544            timg_calibration_clock_config_frequency(source)
4545        }
4546        impl CordicInstance {
4547            pub fn configure_function_clock(
4548                self,
4549                clocks: &mut ClockTree,
4550                config: CordicFunctionClockConfig,
4551            ) {
4552                let old_config = clocks.cordic_function_clock[self as usize].replace(config);
4553                refresh_cordic_function_clock_downstream(clocks, self);
4554                let active = clocks.cordic_function_clock_refcount[self as usize] > 0;
4555                if active {
4556                    match config.source {
4557                        CordicFunctionClockSource::Xtal => request_xtal_clk(clocks),
4558                        CordicFunctionClockSource::RcFast => request_rc_fast_clk(clocks),
4559                        CordicFunctionClockSource::PllF160m => request_pll_f160m(clocks),
4560                    }
4561                }
4562                self.configure_function_clock_impl(clocks, old_config, config);
4563                if active && let Some(old_config) = old_config {
4564                    match old_config.source {
4565                        CordicFunctionClockSource::Xtal => release_xtal_clk(clocks),
4566                        CordicFunctionClockSource::RcFast => release_rc_fast_clk(clocks),
4567                        CordicFunctionClockSource::PllF160m => release_pll_f160m(clocks),
4568                    }
4569                }
4570            }
4571            pub fn function_clock_config(
4572                self,
4573                clocks: &mut ClockTree,
4574            ) -> Option<CordicFunctionClockConfig> {
4575                clocks.cordic_function_clock[self as usize]
4576            }
4577            pub fn request_function_clock(self, clocks: &mut ClockTree) {
4578                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4579                if increment_reference_count(
4580                    &mut clocks.cordic_function_clock_refcount[self as usize],
4581                ) {
4582                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4583                    crate::rtc_cntl::WakeLock::acquire();
4584                    match unwrap!(clocks.cordic_function_clock[self as usize]).source {
4585                        CordicFunctionClockSource::Xtal => request_xtal_clk(clocks),
4586                        CordicFunctionClockSource::RcFast => request_rc_fast_clk(clocks),
4587                        CordicFunctionClockSource::PllF160m => request_pll_f160m(clocks),
4588                    }
4589                    self.enable_function_clock_impl(clocks, true);
4590                }
4591            }
4592            pub fn release_function_clock(self, clocks: &mut ClockTree) {
4593                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4594                if decrement_reference_count(
4595                    &mut clocks.cordic_function_clock_refcount[self as usize],
4596                ) {
4597                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4598                    crate::rtc_cntl::WakeLock::release();
4599                    self.enable_function_clock_impl(clocks, false);
4600                    match unwrap!(clocks.cordic_function_clock[self as usize]).source {
4601                        CordicFunctionClockSource::Xtal => release_xtal_clk(clocks),
4602                        CordicFunctionClockSource::RcFast => release_rc_fast_clk(clocks),
4603                        CordicFunctionClockSource::PllF160m => release_pll_f160m(clocks),
4604                    }
4605                }
4606            }
4607            pub fn function_clock_config_frequency(config: CordicFunctionClockConfig) -> u32 {
4608                (((match config.source {
4609                    CordicFunctionClockSource::Xtal => xtal_clk_frequency(),
4610                    CordicFunctionClockSource::RcFast => rc_fast_clk_frequency(),
4611                    CordicFunctionClockSource::PllF160m => pll_f160m_frequency(),
4612                } as u64)
4613                    * (config.denominator() as u64))
4614                    / (((config.divider() * config.denominator()) + config.numerator()) as u64))
4615                    as u32
4616            }
4617            pub fn function_clock_frequency(self) -> u32 {
4618                CORDIC_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4619                    .load(::core::sync::atomic::Ordering::Acquire)
4620            }
4621            pub fn function_clock_source_frequency(source: CordicFunctionClockSource) -> u32 {
4622                match source {
4623                    CordicFunctionClockSource::Xtal => xtal_clk_frequency(),
4624                    CordicFunctionClockSource::RcFast => rc_fast_clk_frequency(),
4625                    CordicFunctionClockSource::PllF160m => pll_f160m_frequency(),
4626                }
4627            }
4628        }
4629        impl SdmInstance {
4630            pub fn request_function_clock(self, clocks: &mut ClockTree) {
4631                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4632                if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
4633                {
4634                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4635                    request_iomux_function_clock(clocks);
4636                    self.enable_function_clock_impl(clocks, true);
4637                }
4638            }
4639            pub fn release_function_clock(self, clocks: &mut ClockTree) {
4640                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4641                if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
4642                {
4643                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4644                    self.enable_function_clock_impl(clocks, false);
4645                    release_iomux_function_clock(clocks);
4646                }
4647            }
4648            pub fn function_clock_frequency(self) -> u32 {
4649                iomux_function_clock_frequency()
4650            }
4651            pub fn function_clock_source_frequency() -> u32 {
4652                iomux_function_clock_frequency()
4653            }
4654        }
4655        impl I2cInstance {
4656            pub fn configure_function_clock(
4657                self,
4658                clocks: &mut ClockTree,
4659                config: I2cFunctionClockConfig,
4660            ) {
4661                let old_config = clocks.i2c_function_clock[self as usize].replace(config);
4662                refresh_i2c_function_clock_downstream(clocks, self);
4663                let active = clocks.i2c_function_clock_refcount[self as usize] > 0;
4664                if active {
4665                    match config.sclk {
4666                        I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4667                        I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4668                    }
4669                }
4670                self.configure_function_clock_impl(clocks, old_config, config);
4671                if active && let Some(old_config) = old_config {
4672                    match old_config.sclk {
4673                        I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4674                        I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4675                    }
4676                }
4677            }
4678            pub fn function_clock_config(
4679                self,
4680                clocks: &mut ClockTree,
4681            ) -> Option<I2cFunctionClockConfig> {
4682                clocks.i2c_function_clock[self as usize]
4683            }
4684            pub fn request_function_clock(self, clocks: &mut ClockTree) {
4685                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4686                if increment_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
4687                {
4688                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4689                    match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
4690                        I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4691                        I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4692                    }
4693                    self.enable_function_clock_impl(clocks, true);
4694                }
4695            }
4696            pub fn release_function_clock(self, clocks: &mut ClockTree) {
4697                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4698                if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
4699                {
4700                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4701                    self.enable_function_clock_impl(clocks, false);
4702                    match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
4703                        I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4704                        I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4705                    }
4706                }
4707            }
4708            pub fn function_clock_config_frequency(config: I2cFunctionClockConfig) -> u32 {
4709                (match config.sclk {
4710                    I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
4711                    I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4712                } / (config.div_num() + 1))
4713            }
4714            pub fn function_clock_frequency(self) -> u32 {
4715                I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4716                    .load(::core::sync::atomic::Ordering::Acquire)
4717            }
4718            pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
4719                match sclk {
4720                    I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
4721                    I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4722                }
4723            }
4724        }
4725        impl I2sInstance {
4726            pub fn configure_tx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
4727                let old_config = clocks.i2s_tx_clk[self as usize].replace(config);
4728                refresh_i2s_tx_clk_downstream(clocks, self);
4729                self.configure_tx_clk_impl(clocks, old_config, config);
4730            }
4731            pub fn tx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
4732                clocks.i2s_tx_clk[self as usize]
4733            }
4734            pub fn request_tx_clk(self, clocks: &mut ClockTree) {
4735                trace!("Requesting {:?}::TX_CLK", self);
4736                if increment_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
4737                    trace!("Enabling {:?}::TX_CLK", self);
4738                    crate::rtc_cntl::WakeLock::acquire();
4739                    match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
4740                        I2sClkSclk::Xtal => request_xtal_clk(clocks),
4741                    }
4742                    self.enable_tx_clk_impl(clocks, true);
4743                }
4744            }
4745            pub fn release_tx_clk(self, clocks: &mut ClockTree) {
4746                trace!("Releasing {:?}::TX_CLK", self);
4747                if decrement_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
4748                    trace!("Disabling {:?}::TX_CLK", self);
4749                    crate::rtc_cntl::WakeLock::release();
4750                    self.enable_tx_clk_impl(clocks, false);
4751                    match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
4752                        I2sClkSclk::Xtal => release_xtal_clk(clocks),
4753                    }
4754                }
4755            }
4756            pub fn tx_clk_config_frequency(config: I2sClkConfig) -> u32 {
4757                (((xtal_clk_frequency() as u64) * (config.div_a() as u64))
4758                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4759                    as u32
4760            }
4761            pub fn tx_clk_frequency(self) -> u32 {
4762                I2S_TX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4763            }
4764            pub fn tx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
4765                match sclk {
4766                    I2sClkSclk::Xtal => xtal_clk_frequency(),
4767                }
4768            }
4769            pub fn configure_rx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
4770                let old_config = clocks.i2s_rx_clk[self as usize].replace(config);
4771                refresh_i2s_rx_clk_downstream(clocks, self);
4772                self.configure_rx_clk_impl(clocks, old_config, config);
4773            }
4774            pub fn rx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
4775                clocks.i2s_rx_clk[self as usize]
4776            }
4777            pub fn request_rx_clk(self, clocks: &mut ClockTree) {
4778                trace!("Requesting {:?}::RX_CLK", self);
4779                if increment_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
4780                    trace!("Enabling {:?}::RX_CLK", self);
4781                    crate::rtc_cntl::WakeLock::acquire();
4782                    match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
4783                        I2sClkSclk::Xtal => request_xtal_clk(clocks),
4784                    }
4785                    self.enable_rx_clk_impl(clocks, true);
4786                }
4787            }
4788            pub fn release_rx_clk(self, clocks: &mut ClockTree) {
4789                trace!("Releasing {:?}::RX_CLK", self);
4790                if decrement_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
4791                    trace!("Disabling {:?}::RX_CLK", self);
4792                    crate::rtc_cntl::WakeLock::release();
4793                    self.enable_rx_clk_impl(clocks, false);
4794                    match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
4795                        I2sClkSclk::Xtal => release_xtal_clk(clocks),
4796                    }
4797                }
4798            }
4799            pub fn rx_clk_config_frequency(config: I2sClkConfig) -> u32 {
4800                (((xtal_clk_frequency() as u64) * (config.div_a() as u64))
4801                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4802                    as u32
4803            }
4804            pub fn rx_clk_frequency(self) -> u32 {
4805                I2S_RX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4806            }
4807            pub fn rx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
4808                match sclk {
4809                    I2sClkSclk::Xtal => xtal_clk_frequency(),
4810                }
4811            }
4812            pub fn configure_mclk_out(
4813                self,
4814                clocks: &mut ClockTree,
4815                new_selector: I2sMclkOutConfig,
4816            ) {
4817                let old_selector = clocks.i2s_mclk_out[self as usize].replace(new_selector);
4818                refresh_i2s_mclk_out_downstream(clocks, self);
4819                let active = clocks.i2s_mclk_out_refcount[self as usize] > 0;
4820                if active {
4821                    match new_selector {
4822                        I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
4823                        I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
4824                    }
4825                }
4826                self.configure_mclk_out_impl(clocks, old_selector, new_selector);
4827                if active && let Some(old_selector) = old_selector {
4828                    match old_selector {
4829                        I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
4830                        I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
4831                    }
4832                }
4833            }
4834            pub fn mclk_out_config(self, clocks: &mut ClockTree) -> Option<I2sMclkOutConfig> {
4835                clocks.i2s_mclk_out[self as usize]
4836            }
4837            pub fn request_mclk_out(self, clocks: &mut ClockTree) {
4838                trace!("Requesting {:?}::MCLK_OUT", self);
4839                if increment_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
4840                    trace!("Enabling {:?}::MCLK_OUT", self);
4841                    match unwrap!(clocks.i2s_mclk_out[self as usize]) {
4842                        I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
4843                        I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
4844                    }
4845                    self.enable_mclk_out_impl(clocks, true);
4846                }
4847            }
4848            pub fn release_mclk_out(self, clocks: &mut ClockTree) {
4849                trace!("Releasing {:?}::MCLK_OUT", self);
4850                if decrement_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
4851                    trace!("Disabling {:?}::MCLK_OUT", self);
4852                    self.enable_mclk_out_impl(clocks, false);
4853                    match unwrap!(clocks.i2s_mclk_out[self as usize]) {
4854                        I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
4855                        I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
4856                    }
4857                }
4858            }
4859            pub fn mclk_out_config_frequency(self, config: I2sMclkOutConfig) -> u32 {
4860                match config {
4861                    I2sMclkOutConfig::Tx => self.tx_clk_frequency(),
4862                    I2sMclkOutConfig::Rx => self.rx_clk_frequency(),
4863                }
4864            }
4865            pub fn mclk_out_frequency(self) -> u32 {
4866                I2S_MCLK_OUT_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4867            }
4868        }
4869        impl LcdCamInstance {
4870            pub fn configure_lcd_clock(self, clocks: &mut ClockTree, config: LcdCamLcdClockConfig) {
4871                let old_config = clocks.lcd_cam_lcd_clock[self as usize].replace(config);
4872                refresh_lcd_cam_lcd_clock_downstream(clocks, self);
4873                let active = clocks.lcd_cam_lcd_clock_refcount[self as usize] > 0;
4874                if active {
4875                    match config.sclk {
4876                        LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
4877                        LcdCamLcdClockSclk::PllF160m => request_pll_f160m(clocks),
4878                    }
4879                }
4880                self.configure_lcd_clock_impl(clocks, old_config, config);
4881                if active && let Some(old_config) = old_config {
4882                    match old_config.sclk {
4883                        LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
4884                        LcdCamLcdClockSclk::PllF160m => release_pll_f160m(clocks),
4885                    }
4886                }
4887            }
4888            pub fn lcd_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamLcdClockConfig> {
4889                clocks.lcd_cam_lcd_clock[self as usize]
4890            }
4891            pub fn request_lcd_clock(self, clocks: &mut ClockTree) {
4892                trace!("Requesting {:?}::LCD_CLOCK", self);
4893                if increment_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
4894                {
4895                    trace!("Enabling {:?}::LCD_CLOCK", self);
4896                    crate::rtc_cntl::WakeLock::acquire();
4897                    match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
4898                        LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
4899                        LcdCamLcdClockSclk::PllF160m => request_pll_f160m(clocks),
4900                    }
4901                    self.enable_lcd_clock_impl(clocks, true);
4902                }
4903            }
4904            pub fn release_lcd_clock(self, clocks: &mut ClockTree) {
4905                trace!("Releasing {:?}::LCD_CLOCK", self);
4906                if decrement_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
4907                {
4908                    trace!("Disabling {:?}::LCD_CLOCK", self);
4909                    crate::rtc_cntl::WakeLock::release();
4910                    self.enable_lcd_clock_impl(clocks, false);
4911                    match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
4912                        LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
4913                        LcdCamLcdClockSclk::PllF160m => release_pll_f160m(clocks),
4914                    }
4915                }
4916            }
4917            pub fn lcd_clock_config_frequency(config: LcdCamLcdClockConfig) -> u32 {
4918                (((match config.sclk {
4919                    LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
4920                    LcdCamLcdClockSclk::PllF160m => pll_f160m_frequency(),
4921                } as u64)
4922                    * (config.div_a() as u64))
4923                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4924                    as u32
4925            }
4926            pub fn lcd_clock_frequency(self) -> u32 {
4927                LCD_CAM_LCD_CLOCK_FREQ_CACHE[self as usize]
4928                    .load(::core::sync::atomic::Ordering::Acquire)
4929            }
4930            pub fn lcd_clock_source_frequency(sclk: LcdCamLcdClockSclk) -> u32 {
4931                match sclk {
4932                    LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
4933                    LcdCamLcdClockSclk::PllF160m => pll_f160m_frequency(),
4934                }
4935            }
4936            pub fn configure_cam_clock(self, clocks: &mut ClockTree, config: LcdCamCamClockConfig) {
4937                let old_config = clocks.lcd_cam_cam_clock[self as usize].replace(config);
4938                refresh_lcd_cam_cam_clock_downstream(clocks, self);
4939                let active = clocks.lcd_cam_cam_clock_refcount[self as usize] > 0;
4940                if active {
4941                    match config.sclk {
4942                        LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
4943                        LcdCamCamClockSclk::PllF160m => request_pll_f160m(clocks),
4944                    }
4945                }
4946                self.configure_cam_clock_impl(clocks, old_config, config);
4947                if active && let Some(old_config) = old_config {
4948                    match old_config.sclk {
4949                        LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
4950                        LcdCamCamClockSclk::PllF160m => release_pll_f160m(clocks),
4951                    }
4952                }
4953            }
4954            pub fn cam_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamCamClockConfig> {
4955                clocks.lcd_cam_cam_clock[self as usize]
4956            }
4957            pub fn request_cam_clock(self, clocks: &mut ClockTree) {
4958                trace!("Requesting {:?}::CAM_CLOCK", self);
4959                if increment_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
4960                {
4961                    trace!("Enabling {:?}::CAM_CLOCK", self);
4962                    crate::rtc_cntl::WakeLock::acquire();
4963                    match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
4964                        LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
4965                        LcdCamCamClockSclk::PllF160m => request_pll_f160m(clocks),
4966                    }
4967                    self.enable_cam_clock_impl(clocks, true);
4968                }
4969            }
4970            pub fn release_cam_clock(self, clocks: &mut ClockTree) {
4971                trace!("Releasing {:?}::CAM_CLOCK", self);
4972                if decrement_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
4973                {
4974                    trace!("Disabling {:?}::CAM_CLOCK", self);
4975                    crate::rtc_cntl::WakeLock::release();
4976                    self.enable_cam_clock_impl(clocks, false);
4977                    match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
4978                        LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
4979                        LcdCamCamClockSclk::PllF160m => release_pll_f160m(clocks),
4980                    }
4981                }
4982            }
4983            pub fn cam_clock_config_frequency(config: LcdCamCamClockConfig) -> u32 {
4984                (((match config.sclk {
4985                    LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
4986                    LcdCamCamClockSclk::PllF160m => pll_f160m_frequency(),
4987                } as u64)
4988                    * (config.div_a() as u64))
4989                    / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4990                    as u32
4991            }
4992            pub fn cam_clock_frequency(self) -> u32 {
4993                LCD_CAM_CAM_CLOCK_FREQ_CACHE[self as usize]
4994                    .load(::core::sync::atomic::Ordering::Acquire)
4995            }
4996            pub fn cam_clock_source_frequency(sclk: LcdCamCamClockSclk) -> u32 {
4997                match sclk {
4998                    LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
4999                    LcdCamCamClockSclk::PllF160m => pll_f160m_frequency(),
5000                }
5001            }
5002        }
5003        impl ParlIoInstance {
5004            pub fn configure_rx_clock(self, clocks: &mut ClockTree, new_selector: ParlIoClkConfig) {
5005                let old_selector = clocks.parl_io_rx_clock[self as usize].replace(new_selector);
5006                refresh_parl_io_rx_clock_downstream(clocks, self);
5007                let active = clocks.parl_io_rx_clock_refcount[self as usize] > 0;
5008                if active {
5009                    match new_selector {
5010                        ParlIoClkConfig::XtalClk => request_xtal_clk(clocks),
5011                        ParlIoClkConfig::RcFastClk => request_rc_fast_clk(clocks),
5012                        ParlIoClkConfig::PllF160m => request_pll_f160m(clocks),
5013                    }
5014                }
5015                self.configure_rx_clock_impl(clocks, old_selector, new_selector);
5016                if active && let Some(old_selector) = old_selector {
5017                    match old_selector {
5018                        ParlIoClkConfig::XtalClk => release_xtal_clk(clocks),
5019                        ParlIoClkConfig::RcFastClk => release_rc_fast_clk(clocks),
5020                        ParlIoClkConfig::PllF160m => release_pll_f160m(clocks),
5021                    }
5022                }
5023            }
5024            pub fn rx_clock_config(self, clocks: &mut ClockTree) -> Option<ParlIoClkConfig> {
5025                clocks.parl_io_rx_clock[self as usize]
5026            }
5027            pub fn request_rx_clock(self, clocks: &mut ClockTree) {
5028                trace!("Requesting {:?}::RX_CLOCK", self);
5029                if increment_reference_count(&mut clocks.parl_io_rx_clock_refcount[self as usize]) {
5030                    trace!("Enabling {:?}::RX_CLOCK", self);
5031                    crate::rtc_cntl::WakeLock::acquire();
5032                    match unwrap!(clocks.parl_io_rx_clock[self as usize]) {
5033                        ParlIoClkConfig::XtalClk => request_xtal_clk(clocks),
5034                        ParlIoClkConfig::RcFastClk => request_rc_fast_clk(clocks),
5035                        ParlIoClkConfig::PllF160m => request_pll_f160m(clocks),
5036                    }
5037                    self.enable_rx_clock_impl(clocks, true);
5038                }
5039            }
5040            pub fn release_rx_clock(self, clocks: &mut ClockTree) {
5041                trace!("Releasing {:?}::RX_CLOCK", self);
5042                if decrement_reference_count(&mut clocks.parl_io_rx_clock_refcount[self as usize]) {
5043                    trace!("Disabling {:?}::RX_CLOCK", self);
5044                    crate::rtc_cntl::WakeLock::release();
5045                    self.enable_rx_clock_impl(clocks, false);
5046                    match unwrap!(clocks.parl_io_rx_clock[self as usize]) {
5047                        ParlIoClkConfig::XtalClk => release_xtal_clk(clocks),
5048                        ParlIoClkConfig::RcFastClk => release_rc_fast_clk(clocks),
5049                        ParlIoClkConfig::PllF160m => release_pll_f160m(clocks),
5050                    }
5051                }
5052            }
5053            pub fn rx_clock_config_frequency(config: ParlIoClkConfig) -> u32 {
5054                match config {
5055                    ParlIoClkConfig::XtalClk => xtal_clk_frequency(),
5056                    ParlIoClkConfig::RcFastClk => rc_fast_clk_frequency(),
5057                    ParlIoClkConfig::PllF160m => pll_f160m_frequency(),
5058                }
5059            }
5060            pub fn rx_clock_frequency(self) -> u32 {
5061                PARL_IO_RX_CLOCK_FREQ_CACHE[self as usize]
5062                    .load(::core::sync::atomic::Ordering::Acquire)
5063            }
5064            pub fn rx_clock_source_frequency(source: ParlIoClkConfig) -> u32 {
5065                Self::rx_clock_config_frequency(source)
5066            }
5067            pub fn configure_tx_clock(self, clocks: &mut ClockTree, new_selector: ParlIoClkConfig) {
5068                let old_selector = clocks.parl_io_tx_clock[self as usize].replace(new_selector);
5069                refresh_parl_io_tx_clock_downstream(clocks, self);
5070                let active = clocks.parl_io_tx_clock_refcount[self as usize] > 0;
5071                if active {
5072                    match new_selector {
5073                        ParlIoClkConfig::XtalClk => request_xtal_clk(clocks),
5074                        ParlIoClkConfig::RcFastClk => request_rc_fast_clk(clocks),
5075                        ParlIoClkConfig::PllF160m => request_pll_f160m(clocks),
5076                    }
5077                }
5078                self.configure_tx_clock_impl(clocks, old_selector, new_selector);
5079                if active && let Some(old_selector) = old_selector {
5080                    match old_selector {
5081                        ParlIoClkConfig::XtalClk => release_xtal_clk(clocks),
5082                        ParlIoClkConfig::RcFastClk => release_rc_fast_clk(clocks),
5083                        ParlIoClkConfig::PllF160m => release_pll_f160m(clocks),
5084                    }
5085                }
5086            }
5087            pub fn tx_clock_config(self, clocks: &mut ClockTree) -> Option<ParlIoClkConfig> {
5088                clocks.parl_io_tx_clock[self as usize]
5089            }
5090            pub fn request_tx_clock(self, clocks: &mut ClockTree) {
5091                trace!("Requesting {:?}::TX_CLOCK", self);
5092                if increment_reference_count(&mut clocks.parl_io_tx_clock_refcount[self as usize]) {
5093                    trace!("Enabling {:?}::TX_CLOCK", self);
5094                    crate::rtc_cntl::WakeLock::acquire();
5095                    match unwrap!(clocks.parl_io_tx_clock[self as usize]) {
5096                        ParlIoClkConfig::XtalClk => request_xtal_clk(clocks),
5097                        ParlIoClkConfig::RcFastClk => request_rc_fast_clk(clocks),
5098                        ParlIoClkConfig::PllF160m => request_pll_f160m(clocks),
5099                    }
5100                    self.enable_tx_clock_impl(clocks, true);
5101                }
5102            }
5103            pub fn release_tx_clock(self, clocks: &mut ClockTree) {
5104                trace!("Releasing {:?}::TX_CLOCK", self);
5105                if decrement_reference_count(&mut clocks.parl_io_tx_clock_refcount[self as usize]) {
5106                    trace!("Disabling {:?}::TX_CLOCK", self);
5107                    crate::rtc_cntl::WakeLock::release();
5108                    self.enable_tx_clock_impl(clocks, false);
5109                    match unwrap!(clocks.parl_io_tx_clock[self as usize]) {
5110                        ParlIoClkConfig::XtalClk => release_xtal_clk(clocks),
5111                        ParlIoClkConfig::RcFastClk => release_rc_fast_clk(clocks),
5112                        ParlIoClkConfig::PllF160m => release_pll_f160m(clocks),
5113                    }
5114                }
5115            }
5116            pub fn tx_clock_config_frequency(config: ParlIoClkConfig) -> u32 {
5117                match config {
5118                    ParlIoClkConfig::XtalClk => xtal_clk_frequency(),
5119                    ParlIoClkConfig::RcFastClk => rc_fast_clk_frequency(),
5120                    ParlIoClkConfig::PllF160m => pll_f160m_frequency(),
5121                }
5122            }
5123            pub fn tx_clock_frequency(self) -> u32 {
5124                PARL_IO_TX_CLOCK_FREQ_CACHE[self as usize]
5125                    .load(::core::sync::atomic::Ordering::Acquire)
5126            }
5127            pub fn tx_clock_source_frequency(source: ParlIoClkConfig) -> u32 {
5128                Self::tx_clock_config_frequency(source)
5129            }
5130        }
5131        impl PcntInstance {
5132            pub fn request_function_clock(self, clocks: &mut ClockTree) {
5133                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
5134                if increment_reference_count(
5135                    &mut clocks.pcnt_function_clock_refcount[self as usize],
5136                ) {
5137                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
5138                    request_apb_clk(clocks);
5139                    self.enable_function_clock_impl(clocks, true);
5140                }
5141            }
5142            pub fn release_function_clock(self, clocks: &mut ClockTree) {
5143                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
5144                if decrement_reference_count(
5145                    &mut clocks.pcnt_function_clock_refcount[self as usize],
5146                ) {
5147                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
5148                    self.enable_function_clock_impl(clocks, false);
5149                    release_apb_clk(clocks);
5150                }
5151            }
5152            pub fn function_clock_frequency(self) -> u32 {
5153                apb_clk_frequency()
5154            }
5155            pub fn function_clock_source_frequency() -> u32 {
5156                apb_clk_frequency()
5157            }
5158        }
5159        impl RmtInstance {
5160            pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
5161                let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
5162                refresh_rmt_sclk_downstream(clocks, self);
5163                let active = clocks.rmt_sclk_refcount[self as usize] > 0;
5164                if active {
5165                    match new_selector {
5166                        RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
5167                        RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
5168                        RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
5169                    }
5170                }
5171                self.configure_sclk_impl(clocks, old_selector, new_selector);
5172                if active && let Some(old_selector) = old_selector {
5173                    match old_selector {
5174                        RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
5175                        RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
5176                        RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
5177                    }
5178                }
5179            }
5180            pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
5181                clocks.rmt_sclk[self as usize]
5182            }
5183            pub fn request_sclk(self, clocks: &mut ClockTree) {
5184                trace!("Requesting {:?}::SCLK", self);
5185                if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
5186                    trace!("Enabling {:?}::SCLK", self);
5187                    crate::rtc_cntl::WakeLock::acquire();
5188                    match unwrap!(clocks.rmt_sclk[self as usize]) {
5189                        RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
5190                        RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
5191                        RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
5192                    }
5193                    self.enable_sclk_impl(clocks, true);
5194                }
5195            }
5196            pub fn release_sclk(self, clocks: &mut ClockTree) {
5197                trace!("Releasing {:?}::SCLK", self);
5198                if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
5199                    trace!("Disabling {:?}::SCLK", self);
5200                    crate::rtc_cntl::WakeLock::release();
5201                    self.enable_sclk_impl(clocks, false);
5202                    match unwrap!(clocks.rmt_sclk[self as usize]) {
5203                        RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
5204                        RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
5205                        RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
5206                    }
5207                }
5208            }
5209            pub fn sclk_config_frequency(config: RmtSclkConfig) -> u32 {
5210                match config {
5211                    RmtSclkConfig::PllF80m => pll_f80m_frequency(),
5212                    RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
5213                    RmtSclkConfig::XtalClk => xtal_clk_frequency(),
5214                }
5215            }
5216            pub fn sclk_frequency(self) -> u32 {
5217                RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
5218            }
5219            pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
5220                Self::sclk_config_frequency(source)
5221            }
5222        }
5223        impl SpiInstance {
5224            pub fn configure_function_clock(
5225                self,
5226                clocks: &mut ClockTree,
5227                new_selector: SpiFunctionClockConfig,
5228            ) {
5229                let old_selector = clocks.spi_function_clock[self as usize].replace(new_selector);
5230                refresh_spi_function_clock_downstream(clocks, self);
5231                let active = clocks.spi_function_clock_refcount[self as usize] > 0;
5232                if active {
5233                    match new_selector {
5234                        SpiFunctionClockConfig::Bbpll => request_bbpll_d3_clock(clocks),
5235                        SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
5236                        SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
5237                    }
5238                }
5239                self.configure_function_clock_impl(clocks, old_selector, new_selector);
5240                if active && let Some(old_selector) = old_selector {
5241                    match old_selector {
5242                        SpiFunctionClockConfig::Bbpll => release_bbpll_d3_clock(clocks),
5243                        SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
5244                        SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
5245                    }
5246                }
5247            }
5248            pub fn function_clock_config(
5249                self,
5250                clocks: &mut ClockTree,
5251            ) -> Option<SpiFunctionClockConfig> {
5252                clocks.spi_function_clock[self as usize]
5253            }
5254            pub fn request_function_clock(self, clocks: &mut ClockTree) {
5255                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
5256                if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
5257                {
5258                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
5259                    match unwrap!(clocks.spi_function_clock[self as usize]) {
5260                        SpiFunctionClockConfig::Bbpll => request_bbpll_d3_clock(clocks),
5261                        SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
5262                        SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
5263                    }
5264                    self.enable_function_clock_impl(clocks, true);
5265                }
5266            }
5267            pub fn release_function_clock(self, clocks: &mut ClockTree) {
5268                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
5269                if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
5270                {
5271                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
5272                    self.enable_function_clock_impl(clocks, false);
5273                    match unwrap!(clocks.spi_function_clock[self as usize]) {
5274                        SpiFunctionClockConfig::Bbpll => release_bbpll_d3_clock(clocks),
5275                        SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
5276                        SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
5277                    }
5278                }
5279            }
5280            pub fn function_clock_config_frequency(config: SpiFunctionClockConfig) -> u32 {
5281                match config {
5282                    SpiFunctionClockConfig::Bbpll => bbpll_d3_clock_frequency(),
5283                    SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
5284                    SpiFunctionClockConfig::RcFast => rc_fast_clk_frequency(),
5285                }
5286            }
5287            pub fn function_clock_frequency(self) -> u32 {
5288                SPI_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
5289                    .load(::core::sync::atomic::Ordering::Acquire)
5290            }
5291            pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
5292                Self::function_clock_config_frequency(source)
5293            }
5294        }
5295        impl TimgInstance {
5296            pub fn configure_function_clock(
5297                self,
5298                clocks: &mut ClockTree,
5299                new_selector: TimgFunctionClockConfig,
5300            ) {
5301                let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
5302                refresh_timg_function_clock_downstream(clocks, self);
5303                let active = clocks.timg_function_clock_refcount[self as usize] > 0;
5304                if active {
5305                    match new_selector {
5306                        TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
5307                        TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
5308                        TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
5309                    }
5310                }
5311                self.configure_function_clock_impl(clocks, old_selector, new_selector);
5312                if active && let Some(old_selector) = old_selector {
5313                    match old_selector {
5314                        TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
5315                        TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
5316                        TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
5317                    }
5318                }
5319            }
5320            pub fn function_clock_config(
5321                self,
5322                clocks: &mut ClockTree,
5323            ) -> Option<TimgFunctionClockConfig> {
5324                clocks.timg_function_clock[self as usize]
5325            }
5326            pub fn request_function_clock(self, clocks: &mut ClockTree) {
5327                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
5328                if increment_reference_count(
5329                    &mut clocks.timg_function_clock_refcount[self as usize],
5330                ) {
5331                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
5332                    match unwrap!(clocks.timg_function_clock[self as usize]) {
5333                        TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
5334                        TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
5335                        TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
5336                    }
5337                    self.enable_function_clock_impl(clocks, true);
5338                }
5339            }
5340            pub fn release_function_clock(self, clocks: &mut ClockTree) {
5341                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
5342                if decrement_reference_count(
5343                    &mut clocks.timg_function_clock_refcount[self as usize],
5344                ) {
5345                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
5346                    self.enable_function_clock_impl(clocks, false);
5347                    match unwrap!(clocks.timg_function_clock[self as usize]) {
5348                        TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
5349                        TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
5350                        TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
5351                    }
5352                }
5353            }
5354            pub fn function_clock_config_frequency(config: TimgFunctionClockConfig) -> u32 {
5355                match config {
5356                    TimgFunctionClockConfig::PllF80m => pll_f80m_frequency(),
5357                    TimgFunctionClockConfig::RcFastClk => rc_fast_clk_frequency(),
5358                    TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
5359                }
5360            }
5361            pub fn function_clock_frequency(self) -> u32 {
5362                TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
5363                    .load(::core::sync::atomic::Ordering::Acquire)
5364            }
5365            pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
5366                Self::function_clock_config_frequency(source)
5367            }
5368            pub fn configure_wdt_clock(
5369                self,
5370                clocks: &mut ClockTree,
5371                new_selector: TimgWdtClockConfig,
5372            ) {
5373                let old_selector = clocks.timg_wdt_clock[self as usize].replace(new_selector);
5374                refresh_timg_wdt_clock_downstream(clocks, self);
5375                let active = clocks.timg_wdt_clock_refcount[self as usize] > 0;
5376                if active {
5377                    match new_selector {
5378                        TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
5379                        TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
5380                        TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
5381                    }
5382                }
5383                self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
5384                if active && let Some(old_selector) = old_selector {
5385                    match old_selector {
5386                        TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
5387                        TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
5388                        TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
5389                    }
5390                }
5391            }
5392            pub fn wdt_clock_config(self, clocks: &mut ClockTree) -> Option<TimgWdtClockConfig> {
5393                clocks.timg_wdt_clock[self as usize]
5394            }
5395            pub fn request_wdt_clock(self, clocks: &mut ClockTree) {
5396                trace!("Requesting {:?}::WDT_CLOCK", self);
5397                if increment_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
5398                    trace!("Enabling {:?}::WDT_CLOCK", self);
5399                    match unwrap!(clocks.timg_wdt_clock[self as usize]) {
5400                        TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
5401                        TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
5402                        TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
5403                    }
5404                    self.enable_wdt_clock_impl(clocks, true);
5405                }
5406            }
5407            pub fn release_wdt_clock(self, clocks: &mut ClockTree) {
5408                trace!("Releasing {:?}::WDT_CLOCK", self);
5409                if decrement_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
5410                    trace!("Disabling {:?}::WDT_CLOCK", self);
5411                    self.enable_wdt_clock_impl(clocks, false);
5412                    match unwrap!(clocks.timg_wdt_clock[self as usize]) {
5413                        TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
5414                        TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
5415                        TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
5416                    }
5417                }
5418            }
5419            pub fn wdt_clock_config_frequency(config: TimgWdtClockConfig) -> u32 {
5420                match config {
5421                    TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
5422                    TimgWdtClockConfig::PllF80m => pll_f80m_frequency(),
5423                    TimgWdtClockConfig::RcFastClk => rc_fast_clk_frequency(),
5424                }
5425            }
5426            pub fn wdt_clock_frequency(self) -> u32 {
5427                TIMG_WDT_CLOCK_FREQ_CACHE[self as usize]
5428                    .load(::core::sync::atomic::Ordering::Acquire)
5429            }
5430            pub fn wdt_clock_source_frequency(source: TimgWdtClockConfig) -> u32 {
5431                Self::wdt_clock_config_frequency(source)
5432            }
5433        }
5434        impl TsensInstance {
5435            pub fn request_sclk(self, clocks: &mut ClockTree) {
5436                trace!("Requesting {:?}::SCLK", self);
5437                if increment_reference_count(&mut clocks.tsens_sclk_refcount[self as usize]) {
5438                    trace!("Enabling {:?}::SCLK", self);
5439                    request_lp_peri_clk(clocks);
5440                    self.enable_sclk_impl(clocks, true);
5441                }
5442            }
5443            pub fn release_sclk(self, clocks: &mut ClockTree) {
5444                trace!("Releasing {:?}::SCLK", self);
5445                if decrement_reference_count(&mut clocks.tsens_sclk_refcount[self as usize]) {
5446                    trace!("Disabling {:?}::SCLK", self);
5447                    self.enable_sclk_impl(clocks, false);
5448                    release_lp_peri_clk(clocks);
5449                }
5450            }
5451            pub fn sclk_frequency(self) -> u32 {
5452                lp_peri_clk_frequency()
5453            }
5454            pub fn sclk_source_frequency(source: TsensSclkConfig) -> u32 {
5455                match source {
5456                    TsensSclkConfig::LpPeri => lp_peri_clk_frequency(),
5457                }
5458            }
5459        }
5460        impl UartInstance {
5461            pub fn configure_function_clock(
5462                self,
5463                clocks: &mut ClockTree,
5464                config: UartFunctionClockConfig,
5465            ) {
5466                let old_config = clocks.uart_function_clock[self as usize].replace(config);
5467                refresh_uart_function_clock_downstream(clocks, self);
5468                let active = clocks.uart_function_clock_refcount[self as usize] > 0;
5469                if active {
5470                    match config.sclk {
5471                        UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
5472                        UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
5473                        UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
5474                    }
5475                }
5476                self.configure_function_clock_impl(clocks, old_config, config);
5477                if active && let Some(old_config) = old_config {
5478                    match old_config.sclk {
5479                        UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
5480                        UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
5481                        UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
5482                    }
5483                }
5484            }
5485            pub fn function_clock_config(
5486                self,
5487                clocks: &mut ClockTree,
5488            ) -> Option<UartFunctionClockConfig> {
5489                clocks.uart_function_clock[self as usize]
5490            }
5491            pub fn request_function_clock(self, clocks: &mut ClockTree) {
5492                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
5493                if increment_reference_count(
5494                    &mut clocks.uart_function_clock_refcount[self as usize],
5495                ) {
5496                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
5497                    match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
5498                        UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
5499                        UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
5500                        UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
5501                    }
5502                    self.enable_function_clock_impl(clocks, true);
5503                }
5504            }
5505            pub fn release_function_clock(self, clocks: &mut ClockTree) {
5506                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
5507                if decrement_reference_count(
5508                    &mut clocks.uart_function_clock_refcount[self as usize],
5509                ) {
5510                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
5511                    self.enable_function_clock_impl(clocks, false);
5512                    match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
5513                        UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
5514                        UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
5515                        UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
5516                    }
5517                }
5518            }
5519            pub fn function_clock_config_frequency(config: UartFunctionClockConfig) -> u32 {
5520                (match config.sclk {
5521                    UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
5522                    UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
5523                    UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
5524                } / (config.div_num() + 1))
5525            }
5526            pub fn function_clock_frequency(self) -> u32 {
5527                UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
5528                    .load(::core::sync::atomic::Ordering::Acquire)
5529            }
5530            pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
5531                match sclk {
5532                    UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
5533                    UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
5534                    UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
5535                }
5536            }
5537            pub fn configure_baud_rate_generator(
5538                self,
5539                clocks: &mut ClockTree,
5540                config: UartBaudRateGeneratorConfig,
5541            ) {
5542                let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
5543                refresh_uart_baud_rate_generator_downstream(clocks, self);
5544                self.configure_baud_rate_generator_impl(clocks, old_config, config);
5545            }
5546            pub fn baud_rate_generator_config(
5547                self,
5548                clocks: &mut ClockTree,
5549            ) -> Option<UartBaudRateGeneratorConfig> {
5550                clocks.uart_baud_rate_generator[self as usize]
5551            }
5552            pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
5553                trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
5554                if increment_reference_count(
5555                    &mut clocks.uart_baud_rate_generator_refcount[self as usize],
5556                ) {
5557                    trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
5558                    self.request_function_clock(clocks);
5559                    self.enable_baud_rate_generator_impl(clocks, true);
5560                }
5561            }
5562            pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
5563                trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
5564                if decrement_reference_count(
5565                    &mut clocks.uart_baud_rate_generator_refcount[self as usize],
5566                ) {
5567                    trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
5568                    self.enable_baud_rate_generator_impl(clocks, false);
5569                    self.release_function_clock(clocks);
5570                }
5571            }
5572            pub fn baud_rate_generator_config_frequency(
5573                self,
5574                config: UartBaudRateGeneratorConfig,
5575            ) -> u32 {
5576                ((self.function_clock_frequency() * 16)
5577                    / ((config.integral() * 16) + config.fractional()))
5578            }
5579            pub fn baud_rate_generator_frequency(self) -> u32 {
5580                UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
5581                    .load(::core::sync::atomic::Ordering::Acquire)
5582            }
5583            pub fn request_mem_clock(self, clocks: &mut ClockTree) {
5584                trace!("Requesting {:?}::MEM_CLOCK", self);
5585                if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
5586                    trace!("Enabling {:?}::MEM_CLOCK", self);
5587                    request_apb_clk(clocks);
5588                    self.enable_mem_clock_impl(clocks, true);
5589                }
5590            }
5591            pub fn release_mem_clock(self, clocks: &mut ClockTree) {
5592                trace!("Releasing {:?}::MEM_CLOCK", self);
5593                if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
5594                    trace!("Disabling {:?}::MEM_CLOCK", self);
5595                    self.enable_mem_clock_impl(clocks, false);
5596                    release_apb_clk(clocks);
5597                }
5598            }
5599            pub fn mem_clock_frequency(self) -> u32 {
5600                apb_clk_frequency()
5601            }
5602            pub fn mem_clock_source_frequency() -> u32 {
5603                apb_clk_frequency()
5604            }
5605        }
5606        impl PsramInstance {
5607            pub fn configure_function_clock(
5608                self,
5609                clocks: &mut ClockTree,
5610                new_selector: PsramFunctionClockConfig,
5611            ) {
5612                let old_selector = clocks.psram_function_clock[self as usize].replace(new_selector);
5613                refresh_psram_function_clock_downstream(clocks, self);
5614                let active = clocks.psram_function_clock_refcount[self as usize] > 0;
5615                if active {
5616                    match new_selector {
5617                        PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
5618                        PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
5619                        PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
5620                    }
5621                }
5622                self.configure_function_clock_impl(clocks, old_selector, new_selector);
5623                if active && let Some(old_selector) = old_selector {
5624                    match old_selector {
5625                        PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
5626                        PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
5627                        PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
5628                    }
5629                }
5630            }
5631            pub fn function_clock_config(
5632                self,
5633                clocks: &mut ClockTree,
5634            ) -> Option<PsramFunctionClockConfig> {
5635                clocks.psram_function_clock[self as usize]
5636            }
5637            pub fn request_function_clock(self, clocks: &mut ClockTree) {
5638                trace!("Requesting {:?}::FUNCTION_CLOCK", self);
5639                if increment_reference_count(
5640                    &mut clocks.psram_function_clock_refcount[self as usize],
5641                ) {
5642                    trace!("Enabling {:?}::FUNCTION_CLOCK", self);
5643                    match unwrap!(clocks.psram_function_clock[self as usize]) {
5644                        PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
5645                        PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
5646                        PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
5647                    }
5648                    self.enable_function_clock_impl(clocks, true);
5649                }
5650            }
5651            pub fn release_function_clock(self, clocks: &mut ClockTree) {
5652                trace!("Releasing {:?}::FUNCTION_CLOCK", self);
5653                if decrement_reference_count(
5654                    &mut clocks.psram_function_clock_refcount[self as usize],
5655                ) {
5656                    trace!("Disabling {:?}::FUNCTION_CLOCK", self);
5657                    self.enable_function_clock_impl(clocks, false);
5658                    match unwrap!(clocks.psram_function_clock[self as usize]) {
5659                        PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
5660                        PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
5661                        PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
5662                    }
5663                }
5664            }
5665            pub fn function_clock_config_frequency(config: PsramFunctionClockConfig) -> u32 {
5666                match config {
5667                    PsramFunctionClockConfig::Xtal => xtal_clk_frequency(),
5668                    PsramFunctionClockConfig::Mpll => mpll_clk_frequency(),
5669                    PsramFunctionClockConfig::Cpll => cpll_clk_frequency(),
5670                }
5671            }
5672            pub fn function_clock_frequency(self) -> u32 {
5673                PSRAM_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
5674                    .load(::core::sync::atomic::Ordering::Acquire)
5675            }
5676            pub fn function_clock_source_frequency(source: PsramFunctionClockConfig) -> u32 {
5677                Self::function_clock_config_frequency(source)
5678            }
5679        }
5680        /// Clock tree configuration.
5681        ///
5682        /// The fields of this struct are optional, with the following caveats:
5683        /// - If `XTAL_CLK` is not specified, the crystal frequency will be automatically detected
5684        ///   if possible.
5685        /// - The CPU and its upstream clock nodes will be set to a default configuration.
5686        /// - Other unspecified clock sources will not be useable by peripherals.
5687        #[derive(Debug, Clone, Copy, PartialEq, Eq)]
5688        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
5689        #[instability::unstable]
5690        pub struct ClockConfig {
5691            /// `MPLL_CLK` configuration.
5692            pub mpll_clk: Option<MpllClkConfig>,
5693            /// `CPU_ROOT_CLK` configuration.
5694            pub cpu_root_clk: Option<CpuRootClkConfig>,
5695            /// `CPU_CLK` configuration.
5696            pub cpu_clk: Option<CpuClkConfig>,
5697            /// `MEM_CLK` configuration.
5698            pub mem_clk: Option<MemClkConfig>,
5699            /// `SYS_CLK` configuration.
5700            pub sys_clk: Option<SysClkConfig>,
5701            /// `APB_CLK` configuration.
5702            pub apb_clk: Option<ApbClkConfig>,
5703            /// `LP_FAST_CLK` configuration.
5704            pub lp_fast_clk: Option<LpFastClkConfig>,
5705            /// `LP_SLOW_CLK` configuration.
5706            pub lp_slow_clk: Option<LpSlowClkConfig>,
5707            /// `LP_PERI_CLK` configuration.
5708            pub lp_peri_clk: Option<LpPeriClkConfig>,
5709            /// `BLE_LP_CLK` configuration.
5710            pub ble_lp_clk: Option<BleLpClkConfig>,
5711            /// `CRYPTO_CLK` configuration.
5712            pub crypto_clk: Option<CryptoClkConfig>,
5713            /// `IOMUX_FUNCTION_CLOCK` configuration.
5714            pub iomux_function_clock: Option<IomuxFunctionClockConfig>,
5715            /// `TIMG_CALIBRATION_CLOCK` configuration.
5716            pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
5717        }
5718        impl ClockConfig {
5719            fn apply(&self, clocks: &mut ClockTree) {
5720                if let Some(config) = self.mpll_clk {
5721                    configure_mpll_clk(clocks, config);
5722                }
5723                if let Some(config) = self.cpu_root_clk {
5724                    configure_cpu_root_clk(clocks, config);
5725                }
5726                if let Some(config) = self.cpu_clk {
5727                    configure_cpu_clk(clocks, config);
5728                }
5729                if let Some(config) = self.mem_clk {
5730                    configure_mem_clk(clocks, config);
5731                }
5732                if let Some(config) = self.sys_clk {
5733                    configure_sys_clk(clocks, config);
5734                }
5735                if let Some(config) = self.apb_clk {
5736                    configure_apb_clk(clocks, config);
5737                }
5738                if let Some(config) = self.lp_fast_clk {
5739                    configure_lp_fast_clk(clocks, config);
5740                }
5741                if let Some(config) = self.lp_slow_clk {
5742                    configure_lp_slow_clk(clocks, config);
5743                }
5744                if let Some(config) = self.lp_peri_clk {
5745                    configure_lp_peri_clk(clocks, config);
5746                }
5747                if let Some(config) = self.ble_lp_clk {
5748                    configure_ble_lp_clk(clocks, config);
5749                }
5750                if let Some(config) = self.crypto_clk {
5751                    configure_crypto_clk(clocks, config);
5752                }
5753                if let Some(config) = self.iomux_function_clock {
5754                    configure_iomux_function_clock(clocks, config);
5755                }
5756                if let Some(config) = self.timg_calibration_clock {
5757                    configure_timg_calibration_clock(clocks, config);
5758                }
5759            }
5760        }
5761        fn increment_reference_count(refcount: &mut u32) -> bool {
5762            let first = *refcount == 0;
5763            *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
5764            first
5765        }
5766        fn decrement_reference_count(refcount: &mut u32) -> bool {
5767            *refcount = refcount.saturating_sub(1);
5768            let last = *refcount == 0;
5769            last
5770        }
5771        fn refresh_mpll_clk_downstream(clocks: &mut ClockTree) {
5772            if let Some(config) = clocks.mpll_clk {
5773                MPLL_CLK_FREQ_CACHE.store(
5774                    mpll_clk_config_frequency(config),
5775                    ::core::sync::atomic::Ordering::Release,
5776                );
5777            }
5778            for child_instance in [PsramInstance::Psram] {
5779                refresh_psram_function_clock_downstream(clocks, child_instance);
5780            }
5781        }
5782        fn refresh_rc_fast_clk_downstream(clocks: &mut ClockTree) {
5783            refresh_cpu_root_clk_downstream(clocks);
5784            refresh_lp_fast_clk_downstream(clocks);
5785            refresh_crypto_clk_downstream(clocks);
5786            refresh_timg_calibration_clock_downstream(clocks);
5787            for child_instance in [CordicInstance::Cordic] {
5788                refresh_cordic_function_clock_downstream(clocks, child_instance);
5789            }
5790            for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
5791                refresh_i2c_function_clock_downstream(clocks, child_instance);
5792            }
5793            for child_instance in [ParlIoInstance::ParlIo] {
5794                refresh_parl_io_rx_clock_downstream(clocks, child_instance);
5795                refresh_parl_io_tx_clock_downstream(clocks, child_instance);
5796            }
5797            for child_instance in [RmtInstance::Rmt] {
5798                refresh_rmt_sclk_downstream(clocks, child_instance);
5799            }
5800            for child_instance in [SpiInstance::Spi2, SpiInstance::Spi3] {
5801                refresh_spi_function_clock_downstream(clocks, child_instance);
5802            }
5803            for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
5804                refresh_timg_function_clock_downstream(clocks, child_instance);
5805                refresh_timg_wdt_clock_downstream(clocks, child_instance);
5806            }
5807            for child_instance in [
5808                UartInstance::Uart0,
5809                UartInstance::Uart1,
5810                UartInstance::Uart2,
5811                UartInstance::Uart3,
5812            ] {
5813                refresh_uart_function_clock_downstream(clocks, child_instance);
5814            }
5815        }
5816        fn refresh_rc_slow_clk_downstream(clocks: &mut ClockTree) {
5817            refresh_lp_slow_clk_downstream(clocks);
5818            refresh_timg_calibration_clock_downstream(clocks);
5819        }
5820        fn refresh_cpu_root_clk_downstream(clocks: &mut ClockTree) {
5821            if let Some(config) = clocks.cpu_root_clk {
5822                CPU_ROOT_CLK_FREQ_CACHE.store(
5823                    cpu_root_clk_config_frequency(config),
5824                    ::core::sync::atomic::Ordering::Release,
5825                );
5826            }
5827            refresh_cpu_clk_downstream(clocks);
5828        }
5829        fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
5830            if let Some(config) = clocks.cpu_clk {
5831                CPU_CLK_FREQ_CACHE.store(
5832                    cpu_clk_config_frequency(config),
5833                    ::core::sync::atomic::Ordering::Release,
5834                );
5835            }
5836            refresh_mem_clk_downstream(clocks);
5837            refresh_sys_clk_downstream(clocks);
5838        }
5839        fn refresh_mem_clk_downstream(clocks: &mut ClockTree) {
5840            if let Some(config) = clocks.mem_clk {
5841                MEM_CLK_FREQ_CACHE.store(
5842                    mem_clk_config_frequency(config),
5843                    ::core::sync::atomic::Ordering::Release,
5844                );
5845            }
5846        }
5847        fn refresh_sys_clk_downstream(clocks: &mut ClockTree) {
5848            if let Some(config) = clocks.sys_clk {
5849                SYS_CLK_FREQ_CACHE.store(
5850                    sys_clk_config_frequency(config),
5851                    ::core::sync::atomic::Ordering::Release,
5852                );
5853            }
5854            refresh_apb_clk_downstream(clocks);
5855        }
5856        fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
5857            if let Some(config) = clocks.apb_clk {
5858                APB_CLK_FREQ_CACHE.store(
5859                    apb_clk_config_frequency(config),
5860                    ::core::sync::atomic::Ordering::Release,
5861                );
5862            }
5863        }
5864        fn refresh_lp_fast_clk_downstream(clocks: &mut ClockTree) {
5865            if let Some(config) = clocks.lp_fast_clk {
5866                LP_FAST_CLK_FREQ_CACHE.store(
5867                    lp_fast_clk_config_frequency(config),
5868                    ::core::sync::atomic::Ordering::Release,
5869                );
5870            }
5871            refresh_lp_peri_clk_downstream(clocks);
5872        }
5873        fn refresh_lp_slow_clk_downstream(clocks: &mut ClockTree) {
5874            if let Some(config) = clocks.lp_slow_clk {
5875                LP_SLOW_CLK_FREQ_CACHE.store(
5876                    lp_slow_clk_config_frequency(config),
5877                    ::core::sync::atomic::Ordering::Release,
5878                );
5879            }
5880        }
5881        fn refresh_lp_peri_clk_downstream(clocks: &mut ClockTree) {
5882            if let Some(config) = clocks.lp_peri_clk {
5883                LP_PERI_CLK_FREQ_CACHE.store(
5884                    lp_peri_clk_config_frequency(config),
5885                    ::core::sync::atomic::Ordering::Release,
5886                );
5887            }
5888        }
5889        fn refresh_ble_lp_clk_downstream(clocks: &mut ClockTree) {
5890            if let Some(config) = clocks.ble_lp_clk {
5891                BLE_LP_CLK_FREQ_CACHE.store(
5892                    ble_lp_clk_config_frequency(config),
5893                    ::core::sync::atomic::Ordering::Release,
5894                );
5895            }
5896        }
5897        fn refresh_crypto_clk_downstream(clocks: &mut ClockTree) {
5898            if let Some(config) = clocks.crypto_clk {
5899                CRYPTO_CLK_FREQ_CACHE.store(
5900                    crypto_clk_config_frequency(config),
5901                    ::core::sync::atomic::Ordering::Release,
5902                );
5903            }
5904        }
5905        fn refresh_iomux_function_clock_downstream(clocks: &mut ClockTree) {
5906            if let Some(config) = clocks.iomux_function_clock {
5907                IOMUX_FUNCTION_CLOCK_FREQ_CACHE.store(
5908                    iomux_function_clock_config_frequency(config),
5909                    ::core::sync::atomic::Ordering::Release,
5910                );
5911            }
5912        }
5913        fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
5914            if let Some(config) = clocks.timg_calibration_clock {
5915                TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
5916                    timg_calibration_clock_config_frequency(config),
5917                    ::core::sync::atomic::Ordering::Release,
5918                );
5919            }
5920        }
5921        fn refresh_cordic_function_clock_downstream(
5922            clocks: &mut ClockTree,
5923            instance: CordicInstance,
5924        ) {
5925            if let Some(config) = clocks.cordic_function_clock[instance as usize] {
5926                CORDIC_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5927                    CordicInstance::function_clock_config_frequency(config),
5928                    ::core::sync::atomic::Ordering::Release,
5929                );
5930            }
5931        }
5932        fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
5933            if let Some(config) = clocks.i2c_function_clock[instance as usize] {
5934                I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5935                    I2cInstance::function_clock_config_frequency(config),
5936                    ::core::sync::atomic::Ordering::Release,
5937                );
5938            }
5939        }
5940        fn refresh_i2s_tx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
5941            if let Some(config) = clocks.i2s_tx_clk[instance as usize] {
5942                I2S_TX_CLK_FREQ_CACHE[instance as usize].store(
5943                    I2sInstance::tx_clk_config_frequency(config),
5944                    ::core::sync::atomic::Ordering::Release,
5945                );
5946            }
5947            refresh_i2s_mclk_out_downstream(clocks, instance);
5948        }
5949        fn refresh_i2s_rx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
5950            if let Some(config) = clocks.i2s_rx_clk[instance as usize] {
5951                I2S_RX_CLK_FREQ_CACHE[instance as usize].store(
5952                    I2sInstance::rx_clk_config_frequency(config),
5953                    ::core::sync::atomic::Ordering::Release,
5954                );
5955            }
5956            refresh_i2s_mclk_out_downstream(clocks, instance);
5957        }
5958        fn refresh_i2s_mclk_out_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
5959            if let Some(config) = clocks.i2s_mclk_out[instance as usize] {
5960                I2S_MCLK_OUT_FREQ_CACHE[instance as usize].store(
5961                    instance.mclk_out_config_frequency(config),
5962                    ::core::sync::atomic::Ordering::Release,
5963                );
5964            }
5965        }
5966        fn refresh_lcd_cam_lcd_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
5967            if let Some(config) = clocks.lcd_cam_lcd_clock[instance as usize] {
5968                LCD_CAM_LCD_CLOCK_FREQ_CACHE[instance as usize].store(
5969                    LcdCamInstance::lcd_clock_config_frequency(config),
5970                    ::core::sync::atomic::Ordering::Release,
5971                );
5972            }
5973        }
5974        fn refresh_lcd_cam_cam_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
5975            if let Some(config) = clocks.lcd_cam_cam_clock[instance as usize] {
5976                LCD_CAM_CAM_CLOCK_FREQ_CACHE[instance as usize].store(
5977                    LcdCamInstance::cam_clock_config_frequency(config),
5978                    ::core::sync::atomic::Ordering::Release,
5979                );
5980            }
5981        }
5982        fn refresh_parl_io_rx_clock_downstream(clocks: &mut ClockTree, instance: ParlIoInstance) {
5983            if let Some(config) = clocks.parl_io_rx_clock[instance as usize] {
5984                PARL_IO_RX_CLOCK_FREQ_CACHE[instance as usize].store(
5985                    ParlIoInstance::rx_clock_config_frequency(config),
5986                    ::core::sync::atomic::Ordering::Release,
5987                );
5988            }
5989        }
5990        fn refresh_parl_io_tx_clock_downstream(clocks: &mut ClockTree, instance: ParlIoInstance) {
5991            if let Some(config) = clocks.parl_io_tx_clock[instance as usize] {
5992                PARL_IO_TX_CLOCK_FREQ_CACHE[instance as usize].store(
5993                    ParlIoInstance::tx_clock_config_frequency(config),
5994                    ::core::sync::atomic::Ordering::Release,
5995                );
5996            }
5997        }
5998        fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
5999            if let Some(config) = clocks.rmt_sclk[instance as usize] {
6000                RMT_SCLK_FREQ_CACHE[instance as usize].store(
6001                    RmtInstance::sclk_config_frequency(config),
6002                    ::core::sync::atomic::Ordering::Release,
6003                );
6004            }
6005        }
6006        fn refresh_spi_function_clock_downstream(clocks: &mut ClockTree, instance: SpiInstance) {
6007            if let Some(config) = clocks.spi_function_clock[instance as usize] {
6008                SPI_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
6009                    SpiInstance::function_clock_config_frequency(config),
6010                    ::core::sync::atomic::Ordering::Release,
6011                );
6012            }
6013        }
6014        fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
6015            if let Some(config) = clocks.timg_function_clock[instance as usize] {
6016                TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
6017                    TimgInstance::function_clock_config_frequency(config),
6018                    ::core::sync::atomic::Ordering::Release,
6019                );
6020            }
6021        }
6022        fn refresh_timg_wdt_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
6023            if let Some(config) = clocks.timg_wdt_clock[instance as usize] {
6024                TIMG_WDT_CLOCK_FREQ_CACHE[instance as usize].store(
6025                    TimgInstance::wdt_clock_config_frequency(config),
6026                    ::core::sync::atomic::Ordering::Release,
6027                );
6028            }
6029        }
6030        fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
6031            if let Some(config) = clocks.uart_function_clock[instance as usize] {
6032                UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
6033                    UartInstance::function_clock_config_frequency(config),
6034                    ::core::sync::atomic::Ordering::Release,
6035                );
6036            }
6037            refresh_uart_baud_rate_generator_downstream(clocks, instance);
6038        }
6039        fn refresh_uart_baud_rate_generator_downstream(
6040            clocks: &mut ClockTree,
6041            instance: UartInstance,
6042        ) {
6043            if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
6044                UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
6045                    instance.baud_rate_generator_config_frequency(config),
6046                    ::core::sync::atomic::Ordering::Release,
6047                );
6048            }
6049        }
6050        fn refresh_psram_function_clock_downstream(
6051            clocks: &mut ClockTree,
6052            instance: PsramInstance,
6053        ) {
6054            if let Some(config) = clocks.psram_function_clock[instance as usize] {
6055                PSRAM_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
6056                    PsramInstance::function_clock_config_frequency(config),
6057                    ::core::sync::atomic::Ordering::Release,
6058                );
6059            }
6060        }
6061    };
6062}
6063/// Implement the `Peripheral` enum and enable/disable/reset functions.
6064///
6065/// This macro is intended to be placed in `esp_hal::system`.
6066#[macro_export]
6067#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6068macro_rules! implement_peripheral_clocks {
6069    () => {
6070        #[doc(hidden)]
6071        #[derive(Debug, Clone, Copy, PartialEq, Eq)]
6072        #[repr(u8)]
6073        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6074        pub enum Peripheral {
6075            /// AES peripheral clock signal
6076            Aes,
6077            /// AHB_GDMA peripheral clock signal
6078            AhbGdma,
6079            /// APB_SAR_ADC peripheral clock signal
6080            ApbSarAdc,
6081            /// AXI_GDMA peripheral clock signal
6082            AxiGdma,
6083            /// CORDIC peripheral clock signal
6084            Cordic,
6085            /// DAC peripheral clock signal
6086            Dac,
6087            /// DMA2D peripheral clock signal
6088            Dma2d,
6089            /// ECC peripheral clock signal
6090            Ecc,
6091            /// EMAC peripheral clock signal
6092            Emac,
6093            /// GPIO_SD peripheral clock signal
6094            GpioSd,
6095            /// I2C0 peripheral clock signal
6096            I2c0,
6097            /// I2C1 peripheral clock signal
6098            I2c1,
6099            /// I2S0 peripheral clock signal
6100            I2s0,
6101            /// I2S1 peripheral clock signal
6102            I2s1,
6103            /// LCD_CAM peripheral clock signal
6104            LcdCam,
6105            /// PARL_IO peripheral clock signal
6106            ParlIo,
6107            /// PCNT peripheral clock signal
6108            Pcnt,
6109            /// PCNT1 peripheral clock signal
6110            Pcnt1,
6111            /// PPA peripheral clock signal
6112            Ppa,
6113            /// RMT peripheral clock signal
6114            Rmt,
6115            /// RSA peripheral clock signal
6116            Rsa,
6117            /// SDIO_HOST peripheral clock signal
6118            SdioHost,
6119            /// SHA peripheral clock signal
6120            Sha,
6121            /// SPI2 peripheral clock signal
6122            Spi2,
6123            /// SPI3 peripheral clock signal
6124            Spi3,
6125            /// SYSTIMER peripheral clock signal
6126            Systimer,
6127            /// TIMG0 peripheral clock signal
6128            Timg0,
6129            /// TIMG1 peripheral clock signal
6130            Timg1,
6131            /// TSENS peripheral clock signal
6132            Tsens,
6133            /// UART0 peripheral clock signal
6134            Uart0,
6135            /// UART1 peripheral clock signal
6136            Uart1,
6137            /// UART2 peripheral clock signal
6138            Uart2,
6139            /// UART3 peripheral clock signal
6140            Uart3,
6141            /// UHCI0 peripheral clock signal
6142            Uhci0,
6143            /// USB_DEVICE peripheral clock signal
6144            UsbDevice,
6145            /// USB_HS peripheral clock signal
6146            UsbHs,
6147        }
6148        impl Peripheral {
6149            const KEEP_ENABLED: &[Peripheral] = &[
6150                Self::ApbSarAdc,
6151                Self::Systimer,
6152                Self::Timg0,
6153                Self::Uart0,
6154                Self::UsbDevice,
6155            ];
6156            const COUNT: usize = Self::ALL.len();
6157            const ALL: &[Self] = &[
6158                Self::Aes,
6159                Self::AhbGdma,
6160                Self::ApbSarAdc,
6161                Self::AxiGdma,
6162                Self::Cordic,
6163                Self::Dac,
6164                Self::Dma2d,
6165                Self::Ecc,
6166                Self::Emac,
6167                Self::GpioSd,
6168                Self::I2c0,
6169                Self::I2c1,
6170                Self::I2s0,
6171                Self::I2s1,
6172                Self::LcdCam,
6173                Self::ParlIo,
6174                Self::Pcnt,
6175                Self::Pcnt1,
6176                Self::Ppa,
6177                Self::Rmt,
6178                Self::Rsa,
6179                Self::SdioHost,
6180                Self::Sha,
6181                Self::Spi2,
6182                Self::Spi3,
6183                Self::Systimer,
6184                Self::Timg0,
6185                Self::Timg1,
6186                Self::Tsens,
6187                Self::Uart0,
6188                Self::Uart1,
6189                Self::Uart2,
6190                Self::Uart3,
6191                Self::Uhci0,
6192                Self::UsbDevice,
6193                Self::UsbHs,
6194            ];
6195        }
6196        unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
6197            match peripheral {
6198                Peripheral::Aes => {
6199                    crate::peripherals::HP_SYS_CLKRST::regs()
6200                        .crypto_ctrl0()
6201                        .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
6202                }
6203                Peripheral::AhbGdma => {
6204                    crate::peripherals::HP_SYS_CLKRST::regs()
6205                        .ahb_pdma_ctrl0()
6206                        .modify(|_, w| w.sys_clk_en().bit(enable));
6207                }
6208                Peripheral::ApbSarAdc => {
6209                    crate::peripherals::LP_PERI::regs()
6210                        .adc_ctrl()
6211                        .modify(|_, w| w.lp_adc_clk_en().bit(enable));
6212                }
6213                Peripheral::AxiGdma => {
6214                    crate::peripherals::HP_SYS_CLKRST::regs()
6215                        .axi_pdma_ctrl0()
6216                        .modify(|_, w| w.sys_clk_en().bit(enable));
6217                }
6218                Peripheral::Cordic => {
6219                    crate::peripherals::HP_SYS_CLKRST::regs()
6220                        .cordic_ctrl0()
6221                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6222                }
6223                Peripheral::Dac => {
6224                    let reg = crate::peripherals::LP_PERI::regs().dac_ctrl();
6225                    if enable {
6226                        reg.write(|w| unsafe {
6227                            w.lp_dac_clk_sel().bits(1).lp_dac_clk_en().set_bit()
6228                        });
6229                    } else {
6230                        reg.modify(|_, w| w.lp_dac_clk_en().clear_bit());
6231                    }
6232                }
6233                Peripheral::Dma2d => {
6234                    crate::peripherals::HP_SYS_CLKRST::regs()
6235                        .dma2d_ctrl0()
6236                        .modify(|_, w| w.sys_clk_en().bit(enable));
6237                }
6238                Peripheral::Ecc => {
6239                    crate::peripherals::HP_SYS_CLKRST::regs()
6240                        .crypto_ctrl0()
6241                        .modify(|_, w| w.crypto_ecc_clk_en().bit(enable));
6242                }
6243                Peripheral::Emac => {
6244                    crate::peripherals::HP_SYS_CLKRST::regs()
6245                        .emac_ctrl0()
6246                        .modify(|_, w| w.sys_clk_en().bit(enable));
6247                }
6248                Peripheral::GpioSd => {
6249                    crate::peripherals::GPIO_SD::regs()
6250                        .clock_gate()
6251                        .modify(|_, w| w.clk_en().bit(enable));
6252                }
6253                Peripheral::I2c0 => {
6254                    crate::peripherals::HP_SYS_CLKRST::regs()
6255                        .i2c_ctrl0(0)
6256                        .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
6257                }
6258                Peripheral::I2c1 => {
6259                    crate::peripherals::HP_SYS_CLKRST::regs()
6260                        .i2c_ctrl0(1)
6261                        .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
6262                }
6263                Peripheral::I2s0 => {
6264                    crate::peripherals::HP_SYS_CLKRST::regs()
6265                        .i2s0_ctrl0()
6266                        .modify(|_, w| w.apb_clk_en().bit(enable));
6267                    crate::peripherals::HP_ALIVE_SYS::regs()
6268                        .hp_pad_i2s0_ctrl()
6269                        .modify(|_, w| w.hp_pad_i2s0_mclk_en().bit(enable));
6270                }
6271                Peripheral::I2s1 => {
6272                    crate::peripherals::HP_SYS_CLKRST::regs()
6273                        .i2s1_ctrl0()
6274                        .modify(|_, w| w.apb_clk_en().bit(enable));
6275                    crate::peripherals::HP_ALIVE_SYS::regs()
6276                        .hp_pad_i2s1_ctrl()
6277                        .modify(|_, w| w.hp_pad_i2s1_mclk_en().bit(enable));
6278                }
6279                Peripheral::LcdCam => {
6280                    crate::peripherals::HP_SYS_CLKRST::regs()
6281                        .lcdcam_ctrl0()
6282                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6283                }
6284                Peripheral::ParlIo => {
6285                    crate::peripherals::HP_SYS_CLKRST::regs()
6286                        .parlio_ctrl0()
6287                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6288                }
6289                Peripheral::Pcnt => {
6290                    crate::peripherals::HP_SYS_CLKRST::regs()
6291                        .pcnt_ctrl0()
6292                        .modify(|_, w| w.pcnt0_apb_clk_en().bit(enable));
6293                }
6294                Peripheral::Pcnt1 => {
6295                    crate::peripherals::HP_SYS_CLKRST::regs()
6296                        .pcnt_ctrl0()
6297                        .modify(|_, w| w.pcnt1_apb_clk_en().bit(enable));
6298                }
6299                Peripheral::Ppa => {
6300                    crate::peripherals::HP_SYS_CLKRST::regs()
6301                        .ppa_ctrl0()
6302                        .modify(|_, w| w.sys_clk_en().bit(enable));
6303                }
6304                Peripheral::Rmt => {
6305                    crate::peripherals::HP_SYS_CLKRST::regs()
6306                        .rmt_ctrl0()
6307                        .modify(|_, w| w.sys_clk_en().bit(enable));
6308                }
6309                Peripheral::Rsa => {
6310                    crate::peripherals::HP_SYS_CLKRST::regs()
6311                        .crypto_ctrl0()
6312                        .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
6313                }
6314                Peripheral::SdioHost => {
6315                    crate::peripherals::HP_SYS_CLKRST::regs()
6316                        .sdio_host_ctrl0()
6317                        .modify(|_, w| w.sys_clk_en().bit(enable));
6318                }
6319                Peripheral::Sha => {
6320                    crate::peripherals::HP_SYS_CLKRST::regs()
6321                        .crypto_ctrl0()
6322                        .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
6323                }
6324                Peripheral::Spi2 => {
6325                    crate::peripherals::HP_SYS_CLKRST::regs()
6326                        .gpspi2_ctrl0()
6327                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6328                }
6329                Peripheral::Spi3 => {
6330                    crate::peripherals::HP_SYS_CLKRST::regs()
6331                        .gpspi3_ctrl0()
6332                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6333                }
6334                Peripheral::Systimer => {
6335                    crate::peripherals::HP_SYS_CLKRST::regs()
6336                        .systimer_ctrl0()
6337                        .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
6338                }
6339                Peripheral::Timg0 => {
6340                    crate::peripherals::HP_SYS_CLKRST::regs()
6341                        .timergrp0_ctrl0()
6342                        .modify(|_, w| w.apb_clk_en().bit(enable));
6343                }
6344                Peripheral::Timg1 => {
6345                    crate::peripherals::HP_SYS_CLKRST::regs()
6346                        .timergrp1_ctrl0()
6347                        .modify(|_, w| w.apb_clk_en().bit(enable));
6348                }
6349                Peripheral::Tsens => {
6350                    crate::peripherals::LP_PERI::regs()
6351                        .tsens_ctrl()
6352                        .modify(|_, w| w.lp_tsens_clk_en().bit(enable));
6353                }
6354                Peripheral::Uart0 => {
6355                    crate::peripherals::HP_SYS_CLKRST::regs()
6356                        .uart_ctrl0(0)
6357                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6358                }
6359                Peripheral::Uart1 => {
6360                    crate::peripherals::HP_SYS_CLKRST::regs()
6361                        .uart_ctrl0(1)
6362                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6363                }
6364                Peripheral::Uart2 => {
6365                    crate::peripherals::HP_SYS_CLKRST::regs()
6366                        .uart_ctrl0(2)
6367                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6368                }
6369                Peripheral::Uart3 => {
6370                    crate::peripherals::HP_SYS_CLKRST::regs()
6371                        .uart_ctrl0(3)
6372                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6373                }
6374                Peripheral::Uhci0 => {
6375                    crate::peripherals::HP_SYS_CLKRST::regs()
6376                        .uhci_ctrl0()
6377                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6378                }
6379                Peripheral::UsbDevice => {
6380                    crate::peripherals::HP_SYS_CLKRST::regs()
6381                        .usb_device_ctrl0()
6382                        .modify(|_, w| w.apb_clk_en().bit(enable));
6383                    crate::peripherals::CNNT_SYS::regs()
6384                        .sys_hp_usb_device_ctrl()
6385                        .modify(|_, w| w.sys_usb_device_48m_clk_en().bit(enable));
6386                }
6387                Peripheral::UsbHs => {
6388                    crate::peripherals::HP_SYS_CLKRST::regs()
6389                        .usb_otghs_ctrl0()
6390                        .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
6391                }
6392            }
6393        }
6394        unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
6395            match peripheral {
6396                Peripheral::Aes => {
6397                    crate::peripherals::HP_SYS_CLKRST::regs()
6398                        .crypto_ctrl0()
6399                        .modify(|_, w| w.crypto_aes_rst_en().bit(reset));
6400                }
6401                Peripheral::AhbGdma => {
6402                    crate::peripherals::HP_SYS_CLKRST::regs()
6403                        .ahb_pdma_ctrl0()
6404                        .modify(|_, w| w.rst_en().bit(reset));
6405                }
6406                Peripheral::ApbSarAdc => {
6407                    crate::peripherals::LP_PERI::regs()
6408                        .adc_ctrl()
6409                        .modify(|_, w| w.lp_adc_rst_en().bit(reset));
6410                }
6411                Peripheral::AxiGdma => {
6412                    crate::peripherals::HP_SYS_CLKRST::regs()
6413                        .axi_pdma_ctrl0()
6414                        .modify(|_, w| w.rst_en().bit(reset));
6415                }
6416                Peripheral::Cordic => {
6417                    crate::peripherals::HP_SYS_CLKRST::regs()
6418                        .cordic_ctrl0()
6419                        .modify(|_, w| {
6420                            w.apb_rst_en()
6421                                .bit(reset)
6422                                .sys_rst_en()
6423                                .bit(reset)
6424                                .core_rst_en()
6425                                .bit(reset)
6426                        });
6427                }
6428                Peripheral::Dac => {
6429                    crate::peripherals::LP_PERI::regs()
6430                        .dac_ctrl()
6431                        .modify(|_, w| w.lp_dac_rst_en().bit(reset));
6432                }
6433                Peripheral::Dma2d => {
6434                    crate::peripherals::HP_SYS_CLKRST::regs()
6435                        .dma2d_ctrl0()
6436                        .modify(|_, w| w.rst_en().bit(reset));
6437                }
6438                Peripheral::Ecc => {
6439                    crate::peripherals::HP_SYS_CLKRST::regs()
6440                        .crypto_ctrl0()
6441                        .modify(|_, w| w.crypto_ecc_rst_en().bit(reset));
6442                }
6443                Peripheral::Emac => {
6444                    let _ = reset;
6445                }
6446                Peripheral::GpioSd => {
6447                    let _ = reset;
6448                }
6449                Peripheral::I2c0 => {
6450                    crate::peripherals::HP_SYS_CLKRST::regs()
6451                        .i2c_ctrl0(0)
6452                        .modify(|_, w| w.rst_en().bit(reset));
6453                }
6454                Peripheral::I2c1 => {
6455                    crate::peripherals::HP_SYS_CLKRST::regs()
6456                        .i2c_ctrl0(1)
6457                        .modify(|_, w| w.rst_en().bit(reset));
6458                }
6459                Peripheral::I2s0 => {
6460                    crate::peripherals::HP_SYS_CLKRST::regs()
6461                        .i2s0_ctrl0()
6462                        .modify(|_, w| w.apb_rst_en().bit(reset));
6463                }
6464                Peripheral::I2s1 => {
6465                    crate::peripherals::HP_SYS_CLKRST::regs()
6466                        .i2s1_ctrl0()
6467                        .modify(|_, w| w.apb_rst_en().bit(reset));
6468                }
6469                Peripheral::LcdCam => {
6470                    crate::peripherals::HP_SYS_CLKRST::regs()
6471                        .lcdcam_ctrl0()
6472                        .modify(|_, w| w.apb_rst_en().bit(reset).rst_en().bit(reset));
6473                }
6474                Peripheral::ParlIo => {
6475                    crate::peripherals::HP_SYS_CLKRST::regs()
6476                        .parlio_ctrl0()
6477                        .modify(|_, w| w.rst_en().bit(reset));
6478                }
6479                Peripheral::Pcnt => {
6480                    crate::peripherals::HP_SYS_CLKRST::regs()
6481                        .pcnt_ctrl0()
6482                        .modify(|_, w| w.pcnt0_rst_en().bit(reset));
6483                }
6484                Peripheral::Pcnt1 => {
6485                    crate::peripherals::HP_SYS_CLKRST::regs()
6486                        .pcnt_ctrl0()
6487                        .modify(|_, w| w.pcnt1_rst_en().bit(reset));
6488                }
6489                Peripheral::Ppa => {
6490                    crate::peripherals::HP_SYS_CLKRST::regs()
6491                        .ppa_ctrl0()
6492                        .modify(|_, w| w.rst_en().bit(reset));
6493                }
6494                Peripheral::Rmt => {
6495                    crate::peripherals::HP_SYS_CLKRST::regs()
6496                        .rmt_ctrl0()
6497                        .modify(|_, w| w.rst_en().bit(reset));
6498                }
6499                Peripheral::Rsa => {
6500                    crate::peripherals::HP_SYS_CLKRST::regs()
6501                        .crypto_ctrl0()
6502                        .modify(|_, w| w.crypto_rsa_rst_en().bit(reset));
6503                }
6504                Peripheral::SdioHost => {
6505                    crate::peripherals::CNNT_SYS::regs()
6506                        .sys_hp_sdmmc_ctrl()
6507                        .modify(|_, w| w.sys_sdmmc_rst_en().bit(reset));
6508                }
6509                Peripheral::Sha => {
6510                    crate::peripherals::HP_SYS_CLKRST::regs()
6511                        .crypto_ctrl0()
6512                        .modify(|_, w| w.crypto_sha_rst_en().bit(reset));
6513                }
6514                Peripheral::Spi2 => {
6515                    crate::peripherals::HP_SYS_CLKRST::regs()
6516                        .gpspi2_ctrl0()
6517                        .modify(|_, w| w.rst_en().bit(reset));
6518                }
6519                Peripheral::Spi3 => {
6520                    crate::peripherals::HP_SYS_CLKRST::regs()
6521                        .gpspi3_ctrl0()
6522                        .modify(|_, w| w.rst_en().bit(reset));
6523                }
6524                Peripheral::Systimer => {
6525                    crate::peripherals::HP_SYS_CLKRST::regs()
6526                        .systimer_ctrl0()
6527                        .modify(|_, w| w.rst_en().bit(reset));
6528                }
6529                Peripheral::Timg0 => {
6530                    crate::peripherals::HP_SYS_CLKRST::regs()
6531                        .timergrp0_ctrl0()
6532                        .modify(|_, w| w.rst_en().bit(reset));
6533                }
6534                Peripheral::Timg1 => {
6535                    crate::peripherals::HP_SYS_CLKRST::regs()
6536                        .timergrp1_ctrl0()
6537                        .modify(|_, w| w.rst_en().bit(reset));
6538                }
6539                Peripheral::Tsens => {
6540                    crate::peripherals::LP_PERI::regs()
6541                        .tsens_ctrl()
6542                        .modify(|_, w| w.lp_tsens_rst_en().bit(reset));
6543                }
6544                Peripheral::Uart0 => {
6545                    crate::peripherals::HP_SYS_CLKRST::regs()
6546                        .uart_ctrl0(0)
6547                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
6548                }
6549                Peripheral::Uart1 => {
6550                    crate::peripherals::HP_SYS_CLKRST::regs()
6551                        .uart_ctrl0(1)
6552                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
6553                }
6554                Peripheral::Uart2 => {
6555                    crate::peripherals::HP_SYS_CLKRST::regs()
6556                        .uart_ctrl0(2)
6557                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
6558                }
6559                Peripheral::Uart3 => {
6560                    crate::peripherals::HP_SYS_CLKRST::regs()
6561                        .uart_ctrl0(3)
6562                        .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
6563                }
6564                Peripheral::Uhci0 => {
6565                    crate::peripherals::HP_SYS_CLKRST::regs()
6566                        .uhci_ctrl0()
6567                        .modify(|_, w| w.rst_en().bit(reset));
6568                }
6569                Peripheral::UsbDevice => {
6570                    crate::peripherals::CNNT_SYS::regs()
6571                        .sys_hp_usb_device_ctrl()
6572                        .modify(|_, w| w.sys_usb_device_rst_en().bit(reset));
6573                }
6574                Peripheral::UsbHs => {
6575                    let _ = reset;
6576                }
6577            }
6578        }
6579    };
6580}
6581/// Macro to get the address range of the given memory region.
6582///
6583/// This macro provides two syntax options for each memory region:
6584///
6585/// - `memory_range!("region_name")` returns the address range as a range expression (`start..end`).
6586/// - `memory_range!(size as str, "region_name")` returns the size of the region as a string
6587///   literal.
6588#[macro_export]
6589#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6590macro_rules! memory_range {
6591    ("DRAM") => {
6592        0x2F000000..0x2F080000
6593    };
6594    (size as str, "DRAM") => {
6595        "524288"
6596    };
6597    ("DRAM2_UNINIT") => {
6598        0x2F06CFB0..0x2F07CFB0
6599    };
6600    (size as str, "DRAM2_UNINIT") => {
6601        "65536"
6602    };
6603    ("IROM") => {
6604        0x40000000..0x50000000
6605    };
6606    (size as str, "IROM") => {
6607        "268435456"
6608    };
6609    ("DROM") => {
6610        0x40000000..0x50000000
6611    };
6612    (size as str, "DROM") => {
6613        "268435456"
6614    };
6615}
6616/// This macro can be used to generate code for each peripheral instance of the I2C master driver.
6617///
6618/// For an explanation on the general syntax, as well as usage of individual/repeated
6619/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6620///
6621/// This macro has one option for its "Individual matcher" case:
6622///
6623/// Syntax: `($id:literal, $instance:ident, $sys:ident, $scl:ident, $sda:ident)`
6624///
6625/// Macro fragments:
6626/// - `$id`: the index of the I2C instance
6627/// - `$instance`: the name of the I2C instance
6628/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
6629/// - `$scl`, `$sda`: peripheral signal names.
6630///
6631/// Example data: `(0, I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)`
6632#[macro_export]
6633#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6634macro_rules! for_each_i2c_master {
6635    ($($pattern:tt => $code:tt;)*) => {
6636        macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
6637        => {} } _for_each_inner_i2c_master!((0, I2C0, I2c0, I2CEXT0_SCL, I2CEXT0_SDA));
6638        _for_each_inner_i2c_master!((1, I2C1, I2c1, I2CEXT1_SCL, I2CEXT1_SDA));
6639        _for_each_inner_i2c_master!((all(0, I2C0, I2c0, I2CEXT0_SCL, I2CEXT0_SDA), (1,
6640        I2C1, I2c1, I2CEXT1_SCL, I2CEXT1_SDA)));
6641    };
6642}
6643/// This macro can be used to generate code for each peripheral instance of the I2S driver.
6644///
6645/// For an explanation on the general syntax, as well as usage of individual/repeated
6646/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6647///
6648/// This macro has one option for its "Individual matcher" case:
6649///
6650/// Syntax: `($instance:ident, $sys:ident, $mclk:ident, $bclk:ident, $ws:ident, $bclk_rx:ident,
6651/// $ws_rx:ident, [$($dout:ident),*], [$($din:ident),*], $pdm_tx:literal, $pdm_rx:literal,
6652/// $pcm2pdm:literal, $pdm2pcm:literal)`
6653///
6654/// Macro fragments:
6655///
6656/// - `$instance`: the name of the I2S instance
6657/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
6658/// - `$mclk`: the MCLK output signal (a placeholder on chips without a GPIO-matrix MCLK).
6659/// - `$bclk`, `$ws`: TX bit clock and word select output signals.
6660/// - `$bclk_rx`, `$ws_rx`: RX bit clock and word select output signals.
6661/// - `$dout`, `$din`: data-out and data-in signal names.
6662/// - `$pdm_tx`, `$pdm_rx`: whether the instance supports PDM TX/RX.
6663/// - `$pcm2pdm`, `$pdm2pcm`: whether the instance supports the hardware PCM<->PDM format conversion
6664///   filter on TX/RX.
6665///
6666/// Example data:
6667/// - `(I2S0, I2s0, I2S_MCLK, I2SO_BCK, I2SO_WS, I2SI_BCK, I2SI_WS, [I2SO_SD], [I2SI_SD], true,
6668///   true, true, true)`
6669#[macro_export]
6670#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6671macro_rules! for_each_i2s {
6672    ($($pattern:tt => $code:tt;)*) => {
6673        macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
6674        _for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S1));
6675        _for_each_inner_i2s!((I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
6676        I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
6677        true, true, true, true)); _for_each_inner_i2s!((I2S1, I2s1, I2S1_MCLK, I2S1O_BCK,
6678        I2S1O_WS, I2S1I_BCK, I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false,
6679        false)); _for_each_inner_i2s!((names(I2S0), (I2S1)));
6680        _for_each_inner_i2s!((all(I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
6681        I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
6682        true, true, true, true), (I2S1, I2s1, I2S1_MCLK, I2S1O_BCK, I2S1O_WS, I2S1I_BCK,
6683        I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false, false)));
6684    };
6685}
6686/// This macro can be used to generate code for each peripheral instance of the UART driver.
6687///
6688/// For an explanation on the general syntax, as well as usage of individual/repeated
6689/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6690///
6691/// This macro has one option for its "Individual matcher" case:
6692///
6693/// Syntax: `($id:literal, $instance:ident, $sys:ident, $rx:ident, $tx:ident, $cts:ident,
6694/// $rts:ident)`
6695///
6696/// Macro fragments:
6697///
6698/// - `$id`: the index of the UART instance
6699/// - `$instance`: the name of the UART instance
6700/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
6701/// - `$rx`, `$tx`, `$cts`, `$rts`: signal names.
6702///
6703/// Example data: `(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS)`
6704#[macro_export]
6705#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6706macro_rules! for_each_uart {
6707    ($($pattern:tt => $code:tt;)*) => {
6708        macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
6709        } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
6710        wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
6711        U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((2, UART2, Uart2,
6712        U2RXD, U2TXD, U2CTS, U2RTS, wakeup_source = false)); _for_each_inner_uart!((3,
6713        UART3, Uart3, U3RXD, U3TXD, U3CTS, U3RTS, wakeup_source = false));
6714        _for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
6715        wakeup_source = true), (1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS,
6716        wakeup_source = true), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS,
6717        wakeup_source = false), (3, UART3, Uart3, U3RXD, U3TXD, U3CTS, U3RTS,
6718        wakeup_source = false)));
6719    };
6720}
6721/// This macro can be used to generate code for each peripheral instance of the SPI master driver.
6722///
6723/// For an explanation on the general syntax, as well as usage of individual/repeated
6724/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6725///
6726/// This macro has one option for its "Individual matcher" case:
6727///
6728/// Syntax: `($instance:ident, $sys:ident, $sclk:ident [$($cs:ident),*] [$($sio:ident),*]
6729/// $($is_qspi:literal)?)`
6730///
6731/// Macro fragments:
6732///
6733/// - `$instance`: the name of the SPI instance
6734/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
6735/// - `$cs`, `$sio`: chip select and SIO signal names.
6736/// - `$is_qspi`: a `true` literal present if the SPI instance supports QSPI.
6737///
6738/// Example data:
6739/// - `(SPI2, Spi2, FSPICLK [FSPICS0, FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ,
6740///   FSPIWP, FSPIHD, FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7], true)`
6741/// - `(SPI3, Spi3, SPI3_CLK [SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q])`
6742#[macro_export]
6743#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6744macro_rules! for_each_spi_master {
6745    ($($pattern:tt => $code:tt;)*) => {
6746        macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
6747        => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
6748        _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
6749        FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
6750        FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
6751        SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD],
6752        true)); _for_each_inner_spi_master!((names(SPI2), (SPI3)));
6753        _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
6754        FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
6755        FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2]
6756        [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD], true)));
6757    };
6758}
6759/// This macro can be used to generate code for each peripheral instance of the SPI slave driver.
6760///
6761/// For an explanation on the general syntax, as well as usage of individual/repeated
6762/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6763///
6764/// This macro has one option for its "Individual matcher" case:
6765///
6766/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, $mosi:ident, $miso:ident, $cs:ident)`
6767///
6768/// Macro fragments:
6769///
6770/// - `$instance`: the name of the SPI instance
6771/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
6772/// - `$sclk`, `$mosi`, `$miso`, `$cs`: signal names.
6773///
6774/// Example data: `(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)`
6775#[macro_export]
6776#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6777macro_rules! for_each_spi_slave {
6778    ($($pattern:tt => $code:tt;)*) => {
6779        macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
6780        => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
6781        _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
6782        _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS));
6783        _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
6784        _for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
6785        (SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS)));
6786    };
6787}
6788/// This macro can be used to generate code for each PCNT unit.
6789///
6790/// For an explanation on the general syntax, as well as usage of individual/repeated
6791/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6792///
6793/// This macro has four options for its "Individual matcher" case:
6794///
6795/// - `names`: `($instance:ident)`
6796/// - `all`: `($peri:ident, $variant:ident, $sys:ident, $regs:ident, $unit:literal,
6797///   $interrupt:ident, $sig_ch0:ident, $sig_ch1:ident, $ctrl_ch0:ident, $ctrl_ch1:ident)`
6798/// - `interrupt`: `($interrupt:ident)` (repeated: one ident per unique IRQ)
6799/// - `regs`: `($regs:ident)` (repeated: one ident per register block)
6800///
6801/// Macro fragments:
6802///
6803/// - `$peri`: unit singleton name (`PCNT0_UNIT0`, `PCNT1_UNIT0`, …)
6804/// - `$variant`: `AnyPcntUnit` enum variant (`Pcnt0Unit0`, `Pcnt1Unit0`, …)
6805/// - `$sys`: `esp_hal::system::Peripheral` variant for clocks
6806/// - `$regs`: register-block singleton (`PCNT`, `PCNT1`)
6807/// - `$unit`: hardware unit index within that register block
6808/// - `$interrupt`: shared peripheral interrupt
6809/// - `$sig_ch0`, `$sig_ch1`, `$ctrl_ch0`, `$ctrl_ch1`: GPIO matrix input signals
6810#[macro_export]
6811#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6812macro_rules! for_each_pcnt_unit {
6813    ($($pattern:tt => $code:tt;)*) => {
6814        macro_rules! _for_each_inner_pcnt_unit { $(($pattern) => $code;)* ($other : tt)
6815        => {} } _for_each_inner_pcnt_unit!((PCNT0_UNIT0));
6816        _for_each_inner_pcnt_unit!((PCNT0_UNIT1));
6817        _for_each_inner_pcnt_unit!((PCNT0_UNIT2));
6818        _for_each_inner_pcnt_unit!((PCNT0_UNIT3));
6819        _for_each_inner_pcnt_unit!((PCNT1_UNIT0));
6820        _for_each_inner_pcnt_unit!((PCNT1_UNIT1));
6821        _for_each_inner_pcnt_unit!((PCNT1_UNIT2));
6822        _for_each_inner_pcnt_unit!((PCNT1_UNIT3));
6823        _for_each_inner_pcnt_unit!((PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT0,
6824        PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1));
6825        _for_each_inner_pcnt_unit!((PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT0,
6826        PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0, PCNT1_CTRL_CH1));
6827        _for_each_inner_pcnt_unit!((PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT0,
6828        PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1));
6829        _for_each_inner_pcnt_unit!((PCNT0_UNIT3, Pcnt0Unit3, Pcnt, PCNT, 3, PCNT0,
6830        PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1));
6831        _for_each_inner_pcnt_unit!((PCNT1_UNIT0, Pcnt1Unit0, Pcnt1, PCNT1, 0, PCNT1,
6832        PCNT1_U0_SIG_CH0, PCNT1_U0_SIG_CH1, PCNT1_U0_CTRL_CH0, PCNT1_U0_CTRL_CH1));
6833        _for_each_inner_pcnt_unit!((PCNT1_UNIT1, Pcnt1Unit1, Pcnt1, PCNT1, 1, PCNT1,
6834        PCNT1_U1_SIG_CH0, PCNT1_U1_SIG_CH1, PCNT1_U1_CTRL_CH0, PCNT1_U1_CTRL_CH1));
6835        _for_each_inner_pcnt_unit!((PCNT1_UNIT2, Pcnt1Unit2, Pcnt1, PCNT1, 2, PCNT1,
6836        PCNT1_U2_SIG_CH0, PCNT1_U2_SIG_CH1, PCNT1_U2_CTRL_CH0, PCNT1_U2_CTRL_CH1));
6837        _for_each_inner_pcnt_unit!((PCNT1_UNIT3, Pcnt1Unit3, Pcnt1, PCNT1, 3, PCNT1,
6838        PCNT1_U3_SIG_CH0, PCNT1_U3_SIG_CH1, PCNT1_U3_CTRL_CH0, PCNT1_U3_CTRL_CH1));
6839        _for_each_inner_pcnt_unit!((PCNT0)); _for_each_inner_pcnt_unit!((PCNT1));
6840        _for_each_inner_pcnt_unit!((PCNT)); _for_each_inner_pcnt_unit!((PCNT1));
6841        _for_each_inner_pcnt_unit!((names(PCNT0_UNIT0), (PCNT0_UNIT1), (PCNT0_UNIT2),
6842        (PCNT0_UNIT3), (PCNT1_UNIT0), (PCNT1_UNIT1), (PCNT1_UNIT2), (PCNT1_UNIT3)));
6843        _for_each_inner_pcnt_unit!((all(PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT0,
6844        PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1), (PCNT0_UNIT1,
6845        Pcnt0Unit1, Pcnt, PCNT, 1, PCNT0, PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0,
6846        PCNT1_CTRL_CH1), (PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT0, PCNT2_SIG_CH0,
6847        PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1), (PCNT0_UNIT3, Pcnt0Unit3, Pcnt,
6848        PCNT, 3, PCNT0, PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1),
6849        (PCNT1_UNIT0, Pcnt1Unit0, Pcnt1, PCNT1, 0, PCNT1, PCNT1_U0_SIG_CH0,
6850        PCNT1_U0_SIG_CH1, PCNT1_U0_CTRL_CH0, PCNT1_U0_CTRL_CH1), (PCNT1_UNIT1,
6851        Pcnt1Unit1, Pcnt1, PCNT1, 1, PCNT1, PCNT1_U1_SIG_CH0, PCNT1_U1_SIG_CH1,
6852        PCNT1_U1_CTRL_CH0, PCNT1_U1_CTRL_CH1), (PCNT1_UNIT2, Pcnt1Unit2, Pcnt1, PCNT1, 2,
6853        PCNT1, PCNT1_U2_SIG_CH0, PCNT1_U2_SIG_CH1, PCNT1_U2_CTRL_CH0, PCNT1_U2_CTRL_CH1),
6854        (PCNT1_UNIT3, Pcnt1Unit3, Pcnt1, PCNT1, 3, PCNT1, PCNT1_U3_SIG_CH0,
6855        PCNT1_U3_SIG_CH1, PCNT1_U3_CTRL_CH0, PCNT1_U3_CTRL_CH1)));
6856        _for_each_inner_pcnt_unit!((interrupt(PCNT0), (PCNT1)));
6857        _for_each_inner_pcnt_unit!((regs(PCNT), (PCNT1)));
6858    };
6859}
6860/// This macro can be used to generate code for each peripheral instance of the CAN FD driver.
6861///
6862/// For an explanation on the general syntax, as well as usage of individual/repeated
6863/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
6864///
6865/// This macro has one option for its "Individual matcher" case:
6866///
6867/// Syntax: `($instance:ident, $sys:ident, $rx:ident, $tx:ident)`
6868///
6869/// Macro fragments:
6870///
6871/// - `$instance`: the name of the CAN FD instance
6872/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
6873/// - `$rx`, `$tx`: signal names.
6874///
6875/// Example data: `(TWAI0, Twai0, TWAI0_RX, TWAI0_TX)`
6876#[macro_export]
6877#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6878macro_rules! for_each_canfd {
6879    ($($pattern:tt => $code:tt;)*) => {
6880        macro_rules! _for_each_inner_canfd { $(($pattern) => $code;)* ($other : tt) => {}
6881        } _for_each_inner_canfd!((all));
6882    };
6883}
6884#[macro_export]
6885#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6886macro_rules! for_each_peripheral {
6887    ($($pattern:tt => $code:tt;)*) => {
6888        macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
6889        => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
6890        "GPIO0 peripheral singleton"] GPIO0 <= virtual()));
6891        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
6892        GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6893        "GPIO2 peripheral singleton"] GPIO2 <= virtual()));
6894        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO3 peripheral singleton"]
6895        GPIO3 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6896        "GPIO4 peripheral singleton"] GPIO4 <= virtual()));
6897        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO5 peripheral singleton"]
6898        GPIO5 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6899        "GPIO6 peripheral singleton"] GPIO6 <= virtual()));
6900        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO7 peripheral singleton"]
6901        GPIO7 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6902        "GPIO8 peripheral singleton"] GPIO8 <= virtual()));
6903        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO9 peripheral singleton"]
6904        GPIO9 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6905        "GPIO10 peripheral singleton"] GPIO10 <= virtual()));
6906        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO11 peripheral singleton"]
6907        GPIO11 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6908        "GPIO12 peripheral singleton"] GPIO12 <= virtual()));
6909        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO13 peripheral singleton"]
6910        GPIO13 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6911        "GPIO14 peripheral singleton"] GPIO14 <= virtual()));
6912        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO15 peripheral singleton"]
6913        GPIO15 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6914        "GPIO16 peripheral singleton"] GPIO16 <= virtual()));
6915        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO17 peripheral singleton"]
6916        GPIO17 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6917        "GPIO18 peripheral singleton"] GPIO18 <= virtual()));
6918        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO19 peripheral singleton"]
6919        GPIO19 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6920        "GPIO20 peripheral singleton"] GPIO20 <= virtual()));
6921        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO21 peripheral singleton"]
6922        GPIO21 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6923        "GPIO22 peripheral singleton"] GPIO22 <= virtual()));
6924        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO23 peripheral singleton"]
6925        GPIO23 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6926        "GPIO24 peripheral singleton"] GPIO24 <= virtual()));
6927        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO25 peripheral singleton"]
6928        GPIO25 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6929        "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6930        "<section class=\"warning\">"] #[doc =
6931        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6932        #[doc = "<ul>"] #[doc =
6933        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6934        "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
6935        _for_each_inner_peripheral!((@ peri_type #[doc =
6936        "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6937        "<section class=\"warning\">"] #[doc =
6938        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6939        #[doc = "<ul>"] #[doc =
6940        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6941        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6942        = "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
6943        _for_each_inner_peripheral!((@ peri_type #[doc =
6944        "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6945        "<section class=\"warning\">"] #[doc =
6946        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6947        #[doc = "<ul>"] #[doc =
6948        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6949        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6950        = "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
6951        _for_each_inner_peripheral!((@ peri_type #[doc =
6952        "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6953        "<section class=\"warning\">"] #[doc =
6954        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6955        #[doc = "<ul>"] #[doc =
6956        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6957        "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
6958        _for_each_inner_peripheral!((@ peri_type #[doc =
6959        "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6960        "<section class=\"warning\">"] #[doc =
6961        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6962        #[doc = "<ul>"] #[doc =
6963        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6964        "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
6965        _for_each_inner_peripheral!((@ peri_type #[doc =
6966        "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6967        "<section class=\"warning\">"] #[doc =
6968        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6969        #[doc = "<ul>"] #[doc =
6970        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6971        "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
6972        _for_each_inner_peripheral!((@ peri_type #[doc =
6973        "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6974        "<section class=\"warning\">"] #[doc =
6975        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6976        #[doc = "<ul>"] #[doc =
6977        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6978        #[doc = "</section>"] GPIO33 <= virtual())); _for_each_inner_peripheral!((@
6979        peri_type #[doc = "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""]
6980        #[doc = "<section class=\"warning\">"] #[doc =
6981        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6982        #[doc = "<ul>"] #[doc =
6983        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6984        #[doc = "</section>"] GPIO34 <= virtual())); _for_each_inner_peripheral!((@
6985        peri_type #[doc = "GPIO35 peripheral singleton"] GPIO35 <= virtual()));
6986        _for_each_inner_peripheral!((@ peri_type #[doc =
6987        "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6988        "<section class=\"warning\">"] #[doc =
6989        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6990        #[doc = "<ul>"] #[doc =
6991        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6992        = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
6993        _for_each_inner_peripheral!((@ peri_type #[doc =
6994        "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6995        "<section class=\"warning\">"] #[doc =
6996        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6997        #[doc = "<ul>"] #[doc =
6998        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6999        = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
7000        _for_each_inner_peripheral!((@ peri_type #[doc =
7001        "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7002        "<section class=\"warning\">"] #[doc =
7003        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7004        #[doc = "<ul>"] #[doc =
7005        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7006        = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()));
7007        _for_each_inner_peripheral!((@ peri_type #[doc =
7008        "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7009        "<section class=\"warning\">"] #[doc =
7010        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7011        #[doc = "<ul>"] #[doc =
7012        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7013        = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
7014        _for_each_inner_peripheral!((@ peri_type #[doc =
7015        "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7016        "<section class=\"warning\">"] #[doc =
7017        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7018        #[doc = "<ul>"] #[doc =
7019        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7020        = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
7021        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO42 peripheral singleton"]
7022        GPIO42 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
7023        "GPIO43 peripheral singleton"] GPIO43 <= virtual()));
7024        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO44 peripheral singleton"]
7025        GPIO44 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
7026        "GPIO45 peripheral singleton"] GPIO45 <= virtual()));
7027        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO46 peripheral singleton"]
7028        GPIO46 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
7029        "GPIO47 peripheral singleton"] GPIO47 <= virtual()));
7030        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO48 peripheral singleton"]
7031        GPIO48 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
7032        "GPIO49 peripheral singleton"] GPIO49 <= virtual()));
7033        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO50 peripheral singleton"]
7034        GPIO50 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
7035        "GPIO51 peripheral singleton"] GPIO51 <= virtual()));
7036        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO52 peripheral singleton"]
7037        GPIO52 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
7038        "GPIO53 peripheral singleton"] GPIO53 <= virtual()));
7039        _for_each_inner_peripheral!((@ peri_type #[doc =
7040        "GPIO54 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7041        "<section class=\"warning\">"] #[doc =
7042        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7043        #[doc = "<ul>"] #[doc =
7044        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7045        #[doc = "</ul>"] #[doc = "</section>"] GPIO54 <= virtual()));
7046        _for_each_inner_peripheral!((@ peri_type #[doc =
7047        "GPIO55 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7048        "<section class=\"warning\">"] #[doc =
7049        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7050        #[doc = "<ul>"] #[doc =
7051        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7052        #[doc = "</ul>"] #[doc = "</section>"] GPIO55 <= virtual()));
7053        _for_each_inner_peripheral!((@ peri_type #[doc =
7054        "GPIO56 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7055        "<section class=\"warning\">"] #[doc =
7056        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7057        #[doc = "<ul>"] #[doc =
7058        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7059        #[doc = "</ul>"] #[doc = "</section>"] GPIO56 <= virtual()));
7060        _for_each_inner_peripheral!((@ peri_type #[doc =
7061        "GPIO57 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7062        "<section class=\"warning\">"] #[doc =
7063        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7064        #[doc = "<ul>"] #[doc =
7065        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7066        #[doc = "</ul>"] #[doc = "</section>"] GPIO57 <= virtual()));
7067        _for_each_inner_peripheral!((@ peri_type #[doc =
7068        "GPIO58 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7069        "<section class=\"warning\">"] #[doc =
7070        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7071        #[doc = "<ul>"] #[doc =
7072        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
7073        = "</ul>"] #[doc = "</section>"] GPIO58 <= virtual()));
7074        _for_each_inner_peripheral!((@ peri_type #[doc =
7075        "GPIO59 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7076        "<section class=\"warning\">"] #[doc =
7077        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7078        #[doc = "<ul>"] #[doc =
7079        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
7080        = "</ul>"] #[doc = "</section>"] GPIO59 <= virtual()));
7081        _for_each_inner_peripheral!((@ peri_type #[doc =
7082        "GPIO60 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7083        "<section class=\"warning\">"] #[doc =
7084        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7085        #[doc = "<ul>"] #[doc =
7086        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7087        = "</ul>"] #[doc = "</section>"] GPIO60 <= virtual()));
7088        _for_each_inner_peripheral!((@ peri_type #[doc =
7089        "GPIO61 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7090        "<section class=\"warning\">"] #[doc =
7091        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7092        #[doc = "<ul>"] #[doc =
7093        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7094        = "</ul>"] #[doc = "</section>"] GPIO61 <= virtual()));
7095        _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
7096        DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : { bind_dma_in_interrupt,
7097        enable_dma_in_interrupt, disable_dma_in_interrupt }, AHB_PDMA_OUT_CH0 : {
7098        bind_dma_out_interrupt, enable_dma_out_interrupt, disable_dma_out_interrupt })
7099        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7100        "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
7101        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7102        AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7103        disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
7104        peri_type #[doc = "DMA_CH2 peripheral singleton"] DMA_CH2 <=
7105        virtual(AHB_PDMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
7106        disable_dma_in_interrupt }, AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt,
7107        enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
7108        _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH3 peripheral singleton"]
7109        DMA_CH3 <= virtual(AHB_PDMA_IN_CH3 : { bind_dma_in_interrupt,
7110        enable_dma_in_interrupt, disable_dma_in_interrupt }, AHB_PDMA_OUT_CH3 : {
7111        bind_dma_out_interrupt, enable_dma_out_interrupt, disable_dma_out_interrupt })
7112        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7113        "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(AHB_PDMA_IN_CH4 : {
7114        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7115        AHB_PDMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7116        disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
7117        peri_type #[doc = "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <=
7118        virtual(AXI_PDMA_IN_CH0 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
7119        disable_dma_in_interrupt }, AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt,
7120        enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
7121        _for_each_inner_peripheral!((@ peri_type #[doc =
7122        "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <= virtual(AXI_PDMA_IN_CH1 : {
7123        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7124        AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7125        disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
7126        peri_type #[doc = "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <=
7127        virtual(AXI_PDMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
7128        disable_dma_in_interrupt }, AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt,
7129        enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
7130        _for_each_inner_peripheral!((@ peri_type #[doc =
7131        "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)));
7132        _for_each_inner_peripheral!((@ peri_type #[doc =
7133        "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual() (unstable)));
7134        _for_each_inner_peripheral!((@ peri_type #[doc =
7135        "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)));
7136        _for_each_inner_peripheral!((@ peri_type #[doc =
7137        "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)));
7138        _for_each_inner_peripheral!((@ peri_type #[doc =
7139        "PCNT1_UNIT0 peripheral singleton"] PCNT1_UNIT0 <= virtual() (unstable)));
7140        _for_each_inner_peripheral!((@ peri_type #[doc =
7141        "PCNT1_UNIT1 peripheral singleton"] PCNT1_UNIT1 <= virtual() (unstable)));
7142        _for_each_inner_peripheral!((@ peri_type #[doc =
7143        "PCNT1_UNIT2 peripheral singleton"] PCNT1_UNIT2 <= virtual() (unstable)));
7144        _for_each_inner_peripheral!((@ peri_type #[doc =
7145        "PCNT1_UNIT3 peripheral singleton"] PCNT1_UNIT3 <= virtual() (unstable)));
7146        _for_each_inner_peripheral!((@ peri_type #[doc = "DAC1 peripheral singleton"]
7147        DAC1 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7148        "DAC2 peripheral singleton"] DAC2 <= virtual() (unstable)));
7149        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
7150        SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
7151        = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
7152        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
7153        SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
7154        = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
7155        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
7156        SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
7157        = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
7158        _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
7159        SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
7160        = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
7161        _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
7162        <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
7163        }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7164        "APB_SARADC peripheral singleton"] APB_SARADC <= ADC() (unstable)));
7165        _for_each_inner_peripheral!((@ peri_type #[doc =
7166        "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
7167        _for_each_inner_peripheral!((@ peri_type #[doc = "CACHE peripheral singleton"]
7168        CACHE <= CACHE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7169        "CLIC peripheral singleton"] CLIC <= CLIC() (unstable)));
7170        _for_each_inner_peripheral!((@ peri_type #[doc = "CLINT peripheral singleton"]
7171        CLINT <= CLINT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7172        "CLINT_OTHER_CORE peripheral singleton"] CLINT_OTHER_CORE <= CLINT_OTHER_CORE()
7173        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7174        "CNNT_SYS peripheral singleton"] CNNT_SYS <= CNNT_SYS() (unstable)));
7175        _for_each_inner_peripheral!((@ peri_type #[doc =
7176        "CNNT_IO_MUX peripheral singleton"] CNNT_IO_MUX <= CNNT_IO_MUX() (unstable)));
7177        _for_each_inner_peripheral!((@ peri_type #[doc = "CORDIC peripheral singleton"]
7178        CORDIC <= CORDIC(CORDIC : { bind_peri_interrupt, enable_peri_interrupt,
7179        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
7180        #[doc = "DMA2D peripheral singleton"] DMA2D <= DMA2D() (unstable)));
7181        _for_each_inner_peripheral!((@ peri_type #[doc = "ETH peripheral singleton"] ETH
7182        <= virtual(SBD : { bind_peri_interrupt, enable_peri_interrupt,
7183        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
7184        #[doc = "EMAC_DMA peripheral singleton"] EMAC_DMA <= GMAC_DMA() (unstable)));
7185        _for_each_inner_peripheral!((@ peri_type #[doc = "EMAC_MAC peripheral singleton"]
7186        EMAC_MAC <= GMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7187        "DAC peripheral singleton"] DAC <= DAC() (unstable)));
7188        _for_each_inner_peripheral!((@ peri_type #[doc = "ECC peripheral singleton"] ECC
7189        <= ECC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7190        "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)));
7191        _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO peripheral singleton"]
7192        GPIO <= GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7193        "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_EXT() (unstable)));
7194        _for_each_inner_peripheral!((@ peri_type #[doc = "HP_APM peripheral singleton"]
7195        HP_APM <= HP_APM() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7196        "HP_MEM_APM peripheral singleton"] HP_MEM_APM <= HP_MEM_APM() (unstable)));
7197        _for_each_inner_peripheral!((@ peri_type #[doc = "HP_SYS peripheral singleton"]
7198        HP_SYS <= HP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7199        "HP_ALIVE_SYS peripheral singleton"] HP_ALIVE_SYS <= HP_ALIVE_SYS() (unstable)));
7200        _for_each_inner_peripheral!((@ peri_type #[doc =
7201        "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
7202        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7203        "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0 : { bind_peri_interrupt,
7204        enable_peri_interrupt, disable_peri_interrupt })));
7205        _for_each_inner_peripheral!((@ peri_type #[doc = "I2C1 peripheral singleton"]
7206        I2C1 <= I2C1(I2C1 : { bind_peri_interrupt, enable_peri_interrupt,
7207        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
7208        "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
7209        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
7210        _for_each_inner_peripheral!((@ peri_type #[doc = "I2S1 peripheral singleton"]
7211        I2S1 <= I2S1(I2S1 : { bind_peri_interrupt, enable_peri_interrupt,
7212        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
7213        #[doc = "IEEE802154 peripheral singleton"] IEEE802154 <= IEEE802154(MODEM_ZB_MAC
7214        : { bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt })
7215        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7216        "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
7217        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7218        "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
7219        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7220        "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
7221        _for_each_inner_peripheral!((@ peri_type #[doc = "LCD_CAM peripheral singleton"]
7222        LCD_CAM <= LCD_CAM(LCD_CAM : { bind_peri_interrupt, enable_peri_interrupt,
7223        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
7224        #[doc = "IOMUX_MSPI_PIN peripheral singleton"] IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN()
7225        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7226        "LP_AON_CLK_RST peripheral singleton"] LP_AON_CLK_RST <= LP_AON_CLKRST()
7227        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7228        "LP_APM peripheral singleton"] LP_APM <= LP_APM() (unstable)));
7229        _for_each_inner_peripheral!((@ peri_type #[doc = "LP_GPIO peripheral singleton"]
7230        LP_GPIO <= LP_GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
7231        = "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)));
7232        _for_each_inner_peripheral!((@ peri_type #[doc = "LP_PERI peripheral singleton"]
7233        LP_PERI <= LP_PERICLKRST() (unstable))); _for_each_inner_peripheral!((@ peri_type
7234        #[doc = "LP_SYS peripheral singleton"] LP_SYS <= LP_SYS() (unstable)));
7235        _for_each_inner_peripheral!((@ peri_type #[doc = "LP_TEE peripheral singleton"]
7236        LP_TEE <= LP_TEE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7237        "LP_WDT peripheral singleton"] LP_WDT <= LP_WDT() (unstable)));
7238        _for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
7239        LPWR <= PMU() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7240        "MEM_MONITOR peripheral singleton"] MEM_MONITOR <= MEM_MONITOR0() (unstable)));
7241        _for_each_inner_peripheral!((@ peri_type #[doc =
7242        "MODEM_LPCON peripheral singleton"] MODEM_LPCON <= MODEM_LPCON() (unstable)));
7243        _for_each_inner_peripheral!((@ peri_type #[doc =
7244        "MODEM_SYSCON peripheral singleton"] MODEM_SYSCON <= MODEM_SYSCON() (unstable)));
7245        _for_each_inner_peripheral!((@ peri_type #[doc = "PARL_IO peripheral singleton"]
7246        PARL_IO <= PARL_IO(HP_PARLIO_RX : { bind_rx_interrupt, enable_rx_interrupt,
7247        disable_rx_interrupt }, HP_PARLIO_TX : { bind_tx_interrupt, enable_tx_interrupt,
7248        disable_tx_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
7249        #[doc = "PAU peripheral singleton"] PAU <= PAU() (unstable)));
7250        _for_each_inner_peripheral!((@ peri_type #[doc = "PCNT peripheral singleton"]
7251        PCNT <= PCNT(PCNT0 : { bind_peri_interrupt, enable_peri_interrupt,
7252        disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
7253        #[doc = "PCNT1 peripheral singleton"] PCNT1 <= PCNT1(PCNT1 : {
7254        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7255        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7256        "PMU peripheral singleton"] PMU <= PMU() (unstable)));
7257        _for_each_inner_peripheral!((@ peri_type #[doc = "PPA peripheral singleton"] PPA
7258        <= PPA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7259        "RTC_TIMER peripheral singleton"] RTC_TIMER <= LP_TIMER() (unstable)));
7260        _for_each_inner_peripheral!((@ peri_type #[doc = "RNG peripheral singleton"] RNG
7261        <= TRNG() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7262        "RMT peripheral singleton"] RMT <= RMT(RMT : { bind_peri_interrupt,
7263        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
7264        _for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
7265        <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
7266        }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7267        "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
7268        _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
7269        SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7270        "MEMSPI2 peripheral singleton"] MEMSPI2 <= MEMSPI2() (unstable)));
7271        _for_each_inner_peripheral!((@ peri_type #[doc = "MEMSPI3 peripheral singleton"]
7272        MEMSPI3 <= MEMSPI3() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
7273        = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
7274        enable_peri_interrupt, disable_peri_interrupt })));
7275        _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
7276        SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
7277        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
7278        "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)));
7279        _for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
7280        <= AHB_DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7281        "SHA peripheral singleton"] SHA <= SHA() (unstable)));
7282        _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTEM peripheral singleton"]
7283        SYSTEM <= HP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7284        "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER() (unstable)));
7285        _for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
7286        SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7287        "TEE peripheral singleton"] TEE <= TEE() (unstable)));
7288        _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG0 peripheral singleton"]
7289        TIMG0 <= TIMG0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7290        "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)));
7291        _for_each_inner_peripheral!((@ peri_type #[doc = "TSENS peripheral singleton"]
7292        TSENS <= LP_TSENS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
7293        = "UART0 peripheral singleton"] UART0 <= UART0(UART0 : { bind_peri_interrupt,
7294        enable_peri_interrupt, disable_peri_interrupt })));
7295        _for_each_inner_peripheral!((@ peri_type #[doc = "UART1 peripheral singleton"]
7296        UART1 <= UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
7297        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
7298        "UART2 peripheral singleton"] UART2 <= UART2(UART2 : { bind_peri_interrupt,
7299        enable_peri_interrupt, disable_peri_interrupt })));
7300        _for_each_inner_peripheral!((@ peri_type #[doc = "UART3 peripheral singleton"]
7301        UART3 <= UART3(UART3 : { bind_peri_interrupt, enable_peri_interrupt,
7302        disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
7303        "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)));
7304        _for_each_inner_peripheral!((@ peri_type #[doc =
7305        "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
7306        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7307        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7308        "USB_HS peripheral singleton"] USB_HS <= USB_OTG_HS(USB_OTG_HS : {
7309        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7310        (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7311        "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)));
7312        _for_each_inner_peripheral!((@ peri_type #[doc = "ADC2 peripheral singleton"]
7313        ADC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7314        "BT peripheral singleton"] BT <= virtual(MODEM_BT_BB : { bind_bb_interrupt,
7315        enable_bb_interrupt, disable_bb_interrupt }, MODEM_LP_TIMER : {
7316        bind_lp_timer_interrupt, enable_lp_timer_interrupt, disable_lp_timer_interrupt },
7317        MODEM_BT_MAC : { bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt
7318        }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7319        "FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
7320        _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
7321        PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
7322        "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
7323        _for_each_inner_peripheral!((@ peri_type #[doc = "WIFI peripheral singleton"]
7324        WIFI <= virtual(MODEM_WIFI_BB : { bind_bb_interrupt, enable_bb_interrupt,
7325        disable_bb_interrupt }, MODEM_WIFI_MAC : { bind_mac_interrupt,
7326        enable_mac_interrupt, disable_mac_interrupt }, MODEM_WIFI_PWR : {
7327        bind_pwr_interrupt, enable_pwr_interrupt, disable_pwr_interrupt })));
7328        _for_each_inner_peripheral!((@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
7329        CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
7330        #[doc = "IPC peripheral singleton"] IPC <= virtual() (unstable)));
7331        _for_each_inner_peripheral!((@ peri_type #[doc =
7332        "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)));
7333        _for_each_inner_peripheral!((@ peri_type #[doc =
7334        "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
7335        _for_each_inner_peripheral!((@ peri_type #[doc =
7336        "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
7337        _for_each_inner_peripheral!((@ peri_type #[doc =
7338        "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
7339        _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO0));
7340        _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO1));
7341        _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
7342        _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
7343        _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
7344        _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
7345        _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
7346        _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
7347        _for_each_inner_peripheral!((GPIO14)); _for_each_inner_peripheral!((GPIO15));
7348        _for_each_inner_peripheral!((GPIO16)); _for_each_inner_peripheral!((GPIO17));
7349        _for_each_inner_peripheral!((GPIO18)); _for_each_inner_peripheral!((GPIO19));
7350        _for_each_inner_peripheral!((GPIO20)); _for_each_inner_peripheral!((GPIO21));
7351        _for_each_inner_peripheral!((GPIO22)); _for_each_inner_peripheral!((GPIO23));
7352        _for_each_inner_peripheral!((GPIO24)); _for_each_inner_peripheral!((GPIO25));
7353        _for_each_inner_peripheral!((GPIO26)); _for_each_inner_peripheral!((GPIO27));
7354        _for_each_inner_peripheral!((GPIO28)); _for_each_inner_peripheral!((GPIO30));
7355        _for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
7356        _for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
7357        _for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
7358        _for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
7359        _for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
7360        _for_each_inner_peripheral!((GPIO42)); _for_each_inner_peripheral!((GPIO43));
7361        _for_each_inner_peripheral!((GPIO44)); _for_each_inner_peripheral!((GPIO45));
7362        _for_each_inner_peripheral!((GPIO46)); _for_each_inner_peripheral!((GPIO47));
7363        _for_each_inner_peripheral!((GPIO48)); _for_each_inner_peripheral!((GPIO49));
7364        _for_each_inner_peripheral!((GPIO50)); _for_each_inner_peripheral!((GPIO51));
7365        _for_each_inner_peripheral!((GPIO52)); _for_each_inner_peripheral!((GPIO53));
7366        _for_each_inner_peripheral!((GPIO54)); _for_each_inner_peripheral!((GPIO55));
7367        _for_each_inner_peripheral!((GPIO56)); _for_each_inner_peripheral!((GPIO57));
7368        _for_each_inner_peripheral!((GPIO58)); _for_each_inner_peripheral!((GPIO59));
7369        _for_each_inner_peripheral!((GPIO60)); _for_each_inner_peripheral!((GPIO61));
7370        _for_each_inner_peripheral!((DMA_CH0(unstable)));
7371        _for_each_inner_peripheral!((DMA_CH1(unstable)));
7372        _for_each_inner_peripheral!((DMA_CH2(unstable)));
7373        _for_each_inner_peripheral!((DMA_CH3(unstable)));
7374        _for_each_inner_peripheral!((DMA_CH4(unstable)));
7375        _for_each_inner_peripheral!((DMA_AXI_CH0(unstable)));
7376        _for_each_inner_peripheral!((DMA_AXI_CH1(unstable)));
7377        _for_each_inner_peripheral!((DMA_AXI_CH2(unstable)));
7378        _for_each_inner_peripheral!((PCNT0_UNIT0(unstable)));
7379        _for_each_inner_peripheral!((PCNT0_UNIT1(unstable)));
7380        _for_each_inner_peripheral!((PCNT0_UNIT2(unstable)));
7381        _for_each_inner_peripheral!((PCNT0_UNIT3(unstable)));
7382        _for_each_inner_peripheral!((PCNT1_UNIT0(unstable)));
7383        _for_each_inner_peripheral!((PCNT1_UNIT1(unstable)));
7384        _for_each_inner_peripheral!((PCNT1_UNIT2(unstable)));
7385        _for_each_inner_peripheral!((PCNT1_UNIT3(unstable)));
7386        _for_each_inner_peripheral!((DAC1(unstable)));
7387        _for_each_inner_peripheral!((DAC2(unstable)));
7388        _for_each_inner_peripheral!((SDM_CH0(unstable)));
7389        _for_each_inner_peripheral!((SDM_CH1(unstable)));
7390        _for_each_inner_peripheral!((SDM_CH2(unstable)));
7391        _for_each_inner_peripheral!((SDM_CH3(unstable)));
7392        _for_each_inner_peripheral!((SDM_CH4(unstable)));
7393        _for_each_inner_peripheral!((SDM_CH5(unstable)));
7394        _for_each_inner_peripheral!((SDM_CH6(unstable)));
7395        _for_each_inner_peripheral!((SDM_CH7(unstable)));
7396        _for_each_inner_peripheral!((AES(unstable)));
7397        _for_each_inner_peripheral!((APB_SARADC(unstable)));
7398        _for_each_inner_peripheral!((ASSIST_DEBUG(unstable)));
7399        _for_each_inner_peripheral!((CACHE(unstable)));
7400        _for_each_inner_peripheral!((CLIC(unstable)));
7401        _for_each_inner_peripheral!((CLINT(unstable)));
7402        _for_each_inner_peripheral!((CLINT_OTHER_CORE(unstable)));
7403        _for_each_inner_peripheral!((CORDIC(unstable)));
7404        _for_each_inner_peripheral!((DMA2D(unstable)));
7405        _for_each_inner_peripheral!((ETH(unstable)));
7406        _for_each_inner_peripheral!((ECC(unstable)));
7407        _for_each_inner_peripheral!((GPIO(unstable)));
7408        _for_each_inner_peripheral!((GPIO_SD(unstable)));
7409        _for_each_inner_peripheral!((HP_APM(unstable)));
7410        _for_each_inner_peripheral!((HP_MEM_APM(unstable)));
7411        _for_each_inner_peripheral!((HP_SYS(unstable)));
7412        _for_each_inner_peripheral!((HP_ALIVE_SYS(unstable)));
7413        _for_each_inner_peripheral!((HP_SYS_CLKRST(unstable)));
7414        _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
7415        _for_each_inner_peripheral!((I2S0(unstable)));
7416        _for_each_inner_peripheral!((I2S1(unstable)));
7417        _for_each_inner_peripheral!((IEEE802154(unstable)));
7418        _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
7419        _for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
7420        _for_each_inner_peripheral!((IO_MUX(unstable)));
7421        _for_each_inner_peripheral!((LCD_CAM(unstable)));
7422        _for_each_inner_peripheral!((LP_AON_CLK_RST(unstable)));
7423        _for_each_inner_peripheral!((LP_APM(unstable)));
7424        _for_each_inner_peripheral!((LP_GPIO(unstable)));
7425        _for_each_inner_peripheral!((LP_IO_MUX(unstable)));
7426        _for_each_inner_peripheral!((LP_PERI(unstable)));
7427        _for_each_inner_peripheral!((LP_SYS(unstable)));
7428        _for_each_inner_peripheral!((LP_TEE(unstable)));
7429        _for_each_inner_peripheral!((LP_WDT(unstable)));
7430        _for_each_inner_peripheral!((LPWR(unstable)));
7431        _for_each_inner_peripheral!((MEM_MONITOR(unstable)));
7432        _for_each_inner_peripheral!((MODEM_LPCON(unstable)));
7433        _for_each_inner_peripheral!((MODEM_SYSCON(unstable)));
7434        _for_each_inner_peripheral!((PARL_IO(unstable)));
7435        _for_each_inner_peripheral!((PAU(unstable)));
7436        _for_each_inner_peripheral!((PCNT(unstable)));
7437        _for_each_inner_peripheral!((PCNT1(unstable)));
7438        _for_each_inner_peripheral!((PMU(unstable)));
7439        _for_each_inner_peripheral!((PPA(unstable)));
7440        _for_each_inner_peripheral!((RTC_TIMER(unstable)));
7441        _for_each_inner_peripheral!((RNG(unstable)));
7442        _for_each_inner_peripheral!((RMT(unstable)));
7443        _for_each_inner_peripheral!((RSA(unstable)));
7444        _for_each_inner_peripheral!((SPI0(unstable)));
7445        _for_each_inner_peripheral!((SPI1(unstable)));
7446        _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
7447        _for_each_inner_peripheral!((AXI_GDMA(unstable)));
7448        _for_each_inner_peripheral!((DMA(unstable)));
7449        _for_each_inner_peripheral!((SHA(unstable)));
7450        _for_each_inner_peripheral!((SYSTEM(unstable)));
7451        _for_each_inner_peripheral!((SYSTIMER(unstable)));
7452        _for_each_inner_peripheral!((SDHOST(unstable)));
7453        _for_each_inner_peripheral!((TEE(unstable)));
7454        _for_each_inner_peripheral!((TIMG0(unstable)));
7455        _for_each_inner_peripheral!((TIMG1(unstable)));
7456        _for_each_inner_peripheral!((TSENS(unstable)));
7457        _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
7458        _for_each_inner_peripheral!((UART2)); _for_each_inner_peripheral!((UART3));
7459        _for_each_inner_peripheral!((UHCI0(unstable)));
7460        _for_each_inner_peripheral!((USB_DEVICE(unstable)));
7461        _for_each_inner_peripheral!((USB_HS(unstable)));
7462        _for_each_inner_peripheral!((ADC1(unstable)));
7463        _for_each_inner_peripheral!((ADC2(unstable)));
7464        _for_each_inner_peripheral!((BT(unstable)));
7465        _for_each_inner_peripheral!((FLASH(unstable)));
7466        _for_each_inner_peripheral!((PSRAM(unstable)));
7467        _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
7468        _for_each_inner_peripheral!((WIFI));
7469        _for_each_inner_peripheral!((CPU_CTRL(unstable)));
7470        _for_each_inner_peripheral!((IPC(unstable)));
7471        _for_each_inner_peripheral!((FROM_CPU_INTR0(unstable)));
7472        _for_each_inner_peripheral!((FROM_CPU_INTR1(unstable)));
7473        _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
7474        _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
7475        _for_each_inner_peripheral!((UHCI0, Uhci0, 0, AhbGdmaChannel));
7476        _for_each_inner_peripheral!((LCD_CAM, LcdCam, 0, AxiGdmaChannel));
7477        _for_each_inner_peripheral!((I2S0, I2s0, 1, AhbGdmaChannel));
7478        _for_each_inner_peripheral!((SPI2, Spi2, 1, AxiGdmaChannel));
7479        _for_each_inner_peripheral!((SPI3, Spi3, 2, AxiGdmaChannel));
7480        _for_each_inner_peripheral!((PARL_IO, ParlIo, 3, AxiGdmaChannel));
7481        _for_each_inner_peripheral!((AES, Aes, 4, AxiGdmaChannel));
7482        _for_each_inner_peripheral!((I2S1, I2s1, 5, AhbGdmaChannel));
7483        _for_each_inner_peripheral!((SHA, Sha, 5, AxiGdmaChannel));
7484        _for_each_inner_peripheral!((all(@ peri_type #[doc =
7485        "GPIO0 peripheral singleton"] GPIO0 <= virtual()), (@ peri_type #[doc =
7486        "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
7487        "GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
7488        "GPIO3 peripheral singleton"] GPIO3 <= virtual()), (@ peri_type #[doc =
7489        "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
7490        "GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
7491        "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
7492        "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
7493        "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
7494        "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
7495        "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
7496        "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
7497        "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
7498        "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
7499        "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
7500        "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
7501        "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
7502        "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
7503        "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
7504        "GPIO19 peripheral singleton"] GPIO19 <= virtual()), (@ peri_type #[doc =
7505        "GPIO20 peripheral singleton"] GPIO20 <= virtual()), (@ peri_type #[doc =
7506        "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
7507        "GPIO22 peripheral singleton"] GPIO22 <= virtual()), (@ peri_type #[doc =
7508        "GPIO23 peripheral singleton"] GPIO23 <= virtual()), (@ peri_type #[doc =
7509        "GPIO24 peripheral singleton"] GPIO24 <= virtual()), (@ peri_type #[doc =
7510        "GPIO25 peripheral singleton"] GPIO25 <= virtual()), (@ peri_type #[doc =
7511        "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7512        "<section class=\"warning\">"] #[doc =
7513        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7514        #[doc = "<ul>"] #[doc =
7515        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
7516        "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
7517        "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7518        "<section class=\"warning\">"] #[doc =
7519        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7520        #[doc = "<ul>"] #[doc =
7521        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
7522        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7523        = "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
7524        "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7525        "<section class=\"warning\">"] #[doc =
7526        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7527        #[doc = "<ul>"] #[doc =
7528        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
7529        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7530        = "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
7531        "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7532        "<section class=\"warning\">"] #[doc =
7533        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7534        #[doc = "<ul>"] #[doc =
7535        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
7536        "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
7537        "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7538        "<section class=\"warning\">"] #[doc =
7539        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7540        #[doc = "<ul>"] #[doc =
7541        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
7542        "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
7543        "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7544        "<section class=\"warning\">"] #[doc =
7545        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7546        #[doc = "<ul>"] #[doc =
7547        "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
7548        "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
7549        "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7550        "<section class=\"warning\">"] #[doc =
7551        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7552        #[doc = "<ul>"] #[doc =
7553        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
7554        #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
7555        "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7556        "<section class=\"warning\">"] #[doc =
7557        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7558        #[doc = "<ul>"] #[doc =
7559        "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
7560        #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
7561        "GPIO35 peripheral singleton"] GPIO35 <= virtual()), (@ peri_type #[doc =
7562        "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7563        "<section class=\"warning\">"] #[doc =
7564        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7565        #[doc = "<ul>"] #[doc =
7566        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7567        = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
7568        "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7569        "<section class=\"warning\">"] #[doc =
7570        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7571        #[doc = "<ul>"] #[doc =
7572        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7573        = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
7574        "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7575        "<section class=\"warning\">"] #[doc =
7576        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7577        #[doc = "<ul>"] #[doc =
7578        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7579        = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()), (@ peri_type #[doc =
7580        "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7581        "<section class=\"warning\">"] #[doc =
7582        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7583        #[doc = "<ul>"] #[doc =
7584        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7585        = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
7586        "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7587        "<section class=\"warning\">"] #[doc =
7588        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7589        #[doc = "<ul>"] #[doc =
7590        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7591        = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
7592        "GPIO42 peripheral singleton"] GPIO42 <= virtual()), (@ peri_type #[doc =
7593        "GPIO43 peripheral singleton"] GPIO43 <= virtual()), (@ peri_type #[doc =
7594        "GPIO44 peripheral singleton"] GPIO44 <= virtual()), (@ peri_type #[doc =
7595        "GPIO45 peripheral singleton"] GPIO45 <= virtual()), (@ peri_type #[doc =
7596        "GPIO46 peripheral singleton"] GPIO46 <= virtual()), (@ peri_type #[doc =
7597        "GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
7598        "GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
7599        "GPIO49 peripheral singleton"] GPIO49 <= virtual()), (@ peri_type #[doc =
7600        "GPIO50 peripheral singleton"] GPIO50 <= virtual()), (@ peri_type #[doc =
7601        "GPIO51 peripheral singleton"] GPIO51 <= virtual()), (@ peri_type #[doc =
7602        "GPIO52 peripheral singleton"] GPIO52 <= virtual()), (@ peri_type #[doc =
7603        "GPIO53 peripheral singleton"] GPIO53 <= virtual()), (@ peri_type #[doc =
7604        "GPIO54 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7605        "<section class=\"warning\">"] #[doc =
7606        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7607        #[doc = "<ul>"] #[doc =
7608        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7609        #[doc = "</ul>"] #[doc = "</section>"] GPIO54 <= virtual()), (@ peri_type #[doc =
7610        "GPIO55 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7611        "<section class=\"warning\">"] #[doc =
7612        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7613        #[doc = "<ul>"] #[doc =
7614        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7615        #[doc = "</ul>"] #[doc = "</section>"] GPIO55 <= virtual()), (@ peri_type #[doc =
7616        "GPIO56 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7617        "<section class=\"warning\">"] #[doc =
7618        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7619        #[doc = "<ul>"] #[doc =
7620        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7621        #[doc = "</ul>"] #[doc = "</section>"] GPIO56 <= virtual()), (@ peri_type #[doc =
7622        "GPIO57 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7623        "<section class=\"warning\">"] #[doc =
7624        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7625        #[doc = "<ul>"] #[doc =
7626        "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
7627        #[doc = "</ul>"] #[doc = "</section>"] GPIO57 <= virtual()), (@ peri_type #[doc =
7628        "GPIO58 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7629        "<section class=\"warning\">"] #[doc =
7630        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7631        #[doc = "<ul>"] #[doc =
7632        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
7633        = "</ul>"] #[doc = "</section>"] GPIO58 <= virtual()), (@ peri_type #[doc =
7634        "GPIO59 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7635        "<section class=\"warning\">"] #[doc =
7636        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7637        #[doc = "<ul>"] #[doc =
7638        "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
7639        = "</ul>"] #[doc = "</section>"] GPIO59 <= virtual()), (@ peri_type #[doc =
7640        "GPIO60 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7641        "<section class=\"warning\">"] #[doc =
7642        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7643        #[doc = "<ul>"] #[doc =
7644        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7645        = "</ul>"] #[doc = "</section>"] GPIO60 <= virtual()), (@ peri_type #[doc =
7646        "GPIO61 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7647        "<section class=\"warning\">"] #[doc =
7648        "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7649        #[doc = "<ul>"] #[doc =
7650        "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7651        = "</ul>"] #[doc = "</section>"] GPIO61 <= virtual()), (@ peri_type #[doc =
7652        "DMA_CH0 peripheral singleton"] DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : {
7653        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7654        AHB_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7655        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7656        "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
7657        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7658        AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7659        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7660        "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual(AHB_PDMA_IN_CH2 : {
7661        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7662        AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7663        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7664        "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual(AHB_PDMA_IN_CH3 : {
7665        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7666        AHB_PDMA_OUT_CH3 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7667        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7668        "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(AHB_PDMA_IN_CH4 : {
7669        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7670        AHB_PDMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7671        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7672        "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <= virtual(AXI_PDMA_IN_CH0 : {
7673        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7674        AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7675        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7676        "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <= virtual(AXI_PDMA_IN_CH1 : {
7677        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7678        AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7679        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7680        "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <= virtual(AXI_PDMA_IN_CH2 : {
7681        bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7682        AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7683        disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7684        "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)), (@
7685        peri_type #[doc = "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual()
7686        (unstable)), (@ peri_type #[doc = "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2
7687        <= virtual() (unstable)), (@ peri_type #[doc =
7688        "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)), (@
7689        peri_type #[doc = "PCNT1_UNIT0 peripheral singleton"] PCNT1_UNIT0 <= virtual()
7690        (unstable)), (@ peri_type #[doc = "PCNT1_UNIT1 peripheral singleton"] PCNT1_UNIT1
7691        <= virtual() (unstable)), (@ peri_type #[doc =
7692        "PCNT1_UNIT2 peripheral singleton"] PCNT1_UNIT2 <= virtual() (unstable)), (@
7693        peri_type #[doc = "PCNT1_UNIT3 peripheral singleton"] PCNT1_UNIT3 <= virtual()
7694        (unstable)), (@ peri_type #[doc = "DAC1 peripheral singleton"] DAC1 <= virtual()
7695        (unstable)), (@ peri_type #[doc = "DAC2 peripheral singleton"] DAC2 <= virtual()
7696        (unstable)), (@ peri_type #[doc = "SDM_CH0 peripheral singleton"] SDM_CH0 <=
7697        virtual() (unstable)), (@ peri_type #[doc = "SDM_CH1 peripheral singleton"]
7698        SDM_CH1 <= virtual() (unstable)), (@ peri_type #[doc =
7699        "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual() (unstable)), (@ peri_type
7700        #[doc = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)), (@
7701        peri_type #[doc = "SDM_CH4 peripheral singleton"] SDM_CH4 <= virtual()
7702        (unstable)), (@ peri_type #[doc = "SDM_CH5 peripheral singleton"] SDM_CH5 <=
7703        virtual() (unstable)), (@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
7704        SDM_CH6 <= virtual() (unstable)), (@ peri_type #[doc =
7705        "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)), (@ peri_type
7706        #[doc = "AES peripheral singleton"] AES <= AES(AES : { bind_peri_interrupt,
7707        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7708        = "APB_SARADC peripheral singleton"] APB_SARADC <= ADC() (unstable)), (@
7709        peri_type #[doc = "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <=
7710        ASSIST_DEBUG() (unstable)), (@ peri_type #[doc = "CACHE peripheral singleton"]
7711        CACHE <= CACHE() (unstable)), (@ peri_type #[doc = "CLIC peripheral singleton"]
7712        CLIC <= CLIC() (unstable)), (@ peri_type #[doc = "CLINT peripheral singleton"]
7713        CLINT <= CLINT() (unstable)), (@ peri_type #[doc =
7714        "CLINT_OTHER_CORE peripheral singleton"] CLINT_OTHER_CORE <= CLINT_OTHER_CORE()
7715        (unstable)), (@ peri_type #[doc = "CNNT_SYS peripheral singleton"] CNNT_SYS <=
7716        CNNT_SYS() (unstable)), (@ peri_type #[doc = "CNNT_IO_MUX peripheral singleton"]
7717        CNNT_IO_MUX <= CNNT_IO_MUX() (unstable)), (@ peri_type #[doc =
7718        "CORDIC peripheral singleton"] CORDIC <= CORDIC(CORDIC : { bind_peri_interrupt,
7719        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7720        = "DMA2D peripheral singleton"] DMA2D <= DMA2D() (unstable)), (@ peri_type #[doc
7721        = "ETH peripheral singleton"] ETH <= virtual(SBD : { bind_peri_interrupt,
7722        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7723        = "EMAC_DMA peripheral singleton"] EMAC_DMA <= GMAC_DMA() (unstable)), (@
7724        peri_type #[doc = "EMAC_MAC peripheral singleton"] EMAC_MAC <= GMAC()
7725        (unstable)), (@ peri_type #[doc = "DAC peripheral singleton"] DAC <= DAC()
7726        (unstable)), (@ peri_type #[doc = "ECC peripheral singleton"] ECC <= ECC()
7727        (unstable)), (@ peri_type #[doc = "EFUSE peripheral singleton"] EFUSE <= EFUSE()
7728        (unstable)), (@ peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO()
7729        (unstable)), (@ peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <=
7730        GPIO_EXT() (unstable)), (@ peri_type #[doc = "HP_APM peripheral singleton"]
7731        HP_APM <= HP_APM() (unstable)), (@ peri_type #[doc =
7732        "HP_MEM_APM peripheral singleton"] HP_MEM_APM <= HP_MEM_APM() (unstable)), (@
7733        peri_type #[doc = "HP_SYS peripheral singleton"] HP_SYS <= HP_SYS() (unstable)),
7734        (@ peri_type #[doc = "HP_ALIVE_SYS peripheral singleton"] HP_ALIVE_SYS <=
7735        HP_ALIVE_SYS() (unstable)), (@ peri_type #[doc =
7736        "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
7737        (unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0
7738        : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
7739        peri_type #[doc = "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C1 : {
7740        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
7741        peri_type #[doc = "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : {
7742        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7743        (unstable)), (@ peri_type #[doc = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1
7744        : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7745        (unstable)), (@ peri_type #[doc = "IEEE802154 peripheral singleton"] IEEE802154
7746        <= IEEE802154(MODEM_ZB_MAC : { bind_mac_interrupt, enable_mac_interrupt,
7747        disable_mac_interrupt }) (unstable)), (@ peri_type #[doc =
7748        "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
7749        (unstable)), (@ peri_type #[doc = "INTERRUPT_CORE1 peripheral singleton"]
7750        INTERRUPT_CORE1 <= INTERRUPT_CORE1() (unstable)), (@ peri_type #[doc =
7751        "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type #[doc
7752        = "LCD_CAM peripheral singleton"] LCD_CAM <= LCD_CAM(LCD_CAM : {
7753        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7754        (unstable)), (@ peri_type #[doc = "IOMUX_MSPI_PIN peripheral singleton"]
7755        IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN() (unstable)), (@ peri_type #[doc =
7756        "LP_AON_CLK_RST peripheral singleton"] LP_AON_CLK_RST <= LP_AON_CLKRST()
7757        (unstable)), (@ peri_type #[doc = "LP_APM peripheral singleton"] LP_APM <=
7758        LP_APM() (unstable)), (@ peri_type #[doc = "LP_GPIO peripheral singleton"]
7759        LP_GPIO <= LP_GPIO() (unstable)), (@ peri_type #[doc =
7760        "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)), (@
7761        peri_type #[doc = "LP_PERI peripheral singleton"] LP_PERI <= LP_PERICLKRST()
7762        (unstable)), (@ peri_type #[doc = "LP_SYS peripheral singleton"] LP_SYS <=
7763        LP_SYS() (unstable)), (@ peri_type #[doc = "LP_TEE peripheral singleton"] LP_TEE
7764        <= LP_TEE() (unstable)), (@ peri_type #[doc = "LP_WDT peripheral singleton"]
7765        LP_WDT <= LP_WDT() (unstable)), (@ peri_type #[doc = "LPWR peripheral singleton"]
7766        LPWR <= PMU() (unstable)), (@ peri_type #[doc =
7767        "MEM_MONITOR peripheral singleton"] MEM_MONITOR <= MEM_MONITOR0() (unstable)), (@
7768        peri_type #[doc = "MODEM_LPCON peripheral singleton"] MODEM_LPCON <=
7769        MODEM_LPCON() (unstable)), (@ peri_type #[doc =
7770        "MODEM_SYSCON peripheral singleton"] MODEM_SYSCON <= MODEM_SYSCON() (unstable)),
7771        (@ peri_type #[doc = "PARL_IO peripheral singleton"] PARL_IO <=
7772        PARL_IO(HP_PARLIO_RX : { bind_rx_interrupt, enable_rx_interrupt,
7773        disable_rx_interrupt }, HP_PARLIO_TX : { bind_tx_interrupt, enable_tx_interrupt,
7774        disable_tx_interrupt }) (unstable)), (@ peri_type #[doc =
7775        "PAU peripheral singleton"] PAU <= PAU() (unstable)), (@ peri_type #[doc =
7776        "PCNT peripheral singleton"] PCNT <= PCNT(PCNT0 : { bind_peri_interrupt,
7777        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7778        = "PCNT1 peripheral singleton"] PCNT1 <= PCNT1(PCNT1 : { bind_peri_interrupt,
7779        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7780        = "PMU peripheral singleton"] PMU <= PMU() (unstable)), (@ peri_type #[doc =
7781        "PPA peripheral singleton"] PPA <= PPA() (unstable)), (@ peri_type #[doc =
7782        "RTC_TIMER peripheral singleton"] RTC_TIMER <= LP_TIMER() (unstable)), (@
7783        peri_type #[doc = "RNG peripheral singleton"] RNG <= TRNG() (unstable)), (@
7784        peri_type #[doc = "RMT peripheral singleton"] RMT <= RMT(RMT : {
7785        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7786        (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <= RSA(RSA : {
7787        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7788        (unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0()
7789        (unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1()
7790        (unstable)), (@ peri_type #[doc = "MEMSPI2 peripheral singleton"] MEMSPI2 <=
7791        MEMSPI2() (unstable)), (@ peri_type #[doc = "MEMSPI3 peripheral singleton"]
7792        MEMSPI3 <= MEMSPI3() (unstable)), (@ peri_type #[doc =
7793        "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
7794        enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
7795        "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : { bind_peri_interrupt,
7796        enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
7797        "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)), (@ peri_type
7798        #[doc = "DMA peripheral singleton"] DMA <= AHB_DMA() (unstable)), (@ peri_type
7799        #[doc = "SHA peripheral singleton"] SHA <= SHA() (unstable)), (@ peri_type #[doc
7800        = "SYSTEM peripheral singleton"] SYSTEM <= HP_SYS() (unstable)), (@ peri_type
7801        #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER() (unstable)), (@
7802        peri_type #[doc = "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)),
7803        (@ peri_type #[doc = "TEE peripheral singleton"] TEE <= TEE() (unstable)), (@
7804        peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)), (@
7805        peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)), (@
7806        peri_type #[doc = "TSENS peripheral singleton"] TSENS <= LP_TSENS() (unstable)),
7807        (@ peri_type #[doc = "UART0 peripheral singleton"] UART0 <= UART0(UART0 : {
7808        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
7809        peri_type #[doc = "UART1 peripheral singleton"] UART1 <= UART1(UART1 : {
7810        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
7811        peri_type #[doc = "UART2 peripheral singleton"] UART2 <= UART2(UART2 : {
7812        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
7813        peri_type #[doc = "UART3 peripheral singleton"] UART3 <= UART3(UART3 : {
7814        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
7815        peri_type #[doc = "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)), (@
7816        peri_type #[doc = "USB_DEVICE peripheral singleton"] USB_DEVICE <=
7817        USB_DEVICE(USB_DEVICE : { bind_peri_interrupt, enable_peri_interrupt,
7818        disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
7819        "USB_HS peripheral singleton"] USB_HS <= USB_OTG_HS(USB_OTG_HS : {
7820        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7821        (unstable)), (@ peri_type #[doc = "ADC1 peripheral singleton"] ADC1 <= virtual()
7822        (unstable)), (@ peri_type #[doc = "ADC2 peripheral singleton"] ADC2 <= virtual()
7823        (unstable)), (@ peri_type #[doc = "BT peripheral singleton"] BT <=
7824        virtual(MODEM_BT_BB : { bind_bb_interrupt, enable_bb_interrupt,
7825        disable_bb_interrupt }, MODEM_LP_TIMER : { bind_lp_timer_interrupt,
7826        enable_lp_timer_interrupt, disable_lp_timer_interrupt }, MODEM_BT_MAC : {
7827        bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt }) (unstable)),
7828        (@ peri_type #[doc = "FLASH peripheral singleton"] FLASH <= virtual()
7829        (unstable)), (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <=
7830        virtual() (unstable)), (@ peri_type #[doc =
7831        "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
7832        (@ peri_type #[doc = "WIFI peripheral singleton"] WIFI <= virtual(MODEM_WIFI_BB :
7833        { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt }, MODEM_WIFI_MAC
7834        : { bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt },
7835        MODEM_WIFI_PWR : { bind_pwr_interrupt, enable_pwr_interrupt,
7836        disable_pwr_interrupt })), (@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
7837        CPU_CTRL <= virtual() (unstable)), (@ peri_type #[doc =
7838        "IPC peripheral singleton"] IPC <= virtual() (unstable)), (@ peri_type #[doc =
7839        "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)),
7840        (@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <=
7841        virtual() (unstable)), (@ peri_type #[doc =
7842        "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
7843        (@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
7844        virtual() (unstable))));
7845        _for_each_inner_peripheral!((singletons(#[cfg(not(use_xtal32k))] GPIO0),
7846        (#[cfg(not(use_xtal32k))] GPIO1), (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6),
7847        (GPIO7), (GPIO8), (GPIO9), (GPIO10), (GPIO11), (GPIO12), (GPIO13), (GPIO14),
7848        (GPIO15), (GPIO16), (GPIO17), (GPIO18), (GPIO19), (GPIO20), (GPIO21), (GPIO22),
7849        (GPIO23), (GPIO24), (GPIO25), (GPIO26), (GPIO27), (GPIO28), (GPIO30), (GPIO31),
7850        (GPIO32), (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39),
7851        (GPIO40), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47), (GPIO48),
7852        (GPIO49), (GPIO50), (GPIO51), (GPIO52), (GPIO53), (GPIO54), (GPIO55), (GPIO56),
7853        (GPIO57), (GPIO58), (GPIO59), (GPIO60), (GPIO61), (DMA_CH0(unstable)),
7854        (DMA_CH1(unstable)), (DMA_CH2(unstable)), (DMA_CH3(unstable)),
7855        (DMA_CH4(unstable)), (DMA_AXI_CH0(unstable)), (DMA_AXI_CH1(unstable)),
7856        (DMA_AXI_CH2(unstable)), (PCNT0_UNIT0(unstable)), (PCNT0_UNIT1(unstable)),
7857        (PCNT0_UNIT2(unstable)), (PCNT0_UNIT3(unstable)), (PCNT1_UNIT0(unstable)),
7858        (PCNT1_UNIT1(unstable)), (PCNT1_UNIT2(unstable)), (PCNT1_UNIT3(unstable)),
7859        (DAC1(unstable)), (DAC2(unstable)), (SDM_CH0(unstable)), (SDM_CH1(unstable)),
7860        (SDM_CH2(unstable)), (SDM_CH3(unstable)), (SDM_CH4(unstable)),
7861        (SDM_CH5(unstable)), (SDM_CH6(unstable)), (SDM_CH7(unstable)), (AES(unstable)),
7862        (APB_SARADC(unstable)), (ASSIST_DEBUG(unstable)), (CACHE(unstable)),
7863        (CLIC(unstable)), (CLINT(unstable)), (CLINT_OTHER_CORE(unstable)),
7864        (CORDIC(unstable)), (DMA2D(unstable)), (ETH(unstable)), (ECC(unstable)),
7865        (GPIO(unstable)), (GPIO_SD(unstable)), (HP_APM(unstable)),
7866        (HP_MEM_APM(unstable)), (HP_SYS(unstable)), (HP_ALIVE_SYS(unstable)),
7867        (HP_SYS_CLKRST(unstable)), (I2C0), (I2C1), (I2S0(unstable)), (I2S1(unstable)),
7868        (IEEE802154(unstable)), (INTERRUPT_CORE0(unstable)), (INTERRUPT_CORE1(unstable)),
7869        (IO_MUX(unstable)), (LCD_CAM(unstable)), (LP_AON_CLK_RST(unstable)),
7870        (LP_APM(unstable)), (LP_GPIO(unstable)), (LP_IO_MUX(unstable)),
7871        (LP_PERI(unstable)), (LP_SYS(unstable)), (LP_TEE(unstable)), (LP_WDT(unstable)),
7872        (LPWR(unstable)), (MEM_MONITOR(unstable)), (MODEM_LPCON(unstable)),
7873        (MODEM_SYSCON(unstable)), (PARL_IO(unstable)), (PAU(unstable)), (PCNT(unstable)),
7874        (PCNT1(unstable)), (PMU(unstable)), (PPA(unstable)), (RTC_TIMER(unstable)),
7875        (RNG(unstable)), (RMT(unstable)), (RSA(unstable)), (SPI0(unstable)),
7876        (SPI1(unstable)), (SPI2), (SPI3), (AXI_GDMA(unstable)), (DMA(unstable)),
7877        (SHA(unstable)), (SYSTEM(unstable)), (SYSTIMER(unstable)), (SDHOST(unstable)),
7878        (TEE(unstable)), (TIMG0(unstable)), (TIMG1(unstable)), (TSENS(unstable)),
7879        (UART0), (UART1), (UART2), (UART3), (UHCI0(unstable)), (USB_DEVICE(unstable)),
7880        (USB_HS(unstable)), (ADC1(unstable)), (ADC2(unstable)), (BT(unstable)),
7881        (FLASH(unstable)), (PSRAM(unstable)), (GPIO_DEDICATED(unstable)), (WIFI),
7882        (CPU_CTRL(unstable)), (IPC(unstable)), (FROM_CPU_INTR0(unstable)),
7883        (FROM_CPU_INTR1(unstable)), (FROM_CPU_INTR2(unstable)),
7884        (FROM_CPU_INTR3(unstable)))); _for_each_inner_peripheral!((dma_eligible(UHCI0,
7885        Uhci0, 0, AhbGdmaChannel), (LCD_CAM, LcdCam, 0, AxiGdmaChannel), (I2S0, I2s0, 1,
7886        AhbGdmaChannel), (SPI2, Spi2, 1, AxiGdmaChannel), (SPI3, Spi3, 2,
7887        AxiGdmaChannel), (PARL_IO, ParlIo, 3, AxiGdmaChannel), (AES, Aes, 4,
7888        AxiGdmaChannel), (I2S1, I2s1, 5, AhbGdmaChannel), (SHA, Sha, 5,
7889        AxiGdmaChannel)));
7890    };
7891}
7892/// This macro can be used to generate code for each `GPIOn` instance.
7893///
7894/// For an explanation on the general syntax, as well as usage of individual/repeated
7895/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
7896///
7897/// This macro has one option for its "Individual matcher" case:
7898///
7899/// Syntax: `($n:literal, $gpio:ident ($($digital_input_function:ident =>
7900/// $digital_input_signal:ident)*) ($($digital_output_function:ident =>
7901/// $digital_output_signal:ident)*) ($([$pin_attribute:ident])*))`
7902///
7903/// Macro fragments:
7904///
7905/// - `$n`: the number of the GPIO. For `GPIO0`, `$n` is 0.
7906/// - `$gpio`: the name of the GPIO.
7907/// - `$digital_input_function`: the number of the digital function, as an identifier (i.e. for
7908///   function 0 this is `_0`).
7909/// - `$digital_input_function`: the name of the digital function, as an identifier.
7910/// - `$digital_output_function`: the number of the digital function, as an identifier (i.e. for
7911///   function 0 this is `_0`).
7912/// - `$digital_output_function`: the name of the digital function, as an identifier.
7913/// - `$pin_attribute`: `Input` and/or `Output`, marks the possible directions of the GPIO.
7914///   Bracketed so that they can also be matched as optional fragments. Order is always Input first.
7915///
7916/// Example data: `(0, GPIO0 (_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input]
7917/// [Output]))`
7918#[macro_export]
7919#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7920macro_rules! for_each_gpio {
7921    ($($pattern:tt => $code:tt;)*) => {
7922        macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
7923        } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
7924        _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
7925        _for_each_inner_gpio!((2, GPIO2() (_3 => LCD_DATA_19) ([Input] [Output])));
7926        _for_each_inner_gpio!((3, GPIO3() (_3 => LCD_DATA_20) ([Input] [Output])));
7927        _for_each_inner_gpio!((4, GPIO4() (_3 => LCD_DATA_21) ([Input] [Output])));
7928        _for_each_inner_gpio!((5, GPIO5() (_3 => LCD_DATA_22) ([Input] [Output])));
7929        _for_each_inner_gpio!((6, GPIO6() () ([Input] [Output])));
7930        _for_each_inner_gpio!((7, GPIO7() (_3 => LCD_DATA_23) ([Input] [Output])));
7931        _for_each_inner_gpio!((8, GPIO8() (_2 => EMAC_TXD0 _3 => LCD_DATA_0) ([Input]
7932        [Output]))); _for_each_inner_gpio!((9, GPIO9(_0 => FSPIHD _4 => DBG_PSRAM_CK) (_0
7933        => FSPIHD _2 => EMAC_TXD1 _3 => LCD_DATA_1 _4 => DBG_PSRAM_CK) ([Input]
7934        [Output]))); _for_each_inner_gpio!((10, GPIO10(_0 => FSPICS0 _4 => DBG_PSRAM_CS)
7935        (_0 => FSPICS0 _2 => EMAC_TXD2 _3 => LCD_DATA_2 _4 => DBG_PSRAM_CS) ([Input]
7936        [Output]))); _for_each_inner_gpio!((11, GPIO11(_0 => FSPID _4 => DBG_PSRAM_D) (_0
7937        => FSPID _2 => EMAC_TXD3 _3 => LCD_DATA_3 _4 => DBG_PSRAM_D) ([Input]
7938        [Output]))); _for_each_inner_gpio!((12, GPIO12(_0 => FSPICLK _4 => DBG_PSRAM_Q)
7939        (_0 => FSPICLK _2 => EMAC_TXEN _3 => LCD_DATA_4 _4 => DBG_PSRAM_Q) ([Input]
7940        [Output]))); _for_each_inner_gpio!((13, GPIO13(_0 => FSPIQ _2 => EMAC_RMII_CLK _4
7941        => DBG_PSRAM_WP) (_0 => FSPIQ _2 => EMAC_RMII_CLK _3 => LCD_DATA_5 _4 =>
7942        DBG_PSRAM_WP) ([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14(_0 =>
7943        FSPIWP _2 => EMAC_RX_CLK _4 => DBG_PSRAM_HOLD) (_0 => FSPIWP _3 => LCD_DATA_6 _4
7944        => DBG_PSRAM_HOLD) ([Input] [Output]))); _for_each_inner_gpio!((15, GPIO15(_0 =>
7945        FSPIIO4 _2 => EMAC_RXDV _4 => DBG_PSRAM_DQ4) (_0 => FSPIIO4 _3 => LCD_DATA_7 _4
7946        => DBG_PSRAM_DQ4) ([Input] [Output]))); _for_each_inner_gpio!((16, GPIO16(_0 =>
7947        FSPIIO5 _2 => EMAC_RXD3 _4 => DBG_PSRAM_DQ5) (_0 => FSPIIO5 _3 => LCD_DATA_8 _4
7948        => DBG_PSRAM_DQ5) ([Input] [Output]))); _for_each_inner_gpio!((17, GPIO17(_0 =>
7949        FSPIIO6 _2 => EMAC_RXD2 _4 => DBG_PSRAM_DQ6) (_0 => FSPIIO6 _3 => LCD_DATA_9 _4
7950        => DBG_PSRAM_DQ6) ([Input] [Output]))); _for_each_inner_gpio!((18, GPIO18(_0 =>
7951        FSPIIO7 _2 => EMAC_RXD1 _4 => DBG_PSRAM_DQ7) (_0 => FSPIIO7 _3 => LCD_DATA_10 _4
7952        => DBG_PSRAM_DQ7) ([Input] [Output]))); _for_each_inner_gpio!((19, GPIO19(_2 =>
7953        EMAC_RXD0 _4 => DBG_PSRAM_DQS_0) (_0 => FSPIDQS _3 => LCD_DATA_11 _4 =>
7954        DBG_PSRAM_DQS_0) ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20(_0 =>
7955        SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) (_0 => SD1_DATA0 _2 => FSPICLK _4 =>
7956        DBG_FLASH_CK) ([Input] [Output]))); _for_each_inner_gpio!((21, GPIO21(_0 =>
7957        SD1_DATA1 _2 => FSPID _4 => DBG_FLASH_D) (_0 => SD1_DATA1 _2 => FSPID _4 =>
7958        DBG_FLASH_D) ([Input] [Output]))); _for_each_inner_gpio!((22, GPIO22(_0 =>
7959        SD1_DATA2 _2 => FSPIQ _4 => DBG_FLASH_CS) (_0 => SD1_DATA2 _2 => FSPIQ _4 =>
7960        DBG_FLASH_CS) ([Input] [Output]))); _for_each_inner_gpio!((23, GPIO23(_0 =>
7961        SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) (_0 => SD1_DATA3 _2 => FSPICS0 _4 =>
7962        DBG_FLASH_Q) ([Input] [Output]))); _for_each_inner_gpio!((24, GPIO24(_0 =>
7963        SD1_CLK _2 => FSPIHD _4 => DBG_FLASH_WP) (_0 => SD1_CLK _2 => FSPIHD _4 =>
7964        DBG_FLASH_WP) ([Input] [Output]))); _for_each_inner_gpio!((25, GPIO25(_0 =>
7965        SD1_CMD _2 => FSPIWP _4 => DBG_FLASH_HOLD) (_0 => SD1_CMD _2 => FSPIWP _4 =>
7966        DBG_FLASH_HOLD) ([Input] [Output]))); _for_each_inner_gpio!((26, GPIO26(_0 =>
7967        SPICS0) (_0 => SPICS0) ([Input] [Output]))); _for_each_inner_gpio!((27, GPIO27(_0
7968        => SPIQ) (_0 => SPIQ) ([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0
7969        => SPIWP) (_0 => SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((30,
7970        GPIO30(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])));
7971        _for_each_inner_gpio!((31, GPIO31(_0 => SPICLK) (_0 => SPICLK) ([Input]
7972        [Output]))); _for_each_inner_gpio!((32, GPIO32(_0 => SPID) (_0 => SPID) ([Input]
7973        [Output]))); _for_each_inner_gpio!((33, GPIO33() (_3 => LCD_DATA_12) ([Input]
7974        [Output]))); _for_each_inner_gpio!((34, GPIO34() (_3 => LCD_DATA_13) ([Input]
7975        [Output]))); _for_each_inner_gpio!((35, GPIO35(_2 => REF_50M_CLK _4 =>
7976        SD2_CDATA0) (_2 => REF_50M_CLK _3 => LCD_DATA_14 _4 => SD2_CDATA0) ([Input]
7977        [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => EMAC_RXDV _4 => SD2_CDATA1)
7978        (_3 => LCD_DATA_15 _4 => SD2_CDATA1) ([Input] [Output])));
7979        _for_each_inner_gpio!((37, GPIO37(_4 => SD2_CDATA2) (_2 => EMAC_TXEN _3 =>
7980        LCD_DATA_16 _4 => SD2_CDATA2) ([Input] [Output]))); _for_each_inner_gpio!((38,
7981        GPIO38(_2 => EMAC_RXD3 _4 => SD2_CDATA3) (_3 => LCD_DATA_17 _4 => SD2_CDATA3)
7982        ([Input] [Output]))); _for_each_inner_gpio!((39, GPIO39(_2 => EMAC_RXD2 _4 =>
7983        SD2_CCLK) (_3 => LCD_DATA_18 _4 => SD2_CCLK) ([Input] [Output])));
7984        _for_each_inner_gpio!((40, GPIO40(_2 => EMAC_RXD1 _4 => SD2_CCMD) (_3 => LCD_PCLK
7985        _4 => SD2_CCMD) ([Input] [Output]))); _for_each_inner_gpio!((42, GPIO42(_2 =>
7986        EMAC_RX_CLK) () ([Input] [Output]))); _for_each_inner_gpio!((43, GPIO43(_2 =>
7987        EMAC_RMII_CLK) (_2 => EMAC_RMII_CLK _3 => LCD_H_ENABLE) ([Input] [Output])));
7988        _for_each_inner_gpio!((44, GPIO44() (_2 => EMAC_TXD0 _3 => LCD_H_SYNC) ([Input]
7989        [Output]))); _for_each_inner_gpio!((45, GPIO45() (_2 => EMAC_TXD1 _3 =>
7990        LCD_V_SYNC) ([Input] [Output]))); _for_each_inner_gpio!((46, GPIO46(_3 =>
7991        CAM_DATA_0) (_2 => EMAC_TXD2) ([Input] [Output]))); _for_each_inner_gpio!((47,
7992        GPIO47(_3 => CAM_DATA_1) (_2 => EMAC_TXD3) ([Input] [Output])));
7993        _for_each_inner_gpio!((48, GPIO48(_3 => CAM_DATA_2) () ([Input] [Output])));
7994        _for_each_inner_gpio!((49, GPIO49(_3 => CAM_DATA_3) () ([Input] [Output])));
7995        _for_each_inner_gpio!((50, GPIO50(_3 => CAM_DATA_4) () ([Input] [Output])));
7996        _for_each_inner_gpio!((51, GPIO51(_3 => CAM_DATA_5) () ([Input] [Output])));
7997        _for_each_inner_gpio!((52, GPIO52(_2 => FSPICS0 _3 => CAM_DATA_6) (_2 => FSPICS0)
7998        ([Input] [Output]))); _for_each_inner_gpio!((53, GPIO53(_2 => FSPICLK _3 =>
7999        CAM_DATA_7) (_2 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((54,
8000        GPIO54(_0 => MTDO _2 => FSPID _3 => CAM_PCLK) (_0 => MTDO _2 => FSPID) ([Input]
8001        [Output]))); _for_each_inner_gpio!((55, GPIO55(_0 => MTCK _2 => FSPIQ _3 =>
8002        CAM_XCLK) (_0 => MTCK _2 => FSPIQ _3 => CAM_XCLK) ([Input] [Output])));
8003        _for_each_inner_gpio!((56, GPIO56(_0 => MTDI _2 => FSPIHD _3 => CAM_V_SYNC) (_0
8004        => MTDI _2 => FSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((57, GPIO57(_0
8005        => MTMS _2 => FSPIWP _3 => CAM_H_SYNC) (_0 => MTMS _2 => FSPIWP) ([Input]
8006        [Output]))); _for_each_inner_gpio!((58, GPIO58() (_0 => U0TXD) ([Input]
8007        [Output]))); _for_each_inner_gpio!((59, GPIO59(_0 => U0RXD) () ([Input]
8008        [Output]))); _for_each_inner_gpio!((60, GPIO60() () ([Input] [Output])));
8009        _for_each_inner_gpio!((61, GPIO61() () ([Input] [Output])));
8010        _for_each_inner_gpio!((all(0, GPIO0() () ([Input] [Output])), (1, GPIO1() ()
8011        ([Input] [Output])), (2, GPIO2() (_3 => LCD_DATA_19) ([Input] [Output])), (3,
8012        GPIO3() (_3 => LCD_DATA_20) ([Input] [Output])), (4, GPIO4() (_3 => LCD_DATA_21)
8013        ([Input] [Output])), (5, GPIO5() (_3 => LCD_DATA_22) ([Input] [Output])), (6,
8014        GPIO6() () ([Input] [Output])), (7, GPIO7() (_3 => LCD_DATA_23) ([Input]
8015        [Output])), (8, GPIO8() (_2 => EMAC_TXD0 _3 => LCD_DATA_0) ([Input] [Output])),
8016        (9, GPIO9(_0 => FSPIHD _4 => DBG_PSRAM_CK) (_0 => FSPIHD _2 => EMAC_TXD1 _3 =>
8017        LCD_DATA_1 _4 => DBG_PSRAM_CK) ([Input] [Output])), (10, GPIO10(_0 => FSPICS0 _4
8018        => DBG_PSRAM_CS) (_0 => FSPICS0 _2 => EMAC_TXD2 _3 => LCD_DATA_2 _4 =>
8019        DBG_PSRAM_CS) ([Input] [Output])), (11, GPIO11(_0 => FSPID _4 => DBG_PSRAM_D) (_0
8020        => FSPID _2 => EMAC_TXD3 _3 => LCD_DATA_3 _4 => DBG_PSRAM_D) ([Input] [Output])),
8021        (12, GPIO12(_0 => FSPICLK _4 => DBG_PSRAM_Q) (_0 => FSPICLK _2 => EMAC_TXEN _3 =>
8022        LCD_DATA_4 _4 => DBG_PSRAM_Q) ([Input] [Output])), (13, GPIO13(_0 => FSPIQ _2 =>
8023        EMAC_RMII_CLK _4 => DBG_PSRAM_WP) (_0 => FSPIQ _2 => EMAC_RMII_CLK _3 =>
8024        LCD_DATA_5 _4 => DBG_PSRAM_WP) ([Input] [Output])), (14, GPIO14(_0 => FSPIWP _2
8025        => EMAC_RX_CLK _4 => DBG_PSRAM_HOLD) (_0 => FSPIWP _3 => LCD_DATA_6 _4 =>
8026        DBG_PSRAM_HOLD) ([Input] [Output])), (15, GPIO15(_0 => FSPIIO4 _2 => EMAC_RXDV _4
8027        => DBG_PSRAM_DQ4) (_0 => FSPIIO4 _3 => LCD_DATA_7 _4 => DBG_PSRAM_DQ4) ([Input]
8028        [Output])), (16, GPIO16(_0 => FSPIIO5 _2 => EMAC_RXD3 _4 => DBG_PSRAM_DQ5) (_0 =>
8029        FSPIIO5 _3 => LCD_DATA_8 _4 => DBG_PSRAM_DQ5) ([Input] [Output])), (17, GPIO17(_0
8030        => FSPIIO6 _2 => EMAC_RXD2 _4 => DBG_PSRAM_DQ6) (_0 => FSPIIO6 _3 => LCD_DATA_9
8031        _4 => DBG_PSRAM_DQ6) ([Input] [Output])), (18, GPIO18(_0 => FSPIIO7 _2 =>
8032        EMAC_RXD1 _4 => DBG_PSRAM_DQ7) (_0 => FSPIIO7 _3 => LCD_DATA_10 _4 =>
8033        DBG_PSRAM_DQ7) ([Input] [Output])), (19, GPIO19(_2 => EMAC_RXD0 _4 =>
8034        DBG_PSRAM_DQS_0) (_0 => FSPIDQS _3 => LCD_DATA_11 _4 => DBG_PSRAM_DQS_0) ([Input]
8035        [Output])), (20, GPIO20(_0 => SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) (_0 =>
8036        SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) ([Input] [Output])), (21, GPIO21(_0
8037        => SD1_DATA1 _2 => FSPID _4 => DBG_FLASH_D) (_0 => SD1_DATA1 _2 => FSPID _4 =>
8038        DBG_FLASH_D) ([Input] [Output])), (22, GPIO22(_0 => SD1_DATA2 _2 => FSPIQ _4 =>
8039        DBG_FLASH_CS) (_0 => SD1_DATA2 _2 => FSPIQ _4 => DBG_FLASH_CS) ([Input]
8040        [Output])), (23, GPIO23(_0 => SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) (_0 =>
8041        SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) ([Input] [Output])), (24, GPIO24(_0 =>
8042        SD1_CLK _2 => FSPIHD _4 => DBG_FLASH_WP) (_0 => SD1_CLK _2 => FSPIHD _4 =>
8043        DBG_FLASH_WP) ([Input] [Output])), (25, GPIO25(_0 => SD1_CMD _2 => FSPIWP _4 =>
8044        DBG_FLASH_HOLD) (_0 => SD1_CMD _2 => FSPIWP _4 => DBG_FLASH_HOLD) ([Input]
8045        [Output])), (26, GPIO26(_0 => SPICS0) (_0 => SPICS0) ([Input] [Output])), (27,
8046        GPIO27(_0 => SPIQ) (_0 => SPIQ) ([Input] [Output])), (28, GPIO28(_0 => SPIWP) (_0
8047        => SPIWP) ([Input] [Output])), (30, GPIO30(_0 => SPIHD) (_0 => SPIHD) ([Input]
8048        [Output])), (31, GPIO31(_0 => SPICLK) (_0 => SPICLK) ([Input] [Output])), (32,
8049        GPIO32(_0 => SPID) (_0 => SPID) ([Input] [Output])), (33, GPIO33() (_3 =>
8050        LCD_DATA_12) ([Input] [Output])), (34, GPIO34() (_3 => LCD_DATA_13) ([Input]
8051        [Output])), (35, GPIO35(_2 => REF_50M_CLK _4 => SD2_CDATA0) (_2 => REF_50M_CLK _3
8052        => LCD_DATA_14 _4 => SD2_CDATA0) ([Input] [Output])), (36, GPIO36(_2 => EMAC_RXDV
8053        _4 => SD2_CDATA1) (_3 => LCD_DATA_15 _4 => SD2_CDATA1) ([Input] [Output])), (37,
8054        GPIO37(_4 => SD2_CDATA2) (_2 => EMAC_TXEN _3 => LCD_DATA_16 _4 => SD2_CDATA2)
8055        ([Input] [Output])), (38, GPIO38(_2 => EMAC_RXD3 _4 => SD2_CDATA3) (_3 =>
8056        LCD_DATA_17 _4 => SD2_CDATA3) ([Input] [Output])), (39, GPIO39(_2 => EMAC_RXD2 _4
8057        => SD2_CCLK) (_3 => LCD_DATA_18 _4 => SD2_CCLK) ([Input] [Output])), (40,
8058        GPIO40(_2 => EMAC_RXD1 _4 => SD2_CCMD) (_3 => LCD_PCLK _4 => SD2_CCMD) ([Input]
8059        [Output])), (42, GPIO42(_2 => EMAC_RX_CLK) () ([Input] [Output])), (43, GPIO43(_2
8060        => EMAC_RMII_CLK) (_2 => EMAC_RMII_CLK _3 => LCD_H_ENABLE) ([Input] [Output])),
8061        (44, GPIO44() (_2 => EMAC_TXD0 _3 => LCD_H_SYNC) ([Input] [Output])), (45,
8062        GPIO45() (_2 => EMAC_TXD1 _3 => LCD_V_SYNC) ([Input] [Output])), (46, GPIO46(_3
8063        => CAM_DATA_0) (_2 => EMAC_TXD2) ([Input] [Output])), (47, GPIO47(_3 =>
8064        CAM_DATA_1) (_2 => EMAC_TXD3) ([Input] [Output])), (48, GPIO48(_3 => CAM_DATA_2)
8065        () ([Input] [Output])), (49, GPIO49(_3 => CAM_DATA_3) () ([Input] [Output])),
8066        (50, GPIO50(_3 => CAM_DATA_4) () ([Input] [Output])), (51, GPIO51(_3 =>
8067        CAM_DATA_5) () ([Input] [Output])), (52, GPIO52(_2 => FSPICS0 _3 => CAM_DATA_6)
8068        (_2 => FSPICS0) ([Input] [Output])), (53, GPIO53(_2 => FSPICLK _3 => CAM_DATA_7)
8069        (_2 => FSPICLK) ([Input] [Output])), (54, GPIO54(_0 => MTDO _2 => FSPID _3 =>
8070        CAM_PCLK) (_0 => MTDO _2 => FSPID) ([Input] [Output])), (55, GPIO55(_0 => MTCK _2
8071        => FSPIQ _3 => CAM_XCLK) (_0 => MTCK _2 => FSPIQ _3 => CAM_XCLK) ([Input]
8072        [Output])), (56, GPIO56(_0 => MTDI _2 => FSPIHD _3 => CAM_V_SYNC) (_0 => MTDI _2
8073        => FSPIHD) ([Input] [Output])), (57, GPIO57(_0 => MTMS _2 => FSPIWP _3 =>
8074        CAM_H_SYNC) (_0 => MTMS _2 => FSPIWP) ([Input] [Output])), (58, GPIO58() (_0 =>
8075        U0TXD) ([Input] [Output])), (59, GPIO59(_0 => U0RXD) () ([Input] [Output])), (60,
8076        GPIO60() () ([Input] [Output])), (61, GPIO61() () ([Input] [Output]))));
8077    };
8078}
8079/// This macro can be used to generate code for each analog function of each GPIO.
8080///
8081/// For an explanation on the general syntax, as well as usage of individual/repeated
8082/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
8083///
8084/// This macro has two options for its "Individual matcher" case:
8085///
8086/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
8087/// - group: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` - expanded signal
8088///   case, where you need the number(s) of a signal, or the general group to which the signal
8089///   belongs. For example, in case of `ADC2_CH3` the expanded form looks like `(ADC2_CH3, ADCn_CHm,
8090///   2, 3)`.
8091///
8092/// Macro fragments:
8093///
8094/// - `$signal`: the name of the signal.
8095/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
8096///   is `ADCn_CHm`.
8097/// - `$number`: the numbers extracted from `$signal`.
8098/// - `$gpio`: the name of the GPIO.
8099///
8100/// Example data:
8101/// - `(ADC2_CH5, GPIO12)`
8102/// - `((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12)`
8103///
8104/// The expanded syntax is only available when the signal has at least one numbered component.
8105#[macro_export]
8106#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8107macro_rules! for_each_analog_function {
8108    ($($pattern:tt => $code:tt;)*) => {
8109        macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
8110        tt) => {} } _for_each_inner_analog_function!((XTAL_32K_N, GPIO0));
8111        _for_each_inner_analog_function!((XTAL_32K_P, GPIO1));
8112        _for_each_inner_analog_function!((DAC1, GPIO4));
8113        _for_each_inner_analog_function!((DAC2, GPIO5));
8114        _for_each_inner_analog_function!((USJ_DM, GPIO33));
8115        _for_each_inner_analog_function!((USJ_DP, GPIO34));
8116        _for_each_inner_analog_function!((ADC1_CH0, GPIO42));
8117        _for_each_inner_analog_function!((ADC1_CH1, GPIO43));
8118        _for_each_inner_analog_function!((ADC1_CH2, GPIO44));
8119        _for_each_inner_analog_function!((ADC1_CH3, GPIO45));
8120        _for_each_inner_analog_function!((ADC1_CH4, GPIO46));
8121        _for_each_inner_analog_function!((ADC1_CH5, GPIO47));
8122        _for_each_inner_analog_function!((ADC1_CH6, GPIO48));
8123        _for_each_inner_analog_function!((ADC1_CH7, GPIO49));
8124        _for_each_inner_analog_function!((ADC2_CH0, GPIO50));
8125        _for_each_inner_analog_function!((ADC2_CH1, GPIO51));
8126        _for_each_inner_analog_function!((ADC2_CH2, GPIO52));
8127        _for_each_inner_analog_function!((ADC2_CH3, GPIO53));
8128        _for_each_inner_analog_function!((ADC2_CH4, GPIO54));
8129        _for_each_inner_analog_function!((ADC2_CH5, GPIO55));
8130        _for_each_inner_analog_function!((ADC2_CH6, GPIO56));
8131        _for_each_inner_analog_function!((ADC2_CH7, GPIO57));
8132        _for_each_inner_analog_function!(((DAC1, DACn, 1), GPIO4));
8133        _for_each_inner_analog_function!(((DAC2, DACn, 2), GPIO5));
8134        _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO42));
8135        _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO43));
8136        _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO44));
8137        _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO45));
8138        _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO46));
8139        _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO47));
8140        _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO48));
8141        _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO49));
8142        _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO50));
8143        _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO51));
8144        _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO52));
8145        _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO53));
8146        _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO54));
8147        _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO55));
8148        _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO56));
8149        _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO57));
8150        _for_each_inner_analog_function!((all(XTAL_32K_N, GPIO0), (XTAL_32K_P, GPIO1),
8151        (DAC1, GPIO4), (DAC2, GPIO5), (USJ_DM, GPIO33), (USJ_DP, GPIO34), (ADC1_CH0,
8152        GPIO42), (ADC1_CH1, GPIO43), (ADC1_CH2, GPIO44), (ADC1_CH3, GPIO45), (ADC1_CH4,
8153        GPIO46), (ADC1_CH5, GPIO47), (ADC1_CH6, GPIO48), (ADC1_CH7, GPIO49), (ADC2_CH0,
8154        GPIO50), (ADC2_CH1, GPIO51), (ADC2_CH2, GPIO52), (ADC2_CH3, GPIO53), (ADC2_CH4,
8155        GPIO54), (ADC2_CH5, GPIO55), (ADC2_CH6, GPIO56), (ADC2_CH7, GPIO57)));
8156        _for_each_inner_analog_function!((DACn((DAC1, DACn, 1), GPIO4), ((DAC2, DACn, 2),
8157        GPIO5))); _for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0, ADCn_CHm, 1, 0),
8158        GPIO42), ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO43), ((ADC1_CH2, ADCn_CHm, 1, 2),
8159        GPIO44), ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO45), ((ADC1_CH4, ADCn_CHm, 1, 4),
8160        GPIO46), ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO47), ((ADC1_CH6, ADCn_CHm, 1, 6),
8161        GPIO48), ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO49), ((ADC2_CH0, ADCn_CHm, 2, 0),
8162        GPIO50), ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO51), ((ADC2_CH2, ADCn_CHm, 2, 2),
8163        GPIO52), ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO53), ((ADC2_CH4, ADCn_CHm, 2, 4),
8164        GPIO54), ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO55), ((ADC2_CH6, ADCn_CHm, 2, 6),
8165        GPIO56), ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO57)));
8166    };
8167}
8168/// This macro can be used to generate code for each LP function of each GPIO.
8169///
8170/// For an explanation on the general syntax, as well as usage of individual/repeated
8171/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
8172///
8173/// This macro has two options for its "Individual matcher" case:
8174///
8175/// - `all`: `($signal:ident, $gpio:ident, $af:ident)` - simple case where you only need
8176///   identifiers, and maybe the function.
8177/// - group: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident, $af:ident, ($(
8178///   $lp_input_af:ident => $lp_input_signal:ident )*) ($( $lp_output_af:ident =>
8179///   $lp_output_signal:ident )*))` - expanded signal case, where you need the number(s) of a
8180///   signal, or the general group to which the signal belongs. Every expanded branch ends with the
8181///   pad's LP input and output function groups (empty on chips without an LP GPIO matrix).
8182///
8183/// Macro fragments:
8184///
8185/// - `$signal`: the name of the signal.
8186/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
8187///   is `ADCn_CHm`.
8188/// - `$number`: the numbers extracted from `$signal`.
8189/// - `$gpio`: the name of the GPIO.
8190/// - `$af`: the LP IO MUX function, as an identifier (i.e. for function 0 this is `_0`). This is
8191///   the name of an `LpFunction` variant, and its number is the value to write to the pad's
8192///   function select field.
8193/// - `$lp_input_af`: the LP IO MUX function for an LP peripheral input on this pad.
8194/// - `$lp_input_signal`: the LP peripheral input signal name.
8195/// - `$lp_output_af`: the LP IO MUX function for an LP peripheral output on this pad.
8196/// - `$lp_output_signal`: the LP peripheral output signal name.
8197///
8198/// Example data:
8199/// - `(LP_GPIO15, GPIO12, _0)`
8200/// - `((LP_GPIO15, LP_GPIOn, 15), GPIO12, _0, () ())`
8201/// - `((LP_GPIO14, LP_GPIOn, 14), GPIO14, _1, () (_0 => LP_UART_TXD))`
8202/// - `((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2, _3, () ())`
8203///
8204/// The expanded syntax is only available when the signal has at least one numbered component.
8205#[macro_export]
8206#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8207macro_rules! for_each_lp_function {
8208    ($($pattern:tt => $code:tt;)*) => {
8209        macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
8210        => {} } _for_each_inner_lp_function!((LP_GPIO0, GPIO0, _1));
8211        _for_each_inner_lp_function!((LP_GPIO1, GPIO1, _1));
8212        _for_each_inner_lp_function!((LP_GPIO2, GPIO2, _1));
8213        _for_each_inner_lp_function!((LP_GPIO3, GPIO3, _1));
8214        _for_each_inner_lp_function!((LP_GPIO4, GPIO4, _1));
8215        _for_each_inner_lp_function!((LP_GPIO5, GPIO5, _1));
8216        _for_each_inner_lp_function!((LP_GPIO6, GPIO6, _1));
8217        _for_each_inner_lp_function!((LP_GPIO7, GPIO7, _1));
8218        _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _1, () ()));
8219        _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _1, () ()));
8220        _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _1, () ()));
8221        _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _1, () ()));
8222        _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _1, () ()));
8223        _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _1, () ()));
8224        _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO6, _1, () ()));
8225        _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO7, _1, () ()));
8226        _for_each_inner_lp_function!((all(LP_GPIO0, GPIO0, _1), (LP_GPIO1, GPIO1, _1),
8227        (LP_GPIO2, GPIO2, _1), (LP_GPIO3, GPIO3, _1), (LP_GPIO4, GPIO4, _1), (LP_GPIO5,
8228        GPIO5, _1), (LP_GPIO6, GPIO6, _1), (LP_GPIO7, GPIO7, _1)));
8229        _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0, LP_GPIOn, 0), GPIO0, _1, ()
8230        ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _1, () ()), ((LP_GPIO2, LP_GPIOn, 2),
8231        GPIO2, _1, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _1, () ()), ((LP_GPIO4,
8232        LP_GPIOn, 4), GPIO4, _1, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO5, _1, () ()),
8233        ((LP_GPIO6, LP_GPIOn, 6), GPIO6, _1, () ()), ((LP_GPIO7, LP_GPIOn, 7), GPIO7, _1,
8234        () ())));
8235    };
8236}
8237/// This macro can be used to generate code for each IOMUX digital function of each GPIO.
8238///
8239/// IOMUX functions are the alternate digital functions configured via the IO_MUX registers.
8240/// Use this to implement signal-specific traits for peripherals whose pins must bypass the
8241/// GPIO matrix (e.g., EMAC, USB).
8242///
8243/// For an explanation on the general syntax, as well as usage of individual/repeated
8244/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
8245///
8246/// This macro has two options for its "Individual matcher" case:
8247///
8248/// - `all`: `($signal:ident, $gpio:ident, $af:ident)` - simple case where you only need
8249///   identifiers, and maybe the alternate function.
8250/// - group: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident, $af:ident)` -
8251///   expanded signal case, where you need the number(s) of a signal, or the general group to which
8252///   the signal belongs.
8253///
8254/// Macro fragments:
8255///
8256/// - `$signal`: the name of the signal.
8257/// - `$group`: the name of the signal, with numbers replaced by placeholders.
8258/// - `$number`: the numbers extracted from `$signal`.
8259/// - `$gpio`: the name of the GPIO.
8260/// - `$af`: the alternate function number, as an identifier (e.g. `_5`).
8261///
8262/// Example data:
8263/// - `(EMAC_RXD0, GPIO25, _5)`
8264/// - `((EMAC_RXDn, EMAC_RXDn, 0), GPIO25, _5)`
8265///
8266/// The expanded syntax is only available when the signal has at least one numbered component.
8267#[macro_export]
8268#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8269macro_rules! for_each_iomux_function {
8270    ($($pattern:tt => $code:tt;)*) => {
8271        macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
8272        tt) => {} } _for_each_inner_iomux_function!((LCD_DATA_19, GPIO2, _3));
8273        _for_each_inner_iomux_function!((LCD_DATA_20, GPIO3, _3));
8274        _for_each_inner_iomux_function!((LCD_DATA_21, GPIO4, _3));
8275        _for_each_inner_iomux_function!((LCD_DATA_22, GPIO5, _3));
8276        _for_each_inner_iomux_function!((LCD_DATA_23, GPIO7, _3));
8277        _for_each_inner_iomux_function!((EMAC_TXD0, GPIO8, _2));
8278        _for_each_inner_iomux_function!((LCD_DATA_0, GPIO8, _3));
8279        _for_each_inner_iomux_function!((FSPIHD, GPIO9, _0));
8280        _for_each_inner_iomux_function!((EMAC_TXD1, GPIO9, _2));
8281        _for_each_inner_iomux_function!((LCD_DATA_1, GPIO9, _3));
8282        _for_each_inner_iomux_function!((DBG_PSRAM_CK, GPIO9, _4));
8283        _for_each_inner_iomux_function!((FSPICS0, GPIO10, _0));
8284        _for_each_inner_iomux_function!((EMAC_TXD2, GPIO10, _2));
8285        _for_each_inner_iomux_function!((LCD_DATA_2, GPIO10, _3));
8286        _for_each_inner_iomux_function!((DBG_PSRAM_CS, GPIO10, _4));
8287        _for_each_inner_iomux_function!((FSPID, GPIO11, _0));
8288        _for_each_inner_iomux_function!((EMAC_TXD3, GPIO11, _2));
8289        _for_each_inner_iomux_function!((LCD_DATA_3, GPIO11, _3));
8290        _for_each_inner_iomux_function!((DBG_PSRAM_D, GPIO11, _4));
8291        _for_each_inner_iomux_function!((FSPICLK, GPIO12, _0));
8292        _for_each_inner_iomux_function!((EMAC_TXEN, GPIO12, _2));
8293        _for_each_inner_iomux_function!((LCD_DATA_4, GPIO12, _3));
8294        _for_each_inner_iomux_function!((DBG_PSRAM_Q, GPIO12, _4));
8295        _for_each_inner_iomux_function!((FSPIQ, GPIO13, _0));
8296        _for_each_inner_iomux_function!((EMAC_RMII_CLK, GPIO13, _2));
8297        _for_each_inner_iomux_function!((LCD_DATA_5, GPIO13, _3));
8298        _for_each_inner_iomux_function!((DBG_PSRAM_WP, GPIO13, _4));
8299        _for_each_inner_iomux_function!((FSPIWP, GPIO14, _0));
8300        _for_each_inner_iomux_function!((EMAC_RX_CLK, GPIO14, _2));
8301        _for_each_inner_iomux_function!((LCD_DATA_6, GPIO14, _3));
8302        _for_each_inner_iomux_function!((DBG_PSRAM_HOLD, GPIO14, _4));
8303        _for_each_inner_iomux_function!((FSPIIO4, GPIO15, _0));
8304        _for_each_inner_iomux_function!((EMAC_RXDV, GPIO15, _2));
8305        _for_each_inner_iomux_function!((LCD_DATA_7, GPIO15, _3));
8306        _for_each_inner_iomux_function!((DBG_PSRAM_DQ4, GPIO15, _4));
8307        _for_each_inner_iomux_function!((FSPIIO5, GPIO16, _0));
8308        _for_each_inner_iomux_function!((EMAC_RXD3, GPIO16, _2));
8309        _for_each_inner_iomux_function!((LCD_DATA_8, GPIO16, _3));
8310        _for_each_inner_iomux_function!((DBG_PSRAM_DQ5, GPIO16, _4));
8311        _for_each_inner_iomux_function!((FSPIIO6, GPIO17, _0));
8312        _for_each_inner_iomux_function!((EMAC_RXD2, GPIO17, _2));
8313        _for_each_inner_iomux_function!((LCD_DATA_9, GPIO17, _3));
8314        _for_each_inner_iomux_function!((DBG_PSRAM_DQ6, GPIO17, _4));
8315        _for_each_inner_iomux_function!((FSPIIO7, GPIO18, _0));
8316        _for_each_inner_iomux_function!((EMAC_RXD1, GPIO18, _2));
8317        _for_each_inner_iomux_function!((LCD_DATA_10, GPIO18, _3));
8318        _for_each_inner_iomux_function!((DBG_PSRAM_DQ7, GPIO18, _4));
8319        _for_each_inner_iomux_function!((FSPIDQS, GPIO19, _0));
8320        _for_each_inner_iomux_function!((EMAC_RXD0, GPIO19, _2));
8321        _for_each_inner_iomux_function!((LCD_DATA_11, GPIO19, _3));
8322        _for_each_inner_iomux_function!((DBG_PSRAM_DQS_0, GPIO19, _4));
8323        _for_each_inner_iomux_function!((SD1_DATA0, GPIO20, _0));
8324        _for_each_inner_iomux_function!((FSPICLK, GPIO20, _2));
8325        _for_each_inner_iomux_function!((DBG_FLASH_CK, GPIO20, _4));
8326        _for_each_inner_iomux_function!((SD1_DATA1, GPIO21, _0));
8327        _for_each_inner_iomux_function!((FSPID, GPIO21, _2));
8328        _for_each_inner_iomux_function!((DBG_FLASH_D, GPIO21, _4));
8329        _for_each_inner_iomux_function!((SD1_DATA2, GPIO22, _0));
8330        _for_each_inner_iomux_function!((FSPIQ, GPIO22, _2));
8331        _for_each_inner_iomux_function!((DBG_FLASH_CS, GPIO22, _4));
8332        _for_each_inner_iomux_function!((SD1_DATA3, GPIO23, _0));
8333        _for_each_inner_iomux_function!((FSPICS0, GPIO23, _2));
8334        _for_each_inner_iomux_function!((DBG_FLASH_Q, GPIO23, _4));
8335        _for_each_inner_iomux_function!((SD1_CLK, GPIO24, _0));
8336        _for_each_inner_iomux_function!((FSPIHD, GPIO24, _2));
8337        _for_each_inner_iomux_function!((DBG_FLASH_WP, GPIO24, _4));
8338        _for_each_inner_iomux_function!((SD1_CMD, GPIO25, _0));
8339        _for_each_inner_iomux_function!((FSPIWP, GPIO25, _2));
8340        _for_each_inner_iomux_function!((DBG_FLASH_HOLD, GPIO25, _4));
8341        _for_each_inner_iomux_function!((SPICS0, GPIO26, _0));
8342        _for_each_inner_iomux_function!((SPIQ, GPIO27, _0));
8343        _for_each_inner_iomux_function!((SPIWP, GPIO28, _0));
8344        _for_each_inner_iomux_function!((SPIHD, GPIO30, _0));
8345        _for_each_inner_iomux_function!((SPICLK, GPIO31, _0));
8346        _for_each_inner_iomux_function!((SPID, GPIO32, _0));
8347        _for_each_inner_iomux_function!((LCD_DATA_12, GPIO33, _3));
8348        _for_each_inner_iomux_function!((LCD_DATA_13, GPIO34, _3));
8349        _for_each_inner_iomux_function!((REF_50M_CLK, GPIO35, _2));
8350        _for_each_inner_iomux_function!((LCD_DATA_14, GPIO35, _3));
8351        _for_each_inner_iomux_function!((SD2_CDATA0, GPIO35, _4));
8352        _for_each_inner_iomux_function!((EMAC_RXDV, GPIO36, _2));
8353        _for_each_inner_iomux_function!((LCD_DATA_15, GPIO36, _3));
8354        _for_each_inner_iomux_function!((SD2_CDATA1, GPIO36, _4));
8355        _for_each_inner_iomux_function!((EMAC_TXEN, GPIO37, _2));
8356        _for_each_inner_iomux_function!((LCD_DATA_16, GPIO37, _3));
8357        _for_each_inner_iomux_function!((SD2_CDATA2, GPIO37, _4));
8358        _for_each_inner_iomux_function!((EMAC_RXD3, GPIO38, _2));
8359        _for_each_inner_iomux_function!((LCD_DATA_17, GPIO38, _3));
8360        _for_each_inner_iomux_function!((SD2_CDATA3, GPIO38, _4));
8361        _for_each_inner_iomux_function!((EMAC_RXD2, GPIO39, _2));
8362        _for_each_inner_iomux_function!((LCD_DATA_18, GPIO39, _3));
8363        _for_each_inner_iomux_function!((SD2_CCLK, GPIO39, _4));
8364        _for_each_inner_iomux_function!((EMAC_RXD1, GPIO40, _2));
8365        _for_each_inner_iomux_function!((LCD_PCLK, GPIO40, _3));
8366        _for_each_inner_iomux_function!((SD2_CCMD, GPIO40, _4));
8367        _for_each_inner_iomux_function!((EMAC_RX_CLK, GPIO42, _2));
8368        _for_each_inner_iomux_function!((EMAC_RMII_CLK, GPIO43, _2));
8369        _for_each_inner_iomux_function!((LCD_H_ENABLE, GPIO43, _3));
8370        _for_each_inner_iomux_function!((EMAC_TXD0, GPIO44, _2));
8371        _for_each_inner_iomux_function!((LCD_H_SYNC, GPIO44, _3));
8372        _for_each_inner_iomux_function!((EMAC_TXD1, GPIO45, _2));
8373        _for_each_inner_iomux_function!((LCD_V_SYNC, GPIO45, _3));
8374        _for_each_inner_iomux_function!((EMAC_TXD2, GPIO46, _2));
8375        _for_each_inner_iomux_function!((CAM_DATA_0, GPIO46, _3));
8376        _for_each_inner_iomux_function!((EMAC_TXD3, GPIO47, _2));
8377        _for_each_inner_iomux_function!((CAM_DATA_1, GPIO47, _3));
8378        _for_each_inner_iomux_function!((CAM_DATA_2, GPIO48, _3));
8379        _for_each_inner_iomux_function!((CAM_DATA_3, GPIO49, _3));
8380        _for_each_inner_iomux_function!((CAM_DATA_4, GPIO50, _3));
8381        _for_each_inner_iomux_function!((CAM_DATA_5, GPIO51, _3));
8382        _for_each_inner_iomux_function!((FSPICS0, GPIO52, _2));
8383        _for_each_inner_iomux_function!((CAM_DATA_6, GPIO52, _3));
8384        _for_each_inner_iomux_function!((FSPICLK, GPIO53, _2));
8385        _for_each_inner_iomux_function!((CAM_DATA_7, GPIO53, _3));
8386        _for_each_inner_iomux_function!((MTDO, GPIO54, _0));
8387        _for_each_inner_iomux_function!((FSPID, GPIO54, _2));
8388        _for_each_inner_iomux_function!((CAM_PCLK, GPIO54, _3));
8389        _for_each_inner_iomux_function!((MTCK, GPIO55, _0));
8390        _for_each_inner_iomux_function!((FSPIQ, GPIO55, _2));
8391        _for_each_inner_iomux_function!((CAM_XCLK, GPIO55, _3));
8392        _for_each_inner_iomux_function!((MTDI, GPIO56, _0));
8393        _for_each_inner_iomux_function!((FSPIHD, GPIO56, _2));
8394        _for_each_inner_iomux_function!((CAM_V_SYNC, GPIO56, _3));
8395        _for_each_inner_iomux_function!((MTMS, GPIO57, _0));
8396        _for_each_inner_iomux_function!((FSPIWP, GPIO57, _2));
8397        _for_each_inner_iomux_function!((CAM_H_SYNC, GPIO57, _3));
8398        _for_each_inner_iomux_function!((U0TXD, GPIO58, _0));
8399        _for_each_inner_iomux_function!((U0RXD, GPIO59, _0));
8400        _for_each_inner_iomux_function!(((LCD_DATA_19, LCD_DATA_n, 19), GPIO2, _3));
8401        _for_each_inner_iomux_function!(((LCD_DATA_20, LCD_DATA_n, 20), GPIO3, _3));
8402        _for_each_inner_iomux_function!(((LCD_DATA_21, LCD_DATA_n, 21), GPIO4, _3));
8403        _for_each_inner_iomux_function!(((LCD_DATA_22, LCD_DATA_n, 22), GPIO5, _3));
8404        _for_each_inner_iomux_function!(((LCD_DATA_23, LCD_DATA_n, 23), GPIO7, _3));
8405        _for_each_inner_iomux_function!(((LCD_DATA_0, LCD_DATA_n, 0), GPIO8, _3));
8406        _for_each_inner_iomux_function!(((LCD_DATA_1, LCD_DATA_n, 1), GPIO9, _3));
8407        _for_each_inner_iomux_function!(((LCD_DATA_2, LCD_DATA_n, 2), GPIO10, _3));
8408        _for_each_inner_iomux_function!(((LCD_DATA_3, LCD_DATA_n, 3), GPIO11, _3));
8409        _for_each_inner_iomux_function!(((LCD_DATA_4, LCD_DATA_n, 4), GPIO12, _3));
8410        _for_each_inner_iomux_function!(((LCD_DATA_5, LCD_DATA_n, 5), GPIO13, _3));
8411        _for_each_inner_iomux_function!(((LCD_DATA_6, LCD_DATA_n, 6), GPIO14, _3));
8412        _for_each_inner_iomux_function!(((LCD_DATA_7, LCD_DATA_n, 7), GPIO15, _3));
8413        _for_each_inner_iomux_function!(((LCD_DATA_8, LCD_DATA_n, 8), GPIO16, _3));
8414        _for_each_inner_iomux_function!(((LCD_DATA_9, LCD_DATA_n, 9), GPIO17, _3));
8415        _for_each_inner_iomux_function!(((LCD_DATA_10, LCD_DATA_n, 10), GPIO18, _3));
8416        _for_each_inner_iomux_function!(((LCD_DATA_11, LCD_DATA_n, 11), GPIO19, _3));
8417        _for_each_inner_iomux_function!(((LCD_DATA_12, LCD_DATA_n, 12), GPIO33, _3));
8418        _for_each_inner_iomux_function!(((LCD_DATA_13, LCD_DATA_n, 13), GPIO34, _3));
8419        _for_each_inner_iomux_function!(((LCD_DATA_14, LCD_DATA_n, 14), GPIO35, _3));
8420        _for_each_inner_iomux_function!(((LCD_DATA_15, LCD_DATA_n, 15), GPIO36, _3));
8421        _for_each_inner_iomux_function!(((LCD_DATA_16, LCD_DATA_n, 16), GPIO37, _3));
8422        _for_each_inner_iomux_function!(((LCD_DATA_17, LCD_DATA_n, 17), GPIO38, _3));
8423        _for_each_inner_iomux_function!(((LCD_DATA_18, LCD_DATA_n, 18), GPIO39, _3));
8424        _for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO8, _2));
8425        _for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO9, _2));
8426        _for_each_inner_iomux_function!(((EMAC_TXD2, EMAC_TXDn, 2), GPIO10, _2));
8427        _for_each_inner_iomux_function!(((EMAC_TXD3, EMAC_TXDn, 3), GPIO11, _2));
8428        _for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO44, _2));
8429        _for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO45, _2));
8430        _for_each_inner_iomux_function!(((EMAC_TXD2, EMAC_TXDn, 2), GPIO46, _2));
8431        _for_each_inner_iomux_function!(((EMAC_TXD3, EMAC_TXDn, 3), GPIO47, _2));
8432        _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO10, _0));
8433        _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO23, _2));
8434        _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO52, _2));
8435        _for_each_inner_iomux_function!(((FSPIIO4, FSPIIOn, 4), GPIO15, _0));
8436        _for_each_inner_iomux_function!(((FSPIIO5, FSPIIOn, 5), GPIO16, _0));
8437        _for_each_inner_iomux_function!(((FSPIIO6, FSPIIOn, 6), GPIO17, _0));
8438        _for_each_inner_iomux_function!(((FSPIIO7, FSPIIOn, 7), GPIO18, _0));
8439        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4), GPIO15, _4));
8440        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO16, _4));
8441        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ6, DBG_PSRAM_DQn, 6), GPIO17, _4));
8442        _for_each_inner_iomux_function!(((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO18, _4));
8443        _for_each_inner_iomux_function!(((EMAC_RXD3, EMAC_RXDn, 3), GPIO16, _2));
8444        _for_each_inner_iomux_function!(((EMAC_RXD2, EMAC_RXDn, 2), GPIO17, _2));
8445        _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO18, _2));
8446        _for_each_inner_iomux_function!(((EMAC_RXD0, EMAC_RXDn, 0), GPIO19, _2));
8447        _for_each_inner_iomux_function!(((EMAC_RXD3, EMAC_RXDn, 3), GPIO38, _2));
8448        _for_each_inner_iomux_function!(((EMAC_RXD2, EMAC_RXDn, 2), GPIO39, _2));
8449        _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO40, _2));
8450        _for_each_inner_iomux_function!(((DBG_PSRAM_DQS_0, DBG_PSRAM_DQS_n, 0), GPIO19,
8451        _4)); _for_each_inner_iomux_function!(((SD1_DATA0, SDn_DATAm, 1, 0), GPIO20,
8452        _0)); _for_each_inner_iomux_function!(((SD1_DATA1, SDn_DATAm, 1, 1), GPIO21,
8453        _0)); _for_each_inner_iomux_function!(((SD1_DATA2, SDn_DATAm, 1, 2), GPIO22,
8454        _0)); _for_each_inner_iomux_function!(((SD1_DATA3, SDn_DATAm, 1, 3), GPIO23,
8455        _0)); _for_each_inner_iomux_function!(((SD1_CLK, SDn_CLK, 1), GPIO24, _0));
8456        _for_each_inner_iomux_function!(((SD1_CMD, SDn_CMD, 1), GPIO25, _0));
8457        _for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO26, _0));
8458        _for_each_inner_iomux_function!(((SD2_CDATA0, SDn_CDATAm, 2, 0), GPIO35, _4));
8459        _for_each_inner_iomux_function!(((SD2_CDATA1, SDn_CDATAm, 2, 1), GPIO36, _4));
8460        _for_each_inner_iomux_function!(((SD2_CDATA2, SDn_CDATAm, 2, 2), GPIO37, _4));
8461        _for_each_inner_iomux_function!(((SD2_CDATA3, SDn_CDATAm, 2, 3), GPIO38, _4));
8462        _for_each_inner_iomux_function!(((SD2_CCLK, SDn_CCLK, 2), GPIO39, _4));
8463        _for_each_inner_iomux_function!(((SD2_CCMD, SDn_CCMD, 2), GPIO40, _4));
8464        _for_each_inner_iomux_function!(((CAM_DATA_0, CAM_DATA_n, 0), GPIO46, _3));
8465        _for_each_inner_iomux_function!(((CAM_DATA_1, CAM_DATA_n, 1), GPIO47, _3));
8466        _for_each_inner_iomux_function!(((CAM_DATA_2, CAM_DATA_n, 2), GPIO48, _3));
8467        _for_each_inner_iomux_function!(((CAM_DATA_3, CAM_DATA_n, 3), GPIO49, _3));
8468        _for_each_inner_iomux_function!(((CAM_DATA_4, CAM_DATA_n, 4), GPIO50, _3));
8469        _for_each_inner_iomux_function!(((CAM_DATA_5, CAM_DATA_n, 5), GPIO51, _3));
8470        _for_each_inner_iomux_function!(((CAM_DATA_6, CAM_DATA_n, 6), GPIO52, _3));
8471        _for_each_inner_iomux_function!(((CAM_DATA_7, CAM_DATA_n, 7), GPIO53, _3));
8472        _for_each_inner_iomux_function!((all(LCD_DATA_19, GPIO2, _3), (LCD_DATA_20,
8473        GPIO3, _3), (LCD_DATA_21, GPIO4, _3), (LCD_DATA_22, GPIO5, _3), (LCD_DATA_23,
8474        GPIO7, _3), (EMAC_TXD0, GPIO8, _2), (LCD_DATA_0, GPIO8, _3), (FSPIHD, GPIO9, _0),
8475        (EMAC_TXD1, GPIO9, _2), (LCD_DATA_1, GPIO9, _3), (DBG_PSRAM_CK, GPIO9, _4),
8476        (FSPICS0, GPIO10, _0), (EMAC_TXD2, GPIO10, _2), (LCD_DATA_2, GPIO10, _3),
8477        (DBG_PSRAM_CS, GPIO10, _4), (FSPID, GPIO11, _0), (EMAC_TXD3, GPIO11, _2),
8478        (LCD_DATA_3, GPIO11, _3), (DBG_PSRAM_D, GPIO11, _4), (FSPICLK, GPIO12, _0),
8479        (EMAC_TXEN, GPIO12, _2), (LCD_DATA_4, GPIO12, _3), (DBG_PSRAM_Q, GPIO12, _4),
8480        (FSPIQ, GPIO13, _0), (EMAC_RMII_CLK, GPIO13, _2), (LCD_DATA_5, GPIO13, _3),
8481        (DBG_PSRAM_WP, GPIO13, _4), (FSPIWP, GPIO14, _0), (EMAC_RX_CLK, GPIO14, _2),
8482        (LCD_DATA_6, GPIO14, _3), (DBG_PSRAM_HOLD, GPIO14, _4), (FSPIIO4, GPIO15, _0),
8483        (EMAC_RXDV, GPIO15, _2), (LCD_DATA_7, GPIO15, _3), (DBG_PSRAM_DQ4, GPIO15, _4),
8484        (FSPIIO5, GPIO16, _0), (EMAC_RXD3, GPIO16, _2), (LCD_DATA_8, GPIO16, _3),
8485        (DBG_PSRAM_DQ5, GPIO16, _4), (FSPIIO6, GPIO17, _0), (EMAC_RXD2, GPIO17, _2),
8486        (LCD_DATA_9, GPIO17, _3), (DBG_PSRAM_DQ6, GPIO17, _4), (FSPIIO7, GPIO18, _0),
8487        (EMAC_RXD1, GPIO18, _2), (LCD_DATA_10, GPIO18, _3), (DBG_PSRAM_DQ7, GPIO18, _4),
8488        (FSPIDQS, GPIO19, _0), (EMAC_RXD0, GPIO19, _2), (LCD_DATA_11, GPIO19, _3),
8489        (DBG_PSRAM_DQS_0, GPIO19, _4), (SD1_DATA0, GPIO20, _0), (FSPICLK, GPIO20, _2),
8490        (DBG_FLASH_CK, GPIO20, _4), (SD1_DATA1, GPIO21, _0), (FSPID, GPIO21, _2),
8491        (DBG_FLASH_D, GPIO21, _4), (SD1_DATA2, GPIO22, _0), (FSPIQ, GPIO22, _2),
8492        (DBG_FLASH_CS, GPIO22, _4), (SD1_DATA3, GPIO23, _0), (FSPICS0, GPIO23, _2),
8493        (DBG_FLASH_Q, GPIO23, _4), (SD1_CLK, GPIO24, _0), (FSPIHD, GPIO24, _2),
8494        (DBG_FLASH_WP, GPIO24, _4), (SD1_CMD, GPIO25, _0), (FSPIWP, GPIO25, _2),
8495        (DBG_FLASH_HOLD, GPIO25, _4), (SPICS0, GPIO26, _0), (SPIQ, GPIO27, _0), (SPIWP,
8496        GPIO28, _0), (SPIHD, GPIO30, _0), (SPICLK, GPIO31, _0), (SPID, GPIO32, _0),
8497        (LCD_DATA_12, GPIO33, _3), (LCD_DATA_13, GPIO34, _3), (REF_50M_CLK, GPIO35, _2),
8498        (LCD_DATA_14, GPIO35, _3), (SD2_CDATA0, GPIO35, _4), (EMAC_RXDV, GPIO36, _2),
8499        (LCD_DATA_15, GPIO36, _3), (SD2_CDATA1, GPIO36, _4), (EMAC_TXEN, GPIO37, _2),
8500        (LCD_DATA_16, GPIO37, _3), (SD2_CDATA2, GPIO37, _4), (EMAC_RXD3, GPIO38, _2),
8501        (LCD_DATA_17, GPIO38, _3), (SD2_CDATA3, GPIO38, _4), (EMAC_RXD2, GPIO39, _2),
8502        (LCD_DATA_18, GPIO39, _3), (SD2_CCLK, GPIO39, _4), (EMAC_RXD1, GPIO40, _2),
8503        (LCD_PCLK, GPIO40, _3), (SD2_CCMD, GPIO40, _4), (EMAC_RX_CLK, GPIO42, _2),
8504        (EMAC_RMII_CLK, GPIO43, _2), (LCD_H_ENABLE, GPIO43, _3), (EMAC_TXD0, GPIO44, _2),
8505        (LCD_H_SYNC, GPIO44, _3), (EMAC_TXD1, GPIO45, _2), (LCD_V_SYNC, GPIO45, _3),
8506        (EMAC_TXD2, GPIO46, _2), (CAM_DATA_0, GPIO46, _3), (EMAC_TXD3, GPIO47, _2),
8507        (CAM_DATA_1, GPIO47, _3), (CAM_DATA_2, GPIO48, _3), (CAM_DATA_3, GPIO49, _3),
8508        (CAM_DATA_4, GPIO50, _3), (CAM_DATA_5, GPIO51, _3), (FSPICS0, GPIO52, _2),
8509        (CAM_DATA_6, GPIO52, _3), (FSPICLK, GPIO53, _2), (CAM_DATA_7, GPIO53, _3), (MTDO,
8510        GPIO54, _0), (FSPID, GPIO54, _2), (CAM_PCLK, GPIO54, _3), (MTCK, GPIO55, _0),
8511        (FSPIQ, GPIO55, _2), (CAM_XCLK, GPIO55, _3), (MTDI, GPIO56, _0), (FSPIHD, GPIO56,
8512        _2), (CAM_V_SYNC, GPIO56, _3), (MTMS, GPIO57, _0), (FSPIWP, GPIO57, _2),
8513        (CAM_H_SYNC, GPIO57, _3), (U0TXD, GPIO58, _0), (U0RXD, GPIO59, _0)));
8514        _for_each_inner_iomux_function!((LCD_DATA_n((LCD_DATA_19, LCD_DATA_n, 19), GPIO2,
8515        _3), ((LCD_DATA_20, LCD_DATA_n, 20), GPIO3, _3), ((LCD_DATA_21, LCD_DATA_n, 21),
8516        GPIO4, _3), ((LCD_DATA_22, LCD_DATA_n, 22), GPIO5, _3), ((LCD_DATA_23,
8517        LCD_DATA_n, 23), GPIO7, _3), ((LCD_DATA_0, LCD_DATA_n, 0), GPIO8, _3),
8518        ((LCD_DATA_1, LCD_DATA_n, 1), GPIO9, _3), ((LCD_DATA_2, LCD_DATA_n, 2), GPIO10,
8519        _3), ((LCD_DATA_3, LCD_DATA_n, 3), GPIO11, _3), ((LCD_DATA_4, LCD_DATA_n, 4),
8520        GPIO12, _3), ((LCD_DATA_5, LCD_DATA_n, 5), GPIO13, _3), ((LCD_DATA_6, LCD_DATA_n,
8521        6), GPIO14, _3), ((LCD_DATA_7, LCD_DATA_n, 7), GPIO15, _3), ((LCD_DATA_8,
8522        LCD_DATA_n, 8), GPIO16, _3), ((LCD_DATA_9, LCD_DATA_n, 9), GPIO17, _3),
8523        ((LCD_DATA_10, LCD_DATA_n, 10), GPIO18, _3), ((LCD_DATA_11, LCD_DATA_n, 11),
8524        GPIO19, _3), ((LCD_DATA_12, LCD_DATA_n, 12), GPIO33, _3), ((LCD_DATA_13,
8525        LCD_DATA_n, 13), GPIO34, _3), ((LCD_DATA_14, LCD_DATA_n, 14), GPIO35, _3),
8526        ((LCD_DATA_15, LCD_DATA_n, 15), GPIO36, _3), ((LCD_DATA_16, LCD_DATA_n, 16),
8527        GPIO37, _3), ((LCD_DATA_17, LCD_DATA_n, 17), GPIO38, _3), ((LCD_DATA_18,
8528        LCD_DATA_n, 18), GPIO39, _3)));
8529        _for_each_inner_iomux_function!((EMAC_TXDn((EMAC_TXD0, EMAC_TXDn, 0), GPIO8, _2),
8530        ((EMAC_TXD1, EMAC_TXDn, 1), GPIO9, _2), ((EMAC_TXD2, EMAC_TXDn, 2), GPIO10, _2),
8531        ((EMAC_TXD3, EMAC_TXDn, 3), GPIO11, _2), ((EMAC_TXD0, EMAC_TXDn, 0), GPIO44, _2),
8532        ((EMAC_TXD1, EMAC_TXDn, 1), GPIO45, _2), ((EMAC_TXD2, EMAC_TXDn, 2), GPIO46, _2),
8533        ((EMAC_TXD3, EMAC_TXDn, 3), GPIO47, _2)));
8534        _for_each_inner_iomux_function!((FSPICSn((FSPICS0, FSPICSn, 0), GPIO10, _0),
8535        ((FSPICS0, FSPICSn, 0), GPIO23, _2), ((FSPICS0, FSPICSn, 0), GPIO52, _2)));
8536        _for_each_inner_iomux_function!((FSPIIOn((FSPIIO4, FSPIIOn, 4), GPIO15, _0),
8537        ((FSPIIO5, FSPIIOn, 5), GPIO16, _0), ((FSPIIO6, FSPIIOn, 6), GPIO17, _0),
8538        ((FSPIIO7, FSPIIOn, 7), GPIO18, _0)));
8539        _for_each_inner_iomux_function!((DBG_PSRAM_DQn((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4),
8540        GPIO15, _4), ((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO16, _4), ((DBG_PSRAM_DQ6,
8541        DBG_PSRAM_DQn, 6), GPIO17, _4), ((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO18,
8542        _4))); _for_each_inner_iomux_function!((EMAC_RXDn((EMAC_RXD3, EMAC_RXDn, 3),
8543        GPIO16, _2), ((EMAC_RXD2, EMAC_RXDn, 2), GPIO17, _2), ((EMAC_RXD1, EMAC_RXDn, 1),
8544        GPIO18, _2), ((EMAC_RXD0, EMAC_RXDn, 0), GPIO19, _2), ((EMAC_RXD3, EMAC_RXDn, 3),
8545        GPIO38, _2), ((EMAC_RXD2, EMAC_RXDn, 2), GPIO39, _2), ((EMAC_RXD1, EMAC_RXDn, 1),
8546        GPIO40, _2))); _for_each_inner_iomux_function!((DBG_PSRAM_DQS_n((DBG_PSRAM_DQS_0,
8547        DBG_PSRAM_DQS_n, 0), GPIO19, _4)));
8548        _for_each_inner_iomux_function!((SDn_DATAm((SD1_DATA0, SDn_DATAm, 1, 0), GPIO20,
8549        _0), ((SD1_DATA1, SDn_DATAm, 1, 1), GPIO21, _0), ((SD1_DATA2, SDn_DATAm, 1, 2),
8550        GPIO22, _0), ((SD1_DATA3, SDn_DATAm, 1, 3), GPIO23, _0)));
8551        _for_each_inner_iomux_function!((SDn_CLK((SD1_CLK, SDn_CLK, 1), GPIO24, _0)));
8552        _for_each_inner_iomux_function!((SDn_CMD((SD1_CMD, SDn_CMD, 1), GPIO25, _0)));
8553        _for_each_inner_iomux_function!((SPICSn((SPICS0, SPICSn, 0), GPIO26, _0)));
8554        _for_each_inner_iomux_function!((SDn_CDATAm((SD2_CDATA0, SDn_CDATAm, 2, 0),
8555        GPIO35, _4), ((SD2_CDATA1, SDn_CDATAm, 2, 1), GPIO36, _4), ((SD2_CDATA2,
8556        SDn_CDATAm, 2, 2), GPIO37, _4), ((SD2_CDATA3, SDn_CDATAm, 2, 3), GPIO38, _4)));
8557        _for_each_inner_iomux_function!((SDn_CCLK((SD2_CCLK, SDn_CCLK, 2), GPIO39, _4)));
8558        _for_each_inner_iomux_function!((SDn_CCMD((SD2_CCMD, SDn_CCMD, 2), GPIO40, _4)));
8559        _for_each_inner_iomux_function!((CAM_DATA_n((CAM_DATA_0, CAM_DATA_n, 0), GPIO46,
8560        _3), ((CAM_DATA_1, CAM_DATA_n, 1), GPIO47, _3), ((CAM_DATA_2, CAM_DATA_n, 2),
8561        GPIO48, _3), ((CAM_DATA_3, CAM_DATA_n, 3), GPIO49, _3), ((CAM_DATA_4, CAM_DATA_n,
8562        4), GPIO50, _3), ((CAM_DATA_5, CAM_DATA_n, 5), GPIO51, _3), ((CAM_DATA_6,
8563        CAM_DATA_n, 6), GPIO52, _3), ((CAM_DATA_7, CAM_DATA_n, 7), GPIO53, _3)));
8564    };
8565}
8566/// Returns the name of the GPIO that provides the given signal, as a string.
8567///
8568/// The macro takes the name of a direct function - a digital IO MUX function, an analog
8569/// function, or an LP IO MUX function - and expands to a string literal like `"GPIO4"`. It
8570/// is meant to keep documentation free of per-chip pin lists.
8571///
8572/// Signals that are not wired to a pad on this chip have to be routed through the GPIO
8573/// matrix, which can reach any pad. The macro has no pad to return for those, so it accepts
8574/// an optional fallback to expand to instead. The fallback is not validated.
8575///
8576/// If multiple pads provide the signal, the macro returns one that is not reserved for some
8577/// other purpose, such as booting or interfacing with flash.
8578///
8579/// Example usage:
8580/// - `gpio_for_signal!(ADC1_CH0)`
8581/// - `gpio_for_signal!(LP_I2C_SDA, "GPIO6")`
8582#[macro_export]
8583#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8584macro_rules! gpio_for_signal {
8585    (XTAL_32K_N $(, $_fallback:literal)?) => {
8586        "GPIO0"
8587    };
8588    (LP_GPIO0 $(, $_fallback:literal)?) => {
8589        "GPIO0"
8590    };
8591    (XTAL_32K_P $(, $_fallback:literal)?) => {
8592        "GPIO1"
8593    };
8594    (LP_GPIO1 $(, $_fallback:literal)?) => {
8595        "GPIO1"
8596    };
8597    (LCD_DATA_19 $(, $_fallback:literal)?) => {
8598        "GPIO2"
8599    };
8600    (LP_GPIO2 $(, $_fallback:literal)?) => {
8601        "GPIO2"
8602    };
8603    (LCD_DATA_20 $(, $_fallback:literal)?) => {
8604        "GPIO3"
8605    };
8606    (LP_GPIO3 $(, $_fallback:literal)?) => {
8607        "GPIO3"
8608    };
8609    (LCD_DATA_21 $(, $_fallback:literal)?) => {
8610        "GPIO4"
8611    };
8612    (DAC1 $(, $_fallback:literal)?) => {
8613        "GPIO4"
8614    };
8615    (LP_GPIO4 $(, $_fallback:literal)?) => {
8616        "GPIO4"
8617    };
8618    (LCD_DATA_22 $(, $_fallback:literal)?) => {
8619        "GPIO5"
8620    };
8621    (DAC2 $(, $_fallback:literal)?) => {
8622        "GPIO5"
8623    };
8624    (LP_GPIO5 $(, $_fallback:literal)?) => {
8625        "GPIO5"
8626    };
8627    (LP_GPIO6 $(, $_fallback:literal)?) => {
8628        "GPIO6"
8629    };
8630    (LCD_DATA_23 $(, $_fallback:literal)?) => {
8631        "GPIO7"
8632    };
8633    (LP_GPIO7 $(, $_fallback:literal)?) => {
8634        "GPIO7"
8635    };
8636    (EMAC_TXD0 $(, $_fallback:literal)?) => {
8637        "GPIO8"
8638    };
8639    (LCD_DATA_0 $(, $_fallback:literal)?) => {
8640        "GPIO8"
8641    };
8642    (FSPIHD $(, $_fallback:literal)?) => {
8643        "GPIO9"
8644    };
8645    (EMAC_TXD1 $(, $_fallback:literal)?) => {
8646        "GPIO9"
8647    };
8648    (LCD_DATA_1 $(, $_fallback:literal)?) => {
8649        "GPIO9"
8650    };
8651    (DBG_PSRAM_CK $(, $_fallback:literal)?) => {
8652        "GPIO9"
8653    };
8654    (FSPICS0 $(, $_fallback:literal)?) => {
8655        "GPIO10"
8656    };
8657    (EMAC_TXD2 $(, $_fallback:literal)?) => {
8658        "GPIO10"
8659    };
8660    (LCD_DATA_2 $(, $_fallback:literal)?) => {
8661        "GPIO10"
8662    };
8663    (DBG_PSRAM_CS $(, $_fallback:literal)?) => {
8664        "GPIO10"
8665    };
8666    (FSPID $(, $_fallback:literal)?) => {
8667        "GPIO11"
8668    };
8669    (EMAC_TXD3 $(, $_fallback:literal)?) => {
8670        "GPIO11"
8671    };
8672    (LCD_DATA_3 $(, $_fallback:literal)?) => {
8673        "GPIO11"
8674    };
8675    (DBG_PSRAM_D $(, $_fallback:literal)?) => {
8676        "GPIO11"
8677    };
8678    (FSPICLK $(, $_fallback:literal)?) => {
8679        "GPIO12"
8680    };
8681    (EMAC_TXEN $(, $_fallback:literal)?) => {
8682        "GPIO12"
8683    };
8684    (LCD_DATA_4 $(, $_fallback:literal)?) => {
8685        "GPIO12"
8686    };
8687    (DBG_PSRAM_Q $(, $_fallback:literal)?) => {
8688        "GPIO12"
8689    };
8690    (FSPIQ $(, $_fallback:literal)?) => {
8691        "GPIO13"
8692    };
8693    (EMAC_RMII_CLK $(, $_fallback:literal)?) => {
8694        "GPIO13"
8695    };
8696    (LCD_DATA_5 $(, $_fallback:literal)?) => {
8697        "GPIO13"
8698    };
8699    (DBG_PSRAM_WP $(, $_fallback:literal)?) => {
8700        "GPIO13"
8701    };
8702    (FSPIWP $(, $_fallback:literal)?) => {
8703        "GPIO14"
8704    };
8705    (EMAC_RX_CLK $(, $_fallback:literal)?) => {
8706        "GPIO14"
8707    };
8708    (LCD_DATA_6 $(, $_fallback:literal)?) => {
8709        "GPIO14"
8710    };
8711    (DBG_PSRAM_HOLD $(, $_fallback:literal)?) => {
8712        "GPIO14"
8713    };
8714    (FSPIIO4 $(, $_fallback:literal)?) => {
8715        "GPIO15"
8716    };
8717    (EMAC_RXDV $(, $_fallback:literal)?) => {
8718        "GPIO15"
8719    };
8720    (LCD_DATA_7 $(, $_fallback:literal)?) => {
8721        "GPIO15"
8722    };
8723    (DBG_PSRAM_DQ4 $(, $_fallback:literal)?) => {
8724        "GPIO15"
8725    };
8726    (FSPIIO5 $(, $_fallback:literal)?) => {
8727        "GPIO16"
8728    };
8729    (EMAC_RXD3 $(, $_fallback:literal)?) => {
8730        "GPIO16"
8731    };
8732    (LCD_DATA_8 $(, $_fallback:literal)?) => {
8733        "GPIO16"
8734    };
8735    (DBG_PSRAM_DQ5 $(, $_fallback:literal)?) => {
8736        "GPIO16"
8737    };
8738    (FSPIIO6 $(, $_fallback:literal)?) => {
8739        "GPIO17"
8740    };
8741    (EMAC_RXD2 $(, $_fallback:literal)?) => {
8742        "GPIO17"
8743    };
8744    (LCD_DATA_9 $(, $_fallback:literal)?) => {
8745        "GPIO17"
8746    };
8747    (DBG_PSRAM_DQ6 $(, $_fallback:literal)?) => {
8748        "GPIO17"
8749    };
8750    (FSPIIO7 $(, $_fallback:literal)?) => {
8751        "GPIO18"
8752    };
8753    (EMAC_RXD1 $(, $_fallback:literal)?) => {
8754        "GPIO18"
8755    };
8756    (LCD_DATA_10 $(, $_fallback:literal)?) => {
8757        "GPIO18"
8758    };
8759    (DBG_PSRAM_DQ7 $(, $_fallback:literal)?) => {
8760        "GPIO18"
8761    };
8762    (FSPIDQS $(, $_fallback:literal)?) => {
8763        "GPIO19"
8764    };
8765    (EMAC_RXD0 $(, $_fallback:literal)?) => {
8766        "GPIO19"
8767    };
8768    (LCD_DATA_11 $(, $_fallback:literal)?) => {
8769        "GPIO19"
8770    };
8771    (DBG_PSRAM_DQS_0 $(, $_fallback:literal)?) => {
8772        "GPIO19"
8773    };
8774    (SD1_DATA0 $(, $_fallback:literal)?) => {
8775        "GPIO20"
8776    };
8777    (DBG_FLASH_CK $(, $_fallback:literal)?) => {
8778        "GPIO20"
8779    };
8780    (SD1_DATA1 $(, $_fallback:literal)?) => {
8781        "GPIO21"
8782    };
8783    (DBG_FLASH_D $(, $_fallback:literal)?) => {
8784        "GPIO21"
8785    };
8786    (SD1_DATA2 $(, $_fallback:literal)?) => {
8787        "GPIO22"
8788    };
8789    (DBG_FLASH_CS $(, $_fallback:literal)?) => {
8790        "GPIO22"
8791    };
8792    (SD1_DATA3 $(, $_fallback:literal)?) => {
8793        "GPIO23"
8794    };
8795    (DBG_FLASH_Q $(, $_fallback:literal)?) => {
8796        "GPIO23"
8797    };
8798    (SD1_CLK $(, $_fallback:literal)?) => {
8799        "GPIO24"
8800    };
8801    (DBG_FLASH_WP $(, $_fallback:literal)?) => {
8802        "GPIO24"
8803    };
8804    (SD1_CMD $(, $_fallback:literal)?) => {
8805        "GPIO25"
8806    };
8807    (DBG_FLASH_HOLD $(, $_fallback:literal)?) => {
8808        "GPIO25"
8809    };
8810    (SPICS0 $(, $_fallback:literal)?) => {
8811        "GPIO26"
8812    };
8813    (SPIQ $(, $_fallback:literal)?) => {
8814        "GPIO27"
8815    };
8816    (SPIWP $(, $_fallback:literal)?) => {
8817        "GPIO28"
8818    };
8819    (SPIHD $(, $_fallback:literal)?) => {
8820        "GPIO30"
8821    };
8822    (SPICLK $(, $_fallback:literal)?) => {
8823        "GPIO31"
8824    };
8825    (SPID $(, $_fallback:literal)?) => {
8826        "GPIO32"
8827    };
8828    (LCD_DATA_12 $(, $_fallback:literal)?) => {
8829        "GPIO33"
8830    };
8831    (USJ_DM $(, $_fallback:literal)?) => {
8832        "GPIO33"
8833    };
8834    (LCD_DATA_13 $(, $_fallback:literal)?) => {
8835        "GPIO34"
8836    };
8837    (USJ_DP $(, $_fallback:literal)?) => {
8838        "GPIO34"
8839    };
8840    (REF_50M_CLK $(, $_fallback:literal)?) => {
8841        "GPIO35"
8842    };
8843    (LCD_DATA_14 $(, $_fallback:literal)?) => {
8844        "GPIO35"
8845    };
8846    (SD2_CDATA0 $(, $_fallback:literal)?) => {
8847        "GPIO35"
8848    };
8849    (LCD_DATA_15 $(, $_fallback:literal)?) => {
8850        "GPIO36"
8851    };
8852    (SD2_CDATA1 $(, $_fallback:literal)?) => {
8853        "GPIO36"
8854    };
8855    (LCD_DATA_16 $(, $_fallback:literal)?) => {
8856        "GPIO37"
8857    };
8858    (SD2_CDATA2 $(, $_fallback:literal)?) => {
8859        "GPIO37"
8860    };
8861    (LCD_DATA_17 $(, $_fallback:literal)?) => {
8862        "GPIO38"
8863    };
8864    (SD2_CDATA3 $(, $_fallback:literal)?) => {
8865        "GPIO38"
8866    };
8867    (LCD_DATA_18 $(, $_fallback:literal)?) => {
8868        "GPIO39"
8869    };
8870    (SD2_CCLK $(, $_fallback:literal)?) => {
8871        "GPIO39"
8872    };
8873    (LCD_PCLK $(, $_fallback:literal)?) => {
8874        "GPIO40"
8875    };
8876    (SD2_CCMD $(, $_fallback:literal)?) => {
8877        "GPIO40"
8878    };
8879    (ADC1_CH0 $(, $_fallback:literal)?) => {
8880        "GPIO42"
8881    };
8882    (LCD_H_ENABLE $(, $_fallback:literal)?) => {
8883        "GPIO43"
8884    };
8885    (ADC1_CH1 $(, $_fallback:literal)?) => {
8886        "GPIO43"
8887    };
8888    (LCD_H_SYNC $(, $_fallback:literal)?) => {
8889        "GPIO44"
8890    };
8891    (ADC1_CH2 $(, $_fallback:literal)?) => {
8892        "GPIO44"
8893    };
8894    (LCD_V_SYNC $(, $_fallback:literal)?) => {
8895        "GPIO45"
8896    };
8897    (ADC1_CH3 $(, $_fallback:literal)?) => {
8898        "GPIO45"
8899    };
8900    (CAM_DATA_0 $(, $_fallback:literal)?) => {
8901        "GPIO46"
8902    };
8903    (ADC1_CH4 $(, $_fallback:literal)?) => {
8904        "GPIO46"
8905    };
8906    (CAM_DATA_1 $(, $_fallback:literal)?) => {
8907        "GPIO47"
8908    };
8909    (ADC1_CH5 $(, $_fallback:literal)?) => {
8910        "GPIO47"
8911    };
8912    (CAM_DATA_2 $(, $_fallback:literal)?) => {
8913        "GPIO48"
8914    };
8915    (ADC1_CH6 $(, $_fallback:literal)?) => {
8916        "GPIO48"
8917    };
8918    (CAM_DATA_3 $(, $_fallback:literal)?) => {
8919        "GPIO49"
8920    };
8921    (ADC1_CH7 $(, $_fallback:literal)?) => {
8922        "GPIO49"
8923    };
8924    (CAM_DATA_4 $(, $_fallback:literal)?) => {
8925        "GPIO50"
8926    };
8927    (ADC2_CH0 $(, $_fallback:literal)?) => {
8928        "GPIO50"
8929    };
8930    (CAM_DATA_5 $(, $_fallback:literal)?) => {
8931        "GPIO51"
8932    };
8933    (ADC2_CH1 $(, $_fallback:literal)?) => {
8934        "GPIO51"
8935    };
8936    (CAM_DATA_6 $(, $_fallback:literal)?) => {
8937        "GPIO52"
8938    };
8939    (ADC2_CH2 $(, $_fallback:literal)?) => {
8940        "GPIO52"
8941    };
8942    (CAM_DATA_7 $(, $_fallback:literal)?) => {
8943        "GPIO53"
8944    };
8945    (ADC2_CH3 $(, $_fallback:literal)?) => {
8946        "GPIO53"
8947    };
8948    (MTDO $(, $_fallback:literal)?) => {
8949        "GPIO54"
8950    };
8951    (CAM_PCLK $(, $_fallback:literal)?) => {
8952        "GPIO54"
8953    };
8954    (ADC2_CH4 $(, $_fallback:literal)?) => {
8955        "GPIO54"
8956    };
8957    (MTCK $(, $_fallback:literal)?) => {
8958        "GPIO55"
8959    };
8960    (CAM_XCLK $(, $_fallback:literal)?) => {
8961        "GPIO55"
8962    };
8963    (ADC2_CH5 $(, $_fallback:literal)?) => {
8964        "GPIO55"
8965    };
8966    (MTDI $(, $_fallback:literal)?) => {
8967        "GPIO56"
8968    };
8969    (CAM_V_SYNC $(, $_fallback:literal)?) => {
8970        "GPIO56"
8971    };
8972    (ADC2_CH6 $(, $_fallback:literal)?) => {
8973        "GPIO56"
8974    };
8975    (MTMS $(, $_fallback:literal)?) => {
8976        "GPIO57"
8977    };
8978    (CAM_H_SYNC $(, $_fallback:literal)?) => {
8979        "GPIO57"
8980    };
8981    (ADC2_CH7 $(, $_fallback:literal)?) => {
8982        "GPIO57"
8983    };
8984    (U0TXD $(, $_fallback:literal)?) => {
8985        "GPIO58"
8986    };
8987    (U0RXD $(, $_fallback:literal)?) => {
8988        "GPIO59"
8989    };
8990    ($_signal:ident, $fallback:literal) => {
8991        $fallback
8992    };
8993}
8994/// This macro can be used to generate code for each digital GPIO that deep-sleep entry
8995/// isolates when `gpio.need_soft_isolate_during_pd` is set.
8996///
8997/// For an explanation on the general syntax, as well as usage of individual/repeated
8998/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
8999///
9000/// The list excludes low-power pads and pads that interface with flash or PSRAM. Isolating
9001/// a memory-interface pad cuts instruction fetch.
9002///
9003/// This macro has one option for its "Individual matcher" case:
9004///
9005/// Syntax: `($n:literal)`
9006///
9007/// Macro fragments:
9008///
9009/// - `$n`: the number of the GPIO. For `GPIO8`, `$n` is 8.
9010///
9011/// Example data: `(8)`
9012#[macro_export]
9013#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
9014macro_rules! for_each_gpio_soft_isolate {
9015    ($($pattern:tt => $code:tt;)*) => {
9016        macro_rules! _for_each_inner_gpio_soft_isolate { $(($pattern) => $code;)* ($other
9017        : tt) => {} } _for_each_inner_gpio_soft_isolate!((8));
9018        _for_each_inner_gpio_soft_isolate!((9));
9019        _for_each_inner_gpio_soft_isolate!((10));
9020        _for_each_inner_gpio_soft_isolate!((11));
9021        _for_each_inner_gpio_soft_isolate!((12));
9022        _for_each_inner_gpio_soft_isolate!((13));
9023        _for_each_inner_gpio_soft_isolate!((14));
9024        _for_each_inner_gpio_soft_isolate!((15));
9025        _for_each_inner_gpio_soft_isolate!((16));
9026        _for_each_inner_gpio_soft_isolate!((17));
9027        _for_each_inner_gpio_soft_isolate!((18));
9028        _for_each_inner_gpio_soft_isolate!((19));
9029        _for_each_inner_gpio_soft_isolate!((20));
9030        _for_each_inner_gpio_soft_isolate!((21));
9031        _for_each_inner_gpio_soft_isolate!((22));
9032        _for_each_inner_gpio_soft_isolate!((23));
9033        _for_each_inner_gpio_soft_isolate!((24));
9034        _for_each_inner_gpio_soft_isolate!((25));
9035        _for_each_inner_gpio_soft_isolate!((33));
9036        _for_each_inner_gpio_soft_isolate!((34));
9037        _for_each_inner_gpio_soft_isolate!((35));
9038        _for_each_inner_gpio_soft_isolate!((36));
9039        _for_each_inner_gpio_soft_isolate!((37));
9040        _for_each_inner_gpio_soft_isolate!((38));
9041        _for_each_inner_gpio_soft_isolate!((39));
9042        _for_each_inner_gpio_soft_isolate!((40));
9043        _for_each_inner_gpio_soft_isolate!((42));
9044        _for_each_inner_gpio_soft_isolate!((43));
9045        _for_each_inner_gpio_soft_isolate!((44));
9046        _for_each_inner_gpio_soft_isolate!((45));
9047        _for_each_inner_gpio_soft_isolate!((46));
9048        _for_each_inner_gpio_soft_isolate!((47));
9049        _for_each_inner_gpio_soft_isolate!((48));
9050        _for_each_inner_gpio_soft_isolate!((49));
9051        _for_each_inner_gpio_soft_isolate!((50));
9052        _for_each_inner_gpio_soft_isolate!((51));
9053        _for_each_inner_gpio_soft_isolate!((52));
9054        _for_each_inner_gpio_soft_isolate!((53));
9055        _for_each_inner_gpio_soft_isolate!((54));
9056        _for_each_inner_gpio_soft_isolate!((55));
9057        _for_each_inner_gpio_soft_isolate!((56));
9058        _for_each_inner_gpio_soft_isolate!((57));
9059        _for_each_inner_gpio_soft_isolate!((58));
9060        _for_each_inner_gpio_soft_isolate!((59));
9061        _for_each_inner_gpio_soft_isolate!((60));
9062        _for_each_inner_gpio_soft_isolate!((61));
9063        _for_each_inner_gpio_soft_isolate!((all(8), (9), (10), (11), (12), (13), (14),
9064        (15), (16), (17), (18), (19), (20), (21), (22), (23), (24), (25), (33), (34),
9065        (35), (36), (37), (38), (39), (40), (42), (43), (44), (45), (46), (47), (48),
9066        (49), (50), (51), (52), (53), (54), (55), (56), (57), (58), (59), (60), (61)));
9067    };
9068}
9069/// Defines the `InputSignal` and `OutputSignal` enums.
9070///
9071/// This macro is intended to be called in esp-hal only.
9072#[macro_export]
9073#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
9074macro_rules! define_io_mux_signals {
9075    () => {
9076        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
9077        #[derive(Debug, PartialEq, Copy, Clone)]
9078        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
9079        #[doc(hidden)]
9080        pub enum InputSignal {
9081            U0RXD                   = 10,
9082            U0CTS                   = 11,
9083            U0DSR                   = 12,
9084            U1RXD                   = 13,
9085            U1CTS                   = 14,
9086            U1DSR                   = 15,
9087            U2RXD                   = 16,
9088            U2CTS                   = 17,
9089            U2DSR                   = 18,
9090            U3RXD                   = 137,
9091            U3CTS                   = 138,
9092            U3DSR                   = 139,
9093            I2S0O_BCK               = 25,
9094            I2S0_MCLK               = 26,
9095            I2S0O_WS                = 27,
9096            I2S0I_SD                = 28,
9097            I2S0I_BCK               = 29,
9098            I2S0I_WS                = 30,
9099            I2S0I_SD1               = 43,
9100            I2S0I_SD2               = 44,
9101            I2S0I_SD3               = 45,
9102            I2S1O_BCK               = 31,
9103            I2S1_MCLK               = 32,
9104            I2S1O_WS                = 33,
9105            I2S1I_SD                = 34,
9106            I2S1I_BCK               = 35,
9107            I2S1I_WS                = 36,
9108            FSPICLK                 = 53,
9109            FSPIQ                   = 54,
9110            FSPID                   = 55,
9111            FSPIHD                  = 56,
9112            FSPIWP                  = 57,
9113            FSPIIO4                 = 58,
9114            FSPIIO5                 = 59,
9115            FSPIIO6                 = 60,
9116            FSPIIO7                 = 61,
9117            FSPICS0                 = 62,
9118            FSPICS1                 = 63,
9119            FSPICS2                 = 64,
9120            FSPICS3                 = 65,
9121            FSPICS4                 = 66,
9122            FSPICS5                 = 67,
9123            SPI3_CK                 = 47,
9124            SPI3_Q                  = 48,
9125            SPI3_D                  = 49,
9126            SPI3_HOLD               = 50,
9127            SPI3_WP                 = 51,
9128            SPI3_CS                 = 52,
9129            I2CEXT0_SCL             = 68,
9130            I2CEXT0_SDA             = 69,
9131            I2CEXT1_SCL             = 70,
9132            I2CEXT1_SDA             = 71,
9133            USB_JTAG_TDO_BRIDGE     = 140,
9134            PCNT0_SIG_CH0           = 141,
9135            PCNT1_SIG_CH0           = 142,
9136            PCNT2_SIG_CH0           = 143,
9137            PCNT3_SIG_CH0           = 144,
9138            PCNT0_SIG_CH1           = 145,
9139            PCNT1_SIG_CH1           = 146,
9140            PCNT2_SIG_CH1           = 147,
9141            PCNT3_SIG_CH1           = 148,
9142            PCNT0_CTRL_CH0          = 149,
9143            PCNT1_CTRL_CH0          = 150,
9144            PCNT2_CTRL_CH0          = 151,
9145            PCNT3_CTRL_CH0          = 152,
9146            PCNT0_CTRL_CH1          = 153,
9147            PCNT1_CTRL_CH1          = 154,
9148            PCNT2_CTRL_CH1          = 155,
9149            PCNT3_CTRL_CH1          = 156,
9150            PCNT1_U0_CTRL_CH0       = 72,
9151            PCNT1_U1_CTRL_CH0       = 73,
9152            PCNT1_U2_CTRL_CH0       = 74,
9153            PCNT1_U3_CTRL_CH0       = 75,
9154            PCNT1_U0_CTRL_CH1       = 76,
9155            PCNT1_U1_CTRL_CH1       = 77,
9156            PCNT1_U2_CTRL_CH1       = 78,
9157            PCNT1_U3_CTRL_CH1       = 79,
9158            PCNT1_U0_SIG_CH0        = 204,
9159            PCNT1_U1_SIG_CH0        = 205,
9160            PCNT1_U2_SIG_CH0        = 206,
9161            PCNT1_U3_SIG_CH0        = 207,
9162            PCNT1_U0_SIG_CH1        = 208,
9163            PCNT1_U1_SIG_CH1        = 209,
9164            PCNT1_U2_SIG_CH1        = 210,
9165            PCNT1_U3_SIG_CH1        = 211,
9166            CPU_GPIO_0              = 214,
9167            CPU_GPIO_1              = 215,
9168            CPU_GPIO_2              = 216,
9169            CPU_GPIO_3              = 217,
9170            CPU_GPIO_4              = 218,
9171            CPU_GPIO_5              = 219,
9172            CPU_GPIO_6              = 220,
9173            CPU_GPIO_7              = 221,
9174            CPU_GPIO_8              = 222,
9175            CPU_GPIO_9              = 223,
9176            CPU_GPIO_10             = 224,
9177            CPU_GPIO_11             = 225,
9178            CPU_GPIO_12             = 226,
9179            CPU_GPIO_13             = 227,
9180            CPU_GPIO_14             = 228,
9181            CPU_GPIO_15             = 229,
9182            RMT_SIG_0               = 246,
9183            RMT_SIG_1               = 247,
9184            RMT_SIG_2               = 248,
9185            RMT_SIG_3               = 249,
9186            CAM_PCLK                = 158,
9187            CAM_H_ENABLE            = 159,
9188            CAM_H_SYNC              = 160,
9189            CAM_V_SYNC              = 161,
9190            CAM_DATA_0              = 162,
9191            CAM_DATA_1              = 163,
9192            CAM_DATA_2              = 164,
9193            CAM_DATA_3              = 165,
9194            CAM_DATA_4              = 166,
9195            CAM_DATA_5              = 167,
9196            CAM_DATA_6              = 168,
9197            CAM_DATA_7              = 169,
9198            CAM_DATA_8              = 170,
9199            CAM_DATA_9              = 171,
9200            CAM_DATA_10             = 172,
9201            CAM_DATA_11             = 173,
9202            CAM_DATA_12             = 174,
9203            CAM_DATA_13             = 175,
9204            CAM_DATA_14             = 176,
9205            CAM_DATA_15             = 177,
9206            SDHOST_CDATA_IN_41      = 0,
9207            SDHOST_CDATA_IN_51      = 1,
9208            SDHOST_CDATA_IN_61      = 2,
9209            SDHOST_CDATA_IN_71      = 3,
9210            SDHOST_CDATA_IN_42      = 4,
9211            SDHOST_CDATA_IN_52      = 5,
9212            SDHOST_CDATA_IN_62      = 6,
9213            SDHOST_CDATA_IN_72      = 7,
9214            SDHOST_CARD_DETECT_N_1  = 126,
9215            SDHOST_CARD_DETECT_N_2  = 127,
9216            SDHOST_CARD_INT_N_1     = 128,
9217            SDHOST_CARD_INT_N_2     = 129,
9218            SDHOST_CARD_WRITE_PRT_1 = 130,
9219            SDHOST_CARD_WRITE_PRT_2 = 131,
9220            SDHOST_DATA_STROBE_1    = 132,
9221            SDHOST_DATA_STROBE_2    = 133,
9222            EMAC_MDI                = 107,
9223            EMAC_COL                = 108,
9224            EMAC_CRS                = 109,
9225            EMAC_RXDV               = 178,
9226            EMAC_RXD0               = 179,
9227            EMAC_RXD1               = 180,
9228            EMAC_RXD2               = 181,
9229            EMAC_RXD3               = 182,
9230            EMAC_RXER               = 183,
9231            EMAC_RX_CLK             = 184,
9232            EMAC_TX_CLK             = 185,
9233            PARL_RX_CLK             = 186,
9234            PARL_TX_CLK             = 187,
9235            PARL_RX_DATA0           = 188,
9236            PARL_RX_DATA1           = 189,
9237            PARL_RX_DATA2           = 190,
9238            PARL_RX_DATA3           = 191,
9239            PARL_RX_DATA4           = 192,
9240            PARL_RX_DATA5           = 193,
9241            PARL_RX_DATA6           = 194,
9242            PARL_RX_DATA7           = 195,
9243            PARL_RX_DATA8           = 196,
9244            PARL_RX_DATA9           = 197,
9245            PARL_RX_DATA10          = 198,
9246            PARL_RX_DATA11          = 199,
9247            PARL_RX_DATA12          = 200,
9248            PARL_RX_DATA13          = 201,
9249            PARL_RX_DATA14          = 202,
9250            PARL_RX_DATA15          = 203,
9251            SIG_IN_FUNC251          = 251,
9252            SIG_IN_FUNC252          = 252,
9253            SIG_IN_FUNC253          = 253,
9254            SIG_IN_FUNC254          = 254,
9255            SIG_IN_FUNC255          = 255,
9256            MTDO,
9257            MTCK,
9258            MTDI,
9259            MTMS,
9260            SD1_DATA0,
9261            SD1_DATA1,
9262            SD1_DATA2,
9263            SD1_DATA3,
9264            SD1_CLK,
9265            SD1_CMD,
9266            SPICS0,
9267            SPIQ,
9268            SPIWP,
9269            SPIHD,
9270            SPICLK,
9271            SPID,
9272            EMAC_RMII_CLK,
9273            REF_50M_CLK,
9274            CAM_XCLK,
9275            SD2_CDATA0,
9276            SD2_CDATA1,
9277            SD2_CDATA2,
9278            SD2_CDATA3,
9279            SD2_CCLK,
9280            SD2_CCMD,
9281            DBG_PSRAM_CK,
9282            DBG_PSRAM_CS,
9283            DBG_PSRAM_D,
9284            DBG_PSRAM_Q,
9285            DBG_PSRAM_WP,
9286            DBG_PSRAM_HOLD,
9287            DBG_PSRAM_DQ4,
9288            DBG_PSRAM_DQ5,
9289            DBG_PSRAM_DQ6,
9290            DBG_PSRAM_DQ7,
9291            DBG_PSRAM_DQS_0,
9292            DBG_FLASH_CK,
9293            DBG_FLASH_D,
9294            DBG_FLASH_CS,
9295            DBG_FLASH_Q,
9296            DBG_FLASH_WP,
9297            DBG_FLASH_HOLD,
9298        }
9299        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
9300        #[derive(Debug, PartialEq, Copy, Clone)]
9301        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
9302        #[doc(hidden)]
9303        pub enum OutputSignal {
9304            SDHOST_CDATA_OUT_41    = 0,
9305            SDHOST_CDATA_OUT_51    = 1,
9306            SDHOST_CDATA_OUT_61    = 2,
9307            SDHOST_CDATA_OUT_71    = 3,
9308            SDHOST_CDATA_OUT_42    = 4,
9309            SDHOST_CDATA_OUT_52    = 5,
9310            SDHOST_CDATA_OUT_62    = 6,
9311            SDHOST_CDATA_OUT_72    = 7,
9312            SD_RST_N_1             = 146,
9313            SD_RST_N_2             = 147,
9314            SD_CCMD_OD_PULLUP_EN_N = 148,
9315            U0TXD                  = 10,
9316            U0RTS                  = 11,
9317            U0DTR                  = 12,
9318            U1TXD                  = 13,
9319            U1RTS                  = 14,
9320            U1DTR                  = 15,
9321            U2TXD                  = 16,
9322            U2RTS                  = 17,
9323            U2DTR                  = 18,
9324            U3TXD                  = 137,
9325            U3RTS                  = 138,
9326            U3DTR                  = 116,
9327            I2S0O_BCK              = 25,
9328            I2S0_MCLK              = 26,
9329            I2S0O_WS               = 27,
9330            I2S0O_SD               = 28,
9331            I2S0I_BCK              = 29,
9332            I2S0I_WS               = 30,
9333            I2S0O_SD1              = 43,
9334            I2S1O_BCK              = 31,
9335            I2S1_MCLK              = 32,
9336            I2S1O_WS               = 33,
9337            I2S1O_SD               = 34,
9338            I2S1I_BCK              = 35,
9339            I2S1I_WS               = 36,
9340            FSPICLK                = 53,
9341            FSPIQ                  = 54,
9342            FSPID                  = 55,
9343            FSPIHD                 = 56,
9344            FSPIWP                 = 57,
9345            FSPIIO4                = 58,
9346            FSPIIO5                = 59,
9347            FSPIIO6                = 60,
9348            FSPIIO7                = 61,
9349            FSPIDQS                = 44,
9350            FSPICS0                = 62,
9351            FSPICS1                = 63,
9352            FSPICS2                = 64,
9353            FSPICS3                = 65,
9354            FSPICS4                = 66,
9355            FSPICS5                = 67,
9356            SPI3_CS2               = 45,
9357            SPI3_CS1               = 46,
9358            SPI3_CK                = 47,
9359            SPI3_Q                 = 48,
9360            SPI3_D                 = 49,
9361            SPI3_HOLD              = 50,
9362            SPI3_WP                = 51,
9363            SPI3_CS                = 52,
9364            I2CEXT0_SCL            = 68,
9365            I2CEXT0_SDA            = 69,
9366            I2CEXT1_SCL            = 70,
9367            I2CEXT1_SDA            = 71,
9368            GPIO_SD0               = 72,
9369            GPIO_SD1               = 73,
9370            GPIO_SD2               = 74,
9371            GPIO_SD3               = 75,
9372            GPIO_SD4               = 76,
9373            GPIO_SD5               = 77,
9374            GPIO_SD6               = 78,
9375            GPIO_SD7               = 79,
9376            CPU_GPIO_0             = 214,
9377            CPU_GPIO_1             = 215,
9378            CPU_GPIO_2             = 216,
9379            CPU_GPIO_3             = 217,
9380            CPU_GPIO_4             = 218,
9381            CPU_GPIO_5             = 219,
9382            CPU_GPIO_6             = 220,
9383            CPU_GPIO_7             = 221,
9384            CPU_GPIO_8             = 222,
9385            CPU_GPIO_9             = 223,
9386            CPU_GPIO_10            = 224,
9387            CPU_GPIO_11            = 225,
9388            CPU_GPIO_12            = 226,
9389            CPU_GPIO_13            = 227,
9390            CPU_GPIO_14            = 228,
9391            CPU_GPIO_15            = 229,
9392            RMT_SIG_0              = 246,
9393            RMT_SIG_1              = 247,
9394            RMT_SIG_2              = 248,
9395            RMT_SIG_3              = 249,
9396            LCD_CS                 = 144,
9397            LCD_DC                 = 145,
9398            LCD_PCLK               = 149,
9399            CAM_CLK                = 150,
9400            LCD_H_ENABLE           = 151,
9401            LCD_H_SYNC             = 152,
9402            LCD_V_SYNC             = 153,
9403            LCD_DATA_0             = 154,
9404            LCD_DATA_1             = 155,
9405            LCD_DATA_2             = 156,
9406            LCD_DATA_3             = 157,
9407            LCD_DATA_4             = 158,
9408            LCD_DATA_5             = 159,
9409            LCD_DATA_6             = 160,
9410            LCD_DATA_7             = 161,
9411            LCD_DATA_8             = 162,
9412            LCD_DATA_9             = 163,
9413            LCD_DATA_10            = 164,
9414            LCD_DATA_11            = 165,
9415            LCD_DATA_12            = 166,
9416            LCD_DATA_13            = 167,
9417            LCD_DATA_14            = 168,
9418            LCD_DATA_15            = 169,
9419            LCD_DATA_16            = 170,
9420            LCD_DATA_17            = 171,
9421            LCD_DATA_18            = 172,
9422            LCD_DATA_19            = 173,
9423            LCD_DATA_20            = 174,
9424            LCD_DATA_21            = 175,
9425            LCD_DATA_22            = 176,
9426            LCD_DATA_23            = 177,
9427            EMAC_PTP_PPS           = 105,
9428            EMAC_MDC               = 108,
9429            EMAC_MDO               = 109,
9430            EMAC_TXEN              = 178,
9431            EMAC_TXD0              = 179,
9432            EMAC_TXD1              = 180,
9433            EMAC_TXD2              = 181,
9434            EMAC_TXD3              = 182,
9435            EMAC_TXER              = 183,
9436            PARL_RX_CLK            = 186,
9437            PARL_TX_CLK            = 187,
9438            PARL_TX_DATA0          = 188,
9439            PARL_TX_DATA1          = 189,
9440            PARL_TX_DATA2          = 190,
9441            PARL_TX_DATA3          = 191,
9442            PARL_TX_DATA4          = 192,
9443            PARL_TX_DATA5          = 193,
9444            PARL_TX_DATA6          = 194,
9445            PARL_TX_DATA7          = 195,
9446            PARL_TX_DATA8          = 196,
9447            PARL_TX_DATA9          = 197,
9448            PARL_TX_DATA10         = 198,
9449            PARL_TX_DATA11         = 199,
9450            PARL_TX_DATA12         = 200,
9451            PARL_TX_DATA13         = 201,
9452            PARL_TX_DATA14         = 202,
9453            PARL_TX_DATA15         = 203,
9454            PARL_TX_CS             = 107,
9455            GPIO                   = 256,
9456            MTDO,
9457            MTCK,
9458            MTDI,
9459            MTMS,
9460            SD1_DATA0,
9461            SD1_DATA1,
9462            SD1_DATA2,
9463            SD1_DATA3,
9464            SD1_CLK,
9465            SD1_CMD,
9466            SPICS0,
9467            SPIQ,
9468            SPIWP,
9469            SPIHD,
9470            SPICLK,
9471            SPID,
9472            EMAC_RMII_CLK,
9473            REF_50M_CLK,
9474            CAM_XCLK,
9475            SD2_CDATA0,
9476            SD2_CDATA1,
9477            SD2_CDATA2,
9478            SD2_CDATA3,
9479            SD2_CCLK,
9480            SD2_CCMD,
9481            DBG_PSRAM_CK,
9482            DBG_PSRAM_CS,
9483            DBG_PSRAM_D,
9484            DBG_PSRAM_Q,
9485            DBG_PSRAM_WP,
9486            DBG_PSRAM_HOLD,
9487            DBG_PSRAM_DQ4,
9488            DBG_PSRAM_DQ5,
9489            DBG_PSRAM_DQ6,
9490            DBG_PSRAM_DQ7,
9491            DBG_PSRAM_DQS_0,
9492            DBG_FLASH_CK,
9493            DBG_FLASH_D,
9494            DBG_FLASH_CS,
9495            DBG_FLASH_Q,
9496            DBG_FLASH_WP,
9497            DBG_FLASH_HOLD,
9498        }
9499    };
9500}
9501/// Defines the `LpFunction` enum.
9502///
9503/// The enum only contains the LP IO MUX functions that the chip implements. It is
9504/// empty on chips without an LP IO peripheral.
9505///
9506/// This macro is intended to be called in esp-hal only.
9507#[macro_export]
9508#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
9509macro_rules! define_lp_functions {
9510    () => {
9511        /// LP IO MUX function of a pad.
9512        ///
9513        /// This is the low-power counterpart of `AlternateFunction`: it selects which function
9514        /// drives a pad while the pad belongs to the low-power domain.
9515        #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
9516        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
9517        #[doc(hidden)]
9518        pub enum LpFunction {
9519            /// LP IO MUX function 1.
9520            _1 = 1,
9521        }
9522        impl LpFunction {
9523            /// The function that connects the pad to the LP GPIO peripheral.
9524            pub const LP_GPIO: Self = Self::_1;
9525        }
9526    };
9527}
9528/// Defines and implements the `io_mux_reg` function.
9529///
9530/// The generated function has the following signature:
9531///
9532/// ```rust,ignore
9533/// pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO0 {
9534///     // ...
9535/// # unimplemented!()
9536/// }
9537/// ```
9538///
9539/// This macro is intended to be called in esp-hal only.
9540#[macro_export]
9541#[expect(clippy::crate_in_macro_def)]
9542#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
9543macro_rules! define_io_mux_reg {
9544    () => {
9545        pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
9546            crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
9547        }
9548    };
9549}