1#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
12#[macro_export]
14#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
15macro_rules! chip {
16 () => {
17 "esp32p4"
18 };
19}
20#[doc = concat!("assert_eq!(chip_name, ", chip_pretty!(), ")")]
28#[macro_export]
30#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
31macro_rules! chip_pretty {
32 () => {
33 "ESP32-P4"
34 };
35}
36#[macro_export]
38#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
39macro_rules! property {
40 ("chip") => {
41 "esp32p4"
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-p4_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 62
72 };
73 ("gpio.constant_0_input", str) => {
74 stringify!(62)
75 };
76 ("gpio.constant_1_input") => {
77 63
78 };
79 ("gpio.constant_1_input", str) => {
80 stringify!(63)
81 };
82 ("gpio.remap_iomux_pin_registers") => {
83 false
84 };
85 ("gpio.func_in_sel_offset") => {
86 1
87 };
88 ("gpio.func_in_sel_offset", str) => {
89 stringify!(1)
90 };
91 ("gpio.need_soft_isolate_during_pd") => {
92 false
93 };
94 ("gpio.has_bank_1") => {
95 true
96 };
97 ("gpio.input_signal_max") => {
98 249
99 };
100 ("gpio.input_signal_max", str) => {
101 stringify!(249)
102 };
103 ("gpio.output_signal_max") => {
104 256
105 };
106 ("gpio.output_signal_max", str) => {
107 stringify!(256)
108 };
109 ("dedicated_gpio.version") => {
110 "riscv_v2"
111 };
112 ("dedicated_gpio.needs_initialization") => {
113 false
114 };
115 ("dedicated_gpio.channel_count") => {
116 8
117 };
118 ("dedicated_gpio.channel_count", str) => {
119 stringify!(8)
120 };
121 ("lp_io.version") => {
122 "esp32p4"
123 };
124 ("lp_io.has_gpio_matrix") => {
125 true
126 };
127 ("uart.ram_size") => {
128 128
129 };
130 ("uart.ram_size", str) => {
131 stringify!(128)
132 };
133 ("uart.version") => {
134 2
135 };
136 ("uart.version", str) => {
137 stringify!(2)
138 };
139 ("uart.peripheral_controls_mem_clk") => {
140 false
141 };
142 ("uart.has_sclk_divider") => {
143 false
144 };
145 ("uart.has_sclk_enable") => {
146 false
147 };
148 ("uhci.combined_uart_selector_field") => {
149 true
150 };
151 ("i2c_master.version") => {
152 4
153 };
154 ("i2c_master.version", str) => {
155 stringify!(4)
156 };
157 ("i2c_master.has_fsm_timeouts") => {
158 true
159 };
160 ("i2c_master.has_hw_bus_clear") => {
161 true
162 };
163 ("i2c_master.has_bus_timeout_enable") => {
164 true
165 };
166 ("i2c_master.separate_filter_config_registers") => {
167 false
168 };
169 ("i2c_master.can_estimate_nack_reason") => {
170 true
171 };
172 ("i2c_master.has_conf_update") => {
173 true
174 };
175 ("i2c_master.has_reliable_fsm_reset") => {
176 false
177 };
178 ("i2c_master.has_arbitration_en") => {
179 true
180 };
181 ("i2c_master.has_tx_fifo_watermark") => {
182 false
183 };
184 ("i2c_master.bus_timeout_is_exponential") => {
185 false
186 };
187 ("i2c_master.has_pd_en") => {
188 true
189 };
190 ("i2c_master.max_bus_timeout") => {
191 31
192 };
193 ("i2c_master.max_bus_timeout", str) => {
194 stringify!(31)
195 };
196 ("i2c_master.ll_intr_mask") => {
197 262143
198 };
199 ("i2c_master.ll_intr_mask", str) => {
200 stringify!(262143)
201 };
202 ("i2c_master.fifo_size") => {
203 32
204 };
205 ("i2c_master.fifo_size", str) => {
206 stringify!(32)
207 };
208 ("lp_i2c_master.version") => {
209 "lp_i2c"
210 };
211 ("lp_i2c_master.fifo_size") => {
212 16
213 };
214 ("lp_i2c_master.fifo_size", str) => {
215 stringify!(16)
216 };
217 ("spi_master.version") => {
218 3
219 };
220 ("spi_master.version", str) => {
221 stringify!(3)
222 };
223 ("spi_master.fifo_size") => {
224 64
225 };
226 ("spi_master.fifo_size", str) => {
227 stringify!(64)
228 };
229 ("spi_master.bit_order_is_bool") => {
230 false
231 };
232 ("spi_master.has_octal") => {
233 false
234 };
235 ("spi_master.has_app_interrupts") => {
236 false
237 };
238 ("spi_master.has_dma_segmented_transfer") => {
239 false
240 };
241 ("spi_master.has_clk_pre_div") => {
242 false
243 };
244 ("spi_master.dma_can_access_flash") => {
245 false
246 };
247 ("i2s.version") => {
248 3
249 };
250 ("i2s.version", str) => {
251 stringify!(3)
252 };
253 ("i2s.mclk_divider_bit_width") => {
254 9
255 };
256 ("i2s.mclk_divider_bit_width", str) => {
257 stringify!(9)
258 };
259 ("i2s.max_ws_width") => {
260 128
261 };
262 ("i2s.max_ws_width", str) => {
263 stringify!(128)
264 };
265 ("i2s.clock_configured_by_pcr") => {
266 false
267 };
268 ("i2s.clock_configured_by_hp_sys_clkrst") => {
269 true
270 };
271 ("i2s.supports_pdm_rx_hp_filter") => {
272 true
273 };
274 ("i2s.supports_pdm_tx") => {
275 true
276 };
277 ("i2s.supports_pdm_rx") => {
278 true
279 };
280 ("i2s.supports_pcm2pdm") => {
281 true
282 };
283 ("i2s.supports_pdm2pcm") => {
284 true
285 };
286 ("rmt.ram_start") => {
287 1342842880
288 };
289 ("rmt.ram_start", str) => {
290 stringify!(1342842880)
291 };
292 ("rmt.channel_ram_size") => {
293 48
294 };
295 ("rmt.channel_ram_size", str) => {
296 stringify!(48)
297 };
298 ("rmt.has_tx_immediate_stop") => {
299 true
300 };
301 ("rmt.has_tx_loop_count") => {
302 true
303 };
304 ("rmt.has_tx_loop_auto_stop") => {
305 true
306 };
307 ("rmt.has_tx_carrier_data_only") => {
308 true
309 };
310 ("rmt.has_tx_sync") => {
311 true
312 };
313 ("rmt.has_rx_wrap") => {
314 true
315 };
316 ("rmt.has_rx_demodulation") => {
317 true
318 };
319 ("rmt.has_per_channel_clock") => {
320 false
321 };
322 ("sdmmc.delay_phase_num") => {
323 8
324 };
325 ("sdmmc.delay_phase_num", str) => {
326 stringify!(8)
327 };
328 ("sdmmc.has_iomux") => {
329 true
330 };
331 ("sdmmc.has_gpio_matrix") => {
332 true
333 };
334 ("sdmmc.psram_dma") => {
335 true
336 };
337 ("sdmmc.uhs") => {
338 false
339 };
340 ("usb_otg.fifo_depth_words") => {
341 200
342 };
343 ("usb_otg.fifo_depth_words", str) => {
344 stringify!(200)
345 };
346 ("usb_otg_hs.fifo_depth_words") => {
347 896
348 };
349 ("usb_otg_hs.fifo_depth_words", str) => {
350 stringify!(896)
351 };
352 ("ethernet.mii_via_gpio_matrix") => {
353 true
354 };
355 ("ethernet.rx_store_and_forward") => {
356 false
357 };
358 ("ethernet.rx_checksum_offload") => {
359 true
360 };
361 ("ethernet.tx_checksum_offload") => {
362 false
363 };
364 ("ethernet.dma_burst_len") => {
365 32
366 };
367 ("ethernet.dma_burst_len", str) => {
368 stringify!(32)
369 };
370 ("ethernet.has_rgmii") => {
371 false
372 };
373 ("adc.line_calibration") => {
374 true
375 };
376 ("adc.curve_calibration") => {
377 true
378 };
379 ("adc.basic_calibration") => {
380 true
381 };
382 ("adc.calibration_v1_scheme_supported") => {
383 true
384 };
385 ("adc.channel_compensation") => {
386 true
387 };
388 ("adc.pcr_clock") => {
389 false
390 };
391 ("adc.pcr_sar_clk_div") => {
392 false
393 };
394 ("adc.sar_power_override") => {
395 false
396 };
397 ("sdm.channel_count") => {
398 8
399 };
400 ("sdm.channel_count", str) => {
401 stringify!(8)
402 };
403 ("timergroup.timg_has_timer1") => {
404 true
405 };
406 ("timergroup.timg_has_divcnt_rst") => {
407 true
408 };
409 ("timergroup.wdt_has_conf_update") => {
410 true
411 };
412 ("aes.has_split_text_registers") => {
413 true
414 };
415 ("aes.endianness_configurable") => {
416 false
417 };
418 ("ecc.zero_extend_writes") => {
419 false
420 };
421 ("ecc.separate_jacobian_point_memory") => {
422 true
423 };
424 ("ecc.has_memory_clock_gate") => {
425 true
426 };
427 ("ecc.supports_enhanced_security") => {
428 true
429 };
430 ("ecc.mem_block_size") => {
431 48
432 };
433 ("rng.apb_cycle_wait_num") => {
434 16
435 };
436 ("rng.apb_cycle_wait_num", str) => {
437 stringify!(16)
438 };
439 ("rng.trng_supported") => {
440 true
441 };
442 ("rng.is_lp_sys") => {
443 false
444 };
445 ("rsa.version") => {
446 3
447 };
448 ("rsa.version", str) => {
449 stringify!(3)
450 };
451 ("rsa.size_increment") => {
452 32
453 };
454 ("rsa.size_increment", str) => {
455 stringify!(32)
456 };
457 ("rsa.memory_size_bytes") => {
458 512
459 };
460 ("rsa.memory_size_bytes", str) => {
461 stringify!(512)
462 };
463 ("sleep.light_sleep") => {
464 true
465 };
466 ("sleep.deep_sleep") => {
467 true
468 };
469 ("sleep.rejectable_mask") => {
470 14845
471 };
472 ("sleep.ext1_version") => {
473 3
474 };
475 ("sleep.ext1_version", str) => {
476 stringify!(3)
477 };
478 ("sleep.pin_wakeup_version") => {
479 3
480 };
481 ("sleep.pin_wakeup_version", str) => {
482 stringify!(3)
483 };
484 ("sleep.deep_sleep_needs_gpio_isolation") => {
485 false
486 };
487 ("dma.mem2mem_requires_peripheral") => {
488 false
489 };
490 ("dma.ext_mem_configurable_block_size") => {
491 false
492 };
493 ("dma.separate_in_out_interrupts") => {
494 true
495 };
496 ("dma.gdma_version") => {
497 2
498 };
499 ("dma.gdma_version", str) => {
500 stringify!(2)
501 };
502 ("interrupts.status_registers") => {
503 5
504 };
505 ("interrupts.status_registers", str) => {
506 stringify!(5)
507 };
508 ("interrupts.disabled_interrupt") => {
509 0
510 };
511 ("mmu.page_size") => {
512 65536
513 };
514 ("mmu.page_size", str) => {
515 stringify!(65536)
516 };
517 ("mmu.entry_num") => {
518 1024
519 };
520 ("mmu.entry_num", str) => {
521 stringify!(1024)
522 };
523 ("psram.octal_spi") => {
524 true
525 };
526 ("psram.hex_spi") => {
527 true
528 };
529 ("psram.extmem_origin") => {
530 1207959552
531 };
532 ("psram.extmem_origin", str) => {
533 stringify!(1207959552)
534 };
535 ("rom.has_crc_le") => {
536 true
537 };
538 ("rom.has_crc_be") => {
539 true
540 };
541 ("rom.has_md5_bsd") => {
542 true
543 };
544 ("rom.has_md5_mbedtls") => {
545 false
546 };
547 ("soc.cpu_has_branch_predictor") => {
548 true
549 };
550 ("soc.cpu_has_csr_pc") => {
551 false
552 };
553 ("soc.cpu_has_zcmp_workaround") => {
554 true
555 };
556 ("soc.multi_core_enabled") => {
557 true
558 };
559 ("soc.internal_memory_cached") => {
560 true
561 };
562 ("soc.has_swd_watchdog") => {
563 true
564 };
565 ("soc.cpu_mcause_mask") => {
566 63
567 };
568 ("soc.cpu_mcause_mask", str) => {
569 stringify!(63)
570 };
571 ("soc.cpu_pmp_granularity") => {
572 128
573 };
574 ("soc.cpu_pmp_granularity", str) => {
575 stringify!(128)
576 };
577 ("clock_tree.iomux_function_clock.source") => {
578 [crate ::soc::clocks::IomuxFunctionClockSource::XtalClk, crate
579 ::soc::clocks::IomuxFunctionClockSource::PllF80m]
580 };
581 ("clock_tree.iomux_function_clock.div_num") => {
582 (0, 255)
583 };
584 ("clock_tree.cpu_root_clk") => {
585 [crate ::soc::clocks::CpuRootClkConfig::Xtal, crate
586 ::soc::clocks::CpuRootClkConfig::Cpll, crate
587 ::soc::clocks::CpuRootClkConfig::RcFast]
588 };
589 ("clock_tree.cpu_clk.divisor") => {
590 (0, 255)
591 };
592 ("clock_tree.mem_clk.divisor") => {
593 (0, 255)
594 };
595 ("clock_tree.sys_clk.divisor") => {
596 (0, 255)
597 };
598 ("clock_tree.apb_clk.divisor") => {
599 (0, 255)
600 };
601 ("clock_tree.lp_fast_clk") => {
602 [crate ::soc::clocks::LpFastClkConfig::RcFast, crate
603 ::soc::clocks::LpFastClkConfig::XtalD2]
604 };
605 ("clock_tree.lp_slow_clk") => {
606 [crate ::soc::clocks::LpSlowClkConfig::RcSlow, #[cfg(use_xtal32k)] crate
607 ::soc::clocks::LpSlowClkConfig::Xtal32k, crate
608 ::soc::clocks::LpSlowClkConfig::OscSlow]
609 };
610 ("clock_tree.crypto_clk") => {
611 [crate ::soc::clocks::CryptoClkConfig::Xtal, crate
612 ::soc::clocks::CryptoClkConfig::RcFast, crate
613 ::soc::clocks::CryptoClkConfig::PllF240m, crate
614 ::soc::clocks::CryptoClkConfig::PllF160m]
615 };
616 ("clock_tree.timg_calibration_clock") => {
617 [crate ::soc::clocks::TimgCalibrationClockConfig::MpllClk, crate
618 ::soc::clocks::TimgCalibrationClockConfig::SpllClk, crate
619 ::soc::clocks::TimgCalibrationClockConfig::CpllClk, crate
620 ::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, crate
621 ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, #[cfg(use_xtal32k)] crate
622 ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
623 };
624 ("clock_tree.psram.function_clock") => {
625 [crate ::soc::clocks::PsramFunctionClockConfig::Xtal, crate
626 ::soc::clocks::PsramFunctionClockConfig::Mpll, crate
627 ::soc::clocks::PsramFunctionClockConfig::Spll, crate
628 ::soc::clocks::PsramFunctionClockConfig::Cpll]
629 };
630 ("clock_tree.uart.function_clock.sclk") => {
631 [crate ::soc::clocks::UartFunctionClockSclk::Xtal, crate
632 ::soc::clocks::UartFunctionClockSclk::PllF80m, crate
633 ::soc::clocks::UartFunctionClockSclk::RcFast]
634 };
635 ("clock_tree.uart.function_clock.div_num") => {
636 (0, 255)
637 };
638 ("clock_tree.uart.baud_rate_generator.fractional") => {
639 (0, 15)
640 };
641 ("clock_tree.uart.baud_rate_generator.integral") => {
642 (0, 4095)
643 };
644 ("clock_tree.timg.function_clock") => {
645 [crate ::soc::clocks::TimgFunctionClockConfig::XtalClk, crate
646 ::soc::clocks::TimgFunctionClockConfig::RcFastClk, crate
647 ::soc::clocks::TimgFunctionClockConfig::PllF80m]
648 };
649 ("clock_tree.timg.wdt_clock") => {
650 [crate ::soc::clocks::TimgWdtClockConfig::XtalClk, crate
651 ::soc::clocks::TimgWdtClockConfig::PllF80m, crate
652 ::soc::clocks::TimgWdtClockConfig::RcFastClk]
653 };
654 ("clock_tree.i2c.function_clock.sclk") => {
655 [crate ::soc::clocks::I2cFunctionClockSclk::Xtal, crate
656 ::soc::clocks::I2cFunctionClockSclk::RcFast]
657 };
658 ("clock_tree.i2c.function_clock.div_num") => {
659 (0, 255)
660 };
661 ("clock_tree.rmt.sclk") => {
662 [crate ::soc::clocks::RmtSclkConfig::PllF80m, crate
663 ::soc::clocks::RmtSclkConfig::RcFastClk, crate
664 ::soc::clocks::RmtSclkConfig::XtalClk]
665 };
666 ("clock_tree.spi.function_clock") => {
667 [crate ::soc::clocks::SpiFunctionClockConfig::Xtal, crate
668 ::soc::clocks::SpiFunctionClockConfig::RcFast, crate
669 ::soc::clocks::SpiFunctionClockConfig::Spll]
670 };
671 ("clock_tree.i2s.tx_clk.sclk") => {
672 [crate ::soc::clocks::I2sClkSclk::Xtal, crate
673 ::soc::clocks::I2sClkSclk::PllF160m]
674 };
675 ("clock_tree.i2s.tx_clk.div_num") => {
676 (1, 255)
677 };
678 ("clock_tree.i2s.tx_clk.div_a") => {
679 (1, 511)
680 };
681 ("clock_tree.i2s.tx_clk.div_b") => {
682 (0, 511)
683 };
684 ("clock_tree.i2s.rx_clk.sclk") => {
685 [crate ::soc::clocks::I2sClkSclk::Xtal, crate
686 ::soc::clocks::I2sClkSclk::PllF160m]
687 };
688 ("clock_tree.i2s.rx_clk.div_num") => {
689 (1, 255)
690 };
691 ("clock_tree.i2s.rx_clk.div_a") => {
692 (1, 511)
693 };
694 ("clock_tree.i2s.rx_clk.div_b") => {
695 (0, 511)
696 };
697 ("clock_tree.i2s.mclk_out") => {
698 [crate ::soc::clocks::I2sMclkOutConfig::Tx, crate
699 ::soc::clocks::I2sMclkOutConfig::Rx]
700 };
701 ("clock_tree.mipi_dsi.dpi_clk.sclk") => {
702 [crate ::soc::clocks::MipiDsiDpiClkSclk::Xtal, crate
703 ::soc::clocks::MipiDsiDpiClkSclk::PllF240m, crate
704 ::soc::clocks::MipiDsiDpiClkSclk::PllF160m]
705 };
706 ("clock_tree.mipi_dsi.dpi_clk.div_num") => {
707 (0, 255)
708 };
709 ("clock_tree.mipi_dsi.phy_pll_refclk.sclk") => {
710 [crate ::soc::clocks::MipiDsiPhyPllRefclkSclk::Xtal, crate
711 ::soc::clocks::MipiDsiPhyPllRefclkSclk::Cpll, crate
712 ::soc::clocks::MipiDsiPhyPllRefclkSclk::Spll, crate
713 ::soc::clocks::MipiDsiPhyPllRefclkSclk::Mpll]
714 };
715 ("clock_tree.mipi_dsi.phy_pll_refclk.div_num") => {
716 (0, 255)
717 };
718 ("clock_tree.mipi_dsi.phy_cfg_clk") => {
719 [crate ::soc::clocks::MipiDsiPhyCfgClkConfig::PllF20m, crate
720 ::soc::clocks::MipiDsiPhyCfgClkConfig::RcFast, crate
721 ::soc::clocks::MipiDsiPhyCfgClkConfig::PllF25m]
722 };
723}
724#[macro_export]
725#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
726macro_rules! for_each_dedicated_gpio {
727 ($($pattern:tt => $code:tt;)*) => {
728 macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
729 tt) => {} } _for_each_inner_dedicated_gpio!((0));
730 _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
731 _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
732 _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
733 _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
734 CPU_GPIO_0)); _for_each_inner_dedicated_gpio!((0, 1, CPU_GPIO_1));
735 _for_each_inner_dedicated_gpio!((0, 2, CPU_GPIO_2));
736 _for_each_inner_dedicated_gpio!((0, 3, CPU_GPIO_3));
737 _for_each_inner_dedicated_gpio!((0, 4, CPU_GPIO_4));
738 _for_each_inner_dedicated_gpio!((0, 5, CPU_GPIO_5));
739 _for_each_inner_dedicated_gpio!((0, 6, CPU_GPIO_6));
740 _for_each_inner_dedicated_gpio!((0, 7, CPU_GPIO_7));
741 _for_each_inner_dedicated_gpio!((1, 0, CPU_GPIO_8));
742 _for_each_inner_dedicated_gpio!((1, 1, CPU_GPIO_9));
743 _for_each_inner_dedicated_gpio!((1, 2, CPU_GPIO_10));
744 _for_each_inner_dedicated_gpio!((1, 3, CPU_GPIO_11));
745 _for_each_inner_dedicated_gpio!((1, 4, CPU_GPIO_12));
746 _for_each_inner_dedicated_gpio!((1, 5, CPU_GPIO_13));
747 _for_each_inner_dedicated_gpio!((1, 6, CPU_GPIO_14));
748 _for_each_inner_dedicated_gpio!((1, 7, CPU_GPIO_15));
749 _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
750 (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, CPU_GPIO_0), (0, 1,
751 CPU_GPIO_1), (0, 2, CPU_GPIO_2), (0, 3, CPU_GPIO_3), (0, 4, CPU_GPIO_4), (0, 5,
752 CPU_GPIO_5), (0, 6, CPU_GPIO_6), (0, 7, CPU_GPIO_7), (1, 0, CPU_GPIO_8), (1, 1,
753 CPU_GPIO_9), (1, 2, CPU_GPIO_10), (1, 3, CPU_GPIO_11), (1, 4, CPU_GPIO_12), (1,
754 5, CPU_GPIO_13), (1, 6, CPU_GPIO_14), (1, 7, CPU_GPIO_15)));
755 };
756}
757#[macro_export]
761#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
762macro_rules! define_lp_io_signals {
763 () => {
764 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
765 #[derive(Debug, PartialEq, Copy, Clone)]
766 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
767 #[doc(hidden)]
768 pub enum LpInputSignal {
769 LP_I2C_SCL = 0,
770 LP_I2C_SDA = 1,
771 LP_UART_RXD = 2,
772 LP_UART_CTSN = 3,
773 LP_UART_DSRN = 4,
774 LP_SPI_CK = 5,
775 LP_SPI_CS = 6,
776 LP_SPI_D = 7,
777 LP_SPI_Q = 8,
778 LP_I2S_I_BCK = 9,
779 LP_I2S_I_SD = 10,
780 LP_I2S_I_WS = 11,
781 LP_I2S_O_BCK = 12,
782 LP_I2S_O_WS = 13,
783 }
784 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
785 #[derive(Debug, PartialEq, Copy, Clone)]
786 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
787 #[doc(hidden)]
788 pub enum LpOutputSignal {
789 LP_I2C_SCL = 0,
790 LP_I2C_SDA = 1,
791 LP_UART_TXD = 2,
792 LP_UART_RTSN = 3,
793 LP_UART_DTRN = 4,
794 LP_SPI_CK = 5,
795 LP_SPI_CS = 6,
796 LP_SPI_D = 7,
797 LP_SPI_Q = 8,
798 LP_I2S_I_BCK = 9,
799 LP_I2S_O_SD = 10,
800 LP_I2S_I_WS = 11,
801 LP_I2S_O_BCK = 12,
802 LP_I2S_O_WS = 13,
803 }
804 };
805}
806#[macro_export]
828#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
829macro_rules! for_each_rmt_channel {
830 ($($pattern:tt => $code:tt;)*) => {
831 macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
832 => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
833 _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
834 _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
835 _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
836 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
837 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
838 _for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
839 _for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
840 _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
841 _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
842 _for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
843 };
844}
845#[macro_export]
870#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
871macro_rules! for_each_sdmmc {
872 ($($pattern:tt => $code:tt;)*) => {
873 macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
874 } _for_each_inner_sdmmc!((slot0, 0, true, [], [], [], [], [],
875 [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
876 [SDHOST_DATA_STROBE_1], [SD_RST_N_1])); _for_each_inner_sdmmc!((slot1, 1, false,
877 [SDHOST_CCLK_OUT_2], [SDHOST_CCMD_IN_2], [SDHOST_CCMD_OUT_2],
878 [SDHOST_CDATA_IN_20, SDHOST_CDATA_IN_21, SDHOST_CDATA_IN_22, SDHOST_CDATA_IN_23,
879 SDHOST_CDATA_IN_24, SDHOST_CDATA_IN_25, SDHOST_CDATA_IN_26, SDHOST_CDATA_IN_27],
880 [SDHOST_CDATA_OUT_20, SDHOST_CDATA_OUT_21, SDHOST_CDATA_OUT_22,
881 SDHOST_CDATA_OUT_23, SDHOST_CDATA_OUT_24, SDHOST_CDATA_OUT_25,
882 SDHOST_CDATA_OUT_26, SDHOST_CDATA_OUT_27], [SDHOST_CARD_DETECT_N_2],
883 [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2], [SDHOST_DATA_STROBE_2],
884 [SD_RST_N_2])); _for_each_inner_sdmmc!((all(slot0, 0, true, [], [], [], [], [],
885 [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
886 [SDHOST_DATA_STROBE_1], [SD_RST_N_1]), (slot1, 1, false, [SDHOST_CCLK_OUT_2],
887 [SDHOST_CCMD_IN_2], [SDHOST_CCMD_OUT_2], [SDHOST_CDATA_IN_20, SDHOST_CDATA_IN_21,
888 SDHOST_CDATA_IN_22, SDHOST_CDATA_IN_23, SDHOST_CDATA_IN_24, SDHOST_CDATA_IN_25,
889 SDHOST_CDATA_IN_26, SDHOST_CDATA_IN_27], [SDHOST_CDATA_OUT_20,
890 SDHOST_CDATA_OUT_21, SDHOST_CDATA_OUT_22, SDHOST_CDATA_OUT_23,
891 SDHOST_CDATA_OUT_24, SDHOST_CDATA_OUT_25, SDHOST_CDATA_OUT_26,
892 SDHOST_CDATA_OUT_27], [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2],
893 [SDHOST_CARD_INT_N_2], [SDHOST_DATA_STROBE_2], [SD_RST_N_2])));
894 };
895}
896#[macro_export]
897#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
898macro_rules! for_each_sdm_channel {
899 ($($pattern:tt => $code:tt;)*) => {
900 macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
901 => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
902 _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
903 _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
904 _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
905 _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
906 _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
907 _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
908 _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
909 _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
910 SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
911 GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
912 SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
913 };
914}
915#[macro_export]
916#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
917macro_rules! for_each_aes_key_length {
918 ($($pattern:tt => $code:tt;)*) => {
919 macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
920 tt) => {} } _for_each_inner_aes_key_length!((128));
921 _for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
922 4)); _for_each_inner_aes_key_length!((256, 2, 6));
923 _for_each_inner_aes_key_length!((bits(128), (256)));
924 _for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
925 };
926}
927#[macro_export]
928#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
929macro_rules! for_each_ecc_working_mode {
930 ($($pattern:tt => $code:tt;)*) => {
931 macro_rules! _for_each_inner_ecc_working_mode { $(($pattern) => $code;)* ($other
932 : tt) => {} } _for_each_inner_ecc_working_mode!((0, AffinePointMultiplication));
933 _for_each_inner_ecc_working_mode!((2, AffinePointVerification));
934 _for_each_inner_ecc_working_mode!((3, AffinePointVerificationAndMultiplication));
935 _for_each_inner_ecc_working_mode!((4, JacobianPointMultiplication));
936 _for_each_inner_ecc_working_mode!((5, AffinePointAddition));
937 _for_each_inner_ecc_working_mode!((6, JacobianPointVerification));
938 _for_each_inner_ecc_working_mode!((7,
939 AffinePointVerificationAndJacobianPointMultiplication));
940 _for_each_inner_ecc_working_mode!((8, ModularAddition));
941 _for_each_inner_ecc_working_mode!((9, ModularSubtraction));
942 _for_each_inner_ecc_working_mode!((10, ModularMultiplication));
943 _for_each_inner_ecc_working_mode!((11, ModularDivision));
944 _for_each_inner_ecc_working_mode!((all(0, AffinePointMultiplication), (2,
945 AffinePointVerification), (3, AffinePointVerificationAndMultiplication), (4,
946 JacobianPointMultiplication), (5, AffinePointAddition), (6,
947 JacobianPointVerification), (7,
948 AffinePointVerificationAndJacobianPointMultiplication), (8, ModularAddition), (9,
949 ModularSubtraction), (10, ModularMultiplication), (11, ModularDivision)));
950 };
951}
952#[macro_export]
953#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
954macro_rules! for_each_ecc_curve {
955 ($($pattern:tt => $code:tt;)*) => {
956 macro_rules! _for_each_inner_ecc_curve { $(($pattern) => $code;)* ($other : tt)
957 => {} } _for_each_inner_ecc_curve!((0, P192, 192));
958 _for_each_inner_ecc_curve!((1, P256, 256)); _for_each_inner_ecc_curve!((2, P384,
959 384)); _for_each_inner_ecc_curve!((all(0, P192, 192), (1, P256, 256), (2, P384,
960 384)));
961 };
962}
963#[macro_export]
964#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
965macro_rules! for_each_rsa_exponentiation {
966 ($($pattern:tt => $code:tt;)*) => {
967 macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
968 ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
969 _for_each_inner_rsa_exponentiation!((64));
970 _for_each_inner_rsa_exponentiation!((96));
971 _for_each_inner_rsa_exponentiation!((128));
972 _for_each_inner_rsa_exponentiation!((160));
973 _for_each_inner_rsa_exponentiation!((192));
974 _for_each_inner_rsa_exponentiation!((224));
975 _for_each_inner_rsa_exponentiation!((256));
976 _for_each_inner_rsa_exponentiation!((288));
977 _for_each_inner_rsa_exponentiation!((320));
978 _for_each_inner_rsa_exponentiation!((352));
979 _for_each_inner_rsa_exponentiation!((384));
980 _for_each_inner_rsa_exponentiation!((416));
981 _for_each_inner_rsa_exponentiation!((448));
982 _for_each_inner_rsa_exponentiation!((480));
983 _for_each_inner_rsa_exponentiation!((512));
984 _for_each_inner_rsa_exponentiation!((544));
985 _for_each_inner_rsa_exponentiation!((576));
986 _for_each_inner_rsa_exponentiation!((608));
987 _for_each_inner_rsa_exponentiation!((640));
988 _for_each_inner_rsa_exponentiation!((672));
989 _for_each_inner_rsa_exponentiation!((704));
990 _for_each_inner_rsa_exponentiation!((736));
991 _for_each_inner_rsa_exponentiation!((768));
992 _for_each_inner_rsa_exponentiation!((800));
993 _for_each_inner_rsa_exponentiation!((832));
994 _for_each_inner_rsa_exponentiation!((864));
995 _for_each_inner_rsa_exponentiation!((896));
996 _for_each_inner_rsa_exponentiation!((928));
997 _for_each_inner_rsa_exponentiation!((960));
998 _for_each_inner_rsa_exponentiation!((992));
999 _for_each_inner_rsa_exponentiation!((1024));
1000 _for_each_inner_rsa_exponentiation!((1056));
1001 _for_each_inner_rsa_exponentiation!((1088));
1002 _for_each_inner_rsa_exponentiation!((1120));
1003 _for_each_inner_rsa_exponentiation!((1152));
1004 _for_each_inner_rsa_exponentiation!((1184));
1005 _for_each_inner_rsa_exponentiation!((1216));
1006 _for_each_inner_rsa_exponentiation!((1248));
1007 _for_each_inner_rsa_exponentiation!((1280));
1008 _for_each_inner_rsa_exponentiation!((1312));
1009 _for_each_inner_rsa_exponentiation!((1344));
1010 _for_each_inner_rsa_exponentiation!((1376));
1011 _for_each_inner_rsa_exponentiation!((1408));
1012 _for_each_inner_rsa_exponentiation!((1440));
1013 _for_each_inner_rsa_exponentiation!((1472));
1014 _for_each_inner_rsa_exponentiation!((1504));
1015 _for_each_inner_rsa_exponentiation!((1536));
1016 _for_each_inner_rsa_exponentiation!((1568));
1017 _for_each_inner_rsa_exponentiation!((1600));
1018 _for_each_inner_rsa_exponentiation!((1632));
1019 _for_each_inner_rsa_exponentiation!((1664));
1020 _for_each_inner_rsa_exponentiation!((1696));
1021 _for_each_inner_rsa_exponentiation!((1728));
1022 _for_each_inner_rsa_exponentiation!((1760));
1023 _for_each_inner_rsa_exponentiation!((1792));
1024 _for_each_inner_rsa_exponentiation!((1824));
1025 _for_each_inner_rsa_exponentiation!((1856));
1026 _for_each_inner_rsa_exponentiation!((1888));
1027 _for_each_inner_rsa_exponentiation!((1920));
1028 _for_each_inner_rsa_exponentiation!((1952));
1029 _for_each_inner_rsa_exponentiation!((1984));
1030 _for_each_inner_rsa_exponentiation!((2016));
1031 _for_each_inner_rsa_exponentiation!((2048));
1032 _for_each_inner_rsa_exponentiation!((2080));
1033 _for_each_inner_rsa_exponentiation!((2112));
1034 _for_each_inner_rsa_exponentiation!((2144));
1035 _for_each_inner_rsa_exponentiation!((2176));
1036 _for_each_inner_rsa_exponentiation!((2208));
1037 _for_each_inner_rsa_exponentiation!((2240));
1038 _for_each_inner_rsa_exponentiation!((2272));
1039 _for_each_inner_rsa_exponentiation!((2304));
1040 _for_each_inner_rsa_exponentiation!((2336));
1041 _for_each_inner_rsa_exponentiation!((2368));
1042 _for_each_inner_rsa_exponentiation!((2400));
1043 _for_each_inner_rsa_exponentiation!((2432));
1044 _for_each_inner_rsa_exponentiation!((2464));
1045 _for_each_inner_rsa_exponentiation!((2496));
1046 _for_each_inner_rsa_exponentiation!((2528));
1047 _for_each_inner_rsa_exponentiation!((2560));
1048 _for_each_inner_rsa_exponentiation!((2592));
1049 _for_each_inner_rsa_exponentiation!((2624));
1050 _for_each_inner_rsa_exponentiation!((2656));
1051 _for_each_inner_rsa_exponentiation!((2688));
1052 _for_each_inner_rsa_exponentiation!((2720));
1053 _for_each_inner_rsa_exponentiation!((2752));
1054 _for_each_inner_rsa_exponentiation!((2784));
1055 _for_each_inner_rsa_exponentiation!((2816));
1056 _for_each_inner_rsa_exponentiation!((2848));
1057 _for_each_inner_rsa_exponentiation!((2880));
1058 _for_each_inner_rsa_exponentiation!((2912));
1059 _for_each_inner_rsa_exponentiation!((2944));
1060 _for_each_inner_rsa_exponentiation!((2976));
1061 _for_each_inner_rsa_exponentiation!((3008));
1062 _for_each_inner_rsa_exponentiation!((3040));
1063 _for_each_inner_rsa_exponentiation!((3072));
1064 _for_each_inner_rsa_exponentiation!((3104));
1065 _for_each_inner_rsa_exponentiation!((3136));
1066 _for_each_inner_rsa_exponentiation!((3168));
1067 _for_each_inner_rsa_exponentiation!((3200));
1068 _for_each_inner_rsa_exponentiation!((3232));
1069 _for_each_inner_rsa_exponentiation!((3264));
1070 _for_each_inner_rsa_exponentiation!((3296));
1071 _for_each_inner_rsa_exponentiation!((3328));
1072 _for_each_inner_rsa_exponentiation!((3360));
1073 _for_each_inner_rsa_exponentiation!((3392));
1074 _for_each_inner_rsa_exponentiation!((3424));
1075 _for_each_inner_rsa_exponentiation!((3456));
1076 _for_each_inner_rsa_exponentiation!((3488));
1077 _for_each_inner_rsa_exponentiation!((3520));
1078 _for_each_inner_rsa_exponentiation!((3552));
1079 _for_each_inner_rsa_exponentiation!((3584));
1080 _for_each_inner_rsa_exponentiation!((3616));
1081 _for_each_inner_rsa_exponentiation!((3648));
1082 _for_each_inner_rsa_exponentiation!((3680));
1083 _for_each_inner_rsa_exponentiation!((3712));
1084 _for_each_inner_rsa_exponentiation!((3744));
1085 _for_each_inner_rsa_exponentiation!((3776));
1086 _for_each_inner_rsa_exponentiation!((3808));
1087 _for_each_inner_rsa_exponentiation!((3840));
1088 _for_each_inner_rsa_exponentiation!((3872));
1089 _for_each_inner_rsa_exponentiation!((3904));
1090 _for_each_inner_rsa_exponentiation!((3936));
1091 _for_each_inner_rsa_exponentiation!((3968));
1092 _for_each_inner_rsa_exponentiation!((4000));
1093 _for_each_inner_rsa_exponentiation!((4032));
1094 _for_each_inner_rsa_exponentiation!((4064));
1095 _for_each_inner_rsa_exponentiation!((4096));
1096 _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
1097 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1098 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1099 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1100 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1101 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1102 (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
1103 (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
1104 (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
1105 (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
1106 (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
1107 (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
1108 (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
1109 };
1110}
1111#[macro_export]
1112#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1113macro_rules! for_each_rsa_multiplication {
1114 ($($pattern:tt => $code:tt;)*) => {
1115 macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
1116 ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
1117 _for_each_inner_rsa_multiplication!((64));
1118 _for_each_inner_rsa_multiplication!((96));
1119 _for_each_inner_rsa_multiplication!((128));
1120 _for_each_inner_rsa_multiplication!((160));
1121 _for_each_inner_rsa_multiplication!((192));
1122 _for_each_inner_rsa_multiplication!((224));
1123 _for_each_inner_rsa_multiplication!((256));
1124 _for_each_inner_rsa_multiplication!((288));
1125 _for_each_inner_rsa_multiplication!((320));
1126 _for_each_inner_rsa_multiplication!((352));
1127 _for_each_inner_rsa_multiplication!((384));
1128 _for_each_inner_rsa_multiplication!((416));
1129 _for_each_inner_rsa_multiplication!((448));
1130 _for_each_inner_rsa_multiplication!((480));
1131 _for_each_inner_rsa_multiplication!((512));
1132 _for_each_inner_rsa_multiplication!((544));
1133 _for_each_inner_rsa_multiplication!((576));
1134 _for_each_inner_rsa_multiplication!((608));
1135 _for_each_inner_rsa_multiplication!((640));
1136 _for_each_inner_rsa_multiplication!((672));
1137 _for_each_inner_rsa_multiplication!((704));
1138 _for_each_inner_rsa_multiplication!((736));
1139 _for_each_inner_rsa_multiplication!((768));
1140 _for_each_inner_rsa_multiplication!((800));
1141 _for_each_inner_rsa_multiplication!((832));
1142 _for_each_inner_rsa_multiplication!((864));
1143 _for_each_inner_rsa_multiplication!((896));
1144 _for_each_inner_rsa_multiplication!((928));
1145 _for_each_inner_rsa_multiplication!((960));
1146 _for_each_inner_rsa_multiplication!((992));
1147 _for_each_inner_rsa_multiplication!((1024));
1148 _for_each_inner_rsa_multiplication!((1056));
1149 _for_each_inner_rsa_multiplication!((1088));
1150 _for_each_inner_rsa_multiplication!((1120));
1151 _for_each_inner_rsa_multiplication!((1152));
1152 _for_each_inner_rsa_multiplication!((1184));
1153 _for_each_inner_rsa_multiplication!((1216));
1154 _for_each_inner_rsa_multiplication!((1248));
1155 _for_each_inner_rsa_multiplication!((1280));
1156 _for_each_inner_rsa_multiplication!((1312));
1157 _for_each_inner_rsa_multiplication!((1344));
1158 _for_each_inner_rsa_multiplication!((1376));
1159 _for_each_inner_rsa_multiplication!((1408));
1160 _for_each_inner_rsa_multiplication!((1440));
1161 _for_each_inner_rsa_multiplication!((1472));
1162 _for_each_inner_rsa_multiplication!((1504));
1163 _for_each_inner_rsa_multiplication!((1536));
1164 _for_each_inner_rsa_multiplication!((1568));
1165 _for_each_inner_rsa_multiplication!((1600));
1166 _for_each_inner_rsa_multiplication!((1632));
1167 _for_each_inner_rsa_multiplication!((1664));
1168 _for_each_inner_rsa_multiplication!((1696));
1169 _for_each_inner_rsa_multiplication!((1728));
1170 _for_each_inner_rsa_multiplication!((1760));
1171 _for_each_inner_rsa_multiplication!((1792));
1172 _for_each_inner_rsa_multiplication!((1824));
1173 _for_each_inner_rsa_multiplication!((1856));
1174 _for_each_inner_rsa_multiplication!((1888));
1175 _for_each_inner_rsa_multiplication!((1920));
1176 _for_each_inner_rsa_multiplication!((1952));
1177 _for_each_inner_rsa_multiplication!((1984));
1178 _for_each_inner_rsa_multiplication!((2016));
1179 _for_each_inner_rsa_multiplication!((2048));
1180 _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
1181 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1182 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1183 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1184 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1185 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1186 (1888), (1920), (1952), (1984), (2016), (2048)));
1187 };
1188}
1189#[macro_export]
1190#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1191macro_rules! for_each_sha_algorithm {
1192 ($($pattern:tt => $code:tt;)*) => {
1193 macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
1194 tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
1195 (insecure_against : "collision", "length extension"), 0));
1196 _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
1197 (insecure_against : "length extension"), 1));
1198 _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
1199 (insecure_against : "length extension"), 2));
1200 _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
1201 (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
1202 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
1203 _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
1204 (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
1205 "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
1206 _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
1207 (insecure_against : "collision", "length extension"), 0), (Sha224,
1208 "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
1209 (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
1210 2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
1211 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
1212 (Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
1213 (Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
1214 };
1215}
1216#[macro_export]
1217#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1218macro_rules! for_each_wakeup_source {
1219 ($($pattern:tt => $code:tt;)*) => {
1220 macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
1221 tt) => {} } _for_each_inner_wakeup_source!((Sdio, 0));
1222 _for_each_inner_wakeup_source!((Gpio, 2)); _for_each_inner_wakeup_source!((Usb,
1223 3)); _for_each_inner_wakeup_source!((Uart4, 4));
1224 _for_each_inner_wakeup_source!((Uart3, 5));
1225 _for_each_inner_wakeup_source!((Uart2, 6));
1226 _for_each_inner_wakeup_source!((Uart1, 7));
1227 _for_each_inner_wakeup_source!((Uart0, 8));
1228 _for_each_inner_wakeup_source!((Touch, 11));
1229 _for_each_inner_wakeup_source!((Ext1, 12));
1230 _for_each_inner_wakeup_source!((Timer, 13));
1231 _for_each_inner_wakeup_source!((all(Sdio, 0), (Gpio, 2), (Usb, 3), (Uart4, 4),
1232 (Uart3, 5), (Uart2, 6), (Uart1, 7), (Uart0, 8), (Touch, 11), (Ext1, 12), (Timer,
1233 13)));
1234 };
1235}
1236#[macro_export]
1237#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1238macro_rules! for_each_dma_engine {
1239 ($($pattern:tt => $code:tt;)*) => {
1240 macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
1241 => {} } _for_each_inner_dma_engine!(("AHB_GDMA"));
1242 _for_each_inner_dma_engine!(("AXI_GDMA")); _for_each_inner_dma_engine!(("VDMA"));
1243 _for_each_inner_dma_engine!((all("AHB_GDMA"), ("AXI_GDMA"), ("VDMA")));
1244 };
1245}
1246#[macro_export]
1247#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1248macro_rules! for_each_dma_channel {
1249 ($($pattern:tt => $code:tt;)*) => {
1250 macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
1251 => {} } _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0));
1252 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1));
1253 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2));
1254 _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0));
1255 _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH1));
1256 _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH2));
1257 _for_each_inner_dma_channel!(("VDMA", VDMA_CH0));
1258 _for_each_inner_dma_channel!(("VDMA", VDMA_CH1));
1259 _for_each_inner_dma_channel!(("VDMA", VDMA_CH2));
1260 _for_each_inner_dma_channel!(("VDMA", VDMA_CH3));
1261 _for_each_inner_dma_channel!(("AHB_GDMA", any_channel = AhbGdmaChannel));
1262 _for_each_inner_dma_channel!(("AXI_GDMA", any_channel = AxiGdmaChannel));
1263 _for_each_inner_dma_channel!(("VDMA", any_channel = VdmaChannel));
1264 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1265 AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0, I2S0,
1266 I2S1, I2S2])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1, 1, interrupt_in
1267 = AHB_PDMA_IN_CH1, interrupt_out = AHB_PDMA_OUT_CH1, compatible = [UHCI0, I2S0,
1268 I2S1, I2S2])); _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2, 2, interrupt_in
1269 = AHB_PDMA_IN_CH2, interrupt_out = AHB_PDMA_OUT_CH2, compatible = [UHCI0, I2S0,
1270 I2S1, I2S2])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0, 0,
1271 interrupt_in = AXI_PDMA_IN_CH0, interrupt_out = AXI_PDMA_OUT_CH0, compatible =
1272 [SPI2, SPI3, AES, SHA])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH1,
1273 1, interrupt_in = AXI_PDMA_IN_CH1, interrupt_out = AXI_PDMA_OUT_CH1, compatible =
1274 [SPI2, SPI3, AES, SHA])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH2,
1275 2, interrupt_in = AXI_PDMA_IN_CH2, interrupt_out = AXI_PDMA_OUT_CH2, compatible =
1276 [SPI2, SPI3, AES, SHA])); _for_each_inner_dma_channel!(("VDMA", VDMA_CH0, 0,
1277 compatible = [])); _for_each_inner_dma_channel!(("VDMA", VDMA_CH1, 1, compatible
1278 = [])); _for_each_inner_dma_channel!(("VDMA", VDMA_CH2, 2, compatible = []));
1279 _for_each_inner_dma_channel!(("VDMA", VDMA_CH3, 3, compatible = []));
1280 _for_each_inner_dma_channel!((names("AHB_GDMA", DMA_CH0), ("AHB_GDMA", DMA_CH1),
1281 ("AHB_GDMA", DMA_CH2), ("AXI_GDMA", DMA_AXI_CH0), ("AXI_GDMA", DMA_AXI_CH1),
1282 ("AXI_GDMA", DMA_AXI_CH2), ("VDMA", VDMA_CH0), ("VDMA", VDMA_CH1), ("VDMA",
1283 VDMA_CH2), ("VDMA", VDMA_CH3)));
1284 _for_each_inner_dma_channel!((separate_any_type("AHB_GDMA", any_channel =
1285 AhbGdmaChannel), ("AXI_GDMA", any_channel = AxiGdmaChannel), ("VDMA", any_channel
1286 = VdmaChannel))); _for_each_inner_dma_channel!((shared));
1287 _for_each_inner_dma_channel!((split("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1288 AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0, I2S0,
1289 I2S1, I2S2]), ("AHB_GDMA", DMA_CH1, 1, interrupt_in = AHB_PDMA_IN_CH1,
1290 interrupt_out = AHB_PDMA_OUT_CH1, compatible = [UHCI0, I2S0, I2S1, I2S2]),
1291 ("AHB_GDMA", DMA_CH2, 2, interrupt_in = AHB_PDMA_IN_CH2, interrupt_out =
1292 AHB_PDMA_OUT_CH2, compatible = [UHCI0, I2S0, I2S1, I2S2]), ("AXI_GDMA",
1293 DMA_AXI_CH0, 0, interrupt_in = AXI_PDMA_IN_CH0, interrupt_out = AXI_PDMA_OUT_CH0,
1294 compatible = [SPI2, SPI3, AES, SHA]), ("AXI_GDMA", DMA_AXI_CH1, 1, interrupt_in =
1295 AXI_PDMA_IN_CH1, interrupt_out = AXI_PDMA_OUT_CH1, compatible = [SPI2, SPI3, AES,
1296 SHA]), ("AXI_GDMA", DMA_AXI_CH2, 2, interrupt_in = AXI_PDMA_IN_CH2, interrupt_out
1297 = AXI_PDMA_OUT_CH2, compatible = [SPI2, SPI3, AES, SHA])));
1298 _for_each_inner_dma_channel!((no_own_interrupt("VDMA", VDMA_CH0, 0, compatible =
1299 []), ("VDMA", VDMA_CH1, 1, compatible = []), ("VDMA", VDMA_CH2, 2, compatible =
1300 []), ("VDMA", VDMA_CH3, 3, compatible = [])));
1301 };
1302}
1303#[macro_export]
1304#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1305macro_rules! for_each_dma_channel_peri_pair {
1306 ($($pattern:tt => $code:tt;)*) => {
1307 macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1308 ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1309 DMA_CH0, UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0,
1310 I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S1));
1311 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S2));
1312 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, UHCI0));
1313 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S0));
1314 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S1));
1315 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S2));
1316 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, UHCI0));
1317 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S0));
1318 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S1));
1319 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S2));
1320 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI2));
1321 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI3));
1322 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, AES));
1323 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SHA));
1324 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI2));
1325 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI3));
1326 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, AES));
1327 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SHA));
1328 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI2));
1329 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI3));
1330 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, AES));
1331 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SHA));
1332 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1333 UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1334 AhbGdmaChannel, I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1335 any_channel = AhbGdmaChannel, I2S1));
1336 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1337 I2S2)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1338 AxiGdmaChannel, SPI2)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA",
1339 any_channel = AxiGdmaChannel, SPI3));
1340 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel = AxiGdmaChannel,
1341 AES)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1342 AxiGdmaChannel, SHA));
1343 _for_each_inner_dma_channel_peri_pair!((channels("AHB_GDMA", DMA_CH0, UHCI0),
1344 ("AHB_GDMA", DMA_CH0, I2S0), ("AHB_GDMA", DMA_CH0, I2S1), ("AHB_GDMA", DMA_CH0,
1345 I2S2), ("AHB_GDMA", DMA_CH1, UHCI0), ("AHB_GDMA", DMA_CH1, I2S0), ("AHB_GDMA",
1346 DMA_CH1, I2S1), ("AHB_GDMA", DMA_CH1, I2S2), ("AHB_GDMA", DMA_CH2, UHCI0),
1347 ("AHB_GDMA", DMA_CH2, I2S0), ("AHB_GDMA", DMA_CH2, I2S1), ("AHB_GDMA", DMA_CH2,
1348 I2S2), ("AXI_GDMA", DMA_AXI_CH0, SPI2), ("AXI_GDMA", DMA_AXI_CH0, SPI3),
1349 ("AXI_GDMA", DMA_AXI_CH0, AES), ("AXI_GDMA", DMA_AXI_CH0, SHA), ("AXI_GDMA",
1350 DMA_AXI_CH1, SPI2), ("AXI_GDMA", DMA_AXI_CH1, SPI3), ("AXI_GDMA", DMA_AXI_CH1,
1351 AES), ("AXI_GDMA", DMA_AXI_CH1, SHA), ("AXI_GDMA", DMA_AXI_CH2, SPI2),
1352 ("AXI_GDMA", DMA_AXI_CH2, SPI3), ("AXI_GDMA", DMA_AXI_CH2, AES), ("AXI_GDMA",
1353 DMA_AXI_CH2, SHA)));
1354 _for_each_inner_dma_channel_peri_pair!((any_channels("AHB_GDMA", any_channel =
1355 AhbGdmaChannel, UHCI0), ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S0),
1356 ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S1), ("AHB_GDMA", any_channel =
1357 AhbGdmaChannel, I2S2), ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI2),
1358 ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI3), ("AXI_GDMA", any_channel =
1359 AxiGdmaChannel, AES), ("AXI_GDMA", any_channel = AxiGdmaChannel, SHA)));
1360 };
1361}
1362#[macro_export]
1363#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1364macro_rules! for_each_mem2mem_channel {
1365 ($($pattern:tt => $code:tt;)*) => {
1366 macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
1367 tt) => {} } _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1368 AhbGdmaChannel, DMA_CH1, 11)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1369 AhbGdma, AhbGdmaChannel, DMA_CH2, 12));
1370 _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1371 DMA_AXI_CH0, 6)); _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma,
1372 AxiGdmaChannel, DMA_AXI_CH1, 7)); _for_each_inner_mem2mem_channel!(("AXI_GDMA",
1373 AxiGdma, AxiGdmaChannel, DMA_AXI_CH2, 8));
1374 _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel, 1, 11, 2,
1375 12)); _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel, 0,
1376 6, 1, 7, 2, 8)); _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1377 AhbGdmaChannel)); _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma,
1378 AxiGdmaChannel)); _for_each_inner_mem2mem_channel!((channels("AHB_GDMA", AhbGdma,
1379 AhbGdmaChannel, DMA_CH1, 11), ("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH2, 12),
1380 ("AXI_GDMA", AxiGdma, AxiGdmaChannel, DMA_AXI_CH0, 6), ("AXI_GDMA", AxiGdma,
1381 AxiGdmaChannel, DMA_AXI_CH1, 7), ("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1382 DMA_AXI_CH2, 8))); _for_each_inner_mem2mem_channel!((erased("AHB_GDMA", AhbGdma,
1383 AhbGdmaChannel, 1, 11, 2, 12), ("AXI_GDMA", AxiGdma, AxiGdmaChannel, 0, 6, 1, 7,
1384 2, 8))); _for_each_inner_mem2mem_channel!((engines("AHB_GDMA", AhbGdma,
1385 AhbGdmaChannel), ("AXI_GDMA", AxiGdma, AxiGdmaChannel)));
1386 };
1387}
1388#[macro_export]
1389#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1390macro_rules! with_aes_dma_engine {
1391 ($($pattern:tt => $code:tt;)*) => {
1392 macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
1393 => {} } _with_inner_aes_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1394 };
1395}
1396#[macro_export]
1397#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1398macro_rules! with_i2s_dma_engine {
1399 ($($pattern:tt => $code:tt;)*) => {
1400 macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
1401 => {} } _with_inner_i2s_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1402 };
1403}
1404#[macro_export]
1405#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1406macro_rules! with_mipi_dsi_dma_engine {
1407 ($($pattern:tt => $code:tt;)*) => {
1408 macro_rules! _with_inner_mipi_dsi_dma_engine { $(($pattern) => $code;)* ($other :
1409 tt) => {} } _with_inner_mipi_dsi_dma_engine!(("VDMA", VdmaChannel));
1410 };
1411}
1412#[macro_export]
1413#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1414macro_rules! with_sha_dma_engine {
1415 ($($pattern:tt => $code:tt;)*) => {
1416 macro_rules! _with_inner_sha_dma_engine { $(($pattern) => $code;)* ($other : tt)
1417 => {} } _with_inner_sha_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1418 };
1419}
1420#[macro_export]
1421#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1422macro_rules! with_spi_master_dma_engine {
1423 ($($pattern:tt => $code:tt;)*) => {
1424 macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1425 : tt) => {} } _with_inner_spi_master_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1426 };
1427}
1428#[macro_export]
1429#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1430macro_rules! with_spi_slave_dma_engine {
1431 ($($pattern:tt => $code:tt;)*) => {
1432 macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1433 : tt) => {} } _with_inner_spi_slave_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1434 };
1435}
1436#[macro_export]
1437#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1438macro_rules! with_uhci_dma_engine {
1439 ($($pattern:tt => $code:tt;)*) => {
1440 macro_rules! _with_inner_uhci_dma_engine { $(($pattern) => $code;)* ($other : tt)
1441 => {} } _with_inner_uhci_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1442 };
1443}
1444#[macro_export]
1445#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1446macro_rules! for_each_interrupt {
1447 ($($pattern:tt => $code:tt;)*) => {
1448 macro_rules! _for_each_inner_interrupt { $(($pattern) => $code;)* ($other : tt)
1449 => {} } _for_each_inner_interrupt!(([disabled 0] 0));
1450 _for_each_inner_interrupt!(([reserved 0] 1));
1451 _for_each_inner_interrupt!(([reserved 1] 2));
1452 _for_each_inner_interrupt!(([reserved 2] 3));
1453 _for_each_inner_interrupt!(([reserved 3] 4));
1454 _for_each_inner_interrupt!(([reserved 4] 5));
1455 _for_each_inner_interrupt!(([reserved 5] 6));
1456 _for_each_inner_interrupt!(([reserved 6] 7));
1457 _for_each_inner_interrupt!(([reserved 7] 8));
1458 _for_each_inner_interrupt!(([reserved 8] 9));
1459 _for_each_inner_interrupt!(([reserved 9] 10));
1460 _for_each_inner_interrupt!(([reserved 10] 11));
1461 _for_each_inner_interrupt!(([reserved 11] 12));
1462 _for_each_inner_interrupt!(([reserved 12] 13));
1463 _for_each_inner_interrupt!(([reserved 13] 14));
1464 _for_each_inner_interrupt!(([reserved 14] 15));
1465 _for_each_inner_interrupt!(([vector 0] 16)); _for_each_inner_interrupt!(([vector
1466 1] 17)); _for_each_inner_interrupt!(([vector 2] 18));
1467 _for_each_inner_interrupt!(([vector 3] 19)); _for_each_inner_interrupt!(([vector
1468 4] 20)); _for_each_inner_interrupt!(([vector 5] 21));
1469 _for_each_inner_interrupt!(([vector 6] 22)); _for_each_inner_interrupt!(([vector
1470 7] 23)); _for_each_inner_interrupt!(([direct_bindable 0] 24));
1471 _for_each_inner_interrupt!(([direct_bindable 1] 25));
1472 _for_each_inner_interrupt!(([direct_bindable 2] 26));
1473 _for_each_inner_interrupt!(([direct_bindable 3] 27));
1474 _for_each_inner_interrupt!(([direct_bindable 4] 28));
1475 _for_each_inner_interrupt!(([direct_bindable 5] 29));
1476 _for_each_inner_interrupt!(([direct_bindable 6] 30));
1477 _for_each_inner_interrupt!(([direct_bindable 7] 31));
1478 _for_each_inner_interrupt!(([direct_bindable 8] 32));
1479 _for_each_inner_interrupt!(([direct_bindable 9] 33));
1480 _for_each_inner_interrupt!(([direct_bindable 10] 34));
1481 _for_each_inner_interrupt!(([direct_bindable 11] 35));
1482 _for_each_inner_interrupt!(([direct_bindable 12] 36));
1483 _for_each_inner_interrupt!(([direct_bindable 13] 37));
1484 _for_each_inner_interrupt!(([direct_bindable 14] 38));
1485 _for_each_inner_interrupt!(([direct_bindable 15] 39));
1486 _for_each_inner_interrupt!(([direct_bindable 16] 40));
1487 _for_each_inner_interrupt!(([direct_bindable 17] 41));
1488 _for_each_inner_interrupt!(([direct_bindable 18] 42));
1489 _for_each_inner_interrupt!(([direct_bindable 19] 43));
1490 _for_each_inner_interrupt!(([direct_bindable 20] 44));
1491 _for_each_inner_interrupt!(([direct_bindable 21] 45));
1492 _for_each_inner_interrupt!(([direct_bindable 22] 46));
1493 _for_each_inner_interrupt!(([direct_bindable 23] 47));
1494 _for_each_inner_interrupt!((all([disabled 0] 0), ([reserved 0] 1), ([reserved 1]
1495 2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5), ([reserved 5] 6),
1496 ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9), ([reserved 9] 10),
1497 ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13), ([reserved 13] 14),
1498 ([reserved 14] 15), ([vector 0] 16), ([vector 1] 17), ([vector 2] 18), ([vector
1499 3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6] 22), ([vector 7] 23),
1500 ([direct_bindable 0] 24), ([direct_bindable 1] 25), ([direct_bindable 2] 26),
1501 ([direct_bindable 3] 27), ([direct_bindable 4] 28), ([direct_bindable 5] 29),
1502 ([direct_bindable 6] 30), ([direct_bindable 7] 31), ([direct_bindable 8] 32),
1503 ([direct_bindable 9] 33), ([direct_bindable 10] 34), ([direct_bindable 11] 35),
1504 ([direct_bindable 12] 36), ([direct_bindable 13] 37), ([direct_bindable 14] 38),
1505 ([direct_bindable 15] 39), ([direct_bindable 16] 40), ([direct_bindable 17] 41),
1506 ([direct_bindable 18] 42), ([direct_bindable 19] 43), ([direct_bindable 20] 44),
1507 ([direct_bindable 21] 45), ([direct_bindable 22] 46), ([direct_bindable 23]
1508 47)));
1509 };
1510}
1511#[macro_export]
1512#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1513macro_rules! for_each_classified_interrupt {
1514 ($($pattern:tt => $code:tt;)*) => {
1515 macro_rules! _for_each_inner_classified_interrupt { $(($pattern) => $code;)*
1516 ($other : tt) => {} } _for_each_inner_classified_interrupt!(([direct_bindable 0]
1517 24)); _for_each_inner_classified_interrupt!(([direct_bindable 1] 25));
1518 _for_each_inner_classified_interrupt!(([direct_bindable 2] 26));
1519 _for_each_inner_classified_interrupt!(([direct_bindable 3] 27));
1520 _for_each_inner_classified_interrupt!(([direct_bindable 4] 28));
1521 _for_each_inner_classified_interrupt!(([direct_bindable 5] 29));
1522 _for_each_inner_classified_interrupt!(([direct_bindable 6] 30));
1523 _for_each_inner_classified_interrupt!(([direct_bindable 7] 31));
1524 _for_each_inner_classified_interrupt!(([direct_bindable 8] 32));
1525 _for_each_inner_classified_interrupt!(([direct_bindable 9] 33));
1526 _for_each_inner_classified_interrupt!(([direct_bindable 10] 34));
1527 _for_each_inner_classified_interrupt!(([direct_bindable 11] 35));
1528 _for_each_inner_classified_interrupt!(([direct_bindable 12] 36));
1529 _for_each_inner_classified_interrupt!(([direct_bindable 13] 37));
1530 _for_each_inner_classified_interrupt!(([direct_bindable 14] 38));
1531 _for_each_inner_classified_interrupt!(([direct_bindable 15] 39));
1532 _for_each_inner_classified_interrupt!(([direct_bindable 16] 40));
1533 _for_each_inner_classified_interrupt!(([direct_bindable 17] 41));
1534 _for_each_inner_classified_interrupt!(([direct_bindable 18] 42));
1535 _for_each_inner_classified_interrupt!(([direct_bindable 19] 43));
1536 _for_each_inner_classified_interrupt!(([direct_bindable 20] 44));
1537 _for_each_inner_classified_interrupt!(([direct_bindable 21] 45));
1538 _for_each_inner_classified_interrupt!(([direct_bindable 22] 46));
1539 _for_each_inner_classified_interrupt!(([direct_bindable 23] 47));
1540 _for_each_inner_classified_interrupt!(([vector 0] 16));
1541 _for_each_inner_classified_interrupt!(([vector 1] 17));
1542 _for_each_inner_classified_interrupt!(([vector 2] 18));
1543 _for_each_inner_classified_interrupt!(([vector 3] 19));
1544 _for_each_inner_classified_interrupt!(([vector 4] 20));
1545 _for_each_inner_classified_interrupt!(([vector 5] 21));
1546 _for_each_inner_classified_interrupt!(([vector 6] 22));
1547 _for_each_inner_classified_interrupt!(([vector 7] 23));
1548 _for_each_inner_classified_interrupt!(([reserved 0] 1));
1549 _for_each_inner_classified_interrupt!(([reserved 1] 2));
1550 _for_each_inner_classified_interrupt!(([reserved 2] 3));
1551 _for_each_inner_classified_interrupt!(([reserved 3] 4));
1552 _for_each_inner_classified_interrupt!(([reserved 4] 5));
1553 _for_each_inner_classified_interrupt!(([reserved 5] 6));
1554 _for_each_inner_classified_interrupt!(([reserved 6] 7));
1555 _for_each_inner_classified_interrupt!(([reserved 7] 8));
1556 _for_each_inner_classified_interrupt!(([reserved 8] 9));
1557 _for_each_inner_classified_interrupt!(([reserved 9] 10));
1558 _for_each_inner_classified_interrupt!(([reserved 10] 11));
1559 _for_each_inner_classified_interrupt!(([reserved 11] 12));
1560 _for_each_inner_classified_interrupt!(([reserved 12] 13));
1561 _for_each_inner_classified_interrupt!(([reserved 13] 14));
1562 _for_each_inner_classified_interrupt!(([reserved 14] 15));
1563 _for_each_inner_classified_interrupt!((direct_bindable([direct_bindable 0] 24),
1564 ([direct_bindable 1] 25), ([direct_bindable 2] 26), ([direct_bindable 3] 27),
1565 ([direct_bindable 4] 28), ([direct_bindable 5] 29), ([direct_bindable 6] 30),
1566 ([direct_bindable 7] 31), ([direct_bindable 8] 32), ([direct_bindable 9] 33),
1567 ([direct_bindable 10] 34), ([direct_bindable 11] 35), ([direct_bindable 12] 36),
1568 ([direct_bindable 13] 37), ([direct_bindable 14] 38), ([direct_bindable 15] 39),
1569 ([direct_bindable 16] 40), ([direct_bindable 17] 41), ([direct_bindable 18] 42),
1570 ([direct_bindable 19] 43), ([direct_bindable 20] 44), ([direct_bindable 21] 45),
1571 ([direct_bindable 22] 46), ([direct_bindable 23] 47)));
1572 _for_each_inner_classified_interrupt!((vector([vector 0] 16), ([vector 1] 17),
1573 ([vector 2] 18), ([vector 3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6]
1574 22), ([vector 7] 23))); _for_each_inner_classified_interrupt!((reserved([reserved
1575 0] 1), ([reserved 1] 2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5),
1576 ([reserved 5] 6), ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9),
1577 ([reserved 9] 10), ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13),
1578 ([reserved 13] 14), ([reserved 14] 15)));
1579 _for_each_inner_classified_interrupt!((context_switch));
1580 };
1581}
1582#[macro_export]
1583#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1584macro_rules! for_each_interrupt_priority {
1585 ($($pattern:tt => $code:tt;)*) => {
1586 macro_rules! _for_each_inner_interrupt_priority { $(($pattern) => $code;)*
1587 ($other : tt) => {} } _for_each_inner_interrupt_priority!((0, 1, Priority1,
1588 Level1)); _for_each_inner_interrupt_priority!((1, 2, Priority2, Level2));
1589 _for_each_inner_interrupt_priority!((2, 3, Priority3, Level3));
1590 _for_each_inner_interrupt_priority!((3, 4, Priority4, Level4));
1591 _for_each_inner_interrupt_priority!((4, 5, Priority5, Level5));
1592 _for_each_inner_interrupt_priority!((5, 6, Priority6, Level6));
1593 _for_each_inner_interrupt_priority!((6, 7, Priority7, Level7));
1594 _for_each_inner_interrupt_priority!((7, 8, Priority8, Level8));
1595 _for_each_inner_interrupt_priority!((all(0, 1, Priority1, Level1), (1, 2,
1596 Priority2, Level2), (2, 3, Priority3, Level3), (3, 4, Priority4, Level4), (4, 5,
1597 Priority5, Level5), (5, 6, Priority6, Level6), (6, 7, Priority7, Level7), (7, 8,
1598 Priority8, Level8)));
1599 };
1600}
1601#[macro_export]
1602#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1603macro_rules! for_each_sw_interrupt {
1604 ($($pattern:tt => $code:tt;)*) => {
1605 macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1606 tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1607 software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1608 software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1609 software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1610 software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1611 software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1612 FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1613 };
1614}
1615#[macro_export]
1616macro_rules! define_clock_tree_types {
2102 () => {
2103 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2104 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2105 pub enum SdmInstance {
2106 GpioSd = 0,
2107 }
2108 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2109 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2110 pub enum TimgInstance {
2111 Timg0 = 0,
2112 Timg1 = 1,
2113 }
2114 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2115 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2116 pub enum UartInstance {
2117 Uart0 = 0,
2118 Uart1 = 1,
2119 Uart2 = 2,
2120 Uart3 = 3,
2121 Uart4 = 4,
2122 }
2123 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2124 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2125 pub enum SpiInstance {
2126 Spi2 = 0,
2127 Spi3 = 1,
2128 }
2129 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2130 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2131 pub enum I2cInstance {
2132 I2c0 = 0,
2133 I2c1 = 1,
2134 }
2135 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2136 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2137 pub enum I2sInstance {
2138 I2s0 = 0,
2139 I2s1 = 1,
2140 I2s2 = 2,
2141 }
2142 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2143 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2144 pub enum MipiDsiInstance {
2145 MipiDsi = 0,
2146 }
2147 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2148 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2149 pub enum RmtInstance {
2150 Rmt = 0,
2151 }
2152 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
2153 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2154 pub enum PsramInstance {
2155 Psram = 0,
2156 }
2157 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2159 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2160 pub enum CpllClkConfig {
2161 _360,
2163 _400,
2165 }
2166 impl CpllClkConfig {
2167 pub fn value(&self) -> u32 {
2168 match self {
2169 CpllClkConfig::_360 => 360000000,
2170 CpllClkConfig::_400 => 400000000,
2171 }
2172 }
2173 }
2174 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2176 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2177 pub enum MpllClkConfig {
2178 _320,
2180 _400,
2182 _500,
2184 }
2185 impl MpllClkConfig {
2186 pub fn value(&self) -> u32 {
2187 match self {
2188 MpllClkConfig::_320 => 320000000,
2189 MpllClkConfig::_400 => 400000000,
2190 MpllClkConfig::_500 => 500000000,
2191 }
2192 }
2193 }
2194 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2195 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2196 pub enum IomuxFunctionClockSource {
2197 XtalClk,
2199 #[default]
2200 PllF80m,
2202 }
2203 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2207 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2208 pub struct IomuxFunctionClockConfig {
2209 source: IomuxFunctionClockSource,
2210 div_num: u32,
2211 }
2212 impl IomuxFunctionClockConfig {
2213 pub const fn new(source: IomuxFunctionClockSource, div_num: u32) -> Self {
2220 ::core::assert!(
2221 div_num <= 255,
2222 "`IOMUX_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2223 );
2224 Self { source, div_num }
2225 }
2226 pub fn source(self) -> IomuxFunctionClockSource {
2227 self.source
2228 }
2229 pub fn div_num(self) -> u32 {
2230 self.div_num as u32
2231 }
2232 }
2233 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2235 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2236 pub enum CpuRootClkConfig {
2237 Xtal,
2239 Cpll,
2241 RcFast,
2243 }
2244 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2248 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2249 pub struct CpuClkConfig {
2250 divisor: u32,
2251 }
2252 impl CpuClkConfig {
2253 pub const fn new(divisor: u32) -> Self {
2260 ::core::assert!(
2261 divisor <= 255,
2262 "`CPU_CLK` divisor must be between 0 and 255 (inclusive)."
2263 );
2264 Self { divisor }
2265 }
2266 pub fn divisor(self) -> u32 {
2267 self.divisor as u32
2268 }
2269 }
2270 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2274 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2275 pub struct MemClkConfig {
2276 divisor: u32,
2277 }
2278 impl MemClkConfig {
2279 pub const fn new(divisor: u32) -> Self {
2286 ::core::assert!(
2287 divisor <= 255,
2288 "`MEM_CLK` divisor must be between 0 and 255 (inclusive)."
2289 );
2290 Self { divisor }
2291 }
2292 pub fn divisor(self) -> u32 {
2293 self.divisor as u32
2294 }
2295 }
2296 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2300 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2301 pub struct SysClkConfig {
2302 divisor: u32,
2303 }
2304 impl SysClkConfig {
2305 pub const fn new(divisor: u32) -> Self {
2312 ::core::assert!(
2313 divisor <= 255,
2314 "`SYS_CLK` divisor must be between 0 and 255 (inclusive)."
2315 );
2316 Self { divisor }
2317 }
2318 pub fn divisor(self) -> u32 {
2319 self.divisor as u32
2320 }
2321 }
2322 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2326 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2327 pub struct ApbClkConfig {
2328 divisor: u32,
2329 }
2330 impl ApbClkConfig {
2331 pub const fn new(divisor: u32) -> Self {
2338 ::core::assert!(
2339 divisor <= 255,
2340 "`APB_CLK` divisor must be between 0 and 255 (inclusive)."
2341 );
2342 Self { divisor }
2343 }
2344 pub fn divisor(self) -> u32 {
2345 self.divisor as u32
2346 }
2347 }
2348 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2350 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2351 pub enum LpFastClkConfig {
2352 RcFast,
2354 XtalD2,
2356 }
2357 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2359 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2360 pub enum LpSlowClkConfig {
2361 RcSlow,
2363 #[cfg(use_xtal32k)]
2364 Xtal32k,
2366 OscSlow,
2368 }
2369 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2371 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2372 pub enum CryptoClkConfig {
2373 Xtal,
2375 RcFast,
2377 PllF240m,
2379 PllF160m,
2381 }
2382 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2384 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2385 pub enum TimgCalibrationClockConfig {
2386 MpllClk,
2388 SpllClk,
2390 CpllClk,
2392 RcFastDivClk,
2394 RcSlowClk,
2396 #[cfg(use_xtal32k)]
2397 Xtal32kClk,
2399 }
2400 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2402 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2403 pub enum TimgFunctionClockConfig {
2404 #[default]
2405 XtalClk,
2407 RcFastClk,
2409 PllF80m,
2411 }
2412 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2414 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2415 pub enum TimgWdtClockConfig {
2416 #[default]
2417 XtalClk,
2419 PllF80m,
2421 RcFastClk,
2423 }
2424 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2425 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2426 pub enum UartFunctionClockSclk {
2427 #[default]
2428 Xtal,
2430 PllF80m,
2432 RcFast,
2434 }
2435 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2439 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2440 pub struct UartFunctionClockConfig {
2441 sclk: UartFunctionClockSclk,
2442 div_num: u32,
2443 }
2444 impl UartFunctionClockConfig {
2445 pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
2452 ::core::assert!(
2453 div_num <= 255,
2454 "`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2455 );
2456 Self { sclk, div_num }
2457 }
2458 pub fn sclk(self) -> UartFunctionClockSclk {
2459 self.sclk
2460 }
2461 pub fn div_num(self) -> u32 {
2462 self.div_num as u32
2463 }
2464 }
2465 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2470 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2471 pub struct UartBaudRateGeneratorConfig {
2472 fractional: u32,
2473 integral: u32,
2474 }
2475 impl UartBaudRateGeneratorConfig {
2476 pub const fn new(fractional: u32, integral: u32) -> Self {
2486 ::core::assert!(
2487 fractional <= 15,
2488 "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
2489 );
2490 ::core::assert!(
2491 integral <= 4095,
2492 "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
2493 );
2494 Self {
2495 fractional,
2496 integral,
2497 }
2498 }
2499 pub fn fractional(self) -> u32 {
2500 self.fractional as u32
2501 }
2502 pub fn integral(self) -> u32 {
2503 self.integral as u32
2504 }
2505 }
2506 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2508 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2509 pub enum SpiFunctionClockConfig {
2510 Xtal,
2512 RcFast,
2514 #[default]
2515 Spll,
2517 }
2518 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2519 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2520 pub enum I2cFunctionClockSclk {
2521 #[default]
2522 Xtal,
2524 RcFast,
2526 }
2527 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2531 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2532 pub struct I2cFunctionClockConfig {
2533 sclk: I2cFunctionClockSclk,
2534 div_num: u32,
2535 }
2536 impl I2cFunctionClockConfig {
2537 pub const fn new(sclk: I2cFunctionClockSclk, div_num: u32) -> Self {
2544 ::core::assert!(
2545 div_num <= 255,
2546 "`I2C0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2547 );
2548 Self { sclk, div_num }
2549 }
2550 pub fn sclk(self) -> I2cFunctionClockSclk {
2551 self.sclk
2552 }
2553 pub fn div_num(self) -> u32 {
2554 self.div_num as u32
2555 }
2556 }
2557 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2558 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2559 pub enum I2sClkSclk {
2560 Xtal,
2562 #[default]
2563 PllF160m,
2565 }
2566 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2570 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2571 pub struct I2sClkConfig {
2572 sclk: I2sClkSclk,
2573 div_num: u32,
2574 div_a: u32,
2575 div_b: u32,
2576 }
2577 impl I2sClkConfig {
2578 pub const fn new(sclk: I2sClkSclk, div_num: u32, div_a: u32, div_b: u32) -> Self {
2591 ::core::assert!(
2592 div_num >= 1 && div_num <= 255,
2593 "`I2S0_TX_CLK` div_num must be between 1 and 255 (inclusive)."
2594 );
2595 ::core::assert!(
2596 div_a >= 1 && div_a <= 511,
2597 "`I2S0_TX_CLK` div_a must be between 1 and 511 (inclusive)."
2598 );
2599 ::core::assert!(
2600 div_b <= 511,
2601 "`I2S0_TX_CLK` div_b must be between 0 and 511 (inclusive)."
2602 );
2603 Self {
2604 sclk,
2605 div_num,
2606 div_a,
2607 div_b,
2608 }
2609 }
2610 pub fn sclk(self) -> I2sClkSclk {
2611 self.sclk
2612 }
2613 pub fn div_num(self) -> u32 {
2614 self.div_num as u32
2615 }
2616 pub fn div_a(self) -> u32 {
2617 self.div_a as u32
2618 }
2619 pub fn div_b(self) -> u32 {
2620 self.div_b as u32
2621 }
2622 }
2623 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2625 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2626 pub enum I2sMclkOutConfig {
2627 Tx,
2629 #[default]
2630 Rx,
2632 }
2633 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2634 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2635 pub enum MipiDsiDpiClkSclk {
2636 #[default]
2637 Xtal,
2639 PllF240m,
2641 PllF160m,
2643 }
2644 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2648 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2649 pub struct MipiDsiDpiClkConfig {
2650 sclk: MipiDsiDpiClkSclk,
2651 div_num: u32,
2652 }
2653 impl MipiDsiDpiClkConfig {
2654 pub const fn new(sclk: MipiDsiDpiClkSclk, div_num: u32) -> Self {
2661 ::core::assert!(
2662 div_num <= 255,
2663 "`MIPI_DSI_DPI_CLK` div_num must be between 0 and 255 (inclusive)."
2664 );
2665 Self { sclk, div_num }
2666 }
2667 pub fn sclk(self) -> MipiDsiDpiClkSclk {
2668 self.sclk
2669 }
2670 pub fn div_num(self) -> u32 {
2671 self.div_num as u32
2672 }
2673 }
2674 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2675 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2676 pub enum MipiDsiPhyPllRefclkSclk {
2677 #[default]
2678 Xtal,
2680 Cpll,
2682 Spll,
2684 Mpll,
2686 }
2687 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2691 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2692 pub struct MipiDsiPhyPllRefclkConfig {
2693 sclk: MipiDsiPhyPllRefclkSclk,
2694 div_num: u32,
2695 }
2696 impl MipiDsiPhyPllRefclkConfig {
2697 pub const fn new(sclk: MipiDsiPhyPllRefclkSclk, div_num: u32) -> Self {
2704 ::core::assert!(
2705 div_num <= 255,
2706 "`MIPI_DSI_PHY_PLL_REFCLK` div_num must be between 0 and 255 (inclusive)."
2707 );
2708 Self { sclk, div_num }
2709 }
2710 pub fn sclk(self) -> MipiDsiPhyPllRefclkSclk {
2711 self.sclk
2712 }
2713 pub fn div_num(self) -> u32 {
2714 self.div_num as u32
2715 }
2716 }
2717 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2719 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2720 pub enum MipiDsiPhyCfgClkConfig {
2721 #[default]
2722 PllF20m,
2724 RcFast,
2726 PllF25m,
2728 }
2729 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2731 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2732 pub enum RmtSclkConfig {
2733 #[default]
2734 PllF80m,
2736 RcFastClk,
2738 XtalClk,
2740 }
2741 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2743 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2744 pub enum PsramFunctionClockConfig {
2745 #[default]
2746 Xtal,
2748 Mpll,
2750 Spll,
2752 Cpll,
2754 }
2755 pub struct ClockTree {
2757 cpll_clk: Option<CpllClkConfig>,
2758 mpll_clk: Option<MpllClkConfig>,
2759 iomux_function_clock: Option<IomuxFunctionClockConfig>,
2760 cpu_root_clk: Option<CpuRootClkConfig>,
2761 cpu_clk: Option<CpuClkConfig>,
2762 mem_clk: Option<MemClkConfig>,
2763 sys_clk: Option<SysClkConfig>,
2764 apb_clk: Option<ApbClkConfig>,
2765 lp_fast_clk: Option<LpFastClkConfig>,
2766 lp_slow_clk: Option<LpSlowClkConfig>,
2767 crypto_clk: Option<CryptoClkConfig>,
2768 timg_calibration_clock: Option<TimgCalibrationClockConfig>,
2769 timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
2770 timg_wdt_clock: [Option<TimgWdtClockConfig>; 2],
2771 uart_function_clock: [Option<UartFunctionClockConfig>; 5],
2772 uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 5],
2773 spi_function_clock: [Option<SpiFunctionClockConfig>; 2],
2774 i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
2775 i2s_tx_clk: [Option<I2sClkConfig>; 3],
2776 i2s_rx_clk: [Option<I2sClkConfig>; 3],
2777 i2s_mclk_out: [Option<I2sMclkOutConfig>; 3],
2778 mipi_dsi_dpi_clk: [Option<MipiDsiDpiClkConfig>; 1],
2779 mipi_dsi_phy_pll_refclk: [Option<MipiDsiPhyPllRefclkConfig>; 1],
2780 mipi_dsi_phy_cfg_clk: [Option<MipiDsiPhyCfgClkConfig>; 1],
2781 rmt_sclk: [Option<RmtSclkConfig>; 1],
2782 psram_function_clock: [Option<PsramFunctionClockConfig>; 1],
2783 cpll_clk_refcount: u32,
2784 spll_clk_refcount: u32,
2785 mpll_clk_refcount: u32,
2786 rc_fast_clk_refcount: u32,
2787 #[cfg(use_xtal32k)]
2788 xtal32k_clk_refcount: u32,
2789 rc32k_clk_refcount: u32,
2790 pll_f80m_refcount: u32,
2791 pll_f120m_refcount: u32,
2792 pll_f160m_refcount: u32,
2793 pll_f240m_refcount: u32,
2794 spll_d3_clock_refcount: u32,
2795 pll_f50m_refcount: u32,
2796 apb_clk_refcount: u32,
2797 lp_fast_clk_refcount: u32,
2798 crypto_clk_refcount: u32,
2799 timg_calibration_clock_refcount: u32,
2800 sdm_function_clock_refcount: [u32; 1],
2801 timg_function_clock_refcount: [u32; 2],
2802 timg_wdt_clock_refcount: [u32; 2],
2803 uart_function_clock_refcount: [u32; 5],
2804 uart_baud_rate_generator_refcount: [u32; 5],
2805 spi_function_clock_refcount: [u32; 2],
2806 i2c_function_clock_refcount: [u32; 2],
2807 i2s_tx_clk_refcount: [u32; 3],
2808 i2s_rx_clk_refcount: [u32; 3],
2809 i2s_mclk_out_refcount: [u32; 3],
2810 mipi_dsi_dpi_clk_refcount: [u32; 1],
2811 mipi_dsi_phy_pll_refclk_refcount: [u32; 1],
2812 mipi_dsi_phy_cfg_clk_refcount: [u32; 1],
2813 rmt_sclk_refcount: [u32; 1],
2814 psram_function_clock_refcount: [u32; 1],
2815 }
2816 impl ClockTree {
2817 pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
2819 CLOCK_TREE.with(f)
2820 }
2821 pub fn cpll_clk(&self) -> Option<CpllClkConfig> {
2823 self.cpll_clk
2824 }
2825 pub fn mpll_clk(&self) -> Option<MpllClkConfig> {
2827 self.mpll_clk
2828 }
2829 pub fn iomux_function_clock(&self) -> Option<IomuxFunctionClockConfig> {
2831 self.iomux_function_clock
2832 }
2833 pub fn cpu_root_clk(&self) -> Option<CpuRootClkConfig> {
2835 self.cpu_root_clk
2836 }
2837 pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
2839 self.cpu_clk
2840 }
2841 pub fn mem_clk(&self) -> Option<MemClkConfig> {
2843 self.mem_clk
2844 }
2845 pub fn sys_clk(&self) -> Option<SysClkConfig> {
2847 self.sys_clk
2848 }
2849 pub fn apb_clk(&self) -> Option<ApbClkConfig> {
2851 self.apb_clk
2852 }
2853 pub fn lp_fast_clk(&self) -> Option<LpFastClkConfig> {
2855 self.lp_fast_clk
2856 }
2857 pub fn lp_slow_clk(&self) -> Option<LpSlowClkConfig> {
2859 self.lp_slow_clk
2860 }
2861 pub fn crypto_clk(&self) -> Option<CryptoClkConfig> {
2863 self.crypto_clk
2864 }
2865 pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
2867 self.timg_calibration_clock
2868 }
2869 pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2871 self.timg_function_clock[TimgInstance::Timg0 as usize]
2872 }
2873 pub fn timg0_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
2875 self.timg_wdt_clock[TimgInstance::Timg0 as usize]
2876 }
2877 pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2879 self.timg_function_clock[TimgInstance::Timg1 as usize]
2880 }
2881 pub fn timg1_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
2883 self.timg_wdt_clock[TimgInstance::Timg1 as usize]
2884 }
2885 pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
2887 self.uart_function_clock[UartInstance::Uart0 as usize]
2888 }
2889 pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2891 self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
2892 }
2893 pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
2895 self.uart_function_clock[UartInstance::Uart1 as usize]
2896 }
2897 pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2899 self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
2900 }
2901 pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
2903 self.uart_function_clock[UartInstance::Uart2 as usize]
2904 }
2905 pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2907 self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
2908 }
2909 pub fn uart3_function_clock(&self) -> Option<UartFunctionClockConfig> {
2911 self.uart_function_clock[UartInstance::Uart3 as usize]
2912 }
2913 pub fn uart3_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2915 self.uart_baud_rate_generator[UartInstance::Uart3 as usize]
2916 }
2917 pub fn uart4_function_clock(&self) -> Option<UartFunctionClockConfig> {
2919 self.uart_function_clock[UartInstance::Uart4 as usize]
2920 }
2921 pub fn uart4_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2923 self.uart_baud_rate_generator[UartInstance::Uart4 as usize]
2924 }
2925 pub fn spi2_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2927 self.spi_function_clock[SpiInstance::Spi2 as usize]
2928 }
2929 pub fn spi3_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2931 self.spi_function_clock[SpiInstance::Spi3 as usize]
2932 }
2933 pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2935 self.i2c_function_clock[I2cInstance::I2c0 as usize]
2936 }
2937 pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2939 self.i2c_function_clock[I2cInstance::I2c1 as usize]
2940 }
2941 pub fn i2s0_tx_clk(&self) -> Option<I2sClkConfig> {
2943 self.i2s_tx_clk[I2sInstance::I2s0 as usize]
2944 }
2945 pub fn i2s0_rx_clk(&self) -> Option<I2sClkConfig> {
2947 self.i2s_rx_clk[I2sInstance::I2s0 as usize]
2948 }
2949 pub fn i2s0_mclk_out(&self) -> Option<I2sMclkOutConfig> {
2951 self.i2s_mclk_out[I2sInstance::I2s0 as usize]
2952 }
2953 pub fn i2s1_tx_clk(&self) -> Option<I2sClkConfig> {
2955 self.i2s_tx_clk[I2sInstance::I2s1 as usize]
2956 }
2957 pub fn i2s1_rx_clk(&self) -> Option<I2sClkConfig> {
2959 self.i2s_rx_clk[I2sInstance::I2s1 as usize]
2960 }
2961 pub fn i2s1_mclk_out(&self) -> Option<I2sMclkOutConfig> {
2963 self.i2s_mclk_out[I2sInstance::I2s1 as usize]
2964 }
2965 pub fn i2s2_tx_clk(&self) -> Option<I2sClkConfig> {
2967 self.i2s_tx_clk[I2sInstance::I2s2 as usize]
2968 }
2969 pub fn i2s2_rx_clk(&self) -> Option<I2sClkConfig> {
2971 self.i2s_rx_clk[I2sInstance::I2s2 as usize]
2972 }
2973 pub fn i2s2_mclk_out(&self) -> Option<I2sMclkOutConfig> {
2975 self.i2s_mclk_out[I2sInstance::I2s2 as usize]
2976 }
2977 pub fn mipi_dsi_dpi_clk(&self) -> Option<MipiDsiDpiClkConfig> {
2979 self.mipi_dsi_dpi_clk[MipiDsiInstance::MipiDsi as usize]
2980 }
2981 pub fn mipi_dsi_phy_pll_refclk(&self) -> Option<MipiDsiPhyPllRefclkConfig> {
2983 self.mipi_dsi_phy_pll_refclk[MipiDsiInstance::MipiDsi as usize]
2984 }
2985 pub fn mipi_dsi_phy_cfg_clk(&self) -> Option<MipiDsiPhyCfgClkConfig> {
2987 self.mipi_dsi_phy_cfg_clk[MipiDsiInstance::MipiDsi as usize]
2988 }
2989 pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
2991 self.rmt_sclk[RmtInstance::Rmt as usize]
2992 }
2993 pub fn psram_function_clock(&self) -> Option<PsramFunctionClockConfig> {
2995 self.psram_function_clock[PsramInstance::Psram as usize]
2996 }
2997 }
2998 static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
2999 ::esp_sync::NonReentrantMutex::new(ClockTree {
3000 cpll_clk: None,
3001 mpll_clk: None,
3002 iomux_function_clock: None,
3003 cpu_root_clk: None,
3004 cpu_clk: None,
3005 mem_clk: None,
3006 sys_clk: None,
3007 apb_clk: None,
3008 lp_fast_clk: None,
3009 lp_slow_clk: None,
3010 crypto_clk: None,
3011 timg_calibration_clock: None,
3012 timg_function_clock: [None; 2],
3013 timg_wdt_clock: [None; 2],
3014 uart_function_clock: [None; 5],
3015 uart_baud_rate_generator: [None; 5],
3016 spi_function_clock: [None; 2],
3017 i2c_function_clock: [None; 2],
3018 i2s_tx_clk: [None; 3],
3019 i2s_rx_clk: [None; 3],
3020 i2s_mclk_out: [None; 3],
3021 mipi_dsi_dpi_clk: [None; 1],
3022 mipi_dsi_phy_pll_refclk: [None; 1],
3023 mipi_dsi_phy_cfg_clk: [None; 1],
3024 rmt_sclk: [None; 1],
3025 psram_function_clock: [None; 1],
3026 cpll_clk_refcount: 0,
3027 spll_clk_refcount: 0,
3028 mpll_clk_refcount: 0,
3029 rc_fast_clk_refcount: 0,
3030 #[cfg(use_xtal32k)]
3031 xtal32k_clk_refcount: 0,
3032 rc32k_clk_refcount: 0,
3033 pll_f80m_refcount: 0,
3034 pll_f120m_refcount: 0,
3035 pll_f160m_refcount: 0,
3036 pll_f240m_refcount: 0,
3037 spll_d3_clock_refcount: 0,
3038 pll_f50m_refcount: 0,
3039 apb_clk_refcount: 0,
3040 lp_fast_clk_refcount: 0,
3041 crypto_clk_refcount: 0,
3042 timg_calibration_clock_refcount: 0,
3043 sdm_function_clock_refcount: [0; 1],
3044 timg_function_clock_refcount: [0; 2],
3045 timg_wdt_clock_refcount: [0; 2],
3046 uart_function_clock_refcount: [0; 5],
3047 uart_baud_rate_generator_refcount: [0; 5],
3048 spi_function_clock_refcount: [0; 2],
3049 i2c_function_clock_refcount: [0; 2],
3050 i2s_tx_clk_refcount: [0; 3],
3051 i2s_rx_clk_refcount: [0; 3],
3052 i2s_mclk_out_refcount: [0; 3],
3053 mipi_dsi_dpi_clk_refcount: [0; 1],
3054 mipi_dsi_phy_pll_refclk_refcount: [0; 1],
3055 mipi_dsi_phy_cfg_clk_refcount: [0; 1],
3056 rmt_sclk_refcount: [0; 1],
3057 psram_function_clock_refcount: [0; 1],
3058 });
3059 static CPLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3060 ::core::sync::atomic::AtomicU32::new(0);
3061 static MPLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3062 ::core::sync::atomic::AtomicU32::new(0);
3063 static IOMUX_FUNCTION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3064 ::core::sync::atomic::AtomicU32::new(0);
3065 static CPU_ROOT_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3066 ::core::sync::atomic::AtomicU32::new(0);
3067 static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3068 ::core::sync::atomic::AtomicU32::new(0);
3069 static MEM_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3070 ::core::sync::atomic::AtomicU32::new(0);
3071 static SYS_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3072 ::core::sync::atomic::AtomicU32::new(0);
3073 static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3074 ::core::sync::atomic::AtomicU32::new(0);
3075 static LP_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3076 ::core::sync::atomic::AtomicU32::new(0);
3077 static LP_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3078 ::core::sync::atomic::AtomicU32::new(0);
3079 static CRYPTO_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3080 ::core::sync::atomic::AtomicU32::new(0);
3081 static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
3082 ::core::sync::atomic::AtomicU32::new(0);
3083 static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3084 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3085 static TIMG_WDT_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3086 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3087 static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 5] =
3088 [const { ::core::sync::atomic::AtomicU32::new(0) }; 5];
3089 static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 5] =
3090 [const { ::core::sync::atomic::AtomicU32::new(0) }; 5];
3091 static SPI_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3092 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3093 static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
3094 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
3095 static I2S_TX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
3096 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
3097 static I2S_RX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
3098 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
3099 static I2S_MCLK_OUT_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
3100 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
3101 static MIPI_DSI_DPI_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3102 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3103 static MIPI_DSI_PHY_PLL_REFCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3104 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3105 static MIPI_DSI_PHY_CFG_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3106 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3107 static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3108 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3109 static PSRAM_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
3110 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
3111 #[derive(Debug, enumset::EnumSetType)]
3116 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3117 pub enum ClockSource {
3118 XtalClk,
3120 RcFastClk,
3122 #[cfg(use_xtal32k)]
3123 Xtal32kClk,
3125 OscSlowClk,
3127 RcSlowClk,
3129 Rc32kClk,
3131 }
3132 pub fn xtal_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3134 Some(ClockSource::XtalClk)
3135 }
3136 pub fn cpll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3138 xtal_clk_root_source(clocks)
3139 }
3140 pub fn spll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3142 xtal_clk_root_source(clocks)
3143 }
3144 pub fn mpll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3146 xtal_clk_root_source(clocks)
3147 }
3148 pub fn rc_fast_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3150 Some(ClockSource::RcFastClk)
3151 }
3152 #[cfg(use_xtal32k)]
3153 pub fn xtal32k_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3155 Some(ClockSource::Xtal32kClk)
3156 }
3157 pub fn osc_slow_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3159 Some(ClockSource::OscSlowClk)
3160 }
3161 pub fn rc_slow_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3163 Some(ClockSource::RcSlowClk)
3164 }
3165 pub fn rc32k_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
3167 Some(ClockSource::Rc32kClk)
3168 }
3169 pub fn pll_f20m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3171 spll_clk_root_source(clocks)
3172 }
3173 pub fn pll_f80m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3175 spll_clk_root_source(clocks)
3176 }
3177 pub fn pll_f120m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3179 spll_clk_root_source(clocks)
3180 }
3181 pub fn pll_f160m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3183 spll_clk_root_source(clocks)
3184 }
3185 pub fn pll_f240m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3187 spll_clk_root_source(clocks)
3188 }
3189 pub fn spll_d3_clock_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3191 spll_clk_root_source(clocks)
3192 }
3193 pub fn iomux_function_clock_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3195 let config = clocks.iomux_function_clock?;
3196 match config.source() {
3197 IomuxFunctionClockSource::XtalClk => xtal_clk_root_source(clocks),
3198 IomuxFunctionClockSource::PllF80m => pll_f80m_root_source(clocks),
3199 }
3200 }
3201 pub fn pll_f25m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3203 mpll_clk_root_source(clocks)
3204 }
3205 pub fn pll_f50m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3207 mpll_clk_root_source(clocks)
3208 }
3209 pub fn xtal_d2_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3211 xtal_clk_root_source(clocks)
3212 }
3213 pub fn cpu_root_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3215 let config = clocks.cpu_root_clk?;
3216 match config {
3217 CpuRootClkConfig::Xtal => xtal_clk_root_source(clocks),
3218 CpuRootClkConfig::Cpll => cpll_clk_root_source(clocks),
3219 CpuRootClkConfig::RcFast => rc_fast_clk_root_source(clocks),
3220 }
3221 }
3222 pub fn cpu_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3224 cpu_root_clk_root_source(clocks)
3225 }
3226 pub fn mem_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3228 cpu_clk_root_source(clocks)
3229 }
3230 pub fn sys_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3232 mem_clk_root_source(clocks)
3233 }
3234 pub fn apb_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3236 sys_clk_root_source(clocks)
3237 }
3238 pub fn lp_fast_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3240 let config = clocks.lp_fast_clk?;
3241 match config {
3242 LpFastClkConfig::RcFast => rc_fast_clk_root_source(clocks),
3243 LpFastClkConfig::XtalD2 => xtal_d2_clk_root_source(clocks),
3244 }
3245 }
3246 pub fn lp_slow_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3248 let config = clocks.lp_slow_clk?;
3249 match config {
3250 LpSlowClkConfig::RcSlow => rc_slow_clk_root_source(clocks),
3251 #[cfg(use_xtal32k)]
3252 LpSlowClkConfig::Xtal32k => xtal32k_clk_root_source(clocks),
3253 LpSlowClkConfig::OscSlow => osc_slow_clk_root_source(clocks),
3254 }
3255 }
3256 pub fn crypto_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3258 let config = clocks.crypto_clk?;
3259 match config {
3260 CryptoClkConfig::Xtal => xtal_clk_root_source(clocks),
3261 CryptoClkConfig::RcFast => rc_fast_clk_root_source(clocks),
3262 CryptoClkConfig::PllF240m => pll_f240m_root_source(clocks),
3263 CryptoClkConfig::PllF160m => pll_f160m_root_source(clocks),
3264 }
3265 }
3266 pub fn timg_calibration_clock_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
3268 let config = clocks.timg_calibration_clock?;
3269 match config {
3270 TimgCalibrationClockConfig::MpllClk => mpll_clk_root_source(clocks),
3271 TimgCalibrationClockConfig::SpllClk => spll_clk_root_source(clocks),
3272 TimgCalibrationClockConfig::CpllClk => cpll_clk_root_source(clocks),
3273 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_root_source(clocks),
3274 TimgCalibrationClockConfig::RcSlowClk => lp_slow_clk_root_source(clocks),
3275 #[cfg(use_xtal32k)]
3276 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_root_source(clocks),
3277 }
3278 }
3279 fn request_xtal_clk(_clocks: &mut ClockTree) {}
3280 fn release_xtal_clk(_clocks: &mut ClockTree) {}
3281 pub fn xtal_clk_frequency() -> u32 {
3282 40000000
3283 }
3284 pub fn configure_cpll_clk(clocks: &mut ClockTree, config: CpllClkConfig) {
3285 let old_config = clocks.cpll_clk.replace(config);
3286 refresh_cpll_clk_downstream(clocks);
3287 configure_cpll_clk_impl(clocks, old_config, config);
3288 }
3289 pub fn cpll_clk_config(clocks: &mut ClockTree) -> Option<CpllClkConfig> {
3290 clocks.cpll_clk
3291 }
3292 pub fn request_cpll_clk(clocks: &mut ClockTree) {
3293 trace!("Requesting CPLL_CLK");
3294 if increment_reference_count(&mut clocks.cpll_clk_refcount) {
3295 trace!("Enabling CPLL_CLK");
3296 request_xtal_clk(clocks);
3297 enable_cpll_clk_impl(clocks, true);
3298 }
3299 }
3300 pub fn release_cpll_clk(clocks: &mut ClockTree) {
3301 trace!("Releasing CPLL_CLK");
3302 if decrement_reference_count(&mut clocks.cpll_clk_refcount) {
3303 trace!("Disabling CPLL_CLK");
3304 enable_cpll_clk_impl(clocks, false);
3305 release_xtal_clk(clocks);
3306 }
3307 }
3308 pub fn cpll_clk_config_frequency(config: CpllClkConfig) -> u32 {
3309 config.value()
3310 }
3311 pub fn cpll_clk_frequency() -> u32 {
3312 CPLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3313 }
3314 pub fn cpll_clk_source_frequency() -> u32 {
3315 xtal_clk_frequency()
3316 }
3317 pub fn request_spll_clk(clocks: &mut ClockTree) {
3318 trace!("Requesting SPLL_CLK");
3319 if increment_reference_count(&mut clocks.spll_clk_refcount) {
3320 trace!("Enabling SPLL_CLK");
3321 request_xtal_clk(clocks);
3322 enable_spll_clk_impl(clocks, true);
3323 }
3324 }
3325 pub fn release_spll_clk(clocks: &mut ClockTree) {
3326 trace!("Releasing SPLL_CLK");
3327 if decrement_reference_count(&mut clocks.spll_clk_refcount) {
3328 trace!("Disabling SPLL_CLK");
3329 enable_spll_clk_impl(clocks, false);
3330 release_xtal_clk(clocks);
3331 }
3332 }
3333 pub fn spll_clk_frequency() -> u32 {
3334 (480 * 1000000)
3335 }
3336 pub fn spll_clk_source_frequency() -> u32 {
3337 xtal_clk_frequency()
3338 }
3339 pub fn configure_mpll_clk(clocks: &mut ClockTree, config: MpllClkConfig) {
3340 let old_config = clocks.mpll_clk.replace(config);
3341 refresh_mpll_clk_downstream(clocks);
3342 configure_mpll_clk_impl(clocks, old_config, config);
3343 }
3344 pub fn mpll_clk_config(clocks: &mut ClockTree) -> Option<MpllClkConfig> {
3345 clocks.mpll_clk
3346 }
3347 pub fn request_mpll_clk(clocks: &mut ClockTree) {
3348 trace!("Requesting MPLL_CLK");
3349 if increment_reference_count(&mut clocks.mpll_clk_refcount) {
3350 trace!("Enabling MPLL_CLK");
3351 request_xtal_clk(clocks);
3352 enable_mpll_clk_impl(clocks, true);
3353 }
3354 }
3355 pub fn release_mpll_clk(clocks: &mut ClockTree) {
3356 trace!("Releasing MPLL_CLK");
3357 if decrement_reference_count(&mut clocks.mpll_clk_refcount) {
3358 trace!("Disabling MPLL_CLK");
3359 enable_mpll_clk_impl(clocks, false);
3360 release_xtal_clk(clocks);
3361 }
3362 }
3363 pub fn mpll_clk_config_frequency(config: MpllClkConfig) -> u32 {
3364 config.value()
3365 }
3366 pub fn mpll_clk_frequency() -> u32 {
3367 MPLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3368 }
3369 pub fn mpll_clk_source_frequency() -> u32 {
3370 xtal_clk_frequency()
3371 }
3372 pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
3373 trace!("Requesting RC_FAST_CLK");
3374 if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
3375 trace!("Enabling RC_FAST_CLK");
3376 enable_rc_fast_clk_impl(clocks, true);
3377 }
3378 }
3379 pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
3380 trace!("Releasing RC_FAST_CLK");
3381 if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
3382 trace!("Disabling RC_FAST_CLK");
3383 enable_rc_fast_clk_impl(clocks, false);
3384 }
3385 }
3386 static RC_FAST_CLK_FREQUENCY: ::core::sync::atomic::AtomicU32 =
3387 ::core::sync::atomic::AtomicU32::new(rc_fast_clk_nominal_frequency());
3388 pub const fn rc_fast_clk_nominal_frequency() -> u32 {
3389 20000000
3390 }
3391 pub fn rc_fast_clk_frequency() -> u32 {
3392 RC_FAST_CLK_FREQUENCY.load(::core::sync::atomic::Ordering::Acquire)
3393 }
3394 pub fn set_rc_fast_clk_frequency(clocks: &mut ClockTree, frequency: u32) {
3395 if !(10000000..=30000000).contains(&frequency) {
3396 warn!(
3397 "Ignoring out-of-range RC_FAST_CLK frequency: {} Hz",
3398 frequency
3399 );
3400 return;
3401 }
3402 debug!(
3403 "Updating RC_FAST_CLK frequency to {} Hz (nominal {} Hz)",
3404 frequency,
3405 rc_fast_clk_nominal_frequency()
3406 );
3407 RC_FAST_CLK_FREQUENCY.store(frequency, ::core::sync::atomic::Ordering::Release);
3408 refresh_rc_fast_clk_downstream(clocks);
3409 }
3410 #[cfg(use_xtal32k)]
3411 pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
3412 trace!("Requesting XTAL32K_CLK");
3413 if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
3414 trace!("Enabling XTAL32K_CLK");
3415 enable_xtal32k_clk_impl(clocks, true);
3416 }
3417 }
3418 #[cfg(use_xtal32k)]
3419 pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
3420 trace!("Releasing XTAL32K_CLK");
3421 if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
3422 trace!("Disabling XTAL32K_CLK");
3423 enable_xtal32k_clk_impl(clocks, false);
3424 }
3425 }
3426 #[cfg(use_xtal32k)]
3427 pub fn xtal32k_clk_frequency() -> u32 {
3428 32768
3429 }
3430 pub fn request_osc_slow_clk(clocks: &mut ClockTree) {
3431 trace!("Enabling OSC_SLOW_CLK");
3432 enable_osc_slow_clk_impl(clocks, true);
3433 }
3434 pub fn release_osc_slow_clk(clocks: &mut ClockTree) {
3435 trace!("Disabling OSC_SLOW_CLK");
3436 enable_osc_slow_clk_impl(clocks, false);
3437 }
3438 pub fn osc_slow_clk_frequency() -> u32 {
3439 32768
3440 }
3441 pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
3442 trace!("Enabling RC_SLOW_CLK");
3443 enable_rc_slow_clk_impl(clocks, true);
3444 }
3445 pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
3446 trace!("Disabling RC_SLOW_CLK");
3447 enable_rc_slow_clk_impl(clocks, false);
3448 }
3449 static RC_SLOW_CLK_FREQUENCY: ::core::sync::atomic::AtomicU32 =
3450 ::core::sync::atomic::AtomicU32::new(rc_slow_clk_nominal_frequency());
3451 pub const fn rc_slow_clk_nominal_frequency() -> u32 {
3452 136000
3453 }
3454 pub fn rc_slow_clk_frequency() -> u32 {
3455 RC_SLOW_CLK_FREQUENCY.load(::core::sync::atomic::Ordering::Acquire)
3456 }
3457 pub fn set_rc_slow_clk_frequency(clocks: &mut ClockTree, frequency: u32) {
3458 if !(68000..=204000).contains(&frequency) {
3459 warn!(
3460 "Ignoring out-of-range RC_SLOW_CLK frequency: {} Hz",
3461 frequency
3462 );
3463 return;
3464 }
3465 debug!(
3466 "Updating RC_SLOW_CLK frequency to {} Hz (nominal {} Hz)",
3467 frequency,
3468 rc_slow_clk_nominal_frequency()
3469 );
3470 RC_SLOW_CLK_FREQUENCY.store(frequency, ::core::sync::atomic::Ordering::Release);
3471 refresh_rc_slow_clk_downstream(clocks);
3472 }
3473 pub fn request_rc32k_clk(clocks: &mut ClockTree) {
3474 trace!("Requesting RC32K_CLK");
3475 if increment_reference_count(&mut clocks.rc32k_clk_refcount) {
3476 trace!("Enabling RC32K_CLK");
3477 enable_rc32k_clk_impl(clocks, true);
3478 }
3479 }
3480 pub fn release_rc32k_clk(clocks: &mut ClockTree) {
3481 trace!("Releasing RC32K_CLK");
3482 if decrement_reference_count(&mut clocks.rc32k_clk_refcount) {
3483 trace!("Disabling RC32K_CLK");
3484 enable_rc32k_clk_impl(clocks, false);
3485 }
3486 }
3487 pub fn rc32k_clk_frequency() -> u32 {
3488 32768
3489 }
3490 pub fn request_pll_f20m(clocks: &mut ClockTree) {
3491 trace!("Enabling PLL_F20M");
3492 request_spll_clk(clocks);
3493 enable_pll_f20m_impl(clocks, true);
3494 }
3495 pub fn release_pll_f20m(clocks: &mut ClockTree) {
3496 trace!("Disabling PLL_F20M");
3497 enable_pll_f20m_impl(clocks, false);
3498 release_spll_clk(clocks);
3499 }
3500 pub fn pll_f20m_frequency() -> u32 {
3501 (spll_clk_frequency() / 24)
3502 }
3503 pub fn pll_f20m_source_frequency() -> u32 {
3504 spll_clk_frequency()
3505 }
3506 pub fn request_pll_f80m(clocks: &mut ClockTree) {
3507 trace!("Requesting PLL_F80M");
3508 if increment_reference_count(&mut clocks.pll_f80m_refcount) {
3509 trace!("Enabling PLL_F80M");
3510 request_spll_clk(clocks);
3511 enable_pll_f80m_impl(clocks, true);
3512 }
3513 }
3514 pub fn release_pll_f80m(clocks: &mut ClockTree) {
3515 trace!("Releasing PLL_F80M");
3516 if decrement_reference_count(&mut clocks.pll_f80m_refcount) {
3517 trace!("Disabling PLL_F80M");
3518 enable_pll_f80m_impl(clocks, false);
3519 release_spll_clk(clocks);
3520 }
3521 }
3522 pub fn pll_f80m_frequency() -> u32 {
3523 (spll_clk_frequency() / 6)
3524 }
3525 pub fn pll_f80m_source_frequency() -> u32 {
3526 spll_clk_frequency()
3527 }
3528 pub fn request_pll_f120m(clocks: &mut ClockTree) {
3529 trace!("Requesting PLL_F120M");
3530 if increment_reference_count(&mut clocks.pll_f120m_refcount) {
3531 trace!("Enabling PLL_F120M");
3532 request_spll_clk(clocks);
3533 enable_pll_f120m_impl(clocks, true);
3534 }
3535 }
3536 pub fn release_pll_f120m(clocks: &mut ClockTree) {
3537 trace!("Releasing PLL_F120M");
3538 if decrement_reference_count(&mut clocks.pll_f120m_refcount) {
3539 trace!("Disabling PLL_F120M");
3540 enable_pll_f120m_impl(clocks, false);
3541 release_spll_clk(clocks);
3542 }
3543 }
3544 pub fn pll_f120m_frequency() -> u32 {
3545 (spll_clk_frequency() / 4)
3546 }
3547 pub fn pll_f120m_source_frequency() -> u32 {
3548 spll_clk_frequency()
3549 }
3550 pub fn request_pll_f160m(clocks: &mut ClockTree) {
3551 trace!("Requesting PLL_F160M");
3552 if increment_reference_count(&mut clocks.pll_f160m_refcount) {
3553 trace!("Enabling PLL_F160M");
3554 request_spll_clk(clocks);
3555 enable_pll_f160m_impl(clocks, true);
3556 }
3557 }
3558 pub fn release_pll_f160m(clocks: &mut ClockTree) {
3559 trace!("Releasing PLL_F160M");
3560 if decrement_reference_count(&mut clocks.pll_f160m_refcount) {
3561 trace!("Disabling PLL_F160M");
3562 enable_pll_f160m_impl(clocks, false);
3563 release_spll_clk(clocks);
3564 }
3565 }
3566 pub fn pll_f160m_frequency() -> u32 {
3567 (spll_clk_frequency() / 3)
3568 }
3569 pub fn pll_f160m_source_frequency() -> u32 {
3570 spll_clk_frequency()
3571 }
3572 pub fn request_pll_f240m(clocks: &mut ClockTree) {
3573 trace!("Requesting PLL_F240M");
3574 if increment_reference_count(&mut clocks.pll_f240m_refcount) {
3575 trace!("Enabling PLL_F240M");
3576 request_spll_clk(clocks);
3577 enable_pll_f240m_impl(clocks, true);
3578 }
3579 }
3580 pub fn release_pll_f240m(clocks: &mut ClockTree) {
3581 trace!("Releasing PLL_F240M");
3582 if decrement_reference_count(&mut clocks.pll_f240m_refcount) {
3583 trace!("Disabling PLL_F240M");
3584 enable_pll_f240m_impl(clocks, false);
3585 release_spll_clk(clocks);
3586 }
3587 }
3588 pub fn pll_f240m_frequency() -> u32 {
3589 (spll_clk_frequency() / 2)
3590 }
3591 pub fn pll_f240m_source_frequency() -> u32 {
3592 spll_clk_frequency()
3593 }
3594 pub fn request_spll_d3_clock(clocks: &mut ClockTree) {
3595 trace!("Requesting SPLL_D3_CLOCK");
3596 if increment_reference_count(&mut clocks.spll_d3_clock_refcount) {
3597 trace!("Enabling SPLL_D3_CLOCK");
3598 request_spll_clk(clocks);
3599 enable_spll_d3_clock_impl(clocks, true);
3600 }
3601 }
3602 pub fn release_spll_d3_clock(clocks: &mut ClockTree) {
3603 trace!("Releasing SPLL_D3_CLOCK");
3604 if decrement_reference_count(&mut clocks.spll_d3_clock_refcount) {
3605 trace!("Disabling SPLL_D3_CLOCK");
3606 enable_spll_d3_clock_impl(clocks, false);
3607 release_spll_clk(clocks);
3608 }
3609 }
3610 pub fn spll_d3_clock_frequency() -> u32 {
3611 (spll_clk_frequency() / 3)
3612 }
3613 pub fn spll_d3_clock_source_frequency() -> u32 {
3614 spll_clk_frequency()
3615 }
3616 pub fn configure_iomux_function_clock(
3617 clocks: &mut ClockTree,
3618 config: IomuxFunctionClockConfig,
3619 ) {
3620 let old_config = clocks.iomux_function_clock.replace(config);
3621 refresh_iomux_function_clock_downstream(clocks);
3622 match config.source {
3623 IomuxFunctionClockSource::XtalClk => request_xtal_clk(clocks),
3624 IomuxFunctionClockSource::PllF80m => request_pll_f80m(clocks),
3625 }
3626 configure_iomux_function_clock_impl(clocks, old_config, config);
3627 if let Some(old_config) = old_config {
3628 match old_config.source {
3629 IomuxFunctionClockSource::XtalClk => release_xtal_clk(clocks),
3630 IomuxFunctionClockSource::PllF80m => release_pll_f80m(clocks),
3631 }
3632 }
3633 }
3634 pub fn iomux_function_clock_config(
3635 clocks: &mut ClockTree,
3636 ) -> Option<IomuxFunctionClockConfig> {
3637 clocks.iomux_function_clock
3638 }
3639 fn request_iomux_function_clock(_clocks: &mut ClockTree) {}
3640 fn release_iomux_function_clock(_clocks: &mut ClockTree) {}
3641 pub fn iomux_function_clock_config_frequency(config: IomuxFunctionClockConfig) -> u32 {
3642 (match config.source {
3643 IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
3644 IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
3645 } / (config.div_num() + 1))
3646 }
3647 pub fn iomux_function_clock_frequency() -> u32 {
3648 IOMUX_FUNCTION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3649 }
3650 pub fn iomux_function_clock_source_frequency(source: IomuxFunctionClockSource) -> u32 {
3651 match source {
3652 IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
3653 IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
3654 }
3655 }
3656 pub fn request_pll_f25m(clocks: &mut ClockTree) {
3657 trace!("Enabling PLL_F25M");
3658 request_mpll_clk(clocks);
3659 enable_pll_f25m_impl(clocks, true);
3660 }
3661 pub fn release_pll_f25m(clocks: &mut ClockTree) {
3662 trace!("Disabling PLL_F25M");
3663 enable_pll_f25m_impl(clocks, false);
3664 release_mpll_clk(clocks);
3665 }
3666 pub fn pll_f25m_frequency() -> u32 {
3667 (mpll_clk_frequency() / 20)
3668 }
3669 pub fn pll_f25m_source_frequency() -> u32 {
3670 mpll_clk_frequency()
3671 }
3672 pub fn request_pll_f50m(clocks: &mut ClockTree) {
3673 trace!("Requesting PLL_F50M");
3674 if increment_reference_count(&mut clocks.pll_f50m_refcount) {
3675 trace!("Enabling PLL_F50M");
3676 request_mpll_clk(clocks);
3677 enable_pll_f50m_impl(clocks, true);
3678 }
3679 }
3680 pub fn release_pll_f50m(clocks: &mut ClockTree) {
3681 trace!("Releasing PLL_F50M");
3682 if decrement_reference_count(&mut clocks.pll_f50m_refcount) {
3683 trace!("Disabling PLL_F50M");
3684 enable_pll_f50m_impl(clocks, false);
3685 release_mpll_clk(clocks);
3686 }
3687 }
3688 pub fn pll_f50m_frequency() -> u32 {
3689 (mpll_clk_frequency() / 10)
3690 }
3691 pub fn pll_f50m_source_frequency() -> u32 {
3692 mpll_clk_frequency()
3693 }
3694 pub fn request_xtal_d2_clk(clocks: &mut ClockTree) {
3695 trace!("Enabling XTAL_D2_CLK");
3696 request_xtal_clk(clocks);
3697 enable_xtal_d2_clk_impl(clocks, true);
3698 }
3699 pub fn release_xtal_d2_clk(clocks: &mut ClockTree) {
3700 trace!("Disabling XTAL_D2_CLK");
3701 enable_xtal_d2_clk_impl(clocks, false);
3702 release_xtal_clk(clocks);
3703 }
3704 pub fn xtal_d2_clk_frequency() -> u32 {
3705 (xtal_clk_frequency() / 2)
3706 }
3707 pub fn xtal_d2_clk_source_frequency() -> u32 {
3708 xtal_clk_frequency()
3709 }
3710 pub fn configure_cpu_root_clk(clocks: &mut ClockTree, new_selector: CpuRootClkConfig) {
3711 let old_selector = clocks.cpu_root_clk.replace(new_selector);
3712 refresh_cpu_root_clk_downstream(clocks);
3713 match new_selector {
3714 CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
3715 CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
3716 CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
3717 }
3718 configure_cpu_root_clk_impl(clocks, old_selector, new_selector);
3719 if let Some(old_selector) = old_selector {
3720 match old_selector {
3721 CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
3722 CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
3723 CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
3724 }
3725 }
3726 }
3727 pub fn cpu_root_clk_config(clocks: &mut ClockTree) -> Option<CpuRootClkConfig> {
3728 clocks.cpu_root_clk
3729 }
3730 pub fn request_cpu_root_clk(clocks: &mut ClockTree) {
3731 trace!("Enabling CPU_ROOT_CLK");
3732 match unwrap!(clocks.cpu_root_clk) {
3733 CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
3734 CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
3735 CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
3736 }
3737 enable_cpu_root_clk_impl(clocks, true);
3738 }
3739 pub fn release_cpu_root_clk(clocks: &mut ClockTree) {
3740 trace!("Disabling CPU_ROOT_CLK");
3741 enable_cpu_root_clk_impl(clocks, false);
3742 match unwrap!(clocks.cpu_root_clk) {
3743 CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
3744 CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
3745 CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
3746 }
3747 }
3748 pub fn cpu_root_clk_config_frequency(config: CpuRootClkConfig) -> u32 {
3749 match config {
3750 CpuRootClkConfig::Xtal => xtal_clk_frequency(),
3751 CpuRootClkConfig::Cpll => cpll_clk_frequency(),
3752 CpuRootClkConfig::RcFast => rc_fast_clk_frequency(),
3753 }
3754 }
3755 pub fn cpu_root_clk_frequency() -> u32 {
3756 CPU_ROOT_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3757 }
3758 pub fn cpu_root_clk_source_frequency(source: CpuRootClkConfig) -> u32 {
3759 cpu_root_clk_config_frequency(source)
3760 }
3761 pub fn configure_cpu_clk(clocks: &mut ClockTree, config: CpuClkConfig) {
3762 let old_config = clocks.cpu_clk.replace(config);
3763 refresh_cpu_clk_downstream(clocks);
3764 configure_cpu_clk_impl(clocks, old_config, config);
3765 }
3766 pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
3767 clocks.cpu_clk
3768 }
3769 pub fn request_cpu_clk(clocks: &mut ClockTree) {
3770 trace!("Enabling CPU_CLK");
3771 request_cpu_root_clk(clocks);
3772 enable_cpu_clk_impl(clocks, true);
3773 }
3774 pub fn release_cpu_clk(clocks: &mut ClockTree) {
3775 trace!("Disabling CPU_CLK");
3776 enable_cpu_clk_impl(clocks, false);
3777 release_cpu_root_clk(clocks);
3778 }
3779 pub fn cpu_clk_config_frequency(config: CpuClkConfig) -> u32 {
3780 (cpu_root_clk_frequency() / (config.divisor() + 1))
3781 }
3782 pub fn cpu_clk_frequency() -> u32 {
3783 CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3784 }
3785 pub fn cpu_clk_source_frequency() -> u32 {
3786 cpu_root_clk_frequency()
3787 }
3788 pub fn configure_mem_clk(clocks: &mut ClockTree, config: MemClkConfig) {
3789 let old_config = clocks.mem_clk.replace(config);
3790 refresh_mem_clk_downstream(clocks);
3791 configure_mem_clk_impl(clocks, old_config, config);
3792 }
3793 pub fn mem_clk_config(clocks: &mut ClockTree) -> Option<MemClkConfig> {
3794 clocks.mem_clk
3795 }
3796 pub fn request_mem_clk(clocks: &mut ClockTree) {
3797 trace!("Enabling MEM_CLK");
3798 request_cpu_clk(clocks);
3799 enable_mem_clk_impl(clocks, true);
3800 }
3801 pub fn release_mem_clk(clocks: &mut ClockTree) {
3802 trace!("Disabling MEM_CLK");
3803 enable_mem_clk_impl(clocks, false);
3804 release_cpu_clk(clocks);
3805 }
3806 pub fn mem_clk_config_frequency(config: MemClkConfig) -> u32 {
3807 (cpu_clk_frequency() / (config.divisor() + 1))
3808 }
3809 pub fn mem_clk_frequency() -> u32 {
3810 MEM_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3811 }
3812 pub fn mem_clk_source_frequency() -> u32 {
3813 cpu_clk_frequency()
3814 }
3815 pub fn configure_sys_clk(clocks: &mut ClockTree, config: SysClkConfig) {
3816 let old_config = clocks.sys_clk.replace(config);
3817 refresh_sys_clk_downstream(clocks);
3818 configure_sys_clk_impl(clocks, old_config, config);
3819 }
3820 pub fn sys_clk_config(clocks: &mut ClockTree) -> Option<SysClkConfig> {
3821 clocks.sys_clk
3822 }
3823 pub fn request_sys_clk(clocks: &mut ClockTree) {
3824 trace!("Enabling SYS_CLK");
3825 request_mem_clk(clocks);
3826 enable_sys_clk_impl(clocks, true);
3827 }
3828 pub fn release_sys_clk(clocks: &mut ClockTree) {
3829 trace!("Disabling SYS_CLK");
3830 enable_sys_clk_impl(clocks, false);
3831 release_mem_clk(clocks);
3832 }
3833 pub fn sys_clk_config_frequency(config: SysClkConfig) -> u32 {
3834 (mem_clk_frequency() / (config.divisor() + 1))
3835 }
3836 pub fn sys_clk_frequency() -> u32 {
3837 SYS_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3838 }
3839 pub fn sys_clk_source_frequency() -> u32 {
3840 mem_clk_frequency()
3841 }
3842 pub fn configure_apb_clk(clocks: &mut ClockTree, config: ApbClkConfig) {
3843 let old_config = clocks.apb_clk.replace(config);
3844 refresh_apb_clk_downstream(clocks);
3845 configure_apb_clk_impl(clocks, old_config, config);
3846 }
3847 pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
3848 clocks.apb_clk
3849 }
3850 pub fn request_apb_clk(clocks: &mut ClockTree) {
3851 trace!("Requesting APB_CLK");
3852 if increment_reference_count(&mut clocks.apb_clk_refcount) {
3853 trace!("Enabling APB_CLK");
3854 request_sys_clk(clocks);
3855 enable_apb_clk_impl(clocks, true);
3856 }
3857 }
3858 pub fn release_apb_clk(clocks: &mut ClockTree) {
3859 trace!("Releasing APB_CLK");
3860 if decrement_reference_count(&mut clocks.apb_clk_refcount) {
3861 trace!("Disabling APB_CLK");
3862 enable_apb_clk_impl(clocks, false);
3863 release_sys_clk(clocks);
3864 }
3865 }
3866 pub fn apb_clk_config_frequency(config: ApbClkConfig) -> u32 {
3867 (sys_clk_frequency() / (config.divisor() + 1))
3868 }
3869 pub fn apb_clk_frequency() -> u32 {
3870 APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3871 }
3872 pub fn apb_clk_source_frequency() -> u32 {
3873 sys_clk_frequency()
3874 }
3875 pub fn configure_lp_fast_clk(clocks: &mut ClockTree, new_selector: LpFastClkConfig) {
3876 let old_selector = clocks.lp_fast_clk.replace(new_selector);
3877 refresh_lp_fast_clk_downstream(clocks);
3878 let active = clocks.lp_fast_clk_refcount > 0;
3879 if active {
3880 match new_selector {
3881 LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
3882 LpFastClkConfig::XtalD2 => request_xtal_d2_clk(clocks),
3883 }
3884 }
3885 configure_lp_fast_clk_impl(clocks, old_selector, new_selector);
3886 if active && let Some(old_selector) = old_selector {
3887 match old_selector {
3888 LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
3889 LpFastClkConfig::XtalD2 => release_xtal_d2_clk(clocks),
3890 }
3891 }
3892 }
3893 pub fn lp_fast_clk_config(clocks: &mut ClockTree) -> Option<LpFastClkConfig> {
3894 clocks.lp_fast_clk
3895 }
3896 pub fn request_lp_fast_clk(clocks: &mut ClockTree) {
3897 trace!("Requesting LP_FAST_CLK");
3898 if increment_reference_count(&mut clocks.lp_fast_clk_refcount) {
3899 trace!("Enabling LP_FAST_CLK");
3900 match unwrap!(clocks.lp_fast_clk) {
3901 LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
3902 LpFastClkConfig::XtalD2 => request_xtal_d2_clk(clocks),
3903 }
3904 enable_lp_fast_clk_impl(clocks, true);
3905 }
3906 }
3907 pub fn release_lp_fast_clk(clocks: &mut ClockTree) {
3908 trace!("Releasing LP_FAST_CLK");
3909 if decrement_reference_count(&mut clocks.lp_fast_clk_refcount) {
3910 trace!("Disabling LP_FAST_CLK");
3911 enable_lp_fast_clk_impl(clocks, false);
3912 match unwrap!(clocks.lp_fast_clk) {
3913 LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
3914 LpFastClkConfig::XtalD2 => release_xtal_d2_clk(clocks),
3915 }
3916 }
3917 }
3918 pub fn lp_fast_clk_config_frequency(config: LpFastClkConfig) -> u32 {
3919 match config {
3920 LpFastClkConfig::RcFast => rc_fast_clk_frequency(),
3921 LpFastClkConfig::XtalD2 => xtal_d2_clk_frequency(),
3922 }
3923 }
3924 pub fn lp_fast_clk_frequency() -> u32 {
3925 LP_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3926 }
3927 pub fn lp_fast_clk_source_frequency(source: LpFastClkConfig) -> u32 {
3928 lp_fast_clk_config_frequency(source)
3929 }
3930 pub fn configure_lp_slow_clk(clocks: &mut ClockTree, new_selector: LpSlowClkConfig) {
3931 let old_selector = clocks.lp_slow_clk.replace(new_selector);
3932 refresh_lp_slow_clk_downstream(clocks);
3933 match new_selector {
3934 LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3935 #[cfg(use_xtal32k)]
3936 LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3937 LpSlowClkConfig::OscSlow => request_osc_slow_clk(clocks),
3938 }
3939 configure_lp_slow_clk_impl(clocks, old_selector, new_selector);
3940 if let Some(old_selector) = old_selector {
3941 match old_selector {
3942 LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3943 #[cfg(use_xtal32k)]
3944 LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3945 LpSlowClkConfig::OscSlow => release_osc_slow_clk(clocks),
3946 }
3947 }
3948 }
3949 pub fn lp_slow_clk_config(clocks: &mut ClockTree) -> Option<LpSlowClkConfig> {
3950 clocks.lp_slow_clk
3951 }
3952 pub fn request_lp_slow_clk(clocks: &mut ClockTree) {
3953 trace!("Enabling LP_SLOW_CLK");
3954 match unwrap!(clocks.lp_slow_clk) {
3955 LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3956 #[cfg(use_xtal32k)]
3957 LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3958 LpSlowClkConfig::OscSlow => request_osc_slow_clk(clocks),
3959 }
3960 enable_lp_slow_clk_impl(clocks, true);
3961 }
3962 pub fn release_lp_slow_clk(clocks: &mut ClockTree) {
3963 trace!("Disabling LP_SLOW_CLK");
3964 enable_lp_slow_clk_impl(clocks, false);
3965 match unwrap!(clocks.lp_slow_clk) {
3966 LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3967 #[cfg(use_xtal32k)]
3968 LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3969 LpSlowClkConfig::OscSlow => release_osc_slow_clk(clocks),
3970 }
3971 }
3972 pub fn lp_slow_clk_config_frequency(config: LpSlowClkConfig) -> u32 {
3973 match config {
3974 LpSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3975 #[cfg(use_xtal32k)]
3976 LpSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3977 LpSlowClkConfig::OscSlow => osc_slow_clk_frequency(),
3978 }
3979 }
3980 pub fn lp_slow_clk_frequency() -> u32 {
3981 LP_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3982 }
3983 pub fn lp_slow_clk_source_frequency(source: LpSlowClkConfig) -> u32 {
3984 lp_slow_clk_config_frequency(source)
3985 }
3986 pub fn configure_crypto_clk(clocks: &mut ClockTree, new_selector: CryptoClkConfig) {
3987 let old_selector = clocks.crypto_clk.replace(new_selector);
3988 refresh_crypto_clk_downstream(clocks);
3989 let active = clocks.crypto_clk_refcount > 0;
3990 if active {
3991 match new_selector {
3992 CryptoClkConfig::Xtal => request_xtal_clk(clocks),
3993 CryptoClkConfig::RcFast => request_rc_fast_clk(clocks),
3994 CryptoClkConfig::PllF240m => request_pll_f240m(clocks),
3995 CryptoClkConfig::PllF160m => request_pll_f160m(clocks),
3996 }
3997 }
3998 configure_crypto_clk_impl(clocks, old_selector, new_selector);
3999 if active && let Some(old_selector) = old_selector {
4000 match old_selector {
4001 CryptoClkConfig::Xtal => release_xtal_clk(clocks),
4002 CryptoClkConfig::RcFast => release_rc_fast_clk(clocks),
4003 CryptoClkConfig::PllF240m => release_pll_f240m(clocks),
4004 CryptoClkConfig::PllF160m => release_pll_f160m(clocks),
4005 }
4006 }
4007 }
4008 pub fn crypto_clk_config(clocks: &mut ClockTree) -> Option<CryptoClkConfig> {
4009 clocks.crypto_clk
4010 }
4011 pub fn request_crypto_clk(clocks: &mut ClockTree) {
4012 trace!("Requesting CRYPTO_CLK");
4013 if increment_reference_count(&mut clocks.crypto_clk_refcount) {
4014 trace!("Enabling CRYPTO_CLK");
4015 match unwrap!(clocks.crypto_clk) {
4016 CryptoClkConfig::Xtal => request_xtal_clk(clocks),
4017 CryptoClkConfig::RcFast => request_rc_fast_clk(clocks),
4018 CryptoClkConfig::PllF240m => request_pll_f240m(clocks),
4019 CryptoClkConfig::PllF160m => request_pll_f160m(clocks),
4020 }
4021 enable_crypto_clk_impl(clocks, true);
4022 }
4023 }
4024 pub fn release_crypto_clk(clocks: &mut ClockTree) {
4025 trace!("Releasing CRYPTO_CLK");
4026 if decrement_reference_count(&mut clocks.crypto_clk_refcount) {
4027 trace!("Disabling CRYPTO_CLK");
4028 enable_crypto_clk_impl(clocks, false);
4029 match unwrap!(clocks.crypto_clk) {
4030 CryptoClkConfig::Xtal => release_xtal_clk(clocks),
4031 CryptoClkConfig::RcFast => release_rc_fast_clk(clocks),
4032 CryptoClkConfig::PllF240m => release_pll_f240m(clocks),
4033 CryptoClkConfig::PllF160m => release_pll_f160m(clocks),
4034 }
4035 }
4036 }
4037 pub fn crypto_clk_config_frequency(config: CryptoClkConfig) -> u32 {
4038 match config {
4039 CryptoClkConfig::Xtal => xtal_clk_frequency(),
4040 CryptoClkConfig::RcFast => rc_fast_clk_frequency(),
4041 CryptoClkConfig::PllF240m => pll_f240m_frequency(),
4042 CryptoClkConfig::PllF160m => pll_f160m_frequency(),
4043 }
4044 }
4045 pub fn crypto_clk_frequency() -> u32 {
4046 CRYPTO_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4047 }
4048 pub fn crypto_clk_source_frequency(source: CryptoClkConfig) -> u32 {
4049 crypto_clk_config_frequency(source)
4050 }
4051 pub fn configure_timg_calibration_clock(
4052 clocks: &mut ClockTree,
4053 new_selector: TimgCalibrationClockConfig,
4054 ) {
4055 let old_selector = clocks.timg_calibration_clock.replace(new_selector);
4056 refresh_timg_calibration_clock_downstream(clocks);
4057 let active = clocks.timg_calibration_clock_refcount > 0;
4058 if active {
4059 match new_selector {
4060 TimgCalibrationClockConfig::MpllClk => request_mpll_clk(clocks),
4061 TimgCalibrationClockConfig::SpllClk => request_spll_clk(clocks),
4062 TimgCalibrationClockConfig::CpllClk => request_cpll_clk(clocks),
4063 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
4064 TimgCalibrationClockConfig::RcSlowClk => request_lp_slow_clk(clocks),
4065 #[cfg(use_xtal32k)]
4066 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
4067 }
4068 }
4069 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
4070 if active && let Some(old_selector) = old_selector {
4071 match old_selector {
4072 TimgCalibrationClockConfig::MpllClk => release_mpll_clk(clocks),
4073 TimgCalibrationClockConfig::SpllClk => release_spll_clk(clocks),
4074 TimgCalibrationClockConfig::CpllClk => release_cpll_clk(clocks),
4075 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
4076 TimgCalibrationClockConfig::RcSlowClk => release_lp_slow_clk(clocks),
4077 #[cfg(use_xtal32k)]
4078 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
4079 }
4080 }
4081 }
4082 pub fn timg_calibration_clock_config(
4083 clocks: &mut ClockTree,
4084 ) -> Option<TimgCalibrationClockConfig> {
4085 clocks.timg_calibration_clock
4086 }
4087 pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
4088 trace!("Requesting TIMG_CALIBRATION_CLOCK");
4089 if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
4090 trace!("Enabling TIMG_CALIBRATION_CLOCK");
4091 crate::rtc_cntl::WakeLock::acquire();
4092 match unwrap!(clocks.timg_calibration_clock) {
4093 TimgCalibrationClockConfig::MpllClk => request_mpll_clk(clocks),
4094 TimgCalibrationClockConfig::SpllClk => request_spll_clk(clocks),
4095 TimgCalibrationClockConfig::CpllClk => request_cpll_clk(clocks),
4096 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
4097 TimgCalibrationClockConfig::RcSlowClk => request_lp_slow_clk(clocks),
4098 #[cfg(use_xtal32k)]
4099 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
4100 }
4101 enable_timg_calibration_clock_impl(clocks, true);
4102 }
4103 }
4104 pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
4105 trace!("Releasing TIMG_CALIBRATION_CLOCK");
4106 if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
4107 trace!("Disabling TIMG_CALIBRATION_CLOCK");
4108 crate::rtc_cntl::WakeLock::release();
4109 enable_timg_calibration_clock_impl(clocks, false);
4110 match unwrap!(clocks.timg_calibration_clock) {
4111 TimgCalibrationClockConfig::MpllClk => release_mpll_clk(clocks),
4112 TimgCalibrationClockConfig::SpllClk => release_spll_clk(clocks),
4113 TimgCalibrationClockConfig::CpllClk => release_cpll_clk(clocks),
4114 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
4115 TimgCalibrationClockConfig::RcSlowClk => release_lp_slow_clk(clocks),
4116 #[cfg(use_xtal32k)]
4117 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
4118 }
4119 }
4120 }
4121 pub fn timg_calibration_clock_config_frequency(config: TimgCalibrationClockConfig) -> u32 {
4122 match config {
4123 TimgCalibrationClockConfig::MpllClk => mpll_clk_frequency(),
4124 TimgCalibrationClockConfig::SpllClk => spll_clk_frequency(),
4125 TimgCalibrationClockConfig::CpllClk => cpll_clk_frequency(),
4126 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_frequency(),
4127 TimgCalibrationClockConfig::RcSlowClk => lp_slow_clk_frequency(),
4128 #[cfg(use_xtal32k)]
4129 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
4130 }
4131 }
4132 pub fn timg_calibration_clock_frequency() -> u32 {
4133 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
4134 }
4135 pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
4136 timg_calibration_clock_config_frequency(source)
4137 }
4138 impl SdmInstance {
4139 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4140 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4141 if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
4142 {
4143 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4144 request_iomux_function_clock(clocks);
4145 self.enable_function_clock_impl(clocks, true);
4146 }
4147 }
4148 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4149 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4150 if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
4151 {
4152 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4153 self.enable_function_clock_impl(clocks, false);
4154 release_iomux_function_clock(clocks);
4155 }
4156 }
4157 pub fn function_clock_frequency(self) -> u32 {
4158 iomux_function_clock_frequency()
4159 }
4160 pub fn function_clock_source_frequency() -> u32 {
4161 iomux_function_clock_frequency()
4162 }
4163 }
4164 impl TimgInstance {
4165 pub fn configure_function_clock(
4166 self,
4167 clocks: &mut ClockTree,
4168 new_selector: TimgFunctionClockConfig,
4169 ) {
4170 let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
4171 refresh_timg_function_clock_downstream(clocks, self);
4172 let active = clocks.timg_function_clock_refcount[self as usize] > 0;
4173 if active {
4174 match new_selector {
4175 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
4176 TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4177 TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
4178 }
4179 }
4180 self.configure_function_clock_impl(clocks, old_selector, new_selector);
4181 if active && let Some(old_selector) = old_selector {
4182 match old_selector {
4183 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
4184 TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4185 TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
4186 }
4187 }
4188 }
4189 pub fn function_clock_config(
4190 self,
4191 clocks: &mut ClockTree,
4192 ) -> Option<TimgFunctionClockConfig> {
4193 clocks.timg_function_clock[self as usize]
4194 }
4195 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4196 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4197 if increment_reference_count(
4198 &mut clocks.timg_function_clock_refcount[self as usize],
4199 ) {
4200 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4201 match unwrap!(clocks.timg_function_clock[self as usize]) {
4202 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
4203 TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4204 TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
4205 }
4206 self.enable_function_clock_impl(clocks, true);
4207 }
4208 }
4209 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4210 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4211 if decrement_reference_count(
4212 &mut clocks.timg_function_clock_refcount[self as usize],
4213 ) {
4214 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4215 self.enable_function_clock_impl(clocks, false);
4216 match unwrap!(clocks.timg_function_clock[self as usize]) {
4217 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
4218 TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4219 TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
4220 }
4221 }
4222 }
4223 pub fn function_clock_config_frequency(config: TimgFunctionClockConfig) -> u32 {
4224 match config {
4225 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
4226 TimgFunctionClockConfig::RcFastClk => rc_fast_clk_frequency(),
4227 TimgFunctionClockConfig::PllF80m => pll_f80m_frequency(),
4228 }
4229 }
4230 pub fn function_clock_frequency(self) -> u32 {
4231 TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4232 .load(::core::sync::atomic::Ordering::Acquire)
4233 }
4234 pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
4235 Self::function_clock_config_frequency(source)
4236 }
4237 pub fn configure_wdt_clock(
4238 self,
4239 clocks: &mut ClockTree,
4240 new_selector: TimgWdtClockConfig,
4241 ) {
4242 let old_selector = clocks.timg_wdt_clock[self as usize].replace(new_selector);
4243 refresh_timg_wdt_clock_downstream(clocks, self);
4244 let active = clocks.timg_wdt_clock_refcount[self as usize] > 0;
4245 if active {
4246 match new_selector {
4247 TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
4248 TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
4249 TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4250 }
4251 }
4252 self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
4253 if active && let Some(old_selector) = old_selector {
4254 match old_selector {
4255 TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
4256 TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
4257 TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4258 }
4259 }
4260 }
4261 pub fn wdt_clock_config(self, clocks: &mut ClockTree) -> Option<TimgWdtClockConfig> {
4262 clocks.timg_wdt_clock[self as usize]
4263 }
4264 pub fn request_wdt_clock(self, clocks: &mut ClockTree) {
4265 trace!("Requesting {:?}::WDT_CLOCK", self);
4266 if increment_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
4267 trace!("Enabling {:?}::WDT_CLOCK", self);
4268 match unwrap!(clocks.timg_wdt_clock[self as usize]) {
4269 TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
4270 TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
4271 TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
4272 }
4273 self.enable_wdt_clock_impl(clocks, true);
4274 }
4275 }
4276 pub fn release_wdt_clock(self, clocks: &mut ClockTree) {
4277 trace!("Releasing {:?}::WDT_CLOCK", self);
4278 if decrement_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
4279 trace!("Disabling {:?}::WDT_CLOCK", self);
4280 self.enable_wdt_clock_impl(clocks, false);
4281 match unwrap!(clocks.timg_wdt_clock[self as usize]) {
4282 TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
4283 TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
4284 TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
4285 }
4286 }
4287 }
4288 pub fn wdt_clock_config_frequency(config: TimgWdtClockConfig) -> u32 {
4289 match config {
4290 TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
4291 TimgWdtClockConfig::PllF80m => pll_f80m_frequency(),
4292 TimgWdtClockConfig::RcFastClk => rc_fast_clk_frequency(),
4293 }
4294 }
4295 pub fn wdt_clock_frequency(self) -> u32 {
4296 TIMG_WDT_CLOCK_FREQ_CACHE[self as usize]
4297 .load(::core::sync::atomic::Ordering::Acquire)
4298 }
4299 pub fn wdt_clock_source_frequency(source: TimgWdtClockConfig) -> u32 {
4300 Self::wdt_clock_config_frequency(source)
4301 }
4302 }
4303 impl UartInstance {
4304 pub fn configure_function_clock(
4305 self,
4306 clocks: &mut ClockTree,
4307 config: UartFunctionClockConfig,
4308 ) {
4309 let old_config = clocks.uart_function_clock[self as usize].replace(config);
4310 refresh_uart_function_clock_downstream(clocks, self);
4311 let active = clocks.uart_function_clock_refcount[self as usize] > 0;
4312 if active {
4313 match config.sclk {
4314 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4315 UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
4316 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4317 }
4318 }
4319 self.configure_function_clock_impl(clocks, old_config, config);
4320 if active && let Some(old_config) = old_config {
4321 match old_config.sclk {
4322 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4323 UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
4324 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4325 }
4326 }
4327 }
4328 pub fn function_clock_config(
4329 self,
4330 clocks: &mut ClockTree,
4331 ) -> Option<UartFunctionClockConfig> {
4332 clocks.uart_function_clock[self as usize]
4333 }
4334 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4335 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4336 if increment_reference_count(
4337 &mut clocks.uart_function_clock_refcount[self as usize],
4338 ) {
4339 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4340 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
4341 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4342 UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
4343 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4344 }
4345 self.enable_function_clock_impl(clocks, true);
4346 }
4347 }
4348 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4349 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4350 if decrement_reference_count(
4351 &mut clocks.uart_function_clock_refcount[self as usize],
4352 ) {
4353 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4354 self.enable_function_clock_impl(clocks, false);
4355 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
4356 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4357 UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
4358 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4359 }
4360 }
4361 }
4362 pub fn function_clock_config_frequency(config: UartFunctionClockConfig) -> u32 {
4363 (match config.sclk {
4364 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
4365 UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
4366 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4367 } / (config.div_num() + 1))
4368 }
4369 pub fn function_clock_frequency(self) -> u32 {
4370 UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4371 .load(::core::sync::atomic::Ordering::Acquire)
4372 }
4373 pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
4374 match sclk {
4375 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
4376 UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
4377 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4378 }
4379 }
4380 pub fn configure_baud_rate_generator(
4381 self,
4382 clocks: &mut ClockTree,
4383 config: UartBaudRateGeneratorConfig,
4384 ) {
4385 let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
4386 refresh_uart_baud_rate_generator_downstream(clocks, self);
4387 self.configure_baud_rate_generator_impl(clocks, old_config, config);
4388 }
4389 pub fn baud_rate_generator_config(
4390 self,
4391 clocks: &mut ClockTree,
4392 ) -> Option<UartBaudRateGeneratorConfig> {
4393 clocks.uart_baud_rate_generator[self as usize]
4394 }
4395 pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
4396 trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
4397 if increment_reference_count(
4398 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
4399 ) {
4400 trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
4401 self.request_function_clock(clocks);
4402 self.enable_baud_rate_generator_impl(clocks, true);
4403 }
4404 }
4405 pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
4406 trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
4407 if decrement_reference_count(
4408 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
4409 ) {
4410 trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
4411 self.enable_baud_rate_generator_impl(clocks, false);
4412 self.release_function_clock(clocks);
4413 }
4414 }
4415 pub fn baud_rate_generator_config_frequency(
4416 self,
4417 config: UartBaudRateGeneratorConfig,
4418 ) -> u32 {
4419 ((self.function_clock_frequency() * 16)
4420 / ((config.integral() * 16) + config.fractional()))
4421 }
4422 pub fn baud_rate_generator_frequency(self) -> u32 {
4423 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
4424 .load(::core::sync::atomic::Ordering::Acquire)
4425 }
4426 }
4427 impl SpiInstance {
4428 pub fn configure_function_clock(
4429 self,
4430 clocks: &mut ClockTree,
4431 new_selector: SpiFunctionClockConfig,
4432 ) {
4433 let old_selector = clocks.spi_function_clock[self as usize].replace(new_selector);
4434 refresh_spi_function_clock_downstream(clocks, self);
4435 let active = clocks.spi_function_clock_refcount[self as usize] > 0;
4436 if active {
4437 match new_selector {
4438 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4439 SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
4440 SpiFunctionClockConfig::Spll => request_spll_d3_clock(clocks),
4441 }
4442 }
4443 self.configure_function_clock_impl(clocks, old_selector, new_selector);
4444 if active && let Some(old_selector) = old_selector {
4445 match old_selector {
4446 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4447 SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
4448 SpiFunctionClockConfig::Spll => release_spll_d3_clock(clocks),
4449 }
4450 }
4451 }
4452 pub fn function_clock_config(
4453 self,
4454 clocks: &mut ClockTree,
4455 ) -> Option<SpiFunctionClockConfig> {
4456 clocks.spi_function_clock[self as usize]
4457 }
4458 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4459 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4460 if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
4461 {
4462 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4463 match unwrap!(clocks.spi_function_clock[self as usize]) {
4464 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4465 SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
4466 SpiFunctionClockConfig::Spll => request_spll_d3_clock(clocks),
4467 }
4468 self.enable_function_clock_impl(clocks, true);
4469 }
4470 }
4471 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4472 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4473 if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
4474 {
4475 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4476 self.enable_function_clock_impl(clocks, false);
4477 match unwrap!(clocks.spi_function_clock[self as usize]) {
4478 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4479 SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
4480 SpiFunctionClockConfig::Spll => release_spll_d3_clock(clocks),
4481 }
4482 }
4483 }
4484 pub fn function_clock_config_frequency(config: SpiFunctionClockConfig) -> u32 {
4485 match config {
4486 SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
4487 SpiFunctionClockConfig::RcFast => rc_fast_clk_frequency(),
4488 SpiFunctionClockConfig::Spll => spll_d3_clock_frequency(),
4489 }
4490 }
4491 pub fn function_clock_frequency(self) -> u32 {
4492 SPI_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4493 .load(::core::sync::atomic::Ordering::Acquire)
4494 }
4495 pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
4496 Self::function_clock_config_frequency(source)
4497 }
4498 }
4499 impl I2cInstance {
4500 pub fn configure_function_clock(
4501 self,
4502 clocks: &mut ClockTree,
4503 config: I2cFunctionClockConfig,
4504 ) {
4505 let old_config = clocks.i2c_function_clock[self as usize].replace(config);
4506 refresh_i2c_function_clock_downstream(clocks, self);
4507 let active = clocks.i2c_function_clock_refcount[self as usize] > 0;
4508 if active {
4509 match config.sclk {
4510 I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4511 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4512 }
4513 }
4514 self.configure_function_clock_impl(clocks, old_config, config);
4515 if active && let Some(old_config) = old_config {
4516 match old_config.sclk {
4517 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4518 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4519 }
4520 }
4521 }
4522 pub fn function_clock_config(
4523 self,
4524 clocks: &mut ClockTree,
4525 ) -> Option<I2cFunctionClockConfig> {
4526 clocks.i2c_function_clock[self as usize]
4527 }
4528 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4529 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4530 if increment_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
4531 {
4532 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4533 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
4534 I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4535 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4536 }
4537 self.enable_function_clock_impl(clocks, true);
4538 }
4539 }
4540 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4541 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4542 if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
4543 {
4544 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4545 self.enable_function_clock_impl(clocks, false);
4546 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
4547 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4548 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4549 }
4550 }
4551 }
4552 pub fn function_clock_config_frequency(config: I2cFunctionClockConfig) -> u32 {
4553 (match config.sclk {
4554 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
4555 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4556 } / (config.div_num() + 1))
4557 }
4558 pub fn function_clock_frequency(self) -> u32 {
4559 I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4560 .load(::core::sync::atomic::Ordering::Acquire)
4561 }
4562 pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
4563 match sclk {
4564 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
4565 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4566 }
4567 }
4568 }
4569 impl I2sInstance {
4570 pub fn configure_tx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
4571 let old_config = clocks.i2s_tx_clk[self as usize].replace(config);
4572 refresh_i2s_tx_clk_downstream(clocks, self);
4573 let active = clocks.i2s_tx_clk_refcount[self as usize] > 0;
4574 if active {
4575 match config.sclk {
4576 I2sClkSclk::Xtal => request_xtal_clk(clocks),
4577 I2sClkSclk::PllF160m => request_pll_f160m(clocks),
4578 }
4579 }
4580 self.configure_tx_clk_impl(clocks, old_config, config);
4581 if active && let Some(old_config) = old_config {
4582 match old_config.sclk {
4583 I2sClkSclk::Xtal => release_xtal_clk(clocks),
4584 I2sClkSclk::PllF160m => release_pll_f160m(clocks),
4585 }
4586 }
4587 }
4588 pub fn tx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
4589 clocks.i2s_tx_clk[self as usize]
4590 }
4591 pub fn request_tx_clk(self, clocks: &mut ClockTree) {
4592 trace!("Requesting {:?}::TX_CLK", self);
4593 if increment_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
4594 trace!("Enabling {:?}::TX_CLK", self);
4595 crate::rtc_cntl::WakeLock::acquire();
4596 match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
4597 I2sClkSclk::Xtal => request_xtal_clk(clocks),
4598 I2sClkSclk::PllF160m => request_pll_f160m(clocks),
4599 }
4600 self.enable_tx_clk_impl(clocks, true);
4601 }
4602 }
4603 pub fn release_tx_clk(self, clocks: &mut ClockTree) {
4604 trace!("Releasing {:?}::TX_CLK", self);
4605 if decrement_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
4606 trace!("Disabling {:?}::TX_CLK", self);
4607 crate::rtc_cntl::WakeLock::release();
4608 self.enable_tx_clk_impl(clocks, false);
4609 match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
4610 I2sClkSclk::Xtal => release_xtal_clk(clocks),
4611 I2sClkSclk::PllF160m => release_pll_f160m(clocks),
4612 }
4613 }
4614 }
4615 pub fn tx_clk_config_frequency(config: I2sClkConfig) -> u32 {
4616 (((match config.sclk {
4617 I2sClkSclk::Xtal => xtal_clk_frequency(),
4618 I2sClkSclk::PllF160m => pll_f160m_frequency(),
4619 } as u64)
4620 * (config.div_a() as u64))
4621 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4622 as u32
4623 }
4624 pub fn tx_clk_frequency(self) -> u32 {
4625 I2S_TX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4626 }
4627 pub fn tx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
4628 match sclk {
4629 I2sClkSclk::Xtal => xtal_clk_frequency(),
4630 I2sClkSclk::PllF160m => pll_f160m_frequency(),
4631 }
4632 }
4633 pub fn configure_rx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
4634 let old_config = clocks.i2s_rx_clk[self as usize].replace(config);
4635 refresh_i2s_rx_clk_downstream(clocks, self);
4636 let active = clocks.i2s_rx_clk_refcount[self as usize] > 0;
4637 if active {
4638 match config.sclk {
4639 I2sClkSclk::Xtal => request_xtal_clk(clocks),
4640 I2sClkSclk::PllF160m => request_pll_f160m(clocks),
4641 }
4642 }
4643 self.configure_rx_clk_impl(clocks, old_config, config);
4644 if active && let Some(old_config) = old_config {
4645 match old_config.sclk {
4646 I2sClkSclk::Xtal => release_xtal_clk(clocks),
4647 I2sClkSclk::PllF160m => release_pll_f160m(clocks),
4648 }
4649 }
4650 }
4651 pub fn rx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
4652 clocks.i2s_rx_clk[self as usize]
4653 }
4654 pub fn request_rx_clk(self, clocks: &mut ClockTree) {
4655 trace!("Requesting {:?}::RX_CLK", self);
4656 if increment_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
4657 trace!("Enabling {:?}::RX_CLK", self);
4658 crate::rtc_cntl::WakeLock::acquire();
4659 match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
4660 I2sClkSclk::Xtal => request_xtal_clk(clocks),
4661 I2sClkSclk::PllF160m => request_pll_f160m(clocks),
4662 }
4663 self.enable_rx_clk_impl(clocks, true);
4664 }
4665 }
4666 pub fn release_rx_clk(self, clocks: &mut ClockTree) {
4667 trace!("Releasing {:?}::RX_CLK", self);
4668 if decrement_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
4669 trace!("Disabling {:?}::RX_CLK", self);
4670 crate::rtc_cntl::WakeLock::release();
4671 self.enable_rx_clk_impl(clocks, false);
4672 match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
4673 I2sClkSclk::Xtal => release_xtal_clk(clocks),
4674 I2sClkSclk::PllF160m => release_pll_f160m(clocks),
4675 }
4676 }
4677 }
4678 pub fn rx_clk_config_frequency(config: I2sClkConfig) -> u32 {
4679 (((match config.sclk {
4680 I2sClkSclk::Xtal => xtal_clk_frequency(),
4681 I2sClkSclk::PllF160m => pll_f160m_frequency(),
4682 } as u64)
4683 * (config.div_a() as u64))
4684 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4685 as u32
4686 }
4687 pub fn rx_clk_frequency(self) -> u32 {
4688 I2S_RX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4689 }
4690 pub fn rx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
4691 match sclk {
4692 I2sClkSclk::Xtal => xtal_clk_frequency(),
4693 I2sClkSclk::PllF160m => pll_f160m_frequency(),
4694 }
4695 }
4696 pub fn configure_mclk_out(
4697 self,
4698 clocks: &mut ClockTree,
4699 new_selector: I2sMclkOutConfig,
4700 ) {
4701 let old_selector = clocks.i2s_mclk_out[self as usize].replace(new_selector);
4702 refresh_i2s_mclk_out_downstream(clocks, self);
4703 let active = clocks.i2s_mclk_out_refcount[self as usize] > 0;
4704 if active {
4705 match new_selector {
4706 I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
4707 I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
4708 }
4709 }
4710 self.configure_mclk_out_impl(clocks, old_selector, new_selector);
4711 if active && let Some(old_selector) = old_selector {
4712 match old_selector {
4713 I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
4714 I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
4715 }
4716 }
4717 }
4718 pub fn mclk_out_config(self, clocks: &mut ClockTree) -> Option<I2sMclkOutConfig> {
4719 clocks.i2s_mclk_out[self as usize]
4720 }
4721 pub fn request_mclk_out(self, clocks: &mut ClockTree) {
4722 trace!("Requesting {:?}::MCLK_OUT", self);
4723 if increment_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
4724 trace!("Enabling {:?}::MCLK_OUT", self);
4725 match unwrap!(clocks.i2s_mclk_out[self as usize]) {
4726 I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
4727 I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
4728 }
4729 self.enable_mclk_out_impl(clocks, true);
4730 }
4731 }
4732 pub fn release_mclk_out(self, clocks: &mut ClockTree) {
4733 trace!("Releasing {:?}::MCLK_OUT", self);
4734 if decrement_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
4735 trace!("Disabling {:?}::MCLK_OUT", self);
4736 self.enable_mclk_out_impl(clocks, false);
4737 match unwrap!(clocks.i2s_mclk_out[self as usize]) {
4738 I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
4739 I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
4740 }
4741 }
4742 }
4743 pub fn mclk_out_config_frequency(self, config: I2sMclkOutConfig) -> u32 {
4744 match config {
4745 I2sMclkOutConfig::Tx => self.tx_clk_frequency(),
4746 I2sMclkOutConfig::Rx => self.rx_clk_frequency(),
4747 }
4748 }
4749 pub fn mclk_out_frequency(self) -> u32 {
4750 I2S_MCLK_OUT_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4751 }
4752 }
4753 impl MipiDsiInstance {
4754 pub fn configure_dpi_clk(self, clocks: &mut ClockTree, config: MipiDsiDpiClkConfig) {
4755 let old_config = clocks.mipi_dsi_dpi_clk[self as usize].replace(config);
4756 refresh_mipi_dsi_dpi_clk_downstream(clocks, self);
4757 let active = clocks.mipi_dsi_dpi_clk_refcount[self as usize] > 0;
4758 if active {
4759 match config.sclk {
4760 MipiDsiDpiClkSclk::Xtal => request_xtal_clk(clocks),
4761 MipiDsiDpiClkSclk::PllF240m => request_pll_f240m(clocks),
4762 MipiDsiDpiClkSclk::PllF160m => request_pll_f160m(clocks),
4763 }
4764 }
4765 self.configure_dpi_clk_impl(clocks, old_config, config);
4766 if active && let Some(old_config) = old_config {
4767 match old_config.sclk {
4768 MipiDsiDpiClkSclk::Xtal => release_xtal_clk(clocks),
4769 MipiDsiDpiClkSclk::PllF240m => release_pll_f240m(clocks),
4770 MipiDsiDpiClkSclk::PllF160m => release_pll_f160m(clocks),
4771 }
4772 }
4773 }
4774 pub fn dpi_clk_config(self, clocks: &mut ClockTree) -> Option<MipiDsiDpiClkConfig> {
4775 clocks.mipi_dsi_dpi_clk[self as usize]
4776 }
4777 pub fn request_dpi_clk(self, clocks: &mut ClockTree) {
4778 trace!("Requesting {:?}::DPI_CLK", self);
4779 if increment_reference_count(&mut clocks.mipi_dsi_dpi_clk_refcount[self as usize]) {
4780 trace!("Enabling {:?}::DPI_CLK", self);
4781 match unwrap!(clocks.mipi_dsi_dpi_clk[self as usize]).sclk {
4782 MipiDsiDpiClkSclk::Xtal => request_xtal_clk(clocks),
4783 MipiDsiDpiClkSclk::PllF240m => request_pll_f240m(clocks),
4784 MipiDsiDpiClkSclk::PllF160m => request_pll_f160m(clocks),
4785 }
4786 self.enable_dpi_clk_impl(clocks, true);
4787 }
4788 }
4789 pub fn release_dpi_clk(self, clocks: &mut ClockTree) {
4790 trace!("Releasing {:?}::DPI_CLK", self);
4791 if decrement_reference_count(&mut clocks.mipi_dsi_dpi_clk_refcount[self as usize]) {
4792 trace!("Disabling {:?}::DPI_CLK", self);
4793 self.enable_dpi_clk_impl(clocks, false);
4794 match unwrap!(clocks.mipi_dsi_dpi_clk[self as usize]).sclk {
4795 MipiDsiDpiClkSclk::Xtal => release_xtal_clk(clocks),
4796 MipiDsiDpiClkSclk::PllF240m => release_pll_f240m(clocks),
4797 MipiDsiDpiClkSclk::PllF160m => release_pll_f160m(clocks),
4798 }
4799 }
4800 }
4801 pub fn dpi_clk_config_frequency(config: MipiDsiDpiClkConfig) -> u32 {
4802 (match config.sclk {
4803 MipiDsiDpiClkSclk::Xtal => xtal_clk_frequency(),
4804 MipiDsiDpiClkSclk::PllF240m => pll_f240m_frequency(),
4805 MipiDsiDpiClkSclk::PllF160m => pll_f160m_frequency(),
4806 } / (config.div_num() + 1))
4807 }
4808 pub fn dpi_clk_frequency(self) -> u32 {
4809 MIPI_DSI_DPI_CLK_FREQ_CACHE[self as usize]
4810 .load(::core::sync::atomic::Ordering::Acquire)
4811 }
4812 pub fn dpi_clk_source_frequency(sclk: MipiDsiDpiClkSclk) -> u32 {
4813 match sclk {
4814 MipiDsiDpiClkSclk::Xtal => xtal_clk_frequency(),
4815 MipiDsiDpiClkSclk::PllF240m => pll_f240m_frequency(),
4816 MipiDsiDpiClkSclk::PllF160m => pll_f160m_frequency(),
4817 }
4818 }
4819 pub fn configure_phy_pll_refclk(
4820 self,
4821 clocks: &mut ClockTree,
4822 config: MipiDsiPhyPllRefclkConfig,
4823 ) {
4824 let old_config = clocks.mipi_dsi_phy_pll_refclk[self as usize].replace(config);
4825 refresh_mipi_dsi_phy_pll_refclk_downstream(clocks, self);
4826 let active = clocks.mipi_dsi_phy_pll_refclk_refcount[self as usize] > 0;
4827 if active {
4828 match config.sclk {
4829 MipiDsiPhyPllRefclkSclk::Xtal => request_xtal_clk(clocks),
4830 MipiDsiPhyPllRefclkSclk::Cpll => request_cpll_clk(clocks),
4831 MipiDsiPhyPllRefclkSclk::Spll => request_spll_clk(clocks),
4832 MipiDsiPhyPllRefclkSclk::Mpll => request_mpll_clk(clocks),
4833 }
4834 }
4835 self.configure_phy_pll_refclk_impl(clocks, old_config, config);
4836 if active && let Some(old_config) = old_config {
4837 match old_config.sclk {
4838 MipiDsiPhyPllRefclkSclk::Xtal => release_xtal_clk(clocks),
4839 MipiDsiPhyPllRefclkSclk::Cpll => release_cpll_clk(clocks),
4840 MipiDsiPhyPllRefclkSclk::Spll => release_spll_clk(clocks),
4841 MipiDsiPhyPllRefclkSclk::Mpll => release_mpll_clk(clocks),
4842 }
4843 }
4844 }
4845 pub fn phy_pll_refclk_config(
4846 self,
4847 clocks: &mut ClockTree,
4848 ) -> Option<MipiDsiPhyPllRefclkConfig> {
4849 clocks.mipi_dsi_phy_pll_refclk[self as usize]
4850 }
4851 pub fn request_phy_pll_refclk(self, clocks: &mut ClockTree) {
4852 trace!("Requesting {:?}::PHY_PLL_REFCLK", self);
4853 if increment_reference_count(
4854 &mut clocks.mipi_dsi_phy_pll_refclk_refcount[self as usize],
4855 ) {
4856 trace!("Enabling {:?}::PHY_PLL_REFCLK", self);
4857 match unwrap!(clocks.mipi_dsi_phy_pll_refclk[self as usize]).sclk {
4858 MipiDsiPhyPllRefclkSclk::Xtal => request_xtal_clk(clocks),
4859 MipiDsiPhyPllRefclkSclk::Cpll => request_cpll_clk(clocks),
4860 MipiDsiPhyPllRefclkSclk::Spll => request_spll_clk(clocks),
4861 MipiDsiPhyPllRefclkSclk::Mpll => request_mpll_clk(clocks),
4862 }
4863 self.enable_phy_pll_refclk_impl(clocks, true);
4864 }
4865 }
4866 pub fn release_phy_pll_refclk(self, clocks: &mut ClockTree) {
4867 trace!("Releasing {:?}::PHY_PLL_REFCLK", self);
4868 if decrement_reference_count(
4869 &mut clocks.mipi_dsi_phy_pll_refclk_refcount[self as usize],
4870 ) {
4871 trace!("Disabling {:?}::PHY_PLL_REFCLK", self);
4872 self.enable_phy_pll_refclk_impl(clocks, false);
4873 match unwrap!(clocks.mipi_dsi_phy_pll_refclk[self as usize]).sclk {
4874 MipiDsiPhyPllRefclkSclk::Xtal => release_xtal_clk(clocks),
4875 MipiDsiPhyPllRefclkSclk::Cpll => release_cpll_clk(clocks),
4876 MipiDsiPhyPllRefclkSclk::Spll => release_spll_clk(clocks),
4877 MipiDsiPhyPllRefclkSclk::Mpll => release_mpll_clk(clocks),
4878 }
4879 }
4880 }
4881 pub fn phy_pll_refclk_config_frequency(config: MipiDsiPhyPllRefclkConfig) -> u32 {
4882 (match config.sclk {
4883 MipiDsiPhyPllRefclkSclk::Xtal => xtal_clk_frequency(),
4884 MipiDsiPhyPllRefclkSclk::Cpll => cpll_clk_frequency(),
4885 MipiDsiPhyPllRefclkSclk::Spll => spll_clk_frequency(),
4886 MipiDsiPhyPllRefclkSclk::Mpll => mpll_clk_frequency(),
4887 } / (config.div_num() + 1))
4888 }
4889 pub fn phy_pll_refclk_frequency(self) -> u32 {
4890 MIPI_DSI_PHY_PLL_REFCLK_FREQ_CACHE[self as usize]
4891 .load(::core::sync::atomic::Ordering::Acquire)
4892 }
4893 pub fn phy_pll_refclk_source_frequency(sclk: MipiDsiPhyPllRefclkSclk) -> u32 {
4894 match sclk {
4895 MipiDsiPhyPllRefclkSclk::Xtal => xtal_clk_frequency(),
4896 MipiDsiPhyPllRefclkSclk::Cpll => cpll_clk_frequency(),
4897 MipiDsiPhyPllRefclkSclk::Spll => spll_clk_frequency(),
4898 MipiDsiPhyPllRefclkSclk::Mpll => mpll_clk_frequency(),
4899 }
4900 }
4901 pub fn configure_phy_cfg_clk(
4902 self,
4903 clocks: &mut ClockTree,
4904 new_selector: MipiDsiPhyCfgClkConfig,
4905 ) {
4906 let old_selector = clocks.mipi_dsi_phy_cfg_clk[self as usize].replace(new_selector);
4907 refresh_mipi_dsi_phy_cfg_clk_downstream(clocks, self);
4908 let active = clocks.mipi_dsi_phy_cfg_clk_refcount[self as usize] > 0;
4909 if active {
4910 match new_selector {
4911 MipiDsiPhyCfgClkConfig::PllF20m => request_pll_f20m(clocks),
4912 MipiDsiPhyCfgClkConfig::RcFast => request_rc_fast_clk(clocks),
4913 MipiDsiPhyCfgClkConfig::PllF25m => request_pll_f25m(clocks),
4914 }
4915 }
4916 self.configure_phy_cfg_clk_impl(clocks, old_selector, new_selector);
4917 if active && let Some(old_selector) = old_selector {
4918 match old_selector {
4919 MipiDsiPhyCfgClkConfig::PllF20m => release_pll_f20m(clocks),
4920 MipiDsiPhyCfgClkConfig::RcFast => release_rc_fast_clk(clocks),
4921 MipiDsiPhyCfgClkConfig::PllF25m => release_pll_f25m(clocks),
4922 }
4923 }
4924 }
4925 pub fn phy_cfg_clk_config(
4926 self,
4927 clocks: &mut ClockTree,
4928 ) -> Option<MipiDsiPhyCfgClkConfig> {
4929 clocks.mipi_dsi_phy_cfg_clk[self as usize]
4930 }
4931 pub fn request_phy_cfg_clk(self, clocks: &mut ClockTree) {
4932 trace!("Requesting {:?}::PHY_CFG_CLK", self);
4933 if increment_reference_count(
4934 &mut clocks.mipi_dsi_phy_cfg_clk_refcount[self as usize],
4935 ) {
4936 trace!("Enabling {:?}::PHY_CFG_CLK", self);
4937 match unwrap!(clocks.mipi_dsi_phy_cfg_clk[self as usize]) {
4938 MipiDsiPhyCfgClkConfig::PllF20m => request_pll_f20m(clocks),
4939 MipiDsiPhyCfgClkConfig::RcFast => request_rc_fast_clk(clocks),
4940 MipiDsiPhyCfgClkConfig::PllF25m => request_pll_f25m(clocks),
4941 }
4942 self.enable_phy_cfg_clk_impl(clocks, true);
4943 }
4944 }
4945 pub fn release_phy_cfg_clk(self, clocks: &mut ClockTree) {
4946 trace!("Releasing {:?}::PHY_CFG_CLK", self);
4947 if decrement_reference_count(
4948 &mut clocks.mipi_dsi_phy_cfg_clk_refcount[self as usize],
4949 ) {
4950 trace!("Disabling {:?}::PHY_CFG_CLK", self);
4951 self.enable_phy_cfg_clk_impl(clocks, false);
4952 match unwrap!(clocks.mipi_dsi_phy_cfg_clk[self as usize]) {
4953 MipiDsiPhyCfgClkConfig::PllF20m => release_pll_f20m(clocks),
4954 MipiDsiPhyCfgClkConfig::RcFast => release_rc_fast_clk(clocks),
4955 MipiDsiPhyCfgClkConfig::PllF25m => release_pll_f25m(clocks),
4956 }
4957 }
4958 }
4959 pub fn phy_cfg_clk_config_frequency(config: MipiDsiPhyCfgClkConfig) -> u32 {
4960 match config {
4961 MipiDsiPhyCfgClkConfig::PllF20m => pll_f20m_frequency(),
4962 MipiDsiPhyCfgClkConfig::RcFast => rc_fast_clk_frequency(),
4963 MipiDsiPhyCfgClkConfig::PllF25m => pll_f25m_frequency(),
4964 }
4965 }
4966 pub fn phy_cfg_clk_frequency(self) -> u32 {
4967 MIPI_DSI_PHY_CFG_CLK_FREQ_CACHE[self as usize]
4968 .load(::core::sync::atomic::Ordering::Acquire)
4969 }
4970 pub fn phy_cfg_clk_source_frequency(source: MipiDsiPhyCfgClkConfig) -> u32 {
4971 Self::phy_cfg_clk_config_frequency(source)
4972 }
4973 }
4974 impl RmtInstance {
4975 pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
4976 let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
4977 refresh_rmt_sclk_downstream(clocks, self);
4978 let active = clocks.rmt_sclk_refcount[self as usize] > 0;
4979 if active {
4980 match new_selector {
4981 RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
4982 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
4983 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
4984 }
4985 }
4986 self.configure_sclk_impl(clocks, old_selector, new_selector);
4987 if active && let Some(old_selector) = old_selector {
4988 match old_selector {
4989 RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
4990 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
4991 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
4992 }
4993 }
4994 }
4995 pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
4996 clocks.rmt_sclk[self as usize]
4997 }
4998 pub fn request_sclk(self, clocks: &mut ClockTree) {
4999 trace!("Requesting {:?}::SCLK", self);
5000 if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
5001 trace!("Enabling {:?}::SCLK", self);
5002 crate::rtc_cntl::WakeLock::acquire();
5003 match unwrap!(clocks.rmt_sclk[self as usize]) {
5004 RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
5005 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
5006 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
5007 }
5008 self.enable_sclk_impl(clocks, true);
5009 }
5010 }
5011 pub fn release_sclk(self, clocks: &mut ClockTree) {
5012 trace!("Releasing {:?}::SCLK", self);
5013 if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
5014 trace!("Disabling {:?}::SCLK", self);
5015 crate::rtc_cntl::WakeLock::release();
5016 self.enable_sclk_impl(clocks, false);
5017 match unwrap!(clocks.rmt_sclk[self as usize]) {
5018 RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
5019 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
5020 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
5021 }
5022 }
5023 }
5024 pub fn sclk_config_frequency(config: RmtSclkConfig) -> u32 {
5025 match config {
5026 RmtSclkConfig::PllF80m => pll_f80m_frequency(),
5027 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
5028 RmtSclkConfig::XtalClk => xtal_clk_frequency(),
5029 }
5030 }
5031 pub fn sclk_frequency(self) -> u32 {
5032 RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
5033 }
5034 pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
5035 Self::sclk_config_frequency(source)
5036 }
5037 }
5038 impl PsramInstance {
5039 pub fn configure_function_clock(
5040 self,
5041 clocks: &mut ClockTree,
5042 new_selector: PsramFunctionClockConfig,
5043 ) {
5044 let old_selector = clocks.psram_function_clock[self as usize].replace(new_selector);
5045 refresh_psram_function_clock_downstream(clocks, self);
5046 let active = clocks.psram_function_clock_refcount[self as usize] > 0;
5047 if active {
5048 match new_selector {
5049 PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
5050 PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
5051 PsramFunctionClockConfig::Spll => request_spll_clk(clocks),
5052 PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
5053 }
5054 }
5055 self.configure_function_clock_impl(clocks, old_selector, new_selector);
5056 if active && let Some(old_selector) = old_selector {
5057 match old_selector {
5058 PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
5059 PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
5060 PsramFunctionClockConfig::Spll => release_spll_clk(clocks),
5061 PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
5062 }
5063 }
5064 }
5065 pub fn function_clock_config(
5066 self,
5067 clocks: &mut ClockTree,
5068 ) -> Option<PsramFunctionClockConfig> {
5069 clocks.psram_function_clock[self as usize]
5070 }
5071 pub fn request_function_clock(self, clocks: &mut ClockTree) {
5072 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
5073 if increment_reference_count(
5074 &mut clocks.psram_function_clock_refcount[self as usize],
5075 ) {
5076 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
5077 match unwrap!(clocks.psram_function_clock[self as usize]) {
5078 PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
5079 PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
5080 PsramFunctionClockConfig::Spll => request_spll_clk(clocks),
5081 PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
5082 }
5083 self.enable_function_clock_impl(clocks, true);
5084 }
5085 }
5086 pub fn release_function_clock(self, clocks: &mut ClockTree) {
5087 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
5088 if decrement_reference_count(
5089 &mut clocks.psram_function_clock_refcount[self as usize],
5090 ) {
5091 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
5092 self.enable_function_clock_impl(clocks, false);
5093 match unwrap!(clocks.psram_function_clock[self as usize]) {
5094 PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
5095 PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
5096 PsramFunctionClockConfig::Spll => release_spll_clk(clocks),
5097 PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
5098 }
5099 }
5100 }
5101 pub fn function_clock_config_frequency(config: PsramFunctionClockConfig) -> u32 {
5102 match config {
5103 PsramFunctionClockConfig::Xtal => xtal_clk_frequency(),
5104 PsramFunctionClockConfig::Mpll => mpll_clk_frequency(),
5105 PsramFunctionClockConfig::Spll => spll_clk_frequency(),
5106 PsramFunctionClockConfig::Cpll => cpll_clk_frequency(),
5107 }
5108 }
5109 pub fn function_clock_frequency(self) -> u32 {
5110 PSRAM_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
5111 .load(::core::sync::atomic::Ordering::Acquire)
5112 }
5113 pub fn function_clock_source_frequency(source: PsramFunctionClockConfig) -> u32 {
5114 Self::function_clock_config_frequency(source)
5115 }
5116 }
5117 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
5125 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
5126 #[instability::unstable]
5127 pub struct ClockConfig {
5128 pub cpll_clk: Option<CpllClkConfig>,
5130 pub mpll_clk: Option<MpllClkConfig>,
5132 pub iomux_function_clock: Option<IomuxFunctionClockConfig>,
5134 pub cpu_root_clk: Option<CpuRootClkConfig>,
5136 pub cpu_clk: Option<CpuClkConfig>,
5138 pub mem_clk: Option<MemClkConfig>,
5140 pub sys_clk: Option<SysClkConfig>,
5142 pub apb_clk: Option<ApbClkConfig>,
5144 pub lp_fast_clk: Option<LpFastClkConfig>,
5146 pub lp_slow_clk: Option<LpSlowClkConfig>,
5148 pub crypto_clk: Option<CryptoClkConfig>,
5150 pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
5152 }
5153 impl ClockConfig {
5154 fn apply(&self, clocks: &mut ClockTree) {
5155 if let Some(config) = self.cpll_clk {
5156 configure_cpll_clk(clocks, config);
5157 }
5158 if let Some(config) = self.mpll_clk {
5159 configure_mpll_clk(clocks, config);
5160 }
5161 if let Some(config) = self.iomux_function_clock {
5162 configure_iomux_function_clock(clocks, config);
5163 }
5164 if let Some(config) = self.cpu_root_clk {
5165 configure_cpu_root_clk(clocks, config);
5166 }
5167 if let Some(config) = self.cpu_clk {
5168 configure_cpu_clk(clocks, config);
5169 }
5170 if let Some(config) = self.mem_clk {
5171 configure_mem_clk(clocks, config);
5172 }
5173 if let Some(config) = self.sys_clk {
5174 configure_sys_clk(clocks, config);
5175 }
5176 if let Some(config) = self.apb_clk {
5177 configure_apb_clk(clocks, config);
5178 }
5179 if let Some(config) = self.lp_fast_clk {
5180 configure_lp_fast_clk(clocks, config);
5181 }
5182 if let Some(config) = self.lp_slow_clk {
5183 configure_lp_slow_clk(clocks, config);
5184 }
5185 if let Some(config) = self.crypto_clk {
5186 configure_crypto_clk(clocks, config);
5187 }
5188 if let Some(config) = self.timg_calibration_clock {
5189 configure_timg_calibration_clock(clocks, config);
5190 }
5191 }
5192 }
5193 fn increment_reference_count(refcount: &mut u32) -> bool {
5194 let first = *refcount == 0;
5195 *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
5196 first
5197 }
5198 fn decrement_reference_count(refcount: &mut u32) -> bool {
5199 *refcount = refcount.saturating_sub(1);
5200 let last = *refcount == 0;
5201 last
5202 }
5203 fn refresh_cpll_clk_downstream(clocks: &mut ClockTree) {
5204 if let Some(config) = clocks.cpll_clk {
5205 CPLL_CLK_FREQ_CACHE.store(
5206 cpll_clk_config_frequency(config),
5207 ::core::sync::atomic::Ordering::Release,
5208 );
5209 }
5210 refresh_cpu_root_clk_downstream(clocks);
5211 refresh_timg_calibration_clock_downstream(clocks);
5212 for child_instance in [MipiDsiInstance::MipiDsi] {
5213 refresh_mipi_dsi_phy_pll_refclk_downstream(clocks, child_instance);
5214 }
5215 for child_instance in [PsramInstance::Psram] {
5216 refresh_psram_function_clock_downstream(clocks, child_instance);
5217 }
5218 }
5219 fn refresh_mpll_clk_downstream(clocks: &mut ClockTree) {
5220 if let Some(config) = clocks.mpll_clk {
5221 MPLL_CLK_FREQ_CACHE.store(
5222 mpll_clk_config_frequency(config),
5223 ::core::sync::atomic::Ordering::Release,
5224 );
5225 }
5226 refresh_timg_calibration_clock_downstream(clocks);
5227 for child_instance in [MipiDsiInstance::MipiDsi] {
5228 refresh_mipi_dsi_phy_pll_refclk_downstream(clocks, child_instance);
5229 refresh_mipi_dsi_phy_cfg_clk_downstream(clocks, child_instance);
5230 }
5231 for child_instance in [PsramInstance::Psram] {
5232 refresh_psram_function_clock_downstream(clocks, child_instance);
5233 }
5234 }
5235 fn refresh_rc_fast_clk_downstream(clocks: &mut ClockTree) {
5236 refresh_cpu_root_clk_downstream(clocks);
5237 refresh_lp_fast_clk_downstream(clocks);
5238 refresh_crypto_clk_downstream(clocks);
5239 refresh_timg_calibration_clock_downstream(clocks);
5240 for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
5241 refresh_timg_function_clock_downstream(clocks, child_instance);
5242 refresh_timg_wdt_clock_downstream(clocks, child_instance);
5243 }
5244 for child_instance in [
5245 UartInstance::Uart0,
5246 UartInstance::Uart1,
5247 UartInstance::Uart2,
5248 UartInstance::Uart3,
5249 UartInstance::Uart4,
5250 ] {
5251 refresh_uart_function_clock_downstream(clocks, child_instance);
5252 }
5253 for child_instance in [SpiInstance::Spi2, SpiInstance::Spi3] {
5254 refresh_spi_function_clock_downstream(clocks, child_instance);
5255 }
5256 for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
5257 refresh_i2c_function_clock_downstream(clocks, child_instance);
5258 }
5259 for child_instance in [MipiDsiInstance::MipiDsi] {
5260 refresh_mipi_dsi_phy_cfg_clk_downstream(clocks, child_instance);
5261 }
5262 for child_instance in [RmtInstance::Rmt] {
5263 refresh_rmt_sclk_downstream(clocks, child_instance);
5264 }
5265 }
5266 fn refresh_rc_slow_clk_downstream(clocks: &mut ClockTree) {
5267 refresh_lp_slow_clk_downstream(clocks);
5268 }
5269 fn refresh_iomux_function_clock_downstream(clocks: &mut ClockTree) {
5270 if let Some(config) = clocks.iomux_function_clock {
5271 IOMUX_FUNCTION_CLOCK_FREQ_CACHE.store(
5272 iomux_function_clock_config_frequency(config),
5273 ::core::sync::atomic::Ordering::Release,
5274 );
5275 }
5276 }
5277 fn refresh_cpu_root_clk_downstream(clocks: &mut ClockTree) {
5278 if let Some(config) = clocks.cpu_root_clk {
5279 CPU_ROOT_CLK_FREQ_CACHE.store(
5280 cpu_root_clk_config_frequency(config),
5281 ::core::sync::atomic::Ordering::Release,
5282 );
5283 }
5284 refresh_cpu_clk_downstream(clocks);
5285 }
5286 fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
5287 if let Some(config) = clocks.cpu_clk {
5288 CPU_CLK_FREQ_CACHE.store(
5289 cpu_clk_config_frequency(config),
5290 ::core::sync::atomic::Ordering::Release,
5291 );
5292 }
5293 refresh_mem_clk_downstream(clocks);
5294 }
5295 fn refresh_mem_clk_downstream(clocks: &mut ClockTree) {
5296 if let Some(config) = clocks.mem_clk {
5297 MEM_CLK_FREQ_CACHE.store(
5298 mem_clk_config_frequency(config),
5299 ::core::sync::atomic::Ordering::Release,
5300 );
5301 }
5302 refresh_sys_clk_downstream(clocks);
5303 }
5304 fn refresh_sys_clk_downstream(clocks: &mut ClockTree) {
5305 if let Some(config) = clocks.sys_clk {
5306 SYS_CLK_FREQ_CACHE.store(
5307 sys_clk_config_frequency(config),
5308 ::core::sync::atomic::Ordering::Release,
5309 );
5310 }
5311 refresh_apb_clk_downstream(clocks);
5312 }
5313 fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
5314 if let Some(config) = clocks.apb_clk {
5315 APB_CLK_FREQ_CACHE.store(
5316 apb_clk_config_frequency(config),
5317 ::core::sync::atomic::Ordering::Release,
5318 );
5319 }
5320 }
5321 fn refresh_lp_fast_clk_downstream(clocks: &mut ClockTree) {
5322 if let Some(config) = clocks.lp_fast_clk {
5323 LP_FAST_CLK_FREQ_CACHE.store(
5324 lp_fast_clk_config_frequency(config),
5325 ::core::sync::atomic::Ordering::Release,
5326 );
5327 }
5328 }
5329 fn refresh_lp_slow_clk_downstream(clocks: &mut ClockTree) {
5330 if let Some(config) = clocks.lp_slow_clk {
5331 LP_SLOW_CLK_FREQ_CACHE.store(
5332 lp_slow_clk_config_frequency(config),
5333 ::core::sync::atomic::Ordering::Release,
5334 );
5335 }
5336 refresh_timg_calibration_clock_downstream(clocks);
5337 }
5338 fn refresh_crypto_clk_downstream(clocks: &mut ClockTree) {
5339 if let Some(config) = clocks.crypto_clk {
5340 CRYPTO_CLK_FREQ_CACHE.store(
5341 crypto_clk_config_frequency(config),
5342 ::core::sync::atomic::Ordering::Release,
5343 );
5344 }
5345 }
5346 fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
5347 if let Some(config) = clocks.timg_calibration_clock {
5348 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
5349 timg_calibration_clock_config_frequency(config),
5350 ::core::sync::atomic::Ordering::Release,
5351 );
5352 }
5353 }
5354 fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
5355 if let Some(config) = clocks.timg_function_clock[instance as usize] {
5356 TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5357 TimgInstance::function_clock_config_frequency(config),
5358 ::core::sync::atomic::Ordering::Release,
5359 );
5360 }
5361 }
5362 fn refresh_timg_wdt_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
5363 if let Some(config) = clocks.timg_wdt_clock[instance as usize] {
5364 TIMG_WDT_CLOCK_FREQ_CACHE[instance as usize].store(
5365 TimgInstance::wdt_clock_config_frequency(config),
5366 ::core::sync::atomic::Ordering::Release,
5367 );
5368 }
5369 }
5370 fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
5371 if let Some(config) = clocks.uart_function_clock[instance as usize] {
5372 UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5373 UartInstance::function_clock_config_frequency(config),
5374 ::core::sync::atomic::Ordering::Release,
5375 );
5376 }
5377 refresh_uart_baud_rate_generator_downstream(clocks, instance);
5378 }
5379 fn refresh_uart_baud_rate_generator_downstream(
5380 clocks: &mut ClockTree,
5381 instance: UartInstance,
5382 ) {
5383 if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
5384 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
5385 instance.baud_rate_generator_config_frequency(config),
5386 ::core::sync::atomic::Ordering::Release,
5387 );
5388 }
5389 }
5390 fn refresh_spi_function_clock_downstream(clocks: &mut ClockTree, instance: SpiInstance) {
5391 if let Some(config) = clocks.spi_function_clock[instance as usize] {
5392 SPI_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5393 SpiInstance::function_clock_config_frequency(config),
5394 ::core::sync::atomic::Ordering::Release,
5395 );
5396 }
5397 }
5398 fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
5399 if let Some(config) = clocks.i2c_function_clock[instance as usize] {
5400 I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5401 I2cInstance::function_clock_config_frequency(config),
5402 ::core::sync::atomic::Ordering::Release,
5403 );
5404 }
5405 }
5406 fn refresh_i2s_tx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
5407 if let Some(config) = clocks.i2s_tx_clk[instance as usize] {
5408 I2S_TX_CLK_FREQ_CACHE[instance as usize].store(
5409 I2sInstance::tx_clk_config_frequency(config),
5410 ::core::sync::atomic::Ordering::Release,
5411 );
5412 }
5413 refresh_i2s_mclk_out_downstream(clocks, instance);
5414 }
5415 fn refresh_i2s_rx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
5416 if let Some(config) = clocks.i2s_rx_clk[instance as usize] {
5417 I2S_RX_CLK_FREQ_CACHE[instance as usize].store(
5418 I2sInstance::rx_clk_config_frequency(config),
5419 ::core::sync::atomic::Ordering::Release,
5420 );
5421 }
5422 refresh_i2s_mclk_out_downstream(clocks, instance);
5423 }
5424 fn refresh_i2s_mclk_out_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
5425 if let Some(config) = clocks.i2s_mclk_out[instance as usize] {
5426 I2S_MCLK_OUT_FREQ_CACHE[instance as usize].store(
5427 instance.mclk_out_config_frequency(config),
5428 ::core::sync::atomic::Ordering::Release,
5429 );
5430 }
5431 }
5432 fn refresh_mipi_dsi_dpi_clk_downstream(clocks: &mut ClockTree, instance: MipiDsiInstance) {
5433 if let Some(config) = clocks.mipi_dsi_dpi_clk[instance as usize] {
5434 MIPI_DSI_DPI_CLK_FREQ_CACHE[instance as usize].store(
5435 MipiDsiInstance::dpi_clk_config_frequency(config),
5436 ::core::sync::atomic::Ordering::Release,
5437 );
5438 }
5439 }
5440 fn refresh_mipi_dsi_phy_pll_refclk_downstream(
5441 clocks: &mut ClockTree,
5442 instance: MipiDsiInstance,
5443 ) {
5444 if let Some(config) = clocks.mipi_dsi_phy_pll_refclk[instance as usize] {
5445 MIPI_DSI_PHY_PLL_REFCLK_FREQ_CACHE[instance as usize].store(
5446 MipiDsiInstance::phy_pll_refclk_config_frequency(config),
5447 ::core::sync::atomic::Ordering::Release,
5448 );
5449 }
5450 }
5451 fn refresh_mipi_dsi_phy_cfg_clk_downstream(
5452 clocks: &mut ClockTree,
5453 instance: MipiDsiInstance,
5454 ) {
5455 if let Some(config) = clocks.mipi_dsi_phy_cfg_clk[instance as usize] {
5456 MIPI_DSI_PHY_CFG_CLK_FREQ_CACHE[instance as usize].store(
5457 MipiDsiInstance::phy_cfg_clk_config_frequency(config),
5458 ::core::sync::atomic::Ordering::Release,
5459 );
5460 }
5461 }
5462 fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
5463 if let Some(config) = clocks.rmt_sclk[instance as usize] {
5464 RMT_SCLK_FREQ_CACHE[instance as usize].store(
5465 RmtInstance::sclk_config_frequency(config),
5466 ::core::sync::atomic::Ordering::Release,
5467 );
5468 }
5469 }
5470 fn refresh_psram_function_clock_downstream(
5471 clocks: &mut ClockTree,
5472 instance: PsramInstance,
5473 ) {
5474 if let Some(config) = clocks.psram_function_clock[instance as usize] {
5475 PSRAM_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
5476 PsramInstance::function_clock_config_frequency(config),
5477 ::core::sync::atomic::Ordering::Release,
5478 );
5479 }
5480 }
5481 };
5482}
5483#[macro_export]
5487#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5488macro_rules! implement_peripheral_clocks {
5489 () => {
5490 #[doc(hidden)]
5491 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
5492 #[repr(u8)]
5493 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
5494 pub enum Peripheral {
5495 Aes,
5497 AhbGdma,
5499 ApbSarAdc,
5501 AxiGdma,
5503 Ds,
5505 Ecc,
5507 Ecdsa,
5509 Emac,
5511 GpioSd,
5513 Hmac,
5515 I2c0,
5517 I2c1,
5519 I2s0,
5521 I2s1,
5523 I2s2,
5525 Iomux,
5527 LcdCam,
5529 Ledc,
5531 Mcpwm0,
5533 Mcpwm1,
5535 MipiDsi,
5537 ParlIo,
5539 Pcnt,
5541 Rmt,
5543 Rsa,
5545 SdioHost,
5547 Sha,
5549 Spi2,
5551 Spi3,
5553 Systimer,
5555 Timg0,
5557 Timg1,
5559 Twai0,
5561 Twai1,
5563 Twai2,
5565 Uart0,
5567 Uart1,
5569 Uart2,
5571 Uart3,
5573 Uart4,
5575 Uhci0,
5577 UsbDevice,
5579 UsbFs,
5581 UsbHs,
5583 Vdma,
5585 }
5586 impl Peripheral {
5587 const KEEP_ENABLED: &[Peripheral] = &[
5588 Self::Iomux,
5589 Self::Systimer,
5590 Self::Timg0,
5591 Self::Uart0,
5592 Self::UsbDevice,
5593 ];
5594 const COUNT: usize = Self::ALL.len();
5595 const ALL: &[Self] = &[
5596 Self::Aes,
5597 Self::AhbGdma,
5598 Self::ApbSarAdc,
5599 Self::AxiGdma,
5600 Self::Ds,
5601 Self::Ecc,
5602 Self::Ecdsa,
5603 Self::Emac,
5604 Self::GpioSd,
5605 Self::Hmac,
5606 Self::I2c0,
5607 Self::I2c1,
5608 Self::I2s0,
5609 Self::I2s1,
5610 Self::I2s2,
5611 Self::Iomux,
5612 Self::LcdCam,
5613 Self::Ledc,
5614 Self::Mcpwm0,
5615 Self::Mcpwm1,
5616 Self::MipiDsi,
5617 Self::ParlIo,
5618 Self::Pcnt,
5619 Self::Rmt,
5620 Self::Rsa,
5621 Self::SdioHost,
5622 Self::Sha,
5623 Self::Spi2,
5624 Self::Spi3,
5625 Self::Systimer,
5626 Self::Timg0,
5627 Self::Timg1,
5628 Self::Twai0,
5629 Self::Twai1,
5630 Self::Twai2,
5631 Self::Uart0,
5632 Self::Uart1,
5633 Self::Uart2,
5634 Self::Uart3,
5635 Self::Uart4,
5636 Self::Uhci0,
5637 Self::UsbDevice,
5638 Self::UsbFs,
5639 Self::UsbHs,
5640 Self::Vdma,
5641 ];
5642 }
5643 unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
5644 match peripheral {
5645 Peripheral::Aes => {
5646 crate::peripherals::HP_SYS_CLKRST::regs()
5647 .soc_clk_ctrl1()
5648 .modify(|_, w| w.crypto_sys_clk_en().bit(enable));
5649 }
5650 Peripheral::AhbGdma => {
5651 crate::peripherals::HP_SYS_CLKRST::regs()
5652 .soc_clk_ctrl1()
5653 .modify(|_, w| w.ahb_pdma_sys_clk_en().bit(enable));
5654 }
5655 Peripheral::ApbSarAdc => {
5656 crate::peripherals::HP_SYS_CLKRST::regs()
5657 .soc_clk_ctrl2()
5658 .modify(|_, w| w.adc_apb_clk_en().bit(enable));
5659 crate::peripherals::HP_SYS_CLKRST::regs()
5660 .peri_clk_ctrl23()
5661 .modify(|_, w| w.adc_clk_en().bit(enable));
5662 }
5663 Peripheral::AxiGdma => {
5664 crate::peripherals::HP_SYS_CLKRST::regs()
5665 .soc_clk_ctrl1()
5666 .modify(|_, w| w.axi_pdma_sys_clk_en().bit(enable));
5667 }
5668 Peripheral::Ds => {
5669 crate::peripherals::HP_SYS_CLKRST::regs()
5670 .soc_clk_ctrl1()
5671 .modify(|_, w| w.crypto_sys_clk_en().bit(enable));
5672 }
5673 Peripheral::Ecc => {
5674 crate::peripherals::HP_SYS_CLKRST::regs()
5675 .soc_clk_ctrl1()
5676 .modify(|_, w| w.crypto_sys_clk_en().bit(enable));
5677 }
5678 Peripheral::Ecdsa => {
5679 crate::peripherals::HP_SYS_CLKRST::regs()
5680 .soc_clk_ctrl1()
5681 .modify(|_, w| w.crypto_sys_clk_en().bit(enable));
5682 }
5683 Peripheral::Emac => {
5684 crate::peripherals::HP_SYS_CLKRST::regs()
5685 .soc_clk_ctrl1()
5686 .modify(|_, w| w.emac_sys_clk_en().bit(enable));
5687 }
5688 Peripheral::GpioSd => {
5689 crate::peripherals::GPIO_SD::regs()
5690 .clock_gate()
5691 .modify(|_, w| w.clk_en().bit(enable));
5692 }
5693 Peripheral::Hmac => {
5694 crate::peripherals::HP_SYS_CLKRST::regs()
5695 .soc_clk_ctrl1()
5696 .modify(|_, w| w.crypto_sys_clk_en().bit(enable));
5697 }
5698 Peripheral::I2c0 => {
5699 crate::peripherals::HP_SYS_CLKRST::regs()
5700 .soc_clk_ctrl2()
5701 .modify(|_, w| w.i2c0_apb_clk_en().bit(enable));
5702 }
5703 Peripheral::I2c1 => {
5704 crate::peripherals::HP_SYS_CLKRST::regs()
5705 .soc_clk_ctrl2()
5706 .modify(|_, w| w.i2c1_apb_clk_en().bit(enable));
5707 }
5708 Peripheral::I2s0 => {
5709 crate::peripherals::HP_SYS_CLKRST::regs()
5710 .soc_clk_ctrl2()
5711 .modify(|_, w| w.i2s0_apb_clk_en().bit(enable));
5712 }
5713 Peripheral::I2s1 => {
5714 crate::peripherals::HP_SYS_CLKRST::regs()
5715 .soc_clk_ctrl2()
5716 .modify(|_, w| w.i2s1_apb_clk_en().bit(enable));
5717 }
5718 Peripheral::I2s2 => {
5719 crate::peripherals::HP_SYS_CLKRST::regs()
5720 .soc_clk_ctrl2()
5721 .modify(|_, w| w.i2s2_apb_clk_en().bit(enable));
5722 }
5723 Peripheral::Iomux => {
5724 crate::peripherals::HP_SYS_CLKRST::regs()
5725 .peri_clk_ctrl26()
5726 .modify(|_, w| w.iomux_clk_en().bit(enable));
5727 }
5728 Peripheral::LcdCam => {
5729 let _ = enable;
5730 }
5731 Peripheral::Ledc => {
5732 let _ = enable;
5733 }
5734 Peripheral::Mcpwm0 => {
5735 crate::peripherals::HP_SYS_CLKRST::regs()
5736 .soc_clk_ctrl2()
5737 .modify(|_, w| w.mcpwm0_apb_clk_en().bit(enable));
5738 }
5739 Peripheral::Mcpwm1 => {
5740 crate::peripherals::HP_SYS_CLKRST::regs()
5741 .soc_clk_ctrl2()
5742 .modify(|_, w| w.mcpwm1_apb_clk_en().bit(enable));
5743 }
5744 Peripheral::MipiDsi => {
5745 crate::peripherals::HP_SYS_CLKRST::regs()
5746 .soc_clk_ctrl1()
5747 .modify(|_, w| w.dsi_sys_clk_en().bit(enable));
5748 }
5749 Peripheral::ParlIo => {
5750 crate::peripherals::HP_SYS_CLKRST::regs()
5751 .soc_clk_ctrl1()
5752 .modify(|_, w| w.parlio_sys_clk_en().bit(enable));
5753 crate::peripherals::HP_SYS_CLKRST::regs()
5754 .soc_clk_ctrl2()
5755 .modify(|_, w| w.parlio_apb_clk_en().bit(enable));
5756 }
5757 Peripheral::Pcnt => {
5758 crate::peripherals::HP_SYS_CLKRST::regs()
5759 .soc_clk_ctrl2()
5760 .modify(|_, w| w.pcnt_apb_clk_en().bit(enable));
5761 }
5762 Peripheral::Rmt => {
5763 crate::peripherals::HP_SYS_CLKRST::regs()
5764 .soc_clk_ctrl2()
5765 .modify(|_, w| w.rmt_sys_clk_en().bit(enable));
5766 }
5767 Peripheral::Rsa => {
5768 crate::peripherals::HP_SYS_CLKRST::regs()
5769 .soc_clk_ctrl1()
5770 .modify(|_, w| w.crypto_sys_clk_en().bit(enable));
5771 }
5772 Peripheral::SdioHost => {
5773 crate::peripherals::HP_SYS_CLKRST::regs()
5774 .soc_clk_ctrl1()
5775 .modify(|_, w| w.sdmmc_sys_clk_en().bit(enable));
5776 }
5777 Peripheral::Sha => {
5778 crate::peripherals::HP_SYS_CLKRST::regs()
5779 .soc_clk_ctrl1()
5780 .modify(|_, w| w.crypto_sys_clk_en().bit(enable));
5781 }
5782 Peripheral::Spi2 => {
5783 crate::peripherals::HP_SYS_CLKRST::regs()
5784 .soc_clk_ctrl1()
5785 .modify(|_, w| w.gpspi2_sys_clk_en().bit(enable));
5786 crate::peripherals::HP_SYS_CLKRST::regs()
5787 .soc_clk_ctrl2()
5788 .modify(|_, w| w.gpspi2_apb_clk_en().bit(enable));
5789 }
5790 Peripheral::Spi3 => {
5791 crate::peripherals::HP_SYS_CLKRST::regs()
5792 .soc_clk_ctrl1()
5793 .modify(|_, w| w.gpspi3_sys_clk_en().bit(enable));
5794 crate::peripherals::HP_SYS_CLKRST::regs()
5795 .soc_clk_ctrl2()
5796 .modify(|_, w| w.gpspi3_apb_clk_en().bit(enable));
5797 }
5798 Peripheral::Systimer => {
5799 crate::peripherals::HP_SYS_CLKRST::regs()
5800 .soc_clk_ctrl2()
5801 .modify(|_, w| w.systimer_apb_clk_en().bit(enable));
5802 crate::peripherals::HP_SYS_CLKRST::regs()
5803 .peri_clk_ctrl21()
5804 .modify(|_, w| w.systimer_clk_en().bit(enable));
5805 }
5806 Peripheral::Timg0 => {
5807 crate::peripherals::HP_SYS_CLKRST::regs()
5808 .soc_clk_ctrl2()
5809 .modify(|_, w| w.timergrp0_apb_clk_en().bit(enable));
5810 }
5811 Peripheral::Timg1 => {
5812 crate::peripherals::HP_SYS_CLKRST::regs()
5813 .soc_clk_ctrl2()
5814 .modify(|_, w| w.timergrp1_apb_clk_en().bit(enable));
5815 }
5816 Peripheral::Twai0 => {
5817 crate::peripherals::HP_SYS_CLKRST::regs()
5818 .soc_clk_ctrl2()
5819 .modify(|_, w| w.twai0_apb_clk_en().bit(enable));
5820 }
5821 Peripheral::Twai1 => {
5822 crate::peripherals::HP_SYS_CLKRST::regs()
5823 .soc_clk_ctrl2()
5824 .modify(|_, w| w.twai1_apb_clk_en().bit(enable));
5825 }
5826 Peripheral::Twai2 => {
5827 crate::peripherals::HP_SYS_CLKRST::regs()
5828 .soc_clk_ctrl2()
5829 .modify(|_, w| w.twai2_apb_clk_en().bit(enable));
5830 }
5831 Peripheral::Uart0 => {
5832 crate::peripherals::HP_SYS_CLKRST::regs()
5833 .soc_clk_ctrl1()
5834 .modify(|_, w| w.uart0_sys_clk_en().bit(enable));
5835 crate::peripherals::HP_SYS_CLKRST::regs()
5836 .soc_clk_ctrl2()
5837 .modify(|_, w| w.uart0_apb_clk_en().bit(enable));
5838 }
5839 Peripheral::Uart1 => {
5840 crate::peripherals::HP_SYS_CLKRST::regs()
5841 .soc_clk_ctrl1()
5842 .modify(|_, w| w.uart1_sys_clk_en().bit(enable));
5843 crate::peripherals::HP_SYS_CLKRST::regs()
5844 .soc_clk_ctrl2()
5845 .modify(|_, w| w.uart1_apb_clk_en().bit(enable));
5846 }
5847 Peripheral::Uart2 => {
5848 crate::peripherals::HP_SYS_CLKRST::regs()
5849 .soc_clk_ctrl1()
5850 .modify(|_, w| w.uart2_sys_clk_en().bit(enable));
5851 crate::peripherals::HP_SYS_CLKRST::regs()
5852 .soc_clk_ctrl2()
5853 .modify(|_, w| w.uart2_apb_clk_en().bit(enable));
5854 }
5855 Peripheral::Uart3 => {
5856 crate::peripherals::HP_SYS_CLKRST::regs()
5857 .soc_clk_ctrl1()
5858 .modify(|_, w| w.uart3_sys_clk_en().bit(enable));
5859 crate::peripherals::HP_SYS_CLKRST::regs()
5860 .soc_clk_ctrl2()
5861 .modify(|_, w| w.uart3_apb_clk_en().bit(enable));
5862 }
5863 Peripheral::Uart4 => {
5864 crate::peripherals::HP_SYS_CLKRST::regs()
5865 .soc_clk_ctrl1()
5866 .modify(|_, w| w.uart4_sys_clk_en().bit(enable));
5867 crate::peripherals::HP_SYS_CLKRST::regs()
5868 .soc_clk_ctrl2()
5869 .modify(|_, w| w.uart4_apb_clk_en().bit(enable));
5870 }
5871 Peripheral::Uhci0 => {
5872 crate::peripherals::HP_SYS_CLKRST::regs()
5873 .soc_clk_ctrl1()
5874 .modify(|_, w| w.uhci_sys_clk_en().bit(enable));
5875 crate::peripherals::HP_SYS_CLKRST::regs()
5876 .soc_clk_ctrl2()
5877 .modify(|_, w| w.uhci_apb_clk_en().bit(enable));
5878 }
5879 Peripheral::UsbDevice => {
5880 crate::peripherals::HP_SYS_CLKRST::regs()
5881 .soc_clk_ctrl2()
5882 .modify(|_, w| w.usb_device_apb_clk_en().bit(enable));
5883 }
5884 Peripheral::UsbFs => {
5885 crate::peripherals::HP_SYS_CLKRST::regs()
5886 .soc_clk_ctrl1()
5887 .modify(|_, w| w.usb_otg11_sys_clk_en().bit(enable));
5888 }
5889 Peripheral::UsbHs => {
5890 crate::peripherals::HP_SYS_CLKRST::regs()
5891 .soc_clk_ctrl1()
5892 .modify(|_, w| w.usb_otg20_sys_clk_en().bit(enable));
5893 }
5894 Peripheral::Vdma => {
5895 crate::peripherals::HP_SYS_CLKRST::regs()
5896 .soc_clk_ctrl1()
5897 .modify(|_, w| w.gdma_sys_clk_en().bit(enable));
5898 }
5899 }
5900 }
5901 unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
5902 match peripheral {
5903 Peripheral::Aes => {
5904 crate::peripherals::HP_SYS_CLKRST::regs()
5905 .hp_rst_en2()
5906 .modify(|_, w| w.rst_en_aes().bit(reset));
5907 }
5908 Peripheral::AhbGdma => {
5909 crate::peripherals::HP_SYS_CLKRST::regs()
5910 .hp_rst_en1()
5911 .modify(|_, w| w.rst_en_ahb_pdma().bit(reset));
5912 }
5913 Peripheral::ApbSarAdc => {
5914 crate::peripherals::HP_SYS_CLKRST::regs()
5915 .hp_rst_en2()
5916 .modify(|_, w| w.rst_en_adc().bit(reset));
5917 }
5918 Peripheral::AxiGdma => {
5919 crate::peripherals::HP_SYS_CLKRST::regs()
5920 .hp_rst_en1()
5921 .modify(|_, w| w.rst_en_axi_pdma().bit(reset));
5922 }
5923 Peripheral::Ds => {
5924 crate::peripherals::HP_SYS_CLKRST::regs()
5925 .hp_rst_en2()
5926 .modify(|_, w| w.rst_en_ds().bit(reset));
5927 }
5928 Peripheral::Ecc => {
5929 crate::peripherals::HP_SYS_CLKRST::regs()
5930 .hp_rst_en2()
5931 .modify(|_, w| w.rst_en_ecc().bit(reset));
5932 }
5933 Peripheral::Ecdsa => {
5934 crate::peripherals::HP_SYS_CLKRST::regs()
5935 .hp_rst_en2()
5936 .modify(|_, w| w.rst_en_ecdsa().bit(reset));
5937 }
5938 Peripheral::Emac => {
5939 let _ = reset;
5940 }
5941 Peripheral::GpioSd => {
5942 let _ = reset;
5943 }
5944 Peripheral::Hmac => {
5945 crate::peripherals::HP_SYS_CLKRST::regs()
5946 .hp_rst_en2()
5947 .modify(|_, w| w.rst_en_hmac().bit(reset));
5948 }
5949 Peripheral::I2c0 => {
5950 crate::peripherals::HP_SYS_CLKRST::regs()
5951 .hp_rst_en1()
5952 .modify(|_, w| w.rst_en_i2c0().bit(reset));
5953 }
5954 Peripheral::I2c1 => {
5955 crate::peripherals::HP_SYS_CLKRST::regs()
5956 .hp_rst_en1()
5957 .modify(|_, w| w.rst_en_i2c1().bit(reset));
5958 }
5959 Peripheral::I2s0 => {
5960 crate::peripherals::HP_SYS_CLKRST::regs()
5961 .hp_rst_en2()
5962 .modify(|_, w| w.rst_en_i2s0_apb().bit(reset));
5963 }
5964 Peripheral::I2s1 => {
5965 crate::peripherals::HP_SYS_CLKRST::regs()
5966 .hp_rst_en2()
5967 .modify(|_, w| w.rst_en_i2s1_apb().bit(reset));
5968 }
5969 Peripheral::I2s2 => {
5970 crate::peripherals::HP_SYS_CLKRST::regs()
5971 .hp_rst_en2()
5972 .modify(|_, w| w.rst_en_i2s2_apb().bit(reset));
5973 }
5974 Peripheral::Iomux => {
5975 crate::peripherals::HP_SYS_CLKRST::regs()
5976 .hp_rst_en1()
5977 .modify(|_, w| w.rst_en_iomux().bit(reset));
5978 }
5979 Peripheral::LcdCam => {
5980 crate::peripherals::HP_SYS_CLKRST::regs()
5981 .hp_rst_en2()
5982 .modify(|_, w| w.rst_en_lcdcam().bit(reset));
5983 }
5984 Peripheral::Ledc => {
5985 crate::peripherals::HP_SYS_CLKRST::regs()
5986 .hp_rst_en1()
5987 .modify(|_, w| w.rst_en_ledc().bit(reset));
5988 }
5989 Peripheral::Mcpwm0 => {
5990 crate::peripherals::HP_SYS_CLKRST::regs()
5991 .hp_rst_en1()
5992 .modify(|_, w| w.rst_en_pwm0().bit(reset));
5993 }
5994 Peripheral::Mcpwm1 => {
5995 crate::peripherals::HP_SYS_CLKRST::regs()
5996 .hp_rst_en1()
5997 .modify(|_, w| w.rst_en_pwm1().bit(reset));
5998 }
5999 Peripheral::MipiDsi => {
6000 crate::peripherals::HP_SYS_CLKRST::regs()
6001 .hp_rst_en0()
6002 .modify(|_, w| w.rst_en_dsi_brg().bit(reset));
6003 }
6004 Peripheral::ParlIo => {
6005 crate::peripherals::HP_SYS_CLKRST::regs()
6006 .hp_rst_en2()
6007 .modify(|_, w| {
6008 w.rst_en_parlio()
6009 .bit(reset)
6010 .rst_en_parlio_rx()
6011 .bit(reset)
6012 .rst_en_parlio_tx()
6013 .bit(reset)
6014 });
6015 }
6016 Peripheral::Pcnt => {
6017 crate::peripherals::HP_SYS_CLKRST::regs()
6018 .hp_rst_en1()
6019 .modify(|_, w| w.rst_en_pcnt().bit(reset));
6020 }
6021 Peripheral::Rmt => {
6022 crate::peripherals::HP_SYS_CLKRST::regs()
6023 .hp_rst_en1()
6024 .modify(|_, w| w.rst_en_rmt().bit(reset));
6025 }
6026 Peripheral::Rsa => {
6027 crate::peripherals::HP_SYS_CLKRST::regs()
6028 .hp_rst_en2()
6029 .modify(|_, w| w.rst_en_rsa().bit(reset));
6030 }
6031 Peripheral::SdioHost => {
6032 crate::peripherals::LP_AON_CLKRST::regs()
6033 .lp_aonclkrst_hp_sdmmc_emac_rst_ctrl()
6034 .modify(|_, w| w.lp_aonclkrst_rst_en_sdmmc().bit(reset));
6035 }
6036 Peripheral::Sha => {
6037 crate::peripherals::HP_SYS_CLKRST::regs()
6038 .hp_rst_en2()
6039 .modify(|_, w| w.rst_en_sha().bit(reset));
6040 }
6041 Peripheral::Spi2 => {
6042 crate::peripherals::HP_SYS_CLKRST::regs()
6043 .hp_rst_en2()
6044 .modify(|_, w| w.rst_en_spi2().bit(reset));
6045 }
6046 Peripheral::Spi3 => {
6047 crate::peripherals::HP_SYS_CLKRST::regs()
6048 .hp_rst_en2()
6049 .modify(|_, w| w.rst_en_spi3().bit(reset));
6050 }
6051 Peripheral::Systimer => {
6052 crate::peripherals::HP_SYS_CLKRST::regs()
6053 .hp_rst_en1()
6054 .modify(|_, w| w.rst_en_stimer().bit(reset));
6055 }
6056 Peripheral::Timg0 => {
6057 crate::peripherals::HP_SYS_CLKRST::regs()
6058 .hp_rst_en1()
6059 .modify(|_, w| w.rst_en_timergrp0().bit(reset));
6060 }
6061 Peripheral::Timg1 => {
6062 crate::peripherals::HP_SYS_CLKRST::regs()
6063 .hp_rst_en1()
6064 .modify(|_, w| w.rst_en_timergrp1().bit(reset));
6065 }
6066 Peripheral::Twai0 => {
6067 crate::peripherals::HP_SYS_CLKRST::regs()
6068 .hp_rst_en1()
6069 .modify(|_, w| w.rst_en_can0().bit(reset));
6070 }
6071 Peripheral::Twai1 => {
6072 crate::peripherals::HP_SYS_CLKRST::regs()
6073 .hp_rst_en1()
6074 .modify(|_, w| w.rst_en_can1().bit(reset));
6075 }
6076 Peripheral::Twai2 => {
6077 crate::peripherals::HP_SYS_CLKRST::regs()
6078 .hp_rst_en1()
6079 .modify(|_, w| w.rst_en_can2().bit(reset));
6080 }
6081 Peripheral::Uart0 => {
6082 crate::peripherals::HP_SYS_CLKRST::regs()
6083 .hp_rst_en1()
6084 .modify(|_, w| {
6085 w.rst_en_uart0_core()
6086 .bit(reset)
6087 .rst_en_uart0_apb()
6088 .bit(reset)
6089 });
6090 }
6091 Peripheral::Uart1 => {
6092 crate::peripherals::HP_SYS_CLKRST::regs()
6093 .hp_rst_en1()
6094 .modify(|_, w| {
6095 w.rst_en_uart1_core()
6096 .bit(reset)
6097 .rst_en_uart1_apb()
6098 .bit(reset)
6099 });
6100 }
6101 Peripheral::Uart2 => {
6102 crate::peripherals::HP_SYS_CLKRST::regs()
6103 .hp_rst_en1()
6104 .modify(|_, w| {
6105 w.rst_en_uart2_core()
6106 .bit(reset)
6107 .rst_en_uart2_apb()
6108 .bit(reset)
6109 });
6110 }
6111 Peripheral::Uart3 => {
6112 crate::peripherals::HP_SYS_CLKRST::regs()
6113 .hp_rst_en1()
6114 .modify(|_, w| {
6115 w.rst_en_uart3_core()
6116 .bit(reset)
6117 .rst_en_uart3_apb()
6118 .bit(reset)
6119 });
6120 }
6121 Peripheral::Uart4 => {
6122 crate::peripherals::HP_SYS_CLKRST::regs()
6123 .hp_rst_en1()
6124 .modify(|_, w| {
6125 w.rst_en_uart4_core()
6126 .bit(reset)
6127 .rst_en_uart4_apb()
6128 .bit(reset)
6129 });
6130 }
6131 Peripheral::Uhci0 => {
6132 crate::peripherals::HP_SYS_CLKRST::regs()
6133 .hp_rst_en1()
6134 .modify(|_, w| w.rst_en_uhci().bit(reset));
6135 }
6136 Peripheral::UsbDevice => {
6137 let _ = reset;
6138 }
6139 Peripheral::UsbFs => {
6140 let _ = reset;
6141 }
6142 Peripheral::UsbHs => {
6143 let _ = reset;
6144 }
6145 Peripheral::Vdma => {
6146 crate::peripherals::HP_SYS_CLKRST::regs()
6147 .hp_rst_en0()
6148 .modify(|_, w| w.rst_en_gdma().bit(reset));
6149 }
6150 }
6151 }
6152 };
6153}
6154#[macro_export]
6162#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6163macro_rules! memory_range {
6164 ("DRAM") => {
6165 0x4FF40000..0x4FFADFC0
6166 };
6167 (size as str, "DRAM") => {
6168 "450496"
6169 };
6170 ("DRAM2_UNINIT") => {
6171 0x4FFADFC0..0x4FFBEFC0
6172 };
6173 (size as str, "DRAM2_UNINIT") => {
6174 "69632"
6175 };
6176 ("IROM") => {
6177 0x40000000..0x44000000
6178 };
6179 (size as str, "IROM") => {
6180 "67108864"
6181 };
6182 ("DROM") => {
6183 0x40000000..0x44000000
6184 };
6185 (size as str, "DROM") => {
6186 "67108864"
6187 };
6188}
6189#[macro_export]
6206#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6207macro_rules! for_each_i2c_master {
6208 ($($pattern:tt => $code:tt;)*) => {
6209 macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
6210 => {} } _for_each_inner_i2c_master!((0, I2C0, I2c0, I2C0_SCL, I2C0_SDA));
6211 _for_each_inner_i2c_master!((1, I2C1, I2c1, I2C1_SCL, I2C1_SDA));
6212 _for_each_inner_i2c_master!((all(0, I2C0, I2c0, I2C0_SCL, I2C0_SDA), (1, I2C1,
6213 I2c1, I2C1_SCL, I2C1_SDA)));
6214 };
6215}
6216#[macro_export]
6243#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6244macro_rules! for_each_i2s {
6245 ($($pattern:tt => $code:tt;)*) => {
6246 macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
6247 _for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S1));
6248 _for_each_inner_i2s!((I2S2)); _for_each_inner_i2s!((I2S0, I2s0, I2S0_MCLK,
6249 I2S0_O_BCK, I2S0_O_WS, I2S0_I_BCK, I2S0_I_WS, [I2S0_O_SD, I2S0_O_SD1],
6250 [I2S0_I_SD, I2S0_I_SD1, I2S0_I_SD2, I2S0_I_SD3], true, true, true, true));
6251 _for_each_inner_i2s!((I2S1, I2s1, I2S1_MCLK, I2S1_O_BCK, I2S1_O_WS, I2S1_I_BCK,
6252 I2S1_I_WS, [I2S1_O_SD], [I2S1_I_SD], true, true, false, false));
6253 _for_each_inner_i2s!((I2S2, I2s2, I2S2_MCLK, I2S2_O_BCK, I2S2_O_WS, I2S2_I_BCK,
6254 I2S2_I_WS, [I2S2_O_SD], [I2S2_I_SD], true, true, false, false));
6255 _for_each_inner_i2s!((names(I2S0), (I2S1), (I2S2)));
6256 _for_each_inner_i2s!((all(I2S0, I2s0, I2S0_MCLK, I2S0_O_BCK, I2S0_O_WS,
6257 I2S0_I_BCK, I2S0_I_WS, [I2S0_O_SD, I2S0_O_SD1], [I2S0_I_SD, I2S0_I_SD1,
6258 I2S0_I_SD2, I2S0_I_SD3], true, true, true, true), (I2S1, I2s1, I2S1_MCLK,
6259 I2S1_O_BCK, I2S1_O_WS, I2S1_I_BCK, I2S1_I_WS, [I2S1_O_SD], [I2S1_I_SD], true,
6260 true, false, false), (I2S2, I2s2, I2S2_MCLK, I2S2_O_BCK, I2S2_O_WS, I2S2_I_BCK,
6261 I2S2_I_WS, [I2S2_O_SD], [I2S2_I_SD], true, true, false, false)));
6262 };
6263}
6264#[macro_export]
6283#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6284macro_rules! for_each_uart {
6285 ($($pattern:tt => $code:tt;)*) => {
6286 macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
6287 } _for_each_inner_uart!((0, UART0, Uart0, UART0_RXD, UART0_TXD, UART0_CTS,
6288 UART0_RTS, wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1,
6289 UART1_RXD, UART1_TXD, UART1_CTS, UART1_RTS, wakeup_source = true));
6290 _for_each_inner_uart!((2, UART2, Uart2, UART2_RXD, UART2_TXD, UART2_CTS,
6291 UART2_RTS, wakeup_source = true)); _for_each_inner_uart!((3, UART3, Uart3,
6292 UART3_RXD, UART3_TXD, UART3_CTS, UART3_RTS, wakeup_source = true));
6293 _for_each_inner_uart!((4, UART4, Uart4, UART4_RXD, UART4_TXD, UART4_CTS,
6294 UART4_RTS, wakeup_source = true)); _for_each_inner_uart!((all(0, UART0, Uart0,
6295 UART0_RXD, UART0_TXD, UART0_CTS, UART0_RTS, wakeup_source = true), (1, UART1,
6296 Uart1, UART1_RXD, UART1_TXD, UART1_CTS, UART1_RTS, wakeup_source = true), (2,
6297 UART2, Uart2, UART2_RXD, UART2_TXD, UART2_CTS, UART2_RTS, wakeup_source = true),
6298 (3, UART3, Uart3, UART3_RXD, UART3_TXD, UART3_CTS, UART3_RTS, wakeup_source =
6299 true), (4, UART4, Uart4, UART4_RXD, UART4_TXD, UART4_CTS, UART4_RTS,
6300 wakeup_source = true)));
6301 };
6302}
6303#[macro_export]
6325#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6326macro_rules! for_each_spi_master {
6327 ($($pattern:tt => $code:tt;)*) => {
6328 macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
6329 => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
6330 _for_each_inner_spi_master!((SPI2, Spi2, SPI2_CK[SPI2_CS] [SPI2_D, SPI2_Q,
6331 SPI2_WP, SPI2_HOLD], true)); _for_each_inner_spi_master!((SPI3, Spi3,
6332 SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD],
6333 true)); _for_each_inner_spi_master!((names(SPI2), (SPI3)));
6334 _for_each_inner_spi_master!((all(SPI2, Spi2, SPI2_CK[SPI2_CS] [SPI2_D, SPI2_Q,
6335 SPI2_WP, SPI2_HOLD], true), (SPI3, Spi3, SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2]
6336 [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD], true)));
6337 };
6338}
6339#[macro_export]
6356#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6357macro_rules! for_each_spi_slave {
6358 ($($pattern:tt => $code:tt;)*) => {
6359 macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
6360 => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
6361 _for_each_inner_spi_slave!((SPI2, Spi2, SPI2_CK, SPI2_D, SPI2_Q, SPI2_CS));
6362 _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS));
6363 _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
6364 _for_each_inner_spi_slave!((all(SPI2, Spi2, SPI2_CK, SPI2_D, SPI2_Q, SPI2_CS),
6365 (SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS)));
6366 };
6367}
6368#[macro_export]
6391#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6392macro_rules! for_each_pcnt_unit {
6393 ($($pattern:tt => $code:tt;)*) => {
6394 macro_rules! _for_each_inner_pcnt_unit { $(($pattern) => $code;)* ($other : tt)
6395 => {} } _for_each_inner_pcnt_unit!((PCNT0_UNIT0));
6396 _for_each_inner_pcnt_unit!((PCNT0_UNIT1));
6397 _for_each_inner_pcnt_unit!((PCNT0_UNIT2));
6398 _for_each_inner_pcnt_unit!((PCNT0_UNIT3));
6399 _for_each_inner_pcnt_unit!((PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT,
6400 PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1));
6401 _for_each_inner_pcnt_unit!((PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT,
6402 PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0, PCNT1_CTRL_CH1));
6403 _for_each_inner_pcnt_unit!((PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT,
6404 PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1));
6405 _for_each_inner_pcnt_unit!((PCNT0_UNIT3, Pcnt0Unit3, Pcnt, PCNT, 3, PCNT,
6406 PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1));
6407 _for_each_inner_pcnt_unit!((PCNT)); _for_each_inner_pcnt_unit!((PCNT));
6408 _for_each_inner_pcnt_unit!((names(PCNT0_UNIT0), (PCNT0_UNIT1), (PCNT0_UNIT2),
6409 (PCNT0_UNIT3))); _for_each_inner_pcnt_unit!((all(PCNT0_UNIT0, Pcnt0Unit0, Pcnt,
6410 PCNT, 0, PCNT, PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1),
6411 (PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT, PCNT1_SIG_CH0, PCNT1_SIG_CH1,
6412 PCNT1_CTRL_CH0, PCNT1_CTRL_CH1), (PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT,
6413 PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1), (PCNT0_UNIT3,
6414 Pcnt0Unit3, Pcnt, PCNT, 3, PCNT, PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0,
6415 PCNT3_CTRL_CH1))); _for_each_inner_pcnt_unit!((interrupt(PCNT)));
6416 _for_each_inner_pcnt_unit!((regs(PCNT)));
6417 };
6418}
6419#[macro_export]
6420#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6421macro_rules! for_each_peripheral {
6422 ($($pattern:tt => $code:tt;)*) => {
6423 macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
6424 => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
6425 "GPIO0 peripheral singleton"] GPIO0 <= virtual()));
6426 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
6427 GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6428 "GPIO2 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6429 "<section class=\"warning\">"] #[doc =
6430 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6431 #[doc = "<ul>"] #[doc =
6432 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6433 #[doc = "</ul>"] #[doc = "</section>"] GPIO2 <= virtual()));
6434 _for_each_inner_peripheral!((@ peri_type #[doc =
6435 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6436 "<section class=\"warning\">"] #[doc =
6437 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6438 #[doc = "<ul>"] #[doc =
6439 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6440 #[doc = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()));
6441 _for_each_inner_peripheral!((@ peri_type #[doc =
6442 "GPIO4 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6443 "<section class=\"warning\">"] #[doc =
6444 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6445 #[doc = "<ul>"] #[doc =
6446 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6447 #[doc = "</ul>"] #[doc = "</section>"] GPIO4 <= virtual()));
6448 _for_each_inner_peripheral!((@ peri_type #[doc =
6449 "GPIO5 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6450 "<section class=\"warning\">"] #[doc =
6451 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6452 #[doc = "<ul>"] #[doc =
6453 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6454 #[doc = "</ul>"] #[doc = "</section>"] GPIO5 <= virtual()));
6455 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO6 peripheral singleton"]
6456 GPIO6 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6457 "GPIO7 peripheral singleton"] GPIO7 <= virtual()));
6458 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO8 peripheral singleton"]
6459 GPIO8 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6460 "GPIO9 peripheral singleton"] GPIO9 <= virtual()));
6461 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO10 peripheral singleton"]
6462 GPIO10 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6463 "GPIO11 peripheral singleton"] GPIO11 <= virtual()));
6464 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO12 peripheral singleton"]
6465 GPIO12 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6466 "GPIO13 peripheral singleton"] GPIO13 <= virtual()));
6467 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO14 peripheral singleton"]
6468 GPIO14 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6469 "GPIO15 peripheral singleton"] GPIO15 <= virtual()));
6470 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO16 peripheral singleton"]
6471 GPIO16 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6472 "GPIO17 peripheral singleton"] GPIO17 <= virtual()));
6473 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO18 peripheral singleton"]
6474 GPIO18 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6475 "GPIO19 peripheral singleton"] GPIO19 <= virtual()));
6476 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO20 peripheral singleton"]
6477 GPIO20 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6478 "GPIO21 peripheral singleton"] GPIO21 <= virtual()));
6479 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO22 peripheral singleton"]
6480 GPIO22 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6481 "GPIO23 peripheral singleton"] GPIO23 <= virtual()));
6482 _for_each_inner_peripheral!((@ peri_type #[doc =
6483 "GPIO24 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6484 "<section class=\"warning\">"] #[doc =
6485 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6486 #[doc = "<ul>"] #[doc =
6487 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6488 #[doc = "</section>"] GPIO24 <= virtual())); _for_each_inner_peripheral!((@
6489 peri_type #[doc = "GPIO25 peripheral singleton (Limitations exist)"] #[doc = ""]
6490 #[doc = "<section class=\"warning\">"] #[doc =
6491 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6492 #[doc = "<ul>"] #[doc =
6493 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6494 #[doc = "</section>"] GPIO25 <= virtual())); _for_each_inner_peripheral!((@
6495 peri_type #[doc = "GPIO26 peripheral singleton"] GPIO26 <= virtual()));
6496 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO27 peripheral singleton"]
6497 GPIO27 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6498 "GPIO28 peripheral singleton"] GPIO28 <= virtual()));
6499 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO29 peripheral singleton"]
6500 GPIO29 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6501 "GPIO30 peripheral singleton"] GPIO30 <= virtual()));
6502 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO31 peripheral singleton"]
6503 GPIO31 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6504 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6505 "<section class=\"warning\">"] #[doc =
6506 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6507 #[doc = "<ul>"] #[doc =
6508 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6509 = "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
6510 _for_each_inner_peripheral!((@ peri_type #[doc =
6511 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6512 "<section class=\"warning\">"] #[doc =
6513 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6514 #[doc = "<ul>"] #[doc =
6515 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6516 = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()));
6517 _for_each_inner_peripheral!((@ peri_type #[doc =
6518 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6519 "<section class=\"warning\">"] #[doc =
6520 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6521 #[doc = "<ul>"] #[doc =
6522 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6523 = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
6524 _for_each_inner_peripheral!((@ peri_type #[doc =
6525 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6526 "<section class=\"warning\">"] #[doc =
6527 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6528 #[doc = "<ul>"] #[doc =
6529 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6530 = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
6531 _for_each_inner_peripheral!((@ peri_type #[doc =
6532 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6533 "<section class=\"warning\">"] #[doc =
6534 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6535 #[doc = "<ul>"] #[doc =
6536 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6537 = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
6538 _for_each_inner_peripheral!((@ peri_type #[doc =
6539 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6540 "<section class=\"warning\">"] #[doc =
6541 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6542 #[doc = "<ul>"] #[doc =
6543 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6544 = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
6545 _for_each_inner_peripheral!((@ peri_type #[doc =
6546 "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6547 "<section class=\"warning\">"] #[doc =
6548 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6549 #[doc = "<ul>"] #[doc =
6550 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6551 = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()));
6552 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO39 peripheral singleton"]
6553 GPIO39 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6554 "GPIO40 peripheral singleton"] GPIO40 <= virtual()));
6555 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO41 peripheral singleton"]
6556 GPIO41 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6557 "GPIO42 peripheral singleton"] GPIO42 <= virtual()));
6558 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO43 peripheral singleton"]
6559 GPIO43 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6560 "GPIO44 peripheral singleton"] GPIO44 <= virtual()));
6561 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO45 peripheral singleton"]
6562 GPIO45 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6563 "GPIO46 peripheral singleton"] GPIO46 <= virtual()));
6564 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO47 peripheral singleton"]
6565 GPIO47 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6566 "GPIO48 peripheral singleton"] GPIO48 <= virtual()));
6567 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO49 peripheral singleton"]
6568 GPIO49 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6569 "GPIO50 peripheral singleton"] GPIO50 <= virtual()));
6570 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO51 peripheral singleton"]
6571 GPIO51 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6572 "GPIO52 peripheral singleton"] GPIO52 <= virtual()));
6573 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO53 peripheral singleton"]
6574 GPIO53 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
6575 "GPIO54 peripheral singleton"] GPIO54 <= virtual()));
6576 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
6577 DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : { bind_dma_in_interrupt,
6578 enable_dma_in_interrupt, disable_dma_in_interrupt }, AHB_PDMA_OUT_CH0 : {
6579 bind_dma_out_interrupt, enable_dma_out_interrupt, disable_dma_out_interrupt })
6580 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6581 "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
6582 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6583 AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6584 disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
6585 peri_type #[doc = "DMA_CH2 peripheral singleton"] DMA_CH2 <=
6586 virtual(AHB_PDMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
6587 disable_dma_in_interrupt }, AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt,
6588 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
6589 _for_each_inner_peripheral!((@ peri_type #[doc =
6590 "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <= virtual(AXI_PDMA_IN_CH0 : {
6591 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6592 AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6593 disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
6594 peri_type #[doc = "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <=
6595 virtual(AXI_PDMA_IN_CH1 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
6596 disable_dma_in_interrupt }, AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt,
6597 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
6598 _for_each_inner_peripheral!((@ peri_type #[doc =
6599 "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <= virtual(AXI_PDMA_IN_CH2 : {
6600 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6601 AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6602 disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
6603 peri_type #[doc = "VDMA_CH0 peripheral singleton"] VDMA_CH0 <= virtual()
6604 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6605 "VDMA_CH1 peripheral singleton"] VDMA_CH1 <= virtual() (unstable)));
6606 _for_each_inner_peripheral!((@ peri_type #[doc = "VDMA_CH2 peripheral singleton"]
6607 VDMA_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
6608 #[doc = "VDMA_CH3 peripheral singleton"] VDMA_CH3 <= virtual() (unstable)));
6609 _for_each_inner_peripheral!((@ peri_type #[doc =
6610 "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)));
6611 _for_each_inner_peripheral!((@ peri_type #[doc =
6612 "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual() (unstable)));
6613 _for_each_inner_peripheral!((@ peri_type #[doc =
6614 "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)));
6615 _for_each_inner_peripheral!((@ peri_type #[doc =
6616 "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)));
6617 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
6618 SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6619 = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
6620 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
6621 SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6622 = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
6623 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
6624 SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6625 = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
6626 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
6627 SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6628 = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
6629 _for_each_inner_peripheral!((@ peri_type #[doc = "EFUSE peripheral singleton"]
6630 EFUSE <= EFUSE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6631 "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)));
6632 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO_SD peripheral singleton"]
6633 GPIO_SD <= GPIO_SD() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6634 = "SYSTEM peripheral singleton"] SYSTEM <= HP_SYS() (unstable)));
6635 _for_each_inner_peripheral!((@ peri_type #[doc = "HP_SYS peripheral singleton"]
6636 HP_SYS <= HP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6637 "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
6638 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6639 "RNG peripheral singleton"] RNG <= LP_TRNG() (unstable)));
6640 _for_each_inner_peripheral!((@ peri_type #[doc =
6641 "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
6642 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6643 "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
6644 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6645 "LP_I2C_ANA_MST peripheral singleton"] LP_I2C_ANA_MST <= LP_I2C_ANA_MST()
6646 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6647 "CACHE peripheral singleton"] CACHE <= CACHE() (unstable)));
6648 _for_each_inner_peripheral!((@ peri_type #[doc = "CLIC peripheral singleton"]
6649 CLIC <= CLIC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6650 "CLINT peripheral singleton"] CLINT <= CLINT() (unstable)));
6651 _for_each_inner_peripheral!((@ peri_type #[doc =
6652 "CLINT_OTHER_CORE peripheral singleton"] CLINT_OTHER_CORE <= CLINT_OTHER_CORE()
6653 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6654 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
6655 _for_each_inner_peripheral!((@ peri_type #[doc =
6656 "IOMUX_MSPI_PIN peripheral singleton"] IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN()
6657 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6658 "LP_I2C0 peripheral singleton"] LP_I2C0 <= LP_I2C0() (unstable)));
6659 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_AON peripheral singleton"]
6660 LP_AON <= LP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6661 "LP_AON_CLKRST peripheral singleton"] LP_AON_CLKRST <= LP_AON_CLKRST()
6662 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6663 "LP_SYS peripheral singleton"] LP_SYS <= LP_SYS() (unstable)));
6664 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_GPIO peripheral singleton"]
6665 LP_GPIO <= LP_GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6666 = "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)));
6667 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_PERI peripheral singleton"]
6668 LP_PERI <= LP_PERI() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6669 = "RTC_TIMER peripheral singleton"] RTC_TIMER <= LP_TIMER() (unstable)));
6670 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_WDT peripheral singleton"]
6671 LP_WDT <= LP_WDT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6672 "LPWR peripheral singleton"] LPWR <= LP_SYS() (unstable)));
6673 _for_each_inner_peripheral!((@ peri_type #[doc = "PMU peripheral singleton"] PMU
6674 <= PMU() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6675 "PAU peripheral singleton"] PAU <= PAU() (unstable)));
6676 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTIMER peripheral singleton"]
6677 SYSTIMER <= SYSTIMER() (unstable))); _for_each_inner_peripheral!((@ peri_type
6678 #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
6679 _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
6680 TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6681 "UART0 peripheral singleton"] UART0 <= UART0(UART0 : { bind_peri_interrupt,
6682 enable_peri_interrupt, disable_peri_interrupt })));
6683 _for_each_inner_peripheral!((@ peri_type #[doc = "UART1 peripheral singleton"]
6684 UART1 <= UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
6685 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6686 "UART2 peripheral singleton"] UART2 <= UART2(UART2 : { bind_peri_interrupt,
6687 enable_peri_interrupt, disable_peri_interrupt })));
6688 _for_each_inner_peripheral!((@ peri_type #[doc = "UART3 peripheral singleton"]
6689 UART3 <= UART3(UART3 : { bind_peri_interrupt, enable_peri_interrupt,
6690 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6691 "UART4 peripheral singleton"] UART4 <= UART4(UART4 : { bind_peri_interrupt,
6692 enable_peri_interrupt, disable_peri_interrupt })));
6693 _for_each_inner_peripheral!((@ peri_type #[doc = "UHCI0 peripheral singleton"]
6694 UHCI0 <= UHCI0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6695 "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
6696 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
6697 SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6698 "MEMSPI2 peripheral singleton"] MEMSPI2 <= MEMSPI2() (unstable)));
6699 _for_each_inner_peripheral!((@ peri_type #[doc = "MEMSPI3 peripheral singleton"]
6700 MEMSPI3 <= MEMSPI3() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
6701 = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
6702 enable_peri_interrupt, disable_peri_interrupt })));
6703 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
6704 SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
6705 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6706 "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0 : { bind_peri_interrupt,
6707 enable_peri_interrupt, disable_peri_interrupt })));
6708 _for_each_inner_peripheral!((@ peri_type #[doc = "I2C1 peripheral singleton"]
6709 I2C1 <= I2C1(I2C1 : { bind_peri_interrupt, enable_peri_interrupt,
6710 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
6711 "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
6712 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6713 _for_each_inner_peripheral!((@ peri_type #[doc = "I2S1 peripheral singleton"]
6714 I2S1 <= I2S1(I2S1 : { bind_peri_interrupt, enable_peri_interrupt,
6715 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6716 #[doc = "I2S2 peripheral singleton"] I2S2 <= I2S2(I2S2 : { bind_peri_interrupt,
6717 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6718 _for_each_inner_peripheral!((@ peri_type #[doc = "TWAI0 peripheral singleton"]
6719 TWAI0 <= TWAI0(TWAI0 : { bind_peri_interrupt, enable_peri_interrupt,
6720 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6721 #[doc = "TWAI1 peripheral singleton"] TWAI1 <= TWAI1(TWAI1 : {
6722 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6723 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6724 "TWAI2 peripheral singleton"] TWAI2 <= TWAI2(TWAI2 : { bind_peri_interrupt,
6725 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6726 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
6727 <= AHB_DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6728 "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)));
6729 _for_each_inner_peripheral!((@ peri_type #[doc = "ETH peripheral singleton"] ETH
6730 <= virtual(ETH_MAC : { bind_peri_interrupt, enable_peri_interrupt,
6731 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6732 #[doc = "EMAC_DMA peripheral singleton"] EMAC_DMA <= GMAC_DMA() (unstable)));
6733 _for_each_inner_peripheral!((@ peri_type #[doc = "EMAC_MAC peripheral singleton"]
6734 EMAC_MAC <= GMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6735 "MIPI_DSI peripheral singleton"] MIPI_DSI <= virtual(DSI_BRIDGE : {
6736 bind_bridge_interrupt, enable_bridge_interrupt, disable_bridge_interrupt }, DSI :
6737 { bind_dsi_interrupt, enable_dsi_interrupt, disable_dsi_interrupt })
6738 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6739 "VDMA peripheral singleton"] VDMA <= DMA() (unstable)));
6740 _for_each_inner_peripheral!((@ peri_type #[doc =
6741 "MIPI_DSI_HOST peripheral singleton"] MIPI_DSI_HOST <= MIPI_DSI_HOST()
6742 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6743 "MIPI_DSI_BRIDGE peripheral singleton"] MIPI_DSI_BRIDGE <= MIPI_DSI_BRIDGE()
6744 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6745 "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
6746 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6747 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6748 "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)));
6749 _for_each_inner_peripheral!((@ peri_type #[doc = "LEDC peripheral singleton"]
6750 LEDC <= LEDC(LEDC : { bind_peri_interrupt, enable_peri_interrupt,
6751 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6752 #[doc = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0(PWM0 : {
6753 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6754 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6755 "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1(PWM1 : { bind_peri_interrupt,
6756 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6757 _for_each_inner_peripheral!((@ peri_type #[doc = "PCNT peripheral singleton"]
6758 PCNT <= PCNT(PCNT : { bind_peri_interrupt, enable_peri_interrupt,
6759 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6760 #[doc = "APB_SARADC peripheral singleton"] APB_SARADC <= ADC() (unstable)));
6761 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_ADC peripheral singleton"]
6762 LP_ADC <= LP_ADC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6763 "RMT peripheral singleton"] RMT <= RMT(RMT : { bind_peri_interrupt,
6764 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6765 _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
6766 <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
6767 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6768 "SHA peripheral singleton"] SHA <= SHA(SHA : { bind_peri_interrupt,
6769 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6770 _for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
6771 <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
6772 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6773 "ECC peripheral singleton"] ECC <= ECC(ECC : { bind_peri_interrupt,
6774 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
6775 _for_each_inner_peripheral!((@ peri_type #[doc = "USB_FS peripheral singleton"]
6776 USB_FS <= USB_FS(USB_FS : { bind_peri_interrupt, enable_peri_interrupt,
6777 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
6778 #[doc = "USB_HS peripheral singleton"] USB_HS <= USB_HS(USB_HS : {
6779 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6780 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6781 "USB_WRAP peripheral singleton"] USB_WRAP <= USB_WRAP() (unstable)));
6782 _for_each_inner_peripheral!((@ peri_type #[doc = "ADC1 peripheral singleton"]
6783 ADC1 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6784 "ADC2 peripheral singleton"] ADC2 <= virtual() (unstable)));
6785 _for_each_inner_peripheral!((@ peri_type #[doc = "FLASH peripheral singleton"]
6786 FLASH <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
6787 "PSRAM peripheral singleton"] PSRAM <= virtual() (unstable)));
6788 _for_each_inner_peripheral!((@ peri_type #[doc =
6789 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
6790 _for_each_inner_peripheral!((@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
6791 CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
6792 #[doc = "IPC peripheral singleton"] IPC <= virtual() (unstable)));
6793 _for_each_inner_peripheral!((@ peri_type #[doc =
6794 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)));
6795 _for_each_inner_peripheral!((@ peri_type #[doc =
6796 "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
6797 _for_each_inner_peripheral!((@ peri_type #[doc =
6798 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
6799 _for_each_inner_peripheral!((@ peri_type #[doc =
6800 "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
6801 _for_each_inner_peripheral!((GPIO0)); _for_each_inner_peripheral!((GPIO1));
6802 _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
6803 _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
6804 _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
6805 _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
6806 _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
6807 _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
6808 _for_each_inner_peripheral!((GPIO14)); _for_each_inner_peripheral!((GPIO15));
6809 _for_each_inner_peripheral!((GPIO16)); _for_each_inner_peripheral!((GPIO17));
6810 _for_each_inner_peripheral!((GPIO18)); _for_each_inner_peripheral!((GPIO19));
6811 _for_each_inner_peripheral!((GPIO20)); _for_each_inner_peripheral!((GPIO21));
6812 _for_each_inner_peripheral!((GPIO22)); _for_each_inner_peripheral!((GPIO23));
6813 _for_each_inner_peripheral!((GPIO24)); _for_each_inner_peripheral!((GPIO25));
6814 _for_each_inner_peripheral!((GPIO26)); _for_each_inner_peripheral!((GPIO27));
6815 _for_each_inner_peripheral!((GPIO28)); _for_each_inner_peripheral!((GPIO29));
6816 _for_each_inner_peripheral!((GPIO30)); _for_each_inner_peripheral!((GPIO31));
6817 _for_each_inner_peripheral!((GPIO32)); _for_each_inner_peripheral!((GPIO33));
6818 _for_each_inner_peripheral!((GPIO34)); _for_each_inner_peripheral!((GPIO35));
6819 _for_each_inner_peripheral!((GPIO36)); _for_each_inner_peripheral!((GPIO37));
6820 _for_each_inner_peripheral!((GPIO38)); _for_each_inner_peripheral!((GPIO39));
6821 _for_each_inner_peripheral!((GPIO40)); _for_each_inner_peripheral!((GPIO41));
6822 _for_each_inner_peripheral!((GPIO42)); _for_each_inner_peripheral!((GPIO43));
6823 _for_each_inner_peripheral!((GPIO44)); _for_each_inner_peripheral!((GPIO45));
6824 _for_each_inner_peripheral!((GPIO46)); _for_each_inner_peripheral!((GPIO47));
6825 _for_each_inner_peripheral!((GPIO48)); _for_each_inner_peripheral!((GPIO49));
6826 _for_each_inner_peripheral!((GPIO50)); _for_each_inner_peripheral!((GPIO51));
6827 _for_each_inner_peripheral!((GPIO52)); _for_each_inner_peripheral!((GPIO53));
6828 _for_each_inner_peripheral!((GPIO54));
6829 _for_each_inner_peripheral!((DMA_CH0(unstable)));
6830 _for_each_inner_peripheral!((DMA_CH1(unstable)));
6831 _for_each_inner_peripheral!((DMA_CH2(unstable)));
6832 _for_each_inner_peripheral!((DMA_AXI_CH0(unstable)));
6833 _for_each_inner_peripheral!((DMA_AXI_CH1(unstable)));
6834 _for_each_inner_peripheral!((DMA_AXI_CH2(unstable)));
6835 _for_each_inner_peripheral!((VDMA_CH0(unstable)));
6836 _for_each_inner_peripheral!((VDMA_CH1(unstable)));
6837 _for_each_inner_peripheral!((VDMA_CH2(unstable)));
6838 _for_each_inner_peripheral!((VDMA_CH3(unstable)));
6839 _for_each_inner_peripheral!((PCNT0_UNIT0(unstable)));
6840 _for_each_inner_peripheral!((PCNT0_UNIT1(unstable)));
6841 _for_each_inner_peripheral!((PCNT0_UNIT2(unstable)));
6842 _for_each_inner_peripheral!((PCNT0_UNIT3(unstable)));
6843 _for_each_inner_peripheral!((SDM_CH0(unstable)));
6844 _for_each_inner_peripheral!((SDM_CH1(unstable)));
6845 _for_each_inner_peripheral!((SDM_CH2(unstable)));
6846 _for_each_inner_peripheral!((SDM_CH3(unstable)));
6847 _for_each_inner_peripheral!((SDM_CH4(unstable)));
6848 _for_each_inner_peripheral!((SDM_CH5(unstable)));
6849 _for_each_inner_peripheral!((SDM_CH6(unstable)));
6850 _for_each_inner_peripheral!((SDM_CH7(unstable)));
6851 _for_each_inner_peripheral!((GPIO(unstable)));
6852 _for_each_inner_peripheral!((GPIO_SD(unstable)));
6853 _for_each_inner_peripheral!((SYSTEM(unstable)));
6854 _for_each_inner_peripheral!((HP_SYS(unstable)));
6855 _for_each_inner_peripheral!((HP_SYS_CLKRST(unstable)));
6856 _for_each_inner_peripheral!((RNG(unstable)));
6857 _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
6858 _for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
6859 _for_each_inner_peripheral!((LP_I2C_ANA_MST(unstable)));
6860 _for_each_inner_peripheral!((CLIC(unstable)));
6861 _for_each_inner_peripheral!((CLINT(unstable)));
6862 _for_each_inner_peripheral!((CLINT_OTHER_CORE(unstable)));
6863 _for_each_inner_peripheral!((IO_MUX(unstable)));
6864 _for_each_inner_peripheral!((LP_I2C0(unstable)));
6865 _for_each_inner_peripheral!((LP_AON(unstable)));
6866 _for_each_inner_peripheral!((LP_AON_CLKRST(unstable)));
6867 _for_each_inner_peripheral!((LP_SYS(unstable)));
6868 _for_each_inner_peripheral!((LP_GPIO(unstable)));
6869 _for_each_inner_peripheral!((LP_IO_MUX(unstable)));
6870 _for_each_inner_peripheral!((LP_PERI(unstable)));
6871 _for_each_inner_peripheral!((RTC_TIMER(unstable)));
6872 _for_each_inner_peripheral!((LP_WDT(unstable)));
6873 _for_each_inner_peripheral!((LPWR(unstable)));
6874 _for_each_inner_peripheral!((PMU(unstable)));
6875 _for_each_inner_peripheral!((PAU(unstable)));
6876 _for_each_inner_peripheral!((SYSTIMER(unstable)));
6877 _for_each_inner_peripheral!((TIMG0(unstable)));
6878 _for_each_inner_peripheral!((TIMG1(unstable)));
6879 _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
6880 _for_each_inner_peripheral!((UART2)); _for_each_inner_peripheral!((UART3));
6881 _for_each_inner_peripheral!((UART4));
6882 _for_each_inner_peripheral!((UHCI0(unstable)));
6883 _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
6884 _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
6885 _for_each_inner_peripheral!((I2S0(unstable)));
6886 _for_each_inner_peripheral!((I2S1(unstable)));
6887 _for_each_inner_peripheral!((I2S2(unstable)));
6888 _for_each_inner_peripheral!((TWAI0(unstable)));
6889 _for_each_inner_peripheral!((TWAI1(unstable)));
6890 _for_each_inner_peripheral!((TWAI2(unstable)));
6891 _for_each_inner_peripheral!((DMA(unstable)));
6892 _for_each_inner_peripheral!((AXI_GDMA(unstable)));
6893 _for_each_inner_peripheral!((ETH(unstable)));
6894 _for_each_inner_peripheral!((MIPI_DSI(unstable)));
6895 _for_each_inner_peripheral!((USB_DEVICE(unstable)));
6896 _for_each_inner_peripheral!((SDHOST(unstable)));
6897 _for_each_inner_peripheral!((LEDC(unstable)));
6898 _for_each_inner_peripheral!((MCPWM0(unstable)));
6899 _for_each_inner_peripheral!((MCPWM1(unstable)));
6900 _for_each_inner_peripheral!((PCNT(unstable)));
6901 _for_each_inner_peripheral!((APB_SARADC(unstable)));
6902 _for_each_inner_peripheral!((LP_ADC(unstable)));
6903 _for_each_inner_peripheral!((RMT(unstable)));
6904 _for_each_inner_peripheral!((AES(unstable)));
6905 _for_each_inner_peripheral!((SHA(unstable)));
6906 _for_each_inner_peripheral!((RSA(unstable)));
6907 _for_each_inner_peripheral!((ECC(unstable)));
6908 _for_each_inner_peripheral!((USB_FS(unstable)));
6909 _for_each_inner_peripheral!((USB_HS(unstable)));
6910 _for_each_inner_peripheral!((ADC1(unstable)));
6911 _for_each_inner_peripheral!((ADC2(unstable)));
6912 _for_each_inner_peripheral!((FLASH(unstable)));
6913 _for_each_inner_peripheral!((PSRAM(unstable)));
6914 _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
6915 _for_each_inner_peripheral!((CPU_CTRL(unstable)));
6916 _for_each_inner_peripheral!((IPC(unstable)));
6917 _for_each_inner_peripheral!((FROM_CPU_INTR0(unstable)));
6918 _for_each_inner_peripheral!((FROM_CPU_INTR1(unstable)));
6919 _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
6920 _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
6921 _for_each_inner_peripheral!((SPI2, Spi2, 1, AxiGdmaChannel));
6922 _for_each_inner_peripheral!((UHCI0, Uhci0, 2, AhbGdmaChannel));
6923 _for_each_inner_peripheral!((SPI3, Spi3, 2, AxiGdmaChannel));
6924 _for_each_inner_peripheral!((I2S0, I2s0, 3, AhbGdmaChannel));
6925 _for_each_inner_peripheral!((I2S1, I2s1, 4, AhbGdmaChannel));
6926 _for_each_inner_peripheral!((AES, Aes, 4, AxiGdmaChannel));
6927 _for_each_inner_peripheral!((I2S2, I2s2, 5, AhbGdmaChannel));
6928 _for_each_inner_peripheral!((SHA, Sha, 5, AxiGdmaChannel));
6929 _for_each_inner_peripheral!((all(@ peri_type #[doc =
6930 "GPIO0 peripheral singleton"] GPIO0 <= virtual()), (@ peri_type #[doc =
6931 "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
6932 "GPIO2 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6933 "<section class=\"warning\">"] #[doc =
6934 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6935 #[doc = "<ul>"] #[doc =
6936 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6937 #[doc = "</ul>"] #[doc = "</section>"] GPIO2 <= virtual()), (@ peri_type #[doc =
6938 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6939 "<section class=\"warning\">"] #[doc =
6940 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6941 #[doc = "<ul>"] #[doc =
6942 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6943 #[doc = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()), (@ peri_type #[doc =
6944 "GPIO4 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6945 "<section class=\"warning\">"] #[doc =
6946 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6947 #[doc = "<ul>"] #[doc =
6948 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6949 #[doc = "</ul>"] #[doc = "</section>"] GPIO4 <= virtual()), (@ peri_type #[doc =
6950 "GPIO5 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6951 "<section class=\"warning\">"] #[doc =
6952 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6953 #[doc = "<ul>"] #[doc =
6954 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6955 #[doc = "</ul>"] #[doc = "</section>"] GPIO5 <= virtual()), (@ peri_type #[doc =
6956 "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
6957 "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
6958 "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
6959 "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
6960 "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
6961 "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
6962 "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
6963 "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
6964 "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
6965 "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
6966 "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
6967 "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
6968 "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
6969 "GPIO19 peripheral singleton"] GPIO19 <= virtual()), (@ peri_type #[doc =
6970 "GPIO20 peripheral singleton"] GPIO20 <= virtual()), (@ peri_type #[doc =
6971 "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
6972 "GPIO22 peripheral singleton"] GPIO22 <= virtual()), (@ peri_type #[doc =
6973 "GPIO23 peripheral singleton"] GPIO23 <= virtual()), (@ peri_type #[doc =
6974 "GPIO24 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6975 "<section class=\"warning\">"] #[doc =
6976 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6977 #[doc = "<ul>"] #[doc =
6978 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6979 #[doc = "</section>"] GPIO24 <= virtual()), (@ peri_type #[doc =
6980 "GPIO25 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6981 "<section class=\"warning\">"] #[doc =
6982 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6983 #[doc = "<ul>"] #[doc =
6984 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6985 #[doc = "</section>"] GPIO25 <= virtual()), (@ peri_type #[doc =
6986 "GPIO26 peripheral singleton"] GPIO26 <= virtual()), (@ peri_type #[doc =
6987 "GPIO27 peripheral singleton"] GPIO27 <= virtual()), (@ peri_type #[doc =
6988 "GPIO28 peripheral singleton"] GPIO28 <= virtual()), (@ peri_type #[doc =
6989 "GPIO29 peripheral singleton"] GPIO29 <= virtual()), (@ peri_type #[doc =
6990 "GPIO30 peripheral singleton"] GPIO30 <= virtual()), (@ peri_type #[doc =
6991 "GPIO31 peripheral singleton"] GPIO31 <= virtual()), (@ peri_type #[doc =
6992 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6993 "<section class=\"warning\">"] #[doc =
6994 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6995 #[doc = "<ul>"] #[doc =
6996 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6997 = "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
6998 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6999 "<section class=\"warning\">"] #[doc =
7000 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7001 #[doc = "<ul>"] #[doc =
7002 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7003 = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
7004 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7005 "<section class=\"warning\">"] #[doc =
7006 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7007 #[doc = "<ul>"] #[doc =
7008 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7009 = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
7010 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7011 "<section class=\"warning\">"] #[doc =
7012 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7013 #[doc = "<ul>"] #[doc =
7014 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7015 = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
7016 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7017 "<section class=\"warning\">"] #[doc =
7018 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7019 #[doc = "<ul>"] #[doc =
7020 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7021 = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
7022 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7023 "<section class=\"warning\">"] #[doc =
7024 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7025 #[doc = "<ul>"] #[doc =
7026 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7027 = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
7028 "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
7029 "<section class=\"warning\">"] #[doc =
7030 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
7031 #[doc = "<ul>"] #[doc =
7032 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
7033 = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()), (@ peri_type #[doc =
7034 "GPIO39 peripheral singleton"] GPIO39 <= virtual()), (@ peri_type #[doc =
7035 "GPIO40 peripheral singleton"] GPIO40 <= virtual()), (@ peri_type #[doc =
7036 "GPIO41 peripheral singleton"] GPIO41 <= virtual()), (@ peri_type #[doc =
7037 "GPIO42 peripheral singleton"] GPIO42 <= virtual()), (@ peri_type #[doc =
7038 "GPIO43 peripheral singleton"] GPIO43 <= virtual()), (@ peri_type #[doc =
7039 "GPIO44 peripheral singleton"] GPIO44 <= virtual()), (@ peri_type #[doc =
7040 "GPIO45 peripheral singleton"] GPIO45 <= virtual()), (@ peri_type #[doc =
7041 "GPIO46 peripheral singleton"] GPIO46 <= virtual()), (@ peri_type #[doc =
7042 "GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
7043 "GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
7044 "GPIO49 peripheral singleton"] GPIO49 <= virtual()), (@ peri_type #[doc =
7045 "GPIO50 peripheral singleton"] GPIO50 <= virtual()), (@ peri_type #[doc =
7046 "GPIO51 peripheral singleton"] GPIO51 <= virtual()), (@ peri_type #[doc =
7047 "GPIO52 peripheral singleton"] GPIO52 <= virtual()), (@ peri_type #[doc =
7048 "GPIO53 peripheral singleton"] GPIO53 <= virtual()), (@ peri_type #[doc =
7049 "GPIO54 peripheral singleton"] GPIO54 <= virtual()), (@ peri_type #[doc =
7050 "DMA_CH0 peripheral singleton"] DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : {
7051 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7052 AHB_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7053 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7054 "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
7055 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7056 AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7057 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7058 "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual(AHB_PDMA_IN_CH2 : {
7059 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7060 AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7061 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7062 "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <= virtual(AXI_PDMA_IN_CH0 : {
7063 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7064 AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7065 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7066 "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <= virtual(AXI_PDMA_IN_CH1 : {
7067 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7068 AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7069 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7070 "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <= virtual(AXI_PDMA_IN_CH2 : {
7071 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
7072 AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
7073 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
7074 "VDMA_CH0 peripheral singleton"] VDMA_CH0 <= virtual() (unstable)), (@ peri_type
7075 #[doc = "VDMA_CH1 peripheral singleton"] VDMA_CH1 <= virtual() (unstable)), (@
7076 peri_type #[doc = "VDMA_CH2 peripheral singleton"] VDMA_CH2 <= virtual()
7077 (unstable)), (@ peri_type #[doc = "VDMA_CH3 peripheral singleton"] VDMA_CH3 <=
7078 virtual() (unstable)), (@ peri_type #[doc = "PCNT0_UNIT0 peripheral singleton"]
7079 PCNT0_UNIT0 <= virtual() (unstable)), (@ peri_type #[doc =
7080 "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual() (unstable)), (@
7081 peri_type #[doc = "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual()
7082 (unstable)), (@ peri_type #[doc = "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3
7083 <= virtual() (unstable)), (@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
7084 SDM_CH0 <= virtual() (unstable)), (@ peri_type #[doc =
7085 "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)), (@ peri_type
7086 #[doc = "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual() (unstable)), (@
7087 peri_type #[doc = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual()
7088 (unstable)), (@ peri_type #[doc = "SDM_CH4 peripheral singleton"] SDM_CH4 <=
7089 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH5 peripheral singleton"]
7090 SDM_CH5 <= virtual() (unstable)), (@ peri_type #[doc =
7091 "SDM_CH6 peripheral singleton"] SDM_CH6 <= virtual() (unstable)), (@ peri_type
7092 #[doc = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)), (@
7093 peri_type #[doc = "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@
7094 peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)), (@
7095 peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD()
7096 (unstable)), (@ peri_type #[doc = "SYSTEM peripheral singleton"] SYSTEM <=
7097 HP_SYS() (unstable)), (@ peri_type #[doc = "HP_SYS peripheral singleton"] HP_SYS
7098 <= HP_SYS() (unstable)), (@ peri_type #[doc =
7099 "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
7100 (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <= LP_TRNG()
7101 (unstable)), (@ peri_type #[doc = "INTERRUPT_CORE0 peripheral singleton"]
7102 INTERRUPT_CORE0 <= INTERRUPT_CORE0() (unstable)), (@ peri_type #[doc =
7103 "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
7104 (unstable)), (@ peri_type #[doc = "LP_I2C_ANA_MST peripheral singleton"]
7105 LP_I2C_ANA_MST <= LP_I2C_ANA_MST() (unstable)), (@ peri_type #[doc =
7106 "CACHE peripheral singleton"] CACHE <= CACHE() (unstable)), (@ peri_type #[doc =
7107 "CLIC peripheral singleton"] CLIC <= CLIC() (unstable)), (@ peri_type #[doc =
7108 "CLINT peripheral singleton"] CLINT <= CLINT() (unstable)), (@ peri_type #[doc =
7109 "CLINT_OTHER_CORE peripheral singleton"] CLINT_OTHER_CORE <= CLINT_OTHER_CORE()
7110 (unstable)), (@ peri_type #[doc = "IO_MUX peripheral singleton"] IO_MUX <=
7111 IO_MUX() (unstable)), (@ peri_type #[doc = "IOMUX_MSPI_PIN peripheral singleton"]
7112 IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN() (unstable)), (@ peri_type #[doc =
7113 "LP_I2C0 peripheral singleton"] LP_I2C0 <= LP_I2C0() (unstable)), (@ peri_type
7114 #[doc = "LP_AON peripheral singleton"] LP_AON <= LP_SYS() (unstable)), (@
7115 peri_type #[doc = "LP_AON_CLKRST peripheral singleton"] LP_AON_CLKRST <=
7116 LP_AON_CLKRST() (unstable)), (@ peri_type #[doc = "LP_SYS peripheral singleton"]
7117 LP_SYS <= LP_SYS() (unstable)), (@ peri_type #[doc =
7118 "LP_GPIO peripheral singleton"] LP_GPIO <= LP_GPIO() (unstable)), (@ peri_type
7119 #[doc = "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)),
7120 (@ peri_type #[doc = "LP_PERI peripheral singleton"] LP_PERI <= LP_PERI()
7121 (unstable)), (@ peri_type #[doc = "RTC_TIMER peripheral singleton"] RTC_TIMER <=
7122 LP_TIMER() (unstable)), (@ peri_type #[doc = "LP_WDT peripheral singleton"]
7123 LP_WDT <= LP_WDT() (unstable)), (@ peri_type #[doc = "LPWR peripheral singleton"]
7124 LPWR <= LP_SYS() (unstable)), (@ peri_type #[doc = "PMU peripheral singleton"]
7125 PMU <= PMU() (unstable)), (@ peri_type #[doc = "PAU peripheral singleton"] PAU <=
7126 PAU() (unstable)), (@ peri_type #[doc = "SYSTIMER peripheral singleton"] SYSTIMER
7127 <= SYSTIMER() (unstable)), (@ peri_type #[doc = "TIMG0 peripheral singleton"]
7128 TIMG0 <= TIMG0() (unstable)), (@ peri_type #[doc = "TIMG1 peripheral singleton"]
7129 TIMG1 <= TIMG1() (unstable)), (@ peri_type #[doc = "UART0 peripheral singleton"]
7130 UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
7131 disable_peri_interrupt })), (@ peri_type #[doc = "UART1 peripheral singleton"]
7132 UART1 <= UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
7133 disable_peri_interrupt })), (@ peri_type #[doc = "UART2 peripheral singleton"]
7134 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
7135 disable_peri_interrupt })), (@ peri_type #[doc = "UART3 peripheral singleton"]
7136 UART3 <= UART3(UART3 : { bind_peri_interrupt, enable_peri_interrupt,
7137 disable_peri_interrupt })), (@ peri_type #[doc = "UART4 peripheral singleton"]
7138 UART4 <= UART4(UART4 : { bind_peri_interrupt, enable_peri_interrupt,
7139 disable_peri_interrupt })), (@ peri_type #[doc = "UHCI0 peripheral singleton"]
7140 UHCI0 <= UHCI0() (unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"]
7141 SPI0 <= SPI0() (unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"]
7142 SPI1 <= SPI1() (unstable)), (@ peri_type #[doc = "MEMSPI2 peripheral singleton"]
7143 MEMSPI2 <= MEMSPI2() (unstable)), (@ peri_type #[doc =
7144 "MEMSPI3 peripheral singleton"] MEMSPI3 <= MEMSPI3() (unstable)), (@ peri_type
7145 #[doc = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
7146 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
7147 "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : { bind_peri_interrupt,
7148 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
7149 "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0 : { bind_peri_interrupt,
7150 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
7151 "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C1 : { bind_peri_interrupt,
7152 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
7153 "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
7154 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7155 = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
7156 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7157 = "I2S2 peripheral singleton"] I2S2 <= I2S2(I2S2 : { bind_peri_interrupt,
7158 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7159 = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0(TWAI0 : { bind_peri_interrupt,
7160 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7161 = "TWAI1 peripheral singleton"] TWAI1 <= TWAI1(TWAI1 : { bind_peri_interrupt,
7162 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7163 = "TWAI2 peripheral singleton"] TWAI2 <= TWAI2(TWAI2 : { bind_peri_interrupt,
7164 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7165 = "DMA peripheral singleton"] DMA <= AHB_DMA() (unstable)), (@ peri_type #[doc =
7166 "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)), (@ peri_type
7167 #[doc = "ETH peripheral singleton"] ETH <= virtual(ETH_MAC : {
7168 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7169 (unstable)), (@ peri_type #[doc = "EMAC_DMA peripheral singleton"] EMAC_DMA <=
7170 GMAC_DMA() (unstable)), (@ peri_type #[doc = "EMAC_MAC peripheral singleton"]
7171 EMAC_MAC <= GMAC() (unstable)), (@ peri_type #[doc =
7172 "MIPI_DSI peripheral singleton"] MIPI_DSI <= virtual(DSI_BRIDGE : {
7173 bind_bridge_interrupt, enable_bridge_interrupt, disable_bridge_interrupt }, DSI :
7174 { bind_dsi_interrupt, enable_dsi_interrupt, disable_dsi_interrupt }) (unstable)),
7175 (@ peri_type #[doc = "VDMA peripheral singleton"] VDMA <= DMA() (unstable)), (@
7176 peri_type #[doc = "MIPI_DSI_HOST peripheral singleton"] MIPI_DSI_HOST <=
7177 MIPI_DSI_HOST() (unstable)), (@ peri_type #[doc =
7178 "MIPI_DSI_BRIDGE peripheral singleton"] MIPI_DSI_BRIDGE <= MIPI_DSI_BRIDGE()
7179 (unstable)), (@ peri_type #[doc = "USB_DEVICE peripheral singleton"] USB_DEVICE
7180 <= USB_DEVICE(USB_DEVICE : { bind_peri_interrupt, enable_peri_interrupt,
7181 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
7182 "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)), (@ peri_type #[doc
7183 = "LEDC peripheral singleton"] LEDC <= LEDC(LEDC : { bind_peri_interrupt,
7184 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7185 = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0(PWM0 : { bind_peri_interrupt,
7186 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7187 = "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1(PWM1 : { bind_peri_interrupt,
7188 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7189 = "PCNT peripheral singleton"] PCNT <= PCNT(PCNT : { bind_peri_interrupt,
7190 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7191 = "APB_SARADC peripheral singleton"] APB_SARADC <= ADC() (unstable)), (@
7192 peri_type #[doc = "LP_ADC peripheral singleton"] LP_ADC <= LP_ADC() (unstable)),
7193 (@ peri_type #[doc = "RMT peripheral singleton"] RMT <= RMT(RMT : {
7194 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7195 (unstable)), (@ peri_type #[doc = "AES peripheral singleton"] AES <= AES(AES : {
7196 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7197 (unstable)), (@ peri_type #[doc = "SHA peripheral singleton"] SHA <= SHA(SHA : {
7198 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7199 (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <= RSA(RSA : {
7200 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7201 (unstable)), (@ peri_type #[doc = "ECC peripheral singleton"] ECC <= ECC(ECC : {
7202 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
7203 (unstable)), (@ peri_type #[doc = "USB_FS peripheral singleton"] USB_FS <=
7204 USB_FS(USB_FS : { bind_peri_interrupt, enable_peri_interrupt,
7205 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
7206 "USB_HS peripheral singleton"] USB_HS <= USB_HS(USB_HS : { bind_peri_interrupt,
7207 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
7208 = "USB_WRAP peripheral singleton"] USB_WRAP <= USB_WRAP() (unstable)), (@
7209 peri_type #[doc = "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)), (@
7210 peri_type #[doc = "ADC2 peripheral singleton"] ADC2 <= virtual() (unstable)), (@
7211 peri_type #[doc = "FLASH peripheral singleton"] FLASH <= virtual() (unstable)),
7212 (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
7213 (unstable)), (@ peri_type #[doc = "GPIO_DEDICATED peripheral singleton"]
7214 GPIO_DEDICATED <= virtual() (unstable)), (@ peri_type #[doc =
7215 "CPU_CTRL peripheral singleton"] CPU_CTRL <= virtual() (unstable)), (@ peri_type
7216 #[doc = "IPC peripheral singleton"] IPC <= virtual() (unstable)), (@ peri_type
7217 #[doc = "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual()
7218 (unstable)), (@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"]
7219 FROM_CPU_INTR1 <= virtual() (unstable)), (@ peri_type #[doc =
7220 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
7221 (@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
7222 virtual() (unstable)))); _for_each_inner_peripheral!((singletons(GPIO0), (GPIO1),
7223 (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6), (GPIO7), (GPIO8), (GPIO9), (GPIO10),
7224 (GPIO11), (GPIO12), (GPIO13), (GPIO14), (GPIO15), (GPIO16), (GPIO17), (GPIO18),
7225 (GPIO19), (GPIO20), (GPIO21), (GPIO22), (GPIO23), (GPIO24), (GPIO25), (GPIO26),
7226 (GPIO27), (GPIO28), (GPIO29), (GPIO30), (GPIO31), (GPIO32), (GPIO33), (GPIO34),
7227 (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39), (GPIO40), (GPIO41), (GPIO42),
7228 (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47), (GPIO48), (GPIO49), (GPIO50),
7229 (GPIO51), (GPIO52), (GPIO53), (GPIO54), (DMA_CH0(unstable)), (DMA_CH1(unstable)),
7230 (DMA_CH2(unstable)), (DMA_AXI_CH0(unstable)), (DMA_AXI_CH1(unstable)),
7231 (DMA_AXI_CH2(unstable)), (VDMA_CH0(unstable)), (VDMA_CH1(unstable)),
7232 (VDMA_CH2(unstable)), (VDMA_CH3(unstable)), (PCNT0_UNIT0(unstable)),
7233 (PCNT0_UNIT1(unstable)), (PCNT0_UNIT2(unstable)), (PCNT0_UNIT3(unstable)),
7234 (SDM_CH0(unstable)), (SDM_CH1(unstable)), (SDM_CH2(unstable)),
7235 (SDM_CH3(unstable)), (SDM_CH4(unstable)), (SDM_CH5(unstable)),
7236 (SDM_CH6(unstable)), (SDM_CH7(unstable)), (GPIO(unstable)), (GPIO_SD(unstable)),
7237 (SYSTEM(unstable)), (HP_SYS(unstable)), (HP_SYS_CLKRST(unstable)),
7238 (RNG(unstable)), (INTERRUPT_CORE0(unstable)), (INTERRUPT_CORE1(unstable)),
7239 (LP_I2C_ANA_MST(unstable)), (CLIC(unstable)), (CLINT(unstable)),
7240 (CLINT_OTHER_CORE(unstable)), (IO_MUX(unstable)), (LP_I2C0(unstable)),
7241 (LP_AON(unstable)), (LP_AON_CLKRST(unstable)), (LP_SYS(unstable)),
7242 (LP_GPIO(unstable)), (LP_IO_MUX(unstable)), (LP_PERI(unstable)),
7243 (RTC_TIMER(unstable)), (LP_WDT(unstable)), (LPWR(unstable)), (PMU(unstable)),
7244 (PAU(unstable)), (SYSTIMER(unstable)), (TIMG0(unstable)), (TIMG1(unstable)),
7245 (UART0), (UART1), (UART2), (UART3), (UART4), (UHCI0(unstable)), (SPI2), (SPI3),
7246 (I2C0), (I2C1), (I2S0(unstable)), (I2S1(unstable)), (I2S2(unstable)),
7247 (TWAI0(unstable)), (TWAI1(unstable)), (TWAI2(unstable)), (DMA(unstable)),
7248 (AXI_GDMA(unstable)), (ETH(unstable)), (MIPI_DSI(unstable)),
7249 (USB_DEVICE(unstable)), (SDHOST(unstable)), (LEDC(unstable)), (MCPWM0(unstable)),
7250 (MCPWM1(unstable)), (PCNT(unstable)), (APB_SARADC(unstable)), (LP_ADC(unstable)),
7251 (RMT(unstable)), (AES(unstable)), (SHA(unstable)), (RSA(unstable)),
7252 (ECC(unstable)), (USB_FS(unstable)), (USB_HS(unstable)), (ADC1(unstable)),
7253 (ADC2(unstable)), (FLASH(unstable)), (PSRAM(unstable)),
7254 (GPIO_DEDICATED(unstable)), (CPU_CTRL(unstable)), (IPC(unstable)),
7255 (FROM_CPU_INTR0(unstable)), (FROM_CPU_INTR1(unstable)),
7256 (FROM_CPU_INTR2(unstable)), (FROM_CPU_INTR3(unstable))));
7257 _for_each_inner_peripheral!((dma_eligible(SPI2, Spi2, 1, AxiGdmaChannel), (UHCI0,
7258 Uhci0, 2, AhbGdmaChannel), (SPI3, Spi3, 2, AxiGdmaChannel), (I2S0, I2s0, 3,
7259 AhbGdmaChannel), (I2S1, I2s1, 4, AhbGdmaChannel), (AES, Aes, 4, AxiGdmaChannel),
7260 (I2S2, I2s2, 5, AhbGdmaChannel), (SHA, Sha, 5, AxiGdmaChannel)));
7261 };
7262}
7263#[macro_export]
7290#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7291macro_rules! for_each_gpio {
7292 ($($pattern:tt => $code:tt;)*) => {
7293 macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
7294 } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
7295 _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
7296 _for_each_inner_gpio!((2, GPIO2(_0 => MTCK) (_0 => MTCK) ([Input] [Output])));
7297 _for_each_inner_gpio!((3, GPIO3(_0 => MTDI) (_0 => MTDI) ([Input] [Output])));
7298 _for_each_inner_gpio!((4, GPIO4(_0 => MTMS) (_0 => MTMS) ([Input] [Output])));
7299 _for_each_inner_gpio!((5, GPIO5(_0 => MTDO) (_0 => MTDO) ([Input] [Output])));
7300 _for_each_inner_gpio!((6, GPIO6(_3 => SPI2_HOLD) (_3 => SPI2_HOLD) ([Input]
7301 [Output]))); _for_each_inner_gpio!((7, GPIO7(_3 => SPI2_CS) (_3 => SPI2_CS)
7302 ([Input] [Output]))); _for_each_inner_gpio!((8, GPIO8(_3 => SPI2_D) (_2 =>
7303 UART0_RTS _3 => SPI2_D) ([Input] [Output]))); _for_each_inner_gpio!((9, GPIO9(_2
7304 => UART0_CTS _3 => SPI2_CK) (_3 => SPI2_CK) ([Input] [Output])));
7305 _for_each_inner_gpio!((10, GPIO10(_3 => SPI2_Q) (_2 => UART1_TXD _3 => SPI2_Q)
7306 ([Input] [Output]))); _for_each_inner_gpio!((11, GPIO11(_2 => UART1_RXD _3 =>
7307 SPI2_WP) (_3 => SPI2_WP) ([Input] [Output]))); _for_each_inner_gpio!((12,
7308 GPIO12() (_2 => UART1_RTS) ([Input] [Output]))); _for_each_inner_gpio!((13,
7309 GPIO13(_2 => UART1_CTS) () ([Input] [Output]))); _for_each_inner_gpio!((14,
7310 GPIO14() () ([Input] [Output]))); _for_each_inner_gpio!((15, GPIO15() () ([Input]
7311 [Output]))); _for_each_inner_gpio!((16, GPIO16() () ([Input] [Output])));
7312 _for_each_inner_gpio!((17, GPIO17() () ([Input] [Output])));
7313 _for_each_inner_gpio!((18, GPIO18() () ([Input] [Output])));
7314 _for_each_inner_gpio!((19, GPIO19() () ([Input] [Output])));
7315 _for_each_inner_gpio!((20, GPIO20() () ([Input] [Output])));
7316 _for_each_inner_gpio!((21, GPIO21() () ([Input] [Output])));
7317 _for_each_inner_gpio!((22, GPIO22(_4 => DBG_PSRAM_CK) (_4 => DBG_PSRAM_CK)
7318 ([Input] [Output]))); _for_each_inner_gpio!((23, GPIO23(_3 => REF_50M_CLK _4 =>
7319 DBG_PSRAM_CS) (_3 => REF_50M_CLK _4 => DBG_PSRAM_CS) ([Input] [Output])));
7320 _for_each_inner_gpio!((24, GPIO24() () ([Input] [Output])));
7321 _for_each_inner_gpio!((25, GPIO25() () ([Input] [Output])));
7322 _for_each_inner_gpio!((26, GPIO26() () ([Input] [Output])));
7323 _for_each_inner_gpio!((27, GPIO27() () ([Input] [Output])));
7324 _for_each_inner_gpio!((28, GPIO28(_2 => SPI2_CS _3 => EMAC_RXDV _4 =>
7325 DBG_PSRAM_D) (_2 => SPI2_CS _4 => DBG_PSRAM_D) ([Input] [Output])));
7326 _for_each_inner_gpio!((29, GPIO29(_2 => SPI2_D _3 => EMAC_RXD0 _4 => DBG_PSRAM_Q)
7327 (_2 => SPI2_D _4 => DBG_PSRAM_Q) ([Input] [Output]))); _for_each_inner_gpio!((30,
7328 GPIO30(_2 => SPI2_CK _3 => EMAC_RXD1 _4 => DBG_PSRAM_WP) (_2 => SPI2_CK _4 =>
7329 DBG_PSRAM_WP) ([Input] [Output]))); _for_each_inner_gpio!((31, GPIO31(_2 =>
7330 SPI2_Q _3 => EMAC_RXER _4 => DBG_PSRAM_HOLD) (_2 => SPI2_Q _4 => DBG_PSRAM_HOLD)
7331 ([Input] [Output]))); _for_each_inner_gpio!((32, GPIO32(_2 => SPI2_HOLD _3 =>
7332 EMAC_RMII_CLK _4 => DBG_PSRAM_DQ4) (_2 => SPI2_HOLD _3 => EMAC_RMII_CLK _4 =>
7333 DBG_PSRAM_DQ4) ([Input] [Output]))); _for_each_inner_gpio!((33, GPIO33(_2 =>
7334 SPI2_WP _4 => DBG_PSRAM_DQ5) (_2 => SPI2_WP _3 => EMAC_TXEN _4 => DBG_PSRAM_DQ5)
7335 ([Input] [Output]))); _for_each_inner_gpio!((34, GPIO34(_2 => SPI2_IO4 _4 =>
7336 DBG_PSRAM_DQ6) (_2 => SPI2_IO4 _3 => EMAC_TXD0 _4 => DBG_PSRAM_DQ6) ([Input]
7337 [Output]))); _for_each_inner_gpio!((35, GPIO35(_2 => SPI2_IO5 _4 =>
7338 DBG_PSRAM_DQ7) (_2 => SPI2_IO5 _3 => EMAC_TXD1 _4 => DBG_PSRAM_DQ7) ([Input]
7339 [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => SPI2_IO6 _4 =>
7340 DBG_PSRAM_DQS_0) (_2 => SPI2_IO6 _3 => EMAC_TXER _4 => DBG_PSRAM_DQS_0) ([Input]
7341 [Output]))); _for_each_inner_gpio!((37, GPIO37(_2 => SPI2_IO7) (_0 => UART0_TXD
7342 _2 => SPI2_IO7) ([Input] [Output]))); _for_each_inner_gpio!((38, GPIO38(_0 =>
7343 UART0_RXD _2 => SPI2_DQS) (_2 => SPI2_DQS) ([Input] [Output])));
7344 _for_each_inner_gpio!((39, GPIO39(_0 => SD1_DATA0 _2 => BIST _3 => REF_50M_CLK _4
7345 => DBG_PSRAM_DQ8) (_0 => SD1_DATA0 _2 => BIST _3 => REF_50M_CLK _4 =>
7346 DBG_PSRAM_DQ8) ([Input] [Output]))); _for_each_inner_gpio!((40, GPIO40(_0 =>
7347 SD1_DATA1 _2 => BIST _4 => DBG_PSRAM_DQ9) (_0 => SD1_DATA1 _2 => BIST _3 =>
7348 EMAC_TXEN _4 => DBG_PSRAM_DQ9) ([Input] [Output]))); _for_each_inner_gpio!((41,
7349 GPIO41(_0 => SD1_DATA2 _2 => BIST _4 => DBG_PSRAM_DQ10) (_0 => SD1_DATA2 _2 =>
7350 BIST _3 => EMAC_TXD0 _4 => DBG_PSRAM_DQ10) ([Input] [Output])));
7351 _for_each_inner_gpio!((42, GPIO42(_0 => SD1_DATA3 _2 => BIST _4 =>
7352 DBG_PSRAM_DQ11) (_0 => SD1_DATA3 _2 => BIST _3 => EMAC_TXD1 _4 => DBG_PSRAM_DQ11)
7353 ([Input] [Output]))); _for_each_inner_gpio!((43, GPIO43(_0 => SD1_CLK _2 => BIST
7354 _4 => DBG_PSRAM_DQ12) (_0 => SD1_CLK _2 => BIST _3 => EMAC_TXER _4 =>
7355 DBG_PSRAM_DQ12) ([Input] [Output]))); _for_each_inner_gpio!((44, GPIO44(_0 =>
7356 SD1_CMD _2 => BIST _3 => EMAC_RMII_CLK _4 => DBG_PSRAM_DQ13) (_0 => SD1_CMD _2 =>
7357 BIST _3 => EMAC_RMII_CLK _4 => DBG_PSRAM_DQ13) ([Input] [Output])));
7358 _for_each_inner_gpio!((45, GPIO45(_0 => SD1_DATA4 _2 => BIST _3 => EMAC_RXDV _4
7359 => DBG_PSRAM_DQ14) (_0 => SD1_DATA4 _2 => BIST _4 => DBG_PSRAM_DQ14) ([Input]
7360 [Output]))); _for_each_inner_gpio!((46, GPIO46(_0 => SD1_DATA5 _2 => BIST _3 =>
7361 EMAC_RXD0 _4 => DBG_PSRAM_DQ15) (_0 => SD1_DATA5 _2 => BIST _4 => DBG_PSRAM_DQ15)
7362 ([Input] [Output]))); _for_each_inner_gpio!((47, GPIO47(_0 => SD1_DATA6 _2 =>
7363 BIST _3 => EMAC_RXD1 _4 => DBG_PSRAM_DQS_1) (_0 => SD1_DATA6 _2 => BIST _4 =>
7364 DBG_PSRAM_DQS_1) ([Input] [Output]))); _for_each_inner_gpio!((48, GPIO48(_0 =>
7365 SD1_DATA7 _2 => BIST _3 => EMAC_RXER) (_0 => SD1_DATA7 _2 => BIST) ([Input]
7366 [Output]))); _for_each_inner_gpio!((49, GPIO49(_4 => DBG_FLASH_CS) (_3 =>
7367 EMAC_TXEN _4 => DBG_FLASH_CS) ([Input] [Output]))); _for_each_inner_gpio!((50,
7368 GPIO50(_3 => EMAC_RMII_CLK _4 => DBG_FLASH_Q) (_3 => EMAC_RMII_CLK _4 =>
7369 DBG_FLASH_Q) ([Input] [Output]))); _for_each_inner_gpio!((51, GPIO51(_3 =>
7370 EMAC_RXDV _4 => DBG_FLASH_WP) (_4 => DBG_FLASH_WP) ([Input] [Output])));
7371 _for_each_inner_gpio!((52, GPIO52(_3 => EMAC_RXD0 _4 => DBG_FLASH_HOLD) (_4 =>
7372 DBG_FLASH_HOLD) ([Input] [Output]))); _for_each_inner_gpio!((53, GPIO53(_3 =>
7373 EMAC_RXD1 _4 => DBG_FLASH_CK) (_4 => DBG_FLASH_CK) ([Input] [Output])));
7374 _for_each_inner_gpio!((54, GPIO54(_3 => EMAC_RXER _4 => DBG_FLASH_D) (_4 =>
7375 DBG_FLASH_D) ([Input] [Output]))); _for_each_inner_gpio!((all(0, GPIO0() ()
7376 ([Input] [Output])), (1, GPIO1() () ([Input] [Output])), (2, GPIO2(_0 => MTCK)
7377 (_0 => MTCK) ([Input] [Output])), (3, GPIO3(_0 => MTDI) (_0 => MTDI) ([Input]
7378 [Output])), (4, GPIO4(_0 => MTMS) (_0 => MTMS) ([Input] [Output])), (5, GPIO5(_0
7379 => MTDO) (_0 => MTDO) ([Input] [Output])), (6, GPIO6(_3 => SPI2_HOLD) (_3 =>
7380 SPI2_HOLD) ([Input] [Output])), (7, GPIO7(_3 => SPI2_CS) (_3 => SPI2_CS) ([Input]
7381 [Output])), (8, GPIO8(_3 => SPI2_D) (_2 => UART0_RTS _3 => SPI2_D) ([Input]
7382 [Output])), (9, GPIO9(_2 => UART0_CTS _3 => SPI2_CK) (_3 => SPI2_CK) ([Input]
7383 [Output])), (10, GPIO10(_3 => SPI2_Q) (_2 => UART1_TXD _3 => SPI2_Q) ([Input]
7384 [Output])), (11, GPIO11(_2 => UART1_RXD _3 => SPI2_WP) (_3 => SPI2_WP) ([Input]
7385 [Output])), (12, GPIO12() (_2 => UART1_RTS) ([Input] [Output])), (13, GPIO13(_2
7386 => UART1_CTS) () ([Input] [Output])), (14, GPIO14() () ([Input] [Output])), (15,
7387 GPIO15() () ([Input] [Output])), (16, GPIO16() () ([Input] [Output])), (17,
7388 GPIO17() () ([Input] [Output])), (18, GPIO18() () ([Input] [Output])), (19,
7389 GPIO19() () ([Input] [Output])), (20, GPIO20() () ([Input] [Output])), (21,
7390 GPIO21() () ([Input] [Output])), (22, GPIO22(_4 => DBG_PSRAM_CK) (_4 =>
7391 DBG_PSRAM_CK) ([Input] [Output])), (23, GPIO23(_3 => REF_50M_CLK _4 =>
7392 DBG_PSRAM_CS) (_3 => REF_50M_CLK _4 => DBG_PSRAM_CS) ([Input] [Output])), (24,
7393 GPIO24() () ([Input] [Output])), (25, GPIO25() () ([Input] [Output])), (26,
7394 GPIO26() () ([Input] [Output])), (27, GPIO27() () ([Input] [Output])), (28,
7395 GPIO28(_2 => SPI2_CS _3 => EMAC_RXDV _4 => DBG_PSRAM_D) (_2 => SPI2_CS _4 =>
7396 DBG_PSRAM_D) ([Input] [Output])), (29, GPIO29(_2 => SPI2_D _3 => EMAC_RXD0 _4 =>
7397 DBG_PSRAM_Q) (_2 => SPI2_D _4 => DBG_PSRAM_Q) ([Input] [Output])), (30, GPIO30(_2
7398 => SPI2_CK _3 => EMAC_RXD1 _4 => DBG_PSRAM_WP) (_2 => SPI2_CK _4 => DBG_PSRAM_WP)
7399 ([Input] [Output])), (31, GPIO31(_2 => SPI2_Q _3 => EMAC_RXER _4 =>
7400 DBG_PSRAM_HOLD) (_2 => SPI2_Q _4 => DBG_PSRAM_HOLD) ([Input] [Output])), (32,
7401 GPIO32(_2 => SPI2_HOLD _3 => EMAC_RMII_CLK _4 => DBG_PSRAM_DQ4) (_2 => SPI2_HOLD
7402 _3 => EMAC_RMII_CLK _4 => DBG_PSRAM_DQ4) ([Input] [Output])), (33, GPIO33(_2 =>
7403 SPI2_WP _4 => DBG_PSRAM_DQ5) (_2 => SPI2_WP _3 => EMAC_TXEN _4 => DBG_PSRAM_DQ5)
7404 ([Input] [Output])), (34, GPIO34(_2 => SPI2_IO4 _4 => DBG_PSRAM_DQ6) (_2 =>
7405 SPI2_IO4 _3 => EMAC_TXD0 _4 => DBG_PSRAM_DQ6) ([Input] [Output])), (35, GPIO35(_2
7406 => SPI2_IO5 _4 => DBG_PSRAM_DQ7) (_2 => SPI2_IO5 _3 => EMAC_TXD1 _4 =>
7407 DBG_PSRAM_DQ7) ([Input] [Output])), (36, GPIO36(_2 => SPI2_IO6 _4 =>
7408 DBG_PSRAM_DQS_0) (_2 => SPI2_IO6 _3 => EMAC_TXER _4 => DBG_PSRAM_DQS_0) ([Input]
7409 [Output])), (37, GPIO37(_2 => SPI2_IO7) (_0 => UART0_TXD _2 => SPI2_IO7) ([Input]
7410 [Output])), (38, GPIO38(_0 => UART0_RXD _2 => SPI2_DQS) (_2 => SPI2_DQS) ([Input]
7411 [Output])), (39, GPIO39(_0 => SD1_DATA0 _2 => BIST _3 => REF_50M_CLK _4 =>
7412 DBG_PSRAM_DQ8) (_0 => SD1_DATA0 _2 => BIST _3 => REF_50M_CLK _4 => DBG_PSRAM_DQ8)
7413 ([Input] [Output])), (40, GPIO40(_0 => SD1_DATA1 _2 => BIST _4 => DBG_PSRAM_DQ9)
7414 (_0 => SD1_DATA1 _2 => BIST _3 => EMAC_TXEN _4 => DBG_PSRAM_DQ9) ([Input]
7415 [Output])), (41, GPIO41(_0 => SD1_DATA2 _2 => BIST _4 => DBG_PSRAM_DQ10) (_0 =>
7416 SD1_DATA2 _2 => BIST _3 => EMAC_TXD0 _4 => DBG_PSRAM_DQ10) ([Input] [Output])),
7417 (42, GPIO42(_0 => SD1_DATA3 _2 => BIST _4 => DBG_PSRAM_DQ11) (_0 => SD1_DATA3 _2
7418 => BIST _3 => EMAC_TXD1 _4 => DBG_PSRAM_DQ11) ([Input] [Output])), (43, GPIO43(_0
7419 => SD1_CLK _2 => BIST _4 => DBG_PSRAM_DQ12) (_0 => SD1_CLK _2 => BIST _3 =>
7420 EMAC_TXER _4 => DBG_PSRAM_DQ12) ([Input] [Output])), (44, GPIO44(_0 => SD1_CMD _2
7421 => BIST _3 => EMAC_RMII_CLK _4 => DBG_PSRAM_DQ13) (_0 => SD1_CMD _2 => BIST _3 =>
7422 EMAC_RMII_CLK _4 => DBG_PSRAM_DQ13) ([Input] [Output])), (45, GPIO45(_0 =>
7423 SD1_DATA4 _2 => BIST _3 => EMAC_RXDV _4 => DBG_PSRAM_DQ14) (_0 => SD1_DATA4 _2 =>
7424 BIST _4 => DBG_PSRAM_DQ14) ([Input] [Output])), (46, GPIO46(_0 => SD1_DATA5 _2 =>
7425 BIST _3 => EMAC_RXD0 _4 => DBG_PSRAM_DQ15) (_0 => SD1_DATA5 _2 => BIST _4 =>
7426 DBG_PSRAM_DQ15) ([Input] [Output])), (47, GPIO47(_0 => SD1_DATA6 _2 => BIST _3 =>
7427 EMAC_RXD1 _4 => DBG_PSRAM_DQS_1) (_0 => SD1_DATA6 _2 => BIST _4 =>
7428 DBG_PSRAM_DQS_1) ([Input] [Output])), (48, GPIO48(_0 => SD1_DATA7 _2 => BIST _3
7429 => EMAC_RXER) (_0 => SD1_DATA7 _2 => BIST) ([Input] [Output])), (49, GPIO49(_4 =>
7430 DBG_FLASH_CS) (_3 => EMAC_TXEN _4 => DBG_FLASH_CS) ([Input] [Output])), (50,
7431 GPIO50(_3 => EMAC_RMII_CLK _4 => DBG_FLASH_Q) (_3 => EMAC_RMII_CLK _4 =>
7432 DBG_FLASH_Q) ([Input] [Output])), (51, GPIO51(_3 => EMAC_RXDV _4 => DBG_FLASH_WP)
7433 (_4 => DBG_FLASH_WP) ([Input] [Output])), (52, GPIO52(_3 => EMAC_RXD0 _4 =>
7434 DBG_FLASH_HOLD) (_4 => DBG_FLASH_HOLD) ([Input] [Output])), (53, GPIO53(_3 =>
7435 EMAC_RXD1 _4 => DBG_FLASH_CK) (_4 => DBG_FLASH_CK) ([Input] [Output])), (54,
7436 GPIO54(_3 => EMAC_RXER _4 => DBG_FLASH_D) (_4 => DBG_FLASH_D) ([Input]
7437 [Output]))));
7438 };
7439}
7440#[macro_export]
7467#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7468macro_rules! for_each_analog_function {
7469 ($($pattern:tt => $code:tt;)*) => {
7470 macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
7471 tt) => {} } _for_each_inner_analog_function!((ADC1_CH0, GPIO16));
7472 _for_each_inner_analog_function!((ADC1_CH1, GPIO17));
7473 _for_each_inner_analog_function!((ADC1_CH2, GPIO18));
7474 _for_each_inner_analog_function!((ADC1_CH3, GPIO19));
7475 _for_each_inner_analog_function!((ADC1_CH4, GPIO20));
7476 _for_each_inner_analog_function!((ADC1_CH5, GPIO21));
7477 _for_each_inner_analog_function!((ADC1_CH6, GPIO22));
7478 _for_each_inner_analog_function!((ADC1_CH7, GPIO23));
7479 _for_each_inner_analog_function!((USJ_DM, GPIO24));
7480 _for_each_inner_analog_function!((USJ_DP, GPIO25));
7481 _for_each_inner_analog_function!((USB_FS_DM, GPIO26));
7482 _for_each_inner_analog_function!((USB_FS_DP, GPIO27));
7483 _for_each_inner_analog_function!((ADC2_CH0, GPIO49));
7484 _for_each_inner_analog_function!((ADC2_CH1, GPIO50));
7485 _for_each_inner_analog_function!((ADC2_CH2, GPIO51));
7486 _for_each_inner_analog_function!((ADC2_CH3, GPIO52));
7487 _for_each_inner_analog_function!((ADC2_CH4, GPIO53));
7488 _for_each_inner_analog_function!((ADC2_CH5, GPIO54));
7489 _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO16));
7490 _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO17));
7491 _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO18));
7492 _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO19));
7493 _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO20));
7494 _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO21));
7495 _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO22));
7496 _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO23));
7497 _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO49));
7498 _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO50));
7499 _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO51));
7500 _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO52));
7501 _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO53));
7502 _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO54));
7503 _for_each_inner_analog_function!((all(ADC1_CH0, GPIO16), (ADC1_CH1, GPIO17),
7504 (ADC1_CH2, GPIO18), (ADC1_CH3, GPIO19), (ADC1_CH4, GPIO20), (ADC1_CH5, GPIO21),
7505 (ADC1_CH6, GPIO22), (ADC1_CH7, GPIO23), (USJ_DM, GPIO24), (USJ_DP, GPIO25),
7506 (USB_FS_DM, GPIO26), (USB_FS_DP, GPIO27), (ADC2_CH0, GPIO49), (ADC2_CH1, GPIO50),
7507 (ADC2_CH2, GPIO51), (ADC2_CH3, GPIO52), (ADC2_CH4, GPIO53), (ADC2_CH5, GPIO54)));
7508 _for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0, ADCn_CHm, 1, 0), GPIO16),
7509 ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO17), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO18),
7510 ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO19), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO20),
7511 ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO21), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO22),
7512 ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO23), ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO49),
7513 ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO50), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO51),
7514 ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO52), ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO53),
7515 ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO54)));
7516 };
7517}
7518#[macro_export]
7556#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7557macro_rules! for_each_lp_function {
7558 ($($pattern:tt => $code:tt;)*) => {
7559 macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
7560 => {} } _for_each_inner_lp_function!((LP_GPIO0, GPIO0, _1));
7561 _for_each_inner_lp_function!((LP_GPIO1, GPIO1, _1));
7562 _for_each_inner_lp_function!((LP_GPIO2, GPIO2, _1));
7563 _for_each_inner_lp_function!((LP_GPIO3, GPIO3, _1));
7564 _for_each_inner_lp_function!((LP_GPIO4, GPIO4, _1));
7565 _for_each_inner_lp_function!((LP_GPIO5, GPIO5, _1));
7566 _for_each_inner_lp_function!((LP_GPIO6, GPIO6, _1));
7567 _for_each_inner_lp_function!((LP_GPIO7, GPIO7, _1));
7568 _for_each_inner_lp_function!((LP_GPIO8, GPIO8, _1));
7569 _for_each_inner_lp_function!((LP_GPIO9, GPIO9, _1));
7570 _for_each_inner_lp_function!((LP_GPIO10, GPIO10, _1));
7571 _for_each_inner_lp_function!((LP_GPIO11, GPIO11, _1));
7572 _for_each_inner_lp_function!((LP_GPIO12, GPIO12, _1));
7573 _for_each_inner_lp_function!((LP_GPIO13, GPIO13, _1));
7574 _for_each_inner_lp_function!((LP_UART_TXD, GPIO14, _0));
7575 _for_each_inner_lp_function!((LP_GPIO14, GPIO14, _1));
7576 _for_each_inner_lp_function!((LP_UART_RXD, GPIO15, _0));
7577 _for_each_inner_lp_function!((LP_GPIO15, GPIO15, _1));
7578 _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _1, () ()));
7579 _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _1, () ()));
7580 _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _1, () ()));
7581 _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _1, () ()));
7582 _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _1, () ()));
7583 _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _1, () ()));
7584 _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO6, _1, () ()));
7585 _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO7, _1, () ()));
7586 _for_each_inner_lp_function!(((LP_GPIO8, LP_GPIOn, 8), GPIO8, _1, () ()));
7587 _for_each_inner_lp_function!(((LP_GPIO9, LP_GPIOn, 9), GPIO9, _1, () ()));
7588 _for_each_inner_lp_function!(((LP_GPIO10, LP_GPIOn, 10), GPIO10, _1, () ()));
7589 _for_each_inner_lp_function!(((LP_GPIO11, LP_GPIOn, 11), GPIO11, _1, () ()));
7590 _for_each_inner_lp_function!(((LP_GPIO12, LP_GPIOn, 12), GPIO12, _1, () ()));
7591 _for_each_inner_lp_function!(((LP_GPIO13, LP_GPIOn, 13), GPIO13, _1, () ()));
7592 _for_each_inner_lp_function!(((LP_GPIO14, LP_GPIOn, 14), GPIO14, _1, () (_0 =>
7593 LP_UART_TXD))); _for_each_inner_lp_function!(((LP_GPIO15, LP_GPIOn, 15), GPIO15,
7594 _1, (_0 => LP_UART_RXD) ())); _for_each_inner_lp_function!((all(LP_GPIO0, GPIO0,
7595 _1), (LP_GPIO1, GPIO1, _1), (LP_GPIO2, GPIO2, _1), (LP_GPIO3, GPIO3, _1),
7596 (LP_GPIO4, GPIO4, _1), (LP_GPIO5, GPIO5, _1), (LP_GPIO6, GPIO6, _1), (LP_GPIO7,
7597 GPIO7, _1), (LP_GPIO8, GPIO8, _1), (LP_GPIO9, GPIO9, _1), (LP_GPIO10, GPIO10,
7598 _1), (LP_GPIO11, GPIO11, _1), (LP_GPIO12, GPIO12, _1), (LP_GPIO13, GPIO13, _1),
7599 (LP_UART_TXD, GPIO14, _0), (LP_GPIO14, GPIO14, _1), (LP_UART_RXD, GPIO15, _0),
7600 (LP_GPIO15, GPIO15, _1))); _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0,
7601 LP_GPIOn, 0), GPIO0, _1, () ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _1, () ()),
7602 ((LP_GPIO2, LP_GPIOn, 2), GPIO2, _1, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _1,
7603 () ()), ((LP_GPIO4, LP_GPIOn, 4), GPIO4, _1, () ()), ((LP_GPIO5, LP_GPIOn, 5),
7604 GPIO5, _1, () ()), ((LP_GPIO6, LP_GPIOn, 6), GPIO6, _1, () ()), ((LP_GPIO7,
7605 LP_GPIOn, 7), GPIO7, _1, () ()), ((LP_GPIO8, LP_GPIOn, 8), GPIO8, _1, () ()),
7606 ((LP_GPIO9, LP_GPIOn, 9), GPIO9, _1, () ()), ((LP_GPIO10, LP_GPIOn, 10), GPIO10,
7607 _1, () ()), ((LP_GPIO11, LP_GPIOn, 11), GPIO11, _1, () ()), ((LP_GPIO12,
7608 LP_GPIOn, 12), GPIO12, _1, () ()), ((LP_GPIO13, LP_GPIOn, 13), GPIO13, _1, ()
7609 ()), ((LP_GPIO14, LP_GPIOn, 14), GPIO14, _1, () (_0 => LP_UART_TXD)),
7610 ((LP_GPIO15, LP_GPIOn, 15), GPIO15, _1, (_0 => LP_UART_RXD) ())));
7611 };
7612}
7613#[macro_export]
7644#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7645macro_rules! for_each_iomux_function {
7646 ($($pattern:tt => $code:tt;)*) => {
7647 macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
7648 tt) => {} } _for_each_inner_iomux_function!((MTCK, GPIO2, _0));
7649 _for_each_inner_iomux_function!((MTDI, GPIO3, _0));
7650 _for_each_inner_iomux_function!((MTMS, GPIO4, _0));
7651 _for_each_inner_iomux_function!((MTDO, GPIO5, _0));
7652 _for_each_inner_iomux_function!((SPI2_HOLD, GPIO6, _3));
7653 _for_each_inner_iomux_function!((SPI2_CS, GPIO7, _3));
7654 _for_each_inner_iomux_function!((UART0_RTS, GPIO8, _2));
7655 _for_each_inner_iomux_function!((SPI2_D, GPIO8, _3));
7656 _for_each_inner_iomux_function!((UART0_CTS, GPIO9, _2));
7657 _for_each_inner_iomux_function!((SPI2_CK, GPIO9, _3));
7658 _for_each_inner_iomux_function!((UART1_TXD, GPIO10, _2));
7659 _for_each_inner_iomux_function!((SPI2_Q, GPIO10, _3));
7660 _for_each_inner_iomux_function!((UART1_RXD, GPIO11, _2));
7661 _for_each_inner_iomux_function!((SPI2_WP, GPIO11, _3));
7662 _for_each_inner_iomux_function!((UART1_RTS, GPIO12, _2));
7663 _for_each_inner_iomux_function!((UART1_CTS, GPIO13, _2));
7664 _for_each_inner_iomux_function!((DBG_PSRAM_CK, GPIO22, _4));
7665 _for_each_inner_iomux_function!((REF_50M_CLK, GPIO23, _3));
7666 _for_each_inner_iomux_function!((DBG_PSRAM_CS, GPIO23, _4));
7667 _for_each_inner_iomux_function!((SPI2_CS, GPIO28, _2));
7668 _for_each_inner_iomux_function!((EMAC_RXDV, GPIO28, _3));
7669 _for_each_inner_iomux_function!((DBG_PSRAM_D, GPIO28, _4));
7670 _for_each_inner_iomux_function!((SPI2_D, GPIO29, _2));
7671 _for_each_inner_iomux_function!((EMAC_RXD0, GPIO29, _3));
7672 _for_each_inner_iomux_function!((DBG_PSRAM_Q, GPIO29, _4));
7673 _for_each_inner_iomux_function!((SPI2_CK, GPIO30, _2));
7674 _for_each_inner_iomux_function!((EMAC_RXD1, GPIO30, _3));
7675 _for_each_inner_iomux_function!((DBG_PSRAM_WP, GPIO30, _4));
7676 _for_each_inner_iomux_function!((SPI2_Q, GPIO31, _2));
7677 _for_each_inner_iomux_function!((EMAC_RXER, GPIO31, _3));
7678 _for_each_inner_iomux_function!((DBG_PSRAM_HOLD, GPIO31, _4));
7679 _for_each_inner_iomux_function!((SPI2_HOLD, GPIO32, _2));
7680 _for_each_inner_iomux_function!((EMAC_RMII_CLK, GPIO32, _3));
7681 _for_each_inner_iomux_function!((DBG_PSRAM_DQ4, GPIO32, _4));
7682 _for_each_inner_iomux_function!((SPI2_WP, GPIO33, _2));
7683 _for_each_inner_iomux_function!((EMAC_TXEN, GPIO33, _3));
7684 _for_each_inner_iomux_function!((DBG_PSRAM_DQ5, GPIO33, _4));
7685 _for_each_inner_iomux_function!((SPI2_IO4, GPIO34, _2));
7686 _for_each_inner_iomux_function!((EMAC_TXD0, GPIO34, _3));
7687 _for_each_inner_iomux_function!((DBG_PSRAM_DQ6, GPIO34, _4));
7688 _for_each_inner_iomux_function!((SPI2_IO5, GPIO35, _2));
7689 _for_each_inner_iomux_function!((EMAC_TXD1, GPIO35, _3));
7690 _for_each_inner_iomux_function!((DBG_PSRAM_DQ7, GPIO35, _4));
7691 _for_each_inner_iomux_function!((SPI2_IO6, GPIO36, _2));
7692 _for_each_inner_iomux_function!((EMAC_TXER, GPIO36, _3));
7693 _for_each_inner_iomux_function!((DBG_PSRAM_DQS_0, GPIO36, _4));
7694 _for_each_inner_iomux_function!((UART0_TXD, GPIO37, _0));
7695 _for_each_inner_iomux_function!((SPI2_IO7, GPIO37, _2));
7696 _for_each_inner_iomux_function!((UART0_RXD, GPIO38, _0));
7697 _for_each_inner_iomux_function!((SPI2_DQS, GPIO38, _2));
7698 _for_each_inner_iomux_function!((SD1_DATA0, GPIO39, _0));
7699 _for_each_inner_iomux_function!((BIST, GPIO39, _2));
7700 _for_each_inner_iomux_function!((REF_50M_CLK, GPIO39, _3));
7701 _for_each_inner_iomux_function!((DBG_PSRAM_DQ8, GPIO39, _4));
7702 _for_each_inner_iomux_function!((SD1_DATA1, GPIO40, _0));
7703 _for_each_inner_iomux_function!((BIST, GPIO40, _2));
7704 _for_each_inner_iomux_function!((EMAC_TXEN, GPIO40, _3));
7705 _for_each_inner_iomux_function!((DBG_PSRAM_DQ9, GPIO40, _4));
7706 _for_each_inner_iomux_function!((SD1_DATA2, GPIO41, _0));
7707 _for_each_inner_iomux_function!((BIST, GPIO41, _2));
7708 _for_each_inner_iomux_function!((EMAC_TXD0, GPIO41, _3));
7709 _for_each_inner_iomux_function!((DBG_PSRAM_DQ10, GPIO41, _4));
7710 _for_each_inner_iomux_function!((SD1_DATA3, GPIO42, _0));
7711 _for_each_inner_iomux_function!((BIST, GPIO42, _2));
7712 _for_each_inner_iomux_function!((EMAC_TXD1, GPIO42, _3));
7713 _for_each_inner_iomux_function!((DBG_PSRAM_DQ11, GPIO42, _4));
7714 _for_each_inner_iomux_function!((SD1_CLK, GPIO43, _0));
7715 _for_each_inner_iomux_function!((BIST, GPIO43, _2));
7716 _for_each_inner_iomux_function!((EMAC_TXER, GPIO43, _3));
7717 _for_each_inner_iomux_function!((DBG_PSRAM_DQ12, GPIO43, _4));
7718 _for_each_inner_iomux_function!((SD1_CMD, GPIO44, _0));
7719 _for_each_inner_iomux_function!((BIST, GPIO44, _2));
7720 _for_each_inner_iomux_function!((EMAC_RMII_CLK, GPIO44, _3));
7721 _for_each_inner_iomux_function!((DBG_PSRAM_DQ13, GPIO44, _4));
7722 _for_each_inner_iomux_function!((SD1_DATA4, GPIO45, _0));
7723 _for_each_inner_iomux_function!((BIST, GPIO45, _2));
7724 _for_each_inner_iomux_function!((EMAC_RXDV, GPIO45, _3));
7725 _for_each_inner_iomux_function!((DBG_PSRAM_DQ14, GPIO45, _4));
7726 _for_each_inner_iomux_function!((SD1_DATA5, GPIO46, _0));
7727 _for_each_inner_iomux_function!((BIST, GPIO46, _2));
7728 _for_each_inner_iomux_function!((EMAC_RXD0, GPIO46, _3));
7729 _for_each_inner_iomux_function!((DBG_PSRAM_DQ15, GPIO46, _4));
7730 _for_each_inner_iomux_function!((SD1_DATA6, GPIO47, _0));
7731 _for_each_inner_iomux_function!((BIST, GPIO47, _2));
7732 _for_each_inner_iomux_function!((EMAC_RXD1, GPIO47, _3));
7733 _for_each_inner_iomux_function!((DBG_PSRAM_DQS_1, GPIO47, _4));
7734 _for_each_inner_iomux_function!((SD1_DATA7, GPIO48, _0));
7735 _for_each_inner_iomux_function!((BIST, GPIO48, _2));
7736 _for_each_inner_iomux_function!((EMAC_RXER, GPIO48, _3));
7737 _for_each_inner_iomux_function!((EMAC_TXEN, GPIO49, _3));
7738 _for_each_inner_iomux_function!((DBG_FLASH_CS, GPIO49, _4));
7739 _for_each_inner_iomux_function!((EMAC_RMII_CLK, GPIO50, _3));
7740 _for_each_inner_iomux_function!((DBG_FLASH_Q, GPIO50, _4));
7741 _for_each_inner_iomux_function!((EMAC_RXDV, GPIO51, _3));
7742 _for_each_inner_iomux_function!((DBG_FLASH_WP, GPIO51, _4));
7743 _for_each_inner_iomux_function!((EMAC_RXD0, GPIO52, _3));
7744 _for_each_inner_iomux_function!((DBG_FLASH_HOLD, GPIO52, _4));
7745 _for_each_inner_iomux_function!((EMAC_RXD1, GPIO53, _3));
7746 _for_each_inner_iomux_function!((DBG_FLASH_CK, GPIO53, _4));
7747 _for_each_inner_iomux_function!((EMAC_RXER, GPIO54, _3));
7748 _for_each_inner_iomux_function!((DBG_FLASH_D, GPIO54, _4));
7749 _for_each_inner_iomux_function!(((SPI2_HOLD, SPIn_HOLD, 2), GPIO6, _3));
7750 _for_each_inner_iomux_function!(((SPI2_HOLD, SPIn_HOLD, 2), GPIO32, _2));
7751 _for_each_inner_iomux_function!(((SPI2_CS, SPIn_CS, 2), GPIO7, _3));
7752 _for_each_inner_iomux_function!(((SPI2_CS, SPIn_CS, 2), GPIO28, _2));
7753 _for_each_inner_iomux_function!(((UART0_RTS, UARTn_RTS, 0), GPIO8, _2));
7754 _for_each_inner_iomux_function!(((UART1_RTS, UARTn_RTS, 1), GPIO12, _2));
7755 _for_each_inner_iomux_function!(((SPI2_D, SPIn_D, 2), GPIO8, _3));
7756 _for_each_inner_iomux_function!(((SPI2_D, SPIn_D, 2), GPIO29, _2));
7757 _for_each_inner_iomux_function!(((UART0_CTS, UARTn_CTS, 0), GPIO9, _2));
7758 _for_each_inner_iomux_function!(((UART1_CTS, UARTn_CTS, 1), GPIO13, _2));
7759 _for_each_inner_iomux_function!(((SPI2_CK, SPIn_CK, 2), GPIO9, _3));
7760 _for_each_inner_iomux_function!(((SPI2_CK, SPIn_CK, 2), GPIO30, _2));
7761 _for_each_inner_iomux_function!(((UART1_TXD, UARTn_TXD, 1), GPIO10, _2));
7762 _for_each_inner_iomux_function!(((UART0_TXD, UARTn_TXD, 0), GPIO37, _0));
7763 _for_each_inner_iomux_function!(((SPI2_Q, SPIn_Q, 2), GPIO10, _3));
7764 _for_each_inner_iomux_function!(((SPI2_Q, SPIn_Q, 2), GPIO31, _2));
7765 _for_each_inner_iomux_function!(((UART1_RXD, UARTn_RXD, 1), GPIO11, _2));
7766 _for_each_inner_iomux_function!(((UART0_RXD, UARTn_RXD, 0), GPIO38, _0));
7767 _for_each_inner_iomux_function!(((SPI2_WP, SPIn_WP, 2), GPIO11, _3));
7768 _for_each_inner_iomux_function!(((SPI2_WP, SPIn_WP, 2), GPIO33, _2));
7769 _for_each_inner_iomux_function!(((EMAC_RXD0, EMAC_RXDn, 0), GPIO29, _3));
7770 _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO30, _3));
7771 _for_each_inner_iomux_function!(((EMAC_RXD0, EMAC_RXDn, 0), GPIO46, _3));
7772 _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO47, _3));
7773 _for_each_inner_iomux_function!(((EMAC_RXD0, EMAC_RXDn, 0), GPIO52, _3));
7774 _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO53, _3));
7775 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4), GPIO32, _4));
7776 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO33, _4));
7777 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ6, DBG_PSRAM_DQn, 6), GPIO34, _4));
7778 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO35, _4));
7779 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ8, DBG_PSRAM_DQn, 8), GPIO39, _4));
7780 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ9, DBG_PSRAM_DQn, 9), GPIO40, _4));
7781 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ10, DBG_PSRAM_DQn, 10), GPIO41,
7782 _4)); _for_each_inner_iomux_function!(((DBG_PSRAM_DQ11, DBG_PSRAM_DQn, 11),
7783 GPIO42, _4)); _for_each_inner_iomux_function!(((DBG_PSRAM_DQ12, DBG_PSRAM_DQn,
7784 12), GPIO43, _4)); _for_each_inner_iomux_function!(((DBG_PSRAM_DQ13,
7785 DBG_PSRAM_DQn, 13), GPIO44, _4));
7786 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ14, DBG_PSRAM_DQn, 14), GPIO45,
7787 _4)); _for_each_inner_iomux_function!(((DBG_PSRAM_DQ15, DBG_PSRAM_DQn, 15),
7788 GPIO46, _4)); _for_each_inner_iomux_function!(((SPI2_IO4, SPIn_IOm, 2, 4),
7789 GPIO34, _2)); _for_each_inner_iomux_function!(((SPI2_IO5, SPIn_IOm, 2, 5),
7790 GPIO35, _2)); _for_each_inner_iomux_function!(((SPI2_IO6, SPIn_IOm, 2, 6),
7791 GPIO36, _2)); _for_each_inner_iomux_function!(((SPI2_IO7, SPIn_IOm, 2, 7),
7792 GPIO37, _2)); _for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO34,
7793 _3)); _for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO35, _3));
7794 _for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO41, _3));
7795 _for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO42, _3));
7796 _for_each_inner_iomux_function!(((DBG_PSRAM_DQS_0, DBG_PSRAM_DQS_n, 0), GPIO36,
7797 _4)); _for_each_inner_iomux_function!(((DBG_PSRAM_DQS_1, DBG_PSRAM_DQS_n, 1),
7798 GPIO47, _4)); _for_each_inner_iomux_function!(((SPI2_DQS, SPIn_DQS, 2), GPIO38,
7799 _2)); _for_each_inner_iomux_function!(((SD1_DATA0, SDn_DATAm, 1, 0), GPIO39,
7800 _0)); _for_each_inner_iomux_function!(((SD1_DATA1, SDn_DATAm, 1, 1), GPIO40,
7801 _0)); _for_each_inner_iomux_function!(((SD1_DATA2, SDn_DATAm, 1, 2), GPIO41,
7802 _0)); _for_each_inner_iomux_function!(((SD1_DATA3, SDn_DATAm, 1, 3), GPIO42,
7803 _0)); _for_each_inner_iomux_function!(((SD1_DATA4, SDn_DATAm, 1, 4), GPIO45,
7804 _0)); _for_each_inner_iomux_function!(((SD1_DATA5, SDn_DATAm, 1, 5), GPIO46,
7805 _0)); _for_each_inner_iomux_function!(((SD1_DATA6, SDn_DATAm, 1, 6), GPIO47,
7806 _0)); _for_each_inner_iomux_function!(((SD1_DATA7, SDn_DATAm, 1, 7), GPIO48,
7807 _0)); _for_each_inner_iomux_function!(((SD1_CLK, SDn_CLK, 1), GPIO43, _0));
7808 _for_each_inner_iomux_function!(((SD1_CMD, SDn_CMD, 1), GPIO44, _0));
7809 _for_each_inner_iomux_function!((all(MTCK, GPIO2, _0), (MTDI, GPIO3, _0), (MTMS,
7810 GPIO4, _0), (MTDO, GPIO5, _0), (SPI2_HOLD, GPIO6, _3), (SPI2_CS, GPIO7, _3),
7811 (UART0_RTS, GPIO8, _2), (SPI2_D, GPIO8, _3), (UART0_CTS, GPIO9, _2), (SPI2_CK,
7812 GPIO9, _3), (UART1_TXD, GPIO10, _2), (SPI2_Q, GPIO10, _3), (UART1_RXD, GPIO11,
7813 _2), (SPI2_WP, GPIO11, _3), (UART1_RTS, GPIO12, _2), (UART1_CTS, GPIO13, _2),
7814 (DBG_PSRAM_CK, GPIO22, _4), (REF_50M_CLK, GPIO23, _3), (DBG_PSRAM_CS, GPIO23,
7815 _4), (SPI2_CS, GPIO28, _2), (EMAC_RXDV, GPIO28, _3), (DBG_PSRAM_D, GPIO28, _4),
7816 (SPI2_D, GPIO29, _2), (EMAC_RXD0, GPIO29, _3), (DBG_PSRAM_Q, GPIO29, _4),
7817 (SPI2_CK, GPIO30, _2), (EMAC_RXD1, GPIO30, _3), (DBG_PSRAM_WP, GPIO30, _4),
7818 (SPI2_Q, GPIO31, _2), (EMAC_RXER, GPIO31, _3), (DBG_PSRAM_HOLD, GPIO31, _4),
7819 (SPI2_HOLD, GPIO32, _2), (EMAC_RMII_CLK, GPIO32, _3), (DBG_PSRAM_DQ4, GPIO32,
7820 _4), (SPI2_WP, GPIO33, _2), (EMAC_TXEN, GPIO33, _3), (DBG_PSRAM_DQ5, GPIO33, _4),
7821 (SPI2_IO4, GPIO34, _2), (EMAC_TXD0, GPIO34, _3), (DBG_PSRAM_DQ6, GPIO34, _4),
7822 (SPI2_IO5, GPIO35, _2), (EMAC_TXD1, GPIO35, _3), (DBG_PSRAM_DQ7, GPIO35, _4),
7823 (SPI2_IO6, GPIO36, _2), (EMAC_TXER, GPIO36, _3), (DBG_PSRAM_DQS_0, GPIO36, _4),
7824 (UART0_TXD, GPIO37, _0), (SPI2_IO7, GPIO37, _2), (UART0_RXD, GPIO38, _0),
7825 (SPI2_DQS, GPIO38, _2), (SD1_DATA0, GPIO39, _0), (BIST, GPIO39, _2),
7826 (REF_50M_CLK, GPIO39, _3), (DBG_PSRAM_DQ8, GPIO39, _4), (SD1_DATA1, GPIO40, _0),
7827 (BIST, GPIO40, _2), (EMAC_TXEN, GPIO40, _3), (DBG_PSRAM_DQ9, GPIO40, _4),
7828 (SD1_DATA2, GPIO41, _0), (BIST, GPIO41, _2), (EMAC_TXD0, GPIO41, _3),
7829 (DBG_PSRAM_DQ10, GPIO41, _4), (SD1_DATA3, GPIO42, _0), (BIST, GPIO42, _2),
7830 (EMAC_TXD1, GPIO42, _3), (DBG_PSRAM_DQ11, GPIO42, _4), (SD1_CLK, GPIO43, _0),
7831 (BIST, GPIO43, _2), (EMAC_TXER, GPIO43, _3), (DBG_PSRAM_DQ12, GPIO43, _4),
7832 (SD1_CMD, GPIO44, _0), (BIST, GPIO44, _2), (EMAC_RMII_CLK, GPIO44, _3),
7833 (DBG_PSRAM_DQ13, GPIO44, _4), (SD1_DATA4, GPIO45, _0), (BIST, GPIO45, _2),
7834 (EMAC_RXDV, GPIO45, _3), (DBG_PSRAM_DQ14, GPIO45, _4), (SD1_DATA5, GPIO46, _0),
7835 (BIST, GPIO46, _2), (EMAC_RXD0, GPIO46, _3), (DBG_PSRAM_DQ15, GPIO46, _4),
7836 (SD1_DATA6, GPIO47, _0), (BIST, GPIO47, _2), (EMAC_RXD1, GPIO47, _3),
7837 (DBG_PSRAM_DQS_1, GPIO47, _4), (SD1_DATA7, GPIO48, _0), (BIST, GPIO48, _2),
7838 (EMAC_RXER, GPIO48, _3), (EMAC_TXEN, GPIO49, _3), (DBG_FLASH_CS, GPIO49, _4),
7839 (EMAC_RMII_CLK, GPIO50, _3), (DBG_FLASH_Q, GPIO50, _4), (EMAC_RXDV, GPIO51, _3),
7840 (DBG_FLASH_WP, GPIO51, _4), (EMAC_RXD0, GPIO52, _3), (DBG_FLASH_HOLD, GPIO52,
7841 _4), (EMAC_RXD1, GPIO53, _3), (DBG_FLASH_CK, GPIO53, _4), (EMAC_RXER, GPIO54,
7842 _3), (DBG_FLASH_D, GPIO54, _4)));
7843 _for_each_inner_iomux_function!((SPIn_HOLD((SPI2_HOLD, SPIn_HOLD, 2), GPIO6, _3),
7844 ((SPI2_HOLD, SPIn_HOLD, 2), GPIO32, _2)));
7845 _for_each_inner_iomux_function!((SPIn_CS((SPI2_CS, SPIn_CS, 2), GPIO7, _3),
7846 ((SPI2_CS, SPIn_CS, 2), GPIO28, _2)));
7847 _for_each_inner_iomux_function!((UARTn_RTS((UART0_RTS, UARTn_RTS, 0), GPIO8, _2),
7848 ((UART1_RTS, UARTn_RTS, 1), GPIO12, _2)));
7849 _for_each_inner_iomux_function!((SPIn_D((SPI2_D, SPIn_D, 2), GPIO8, _3),
7850 ((SPI2_D, SPIn_D, 2), GPIO29, _2)));
7851 _for_each_inner_iomux_function!((UARTn_CTS((UART0_CTS, UARTn_CTS, 0), GPIO9, _2),
7852 ((UART1_CTS, UARTn_CTS, 1), GPIO13, _2)));
7853 _for_each_inner_iomux_function!((SPIn_CK((SPI2_CK, SPIn_CK, 2), GPIO9, _3),
7854 ((SPI2_CK, SPIn_CK, 2), GPIO30, _2)));
7855 _for_each_inner_iomux_function!((UARTn_TXD((UART1_TXD, UARTn_TXD, 1), GPIO10,
7856 _2), ((UART0_TXD, UARTn_TXD, 0), GPIO37, _0)));
7857 _for_each_inner_iomux_function!((SPIn_Q((SPI2_Q, SPIn_Q, 2), GPIO10, _3),
7858 ((SPI2_Q, SPIn_Q, 2), GPIO31, _2)));
7859 _for_each_inner_iomux_function!((UARTn_RXD((UART1_RXD, UARTn_RXD, 1), GPIO11,
7860 _2), ((UART0_RXD, UARTn_RXD, 0), GPIO38, _0)));
7861 _for_each_inner_iomux_function!((SPIn_WP((SPI2_WP, SPIn_WP, 2), GPIO11, _3),
7862 ((SPI2_WP, SPIn_WP, 2), GPIO33, _2)));
7863 _for_each_inner_iomux_function!((EMAC_RXDn((EMAC_RXD0, EMAC_RXDn, 0), GPIO29,
7864 _3), ((EMAC_RXD1, EMAC_RXDn, 1), GPIO30, _3), ((EMAC_RXD0, EMAC_RXDn, 0), GPIO46,
7865 _3), ((EMAC_RXD1, EMAC_RXDn, 1), GPIO47, _3), ((EMAC_RXD0, EMAC_RXDn, 0), GPIO52,
7866 _3), ((EMAC_RXD1, EMAC_RXDn, 1), GPIO53, _3)));
7867 _for_each_inner_iomux_function!((DBG_PSRAM_DQn((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4),
7868 GPIO32, _4), ((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO33, _4), ((DBG_PSRAM_DQ6,
7869 DBG_PSRAM_DQn, 6), GPIO34, _4), ((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO35, _4),
7870 ((DBG_PSRAM_DQ8, DBG_PSRAM_DQn, 8), GPIO39, _4), ((DBG_PSRAM_DQ9, DBG_PSRAM_DQn,
7871 9), GPIO40, _4), ((DBG_PSRAM_DQ10, DBG_PSRAM_DQn, 10), GPIO41, _4),
7872 ((DBG_PSRAM_DQ11, DBG_PSRAM_DQn, 11), GPIO42, _4), ((DBG_PSRAM_DQ12,
7873 DBG_PSRAM_DQn, 12), GPIO43, _4), ((DBG_PSRAM_DQ13, DBG_PSRAM_DQn, 13), GPIO44,
7874 _4), ((DBG_PSRAM_DQ14, DBG_PSRAM_DQn, 14), GPIO45, _4), ((DBG_PSRAM_DQ15,
7875 DBG_PSRAM_DQn, 15), GPIO46, _4)));
7876 _for_each_inner_iomux_function!((SPIn_IOm((SPI2_IO4, SPIn_IOm, 2, 4), GPIO34,
7877 _2), ((SPI2_IO5, SPIn_IOm, 2, 5), GPIO35, _2), ((SPI2_IO6, SPIn_IOm, 2, 6),
7878 GPIO36, _2), ((SPI2_IO7, SPIn_IOm, 2, 7), GPIO37, _2)));
7879 _for_each_inner_iomux_function!((EMAC_TXDn((EMAC_TXD0, EMAC_TXDn, 0), GPIO34,
7880 _3), ((EMAC_TXD1, EMAC_TXDn, 1), GPIO35, _3), ((EMAC_TXD0, EMAC_TXDn, 0), GPIO41,
7881 _3), ((EMAC_TXD1, EMAC_TXDn, 1), GPIO42, _3)));
7882 _for_each_inner_iomux_function!((DBG_PSRAM_DQS_n((DBG_PSRAM_DQS_0,
7883 DBG_PSRAM_DQS_n, 0), GPIO36, _4), ((DBG_PSRAM_DQS_1, DBG_PSRAM_DQS_n, 1), GPIO47,
7884 _4))); _for_each_inner_iomux_function!((SPIn_DQS((SPI2_DQS, SPIn_DQS, 2), GPIO38,
7885 _2))); _for_each_inner_iomux_function!((SDn_DATAm((SD1_DATA0, SDn_DATAm, 1, 0),
7886 GPIO39, _0), ((SD1_DATA1, SDn_DATAm, 1, 1), GPIO40, _0), ((SD1_DATA2, SDn_DATAm,
7887 1, 2), GPIO41, _0), ((SD1_DATA3, SDn_DATAm, 1, 3), GPIO42, _0), ((SD1_DATA4,
7888 SDn_DATAm, 1, 4), GPIO45, _0), ((SD1_DATA5, SDn_DATAm, 1, 5), GPIO46, _0),
7889 ((SD1_DATA6, SDn_DATAm, 1, 6), GPIO47, _0), ((SD1_DATA7, SDn_DATAm, 1, 7),
7890 GPIO48, _0))); _for_each_inner_iomux_function!((SDn_CLK((SD1_CLK, SDn_CLK, 1),
7891 GPIO43, _0))); _for_each_inner_iomux_function!((SDn_CMD((SD1_CMD, SDn_CMD, 1),
7892 GPIO44, _0)));
7893 };
7894}
7895#[macro_export]
7912#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7913macro_rules! gpio_for_signal {
7914 (LP_GPIO0 $(, $_fallback:literal)?) => {
7915 "GPIO0"
7916 };
7917 (LP_GPIO1 $(, $_fallback:literal)?) => {
7918 "GPIO1"
7919 };
7920 (MTCK $(, $_fallback:literal)?) => {
7921 "GPIO2"
7922 };
7923 (LP_GPIO2 $(, $_fallback:literal)?) => {
7924 "GPIO2"
7925 };
7926 (MTDI $(, $_fallback:literal)?) => {
7927 "GPIO3"
7928 };
7929 (LP_GPIO3 $(, $_fallback:literal)?) => {
7930 "GPIO3"
7931 };
7932 (MTMS $(, $_fallback:literal)?) => {
7933 "GPIO4"
7934 };
7935 (LP_GPIO4 $(, $_fallback:literal)?) => {
7936 "GPIO4"
7937 };
7938 (MTDO $(, $_fallback:literal)?) => {
7939 "GPIO5"
7940 };
7941 (LP_GPIO5 $(, $_fallback:literal)?) => {
7942 "GPIO5"
7943 };
7944 (SPI2_HOLD $(, $_fallback:literal)?) => {
7945 "GPIO6"
7946 };
7947 (LP_GPIO6 $(, $_fallback:literal)?) => {
7948 "GPIO6"
7949 };
7950 (SPI2_CS $(, $_fallback:literal)?) => {
7951 "GPIO7"
7952 };
7953 (LP_GPIO7 $(, $_fallback:literal)?) => {
7954 "GPIO7"
7955 };
7956 (UART0_RTS $(, $_fallback:literal)?) => {
7957 "GPIO8"
7958 };
7959 (SPI2_D $(, $_fallback:literal)?) => {
7960 "GPIO8"
7961 };
7962 (LP_GPIO8 $(, $_fallback:literal)?) => {
7963 "GPIO8"
7964 };
7965 (UART0_CTS $(, $_fallback:literal)?) => {
7966 "GPIO9"
7967 };
7968 (SPI2_CK $(, $_fallback:literal)?) => {
7969 "GPIO9"
7970 };
7971 (LP_GPIO9 $(, $_fallback:literal)?) => {
7972 "GPIO9"
7973 };
7974 (UART1_TXD $(, $_fallback:literal)?) => {
7975 "GPIO10"
7976 };
7977 (SPI2_Q $(, $_fallback:literal)?) => {
7978 "GPIO10"
7979 };
7980 (LP_GPIO10 $(, $_fallback:literal)?) => {
7981 "GPIO10"
7982 };
7983 (UART1_RXD $(, $_fallback:literal)?) => {
7984 "GPIO11"
7985 };
7986 (SPI2_WP $(, $_fallback:literal)?) => {
7987 "GPIO11"
7988 };
7989 (LP_GPIO11 $(, $_fallback:literal)?) => {
7990 "GPIO11"
7991 };
7992 (UART1_RTS $(, $_fallback:literal)?) => {
7993 "GPIO12"
7994 };
7995 (LP_GPIO12 $(, $_fallback:literal)?) => {
7996 "GPIO12"
7997 };
7998 (UART1_CTS $(, $_fallback:literal)?) => {
7999 "GPIO13"
8000 };
8001 (LP_GPIO13 $(, $_fallback:literal)?) => {
8002 "GPIO13"
8003 };
8004 (LP_UART_TXD $(, $_fallback:literal)?) => {
8005 "GPIO14"
8006 };
8007 (LP_GPIO14 $(, $_fallback:literal)?) => {
8008 "GPIO14"
8009 };
8010 (LP_UART_RXD $(, $_fallback:literal)?) => {
8011 "GPIO15"
8012 };
8013 (LP_GPIO15 $(, $_fallback:literal)?) => {
8014 "GPIO15"
8015 };
8016 (ADC1_CH0 $(, $_fallback:literal)?) => {
8017 "GPIO16"
8018 };
8019 (ADC1_CH1 $(, $_fallback:literal)?) => {
8020 "GPIO17"
8021 };
8022 (ADC1_CH2 $(, $_fallback:literal)?) => {
8023 "GPIO18"
8024 };
8025 (ADC1_CH3 $(, $_fallback:literal)?) => {
8026 "GPIO19"
8027 };
8028 (ADC1_CH4 $(, $_fallback:literal)?) => {
8029 "GPIO20"
8030 };
8031 (ADC1_CH5 $(, $_fallback:literal)?) => {
8032 "GPIO21"
8033 };
8034 (DBG_PSRAM_CK $(, $_fallback:literal)?) => {
8035 "GPIO22"
8036 };
8037 (ADC1_CH6 $(, $_fallback:literal)?) => {
8038 "GPIO22"
8039 };
8040 (REF_50M_CLK $(, $_fallback:literal)?) => {
8041 "GPIO23"
8042 };
8043 (DBG_PSRAM_CS $(, $_fallback:literal)?) => {
8044 "GPIO23"
8045 };
8046 (ADC1_CH7 $(, $_fallback:literal)?) => {
8047 "GPIO23"
8048 };
8049 (USJ_DM $(, $_fallback:literal)?) => {
8050 "GPIO24"
8051 };
8052 (USJ_DP $(, $_fallback:literal)?) => {
8053 "GPIO25"
8054 };
8055 (USB_FS_DM $(, $_fallback:literal)?) => {
8056 "GPIO26"
8057 };
8058 (USB_FS_DP $(, $_fallback:literal)?) => {
8059 "GPIO27"
8060 };
8061 (EMAC_RXDV $(, $_fallback:literal)?) => {
8062 "GPIO28"
8063 };
8064 (DBG_PSRAM_D $(, $_fallback:literal)?) => {
8065 "GPIO28"
8066 };
8067 (EMAC_RXD0 $(, $_fallback:literal)?) => {
8068 "GPIO29"
8069 };
8070 (DBG_PSRAM_Q $(, $_fallback:literal)?) => {
8071 "GPIO29"
8072 };
8073 (EMAC_RXD1 $(, $_fallback:literal)?) => {
8074 "GPIO30"
8075 };
8076 (DBG_PSRAM_WP $(, $_fallback:literal)?) => {
8077 "GPIO30"
8078 };
8079 (EMAC_RXER $(, $_fallback:literal)?) => {
8080 "GPIO31"
8081 };
8082 (DBG_PSRAM_HOLD $(, $_fallback:literal)?) => {
8083 "GPIO31"
8084 };
8085 (EMAC_RMII_CLK $(, $_fallback:literal)?) => {
8086 "GPIO44"
8087 };
8088 (DBG_PSRAM_DQ4 $(, $_fallback:literal)?) => {
8089 "GPIO32"
8090 };
8091 (EMAC_TXEN $(, $_fallback:literal)?) => {
8092 "GPIO40"
8093 };
8094 (DBG_PSRAM_DQ5 $(, $_fallback:literal)?) => {
8095 "GPIO33"
8096 };
8097 (SPI2_IO4 $(, $_fallback:literal)?) => {
8098 "GPIO34"
8099 };
8100 (EMAC_TXD0 $(, $_fallback:literal)?) => {
8101 "GPIO41"
8102 };
8103 (DBG_PSRAM_DQ6 $(, $_fallback:literal)?) => {
8104 "GPIO34"
8105 };
8106 (SPI2_IO5 $(, $_fallback:literal)?) => {
8107 "GPIO35"
8108 };
8109 (EMAC_TXD1 $(, $_fallback:literal)?) => {
8110 "GPIO42"
8111 };
8112 (DBG_PSRAM_DQ7 $(, $_fallback:literal)?) => {
8113 "GPIO35"
8114 };
8115 (SPI2_IO6 $(, $_fallback:literal)?) => {
8116 "GPIO36"
8117 };
8118 (EMAC_TXER $(, $_fallback:literal)?) => {
8119 "GPIO43"
8120 };
8121 (DBG_PSRAM_DQS_0 $(, $_fallback:literal)?) => {
8122 "GPIO36"
8123 };
8124 (UART0_TXD $(, $_fallback:literal)?) => {
8125 "GPIO37"
8126 };
8127 (SPI2_IO7 $(, $_fallback:literal)?) => {
8128 "GPIO37"
8129 };
8130 (UART0_RXD $(, $_fallback:literal)?) => {
8131 "GPIO38"
8132 };
8133 (SPI2_DQS $(, $_fallback:literal)?) => {
8134 "GPIO38"
8135 };
8136 (SD1_DATA0 $(, $_fallback:literal)?) => {
8137 "GPIO39"
8138 };
8139 (BIST $(, $_fallback:literal)?) => {
8140 "GPIO39"
8141 };
8142 (DBG_PSRAM_DQ8 $(, $_fallback:literal)?) => {
8143 "GPIO39"
8144 };
8145 (SD1_DATA1 $(, $_fallback:literal)?) => {
8146 "GPIO40"
8147 };
8148 (DBG_PSRAM_DQ9 $(, $_fallback:literal)?) => {
8149 "GPIO40"
8150 };
8151 (SD1_DATA2 $(, $_fallback:literal)?) => {
8152 "GPIO41"
8153 };
8154 (DBG_PSRAM_DQ10 $(, $_fallback:literal)?) => {
8155 "GPIO41"
8156 };
8157 (SD1_DATA3 $(, $_fallback:literal)?) => {
8158 "GPIO42"
8159 };
8160 (DBG_PSRAM_DQ11 $(, $_fallback:literal)?) => {
8161 "GPIO42"
8162 };
8163 (SD1_CLK $(, $_fallback:literal)?) => {
8164 "GPIO43"
8165 };
8166 (DBG_PSRAM_DQ12 $(, $_fallback:literal)?) => {
8167 "GPIO43"
8168 };
8169 (SD1_CMD $(, $_fallback:literal)?) => {
8170 "GPIO44"
8171 };
8172 (DBG_PSRAM_DQ13 $(, $_fallback:literal)?) => {
8173 "GPIO44"
8174 };
8175 (SD1_DATA4 $(, $_fallback:literal)?) => {
8176 "GPIO45"
8177 };
8178 (DBG_PSRAM_DQ14 $(, $_fallback:literal)?) => {
8179 "GPIO45"
8180 };
8181 (SD1_DATA5 $(, $_fallback:literal)?) => {
8182 "GPIO46"
8183 };
8184 (DBG_PSRAM_DQ15 $(, $_fallback:literal)?) => {
8185 "GPIO46"
8186 };
8187 (SD1_DATA6 $(, $_fallback:literal)?) => {
8188 "GPIO47"
8189 };
8190 (DBG_PSRAM_DQS_1 $(, $_fallback:literal)?) => {
8191 "GPIO47"
8192 };
8193 (SD1_DATA7 $(, $_fallback:literal)?) => {
8194 "GPIO48"
8195 };
8196 (DBG_FLASH_CS $(, $_fallback:literal)?) => {
8197 "GPIO49"
8198 };
8199 (ADC2_CH0 $(, $_fallback:literal)?) => {
8200 "GPIO49"
8201 };
8202 (DBG_FLASH_Q $(, $_fallback:literal)?) => {
8203 "GPIO50"
8204 };
8205 (ADC2_CH1 $(, $_fallback:literal)?) => {
8206 "GPIO50"
8207 };
8208 (DBG_FLASH_WP $(, $_fallback:literal)?) => {
8209 "GPIO51"
8210 };
8211 (ADC2_CH2 $(, $_fallback:literal)?) => {
8212 "GPIO51"
8213 };
8214 (DBG_FLASH_HOLD $(, $_fallback:literal)?) => {
8215 "GPIO52"
8216 };
8217 (ADC2_CH3 $(, $_fallback:literal)?) => {
8218 "GPIO52"
8219 };
8220 (DBG_FLASH_CK $(, $_fallback:literal)?) => {
8221 "GPIO53"
8222 };
8223 (ADC2_CH4 $(, $_fallback:literal)?) => {
8224 "GPIO53"
8225 };
8226 (DBG_FLASH_D $(, $_fallback:literal)?) => {
8227 "GPIO54"
8228 };
8229 (ADC2_CH5 $(, $_fallback:literal)?) => {
8230 "GPIO54"
8231 };
8232 ($_signal:ident, $fallback:literal) => {
8233 $fallback
8234 };
8235}
8236#[macro_export]
8240#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8241macro_rules! define_io_mux_signals {
8242 () => {
8243 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
8244 #[derive(Debug, PartialEq, Copy, Clone)]
8245 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
8246 #[doc(hidden)]
8247 pub enum InputSignal {
8248 SDHOST_CCMD_IN_2 = 1,
8249 SDHOST_CDATA_IN_20 = 2,
8250 SDHOST_CDATA_IN_21 = 3,
8251 SDHOST_CDATA_IN_22 = 4,
8252 SDHOST_CDATA_IN_23 = 5,
8253 SDHOST_CDATA_IN_24 = 6,
8254 SDHOST_CDATA_IN_25 = 7,
8255 SDHOST_CDATA_IN_26 = 8,
8256 SDHOST_CDATA_IN_27 = 9,
8257 UART0_RXD = 10,
8258 UART0_CTS = 11,
8259 UART0_DSR = 12,
8260 UART1_RXD = 13,
8261 UART1_CTS = 14,
8262 UART1_DSR = 15,
8263 UART2_RXD = 16,
8264 UART2_CTS = 17,
8265 UART2_DSR = 18,
8266 UART3_RXD = 19,
8267 UART3_CTS = 20,
8268 UART3_DSR = 21,
8269 UART4_RXD = 22,
8270 UART4_CTS = 23,
8271 UART4_DSR = 24,
8272 I2S0_O_BCK = 25,
8273 I2S0_MCLK = 26,
8274 I2S0_O_WS = 27,
8275 I2S0_I_SD = 28,
8276 I2S0_I_BCK = 29,
8277 I2S0_I_WS = 30,
8278 I2S1_O_BCK = 31,
8279 I2S1_MCLK = 32,
8280 I2S1_O_WS = 33,
8281 I2S1_I_SD = 34,
8282 I2S1_I_BCK = 35,
8283 I2S1_I_WS = 36,
8284 I2S2_O_BCK = 37,
8285 I2S2_MCLK = 38,
8286 I2S2_O_WS = 39,
8287 I2S2_I_SD = 40,
8288 I2S2_I_BCK = 41,
8289 I2S2_I_WS = 42,
8290 I2S0_I_SD1 = 43,
8291 I2S0_I_SD2 = 44,
8292 I2S0_I_SD3 = 45,
8293 SPI3_CK = 47,
8294 SPI3_Q = 48,
8295 SPI3_D = 49,
8296 SPI3_HOLD = 50,
8297 SPI3_WP = 51,
8298 SPI3_CS = 52,
8299 SPI2_CK = 53,
8300 SPI2_Q = 54,
8301 SPI2_D = 55,
8302 SPI2_HOLD = 56,
8303 SPI2_WP = 57,
8304 SPI2_IO4 = 58,
8305 SPI2_IO5 = 59,
8306 SPI2_IO6 = 60,
8307 SPI2_IO7 = 61,
8308 SPI2_CS = 62,
8309 I2C0_SCL = 68,
8310 I2C0_SDA = 69,
8311 I2C1_SCL = 70,
8312 I2C1_SDA = 71,
8313 UART0_SLP_CLK = 74,
8314 UART1_SLP_CLK = 75,
8315 UART2_SLP_CLK = 76,
8316 UART3_SLP_CLK = 77,
8317 UART4_SLP_CLK = 78,
8318 TWAI0_RX = 80,
8319 TWAI1_RX = 83,
8320 TWAI2_RX = 86,
8321 PWM0_SYNC0 = 89,
8322 PWM0_SYNC1 = 90,
8323 PWM0_SYNC2 = 91,
8324 PWM0_F0 = 92,
8325 PWM0_F1 = 93,
8326 PWM0_F2 = 94,
8327 PWM0_CAP0 = 95,
8328 PWM0_CAP1 = 96,
8329 PWM0_CAP2 = 97,
8330 PWM1_SYNC0 = 98,
8331 PWM1_SYNC1 = 99,
8332 PWM1_SYNC2 = 100,
8333 PWM1_F0 = 101,
8334 PWM1_F1 = 102,
8335 PWM1_F2 = 103,
8336 PWM1_CAP0 = 104,
8337 PWM1_CAP1 = 105,
8338 PWM1_CAP2 = 106,
8339 EMAC_MDI = 107,
8340 EMAC_COL = 108,
8341 EMAC_CRS = 109,
8342 USB_FS_IDDIG = 110,
8343 USB_FS_AVALID = 111,
8344 USB_FS_SRP_BVALID = 112,
8345 USB_FS_VBUSVALID = 113,
8346 USB_SRP_SESSEND = 114,
8347 ULPI_CLK = 117,
8348 USB_HSPHY_REFCLK = 118,
8349 SDHOST_CARD_DETECT_N_1 = 126,
8350 SDHOST_CARD_DETECT_N_2 = 127,
8351 SDHOST_CARD_INT_N_1 = 128,
8352 SDHOST_CARD_INT_N_2 = 129,
8353 SDHOST_CARD_WRITE_PRT_1 = 130,
8354 SDHOST_CARD_WRITE_PRT_2 = 131,
8355 SDHOST_DATA_STROBE_1 = 132,
8356 SDHOST_DATA_STROBE_2 = 133,
8357 I3C_MST_SCL = 134,
8358 I3C_MST_SDA = 135,
8359 I3C_SLV_SCL = 136,
8360 I3C_SLV_SDA = 137,
8361 USB_JTAG_TDO_BRIDGE = 140,
8362 PCNT0_SIG_CH0 = 141,
8363 PCNT1_SIG_CH0 = 142,
8364 PCNT2_SIG_CH0 = 143,
8365 PCNT3_SIG_CH0 = 144,
8366 PCNT0_SIG_CH1 = 145,
8367 PCNT1_SIG_CH1 = 146,
8368 PCNT2_SIG_CH1 = 147,
8369 PCNT3_SIG_CH1 = 148,
8370 PCNT0_CTRL_CH0 = 149,
8371 PCNT1_CTRL_CH0 = 150,
8372 PCNT2_CTRL_CH0 = 151,
8373 PCNT3_CTRL_CH0 = 152,
8374 PCNT0_CTRL_CH1 = 153,
8375 PCNT1_CTRL_CH1 = 154,
8376 PCNT2_CTRL_CH1 = 155,
8377 PCNT3_CTRL_CH1 = 156,
8378 CAM_PCLK = 158,
8379 CAM_H_ENABLE = 159,
8380 CAM_H_SYNC = 160,
8381 CAM_V_SYNC = 161,
8382 EMAC_RXDV = 178,
8383 EMAC_RXD0 = 179,
8384 EMAC_RXD1 = 180,
8385 EMAC_RXD2 = 181,
8386 EMAC_RXD3 = 182,
8387 EMAC_RXER = 183,
8388 EMAC_RX_CLK = 184,
8389 EMAC_TX_CLK = 185,
8390 PARL_RX_CLK = 186,
8391 PARL_TX_CLK = 187,
8392 PARL_RX_DATA0 = 188,
8393 PARL_RX_DATA1 = 189,
8394 PARL_RX_DATA2 = 190,
8395 PARL_RX_DATA3 = 191,
8396 PARL_RX_DATA4 = 192,
8397 PARL_RX_DATA5 = 193,
8398 PARL_RX_DATA6 = 194,
8399 PARL_RX_DATA7 = 195,
8400 PARL_RX_DATA8 = 196,
8401 PARL_RX_DATA9 = 197,
8402 PARL_RX_DATA10 = 198,
8403 PARL_RX_DATA11 = 199,
8404 PARL_RX_DATA12 = 200,
8405 PARL_RX_DATA13 = 201,
8406 PARL_RX_DATA14 = 202,
8407 PARL_RX_DATA15 = 203,
8408 CPU_GPIO_0 = 214,
8409 CPU_GPIO_1 = 215,
8410 CPU_GPIO_2 = 216,
8411 CPU_GPIO_3 = 217,
8412 CPU_GPIO_4 = 218,
8413 CPU_GPIO_5 = 219,
8414 CPU_GPIO_6 = 220,
8415 CPU_GPIO_7 = 221,
8416 CPU_GPIO_8 = 222,
8417 CPU_GPIO_9 = 223,
8418 CPU_GPIO_10 = 224,
8419 CPU_GPIO_11 = 225,
8420 CPU_GPIO_12 = 226,
8421 CPU_GPIO_13 = 227,
8422 CPU_GPIO_14 = 228,
8423 CPU_GPIO_15 = 229,
8424 RMT_SIG_0 = 246,
8425 RMT_SIG_1 = 247,
8426 RMT_SIG_2 = 248,
8427 RMT_SIG_3 = 249,
8428 MTCK,
8429 MTDI,
8430 MTMS,
8431 MTDO,
8432 SD1_DATA0,
8433 SD1_DATA1,
8434 SD1_DATA2,
8435 SD1_DATA3,
8436 SD1_CLK,
8437 SD1_CMD,
8438 SD1_DATA4,
8439 SD1_DATA5,
8440 SD1_DATA6,
8441 SD1_DATA7,
8442 EMAC_RMII_CLK,
8443 REF_50M_CLK,
8444 BIST,
8445 DBG_PSRAM_CK,
8446 DBG_PSRAM_CS,
8447 DBG_PSRAM_D,
8448 DBG_PSRAM_Q,
8449 DBG_PSRAM_WP,
8450 DBG_PSRAM_HOLD,
8451 DBG_PSRAM_DQ4,
8452 DBG_PSRAM_DQ5,
8453 DBG_PSRAM_DQ6,
8454 DBG_PSRAM_DQ7,
8455 DBG_PSRAM_DQS_0,
8456 DBG_PSRAM_DQ8,
8457 DBG_PSRAM_DQ9,
8458 DBG_PSRAM_DQ10,
8459 DBG_PSRAM_DQ11,
8460 DBG_PSRAM_DQ12,
8461 DBG_PSRAM_DQ13,
8462 DBG_PSRAM_DQ14,
8463 DBG_PSRAM_DQ15,
8464 DBG_PSRAM_DQS_1,
8465 DBG_FLASH_CS,
8466 DBG_FLASH_Q,
8467 DBG_FLASH_WP,
8468 DBG_FLASH_HOLD,
8469 DBG_FLASH_CK,
8470 DBG_FLASH_D,
8471 SPI2_DQS,
8472 }
8473 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
8474 #[derive(Debug, PartialEq, Copy, Clone)]
8475 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
8476 #[doc(hidden)]
8477 pub enum OutputSignal {
8478 SDHOST_CCLK_OUT_2 = 0,
8479 SDHOST_CCMD_OUT_2 = 1,
8480 SDHOST_CDATA_OUT_20 = 2,
8481 SDHOST_CDATA_OUT_21 = 3,
8482 SDHOST_CDATA_OUT_22 = 4,
8483 SDHOST_CDATA_OUT_23 = 5,
8484 SDHOST_CDATA_OUT_24 = 6,
8485 SDHOST_CDATA_OUT_25 = 7,
8486 SDHOST_CDATA_OUT_26 = 8,
8487 SDHOST_CDATA_OUT_27 = 9,
8488 UART0_TXD = 10,
8489 UART0_RTS = 11,
8490 UART0_DTR = 12,
8491 UART1_TXD = 13,
8492 UART1_RTS = 14,
8493 UART1_DTR = 15,
8494 UART2_TXD = 16,
8495 UART2_RTS = 17,
8496 UART2_DTR = 18,
8497 UART3_TXD = 19,
8498 UART3_RTS = 20,
8499 UART3_DTR = 21,
8500 UART4_TXD = 22,
8501 UART4_RTS = 23,
8502 UART4_DTR = 24,
8503 I2S0_O_BCK = 25,
8504 I2S0_MCLK = 26,
8505 I2S0_O_WS = 27,
8506 I2S0_O_SD = 28,
8507 I2S0_I_BCK = 29,
8508 I2S0_I_WS = 30,
8509 I2S1_O_BCK = 31,
8510 I2S1_MCLK = 32,
8511 I2S1_O_WS = 33,
8512 I2S1_O_SD = 34,
8513 I2S1_I_BCK = 35,
8514 I2S1_I_WS = 36,
8515 I2S2_O_BCK = 37,
8516 I2S2_MCLK = 38,
8517 I2S2_O_WS = 39,
8518 I2S2_O_SD = 40,
8519 I2S2_I_BCK = 41,
8520 I2S2_I_WS = 42,
8521 I2S0_O_SD1 = 43,
8522 SPI2_DQS = 44,
8523 SPI3_CS2 = 45,
8524 SPI3_CS1 = 46,
8525 SPI3_CK = 47,
8526 SPI3_Q = 48,
8527 SPI3_D = 49,
8528 SPI3_HOLD = 50,
8529 SPI3_WP = 51,
8530 SPI3_CS = 52,
8531 SPI2_CK = 53,
8532 SPI2_Q = 54,
8533 SPI2_D = 55,
8534 SPI2_HOLD = 56,
8535 SPI2_WP = 57,
8536 SPI2_IO4 = 58,
8537 SPI2_IO5 = 59,
8538 SPI2_IO6 = 60,
8539 SPI2_IO7 = 61,
8540 SPI2_CS = 62,
8541 SPI2_CS1 = 63,
8542 SPI2_CS2 = 64,
8543 SPI2_CS3 = 65,
8544 SPI2_CS4 = 66,
8545 SPI2_CS5 = 67,
8546 I2C0_SCL = 68,
8547 I2C0_SDA = 69,
8548 I2C1_SCL = 70,
8549 I2C1_SDA = 71,
8550 GPIO_SD0 = 72,
8551 GPIO_SD1 = 73,
8552 GPIO_SD2 = 74,
8553 GPIO_SD3 = 75,
8554 GPIO_SD4 = 76,
8555 GPIO_SD5 = 77,
8556 GPIO_SD6 = 78,
8557 GPIO_SD7 = 79,
8558 TWAI0_TX = 80,
8559 TWAI0_BUS_OFF_ON = 81,
8560 TWAI0_CLKOUT = 82,
8561 TWAI1_TX = 83,
8562 TWAI1_BUS_OFF_ON = 84,
8563 TWAI1_CLKOUT = 85,
8564 TWAI2_TX = 86,
8565 TWAI2_BUS_OFF_ON = 87,
8566 TWAI2_CLKOUT = 88,
8567 PWM0_CH0_A = 89,
8568 PWM0_CH0_B = 90,
8569 PWM0_CH1_A = 91,
8570 PWM0_CH1_B = 92,
8571 PWM0_CH2_A = 93,
8572 PWM0_CH2_B = 94,
8573 PWM1_CH0_A = 95,
8574 PWM1_CH0_B = 96,
8575 PWM1_CH1_A = 97,
8576 PWM1_CH1_B = 98,
8577 PWM1_CH2_A = 99,
8578 PWM1_CH2_B = 100,
8579 TWAI0_STANDBY = 105,
8580 TWAI1_STANDBY = 106,
8581 TWAI2_STANDBY = 107,
8582 EMAC_MDC = 108,
8583 EMAC_MDO = 109,
8584 USB_SRP_DISCHRGVBUS = 110,
8585 USB_OTG11_IDPULLUP = 111,
8586 USB_OTG11_DPPULLDOWN = 112,
8587 USB_OTG11_DMPULLDOWN = 113,
8588 USB_OTG11_DRVVBUS = 114,
8589 USB_SRP_CHRGVBUS = 115,
8590 RNG_CHAIN_CLK = 117,
8591 I3C_MST_SCL = 134,
8592 I3C_MST_SDA = 135,
8593 I3C_SLV_SCL = 136,
8594 I3C_SLV_SDA = 137,
8595 I3C_MST_SCL_PULLUP_EN = 138,
8596 I3C_MST_SDA_PULLUP_EN = 139,
8597 USB_JTAG_TDI_BRIDGE = 140,
8598 USB_JTAG_TMS_BRIDGE = 141,
8599 USB_JTAG_TCK_BRIDGE = 142,
8600 USB_JTAG_TRST_BRIDGE = 143,
8601 LCD_CS = 144,
8602 LCD_DC = 145,
8603 SD_RST_N_1 = 146,
8604 SD_RST_N_2 = 147,
8605 SDHOST_CCMD_OD_PULLUP_EN_N = 148,
8606 LCD_PCLK = 149,
8607 CAM_CLK = 150,
8608 LCD_H_ENABLE = 151,
8609 LCD_H_SYNC = 152,
8610 LCD_V_SYNC = 153,
8611 EMAC_TXEN = 178,
8612 EMAC_TXD0 = 179,
8613 EMAC_TXD1 = 180,
8614 EMAC_TXD2 = 181,
8615 EMAC_TXD3 = 182,
8616 EMAC_TXER = 183,
8617 PARL_RX_CLK = 186,
8618 PARL_TX_CLK = 187,
8619 PARL_TX_DATA0 = 188,
8620 PARL_TX_DATA1 = 189,
8621 PARL_TX_DATA2 = 190,
8622 PARL_TX_DATA3 = 191,
8623 PARL_TX_DATA4 = 192,
8624 PARL_TX_DATA5 = 193,
8625 PARL_TX_DATA6 = 194,
8626 PARL_TX_DATA7 = 195,
8627 PARL_TX_DATA8 = 196,
8628 PARL_TX_DATA9 = 197,
8629 PARL_TX_DATA10 = 198,
8630 PARL_TX_DATA11 = 199,
8631 PARL_TX_DATA12 = 200,
8632 PARL_TX_DATA13 = 201,
8633 PARL_TX_DATA14 = 202,
8634 PARL_TX_DATA15 = 203,
8635 CONSTANT0 = 212,
8636 CONSTANT1 = 213,
8637 CPU_GPIO_0 = 214,
8638 CPU_GPIO_1 = 215,
8639 CPU_GPIO_2 = 216,
8640 CPU_GPIO_3 = 217,
8641 CPU_GPIO_4 = 218,
8642 CPU_GPIO_5 = 219,
8643 CPU_GPIO_6 = 220,
8644 CPU_GPIO_7 = 221,
8645 CPU_GPIO_8 = 222,
8646 CPU_GPIO_9 = 223,
8647 CPU_GPIO_10 = 224,
8648 CPU_GPIO_11 = 225,
8649 CPU_GPIO_12 = 226,
8650 CPU_GPIO_13 = 227,
8651 CPU_GPIO_14 = 228,
8652 CPU_GPIO_15 = 229,
8653 PARL_TX_CS = 242,
8654 EMAC_PTP_PPS = 243,
8655 ANA_COMP0 = 244,
8656 ANA_COMP1 = 245,
8657 RMT_SIG_0 = 246,
8658 RMT_SIG_1 = 247,
8659 RMT_SIG_2 = 248,
8660 RMT_SIG_3 = 249,
8661 GPIO = 256,
8662 MTCK,
8663 MTDI,
8664 MTMS,
8665 MTDO,
8666 SD1_DATA0,
8667 SD1_DATA1,
8668 SD1_DATA2,
8669 SD1_DATA3,
8670 SD1_CLK,
8671 SD1_CMD,
8672 SD1_DATA4,
8673 SD1_DATA5,
8674 SD1_DATA6,
8675 SD1_DATA7,
8676 EMAC_RMII_CLK,
8677 REF_50M_CLK,
8678 BIST,
8679 DBG_PSRAM_CK,
8680 DBG_PSRAM_CS,
8681 DBG_PSRAM_D,
8682 DBG_PSRAM_Q,
8683 DBG_PSRAM_WP,
8684 DBG_PSRAM_HOLD,
8685 DBG_PSRAM_DQ4,
8686 DBG_PSRAM_DQ5,
8687 DBG_PSRAM_DQ6,
8688 DBG_PSRAM_DQ7,
8689 DBG_PSRAM_DQS_0,
8690 DBG_PSRAM_DQ8,
8691 DBG_PSRAM_DQ9,
8692 DBG_PSRAM_DQ10,
8693 DBG_PSRAM_DQ11,
8694 DBG_PSRAM_DQ12,
8695 DBG_PSRAM_DQ13,
8696 DBG_PSRAM_DQ14,
8697 DBG_PSRAM_DQ15,
8698 DBG_PSRAM_DQS_1,
8699 DBG_FLASH_CS,
8700 DBG_FLASH_Q,
8701 DBG_FLASH_WP,
8702 DBG_FLASH_HOLD,
8703 DBG_FLASH_CK,
8704 DBG_FLASH_D,
8705 }
8706 };
8707}
8708#[macro_export]
8715#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8716macro_rules! define_lp_functions {
8717 () => {
8718 #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
8723 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
8724 #[doc(hidden)]
8725 pub enum LpFunction {
8726 _0 = 0,
8728 _1 = 1,
8730 }
8731 impl LpFunction {
8732 pub const LP_GPIO: Self = Self::_1;
8734 }
8735 };
8736}
8737#[macro_export]
8750#[expect(clippy::crate_in_macro_def)]
8751#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
8752macro_rules! define_io_mux_reg {
8753 () => {
8754 pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
8755 crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
8756 }
8757 };
8758}