Skip to main content

esp_metadata_generated/
_generated_esp32s31.rs

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