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 "esp32"
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"
34 };
35}
36#[macro_export]
38#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
39macro_rules! property {
40 ("chip") => {
41 "esp32"
42 };
43 ("arch") => {
44 "xtensa"
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_technical_reference_manual_en.pdf"
54 };
55 ("gpio.version") => {
56 1
57 };
58 ("gpio.version", str) => {
59 stringify!(1)
60 };
61 ("gpio.has_input_sync") => {
62 false
63 };
64 ("gpio.gpio_function") => {
65 2
66 };
67 ("gpio.gpio_function", str) => {
68 stringify!(2)
69 };
70 ("gpio.constant_0_input") => {
71 48
72 };
73 ("gpio.constant_0_input", str) => {
74 stringify!(48)
75 };
76 ("gpio.constant_1_input") => {
77 56
78 };
79 ("gpio.constant_1_input", str) => {
80 stringify!(56)
81 };
82 ("gpio.remap_iomux_pin_registers") => {
83 true
84 };
85 ("gpio.func_in_sel_offset") => {
86 0
87 };
88 ("gpio.func_in_sel_offset", str) => {
89 stringify!(0)
90 };
91 ("gpio.need_soft_isolate_during_pd") => {
92 false
93 };
94 ("gpio.has_bank_1") => {
95 true
96 };
97 ("gpio.input_signal_max") => {
98 206
99 };
100 ("gpio.input_signal_max", str) => {
101 stringify!(206)
102 };
103 ("gpio.output_signal_max") => {
104 256
105 };
106 ("gpio.output_signal_max", str) => {
107 stringify!(256)
108 };
109 ("lp_io.version") => {
110 "esp32"
111 };
112 ("lp_io.has_gpio_matrix") => {
113 false
114 };
115 ("uart.ram_size") => {
116 128
117 };
118 ("uart.ram_size", str) => {
119 stringify!(128)
120 };
121 ("uart.version") => {
122 1
123 };
124 ("uart.version", str) => {
125 stringify!(1)
126 };
127 ("uart.peripheral_controls_mem_clk") => {
128 false
129 };
130 ("uart.has_sclk_divider") => {
131 false
132 };
133 ("uart.has_sclk_enable") => {
134 false
135 };
136 ("i2c_master.version") => {
137 1
138 };
139 ("i2c_master.version", str) => {
140 stringify!(1)
141 };
142 ("i2c_master.has_fsm_timeouts") => {
143 false
144 };
145 ("i2c_master.has_hw_bus_clear") => {
146 false
147 };
148 ("i2c_master.has_bus_timeout_enable") => {
149 false
150 };
151 ("i2c_master.separate_filter_config_registers") => {
152 true
153 };
154 ("i2c_master.can_estimate_nack_reason") => {
155 false
156 };
157 ("i2c_master.has_conf_update") => {
158 false
159 };
160 ("i2c_master.has_reliable_fsm_reset") => {
161 false
162 };
163 ("i2c_master.has_arbitration_en") => {
164 false
165 };
166 ("i2c_master.has_tx_fifo_watermark") => {
167 false
168 };
169 ("i2c_master.bus_timeout_is_exponential") => {
170 false
171 };
172 ("i2c_master.has_pd_en") => {
173 false
174 };
175 ("i2c_master.i2c0_data_register_ahb_address") => {
176 1610690588
177 };
178 ("i2c_master.i2c0_data_register_ahb_address", str) => {
179 stringify!(1610690588)
180 };
181 ("i2c_master.max_bus_timeout") => {
182 1048575
183 };
184 ("i2c_master.max_bus_timeout", str) => {
185 stringify!(1048575)
186 };
187 ("i2c_master.ll_intr_mask") => {
188 262143
189 };
190 ("i2c_master.ll_intr_mask", str) => {
191 stringify!(262143)
192 };
193 ("i2c_master.fifo_size") => {
194 32
195 };
196 ("i2c_master.fifo_size", str) => {
197 stringify!(32)
198 };
199 ("spi_master.version") => {
200 1
201 };
202 ("spi_master.version", str) => {
203 stringify!(1)
204 };
205 ("spi_master.fifo_size") => {
206 64
207 };
208 ("spi_master.fifo_size", str) => {
209 stringify!(64)
210 };
211 ("spi_master.bit_order_is_bool") => {
212 true
213 };
214 ("spi_master.has_octal") => {
215 false
216 };
217 ("spi_master.has_app_interrupts") => {
218 false
219 };
220 ("spi_master.has_dma_segmented_transfer") => {
221 false
222 };
223 ("spi_master.has_clk_pre_div") => {
224 false
225 };
226 ("spi_master.dma_can_access_flash") => {
227 false
228 };
229 ("i2s.version") => {
230 1
231 };
232 ("i2s.version", str) => {
233 stringify!(1)
234 };
235 ("i2s.mclk_divider_bit_width") => {
236 6
237 };
238 ("i2s.mclk_divider_bit_width", str) => {
239 stringify!(6)
240 };
241 ("i2s.max_ws_width") => {
242 128
243 };
244 ("i2s.max_ws_width", str) => {
245 stringify!(128)
246 };
247 ("i2s.clock_configured_by_pcr") => {
248 false
249 };
250 ("i2s.clock_configured_by_hp_sys_clkrst") => {
251 false
252 };
253 ("i2s.supports_pdm_rx_hp_filter") => {
254 false
255 };
256 ("i2s.supports_pdm_tx") => {
257 true
258 };
259 ("i2s.supports_pdm_rx") => {
260 true
261 };
262 ("i2s.supports_pcm2pdm") => {
263 true
264 };
265 ("i2s.supports_pdm2pcm") => {
266 true
267 };
268 ("rmt.ram_start") => {
269 1073047552
270 };
271 ("rmt.ram_start", str) => {
272 stringify!(1073047552)
273 };
274 ("rmt.channel_ram_size") => {
275 64
276 };
277 ("rmt.channel_ram_size", str) => {
278 stringify!(64)
279 };
280 ("rmt.has_tx_immediate_stop") => {
281 false
282 };
283 ("rmt.has_tx_loop_count") => {
284 false
285 };
286 ("rmt.has_tx_loop_auto_stop") => {
287 false
288 };
289 ("rmt.has_tx_carrier_data_only") => {
290 false
291 };
292 ("rmt.has_tx_sync") => {
293 false
294 };
295 ("rmt.has_rx_wrap") => {
296 false
297 };
298 ("rmt.has_rx_demodulation") => {
299 false
300 };
301 ("rmt.has_per_channel_clock") => {
302 true
303 };
304 ("sdmmc.has_iomux") => {
305 true
306 };
307 ("sdmmc.has_gpio_matrix") => {
308 false
309 };
310 ("sdmmc.psram_dma") => {
311 false
312 };
313 ("sdmmc.uhs") => {
314 false
315 };
316 ("bt.controller") => {
317 "btdm"
318 };
319 ("bt.requires_fast_cpu") => {
320 false
321 };
322 ("bt.bredr") => {
323 true
324 };
325 ("wifi.has_wifi6") => {
326 false
327 };
328 ("wifi.mac_version") => {
329 1
330 };
331 ("wifi.mac_version", str) => {
332 stringify!(1)
333 };
334 ("wifi.has_5g") => {
335 false
336 };
337 ("wifi.csi_supported") => {
338 true
339 };
340 ("wifi.has_nan") => {
341 true
342 };
343 ("wifi.has_ftm") => {
344 false
345 };
346 ("wifi.requires_fast_cpu") => {
347 false
348 };
349 ("ethernet.mii_via_gpio_matrix") => {
350 false
351 };
352 ("ethernet.rx_store_and_forward") => {
353 true
354 };
355 ("ethernet.rx_checksum_offload") => {
356 false
357 };
358 ("ethernet.tx_checksum_offload") => {
359 false
360 };
361 ("ethernet.dma_burst_len") => {
362 32
363 };
364 ("ethernet.dma_burst_len", str) => {
365 stringify!(32)
366 };
367 ("ethernet.dma_alignment") => {
368 4
369 };
370 ("ethernet.dma_alignment", str) => {
371 stringify!(4)
372 };
373 ("ethernet.has_rgmii") => {
374 false
375 };
376 ("phy.combo_module") => {
377 true
378 };
379 ("phy.hw_freq_hop") => {
380 false
381 };
382 ("rgb_display.output_lines") => {
383 24
384 };
385 ("rgb_display.output_lines", str) => {
386 stringify!(24)
387 };
388 ("rgb_display.has_rgb_timing_registers") => {
389 false
390 };
391 ("adc.line_calibration") => {
392 true
393 };
394 ("adc.curve_calibration") => {
395 false
396 };
397 ("adc.basic_calibration") => {
398 false
399 };
400 ("adc.calibration_v1_scheme_supported") => {
401 false
402 };
403 ("adc.channel_compensation") => {
404 false
405 };
406 ("adc.pcr_clock") => {
407 false
408 };
409 ("adc.pcr_sar_clk_div") => {
410 false
411 };
412 ("adc.sar_power_override") => {
413 false
414 };
415 ("dac.version") => {
416 1
417 };
418 ("dac.version", str) => {
419 stringify!(1)
420 };
421 ("dac.channel_count") => {
422 2
423 };
424 ("dac.channel_count", str) => {
425 stringify!(2)
426 };
427 ("dac.resolution") => {
428 8
429 };
430 ("dac.resolution", str) => {
431 stringify!(8)
432 };
433 ("ledc.version") => {
434 1
435 };
436 ("ledc.version", str) => {
437 stringify!(1)
438 };
439 ("ledc.channel_count") => {
440 8
441 };
442 ("ledc.channel_count", str) => {
443 stringify!(8)
444 };
445 ("sdm.channel_count") => {
446 8
447 };
448 ("sdm.channel_count", str) => {
449 stringify!(8)
450 };
451 ("timergroup.timg_has_timer1") => {
452 true
453 };
454 ("timergroup.timg_has_divcnt_rst") => {
455 false
456 };
457 ("timergroup.wdt_has_conf_update") => {
458 false
459 };
460 ("aes.has_split_text_registers") => {
461 false
462 };
463 ("aes.endianness_configurable") => {
464 true
465 };
466 ("rng.apb_cycle_wait_num") => {
467 16
468 };
469 ("rng.apb_cycle_wait_num", str) => {
470 stringify!(16)
471 };
472 ("rng.trng_supported") => {
473 true
474 };
475 ("rng.is_lp_sys") => {
476 false
477 };
478 ("rsa.version") => {
479 1
480 };
481 ("rsa.version", str) => {
482 stringify!(1)
483 };
484 ("rsa.size_increment") => {
485 512
486 };
487 ("rsa.size_increment", str) => {
488 stringify!(512)
489 };
490 ("rsa.memory_size_bytes") => {
491 512
492 };
493 ("rsa.memory_size_bytes", str) => {
494 stringify!(512)
495 };
496 ("sleep.light_sleep") => {
497 true
498 };
499 ("sleep.deep_sleep") => {
500 true
501 };
502 ("sleep.rejectable_mask") => {
503 20
504 };
505 ("sleep.ext1_version") => {
506 1
507 };
508 ("sleep.ext1_version", str) => {
509 stringify!(1)
510 };
511 ("sleep.pin_wakeup_version") => {
512 1
513 };
514 ("sleep.pin_wakeup_version", str) => {
515 stringify!(1)
516 };
517 ("sleep.deep_sleep_needs_gpio_isolation") => {
518 true
519 };
520 ("sleep.idle_frequency_scaling") => {
521 false
522 };
523 ("dma.mem2mem_requires_peripheral") => {
524 false
525 };
526 ("dma.ext_mem_configurable_block_size") => {
527 false
528 };
529 ("dma.separate_in_out_interrupts") => {
530 false
531 };
532 ("interrupts.status_registers") => {
533 3
534 };
535 ("interrupts.status_registers", str) => {
536 stringify!(3)
537 };
538 ("mmu.page_size") => {
539 65536
540 };
541 ("mmu.page_size", str) => {
542 stringify!(65536)
543 };
544 ("mmu.entry_num") => {
545 256
546 };
547 ("mmu.entry_num", str) => {
548 stringify!(256)
549 };
550 ("psram.octal_spi") => {
551 false
552 };
553 ("psram.hex_spi") => {
554 false
555 };
556 ("psram.supports_code_in_psram") => {
557 false
558 };
559 ("psram.separate_window") => {
560 false
561 };
562 ("psram.has_timing_tuning") => {
563 false
564 };
565 ("psram.extmem_origin") => {
566 1065353216
567 };
568 ("psram.extmem_origin", str) => {
569 stringify!(1065353216)
570 };
571 ("psram.idle_low_speed_switch") => {
572 false
573 };
574 ("rom.has_crc_le") => {
575 true
576 };
577 ("rom.has_crc_be") => {
578 true
579 };
580 ("rom.has_md5_bsd") => {
581 true
582 };
583 ("rom.has_md5_mbedtls") => {
584 false
585 };
586 ("rom.no_libgcc") => {
587 false
588 };
589 ("soc.cpu_has_branch_predictor") => {
590 false
591 };
592 ("soc.cpu_has_csr_pc") => {
593 false
594 };
595 ("soc.cpu_has_zcmp_workaround") => {
596 false
597 };
598 ("soc.multi_core_enabled") => {
599 true
600 };
601 ("soc.cpu_pma_needs_core1_setup") => {
602 false
603 };
604 ("soc.internal_memory_cached") => {
605 false
606 };
607 ("soc.cpu_powers_down_cache") => {
608 false
609 };
610 ("soc.has_swd_watchdog") => {
611 false
612 };
613 ("soc.has_bus_clock_update") => {
614 false
615 };
616 ("soc.has_apb_frequency_reduction") => {
617 false
618 };
619 ("soc.cpu_mcause_mask") => {
620 0
621 };
622 ("soc.cpu_mcause_mask", str) => {
623 stringify!(0)
624 };
625 ("soc.cpu_pmp_granularity") => {
626 4
627 };
628 ("soc.cpu_pmp_granularity", str) => {
629 stringify!(4)
630 };
631 ("clock_tree.cpu_pll_div_in") => {
632 [crate ::soc::clocks::CpuPllDivInConfig::Pll, crate
633 ::soc::clocks::CpuPllDivInConfig::Apll]
634 };
635 ("clock_tree.cpu_pll_div.divisor") => {
636 [2, 4]
637 };
638 ("clock_tree.syscon_pre_div_in") => {
639 [crate ::soc::clocks::SysconPreDivInConfig::Xtal, crate
640 ::soc::clocks::SysconPreDivInConfig::RcFast]
641 };
642 ("clock_tree.syscon_pre_div.divisor") => {
643 (0, 1023)
644 };
645 ("clock_tree.cpu_clk") => {
646 [crate ::soc::clocks::CpuClkConfig::Xtal, crate
647 ::soc::clocks::CpuClkConfig::RcFast, crate ::soc::clocks::CpuClkConfig::Apll,
648 crate ::soc::clocks::CpuClkConfig::Pll]
649 };
650 ("clock_tree.apb_clk") => {
651 [crate ::soc::clocks::ApbClkConfig::Pll80m, crate
652 ::soc::clocks::ApbClkConfig::CpuDiv2, crate ::soc::clocks::ApbClkConfig::Cpu]
653 };
654 ("clock_tree.ref_tick_pll.divisor") => {
655 (0, 255)
656 };
657 ("clock_tree.ref_tick_apll.divisor") => {
658 (0, 255)
659 };
660 ("clock_tree.ref_tick_xtal.divisor") => {
661 (0, 255)
662 };
663 ("clock_tree.ref_tick_fosc.divisor") => {
664 (0, 255)
665 };
666 ("clock_tree.ref_tick") => {
667 [crate ::soc::clocks::RefTickConfig::Pll, crate
668 ::soc::clocks::RefTickConfig::Apll, crate ::soc::clocks::RefTickConfig::Xtal,
669 crate ::soc::clocks::RefTickConfig::Fosc]
670 };
671 ("clock_tree.rtc_slow_clk") => {
672 [#[cfg(use_xtal32k)] crate ::soc::clocks::RtcSlowClkConfig::Xtal32k, crate
673 ::soc::clocks::RtcSlowClkConfig::RcSlow, crate
674 ::soc::clocks::RtcSlowClkConfig::RcFast]
675 };
676 ("clock_tree.ble_lp_clk") => {
677 [crate ::soc::clocks::BleLpClkConfig::Xtal, crate
678 ::soc::clocks::BleLpClkConfig::RtcSlow]
679 };
680 ("clock_tree.rtc_fast_clk") => {
681 [crate ::soc::clocks::RtcFastClkConfig::Xtal, crate
682 ::soc::clocks::RtcFastClkConfig::Rc]
683 };
684 ("clock_tree.timg_calibration_clock") => {
685 [crate ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, crate
686 ::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
687 crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
688 };
689 ("clock_tree.i2c.function_clock.sclk") => {
690 [crate ::soc::clocks::I2cFunctionClockSclk::Apb]
691 };
692 ("clock_tree.uart.function_clock.sclk") => {
693 [crate ::soc::clocks::UartFunctionClockSclk::Apb, crate
694 ::soc::clocks::UartFunctionClockSclk::RefTick]
695 };
696 ("clock_tree.uart.baud_rate_generator.fractional") => {
697 (0, 15)
698 };
699 ("clock_tree.uart.baud_rate_generator.integral") => {
700 (0, 1048575)
701 };
702 ("clock_tree.rmt.sclk") => {
703 [crate ::soc::clocks::RmtSclkConfig::RefTick, crate
704 ::soc::clocks::RmtSclkConfig::ApbClk]
705 };
706 ("clock_tree.i2s.mclk.sclk") => {
707 [crate ::soc::clocks::I2sMclkSclk::PllF160m, crate
708 ::soc::clocks::I2sMclkSclk::Apll]
709 };
710 ("clock_tree.i2s.mclk.div_num") => {
711 (1, 255)
712 };
713 ("clock_tree.i2s.mclk.div_a") => {
714 (1, 63)
715 };
716 ("clock_tree.i2s.mclk.div_b") => {
717 (0, 63)
718 };
719}
720#[macro_export]
724#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
725macro_rules! define_lp_io_signals {
726 () => {};
727}
728#[macro_export]
757#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
758macro_rules! for_each_rmt_channel {
759 ($($pattern:tt => $code:tt;)*) => {
760 macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
761 => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
762 _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
763 _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
764 _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
765 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
766 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
767 _for_each_inner_rmt_channel!((4, 4)); _for_each_inner_rmt_channel!((5, 5));
768 _for_each_inner_rmt_channel!((6, 6)); _for_each_inner_rmt_channel!((7, 7));
769 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
770 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
771 _for_each_inner_rmt_channel!((4, 4)); _for_each_inner_rmt_channel!((5, 5));
772 _for_each_inner_rmt_channel!((6, 6)); _for_each_inner_rmt_channel!((7, 7));
773 _for_each_inner_rmt_channel!((2, (RMT_CH0, RMT_CH1)));
774 _for_each_inner_rmt_channel!((3, (RMT_CH0, RMT_CH1, RMT_CH2)));
775 _for_each_inner_rmt_channel!((4, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3)));
776 _for_each_inner_rmt_channel!((5, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)));
777 _for_each_inner_rmt_channel!((6, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4,
778 RMT_CH5))); _for_each_inner_rmt_channel!((7, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3,
779 RMT_CH4, RMT_CH5, RMT_CH6))); _for_each_inner_rmt_channel!((8, (RMT_CH0, RMT_CH1,
780 RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)));
781 _for_each_inner_rmt_channel!((2, (RMT_CH1, RMT_CH2)));
782 _for_each_inner_rmt_channel!((3, (RMT_CH1, RMT_CH2, RMT_CH3)));
783 _for_each_inner_rmt_channel!((4, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)));
784 _for_each_inner_rmt_channel!((5, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)));
785 _for_each_inner_rmt_channel!((6, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5,
786 RMT_CH6))); _for_each_inner_rmt_channel!((7, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4,
787 RMT_CH5, RMT_CH6, RMT_CH7))); _for_each_inner_rmt_channel!((2, (RMT_CH2,
788 RMT_CH3))); _for_each_inner_rmt_channel!((3, (RMT_CH2, RMT_CH3, RMT_CH4)));
789 _for_each_inner_rmt_channel!((4, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)));
790 _for_each_inner_rmt_channel!((5, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6)));
791 _for_each_inner_rmt_channel!((6, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6,
792 RMT_CH7))); _for_each_inner_rmt_channel!((2, (RMT_CH3, RMT_CH4)));
793 _for_each_inner_rmt_channel!((3, (RMT_CH3, RMT_CH4, RMT_CH5)));
794 _for_each_inner_rmt_channel!((4, (RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6)));
795 _for_each_inner_rmt_channel!((5, (RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)));
796 _for_each_inner_rmt_channel!((2, (RMT_CH4, RMT_CH5)));
797 _for_each_inner_rmt_channel!((3, (RMT_CH4, RMT_CH5, RMT_CH6)));
798 _for_each_inner_rmt_channel!((4, (RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)));
799 _for_each_inner_rmt_channel!((2, (RMT_CH5, RMT_CH6)));
800 _for_each_inner_rmt_channel!((3, (RMT_CH5, RMT_CH6, RMT_CH7)));
801 _for_each_inner_rmt_channel!((2, (RMT_CH6, RMT_CH7)));
802 _for_each_inner_rmt_channel!((2, (RMT_CH0, RMT_CH1)));
803 _for_each_inner_rmt_channel!((3, (RMT_CH0, RMT_CH1, RMT_CH2)));
804 _for_each_inner_rmt_channel!((4, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3)));
805 _for_each_inner_rmt_channel!((5, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)));
806 _for_each_inner_rmt_channel!((6, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4,
807 RMT_CH5))); _for_each_inner_rmt_channel!((7, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3,
808 RMT_CH4, RMT_CH5, RMT_CH6))); _for_each_inner_rmt_channel!((8, (RMT_CH0, RMT_CH1,
809 RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)));
810 _for_each_inner_rmt_channel!((2, (RMT_CH1, RMT_CH2)));
811 _for_each_inner_rmt_channel!((3, (RMT_CH1, RMT_CH2, RMT_CH3)));
812 _for_each_inner_rmt_channel!((4, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)));
813 _for_each_inner_rmt_channel!((5, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)));
814 _for_each_inner_rmt_channel!((6, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5,
815 RMT_CH6))); _for_each_inner_rmt_channel!((7, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4,
816 RMT_CH5, RMT_CH6, RMT_CH7))); _for_each_inner_rmt_channel!((2, (RMT_CH2,
817 RMT_CH3))); _for_each_inner_rmt_channel!((3, (RMT_CH2, RMT_CH3, RMT_CH4)));
818 _for_each_inner_rmt_channel!((4, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)));
819 _for_each_inner_rmt_channel!((5, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6)));
820 _for_each_inner_rmt_channel!((6, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6,
821 RMT_CH7))); _for_each_inner_rmt_channel!((2, (RMT_CH3, RMT_CH4)));
822 _for_each_inner_rmt_channel!((3, (RMT_CH3, RMT_CH4, RMT_CH5)));
823 _for_each_inner_rmt_channel!((4, (RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6)));
824 _for_each_inner_rmt_channel!((5, (RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)));
825 _for_each_inner_rmt_channel!((2, (RMT_CH4, RMT_CH5)));
826 _for_each_inner_rmt_channel!((3, (RMT_CH4, RMT_CH5, RMT_CH6)));
827 _for_each_inner_rmt_channel!((4, (RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)));
828 _for_each_inner_rmt_channel!((2, (RMT_CH5, RMT_CH6)));
829 _for_each_inner_rmt_channel!((3, (RMT_CH5, RMT_CH6, RMT_CH7)));
830 _for_each_inner_rmt_channel!((2, (RMT_CH6, RMT_CH7)));
831 _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
832 _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
833 (6, 6), (7, 7))); _for_each_inner_rmt_channel!((rx(0, 0), (1, 1), (2, 2), (3, 3),
834 (4, 4), (5, 5), (6, 6), (7, 7))); _for_each_inner_rmt_channel!((tx_tuples(2,
835 (RMT_CH0, RMT_CH1)), (3, (RMT_CH0, RMT_CH1, RMT_CH2)), (4, (RMT_CH0, RMT_CH1,
836 RMT_CH2, RMT_CH3)), (5, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)), (6,
837 (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)), (7, (RMT_CH0, RMT_CH1,
838 RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6)), (8, (RMT_CH0, RMT_CH1, RMT_CH2,
839 RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)), (2, (RMT_CH1, RMT_CH2)), (3,
840 (RMT_CH1, RMT_CH2, RMT_CH3)), (4, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)), (5,
841 (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)), (6, (RMT_CH1, RMT_CH2, RMT_CH3,
842 RMT_CH4, RMT_CH5, RMT_CH6)), (7, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5,
843 RMT_CH6, RMT_CH7)), (2, (RMT_CH2, RMT_CH3)), (3, (RMT_CH2, RMT_CH3, RMT_CH4)),
844 (4, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)), (5, (RMT_CH2, RMT_CH3, RMT_CH4,
845 RMT_CH5, RMT_CH6)), (6, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)),
846 (2, (RMT_CH3, RMT_CH4)), (3, (RMT_CH3, RMT_CH4, RMT_CH5)), (4, (RMT_CH3, RMT_CH4,
847 RMT_CH5, RMT_CH6)), (5, (RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)), (2,
848 (RMT_CH4, RMT_CH5)), (3, (RMT_CH4, RMT_CH5, RMT_CH6)), (4, (RMT_CH4, RMT_CH5,
849 RMT_CH6, RMT_CH7)), (2, (RMT_CH5, RMT_CH6)), (3, (RMT_CH5, RMT_CH6, RMT_CH7)),
850 (2, (RMT_CH6, RMT_CH7)))); _for_each_inner_rmt_channel!((rx_tuples(2, (RMT_CH0,
851 RMT_CH1)), (3, (RMT_CH0, RMT_CH1, RMT_CH2)), (4, (RMT_CH0, RMT_CH1, RMT_CH2,
852 RMT_CH3)), (5, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)), (6, (RMT_CH0,
853 RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)), (7, (RMT_CH0, RMT_CH1, RMT_CH2,
854 RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6)), (8, (RMT_CH0, RMT_CH1, RMT_CH2, RMT_CH3,
855 RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)), (2, (RMT_CH1, RMT_CH2)), (3, (RMT_CH1,
856 RMT_CH2, RMT_CH3)), (4, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4)), (5, (RMT_CH1,
857 RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)), (6, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4,
858 RMT_CH5, RMT_CH6)), (7, (RMT_CH1, RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6,
859 RMT_CH7)), (2, (RMT_CH2, RMT_CH3)), (3, (RMT_CH2, RMT_CH3, RMT_CH4)), (4,
860 (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5)), (5, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5,
861 RMT_CH6)), (6, (RMT_CH2, RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)), (2,
862 (RMT_CH3, RMT_CH4)), (3, (RMT_CH3, RMT_CH4, RMT_CH5)), (4, (RMT_CH3, RMT_CH4,
863 RMT_CH5, RMT_CH6)), (5, (RMT_CH3, RMT_CH4, RMT_CH5, RMT_CH6, RMT_CH7)), (2,
864 (RMT_CH4, RMT_CH5)), (3, (RMT_CH4, RMT_CH5, RMT_CH6)), (4, (RMT_CH4, RMT_CH5,
865 RMT_CH6, RMT_CH7)), (2, (RMT_CH5, RMT_CH6)), (3, (RMT_CH5, RMT_CH6, RMT_CH7)),
866 (2, (RMT_CH6, RMT_CH7))));
867 };
868}
869#[macro_export]
894#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
895macro_rules! for_each_sdmmc {
896 ($($pattern:tt => $code:tt;)*) => {
897 macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
898 } _for_each_inner_sdmmc!((slot0, 0, true, [], [], [], [], [],
899 [HOST_CARD_DETECT_N_1], [HOST_CARD_WRITE_PRT_1], [HOST_CARD_INT_N_1], [],
900 [HOST_RST_N_1])); _for_each_inner_sdmmc!((slot1, 1, true, [], [], [], [], [],
901 [HOST_CARD_DETECT_N_2], [HOST_CARD_WRITE_PRT_2], [HOST_CARD_INT_N_2], [],
902 [HOST_RST_N_2])); _for_each_inner_sdmmc!((all(slot0, 0, true, [], [], [], [], [],
903 [HOST_CARD_DETECT_N_1], [HOST_CARD_WRITE_PRT_1], [HOST_CARD_INT_N_1], [],
904 [HOST_RST_N_1]), (slot1, 1, true, [], [], [], [], [], [HOST_CARD_DETECT_N_2],
905 [HOST_CARD_WRITE_PRT_2], [HOST_CARD_INT_N_2], [], [HOST_RST_N_2])));
906 };
907}
908#[macro_export]
909#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
910macro_rules! for_each_sdm_channel {
911 ($($pattern:tt => $code:tt;)*) => {
912 macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
913 => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
914 _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
915 _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
916 _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
917 _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
918 _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
919 _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
920 _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
921 _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
922 SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
923 GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
924 SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
925 };
926}
927#[macro_export]
928#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
929macro_rules! for_each_aes_key_length {
930 ($($pattern:tt => $code:tt;)*) => {
931 macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
932 tt) => {} } _for_each_inner_aes_key_length!((128));
933 _for_each_inner_aes_key_length!((192)); _for_each_inner_aes_key_length!((256));
934 _for_each_inner_aes_key_length!((128, 0, 4));
935 _for_each_inner_aes_key_length!((192, 1, 5));
936 _for_each_inner_aes_key_length!((256, 2, 6));
937 _for_each_inner_aes_key_length!((bits(128), (192), (256)));
938 _for_each_inner_aes_key_length!((modes(128, 0, 4), (192, 1, 5), (256, 2, 6)));
939 };
940}
941#[macro_export]
942#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
943macro_rules! for_each_rsa_exponentiation {
944 ($($pattern:tt => $code:tt;)*) => {
945 macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
946 ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((512));
947 _for_each_inner_rsa_exponentiation!((1024));
948 _for_each_inner_rsa_exponentiation!((1536));
949 _for_each_inner_rsa_exponentiation!((2048));
950 _for_each_inner_rsa_exponentiation!((2560));
951 _for_each_inner_rsa_exponentiation!((3072));
952 _for_each_inner_rsa_exponentiation!((3584));
953 _for_each_inner_rsa_exponentiation!((4096));
954 _for_each_inner_rsa_exponentiation!((all(512), (1024), (1536), (2048), (2560),
955 (3072), (3584), (4096)));
956 };
957}
958#[macro_export]
959#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
960macro_rules! for_each_rsa_multiplication {
961 ($($pattern:tt => $code:tt;)*) => {
962 macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
963 ($other : tt) => {} } _for_each_inner_rsa_multiplication!((512));
964 _for_each_inner_rsa_multiplication!((1024));
965 _for_each_inner_rsa_multiplication!((1536));
966 _for_each_inner_rsa_multiplication!((2048));
967 _for_each_inner_rsa_multiplication!((all(512), (1024), (1536), (2048)));
968 };
969}
970#[macro_export]
971#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
972macro_rules! for_each_sha_algorithm {
973 ($($pattern:tt => $code:tt;)*) => {
974 macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
975 tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
976 (insecure_against : "collision", "length extension"), 0));
977 _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
978 (insecure_against : "length extension"), 0));
979 _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
980 (insecure_against :), 0)); _for_each_inner_sha_algorithm!((Sha512,
981 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 0));
982 _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
983 (insecure_against : "collision", "length extension"), 0), (Sha256,
984 "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"), 0),
985 (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 0), (Sha512,
986 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 0)));
987 };
988}
989#[macro_export]
990#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
991macro_rules! for_each_wakeup_source {
992 ($($pattern:tt => $code:tt;)*) => {
993 macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
994 tt) => {} } _for_each_inner_wakeup_source!((Ext0, 0));
995 _for_each_inner_wakeup_source!((Ext1, 1)); _for_each_inner_wakeup_source!((Gpio,
996 2)); _for_each_inner_wakeup_source!((Timer, 3));
997 _for_each_inner_wakeup_source!((Sdio, 4)); _for_each_inner_wakeup_source!((Wifi,
998 5)); _for_each_inner_wakeup_source!((Uart0, 6));
999 _for_each_inner_wakeup_source!((Uart1, 7));
1000 _for_each_inner_wakeup_source!((Touch, 8)); _for_each_inner_wakeup_source!((Ulp,
1001 9)); _for_each_inner_wakeup_source!((Bt, 10));
1002 _for_each_inner_wakeup_source!((all(Ext0, 0), (Ext1, 1), (Gpio, 2), (Timer, 3),
1003 (Sdio, 4), (Wifi, 5), (Uart0, 6), (Uart1, 7), (Touch, 8), (Ulp, 9), (Bt, 10)));
1004 };
1005}
1006#[macro_export]
1007#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1008macro_rules! for_each_dma_engine {
1009 ($($pattern:tt => $code:tt;)*) => {
1010 macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
1011 => {} } _for_each_inner_dma_engine!(("SPI_DMA"));
1012 _for_each_inner_dma_engine!(("I2S_DMA")); _for_each_inner_dma_engine!(("SPI_DMA",
1013 internal = [Disabled, Enabled], external = [], external_default = Size32));
1014 _for_each_inner_dma_engine!(("I2S_DMA", internal = [Disabled, Enabled], external
1015 = [], external_default = Size32)); _for_each_inner_dma_engine!((all("SPI_DMA"),
1016 ("I2S_DMA"))); _for_each_inner_dma_engine!((priority));
1017 _for_each_inner_dma_engine!((burst("SPI_DMA", internal = [Disabled, Enabled],
1018 external = [], external_default = Size32), ("I2S_DMA", internal = [Disabled,
1019 Enabled], external = [], external_default = Size32)));
1020 };
1021}
1022#[macro_export]
1023#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1024macro_rules! for_each_dma_channel {
1025 ($($pattern:tt => $code:tt;)*) => {
1026 macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
1027 => {} } _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI2));
1028 _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI3));
1029 _for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S0));
1030 _for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S1));
1031 _for_each_inner_dma_channel!(("SPI_DMA", any_channel = SpiDmaChannel));
1032 _for_each_inner_dma_channel!(("I2S_DMA", any_channel = I2sDmaChannel));
1033 _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI2, 0, interrupt = SPI2_DMA,
1034 compatible = [SPI2])); _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI3, 1,
1035 interrupt = SPI3_DMA, compatible = [SPI3]));
1036 _for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S0, 0, interrupt = I2S0,
1037 compatible = [I2S0])); _for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S1, 1,
1038 interrupt = I2S1, compatible = [I2S1])); _for_each_inner_dma_channel!(("SPI_DMA",
1039 DMA_SPI2, can_access_psram = false)); _for_each_inner_dma_channel!(("SPI_DMA",
1040 DMA_SPI3, can_access_psram = false)); _for_each_inner_dma_channel!(("I2S_DMA",
1041 DMA_I2S0, can_access_psram = false)); _for_each_inner_dma_channel!(("I2S_DMA",
1042 DMA_I2S1, can_access_psram = false));
1043 _for_each_inner_dma_channel!((names("SPI_DMA", DMA_SPI2), ("SPI_DMA", DMA_SPI3),
1044 ("I2S_DMA", DMA_I2S0), ("I2S_DMA", DMA_I2S1)));
1045 _for_each_inner_dma_channel!((separate_any_type("SPI_DMA", any_channel =
1046 SpiDmaChannel), ("I2S_DMA", any_channel = I2sDmaChannel)));
1047 _for_each_inner_dma_channel!((shared("SPI_DMA", DMA_SPI2, 0, interrupt =
1048 SPI2_DMA, compatible = [SPI2]), ("SPI_DMA", DMA_SPI3, 1, interrupt = SPI3_DMA,
1049 compatible = [SPI3]), ("I2S_DMA", DMA_I2S0, 0, interrupt = I2S0, compatible =
1050 [I2S0]), ("I2S_DMA", DMA_I2S1, 1, interrupt = I2S1, compatible = [I2S1])));
1051 _for_each_inner_dma_channel!((split));
1052 _for_each_inner_dma_channel!((no_own_interrupt));
1053 _for_each_inner_dma_channel!((psram("SPI_DMA", DMA_SPI2, can_access_psram =
1054 false), ("SPI_DMA", DMA_SPI3, can_access_psram = false), ("I2S_DMA", DMA_I2S0,
1055 can_access_psram = false), ("I2S_DMA", DMA_I2S1, can_access_psram = false)));
1056 };
1057}
1058#[macro_export]
1059#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1060macro_rules! for_each_dma_channel_peri_pair {
1061 ($($pattern:tt => $code:tt;)*) => {
1062 macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1063 ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("SPI_DMA",
1064 DMA_SPI2, SPI2)); _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", DMA_SPI3,
1065 SPI3)); _for_each_inner_dma_channel_peri_pair!(("I2S_DMA", DMA_I2S0, I2S0));
1066 _for_each_inner_dma_channel_peri_pair!(("I2S_DMA", DMA_I2S1, I2S1));
1067 _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", any_channel = SpiDmaChannel,
1068 SPI2)); _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", any_channel =
1069 SpiDmaChannel, SPI3)); _for_each_inner_dma_channel_peri_pair!(("I2S_DMA",
1070 any_channel = I2sDmaChannel, I2S0));
1071 _for_each_inner_dma_channel_peri_pair!(("I2S_DMA", any_channel = I2sDmaChannel,
1072 I2S1)); _for_each_inner_dma_channel_peri_pair!((channels("SPI_DMA", DMA_SPI2,
1073 SPI2), ("SPI_DMA", DMA_SPI3, SPI3), ("I2S_DMA", DMA_I2S0, I2S0), ("I2S_DMA",
1074 DMA_I2S1, I2S1)));
1075 _for_each_inner_dma_channel_peri_pair!((any_channels("SPI_DMA", any_channel =
1076 SpiDmaChannel, SPI2), ("SPI_DMA", any_channel = SpiDmaChannel, SPI3), ("I2S_DMA",
1077 any_channel = I2sDmaChannel, I2S0), ("I2S_DMA", any_channel = I2sDmaChannel,
1078 I2S1)));
1079 };
1080}
1081#[macro_export]
1082#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1083macro_rules! with_i2s_dma_engine {
1084 ($($pattern:tt => $code:tt;)*) => {
1085 macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
1086 => {} } _with_inner_i2s_dma_engine!(("I2S_DMA", I2sDmaChannel));
1087 };
1088}
1089#[macro_export]
1090#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1091macro_rules! with_spi_master_dma_engine {
1092 ($($pattern:tt => $code:tt;)*) => {
1093 macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1094 : tt) => {} } _with_inner_spi_master_dma_engine!(("SPI_DMA", SpiDmaChannel));
1095 };
1096}
1097#[macro_export]
1098#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1099macro_rules! with_spi_slave_dma_engine {
1100 ($($pattern:tt => $code:tt;)*) => {
1101 macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1102 : tt) => {} } _with_inner_spi_slave_dma_engine!(("SPI_DMA", SpiDmaChannel));
1103 };
1104}
1105#[macro_export]
1106#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1107macro_rules! for_each_sw_interrupt {
1108 ($($pattern:tt => $code:tt;)*) => {
1109 macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1110 tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1111 software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1112 software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1113 software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1114 software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1115 software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1116 FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1117 };
1118}
1119#[macro_export]
1120macro_rules! define_clock_tree_types {
1541 () => {
1542 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1543 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1544 pub enum SdmInstance {
1545 GpioSd = 0,
1546 }
1547 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1548 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1549 pub enum I2cInstance {
1550 I2c0 = 0,
1551 I2c1 = 1,
1552 }
1553 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1554 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1555 pub enum I2sInstance {
1556 I2s0 = 0,
1557 I2s1 = 1,
1558 }
1559 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1560 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1561 pub enum McpwmInstance {
1562 Mcpwm0 = 0,
1563 Mcpwm1 = 1,
1564 }
1565 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1566 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1567 pub enum RmtInstance {
1568 Rmt = 0,
1569 }
1570 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1571 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1572 pub enum SpiInstance {
1573 Spi2 = 0,
1574 Spi3 = 1,
1575 }
1576 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1577 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1578 pub enum UartInstance {
1579 Uart0 = 0,
1580 Uart1 = 1,
1581 Uart2 = 2,
1582 }
1583 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1585 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1586 pub enum XtalClkConfig {
1587 _26,
1589 _40,
1591 }
1592 impl XtalClkConfig {
1593 #[inline(always)]
1594 pub fn value(&self) -> u32 {
1595 match self {
1596 XtalClkConfig::_26 => 26000000,
1597 XtalClkConfig::_40 => 40000000,
1598 }
1599 }
1600 }
1601 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1603 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1604 pub enum PllClkConfig {
1605 _320,
1607 _480,
1609 }
1610 impl PllClkConfig {
1611 #[inline(always)]
1612 pub fn value(&self) -> u32 {
1613 match self {
1614 PllClkConfig::_320 => 320000000,
1615 PllClkConfig::_480 => 480000000,
1616 }
1617 }
1618 }
1619 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1621 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1622 pub struct ApllClkConfig(u32);
1623 impl ApllClkConfig {
1624 pub const fn new(frequency: u32) -> Self {
1631 ::core::assert!(
1632 frequency >= 16000000u32 && frequency <= 128000000u32,
1633 "`APLL_CLK` output frequency value must be between 16000000 and 128000000 \
1634 (inclusive)."
1635 );
1636 Self(frequency)
1637 }
1638 }
1639 impl ApllClkConfig {
1640 #[inline(always)]
1641 pub fn value(&self) -> u32 {
1642 self.0
1643 }
1644 }
1645 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1647 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1648 pub enum CpuPllDivInConfig {
1649 Pll,
1651 Apll,
1653 }
1654 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1655 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1656 pub enum CpuPllDivDivisor {
1657 _2 = 2,
1659 _4 = 4,
1661 }
1662 impl CpuPllDivDivisor {
1663 pub const fn new(raw: u32) -> Self {
1665 match raw {
1666 2 => Self::_2,
1667 4 => Self::_4,
1668 _ => ::core::panic!("Invalid CPU_PLL_DIV divisor value"),
1669 }
1670 }
1671 }
1672 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1676 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1677 pub struct CpuPllDivConfig {
1678 divisor: CpuPllDivDivisor,
1679 }
1680 impl CpuPllDivConfig {
1681 pub const fn new(divisor: CpuPllDivDivisor) -> Self {
1683 Self { divisor }
1684 }
1685 pub fn divisor(self) -> u32 {
1686 self.divisor as u32
1687 }
1688 }
1689 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1691 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1692 pub enum SysconPreDivInConfig {
1693 Xtal,
1695 RcFast,
1697 }
1698 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1702 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1703 pub struct SysconPreDivConfig {
1704 divisor: u32,
1705 }
1706 impl SysconPreDivConfig {
1707 pub const fn new(divisor: u32) -> Self {
1714 ::core::assert!(
1715 divisor <= 1023,
1716 "`SYSCON_PRE_DIV` divisor must be between 0 and 1023 (inclusive)."
1717 );
1718 Self { divisor }
1719 }
1720 pub fn divisor(self) -> u32 {
1721 self.divisor as u32
1722 }
1723 }
1724 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1726 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1727 pub enum ApbClkConfig {
1728 Pll80m,
1730 CpuDiv2,
1732 Cpu,
1734 }
1735 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1737 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1738 pub enum RefTickConfig {
1739 Pll,
1741 Apll,
1743 Xtal,
1745 Fosc,
1747 }
1748 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1752 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1753 pub struct RefTickXtalConfig {
1754 divisor: u32,
1755 }
1756 impl RefTickXtalConfig {
1757 pub const fn new(divisor: u32) -> Self {
1764 ::core::assert!(
1765 divisor <= 255,
1766 "`REF_TICK_XTAL` divisor must be between 0 and 255 (inclusive)."
1767 );
1768 Self { divisor }
1769 }
1770 pub fn divisor(self) -> u32 {
1771 self.divisor as u32
1772 }
1773 }
1774 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1778 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1779 pub struct RefTickFoscConfig {
1780 divisor: u32,
1781 }
1782 impl RefTickFoscConfig {
1783 pub const fn new(divisor: u32) -> Self {
1790 ::core::assert!(
1791 divisor <= 255,
1792 "`REF_TICK_FOSC` divisor must be between 0 and 255 (inclusive)."
1793 );
1794 Self { divisor }
1795 }
1796 pub fn divisor(self) -> u32 {
1797 self.divisor as u32
1798 }
1799 }
1800 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1804 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1805 pub struct RefTickApllConfig {
1806 divisor: u32,
1807 }
1808 impl RefTickApllConfig {
1809 pub const fn new(divisor: u32) -> Self {
1816 ::core::assert!(
1817 divisor <= 255,
1818 "`REF_TICK_APLL` divisor must be between 0 and 255 (inclusive)."
1819 );
1820 Self { divisor }
1821 }
1822 pub fn divisor(self) -> u32 {
1823 self.divisor as u32
1824 }
1825 }
1826 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1830 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1831 pub struct RefTickPllConfig {
1832 divisor: u32,
1833 }
1834 impl RefTickPllConfig {
1835 pub const fn new(divisor: u32) -> Self {
1842 ::core::assert!(
1843 divisor <= 255,
1844 "`REF_TICK_PLL` divisor must be between 0 and 255 (inclusive)."
1845 );
1846 Self { divisor }
1847 }
1848 pub fn divisor(self) -> u32 {
1849 self.divisor as u32
1850 }
1851 }
1852 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1854 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1855 pub enum CpuClkConfig {
1856 Xtal,
1858 RcFast,
1860 Apll,
1862 Pll,
1864 }
1865 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1867 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1868 pub enum RtcSlowClkConfig {
1869 #[cfg(use_xtal32k)]
1870 Xtal32k,
1872 RcSlow,
1874 RcFast,
1876 }
1877 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1879 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1880 pub enum BleLpClkConfig {
1881 Xtal,
1883 RtcSlow,
1885 }
1886 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1888 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1889 pub enum RtcFastClkConfig {
1890 Xtal,
1892 Rc,
1894 }
1895 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1897 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1898 pub enum UartMemClkConfig {
1899 #[default]
1900 Xtal,
1902 }
1903 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1905 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1906 pub enum TimgCalibrationClockConfig {
1907 RcSlowClk,
1909 RcFastDivClk,
1911 #[cfg(use_xtal32k)]
1912 Xtal32kClk,
1914 }
1915 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1916 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1917 pub enum I2cFunctionClockSclk {
1918 #[default]
1919 Apb,
1921 }
1922 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1926 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1927 pub struct I2cFunctionClockConfig {
1928 sclk: I2cFunctionClockSclk,
1929 }
1930 impl I2cFunctionClockConfig {
1931 pub const fn new(sclk: I2cFunctionClockSclk) -> Self {
1933 Self { sclk }
1934 }
1935 pub fn sclk(self) -> I2cFunctionClockSclk {
1936 self.sclk
1937 }
1938 }
1939 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1940 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1941 pub enum I2sMclkSclk {
1942 #[default]
1943 PllF160m,
1945 Apll,
1947 }
1948 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1952 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1953 pub struct I2sMclkConfig {
1954 sclk: I2sMclkSclk,
1955 div_num: u32,
1956 div_a: u32,
1957 div_b: u32,
1958 }
1959 impl I2sMclkConfig {
1960 pub const fn new(sclk: I2sMclkSclk, div_num: u32, div_a: u32, div_b: u32) -> Self {
1973 ::core::assert!(
1974 div_num >= 1 && div_num <= 255,
1975 "`I2S0_MCLK` div_num must be between 1 and 255 (inclusive)."
1976 );
1977 ::core::assert!(
1978 div_a >= 1 && div_a <= 63,
1979 "`I2S0_MCLK` div_a must be between 1 and 63 (inclusive)."
1980 );
1981 ::core::assert!(
1982 div_b <= 63,
1983 "`I2S0_MCLK` div_b must be between 0 and 63 (inclusive)."
1984 );
1985 Self {
1986 sclk,
1987 div_num,
1988 div_a,
1989 div_b,
1990 }
1991 }
1992 pub fn sclk(self) -> I2sMclkSclk {
1993 self.sclk
1994 }
1995 pub fn div_num(self) -> u32 {
1996 self.div_num as u32
1997 }
1998 pub fn div_a(self) -> u32 {
1999 self.div_a as u32
2000 }
2001 pub fn div_b(self) -> u32 {
2002 self.div_b as u32
2003 }
2004 }
2005 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2007 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2008 pub enum McpwmFunctionClockConfig {
2009 #[default]
2010 PllF160m,
2012 }
2013 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2015 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2016 pub enum RmtSclkConfig {
2017 RefTick,
2019 #[default]
2020 ApbClk,
2022 }
2023 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2025 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2026 pub enum SpiFunctionClockConfig {
2027 #[default]
2028 Apb,
2030 }
2031 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2032 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2033 pub enum UartFunctionClockSclk {
2034 #[default]
2035 Apb,
2037 RefTick,
2039 }
2040 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2044 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2045 pub struct UartFunctionClockConfig {
2046 sclk: UartFunctionClockSclk,
2047 }
2048 impl UartFunctionClockConfig {
2049 pub const fn new(sclk: UartFunctionClockSclk) -> Self {
2051 Self { sclk }
2052 }
2053 pub fn sclk(self) -> UartFunctionClockSclk {
2054 self.sclk
2055 }
2056 }
2057 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2062 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2063 pub struct UartBaudRateGeneratorConfig {
2064 fractional: u32,
2065 integral: u32,
2066 }
2067 impl UartBaudRateGeneratorConfig {
2068 pub const fn new(fractional: u32, integral: u32) -> Self {
2078 ::core::assert!(
2079 fractional <= 15,
2080 "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
2081 );
2082 ::core::assert!(
2083 integral <= 1048575,
2084 "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 1048575 \
2085 (inclusive)."
2086 );
2087 Self {
2088 fractional,
2089 integral,
2090 }
2091 }
2092 pub fn fractional(self) -> u32 {
2093 self.fractional as u32
2094 }
2095 pub fn integral(self) -> u32 {
2096 self.integral as u32
2097 }
2098 }
2099 pub struct ClockTree {
2101 xtal_clk: Option<XtalClkConfig>,
2102 pll_clk: Option<PllClkConfig>,
2103 apll_clk: Option<ApllClkConfig>,
2104 cpu_pll_div_in: Option<CpuPllDivInConfig>,
2105 cpu_pll_div: Option<CpuPllDivConfig>,
2106 syscon_pre_div_in: Option<SysconPreDivInConfig>,
2107 syscon_pre_div: Option<SysconPreDivConfig>,
2108 apb_clk: Option<ApbClkConfig>,
2109 ref_tick: Option<RefTickConfig>,
2110 ref_tick_xtal: Option<RefTickXtalConfig>,
2111 ref_tick_fosc: Option<RefTickFoscConfig>,
2112 ref_tick_apll: Option<RefTickApllConfig>,
2113 ref_tick_pll: Option<RefTickPllConfig>,
2114 cpu_clk: Option<CpuClkConfig>,
2115 rtc_slow_clk: Option<RtcSlowClkConfig>,
2116 ble_lp_clk: Option<BleLpClkConfig>,
2117 rtc_fast_clk: Option<RtcFastClkConfig>,
2118 timg_calibration_clock: Option<TimgCalibrationClockConfig>,
2119 i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
2120 i2s_mclk: [Option<I2sMclkConfig>; 2],
2121 rmt_sclk: [Option<RmtSclkConfig>; 1],
2122 uart_function_clock: [Option<UartFunctionClockConfig>; 3],
2123 uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 3],
2124 pub(crate) pll_clk_refcount: u32,
2125 pub(crate) apll_clk_refcount: u32,
2126 pub(crate) rc_fast_clk_refcount: u32,
2127 pub(crate) pll_f160m_clk_refcount: u32,
2128 pub(crate) pll_d2_clk_refcount: u32,
2129 pub(crate) apb_clk_refcount: u32,
2130 pub(crate) ref_tick_refcount: u32,
2131 #[cfg(use_xtal32k)]
2132 pub(crate) xtal32k_clk_refcount: u32,
2133 pub(crate) rc_slow_clk_refcount: u32,
2134 pub(crate) rc_fast_div_clk_refcount: u32,
2135 pub(crate) ble_lp_clk_refcount: u32,
2136 pub(crate) rtc_fast_clk_refcount: u32,
2137 pub(crate) uart_mem_clk_refcount: u32,
2138 pub(crate) timg_calibration_clock_refcount: u32,
2139 pub(crate) sdm_function_clock_refcount: [u32; 1],
2140 pub(crate) i2c_function_clock_refcount: [u32; 2],
2141 pub(crate) i2s_mclk_refcount: [u32; 2],
2142 pub(crate) mcpwm_function_clock_refcount: [u32; 2],
2143 pub(crate) rmt_sclk_refcount: [u32; 1],
2144 pub(crate) spi_function_clock_refcount: [u32; 2],
2145 pub(crate) uart_function_clock_refcount: [u32; 3],
2146 pub(crate) uart_mem_clock_refcount: [u32; 3],
2147 pub(crate) uart_baud_rate_generator_refcount: [u32; 3],
2148 }
2149 impl ClockTree {
2150 pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
2152 CLOCK_TREE.with(f)
2153 }
2154 pub fn xtal_clk(&self) -> Option<XtalClkConfig> {
2156 self.xtal_clk
2157 }
2158 pub fn pll_clk(&self) -> Option<PllClkConfig> {
2160 self.pll_clk
2161 }
2162 pub fn apll_clk(&self) -> Option<ApllClkConfig> {
2164 self.apll_clk
2165 }
2166 pub fn cpu_pll_div_in(&self) -> Option<CpuPllDivInConfig> {
2168 self.cpu_pll_div_in
2169 }
2170 pub fn cpu_pll_div(&self) -> Option<CpuPllDivConfig> {
2172 self.cpu_pll_div
2173 }
2174 pub fn syscon_pre_div_in(&self) -> Option<SysconPreDivInConfig> {
2176 self.syscon_pre_div_in
2177 }
2178 pub fn syscon_pre_div(&self) -> Option<SysconPreDivConfig> {
2180 self.syscon_pre_div
2181 }
2182 pub fn apb_clk(&self) -> Option<ApbClkConfig> {
2184 self.apb_clk
2185 }
2186 pub fn ref_tick(&self) -> Option<RefTickConfig> {
2188 self.ref_tick
2189 }
2190 pub fn ref_tick_xtal(&self) -> Option<RefTickXtalConfig> {
2192 self.ref_tick_xtal
2193 }
2194 pub fn ref_tick_fosc(&self) -> Option<RefTickFoscConfig> {
2196 self.ref_tick_fosc
2197 }
2198 pub fn ref_tick_apll(&self) -> Option<RefTickApllConfig> {
2200 self.ref_tick_apll
2201 }
2202 pub fn ref_tick_pll(&self) -> Option<RefTickPllConfig> {
2204 self.ref_tick_pll
2205 }
2206 pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
2208 self.cpu_clk
2209 }
2210 pub fn rtc_slow_clk(&self) -> Option<RtcSlowClkConfig> {
2212 self.rtc_slow_clk
2213 }
2214 pub fn ble_lp_clk(&self) -> Option<BleLpClkConfig> {
2216 self.ble_lp_clk
2217 }
2218 pub fn rtc_fast_clk(&self) -> Option<RtcFastClkConfig> {
2220 self.rtc_fast_clk
2221 }
2222 pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
2224 self.timg_calibration_clock
2225 }
2226 pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2228 self.i2c_function_clock[I2cInstance::I2c0 as usize]
2229 }
2230 pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2232 self.i2c_function_clock[I2cInstance::I2c1 as usize]
2233 }
2234 pub fn i2s0_mclk(&self) -> Option<I2sMclkConfig> {
2236 self.i2s_mclk[I2sInstance::I2s0 as usize]
2237 }
2238 pub fn i2s1_mclk(&self) -> Option<I2sMclkConfig> {
2240 self.i2s_mclk[I2sInstance::I2s1 as usize]
2241 }
2242 pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
2244 self.rmt_sclk[RmtInstance::Rmt as usize]
2245 }
2246 pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
2248 self.uart_function_clock[UartInstance::Uart0 as usize]
2249 }
2250 pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2252 self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
2253 }
2254 pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
2256 self.uart_function_clock[UartInstance::Uart1 as usize]
2257 }
2258 pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2260 self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
2261 }
2262 pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
2264 self.uart_function_clock[UartInstance::Uart2 as usize]
2265 }
2266 pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2268 self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
2269 }
2270 }
2271 static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
2272 ::esp_sync::NonReentrantMutex::new(ClockTree {
2273 xtal_clk: None,
2274 pll_clk: None,
2275 apll_clk: None,
2276 cpu_pll_div_in: None,
2277 cpu_pll_div: None,
2278 syscon_pre_div_in: None,
2279 syscon_pre_div: None,
2280 apb_clk: None,
2281 ref_tick: None,
2282 ref_tick_xtal: None,
2283 ref_tick_fosc: None,
2284 ref_tick_apll: None,
2285 ref_tick_pll: None,
2286 cpu_clk: None,
2287 rtc_slow_clk: None,
2288 ble_lp_clk: None,
2289 rtc_fast_clk: None,
2290 timg_calibration_clock: None,
2291 i2c_function_clock: [None; 2],
2292 i2s_mclk: [None; 2],
2293 rmt_sclk: [None; 1],
2294 uart_function_clock: [None; 3],
2295 uart_baud_rate_generator: [None; 3],
2296 pll_clk_refcount: 0,
2297 apll_clk_refcount: 0,
2298 rc_fast_clk_refcount: 0,
2299 pll_f160m_clk_refcount: 0,
2300 pll_d2_clk_refcount: 0,
2301 apb_clk_refcount: 0,
2302 ref_tick_refcount: 0,
2303 #[cfg(use_xtal32k)]
2304 xtal32k_clk_refcount: 0,
2305 rc_slow_clk_refcount: 0,
2306 rc_fast_div_clk_refcount: 0,
2307 ble_lp_clk_refcount: 0,
2308 rtc_fast_clk_refcount: 0,
2309 uart_mem_clk_refcount: 0,
2310 timg_calibration_clock_refcount: 0,
2311 sdm_function_clock_refcount: [0; 1],
2312 i2c_function_clock_refcount: [0; 2],
2313 i2s_mclk_refcount: [0; 2],
2314 mcpwm_function_clock_refcount: [0; 2],
2315 rmt_sclk_refcount: [0; 1],
2316 spi_function_clock_refcount: [0; 2],
2317 uart_function_clock_refcount: [0; 3],
2318 uart_mem_clock_refcount: [0; 3],
2319 uart_baud_rate_generator_refcount: [0; 3],
2320 });
2321 static XTAL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2322 ::core::sync::atomic::AtomicU32::new(0);
2323 static PLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2324 ::core::sync::atomic::AtomicU32::new(0);
2325 static APLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2326 ::core::sync::atomic::AtomicU32::new(0);
2327 static CPU_PLL_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2328 ::core::sync::atomic::AtomicU32::new(0);
2329 static CPU_PLL_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2330 ::core::sync::atomic::AtomicU32::new(0);
2331 static SYSCON_PRE_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2332 ::core::sync::atomic::AtomicU32::new(0);
2333 static SYSCON_PRE_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2334 ::core::sync::atomic::AtomicU32::new(0);
2335 static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2336 ::core::sync::atomic::AtomicU32::new(0);
2337 static RTC_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2338 ::core::sync::atomic::AtomicU32::new(0);
2339 static BLE_LP_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2340 ::core::sync::atomic::AtomicU32::new(0);
2341 static RTC_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2342 ::core::sync::atomic::AtomicU32::new(0);
2343 static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2344 ::core::sync::atomic::AtomicU32::new(0);
2345 static I2S_MCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2346 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2347 static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2348 ::core::sync::atomic::AtomicU32::new(0);
2349 static REF_TICK_XTAL_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2350 ::core::sync::atomic::AtomicU32::new(0);
2351 static REF_TICK_FOSC_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2352 ::core::sync::atomic::AtomicU32::new(0);
2353 static REF_TICK_APLL_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2354 ::core::sync::atomic::AtomicU32::new(0);
2355 static REF_TICK_PLL_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2356 ::core::sync::atomic::AtomicU32::new(0);
2357 static REF_TICK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2358 ::core::sync::atomic::AtomicU32::new(0);
2359 static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2360 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2361 static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
2362 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
2363 static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
2364 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
2365 #[derive(Debug, enumset::EnumSetType)]
2370 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2371 pub enum ClockSource {
2372 XtalClk,
2374 RcFastClk,
2376 #[cfg(use_xtal32k)]
2377 Xtal32kClk,
2379 RcSlowClk,
2381 }
2382 pub fn xtal_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
2384 Some(ClockSource::XtalClk)
2385 }
2386 pub fn pll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2388 xtal_clk_root_source(clocks)
2389 }
2390 pub fn apll_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2392 pll_clk_root_source(clocks)
2393 }
2394 pub fn rc_fast_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
2396 Some(ClockSource::RcFastClk)
2397 }
2398 pub fn pll_f160m_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2400 pll_clk_root_source(clocks)
2401 }
2402 pub fn pll_d2_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2404 pll_clk_root_source(clocks)
2405 }
2406 pub fn cpu_pll_div_in_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2408 let config = clocks.cpu_pll_div_in?;
2409 match config {
2410 CpuPllDivInConfig::Pll => pll_clk_root_source(clocks),
2411 CpuPllDivInConfig::Apll => apll_clk_root_source(clocks),
2412 }
2413 }
2414 pub fn cpu_pll_div_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2416 cpu_pll_div_in_root_source(clocks)
2417 }
2418 pub fn syscon_pre_div_in_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2420 let config = clocks.syscon_pre_div_in?;
2421 match config {
2422 SysconPreDivInConfig::Xtal => xtal_clk_root_source(clocks),
2423 SysconPreDivInConfig::RcFast => rc_fast_clk_root_source(clocks),
2424 }
2425 }
2426 pub fn syscon_pre_div_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2428 syscon_pre_div_in_root_source(clocks)
2429 }
2430 pub fn cpu_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2432 let config = clocks.cpu_clk?;
2433 match config {
2434 CpuClkConfig::Xtal => syscon_pre_div_root_source(clocks),
2435 CpuClkConfig::RcFast => syscon_pre_div_root_source(clocks),
2436 CpuClkConfig::Apll => cpu_pll_div_root_source(clocks),
2437 CpuClkConfig::Pll => cpu_pll_div_root_source(clocks),
2438 }
2439 }
2440 pub fn apb_clk_cpu_div2_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2442 cpu_clk_root_source(clocks)
2443 }
2444 pub fn apb_clk_80m_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2446 cpu_clk_root_source(clocks)
2447 }
2448 #[cfg(use_xtal32k)]
2449 pub fn xtal32k_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
2451 Some(ClockSource::Xtal32kClk)
2452 }
2453 pub fn rc_slow_clk_root_source(_clocks: &mut ClockTree) -> Option<ClockSource> {
2455 Some(ClockSource::RcSlowClk)
2456 }
2457 pub fn rc_fast_div_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2459 rc_fast_clk_root_source(clocks)
2460 }
2461 pub fn xtal_div_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2463 xtal_clk_root_source(clocks)
2464 }
2465 pub fn rtc_slow_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2467 let config = clocks.rtc_slow_clk?;
2468 match config {
2469 #[cfg(use_xtal32k)]
2470 RtcSlowClkConfig::Xtal32k => xtal32k_clk_root_source(clocks),
2471 RtcSlowClkConfig::RcSlow => rc_slow_clk_root_source(clocks),
2472 RtcSlowClkConfig::RcFast => rc_fast_div_clk_root_source(clocks),
2473 }
2474 }
2475 pub fn ble_lp_xtal_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2477 xtal_clk_root_source(clocks)
2478 }
2479 pub fn ble_lp_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2481 let config = clocks.ble_lp_clk?;
2482 match config {
2483 BleLpClkConfig::Xtal => ble_lp_xtal_clk_root_source(clocks),
2484 BleLpClkConfig::RtcSlow => rtc_slow_clk_root_source(clocks),
2485 }
2486 }
2487 pub fn rtc_fast_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2489 let config = clocks.rtc_fast_clk?;
2490 match config {
2491 RtcFastClkConfig::Xtal => xtal_div_clk_root_source(clocks),
2492 RtcFastClkConfig::Rc => rc_fast_clk_root_source(clocks),
2493 }
2494 }
2495 pub fn uart_mem_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2497 xtal_clk_root_source(clocks)
2498 }
2499 pub fn timg_calibration_clock_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2501 let config = clocks.timg_calibration_clock?;
2502 match config {
2503 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_root_source(clocks),
2504 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_root_source(clocks),
2505 #[cfg(use_xtal32k)]
2506 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_root_source(clocks),
2507 }
2508 }
2509 pub fn apb_clk_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2511 let config = clocks.apb_clk?;
2512 match config {
2513 ApbClkConfig::Pll80m => apb_clk_80m_root_source(clocks),
2514 ApbClkConfig::CpuDiv2 => apb_clk_cpu_div2_root_source(clocks),
2515 ApbClkConfig::Cpu => cpu_clk_root_source(clocks),
2516 }
2517 }
2518 pub fn ref_tick_xtal_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2520 apb_clk_root_source(clocks)
2521 }
2522 pub fn ref_tick_fosc_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2524 apb_clk_root_source(clocks)
2525 }
2526 pub fn ref_tick_apll_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2528 apb_clk_root_source(clocks)
2529 }
2530 pub fn ref_tick_pll_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2532 apb_clk_root_source(clocks)
2533 }
2534 pub fn ref_tick_root_source(clocks: &mut ClockTree) -> Option<ClockSource> {
2536 let config = clocks.ref_tick?;
2537 match config {
2538 RefTickConfig::Pll => ref_tick_pll_root_source(clocks),
2539 RefTickConfig::Apll => ref_tick_apll_root_source(clocks),
2540 RefTickConfig::Xtal => ref_tick_xtal_root_source(clocks),
2541 RefTickConfig::Fosc => ref_tick_fosc_root_source(clocks),
2542 }
2543 }
2544 pub fn configure_xtal_clk(clocks: &mut ClockTree, config: XtalClkConfig) {
2545 let old_config = clocks.xtal_clk.replace(config);
2546 refresh_xtal_clk_downstream(clocks);
2547 configure_xtal_clk_impl(clocks, old_config, config);
2548 }
2549 pub fn xtal_clk_config(clocks: &mut ClockTree) -> Option<XtalClkConfig> {
2550 clocks.xtal_clk
2551 }
2552 fn request_xtal_clk(_clocks: &mut ClockTree) {}
2553 fn release_xtal_clk(_clocks: &mut ClockTree) {}
2554 pub fn xtal_clk_config_frequency(config: XtalClkConfig) -> u32 {
2555 config.value()
2556 }
2557 #[inline(always)]
2558 pub fn xtal_clk_frequency() -> u32 {
2559 XTAL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2560 }
2561 pub fn configure_pll_clk(clocks: &mut ClockTree, config: PllClkConfig) {
2562 if clocks.cpu_pll_div.is_some() {
2563 assert!(
2564 !((config.value() == 480000000)
2565 && (unwrap!(clocks.cpu_pll_div).divisor() == 4))
2566 );
2567 }
2568 let old_config = clocks.pll_clk.replace(config);
2569 refresh_pll_clk_downstream(clocks);
2570 configure_pll_clk_impl(clocks, old_config, config);
2571 }
2572 pub fn pll_clk_config(clocks: &mut ClockTree) -> Option<PllClkConfig> {
2573 clocks.pll_clk
2574 }
2575 pub fn request_pll_clk(clocks: &mut ClockTree) {
2576 trace!("Requesting PLL_CLK");
2577 if increment_reference_count(&mut clocks.pll_clk_refcount) {
2578 trace!("Enabling PLL_CLK");
2579 request_xtal_clk(clocks);
2580 enable_pll_clk_impl(clocks, true);
2581 }
2582 }
2583 pub fn release_pll_clk(clocks: &mut ClockTree) {
2584 trace!("Releasing PLL_CLK");
2585 if decrement_reference_count(&mut clocks.pll_clk_refcount) {
2586 trace!("Disabling PLL_CLK");
2587 enable_pll_clk_impl(clocks, false);
2588 release_xtal_clk(clocks);
2589 }
2590 }
2591 pub fn pll_clk_config_frequency(config: PllClkConfig) -> u32 {
2592 config.value()
2593 }
2594 #[inline(always)]
2595 pub fn pll_clk_frequency() -> u32 {
2596 PLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2597 }
2598 pub fn pll_clk_source_frequency() -> u32 {
2599 xtal_clk_frequency()
2600 }
2601 pub fn configure_apll_clk(clocks: &mut ClockTree, config: ApllClkConfig) {
2602 let old_config = clocks.apll_clk.replace(config);
2603 refresh_apll_clk_downstream(clocks);
2604 configure_apll_clk_impl(clocks, old_config, config);
2605 }
2606 pub fn apll_clk_config(clocks: &mut ClockTree) -> Option<ApllClkConfig> {
2607 clocks.apll_clk
2608 }
2609 pub fn request_apll_clk(clocks: &mut ClockTree) {
2610 trace!("Requesting APLL_CLK");
2611 if increment_reference_count(&mut clocks.apll_clk_refcount) {
2612 trace!("Enabling APLL_CLK");
2613 request_pll_clk(clocks);
2614 enable_apll_clk_impl(clocks, true);
2615 }
2616 }
2617 pub fn release_apll_clk(clocks: &mut ClockTree) {
2618 trace!("Releasing APLL_CLK");
2619 if decrement_reference_count(&mut clocks.apll_clk_refcount) {
2620 trace!("Disabling APLL_CLK");
2621 enable_apll_clk_impl(clocks, false);
2622 release_pll_clk(clocks);
2623 }
2624 }
2625 pub fn apll_clk_config_frequency(config: ApllClkConfig) -> u32 {
2626 config.value()
2627 }
2628 #[inline(always)]
2629 pub fn apll_clk_frequency() -> u32 {
2630 APLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2631 }
2632 pub fn apll_clk_source_frequency() -> u32 {
2633 pll_clk_frequency()
2634 }
2635 pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
2636 trace!("Requesting RC_FAST_CLK");
2637 if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
2638 trace!("Enabling RC_FAST_CLK");
2639 enable_rc_fast_clk_impl(clocks, true);
2640 }
2641 }
2642 pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
2643 trace!("Releasing RC_FAST_CLK");
2644 if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
2645 trace!("Disabling RC_FAST_CLK");
2646 enable_rc_fast_clk_impl(clocks, false);
2647 }
2648 }
2649 static RC_FAST_CLK_FREQUENCY: ::core::sync::atomic::AtomicU32 =
2650 ::core::sync::atomic::AtomicU32::new(rc_fast_clk_nominal_frequency());
2651 pub const fn rc_fast_clk_nominal_frequency() -> u32 {
2652 8000000
2653 }
2654 #[inline(always)]
2655 pub fn rc_fast_clk_frequency() -> u32 {
2656 RC_FAST_CLK_FREQUENCY.load(::core::sync::atomic::Ordering::Acquire)
2657 }
2658 pub fn set_rc_fast_clk_frequency(clocks: &mut ClockTree, frequency: u32) {
2659 if !(4000000..=12000000).contains(&frequency) {
2660 warn!(
2661 "Ignoring out-of-range RC_FAST_CLK frequency: {} Hz",
2662 frequency
2663 );
2664 return;
2665 }
2666 debug!(
2667 "Updating RC_FAST_CLK frequency to {} Hz (nominal {} Hz)",
2668 frequency,
2669 rc_fast_clk_nominal_frequency()
2670 );
2671 RC_FAST_CLK_FREQUENCY.store(frequency, ::core::sync::atomic::Ordering::Release);
2672 refresh_rc_fast_clk_downstream(clocks);
2673 }
2674 pub fn request_pll_f160m_clk(clocks: &mut ClockTree) {
2675 trace!("Requesting PLL_F160M_CLK");
2676 if increment_reference_count(&mut clocks.pll_f160m_clk_refcount) {
2677 trace!("Enabling PLL_F160M_CLK");
2678 request_pll_clk(clocks);
2679 enable_pll_f160m_clk_impl(clocks, true);
2680 }
2681 }
2682 pub fn release_pll_f160m_clk(clocks: &mut ClockTree) {
2683 trace!("Releasing PLL_F160M_CLK");
2684 if decrement_reference_count(&mut clocks.pll_f160m_clk_refcount) {
2685 trace!("Disabling PLL_F160M_CLK");
2686 enable_pll_f160m_clk_impl(clocks, false);
2687 release_pll_clk(clocks);
2688 }
2689 }
2690 #[inline(always)]
2691 pub fn pll_f160m_clk_frequency() -> u32 {
2692 160000000
2693 }
2694 pub fn pll_f160m_clk_source_frequency() -> u32 {
2695 pll_clk_frequency()
2696 }
2697 pub fn request_pll_d2_clk(clocks: &mut ClockTree) {
2698 trace!("Requesting PLL_D2_CLK");
2699 if increment_reference_count(&mut clocks.pll_d2_clk_refcount) {
2700 trace!("Enabling PLL_D2_CLK");
2701 request_pll_clk(clocks);
2702 enable_pll_d2_clk_impl(clocks, true);
2703 }
2704 }
2705 pub fn release_pll_d2_clk(clocks: &mut ClockTree) {
2706 trace!("Releasing PLL_D2_CLK");
2707 if decrement_reference_count(&mut clocks.pll_d2_clk_refcount) {
2708 trace!("Disabling PLL_D2_CLK");
2709 enable_pll_d2_clk_impl(clocks, false);
2710 release_pll_clk(clocks);
2711 }
2712 }
2713 #[inline(always)]
2714 pub fn pll_d2_clk_frequency() -> u32 {
2715 (pll_clk_frequency() / 2)
2716 }
2717 pub fn pll_d2_clk_source_frequency() -> u32 {
2718 pll_clk_frequency()
2719 }
2720 pub fn configure_cpu_pll_div_in(clocks: &mut ClockTree, new_selector: CpuPllDivInConfig) {
2721 let old_selector = clocks.cpu_pll_div_in.replace(new_selector);
2722 refresh_cpu_pll_div_in_downstream(clocks);
2723 match new_selector {
2724 CpuPllDivInConfig::Pll => request_pll_clk(clocks),
2725 CpuPllDivInConfig::Apll => request_apll_clk(clocks),
2726 }
2727 configure_cpu_pll_div_in_impl(clocks, old_selector, new_selector);
2728 if let Some(old_selector) = old_selector {
2729 match old_selector {
2730 CpuPllDivInConfig::Pll => release_pll_clk(clocks),
2731 CpuPllDivInConfig::Apll => release_apll_clk(clocks),
2732 }
2733 }
2734 }
2735 pub fn cpu_pll_div_in_config(clocks: &mut ClockTree) -> Option<CpuPllDivInConfig> {
2736 clocks.cpu_pll_div_in
2737 }
2738 pub fn request_cpu_pll_div_in(clocks: &mut ClockTree) {
2739 trace!("Enabling CPU_PLL_DIV_IN");
2740 match unwrap!(clocks.cpu_pll_div_in) {
2741 CpuPllDivInConfig::Pll => request_pll_clk(clocks),
2742 CpuPllDivInConfig::Apll => request_apll_clk(clocks),
2743 }
2744 enable_cpu_pll_div_in_impl(clocks, true);
2745 }
2746 pub fn release_cpu_pll_div_in(clocks: &mut ClockTree) {
2747 trace!("Disabling CPU_PLL_DIV_IN");
2748 enable_cpu_pll_div_in_impl(clocks, false);
2749 match unwrap!(clocks.cpu_pll_div_in) {
2750 CpuPllDivInConfig::Pll => release_pll_clk(clocks),
2751 CpuPllDivInConfig::Apll => release_apll_clk(clocks),
2752 }
2753 }
2754 pub fn cpu_pll_div_in_config_frequency(config: CpuPllDivInConfig) -> u32 {
2755 match config {
2756 CpuPllDivInConfig::Pll => pll_clk_frequency(),
2757 CpuPllDivInConfig::Apll => apll_clk_frequency(),
2758 }
2759 }
2760 #[inline(always)]
2761 pub fn cpu_pll_div_in_frequency() -> u32 {
2762 CPU_PLL_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2763 }
2764 pub fn cpu_pll_div_in_source_frequency(source: CpuPllDivInConfig) -> u32 {
2765 cpu_pll_div_in_config_frequency(source)
2766 }
2767 pub fn configure_cpu_pll_div(clocks: &mut ClockTree, config: CpuPllDivConfig) {
2768 if clocks.pll_clk.is_some() {
2769 assert!(!((pll_clk_frequency() == 480000000) && (config.divisor() == 4)));
2770 }
2771 let old_config = clocks.cpu_pll_div.replace(config);
2772 refresh_cpu_pll_div_downstream(clocks);
2773 configure_cpu_pll_div_impl(clocks, old_config, config);
2774 }
2775 pub fn cpu_pll_div_config(clocks: &mut ClockTree) -> Option<CpuPllDivConfig> {
2776 clocks.cpu_pll_div
2777 }
2778 pub fn request_cpu_pll_div(clocks: &mut ClockTree) {
2779 trace!("Enabling CPU_PLL_DIV");
2780 request_cpu_pll_div_in(clocks);
2781 enable_cpu_pll_div_impl(clocks, true);
2782 }
2783 pub fn release_cpu_pll_div(clocks: &mut ClockTree) {
2784 trace!("Disabling CPU_PLL_DIV");
2785 enable_cpu_pll_div_impl(clocks, false);
2786 release_cpu_pll_div_in(clocks);
2787 }
2788 pub fn cpu_pll_div_config_frequency(config: CpuPllDivConfig) -> u32 {
2789 (cpu_pll_div_in_frequency() / config.divisor())
2790 }
2791 #[inline(always)]
2792 pub fn cpu_pll_div_frequency() -> u32 {
2793 CPU_PLL_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2794 }
2795 pub fn cpu_pll_div_source_frequency() -> u32 {
2796 cpu_pll_div_in_frequency()
2797 }
2798 pub fn configure_syscon_pre_div_in(
2799 clocks: &mut ClockTree,
2800 new_selector: SysconPreDivInConfig,
2801 ) {
2802 let old_selector = clocks.syscon_pre_div_in.replace(new_selector);
2803 refresh_syscon_pre_div_in_downstream(clocks);
2804 match new_selector {
2805 SysconPreDivInConfig::Xtal => request_xtal_clk(clocks),
2806 SysconPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2807 }
2808 configure_syscon_pre_div_in_impl(clocks, old_selector, new_selector);
2809 if let Some(old_selector) = old_selector {
2810 match old_selector {
2811 SysconPreDivInConfig::Xtal => release_xtal_clk(clocks),
2812 SysconPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2813 }
2814 }
2815 }
2816 pub fn syscon_pre_div_in_config(clocks: &mut ClockTree) -> Option<SysconPreDivInConfig> {
2817 clocks.syscon_pre_div_in
2818 }
2819 pub fn request_syscon_pre_div_in(clocks: &mut ClockTree) {
2820 trace!("Enabling SYSCON_PRE_DIV_IN");
2821 match unwrap!(clocks.syscon_pre_div_in) {
2822 SysconPreDivInConfig::Xtal => request_xtal_clk(clocks),
2823 SysconPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2824 }
2825 enable_syscon_pre_div_in_impl(clocks, true);
2826 }
2827 pub fn release_syscon_pre_div_in(clocks: &mut ClockTree) {
2828 trace!("Disabling SYSCON_PRE_DIV_IN");
2829 enable_syscon_pre_div_in_impl(clocks, false);
2830 match unwrap!(clocks.syscon_pre_div_in) {
2831 SysconPreDivInConfig::Xtal => release_xtal_clk(clocks),
2832 SysconPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2833 }
2834 }
2835 pub fn syscon_pre_div_in_config_frequency(config: SysconPreDivInConfig) -> u32 {
2836 match config {
2837 SysconPreDivInConfig::Xtal => xtal_clk_frequency(),
2838 SysconPreDivInConfig::RcFast => rc_fast_clk_frequency(),
2839 }
2840 }
2841 #[inline(always)]
2842 pub fn syscon_pre_div_in_frequency() -> u32 {
2843 SYSCON_PRE_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2844 }
2845 pub fn syscon_pre_div_in_source_frequency(source: SysconPreDivInConfig) -> u32 {
2846 syscon_pre_div_in_config_frequency(source)
2847 }
2848 pub fn configure_syscon_pre_div(clocks: &mut ClockTree, config: SysconPreDivConfig) {
2849 let old_config = clocks.syscon_pre_div.replace(config);
2850 refresh_syscon_pre_div_downstream(clocks);
2851 configure_syscon_pre_div_impl(clocks, old_config, config);
2852 }
2853 pub fn syscon_pre_div_config(clocks: &mut ClockTree) -> Option<SysconPreDivConfig> {
2854 clocks.syscon_pre_div
2855 }
2856 pub fn request_syscon_pre_div(clocks: &mut ClockTree) {
2857 trace!("Enabling SYSCON_PRE_DIV");
2858 request_syscon_pre_div_in(clocks);
2859 enable_syscon_pre_div_impl(clocks, true);
2860 }
2861 pub fn release_syscon_pre_div(clocks: &mut ClockTree) {
2862 trace!("Disabling SYSCON_PRE_DIV");
2863 enable_syscon_pre_div_impl(clocks, false);
2864 release_syscon_pre_div_in(clocks);
2865 }
2866 pub fn syscon_pre_div_config_frequency(config: SysconPreDivConfig) -> u32 {
2867 (syscon_pre_div_in_frequency() / (config.divisor() + 1))
2868 }
2869 #[inline(always)]
2870 pub fn syscon_pre_div_frequency() -> u32 {
2871 SYSCON_PRE_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2872 }
2873 pub fn syscon_pre_div_source_frequency() -> u32 {
2874 syscon_pre_div_in_frequency()
2875 }
2876 pub fn configure_apb_clk(clocks: &mut ClockTree, new_selector: ApbClkConfig) {
2877 let old_selector = clocks.apb_clk.replace(new_selector);
2878 refresh_apb_clk_downstream(clocks);
2879 let active = clocks.apb_clk_refcount > 0;
2880 if active {
2881 match new_selector {
2882 ApbClkConfig::Pll80m => request_apb_clk_80m(clocks),
2883 ApbClkConfig::CpuDiv2 => request_apb_clk_cpu_div2(clocks),
2884 ApbClkConfig::Cpu => request_cpu_clk(clocks),
2885 }
2886 }
2887 configure_apb_clk_impl(clocks, old_selector, new_selector);
2888 if active && let Some(old_selector) = old_selector {
2889 match old_selector {
2890 ApbClkConfig::Pll80m => release_apb_clk_80m(clocks),
2891 ApbClkConfig::CpuDiv2 => release_apb_clk_cpu_div2(clocks),
2892 ApbClkConfig::Cpu => release_cpu_clk(clocks),
2893 }
2894 }
2895 }
2896 pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
2897 clocks.apb_clk
2898 }
2899 pub fn request_apb_clk(clocks: &mut ClockTree) {
2900 trace!("Requesting APB_CLK");
2901 if increment_reference_count(&mut clocks.apb_clk_refcount) {
2902 trace!("Enabling APB_CLK");
2903 match unwrap!(clocks.apb_clk) {
2904 ApbClkConfig::Pll80m => request_apb_clk_80m(clocks),
2905 ApbClkConfig::CpuDiv2 => request_apb_clk_cpu_div2(clocks),
2906 ApbClkConfig::Cpu => request_cpu_clk(clocks),
2907 }
2908 enable_apb_clk_impl(clocks, true);
2909 }
2910 }
2911 pub fn release_apb_clk(clocks: &mut ClockTree) {
2912 trace!("Releasing APB_CLK");
2913 if decrement_reference_count(&mut clocks.apb_clk_refcount) {
2914 trace!("Disabling APB_CLK");
2915 enable_apb_clk_impl(clocks, false);
2916 match unwrap!(clocks.apb_clk) {
2917 ApbClkConfig::Pll80m => release_apb_clk_80m(clocks),
2918 ApbClkConfig::CpuDiv2 => release_apb_clk_cpu_div2(clocks),
2919 ApbClkConfig::Cpu => release_cpu_clk(clocks),
2920 }
2921 }
2922 }
2923 pub fn apb_clk_config_frequency(config: ApbClkConfig) -> u32 {
2924 match config {
2925 ApbClkConfig::Pll80m => apb_clk_80m_frequency(),
2926 ApbClkConfig::CpuDiv2 => apb_clk_cpu_div2_frequency(),
2927 ApbClkConfig::Cpu => cpu_clk_frequency(),
2928 }
2929 }
2930 #[inline(always)]
2931 pub fn apb_clk_frequency() -> u32 {
2932 APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2933 }
2934 pub fn apb_clk_source_frequency(source: ApbClkConfig) -> u32 {
2935 apb_clk_config_frequency(source)
2936 }
2937 pub fn configure_ref_tick(clocks: &mut ClockTree, new_selector: RefTickConfig) {
2938 let old_selector = clocks.ref_tick.replace(new_selector);
2939 refresh_ref_tick_downstream(clocks);
2940 let active = clocks.ref_tick_refcount > 0;
2941 if active {
2942 match new_selector {
2943 RefTickConfig::Pll => request_ref_tick_pll(clocks),
2944 RefTickConfig::Apll => request_ref_tick_apll(clocks),
2945 RefTickConfig::Xtal => request_ref_tick_xtal(clocks),
2946 RefTickConfig::Fosc => request_ref_tick_fosc(clocks),
2947 }
2948 }
2949 configure_ref_tick_impl(clocks, old_selector, new_selector);
2950 if active && let Some(old_selector) = old_selector {
2951 match old_selector {
2952 RefTickConfig::Pll => release_ref_tick_pll(clocks),
2953 RefTickConfig::Apll => release_ref_tick_apll(clocks),
2954 RefTickConfig::Xtal => release_ref_tick_xtal(clocks),
2955 RefTickConfig::Fosc => release_ref_tick_fosc(clocks),
2956 }
2957 }
2958 }
2959 pub fn ref_tick_config(clocks: &mut ClockTree) -> Option<RefTickConfig> {
2960 clocks.ref_tick
2961 }
2962 pub fn request_ref_tick(clocks: &mut ClockTree) {
2963 trace!("Requesting REF_TICK");
2964 if increment_reference_count(&mut clocks.ref_tick_refcount) {
2965 trace!("Enabling REF_TICK");
2966 match unwrap!(clocks.ref_tick) {
2967 RefTickConfig::Pll => request_ref_tick_pll(clocks),
2968 RefTickConfig::Apll => request_ref_tick_apll(clocks),
2969 RefTickConfig::Xtal => request_ref_tick_xtal(clocks),
2970 RefTickConfig::Fosc => request_ref_tick_fosc(clocks),
2971 }
2972 enable_ref_tick_impl(clocks, true);
2973 }
2974 }
2975 pub fn release_ref_tick(clocks: &mut ClockTree) {
2976 trace!("Releasing REF_TICK");
2977 if decrement_reference_count(&mut clocks.ref_tick_refcount) {
2978 trace!("Disabling REF_TICK");
2979 enable_ref_tick_impl(clocks, false);
2980 match unwrap!(clocks.ref_tick) {
2981 RefTickConfig::Pll => release_ref_tick_pll(clocks),
2982 RefTickConfig::Apll => release_ref_tick_apll(clocks),
2983 RefTickConfig::Xtal => release_ref_tick_xtal(clocks),
2984 RefTickConfig::Fosc => release_ref_tick_fosc(clocks),
2985 }
2986 }
2987 }
2988 pub fn ref_tick_config_frequency(config: RefTickConfig) -> u32 {
2989 match config {
2990 RefTickConfig::Pll => ref_tick_pll_frequency(),
2991 RefTickConfig::Apll => ref_tick_apll_frequency(),
2992 RefTickConfig::Xtal => ref_tick_xtal_frequency(),
2993 RefTickConfig::Fosc => ref_tick_fosc_frequency(),
2994 }
2995 }
2996 #[inline(always)]
2997 pub fn ref_tick_frequency() -> u32 {
2998 REF_TICK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2999 }
3000 pub fn ref_tick_source_frequency(source: RefTickConfig) -> u32 {
3001 ref_tick_config_frequency(source)
3002 }
3003 pub fn configure_ref_tick_xtal(clocks: &mut ClockTree, config: RefTickXtalConfig) {
3004 let old_config = clocks.ref_tick_xtal.replace(config);
3005 refresh_ref_tick_xtal_downstream(clocks);
3006 configure_ref_tick_xtal_impl(clocks, old_config, config);
3007 }
3008 pub fn ref_tick_xtal_config(clocks: &mut ClockTree) -> Option<RefTickXtalConfig> {
3009 clocks.ref_tick_xtal
3010 }
3011 pub fn request_ref_tick_xtal(clocks: &mut ClockTree) {
3012 trace!("Enabling REF_TICK_XTAL");
3013 request_apb_clk(clocks);
3014 enable_ref_tick_xtal_impl(clocks, true);
3015 }
3016 pub fn release_ref_tick_xtal(clocks: &mut ClockTree) {
3017 trace!("Disabling REF_TICK_XTAL");
3018 enable_ref_tick_xtal_impl(clocks, false);
3019 release_apb_clk(clocks);
3020 }
3021 pub fn ref_tick_xtal_config_frequency(config: RefTickXtalConfig) -> u32 {
3022 (apb_clk_frequency() / (config.divisor() + 1))
3023 }
3024 #[inline(always)]
3025 pub fn ref_tick_xtal_frequency() -> u32 {
3026 REF_TICK_XTAL_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3027 }
3028 pub fn ref_tick_xtal_source_frequency() -> u32 {
3029 apb_clk_frequency()
3030 }
3031 pub fn configure_ref_tick_fosc(clocks: &mut ClockTree, config: RefTickFoscConfig) {
3032 let old_config = clocks.ref_tick_fosc.replace(config);
3033 refresh_ref_tick_fosc_downstream(clocks);
3034 configure_ref_tick_fosc_impl(clocks, old_config, config);
3035 }
3036 pub fn ref_tick_fosc_config(clocks: &mut ClockTree) -> Option<RefTickFoscConfig> {
3037 clocks.ref_tick_fosc
3038 }
3039 pub fn request_ref_tick_fosc(clocks: &mut ClockTree) {
3040 trace!("Enabling REF_TICK_FOSC");
3041 request_apb_clk(clocks);
3042 enable_ref_tick_fosc_impl(clocks, true);
3043 }
3044 pub fn release_ref_tick_fosc(clocks: &mut ClockTree) {
3045 trace!("Disabling REF_TICK_FOSC");
3046 enable_ref_tick_fosc_impl(clocks, false);
3047 release_apb_clk(clocks);
3048 }
3049 pub fn ref_tick_fosc_config_frequency(config: RefTickFoscConfig) -> u32 {
3050 (apb_clk_frequency() / (config.divisor() + 1))
3051 }
3052 #[inline(always)]
3053 pub fn ref_tick_fosc_frequency() -> u32 {
3054 REF_TICK_FOSC_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3055 }
3056 pub fn ref_tick_fosc_source_frequency() -> u32 {
3057 apb_clk_frequency()
3058 }
3059 pub fn configure_ref_tick_apll(clocks: &mut ClockTree, config: RefTickApllConfig) {
3060 let old_config = clocks.ref_tick_apll.replace(config);
3061 refresh_ref_tick_apll_downstream(clocks);
3062 configure_ref_tick_apll_impl(clocks, old_config, config);
3063 }
3064 pub fn ref_tick_apll_config(clocks: &mut ClockTree) -> Option<RefTickApllConfig> {
3065 clocks.ref_tick_apll
3066 }
3067 pub fn request_ref_tick_apll(clocks: &mut ClockTree) {
3068 trace!("Enabling REF_TICK_APLL");
3069 request_apb_clk(clocks);
3070 enable_ref_tick_apll_impl(clocks, true);
3071 }
3072 pub fn release_ref_tick_apll(clocks: &mut ClockTree) {
3073 trace!("Disabling REF_TICK_APLL");
3074 enable_ref_tick_apll_impl(clocks, false);
3075 release_apb_clk(clocks);
3076 }
3077 pub fn ref_tick_apll_config_frequency(config: RefTickApllConfig) -> u32 {
3078 (apb_clk_frequency() / (config.divisor() + 1))
3079 }
3080 #[inline(always)]
3081 pub fn ref_tick_apll_frequency() -> u32 {
3082 REF_TICK_APLL_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3083 }
3084 pub fn ref_tick_apll_source_frequency() -> u32 {
3085 apb_clk_frequency()
3086 }
3087 pub fn configure_ref_tick_pll(clocks: &mut ClockTree, config: RefTickPllConfig) {
3088 let old_config = clocks.ref_tick_pll.replace(config);
3089 refresh_ref_tick_pll_downstream(clocks);
3090 configure_ref_tick_pll_impl(clocks, old_config, config);
3091 }
3092 pub fn ref_tick_pll_config(clocks: &mut ClockTree) -> Option<RefTickPllConfig> {
3093 clocks.ref_tick_pll
3094 }
3095 pub fn request_ref_tick_pll(clocks: &mut ClockTree) {
3096 trace!("Enabling REF_TICK_PLL");
3097 request_apb_clk(clocks);
3098 enable_ref_tick_pll_impl(clocks, true);
3099 }
3100 pub fn release_ref_tick_pll(clocks: &mut ClockTree) {
3101 trace!("Disabling REF_TICK_PLL");
3102 enable_ref_tick_pll_impl(clocks, false);
3103 release_apb_clk(clocks);
3104 }
3105 pub fn ref_tick_pll_config_frequency(config: RefTickPllConfig) -> u32 {
3106 (apb_clk_frequency() / (config.divisor() + 1))
3107 }
3108 #[inline(always)]
3109 pub fn ref_tick_pll_frequency() -> u32 {
3110 REF_TICK_PLL_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3111 }
3112 pub fn ref_tick_pll_source_frequency() -> u32 {
3113 apb_clk_frequency()
3114 }
3115 pub fn configure_cpu_clk(clocks: &mut ClockTree, new_selector: CpuClkConfig) {
3116 let old_selector = clocks.cpu_clk.replace(new_selector);
3117 refresh_cpu_clk_downstream(clocks);
3118 match new_selector {
3119 CpuClkConfig::Xtal => {
3120 configure_apb_clk(clocks, ApbClkConfig::Cpu);
3121 configure_syscon_pre_div_in(clocks, SysconPreDivInConfig::Xtal);
3122 configure_ref_tick(clocks, RefTickConfig::Xtal);
3123 let config_value =
3124 RefTickXtalConfig::new(((apb_clk_frequency() / 1000000) - 1));
3125 configure_ref_tick_xtal(clocks, config_value);
3126 }
3127 CpuClkConfig::RcFast => {
3128 configure_apb_clk(clocks, ApbClkConfig::Cpu);
3129 configure_syscon_pre_div_in(clocks, SysconPreDivInConfig::RcFast);
3130 configure_ref_tick(clocks, RefTickConfig::Fosc);
3131 let config_value =
3132 RefTickFoscConfig::new(((apb_clk_frequency() / 1000000) - 1));
3133 configure_ref_tick_fosc(clocks, config_value);
3134 }
3135 CpuClkConfig::Apll => {
3136 configure_apb_clk(clocks, ApbClkConfig::CpuDiv2);
3137 configure_cpu_pll_div_in(clocks, CpuPllDivInConfig::Apll);
3138 configure_ref_tick(clocks, RefTickConfig::Apll);
3139 let config_value =
3140 RefTickApllConfig::new(((apb_clk_frequency() / 1000000) - 1));
3141 configure_ref_tick_apll(clocks, config_value);
3142 }
3143 CpuClkConfig::Pll => {
3144 configure_apb_clk(clocks, ApbClkConfig::Pll80m);
3145 configure_cpu_pll_div_in(clocks, CpuPllDivInConfig::Pll);
3146 configure_ref_tick(clocks, RefTickConfig::Pll);
3147 let config_value = RefTickPllConfig::new(((apb_clk_frequency() / 1000000) - 1));
3148 configure_ref_tick_pll(clocks, config_value);
3149 }
3150 }
3151 match new_selector {
3152 CpuClkConfig::Xtal => request_syscon_pre_div(clocks),
3153 CpuClkConfig::RcFast => request_syscon_pre_div(clocks),
3154 CpuClkConfig::Apll => request_cpu_pll_div(clocks),
3155 CpuClkConfig::Pll => request_cpu_pll_div(clocks),
3156 }
3157 configure_cpu_clk_impl(clocks, old_selector, new_selector);
3158 if let Some(old_selector) = old_selector {
3159 match old_selector {
3160 CpuClkConfig::Xtal => release_syscon_pre_div(clocks),
3161 CpuClkConfig::RcFast => release_syscon_pre_div(clocks),
3162 CpuClkConfig::Apll => release_cpu_pll_div(clocks),
3163 CpuClkConfig::Pll => release_cpu_pll_div(clocks),
3164 }
3165 }
3166 }
3167 pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
3168 clocks.cpu_clk
3169 }
3170 fn request_cpu_clk(_clocks: &mut ClockTree) {}
3171 fn release_cpu_clk(_clocks: &mut ClockTree) {}
3172 pub fn cpu_clk_config_frequency(config: CpuClkConfig) -> u32 {
3173 match config {
3174 CpuClkConfig::Xtal => syscon_pre_div_frequency(),
3175 CpuClkConfig::RcFast => syscon_pre_div_frequency(),
3176 CpuClkConfig::Apll => cpu_pll_div_frequency(),
3177 CpuClkConfig::Pll => cpu_pll_div_frequency(),
3178 }
3179 }
3180 #[inline(always)]
3181 pub fn cpu_clk_frequency() -> u32 {
3182 CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3183 }
3184 pub fn request_apb_clk_cpu_div2(clocks: &mut ClockTree) {
3185 trace!("Enabling APB_CLK_CPU_DIV2");
3186 request_cpu_clk(clocks);
3187 enable_apb_clk_cpu_div2_impl(clocks, true);
3188 }
3189 pub fn release_apb_clk_cpu_div2(clocks: &mut ClockTree) {
3190 trace!("Disabling APB_CLK_CPU_DIV2");
3191 enable_apb_clk_cpu_div2_impl(clocks, false);
3192 release_cpu_clk(clocks);
3193 }
3194 #[inline(always)]
3195 pub fn apb_clk_cpu_div2_frequency() -> u32 {
3196 (cpu_clk_frequency() / 2)
3197 }
3198 pub fn apb_clk_cpu_div2_source_frequency() -> u32 {
3199 cpu_clk_frequency()
3200 }
3201 pub fn request_apb_clk_80m(clocks: &mut ClockTree) {
3202 trace!("Enabling APB_CLK_80M");
3203 request_cpu_clk(clocks);
3204 enable_apb_clk_80m_impl(clocks, true);
3205 }
3206 pub fn release_apb_clk_80m(clocks: &mut ClockTree) {
3207 trace!("Disabling APB_CLK_80M");
3208 enable_apb_clk_80m_impl(clocks, false);
3209 release_cpu_clk(clocks);
3210 }
3211 #[inline(always)]
3212 pub fn apb_clk_80m_frequency() -> u32 {
3213 80000000
3214 }
3215 pub fn apb_clk_80m_source_frequency() -> u32 {
3216 cpu_clk_frequency()
3217 }
3218 #[cfg(use_xtal32k)]
3219 pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
3220 trace!("Requesting XTAL32K_CLK");
3221 if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
3222 trace!("Enabling XTAL32K_CLK");
3223 enable_xtal32k_clk_impl(clocks, true);
3224 }
3225 }
3226 #[cfg(use_xtal32k)]
3227 pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
3228 trace!("Releasing XTAL32K_CLK");
3229 if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
3230 trace!("Disabling XTAL32K_CLK");
3231 enable_xtal32k_clk_impl(clocks, false);
3232 }
3233 }
3234 #[cfg(use_xtal32k)]
3235 #[inline(always)]
3236 pub fn xtal32k_clk_frequency() -> u32 {
3237 32768
3238 }
3239 pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
3240 trace!("Requesting RC_SLOW_CLK");
3241 if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
3242 trace!("Enabling RC_SLOW_CLK");
3243 enable_rc_slow_clk_impl(clocks, true);
3244 }
3245 }
3246 pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
3247 trace!("Releasing RC_SLOW_CLK");
3248 if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
3249 trace!("Disabling RC_SLOW_CLK");
3250 enable_rc_slow_clk_impl(clocks, false);
3251 }
3252 }
3253 static RC_SLOW_CLK_FREQUENCY: ::core::sync::atomic::AtomicU32 =
3254 ::core::sync::atomic::AtomicU32::new(rc_slow_clk_nominal_frequency());
3255 pub const fn rc_slow_clk_nominal_frequency() -> u32 {
3256 150000
3257 }
3258 #[inline(always)]
3259 pub fn rc_slow_clk_frequency() -> u32 {
3260 RC_SLOW_CLK_FREQUENCY.load(::core::sync::atomic::Ordering::Acquire)
3261 }
3262 pub fn set_rc_slow_clk_frequency(clocks: &mut ClockTree, frequency: u32) {
3263 if !(75000..=225000).contains(&frequency) {
3264 warn!(
3265 "Ignoring out-of-range RC_SLOW_CLK frequency: {} Hz",
3266 frequency
3267 );
3268 return;
3269 }
3270 debug!(
3271 "Updating RC_SLOW_CLK frequency to {} Hz (nominal {} Hz)",
3272 frequency,
3273 rc_slow_clk_nominal_frequency()
3274 );
3275 RC_SLOW_CLK_FREQUENCY.store(frequency, ::core::sync::atomic::Ordering::Release);
3276 refresh_rc_slow_clk_downstream(clocks);
3277 }
3278 pub fn request_rc_fast_div_clk(clocks: &mut ClockTree) {
3279 trace!("Requesting RC_FAST_DIV_CLK");
3280 if increment_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
3281 trace!("Enabling RC_FAST_DIV_CLK");
3282 request_rc_fast_clk(clocks);
3283 enable_rc_fast_div_clk_impl(clocks, true);
3284 }
3285 }
3286 pub fn release_rc_fast_div_clk(clocks: &mut ClockTree) {
3287 trace!("Releasing RC_FAST_DIV_CLK");
3288 if decrement_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
3289 trace!("Disabling RC_FAST_DIV_CLK");
3290 enable_rc_fast_div_clk_impl(clocks, false);
3291 release_rc_fast_clk(clocks);
3292 }
3293 }
3294 #[inline(always)]
3295 pub fn rc_fast_div_clk_frequency() -> u32 {
3296 (rc_fast_clk_frequency() / 256)
3297 }
3298 pub fn rc_fast_div_clk_source_frequency() -> u32 {
3299 rc_fast_clk_frequency()
3300 }
3301 pub fn request_xtal_div_clk(clocks: &mut ClockTree) {
3302 trace!("Enabling XTAL_DIV_CLK");
3303 request_xtal_clk(clocks);
3304 enable_xtal_div_clk_impl(clocks, true);
3305 }
3306 pub fn release_xtal_div_clk(clocks: &mut ClockTree) {
3307 trace!("Disabling XTAL_DIV_CLK");
3308 enable_xtal_div_clk_impl(clocks, false);
3309 release_xtal_clk(clocks);
3310 }
3311 #[inline(always)]
3312 pub fn xtal_div_clk_frequency() -> u32 {
3313 (xtal_clk_frequency() / 4)
3314 }
3315 pub fn xtal_div_clk_source_frequency() -> u32 {
3316 xtal_clk_frequency()
3317 }
3318 pub fn configure_rtc_slow_clk(clocks: &mut ClockTree, new_selector: RtcSlowClkConfig) {
3319 let old_selector = clocks.rtc_slow_clk.replace(new_selector);
3320 refresh_rtc_slow_clk_downstream(clocks);
3321 match new_selector {
3322 #[cfg(use_xtal32k)]
3323 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3324 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3325 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
3326 }
3327 configure_rtc_slow_clk_impl(clocks, old_selector, new_selector);
3328 if let Some(old_selector) = old_selector {
3329 match old_selector {
3330 #[cfg(use_xtal32k)]
3331 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3332 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3333 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
3334 }
3335 }
3336 }
3337 pub fn rtc_slow_clk_config(clocks: &mut ClockTree) -> Option<RtcSlowClkConfig> {
3338 clocks.rtc_slow_clk
3339 }
3340 pub fn request_rtc_slow_clk(clocks: &mut ClockTree) {
3341 trace!("Enabling RTC_SLOW_CLK");
3342 match unwrap!(clocks.rtc_slow_clk) {
3343 #[cfg(use_xtal32k)]
3344 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3345 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3346 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
3347 }
3348 enable_rtc_slow_clk_impl(clocks, true);
3349 }
3350 pub fn release_rtc_slow_clk(clocks: &mut ClockTree) {
3351 trace!("Disabling RTC_SLOW_CLK");
3352 enable_rtc_slow_clk_impl(clocks, false);
3353 match unwrap!(clocks.rtc_slow_clk) {
3354 #[cfg(use_xtal32k)]
3355 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3356 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3357 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
3358 }
3359 }
3360 pub fn rtc_slow_clk_config_frequency(config: RtcSlowClkConfig) -> u32 {
3361 match config {
3362 #[cfg(use_xtal32k)]
3363 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3364 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3365 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
3366 }
3367 }
3368 #[inline(always)]
3369 pub fn rtc_slow_clk_frequency() -> u32 {
3370 RTC_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3371 }
3372 pub fn rtc_slow_clk_source_frequency(source: RtcSlowClkConfig) -> u32 {
3373 rtc_slow_clk_config_frequency(source)
3374 }
3375 pub fn request_ble_lp_xtal_clk(clocks: &mut ClockTree) {
3376 trace!("Enabling BLE_LP_XTAL_CLK");
3377 request_xtal_clk(clocks);
3378 enable_ble_lp_xtal_clk_impl(clocks, true);
3379 }
3380 pub fn release_ble_lp_xtal_clk(clocks: &mut ClockTree) {
3381 trace!("Disabling BLE_LP_XTAL_CLK");
3382 enable_ble_lp_xtal_clk_impl(clocks, false);
3383 release_xtal_clk(clocks);
3384 }
3385 #[inline(always)]
3386 pub fn ble_lp_xtal_clk_frequency() -> u32 {
3387 500000
3388 }
3389 pub fn ble_lp_xtal_clk_source_frequency() -> u32 {
3390 xtal_clk_frequency()
3391 }
3392 pub fn configure_ble_lp_clk(clocks: &mut ClockTree, new_selector: BleLpClkConfig) {
3393 let old_selector = clocks.ble_lp_clk.replace(new_selector);
3394 refresh_ble_lp_clk_downstream(clocks);
3395 let active = clocks.ble_lp_clk_refcount > 0;
3396 if active {
3397 match new_selector {
3398 BleLpClkConfig::Xtal => request_ble_lp_xtal_clk(clocks),
3399 BleLpClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
3400 }
3401 }
3402 configure_ble_lp_clk_impl(clocks, old_selector, new_selector);
3403 if active && let Some(old_selector) = old_selector {
3404 match old_selector {
3405 BleLpClkConfig::Xtal => release_ble_lp_xtal_clk(clocks),
3406 BleLpClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
3407 }
3408 }
3409 }
3410 pub fn ble_lp_clk_config(clocks: &mut ClockTree) -> Option<BleLpClkConfig> {
3411 clocks.ble_lp_clk
3412 }
3413 pub fn request_ble_lp_clk(clocks: &mut ClockTree) {
3414 trace!("Requesting BLE_LP_CLK");
3415 if increment_reference_count(&mut clocks.ble_lp_clk_refcount) {
3416 trace!("Enabling BLE_LP_CLK");
3417 match unwrap!(clocks.ble_lp_clk) {
3418 BleLpClkConfig::Xtal => request_ble_lp_xtal_clk(clocks),
3419 BleLpClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
3420 }
3421 enable_ble_lp_clk_impl(clocks, true);
3422 }
3423 }
3424 pub fn release_ble_lp_clk(clocks: &mut ClockTree) {
3425 trace!("Releasing BLE_LP_CLK");
3426 if decrement_reference_count(&mut clocks.ble_lp_clk_refcount) {
3427 trace!("Disabling BLE_LP_CLK");
3428 enable_ble_lp_clk_impl(clocks, false);
3429 match unwrap!(clocks.ble_lp_clk) {
3430 BleLpClkConfig::Xtal => release_ble_lp_xtal_clk(clocks),
3431 BleLpClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
3432 }
3433 }
3434 }
3435 pub fn ble_lp_clk_config_frequency(config: BleLpClkConfig) -> u32 {
3436 match config {
3437 BleLpClkConfig::Xtal => ble_lp_xtal_clk_frequency(),
3438 BleLpClkConfig::RtcSlow => rtc_slow_clk_frequency(),
3439 }
3440 }
3441 #[inline(always)]
3442 pub fn ble_lp_clk_frequency() -> u32 {
3443 BLE_LP_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3444 }
3445 pub fn ble_lp_clk_source_frequency(source: BleLpClkConfig) -> u32 {
3446 ble_lp_clk_config_frequency(source)
3447 }
3448 pub fn configure_rtc_fast_clk(clocks: &mut ClockTree, new_selector: RtcFastClkConfig) {
3449 let old_selector = clocks.rtc_fast_clk.replace(new_selector);
3450 refresh_rtc_fast_clk_downstream(clocks);
3451 let active = clocks.rtc_fast_clk_refcount > 0;
3452 if active {
3453 match new_selector {
3454 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
3455 RtcFastClkConfig::Rc => request_rc_fast_clk(clocks),
3456 }
3457 }
3458 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
3459 if active && let Some(old_selector) = old_selector {
3460 match old_selector {
3461 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
3462 RtcFastClkConfig::Rc => release_rc_fast_clk(clocks),
3463 }
3464 }
3465 }
3466 pub fn rtc_fast_clk_config(clocks: &mut ClockTree) -> Option<RtcFastClkConfig> {
3467 clocks.rtc_fast_clk
3468 }
3469 pub fn request_rtc_fast_clk(clocks: &mut ClockTree) {
3470 trace!("Requesting RTC_FAST_CLK");
3471 if increment_reference_count(&mut clocks.rtc_fast_clk_refcount) {
3472 trace!("Enabling RTC_FAST_CLK");
3473 match unwrap!(clocks.rtc_fast_clk) {
3474 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
3475 RtcFastClkConfig::Rc => request_rc_fast_clk(clocks),
3476 }
3477 enable_rtc_fast_clk_impl(clocks, true);
3478 }
3479 }
3480 pub fn release_rtc_fast_clk(clocks: &mut ClockTree) {
3481 trace!("Releasing RTC_FAST_CLK");
3482 if decrement_reference_count(&mut clocks.rtc_fast_clk_refcount) {
3483 trace!("Disabling RTC_FAST_CLK");
3484 enable_rtc_fast_clk_impl(clocks, false);
3485 match unwrap!(clocks.rtc_fast_clk) {
3486 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
3487 RtcFastClkConfig::Rc => release_rc_fast_clk(clocks),
3488 }
3489 }
3490 }
3491 pub fn rtc_fast_clk_config_frequency(config: RtcFastClkConfig) -> u32 {
3492 match config {
3493 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
3494 RtcFastClkConfig::Rc => rc_fast_clk_frequency(),
3495 }
3496 }
3497 #[inline(always)]
3498 pub fn rtc_fast_clk_frequency() -> u32 {
3499 RTC_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3500 }
3501 pub fn rtc_fast_clk_source_frequency(source: RtcFastClkConfig) -> u32 {
3502 rtc_fast_clk_config_frequency(source)
3503 }
3504 pub fn request_uart_mem_clk(clocks: &mut ClockTree) {
3505 trace!("Requesting UART_MEM_CLK");
3506 if increment_reference_count(&mut clocks.uart_mem_clk_refcount) {
3507 trace!("Enabling UART_MEM_CLK");
3508 request_xtal_clk(clocks);
3509 enable_uart_mem_clk_impl(clocks, true);
3510 }
3511 }
3512 pub fn release_uart_mem_clk(clocks: &mut ClockTree) {
3513 trace!("Releasing UART_MEM_CLK");
3514 if decrement_reference_count(&mut clocks.uart_mem_clk_refcount) {
3515 trace!("Disabling UART_MEM_CLK");
3516 enable_uart_mem_clk_impl(clocks, false);
3517 release_xtal_clk(clocks);
3518 }
3519 }
3520 #[inline(always)]
3521 pub fn uart_mem_clk_frequency() -> u32 {
3522 xtal_clk_frequency()
3523 }
3524 pub fn uart_mem_clk_source_frequency(source: UartMemClkConfig) -> u32 {
3525 match source {
3526 UartMemClkConfig::Xtal => xtal_clk_frequency(),
3527 }
3528 }
3529 pub fn configure_timg_calibration_clock(
3530 clocks: &mut ClockTree,
3531 new_selector: TimgCalibrationClockConfig,
3532 ) {
3533 let old_selector = clocks.timg_calibration_clock.replace(new_selector);
3534 refresh_timg_calibration_clock_downstream(clocks);
3535 let active = clocks.timg_calibration_clock_refcount > 0;
3536 if active {
3537 match new_selector {
3538 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3539 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3540 #[cfg(use_xtal32k)]
3541 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3542 }
3543 }
3544 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3545 if active && let Some(old_selector) = old_selector {
3546 match old_selector {
3547 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3548 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3549 #[cfg(use_xtal32k)]
3550 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3551 }
3552 }
3553 }
3554 pub fn timg_calibration_clock_config(
3555 clocks: &mut ClockTree,
3556 ) -> Option<TimgCalibrationClockConfig> {
3557 clocks.timg_calibration_clock
3558 }
3559 pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
3560 trace!("Requesting TIMG_CALIBRATION_CLOCK");
3561 if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3562 trace!("Enabling TIMG_CALIBRATION_CLOCK");
3563 crate::rtc_cntl::WakeLock::acquire();
3564 match unwrap!(clocks.timg_calibration_clock) {
3565 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3566 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3567 #[cfg(use_xtal32k)]
3568 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3569 }
3570 enable_timg_calibration_clock_impl(clocks, true);
3571 }
3572 }
3573 pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
3574 trace!("Releasing TIMG_CALIBRATION_CLOCK");
3575 if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3576 trace!("Disabling TIMG_CALIBRATION_CLOCK");
3577 crate::rtc_cntl::WakeLock::release();
3578 enable_timg_calibration_clock_impl(clocks, false);
3579 match unwrap!(clocks.timg_calibration_clock) {
3580 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3581 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3582 #[cfg(use_xtal32k)]
3583 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3584 }
3585 }
3586 }
3587 pub fn timg_calibration_clock_config_frequency(config: TimgCalibrationClockConfig) -> u32 {
3588 match config {
3589 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
3590 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
3591 #[cfg(use_xtal32k)]
3592 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3593 }
3594 }
3595 #[inline(always)]
3596 pub fn timg_calibration_clock_frequency() -> u32 {
3597 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3598 }
3599 pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
3600 timg_calibration_clock_config_frequency(source)
3601 }
3602 impl SdmInstance {
3603 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3604 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3605 if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3606 {
3607 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3608 request_apb_clk(clocks);
3609 self.enable_function_clock_impl(clocks, true);
3610 }
3611 }
3612 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3613 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3614 if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3615 {
3616 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3617 self.enable_function_clock_impl(clocks, false);
3618 release_apb_clk(clocks);
3619 }
3620 }
3621 #[inline(always)]
3622 pub fn function_clock_frequency(self) -> u32 {
3623 apb_clk_frequency()
3624 }
3625 pub fn function_clock_source_frequency() -> u32 {
3626 apb_clk_frequency()
3627 }
3628 }
3629 impl I2cInstance {
3630 pub fn configure_function_clock(
3631 self,
3632 clocks: &mut ClockTree,
3633 config: I2cFunctionClockConfig,
3634 ) {
3635 let old_config = clocks.i2c_function_clock[self as usize].replace(config);
3636 refresh_i2c_function_clock_downstream(clocks, self);
3637 self.configure_function_clock_impl(clocks, old_config, config);
3638 }
3639 pub fn function_clock_config(
3640 self,
3641 clocks: &mut ClockTree,
3642 ) -> Option<I2cFunctionClockConfig> {
3643 clocks.i2c_function_clock[self as usize]
3644 }
3645 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3646 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3647 if increment_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3648 {
3649 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3650 crate::rtc_cntl::WakeLock::acquire();
3651 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3652 I2cFunctionClockSclk::Apb => request_apb_clk(clocks),
3653 }
3654 self.enable_function_clock_impl(clocks, true);
3655 }
3656 }
3657 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3658 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3659 if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3660 {
3661 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3662 crate::rtc_cntl::WakeLock::release();
3663 self.enable_function_clock_impl(clocks, false);
3664 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3665 I2cFunctionClockSclk::Apb => release_apb_clk(clocks),
3666 }
3667 }
3668 }
3669 #[allow(unused_variables)]
3670 pub fn function_clock_config_frequency(config: I2cFunctionClockConfig) -> u32 {
3671 apb_clk_frequency()
3672 }
3673 pub fn function_clock_frequency(self) -> u32 {
3674 apb_clk_frequency()
3675 }
3676 pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
3677 match sclk {
3678 I2cFunctionClockSclk::Apb => apb_clk_frequency(),
3679 }
3680 }
3681 }
3682 impl I2sInstance {
3683 pub fn configure_mclk(self, clocks: &mut ClockTree, config: I2sMclkConfig) {
3684 let old_config = clocks.i2s_mclk[self as usize].replace(config);
3685 refresh_i2s_mclk_downstream(clocks, self);
3686 let active = clocks.i2s_mclk_refcount[self as usize] > 0;
3687 if active {
3688 match config.sclk {
3689 I2sMclkSclk::PllF160m => request_pll_f160m_clk(clocks),
3690 I2sMclkSclk::Apll => request_apll_clk(clocks),
3691 }
3692 }
3693 self.configure_mclk_impl(clocks, old_config, config);
3694 if active && let Some(old_config) = old_config {
3695 match old_config.sclk {
3696 I2sMclkSclk::PllF160m => release_pll_f160m_clk(clocks),
3697 I2sMclkSclk::Apll => release_apll_clk(clocks),
3698 }
3699 }
3700 }
3701 pub fn mclk_config(self, clocks: &mut ClockTree) -> Option<I2sMclkConfig> {
3702 clocks.i2s_mclk[self as usize]
3703 }
3704 pub fn request_mclk(self, clocks: &mut ClockTree) {
3705 trace!("Requesting {:?}::MCLK", self);
3706 if increment_reference_count(&mut clocks.i2s_mclk_refcount[self as usize]) {
3707 trace!("Enabling {:?}::MCLK", self);
3708 crate::rtc_cntl::WakeLock::acquire();
3709 match unwrap!(clocks.i2s_mclk[self as usize]).sclk {
3710 I2sMclkSclk::PllF160m => request_pll_f160m_clk(clocks),
3711 I2sMclkSclk::Apll => request_apll_clk(clocks),
3712 }
3713 self.enable_mclk_impl(clocks, true);
3714 }
3715 }
3716 pub fn release_mclk(self, clocks: &mut ClockTree) {
3717 trace!("Releasing {:?}::MCLK", self);
3718 if decrement_reference_count(&mut clocks.i2s_mclk_refcount[self as usize]) {
3719 trace!("Disabling {:?}::MCLK", self);
3720 crate::rtc_cntl::WakeLock::release();
3721 self.enable_mclk_impl(clocks, false);
3722 match unwrap!(clocks.i2s_mclk[self as usize]).sclk {
3723 I2sMclkSclk::PllF160m => release_pll_f160m_clk(clocks),
3724 I2sMclkSclk::Apll => release_apll_clk(clocks),
3725 }
3726 }
3727 }
3728 pub fn mclk_config_frequency(config: I2sMclkConfig) -> u32 {
3729 (((match config.sclk {
3730 I2sMclkSclk::PllF160m => pll_f160m_clk_frequency(),
3731 I2sMclkSclk::Apll => apll_clk_frequency(),
3732 } as u64)
3733 * (config.div_a() as u64))
3734 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3735 as u32
3736 }
3737 #[inline(always)]
3738 pub fn mclk_frequency(self) -> u32 {
3739 I2S_MCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3740 }
3741 pub fn mclk_source_frequency(sclk: I2sMclkSclk) -> u32 {
3742 match sclk {
3743 I2sMclkSclk::PllF160m => pll_f160m_clk_frequency(),
3744 I2sMclkSclk::Apll => apll_clk_frequency(),
3745 }
3746 }
3747 }
3748 impl McpwmInstance {
3749 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3750 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3751 if increment_reference_count(
3752 &mut clocks.mcpwm_function_clock_refcount[self as usize],
3753 ) {
3754 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3755 crate::rtc_cntl::WakeLock::acquire();
3756 request_pll_f160m_clk(clocks);
3757 self.enable_function_clock_impl(clocks, true);
3758 }
3759 }
3760 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3761 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3762 if decrement_reference_count(
3763 &mut clocks.mcpwm_function_clock_refcount[self as usize],
3764 ) {
3765 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3766 crate::rtc_cntl::WakeLock::release();
3767 self.enable_function_clock_impl(clocks, false);
3768 release_pll_f160m_clk(clocks);
3769 }
3770 }
3771 #[inline(always)]
3772 pub fn function_clock_frequency(self) -> u32 {
3773 pll_f160m_clk_frequency()
3774 }
3775 pub fn function_clock_source_frequency(source: McpwmFunctionClockConfig) -> u32 {
3776 match source {
3777 McpwmFunctionClockConfig::PllF160m => pll_f160m_clk_frequency(),
3778 }
3779 }
3780 }
3781 impl RmtInstance {
3782 pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
3783 let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
3784 refresh_rmt_sclk_downstream(clocks, self);
3785 let active = clocks.rmt_sclk_refcount[self as usize] > 0;
3786 if active {
3787 match new_selector {
3788 RmtSclkConfig::RefTick => request_ref_tick(clocks),
3789 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
3790 }
3791 }
3792 self.configure_sclk_impl(clocks, old_selector, new_selector);
3793 if active && let Some(old_selector) = old_selector {
3794 match old_selector {
3795 RmtSclkConfig::RefTick => release_ref_tick(clocks),
3796 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
3797 }
3798 }
3799 }
3800 pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
3801 clocks.rmt_sclk[self as usize]
3802 }
3803 pub fn request_sclk(self, clocks: &mut ClockTree) {
3804 trace!("Requesting {:?}::SCLK", self);
3805 if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3806 trace!("Enabling {:?}::SCLK", self);
3807 crate::rtc_cntl::WakeLock::acquire();
3808 match unwrap!(clocks.rmt_sclk[self as usize]) {
3809 RmtSclkConfig::RefTick => request_ref_tick(clocks),
3810 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
3811 }
3812 self.enable_sclk_impl(clocks, true);
3813 }
3814 }
3815 pub fn release_sclk(self, clocks: &mut ClockTree) {
3816 trace!("Releasing {:?}::SCLK", self);
3817 if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3818 trace!("Disabling {:?}::SCLK", self);
3819 crate::rtc_cntl::WakeLock::release();
3820 self.enable_sclk_impl(clocks, false);
3821 match unwrap!(clocks.rmt_sclk[self as usize]) {
3822 RmtSclkConfig::RefTick => release_ref_tick(clocks),
3823 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
3824 }
3825 }
3826 }
3827 pub fn sclk_config_frequency(config: RmtSclkConfig) -> u32 {
3828 match config {
3829 RmtSclkConfig::RefTick => ref_tick_frequency(),
3830 RmtSclkConfig::ApbClk => apb_clk_frequency(),
3831 }
3832 }
3833 #[inline(always)]
3834 pub fn sclk_frequency(self) -> u32 {
3835 RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3836 }
3837 pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
3838 Self::sclk_config_frequency(source)
3839 }
3840 }
3841 impl SpiInstance {
3842 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3843 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3844 if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3845 {
3846 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3847 crate::rtc_cntl::WakeLock::acquire();
3848 request_apb_clk(clocks);
3849 self.enable_function_clock_impl(clocks, true);
3850 }
3851 }
3852 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3853 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3854 if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3855 {
3856 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3857 crate::rtc_cntl::WakeLock::release();
3858 self.enable_function_clock_impl(clocks, false);
3859 release_apb_clk(clocks);
3860 }
3861 }
3862 #[inline(always)]
3863 pub fn function_clock_frequency(self) -> u32 {
3864 apb_clk_frequency()
3865 }
3866 pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
3867 match source {
3868 SpiFunctionClockConfig::Apb => apb_clk_frequency(),
3869 }
3870 }
3871 }
3872 impl UartInstance {
3873 pub fn configure_function_clock(
3874 self,
3875 clocks: &mut ClockTree,
3876 config: UartFunctionClockConfig,
3877 ) {
3878 let old_config = clocks.uart_function_clock[self as usize].replace(config);
3879 refresh_uart_function_clock_downstream(clocks, self);
3880 let active = clocks.uart_function_clock_refcount[self as usize] > 0;
3881 if active {
3882 match config.sclk {
3883 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
3884 UartFunctionClockSclk::RefTick => request_ref_tick(clocks),
3885 }
3886 }
3887 self.configure_function_clock_impl(clocks, old_config, config);
3888 if active && let Some(old_config) = old_config {
3889 match old_config.sclk {
3890 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
3891 UartFunctionClockSclk::RefTick => release_ref_tick(clocks),
3892 }
3893 }
3894 }
3895 pub fn function_clock_config(
3896 self,
3897 clocks: &mut ClockTree,
3898 ) -> Option<UartFunctionClockConfig> {
3899 clocks.uart_function_clock[self as usize]
3900 }
3901 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3902 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3903 if increment_reference_count(
3904 &mut clocks.uart_function_clock_refcount[self as usize],
3905 ) {
3906 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3907 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3908 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
3909 UartFunctionClockSclk::RefTick => request_ref_tick(clocks),
3910 }
3911 self.enable_function_clock_impl(clocks, true);
3912 }
3913 }
3914 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3915 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3916 if decrement_reference_count(
3917 &mut clocks.uart_function_clock_refcount[self as usize],
3918 ) {
3919 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3920 self.enable_function_clock_impl(clocks, false);
3921 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3922 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
3923 UartFunctionClockSclk::RefTick => release_ref_tick(clocks),
3924 }
3925 }
3926 }
3927 pub fn function_clock_config_frequency(config: UartFunctionClockConfig) -> u32 {
3928 match config.sclk {
3929 UartFunctionClockSclk::Apb => apb_clk_frequency(),
3930 UartFunctionClockSclk::RefTick => ref_tick_frequency(),
3931 }
3932 }
3933 #[inline(always)]
3934 pub fn function_clock_frequency(self) -> u32 {
3935 UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3936 .load(::core::sync::atomic::Ordering::Acquire)
3937 }
3938 pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
3939 match sclk {
3940 UartFunctionClockSclk::Apb => apb_clk_frequency(),
3941 UartFunctionClockSclk::RefTick => ref_tick_frequency(),
3942 }
3943 }
3944 pub fn request_mem_clock(self, clocks: &mut ClockTree) {
3945 trace!("Requesting {:?}::MEM_CLOCK", self);
3946 if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
3947 trace!("Enabling {:?}::MEM_CLOCK", self);
3948 request_uart_mem_clk(clocks);
3949 self.enable_mem_clock_impl(clocks, true);
3950 }
3951 }
3952 pub fn release_mem_clock(self, clocks: &mut ClockTree) {
3953 trace!("Releasing {:?}::MEM_CLOCK", self);
3954 if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
3955 trace!("Disabling {:?}::MEM_CLOCK", self);
3956 self.enable_mem_clock_impl(clocks, false);
3957 release_uart_mem_clk(clocks);
3958 }
3959 }
3960 #[inline(always)]
3961 pub fn mem_clock_frequency(self) -> u32 {
3962 uart_mem_clk_frequency()
3963 }
3964 pub fn mem_clock_source_frequency() -> u32 {
3965 uart_mem_clk_frequency()
3966 }
3967 pub fn configure_baud_rate_generator(
3968 self,
3969 clocks: &mut ClockTree,
3970 config: UartBaudRateGeneratorConfig,
3971 ) {
3972 let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
3973 refresh_uart_baud_rate_generator_downstream(clocks, self);
3974 self.configure_baud_rate_generator_impl(clocks, old_config, config);
3975 }
3976 pub fn baud_rate_generator_config(
3977 self,
3978 clocks: &mut ClockTree,
3979 ) -> Option<UartBaudRateGeneratorConfig> {
3980 clocks.uart_baud_rate_generator[self as usize]
3981 }
3982 pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
3983 trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
3984 if increment_reference_count(
3985 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3986 ) {
3987 trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
3988 self.request_function_clock(clocks);
3989 self.enable_baud_rate_generator_impl(clocks, true);
3990 }
3991 }
3992 pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
3993 trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
3994 if decrement_reference_count(
3995 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3996 ) {
3997 trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
3998 self.enable_baud_rate_generator_impl(clocks, false);
3999 self.release_function_clock(clocks);
4000 }
4001 }
4002 pub fn baud_rate_generator_config_frequency(
4003 self,
4004 config: UartBaudRateGeneratorConfig,
4005 ) -> u32 {
4006 ((self.function_clock_frequency() * 16)
4007 / ((config.integral() * 16) + config.fractional()))
4008 }
4009 #[inline(always)]
4010 pub fn baud_rate_generator_frequency(self) -> u32 {
4011 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
4012 .load(::core::sync::atomic::Ordering::Acquire)
4013 }
4014 }
4015 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4023 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4024 #[instability::unstable]
4025 pub struct ClockConfig {
4026 pub xtal_clk: Option<XtalClkConfig>,
4028 pub pll_clk: Option<PllClkConfig>,
4030 pub apll_clk: Option<ApllClkConfig>,
4032 pub cpu_pll_div: Option<CpuPllDivConfig>,
4034 pub syscon_pre_div: Option<SysconPreDivConfig>,
4036 pub cpu_clk: Option<CpuClkConfig>,
4038 pub rtc_slow_clk: Option<RtcSlowClkConfig>,
4040 pub ble_lp_clk: Option<BleLpClkConfig>,
4042 pub rtc_fast_clk: Option<RtcFastClkConfig>,
4044 pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
4046 }
4047 impl ClockConfig {
4048 fn apply(&self, clocks: &mut ClockTree) {
4049 if let Some(config) = self.xtal_clk {
4050 configure_xtal_clk(clocks, config);
4051 }
4052 if let Some(config) = self.pll_clk {
4053 configure_pll_clk(clocks, config);
4054 }
4055 if let Some(config) = self.apll_clk {
4056 configure_apll_clk(clocks, config);
4057 }
4058 if let Some(config) = self.cpu_pll_div {
4059 configure_cpu_pll_div(clocks, config);
4060 }
4061 if let Some(config) = self.syscon_pre_div {
4062 configure_syscon_pre_div(clocks, config);
4063 }
4064 if let Some(config) = self.cpu_clk {
4065 configure_cpu_clk(clocks, config);
4066 }
4067 if let Some(config) = self.rtc_slow_clk {
4068 configure_rtc_slow_clk(clocks, config);
4069 }
4070 if let Some(config) = self.ble_lp_clk {
4071 configure_ble_lp_clk(clocks, config);
4072 }
4073 if let Some(config) = self.rtc_fast_clk {
4074 configure_rtc_fast_clk(clocks, config);
4075 }
4076 if let Some(config) = self.timg_calibration_clock {
4077 configure_timg_calibration_clock(clocks, config);
4078 }
4079 }
4080 }
4081 fn increment_reference_count(refcount: &mut u32) -> bool {
4082 let first = *refcount == 0;
4083 *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
4084 first
4085 }
4086 fn decrement_reference_count(refcount: &mut u32) -> bool {
4087 *refcount = refcount.saturating_sub(1);
4088 let last = *refcount == 0;
4089 last
4090 }
4091 fn refresh_xtal_clk_downstream(clocks: &mut ClockTree) {
4092 if let Some(config) = clocks.xtal_clk {
4093 XTAL_CLK_FREQ_CACHE.store(
4094 xtal_clk_config_frequency(config),
4095 ::core::sync::atomic::Ordering::Release,
4096 );
4097 }
4098 refresh_pll_clk_downstream(clocks);
4099 refresh_syscon_pre_div_in_downstream(clocks);
4100 refresh_ble_lp_clk_downstream(clocks);
4101 refresh_rtc_fast_clk_downstream(clocks);
4102 }
4103 fn refresh_pll_clk_downstream(clocks: &mut ClockTree) {
4104 if let Some(config) = clocks.pll_clk {
4105 PLL_CLK_FREQ_CACHE.store(
4106 pll_clk_config_frequency(config),
4107 ::core::sync::atomic::Ordering::Release,
4108 );
4109 }
4110 refresh_apll_clk_downstream(clocks);
4111 refresh_cpu_pll_div_in_downstream(clocks);
4112 for child_instance in [I2sInstance::I2s0, I2sInstance::I2s1] {
4113 refresh_i2s_mclk_downstream(clocks, child_instance);
4114 }
4115 }
4116 fn refresh_apll_clk_downstream(clocks: &mut ClockTree) {
4117 if let Some(config) = clocks.apll_clk {
4118 APLL_CLK_FREQ_CACHE.store(
4119 apll_clk_config_frequency(config),
4120 ::core::sync::atomic::Ordering::Release,
4121 );
4122 }
4123 refresh_cpu_pll_div_in_downstream(clocks);
4124 for child_instance in [I2sInstance::I2s0, I2sInstance::I2s1] {
4125 refresh_i2s_mclk_downstream(clocks, child_instance);
4126 }
4127 }
4128 fn refresh_rc_fast_clk_downstream(clocks: &mut ClockTree) {
4129 refresh_syscon_pre_div_in_downstream(clocks);
4130 refresh_rtc_slow_clk_downstream(clocks);
4131 refresh_rtc_fast_clk_downstream(clocks);
4132 refresh_timg_calibration_clock_downstream(clocks);
4133 }
4134 fn refresh_cpu_pll_div_in_downstream(clocks: &mut ClockTree) {
4135 if let Some(config) = clocks.cpu_pll_div_in {
4136 CPU_PLL_DIV_IN_FREQ_CACHE.store(
4137 cpu_pll_div_in_config_frequency(config),
4138 ::core::sync::atomic::Ordering::Release,
4139 );
4140 }
4141 refresh_cpu_pll_div_downstream(clocks);
4142 }
4143 fn refresh_cpu_pll_div_downstream(clocks: &mut ClockTree) {
4144 if let Some(config) = clocks.cpu_pll_div {
4145 CPU_PLL_DIV_FREQ_CACHE.store(
4146 cpu_pll_div_config_frequency(config),
4147 ::core::sync::atomic::Ordering::Release,
4148 );
4149 }
4150 refresh_cpu_clk_downstream(clocks);
4151 }
4152 fn refresh_syscon_pre_div_in_downstream(clocks: &mut ClockTree) {
4153 if let Some(config) = clocks.syscon_pre_div_in {
4154 SYSCON_PRE_DIV_IN_FREQ_CACHE.store(
4155 syscon_pre_div_in_config_frequency(config),
4156 ::core::sync::atomic::Ordering::Release,
4157 );
4158 }
4159 refresh_syscon_pre_div_downstream(clocks);
4160 }
4161 fn refresh_syscon_pre_div_downstream(clocks: &mut ClockTree) {
4162 if let Some(config) = clocks.syscon_pre_div {
4163 SYSCON_PRE_DIV_FREQ_CACHE.store(
4164 syscon_pre_div_config_frequency(config),
4165 ::core::sync::atomic::Ordering::Release,
4166 );
4167 }
4168 refresh_cpu_clk_downstream(clocks);
4169 }
4170 fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
4171 if let Some(config) = clocks.cpu_clk {
4172 CPU_CLK_FREQ_CACHE.store(
4173 cpu_clk_config_frequency(config),
4174 ::core::sync::atomic::Ordering::Release,
4175 );
4176 }
4177 refresh_apb_clk_downstream(clocks);
4178 }
4179 fn refresh_rc_slow_clk_downstream(clocks: &mut ClockTree) {
4180 refresh_rtc_slow_clk_downstream(clocks);
4181 refresh_timg_calibration_clock_downstream(clocks);
4182 }
4183 fn refresh_rtc_slow_clk_downstream(clocks: &mut ClockTree) {
4184 if let Some(config) = clocks.rtc_slow_clk {
4185 RTC_SLOW_CLK_FREQ_CACHE.store(
4186 rtc_slow_clk_config_frequency(config),
4187 ::core::sync::atomic::Ordering::Release,
4188 );
4189 }
4190 refresh_ble_lp_clk_downstream(clocks);
4191 }
4192 fn refresh_ble_lp_clk_downstream(clocks: &mut ClockTree) {
4193 if let Some(config) = clocks.ble_lp_clk {
4194 BLE_LP_CLK_FREQ_CACHE.store(
4195 ble_lp_clk_config_frequency(config),
4196 ::core::sync::atomic::Ordering::Release,
4197 );
4198 }
4199 }
4200 fn refresh_rtc_fast_clk_downstream(clocks: &mut ClockTree) {
4201 if let Some(config) = clocks.rtc_fast_clk {
4202 RTC_FAST_CLK_FREQ_CACHE.store(
4203 rtc_fast_clk_config_frequency(config),
4204 ::core::sync::atomic::Ordering::Release,
4205 );
4206 }
4207 }
4208 fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
4209 if let Some(config) = clocks.timg_calibration_clock {
4210 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
4211 timg_calibration_clock_config_frequency(config),
4212 ::core::sync::atomic::Ordering::Release,
4213 );
4214 }
4215 }
4216 fn refresh_i2s_mclk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
4217 if let Some(config) = clocks.i2s_mclk[instance as usize] {
4218 I2S_MCLK_FREQ_CACHE[instance as usize].store(
4219 I2sInstance::mclk_config_frequency(config),
4220 ::core::sync::atomic::Ordering::Release,
4221 );
4222 }
4223 }
4224 fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
4225 if let Some(config) = clocks.apb_clk {
4226 APB_CLK_FREQ_CACHE.store(
4227 apb_clk_config_frequency(config),
4228 ::core::sync::atomic::Ordering::Release,
4229 );
4230 }
4231 refresh_ref_tick_xtal_downstream(clocks);
4232 refresh_ref_tick_fosc_downstream(clocks);
4233 refresh_ref_tick_apll_downstream(clocks);
4234 refresh_ref_tick_pll_downstream(clocks);
4235 for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
4236 refresh_i2c_function_clock_downstream(clocks, child_instance);
4237 }
4238 for child_instance in [RmtInstance::Rmt] {
4239 refresh_rmt_sclk_downstream(clocks, child_instance);
4240 }
4241 for child_instance in [
4242 UartInstance::Uart0,
4243 UartInstance::Uart1,
4244 UartInstance::Uart2,
4245 ] {
4246 refresh_uart_function_clock_downstream(clocks, child_instance);
4247 }
4248 }
4249 fn refresh_ref_tick_xtal_downstream(clocks: &mut ClockTree) {
4250 if let Some(config) = clocks.ref_tick_xtal {
4251 REF_TICK_XTAL_FREQ_CACHE.store(
4252 ref_tick_xtal_config_frequency(config),
4253 ::core::sync::atomic::Ordering::Release,
4254 );
4255 }
4256 refresh_ref_tick_downstream(clocks);
4257 }
4258 fn refresh_ref_tick_fosc_downstream(clocks: &mut ClockTree) {
4259 if let Some(config) = clocks.ref_tick_fosc {
4260 REF_TICK_FOSC_FREQ_CACHE.store(
4261 ref_tick_fosc_config_frequency(config),
4262 ::core::sync::atomic::Ordering::Release,
4263 );
4264 }
4265 refresh_ref_tick_downstream(clocks);
4266 }
4267 fn refresh_ref_tick_apll_downstream(clocks: &mut ClockTree) {
4268 if let Some(config) = clocks.ref_tick_apll {
4269 REF_TICK_APLL_FREQ_CACHE.store(
4270 ref_tick_apll_config_frequency(config),
4271 ::core::sync::atomic::Ordering::Release,
4272 );
4273 }
4274 refresh_ref_tick_downstream(clocks);
4275 }
4276 fn refresh_ref_tick_pll_downstream(clocks: &mut ClockTree) {
4277 if let Some(config) = clocks.ref_tick_pll {
4278 REF_TICK_PLL_FREQ_CACHE.store(
4279 ref_tick_pll_config_frequency(config),
4280 ::core::sync::atomic::Ordering::Release,
4281 );
4282 }
4283 refresh_ref_tick_downstream(clocks);
4284 }
4285 fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {}
4286 fn refresh_ref_tick_downstream(clocks: &mut ClockTree) {
4287 if let Some(config) = clocks.ref_tick {
4288 REF_TICK_FREQ_CACHE.store(
4289 ref_tick_config_frequency(config),
4290 ::core::sync::atomic::Ordering::Release,
4291 );
4292 }
4293 for child_instance in [RmtInstance::Rmt] {
4294 refresh_rmt_sclk_downstream(clocks, child_instance);
4295 }
4296 for child_instance in [
4297 UartInstance::Uart0,
4298 UartInstance::Uart1,
4299 UartInstance::Uart2,
4300 ] {
4301 refresh_uart_function_clock_downstream(clocks, child_instance);
4302 }
4303 }
4304 fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
4305 if let Some(config) = clocks.rmt_sclk[instance as usize] {
4306 RMT_SCLK_FREQ_CACHE[instance as usize].store(
4307 RmtInstance::sclk_config_frequency(config),
4308 ::core::sync::atomic::Ordering::Release,
4309 );
4310 }
4311 }
4312 fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
4313 if let Some(config) = clocks.uart_function_clock[instance as usize] {
4314 UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4315 UartInstance::function_clock_config_frequency(config),
4316 ::core::sync::atomic::Ordering::Release,
4317 );
4318 }
4319 refresh_uart_baud_rate_generator_downstream(clocks, instance);
4320 }
4321 fn refresh_uart_baud_rate_generator_downstream(
4322 clocks: &mut ClockTree,
4323 instance: UartInstance,
4324 ) {
4325 if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
4326 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
4327 instance.baud_rate_generator_config_frequency(config),
4328 ::core::sync::atomic::Ordering::Release,
4329 );
4330 }
4331 }
4332 };
4333}
4334#[macro_export]
4338#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4339macro_rules! implement_peripheral_clocks {
4340 () => {
4341 #[doc(hidden)]
4342 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4343 #[repr(u8)]
4344 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4345 pub enum Peripheral {
4346 Aes,
4348 Emac,
4350 GpioSd,
4352 I2cExt0,
4354 I2cExt1,
4356 I2s0,
4358 I2s1,
4360 Ledc,
4362 Mcpwm0,
4364 Mcpwm1,
4366 Pcnt,
4368 Rmt,
4370 Rsa,
4372 SdioHost,
4374 Sha,
4376 Spi2,
4378 Spi3,
4380 SpiDma,
4382 Timg0,
4384 Timg1,
4386 Twai0,
4388 Uart0,
4390 Uart1,
4392 Uart2,
4394 UartMem,
4396 Uhci0,
4398 Uhci1,
4400 }
4401 impl Peripheral {
4402 const KEEP_ENABLED: &[Peripheral] = &[
4403 Self::Timg0,
4404 #[cfg(keep_uart0_enabled)]
4405 Self::Uart0,
4406 #[cfg(keep_uart0_enabled)]
4407 Self::UartMem,
4408 ];
4409 const COUNT: usize = Self::ALL.len();
4410 const ALL: &[Self] = &[
4411 Self::Aes,
4412 Self::Emac,
4413 Self::GpioSd,
4414 Self::I2cExt0,
4415 Self::I2cExt1,
4416 Self::I2s0,
4417 Self::I2s1,
4418 Self::Ledc,
4419 Self::Mcpwm0,
4420 Self::Mcpwm1,
4421 Self::Pcnt,
4422 Self::Rmt,
4423 Self::Rsa,
4424 Self::SdioHost,
4425 Self::Sha,
4426 Self::Spi2,
4427 Self::Spi3,
4428 Self::SpiDma,
4429 Self::Timg0,
4430 Self::Timg1,
4431 Self::Twai0,
4432 Self::Uart0,
4433 Self::Uart1,
4434 Self::Uart2,
4435 Self::UartMem,
4436 Self::Uhci0,
4437 Self::Uhci1,
4438 ];
4439 }
4440 unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
4441 match peripheral {
4442 Peripheral::Aes => {
4443 crate::peripherals::SYSTEM::regs()
4444 .peri_clk_en()
4445 .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
4446 }
4447 Peripheral::Emac => {
4448 crate::peripherals::SYSTEM::regs()
4449 .wifi_clk_en()
4450 .modify(|_, w| w.emac_clk_en().bit(enable));
4451 }
4452 Peripheral::GpioSd => {
4453 let _ = enable;
4454 }
4455 Peripheral::I2cExt0 => {
4456 crate::peripherals::SYSTEM::regs()
4457 .perip_clk_en()
4458 .modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
4459 }
4460 Peripheral::I2cExt1 => {
4461 crate::peripherals::SYSTEM::regs()
4462 .perip_clk_en()
4463 .modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
4464 }
4465 Peripheral::I2s0 => {
4466 crate::peripherals::SYSTEM::regs()
4467 .perip_clk_en()
4468 .modify(|_, w| w.i2s0_clk_en().bit(enable));
4469 }
4470 Peripheral::I2s1 => {
4471 crate::peripherals::SYSTEM::regs()
4472 .perip_clk_en()
4473 .modify(|_, w| w.i2s1_clk_en().bit(enable));
4474 }
4475 Peripheral::Ledc => {
4476 crate::peripherals::SYSTEM::regs()
4477 .perip_clk_en()
4478 .modify(|_, w| w.ledc_clk_en().bit(enable));
4479 }
4480 Peripheral::Mcpwm0 => {
4481 crate::peripherals::SYSTEM::regs()
4482 .perip_clk_en()
4483 .modify(|_, w| w.pwm0_clk_en().bit(enable));
4484 }
4485 Peripheral::Mcpwm1 => {
4486 crate::peripherals::SYSTEM::regs()
4487 .perip_clk_en()
4488 .modify(|_, w| w.pwm1_clk_en().bit(enable));
4489 }
4490 Peripheral::Pcnt => {
4491 crate::peripherals::SYSTEM::regs()
4492 .perip_clk_en()
4493 .modify(|_, w| w.pcnt_clk_en().bit(enable));
4494 }
4495 Peripheral::Rmt => {
4496 crate::peripherals::SYSTEM::regs()
4497 .perip_clk_en()
4498 .modify(|_, w| w.rmt_clk_en().bit(enable));
4499 }
4500 Peripheral::Rsa => {
4501 crate::peripherals::SYSTEM::regs()
4502 .peri_clk_en()
4503 .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
4504 }
4505 Peripheral::SdioHost => {
4506 crate::peripherals::SYSTEM::regs()
4507 .wifi_clk_en()
4508 .modify(|_, w| w.sdio_host_clk_en().bit(enable));
4509 }
4510 Peripheral::Sha => {
4511 crate::peripherals::SYSTEM::regs()
4512 .peri_clk_en()
4513 .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
4514 }
4515 Peripheral::Spi2 => {
4516 crate::peripherals::SYSTEM::regs()
4517 .perip_clk_en()
4518 .modify(|_, w| w.spi2_clk_en().bit(enable));
4519 }
4520 Peripheral::Spi3 => {
4521 crate::peripherals::SYSTEM::regs()
4522 .perip_clk_en()
4523 .modify(|_, w| w.spi3_clk_en().bit(enable));
4524 }
4525 Peripheral::SpiDma => {
4526 crate::peripherals::SYSTEM::regs()
4527 .perip_clk_en()
4528 .modify(|_, w| w.spi_dma_clk_en().bit(enable));
4529 }
4530 Peripheral::Timg0 => {
4531 crate::peripherals::SYSTEM::regs()
4532 .perip_clk_en()
4533 .modify(|_, w| w.timergroup_clk_en().bit(enable));
4534 }
4535 Peripheral::Timg1 => {
4536 crate::peripherals::SYSTEM::regs()
4537 .perip_clk_en()
4538 .modify(|_, w| w.timergroup1_clk_en().bit(enable));
4539 }
4540 Peripheral::Twai0 => {
4541 crate::peripherals::SYSTEM::regs()
4542 .perip_clk_en()
4543 .modify(|_, w| w.twai_clk_en().bit(enable));
4544 }
4545 Peripheral::Uart0 => {
4546 crate::peripherals::SYSTEM::regs()
4547 .perip_clk_en()
4548 .modify(|_, w| w.uart_clk_en().bit(enable));
4549 }
4550 Peripheral::Uart1 => {
4551 crate::peripherals::SYSTEM::regs()
4552 .perip_clk_en()
4553 .modify(|_, w| w.uart1_clk_en().bit(enable));
4554 }
4555 Peripheral::Uart2 => {
4556 crate::peripherals::SYSTEM::regs()
4557 .perip_clk_en()
4558 .modify(|_, w| w.uart2_clk_en().bit(enable));
4559 }
4560 Peripheral::UartMem => {
4561 crate::peripherals::SYSTEM::regs()
4562 .perip_clk_en()
4563 .modify(|_, w| w.uart_mem_clk_en().bit(enable));
4564 }
4565 Peripheral::Uhci0 => {
4566 crate::peripherals::SYSTEM::regs()
4567 .perip_clk_en()
4568 .modify(|_, w| w.uhci0_clk_en().bit(enable));
4569 }
4570 Peripheral::Uhci1 => {
4571 crate::peripherals::SYSTEM::regs()
4572 .perip_clk_en()
4573 .modify(|_, w| w.uhci1_clk_en().bit(enable));
4574 }
4575 }
4576 }
4577 unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
4578 match peripheral {
4579 Peripheral::Aes => {
4580 crate::peripherals::SYSTEM::regs()
4581 .peri_rst_en()
4582 .modify(|_, w| w.crypto_aes_rst().bit(reset));
4583 }
4584 Peripheral::Emac => {
4585 crate::peripherals::SYSTEM::regs()
4586 .wifi_rst_en()
4587 .modify(|_, w| w.emac_rst().bit(reset));
4588 }
4589 Peripheral::GpioSd => {
4590 let _ = reset;
4591 }
4592 Peripheral::I2cExt0 => {
4593 crate::peripherals::SYSTEM::regs()
4594 .perip_rst_en()
4595 .modify(|_, w| w.i2c_ext0_rst().bit(reset));
4596 }
4597 Peripheral::I2cExt1 => {
4598 crate::peripherals::SYSTEM::regs()
4599 .perip_rst_en()
4600 .modify(|_, w| w.i2c_ext1_rst().bit(reset));
4601 }
4602 Peripheral::I2s0 => {
4603 crate::peripherals::SYSTEM::regs()
4604 .perip_rst_en()
4605 .modify(|_, w| w.i2s0_rst().bit(reset));
4606 }
4607 Peripheral::I2s1 => {
4608 crate::peripherals::SYSTEM::regs()
4609 .perip_rst_en()
4610 .modify(|_, w| w.i2s1_rst().bit(reset));
4611 }
4612 Peripheral::Ledc => {
4613 crate::peripherals::SYSTEM::regs()
4614 .perip_rst_en()
4615 .modify(|_, w| w.ledc_rst().bit(reset));
4616 }
4617 Peripheral::Mcpwm0 => {
4618 crate::peripherals::SYSTEM::regs()
4619 .perip_rst_en()
4620 .modify(|_, w| w.pwm0_rst().bit(reset));
4621 }
4622 Peripheral::Mcpwm1 => {
4623 crate::peripherals::SYSTEM::regs()
4624 .perip_rst_en()
4625 .modify(|_, w| w.pwm1_rst().bit(reset));
4626 }
4627 Peripheral::Pcnt => {
4628 crate::peripherals::SYSTEM::regs()
4629 .perip_rst_en()
4630 .modify(|_, w| w.pcnt_rst().bit(reset));
4631 }
4632 Peripheral::Rmt => {
4633 crate::peripherals::SYSTEM::regs()
4634 .perip_rst_en()
4635 .modify(|_, w| w.rmt_rst().bit(reset));
4636 }
4637 Peripheral::Rsa => {
4638 crate::peripherals::SYSTEM::regs()
4639 .peri_rst_en()
4640 .modify(|_, w| w.crypto_rsa_rst().bit(reset));
4641 }
4642 Peripheral::SdioHost => {
4643 crate::peripherals::SYSTEM::regs()
4644 .wifi_rst_en()
4645 .modify(|_, w| w.sdio_host_rst().bit(reset));
4646 }
4647 Peripheral::Sha => {
4648 crate::peripherals::SYSTEM::regs()
4649 .peri_rst_en()
4650 .modify(|_, w| w.crypto_sha_rst().bit(reset));
4651 }
4652 Peripheral::Spi2 => {
4653 crate::peripherals::SYSTEM::regs()
4654 .perip_rst_en()
4655 .modify(|_, w| w.spi2_rst().bit(reset));
4656 }
4657 Peripheral::Spi3 => {
4658 crate::peripherals::SYSTEM::regs()
4659 .perip_rst_en()
4660 .modify(|_, w| w.spi3_rst().bit(reset));
4661 }
4662 Peripheral::SpiDma => {
4663 crate::peripherals::SYSTEM::regs()
4664 .perip_rst_en()
4665 .modify(|_, w| w.spi_dma_rst().bit(reset));
4666 }
4667 Peripheral::Timg0 => {
4668 crate::peripherals::SYSTEM::regs()
4669 .perip_rst_en()
4670 .modify(|_, w| w.timergroup_rst().bit(reset));
4671 }
4672 Peripheral::Timg1 => {
4673 crate::peripherals::SYSTEM::regs()
4674 .perip_rst_en()
4675 .modify(|_, w| w.timergroup1_rst().bit(reset));
4676 }
4677 Peripheral::Twai0 => {
4678 crate::peripherals::SYSTEM::regs()
4679 .perip_rst_en()
4680 .modify(|_, w| w.twai_rst().bit(reset));
4681 }
4682 Peripheral::Uart0 => {
4683 crate::peripherals::SYSTEM::regs()
4684 .perip_rst_en()
4685 .modify(|_, w| w.uart_rst().bit(reset));
4686 }
4687 Peripheral::Uart1 => {
4688 crate::peripherals::SYSTEM::regs()
4689 .perip_rst_en()
4690 .modify(|_, w| w.uart1_rst().bit(reset));
4691 }
4692 Peripheral::Uart2 => {
4693 crate::peripherals::SYSTEM::regs()
4694 .perip_rst_en()
4695 .modify(|_, w| w.uart2_rst().bit(reset));
4696 }
4697 Peripheral::UartMem => {
4698 crate::peripherals::SYSTEM::regs()
4699 .perip_rst_en()
4700 .modify(|_, w| w.uart_mem_rst().bit(reset));
4701 }
4702 Peripheral::Uhci0 => {
4703 crate::peripherals::SYSTEM::regs()
4704 .perip_rst_en()
4705 .modify(|_, w| w.uhci0_rst().bit(reset));
4706 }
4707 Peripheral::Uhci1 => {
4708 crate::peripherals::SYSTEM::regs()
4709 .perip_rst_en()
4710 .modify(|_, w| w.uhci1_rst().bit(reset));
4711 }
4712 }
4713 }
4714 };
4715}
4716#[macro_export]
4724#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4725macro_rules! memory_range {
4726 ("DRAM") => {
4727 0x3FFAE000..0x40000000
4728 };
4729 (size as str, "DRAM") => {
4730 "335872"
4731 };
4732 ("IROM") => {
4733 0x400D0000..0x40400000
4734 };
4735 (size as str, "IROM") => {
4736 "3342336"
4737 };
4738 ("DROM") => {
4739 0x3F400000..0x3F800000
4740 };
4741 (size as str, "DROM") => {
4742 "4194304"
4743 };
4744}
4745#[macro_export]
4764#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4765macro_rules! for_each_i2c_master {
4766 ($($pattern:tt => $code:tt;)*) => {
4767 macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
4768 => {} } _for_each_inner_i2c_master!((0, I2C0, I2cExt0, I2C_EXT0, I2CEXT0_SCL,
4769 I2CEXT0_SDA)); _for_each_inner_i2c_master!((1, I2C1, I2cExt1, I2C_EXT1,
4770 I2CEXT1_SCL, I2CEXT1_SDA)); _for_each_inner_i2c_master!((all(0, I2C0, I2cExt0,
4771 I2C_EXT0, I2CEXT0_SCL, I2CEXT0_SDA), (1, I2C1, I2cExt1, I2C_EXT1, I2CEXT1_SCL,
4772 I2CEXT1_SDA)));
4773 };
4774}
4775#[macro_export]
4802#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4803macro_rules! for_each_i2s {
4804 ($($pattern:tt => $code:tt;)*) => {
4805 macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
4806 _for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S1));
4807 _for_each_inner_i2s!((I2S0, I2s0, __NO_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
4808 I2S0I_WS, [I2S0O_DATA_23], [I2S0I_DATA_15], true, true, true, true));
4809 _for_each_inner_i2s!((I2S1, I2s1, __NO_MCLK, I2S1O_BCK, I2S1O_WS, I2S1I_BCK,
4810 I2S1I_WS, [I2S1O_DATA_23], [I2S1I_DATA_15], true, false, false, false));
4811 _for_each_inner_i2s!((names(I2S0), (I2S1))); _for_each_inner_i2s!((all(I2S0,
4812 I2s0, __NO_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK, I2S0I_WS, [I2S0O_DATA_23],
4813 [I2S0I_DATA_15], true, true, true, true), (I2S1, I2s1, __NO_MCLK, I2S1O_BCK,
4814 I2S1O_WS, I2S1I_BCK, I2S1I_WS, [I2S1O_DATA_23], [I2S1I_DATA_15], true, false,
4815 false, false)));
4816 };
4817}
4818#[macro_export]
4837#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4838macro_rules! for_each_uart {
4839 ($($pattern:tt => $code:tt;)*) => {
4840 macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
4841 } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
4842 wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
4843 U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((2, UART2, Uart2,
4844 U2RXD, U2TXD, U2CTS, U2RTS, wakeup_source = false));
4845 _for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
4846 wakeup_source = true), (1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS,
4847 wakeup_source = true), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS,
4848 wakeup_source = false)));
4849 };
4850}
4851#[macro_export]
4873#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4874macro_rules! for_each_spi_master {
4875 ($($pattern:tt => $code:tt;)*) => {
4876 macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
4877 => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
4878 _for_each_inner_spi_master!((SPI2, Spi2, HSPICLK[HSPICS0, HSPICS1, HSPICS2]
4879 [HSPID, HSPIQ, HSPIWP, HSPIHD], true)); _for_each_inner_spi_master!((SPI3, Spi3,
4880 VSPICLK[VSPICS0, VSPICS1, VSPICS2] [VSPID, VSPIQ, VSPIWP, VSPIHD], true));
4881 _for_each_inner_spi_master!((names(SPI2), (SPI3)));
4882 _for_each_inner_spi_master!((all(SPI2, Spi2, HSPICLK[HSPICS0, HSPICS1, HSPICS2]
4883 [HSPID, HSPIQ, HSPIWP, HSPIHD], true), (SPI3, Spi3, VSPICLK[VSPICS0, VSPICS1,
4884 VSPICS2] [VSPID, VSPIQ, VSPIWP, VSPIHD], true)));
4885 };
4886}
4887#[macro_export]
4904#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4905macro_rules! for_each_spi_slave {
4906 ($($pattern:tt => $code:tt;)*) => {
4907 macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
4908 => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
4909 _for_each_inner_spi_slave!((SPI2, Spi2, HSPICLK, HSPID, HSPIQ, HSPICS0));
4910 _for_each_inner_spi_slave!((SPI3, Spi3, VSPICLK, VSPID, VSPIQ, VSPICS0));
4911 _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
4912 _for_each_inner_spi_slave!((all(SPI2, Spi2, HSPICLK, HSPID, HSPIQ, HSPICS0),
4913 (SPI3, Spi3, VSPICLK, VSPID, VSPIQ, VSPICS0)));
4914 };
4915}
4916#[macro_export]
4939#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4940macro_rules! for_each_pcnt_unit {
4941 ($($pattern:tt => $code:tt;)*) => {
4942 macro_rules! _for_each_inner_pcnt_unit { $(($pattern) => $code;)* ($other : tt)
4943 => {} } _for_each_inner_pcnt_unit!((PCNT0_UNIT0));
4944 _for_each_inner_pcnt_unit!((PCNT0_UNIT1));
4945 _for_each_inner_pcnt_unit!((PCNT0_UNIT2));
4946 _for_each_inner_pcnt_unit!((PCNT0_UNIT3));
4947 _for_each_inner_pcnt_unit!((PCNT0_UNIT4));
4948 _for_each_inner_pcnt_unit!((PCNT0_UNIT5));
4949 _for_each_inner_pcnt_unit!((PCNT0_UNIT6));
4950 _for_each_inner_pcnt_unit!((PCNT0_UNIT7));
4951 _for_each_inner_pcnt_unit!((PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT,
4952 PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1));
4953 _for_each_inner_pcnt_unit!((PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT,
4954 PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0, PCNT1_CTRL_CH1));
4955 _for_each_inner_pcnt_unit!((PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT,
4956 PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1));
4957 _for_each_inner_pcnt_unit!((PCNT0_UNIT3, Pcnt0Unit3, Pcnt, PCNT, 3, PCNT,
4958 PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1));
4959 _for_each_inner_pcnt_unit!((PCNT0_UNIT4, Pcnt0Unit4, Pcnt, PCNT, 4, PCNT,
4960 PCNT4_SIG_CH0, PCNT4_SIG_CH1, PCNT4_CTRL_CH0, PCNT4_CTRL_CH1));
4961 _for_each_inner_pcnt_unit!((PCNT0_UNIT5, Pcnt0Unit5, Pcnt, PCNT, 5, PCNT,
4962 PCNT5_SIG_CH0, PCNT5_SIG_CH1, PCNT5_CTRL_CH0, PCNT5_CTRL_CH1));
4963 _for_each_inner_pcnt_unit!((PCNT0_UNIT6, Pcnt0Unit6, Pcnt, PCNT, 6, PCNT,
4964 PCNT6_SIG_CH0, PCNT6_SIG_CH1, PCNT6_CTRL_CH0, PCNT6_CTRL_CH1));
4965 _for_each_inner_pcnt_unit!((PCNT0_UNIT7, Pcnt0Unit7, Pcnt, PCNT, 7, PCNT,
4966 PCNT7_SIG_CH0, PCNT7_SIG_CH1, PCNT7_CTRL_CH0, PCNT7_CTRL_CH1));
4967 _for_each_inner_pcnt_unit!((PCNT)); _for_each_inner_pcnt_unit!((PCNT));
4968 _for_each_inner_pcnt_unit!((names(PCNT0_UNIT0), (PCNT0_UNIT1), (PCNT0_UNIT2),
4969 (PCNT0_UNIT3), (PCNT0_UNIT4), (PCNT0_UNIT5), (PCNT0_UNIT6), (PCNT0_UNIT7)));
4970 _for_each_inner_pcnt_unit!((all(PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT,
4971 PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1), (PCNT0_UNIT1,
4972 Pcnt0Unit1, Pcnt, PCNT, 1, PCNT, PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0,
4973 PCNT1_CTRL_CH1), (PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT, PCNT2_SIG_CH0,
4974 PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1), (PCNT0_UNIT3, Pcnt0Unit3, Pcnt,
4975 PCNT, 3, PCNT, PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1),
4976 (PCNT0_UNIT4, Pcnt0Unit4, Pcnt, PCNT, 4, PCNT, PCNT4_SIG_CH0, PCNT4_SIG_CH1,
4977 PCNT4_CTRL_CH0, PCNT4_CTRL_CH1), (PCNT0_UNIT5, Pcnt0Unit5, Pcnt, PCNT, 5, PCNT,
4978 PCNT5_SIG_CH0, PCNT5_SIG_CH1, PCNT5_CTRL_CH0, PCNT5_CTRL_CH1), (PCNT0_UNIT6,
4979 Pcnt0Unit6, Pcnt, PCNT, 6, PCNT, PCNT6_SIG_CH0, PCNT6_SIG_CH1, PCNT6_CTRL_CH0,
4980 PCNT6_CTRL_CH1), (PCNT0_UNIT7, Pcnt0Unit7, Pcnt, PCNT, 7, PCNT, PCNT7_SIG_CH0,
4981 PCNT7_SIG_CH1, PCNT7_CTRL_CH0, PCNT7_CTRL_CH1)));
4982 _for_each_inner_pcnt_unit!((interrupt(PCNT)));
4983 _for_each_inner_pcnt_unit!((regs(PCNT)));
4984 };
4985}
4986#[macro_export]
4987#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4988macro_rules! for_each_peripheral {
4989 ($($pattern:tt => $code:tt;)*) => {
4990 macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
4991 => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
4992 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4993 "<section class=\"warning\">"] #[doc =
4994 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4995 #[doc = "<ul>"] #[doc =
4996 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4997 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()));
4998 _for_each_inner_peripheral!((@ peri_type #[doc =
4999 "GPIO1 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5000 "<section class=\"warning\">"] #[doc =
5001 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5002 #[doc = "<ul>"] #[doc =
5003 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5004 = "</ul>"] #[doc = "</section>"] GPIO1 <= virtual()));
5005 _for_each_inner_peripheral!((@ peri_type #[doc =
5006 "GPIO2 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5007 "<section class=\"warning\">"] #[doc =
5008 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5009 #[doc = "<ul>"] #[doc =
5010 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5011 = "</ul>"] #[doc = "</section>"] GPIO2 <= virtual()));
5012 _for_each_inner_peripheral!((@ peri_type #[doc =
5013 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5014 "<section class=\"warning\">"] #[doc =
5015 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5016 #[doc = "<ul>"] #[doc =
5017 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5018 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()));
5019 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO4 peripheral singleton"]
5020 GPIO4 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5021 "GPIO5 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5022 "<section class=\"warning\">"] #[doc =
5023 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5024 #[doc = "<ul>"] #[doc =
5025 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5026 = "</ul>"] #[doc = "</section>"] GPIO5 <= virtual()));
5027 _for_each_inner_peripheral!((@ peri_type #[doc =
5028 "GPIO6 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5029 "<section class=\"warning\">"] #[doc =
5030 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5031 #[doc = "<ul>"] #[doc =
5032 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5033 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5034 "</ul>"] #[doc = "</section>"] GPIO6 <= virtual()));
5035 _for_each_inner_peripheral!((@ peri_type #[doc =
5036 "GPIO7 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5037 "<section class=\"warning\">"] #[doc =
5038 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5039 #[doc = "<ul>"] #[doc =
5040 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5041 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5042 "</ul>"] #[doc = "</section>"] GPIO7 <= virtual()));
5043 _for_each_inner_peripheral!((@ peri_type #[doc =
5044 "GPIO8 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5045 "<section class=\"warning\">"] #[doc =
5046 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5047 #[doc = "<ul>"] #[doc =
5048 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5049 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5050 "</ul>"] #[doc = "</section>"] GPIO8 <= virtual()));
5051 _for_each_inner_peripheral!((@ peri_type #[doc =
5052 "GPIO9 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5053 "<section class=\"warning\">"] #[doc =
5054 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5055 #[doc = "<ul>"] #[doc =
5056 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5057 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5058 "</ul>"] #[doc = "</section>"] GPIO9 <= virtual()));
5059 _for_each_inner_peripheral!((@ peri_type #[doc =
5060 "GPIO10 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5061 "<section class=\"warning\">"] #[doc =
5062 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5063 #[doc = "<ul>"] #[doc =
5064 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5065 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5066 "</ul>"] #[doc = "</section>"] GPIO10 <= virtual()));
5067 _for_each_inner_peripheral!((@ peri_type #[doc =
5068 "GPIO11 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5069 "<section class=\"warning\">"] #[doc =
5070 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5071 #[doc = "<ul>"] #[doc =
5072 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5073 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5074 "</ul>"] #[doc = "</section>"] GPIO11 <= virtual()));
5075 _for_each_inner_peripheral!((@ peri_type #[doc =
5076 "GPIO12 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5077 "<section class=\"warning\">"] #[doc =
5078 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5079 #[doc = "<ul>"] #[doc =
5080 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5081 =
5082 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5083 #[doc = "</ul>"] #[doc = "</section>"] GPIO12 <= virtual()));
5084 _for_each_inner_peripheral!((@ peri_type #[doc =
5085 "GPIO13 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5086 "<section class=\"warning\">"] #[doc =
5087 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5088 #[doc = "<ul>"] #[doc =
5089 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5090 #[doc = "</ul>"] #[doc = "</section>"] GPIO13 <= virtual()));
5091 _for_each_inner_peripheral!((@ peri_type #[doc =
5092 "GPIO14 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5093 "<section class=\"warning\">"] #[doc =
5094 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5095 #[doc = "<ul>"] #[doc =
5096 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5097 #[doc = "</ul>"] #[doc = "</section>"] GPIO14 <= virtual()));
5098 _for_each_inner_peripheral!((@ peri_type #[doc =
5099 "GPIO15 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5100 "<section class=\"warning\">"] #[doc =
5101 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5102 #[doc = "<ul>"] #[doc =
5103 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5104 =
5105 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5106 #[doc = "</ul>"] #[doc = "</section>"] GPIO15 <= virtual()));
5107 _for_each_inner_peripheral!((@ peri_type #[doc =
5108 "GPIO16 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5109 "<section class=\"warning\">"] #[doc =
5110 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5111 #[doc = "<ul>"] #[doc =
5112 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5113 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5114 "</ul>"] #[doc = "</section>"] GPIO16 <= virtual()));
5115 _for_each_inner_peripheral!((@ peri_type #[doc =
5116 "GPIO17 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5117 "<section class=\"warning\">"] #[doc =
5118 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5119 #[doc = "<ul>"] #[doc =
5120 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5121 "</ul>"] #[doc = "</section>"] GPIO17 <= virtual()));
5122 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO18 peripheral singleton"]
5123 GPIO18 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5124 "GPIO19 peripheral singleton"] GPIO19 <= virtual()));
5125 _for_each_inner_peripheral!((@ peri_type #[doc =
5126 "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5127 "<section class=\"warning\">"] #[doc =
5128 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5129 #[doc = "<ul>"] #[doc = "<li>This pin is only available on ESP32-PICO-V3.</li>"]
5130 #[doc = "</ul>"] #[doc = "</section>"] GPIO20 <= virtual()));
5131 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO21 peripheral singleton"]
5132 GPIO21 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5133 "GPIO22 peripheral singleton"] GPIO22 <= virtual()));
5134 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO23 peripheral singleton"]
5135 GPIO23 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5136 "GPIO25 peripheral singleton"] GPIO25 <= virtual()));
5137 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO26 peripheral singleton"]
5138 GPIO26 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5139 "GPIO27 peripheral singleton"] GPIO27 <= virtual()));
5140 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO32 peripheral singleton"]
5141 GPIO32 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5142 "GPIO33 peripheral singleton"] GPIO33 <= virtual()));
5143 _for_each_inner_peripheral!((@ peri_type #[doc =
5144 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5145 "<section class=\"warning\">"] #[doc =
5146 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5147 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5148 = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
5149 _for_each_inner_peripheral!((@ peri_type #[doc =
5150 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5151 "<section class=\"warning\">"] #[doc =
5152 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5153 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5154 = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
5155 _for_each_inner_peripheral!((@ peri_type #[doc =
5156 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5157 "<section class=\"warning\">"] #[doc =
5158 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5159 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5160 = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
5161 _for_each_inner_peripheral!((@ peri_type #[doc =
5162 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5163 "<section class=\"warning\">"] #[doc =
5164 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5165 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5166 = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
5167 _for_each_inner_peripheral!((@ peri_type #[doc =
5168 "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5169 "<section class=\"warning\">"] #[doc =
5170 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5171 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5172 = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()));
5173 _for_each_inner_peripheral!((@ peri_type #[doc =
5174 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5175 "<section class=\"warning\">"] #[doc =
5176 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5177 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5178 = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
5179 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_SPI2 peripheral singleton"]
5180 DMA_SPI2 <= SPI2(SPI2_DMA : { bind_dma_interrupt, enable_dma_interrupt,
5181 disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5182 #[doc = "DMA_SPI3 peripheral singleton"] DMA_SPI3 <= SPI3(SPI3_DMA : {
5183 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)));
5184 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_I2S0 peripheral singleton"]
5185 DMA_I2S0 <= I2S0(I2S0 : { bind_dma_interrupt, enable_dma_interrupt,
5186 disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5187 #[doc = "DMA_I2S1 peripheral singleton"] DMA_I2S1 <= I2S1(I2S1 : {
5188 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)));
5189 _for_each_inner_peripheral!((@ peri_type #[doc =
5190 "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)));
5191 _for_each_inner_peripheral!((@ peri_type #[doc =
5192 "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual() (unstable)));
5193 _for_each_inner_peripheral!((@ peri_type #[doc =
5194 "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)));
5195 _for_each_inner_peripheral!((@ peri_type #[doc =
5196 "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)));
5197 _for_each_inner_peripheral!((@ peri_type #[doc =
5198 "PCNT0_UNIT4 peripheral singleton"] PCNT0_UNIT4 <= virtual() (unstable)));
5199 _for_each_inner_peripheral!((@ peri_type #[doc =
5200 "PCNT0_UNIT5 peripheral singleton"] PCNT0_UNIT5 <= virtual() (unstable)));
5201 _for_each_inner_peripheral!((@ peri_type #[doc =
5202 "PCNT0_UNIT6 peripheral singleton"] PCNT0_UNIT6 <= virtual() (unstable)));
5203 _for_each_inner_peripheral!((@ peri_type #[doc =
5204 "PCNT0_UNIT7 peripheral singleton"] PCNT0_UNIT7 <= virtual() (unstable)));
5205 _for_each_inner_peripheral!((@ peri_type #[doc = "DAC1 peripheral singleton"]
5206 DAC1 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5207 "DAC2 peripheral singleton"] DAC2 <= virtual() (unstable)));
5208 _for_each_inner_peripheral!((@ peri_type #[doc =
5209 "RMT channel 0. Transmit or receive."] RMT_CH0 <= virtual() (unstable)));
5210 _for_each_inner_peripheral!((@ peri_type #[doc =
5211 "RMT channel 1. Transmit or receive."] RMT_CH1 <= virtual() (unstable)));
5212 _for_each_inner_peripheral!((@ peri_type #[doc =
5213 "RMT channel 2. Transmit or receive."] RMT_CH2 <= virtual() (unstable)));
5214 _for_each_inner_peripheral!((@ peri_type #[doc =
5215 "RMT channel 3. Transmit or receive."] RMT_CH3 <= virtual() (unstable)));
5216 _for_each_inner_peripheral!((@ peri_type #[doc =
5217 "RMT channel 4. Transmit or receive."] RMT_CH4 <= virtual() (unstable)));
5218 _for_each_inner_peripheral!((@ peri_type #[doc =
5219 "RMT channel 5. Transmit or receive."] RMT_CH5 <= virtual() (unstable)));
5220 _for_each_inner_peripheral!((@ peri_type #[doc =
5221 "RMT channel 6. Transmit or receive."] RMT_CH6 <= virtual() (unstable)));
5222 _for_each_inner_peripheral!((@ peri_type #[doc =
5223 "RMT channel 7. Transmit or receive."] RMT_CH7 <= virtual() (unstable)));
5224 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
5225 SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5226 = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
5227 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
5228 SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5229 = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
5230 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
5231 SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5232 = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
5233 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
5234 SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5235 = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
5236 _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
5237 <= AES() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5238 "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)));
5239 _for_each_inner_peripheral!((@ peri_type #[doc = "BB peripheral singleton"] BB <=
5240 BB() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5241 "DPORT peripheral singleton"] DPORT <= DPORT() (unstable)));
5242 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTEM peripheral singleton"]
5243 SYSTEM <= DPORT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5244 "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)));
5245 _for_each_inner_peripheral!((@ peri_type #[doc = "ETH peripheral singleton"] ETH
5246 <= virtual(ETH_MAC : { bind_peri_interrupt, enable_peri_interrupt,
5247 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5248 #[doc = "EMAC_DMA peripheral singleton"] EMAC_DMA <= GMAC_DMA() (unstable)));
5249 _for_each_inner_peripheral!((@ peri_type #[doc = "EMAC_EXT peripheral singleton"]
5250 EMAC_EXT <= EMAC_EXT() (unstable))); _for_each_inner_peripheral!((@ peri_type
5251 #[doc = "EMAC_MAC peripheral singleton"] EMAC_MAC <= GMAC() (unstable)));
5252 _for_each_inner_peripheral!((@ peri_type #[doc =
5253 "FLASH_ENCRYPTION peripheral singleton"] FLASH_ENCRYPTION <= FLASH_ENCRYPTION()
5254 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5255 "FRC_TIMER peripheral singleton"] FRC_TIMER <= FRC_TIMER() (unstable)));
5256 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO peripheral singleton"]
5257 GPIO <= GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5258 "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)));
5259 _for_each_inner_peripheral!((@ peri_type #[doc = "HINF peripheral singleton"]
5260 HINF <= HINF() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5261 "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
5262 enable_peri_interrupt, disable_peri_interrupt })));
5263 _for_each_inner_peripheral!((@ peri_type #[doc = "I2C1 peripheral singleton"]
5264 I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
5265 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5266 "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
5267 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
5268 _for_each_inner_peripheral!((@ peri_type #[doc = "I2S1 peripheral singleton"]
5269 I2S1 <= I2S1(I2S1 : { bind_peri_interrupt, enable_peri_interrupt,
5270 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5271 #[doc = "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
5272 _for_each_inner_peripheral!((@ peri_type #[doc = "LEDC peripheral singleton"]
5273 LEDC <= LEDC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5274 "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)));
5275 _for_each_inner_peripheral!((@ peri_type #[doc =
5276 "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)));
5277 _for_each_inner_peripheral!((@ peri_type #[doc = "MCPWM1 peripheral singleton"]
5278 MCPWM1 <= MCPWM1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5279 "NRX peripheral singleton"] NRX <= NRX() (unstable)));
5280 _for_each_inner_peripheral!((@ peri_type #[doc = "PCNT peripheral singleton"]
5281 PCNT <= PCNT(PCNT : { bind_peri_interrupt, enable_peri_interrupt,
5282 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5283 #[doc = "RMT peripheral singleton"] RMT <= RMT() (unstable)));
5284 _for_each_inner_peripheral!((@ peri_type #[doc = "RNG peripheral singleton"] RNG
5285 <= RNG() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5286 "RSA peripheral singleton"] RSA <= RSA(RSA : { bind_peri_interrupt,
5287 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
5288 _for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
5289 LPWR <= RTC_CNTL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5290 "RTC_TIMER peripheral singleton"] RTC_TIMER <= RTC_CNTL() (unstable)));
5291 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_I2C0 peripheral singleton"]
5292 LP_I2C0 <= RTC_I2C() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5293 = "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)));
5294 _for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
5295 SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5296 "SENS peripheral singleton"] SENS <= SENS() (unstable)));
5297 _for_each_inner_peripheral!((@ peri_type #[doc = "SHA peripheral singleton"] SHA
5298 <= SHA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5299 "SLC peripheral singleton"] SLC <= SLC() (unstable)));
5300 _for_each_inner_peripheral!((@ peri_type #[doc = "SLCHOST peripheral singleton"]
5301 SLCHOST <= SLCHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5302 = "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
5303 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
5304 SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5305 "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2_DMA : { bind_dma_interrupt,
5306 enable_dma_interrupt, disable_dma_interrupt }, SPI2 : { bind_peri_interrupt,
5307 enable_peri_interrupt, disable_peri_interrupt })));
5308 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
5309 SPI3 <= SPI3(SPI3_DMA : { bind_dma_interrupt, enable_dma_interrupt,
5310 disable_dma_interrupt }, SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
5311 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5312 "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
5313 _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
5314 TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5315 "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)));
5316 _for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
5317 UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
5318 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5319 "UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
5320 enable_peri_interrupt, disable_peri_interrupt })));
5321 _for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
5322 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
5323 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5324 "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)));
5325 _for_each_inner_peripheral!((@ peri_type #[doc = "UHCI1 peripheral singleton"]
5326 UHCI1 <= UHCI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5327 "WIFI peripheral singleton"] WIFI <= WIFI(WIFI_MAC : { bind_mac_interrupt,
5328 enable_mac_interrupt, disable_mac_interrupt }))); _for_each_inner_peripheral!((@
5329 peri_type #[doc = "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)));
5330 _for_each_inner_peripheral!((@ peri_type #[doc = "ADC2 peripheral singleton"]
5331 ADC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5332 "BT peripheral singleton"] BT <= virtual(BT_BB : { bind_bb_interrupt,
5333 enable_bb_interrupt, disable_bb_interrupt }, RWBLE : { bind_rwble_interrupt,
5334 enable_rwble_interrupt, disable_rwble_interrupt }, RWBT : { bind_rwbt_interrupt,
5335 enable_rwbt_interrupt, disable_rwbt_interrupt }) (unstable)));
5336 _for_each_inner_peripheral!((@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
5337 CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
5338 #[doc = "FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
5339 _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
5340 PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5341 "TOUCH peripheral singleton"] TOUCH <= virtual() (unstable)));
5342 _for_each_inner_peripheral!((@ peri_type #[doc = "IPC peripheral singleton"] IPC
5343 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5344 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)));
5345 _for_each_inner_peripheral!((@ peri_type #[doc =
5346 "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
5347 _for_each_inner_peripheral!((@ peri_type #[doc =
5348 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
5349 _for_each_inner_peripheral!((@ peri_type #[doc =
5350 "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
5351 _for_each_inner_peripheral!((GPIO0)); _for_each_inner_peripheral!((GPIO1));
5352 _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
5353 _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
5354 _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
5355 _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
5356 _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
5357 _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
5358 _for_each_inner_peripheral!((GPIO14)); _for_each_inner_peripheral!((GPIO15));
5359 _for_each_inner_peripheral!((GPIO16)); _for_each_inner_peripheral!((GPIO17));
5360 _for_each_inner_peripheral!((GPIO18)); _for_each_inner_peripheral!((GPIO19));
5361 _for_each_inner_peripheral!((GPIO20)); _for_each_inner_peripheral!((GPIO21));
5362 _for_each_inner_peripheral!((GPIO22)); _for_each_inner_peripheral!((GPIO23));
5363 _for_each_inner_peripheral!((GPIO25)); _for_each_inner_peripheral!((GPIO26));
5364 _for_each_inner_peripheral!((GPIO27));
5365 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO32));
5366 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO33));
5367 _for_each_inner_peripheral!((GPIO34)); _for_each_inner_peripheral!((GPIO35));
5368 _for_each_inner_peripheral!((GPIO36)); _for_each_inner_peripheral!((GPIO37));
5369 _for_each_inner_peripheral!((GPIO38)); _for_each_inner_peripheral!((GPIO39));
5370 _for_each_inner_peripheral!((DMA_SPI2(unstable)));
5371 _for_each_inner_peripheral!((DMA_SPI3(unstable)));
5372 _for_each_inner_peripheral!((DMA_I2S0(unstable)));
5373 _for_each_inner_peripheral!((DMA_I2S1(unstable)));
5374 _for_each_inner_peripheral!((PCNT0_UNIT0(unstable)));
5375 _for_each_inner_peripheral!((PCNT0_UNIT1(unstable)));
5376 _for_each_inner_peripheral!((PCNT0_UNIT2(unstable)));
5377 _for_each_inner_peripheral!((PCNT0_UNIT3(unstable)));
5378 _for_each_inner_peripheral!((PCNT0_UNIT4(unstable)));
5379 _for_each_inner_peripheral!((PCNT0_UNIT5(unstable)));
5380 _for_each_inner_peripheral!((PCNT0_UNIT6(unstable)));
5381 _for_each_inner_peripheral!((PCNT0_UNIT7(unstable)));
5382 _for_each_inner_peripheral!((DAC1(unstable)));
5383 _for_each_inner_peripheral!((DAC2(unstable)));
5384 _for_each_inner_peripheral!((RMT_CH0(unstable)));
5385 _for_each_inner_peripheral!((RMT_CH1(unstable)));
5386 _for_each_inner_peripheral!((RMT_CH2(unstable)));
5387 _for_each_inner_peripheral!((RMT_CH3(unstable)));
5388 _for_each_inner_peripheral!((RMT_CH4(unstable)));
5389 _for_each_inner_peripheral!((RMT_CH5(unstable)));
5390 _for_each_inner_peripheral!((RMT_CH6(unstable)));
5391 _for_each_inner_peripheral!((RMT_CH7(unstable)));
5392 _for_each_inner_peripheral!((SDM_CH0(unstable)));
5393 _for_each_inner_peripheral!((SDM_CH1(unstable)));
5394 _for_each_inner_peripheral!((SDM_CH2(unstable)));
5395 _for_each_inner_peripheral!((SDM_CH3(unstable)));
5396 _for_each_inner_peripheral!((SDM_CH4(unstable)));
5397 _for_each_inner_peripheral!((SDM_CH5(unstable)));
5398 _for_each_inner_peripheral!((SDM_CH6(unstable)));
5399 _for_each_inner_peripheral!((SDM_CH7(unstable)));
5400 _for_each_inner_peripheral!((AES(unstable)));
5401 _for_each_inner_peripheral!((APB_CTRL(unstable)));
5402 _for_each_inner_peripheral!((BB(unstable)));
5403 _for_each_inner_peripheral!((DPORT(unstable)));
5404 _for_each_inner_peripheral!((SYSTEM(unstable)));
5405 _for_each_inner_peripheral!((ETH(unstable)));
5406 _for_each_inner_peripheral!((FLASH_ENCRYPTION(unstable)));
5407 _for_each_inner_peripheral!((FRC_TIMER(unstable)));
5408 _for_each_inner_peripheral!((GPIO(unstable)));
5409 _for_each_inner_peripheral!((GPIO_SD(unstable)));
5410 _for_each_inner_peripheral!((HINF(unstable)));
5411 _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
5412 _for_each_inner_peripheral!((I2S0(unstable)));
5413 _for_each_inner_peripheral!((I2S1(unstable)));
5414 _for_each_inner_peripheral!((IO_MUX(unstable)));
5415 _for_each_inner_peripheral!((LEDC(unstable)));
5416 _for_each_inner_peripheral!((MCPWM0(unstable)));
5417 _for_each_inner_peripheral!((MCPWM1(unstable)));
5418 _for_each_inner_peripheral!((NRX(unstable)));
5419 _for_each_inner_peripheral!((PCNT(unstable)));
5420 _for_each_inner_peripheral!((RMT(unstable)));
5421 _for_each_inner_peripheral!((RNG(unstable)));
5422 _for_each_inner_peripheral!((RSA(unstable)));
5423 _for_each_inner_peripheral!((LPWR(unstable)));
5424 _for_each_inner_peripheral!((RTC_TIMER(unstable)));
5425 _for_each_inner_peripheral!((LP_I2C0(unstable)));
5426 _for_each_inner_peripheral!((RTC_IO(unstable)));
5427 _for_each_inner_peripheral!((SDHOST(unstable)));
5428 _for_each_inner_peripheral!((SENS(unstable)));
5429 _for_each_inner_peripheral!((SHA(unstable)));
5430 _for_each_inner_peripheral!((SLC(unstable)));
5431 _for_each_inner_peripheral!((SLCHOST(unstable)));
5432 _for_each_inner_peripheral!((SPI0(unstable)));
5433 _for_each_inner_peripheral!((SPI1(unstable)));
5434 _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
5435 _for_each_inner_peripheral!((TIMG0(unstable)));
5436 _for_each_inner_peripheral!((TIMG1(unstable)));
5437 _for_each_inner_peripheral!((TWAI0(unstable)));
5438 _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
5439 _for_each_inner_peripheral!((UART2));
5440 _for_each_inner_peripheral!((UHCI0(unstable)));
5441 _for_each_inner_peripheral!((UHCI1(unstable)));
5442 _for_each_inner_peripheral!((WIFI));
5443 _for_each_inner_peripheral!((ADC1(unstable)));
5444 _for_each_inner_peripheral!((ADC2(unstable)));
5445 _for_each_inner_peripheral!((BT(unstable)));
5446 _for_each_inner_peripheral!((CPU_CTRL(unstable)));
5447 _for_each_inner_peripheral!((FLASH(unstable)));
5448 _for_each_inner_peripheral!((PSRAM(unstable)));
5449 _for_each_inner_peripheral!((TOUCH(unstable)));
5450 _for_each_inner_peripheral!((IPC(unstable)));
5451 _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
5452 _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
5453 _for_each_inner_peripheral!((SPI2, Spi2, 0, SpiDmaChannel));
5454 _for_each_inner_peripheral!((I2S0, I2s0, 0, I2sDmaChannel));
5455 _for_each_inner_peripheral!((SPI3, Spi3, 1, SpiDmaChannel));
5456 _for_each_inner_peripheral!((I2S1, I2s1, 1, I2sDmaChannel));
5457 _for_each_inner_peripheral!((all(@ peri_type #[doc =
5458 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5459 "<section class=\"warning\">"] #[doc =
5460 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5461 #[doc = "<ul>"] #[doc =
5462 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5463 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()), (@ peri_type #[doc =
5464 "GPIO1 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5465 "<section class=\"warning\">"] #[doc =
5466 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5467 #[doc = "<ul>"] #[doc =
5468 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5469 = "</ul>"] #[doc = "</section>"] GPIO1 <= virtual()), (@ peri_type #[doc =
5470 "GPIO2 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5471 "<section class=\"warning\">"] #[doc =
5472 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5473 #[doc = "<ul>"] #[doc =
5474 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5475 = "</ul>"] #[doc = "</section>"] GPIO2 <= virtual()), (@ peri_type #[doc =
5476 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5477 "<section class=\"warning\">"] #[doc =
5478 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5479 #[doc = "<ul>"] #[doc =
5480 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5481 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()), (@ peri_type #[doc =
5482 "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
5483 "GPIO5 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5484 "<section class=\"warning\">"] #[doc =
5485 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5486 #[doc = "<ul>"] #[doc =
5487 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5488 = "</ul>"] #[doc = "</section>"] GPIO5 <= virtual()), (@ peri_type #[doc =
5489 "GPIO6 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5490 "<section class=\"warning\">"] #[doc =
5491 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5492 #[doc = "<ul>"] #[doc =
5493 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5494 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5495 "</ul>"] #[doc = "</section>"] GPIO6 <= virtual()), (@ peri_type #[doc =
5496 "GPIO7 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5497 "<section class=\"warning\">"] #[doc =
5498 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5499 #[doc = "<ul>"] #[doc =
5500 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5501 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5502 "</ul>"] #[doc = "</section>"] GPIO7 <= virtual()), (@ peri_type #[doc =
5503 "GPIO8 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5504 "<section class=\"warning\">"] #[doc =
5505 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5506 #[doc = "<ul>"] #[doc =
5507 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5508 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5509 "</ul>"] #[doc = "</section>"] GPIO8 <= virtual()), (@ peri_type #[doc =
5510 "GPIO9 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5511 "<section class=\"warning\">"] #[doc =
5512 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5513 #[doc = "<ul>"] #[doc =
5514 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5515 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5516 "</ul>"] #[doc = "</section>"] GPIO9 <= virtual()), (@ peri_type #[doc =
5517 "GPIO10 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5518 "<section class=\"warning\">"] #[doc =
5519 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5520 #[doc = "<ul>"] #[doc =
5521 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5522 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5523 "</ul>"] #[doc = "</section>"] GPIO10 <= virtual()), (@ peri_type #[doc =
5524 "GPIO11 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5525 "<section class=\"warning\">"] #[doc =
5526 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5527 #[doc = "<ul>"] #[doc =
5528 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5529 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5530 "</ul>"] #[doc = "</section>"] GPIO11 <= virtual()), (@ peri_type #[doc =
5531 "GPIO12 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5532 "<section class=\"warning\">"] #[doc =
5533 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5534 #[doc = "<ul>"] #[doc =
5535 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5536 =
5537 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5538 #[doc = "</ul>"] #[doc = "</section>"] GPIO12 <= virtual()), (@ peri_type #[doc =
5539 "GPIO13 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5540 "<section class=\"warning\">"] #[doc =
5541 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5542 #[doc = "<ul>"] #[doc =
5543 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5544 #[doc = "</ul>"] #[doc = "</section>"] GPIO13 <= virtual()), (@ peri_type #[doc =
5545 "GPIO14 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5546 "<section class=\"warning\">"] #[doc =
5547 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5548 #[doc = "<ul>"] #[doc =
5549 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5550 #[doc = "</ul>"] #[doc = "</section>"] GPIO14 <= virtual()), (@ peri_type #[doc =
5551 "GPIO15 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5552 "<section class=\"warning\">"] #[doc =
5553 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5554 #[doc = "<ul>"] #[doc =
5555 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5556 =
5557 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5558 #[doc = "</ul>"] #[doc = "</section>"] GPIO15 <= virtual()), (@ peri_type #[doc =
5559 "GPIO16 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5560 "<section class=\"warning\">"] #[doc =
5561 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5562 #[doc = "<ul>"] #[doc =
5563 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5564 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5565 "</ul>"] #[doc = "</section>"] GPIO16 <= virtual()), (@ peri_type #[doc =
5566 "GPIO17 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5567 "<section class=\"warning\">"] #[doc =
5568 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5569 #[doc = "<ul>"] #[doc =
5570 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5571 "</ul>"] #[doc = "</section>"] GPIO17 <= virtual()), (@ peri_type #[doc =
5572 "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
5573 "GPIO19 peripheral singleton"] GPIO19 <= virtual()), (@ peri_type #[doc =
5574 "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5575 "<section class=\"warning\">"] #[doc =
5576 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5577 #[doc = "<ul>"] #[doc = "<li>This pin is only available on ESP32-PICO-V3.</li>"]
5578 #[doc = "</ul>"] #[doc = "</section>"] GPIO20 <= virtual()), (@ peri_type #[doc =
5579 "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
5580 "GPIO22 peripheral singleton"] GPIO22 <= virtual()), (@ peri_type #[doc =
5581 "GPIO23 peripheral singleton"] GPIO23 <= virtual()), (@ peri_type #[doc =
5582 "GPIO25 peripheral singleton"] GPIO25 <= virtual()), (@ peri_type #[doc =
5583 "GPIO26 peripheral singleton"] GPIO26 <= virtual()), (@ peri_type #[doc =
5584 "GPIO27 peripheral singleton"] GPIO27 <= virtual()), (@ peri_type #[doc =
5585 "GPIO32 peripheral singleton"] GPIO32 <= virtual()), (@ peri_type #[doc =
5586 "GPIO33 peripheral singleton"] GPIO33 <= virtual()), (@ peri_type #[doc =
5587 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5588 "<section class=\"warning\">"] #[doc =
5589 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5590 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5591 = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
5592 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5593 "<section class=\"warning\">"] #[doc =
5594 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5595 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5596 = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
5597 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5598 "<section class=\"warning\">"] #[doc =
5599 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5600 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5601 = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
5602 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5603 "<section class=\"warning\">"] #[doc =
5604 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5605 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5606 = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
5607 "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5608 "<section class=\"warning\">"] #[doc =
5609 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5610 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5611 = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()), (@ peri_type #[doc =
5612 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5613 "<section class=\"warning\">"] #[doc =
5614 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5615 #[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
5616 = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
5617 "DMA_SPI2 peripheral singleton"] DMA_SPI2 <= SPI2(SPI2_DMA : {
5618 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5619 (@ peri_type #[doc = "DMA_SPI3 peripheral singleton"] DMA_SPI3 <= SPI3(SPI3_DMA :
5620 { bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5621 (@ peri_type #[doc = "DMA_I2S0 peripheral singleton"] DMA_I2S0 <= I2S0(I2S0 : {
5622 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5623 (@ peri_type #[doc = "DMA_I2S1 peripheral singleton"] DMA_I2S1 <= I2S1(I2S1 : {
5624 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5625 (@ peri_type #[doc = "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual()
5626 (unstable)), (@ peri_type #[doc = "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1
5627 <= virtual() (unstable)), (@ peri_type #[doc =
5628 "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)), (@
5629 peri_type #[doc = "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual()
5630 (unstable)), (@ peri_type #[doc = "PCNT0_UNIT4 peripheral singleton"] PCNT0_UNIT4
5631 <= virtual() (unstable)), (@ peri_type #[doc =
5632 "PCNT0_UNIT5 peripheral singleton"] PCNT0_UNIT5 <= virtual() (unstable)), (@
5633 peri_type #[doc = "PCNT0_UNIT6 peripheral singleton"] PCNT0_UNIT6 <= virtual()
5634 (unstable)), (@ peri_type #[doc = "PCNT0_UNIT7 peripheral singleton"] PCNT0_UNIT7
5635 <= virtual() (unstable)), (@ peri_type #[doc = "DAC1 peripheral singleton"] DAC1
5636 <= virtual() (unstable)), (@ peri_type #[doc = "DAC2 peripheral singleton"] DAC2
5637 <= virtual() (unstable)), (@ peri_type #[doc =
5638 "RMT channel 0. Transmit or receive."] RMT_CH0 <= virtual() (unstable)), (@
5639 peri_type #[doc = "RMT channel 1. Transmit or receive."] RMT_CH1 <= virtual()
5640 (unstable)), (@ peri_type #[doc = "RMT channel 2. Transmit or receive."] RMT_CH2
5641 <= virtual() (unstable)), (@ peri_type #[doc =
5642 "RMT channel 3. Transmit or receive."] RMT_CH3 <= virtual() (unstable)), (@
5643 peri_type #[doc = "RMT channel 4. Transmit or receive."] RMT_CH4 <= virtual()
5644 (unstable)), (@ peri_type #[doc = "RMT channel 5. Transmit or receive."] RMT_CH5
5645 <= virtual() (unstable)), (@ peri_type #[doc =
5646 "RMT channel 6. Transmit or receive."] RMT_CH6 <= virtual() (unstable)), (@
5647 peri_type #[doc = "RMT channel 7. Transmit or receive."] RMT_CH7 <= virtual()
5648 (unstable)), (@ peri_type #[doc = "SDM_CH0 peripheral singleton"] SDM_CH0 <=
5649 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH1 peripheral singleton"]
5650 SDM_CH1 <= virtual() (unstable)), (@ peri_type #[doc =
5651 "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual() (unstable)), (@ peri_type
5652 #[doc = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)), (@
5653 peri_type #[doc = "SDM_CH4 peripheral singleton"] SDM_CH4 <= virtual()
5654 (unstable)), (@ peri_type #[doc = "SDM_CH5 peripheral singleton"] SDM_CH5 <=
5655 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
5656 SDM_CH6 <= virtual() (unstable)), (@ peri_type #[doc =
5657 "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)), (@ peri_type
5658 #[doc = "AES peripheral singleton"] AES <= AES() (unstable)), (@ peri_type #[doc
5659 = "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)), (@
5660 peri_type #[doc = "BB peripheral singleton"] BB <= BB() (unstable)), (@ peri_type
5661 #[doc = "DPORT peripheral singleton"] DPORT <= DPORT() (unstable)), (@ peri_type
5662 #[doc = "SYSTEM peripheral singleton"] SYSTEM <= DPORT() (unstable)), (@
5663 peri_type #[doc = "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@
5664 peri_type #[doc = "ETH peripheral singleton"] ETH <= virtual(ETH_MAC : {
5665 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5666 (unstable)), (@ peri_type #[doc = "EMAC_DMA peripheral singleton"] EMAC_DMA <=
5667 GMAC_DMA() (unstable)), (@ peri_type #[doc = "EMAC_EXT peripheral singleton"]
5668 EMAC_EXT <= EMAC_EXT() (unstable)), (@ peri_type #[doc =
5669 "EMAC_MAC peripheral singleton"] EMAC_MAC <= GMAC() (unstable)), (@ peri_type
5670 #[doc = "FLASH_ENCRYPTION peripheral singleton"] FLASH_ENCRYPTION <=
5671 FLASH_ENCRYPTION() (unstable)), (@ peri_type #[doc =
5672 "FRC_TIMER peripheral singleton"] FRC_TIMER <= FRC_TIMER() (unstable)), (@
5673 peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)), (@
5674 peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD()
5675 (unstable)), (@ peri_type #[doc = "HINF peripheral singleton"] HINF <= HINF()
5676 (unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"] I2C0 <=
5677 I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
5678 disable_peri_interrupt })), (@ peri_type #[doc = "I2C1 peripheral singleton"]
5679 I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
5680 disable_peri_interrupt })), (@ peri_type #[doc = "I2S0 peripheral singleton"]
5681 I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
5682 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
5683 "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
5684 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
5685 = "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type
5686 #[doc = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)), (@ peri_type
5687 #[doc = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)), (@
5688 peri_type #[doc = "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE()
5689 (unstable)), (@ peri_type #[doc = "MCPWM1 peripheral singleton"] MCPWM1 <=
5690 MCPWM1() (unstable)), (@ peri_type #[doc = "NRX peripheral singleton"] NRX <=
5691 NRX() (unstable)), (@ peri_type #[doc = "PCNT peripheral singleton"] PCNT <=
5692 PCNT(PCNT : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
5693 }) (unstable)), (@ peri_type #[doc = "RMT peripheral singleton"] RMT <= RMT()
5694 (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <= RNG()
5695 (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <= RSA(RSA : {
5696 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5697 (unstable)), (@ peri_type #[doc = "LPWR peripheral singleton"] LPWR <= RTC_CNTL()
5698 (unstable)), (@ peri_type #[doc = "RTC_TIMER peripheral singleton"] RTC_TIMER <=
5699 RTC_CNTL() (unstable)), (@ peri_type #[doc = "LP_I2C0 peripheral singleton"]
5700 LP_I2C0 <= RTC_I2C() (unstable)), (@ peri_type #[doc =
5701 "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)), (@ peri_type #[doc
5702 = "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)), (@ peri_type
5703 #[doc = "SENS peripheral singleton"] SENS <= SENS() (unstable)), (@ peri_type
5704 #[doc = "SHA peripheral singleton"] SHA <= SHA() (unstable)), (@ peri_type #[doc
5705 = "SLC peripheral singleton"] SLC <= SLC() (unstable)), (@ peri_type #[doc =
5706 "SLCHOST peripheral singleton"] SLCHOST <= SLCHOST() (unstable)), (@ peri_type
5707 #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)), (@ peri_type
5708 #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1() (unstable)), (@ peri_type
5709 #[doc = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2_DMA : {
5710 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }, SPI2 : {
5711 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5712 peri_type #[doc = "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3_DMA : {
5713 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }, SPI3 : {
5714 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5715 peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)), (@
5716 peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)), (@
5717 peri_type #[doc = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)), (@
5718 peri_type #[doc = "UART0 peripheral singleton"] UART0 <= UART0(UART0 : {
5719 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5720 peri_type #[doc = "UART1 peripheral singleton"] UART1 <= UART1(UART1 : {
5721 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5722 peri_type #[doc = "UART2 peripheral singleton"] UART2 <= UART2(UART2 : {
5723 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5724 peri_type #[doc = "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)), (@
5725 peri_type #[doc = "UHCI1 peripheral singleton"] UHCI1 <= UHCI1() (unstable)), (@
5726 peri_type #[doc = "WIFI peripheral singleton"] WIFI <= WIFI(WIFI_MAC : {
5727 bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt })), (@ peri_type
5728 #[doc = "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)), (@ peri_type
5729 #[doc = "ADC2 peripheral singleton"] ADC2 <= virtual() (unstable)), (@ peri_type
5730 #[doc = "BT peripheral singleton"] BT <= virtual(BT_BB : { bind_bb_interrupt,
5731 enable_bb_interrupt, disable_bb_interrupt }, RWBLE : { bind_rwble_interrupt,
5732 enable_rwble_interrupt, disable_rwble_interrupt }, RWBT : { bind_rwbt_interrupt,
5733 enable_rwbt_interrupt, disable_rwbt_interrupt }) (unstable)), (@ peri_type #[doc
5734 = "CPU_CTRL peripheral singleton"] CPU_CTRL <= virtual() (unstable)), (@
5735 peri_type #[doc = "FLASH peripheral singleton"] FLASH <= virtual() (unstable)),
5736 (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
5737 (unstable)), (@ peri_type #[doc = "TOUCH peripheral singleton"] TOUCH <=
5738 virtual() (unstable)), (@ peri_type #[doc = "IPC peripheral singleton"] IPC <=
5739 virtual() (unstable)), (@ peri_type #[doc =
5740 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)),
5741 (@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <=
5742 virtual() (unstable)), (@ peri_type #[doc =
5743 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
5744 (@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
5745 virtual() (unstable)))); _for_each_inner_peripheral!((singletons(GPIO0), (GPIO1),
5746 (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6), (GPIO7), (GPIO8), (GPIO9), (GPIO10),
5747 (GPIO11), (GPIO12), (GPIO13), (GPIO14), (GPIO15), (GPIO16), (GPIO17), (GPIO18),
5748 (GPIO19), (GPIO20), (GPIO21), (GPIO22), (GPIO23), (GPIO25), (GPIO26), (GPIO27),
5749 (#[cfg(not(use_xtal32k))] GPIO32), (#[cfg(not(use_xtal32k))] GPIO33), (GPIO34),
5750 (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39), (DMA_SPI2(unstable)),
5751 (DMA_SPI3(unstable)), (DMA_I2S0(unstable)), (DMA_I2S1(unstable)),
5752 (PCNT0_UNIT0(unstable)), (PCNT0_UNIT1(unstable)), (PCNT0_UNIT2(unstable)),
5753 (PCNT0_UNIT3(unstable)), (PCNT0_UNIT4(unstable)), (PCNT0_UNIT5(unstable)),
5754 (PCNT0_UNIT6(unstable)), (PCNT0_UNIT7(unstable)), (DAC1(unstable)),
5755 (DAC2(unstable)), (RMT_CH0(unstable)), (RMT_CH1(unstable)), (RMT_CH2(unstable)),
5756 (RMT_CH3(unstable)), (RMT_CH4(unstable)), (RMT_CH5(unstable)),
5757 (RMT_CH6(unstable)), (RMT_CH7(unstable)), (SDM_CH0(unstable)),
5758 (SDM_CH1(unstable)), (SDM_CH2(unstable)), (SDM_CH3(unstable)),
5759 (SDM_CH4(unstable)), (SDM_CH5(unstable)), (SDM_CH6(unstable)),
5760 (SDM_CH7(unstable)), (AES(unstable)), (APB_CTRL(unstable)), (BB(unstable)),
5761 (DPORT(unstable)), (SYSTEM(unstable)), (ETH(unstable)),
5762 (FLASH_ENCRYPTION(unstable)), (FRC_TIMER(unstable)), (GPIO(unstable)),
5763 (GPIO_SD(unstable)), (HINF(unstable)), (I2C0), (I2C1), (I2S0(unstable)),
5764 (I2S1(unstable)), (IO_MUX(unstable)), (LEDC(unstable)), (MCPWM0(unstable)),
5765 (MCPWM1(unstable)), (NRX(unstable)), (PCNT(unstable)), (RMT(unstable)),
5766 (RNG(unstable)), (RSA(unstable)), (LPWR(unstable)), (RTC_TIMER(unstable)),
5767 (LP_I2C0(unstable)), (RTC_IO(unstable)), (SDHOST(unstable)), (SENS(unstable)),
5768 (SHA(unstable)), (SLC(unstable)), (SLCHOST(unstable)), (SPI0(unstable)),
5769 (SPI1(unstable)), (SPI2), (SPI3), (TIMG0(unstable)), (TIMG1(unstable)),
5770 (TWAI0(unstable)), (UART0), (UART1), (UART2), (UHCI0(unstable)),
5771 (UHCI1(unstable)), (WIFI), (ADC1(unstable)), (ADC2(unstable)), (BT(unstable)),
5772 (CPU_CTRL(unstable)), (FLASH(unstable)), (PSRAM(unstable)), (TOUCH(unstable)),
5773 (IPC(unstable)), (FROM_CPU_INTR2(unstable)), (FROM_CPU_INTR3(unstable))));
5774 _for_each_inner_peripheral!((dma_eligible(SPI2, Spi2, 0, SpiDmaChannel), (I2S0,
5775 I2s0, 0, I2sDmaChannel), (SPI3, Spi3, 1, SpiDmaChannel), (I2S1, I2s1, 1,
5776 I2sDmaChannel)));
5777 };
5778}
5779#[macro_export]
5806#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5807macro_rules! for_each_gpio {
5808 ($($pattern:tt => $code:tt;)*) => {
5809 macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
5810 } _for_each_inner_gpio!((0, GPIO0(_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 =>
5811 EMAC_TX_CLK) ([Input] [Output]))); _for_each_inner_gpio!((1, GPIO1(_5 =>
5812 EMAC_RXD2) (_0 => U0TXD _1 => CLK_OUT3) ([Input] [Output])));
5813 _for_each_inner_gpio!((2, GPIO2(_1 => HSPIWP _3 => SD2_DATA0 _4 => SD_DATA0) (_1
5814 => HSPIWP _3 => SD2_DATA0 _4 => SD_DATA0) ([Input] [Output])));
5815 _for_each_inner_gpio!((3, GPIO3(_0 => U0RXD) (_1 => CLK_OUT2) ([Input]
5816 [Output]))); _for_each_inner_gpio!((4, GPIO4(_1 => HSPIHD _3 => SD2_DATA1 _4 =>
5817 SD_DATA1 _5 => EMAC_TXER) (_1 => HSPIHD _3 => SD2_DATA1 _4 => SD_DATA1 _5 =>
5818 EMAC_TXER) ([Input] [Output]))); _for_each_inner_gpio!((5, GPIO5(_1 => VSPICS0 _3
5819 => SD1_DATA6 _5 => EMAC_RX_CLK) (_1 => VSPICS0 _3 => SD1_DATA6) ([Input]
5820 [Output]))); _for_each_inner_gpio!((6, GPIO6(_1 => SPICLK _4 => U1CTS) (_0 =>
5821 SD_CLK _1 => SPICLK _3 => SD1_CLK) ([Input] [Output])));
5822 _for_each_inner_gpio!((7, GPIO7(_0 => SD_DATA0 _1 => SPIQ _3 => SD1_DATA0) (_0 =>
5823 SD_DATA0 _1 => SPIQ _3 => SD1_DATA0 _4 => U2RTS) ([Input] [Output])));
5824 _for_each_inner_gpio!((8, GPIO8(_0 => SD_DATA1 _1 => SPID _3 => SD1_DATA1 _4 =>
5825 U2CTS) (_0 => SD_DATA1 _1 => SPID _3 => SD1_DATA1) ([Input] [Output])));
5826 _for_each_inner_gpio!((9, GPIO9(_0 => SD_DATA2 _1 => SPIHD _3 => SD1_DATA2 _4 =>
5827 U1RXD) (_0 => SD_DATA2 _1 => SPIHD _3 => SD1_DATA2) ([Input] [Output])));
5828 _for_each_inner_gpio!((10, GPIO10(_0 => SD_DATA3 _1 => SPIWP _3 => SD1_DATA3) (_0
5829 => SD_DATA3 _1 => SPIWP _3 => SD1_DATA3 _4 => U1TXD) ([Input] [Output])));
5830 _for_each_inner_gpio!((11, GPIO11(_0 => SD_CMD _1 => SPICS0) (_0 => SD_CMD _1 =>
5831 SPICS0 _3 => SD1_CMD _4 => U1RTS) ([Input] [Output])));
5832 _for_each_inner_gpio!((12, GPIO12(_0 => MTDI _1 => HSPIQ _3 => SD2_DATA2 _4 =>
5833 SD_DATA2) (_1 => HSPIQ _3 => SD2_DATA2 _4 => SD_DATA2 _5 => EMAC_TXD3) ([Input]
5834 [Output]))); _for_each_inner_gpio!((13, GPIO13(_0 => MTCK _1 => HSPID _3 =>
5835 SD2_DATA3 _4 => SD_DATA3 _5 => EMAC_RXER) (_1 => HSPID _3 => SD2_DATA3 _4 =>
5836 SD_DATA3 _5 => EMAC_RXER) ([Input] [Output]))); _for_each_inner_gpio!((14,
5837 GPIO14(_0 => MTMS _1 => HSPICLK) (_1 => HSPICLK _3 => SD2_CLK _4 => SD_CLK _5 =>
5838 EMAC_TXD2) ([Input] [Output]))); _for_each_inner_gpio!((15, GPIO15(_1 => HSPICS0
5839 _4 => SD_CMD _5 => EMAC_RXD3) (_0 => MTDO _1 => HSPICS0 _3 => SD2_CMD _4 =>
5840 SD_CMD) ([Input] [Output]))); _for_each_inner_gpio!((16, GPIO16(_3 => SD1_DATA4
5841 _4 => U2RXD) (_3 => SD1_DATA4 _5 => EMAC_CLK_OUT) ([Input] [Output])));
5842 _for_each_inner_gpio!((17, GPIO17(_3 => SD1_DATA5) (_3 => SD1_DATA5 _4 => U2TXD
5843 _5 => EMAC_CLK_180) ([Input] [Output]))); _for_each_inner_gpio!((18, GPIO18(_1 =>
5844 VSPICLK _3 => SD1_DATA7) (_1 => VSPICLK _3 => SD1_DATA7) ([Input] [Output])));
5845 _for_each_inner_gpio!((19, GPIO19(_1 => VSPIQ _3 => U0CTS) (_1 => VSPIQ _5 =>
5846 EMAC_TXD0) ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20() () ([Input]
5847 [Output]))); _for_each_inner_gpio!((21, GPIO21(_1 => VSPIHD) (_1 => VSPIHD _5 =>
5848 EMAC_TXEN) ([Input] [Output]))); _for_each_inner_gpio!((22, GPIO22(_1 => VSPIWP)
5849 (_1 => VSPIWP _3 => U0RTS _5 => EMAC_TXD1) ([Input] [Output])));
5850 _for_each_inner_gpio!((23, GPIO23(_1 => VSPID) (_1 => VSPID _3 => SD1_STROBE)
5851 ([Input] [Output]))); _for_each_inner_gpio!((25, GPIO25(_5 => EMAC_RXD0) ()
5852 ([Input] [Output]))); _for_each_inner_gpio!((26, GPIO26(_5 => EMAC_RXD1) ()
5853 ([Input] [Output]))); _for_each_inner_gpio!((27, GPIO27(_5 => EMAC_RXDV) ()
5854 ([Input] [Output]))); _for_each_inner_gpio!((32, GPIO32() () ([Input]
5855 [Output]))); _for_each_inner_gpio!((33, GPIO33() () ([Input] [Output])));
5856 _for_each_inner_gpio!((34, GPIO34() () ([Input] []))); _for_each_inner_gpio!((35,
5857 GPIO35() () ([Input] []))); _for_each_inner_gpio!((36, GPIO36() () ([Input]
5858 []))); _for_each_inner_gpio!((37, GPIO37() () ([Input] [])));
5859 _for_each_inner_gpio!((38, GPIO38() () ([Input] []))); _for_each_inner_gpio!((39,
5860 GPIO39() () ([Input] []))); _for_each_inner_gpio!((all(0, GPIO0(_5 =>
5861 EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input] [Output])), (1, GPIO1(_5
5862 => EMAC_RXD2) (_0 => U0TXD _1 => CLK_OUT3) ([Input] [Output])), (2, GPIO2(_1 =>
5863 HSPIWP _3 => SD2_DATA0 _4 => SD_DATA0) (_1 => HSPIWP _3 => SD2_DATA0 _4 =>
5864 SD_DATA0) ([Input] [Output])), (3, GPIO3(_0 => U0RXD) (_1 => CLK_OUT2) ([Input]
5865 [Output])), (4, GPIO4(_1 => HSPIHD _3 => SD2_DATA1 _4 => SD_DATA1 _5 =>
5866 EMAC_TXER) (_1 => HSPIHD _3 => SD2_DATA1 _4 => SD_DATA1 _5 => EMAC_TXER) ([Input]
5867 [Output])), (5, GPIO5(_1 => VSPICS0 _3 => SD1_DATA6 _5 => EMAC_RX_CLK) (_1 =>
5868 VSPICS0 _3 => SD1_DATA6) ([Input] [Output])), (6, GPIO6(_1 => SPICLK _4 => U1CTS)
5869 (_0 => SD_CLK _1 => SPICLK _3 => SD1_CLK) ([Input] [Output])), (7, GPIO7(_0 =>
5870 SD_DATA0 _1 => SPIQ _3 => SD1_DATA0) (_0 => SD_DATA0 _1 => SPIQ _3 => SD1_DATA0
5871 _4 => U2RTS) ([Input] [Output])), (8, GPIO8(_0 => SD_DATA1 _1 => SPID _3 =>
5872 SD1_DATA1 _4 => U2CTS) (_0 => SD_DATA1 _1 => SPID _3 => SD1_DATA1) ([Input]
5873 [Output])), (9, GPIO9(_0 => SD_DATA2 _1 => SPIHD _3 => SD1_DATA2 _4 => U1RXD) (_0
5874 => SD_DATA2 _1 => SPIHD _3 => SD1_DATA2) ([Input] [Output])), (10, GPIO10(_0 =>
5875 SD_DATA3 _1 => SPIWP _3 => SD1_DATA3) (_0 => SD_DATA3 _1 => SPIWP _3 => SD1_DATA3
5876 _4 => U1TXD) ([Input] [Output])), (11, GPIO11(_0 => SD_CMD _1 => SPICS0) (_0 =>
5877 SD_CMD _1 => SPICS0 _3 => SD1_CMD _4 => U1RTS) ([Input] [Output])), (12,
5878 GPIO12(_0 => MTDI _1 => HSPIQ _3 => SD2_DATA2 _4 => SD_DATA2) (_1 => HSPIQ _3 =>
5879 SD2_DATA2 _4 => SD_DATA2 _5 => EMAC_TXD3) ([Input] [Output])), (13, GPIO13(_0 =>
5880 MTCK _1 => HSPID _3 => SD2_DATA3 _4 => SD_DATA3 _5 => EMAC_RXER) (_1 => HSPID _3
5881 => SD2_DATA3 _4 => SD_DATA3 _5 => EMAC_RXER) ([Input] [Output])), (14, GPIO14(_0
5882 => MTMS _1 => HSPICLK) (_1 => HSPICLK _3 => SD2_CLK _4 => SD_CLK _5 => EMAC_TXD2)
5883 ([Input] [Output])), (15, GPIO15(_1 => HSPICS0 _4 => SD_CMD _5 => EMAC_RXD3) (_0
5884 => MTDO _1 => HSPICS0 _3 => SD2_CMD _4 => SD_CMD) ([Input] [Output])), (16,
5885 GPIO16(_3 => SD1_DATA4 _4 => U2RXD) (_3 => SD1_DATA4 _5 => EMAC_CLK_OUT) ([Input]
5886 [Output])), (17, GPIO17(_3 => SD1_DATA5) (_3 => SD1_DATA5 _4 => U2TXD _5 =>
5887 EMAC_CLK_180) ([Input] [Output])), (18, GPIO18(_1 => VSPICLK _3 => SD1_DATA7) (_1
5888 => VSPICLK _3 => SD1_DATA7) ([Input] [Output])), (19, GPIO19(_1 => VSPIQ _3 =>
5889 U0CTS) (_1 => VSPIQ _5 => EMAC_TXD0) ([Input] [Output])), (20, GPIO20() ()
5890 ([Input] [Output])), (21, GPIO21(_1 => VSPIHD) (_1 => VSPIHD _5 => EMAC_TXEN)
5891 ([Input] [Output])), (22, GPIO22(_1 => VSPIWP) (_1 => VSPIWP _3 => U0RTS _5 =>
5892 EMAC_TXD1) ([Input] [Output])), (23, GPIO23(_1 => VSPID) (_1 => VSPID _3 =>
5893 SD1_STROBE) ([Input] [Output])), (25, GPIO25(_5 => EMAC_RXD0) () ([Input]
5894 [Output])), (26, GPIO26(_5 => EMAC_RXD1) () ([Input] [Output])), (27, GPIO27(_5
5895 => EMAC_RXDV) () ([Input] [Output])), (32, GPIO32() () ([Input] [Output])), (33,
5896 GPIO33() () ([Input] [Output])), (34, GPIO34() () ([Input] [])), (35, GPIO35() ()
5897 ([Input] [])), (36, GPIO36() () ([Input] [])), (37, GPIO37() () ([Input] [])),
5898 (38, GPIO38() () ([Input] [])), (39, GPIO39() () ([Input] []))));
5899 };
5900}
5901#[macro_export]
5928#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5929macro_rules! for_each_analog_function {
5930 ($($pattern:tt => $code:tt;)*) => {
5931 macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
5932 tt) => {} } _for_each_inner_analog_function!((ADC2_CH1, GPIO0));
5933 _for_each_inner_analog_function!((TOUCH1, GPIO0));
5934 _for_each_inner_analog_function!((ADC2_CH2, GPIO2));
5935 _for_each_inner_analog_function!((TOUCH2, GPIO2));
5936 _for_each_inner_analog_function!((ADC2_CH0, GPIO4));
5937 _for_each_inner_analog_function!((TOUCH0, GPIO4));
5938 _for_each_inner_analog_function!((ADC2_CH5, GPIO12));
5939 _for_each_inner_analog_function!((TOUCH5, GPIO12));
5940 _for_each_inner_analog_function!((ADC2_CH4, GPIO13));
5941 _for_each_inner_analog_function!((TOUCH4, GPIO13));
5942 _for_each_inner_analog_function!((ADC2_CH6, GPIO14));
5943 _for_each_inner_analog_function!((TOUCH6, GPIO14));
5944 _for_each_inner_analog_function!((ADC2_CH3, GPIO15));
5945 _for_each_inner_analog_function!((TOUCH3, GPIO15));
5946 _for_each_inner_analog_function!((DAC1, GPIO25));
5947 _for_each_inner_analog_function!((ADC2_CH8, GPIO25));
5948 _for_each_inner_analog_function!((DAC2, GPIO26));
5949 _for_each_inner_analog_function!((ADC2_CH9, GPIO26));
5950 _for_each_inner_analog_function!((ADC2_CH7, GPIO27));
5951 _for_each_inner_analog_function!((TOUCH7, GPIO27));
5952 _for_each_inner_analog_function!((XTAL_32K_P, GPIO32));
5953 _for_each_inner_analog_function!((ADC1_CH4, GPIO32));
5954 _for_each_inner_analog_function!((TOUCH9, GPIO32));
5955 _for_each_inner_analog_function!((XTAL_32K_N, GPIO33));
5956 _for_each_inner_analog_function!((ADC1_CH5, GPIO33));
5957 _for_each_inner_analog_function!((TOUCH8, GPIO33));
5958 _for_each_inner_analog_function!((ADC1_CH6, GPIO34));
5959 _for_each_inner_analog_function!((ADC1_CH7, GPIO35));
5960 _for_each_inner_analog_function!((ADC_H, GPIO36));
5961 _for_each_inner_analog_function!((ADC1_CH0, GPIO36));
5962 _for_each_inner_analog_function!((ADC_H, GPIO37));
5963 _for_each_inner_analog_function!((ADC1_CH1, GPIO37));
5964 _for_each_inner_analog_function!((ADC_H, GPIO38));
5965 _for_each_inner_analog_function!((ADC1_CH2, GPIO38));
5966 _for_each_inner_analog_function!((ADC_H, GPIO39));
5967 _for_each_inner_analog_function!((ADC1_CH3, GPIO39));
5968 _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO0));
5969 _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO2));
5970 _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO4));
5971 _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12));
5972 _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO13));
5973 _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO14));
5974 _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO15));
5975 _for_each_inner_analog_function!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO25));
5976 _for_each_inner_analog_function!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO26));
5977 _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO27));
5978 _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO32));
5979 _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO33));
5980 _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO34));
5981 _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO35));
5982 _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO36));
5983 _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO37));
5984 _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO38));
5985 _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO39));
5986 _for_each_inner_analog_function!(((TOUCH1, TOUCHn, 1), GPIO0));
5987 _for_each_inner_analog_function!(((TOUCH2, TOUCHn, 2), GPIO2));
5988 _for_each_inner_analog_function!(((TOUCH0, TOUCHn, 0), GPIO4));
5989 _for_each_inner_analog_function!(((TOUCH5, TOUCHn, 5), GPIO12));
5990 _for_each_inner_analog_function!(((TOUCH4, TOUCHn, 4), GPIO13));
5991 _for_each_inner_analog_function!(((TOUCH6, TOUCHn, 6), GPIO14));
5992 _for_each_inner_analog_function!(((TOUCH3, TOUCHn, 3), GPIO15));
5993 _for_each_inner_analog_function!(((TOUCH7, TOUCHn, 7), GPIO27));
5994 _for_each_inner_analog_function!(((TOUCH9, TOUCHn, 9), GPIO32));
5995 _for_each_inner_analog_function!(((TOUCH8, TOUCHn, 8), GPIO33));
5996 _for_each_inner_analog_function!(((DAC1, DACn, 1), GPIO25));
5997 _for_each_inner_analog_function!(((DAC2, DACn, 2), GPIO26));
5998 _for_each_inner_analog_function!((all(ADC2_CH1, GPIO0), (TOUCH1, GPIO0),
5999 (ADC2_CH2, GPIO2), (TOUCH2, GPIO2), (ADC2_CH0, GPIO4), (TOUCH0, GPIO4),
6000 (ADC2_CH5, GPIO12), (TOUCH5, GPIO12), (ADC2_CH4, GPIO13), (TOUCH4, GPIO13),
6001 (ADC2_CH6, GPIO14), (TOUCH6, GPIO14), (ADC2_CH3, GPIO15), (TOUCH3, GPIO15),
6002 (DAC1, GPIO25), (ADC2_CH8, GPIO25), (DAC2, GPIO26), (ADC2_CH9, GPIO26),
6003 (ADC2_CH7, GPIO27), (TOUCH7, GPIO27), (XTAL_32K_P, GPIO32), (ADC1_CH4, GPIO32),
6004 (TOUCH9, GPIO32), (XTAL_32K_N, GPIO33), (ADC1_CH5, GPIO33), (TOUCH8, GPIO33),
6005 (ADC1_CH6, GPIO34), (ADC1_CH7, GPIO35), (ADC_H, GPIO36), (ADC1_CH0, GPIO36),
6006 (ADC_H, GPIO37), (ADC1_CH1, GPIO37), (ADC_H, GPIO38), (ADC1_CH2, GPIO38), (ADC_H,
6007 GPIO39), (ADC1_CH3, GPIO39)));
6008 _for_each_inner_analog_function!((ADCn_CHm((ADC2_CH1, ADCn_CHm, 2, 1), GPIO0),
6009 ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO2), ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO4),
6010 ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12), ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO13),
6011 ((ADC2_CH6, ADCn_CHm, 2, 6), GPIO14), ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO15),
6012 ((ADC2_CH8, ADCn_CHm, 2, 8), GPIO25), ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO26),
6013 ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO27), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO32),
6014 ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO33), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO34),
6015 ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO35), ((ADC1_CH0, ADCn_CHm, 1, 0), GPIO36),
6016 ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO37), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO38),
6017 ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO39)));
6018 _for_each_inner_analog_function!((TOUCHn((TOUCH1, TOUCHn, 1), GPIO0), ((TOUCH2,
6019 TOUCHn, 2), GPIO2), ((TOUCH0, TOUCHn, 0), GPIO4), ((TOUCH5, TOUCHn, 5), GPIO12),
6020 ((TOUCH4, TOUCHn, 4), GPIO13), ((TOUCH6, TOUCHn, 6), GPIO14), ((TOUCH3, TOUCHn,
6021 3), GPIO15), ((TOUCH7, TOUCHn, 7), GPIO27), ((TOUCH9, TOUCHn, 9), GPIO32),
6022 ((TOUCH8, TOUCHn, 8), GPIO33))); _for_each_inner_analog_function!((DACn((DAC1,
6023 DACn, 1), GPIO25), ((DAC2, DACn, 2), GPIO26)));
6024 };
6025}
6026#[macro_export]
6064#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6065macro_rules! for_each_lp_function {
6066 ($($pattern:tt => $code:tt;)*) => {
6067 macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
6068 => {} } _for_each_inner_lp_function!((LP_GPIO11, GPIO0, _0));
6069 _for_each_inner_lp_function!((SAR_I2C_SDA, GPIO0, _3));
6070 _for_each_inner_lp_function!((LP_GPIO12, GPIO2, _0));
6071 _for_each_inner_lp_function!((SAR_I2C_SCL, GPIO2, _3));
6072 _for_each_inner_lp_function!((LP_GPIO10, GPIO4, _0));
6073 _for_each_inner_lp_function!((SAR_I2C_SCL, GPIO4, _3));
6074 _for_each_inner_lp_function!((LP_GPIO15, GPIO12, _0));
6075 _for_each_inner_lp_function!((LP_GPIO14, GPIO13, _0));
6076 _for_each_inner_lp_function!((LP_GPIO16, GPIO14, _0));
6077 _for_each_inner_lp_function!((LP_GPIO13, GPIO15, _0));
6078 _for_each_inner_lp_function!((SAR_I2C_SDA, GPIO15, _3));
6079 _for_each_inner_lp_function!((LP_GPIO6, GPIO25, _0));
6080 _for_each_inner_lp_function!((LP_GPIO7, GPIO26, _0));
6081 _for_each_inner_lp_function!((LP_GPIO17, GPIO27, _0));
6082 _for_each_inner_lp_function!((LP_GPIO9, GPIO32, _0));
6083 _for_each_inner_lp_function!((LP_GPIO8, GPIO33, _0));
6084 _for_each_inner_lp_function!((LP_GPIO4, GPIO34, _0));
6085 _for_each_inner_lp_function!((LP_GPIO5, GPIO35, _0));
6086 _for_each_inner_lp_function!((LP_GPIO0, GPIO36, _0));
6087 _for_each_inner_lp_function!((LP_GPIO1, GPIO37, _0));
6088 _for_each_inner_lp_function!((LP_GPIO2, GPIO38, _0));
6089 _for_each_inner_lp_function!((LP_GPIO3, GPIO39, _0));
6090 _for_each_inner_lp_function!(((LP_GPIO11, LP_GPIOn, 11), GPIO0, _0, () ()));
6091 _for_each_inner_lp_function!(((LP_GPIO12, LP_GPIOn, 12), GPIO2, _0, () ()));
6092 _for_each_inner_lp_function!(((LP_GPIO10, LP_GPIOn, 10), GPIO4, _0, () ()));
6093 _for_each_inner_lp_function!(((LP_GPIO15, LP_GPIOn, 15), GPIO12, _0, () ()));
6094 _for_each_inner_lp_function!(((LP_GPIO14, LP_GPIOn, 14), GPIO13, _0, () ()));
6095 _for_each_inner_lp_function!(((LP_GPIO16, LP_GPIOn, 16), GPIO14, _0, () ()));
6096 _for_each_inner_lp_function!(((LP_GPIO13, LP_GPIOn, 13), GPIO15, _0, () ()));
6097 _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO25, _0, () ()));
6098 _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO26, _0, () ()));
6099 _for_each_inner_lp_function!(((LP_GPIO17, LP_GPIOn, 17), GPIO27, _0, () ()));
6100 _for_each_inner_lp_function!(((LP_GPIO9, LP_GPIOn, 9), GPIO32, _0, () ()));
6101 _for_each_inner_lp_function!(((LP_GPIO8, LP_GPIOn, 8), GPIO33, _0, () ()));
6102 _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO34, _0, () ()));
6103 _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO35, _0, () ()));
6104 _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO36, _0, () ()));
6105 _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO37, _0, () ()));
6106 _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO38, _0, () ()));
6107 _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO39, _0, () ()));
6108 _for_each_inner_lp_function!((all(LP_GPIO11, GPIO0, _0), (SAR_I2C_SDA, GPIO0,
6109 _3), (LP_GPIO12, GPIO2, _0), (SAR_I2C_SCL, GPIO2, _3), (LP_GPIO10, GPIO4, _0),
6110 (SAR_I2C_SCL, GPIO4, _3), (LP_GPIO15, GPIO12, _0), (LP_GPIO14, GPIO13, _0),
6111 (LP_GPIO16, GPIO14, _0), (LP_GPIO13, GPIO15, _0), (SAR_I2C_SDA, GPIO15, _3),
6112 (LP_GPIO6, GPIO25, _0), (LP_GPIO7, GPIO26, _0), (LP_GPIO17, GPIO27, _0),
6113 (LP_GPIO9, GPIO32, _0), (LP_GPIO8, GPIO33, _0), (LP_GPIO4, GPIO34, _0),
6114 (LP_GPIO5, GPIO35, _0), (LP_GPIO0, GPIO36, _0), (LP_GPIO1, GPIO37, _0),
6115 (LP_GPIO2, GPIO38, _0), (LP_GPIO3, GPIO39, _0)));
6116 _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO11, LP_GPIOn, 11), GPIO0, _0, ()
6117 ()), ((LP_GPIO12, LP_GPIOn, 12), GPIO2, _0, () ()), ((LP_GPIO10, LP_GPIOn, 10),
6118 GPIO4, _0, () ()), ((LP_GPIO15, LP_GPIOn, 15), GPIO12, _0, () ()), ((LP_GPIO14,
6119 LP_GPIOn, 14), GPIO13, _0, () ()), ((LP_GPIO16, LP_GPIOn, 16), GPIO14, _0, ()
6120 ()), ((LP_GPIO13, LP_GPIOn, 13), GPIO15, _0, () ()), ((LP_GPIO6, LP_GPIOn, 6),
6121 GPIO25, _0, () ()), ((LP_GPIO7, LP_GPIOn, 7), GPIO26, _0, () ()), ((LP_GPIO17,
6122 LP_GPIOn, 17), GPIO27, _0, () ()), ((LP_GPIO9, LP_GPIOn, 9), GPIO32, _0, () ()),
6123 ((LP_GPIO8, LP_GPIOn, 8), GPIO33, _0, () ()), ((LP_GPIO4, LP_GPIOn, 4), GPIO34,
6124 _0, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO35, _0, () ()), ((LP_GPIO0, LP_GPIOn,
6125 0), GPIO36, _0, () ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO37, _0, () ()), ((LP_GPIO2,
6126 LP_GPIOn, 2), GPIO38, _0, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO39, _0, () ())));
6127 };
6128}
6129#[macro_export]
6160#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6161macro_rules! for_each_iomux_function {
6162 ($($pattern:tt => $code:tt;)*) => {
6163 macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
6164 tt) => {} } _for_each_inner_iomux_function!((CLK_OUT1, GPIO0, _1));
6165 _for_each_inner_iomux_function!((EMAC_TX_CLK, GPIO0, _5));
6166 _for_each_inner_iomux_function!((U0TXD, GPIO1, _0));
6167 _for_each_inner_iomux_function!((CLK_OUT3, GPIO1, _1));
6168 _for_each_inner_iomux_function!((EMAC_RXD2, GPIO1, _5));
6169 _for_each_inner_iomux_function!((HSPIWP, GPIO2, _1));
6170 _for_each_inner_iomux_function!((SD2_DATA0, GPIO2, _3));
6171 _for_each_inner_iomux_function!((SD_DATA0, GPIO2, _4));
6172 _for_each_inner_iomux_function!((U0RXD, GPIO3, _0));
6173 _for_each_inner_iomux_function!((CLK_OUT2, GPIO3, _1));
6174 _for_each_inner_iomux_function!((HSPIHD, GPIO4, _1));
6175 _for_each_inner_iomux_function!((SD2_DATA1, GPIO4, _3));
6176 _for_each_inner_iomux_function!((SD_DATA1, GPIO4, _4));
6177 _for_each_inner_iomux_function!((EMAC_TXER, GPIO4, _5));
6178 _for_each_inner_iomux_function!((VSPICS0, GPIO5, _1));
6179 _for_each_inner_iomux_function!((SD1_DATA6, GPIO5, _3));
6180 _for_each_inner_iomux_function!((EMAC_RX_CLK, GPIO5, _5));
6181 _for_each_inner_iomux_function!((SD_CLK, GPIO6, _0));
6182 _for_each_inner_iomux_function!((SPICLK, GPIO6, _1));
6183 _for_each_inner_iomux_function!((SD1_CLK, GPIO6, _3));
6184 _for_each_inner_iomux_function!((U1CTS, GPIO6, _4));
6185 _for_each_inner_iomux_function!((SD_DATA0, GPIO7, _0));
6186 _for_each_inner_iomux_function!((SPIQ, GPIO7, _1));
6187 _for_each_inner_iomux_function!((SD1_DATA0, GPIO7, _3));
6188 _for_each_inner_iomux_function!((U2RTS, GPIO7, _4));
6189 _for_each_inner_iomux_function!((SD_DATA1, GPIO8, _0));
6190 _for_each_inner_iomux_function!((SPID, GPIO8, _1));
6191 _for_each_inner_iomux_function!((SD1_DATA1, GPIO8, _3));
6192 _for_each_inner_iomux_function!((U2CTS, GPIO8, _4));
6193 _for_each_inner_iomux_function!((SD_DATA2, GPIO9, _0));
6194 _for_each_inner_iomux_function!((SPIHD, GPIO9, _1));
6195 _for_each_inner_iomux_function!((SD1_DATA2, GPIO9, _3));
6196 _for_each_inner_iomux_function!((U1RXD, GPIO9, _4));
6197 _for_each_inner_iomux_function!((SD_DATA3, GPIO10, _0));
6198 _for_each_inner_iomux_function!((SPIWP, GPIO10, _1));
6199 _for_each_inner_iomux_function!((SD1_DATA3, GPIO10, _3));
6200 _for_each_inner_iomux_function!((U1TXD, GPIO10, _4));
6201 _for_each_inner_iomux_function!((SD_CMD, GPIO11, _0));
6202 _for_each_inner_iomux_function!((SPICS0, GPIO11, _1));
6203 _for_each_inner_iomux_function!((SD1_CMD, GPIO11, _3));
6204 _for_each_inner_iomux_function!((U1RTS, GPIO11, _4));
6205 _for_each_inner_iomux_function!((MTDI, GPIO12, _0));
6206 _for_each_inner_iomux_function!((HSPIQ, GPIO12, _1));
6207 _for_each_inner_iomux_function!((SD2_DATA2, GPIO12, _3));
6208 _for_each_inner_iomux_function!((SD_DATA2, GPIO12, _4));
6209 _for_each_inner_iomux_function!((EMAC_TXD3, GPIO12, _5));
6210 _for_each_inner_iomux_function!((MTCK, GPIO13, _0));
6211 _for_each_inner_iomux_function!((HSPID, GPIO13, _1));
6212 _for_each_inner_iomux_function!((SD2_DATA3, GPIO13, _3));
6213 _for_each_inner_iomux_function!((SD_DATA3, GPIO13, _4));
6214 _for_each_inner_iomux_function!((EMAC_RXER, GPIO13, _5));
6215 _for_each_inner_iomux_function!((MTMS, GPIO14, _0));
6216 _for_each_inner_iomux_function!((HSPICLK, GPIO14, _1));
6217 _for_each_inner_iomux_function!((SD2_CLK, GPIO14, _3));
6218 _for_each_inner_iomux_function!((SD_CLK, GPIO14, _4));
6219 _for_each_inner_iomux_function!((EMAC_TXD2, GPIO14, _5));
6220 _for_each_inner_iomux_function!((MTDO, GPIO15, _0));
6221 _for_each_inner_iomux_function!((HSPICS0, GPIO15, _1));
6222 _for_each_inner_iomux_function!((SD2_CMD, GPIO15, _3));
6223 _for_each_inner_iomux_function!((SD_CMD, GPIO15, _4));
6224 _for_each_inner_iomux_function!((EMAC_RXD3, GPIO15, _5));
6225 _for_each_inner_iomux_function!((SD1_DATA4, GPIO16, _3));
6226 _for_each_inner_iomux_function!((U2RXD, GPIO16, _4));
6227 _for_each_inner_iomux_function!((EMAC_CLK_OUT, GPIO16, _5));
6228 _for_each_inner_iomux_function!((SD1_DATA5, GPIO17, _3));
6229 _for_each_inner_iomux_function!((U2TXD, GPIO17, _4));
6230 _for_each_inner_iomux_function!((EMAC_CLK_180, GPIO17, _5));
6231 _for_each_inner_iomux_function!((VSPICLK, GPIO18, _1));
6232 _for_each_inner_iomux_function!((SD1_DATA7, GPIO18, _3));
6233 _for_each_inner_iomux_function!((VSPIQ, GPIO19, _1));
6234 _for_each_inner_iomux_function!((U0CTS, GPIO19, _3));
6235 _for_each_inner_iomux_function!((EMAC_TXD0, GPIO19, _5));
6236 _for_each_inner_iomux_function!((VSPIHD, GPIO21, _1));
6237 _for_each_inner_iomux_function!((EMAC_TXEN, GPIO21, _5));
6238 _for_each_inner_iomux_function!((VSPIWP, GPIO22, _1));
6239 _for_each_inner_iomux_function!((U0RTS, GPIO22, _3));
6240 _for_each_inner_iomux_function!((EMAC_TXD1, GPIO22, _5));
6241 _for_each_inner_iomux_function!((VSPID, GPIO23, _1));
6242 _for_each_inner_iomux_function!((SD1_STROBE, GPIO23, _3));
6243 _for_each_inner_iomux_function!((EMAC_RXD0, GPIO25, _5));
6244 _for_each_inner_iomux_function!((EMAC_RXD1, GPIO26, _5));
6245 _for_each_inner_iomux_function!((EMAC_RXDV, GPIO27, _5));
6246 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO0, _1));
6247 _for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO1, _1));
6248 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO3, _1));
6249 _for_each_inner_iomux_function!(((EMAC_RXD2, EMAC_RXDn, 2), GPIO1, _5));
6250 _for_each_inner_iomux_function!(((EMAC_RXD3, EMAC_RXDn, 3), GPIO15, _5));
6251 _for_each_inner_iomux_function!(((EMAC_RXD0, EMAC_RXDn, 0), GPIO25, _5));
6252 _for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO26, _5));
6253 _for_each_inner_iomux_function!(((SD2_DATA0, SDn_DATAm, 2, 0), GPIO2, _3));
6254 _for_each_inner_iomux_function!(((SD2_DATA1, SDn_DATAm, 2, 1), GPIO4, _3));
6255 _for_each_inner_iomux_function!(((SD1_DATA6, SDn_DATAm, 1, 6), GPIO5, _3));
6256 _for_each_inner_iomux_function!(((SD1_DATA0, SDn_DATAm, 1, 0), GPIO7, _3));
6257 _for_each_inner_iomux_function!(((SD1_DATA1, SDn_DATAm, 1, 1), GPIO8, _3));
6258 _for_each_inner_iomux_function!(((SD1_DATA2, SDn_DATAm, 1, 2), GPIO9, _3));
6259 _for_each_inner_iomux_function!(((SD1_DATA3, SDn_DATAm, 1, 3), GPIO10, _3));
6260 _for_each_inner_iomux_function!(((SD2_DATA2, SDn_DATAm, 2, 2), GPIO12, _3));
6261 _for_each_inner_iomux_function!(((SD2_DATA3, SDn_DATAm, 2, 3), GPIO13, _3));
6262 _for_each_inner_iomux_function!(((SD1_DATA4, SDn_DATAm, 1, 4), GPIO16, _3));
6263 _for_each_inner_iomux_function!(((SD1_DATA5, SDn_DATAm, 1, 5), GPIO17, _3));
6264 _for_each_inner_iomux_function!(((SD1_DATA7, SDn_DATAm, 1, 7), GPIO18, _3));
6265 _for_each_inner_iomux_function!(((SD_DATA0, SD_DATAn, 0), GPIO2, _4));
6266 _for_each_inner_iomux_function!(((SD_DATA1, SD_DATAn, 1), GPIO4, _4));
6267 _for_each_inner_iomux_function!(((SD_DATA0, SD_DATAn, 0), GPIO7, _0));
6268 _for_each_inner_iomux_function!(((SD_DATA1, SD_DATAn, 1), GPIO8, _0));
6269 _for_each_inner_iomux_function!(((SD_DATA2, SD_DATAn, 2), GPIO9, _0));
6270 _for_each_inner_iomux_function!(((SD_DATA3, SD_DATAn, 3), GPIO10, _0));
6271 _for_each_inner_iomux_function!(((SD_DATA2, SD_DATAn, 2), GPIO12, _4));
6272 _for_each_inner_iomux_function!(((SD_DATA3, SD_DATAn, 3), GPIO13, _4));
6273 _for_each_inner_iomux_function!(((VSPICS0, VSPICSn, 0), GPIO5, _1));
6274 _for_each_inner_iomux_function!(((SD1_CLK, SDn_CLK, 1), GPIO6, _3));
6275 _for_each_inner_iomux_function!(((SD2_CLK, SDn_CLK, 2), GPIO14, _3));
6276 _for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO11, _1));
6277 _for_each_inner_iomux_function!(((SD1_CMD, SDn_CMD, 1), GPIO11, _3));
6278 _for_each_inner_iomux_function!(((SD2_CMD, SDn_CMD, 2), GPIO15, _3));
6279 _for_each_inner_iomux_function!(((EMAC_TXD3, EMAC_TXDn, 3), GPIO12, _5));
6280 _for_each_inner_iomux_function!(((EMAC_TXD2, EMAC_TXDn, 2), GPIO14, _5));
6281 _for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO19, _5));
6282 _for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO22, _5));
6283 _for_each_inner_iomux_function!(((HSPICS0, HSPICSn, 0), GPIO15, _1));
6284 _for_each_inner_iomux_function!(((EMAC_CLK_180, EMAC_CLK_n, 180), GPIO17, _5));
6285 _for_each_inner_iomux_function!(((SD1_STROBE, SDn_STROBE, 1), GPIO23, _3));
6286 _for_each_inner_iomux_function!((all(CLK_OUT1, GPIO0, _1), (EMAC_TX_CLK, GPIO0,
6287 _5), (U0TXD, GPIO1, _0), (CLK_OUT3, GPIO1, _1), (EMAC_RXD2, GPIO1, _5), (HSPIWP,
6288 GPIO2, _1), (SD2_DATA0, GPIO2, _3), (SD_DATA0, GPIO2, _4), (U0RXD, GPIO3, _0),
6289 (CLK_OUT2, GPIO3, _1), (HSPIHD, GPIO4, _1), (SD2_DATA1, GPIO4, _3), (SD_DATA1,
6290 GPIO4, _4), (EMAC_TXER, GPIO4, _5), (VSPICS0, GPIO5, _1), (SD1_DATA6, GPIO5, _3),
6291 (EMAC_RX_CLK, GPIO5, _5), (SD_CLK, GPIO6, _0), (SPICLK, GPIO6, _1), (SD1_CLK,
6292 GPIO6, _3), (U1CTS, GPIO6, _4), (SD_DATA0, GPIO7, _0), (SPIQ, GPIO7, _1),
6293 (SD1_DATA0, GPIO7, _3), (U2RTS, GPIO7, _4), (SD_DATA1, GPIO8, _0), (SPID, GPIO8,
6294 _1), (SD1_DATA1, GPIO8, _3), (U2CTS, GPIO8, _4), (SD_DATA2, GPIO9, _0), (SPIHD,
6295 GPIO9, _1), (SD1_DATA2, GPIO9, _3), (U1RXD, GPIO9, _4), (SD_DATA3, GPIO10, _0),
6296 (SPIWP, GPIO10, _1), (SD1_DATA3, GPIO10, _3), (U1TXD, GPIO10, _4), (SD_CMD,
6297 GPIO11, _0), (SPICS0, GPIO11, _1), (SD1_CMD, GPIO11, _3), (U1RTS, GPIO11, _4),
6298 (MTDI, GPIO12, _0), (HSPIQ, GPIO12, _1), (SD2_DATA2, GPIO12, _3), (SD_DATA2,
6299 GPIO12, _4), (EMAC_TXD3, GPIO12, _5), (MTCK, GPIO13, _0), (HSPID, GPIO13, _1),
6300 (SD2_DATA3, GPIO13, _3), (SD_DATA3, GPIO13, _4), (EMAC_RXER, GPIO13, _5), (MTMS,
6301 GPIO14, _0), (HSPICLK, GPIO14, _1), (SD2_CLK, GPIO14, _3), (SD_CLK, GPIO14, _4),
6302 (EMAC_TXD2, GPIO14, _5), (MTDO, GPIO15, _0), (HSPICS0, GPIO15, _1), (SD2_CMD,
6303 GPIO15, _3), (SD_CMD, GPIO15, _4), (EMAC_RXD3, GPIO15, _5), (SD1_DATA4, GPIO16,
6304 _3), (U2RXD, GPIO16, _4), (EMAC_CLK_OUT, GPIO16, _5), (SD1_DATA5, GPIO17, _3),
6305 (U2TXD, GPIO17, _4), (EMAC_CLK_180, GPIO17, _5), (VSPICLK, GPIO18, _1),
6306 (SD1_DATA7, GPIO18, _3), (VSPIQ, GPIO19, _1), (U0CTS, GPIO19, _3), (EMAC_TXD0,
6307 GPIO19, _5), (VSPIHD, GPIO21, _1), (EMAC_TXEN, GPIO21, _5), (VSPIWP, GPIO22, _1),
6308 (U0RTS, GPIO22, _3), (EMAC_TXD1, GPIO22, _5), (VSPID, GPIO23, _1), (SD1_STROBE,
6309 GPIO23, _3), (EMAC_RXD0, GPIO25, _5), (EMAC_RXD1, GPIO26, _5), (EMAC_RXDV,
6310 GPIO27, _5))); _for_each_inner_iomux_function!((CLK_OUTn((CLK_OUT1, CLK_OUTn, 1),
6311 GPIO0, _1), ((CLK_OUT3, CLK_OUTn, 3), GPIO1, _1), ((CLK_OUT2, CLK_OUTn, 2),
6312 GPIO3, _1))); _for_each_inner_iomux_function!((EMAC_RXDn((EMAC_RXD2, EMAC_RXDn,
6313 2), GPIO1, _5), ((EMAC_RXD3, EMAC_RXDn, 3), GPIO15, _5), ((EMAC_RXD0, EMAC_RXDn,
6314 0), GPIO25, _5), ((EMAC_RXD1, EMAC_RXDn, 1), GPIO26, _5)));
6315 _for_each_inner_iomux_function!((SDn_DATAm((SD2_DATA0, SDn_DATAm, 2, 0), GPIO2,
6316 _3), ((SD2_DATA1, SDn_DATAm, 2, 1), GPIO4, _3), ((SD1_DATA6, SDn_DATAm, 1, 6),
6317 GPIO5, _3), ((SD1_DATA0, SDn_DATAm, 1, 0), GPIO7, _3), ((SD1_DATA1, SDn_DATAm, 1,
6318 1), GPIO8, _3), ((SD1_DATA2, SDn_DATAm, 1, 2), GPIO9, _3), ((SD1_DATA3,
6319 SDn_DATAm, 1, 3), GPIO10, _3), ((SD2_DATA2, SDn_DATAm, 2, 2), GPIO12, _3),
6320 ((SD2_DATA3, SDn_DATAm, 2, 3), GPIO13, _3), ((SD1_DATA4, SDn_DATAm, 1, 4),
6321 GPIO16, _3), ((SD1_DATA5, SDn_DATAm, 1, 5), GPIO17, _3), ((SD1_DATA7, SDn_DATAm,
6322 1, 7), GPIO18, _3))); _for_each_inner_iomux_function!((SD_DATAn((SD_DATA0,
6323 SD_DATAn, 0), GPIO2, _4), ((SD_DATA1, SD_DATAn, 1), GPIO4, _4), ((SD_DATA0,
6324 SD_DATAn, 0), GPIO7, _0), ((SD_DATA1, SD_DATAn, 1), GPIO8, _0), ((SD_DATA2,
6325 SD_DATAn, 2), GPIO9, _0), ((SD_DATA3, SD_DATAn, 3), GPIO10, _0), ((SD_DATA2,
6326 SD_DATAn, 2), GPIO12, _4), ((SD_DATA3, SD_DATAn, 3), GPIO13, _4)));
6327 _for_each_inner_iomux_function!((VSPICSn((VSPICS0, VSPICSn, 0), GPIO5, _1)));
6328 _for_each_inner_iomux_function!((SDn_CLK((SD1_CLK, SDn_CLK, 1), GPIO6, _3),
6329 ((SD2_CLK, SDn_CLK, 2), GPIO14, _3)));
6330 _for_each_inner_iomux_function!((SPICSn((SPICS0, SPICSn, 0), GPIO11, _1)));
6331 _for_each_inner_iomux_function!((SDn_CMD((SD1_CMD, SDn_CMD, 1), GPIO11, _3),
6332 ((SD2_CMD, SDn_CMD, 2), GPIO15, _3)));
6333 _for_each_inner_iomux_function!((EMAC_TXDn((EMAC_TXD3, EMAC_TXDn, 3), GPIO12,
6334 _5), ((EMAC_TXD2, EMAC_TXDn, 2), GPIO14, _5), ((EMAC_TXD0, EMAC_TXDn, 0), GPIO19,
6335 _5), ((EMAC_TXD1, EMAC_TXDn, 1), GPIO22, _5)));
6336 _for_each_inner_iomux_function!((HSPICSn((HSPICS0, HSPICSn, 0), GPIO15, _1)));
6337 _for_each_inner_iomux_function!((EMAC_CLK_n((EMAC_CLK_180, EMAC_CLK_n, 180),
6338 GPIO17, _5))); _for_each_inner_iomux_function!((SDn_STROBE((SD1_STROBE,
6339 SDn_STROBE, 1), GPIO23, _3)));
6340 };
6341}
6342#[macro_export]
6359#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6360macro_rules! gpio_for_signal {
6361 (CLK_OUT1 $(, $_fallback:literal)?) => {
6362 "GPIO0"
6363 };
6364 (EMAC_TX_CLK $(, $_fallback:literal)?) => {
6365 "GPIO0"
6366 };
6367 (ADC2_CH1 $(, $_fallback:literal)?) => {
6368 "GPIO0"
6369 };
6370 (TOUCH1 $(, $_fallback:literal)?) => {
6371 "GPIO0"
6372 };
6373 (LP_GPIO11 $(, $_fallback:literal)?) => {
6374 "GPIO0"
6375 };
6376 (SAR_I2C_SDA $(, $_fallback:literal)?) => {
6377 "GPIO0"
6378 };
6379 (U0TXD $(, $_fallback:literal)?) => {
6380 "GPIO1"
6381 };
6382 (CLK_OUT3 $(, $_fallback:literal)?) => {
6383 "GPIO1"
6384 };
6385 (EMAC_RXD2 $(, $_fallback:literal)?) => {
6386 "GPIO1"
6387 };
6388 (HSPIWP $(, $_fallback:literal)?) => {
6389 "GPIO2"
6390 };
6391 (SD2_DATA0 $(, $_fallback:literal)?) => {
6392 "GPIO2"
6393 };
6394 (SD_DATA0 $(, $_fallback:literal)?) => {
6395 "GPIO2"
6396 };
6397 (ADC2_CH2 $(, $_fallback:literal)?) => {
6398 "GPIO2"
6399 };
6400 (TOUCH2 $(, $_fallback:literal)?) => {
6401 "GPIO2"
6402 };
6403 (LP_GPIO12 $(, $_fallback:literal)?) => {
6404 "GPIO2"
6405 };
6406 (SAR_I2C_SCL $(, $_fallback:literal)?) => {
6407 "GPIO4"
6408 };
6409 (U0RXD $(, $_fallback:literal)?) => {
6410 "GPIO3"
6411 };
6412 (CLK_OUT2 $(, $_fallback:literal)?) => {
6413 "GPIO3"
6414 };
6415 (HSPIHD $(, $_fallback:literal)?) => {
6416 "GPIO4"
6417 };
6418 (SD2_DATA1 $(, $_fallback:literal)?) => {
6419 "GPIO4"
6420 };
6421 (SD_DATA1 $(, $_fallback:literal)?) => {
6422 "GPIO4"
6423 };
6424 (EMAC_TXER $(, $_fallback:literal)?) => {
6425 "GPIO4"
6426 };
6427 (ADC2_CH0 $(, $_fallback:literal)?) => {
6428 "GPIO4"
6429 };
6430 (TOUCH0 $(, $_fallback:literal)?) => {
6431 "GPIO4"
6432 };
6433 (LP_GPIO10 $(, $_fallback:literal)?) => {
6434 "GPIO4"
6435 };
6436 (VSPICS0 $(, $_fallback:literal)?) => {
6437 "GPIO5"
6438 };
6439 (SD1_DATA6 $(, $_fallback:literal)?) => {
6440 "GPIO5"
6441 };
6442 (EMAC_RX_CLK $(, $_fallback:literal)?) => {
6443 "GPIO5"
6444 };
6445 (SD_CLK $(, $_fallback:literal)?) => {
6446 "GPIO6"
6447 };
6448 (SPICLK $(, $_fallback:literal)?) => {
6449 "GPIO6"
6450 };
6451 (SD1_CLK $(, $_fallback:literal)?) => {
6452 "GPIO6"
6453 };
6454 (U1CTS $(, $_fallback:literal)?) => {
6455 "GPIO6"
6456 };
6457 (SPIQ $(, $_fallback:literal)?) => {
6458 "GPIO7"
6459 };
6460 (SD1_DATA0 $(, $_fallback:literal)?) => {
6461 "GPIO7"
6462 };
6463 (U2RTS $(, $_fallback:literal)?) => {
6464 "GPIO7"
6465 };
6466 (SPID $(, $_fallback:literal)?) => {
6467 "GPIO8"
6468 };
6469 (SD1_DATA1 $(, $_fallback:literal)?) => {
6470 "GPIO8"
6471 };
6472 (U2CTS $(, $_fallback:literal)?) => {
6473 "GPIO8"
6474 };
6475 (SD_DATA2 $(, $_fallback:literal)?) => {
6476 "GPIO9"
6477 };
6478 (SPIHD $(, $_fallback:literal)?) => {
6479 "GPIO9"
6480 };
6481 (SD1_DATA2 $(, $_fallback:literal)?) => {
6482 "GPIO9"
6483 };
6484 (U1RXD $(, $_fallback:literal)?) => {
6485 "GPIO9"
6486 };
6487 (SD_DATA3 $(, $_fallback:literal)?) => {
6488 "GPIO10"
6489 };
6490 (SPIWP $(, $_fallback:literal)?) => {
6491 "GPIO10"
6492 };
6493 (SD1_DATA3 $(, $_fallback:literal)?) => {
6494 "GPIO10"
6495 };
6496 (U1TXD $(, $_fallback:literal)?) => {
6497 "GPIO10"
6498 };
6499 (SD_CMD $(, $_fallback:literal)?) => {
6500 "GPIO11"
6501 };
6502 (SPICS0 $(, $_fallback:literal)?) => {
6503 "GPIO11"
6504 };
6505 (SD1_CMD $(, $_fallback:literal)?) => {
6506 "GPIO11"
6507 };
6508 (U1RTS $(, $_fallback:literal)?) => {
6509 "GPIO11"
6510 };
6511 (MTDI $(, $_fallback:literal)?) => {
6512 "GPIO12"
6513 };
6514 (HSPIQ $(, $_fallback:literal)?) => {
6515 "GPIO12"
6516 };
6517 (SD2_DATA2 $(, $_fallback:literal)?) => {
6518 "GPIO12"
6519 };
6520 (EMAC_TXD3 $(, $_fallback:literal)?) => {
6521 "GPIO12"
6522 };
6523 (ADC2_CH5 $(, $_fallback:literal)?) => {
6524 "GPIO12"
6525 };
6526 (TOUCH5 $(, $_fallback:literal)?) => {
6527 "GPIO12"
6528 };
6529 (LP_GPIO15 $(, $_fallback:literal)?) => {
6530 "GPIO12"
6531 };
6532 (MTCK $(, $_fallback:literal)?) => {
6533 "GPIO13"
6534 };
6535 (HSPID $(, $_fallback:literal)?) => {
6536 "GPIO13"
6537 };
6538 (SD2_DATA3 $(, $_fallback:literal)?) => {
6539 "GPIO13"
6540 };
6541 (EMAC_RXER $(, $_fallback:literal)?) => {
6542 "GPIO13"
6543 };
6544 (ADC2_CH4 $(, $_fallback:literal)?) => {
6545 "GPIO13"
6546 };
6547 (TOUCH4 $(, $_fallback:literal)?) => {
6548 "GPIO13"
6549 };
6550 (LP_GPIO14 $(, $_fallback:literal)?) => {
6551 "GPIO13"
6552 };
6553 (MTMS $(, $_fallback:literal)?) => {
6554 "GPIO14"
6555 };
6556 (HSPICLK $(, $_fallback:literal)?) => {
6557 "GPIO14"
6558 };
6559 (SD2_CLK $(, $_fallback:literal)?) => {
6560 "GPIO14"
6561 };
6562 (EMAC_TXD2 $(, $_fallback:literal)?) => {
6563 "GPIO14"
6564 };
6565 (ADC2_CH6 $(, $_fallback:literal)?) => {
6566 "GPIO14"
6567 };
6568 (TOUCH6 $(, $_fallback:literal)?) => {
6569 "GPIO14"
6570 };
6571 (LP_GPIO16 $(, $_fallback:literal)?) => {
6572 "GPIO14"
6573 };
6574 (MTDO $(, $_fallback:literal)?) => {
6575 "GPIO15"
6576 };
6577 (HSPICS0 $(, $_fallback:literal)?) => {
6578 "GPIO15"
6579 };
6580 (SD2_CMD $(, $_fallback:literal)?) => {
6581 "GPIO15"
6582 };
6583 (EMAC_RXD3 $(, $_fallback:literal)?) => {
6584 "GPIO15"
6585 };
6586 (ADC2_CH3 $(, $_fallback:literal)?) => {
6587 "GPIO15"
6588 };
6589 (TOUCH3 $(, $_fallback:literal)?) => {
6590 "GPIO15"
6591 };
6592 (LP_GPIO13 $(, $_fallback:literal)?) => {
6593 "GPIO15"
6594 };
6595 (SD1_DATA4 $(, $_fallback:literal)?) => {
6596 "GPIO16"
6597 };
6598 (U2RXD $(, $_fallback:literal)?) => {
6599 "GPIO16"
6600 };
6601 (EMAC_CLK_OUT $(, $_fallback:literal)?) => {
6602 "GPIO16"
6603 };
6604 (SD1_DATA5 $(, $_fallback:literal)?) => {
6605 "GPIO17"
6606 };
6607 (U2TXD $(, $_fallback:literal)?) => {
6608 "GPIO17"
6609 };
6610 (EMAC_CLK_180 $(, $_fallback:literal)?) => {
6611 "GPIO17"
6612 };
6613 (VSPICLK $(, $_fallback:literal)?) => {
6614 "GPIO18"
6615 };
6616 (SD1_DATA7 $(, $_fallback:literal)?) => {
6617 "GPIO18"
6618 };
6619 (VSPIQ $(, $_fallback:literal)?) => {
6620 "GPIO19"
6621 };
6622 (U0CTS $(, $_fallback:literal)?) => {
6623 "GPIO19"
6624 };
6625 (EMAC_TXD0 $(, $_fallback:literal)?) => {
6626 "GPIO19"
6627 };
6628 (VSPIHD $(, $_fallback:literal)?) => {
6629 "GPIO21"
6630 };
6631 (EMAC_TXEN $(, $_fallback:literal)?) => {
6632 "GPIO21"
6633 };
6634 (VSPIWP $(, $_fallback:literal)?) => {
6635 "GPIO22"
6636 };
6637 (U0RTS $(, $_fallback:literal)?) => {
6638 "GPIO22"
6639 };
6640 (EMAC_TXD1 $(, $_fallback:literal)?) => {
6641 "GPIO22"
6642 };
6643 (VSPID $(, $_fallback:literal)?) => {
6644 "GPIO23"
6645 };
6646 (SD1_STROBE $(, $_fallback:literal)?) => {
6647 "GPIO23"
6648 };
6649 (EMAC_RXD0 $(, $_fallback:literal)?) => {
6650 "GPIO25"
6651 };
6652 (DAC1 $(, $_fallback:literal)?) => {
6653 "GPIO25"
6654 };
6655 (ADC2_CH8 $(, $_fallback:literal)?) => {
6656 "GPIO25"
6657 };
6658 (LP_GPIO6 $(, $_fallback:literal)?) => {
6659 "GPIO25"
6660 };
6661 (EMAC_RXD1 $(, $_fallback:literal)?) => {
6662 "GPIO26"
6663 };
6664 (DAC2 $(, $_fallback:literal)?) => {
6665 "GPIO26"
6666 };
6667 (ADC2_CH9 $(, $_fallback:literal)?) => {
6668 "GPIO26"
6669 };
6670 (LP_GPIO7 $(, $_fallback:literal)?) => {
6671 "GPIO26"
6672 };
6673 (EMAC_RXDV $(, $_fallback:literal)?) => {
6674 "GPIO27"
6675 };
6676 (ADC2_CH7 $(, $_fallback:literal)?) => {
6677 "GPIO27"
6678 };
6679 (TOUCH7 $(, $_fallback:literal)?) => {
6680 "GPIO27"
6681 };
6682 (LP_GPIO17 $(, $_fallback:literal)?) => {
6683 "GPIO27"
6684 };
6685 (XTAL_32K_P $(, $_fallback:literal)?) => {
6686 "GPIO32"
6687 };
6688 (ADC1_CH4 $(, $_fallback:literal)?) => {
6689 "GPIO32"
6690 };
6691 (TOUCH9 $(, $_fallback:literal)?) => {
6692 "GPIO32"
6693 };
6694 (LP_GPIO9 $(, $_fallback:literal)?) => {
6695 "GPIO32"
6696 };
6697 (XTAL_32K_N $(, $_fallback:literal)?) => {
6698 "GPIO33"
6699 };
6700 (ADC1_CH5 $(, $_fallback:literal)?) => {
6701 "GPIO33"
6702 };
6703 (TOUCH8 $(, $_fallback:literal)?) => {
6704 "GPIO33"
6705 };
6706 (LP_GPIO8 $(, $_fallback:literal)?) => {
6707 "GPIO33"
6708 };
6709 (ADC1_CH6 $(, $_fallback:literal)?) => {
6710 "GPIO34"
6711 };
6712 (LP_GPIO4 $(, $_fallback:literal)?) => {
6713 "GPIO34"
6714 };
6715 (ADC1_CH7 $(, $_fallback:literal)?) => {
6716 "GPIO35"
6717 };
6718 (LP_GPIO5 $(, $_fallback:literal)?) => {
6719 "GPIO35"
6720 };
6721 (ADC_H $(, $_fallback:literal)?) => {
6722 "GPIO36"
6723 };
6724 (ADC1_CH0 $(, $_fallback:literal)?) => {
6725 "GPIO36"
6726 };
6727 (LP_GPIO0 $(, $_fallback:literal)?) => {
6728 "GPIO36"
6729 };
6730 (ADC1_CH1 $(, $_fallback:literal)?) => {
6731 "GPIO37"
6732 };
6733 (LP_GPIO1 $(, $_fallback:literal)?) => {
6734 "GPIO37"
6735 };
6736 (ADC1_CH2 $(, $_fallback:literal)?) => {
6737 "GPIO38"
6738 };
6739 (LP_GPIO2 $(, $_fallback:literal)?) => {
6740 "GPIO38"
6741 };
6742 (ADC1_CH3 $(, $_fallback:literal)?) => {
6743 "GPIO39"
6744 };
6745 (LP_GPIO3 $(, $_fallback:literal)?) => {
6746 "GPIO39"
6747 };
6748 ($_signal:ident, $fallback:literal) => {
6749 $fallback
6750 };
6751}
6752#[macro_export]
6756#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6757macro_rules! define_io_mux_signals {
6758 () => {
6759 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6760 #[derive(Debug, PartialEq, Copy, Clone)]
6761 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6762 #[doc(hidden)]
6763 pub enum InputSignal {
6764 SPICLK = 0,
6765 SPIQ = 1,
6766 SPID = 2,
6767 SPIHD = 3,
6768 SPIWP = 4,
6769 SPICS0 = 5,
6770 SPICS1 = 6,
6771 SPICS2 = 7,
6772 HSPICLK = 8,
6773 HSPIQ = 9,
6774 HSPID = 10,
6775 HSPICS0 = 11,
6776 HSPIHD = 12,
6777 HSPIWP = 13,
6778 U0RXD = 14,
6779 U0CTS = 15,
6780 U0DSR = 16,
6781 U1RXD = 17,
6782 U1CTS = 18,
6783 I2S0O_BCK = 23,
6784 I2S1O_BCK = 24,
6785 I2S0O_WS = 25,
6786 I2S1O_WS = 26,
6787 I2S0I_BCK = 27,
6788 I2S0I_WS = 28,
6789 I2CEXT0_SCL = 29,
6790 I2CEXT0_SDA = 30,
6791 PWM0_SYNC0 = 31,
6792 PWM0_SYNC1 = 32,
6793 PWM0_SYNC2 = 33,
6794 PWM0_F0 = 34,
6795 PWM0_F1 = 35,
6796 PWM0_F2 = 36,
6797 PCNT0_SIG_CH0 = 39,
6798 PCNT0_SIG_CH1 = 40,
6799 PCNT0_CTRL_CH0 = 41,
6800 PCNT0_CTRL_CH1 = 42,
6801 PCNT1_SIG_CH0 = 43,
6802 PCNT1_SIG_CH1 = 44,
6803 PCNT1_CTRL_CH0 = 45,
6804 PCNT1_CTRL_CH1 = 46,
6805 PCNT2_SIG_CH0 = 47,
6806 PCNT2_SIG_CH1 = 48,
6807 PCNT2_CTRL_CH0 = 49,
6808 PCNT2_CTRL_CH1 = 50,
6809 PCNT3_SIG_CH0 = 51,
6810 PCNT3_SIG_CH1 = 52,
6811 PCNT3_CTRL_CH0 = 53,
6812 PCNT3_CTRL_CH1 = 54,
6813 PCNT4_SIG_CH0 = 55,
6814 PCNT4_SIG_CH1 = 56,
6815 PCNT4_CTRL_CH0 = 57,
6816 PCNT4_CTRL_CH1 = 58,
6817 HSPICS1 = 61,
6818 HSPICS2 = 62,
6819 VSPICLK = 63,
6820 VSPIQ = 64,
6821 VSPID = 65,
6822 VSPIHD = 66,
6823 VSPIWP = 67,
6824 VSPICS0 = 68,
6825 VSPICS1 = 69,
6826 VSPICS2 = 70,
6827 PCNT5_SIG_CH0 = 71,
6828 PCNT5_SIG_CH1 = 72,
6829 PCNT5_CTRL_CH0 = 73,
6830 PCNT5_CTRL_CH1 = 74,
6831 PCNT6_SIG_CH0 = 75,
6832 PCNT6_SIG_CH1 = 76,
6833 PCNT6_CTRL_CH0 = 77,
6834 PCNT6_CTRL_CH1 = 78,
6835 PCNT7_SIG_CH0 = 79,
6836 PCNT7_SIG_CH1 = 80,
6837 PCNT7_CTRL_CH0 = 81,
6838 PCNT7_CTRL_CH1 = 82,
6839 RMT_SIG_0 = 83,
6840 RMT_SIG_1 = 84,
6841 RMT_SIG_2 = 85,
6842 RMT_SIG_3 = 86,
6843 RMT_SIG_4 = 87,
6844 RMT_SIG_5 = 88,
6845 RMT_SIG_6 = 89,
6846 RMT_SIG_7 = 90,
6847 TWAI_RX = 94,
6848 I2CEXT1_SCL = 95,
6849 I2CEXT1_SDA = 96,
6850 HOST_CARD_DETECT_N_1 = 97,
6851 HOST_CARD_DETECT_N_2 = 98,
6852 HOST_CARD_WRITE_PRT_1 = 99,
6853 HOST_CARD_WRITE_PRT_2 = 100,
6854 HOST_CARD_INT_N_1 = 101,
6855 HOST_CARD_INT_N_2 = 102,
6856 PWM1_SYNC0 = 103,
6857 PWM1_SYNC1 = 104,
6858 PWM1_SYNC2 = 105,
6859 PWM1_F0 = 106,
6860 PWM1_F1 = 107,
6861 PWM1_F2 = 108,
6862 PWM0_CAP0 = 109,
6863 PWM0_CAP1 = 110,
6864 PWM0_CAP2 = 111,
6865 PWM1_CAP0 = 112,
6866 PWM1_CAP1 = 113,
6867 PWM1_CAP2 = 114,
6868 I2S0I_DATA_0 = 140,
6869 I2S0I_DATA_1 = 141,
6870 I2S0I_DATA_2 = 142,
6871 I2S0I_DATA_3 = 143,
6872 I2S0I_DATA_4 = 144,
6873 I2S0I_DATA_5 = 145,
6874 I2S0I_DATA_6 = 146,
6875 I2S0I_DATA_7 = 147,
6876 I2S0I_DATA_8 = 148,
6877 I2S0I_DATA_9 = 149,
6878 I2S0I_DATA_10 = 150,
6879 I2S0I_DATA_11 = 151,
6880 I2S0I_DATA_12 = 152,
6881 I2S0I_DATA_13 = 153,
6882 I2S0I_DATA_14 = 154,
6883 I2S0I_DATA_15 = 155,
6884 I2S1I_BCK = 164,
6885 I2S1I_WS = 165,
6886 I2S1I_DATA_0 = 166,
6887 I2S1I_DATA_1 = 167,
6888 I2S1I_DATA_2 = 168,
6889 I2S1I_DATA_3 = 169,
6890 I2S1I_DATA_4 = 170,
6891 I2S1I_DATA_5 = 171,
6892 I2S1I_DATA_6 = 172,
6893 I2S1I_DATA_7 = 173,
6894 I2S1I_DATA_8 = 174,
6895 I2S1I_DATA_9 = 175,
6896 I2S1I_DATA_10 = 176,
6897 I2S1I_DATA_11 = 177,
6898 I2S1I_DATA_12 = 178,
6899 I2S1I_DATA_13 = 179,
6900 I2S1I_DATA_14 = 180,
6901 I2S1I_DATA_15 = 181,
6902 I2S0I_H_SYNC = 190,
6903 I2S0I_V_SYNC = 191,
6904 I2S0I_H_ENABLE = 192,
6905 I2S1I_H_SYNC = 193,
6906 I2S1I_V_SYNC = 194,
6907 I2S1I_H_ENABLE = 195,
6908 U2RXD = 198,
6909 U2CTS = 199,
6910 EMAC_MDC = 200,
6911 EMAC_MDI = 201,
6912 EMAC_CRS = 202,
6913 EMAC_COL = 203,
6914 PCMFSYNC = 204,
6915 PCMCLK = 205,
6916 PCMDIN = 206,
6917 SD_CMD,
6918 SD_DATA0,
6919 SD_DATA1,
6920 SD_DATA2,
6921 SD_DATA3,
6922 SD1_DATA0,
6923 SD1_DATA1,
6924 SD1_DATA2,
6925 SD1_DATA3,
6926 SD1_DATA4,
6927 SD1_DATA5,
6928 SD1_DATA6,
6929 SD1_DATA7,
6930 SD2_DATA0,
6931 SD2_DATA1,
6932 SD2_DATA2,
6933 SD2_DATA3,
6934 EMAC_TX_CLK,
6935 EMAC_RXD2,
6936 EMAC_TXER,
6937 EMAC_RX_CLK,
6938 EMAC_RXER,
6939 EMAC_RXD3,
6940 EMAC_RXD0,
6941 EMAC_RXD1,
6942 EMAC_RXDV,
6943 MTDI,
6944 MTCK,
6945 MTMS,
6946 }
6947 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6948 #[derive(Debug, PartialEq, Copy, Clone)]
6949 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6950 #[doc(hidden)]
6951 pub enum OutputSignal {
6952 SPICLK = 0,
6953 SPIQ = 1,
6954 SPID = 2,
6955 SPIHD = 3,
6956 SPIWP = 4,
6957 SPICS0 = 5,
6958 SPICS1 = 6,
6959 SPICS2 = 7,
6960 HSPICLK = 8,
6961 HSPIQ = 9,
6962 HSPID = 10,
6963 HSPICS0 = 11,
6964 HSPIHD = 12,
6965 HSPIWP = 13,
6966 U0TXD = 14,
6967 U0RTS = 15,
6968 U0DTR = 16,
6969 U1TXD = 17,
6970 U1RTS = 18,
6971 I2S0O_BCK = 23,
6972 I2S1O_BCK = 24,
6973 I2S0O_WS = 25,
6974 I2S1O_WS = 26,
6975 I2S0I_BCK = 27,
6976 I2S0I_WS = 28,
6977 I2CEXT0_SCL = 29,
6978 I2CEXT0_SDA = 30,
6979 SDIO_TOHOST_INT = 31,
6980 PWM0_0A = 32,
6981 PWM0_0B = 33,
6982 PWM0_1A = 34,
6983 PWM0_1B = 35,
6984 PWM0_2A = 36,
6985 PWM0_2B = 37,
6986 HSPICS1 = 61,
6987 HSPICS2 = 62,
6988 VSPICLK = 63,
6989 VSPIQ = 64,
6990 VSPID = 65,
6991 VSPIHD = 66,
6992 VSPIWP = 67,
6993 VSPICS0 = 68,
6994 VSPICS1 = 69,
6995 VSPICS2 = 70,
6996 LEDC_HS_SIG0 = 71,
6997 LEDC_HS_SIG1 = 72,
6998 LEDC_HS_SIG2 = 73,
6999 LEDC_HS_SIG3 = 74,
7000 LEDC_HS_SIG4 = 75,
7001 LEDC_HS_SIG5 = 76,
7002 LEDC_HS_SIG6 = 77,
7003 LEDC_HS_SIG7 = 78,
7004 LEDC_LS_SIG0 = 79,
7005 LEDC_LS_SIG1 = 80,
7006 LEDC_LS_SIG2 = 81,
7007 LEDC_LS_SIG3 = 82,
7008 LEDC_LS_SIG4 = 83,
7009 LEDC_LS_SIG5 = 84,
7010 LEDC_LS_SIG6 = 85,
7011 LEDC_LS_SIG7 = 86,
7012 RMT_SIG_0 = 87,
7013 RMT_SIG_1 = 88,
7014 RMT_SIG_2 = 89,
7015 RMT_SIG_3 = 90,
7016 RMT_SIG_4 = 91,
7017 RMT_SIG_5 = 92,
7018 RMT_SIG_6 = 93,
7019 RMT_SIG_7 = 94,
7020 I2CEXT1_SCL = 95,
7021 I2CEXT1_SDA = 96,
7022 HOST_CCMD_OD_PULLUP_EN_N = 97,
7023 HOST_RST_N_1 = 98,
7024 HOST_RST_N_2 = 99,
7025 GPIO_SD0 = 100,
7026 GPIO_SD1 = 101,
7027 GPIO_SD2 = 102,
7028 GPIO_SD3 = 103,
7029 GPIO_SD4 = 104,
7030 GPIO_SD5 = 105,
7031 GPIO_SD6 = 106,
7032 GPIO_SD7 = 107,
7033 PWM1_0A = 108,
7034 PWM1_0B = 109,
7035 PWM1_1A = 110,
7036 PWM1_1B = 111,
7037 PWM1_2A = 112,
7038 PWM1_2B = 113,
7039 TWAI_TX = 123,
7040 TWAI_BUS_OFF_ON = 124,
7041 TWAI_CLKOUT = 125,
7042 I2S0O_DATA_0 = 140,
7043 I2S0O_DATA_1 = 141,
7044 I2S0O_DATA_2 = 142,
7045 I2S0O_DATA_3 = 143,
7046 I2S0O_DATA_4 = 144,
7047 I2S0O_DATA_5 = 145,
7048 I2S0O_DATA_6 = 146,
7049 I2S0O_DATA_7 = 147,
7050 I2S0O_DATA_8 = 148,
7051 I2S0O_DATA_9 = 149,
7052 I2S0O_DATA_10 = 150,
7053 I2S0O_DATA_11 = 151,
7054 I2S0O_DATA_12 = 152,
7055 I2S0O_DATA_13 = 153,
7056 I2S0O_DATA_14 = 154,
7057 I2S0O_DATA_15 = 155,
7058 I2S0O_DATA_16 = 156,
7059 I2S0O_DATA_17 = 157,
7060 I2S0O_DATA_18 = 158,
7061 I2S0O_DATA_19 = 159,
7062 I2S0O_DATA_20 = 160,
7063 I2S0O_DATA_21 = 161,
7064 I2S0O_DATA_22 = 162,
7065 I2S0O_DATA_23 = 163,
7066 I2S1I_BCK = 164,
7067 I2S1I_WS = 165,
7068 I2S1O_DATA_0 = 166,
7069 I2S1O_DATA_1 = 167,
7070 I2S1O_DATA_2 = 168,
7071 I2S1O_DATA_3 = 169,
7072 I2S1O_DATA_4 = 170,
7073 I2S1O_DATA_5 = 171,
7074 I2S1O_DATA_6 = 172,
7075 I2S1O_DATA_7 = 173,
7076 I2S1O_DATA_8 = 174,
7077 I2S1O_DATA_9 = 175,
7078 I2S1O_DATA_10 = 176,
7079 I2S1O_DATA_11 = 177,
7080 I2S1O_DATA_12 = 178,
7081 I2S1O_DATA_13 = 179,
7082 I2S1O_DATA_14 = 180,
7083 I2S1O_DATA_15 = 181,
7084 I2S1O_DATA_16 = 182,
7085 I2S1O_DATA_17 = 183,
7086 I2S1O_DATA_18 = 184,
7087 I2S1O_DATA_19 = 185,
7088 I2S1O_DATA_20 = 186,
7089 I2S1O_DATA_21 = 187,
7090 I2S1O_DATA_22 = 188,
7091 I2S1O_DATA_23 = 189,
7092 U2TXD = 198,
7093 U2RTS = 199,
7094 EMAC_MDC = 200,
7095 EMAC_MDO = 201,
7096 EMAC_CRS = 202,
7097 EMAC_COL = 203,
7098 BT_AUDIO0RQ = 204,
7099 BT_AUDIO1RQ = 205,
7100 BT_AUDIO2RQ = 206,
7101 BLE_AUDIO0RQ = 207,
7102 BLE_AUDIO1RQ = 208,
7103 BLE_AUDIO2RQ = 209,
7104 PCMFSYNC = 210,
7105 PCMCLK = 211,
7106 PCMDOUT = 212,
7107 BLE_AUDIO_SYNC0_P = 213,
7108 BLE_AUDIO_SYNC1_P = 214,
7109 BLE_AUDIO_SYNC2_P = 215,
7110 ANT_SEL0 = 216,
7111 ANT_SEL1 = 217,
7112 ANT_SEL2 = 218,
7113 ANT_SEL3 = 219,
7114 ANT_SEL4 = 220,
7115 ANT_SEL5 = 221,
7116 ANT_SEL6 = 222,
7117 ANT_SEL7 = 223,
7118 SIGNAL_224 = 224,
7119 SIGNAL_225 = 225,
7120 SIGNAL_226 = 226,
7121 SIGNAL_227 = 227,
7122 SIGNAL_228 = 228,
7123 GPIO = 256,
7124 CLK_OUT1,
7125 CLK_OUT2,
7126 CLK_OUT3,
7127 SD_CLK,
7128 SD_CMD,
7129 SD_DATA0,
7130 SD_DATA1,
7131 SD_DATA2,
7132 SD_DATA3,
7133 SD1_CLK,
7134 SD1_CMD,
7135 SD1_DATA0,
7136 SD1_DATA1,
7137 SD1_DATA2,
7138 SD1_DATA3,
7139 SD1_DATA4,
7140 SD1_DATA5,
7141 SD1_DATA6,
7142 SD1_DATA7,
7143 SD1_STROBE,
7144 SD2_CLK,
7145 SD2_CMD,
7146 SD2_DATA0,
7147 SD2_DATA1,
7148 SD2_DATA2,
7149 SD2_DATA3,
7150 EMAC_TX_CLK,
7151 EMAC_TXER,
7152 EMAC_TXD3,
7153 EMAC_RXER,
7154 EMAC_TXD2,
7155 EMAC_CLK_OUT,
7156 EMAC_CLK_180,
7157 EMAC_TXD0,
7158 EMAC_TXEN,
7159 EMAC_TXD1,
7160 MTDO,
7161 }
7162 };
7163}
7164#[macro_export]
7171#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7172macro_rules! define_lp_functions {
7173 () => {
7174 #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
7179 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
7180 #[doc(hidden)]
7181 pub enum LpFunction {
7182 _0 = 0,
7184 _3 = 3,
7186 }
7187 impl LpFunction {
7188 pub const LP_GPIO: Self = Self::_0;
7190 }
7191 };
7192}
7193#[macro_export]
7206#[expect(clippy::crate_in_macro_def)]
7207#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7208macro_rules! define_io_mux_reg {
7209 () => {
7210 pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO0 {
7211 let iomux = crate::peripherals::IO_MUX::regs();
7212 match gpio_num {
7213 0 => iomux.gpio0(),
7214 1 => iomux.gpio1(),
7215 2 => iomux.gpio2(),
7216 3 => iomux.gpio3(),
7217 4 => iomux.gpio4(),
7218 5 => iomux.gpio5(),
7219 6 => iomux.gpio6(),
7220 7 => iomux.gpio7(),
7221 8 => iomux.gpio8(),
7222 9 => iomux.gpio9(),
7223 10 => iomux.gpio10(),
7224 11 => iomux.gpio11(),
7225 12 => iomux.gpio12(),
7226 13 => iomux.gpio13(),
7227 14 => iomux.gpio14(),
7228 15 => iomux.gpio15(),
7229 16 => iomux.gpio16(),
7230 17 => iomux.gpio17(),
7231 18 => iomux.gpio18(),
7232 19 => iomux.gpio19(),
7233 20 => iomux.gpio20(),
7234 21 => iomux.gpio21(),
7235 22 => iomux.gpio22(),
7236 23 => iomux.gpio23(),
7237 25 => iomux.gpio25(),
7238 26 => iomux.gpio26(),
7239 27 => iomux.gpio27(),
7240 32 => iomux.gpio32(),
7241 33 => iomux.gpio33(),
7242 34 => iomux.gpio34(),
7243 35 => iomux.gpio35(),
7244 36 => iomux.gpio36(),
7245 37 => iomux.gpio37(),
7246 38 => iomux.gpio38(),
7247 39 => iomux.gpio39(),
7248 other => panic!("GPIO {} does not exist", other),
7249 }
7250 }
7251 };
7252}