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 "esp32s3"
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-S3"
34 };
35}
36#[macro_export]
38#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
39macro_rules! property {
40 ("chip") => {
41 "esp32s3"
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-s3_technical_reference_manual_en.pdf"
54 };
55 ("gpio.version") => {
56 2
57 };
58 ("gpio.version", str) => {
59 stringify!(2)
60 };
61 ("gpio.has_input_sync") => {
62 true
63 };
64 ("gpio.gpio_function") => {
65 1
66 };
67 ("gpio.gpio_function", str) => {
68 stringify!(1)
69 };
70 ("gpio.constant_0_input") => {
71 60
72 };
73 ("gpio.constant_0_input", str) => {
74 stringify!(60)
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 false
84 };
85 ("gpio.func_in_sel_offset") => {
86 0
87 };
88 ("gpio.func_in_sel_offset", str) => {
89 stringify!(0)
90 };
91 ("gpio.has_bank_1") => {
92 true
93 };
94 ("gpio.input_signal_max") => {
95 255
96 };
97 ("gpio.input_signal_max", str) => {
98 stringify!(255)
99 };
100 ("gpio.output_signal_max") => {
101 256
102 };
103 ("gpio.output_signal_max", str) => {
104 stringify!(256)
105 };
106 ("dedicated_gpio.version") => {
107 "esp32s3"
108 };
109 ("dedicated_gpio.needs_initialization") => {
110 true
111 };
112 ("dedicated_gpio.channel_count") => {
113 8
114 };
115 ("dedicated_gpio.channel_count", str) => {
116 stringify!(8)
117 };
118 ("lp_io.version") => {
119 "v2"
120 };
121 ("lp_io.has_gpio_matrix") => {
122 false
123 };
124 ("uart.ram_size") => {
125 128
126 };
127 ("uart.ram_size", str) => {
128 stringify!(128)
129 };
130 ("uart.version") => {
131 1
132 };
133 ("uart.version", str) => {
134 stringify!(1)
135 };
136 ("uart.peripheral_controls_mem_clk") => {
137 false
138 };
139 ("uart.has_sclk_divider") => {
140 true
141 };
142 ("uart.has_sclk_enable") => {
143 true
144 };
145 ("uhci.combined_uart_selector_field") => {
146 false
147 };
148 ("i2c_master.version") => {
149 3
150 };
151 ("i2c_master.version", str) => {
152 stringify!(3)
153 };
154 ("i2c_master.has_fsm_timeouts") => {
155 true
156 };
157 ("i2c_master.has_hw_bus_clear") => {
158 false
159 };
160 ("i2c_master.has_bus_timeout_enable") => {
161 true
162 };
163 ("i2c_master.separate_filter_config_registers") => {
164 false
165 };
166 ("i2c_master.can_estimate_nack_reason") => {
167 true
168 };
169 ("i2c_master.has_conf_update") => {
170 true
171 };
172 ("i2c_master.has_reliable_fsm_reset") => {
173 false
174 };
175 ("i2c_master.has_arbitration_en") => {
176 true
177 };
178 ("i2c_master.has_tx_fifo_watermark") => {
179 true
180 };
181 ("i2c_master.bus_timeout_is_exponential") => {
182 true
183 };
184 ("i2c_master.has_pd_en") => {
185 true
186 };
187 ("i2c_master.max_bus_timeout") => {
188 31
189 };
190 ("i2c_master.max_bus_timeout", str) => {
191 stringify!(31)
192 };
193 ("i2c_master.ll_intr_mask") => {
194 262143
195 };
196 ("i2c_master.ll_intr_mask", str) => {
197 stringify!(262143)
198 };
199 ("i2c_master.fifo_size") => {
200 32
201 };
202 ("i2c_master.fifo_size", str) => {
203 stringify!(32)
204 };
205 ("lp_i2c_master.version") => {
206 "rtc_i2c"
207 };
208 ("spi_master.version") => {
209 3
210 };
211 ("spi_master.version", str) => {
212 stringify!(3)
213 };
214 ("spi_master.fifo_size") => {
215 64
216 };
217 ("spi_master.fifo_size", str) => {
218 stringify!(64)
219 };
220 ("spi_master.bit_order_is_bool") => {
221 false
222 };
223 ("spi_master.has_octal") => {
224 true
225 };
226 ("spi_master.has_app_interrupts") => {
227 true
228 };
229 ("spi_master.has_dma_segmented_transfer") => {
230 true
231 };
232 ("spi_master.has_clk_pre_div") => {
233 false
234 };
235 ("spi_master.dma_can_access_flash") => {
236 false
237 };
238 ("i2s.version") => {
239 2
240 };
241 ("i2s.version", str) => {
242 stringify!(2)
243 };
244 ("i2s.mclk_divider_bit_width") => {
245 9
246 };
247 ("i2s.mclk_divider_bit_width", str) => {
248 stringify!(9)
249 };
250 ("i2s.max_ws_width") => {
251 128
252 };
253 ("i2s.max_ws_width", str) => {
254 stringify!(128)
255 };
256 ("i2s.clock_configured_by_pcr") => {
257 false
258 };
259 ("i2s.clock_configured_by_hp_sys_clkrst") => {
260 false
261 };
262 ("i2s.supports_pdm_rx_hp_filter") => {
263 false
264 };
265 ("i2s.supports_pdm_tx") => {
266 true
267 };
268 ("i2s.supports_pdm_rx") => {
269 true
270 };
271 ("i2s.supports_pcm2pdm") => {
272 true
273 };
274 ("i2s.supports_pdm2pcm") => {
275 true
276 };
277 ("rmt.ram_start") => {
278 1610704896
279 };
280 ("rmt.ram_start", str) => {
281 stringify!(1610704896)
282 };
283 ("rmt.channel_ram_size") => {
284 48
285 };
286 ("rmt.channel_ram_size", str) => {
287 stringify!(48)
288 };
289 ("rmt.has_tx_immediate_stop") => {
290 true
291 };
292 ("rmt.has_tx_loop_count") => {
293 true
294 };
295 ("rmt.has_tx_loop_auto_stop") => {
296 true
297 };
298 ("rmt.has_tx_carrier_data_only") => {
299 true
300 };
301 ("rmt.has_tx_sync") => {
302 true
303 };
304 ("rmt.has_rx_wrap") => {
305 true
306 };
307 ("rmt.has_rx_demodulation") => {
308 true
309 };
310 ("rmt.has_per_channel_clock") => {
311 false
312 };
313 ("sdmmc.delay_phase_num") => {
314 4
315 };
316 ("sdmmc.delay_phase_num", str) => {
317 stringify!(4)
318 };
319 ("sdmmc.has_iomux") => {
320 false
321 };
322 ("sdmmc.has_gpio_matrix") => {
323 true
324 };
325 ("sdmmc.psram_dma") => {
326 false
327 };
328 ("sdmmc.uhs") => {
329 false
330 };
331 ("usb_otg.fifo_depth_words") => {
332 256
333 };
334 ("usb_otg.fifo_depth_words", str) => {
335 stringify!(256)
336 };
337 ("bt.controller") => {
338 "btdm"
339 };
340 ("wifi.has_wifi6") => {
341 false
342 };
343 ("wifi.mac_version") => {
344 1
345 };
346 ("wifi.mac_version", str) => {
347 stringify!(1)
348 };
349 ("wifi.has_5g") => {
350 false
351 };
352 ("wifi.csi_supported") => {
353 true
354 };
355 ("phy.combo_module") => {
356 true
357 };
358 ("phy.backed_up_digital_register_count") => {
359 21
360 };
361 ("phy.backed_up_digital_register_count", str) => {
362 stringify!(21)
363 };
364 ("rgb_display.output_lines") => {
365 16
366 };
367 ("rgb_display.output_lines", str) => {
368 stringify!(16)
369 };
370 ("ledc.version") => {
371 2
372 };
373 ("ledc.version", str) => {
374 stringify!(2)
375 };
376 ("ledc.channel_count") => {
377 8
378 };
379 ("ledc.channel_count", str) => {
380 stringify!(8)
381 };
382 ("sdm.channel_count") => {
383 8
384 };
385 ("sdm.channel_count", str) => {
386 stringify!(8)
387 };
388 ("timergroup.timg_has_timer1") => {
389 true
390 };
391 ("timergroup.timg_has_divcnt_rst") => {
392 false
393 };
394 ("aes.has_split_text_registers") => {
395 true
396 };
397 ("aes.endianness_configurable") => {
398 false
399 };
400 ("rng.apb_cycle_wait_num") => {
401 16
402 };
403 ("rng.apb_cycle_wait_num", str) => {
404 stringify!(16)
405 };
406 ("rng.trng_supported") => {
407 true
408 };
409 ("rng.is_lp_sys") => {
410 false
411 };
412 ("rsa.version") => {
413 2
414 };
415 ("rsa.version", str) => {
416 stringify!(2)
417 };
418 ("rsa.size_increment") => {
419 32
420 };
421 ("rsa.size_increment", str) => {
422 stringify!(32)
423 };
424 ("rsa.memory_size_bytes") => {
425 512
426 };
427 ("rsa.memory_size_bytes", str) => {
428 stringify!(512)
429 };
430 ("sleep.light_sleep") => {
431 true
432 };
433 ("sleep.deep_sleep") => {
434 true
435 };
436 ("sleep.rejectable_mask") => {
437 11583
438 };
439 ("sleep.ext1_version") => {
440 1
441 };
442 ("sleep.ext1_version", str) => {
443 stringify!(1)
444 };
445 ("sleep.pin_wakeup_version") => {
446 1
447 };
448 ("sleep.pin_wakeup_version", str) => {
449 stringify!(1)
450 };
451 ("sleep.deep_sleep_needs_gpio_isolation") => {
452 true
453 };
454 ("assist_debug.has_sp_monitor") => {
455 false
456 };
457 ("assist_debug.has_region_monitor") => {
458 true
459 };
460 ("dma.mem2mem_requires_peripheral") => {
461 true
462 };
463 ("dma.ext_mem_configurable_block_size") => {
464 true
465 };
466 ("dma.separate_in_out_interrupts") => {
467 true
468 };
469 ("dma.gdma_version") => {
470 1
471 };
472 ("dma.gdma_version", str) => {
473 stringify!(1)
474 };
475 ("interrupts.status_registers") => {
476 4
477 };
478 ("interrupts.status_registers", str) => {
479 stringify!(4)
480 };
481 ("mmu.page_size") => {
482 65536
483 };
484 ("mmu.page_size", str) => {
485 stringify!(65536)
486 };
487 ("mmu.entry_num") => {
488 384
489 };
490 ("mmu.entry_num", str) => {
491 stringify!(384)
492 };
493 ("psram.octal_spi") => {
494 true
495 };
496 ("psram.hex_spi") => {
497 false
498 };
499 ("psram.extmem_origin") => {
500 1006632960
501 };
502 ("psram.extmem_origin", str) => {
503 stringify!(1006632960)
504 };
505 ("rom.has_crc_le") => {
506 true
507 };
508 ("rom.has_crc_be") => {
509 true
510 };
511 ("rom.has_md5_bsd") => {
512 true
513 };
514 ("rom.has_md5_mbedtls") => {
515 false
516 };
517 ("soc.cpu_has_branch_predictor") => {
518 false
519 };
520 ("soc.cpu_has_csr_pc") => {
521 false
522 };
523 ("soc.multi_core_enabled") => {
524 true
525 };
526 ("soc.internal_memory_cached") => {
527 false
528 };
529 ("soc.has_swd_watchdog") => {
530 true
531 };
532 ("soc.cpu_mcause_mask") => {
533 0
534 };
535 ("soc.cpu_mcause_mask", str) => {
536 stringify!(0)
537 };
538 ("clock_tree.system_pre_div_in") => {
539 [crate ::soc::clocks::SystemPreDivInConfig::Xtal, crate
540 ::soc::clocks::SystemPreDivInConfig::RcFast]
541 };
542 ("clock_tree.system_pre_div.divisor") => {
543 (0, 1023)
544 };
545 ("clock_tree.cpu_clk") => {
546 [crate ::soc::clocks::CpuClkConfig::Xtal, crate
547 ::soc::clocks::CpuClkConfig::RcFast, crate ::soc::clocks::CpuClkConfig::Pll]
548 };
549 ("clock_tree.apb_clk") => {
550 [crate ::soc::clocks::ApbClkConfig::Pll, crate ::soc::clocks::ApbClkConfig::Cpu]
551 };
552 ("clock_tree.crypto_pwm_clk") => {
553 [crate ::soc::clocks::CryptoPwmClkConfig::Pll, crate
554 ::soc::clocks::CryptoPwmClkConfig::Cpu]
555 };
556 ("clock_tree.rc_fast_clk_div_n.divisor") => {
557 (0, 3)
558 };
559 ("clock_tree.rtc_slow_clk") => {
560 [#[cfg(use_xtal32k)] crate ::soc::clocks::RtcSlowClkConfig::Xtal32k, crate
561 ::soc::clocks::RtcSlowClkConfig::RcSlow, crate
562 ::soc::clocks::RtcSlowClkConfig::RcFast]
563 };
564 ("clock_tree.rtc_fast_clk") => {
565 [crate ::soc::clocks::RtcFastClkConfig::Xtal, crate
566 ::soc::clocks::RtcFastClkConfig::Rc]
567 };
568 ("clock_tree.low_power_clk") => {
569 [crate ::soc::clocks::LowPowerClkConfig::Xtal, crate
570 ::soc::clocks::LowPowerClkConfig::RcFast, #[cfg(use_xtal32k)] crate
571 ::soc::clocks::LowPowerClkConfig::Xtal32k, crate
572 ::soc::clocks::LowPowerClkConfig::RtcSlow]
573 };
574 ("clock_tree.timg_calibration_clock") => {
575 [crate ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, crate
576 ::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
577 crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
578 };
579 ("clock_tree.timg.function_clock") => {
580 [crate ::soc::clocks::TimgFunctionClockConfig::XtalClk, crate
581 ::soc::clocks::TimgFunctionClockConfig::ApbClk]
582 };
583 ("clock_tree.rmt.sclk") => {
584 [crate ::soc::clocks::RmtSclkConfig::ApbClk, crate
585 ::soc::clocks::RmtSclkConfig::RcFastClk, crate
586 ::soc::clocks::RmtSclkConfig::XtalClk]
587 };
588 ("clock_tree.uart.function_clock.sclk") => {
589 [crate ::soc::clocks::UartFunctionClockSclk::Apb, crate
590 ::soc::clocks::UartFunctionClockSclk::RcFast, crate
591 ::soc::clocks::UartFunctionClockSclk::Xtal]
592 };
593 ("clock_tree.uart.function_clock.div_num") => {
594 (0, 255)
595 };
596 ("clock_tree.uart.baud_rate_generator.fractional") => {
597 (0, 15)
598 };
599 ("clock_tree.uart.baud_rate_generator.integral") => {
600 (0, 4095)
601 };
602 ("clock_tree.i2c.function_clock.sclk") => {
603 [crate ::soc::clocks::I2cFunctionClockSclk::Xtal, crate
604 ::soc::clocks::I2cFunctionClockSclk::RcFast]
605 };
606 ("clock_tree.i2c.function_clock.div_num") => {
607 (0, 255)
608 };
609 ("clock_tree.lcd_cam.lcd_clock.sclk") => {
610 [crate ::soc::clocks::LcdCamLcdClockSclk::XtalClk, crate
611 ::soc::clocks::LcdCamLcdClockSclk::PllD2, crate
612 ::soc::clocks::LcdCamLcdClockSclk::Pll160m]
613 };
614 ("clock_tree.lcd_cam.lcd_clock.div_num") => {
615 (2, 256)
616 };
617 ("clock_tree.lcd_cam.lcd_clock.div_a") => {
618 (1, 63)
619 };
620 ("clock_tree.lcd_cam.lcd_clock.div_b") => {
621 (0, 63)
622 };
623 ("clock_tree.lcd_cam.cam_clock.sclk") => {
624 [crate ::soc::clocks::LcdCamCamClockSclk::XtalClk, crate
625 ::soc::clocks::LcdCamCamClockSclk::PllD2, crate
626 ::soc::clocks::LcdCamCamClockSclk::Pll160m]
627 };
628 ("clock_tree.lcd_cam.cam_clock.div_num") => {
629 (2, 256)
630 };
631 ("clock_tree.lcd_cam.cam_clock.div_a") => {
632 (1, 63)
633 };
634 ("clock_tree.lcd_cam.cam_clock.div_b") => {
635 (0, 63)
636 };
637 ("clock_tree.spi.function_clock") => {
638 [crate ::soc::clocks::SpiFunctionClockConfig::Xtal, crate
639 ::soc::clocks::SpiFunctionClockConfig::Apb]
640 };
641 ("clock_tree.i2s.tx_clk.sclk") => {
642 [crate ::soc::clocks::I2sClkSclk::Xtal, crate ::soc::clocks::I2sClkSclk::PllD2,
643 crate ::soc::clocks::I2sClkSclk::Pll160m]
644 };
645 ("clock_tree.i2s.tx_clk.div_num") => {
646 (1, 255)
647 };
648 ("clock_tree.i2s.tx_clk.div_a") => {
649 (1, 511)
650 };
651 ("clock_tree.i2s.tx_clk.div_b") => {
652 (0, 511)
653 };
654 ("clock_tree.i2s.rx_clk.sclk") => {
655 [crate ::soc::clocks::I2sClkSclk::Xtal, crate ::soc::clocks::I2sClkSclk::PllD2,
656 crate ::soc::clocks::I2sClkSclk::Pll160m]
657 };
658 ("clock_tree.i2s.rx_clk.div_num") => {
659 (1, 255)
660 };
661 ("clock_tree.i2s.rx_clk.div_a") => {
662 (1, 511)
663 };
664 ("clock_tree.i2s.rx_clk.div_b") => {
665 (0, 511)
666 };
667 ("clock_tree.i2s.mclk_out") => {
668 [crate ::soc::clocks::I2sMclkOutConfig::Tx, crate
669 ::soc::clocks::I2sMclkOutConfig::Rx]
670 };
671}
672#[macro_export]
673#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
674macro_rules! for_each_dedicated_gpio {
675 ($($pattern:tt => $code:tt;)*) => {
676 macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
677 tt) => {} } _for_each_inner_dedicated_gpio!((0));
678 _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
679 _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
680 _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
681 _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
682 PRO_ALONEGPIO0)); _for_each_inner_dedicated_gpio!((0, 1, PRO_ALONEGPIO1));
683 _for_each_inner_dedicated_gpio!((0, 2, PRO_ALONEGPIO2));
684 _for_each_inner_dedicated_gpio!((0, 3, PRO_ALONEGPIO3));
685 _for_each_inner_dedicated_gpio!((0, 4, PRO_ALONEGPIO4));
686 _for_each_inner_dedicated_gpio!((0, 5, PRO_ALONEGPIO5));
687 _for_each_inner_dedicated_gpio!((0, 6, PRO_ALONEGPIO6));
688 _for_each_inner_dedicated_gpio!((0, 7, PRO_ALONEGPIO7));
689 _for_each_inner_dedicated_gpio!((1, 0, CORE1_GPIO0));
690 _for_each_inner_dedicated_gpio!((1, 1, CORE1_GPIO1));
691 _for_each_inner_dedicated_gpio!((1, 2, CORE1_GPIO2));
692 _for_each_inner_dedicated_gpio!((1, 3, CORE1_GPIO3));
693 _for_each_inner_dedicated_gpio!((1, 4, CORE1_GPIO4));
694 _for_each_inner_dedicated_gpio!((1, 5, CORE1_GPIO5));
695 _for_each_inner_dedicated_gpio!((1, 6, CORE1_GPIO6));
696 _for_each_inner_dedicated_gpio!((1, 7, CORE1_GPIO7));
697 _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
698 (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, PRO_ALONEGPIO0), (0, 1,
699 PRO_ALONEGPIO1), (0, 2, PRO_ALONEGPIO2), (0, 3, PRO_ALONEGPIO3), (0, 4,
700 PRO_ALONEGPIO4), (0, 5, PRO_ALONEGPIO5), (0, 6, PRO_ALONEGPIO6), (0, 7,
701 PRO_ALONEGPIO7), (1, 0, CORE1_GPIO0), (1, 1, CORE1_GPIO1), (1, 2, CORE1_GPIO2),
702 (1, 3, CORE1_GPIO3), (1, 4, CORE1_GPIO4), (1, 5, CORE1_GPIO5), (1, 6,
703 CORE1_GPIO6), (1, 7, CORE1_GPIO7)));
704 };
705}
706#[macro_export]
710#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
711macro_rules! define_lp_io_signals {
712 () => {};
713}
714#[macro_export]
736#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
737macro_rules! for_each_rmt_channel {
738 ($($pattern:tt => $code:tt;)*) => {
739 macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
740 => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
741 _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
742 _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
743 _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
744 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
745 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
746 _for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
747 _for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
748 _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
749 _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
750 _for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
751 };
752}
753#[macro_export]
778#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
779macro_rules! for_each_sdmmc {
780 ($($pattern:tt => $code:tt;)*) => {
781 macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
782 } _for_each_inner_sdmmc!((slot0, 0, false, [SDHOST_CCLK_OUT_1],
783 [SDHOST_CCMD_IN_1], [SDHOST_CCMD_OUT_1], [SDHOST_CDATA_IN_10, SDHOST_CDATA_IN_11,
784 SDHOST_CDATA_IN_12, SDHOST_CDATA_IN_13, SDHOST_CDATA_IN_14, SDHOST_CDATA_IN_15,
785 SDHOST_CDATA_IN_16, SDHOST_CDATA_IN_17], [SDHOST_CDATA_OUT_10,
786 SDHOST_CDATA_OUT_11, SDHOST_CDATA_OUT_12, SDHOST_CDATA_OUT_13,
787 SDHOST_CDATA_OUT_14, SDHOST_CDATA_OUT_15, SDHOST_CDATA_OUT_16,
788 SDHOST_CDATA_OUT_17], [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1],
789 [SDHOST_CARD_INT_N_1], [SDHOST_DATA_STROBE_1], [SDHOST_RST_N_1]));
790 _for_each_inner_sdmmc!((slot1, 1, false, [SDHOST_CCLK_OUT_2], [SDHOST_CCMD_IN_2],
791 [SDHOST_CCMD_OUT_2], [SDHOST_CDATA_IN_20, SDHOST_CDATA_IN_21, SDHOST_CDATA_IN_22,
792 SDHOST_CDATA_IN_23, SDHOST_CDATA_IN_24, SDHOST_CDATA_IN_25, SDHOST_CDATA_IN_26,
793 SDHOST_CDATA_IN_27], [SDHOST_CDATA_OUT_20, SDHOST_CDATA_OUT_21,
794 SDHOST_CDATA_OUT_22, SDHOST_CDATA_OUT_23, SDHOST_CDATA_OUT_24,
795 SDHOST_CDATA_OUT_25, SDHOST_CDATA_OUT_26, SDHOST_CDATA_OUT_27],
796 [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2],
797 [SDHOST_DATA_STROBE_2], [SDHOST_RST_N_2])); _for_each_inner_sdmmc!((all(slot0, 0,
798 false, [SDHOST_CCLK_OUT_1], [SDHOST_CCMD_IN_1], [SDHOST_CCMD_OUT_1],
799 [SDHOST_CDATA_IN_10, SDHOST_CDATA_IN_11, SDHOST_CDATA_IN_12, SDHOST_CDATA_IN_13,
800 SDHOST_CDATA_IN_14, SDHOST_CDATA_IN_15, SDHOST_CDATA_IN_16, SDHOST_CDATA_IN_17],
801 [SDHOST_CDATA_OUT_10, SDHOST_CDATA_OUT_11, SDHOST_CDATA_OUT_12,
802 SDHOST_CDATA_OUT_13, SDHOST_CDATA_OUT_14, SDHOST_CDATA_OUT_15,
803 SDHOST_CDATA_OUT_16, SDHOST_CDATA_OUT_17], [SDHOST_CARD_DETECT_N_1],
804 [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1], [SDHOST_DATA_STROBE_1],
805 [SDHOST_RST_N_1]), (slot1, 1, false, [SDHOST_CCLK_OUT_2], [SDHOST_CCMD_IN_2],
806 [SDHOST_CCMD_OUT_2], [SDHOST_CDATA_IN_20, SDHOST_CDATA_IN_21, SDHOST_CDATA_IN_22,
807 SDHOST_CDATA_IN_23, SDHOST_CDATA_IN_24, SDHOST_CDATA_IN_25, SDHOST_CDATA_IN_26,
808 SDHOST_CDATA_IN_27], [SDHOST_CDATA_OUT_20, SDHOST_CDATA_OUT_21,
809 SDHOST_CDATA_OUT_22, SDHOST_CDATA_OUT_23, SDHOST_CDATA_OUT_24,
810 SDHOST_CDATA_OUT_25, SDHOST_CDATA_OUT_26, SDHOST_CDATA_OUT_27],
811 [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2],
812 [SDHOST_DATA_STROBE_2], [SDHOST_RST_N_2])));
813 };
814}
815#[macro_export]
816#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
817macro_rules! for_each_sdm_channel {
818 ($($pattern:tt => $code:tt;)*) => {
819 macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
820 => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
821 _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
822 _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
823 _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
824 _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
825 _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
826 _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
827 _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
828 _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
829 SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
830 GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
831 SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
832 };
833}
834#[macro_export]
835#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
836macro_rules! for_each_aes_key_length {
837 ($($pattern:tt => $code:tt;)*) => {
838 macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
839 tt) => {} } _for_each_inner_aes_key_length!((128));
840 _for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
841 4)); _for_each_inner_aes_key_length!((256, 2, 6));
842 _for_each_inner_aes_key_length!((bits(128), (256)));
843 _for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
844 };
845}
846#[macro_export]
847#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
848macro_rules! for_each_rsa_exponentiation {
849 ($($pattern:tt => $code:tt;)*) => {
850 macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
851 ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
852 _for_each_inner_rsa_exponentiation!((64));
853 _for_each_inner_rsa_exponentiation!((96));
854 _for_each_inner_rsa_exponentiation!((128));
855 _for_each_inner_rsa_exponentiation!((160));
856 _for_each_inner_rsa_exponentiation!((192));
857 _for_each_inner_rsa_exponentiation!((224));
858 _for_each_inner_rsa_exponentiation!((256));
859 _for_each_inner_rsa_exponentiation!((288));
860 _for_each_inner_rsa_exponentiation!((320));
861 _for_each_inner_rsa_exponentiation!((352));
862 _for_each_inner_rsa_exponentiation!((384));
863 _for_each_inner_rsa_exponentiation!((416));
864 _for_each_inner_rsa_exponentiation!((448));
865 _for_each_inner_rsa_exponentiation!((480));
866 _for_each_inner_rsa_exponentiation!((512));
867 _for_each_inner_rsa_exponentiation!((544));
868 _for_each_inner_rsa_exponentiation!((576));
869 _for_each_inner_rsa_exponentiation!((608));
870 _for_each_inner_rsa_exponentiation!((640));
871 _for_each_inner_rsa_exponentiation!((672));
872 _for_each_inner_rsa_exponentiation!((704));
873 _for_each_inner_rsa_exponentiation!((736));
874 _for_each_inner_rsa_exponentiation!((768));
875 _for_each_inner_rsa_exponentiation!((800));
876 _for_each_inner_rsa_exponentiation!((832));
877 _for_each_inner_rsa_exponentiation!((864));
878 _for_each_inner_rsa_exponentiation!((896));
879 _for_each_inner_rsa_exponentiation!((928));
880 _for_each_inner_rsa_exponentiation!((960));
881 _for_each_inner_rsa_exponentiation!((992));
882 _for_each_inner_rsa_exponentiation!((1024));
883 _for_each_inner_rsa_exponentiation!((1056));
884 _for_each_inner_rsa_exponentiation!((1088));
885 _for_each_inner_rsa_exponentiation!((1120));
886 _for_each_inner_rsa_exponentiation!((1152));
887 _for_each_inner_rsa_exponentiation!((1184));
888 _for_each_inner_rsa_exponentiation!((1216));
889 _for_each_inner_rsa_exponentiation!((1248));
890 _for_each_inner_rsa_exponentiation!((1280));
891 _for_each_inner_rsa_exponentiation!((1312));
892 _for_each_inner_rsa_exponentiation!((1344));
893 _for_each_inner_rsa_exponentiation!((1376));
894 _for_each_inner_rsa_exponentiation!((1408));
895 _for_each_inner_rsa_exponentiation!((1440));
896 _for_each_inner_rsa_exponentiation!((1472));
897 _for_each_inner_rsa_exponentiation!((1504));
898 _for_each_inner_rsa_exponentiation!((1536));
899 _for_each_inner_rsa_exponentiation!((1568));
900 _for_each_inner_rsa_exponentiation!((1600));
901 _for_each_inner_rsa_exponentiation!((1632));
902 _for_each_inner_rsa_exponentiation!((1664));
903 _for_each_inner_rsa_exponentiation!((1696));
904 _for_each_inner_rsa_exponentiation!((1728));
905 _for_each_inner_rsa_exponentiation!((1760));
906 _for_each_inner_rsa_exponentiation!((1792));
907 _for_each_inner_rsa_exponentiation!((1824));
908 _for_each_inner_rsa_exponentiation!((1856));
909 _for_each_inner_rsa_exponentiation!((1888));
910 _for_each_inner_rsa_exponentiation!((1920));
911 _for_each_inner_rsa_exponentiation!((1952));
912 _for_each_inner_rsa_exponentiation!((1984));
913 _for_each_inner_rsa_exponentiation!((2016));
914 _for_each_inner_rsa_exponentiation!((2048));
915 _for_each_inner_rsa_exponentiation!((2080));
916 _for_each_inner_rsa_exponentiation!((2112));
917 _for_each_inner_rsa_exponentiation!((2144));
918 _for_each_inner_rsa_exponentiation!((2176));
919 _for_each_inner_rsa_exponentiation!((2208));
920 _for_each_inner_rsa_exponentiation!((2240));
921 _for_each_inner_rsa_exponentiation!((2272));
922 _for_each_inner_rsa_exponentiation!((2304));
923 _for_each_inner_rsa_exponentiation!((2336));
924 _for_each_inner_rsa_exponentiation!((2368));
925 _for_each_inner_rsa_exponentiation!((2400));
926 _for_each_inner_rsa_exponentiation!((2432));
927 _for_each_inner_rsa_exponentiation!((2464));
928 _for_each_inner_rsa_exponentiation!((2496));
929 _for_each_inner_rsa_exponentiation!((2528));
930 _for_each_inner_rsa_exponentiation!((2560));
931 _for_each_inner_rsa_exponentiation!((2592));
932 _for_each_inner_rsa_exponentiation!((2624));
933 _for_each_inner_rsa_exponentiation!((2656));
934 _for_each_inner_rsa_exponentiation!((2688));
935 _for_each_inner_rsa_exponentiation!((2720));
936 _for_each_inner_rsa_exponentiation!((2752));
937 _for_each_inner_rsa_exponentiation!((2784));
938 _for_each_inner_rsa_exponentiation!((2816));
939 _for_each_inner_rsa_exponentiation!((2848));
940 _for_each_inner_rsa_exponentiation!((2880));
941 _for_each_inner_rsa_exponentiation!((2912));
942 _for_each_inner_rsa_exponentiation!((2944));
943 _for_each_inner_rsa_exponentiation!((2976));
944 _for_each_inner_rsa_exponentiation!((3008));
945 _for_each_inner_rsa_exponentiation!((3040));
946 _for_each_inner_rsa_exponentiation!((3072));
947 _for_each_inner_rsa_exponentiation!((3104));
948 _for_each_inner_rsa_exponentiation!((3136));
949 _for_each_inner_rsa_exponentiation!((3168));
950 _for_each_inner_rsa_exponentiation!((3200));
951 _for_each_inner_rsa_exponentiation!((3232));
952 _for_each_inner_rsa_exponentiation!((3264));
953 _for_each_inner_rsa_exponentiation!((3296));
954 _for_each_inner_rsa_exponentiation!((3328));
955 _for_each_inner_rsa_exponentiation!((3360));
956 _for_each_inner_rsa_exponentiation!((3392));
957 _for_each_inner_rsa_exponentiation!((3424));
958 _for_each_inner_rsa_exponentiation!((3456));
959 _for_each_inner_rsa_exponentiation!((3488));
960 _for_each_inner_rsa_exponentiation!((3520));
961 _for_each_inner_rsa_exponentiation!((3552));
962 _for_each_inner_rsa_exponentiation!((3584));
963 _for_each_inner_rsa_exponentiation!((3616));
964 _for_each_inner_rsa_exponentiation!((3648));
965 _for_each_inner_rsa_exponentiation!((3680));
966 _for_each_inner_rsa_exponentiation!((3712));
967 _for_each_inner_rsa_exponentiation!((3744));
968 _for_each_inner_rsa_exponentiation!((3776));
969 _for_each_inner_rsa_exponentiation!((3808));
970 _for_each_inner_rsa_exponentiation!((3840));
971 _for_each_inner_rsa_exponentiation!((3872));
972 _for_each_inner_rsa_exponentiation!((3904));
973 _for_each_inner_rsa_exponentiation!((3936));
974 _for_each_inner_rsa_exponentiation!((3968));
975 _for_each_inner_rsa_exponentiation!((4000));
976 _for_each_inner_rsa_exponentiation!((4032));
977 _for_each_inner_rsa_exponentiation!((4064));
978 _for_each_inner_rsa_exponentiation!((4096));
979 _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
980 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
981 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
982 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
983 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
984 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
985 (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
986 (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
987 (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
988 (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
989 (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
990 (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
991 (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
992 };
993}
994#[macro_export]
995#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
996macro_rules! for_each_rsa_multiplication {
997 ($($pattern:tt => $code:tt;)*) => {
998 macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
999 ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
1000 _for_each_inner_rsa_multiplication!((64));
1001 _for_each_inner_rsa_multiplication!((96));
1002 _for_each_inner_rsa_multiplication!((128));
1003 _for_each_inner_rsa_multiplication!((160));
1004 _for_each_inner_rsa_multiplication!((192));
1005 _for_each_inner_rsa_multiplication!((224));
1006 _for_each_inner_rsa_multiplication!((256));
1007 _for_each_inner_rsa_multiplication!((288));
1008 _for_each_inner_rsa_multiplication!((320));
1009 _for_each_inner_rsa_multiplication!((352));
1010 _for_each_inner_rsa_multiplication!((384));
1011 _for_each_inner_rsa_multiplication!((416));
1012 _for_each_inner_rsa_multiplication!((448));
1013 _for_each_inner_rsa_multiplication!((480));
1014 _for_each_inner_rsa_multiplication!((512));
1015 _for_each_inner_rsa_multiplication!((544));
1016 _for_each_inner_rsa_multiplication!((576));
1017 _for_each_inner_rsa_multiplication!((608));
1018 _for_each_inner_rsa_multiplication!((640));
1019 _for_each_inner_rsa_multiplication!((672));
1020 _for_each_inner_rsa_multiplication!((704));
1021 _for_each_inner_rsa_multiplication!((736));
1022 _for_each_inner_rsa_multiplication!((768));
1023 _for_each_inner_rsa_multiplication!((800));
1024 _for_each_inner_rsa_multiplication!((832));
1025 _for_each_inner_rsa_multiplication!((864));
1026 _for_each_inner_rsa_multiplication!((896));
1027 _for_each_inner_rsa_multiplication!((928));
1028 _for_each_inner_rsa_multiplication!((960));
1029 _for_each_inner_rsa_multiplication!((992));
1030 _for_each_inner_rsa_multiplication!((1024));
1031 _for_each_inner_rsa_multiplication!((1056));
1032 _for_each_inner_rsa_multiplication!((1088));
1033 _for_each_inner_rsa_multiplication!((1120));
1034 _for_each_inner_rsa_multiplication!((1152));
1035 _for_each_inner_rsa_multiplication!((1184));
1036 _for_each_inner_rsa_multiplication!((1216));
1037 _for_each_inner_rsa_multiplication!((1248));
1038 _for_each_inner_rsa_multiplication!((1280));
1039 _for_each_inner_rsa_multiplication!((1312));
1040 _for_each_inner_rsa_multiplication!((1344));
1041 _for_each_inner_rsa_multiplication!((1376));
1042 _for_each_inner_rsa_multiplication!((1408));
1043 _for_each_inner_rsa_multiplication!((1440));
1044 _for_each_inner_rsa_multiplication!((1472));
1045 _for_each_inner_rsa_multiplication!((1504));
1046 _for_each_inner_rsa_multiplication!((1536));
1047 _for_each_inner_rsa_multiplication!((1568));
1048 _for_each_inner_rsa_multiplication!((1600));
1049 _for_each_inner_rsa_multiplication!((1632));
1050 _for_each_inner_rsa_multiplication!((1664));
1051 _for_each_inner_rsa_multiplication!((1696));
1052 _for_each_inner_rsa_multiplication!((1728));
1053 _for_each_inner_rsa_multiplication!((1760));
1054 _for_each_inner_rsa_multiplication!((1792));
1055 _for_each_inner_rsa_multiplication!((1824));
1056 _for_each_inner_rsa_multiplication!((1856));
1057 _for_each_inner_rsa_multiplication!((1888));
1058 _for_each_inner_rsa_multiplication!((1920));
1059 _for_each_inner_rsa_multiplication!((1952));
1060 _for_each_inner_rsa_multiplication!((1984));
1061 _for_each_inner_rsa_multiplication!((2016));
1062 _for_each_inner_rsa_multiplication!((2048));
1063 _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
1064 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1065 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1066 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1067 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1068 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1069 (1888), (1920), (1952), (1984), (2016), (2048)));
1070 };
1071}
1072#[macro_export]
1073#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1074macro_rules! for_each_sha_algorithm {
1075 ($($pattern:tt => $code:tt;)*) => {
1076 macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
1077 tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
1078 (insecure_against : "collision", "length extension"), 0));
1079 _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
1080 (insecure_against : "length extension"), 1));
1081 _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
1082 (insecure_against : "length extension"), 2));
1083 _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
1084 (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
1085 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
1086 _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
1087 (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
1088 "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
1089 _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
1090 (insecure_against : "collision", "length extension"), 0), (Sha224,
1091 "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
1092 (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
1093 2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
1094 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
1095 (Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
1096 (Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
1097 };
1098}
1099#[macro_export]
1100#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1101macro_rules! for_each_wakeup_source {
1102 ($($pattern:tt => $code:tt;)*) => {
1103 macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
1104 tt) => {} } _for_each_inner_wakeup_source!((Ext0, 0));
1105 _for_each_inner_wakeup_source!((Ext1, 1)); _for_each_inner_wakeup_source!((Gpio,
1106 2)); _for_each_inner_wakeup_source!((Timer, 3));
1107 _for_each_inner_wakeup_source!((Sdio, 4)); _for_each_inner_wakeup_source!((Wifi,
1108 5)); _for_each_inner_wakeup_source!((Uart0, 6));
1109 _for_each_inner_wakeup_source!((Uart1, 7));
1110 _for_each_inner_wakeup_source!((Touch, 8)); _for_each_inner_wakeup_source!((Bt,
1111 10)); _for_each_inner_wakeup_source!((UlpRiscv, 11));
1112 _for_each_inner_wakeup_source!((UlpRiscvTrap, 13));
1113 _for_each_inner_wakeup_source!((all(Ext0, 0), (Ext1, 1), (Gpio, 2), (Timer, 3),
1114 (Sdio, 4), (Wifi, 5), (Uart0, 6), (Uart1, 7), (Touch, 8), (Bt, 10), (UlpRiscv,
1115 11), (UlpRiscvTrap, 13)));
1116 };
1117}
1118#[macro_export]
1119#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1120macro_rules! for_each_dma_engine {
1121 ($($pattern:tt => $code:tt;)*) => {
1122 macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
1123 => {} } _for_each_inner_dma_engine!(("AHB_GDMA"));
1124 _for_each_inner_dma_engine!((all("AHB_GDMA")));
1125 };
1126}
1127#[macro_export]
1128#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1129macro_rules! for_each_dma_channel {
1130 ($($pattern:tt => $code:tt;)*) => {
1131 macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
1132 => {} } _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0));
1133 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1));
1134 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2));
1135 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3));
1136 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4));
1137 _for_each_inner_dma_channel!(("AHB_GDMA", any_channel = AhbGdmaChannel));
1138 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0, 0, interrupt_in = DMA_IN_CH0,
1139 interrupt_out = DMA_OUT_CH0, compatible = [SPI2, SPI3, UHCI0, I2S0, I2S1,
1140 LCD_CAM, AES, SHA, APB_SARADC, RMT])); _for_each_inner_dma_channel!(("AHB_GDMA",
1141 DMA_CH1, 1, interrupt_in = DMA_IN_CH1, interrupt_out = DMA_OUT_CH1, compatible =
1142 [SPI2, SPI3, UHCI0, I2S0, I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]));
1143 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2, 2, interrupt_in = DMA_IN_CH2,
1144 interrupt_out = DMA_OUT_CH2, compatible = [SPI2, SPI3, UHCI0, I2S0, I2S1,
1145 LCD_CAM, AES, SHA, APB_SARADC, RMT])); _for_each_inner_dma_channel!(("AHB_GDMA",
1146 DMA_CH3, 3, interrupt_in = DMA_IN_CH3, interrupt_out = DMA_OUT_CH3, compatible =
1147 [SPI2, SPI3, UHCI0, I2S0, I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]));
1148 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4, 4, interrupt_in = DMA_IN_CH4,
1149 interrupt_out = DMA_OUT_CH4, compatible = [SPI2, SPI3, UHCI0, I2S0, I2S1,
1150 LCD_CAM, AES, SHA, APB_SARADC, RMT]));
1151 _for_each_inner_dma_channel!((names("AHB_GDMA", DMA_CH0), ("AHB_GDMA", DMA_CH1),
1152 ("AHB_GDMA", DMA_CH2), ("AHB_GDMA", DMA_CH3), ("AHB_GDMA", DMA_CH4)));
1153 _for_each_inner_dma_channel!((separate_any_type("AHB_GDMA", any_channel =
1154 AhbGdmaChannel))); _for_each_inner_dma_channel!((shared));
1155 _for_each_inner_dma_channel!((split("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1156 DMA_IN_CH0, interrupt_out = DMA_OUT_CH0, compatible = [SPI2, SPI3, UHCI0, I2S0,
1157 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH1, 1, interrupt_in
1158 = DMA_IN_CH1, interrupt_out = DMA_OUT_CH1, compatible = [SPI2, SPI3, UHCI0, I2S0,
1159 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH2, 2, interrupt_in
1160 = DMA_IN_CH2, interrupt_out = DMA_OUT_CH2, compatible = [SPI2, SPI3, UHCI0, I2S0,
1161 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH3, 3, interrupt_in
1162 = DMA_IN_CH3, interrupt_out = DMA_OUT_CH3, compatible = [SPI2, SPI3, UHCI0, I2S0,
1163 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH4, 4, interrupt_in
1164 = DMA_IN_CH4, interrupt_out = DMA_OUT_CH4, compatible = [SPI2, SPI3, UHCI0, I2S0,
1165 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT])));
1166 _for_each_inner_dma_channel!((no_own_interrupt));
1167 };
1168}
1169#[macro_export]
1170#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1171macro_rules! for_each_dma_channel_peri_pair {
1172 ($($pattern:tt => $code:tt;)*) => {
1173 macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1174 ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1175 DMA_CH0, SPI2)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0,
1176 SPI3)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, UHCI0));
1177 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S0));
1178 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S1));
1179 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, LCD_CAM));
1180 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, AES));
1181 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, SHA));
1182 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, APB_SARADC));
1183 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, RMT));
1184 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SPI2));
1185 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SPI3));
1186 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, UHCI0));
1187 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S0));
1188 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S1));
1189 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, LCD_CAM));
1190 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, AES));
1191 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SHA));
1192 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, APB_SARADC));
1193 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, RMT));
1194 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SPI2));
1195 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SPI3));
1196 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, UHCI0));
1197 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S0));
1198 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S1));
1199 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, LCD_CAM));
1200 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, AES));
1201 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SHA));
1202 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, APB_SARADC));
1203 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, RMT));
1204 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, SPI2));
1205 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, SPI3));
1206 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, UHCI0));
1207 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S0));
1208 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S1));
1209 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, LCD_CAM));
1210 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, AES));
1211 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, SHA));
1212 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, APB_SARADC));
1213 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, RMT));
1214 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, SPI2));
1215 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, SPI3));
1216 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, UHCI0));
1217 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S0));
1218 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S1));
1219 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, LCD_CAM));
1220 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, AES));
1221 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, SHA));
1222 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, APB_SARADC));
1223 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, RMT));
1224 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1225 SPI2)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1226 AhbGdmaChannel, SPI3)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1227 any_channel = AhbGdmaChannel, UHCI0));
1228 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1229 I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1230 AhbGdmaChannel, I2S1)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1231 any_channel = AhbGdmaChannel, LCD_CAM));
1232 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1233 AES)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1234 AhbGdmaChannel, SHA)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1235 any_channel = AhbGdmaChannel, APB_SARADC));
1236 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1237 RMT)); _for_each_inner_dma_channel_peri_pair!((channels("AHB_GDMA", DMA_CH0,
1238 SPI2), ("AHB_GDMA", DMA_CH0, SPI3), ("AHB_GDMA", DMA_CH0, UHCI0), ("AHB_GDMA",
1239 DMA_CH0, I2S0), ("AHB_GDMA", DMA_CH0, I2S1), ("AHB_GDMA", DMA_CH0, LCD_CAM),
1240 ("AHB_GDMA", DMA_CH0, AES), ("AHB_GDMA", DMA_CH0, SHA), ("AHB_GDMA", DMA_CH0,
1241 APB_SARADC), ("AHB_GDMA", DMA_CH0, RMT), ("AHB_GDMA", DMA_CH1, SPI2),
1242 ("AHB_GDMA", DMA_CH1, SPI3), ("AHB_GDMA", DMA_CH1, UHCI0), ("AHB_GDMA", DMA_CH1,
1243 I2S0), ("AHB_GDMA", DMA_CH1, I2S1), ("AHB_GDMA", DMA_CH1, LCD_CAM), ("AHB_GDMA",
1244 DMA_CH1, AES), ("AHB_GDMA", DMA_CH1, SHA), ("AHB_GDMA", DMA_CH1, APB_SARADC),
1245 ("AHB_GDMA", DMA_CH1, RMT), ("AHB_GDMA", DMA_CH2, SPI2), ("AHB_GDMA", DMA_CH2,
1246 SPI3), ("AHB_GDMA", DMA_CH2, UHCI0), ("AHB_GDMA", DMA_CH2, I2S0), ("AHB_GDMA",
1247 DMA_CH2, I2S1), ("AHB_GDMA", DMA_CH2, LCD_CAM), ("AHB_GDMA", DMA_CH2, AES),
1248 ("AHB_GDMA", DMA_CH2, SHA), ("AHB_GDMA", DMA_CH2, APB_SARADC), ("AHB_GDMA",
1249 DMA_CH2, RMT), ("AHB_GDMA", DMA_CH3, SPI2), ("AHB_GDMA", DMA_CH3, SPI3),
1250 ("AHB_GDMA", DMA_CH3, UHCI0), ("AHB_GDMA", DMA_CH3, I2S0), ("AHB_GDMA", DMA_CH3,
1251 I2S1), ("AHB_GDMA", DMA_CH3, LCD_CAM), ("AHB_GDMA", DMA_CH3, AES), ("AHB_GDMA",
1252 DMA_CH3, SHA), ("AHB_GDMA", DMA_CH3, APB_SARADC), ("AHB_GDMA", DMA_CH3, RMT),
1253 ("AHB_GDMA", DMA_CH4, SPI2), ("AHB_GDMA", DMA_CH4, SPI3), ("AHB_GDMA", DMA_CH4,
1254 UHCI0), ("AHB_GDMA", DMA_CH4, I2S0), ("AHB_GDMA", DMA_CH4, I2S1), ("AHB_GDMA",
1255 DMA_CH4, LCD_CAM), ("AHB_GDMA", DMA_CH4, AES), ("AHB_GDMA", DMA_CH4, SHA),
1256 ("AHB_GDMA", DMA_CH4, APB_SARADC), ("AHB_GDMA", DMA_CH4, RMT)));
1257 _for_each_inner_dma_channel_peri_pair!((any_channels("AHB_GDMA", any_channel =
1258 AhbGdmaChannel, SPI2), ("AHB_GDMA", any_channel = AhbGdmaChannel, SPI3),
1259 ("AHB_GDMA", any_channel = AhbGdmaChannel, UHCI0), ("AHB_GDMA", any_channel =
1260 AhbGdmaChannel, I2S0), ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S1),
1261 ("AHB_GDMA", any_channel = AhbGdmaChannel, LCD_CAM), ("AHB_GDMA", any_channel =
1262 AhbGdmaChannel, AES), ("AHB_GDMA", any_channel = AhbGdmaChannel, SHA),
1263 ("AHB_GDMA", any_channel = AhbGdmaChannel, APB_SARADC), ("AHB_GDMA", any_channel
1264 = AhbGdmaChannel, RMT)));
1265 };
1266}
1267#[macro_export]
1268#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1269macro_rules! for_each_mem2mem_channel {
1270 ($($pattern:tt => $code:tt;)*) => {
1271 macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
1272 tt) => {} } _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1273 AhbGdmaChannel, DMA_CH0, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1274 AhbGdma, AhbGdmaChannel, DMA_CH1, 0));
1275 _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH2,
1276 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1277 DMA_CH3, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1278 AhbGdmaChannel, DMA_CH4, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1279 AhbGdma, AhbGdmaChannel, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0));
1280 _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel));
1281 _for_each_inner_mem2mem_channel!((channels("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1282 DMA_CH0, 0), ("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH1, 0), ("AHB_GDMA",
1283 AhbGdma, AhbGdmaChannel, DMA_CH2, 0), ("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1284 DMA_CH3, 0), ("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH4, 0)));
1285 _for_each_inner_mem2mem_channel!((erased("AHB_GDMA", AhbGdma, AhbGdmaChannel, 0,
1286 0, 1, 0, 2, 0, 3, 0, 4, 0)));
1287 _for_each_inner_mem2mem_channel!((engines("AHB_GDMA", AhbGdma, AhbGdmaChannel)));
1288 };
1289}
1290#[macro_export]
1291#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1292macro_rules! with_aes_dma_engine {
1293 ($($pattern:tt => $code:tt;)*) => {
1294 macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
1295 => {} } _with_inner_aes_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1296 };
1297}
1298#[macro_export]
1299#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1300macro_rules! with_i2s_dma_engine {
1301 ($($pattern:tt => $code:tt;)*) => {
1302 macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
1303 => {} } _with_inner_i2s_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1304 };
1305}
1306#[macro_export]
1307#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1308macro_rules! with_lcd_cam_dma_engine {
1309 ($($pattern:tt => $code:tt;)*) => {
1310 macro_rules! _with_inner_lcd_cam_dma_engine { $(($pattern) => $code;)* ($other :
1311 tt) => {} } _with_inner_lcd_cam_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1312 };
1313}
1314#[macro_export]
1315#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1316macro_rules! with_rmt_dma_engine {
1317 ($($pattern:tt => $code:tt;)*) => {
1318 macro_rules! _with_inner_rmt_dma_engine { $(($pattern) => $code;)* ($other : tt)
1319 => {} } _with_inner_rmt_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1320 };
1321}
1322#[macro_export]
1323#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1324macro_rules! with_sha_dma_engine {
1325 ($($pattern:tt => $code:tt;)*) => {
1326 macro_rules! _with_inner_sha_dma_engine { $(($pattern) => $code;)* ($other : tt)
1327 => {} } _with_inner_sha_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1328 };
1329}
1330#[macro_export]
1331#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1332macro_rules! with_spi_master_dma_engine {
1333 ($($pattern:tt => $code:tt;)*) => {
1334 macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1335 : tt) => {} } _with_inner_spi_master_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1336 };
1337}
1338#[macro_export]
1339#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1340macro_rules! with_spi_slave_dma_engine {
1341 ($($pattern:tt => $code:tt;)*) => {
1342 macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1343 : tt) => {} } _with_inner_spi_slave_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1344 };
1345}
1346#[macro_export]
1347#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1348macro_rules! with_uhci_dma_engine {
1349 ($($pattern:tt => $code:tt;)*) => {
1350 macro_rules! _with_inner_uhci_dma_engine { $(($pattern) => $code;)* ($other : tt)
1351 => {} } _with_inner_uhci_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1352 };
1353}
1354#[macro_export]
1355#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1356macro_rules! for_each_sw_interrupt {
1357 ($($pattern:tt => $code:tt;)*) => {
1358 macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1359 tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1360 software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1361 software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1362 software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1363 software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1364 software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1365 FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1366 };
1367}
1368#[macro_export]
1369macro_rules! define_clock_tree_types {
1794 () => {
1795 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1796 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1797 pub enum SdmInstance {
1798 GpioSd = 0,
1799 }
1800 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1801 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1802 pub enum I2cInstance {
1803 I2c0 = 0,
1804 I2c1 = 1,
1805 }
1806 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1807 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1808 pub enum I2sInstance {
1809 I2s0 = 0,
1810 I2s1 = 1,
1811 }
1812 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1813 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1814 pub enum LcdCamInstance {
1815 LcdCam = 0,
1816 }
1817 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1818 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1819 pub enum McpwmInstance {
1820 Mcpwm0 = 0,
1821 Mcpwm1 = 1,
1822 }
1823 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1824 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1825 pub enum RmtInstance {
1826 Rmt = 0,
1827 }
1828 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1829 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1830 pub enum SpiInstance {
1831 Spi2 = 0,
1832 Spi3 = 1,
1833 }
1834 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1835 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1836 pub enum TimgInstance {
1837 Timg0 = 0,
1838 Timg1 = 1,
1839 }
1840 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1841 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1842 pub enum UartInstance {
1843 Uart0 = 0,
1844 Uart1 = 1,
1845 Uart2 = 2,
1846 }
1847 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1849 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1850 pub enum XtalClkConfig {
1851 _40,
1853 }
1854 impl XtalClkConfig {
1855 pub fn value(&self) -> u32 {
1856 match self {
1857 XtalClkConfig::_40 => 40000000,
1858 }
1859 }
1860 }
1861 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1863 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1864 pub enum PllClkConfig {
1865 _320,
1867 _480,
1869 }
1870 impl PllClkConfig {
1871 pub fn value(&self) -> u32 {
1872 match self {
1873 PllClkConfig::_320 => 320000000,
1874 PllClkConfig::_480 => 480000000,
1875 }
1876 }
1877 }
1878 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1880 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1881 pub enum SystemPreDivInConfig {
1882 Xtal,
1884 RcFast,
1886 }
1887 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1891 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1892 pub struct SystemPreDivConfig {
1893 divisor: u32,
1894 }
1895 impl SystemPreDivConfig {
1896 pub const fn new(divisor: u32) -> Self {
1903 ::core::assert!(
1904 divisor <= 1023,
1905 "`SYSTEM_PRE_DIV` divisor must be between 0 and 1023 (inclusive)."
1906 );
1907 Self { divisor }
1908 }
1909 pub(crate) fn divisor(self) -> u32 {
1910 self.divisor as u32
1911 }
1912 }
1913 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1915 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1916 pub enum CpuPllDivOutConfig {
1917 _80,
1919 _160,
1921 _240,
1923 }
1924 impl CpuPllDivOutConfig {
1925 pub fn value(&self) -> u32 {
1926 match self {
1927 CpuPllDivOutConfig::_80 => 80000000,
1928 CpuPllDivOutConfig::_160 => 160000000,
1929 CpuPllDivOutConfig::_240 => 240000000,
1930 }
1931 }
1932 }
1933 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1935 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1936 pub enum ApbClkConfig {
1937 Pll,
1939 Cpu,
1941 }
1942 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1944 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1945 pub enum CryptoPwmClkConfig {
1946 Pll,
1948 Cpu,
1950 }
1951 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1953 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1954 pub enum CpuClkConfig {
1955 Xtal,
1957 RcFast,
1959 Pll,
1961 }
1962 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1966 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1967 pub struct RcFastClkDivNConfig {
1968 divisor: u32,
1969 }
1970 impl RcFastClkDivNConfig {
1971 pub const fn new(divisor: u32) -> Self {
1978 ::core::assert!(
1979 divisor <= 3,
1980 "`RC_FAST_CLK_DIV_N` divisor must be between 0 and 3 (inclusive)."
1981 );
1982 Self { divisor }
1983 }
1984 pub(crate) fn divisor(self) -> u32 {
1985 self.divisor as u32
1986 }
1987 }
1988 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1990 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1991 pub enum RtcSlowClkConfig {
1992 #[cfg(use_xtal32k)]
1993 Xtal32k,
1995 RcSlow,
1997 RcFast,
1999 }
2000 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2002 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2003 pub enum RtcFastClkConfig {
2004 Xtal,
2006 Rc,
2008 }
2009 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2011 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2012 pub enum LowPowerClkConfig {
2013 Xtal,
2015 RcFast,
2017 #[cfg(use_xtal32k)]
2018 Xtal32k,
2020 RtcSlow,
2022 }
2023 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2025 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2026 pub enum UartMemClkConfig {
2027 #[default]
2028 Xtal,
2030 }
2031 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2033 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2034 pub enum TimgCalibrationClockConfig {
2035 RcSlowClk,
2037 RcFastDivClk,
2039 #[cfg(use_xtal32k)]
2040 Xtal32kClk,
2042 }
2043 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2044 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2045 pub enum I2cFunctionClockSclk {
2046 #[default]
2047 Xtal,
2049 RcFast,
2051 }
2052 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2056 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2057 pub struct I2cFunctionClockConfig {
2058 sclk: I2cFunctionClockSclk,
2059 div_num: u32,
2060 }
2061 impl I2cFunctionClockConfig {
2062 pub const fn new(sclk: I2cFunctionClockSclk, div_num: u32) -> Self {
2069 ::core::assert!(
2070 div_num <= 255,
2071 "`I2C0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2072 );
2073 Self { sclk, div_num }
2074 }
2075 pub(crate) fn sclk(self) -> I2cFunctionClockSclk {
2076 self.sclk
2077 }
2078 pub(crate) fn div_num(self) -> u32 {
2079 self.div_num as u32
2080 }
2081 }
2082 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2083 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2084 pub enum I2sClkSclk {
2085 Xtal,
2087 PllD2,
2089 #[default]
2090 Pll160m,
2092 }
2093 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2097 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2098 pub struct I2sClkConfig {
2099 sclk: I2sClkSclk,
2100 div_num: u32,
2101 div_a: u32,
2102 div_b: u32,
2103 }
2104 impl I2sClkConfig {
2105 pub const fn new(sclk: I2sClkSclk, div_num: u32, div_a: u32, div_b: u32) -> Self {
2118 ::core::assert!(
2119 div_num >= 1 && div_num <= 255,
2120 "`I2S0_TX_CLK` div_num must be between 1 and 255 (inclusive)."
2121 );
2122 ::core::assert!(
2123 div_a >= 1 && div_a <= 511,
2124 "`I2S0_TX_CLK` div_a must be between 1 and 511 (inclusive)."
2125 );
2126 ::core::assert!(
2127 div_b <= 511,
2128 "`I2S0_TX_CLK` div_b must be between 0 and 511 (inclusive)."
2129 );
2130 Self {
2131 sclk,
2132 div_num,
2133 div_a,
2134 div_b,
2135 }
2136 }
2137 pub(crate) fn sclk(self) -> I2sClkSclk {
2138 self.sclk
2139 }
2140 pub(crate) fn div_num(self) -> u32 {
2141 self.div_num as u32
2142 }
2143 pub(crate) fn div_a(self) -> u32 {
2144 self.div_a as u32
2145 }
2146 pub(crate) fn div_b(self) -> u32 {
2147 self.div_b as u32
2148 }
2149 }
2150 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2152 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2153 pub enum I2sMclkOutConfig {
2154 Tx,
2156 #[default]
2157 Rx,
2159 }
2160 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2161 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2162 pub enum LcdCamLcdClockSclk {
2163 #[default]
2164 XtalClk,
2166 PllD2,
2168 Pll160m,
2170 }
2171 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2175 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2176 pub struct LcdCamLcdClockConfig {
2177 sclk: LcdCamLcdClockSclk,
2178 div_num: u32,
2179 div_a: u32,
2180 div_b: u32,
2181 }
2182 impl LcdCamLcdClockConfig {
2183 pub const fn new(
2196 sclk: LcdCamLcdClockSclk,
2197 div_num: u32,
2198 div_a: u32,
2199 div_b: u32,
2200 ) -> Self {
2201 ::core::assert!(
2202 div_num >= 2 && div_num <= 256,
2203 "`LCD_CAM_LCD_CLOCK` div_num must be between 2 and 256 (inclusive)."
2204 );
2205 ::core::assert!(
2206 div_a >= 1 && div_a <= 63,
2207 "`LCD_CAM_LCD_CLOCK` div_a must be between 1 and 63 (inclusive)."
2208 );
2209 ::core::assert!(
2210 div_b <= 63,
2211 "`LCD_CAM_LCD_CLOCK` div_b must be between 0 and 63 (inclusive)."
2212 );
2213 Self {
2214 sclk,
2215 div_num,
2216 div_a,
2217 div_b,
2218 }
2219 }
2220 pub(crate) fn sclk(self) -> LcdCamLcdClockSclk {
2221 self.sclk
2222 }
2223 pub(crate) fn div_num(self) -> u32 {
2224 self.div_num as u32
2225 }
2226 pub(crate) fn div_a(self) -> u32 {
2227 self.div_a as u32
2228 }
2229 pub(crate) fn div_b(self) -> u32 {
2230 self.div_b as u32
2231 }
2232 }
2233 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2234 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2235 pub enum LcdCamCamClockSclk {
2236 #[default]
2237 XtalClk,
2239 PllD2,
2241 Pll160m,
2243 }
2244 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2248 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2249 pub struct LcdCamCamClockConfig {
2250 sclk: LcdCamCamClockSclk,
2251 div_num: u32,
2252 div_a: u32,
2253 div_b: u32,
2254 }
2255 impl LcdCamCamClockConfig {
2256 pub const fn new(
2269 sclk: LcdCamCamClockSclk,
2270 div_num: u32,
2271 div_a: u32,
2272 div_b: u32,
2273 ) -> Self {
2274 ::core::assert!(
2275 div_num >= 2 && div_num <= 256,
2276 "`LCD_CAM_CAM_CLOCK` div_num must be between 2 and 256 (inclusive)."
2277 );
2278 ::core::assert!(
2279 div_a >= 1 && div_a <= 63,
2280 "`LCD_CAM_CAM_CLOCK` div_a must be between 1 and 63 (inclusive)."
2281 );
2282 ::core::assert!(
2283 div_b <= 63,
2284 "`LCD_CAM_CAM_CLOCK` div_b must be between 0 and 63 (inclusive)."
2285 );
2286 Self {
2287 sclk,
2288 div_num,
2289 div_a,
2290 div_b,
2291 }
2292 }
2293 pub(crate) fn sclk(self) -> LcdCamCamClockSclk {
2294 self.sclk
2295 }
2296 pub(crate) fn div_num(self) -> u32 {
2297 self.div_num as u32
2298 }
2299 pub(crate) fn div_a(self) -> u32 {
2300 self.div_a as u32
2301 }
2302 pub(crate) fn div_b(self) -> u32 {
2303 self.div_b as u32
2304 }
2305 }
2306 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2308 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2309 pub enum McpwmFunctionClockConfig {
2310 #[default]
2311 CryptoPwmClk,
2313 }
2314 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2316 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2317 pub enum RmtSclkConfig {
2318 #[default]
2319 ApbClk,
2321 RcFastClk,
2323 XtalClk,
2325 }
2326 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2328 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2329 pub enum SpiFunctionClockConfig {
2330 Xtal,
2332 #[default]
2333 Apb,
2335 }
2336 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2338 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2339 pub enum TimgFunctionClockConfig {
2340 #[default]
2341 XtalClk,
2343 ApbClk,
2345 }
2346 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2347 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2348 pub enum UartFunctionClockSclk {
2349 Apb,
2351 RcFast,
2353 #[default]
2354 Xtal,
2356 }
2357 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2361 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2362 pub struct UartFunctionClockConfig {
2363 sclk: UartFunctionClockSclk,
2364 div_num: u32,
2365 }
2366 impl UartFunctionClockConfig {
2367 pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
2374 ::core::assert!(
2375 div_num <= 255,
2376 "`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2377 );
2378 Self { sclk, div_num }
2379 }
2380 pub(crate) fn sclk(self) -> UartFunctionClockSclk {
2381 self.sclk
2382 }
2383 pub(crate) fn div_num(self) -> u32 {
2384 self.div_num as u32
2385 }
2386 }
2387 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2392 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2393 pub struct UartBaudRateGeneratorConfig {
2394 fractional: u32,
2395 integral: u32,
2396 }
2397 impl UartBaudRateGeneratorConfig {
2398 pub const fn new(fractional: u32, integral: u32) -> Self {
2408 ::core::assert!(
2409 fractional <= 15,
2410 "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
2411 );
2412 ::core::assert!(
2413 integral <= 4095,
2414 "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
2415 );
2416 Self {
2417 fractional,
2418 integral,
2419 }
2420 }
2421 pub(crate) fn fractional(self) -> u32 {
2422 self.fractional as u32
2423 }
2424 pub(crate) fn integral(self) -> u32 {
2425 self.integral as u32
2426 }
2427 }
2428 pub struct ClockTree {
2430 xtal_clk: Option<XtalClkConfig>,
2431 pll_clk: Option<PllClkConfig>,
2432 system_pre_div_in: Option<SystemPreDivInConfig>,
2433 system_pre_div: Option<SystemPreDivConfig>,
2434 cpu_pll_div_out: Option<CpuPllDivOutConfig>,
2435 apb_clk: Option<ApbClkConfig>,
2436 crypto_pwm_clk: Option<CryptoPwmClkConfig>,
2437 cpu_clk: Option<CpuClkConfig>,
2438 rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
2439 rtc_slow_clk: Option<RtcSlowClkConfig>,
2440 rtc_fast_clk: Option<RtcFastClkConfig>,
2441 low_power_clk: Option<LowPowerClkConfig>,
2442 timg_calibration_clock: Option<TimgCalibrationClockConfig>,
2443 i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
2444 i2s_tx_clk: [Option<I2sClkConfig>; 2],
2445 i2s_rx_clk: [Option<I2sClkConfig>; 2],
2446 i2s_mclk_out: [Option<I2sMclkOutConfig>; 2],
2447 lcd_cam_lcd_clock: [Option<LcdCamLcdClockConfig>; 1],
2448 lcd_cam_cam_clock: [Option<LcdCamCamClockConfig>; 1],
2449 rmt_sclk: [Option<RmtSclkConfig>; 1],
2450 spi_function_clock: [Option<SpiFunctionClockConfig>; 2],
2451 timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
2452 uart_function_clock: [Option<UartFunctionClockConfig>; 3],
2453 uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 3],
2454 pll_clk_refcount: u32,
2455 rc_fast_clk_refcount: u32,
2456 #[cfg(use_xtal32k)]
2457 xtal32k_clk_refcount: u32,
2458 rc_slow_clk_refcount: u32,
2459 rc_fast_div_clk_refcount: u32,
2460 apb_clk_refcount: u32,
2461 crypto_pwm_clk_refcount: u32,
2462 pll_d2_refcount: u32,
2463 pll_160m_refcount: u32,
2464 rtc_fast_clk_refcount: u32,
2465 low_power_clk_refcount: u32,
2466 uart_mem_clk_refcount: u32,
2467 timg_calibration_clock_refcount: u32,
2468 sdm_function_clock_refcount: [u32; 1],
2469 i2c_function_clock_refcount: [u32; 2],
2470 i2s_tx_clk_refcount: [u32; 2],
2471 i2s_rx_clk_refcount: [u32; 2],
2472 i2s_mclk_out_refcount: [u32; 2],
2473 lcd_cam_lcd_clock_refcount: [u32; 1],
2474 lcd_cam_cam_clock_refcount: [u32; 1],
2475 mcpwm_function_clock_refcount: [u32; 2],
2476 rmt_sclk_refcount: [u32; 1],
2477 spi_function_clock_refcount: [u32; 2],
2478 timg_function_clock_refcount: [u32; 2],
2479 uart_function_clock_refcount: [u32; 3],
2480 uart_baud_rate_generator_refcount: [u32; 3],
2481 uart_mem_clock_refcount: [u32; 3],
2482 }
2483 impl ClockTree {
2484 pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
2486 CLOCK_TREE.with(f)
2487 }
2488 pub fn xtal_clk(&self) -> Option<XtalClkConfig> {
2490 self.xtal_clk
2491 }
2492 pub fn pll_clk(&self) -> Option<PllClkConfig> {
2494 self.pll_clk
2495 }
2496 pub fn system_pre_div_in(&self) -> Option<SystemPreDivInConfig> {
2498 self.system_pre_div_in
2499 }
2500 pub fn system_pre_div(&self) -> Option<SystemPreDivConfig> {
2502 self.system_pre_div
2503 }
2504 pub fn cpu_pll_div_out(&self) -> Option<CpuPllDivOutConfig> {
2506 self.cpu_pll_div_out
2507 }
2508 pub fn apb_clk(&self) -> Option<ApbClkConfig> {
2510 self.apb_clk
2511 }
2512 pub fn crypto_pwm_clk(&self) -> Option<CryptoPwmClkConfig> {
2514 self.crypto_pwm_clk
2515 }
2516 pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
2518 self.cpu_clk
2519 }
2520 pub fn rc_fast_clk_div_n(&self) -> Option<RcFastClkDivNConfig> {
2522 self.rc_fast_clk_div_n
2523 }
2524 pub fn rtc_slow_clk(&self) -> Option<RtcSlowClkConfig> {
2526 self.rtc_slow_clk
2527 }
2528 pub fn rtc_fast_clk(&self) -> Option<RtcFastClkConfig> {
2530 self.rtc_fast_clk
2531 }
2532 pub fn low_power_clk(&self) -> Option<LowPowerClkConfig> {
2534 self.low_power_clk
2535 }
2536 pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
2538 self.timg_calibration_clock
2539 }
2540 pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2542 self.i2c_function_clock[I2cInstance::I2c0 as usize]
2543 }
2544 pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2546 self.i2c_function_clock[I2cInstance::I2c1 as usize]
2547 }
2548 pub fn i2s0_tx_clk(&self) -> Option<I2sClkConfig> {
2550 self.i2s_tx_clk[I2sInstance::I2s0 as usize]
2551 }
2552 pub fn i2s0_rx_clk(&self) -> Option<I2sClkConfig> {
2554 self.i2s_rx_clk[I2sInstance::I2s0 as usize]
2555 }
2556 pub fn i2s0_mclk_out(&self) -> Option<I2sMclkOutConfig> {
2558 self.i2s_mclk_out[I2sInstance::I2s0 as usize]
2559 }
2560 pub fn i2s1_tx_clk(&self) -> Option<I2sClkConfig> {
2562 self.i2s_tx_clk[I2sInstance::I2s1 as usize]
2563 }
2564 pub fn i2s1_rx_clk(&self) -> Option<I2sClkConfig> {
2566 self.i2s_rx_clk[I2sInstance::I2s1 as usize]
2567 }
2568 pub fn i2s1_mclk_out(&self) -> Option<I2sMclkOutConfig> {
2570 self.i2s_mclk_out[I2sInstance::I2s1 as usize]
2571 }
2572 pub fn lcd_cam_lcd_clock(&self) -> Option<LcdCamLcdClockConfig> {
2574 self.lcd_cam_lcd_clock[LcdCamInstance::LcdCam as usize]
2575 }
2576 pub fn lcd_cam_cam_clock(&self) -> Option<LcdCamCamClockConfig> {
2578 self.lcd_cam_cam_clock[LcdCamInstance::LcdCam as usize]
2579 }
2580 pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
2582 self.rmt_sclk[RmtInstance::Rmt as usize]
2583 }
2584 pub fn spi2_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2586 self.spi_function_clock[SpiInstance::Spi2 as usize]
2587 }
2588 pub fn spi3_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2590 self.spi_function_clock[SpiInstance::Spi3 as usize]
2591 }
2592 pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2594 self.timg_function_clock[TimgInstance::Timg0 as usize]
2595 }
2596 pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2598 self.timg_function_clock[TimgInstance::Timg1 as usize]
2599 }
2600 pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
2602 self.uart_function_clock[UartInstance::Uart0 as usize]
2603 }
2604 pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2606 self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
2607 }
2608 pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
2610 self.uart_function_clock[UartInstance::Uart1 as usize]
2611 }
2612 pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2614 self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
2615 }
2616 pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
2618 self.uart_function_clock[UartInstance::Uart2 as usize]
2619 }
2620 pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2622 self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
2623 }
2624 }
2625 static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
2626 ::esp_sync::NonReentrantMutex::new(ClockTree {
2627 xtal_clk: None,
2628 pll_clk: None,
2629 system_pre_div_in: None,
2630 system_pre_div: None,
2631 cpu_pll_div_out: None,
2632 apb_clk: None,
2633 crypto_pwm_clk: None,
2634 cpu_clk: None,
2635 rc_fast_clk_div_n: None,
2636 rtc_slow_clk: None,
2637 rtc_fast_clk: None,
2638 low_power_clk: None,
2639 timg_calibration_clock: None,
2640 i2c_function_clock: [None; 2],
2641 i2s_tx_clk: [None; 2],
2642 i2s_rx_clk: [None; 2],
2643 i2s_mclk_out: [None; 2],
2644 lcd_cam_lcd_clock: [None; 1],
2645 lcd_cam_cam_clock: [None; 1],
2646 rmt_sclk: [None; 1],
2647 spi_function_clock: [None; 2],
2648 timg_function_clock: [None; 2],
2649 uart_function_clock: [None; 3],
2650 uart_baud_rate_generator: [None; 3],
2651 pll_clk_refcount: 0,
2652 rc_fast_clk_refcount: 0,
2653 #[cfg(use_xtal32k)]
2654 xtal32k_clk_refcount: 0,
2655 rc_slow_clk_refcount: 0,
2656 rc_fast_div_clk_refcount: 0,
2657 apb_clk_refcount: 0,
2658 crypto_pwm_clk_refcount: 0,
2659 pll_d2_refcount: 0,
2660 pll_160m_refcount: 0,
2661 rtc_fast_clk_refcount: 0,
2662 low_power_clk_refcount: 0,
2663 uart_mem_clk_refcount: 0,
2664 timg_calibration_clock_refcount: 0,
2665 sdm_function_clock_refcount: [0; 1],
2666 i2c_function_clock_refcount: [0; 2],
2667 i2s_tx_clk_refcount: [0; 2],
2668 i2s_rx_clk_refcount: [0; 2],
2669 i2s_mclk_out_refcount: [0; 2],
2670 lcd_cam_lcd_clock_refcount: [0; 1],
2671 lcd_cam_cam_clock_refcount: [0; 1],
2672 mcpwm_function_clock_refcount: [0; 2],
2673 rmt_sclk_refcount: [0; 1],
2674 spi_function_clock_refcount: [0; 2],
2675 timg_function_clock_refcount: [0; 2],
2676 uart_function_clock_refcount: [0; 3],
2677 uart_baud_rate_generator_refcount: [0; 3],
2678 uart_mem_clock_refcount: [0; 3],
2679 });
2680 static XTAL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2681 ::core::sync::atomic::AtomicU32::new(0);
2682 static PLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2683 ::core::sync::atomic::AtomicU32::new(0);
2684 static SYSTEM_PRE_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2685 ::core::sync::atomic::AtomicU32::new(0);
2686 static SYSTEM_PRE_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2687 ::core::sync::atomic::AtomicU32::new(0);
2688 static CPU_PLL_DIV_OUT_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2689 ::core::sync::atomic::AtomicU32::new(0);
2690 static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2691 ::core::sync::atomic::AtomicU32::new(0);
2692 static RC_FAST_CLK_DIV_N_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2693 ::core::sync::atomic::AtomicU32::new(0);
2694 static RTC_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2695 ::core::sync::atomic::AtomicU32::new(0);
2696 static RTC_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2697 ::core::sync::atomic::AtomicU32::new(0);
2698 static LOW_POWER_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2699 ::core::sync::atomic::AtomicU32::new(0);
2700 static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2701 ::core::sync::atomic::AtomicU32::new(0);
2702 static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2703 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2704 static I2S_TX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2705 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2706 static I2S_RX_CLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2707 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2708 static I2S_MCLK_OUT_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2709 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2710 static LCD_CAM_LCD_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2711 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2712 static LCD_CAM_CAM_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2713 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2714 static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2715 ::core::sync::atomic::AtomicU32::new(0);
2716 static CRYPTO_PWM_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2717 ::core::sync::atomic::AtomicU32::new(0);
2718 static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2719 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2720 static SPI_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2721 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2722 static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2723 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2724 static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
2725 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
2726 static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
2727 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
2728 pub fn configure_xtal_clk(clocks: &mut ClockTree, config: XtalClkConfig) {
2729 let old_config = clocks.xtal_clk.replace(config);
2730 refresh_xtal_clk_downstream(clocks);
2731 configure_xtal_clk_impl(clocks, old_config, config);
2732 }
2733 pub fn xtal_clk_config(clocks: &mut ClockTree) -> Option<XtalClkConfig> {
2734 clocks.xtal_clk
2735 }
2736 fn request_xtal_clk(_clocks: &mut ClockTree) {}
2737 fn release_xtal_clk(_clocks: &mut ClockTree) {}
2738 #[allow(unused_variables)]
2739 pub fn xtal_clk_config_frequency(clocks: &mut ClockTree, config: XtalClkConfig) -> u32 {
2740 config.value()
2741 }
2742 pub fn xtal_clk_frequency() -> u32 {
2743 XTAL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2744 }
2745 pub fn configure_pll_clk(clocks: &mut ClockTree, config: PllClkConfig) {
2746 if clocks.cpu_pll_div_out.is_some() {
2747 assert!(
2748 !((config.value() == 320000000) && (cpu_pll_div_out_frequency() == 240000000))
2749 );
2750 }
2751 let old_config = clocks.pll_clk.replace(config);
2752 refresh_pll_clk_downstream(clocks);
2753 configure_pll_clk_impl(clocks, old_config, config);
2754 }
2755 pub fn pll_clk_config(clocks: &mut ClockTree) -> Option<PllClkConfig> {
2756 clocks.pll_clk
2757 }
2758 pub fn request_pll_clk(clocks: &mut ClockTree) {
2759 trace!("Requesting PLL_CLK");
2760 if increment_reference_count(&mut clocks.pll_clk_refcount) {
2761 trace!("Enabling PLL_CLK");
2762 request_xtal_clk(clocks);
2763 enable_pll_clk_impl(clocks, true);
2764 }
2765 }
2766 pub fn release_pll_clk(clocks: &mut ClockTree) {
2767 trace!("Releasing PLL_CLK");
2768 if decrement_reference_count(&mut clocks.pll_clk_refcount) {
2769 trace!("Disabling PLL_CLK");
2770 enable_pll_clk_impl(clocks, false);
2771 release_xtal_clk(clocks);
2772 }
2773 }
2774 #[allow(unused_variables)]
2775 pub fn pll_clk_config_frequency(clocks: &mut ClockTree, config: PllClkConfig) -> u32 {
2776 config.value()
2777 }
2778 pub fn pll_clk_frequency() -> u32 {
2779 PLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2780 }
2781 pub fn pll_clk_source_frequency() -> u32 {
2782 xtal_clk_frequency()
2783 }
2784 pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
2785 trace!("Requesting RC_FAST_CLK");
2786 if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
2787 trace!("Enabling RC_FAST_CLK");
2788 enable_rc_fast_clk_impl(clocks, true);
2789 }
2790 }
2791 pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
2792 trace!("Releasing RC_FAST_CLK");
2793 if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
2794 trace!("Disabling RC_FAST_CLK");
2795 enable_rc_fast_clk_impl(clocks, false);
2796 }
2797 }
2798 pub fn rc_fast_clk_frequency() -> u32 {
2799 17500000
2800 }
2801 #[cfg(use_xtal32k)]
2802 pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
2803 trace!("Requesting XTAL32K_CLK");
2804 if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
2805 trace!("Enabling XTAL32K_CLK");
2806 enable_xtal32k_clk_impl(clocks, true);
2807 }
2808 }
2809 #[cfg(use_xtal32k)]
2810 pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
2811 trace!("Releasing XTAL32K_CLK");
2812 if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
2813 trace!("Disabling XTAL32K_CLK");
2814 enable_xtal32k_clk_impl(clocks, false);
2815 }
2816 }
2817 #[cfg(use_xtal32k)]
2818 pub fn xtal32k_clk_frequency() -> u32 {
2819 32768
2820 }
2821 pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
2822 trace!("Requesting RC_SLOW_CLK");
2823 if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
2824 trace!("Enabling RC_SLOW_CLK");
2825 enable_rc_slow_clk_impl(clocks, true);
2826 }
2827 }
2828 pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
2829 trace!("Releasing RC_SLOW_CLK");
2830 if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
2831 trace!("Disabling RC_SLOW_CLK");
2832 enable_rc_slow_clk_impl(clocks, false);
2833 }
2834 }
2835 pub fn rc_slow_clk_frequency() -> u32 {
2836 136000
2837 }
2838 pub fn request_rc_fast_div_clk(clocks: &mut ClockTree) {
2839 trace!("Requesting RC_FAST_DIV_CLK");
2840 if increment_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
2841 trace!("Enabling RC_FAST_DIV_CLK");
2842 request_rc_fast_clk(clocks);
2843 enable_rc_fast_div_clk_impl(clocks, true);
2844 }
2845 }
2846 pub fn release_rc_fast_div_clk(clocks: &mut ClockTree) {
2847 trace!("Releasing RC_FAST_DIV_CLK");
2848 if decrement_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
2849 trace!("Disabling RC_FAST_DIV_CLK");
2850 enable_rc_fast_div_clk_impl(clocks, false);
2851 release_rc_fast_clk(clocks);
2852 }
2853 }
2854 pub fn rc_fast_div_clk_frequency() -> u32 {
2855 (rc_fast_clk_frequency() / 256)
2856 }
2857 pub fn rc_fast_div_clk_source_frequency() -> u32 {
2858 rc_fast_clk_frequency()
2859 }
2860 pub fn configure_system_pre_div_in(
2861 clocks: &mut ClockTree,
2862 new_selector: SystemPreDivInConfig,
2863 ) {
2864 let old_selector = clocks.system_pre_div_in.replace(new_selector);
2865 refresh_system_pre_div_in_downstream(clocks);
2866 match new_selector {
2867 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
2868 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2869 }
2870 configure_system_pre_div_in_impl(clocks, old_selector, new_selector);
2871 if let Some(old_selector) = old_selector {
2872 match old_selector {
2873 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
2874 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2875 }
2876 }
2877 }
2878 pub fn system_pre_div_in_config(clocks: &mut ClockTree) -> Option<SystemPreDivInConfig> {
2879 clocks.system_pre_div_in
2880 }
2881 pub fn request_system_pre_div_in(clocks: &mut ClockTree) {
2882 trace!("Requesting SYSTEM_PRE_DIV_IN");
2883 trace!("Enabling SYSTEM_PRE_DIV_IN");
2884 match unwrap!(clocks.system_pre_div_in) {
2885 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
2886 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2887 }
2888 enable_system_pre_div_in_impl(clocks, true);
2889 }
2890 pub fn release_system_pre_div_in(clocks: &mut ClockTree) {
2891 trace!("Releasing SYSTEM_PRE_DIV_IN");
2892 trace!("Disabling SYSTEM_PRE_DIV_IN");
2893 enable_system_pre_div_in_impl(clocks, false);
2894 match unwrap!(clocks.system_pre_div_in) {
2895 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
2896 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2897 }
2898 }
2899 #[allow(unused_variables)]
2900 pub fn system_pre_div_in_config_frequency(
2901 clocks: &mut ClockTree,
2902 config: SystemPreDivInConfig,
2903 ) -> u32 {
2904 match config {
2905 SystemPreDivInConfig::Xtal => xtal_clk_frequency(),
2906 SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
2907 }
2908 }
2909 pub fn system_pre_div_in_frequency() -> u32 {
2910 SYSTEM_PRE_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2911 }
2912 pub fn system_pre_div_in_source_frequency(source: SystemPreDivInConfig) -> u32 {
2913 match source {
2914 SystemPreDivInConfig::Xtal => xtal_clk_frequency(),
2915 SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
2916 }
2917 }
2918 pub fn configure_system_pre_div(clocks: &mut ClockTree, config: SystemPreDivConfig) {
2919 let old_config = clocks.system_pre_div.replace(config);
2920 refresh_system_pre_div_downstream(clocks);
2921 configure_system_pre_div_impl(clocks, old_config, config);
2922 }
2923 pub fn system_pre_div_config(clocks: &mut ClockTree) -> Option<SystemPreDivConfig> {
2924 clocks.system_pre_div
2925 }
2926 pub fn request_system_pre_div(clocks: &mut ClockTree) {
2927 trace!("Requesting SYSTEM_PRE_DIV");
2928 trace!("Enabling SYSTEM_PRE_DIV");
2929 request_system_pre_div_in(clocks);
2930 enable_system_pre_div_impl(clocks, true);
2931 }
2932 pub fn release_system_pre_div(clocks: &mut ClockTree) {
2933 trace!("Releasing SYSTEM_PRE_DIV");
2934 trace!("Disabling SYSTEM_PRE_DIV");
2935 enable_system_pre_div_impl(clocks, false);
2936 release_system_pre_div_in(clocks);
2937 }
2938 #[allow(unused_variables)]
2939 pub fn system_pre_div_config_frequency(
2940 clocks: &mut ClockTree,
2941 config: SystemPreDivConfig,
2942 ) -> u32 {
2943 (system_pre_div_in_frequency() / (config.divisor() + 1))
2944 }
2945 pub fn system_pre_div_frequency() -> u32 {
2946 SYSTEM_PRE_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2947 }
2948 pub fn system_pre_div_source_frequency() -> u32 {
2949 system_pre_div_in_frequency()
2950 }
2951 pub fn configure_cpu_pll_div_out(clocks: &mut ClockTree, config: CpuPllDivOutConfig) {
2952 if clocks.pll_clk.is_some() {
2953 assert!(!((config.value() == 240000000) && (pll_clk_frequency() == 320000000)));
2954 }
2955 let old_config = clocks.cpu_pll_div_out.replace(config);
2956 refresh_cpu_pll_div_out_downstream(clocks);
2957 configure_cpu_pll_div_out_impl(clocks, old_config, config);
2958 }
2959 pub fn cpu_pll_div_out_config(clocks: &mut ClockTree) -> Option<CpuPllDivOutConfig> {
2960 clocks.cpu_pll_div_out
2961 }
2962 pub fn request_cpu_pll_div_out(clocks: &mut ClockTree) {
2963 trace!("Requesting CPU_PLL_DIV_OUT");
2964 trace!("Enabling CPU_PLL_DIV_OUT");
2965 request_pll_clk(clocks);
2966 enable_cpu_pll_div_out_impl(clocks, true);
2967 }
2968 pub fn release_cpu_pll_div_out(clocks: &mut ClockTree) {
2969 trace!("Releasing CPU_PLL_DIV_OUT");
2970 trace!("Disabling CPU_PLL_DIV_OUT");
2971 enable_cpu_pll_div_out_impl(clocks, false);
2972 release_pll_clk(clocks);
2973 }
2974 #[allow(unused_variables)]
2975 pub fn cpu_pll_div_out_config_frequency(
2976 clocks: &mut ClockTree,
2977 config: CpuPllDivOutConfig,
2978 ) -> u32 {
2979 config.value()
2980 }
2981 pub fn cpu_pll_div_out_frequency() -> u32 {
2982 CPU_PLL_DIV_OUT_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2983 }
2984 pub fn cpu_pll_div_out_source_frequency() -> u32 {
2985 pll_clk_frequency()
2986 }
2987 pub fn configure_apb_clk(clocks: &mut ClockTree, new_selector: ApbClkConfig) {
2988 let old_selector = clocks.apb_clk.replace(new_selector);
2989 refresh_apb_clk_downstream(clocks);
2990 if clocks.apb_clk_refcount > 0 {
2991 match new_selector {
2992 ApbClkConfig::Pll => request_apb_80m(clocks),
2993 ApbClkConfig::Cpu => request_cpu_clk(clocks),
2994 }
2995 configure_apb_clk_impl(clocks, old_selector, new_selector);
2996 if let Some(old_selector) = old_selector {
2997 match old_selector {
2998 ApbClkConfig::Pll => release_apb_80m(clocks),
2999 ApbClkConfig::Cpu => release_cpu_clk(clocks),
3000 }
3001 }
3002 } else {
3003 configure_apb_clk_impl(clocks, old_selector, new_selector);
3004 }
3005 }
3006 pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
3007 clocks.apb_clk
3008 }
3009 pub fn request_apb_clk(clocks: &mut ClockTree) {
3010 trace!("Requesting APB_CLK");
3011 if increment_reference_count(&mut clocks.apb_clk_refcount) {
3012 trace!("Enabling APB_CLK");
3013 match unwrap!(clocks.apb_clk) {
3014 ApbClkConfig::Pll => request_apb_80m(clocks),
3015 ApbClkConfig::Cpu => request_cpu_clk(clocks),
3016 }
3017 enable_apb_clk_impl(clocks, true);
3018 }
3019 }
3020 pub fn release_apb_clk(clocks: &mut ClockTree) {
3021 trace!("Releasing APB_CLK");
3022 if decrement_reference_count(&mut clocks.apb_clk_refcount) {
3023 trace!("Disabling APB_CLK");
3024 enable_apb_clk_impl(clocks, false);
3025 match unwrap!(clocks.apb_clk) {
3026 ApbClkConfig::Pll => release_apb_80m(clocks),
3027 ApbClkConfig::Cpu => release_cpu_clk(clocks),
3028 }
3029 }
3030 }
3031 #[allow(unused_variables)]
3032 pub fn apb_clk_config_frequency(clocks: &mut ClockTree, config: ApbClkConfig) -> u32 {
3033 match config {
3034 ApbClkConfig::Pll => apb_80m_frequency(),
3035 ApbClkConfig::Cpu => cpu_clk_frequency(),
3036 }
3037 }
3038 pub fn apb_clk_frequency() -> u32 {
3039 APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3040 }
3041 pub fn apb_clk_source_frequency(source: ApbClkConfig) -> u32 {
3042 match source {
3043 ApbClkConfig::Pll => apb_80m_frequency(),
3044 ApbClkConfig::Cpu => cpu_clk_frequency(),
3045 }
3046 }
3047 pub fn configure_crypto_pwm_clk(clocks: &mut ClockTree, new_selector: CryptoPwmClkConfig) {
3048 let old_selector = clocks.crypto_pwm_clk.replace(new_selector);
3049 refresh_crypto_pwm_clk_downstream(clocks);
3050 if clocks.crypto_pwm_clk_refcount > 0 {
3051 match new_selector {
3052 CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
3053 CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
3054 }
3055 configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
3056 if let Some(old_selector) = old_selector {
3057 match old_selector {
3058 CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
3059 CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
3060 }
3061 }
3062 } else {
3063 configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
3064 }
3065 }
3066 pub fn crypto_pwm_clk_config(clocks: &mut ClockTree) -> Option<CryptoPwmClkConfig> {
3067 clocks.crypto_pwm_clk
3068 }
3069 pub fn request_crypto_pwm_clk(clocks: &mut ClockTree) {
3070 trace!("Requesting CRYPTO_PWM_CLK");
3071 if increment_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
3072 trace!("Enabling CRYPTO_PWM_CLK");
3073 match unwrap!(clocks.crypto_pwm_clk) {
3074 CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
3075 CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
3076 }
3077 enable_crypto_pwm_clk_impl(clocks, true);
3078 }
3079 }
3080 pub fn release_crypto_pwm_clk(clocks: &mut ClockTree) {
3081 trace!("Releasing CRYPTO_PWM_CLK");
3082 if decrement_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
3083 trace!("Disabling CRYPTO_PWM_CLK");
3084 enable_crypto_pwm_clk_impl(clocks, false);
3085 match unwrap!(clocks.crypto_pwm_clk) {
3086 CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
3087 CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
3088 }
3089 }
3090 }
3091 #[allow(unused_variables)]
3092 pub fn crypto_pwm_clk_config_frequency(
3093 clocks: &mut ClockTree,
3094 config: CryptoPwmClkConfig,
3095 ) -> u32 {
3096 match config {
3097 CryptoPwmClkConfig::Pll => pll_160m_frequency(),
3098 CryptoPwmClkConfig::Cpu => cpu_clk_frequency(),
3099 }
3100 }
3101 pub fn crypto_pwm_clk_frequency() -> u32 {
3102 CRYPTO_PWM_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3103 }
3104 pub fn crypto_pwm_clk_source_frequency(source: CryptoPwmClkConfig) -> u32 {
3105 match source {
3106 CryptoPwmClkConfig::Pll => pll_160m_frequency(),
3107 CryptoPwmClkConfig::Cpu => cpu_clk_frequency(),
3108 }
3109 }
3110 pub fn configure_cpu_clk(clocks: &mut ClockTree, new_selector: CpuClkConfig) {
3111 let old_selector = clocks.cpu_clk.replace(new_selector);
3112 refresh_cpu_clk_downstream(clocks);
3113 match new_selector {
3114 CpuClkConfig::Xtal => {
3115 configure_apb_clk(clocks, ApbClkConfig::Cpu);
3116 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
3117 configure_system_pre_div_in(clocks, SystemPreDivInConfig::Xtal);
3118 }
3119 CpuClkConfig::RcFast => {
3120 configure_apb_clk(clocks, ApbClkConfig::Cpu);
3121 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
3122 configure_system_pre_div_in(clocks, SystemPreDivInConfig::RcFast);
3123 }
3124 CpuClkConfig::Pll => {
3125 configure_apb_clk(clocks, ApbClkConfig::Pll);
3126 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Pll);
3127 }
3128 }
3129 match new_selector {
3130 CpuClkConfig::Xtal => request_system_pre_div(clocks),
3131 CpuClkConfig::RcFast => request_system_pre_div(clocks),
3132 CpuClkConfig::Pll => request_cpu_pll_div_out(clocks),
3133 }
3134 configure_cpu_clk_impl(clocks, old_selector, new_selector);
3135 if let Some(old_selector) = old_selector {
3136 match old_selector {
3137 CpuClkConfig::Xtal => release_system_pre_div(clocks),
3138 CpuClkConfig::RcFast => release_system_pre_div(clocks),
3139 CpuClkConfig::Pll => release_cpu_pll_div_out(clocks),
3140 }
3141 }
3142 }
3143 pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
3144 clocks.cpu_clk
3145 }
3146 fn request_cpu_clk(_clocks: &mut ClockTree) {}
3147 fn release_cpu_clk(_clocks: &mut ClockTree) {}
3148 #[allow(unused_variables)]
3149 pub fn cpu_clk_config_frequency(clocks: &mut ClockTree, config: CpuClkConfig) -> u32 {
3150 match config {
3151 CpuClkConfig::Xtal => system_pre_div_frequency(),
3152 CpuClkConfig::RcFast => system_pre_div_frequency(),
3153 CpuClkConfig::Pll => cpu_pll_div_out_frequency(),
3154 }
3155 }
3156 pub fn cpu_clk_frequency() -> u32 {
3157 CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3158 }
3159 pub fn request_pll_d2(clocks: &mut ClockTree) {
3160 trace!("Requesting PLL_D2");
3161 if increment_reference_count(&mut clocks.pll_d2_refcount) {
3162 trace!("Enabling PLL_D2");
3163 request_pll_clk(clocks);
3164 enable_pll_d2_impl(clocks, true);
3165 }
3166 }
3167 pub fn release_pll_d2(clocks: &mut ClockTree) {
3168 trace!("Releasing PLL_D2");
3169 if decrement_reference_count(&mut clocks.pll_d2_refcount) {
3170 trace!("Disabling PLL_D2");
3171 enable_pll_d2_impl(clocks, false);
3172 release_pll_clk(clocks);
3173 }
3174 }
3175 pub fn pll_d2_frequency() -> u32 {
3176 (pll_clk_frequency() / 2)
3177 }
3178 pub fn pll_d2_source_frequency() -> u32 {
3179 pll_clk_frequency()
3180 }
3181 pub fn request_pll_160m(clocks: &mut ClockTree) {
3182 trace!("Requesting PLL_160M");
3183 if increment_reference_count(&mut clocks.pll_160m_refcount) {
3184 trace!("Enabling PLL_160M");
3185 request_cpu_clk(clocks);
3186 enable_pll_160m_impl(clocks, true);
3187 }
3188 }
3189 pub fn release_pll_160m(clocks: &mut ClockTree) {
3190 trace!("Releasing PLL_160M");
3191 if decrement_reference_count(&mut clocks.pll_160m_refcount) {
3192 trace!("Disabling PLL_160M");
3193 enable_pll_160m_impl(clocks, false);
3194 release_cpu_clk(clocks);
3195 }
3196 }
3197 pub fn pll_160m_frequency() -> u32 {
3198 160000000
3199 }
3200 pub fn pll_160m_source_frequency() -> u32 {
3201 cpu_clk_frequency()
3202 }
3203 pub fn request_apb_80m(clocks: &mut ClockTree) {
3204 trace!("Requesting APB_80M");
3205 trace!("Enabling APB_80M");
3206 request_cpu_clk(clocks);
3207 enable_apb_80m_impl(clocks, true);
3208 }
3209 pub fn release_apb_80m(clocks: &mut ClockTree) {
3210 trace!("Releasing APB_80M");
3211 trace!("Disabling APB_80M");
3212 enable_apb_80m_impl(clocks, false);
3213 release_cpu_clk(clocks);
3214 }
3215 pub fn apb_80m_frequency() -> u32 {
3216 80000000
3217 }
3218 pub fn apb_80m_source_frequency() -> u32 {
3219 cpu_clk_frequency()
3220 }
3221 pub fn configure_rc_fast_clk_div_n(clocks: &mut ClockTree, config: RcFastClkDivNConfig) {
3222 let old_config = clocks.rc_fast_clk_div_n.replace(config);
3223 refresh_rc_fast_clk_div_n_downstream(clocks);
3224 configure_rc_fast_clk_div_n_impl(clocks, old_config, config);
3225 }
3226 pub fn rc_fast_clk_div_n_config(clocks: &mut ClockTree) -> Option<RcFastClkDivNConfig> {
3227 clocks.rc_fast_clk_div_n
3228 }
3229 pub fn request_rc_fast_clk_div_n(clocks: &mut ClockTree) {
3230 trace!("Requesting RC_FAST_CLK_DIV_N");
3231 trace!("Enabling RC_FAST_CLK_DIV_N");
3232 request_rc_fast_clk(clocks);
3233 enable_rc_fast_clk_div_n_impl(clocks, true);
3234 }
3235 pub fn release_rc_fast_clk_div_n(clocks: &mut ClockTree) {
3236 trace!("Releasing RC_FAST_CLK_DIV_N");
3237 trace!("Disabling RC_FAST_CLK_DIV_N");
3238 enable_rc_fast_clk_div_n_impl(clocks, false);
3239 release_rc_fast_clk(clocks);
3240 }
3241 #[allow(unused_variables)]
3242 pub fn rc_fast_clk_div_n_config_frequency(
3243 clocks: &mut ClockTree,
3244 config: RcFastClkDivNConfig,
3245 ) -> u32 {
3246 (rc_fast_clk_frequency() / (config.divisor() + 1))
3247 }
3248 pub fn rc_fast_clk_div_n_frequency() -> u32 {
3249 RC_FAST_CLK_DIV_N_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3250 }
3251 pub fn rc_fast_clk_div_n_source_frequency() -> u32 {
3252 rc_fast_clk_frequency()
3253 }
3254 pub fn request_xtal_div_clk(clocks: &mut ClockTree) {
3255 trace!("Requesting XTAL_DIV_CLK");
3256 trace!("Enabling XTAL_DIV_CLK");
3257 request_xtal_clk(clocks);
3258 enable_xtal_div_clk_impl(clocks, true);
3259 }
3260 pub fn release_xtal_div_clk(clocks: &mut ClockTree) {
3261 trace!("Releasing XTAL_DIV_CLK");
3262 trace!("Disabling XTAL_DIV_CLK");
3263 enable_xtal_div_clk_impl(clocks, false);
3264 release_xtal_clk(clocks);
3265 }
3266 pub fn xtal_div_clk_frequency() -> u32 {
3267 (xtal_clk_frequency() / 2)
3268 }
3269 pub fn xtal_div_clk_source_frequency() -> u32 {
3270 xtal_clk_frequency()
3271 }
3272 pub fn configure_rtc_slow_clk(clocks: &mut ClockTree, new_selector: RtcSlowClkConfig) {
3273 let old_selector = clocks.rtc_slow_clk.replace(new_selector);
3274 refresh_rtc_slow_clk_downstream(clocks);
3275 match new_selector {
3276 #[cfg(use_xtal32k)]
3277 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3278 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3279 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
3280 }
3281 configure_rtc_slow_clk_impl(clocks, old_selector, new_selector);
3282 if let Some(old_selector) = old_selector {
3283 match old_selector {
3284 #[cfg(use_xtal32k)]
3285 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3286 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3287 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
3288 }
3289 }
3290 }
3291 pub fn rtc_slow_clk_config(clocks: &mut ClockTree) -> Option<RtcSlowClkConfig> {
3292 clocks.rtc_slow_clk
3293 }
3294 pub fn request_rtc_slow_clk(clocks: &mut ClockTree) {
3295 trace!("Requesting RTC_SLOW_CLK");
3296 trace!("Enabling RTC_SLOW_CLK");
3297 match unwrap!(clocks.rtc_slow_clk) {
3298 #[cfg(use_xtal32k)]
3299 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3300 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3301 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
3302 }
3303 enable_rtc_slow_clk_impl(clocks, true);
3304 }
3305 pub fn release_rtc_slow_clk(clocks: &mut ClockTree) {
3306 trace!("Releasing RTC_SLOW_CLK");
3307 trace!("Disabling RTC_SLOW_CLK");
3308 enable_rtc_slow_clk_impl(clocks, false);
3309 match unwrap!(clocks.rtc_slow_clk) {
3310 #[cfg(use_xtal32k)]
3311 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3312 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3313 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
3314 }
3315 }
3316 #[allow(unused_variables)]
3317 pub fn rtc_slow_clk_config_frequency(
3318 clocks: &mut ClockTree,
3319 config: RtcSlowClkConfig,
3320 ) -> u32 {
3321 match config {
3322 #[cfg(use_xtal32k)]
3323 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3324 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3325 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
3326 }
3327 }
3328 pub fn rtc_slow_clk_frequency() -> u32 {
3329 RTC_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3330 }
3331 pub fn rtc_slow_clk_source_frequency(source: RtcSlowClkConfig) -> u32 {
3332 match source {
3333 #[cfg(use_xtal32k)]
3334 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3335 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3336 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
3337 }
3338 }
3339 pub fn configure_rtc_fast_clk(clocks: &mut ClockTree, new_selector: RtcFastClkConfig) {
3340 let old_selector = clocks.rtc_fast_clk.replace(new_selector);
3341 refresh_rtc_fast_clk_downstream(clocks);
3342 if clocks.rtc_fast_clk_refcount > 0 {
3343 match new_selector {
3344 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
3345 RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
3346 }
3347 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
3348 if let Some(old_selector) = old_selector {
3349 match old_selector {
3350 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
3351 RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
3352 }
3353 }
3354 } else {
3355 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
3356 }
3357 }
3358 pub fn rtc_fast_clk_config(clocks: &mut ClockTree) -> Option<RtcFastClkConfig> {
3359 clocks.rtc_fast_clk
3360 }
3361 pub fn request_rtc_fast_clk(clocks: &mut ClockTree) {
3362 trace!("Requesting RTC_FAST_CLK");
3363 if increment_reference_count(&mut clocks.rtc_fast_clk_refcount) {
3364 trace!("Enabling RTC_FAST_CLK");
3365 match unwrap!(clocks.rtc_fast_clk) {
3366 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
3367 RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
3368 }
3369 enable_rtc_fast_clk_impl(clocks, true);
3370 }
3371 }
3372 pub fn release_rtc_fast_clk(clocks: &mut ClockTree) {
3373 trace!("Releasing RTC_FAST_CLK");
3374 if decrement_reference_count(&mut clocks.rtc_fast_clk_refcount) {
3375 trace!("Disabling RTC_FAST_CLK");
3376 enable_rtc_fast_clk_impl(clocks, false);
3377 match unwrap!(clocks.rtc_fast_clk) {
3378 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
3379 RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
3380 }
3381 }
3382 }
3383 #[allow(unused_variables)]
3384 pub fn rtc_fast_clk_config_frequency(
3385 clocks: &mut ClockTree,
3386 config: RtcFastClkConfig,
3387 ) -> u32 {
3388 match config {
3389 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
3390 RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(),
3391 }
3392 }
3393 pub fn rtc_fast_clk_frequency() -> u32 {
3394 RTC_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3395 }
3396 pub fn rtc_fast_clk_source_frequency(source: RtcFastClkConfig) -> u32 {
3397 match source {
3398 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
3399 RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(),
3400 }
3401 }
3402 pub fn configure_low_power_clk(clocks: &mut ClockTree, new_selector: LowPowerClkConfig) {
3403 let old_selector = clocks.low_power_clk.replace(new_selector);
3404 refresh_low_power_clk_downstream(clocks);
3405 if clocks.low_power_clk_refcount > 0 {
3406 match new_selector {
3407 LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
3408 LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
3409 #[cfg(use_xtal32k)]
3410 LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3411 LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
3412 }
3413 configure_low_power_clk_impl(clocks, old_selector, new_selector);
3414 if let Some(old_selector) = old_selector {
3415 match old_selector {
3416 LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
3417 LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
3418 #[cfg(use_xtal32k)]
3419 LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3420 LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
3421 }
3422 }
3423 } else {
3424 configure_low_power_clk_impl(clocks, old_selector, new_selector);
3425 }
3426 }
3427 pub fn low_power_clk_config(clocks: &mut ClockTree) -> Option<LowPowerClkConfig> {
3428 clocks.low_power_clk
3429 }
3430 pub fn request_low_power_clk(clocks: &mut ClockTree) {
3431 trace!("Requesting LOW_POWER_CLK");
3432 if increment_reference_count(&mut clocks.low_power_clk_refcount) {
3433 trace!("Enabling LOW_POWER_CLK");
3434 match unwrap!(clocks.low_power_clk) {
3435 LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
3436 LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
3437 #[cfg(use_xtal32k)]
3438 LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3439 LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
3440 }
3441 enable_low_power_clk_impl(clocks, true);
3442 }
3443 }
3444 pub fn release_low_power_clk(clocks: &mut ClockTree) {
3445 trace!("Releasing LOW_POWER_CLK");
3446 if decrement_reference_count(&mut clocks.low_power_clk_refcount) {
3447 trace!("Disabling LOW_POWER_CLK");
3448 enable_low_power_clk_impl(clocks, false);
3449 match unwrap!(clocks.low_power_clk) {
3450 LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
3451 LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
3452 #[cfg(use_xtal32k)]
3453 LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3454 LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
3455 }
3456 }
3457 }
3458 #[allow(unused_variables)]
3459 pub fn low_power_clk_config_frequency(
3460 clocks: &mut ClockTree,
3461 config: LowPowerClkConfig,
3462 ) -> u32 {
3463 match config {
3464 LowPowerClkConfig::Xtal => xtal_clk_frequency(),
3465 LowPowerClkConfig::RcFast => rc_fast_clk_frequency(),
3466 #[cfg(use_xtal32k)]
3467 LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(),
3468 LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(),
3469 }
3470 }
3471 pub fn low_power_clk_frequency() -> u32 {
3472 LOW_POWER_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3473 }
3474 pub fn low_power_clk_source_frequency(source: LowPowerClkConfig) -> u32 {
3475 match source {
3476 LowPowerClkConfig::Xtal => xtal_clk_frequency(),
3477 LowPowerClkConfig::RcFast => rc_fast_clk_frequency(),
3478 #[cfg(use_xtal32k)]
3479 LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(),
3480 LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(),
3481 }
3482 }
3483 pub fn request_uart_mem_clk(clocks: &mut ClockTree) {
3484 trace!("Requesting UART_MEM_CLK");
3485 if increment_reference_count(&mut clocks.uart_mem_clk_refcount) {
3486 trace!("Enabling UART_MEM_CLK");
3487 request_xtal_clk(clocks);
3488 enable_uart_mem_clk_impl(clocks, true);
3489 }
3490 }
3491 pub fn release_uart_mem_clk(clocks: &mut ClockTree) {
3492 trace!("Releasing UART_MEM_CLK");
3493 if decrement_reference_count(&mut clocks.uart_mem_clk_refcount) {
3494 trace!("Disabling UART_MEM_CLK");
3495 enable_uart_mem_clk_impl(clocks, false);
3496 release_xtal_clk(clocks);
3497 }
3498 }
3499 pub fn uart_mem_clk_frequency() -> u32 {
3500 xtal_clk_frequency()
3501 }
3502 pub fn uart_mem_clk_source_frequency(source: UartMemClkConfig) -> u32 {
3503 match source {
3504 UartMemClkConfig::Xtal => xtal_clk_frequency(),
3505 }
3506 }
3507 pub fn configure_timg_calibration_clock(
3508 clocks: &mut ClockTree,
3509 new_selector: TimgCalibrationClockConfig,
3510 ) {
3511 let old_selector = clocks.timg_calibration_clock.replace(new_selector);
3512 refresh_timg_calibration_clock_downstream(clocks);
3513 if clocks.timg_calibration_clock_refcount > 0 {
3514 match new_selector {
3515 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3516 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3517 #[cfg(use_xtal32k)]
3518 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3519 }
3520 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3521 if let Some(old_selector) = old_selector {
3522 match old_selector {
3523 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3524 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3525 #[cfg(use_xtal32k)]
3526 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3527 }
3528 }
3529 } else {
3530 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3531 }
3532 }
3533 pub fn timg_calibration_clock_config(
3534 clocks: &mut ClockTree,
3535 ) -> Option<TimgCalibrationClockConfig> {
3536 clocks.timg_calibration_clock
3537 }
3538 pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
3539 trace!("Requesting TIMG_CALIBRATION_CLOCK");
3540 if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3541 trace!("Enabling TIMG_CALIBRATION_CLOCK");
3542 crate::rtc_cntl::WakeLock::acquire();
3543 match unwrap!(clocks.timg_calibration_clock) {
3544 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3545 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3546 #[cfg(use_xtal32k)]
3547 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3548 }
3549 enable_timg_calibration_clock_impl(clocks, true);
3550 }
3551 }
3552 pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
3553 trace!("Releasing TIMG_CALIBRATION_CLOCK");
3554 if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3555 trace!("Disabling TIMG_CALIBRATION_CLOCK");
3556 crate::rtc_cntl::WakeLock::release();
3557 enable_timg_calibration_clock_impl(clocks, false);
3558 match unwrap!(clocks.timg_calibration_clock) {
3559 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3560 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3561 #[cfg(use_xtal32k)]
3562 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3563 }
3564 }
3565 }
3566 #[allow(unused_variables)]
3567 pub fn timg_calibration_clock_config_frequency(
3568 clocks: &mut ClockTree,
3569 config: TimgCalibrationClockConfig,
3570 ) -> u32 {
3571 match config {
3572 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
3573 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
3574 #[cfg(use_xtal32k)]
3575 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3576 }
3577 }
3578 pub fn timg_calibration_clock_frequency() -> u32 {
3579 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3580 }
3581 pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
3582 match source {
3583 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
3584 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
3585 #[cfg(use_xtal32k)]
3586 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3587 }
3588 }
3589 impl SdmInstance {
3590 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3591 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3592 if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3593 {
3594 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3595 request_apb_clk(clocks);
3596 self.enable_function_clock_impl(clocks, true);
3597 }
3598 }
3599 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3600 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3601 if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3602 {
3603 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3604 self.enable_function_clock_impl(clocks, false);
3605 release_apb_clk(clocks);
3606 }
3607 }
3608 pub fn function_clock_frequency(self) -> u32 {
3609 apb_clk_frequency()
3610 }
3611 pub fn function_clock_source_frequency() -> u32 {
3612 apb_clk_frequency()
3613 }
3614 }
3615 impl I2cInstance {
3616 pub fn configure_function_clock(
3617 self,
3618 clocks: &mut ClockTree,
3619 config: I2cFunctionClockConfig,
3620 ) {
3621 let old_config = clocks.i2c_function_clock[self as usize].replace(config);
3622 refresh_i2c_function_clock_downstream(clocks, self);
3623 if clocks.i2c_function_clock_refcount[self as usize] > 0 {
3624 match config.sclk {
3625 I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3626 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3627 }
3628 self.configure_function_clock_impl(clocks, old_config, config);
3629 if let Some(old_config) = old_config {
3630 match old_config.sclk {
3631 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3632 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3633 }
3634 }
3635 } else {
3636 self.configure_function_clock_impl(clocks, old_config, config);
3637 }
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::Xtal => request_xtal_clk(clocks),
3653 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3654 }
3655 self.enable_function_clock_impl(clocks, true);
3656 }
3657 }
3658 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3659 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3660 if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3661 {
3662 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3663 crate::rtc_cntl::WakeLock::release();
3664 self.enable_function_clock_impl(clocks, false);
3665 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3666 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3667 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3668 }
3669 }
3670 }
3671 #[allow(unused_variables)]
3672 pub fn function_clock_config_frequency(
3673 clocks: &mut ClockTree,
3674 config: I2cFunctionClockConfig,
3675 ) -> u32 {
3676 (match config.sclk {
3677 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3678 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3679 } / (config.div_num() + 1))
3680 }
3681 pub fn function_clock_frequency(self) -> u32 {
3682 I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3683 .load(::core::sync::atomic::Ordering::Acquire)
3684 }
3685 pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
3686 match sclk {
3687 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3688 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3689 }
3690 }
3691 }
3692 impl I2sInstance {
3693 pub fn configure_tx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
3694 let old_config = clocks.i2s_tx_clk[self as usize].replace(config);
3695 refresh_i2s_tx_clk_downstream(clocks, self);
3696 if clocks.i2s_tx_clk_refcount[self as usize] > 0 {
3697 match config.sclk {
3698 I2sClkSclk::Xtal => request_xtal_clk(clocks),
3699 I2sClkSclk::PllD2 => request_pll_d2(clocks),
3700 I2sClkSclk::Pll160m => request_pll_160m(clocks),
3701 }
3702 self.configure_tx_clk_impl(clocks, old_config, config);
3703 if let Some(old_config) = old_config {
3704 match old_config.sclk {
3705 I2sClkSclk::Xtal => release_xtal_clk(clocks),
3706 I2sClkSclk::PllD2 => release_pll_d2(clocks),
3707 I2sClkSclk::Pll160m => release_pll_160m(clocks),
3708 }
3709 }
3710 } else {
3711 self.configure_tx_clk_impl(clocks, old_config, config);
3712 }
3713 }
3714 pub fn tx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
3715 clocks.i2s_tx_clk[self as usize]
3716 }
3717 pub fn request_tx_clk(self, clocks: &mut ClockTree) {
3718 trace!("Requesting {:?}::TX_CLK", self);
3719 if increment_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
3720 trace!("Enabling {:?}::TX_CLK", self);
3721 crate::rtc_cntl::WakeLock::acquire();
3722 match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
3723 I2sClkSclk::Xtal => request_xtal_clk(clocks),
3724 I2sClkSclk::PllD2 => request_pll_d2(clocks),
3725 I2sClkSclk::Pll160m => request_pll_160m(clocks),
3726 }
3727 self.enable_tx_clk_impl(clocks, true);
3728 }
3729 }
3730 pub fn release_tx_clk(self, clocks: &mut ClockTree) {
3731 trace!("Releasing {:?}::TX_CLK", self);
3732 if decrement_reference_count(&mut clocks.i2s_tx_clk_refcount[self as usize]) {
3733 trace!("Disabling {:?}::TX_CLK", self);
3734 crate::rtc_cntl::WakeLock::release();
3735 self.enable_tx_clk_impl(clocks, false);
3736 match unwrap!(clocks.i2s_tx_clk[self as usize]).sclk {
3737 I2sClkSclk::Xtal => release_xtal_clk(clocks),
3738 I2sClkSclk::PllD2 => release_pll_d2(clocks),
3739 I2sClkSclk::Pll160m => release_pll_160m(clocks),
3740 }
3741 }
3742 }
3743 #[allow(unused_variables)]
3744 pub fn tx_clk_config_frequency(clocks: &mut ClockTree, config: I2sClkConfig) -> u32 {
3745 (((match config.sclk {
3746 I2sClkSclk::Xtal => xtal_clk_frequency(),
3747 I2sClkSclk::PllD2 => pll_d2_frequency(),
3748 I2sClkSclk::Pll160m => pll_160m_frequency(),
3749 } as u64)
3750 * (config.div_a() as u64))
3751 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3752 as u32
3753 }
3754 pub fn tx_clk_frequency(self) -> u32 {
3755 I2S_TX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3756 }
3757 pub fn tx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
3758 match sclk {
3759 I2sClkSclk::Xtal => xtal_clk_frequency(),
3760 I2sClkSclk::PllD2 => pll_d2_frequency(),
3761 I2sClkSclk::Pll160m => pll_160m_frequency(),
3762 }
3763 }
3764 pub fn configure_rx_clk(self, clocks: &mut ClockTree, config: I2sClkConfig) {
3765 let old_config = clocks.i2s_rx_clk[self as usize].replace(config);
3766 refresh_i2s_rx_clk_downstream(clocks, self);
3767 if clocks.i2s_rx_clk_refcount[self as usize] > 0 {
3768 match config.sclk {
3769 I2sClkSclk::Xtal => request_xtal_clk(clocks),
3770 I2sClkSclk::PllD2 => request_pll_d2(clocks),
3771 I2sClkSclk::Pll160m => request_pll_160m(clocks),
3772 }
3773 self.configure_rx_clk_impl(clocks, old_config, config);
3774 if let Some(old_config) = old_config {
3775 match old_config.sclk {
3776 I2sClkSclk::Xtal => release_xtal_clk(clocks),
3777 I2sClkSclk::PllD2 => release_pll_d2(clocks),
3778 I2sClkSclk::Pll160m => release_pll_160m(clocks),
3779 }
3780 }
3781 } else {
3782 self.configure_rx_clk_impl(clocks, old_config, config);
3783 }
3784 }
3785 pub fn rx_clk_config(self, clocks: &mut ClockTree) -> Option<I2sClkConfig> {
3786 clocks.i2s_rx_clk[self as usize]
3787 }
3788 pub fn request_rx_clk(self, clocks: &mut ClockTree) {
3789 trace!("Requesting {:?}::RX_CLK", self);
3790 if increment_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
3791 trace!("Enabling {:?}::RX_CLK", self);
3792 crate::rtc_cntl::WakeLock::acquire();
3793 match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
3794 I2sClkSclk::Xtal => request_xtal_clk(clocks),
3795 I2sClkSclk::PllD2 => request_pll_d2(clocks),
3796 I2sClkSclk::Pll160m => request_pll_160m(clocks),
3797 }
3798 self.enable_rx_clk_impl(clocks, true);
3799 }
3800 }
3801 pub fn release_rx_clk(self, clocks: &mut ClockTree) {
3802 trace!("Releasing {:?}::RX_CLK", self);
3803 if decrement_reference_count(&mut clocks.i2s_rx_clk_refcount[self as usize]) {
3804 trace!("Disabling {:?}::RX_CLK", self);
3805 crate::rtc_cntl::WakeLock::release();
3806 self.enable_rx_clk_impl(clocks, false);
3807 match unwrap!(clocks.i2s_rx_clk[self as usize]).sclk {
3808 I2sClkSclk::Xtal => release_xtal_clk(clocks),
3809 I2sClkSclk::PllD2 => release_pll_d2(clocks),
3810 I2sClkSclk::Pll160m => release_pll_160m(clocks),
3811 }
3812 }
3813 }
3814 #[allow(unused_variables)]
3815 pub fn rx_clk_config_frequency(clocks: &mut ClockTree, config: I2sClkConfig) -> u32 {
3816 (((match config.sclk {
3817 I2sClkSclk::Xtal => xtal_clk_frequency(),
3818 I2sClkSclk::PllD2 => pll_d2_frequency(),
3819 I2sClkSclk::Pll160m => pll_160m_frequency(),
3820 } as u64)
3821 * (config.div_a() as u64))
3822 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3823 as u32
3824 }
3825 pub fn rx_clk_frequency(self) -> u32 {
3826 I2S_RX_CLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3827 }
3828 pub fn rx_clk_source_frequency(sclk: I2sClkSclk) -> u32 {
3829 match sclk {
3830 I2sClkSclk::Xtal => xtal_clk_frequency(),
3831 I2sClkSclk::PllD2 => pll_d2_frequency(),
3832 I2sClkSclk::Pll160m => pll_160m_frequency(),
3833 }
3834 }
3835 pub fn configure_mclk_out(
3836 self,
3837 clocks: &mut ClockTree,
3838 new_selector: I2sMclkOutConfig,
3839 ) {
3840 let old_selector = clocks.i2s_mclk_out[self as usize].replace(new_selector);
3841 refresh_i2s_mclk_out_downstream(clocks, self);
3842 if clocks.i2s_mclk_out_refcount[self as usize] > 0 {
3843 match new_selector {
3844 I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
3845 I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
3846 }
3847 self.configure_mclk_out_impl(clocks, old_selector, new_selector);
3848 if let Some(old_selector) = old_selector {
3849 match old_selector {
3850 I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
3851 I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
3852 }
3853 }
3854 } else {
3855 self.configure_mclk_out_impl(clocks, old_selector, new_selector);
3856 }
3857 }
3858 pub fn mclk_out_config(self, clocks: &mut ClockTree) -> Option<I2sMclkOutConfig> {
3859 clocks.i2s_mclk_out[self as usize]
3860 }
3861 pub fn request_mclk_out(self, clocks: &mut ClockTree) {
3862 trace!("Requesting {:?}::MCLK_OUT", self);
3863 if increment_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
3864 trace!("Enabling {:?}::MCLK_OUT", self);
3865 match unwrap!(clocks.i2s_mclk_out[self as usize]) {
3866 I2sMclkOutConfig::Tx => self.request_tx_clk(clocks),
3867 I2sMclkOutConfig::Rx => self.request_rx_clk(clocks),
3868 }
3869 self.enable_mclk_out_impl(clocks, true);
3870 }
3871 }
3872 pub fn release_mclk_out(self, clocks: &mut ClockTree) {
3873 trace!("Releasing {:?}::MCLK_OUT", self);
3874 if decrement_reference_count(&mut clocks.i2s_mclk_out_refcount[self as usize]) {
3875 trace!("Disabling {:?}::MCLK_OUT", self);
3876 self.enable_mclk_out_impl(clocks, false);
3877 match unwrap!(clocks.i2s_mclk_out[self as usize]) {
3878 I2sMclkOutConfig::Tx => self.release_tx_clk(clocks),
3879 I2sMclkOutConfig::Rx => self.release_rx_clk(clocks),
3880 }
3881 }
3882 }
3883 #[allow(unused_variables)]
3884 pub fn mclk_out_config_frequency(
3885 self,
3886 clocks: &mut ClockTree,
3887 config: I2sMclkOutConfig,
3888 ) -> u32 {
3889 match config {
3890 I2sMclkOutConfig::Tx => self.tx_clk_frequency(),
3891 I2sMclkOutConfig::Rx => self.rx_clk_frequency(),
3892 }
3893 }
3894 pub fn mclk_out_frequency(self) -> u32 {
3895 I2S_MCLK_OUT_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3896 }
3897 }
3898 impl LcdCamInstance {
3899 pub fn configure_lcd_clock(self, clocks: &mut ClockTree, config: LcdCamLcdClockConfig) {
3900 let old_config = clocks.lcd_cam_lcd_clock[self as usize].replace(config);
3901 refresh_lcd_cam_lcd_clock_downstream(clocks, self);
3902 if clocks.lcd_cam_lcd_clock_refcount[self as usize] > 0 {
3903 match config.sclk {
3904 LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
3905 LcdCamLcdClockSclk::PllD2 => request_pll_d2(clocks),
3906 LcdCamLcdClockSclk::Pll160m => request_pll_160m(clocks),
3907 }
3908 self.configure_lcd_clock_impl(clocks, old_config, config);
3909 if let Some(old_config) = old_config {
3910 match old_config.sclk {
3911 LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
3912 LcdCamLcdClockSclk::PllD2 => release_pll_d2(clocks),
3913 LcdCamLcdClockSclk::Pll160m => release_pll_160m(clocks),
3914 }
3915 }
3916 } else {
3917 self.configure_lcd_clock_impl(clocks, old_config, config);
3918 }
3919 }
3920 pub fn lcd_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamLcdClockConfig> {
3921 clocks.lcd_cam_lcd_clock[self as usize]
3922 }
3923 pub fn request_lcd_clock(self, clocks: &mut ClockTree) {
3924 trace!("Requesting {:?}::LCD_CLOCK", self);
3925 if increment_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
3926 {
3927 trace!("Enabling {:?}::LCD_CLOCK", self);
3928 crate::rtc_cntl::WakeLock::acquire();
3929 match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
3930 LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
3931 LcdCamLcdClockSclk::PllD2 => request_pll_d2(clocks),
3932 LcdCamLcdClockSclk::Pll160m => request_pll_160m(clocks),
3933 }
3934 self.enable_lcd_clock_impl(clocks, true);
3935 }
3936 }
3937 pub fn release_lcd_clock(self, clocks: &mut ClockTree) {
3938 trace!("Releasing {:?}::LCD_CLOCK", self);
3939 if decrement_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
3940 {
3941 trace!("Disabling {:?}::LCD_CLOCK", self);
3942 crate::rtc_cntl::WakeLock::release();
3943 self.enable_lcd_clock_impl(clocks, false);
3944 match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
3945 LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
3946 LcdCamLcdClockSclk::PllD2 => release_pll_d2(clocks),
3947 LcdCamLcdClockSclk::Pll160m => release_pll_160m(clocks),
3948 }
3949 }
3950 }
3951 #[allow(unused_variables)]
3952 pub fn lcd_clock_config_frequency(
3953 clocks: &mut ClockTree,
3954 config: LcdCamLcdClockConfig,
3955 ) -> u32 {
3956 (((match config.sclk {
3957 LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
3958 LcdCamLcdClockSclk::PllD2 => pll_d2_frequency(),
3959 LcdCamLcdClockSclk::Pll160m => pll_160m_frequency(),
3960 } as u64)
3961 * (config.div_a() as u64))
3962 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3963 as u32
3964 }
3965 pub fn lcd_clock_frequency(self) -> u32 {
3966 LCD_CAM_LCD_CLOCK_FREQ_CACHE[self as usize]
3967 .load(::core::sync::atomic::Ordering::Acquire)
3968 }
3969 pub fn lcd_clock_source_frequency(sclk: LcdCamLcdClockSclk) -> u32 {
3970 match sclk {
3971 LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
3972 LcdCamLcdClockSclk::PllD2 => pll_d2_frequency(),
3973 LcdCamLcdClockSclk::Pll160m => pll_160m_frequency(),
3974 }
3975 }
3976 pub fn configure_cam_clock(self, clocks: &mut ClockTree, config: LcdCamCamClockConfig) {
3977 let old_config = clocks.lcd_cam_cam_clock[self as usize].replace(config);
3978 refresh_lcd_cam_cam_clock_downstream(clocks, self);
3979 if clocks.lcd_cam_cam_clock_refcount[self as usize] > 0 {
3980 match config.sclk {
3981 LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
3982 LcdCamCamClockSclk::PllD2 => request_pll_d2(clocks),
3983 LcdCamCamClockSclk::Pll160m => request_pll_160m(clocks),
3984 }
3985 self.configure_cam_clock_impl(clocks, old_config, config);
3986 if let Some(old_config) = old_config {
3987 match old_config.sclk {
3988 LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
3989 LcdCamCamClockSclk::PllD2 => release_pll_d2(clocks),
3990 LcdCamCamClockSclk::Pll160m => release_pll_160m(clocks),
3991 }
3992 }
3993 } else {
3994 self.configure_cam_clock_impl(clocks, old_config, config);
3995 }
3996 }
3997 pub fn cam_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamCamClockConfig> {
3998 clocks.lcd_cam_cam_clock[self as usize]
3999 }
4000 pub fn request_cam_clock(self, clocks: &mut ClockTree) {
4001 trace!("Requesting {:?}::CAM_CLOCK", self);
4002 if increment_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
4003 {
4004 trace!("Enabling {:?}::CAM_CLOCK", self);
4005 crate::rtc_cntl::WakeLock::acquire();
4006 match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
4007 LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
4008 LcdCamCamClockSclk::PllD2 => request_pll_d2(clocks),
4009 LcdCamCamClockSclk::Pll160m => request_pll_160m(clocks),
4010 }
4011 self.enable_cam_clock_impl(clocks, true);
4012 }
4013 }
4014 pub fn release_cam_clock(self, clocks: &mut ClockTree) {
4015 trace!("Releasing {:?}::CAM_CLOCK", self);
4016 if decrement_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
4017 {
4018 trace!("Disabling {:?}::CAM_CLOCK", self);
4019 crate::rtc_cntl::WakeLock::release();
4020 self.enable_cam_clock_impl(clocks, false);
4021 match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
4022 LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
4023 LcdCamCamClockSclk::PllD2 => release_pll_d2(clocks),
4024 LcdCamCamClockSclk::Pll160m => release_pll_160m(clocks),
4025 }
4026 }
4027 }
4028 #[allow(unused_variables)]
4029 pub fn cam_clock_config_frequency(
4030 clocks: &mut ClockTree,
4031 config: LcdCamCamClockConfig,
4032 ) -> u32 {
4033 (((match config.sclk {
4034 LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
4035 LcdCamCamClockSclk::PllD2 => pll_d2_frequency(),
4036 LcdCamCamClockSclk::Pll160m => pll_160m_frequency(),
4037 } as u64)
4038 * (config.div_a() as u64))
4039 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
4040 as u32
4041 }
4042 pub fn cam_clock_frequency(self) -> u32 {
4043 LCD_CAM_CAM_CLOCK_FREQ_CACHE[self as usize]
4044 .load(::core::sync::atomic::Ordering::Acquire)
4045 }
4046 pub fn cam_clock_source_frequency(sclk: LcdCamCamClockSclk) -> u32 {
4047 match sclk {
4048 LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
4049 LcdCamCamClockSclk::PllD2 => pll_d2_frequency(),
4050 LcdCamCamClockSclk::Pll160m => pll_160m_frequency(),
4051 }
4052 }
4053 }
4054 impl McpwmInstance {
4055 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4056 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4057 if increment_reference_count(
4058 &mut clocks.mcpwm_function_clock_refcount[self as usize],
4059 ) {
4060 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4061 crate::rtc_cntl::WakeLock::acquire();
4062 request_crypto_pwm_clk(clocks);
4063 self.enable_function_clock_impl(clocks, true);
4064 }
4065 }
4066 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4067 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4068 if decrement_reference_count(
4069 &mut clocks.mcpwm_function_clock_refcount[self as usize],
4070 ) {
4071 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4072 crate::rtc_cntl::WakeLock::release();
4073 self.enable_function_clock_impl(clocks, false);
4074 release_crypto_pwm_clk(clocks);
4075 }
4076 }
4077 pub fn function_clock_frequency(self) -> u32 {
4078 crypto_pwm_clk_frequency()
4079 }
4080 pub fn function_clock_source_frequency(source: McpwmFunctionClockConfig) -> u32 {
4081 match source {
4082 McpwmFunctionClockConfig::CryptoPwmClk => crypto_pwm_clk_frequency(),
4083 }
4084 }
4085 }
4086 impl RmtInstance {
4087 pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
4088 let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
4089 refresh_rmt_sclk_downstream(clocks, self);
4090 if clocks.rmt_sclk_refcount[self as usize] > 0 {
4091 match new_selector {
4092 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
4093 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
4094 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
4095 }
4096 self.configure_sclk_impl(clocks, old_selector, new_selector);
4097 if let Some(old_selector) = old_selector {
4098 match old_selector {
4099 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
4100 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
4101 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
4102 }
4103 }
4104 } else {
4105 self.configure_sclk_impl(clocks, old_selector, new_selector);
4106 }
4107 }
4108 pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
4109 clocks.rmt_sclk[self as usize]
4110 }
4111 pub fn request_sclk(self, clocks: &mut ClockTree) {
4112 trace!("Requesting {:?}::SCLK", self);
4113 if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
4114 trace!("Enabling {:?}::SCLK", self);
4115 crate::rtc_cntl::WakeLock::acquire();
4116 match unwrap!(clocks.rmt_sclk[self as usize]) {
4117 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
4118 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
4119 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
4120 }
4121 self.enable_sclk_impl(clocks, true);
4122 }
4123 }
4124 pub fn release_sclk(self, clocks: &mut ClockTree) {
4125 trace!("Releasing {:?}::SCLK", self);
4126 if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
4127 trace!("Disabling {:?}::SCLK", self);
4128 crate::rtc_cntl::WakeLock::release();
4129 self.enable_sclk_impl(clocks, false);
4130 match unwrap!(clocks.rmt_sclk[self as usize]) {
4131 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
4132 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
4133 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
4134 }
4135 }
4136 }
4137 #[allow(unused_variables)]
4138 pub fn sclk_config_frequency(clocks: &mut ClockTree, config: RmtSclkConfig) -> u32 {
4139 match config {
4140 RmtSclkConfig::ApbClk => apb_clk_frequency(),
4141 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
4142 RmtSclkConfig::XtalClk => xtal_clk_frequency(),
4143 }
4144 }
4145 pub fn sclk_frequency(self) -> u32 {
4146 RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
4147 }
4148 pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
4149 match source {
4150 RmtSclkConfig::ApbClk => apb_clk_frequency(),
4151 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
4152 RmtSclkConfig::XtalClk => xtal_clk_frequency(),
4153 }
4154 }
4155 }
4156 impl SpiInstance {
4157 pub fn configure_function_clock(
4158 self,
4159 clocks: &mut ClockTree,
4160 new_selector: SpiFunctionClockConfig,
4161 ) {
4162 let old_selector = clocks.spi_function_clock[self as usize].replace(new_selector);
4163 refresh_spi_function_clock_downstream(clocks, self);
4164 if clocks.spi_function_clock_refcount[self as usize] > 0 {
4165 match new_selector {
4166 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4167 SpiFunctionClockConfig::Apb => request_apb_clk(clocks),
4168 }
4169 self.configure_function_clock_impl(clocks, old_selector, new_selector);
4170 if let Some(old_selector) = old_selector {
4171 match old_selector {
4172 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4173 SpiFunctionClockConfig::Apb => release_apb_clk(clocks),
4174 }
4175 }
4176 } else {
4177 self.configure_function_clock_impl(clocks, old_selector, new_selector);
4178 }
4179 }
4180 pub fn function_clock_config(
4181 self,
4182 clocks: &mut ClockTree,
4183 ) -> Option<SpiFunctionClockConfig> {
4184 clocks.spi_function_clock[self as usize]
4185 }
4186 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4187 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4188 if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
4189 {
4190 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4191 crate::rtc_cntl::WakeLock::acquire();
4192 match unwrap!(clocks.spi_function_clock[self as usize]) {
4193 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
4194 SpiFunctionClockConfig::Apb => request_apb_clk(clocks),
4195 }
4196 self.enable_function_clock_impl(clocks, true);
4197 }
4198 }
4199 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4200 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4201 if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
4202 {
4203 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4204 crate::rtc_cntl::WakeLock::release();
4205 self.enable_function_clock_impl(clocks, false);
4206 match unwrap!(clocks.spi_function_clock[self as usize]) {
4207 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
4208 SpiFunctionClockConfig::Apb => release_apb_clk(clocks),
4209 }
4210 }
4211 }
4212 #[allow(unused_variables)]
4213 pub fn function_clock_config_frequency(
4214 clocks: &mut ClockTree,
4215 config: SpiFunctionClockConfig,
4216 ) -> u32 {
4217 match config {
4218 SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
4219 SpiFunctionClockConfig::Apb => apb_clk_frequency(),
4220 }
4221 }
4222 pub fn function_clock_frequency(self) -> u32 {
4223 SPI_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4224 .load(::core::sync::atomic::Ordering::Acquire)
4225 }
4226 pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
4227 match source {
4228 SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
4229 SpiFunctionClockConfig::Apb => apb_clk_frequency(),
4230 }
4231 }
4232 }
4233 impl TimgInstance {
4234 pub fn configure_function_clock(
4235 self,
4236 clocks: &mut ClockTree,
4237 new_selector: TimgFunctionClockConfig,
4238 ) {
4239 let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
4240 refresh_timg_function_clock_downstream(clocks, self);
4241 if clocks.timg_function_clock_refcount[self as usize] > 0 {
4242 match new_selector {
4243 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
4244 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
4245 }
4246 self.configure_function_clock_impl(clocks, old_selector, new_selector);
4247 if let Some(old_selector) = old_selector {
4248 match old_selector {
4249 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
4250 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
4251 }
4252 }
4253 } else {
4254 self.configure_function_clock_impl(clocks, old_selector, new_selector);
4255 }
4256 }
4257 pub fn function_clock_config(
4258 self,
4259 clocks: &mut ClockTree,
4260 ) -> Option<TimgFunctionClockConfig> {
4261 clocks.timg_function_clock[self as usize]
4262 }
4263 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4264 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4265 if increment_reference_count(
4266 &mut clocks.timg_function_clock_refcount[self as usize],
4267 ) {
4268 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4269 match unwrap!(clocks.timg_function_clock[self as usize]) {
4270 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
4271 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
4272 }
4273 self.enable_function_clock_impl(clocks, true);
4274 }
4275 }
4276 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4277 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4278 if decrement_reference_count(
4279 &mut clocks.timg_function_clock_refcount[self as usize],
4280 ) {
4281 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4282 self.enable_function_clock_impl(clocks, false);
4283 match unwrap!(clocks.timg_function_clock[self as usize]) {
4284 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
4285 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
4286 }
4287 }
4288 }
4289 #[allow(unused_variables)]
4290 pub fn function_clock_config_frequency(
4291 clocks: &mut ClockTree,
4292 config: TimgFunctionClockConfig,
4293 ) -> u32 {
4294 match config {
4295 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
4296 TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
4297 }
4298 }
4299 pub fn function_clock_frequency(self) -> u32 {
4300 TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4301 .load(::core::sync::atomic::Ordering::Acquire)
4302 }
4303 pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
4304 match source {
4305 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
4306 TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
4307 }
4308 }
4309 }
4310 impl UartInstance {
4311 pub fn configure_function_clock(
4312 self,
4313 clocks: &mut ClockTree,
4314 config: UartFunctionClockConfig,
4315 ) {
4316 let old_config = clocks.uart_function_clock[self as usize].replace(config);
4317 refresh_uart_function_clock_downstream(clocks, self);
4318 if clocks.uart_function_clock_refcount[self as usize] > 0 {
4319 match config.sclk {
4320 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
4321 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4322 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4323 }
4324 self.configure_function_clock_impl(clocks, old_config, config);
4325 if let Some(old_config) = old_config {
4326 match old_config.sclk {
4327 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
4328 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4329 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4330 }
4331 }
4332 } else {
4333 self.configure_function_clock_impl(clocks, old_config, config);
4334 }
4335 }
4336 pub fn function_clock_config(
4337 self,
4338 clocks: &mut ClockTree,
4339 ) -> Option<UartFunctionClockConfig> {
4340 clocks.uart_function_clock[self as usize]
4341 }
4342 pub fn request_function_clock(self, clocks: &mut ClockTree) {
4343 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
4344 if increment_reference_count(
4345 &mut clocks.uart_function_clock_refcount[self as usize],
4346 ) {
4347 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
4348 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
4349 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
4350 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
4351 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
4352 }
4353 self.enable_function_clock_impl(clocks, true);
4354 }
4355 }
4356 pub fn release_function_clock(self, clocks: &mut ClockTree) {
4357 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
4358 if decrement_reference_count(
4359 &mut clocks.uart_function_clock_refcount[self as usize],
4360 ) {
4361 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
4362 self.enable_function_clock_impl(clocks, false);
4363 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
4364 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
4365 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
4366 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
4367 }
4368 }
4369 }
4370 #[allow(unused_variables)]
4371 pub fn function_clock_config_frequency(
4372 clocks: &mut ClockTree,
4373 config: UartFunctionClockConfig,
4374 ) -> u32 {
4375 (match config.sclk {
4376 UartFunctionClockSclk::Apb => apb_clk_frequency(),
4377 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4378 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
4379 } / (config.div_num() + 1))
4380 }
4381 pub fn function_clock_frequency(self) -> u32 {
4382 UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
4383 .load(::core::sync::atomic::Ordering::Acquire)
4384 }
4385 pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
4386 match sclk {
4387 UartFunctionClockSclk::Apb => apb_clk_frequency(),
4388 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
4389 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
4390 }
4391 }
4392 pub fn configure_baud_rate_generator(
4393 self,
4394 clocks: &mut ClockTree,
4395 config: UartBaudRateGeneratorConfig,
4396 ) {
4397 let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
4398 refresh_uart_baud_rate_generator_downstream(clocks, self);
4399 self.configure_baud_rate_generator_impl(clocks, old_config, config);
4400 }
4401 pub fn baud_rate_generator_config(
4402 self,
4403 clocks: &mut ClockTree,
4404 ) -> Option<UartBaudRateGeneratorConfig> {
4405 clocks.uart_baud_rate_generator[self as usize]
4406 }
4407 pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
4408 trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
4409 if increment_reference_count(
4410 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
4411 ) {
4412 trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
4413 self.request_function_clock(clocks);
4414 self.enable_baud_rate_generator_impl(clocks, true);
4415 }
4416 }
4417 pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
4418 trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
4419 if decrement_reference_count(
4420 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
4421 ) {
4422 trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
4423 self.enable_baud_rate_generator_impl(clocks, false);
4424 self.release_function_clock(clocks);
4425 }
4426 }
4427 #[allow(unused_variables)]
4428 pub fn baud_rate_generator_config_frequency(
4429 self,
4430 clocks: &mut ClockTree,
4431 config: UartBaudRateGeneratorConfig,
4432 ) -> u32 {
4433 ((self.function_clock_frequency() * 16)
4434 / ((config.integral() * 16) + config.fractional()))
4435 }
4436 pub fn baud_rate_generator_frequency(self) -> u32 {
4437 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
4438 .load(::core::sync::atomic::Ordering::Acquire)
4439 }
4440 pub fn request_mem_clock(self, clocks: &mut ClockTree) {
4441 trace!("Requesting {:?}::MEM_CLOCK", self);
4442 if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
4443 trace!("Enabling {:?}::MEM_CLOCK", self);
4444 request_uart_mem_clk(clocks);
4445 self.enable_mem_clock_impl(clocks, true);
4446 }
4447 }
4448 pub fn release_mem_clock(self, clocks: &mut ClockTree) {
4449 trace!("Releasing {:?}::MEM_CLOCK", self);
4450 if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
4451 trace!("Disabling {:?}::MEM_CLOCK", self);
4452 self.enable_mem_clock_impl(clocks, false);
4453 release_uart_mem_clk(clocks);
4454 }
4455 }
4456 pub fn mem_clock_frequency(self) -> u32 {
4457 uart_mem_clk_frequency()
4458 }
4459 pub fn mem_clock_source_frequency() -> u32 {
4460 uart_mem_clk_frequency()
4461 }
4462 }
4463 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4471 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4472 #[instability::unstable]
4473 pub struct ClockConfig {
4474 pub xtal_clk: Option<XtalClkConfig>,
4476 pub pll_clk: Option<PllClkConfig>,
4478 pub system_pre_div: Option<SystemPreDivConfig>,
4480 pub cpu_pll_div_out: Option<CpuPllDivOutConfig>,
4482 pub cpu_clk: Option<CpuClkConfig>,
4484 pub rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
4486 pub rtc_slow_clk: Option<RtcSlowClkConfig>,
4488 pub rtc_fast_clk: Option<RtcFastClkConfig>,
4490 pub low_power_clk: Option<LowPowerClkConfig>,
4492 pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
4494 }
4495 impl ClockConfig {
4496 fn apply(&self, clocks: &mut ClockTree) {
4497 if let Some(config) = self.xtal_clk {
4498 configure_xtal_clk(clocks, config);
4499 }
4500 if let Some(config) = self.pll_clk {
4501 configure_pll_clk(clocks, config);
4502 }
4503 if let Some(config) = self.system_pre_div {
4504 configure_system_pre_div(clocks, config);
4505 }
4506 if let Some(config) = self.cpu_pll_div_out {
4507 configure_cpu_pll_div_out(clocks, config);
4508 }
4509 if let Some(config) = self.cpu_clk {
4510 configure_cpu_clk(clocks, config);
4511 }
4512 if let Some(config) = self.rc_fast_clk_div_n {
4513 configure_rc_fast_clk_div_n(clocks, config);
4514 }
4515 if let Some(config) = self.rtc_slow_clk {
4516 configure_rtc_slow_clk(clocks, config);
4517 }
4518 if let Some(config) = self.rtc_fast_clk {
4519 configure_rtc_fast_clk(clocks, config);
4520 }
4521 if let Some(config) = self.low_power_clk {
4522 configure_low_power_clk(clocks, config);
4523 }
4524 if let Some(config) = self.timg_calibration_clock {
4525 configure_timg_calibration_clock(clocks, config);
4526 }
4527 }
4528 }
4529 fn increment_reference_count(refcount: &mut u32) -> bool {
4530 let first = *refcount == 0;
4531 *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
4532 first
4533 }
4534 fn decrement_reference_count(refcount: &mut u32) -> bool {
4535 *refcount = refcount.saturating_sub(1);
4536 let last = *refcount == 0;
4537 last
4538 }
4539 fn refresh_xtal_clk_downstream(clocks: &mut ClockTree) {
4540 if let Some(config) = clocks.xtal_clk {
4541 XTAL_CLK_FREQ_CACHE.store(
4542 xtal_clk_config_frequency(clocks, config),
4543 ::core::sync::atomic::Ordering::Release,
4544 );
4545 }
4546 refresh_pll_clk_downstream(clocks);
4547 refresh_system_pre_div_in_downstream(clocks);
4548 refresh_rtc_fast_clk_downstream(clocks);
4549 refresh_low_power_clk_downstream(clocks);
4550 for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
4551 refresh_i2c_function_clock_downstream(clocks, child_instance);
4552 }
4553 for child_instance in [I2sInstance::I2s0, I2sInstance::I2s1] {
4554 refresh_i2s_tx_clk_downstream(clocks, child_instance);
4555 refresh_i2s_rx_clk_downstream(clocks, child_instance);
4556 }
4557 for child_instance in [LcdCamInstance::LcdCam] {
4558 refresh_lcd_cam_lcd_clock_downstream(clocks, child_instance);
4559 refresh_lcd_cam_cam_clock_downstream(clocks, child_instance);
4560 }
4561 for child_instance in [RmtInstance::Rmt] {
4562 refresh_rmt_sclk_downstream(clocks, child_instance);
4563 }
4564 for child_instance in [SpiInstance::Spi2, SpiInstance::Spi3] {
4565 refresh_spi_function_clock_downstream(clocks, child_instance);
4566 }
4567 for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
4568 refresh_timg_function_clock_downstream(clocks, child_instance);
4569 }
4570 for child_instance in [
4571 UartInstance::Uart0,
4572 UartInstance::Uart1,
4573 UartInstance::Uart2,
4574 ] {
4575 refresh_uart_function_clock_downstream(clocks, child_instance);
4576 }
4577 }
4578 fn refresh_pll_clk_downstream(clocks: &mut ClockTree) {
4579 if let Some(config) = clocks.pll_clk {
4580 PLL_CLK_FREQ_CACHE.store(
4581 pll_clk_config_frequency(clocks, config),
4582 ::core::sync::atomic::Ordering::Release,
4583 );
4584 }
4585 refresh_cpu_pll_div_out_downstream(clocks);
4586 for child_instance in [I2sInstance::I2s0, I2sInstance::I2s1] {
4587 refresh_i2s_tx_clk_downstream(clocks, child_instance);
4588 refresh_i2s_rx_clk_downstream(clocks, child_instance);
4589 }
4590 for child_instance in [LcdCamInstance::LcdCam] {
4591 refresh_lcd_cam_lcd_clock_downstream(clocks, child_instance);
4592 refresh_lcd_cam_cam_clock_downstream(clocks, child_instance);
4593 }
4594 }
4595 fn refresh_system_pre_div_in_downstream(clocks: &mut ClockTree) {
4596 if let Some(config) = clocks.system_pre_div_in {
4597 SYSTEM_PRE_DIV_IN_FREQ_CACHE.store(
4598 system_pre_div_in_config_frequency(clocks, config),
4599 ::core::sync::atomic::Ordering::Release,
4600 );
4601 }
4602 refresh_system_pre_div_downstream(clocks);
4603 }
4604 fn refresh_system_pre_div_downstream(clocks: &mut ClockTree) {
4605 if let Some(config) = clocks.system_pre_div {
4606 SYSTEM_PRE_DIV_FREQ_CACHE.store(
4607 system_pre_div_config_frequency(clocks, config),
4608 ::core::sync::atomic::Ordering::Release,
4609 );
4610 }
4611 refresh_cpu_clk_downstream(clocks);
4612 }
4613 fn refresh_cpu_pll_div_out_downstream(clocks: &mut ClockTree) {
4614 if let Some(config) = clocks.cpu_pll_div_out {
4615 CPU_PLL_DIV_OUT_FREQ_CACHE.store(
4616 cpu_pll_div_out_config_frequency(clocks, config),
4617 ::core::sync::atomic::Ordering::Release,
4618 );
4619 }
4620 refresh_cpu_clk_downstream(clocks);
4621 }
4622 fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
4623 if let Some(config) = clocks.cpu_clk {
4624 CPU_CLK_FREQ_CACHE.store(
4625 cpu_clk_config_frequency(clocks, config),
4626 ::core::sync::atomic::Ordering::Release,
4627 );
4628 }
4629 refresh_apb_clk_downstream(clocks);
4630 refresh_crypto_pwm_clk_downstream(clocks);
4631 for child_instance in [I2sInstance::I2s0, I2sInstance::I2s1] {
4632 refresh_i2s_tx_clk_downstream(clocks, child_instance);
4633 refresh_i2s_rx_clk_downstream(clocks, child_instance);
4634 }
4635 for child_instance in [LcdCamInstance::LcdCam] {
4636 refresh_lcd_cam_lcd_clock_downstream(clocks, child_instance);
4637 refresh_lcd_cam_cam_clock_downstream(clocks, child_instance);
4638 }
4639 }
4640 fn refresh_rc_fast_clk_div_n_downstream(clocks: &mut ClockTree) {
4641 if let Some(config) = clocks.rc_fast_clk_div_n {
4642 RC_FAST_CLK_DIV_N_FREQ_CACHE.store(
4643 rc_fast_clk_div_n_config_frequency(clocks, config),
4644 ::core::sync::atomic::Ordering::Release,
4645 );
4646 }
4647 refresh_rtc_fast_clk_downstream(clocks);
4648 }
4649 fn refresh_rtc_slow_clk_downstream(clocks: &mut ClockTree) {
4650 if let Some(config) = clocks.rtc_slow_clk {
4651 RTC_SLOW_CLK_FREQ_CACHE.store(
4652 rtc_slow_clk_config_frequency(clocks, config),
4653 ::core::sync::atomic::Ordering::Release,
4654 );
4655 }
4656 refresh_low_power_clk_downstream(clocks);
4657 }
4658 fn refresh_rtc_fast_clk_downstream(clocks: &mut ClockTree) {
4659 if let Some(config) = clocks.rtc_fast_clk {
4660 RTC_FAST_CLK_FREQ_CACHE.store(
4661 rtc_fast_clk_config_frequency(clocks, config),
4662 ::core::sync::atomic::Ordering::Release,
4663 );
4664 }
4665 }
4666 fn refresh_low_power_clk_downstream(clocks: &mut ClockTree) {
4667 if let Some(config) = clocks.low_power_clk {
4668 LOW_POWER_CLK_FREQ_CACHE.store(
4669 low_power_clk_config_frequency(clocks, config),
4670 ::core::sync::atomic::Ordering::Release,
4671 );
4672 }
4673 }
4674 fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
4675 if let Some(config) = clocks.timg_calibration_clock {
4676 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
4677 timg_calibration_clock_config_frequency(clocks, config),
4678 ::core::sync::atomic::Ordering::Release,
4679 );
4680 }
4681 }
4682 fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
4683 if let Some(config) = clocks.i2c_function_clock[instance as usize] {
4684 I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4685 I2cInstance::function_clock_config_frequency(clocks, config),
4686 ::core::sync::atomic::Ordering::Release,
4687 );
4688 }
4689 }
4690 fn refresh_i2s_tx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
4691 if let Some(config) = clocks.i2s_tx_clk[instance as usize] {
4692 I2S_TX_CLK_FREQ_CACHE[instance as usize].store(
4693 I2sInstance::tx_clk_config_frequency(clocks, config),
4694 ::core::sync::atomic::Ordering::Release,
4695 );
4696 }
4697 refresh_i2s_mclk_out_downstream(clocks, instance);
4698 }
4699 fn refresh_i2s_rx_clk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
4700 if let Some(config) = clocks.i2s_rx_clk[instance as usize] {
4701 I2S_RX_CLK_FREQ_CACHE[instance as usize].store(
4702 I2sInstance::rx_clk_config_frequency(clocks, config),
4703 ::core::sync::atomic::Ordering::Release,
4704 );
4705 }
4706 refresh_i2s_mclk_out_downstream(clocks, instance);
4707 }
4708 fn refresh_i2s_mclk_out_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
4709 if let Some(config) = clocks.i2s_mclk_out[instance as usize] {
4710 I2S_MCLK_OUT_FREQ_CACHE[instance as usize].store(
4711 instance.mclk_out_config_frequency(clocks, config),
4712 ::core::sync::atomic::Ordering::Release,
4713 );
4714 }
4715 }
4716 fn refresh_lcd_cam_lcd_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
4717 if let Some(config) = clocks.lcd_cam_lcd_clock[instance as usize] {
4718 LCD_CAM_LCD_CLOCK_FREQ_CACHE[instance as usize].store(
4719 LcdCamInstance::lcd_clock_config_frequency(clocks, config),
4720 ::core::sync::atomic::Ordering::Release,
4721 );
4722 }
4723 }
4724 fn refresh_lcd_cam_cam_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
4725 if let Some(config) = clocks.lcd_cam_cam_clock[instance as usize] {
4726 LCD_CAM_CAM_CLOCK_FREQ_CACHE[instance as usize].store(
4727 LcdCamInstance::cam_clock_config_frequency(clocks, config),
4728 ::core::sync::atomic::Ordering::Release,
4729 );
4730 }
4731 }
4732 fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
4733 if let Some(config) = clocks.apb_clk {
4734 APB_CLK_FREQ_CACHE.store(
4735 apb_clk_config_frequency(clocks, config),
4736 ::core::sync::atomic::Ordering::Release,
4737 );
4738 }
4739 for child_instance in [RmtInstance::Rmt] {
4740 refresh_rmt_sclk_downstream(clocks, child_instance);
4741 }
4742 for child_instance in [SpiInstance::Spi2, SpiInstance::Spi3] {
4743 refresh_spi_function_clock_downstream(clocks, child_instance);
4744 }
4745 for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
4746 refresh_timg_function_clock_downstream(clocks, child_instance);
4747 }
4748 for child_instance in [
4749 UartInstance::Uart0,
4750 UartInstance::Uart1,
4751 UartInstance::Uart2,
4752 ] {
4753 refresh_uart_function_clock_downstream(clocks, child_instance);
4754 }
4755 }
4756 fn refresh_crypto_pwm_clk_downstream(clocks: &mut ClockTree) {
4757 if let Some(config) = clocks.crypto_pwm_clk {
4758 CRYPTO_PWM_CLK_FREQ_CACHE.store(
4759 crypto_pwm_clk_config_frequency(clocks, config),
4760 ::core::sync::atomic::Ordering::Release,
4761 );
4762 }
4763 }
4764 fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
4765 if let Some(config) = clocks.rmt_sclk[instance as usize] {
4766 RMT_SCLK_FREQ_CACHE[instance as usize].store(
4767 RmtInstance::sclk_config_frequency(clocks, config),
4768 ::core::sync::atomic::Ordering::Release,
4769 );
4770 }
4771 }
4772 fn refresh_spi_function_clock_downstream(clocks: &mut ClockTree, instance: SpiInstance) {
4773 if let Some(config) = clocks.spi_function_clock[instance as usize] {
4774 SPI_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4775 SpiInstance::function_clock_config_frequency(clocks, config),
4776 ::core::sync::atomic::Ordering::Release,
4777 );
4778 }
4779 }
4780 fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
4781 if let Some(config) = clocks.timg_function_clock[instance as usize] {
4782 TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4783 TimgInstance::function_clock_config_frequency(clocks, config),
4784 ::core::sync::atomic::Ordering::Release,
4785 );
4786 }
4787 }
4788 fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
4789 if let Some(config) = clocks.uart_function_clock[instance as usize] {
4790 UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4791 UartInstance::function_clock_config_frequency(clocks, config),
4792 ::core::sync::atomic::Ordering::Release,
4793 );
4794 }
4795 refresh_uart_baud_rate_generator_downstream(clocks, instance);
4796 }
4797 fn refresh_uart_baud_rate_generator_downstream(
4798 clocks: &mut ClockTree,
4799 instance: UartInstance,
4800 ) {
4801 if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
4802 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
4803 instance.baud_rate_generator_config_frequency(clocks, config),
4804 ::core::sync::atomic::Ordering::Release,
4805 );
4806 }
4807 }
4808 };
4809}
4810#[macro_export]
4814#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4815macro_rules! implement_peripheral_clocks {
4816 () => {
4817 #[doc(hidden)]
4818 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4819 #[repr(u8)]
4820 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4821 pub enum Peripheral {
4822 Aes,
4824 AhbGdma,
4826 ApbSarAdc,
4828 DedicatedGpio,
4830 Ds,
4832 GpioSd,
4834 Hmac,
4836 I2cExt0,
4838 I2cExt1,
4840 I2s0,
4842 I2s1,
4844 LcdCam,
4846 Ledc,
4848 Mcpwm0,
4850 Mcpwm1,
4852 Pcnt,
4854 PeriBackup,
4856 Rmt,
4858 Rsa,
4860 SdioHost,
4862 Sha,
4864 Spi2,
4866 Spi3,
4868 Systimer,
4870 Timg0,
4872 Timg1,
4874 Twai0,
4876 Uart0,
4878 Uart1,
4880 Uart2,
4882 UartMem,
4884 Uhci0,
4886 UsbDevice,
4888 UsbFs,
4890 }
4891 impl Peripheral {
4892 const KEEP_ENABLED: &[Peripheral] = &[
4893 Self::Systimer,
4894 Self::Timg0,
4895 Self::Uart0,
4896 Self::UartMem,
4897 Self::UsbDevice,
4898 ];
4899 const COUNT: usize = Self::ALL.len();
4900 const ALL: &[Self] = &[
4901 Self::Aes,
4902 Self::AhbGdma,
4903 Self::ApbSarAdc,
4904 Self::DedicatedGpio,
4905 Self::Ds,
4906 Self::GpioSd,
4907 Self::Hmac,
4908 Self::I2cExt0,
4909 Self::I2cExt1,
4910 Self::I2s0,
4911 Self::I2s1,
4912 Self::LcdCam,
4913 Self::Ledc,
4914 Self::Mcpwm0,
4915 Self::Mcpwm1,
4916 Self::Pcnt,
4917 Self::PeriBackup,
4918 Self::Rmt,
4919 Self::Rsa,
4920 Self::SdioHost,
4921 Self::Sha,
4922 Self::Spi2,
4923 Self::Spi3,
4924 Self::Systimer,
4925 Self::Timg0,
4926 Self::Timg1,
4927 Self::Twai0,
4928 Self::Uart0,
4929 Self::Uart1,
4930 Self::Uart2,
4931 Self::UartMem,
4932 Self::Uhci0,
4933 Self::UsbDevice,
4934 Self::UsbFs,
4935 ];
4936 }
4937 unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
4938 match peripheral {
4939 Peripheral::Aes => {
4940 crate::peripherals::SYSTEM::regs()
4941 .perip_clk_en1()
4942 .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
4943 }
4944 Peripheral::AhbGdma => {
4945 crate::peripherals::SYSTEM::regs()
4946 .perip_clk_en1()
4947 .modify(|_, w| w.dma_clk_en().bit(enable));
4948 }
4949 Peripheral::ApbSarAdc => {
4950 crate::peripherals::SYSTEM::regs()
4951 .perip_clk_en0()
4952 .modify(|_, w| w.apb_saradc_clk_en().bit(enable));
4953 }
4954 Peripheral::DedicatedGpio => {
4955 crate::peripherals::SYSTEM::regs()
4956 .cpu_peri_clk_en()
4957 .modify(|_, w| w.dedicated_gpio_clk_en().bit(enable));
4958 }
4959 Peripheral::Ds => {
4960 crate::peripherals::SYSTEM::regs()
4961 .perip_clk_en1()
4962 .modify(|_, w| w.crypto_ds_clk_en().bit(enable));
4963 }
4964 Peripheral::GpioSd => {
4965 crate::peripherals::GPIO_SD::regs()
4966 .clock_gate()
4967 .modify(|_, w| w.clk_en().bit(enable));
4968 }
4969 Peripheral::Hmac => {
4970 crate::peripherals::SYSTEM::regs()
4971 .perip_clk_en1()
4972 .modify(|_, w| w.crypto_hmac_clk_en().bit(enable));
4973 }
4974 Peripheral::I2cExt0 => {
4975 crate::peripherals::SYSTEM::regs()
4976 .perip_clk_en0()
4977 .modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
4978 }
4979 Peripheral::I2cExt1 => {
4980 crate::peripherals::SYSTEM::regs()
4981 .perip_clk_en0()
4982 .modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
4983 }
4984 Peripheral::I2s0 => {
4985 crate::peripherals::SYSTEM::regs()
4986 .perip_clk_en0()
4987 .modify(|_, w| w.i2s0_clk_en().bit(enable));
4988 }
4989 Peripheral::I2s1 => {
4990 crate::peripherals::SYSTEM::regs()
4991 .perip_clk_en0()
4992 .modify(|_, w| w.i2s1_clk_en().bit(enable));
4993 }
4994 Peripheral::LcdCam => {
4995 crate::peripherals::SYSTEM::regs()
4996 .perip_clk_en1()
4997 .modify(|_, w| w.lcd_cam_clk_en().bit(enable));
4998 }
4999 Peripheral::Ledc => {
5000 crate::peripherals::SYSTEM::regs()
5001 .perip_clk_en0()
5002 .modify(|_, w| w.ledc_clk_en().bit(enable));
5003 }
5004 Peripheral::Mcpwm0 => {
5005 crate::peripherals::SYSTEM::regs()
5006 .perip_clk_en0()
5007 .modify(|_, w| w.pwm0_clk_en().bit(enable));
5008 }
5009 Peripheral::Mcpwm1 => {
5010 crate::peripherals::SYSTEM::regs()
5011 .perip_clk_en0()
5012 .modify(|_, w| w.pwm1_clk_en().bit(enable));
5013 }
5014 Peripheral::Pcnt => {
5015 crate::peripherals::SYSTEM::regs()
5016 .perip_clk_en0()
5017 .modify(|_, w| w.pcnt_clk_en().bit(enable));
5018 }
5019 Peripheral::PeriBackup => {
5020 crate::peripherals::SYSTEM::regs()
5021 .perip_clk_en1()
5022 .modify(|_, w| w.peri_backup_clk_en().bit(enable));
5023 }
5024 Peripheral::Rmt => {
5025 crate::peripherals::SYSTEM::regs()
5026 .perip_clk_en0()
5027 .modify(|_, w| w.rmt_clk_en().bit(enable));
5028 }
5029 Peripheral::Rsa => {
5030 crate::peripherals::SYSTEM::regs()
5031 .perip_clk_en1()
5032 .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
5033 }
5034 Peripheral::SdioHost => {
5035 crate::peripherals::SYSTEM::regs()
5036 .perip_clk_en1()
5037 .modify(|_, w| w.sdio_host_clk_en().bit(enable));
5038 }
5039 Peripheral::Sha => {
5040 crate::peripherals::SYSTEM::regs()
5041 .perip_clk_en1()
5042 .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
5043 }
5044 Peripheral::Spi2 => {
5045 crate::peripherals::SYSTEM::regs()
5046 .perip_clk_en0()
5047 .modify(|_, w| w.spi2_clk_en().bit(enable));
5048 }
5049 Peripheral::Spi3 => {
5050 crate::peripherals::SYSTEM::regs()
5051 .perip_clk_en0()
5052 .modify(|_, w| w.spi3_clk_en().bit(enable));
5053 }
5054 Peripheral::Systimer => {
5055 crate::peripherals::SYSTEM::regs()
5056 .perip_clk_en0()
5057 .modify(|_, w| w.systimer_clk_en().bit(enable));
5058 }
5059 Peripheral::Timg0 => {
5060 crate::peripherals::SYSTEM::regs()
5061 .perip_clk_en0()
5062 .modify(|_, w| w.timergroup_clk_en().bit(enable));
5063 }
5064 Peripheral::Timg1 => {
5065 crate::peripherals::SYSTEM::regs()
5066 .perip_clk_en0()
5067 .modify(|_, w| w.timergroup1_clk_en().bit(enable));
5068 }
5069 Peripheral::Twai0 => {
5070 crate::peripherals::SYSTEM::regs()
5071 .perip_clk_en0()
5072 .modify(|_, w| w.twai_clk_en().bit(enable));
5073 }
5074 Peripheral::Uart0 => {
5075 crate::peripherals::SYSTEM::regs()
5076 .perip_clk_en0()
5077 .modify(|_, w| w.uart_clk_en().bit(enable));
5078 }
5079 Peripheral::Uart1 => {
5080 crate::peripherals::SYSTEM::regs()
5081 .perip_clk_en0()
5082 .modify(|_, w| w.uart1_clk_en().bit(enable));
5083 }
5084 Peripheral::Uart2 => {
5085 crate::peripherals::SYSTEM::regs()
5086 .perip_clk_en1()
5087 .modify(|_, w| w.uart2_clk_en().bit(enable));
5088 }
5089 Peripheral::UartMem => {
5090 crate::peripherals::SYSTEM::regs()
5091 .perip_clk_en0()
5092 .modify(|_, w| w.uart_mem_clk_en().bit(enable));
5093 }
5094 Peripheral::Uhci0 => {
5095 crate::peripherals::SYSTEM::regs()
5096 .perip_clk_en0()
5097 .modify(|_, w| w.uhci0_clk_en().bit(enable));
5098 }
5099 Peripheral::UsbDevice => {
5100 crate::peripherals::SYSTEM::regs()
5101 .perip_clk_en1()
5102 .modify(|_, w| w.usb_device_clk_en().bit(enable));
5103 }
5104 Peripheral::UsbFs => {
5105 crate::peripherals::SYSTEM::regs()
5106 .perip_clk_en0()
5107 .modify(|_, w| w.usb_clk_en().bit(enable));
5108 }
5109 }
5110 }
5111 unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
5112 match peripheral {
5113 Peripheral::Aes => {
5114 crate::peripherals::SYSTEM::regs()
5115 .perip_rst_en1()
5116 .modify(|_, w| w.crypto_aes_rst().bit(reset));
5117 }
5118 Peripheral::AhbGdma => {
5119 crate::peripherals::SYSTEM::regs()
5120 .perip_rst_en1()
5121 .modify(|_, w| w.dma_rst().bit(reset));
5122 }
5123 Peripheral::ApbSarAdc => {
5124 crate::peripherals::SYSTEM::regs()
5125 .perip_rst_en0()
5126 .modify(|_, w| w.apb_saradc_rst().bit(reset));
5127 }
5128 Peripheral::DedicatedGpio => {
5129 crate::peripherals::SYSTEM::regs()
5130 .cpu_peri_rst_en()
5131 .modify(|_, w| w.dedicated_gpio_rst().bit(reset));
5132 }
5133 Peripheral::Ds => {
5134 crate::peripherals::SYSTEM::regs()
5135 .perip_rst_en1()
5136 .modify(|_, w| w.crypto_ds_rst().bit(reset));
5137 }
5138 Peripheral::GpioSd => {
5139 let _ = reset;
5140 }
5141 Peripheral::Hmac => {
5142 crate::peripherals::SYSTEM::regs()
5143 .perip_rst_en1()
5144 .modify(|_, w| w.crypto_hmac_rst().bit(reset));
5145 }
5146 Peripheral::I2cExt0 => {
5147 crate::peripherals::SYSTEM::regs()
5148 .perip_rst_en0()
5149 .modify(|_, w| w.i2c_ext0_rst().bit(reset));
5150 }
5151 Peripheral::I2cExt1 => {
5152 crate::peripherals::SYSTEM::regs()
5153 .perip_rst_en0()
5154 .modify(|_, w| w.i2c_ext1_rst().bit(reset));
5155 }
5156 Peripheral::I2s0 => {
5157 crate::peripherals::SYSTEM::regs()
5158 .perip_rst_en0()
5159 .modify(|_, w| w.i2s0_rst().bit(reset));
5160 }
5161 Peripheral::I2s1 => {
5162 crate::peripherals::SYSTEM::regs()
5163 .perip_rst_en0()
5164 .modify(|_, w| w.i2s1_rst().bit(reset));
5165 }
5166 Peripheral::LcdCam => {
5167 crate::peripherals::SYSTEM::regs()
5168 .perip_rst_en1()
5169 .modify(|_, w| w.lcd_cam_rst().bit(reset));
5170 }
5171 Peripheral::Ledc => {
5172 crate::peripherals::SYSTEM::regs()
5173 .perip_rst_en0()
5174 .modify(|_, w| w.ledc_rst().bit(reset));
5175 }
5176 Peripheral::Mcpwm0 => {
5177 crate::peripherals::SYSTEM::regs()
5178 .perip_rst_en0()
5179 .modify(|_, w| w.pwm0_rst().bit(reset));
5180 }
5181 Peripheral::Mcpwm1 => {
5182 crate::peripherals::SYSTEM::regs()
5183 .perip_rst_en0()
5184 .modify(|_, w| w.pwm1_rst().bit(reset));
5185 }
5186 Peripheral::Pcnt => {
5187 crate::peripherals::SYSTEM::regs()
5188 .perip_rst_en0()
5189 .modify(|_, w| w.pcnt_rst().bit(reset));
5190 }
5191 Peripheral::PeriBackup => {
5192 crate::peripherals::SYSTEM::regs()
5193 .perip_rst_en1()
5194 .modify(|_, w| w.peri_backup_rst().bit(reset));
5195 }
5196 Peripheral::Rmt => {
5197 crate::peripherals::SYSTEM::regs()
5198 .perip_rst_en0()
5199 .modify(|_, w| w.rmt_rst().bit(reset));
5200 }
5201 Peripheral::Rsa => {
5202 crate::peripherals::SYSTEM::regs()
5203 .perip_rst_en1()
5204 .modify(|_, w| w.crypto_rsa_rst().bit(reset));
5205 }
5206 Peripheral::SdioHost => {
5207 crate::peripherals::SYSTEM::regs()
5208 .perip_rst_en1()
5209 .modify(|_, w| w.sdio_host_rst().bit(reset));
5210 }
5211 Peripheral::Sha => {
5212 crate::peripherals::SYSTEM::regs()
5213 .perip_rst_en1()
5214 .modify(|_, w| w.crypto_sha_rst().bit(reset));
5215 }
5216 Peripheral::Spi2 => {
5217 crate::peripherals::SYSTEM::regs()
5218 .perip_rst_en0()
5219 .modify(|_, w| w.spi2_rst().bit(reset));
5220 }
5221 Peripheral::Spi3 => {
5222 crate::peripherals::SYSTEM::regs()
5223 .perip_rst_en0()
5224 .modify(|_, w| w.spi3_rst().bit(reset));
5225 }
5226 Peripheral::Systimer => {
5227 crate::peripherals::SYSTEM::regs()
5228 .perip_rst_en0()
5229 .modify(|_, w| w.systimer_rst().bit(reset));
5230 }
5231 Peripheral::Timg0 => {
5232 crate::peripherals::SYSTEM::regs()
5233 .perip_rst_en0()
5234 .modify(|_, w| w.timergroup_rst().bit(reset));
5235 }
5236 Peripheral::Timg1 => {
5237 crate::peripherals::SYSTEM::regs()
5238 .perip_rst_en0()
5239 .modify(|_, w| w.timergroup1_rst().bit(reset));
5240 }
5241 Peripheral::Twai0 => {
5242 crate::peripherals::SYSTEM::regs()
5243 .perip_rst_en0()
5244 .modify(|_, w| w.twai_rst().bit(reset));
5245 }
5246 Peripheral::Uart0 => {
5247 crate::peripherals::SYSTEM::regs()
5248 .perip_rst_en0()
5249 .modify(|_, w| w.uart_rst().bit(reset));
5250 }
5251 Peripheral::Uart1 => {
5252 crate::peripherals::SYSTEM::regs()
5253 .perip_rst_en0()
5254 .modify(|_, w| w.uart1_rst().bit(reset));
5255 }
5256 Peripheral::Uart2 => {
5257 crate::peripherals::SYSTEM::regs()
5258 .perip_rst_en1()
5259 .modify(|_, w| w.uart2_rst().bit(reset));
5260 }
5261 Peripheral::UartMem => {
5262 crate::peripherals::SYSTEM::regs()
5263 .perip_rst_en0()
5264 .modify(|_, w| w.uart_mem_rst().bit(reset));
5265 }
5266 Peripheral::Uhci0 => {
5267 crate::peripherals::SYSTEM::regs()
5268 .perip_rst_en0()
5269 .modify(|_, w| w.uhci0_rst().bit(reset));
5270 }
5271 Peripheral::UsbDevice => {
5272 crate::peripherals::SYSTEM::regs()
5273 .perip_rst_en1()
5274 .modify(|_, w| w.usb_device_rst().bit(reset));
5275 }
5276 Peripheral::UsbFs => {
5277 crate::peripherals::SYSTEM::regs()
5278 .perip_rst_en0()
5279 .modify(|_, w| w.usb_rst().bit(reset));
5280 }
5281 }
5282 }
5283 };
5284}
5285#[macro_export]
5293#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5294macro_rules! memory_range {
5295 ("DRAM") => {
5296 0x3FC88000..0x3FD00000
5297 };
5298 (size as str, "DRAM") => {
5299 "491520"
5300 };
5301 ("DRAM2_UNINIT") => {
5302 0x3FCDB700..0x3FCED710
5303 };
5304 (size as str, "DRAM2_UNINIT") => {
5305 "73744"
5306 };
5307 ("IROM") => {
5308 0x42000000..0x44000000
5309 };
5310 (size as str, "IROM") => {
5311 "33554432"
5312 };
5313 ("DROM") => {
5314 0x3C000000..0x3E000000
5315 };
5316 (size as str, "DROM") => {
5317 "33554432"
5318 };
5319}
5320#[macro_export]
5337#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5338macro_rules! for_each_i2c_master {
5339 ($($pattern:tt => $code:tt;)*) => {
5340 macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
5341 => {} } _for_each_inner_i2c_master!((0, I2C0, I2cExt0, I2CEXT0_SCL,
5342 I2CEXT0_SDA)); _for_each_inner_i2c_master!((1, I2C1, I2cExt1, I2CEXT1_SCL,
5343 I2CEXT1_SDA)); _for_each_inner_i2c_master!((all(0, I2C0, I2cExt0, I2CEXT0_SCL,
5344 I2CEXT0_SDA), (1, I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA)));
5345 };
5346}
5347#[macro_export]
5374#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5375macro_rules! for_each_i2s {
5376 ($($pattern:tt => $code:tt;)*) => {
5377 macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
5378 _for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S1));
5379 _for_each_inner_i2s!((I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
5380 I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
5381 true, true, true, true)); _for_each_inner_i2s!((I2S1, I2s1, I2S1_MCLK, I2S1O_BCK,
5382 I2S1O_WS, I2S1I_BCK, I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false,
5383 false)); _for_each_inner_i2s!((names(I2S0), (I2S1)));
5384 _for_each_inner_i2s!((all(I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
5385 I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
5386 true, true, true, true), (I2S1, I2s1, I2S1_MCLK, I2S1O_BCK, I2S1O_WS, I2S1I_BCK,
5387 I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false, false)));
5388 };
5389}
5390#[macro_export]
5409#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5410macro_rules! for_each_uart {
5411 ($($pattern:tt => $code:tt;)*) => {
5412 macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
5413 } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
5414 wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
5415 U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((2, UART2, Uart2,
5416 U2RXD, U2TXD, U2CTS, U2RTS, wakeup_source = false));
5417 _for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
5418 wakeup_source = true), (1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS,
5419 wakeup_source = true), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS,
5420 wakeup_source = false)));
5421 };
5422}
5423#[macro_export]
5445#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5446macro_rules! for_each_spi_master {
5447 ($($pattern:tt => $code:tt;)*) => {
5448 macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
5449 => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
5450 _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
5451 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
5452 FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
5453 SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD],
5454 true)); _for_each_inner_spi_master!((names(SPI2), (SPI3)));
5455 _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
5456 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
5457 FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2]
5458 [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD], true)));
5459 };
5460}
5461#[macro_export]
5478#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5479macro_rules! for_each_spi_slave {
5480 ($($pattern:tt => $code:tt;)*) => {
5481 macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
5482 => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
5483 _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
5484 _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0));
5485 _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
5486 _for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
5487 (SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0)));
5488 };
5489}
5490#[macro_export]
5513#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5514macro_rules! for_each_pcnt_unit {
5515 ($($pattern:tt => $code:tt;)*) => {
5516 macro_rules! _for_each_inner_pcnt_unit { $(($pattern) => $code;)* ($other : tt)
5517 => {} } _for_each_inner_pcnt_unit!((PCNT0_UNIT0));
5518 _for_each_inner_pcnt_unit!((PCNT0_UNIT1));
5519 _for_each_inner_pcnt_unit!((PCNT0_UNIT2));
5520 _for_each_inner_pcnt_unit!((PCNT0_UNIT3));
5521 _for_each_inner_pcnt_unit!((PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT,
5522 PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1));
5523 _for_each_inner_pcnt_unit!((PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT,
5524 PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0, PCNT1_CTRL_CH1));
5525 _for_each_inner_pcnt_unit!((PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT,
5526 PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1));
5527 _for_each_inner_pcnt_unit!((PCNT0_UNIT3, Pcnt0Unit3, Pcnt, PCNT, 3, PCNT,
5528 PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1));
5529 _for_each_inner_pcnt_unit!((PCNT)); _for_each_inner_pcnt_unit!((PCNT));
5530 _for_each_inner_pcnt_unit!((names(PCNT0_UNIT0), (PCNT0_UNIT1), (PCNT0_UNIT2),
5531 (PCNT0_UNIT3))); _for_each_inner_pcnt_unit!((all(PCNT0_UNIT0, Pcnt0Unit0, Pcnt,
5532 PCNT, 0, PCNT, PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1),
5533 (PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT, PCNT1_SIG_CH0, PCNT1_SIG_CH1,
5534 PCNT1_CTRL_CH0, PCNT1_CTRL_CH1), (PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT,
5535 PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1), (PCNT0_UNIT3,
5536 Pcnt0Unit3, Pcnt, PCNT, 3, PCNT, PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0,
5537 PCNT3_CTRL_CH1))); _for_each_inner_pcnt_unit!((interrupt(PCNT)));
5538 _for_each_inner_pcnt_unit!((regs(PCNT)));
5539 };
5540}
5541#[macro_export]
5542#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5543macro_rules! for_each_peripheral {
5544 ($($pattern:tt => $code:tt;)*) => {
5545 macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
5546 => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
5547 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5548 "<section class=\"warning\">"] #[doc =
5549 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5550 #[doc = "<ul>"] #[doc =
5551 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5552 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()));
5553 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
5554 GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5555 "GPIO2 peripheral singleton"] GPIO2 <= virtual()));
5556 _for_each_inner_peripheral!((@ peri_type #[doc =
5557 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5558 "<section class=\"warning\">"] #[doc =
5559 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5560 #[doc = "<ul>"] #[doc =
5561 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5562 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()));
5563 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO4 peripheral singleton"]
5564 GPIO4 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5565 "GPIO5 peripheral singleton"] GPIO5 <= virtual()));
5566 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO6 peripheral singleton"]
5567 GPIO6 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5568 "GPIO7 peripheral singleton"] GPIO7 <= virtual()));
5569 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO8 peripheral singleton"]
5570 GPIO8 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5571 "GPIO9 peripheral singleton"] GPIO9 <= virtual()));
5572 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO10 peripheral singleton"]
5573 GPIO10 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5574 "GPIO11 peripheral singleton"] GPIO11 <= virtual()));
5575 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO12 peripheral singleton"]
5576 GPIO12 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5577 "GPIO13 peripheral singleton"] GPIO13 <= virtual()));
5578 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO14 peripheral singleton"]
5579 GPIO14 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5580 "GPIO15 peripheral singleton"] GPIO15 <= virtual()));
5581 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO16 peripheral singleton"]
5582 GPIO16 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5583 "GPIO17 peripheral singleton"] GPIO17 <= virtual()));
5584 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO18 peripheral singleton"]
5585 GPIO18 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5586 "GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5587 "<section class=\"warning\">"] #[doc =
5588 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5589 #[doc = "<ul>"] #[doc =
5590 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5591 #[doc = "</section>"] GPIO19 <= virtual())); _for_each_inner_peripheral!((@
5592 peri_type #[doc = "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""]
5593 #[doc = "<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 =
5596 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5597 #[doc = "</section>"] GPIO20 <= virtual())); _for_each_inner_peripheral!((@
5598 peri_type #[doc = "GPIO21 peripheral singleton"] GPIO21 <= virtual()));
5599 _for_each_inner_peripheral!((@ peri_type #[doc =
5600 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5601 "<section class=\"warning\">"] #[doc =
5602 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5603 #[doc = "<ul>"] #[doc =
5604 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5605 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
5606 _for_each_inner_peripheral!((@ peri_type #[doc =
5607 "GPIO27 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 =
5611 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5612 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5613 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
5614 _for_each_inner_peripheral!((@ peri_type #[doc =
5615 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5616 "<section class=\"warning\">"] #[doc =
5617 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5618 #[doc = "<ul>"] #[doc =
5619 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5620 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5621 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
5622 _for_each_inner_peripheral!((@ peri_type #[doc =
5623 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5624 "<section class=\"warning\">"] #[doc =
5625 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5626 #[doc = "<ul>"] #[doc =
5627 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5628 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()));
5629 _for_each_inner_peripheral!((@ peri_type #[doc =
5630 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5631 "<section class=\"warning\">"] #[doc =
5632 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5633 #[doc = "<ul>"] #[doc =
5634 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5635 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5636 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
5637 _for_each_inner_peripheral!((@ peri_type #[doc =
5638 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5639 "<section class=\"warning\">"] #[doc =
5640 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5641 #[doc = "<ul>"] #[doc =
5642 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5643 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5644 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
5645 _for_each_inner_peripheral!((@ peri_type #[doc =
5646 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5647 "<section class=\"warning\">"] #[doc =
5648 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5649 #[doc = "<ul>"] #[doc =
5650 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5651 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
5652 _for_each_inner_peripheral!((@ peri_type #[doc =
5653 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5654 "<section class=\"warning\">"] #[doc =
5655 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5656 #[doc = "<ul>"] #[doc =
5657 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5658 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5659 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()));
5660 _for_each_inner_peripheral!((@ peri_type #[doc =
5661 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5662 "<section class=\"warning\">"] #[doc =
5663 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5664 #[doc = "<ul>"] #[doc =
5665 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5666 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5667 #[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
5668 _for_each_inner_peripheral!((@ peri_type #[doc =
5669 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5670 "<section class=\"warning\">"] #[doc =
5671 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5672 #[doc = "<ul>"] #[doc =
5673 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5674 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5675 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
5676 _for_each_inner_peripheral!((@ peri_type #[doc =
5677 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5678 "<section class=\"warning\">"] #[doc =
5679 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5680 #[doc = "<ul>"] #[doc =
5681 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5682 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5683 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
5684 _for_each_inner_peripheral!((@ peri_type #[doc =
5685 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5686 "<section class=\"warning\">"] #[doc =
5687 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5688 #[doc = "<ul>"] #[doc =
5689 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5690 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5691 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
5692 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO38 peripheral singleton"]
5693 GPIO38 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5694 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5695 "<section class=\"warning\">"] #[doc =
5696 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5697 #[doc = "<ul>"] #[doc =
5698 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5699 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
5700 _for_each_inner_peripheral!((@ peri_type #[doc =
5701 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5702 "<section class=\"warning\">"] #[doc =
5703 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5704 #[doc = "<ul>"] #[doc =
5705 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5706 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
5707 _for_each_inner_peripheral!((@ peri_type #[doc =
5708 "GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5709 "<section class=\"warning\">"] #[doc =
5710 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5711 #[doc = "<ul>"] #[doc =
5712 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5713 #[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()));
5714 _for_each_inner_peripheral!((@ peri_type #[doc =
5715 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5716 "<section class=\"warning\">"] #[doc =
5717 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5718 #[doc = "<ul>"] #[doc =
5719 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5720 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()));
5721 _for_each_inner_peripheral!((@ peri_type #[doc =
5722 "GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5723 "<section class=\"warning\">"] #[doc =
5724 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5725 #[doc = "<ul>"] #[doc =
5726 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5727 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()));
5728 _for_each_inner_peripheral!((@ peri_type #[doc =
5729 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5730 "<section class=\"warning\">"] #[doc =
5731 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5732 #[doc = "<ul>"] #[doc =
5733 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5734 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()));
5735 _for_each_inner_peripheral!((@ peri_type #[doc =
5736 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5737 "<section class=\"warning\">"] #[doc =
5738 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5739 #[doc = "<ul>"] #[doc =
5740 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5741 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()));
5742 _for_each_inner_peripheral!((@ peri_type #[doc =
5743 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5744 "<section class=\"warning\">"] #[doc =
5745 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5746 #[doc = "<ul>"] #[doc =
5747 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5748 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()));
5749 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO47 peripheral singleton"]
5750 GPIO47 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5751 "GPIO48 peripheral singleton"] GPIO48 <= virtual()));
5752 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
5753 DMA_CH0 <= virtual(DMA_IN_CH0 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5754 disable_dma_in_interrupt }, DMA_OUT_CH0 : { bind_dma_out_interrupt,
5755 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5756 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH1 peripheral singleton"]
5757 DMA_CH1 <= virtual(DMA_IN_CH1 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5758 disable_dma_in_interrupt }, DMA_OUT_CH1 : { bind_dma_out_interrupt,
5759 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5760 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH2 peripheral singleton"]
5761 DMA_CH2 <= virtual(DMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5762 disable_dma_in_interrupt }, DMA_OUT_CH2 : { bind_dma_out_interrupt,
5763 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5764 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH3 peripheral singleton"]
5765 DMA_CH3 <= virtual(DMA_IN_CH3 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5766 disable_dma_in_interrupt }, DMA_OUT_CH3 : { bind_dma_out_interrupt,
5767 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5768 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH4 peripheral singleton"]
5769 DMA_CH4 <= virtual(DMA_IN_CH4 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5770 disable_dma_in_interrupt }, DMA_OUT_CH4 : { bind_dma_out_interrupt,
5771 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5772 _for_each_inner_peripheral!((@ peri_type #[doc =
5773 "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)));
5774 _for_each_inner_peripheral!((@ peri_type #[doc =
5775 "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual() (unstable)));
5776 _for_each_inner_peripheral!((@ peri_type #[doc =
5777 "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)));
5778 _for_each_inner_peripheral!((@ peri_type #[doc =
5779 "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)));
5780 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
5781 SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5782 = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
5783 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
5784 SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5785 = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
5786 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
5787 SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5788 = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
5789 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
5790 SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5791 = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
5792 _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
5793 <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
5794 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5795 "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)));
5796 _for_each_inner_peripheral!((@ peri_type #[doc =
5797 "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC() (unstable)));
5798 _for_each_inner_peripheral!((@ peri_type #[doc =
5799 "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
5800 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
5801 <= DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5802 "DS peripheral singleton"] DS <= DS() (unstable)));
5803 _for_each_inner_peripheral!((@ peri_type #[doc = "EFUSE peripheral singleton"]
5804 EFUSE <= EFUSE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5805 "EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)));
5806 _for_each_inner_peripheral!((@ peri_type #[doc =
5807 "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)));
5808 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO peripheral singleton"]
5809 GPIO <= GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5810 "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)));
5811 _for_each_inner_peripheral!((@ peri_type #[doc = "HMAC peripheral singleton"]
5812 HMAC <= HMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5813 "I2C_ANA_MST peripheral singleton"] I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
5814 _for_each_inner_peripheral!((@ peri_type #[doc = "I2C0 peripheral singleton"]
5815 I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
5816 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5817 "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt,
5818 enable_peri_interrupt, disable_peri_interrupt })));
5819 _for_each_inner_peripheral!((@ peri_type #[doc = "I2S0 peripheral singleton"]
5820 I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
5821 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5822 #[doc = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
5823 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
5824 _for_each_inner_peripheral!((@ peri_type #[doc =
5825 "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
5826 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5827 "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
5828 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5829 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
5830 _for_each_inner_peripheral!((@ peri_type #[doc = "LCD_CAM peripheral singleton"]
5831 LCD_CAM <= LCD_CAM() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5832 = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)));
5833 _for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
5834 LPWR <= RTC_CNTL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5835 "RTC_TIMER peripheral singleton"] RTC_TIMER <= RTC_CNTL() (unstable)));
5836 _for_each_inner_peripheral!((@ peri_type #[doc = "MCPWM0 peripheral singleton"]
5837 MCPWM0 <= MCPWM0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5838 "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1() (unstable)));
5839 _for_each_inner_peripheral!((@ peri_type #[doc = "PCNT peripheral singleton"]
5840 PCNT <= PCNT(PCNT : { bind_peri_interrupt, enable_peri_interrupt,
5841 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5842 #[doc = "PERI_BACKUP peripheral singleton"] PERI_BACKUP <= PERI_BACKUP()
5843 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5844 "RMT peripheral singleton"] RMT <= RMT() (unstable)));
5845 _for_each_inner_peripheral!((@ peri_type #[doc = "RNG peripheral singleton"] RNG
5846 <= RNG() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5847 "RSA peripheral singleton"] RSA <= RSA(RSA : { bind_peri_interrupt,
5848 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
5849 _for_each_inner_peripheral!((@ peri_type #[doc = "RTC_CNTL peripheral singleton"]
5850 RTC_CNTL <= RTC_CNTL() (unstable))); _for_each_inner_peripheral!((@ peri_type
5851 #[doc = "LP_I2C0 peripheral singleton"] LP_I2C0 <= RTC_I2C() (unstable)));
5852 _for_each_inner_peripheral!((@ peri_type #[doc = "RTC_IO peripheral singleton"]
5853 RTC_IO <= RTC_IO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5854 "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)));
5855 _for_each_inner_peripheral!((@ peri_type #[doc = "SENS peripheral singleton"]
5856 SENS <= SENS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5857 "SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)));
5858 _for_each_inner_peripheral!((@ peri_type #[doc = "SHA peripheral singleton"] SHA
5859 <= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
5860 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5861 "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
5862 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
5863 SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5864 "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
5865 enable_peri_interrupt, disable_peri_interrupt })));
5866 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
5867 SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
5868 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5869 "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)));
5870 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTIMER peripheral singleton"]
5871 SYSTIMER <= SYSTIMER() (unstable))); _for_each_inner_peripheral!((@ peri_type
5872 #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
5873 _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
5874 TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5875 "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)));
5876 _for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
5877 UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
5878 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5879 "UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
5880 enable_peri_interrupt, disable_peri_interrupt })));
5881 _for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
5882 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
5883 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5884 "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)));
5885 _for_each_inner_peripheral!((@ peri_type #[doc = "USB_FS peripheral singleton"]
5886 USB_FS <= USB_FS(USB : { bind_peri_interrupt, enable_peri_interrupt,
5887 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5888 #[doc = "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE :
5889 { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5890 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5891 "USB_WRAP peripheral singleton"] USB_WRAP <= USB_WRAP() (unstable)));
5892 _for_each_inner_peripheral!((@ peri_type #[doc = "WCL peripheral singleton"] WCL
5893 <= WCL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5894 "XTS_AES peripheral singleton"] XTS_AES <= XTS_AES() (unstable)));
5895 _for_each_inner_peripheral!((@ peri_type #[doc = "ADC1 peripheral singleton"]
5896 ADC1 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5897 "ADC2 peripheral singleton"] ADC2 <= virtual() (unstable)));
5898 _for_each_inner_peripheral!((@ peri_type #[doc = "BT peripheral singleton"] BT <=
5899 virtual(BT_BB : { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt },
5900 RWBLE : { bind_rwble_interrupt, enable_rwble_interrupt, disable_rwble_interrupt
5901 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5902 "CPU_CTRL peripheral singleton"] CPU_CTRL <= virtual() (unstable)));
5903 _for_each_inner_peripheral!((@ peri_type #[doc = "FLASH peripheral singleton"]
5904 FLASH <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5905 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
5906 _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
5907 PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5908 "ULP_RISCV_CORE peripheral singleton"] ULP_RISCV_CORE <= virtual() (unstable)));
5909 _for_each_inner_peripheral!((@ peri_type #[doc = "WIFI peripheral singleton"]
5910 WIFI <= virtual(WIFI_MAC : { bind_mac_interrupt, enable_mac_interrupt,
5911 disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt, enable_pwr_interrupt,
5912 disable_pwr_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5913 "IPC peripheral singleton"] IPC <= virtual() (unstable)));
5914 _for_each_inner_peripheral!((@ peri_type #[doc =
5915 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)));
5916 _for_each_inner_peripheral!((@ peri_type #[doc =
5917 "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
5918 _for_each_inner_peripheral!((@ peri_type #[doc =
5919 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
5920 _for_each_inner_peripheral!((@ peri_type #[doc =
5921 "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
5922 _for_each_inner_peripheral!((GPIO0)); _for_each_inner_peripheral!((GPIO1));
5923 _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
5924 _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
5925 _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
5926 _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
5927 _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
5928 _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
5929 _for_each_inner_peripheral!((GPIO14));
5930 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO15));
5931 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO16));
5932 _for_each_inner_peripheral!((GPIO17)); _for_each_inner_peripheral!((GPIO18));
5933 _for_each_inner_peripheral!((GPIO19)); _for_each_inner_peripheral!((GPIO20));
5934 _for_each_inner_peripheral!((GPIO21)); _for_each_inner_peripheral!((GPIO26));
5935 _for_each_inner_peripheral!((GPIO27)); _for_each_inner_peripheral!((GPIO28));
5936 _for_each_inner_peripheral!((GPIO29)); _for_each_inner_peripheral!((GPIO30));
5937 _for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
5938 _for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
5939 _for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
5940 _for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
5941 _for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
5942 _for_each_inner_peripheral!((GPIO41)); _for_each_inner_peripheral!((GPIO42));
5943 _for_each_inner_peripheral!((GPIO43)); _for_each_inner_peripheral!((GPIO44));
5944 _for_each_inner_peripheral!((GPIO45)); _for_each_inner_peripheral!((GPIO46));
5945 _for_each_inner_peripheral!((GPIO47)); _for_each_inner_peripheral!((GPIO48));
5946 _for_each_inner_peripheral!((DMA_CH0(unstable)));
5947 _for_each_inner_peripheral!((DMA_CH1(unstable)));
5948 _for_each_inner_peripheral!((DMA_CH2(unstable)));
5949 _for_each_inner_peripheral!((DMA_CH3(unstable)));
5950 _for_each_inner_peripheral!((DMA_CH4(unstable)));
5951 _for_each_inner_peripheral!((PCNT0_UNIT0(unstable)));
5952 _for_each_inner_peripheral!((PCNT0_UNIT1(unstable)));
5953 _for_each_inner_peripheral!((PCNT0_UNIT2(unstable)));
5954 _for_each_inner_peripheral!((PCNT0_UNIT3(unstable)));
5955 _for_each_inner_peripheral!((SDM_CH0(unstable)));
5956 _for_each_inner_peripheral!((SDM_CH1(unstable)));
5957 _for_each_inner_peripheral!((SDM_CH2(unstable)));
5958 _for_each_inner_peripheral!((SDM_CH3(unstable)));
5959 _for_each_inner_peripheral!((SDM_CH4(unstable)));
5960 _for_each_inner_peripheral!((SDM_CH5(unstable)));
5961 _for_each_inner_peripheral!((SDM_CH6(unstable)));
5962 _for_each_inner_peripheral!((SDM_CH7(unstable)));
5963 _for_each_inner_peripheral!((AES(unstable)));
5964 _for_each_inner_peripheral!((APB_CTRL(unstable)));
5965 _for_each_inner_peripheral!((APB_SARADC(unstable)));
5966 _for_each_inner_peripheral!((ASSIST_DEBUG(unstable)));
5967 _for_each_inner_peripheral!((DMA(unstable)));
5968 _for_each_inner_peripheral!((DS(unstable)));
5969 _for_each_inner_peripheral!((EXTMEM(unstable)));
5970 _for_each_inner_peripheral!((GPIO(unstable)));
5971 _for_each_inner_peripheral!((GPIO_SD(unstable)));
5972 _for_each_inner_peripheral!((HMAC(unstable)));
5973 _for_each_inner_peripheral!((I2C_ANA_MST(unstable)));
5974 _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
5975 _for_each_inner_peripheral!((I2S0(unstable)));
5976 _for_each_inner_peripheral!((I2S1(unstable)));
5977 _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
5978 _for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
5979 _for_each_inner_peripheral!((IO_MUX(unstable)));
5980 _for_each_inner_peripheral!((LCD_CAM(unstable)));
5981 _for_each_inner_peripheral!((LEDC(unstable)));
5982 _for_each_inner_peripheral!((LPWR(unstable)));
5983 _for_each_inner_peripheral!((RTC_TIMER(unstable)));
5984 _for_each_inner_peripheral!((MCPWM0(unstable)));
5985 _for_each_inner_peripheral!((MCPWM1(unstable)));
5986 _for_each_inner_peripheral!((PCNT(unstable)));
5987 _for_each_inner_peripheral!((PERI_BACKUP(unstable)));
5988 _for_each_inner_peripheral!((RMT(unstable)));
5989 _for_each_inner_peripheral!((RNG(unstable)));
5990 _for_each_inner_peripheral!((RSA(unstable)));
5991 _for_each_inner_peripheral!((RTC_CNTL(unstable)));
5992 _for_each_inner_peripheral!((LP_I2C0(unstable)));
5993 _for_each_inner_peripheral!((RTC_IO(unstable)));
5994 _for_each_inner_peripheral!((SDHOST(unstable)));
5995 _for_each_inner_peripheral!((SENS(unstable)));
5996 _for_each_inner_peripheral!((SENSITIVE(unstable)));
5997 _for_each_inner_peripheral!((SHA(unstable)));
5998 _for_each_inner_peripheral!((SPI0(unstable)));
5999 _for_each_inner_peripheral!((SPI1(unstable)));
6000 _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
6001 _for_each_inner_peripheral!((SYSTEM(unstable)));
6002 _for_each_inner_peripheral!((SYSTIMER(unstable)));
6003 _for_each_inner_peripheral!((TIMG0(unstable)));
6004 _for_each_inner_peripheral!((TIMG1(unstable)));
6005 _for_each_inner_peripheral!((TWAI0(unstable)));
6006 _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
6007 _for_each_inner_peripheral!((UART2));
6008 _for_each_inner_peripheral!((UHCI0(unstable)));
6009 _for_each_inner_peripheral!((USB_FS(unstable)));
6010 _for_each_inner_peripheral!((USB_DEVICE(unstable)));
6011 _for_each_inner_peripheral!((WCL(unstable)));
6012 _for_each_inner_peripheral!((XTS_AES(unstable)));
6013 _for_each_inner_peripheral!((ADC1(unstable)));
6014 _for_each_inner_peripheral!((ADC2(unstable)));
6015 _for_each_inner_peripheral!((BT(unstable)));
6016 _for_each_inner_peripheral!((CPU_CTRL(unstable)));
6017 _for_each_inner_peripheral!((FLASH(unstable)));
6018 _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
6019 _for_each_inner_peripheral!((PSRAM(unstable)));
6020 _for_each_inner_peripheral!((ULP_RISCV_CORE(unstable)));
6021 _for_each_inner_peripheral!((WIFI));
6022 _for_each_inner_peripheral!((IPC(unstable)));
6023 _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
6024 _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
6025 _for_each_inner_peripheral!((SPI2, Spi2, 0, AhbGdmaChannel));
6026 _for_each_inner_peripheral!((SPI3, Spi3, 1, AhbGdmaChannel));
6027 _for_each_inner_peripheral!((UHCI0, Uhci0, 2, AhbGdmaChannel));
6028 _for_each_inner_peripheral!((I2S0, I2s0, 3, AhbGdmaChannel));
6029 _for_each_inner_peripheral!((I2S1, I2s1, 4, AhbGdmaChannel));
6030 _for_each_inner_peripheral!((LCD_CAM, LcdCam, 5, AhbGdmaChannel));
6031 _for_each_inner_peripheral!((AES, Aes, 6, AhbGdmaChannel));
6032 _for_each_inner_peripheral!((SHA, Sha, 7, AhbGdmaChannel));
6033 _for_each_inner_peripheral!((APB_SARADC, ApbSaradc, 8, AhbGdmaChannel));
6034 _for_each_inner_peripheral!((RMT, Rmt, 9, AhbGdmaChannel));
6035 _for_each_inner_peripheral!((all(@ peri_type #[doc =
6036 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6037 "<section class=\"warning\">"] #[doc =
6038 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6039 #[doc = "<ul>"] #[doc =
6040 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6041 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()), (@ peri_type #[doc =
6042 "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
6043 "GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
6044 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6045 "<section class=\"warning\">"] #[doc =
6046 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6047 #[doc = "<ul>"] #[doc =
6048 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6049 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()), (@ peri_type #[doc =
6050 "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
6051 "GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
6052 "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
6053 "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
6054 "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
6055 "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
6056 "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
6057 "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
6058 "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
6059 "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
6060 "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
6061 "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
6062 "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
6063 "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
6064 "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
6065 "GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6066 "<section class=\"warning\">"] #[doc =
6067 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6068 #[doc = "<ul>"] #[doc =
6069 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6070 #[doc = "</section>"] GPIO19 <= virtual()), (@ peri_type #[doc =
6071 "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6072 "<section class=\"warning\">"] #[doc =
6073 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6074 #[doc = "<ul>"] #[doc =
6075 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
6076 #[doc = "</section>"] GPIO20 <= virtual()), (@ peri_type #[doc =
6077 "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
6078 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6079 "<section class=\"warning\">"] #[doc =
6080 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6081 #[doc = "<ul>"] #[doc =
6082 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
6083 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
6084 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6085 "<section class=\"warning\">"] #[doc =
6086 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6087 #[doc = "<ul>"] #[doc =
6088 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6089 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
6090 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
6091 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6092 "<section class=\"warning\">"] #[doc =
6093 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6094 #[doc = "<ul>"] #[doc =
6095 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6096 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
6097 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
6098 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6099 "<section class=\"warning\">"] #[doc =
6100 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6101 #[doc = "<ul>"] #[doc =
6102 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6103 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()), (@ peri_type #[doc =
6104 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6105 "<section class=\"warning\">"] #[doc =
6106 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6107 #[doc = "<ul>"] #[doc =
6108 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6109 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
6110 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
6111 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6112 "<section class=\"warning\">"] #[doc =
6113 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6114 #[doc = "<ul>"] #[doc =
6115 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6116 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
6117 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
6118 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6119 "<section class=\"warning\">"] #[doc =
6120 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6121 #[doc = "<ul>"] #[doc =
6122 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
6123 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
6124 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6125 "<section class=\"warning\">"] #[doc =
6126 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6127 #[doc = "<ul>"] #[doc =
6128 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
6129 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
6130 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
6131 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6132 "<section class=\"warning\">"] #[doc =
6133 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6134 #[doc = "<ul>"] #[doc =
6135 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
6136 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
6137 #[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
6138 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6139 "<section class=\"warning\">"] #[doc =
6140 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6141 #[doc = "<ul>"] #[doc =
6142 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
6143 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
6144 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
6145 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6146 "<section class=\"warning\">"] #[doc =
6147 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6148 #[doc = "<ul>"] #[doc =
6149 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
6150 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
6151 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
6152 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6153 "<section class=\"warning\">"] #[doc =
6154 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6155 #[doc = "<ul>"] #[doc =
6156 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
6157 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
6158 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
6159 "GPIO38 peripheral singleton"] GPIO38 <= virtual()), (@ peri_type #[doc =
6160 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6161 "<section class=\"warning\">"] #[doc =
6162 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6163 #[doc = "<ul>"] #[doc =
6164 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6165 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
6166 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6167 "<section class=\"warning\">"] #[doc =
6168 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6169 #[doc = "<ul>"] #[doc =
6170 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6171 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
6172 "GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6173 "<section class=\"warning\">"] #[doc =
6174 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6175 #[doc = "<ul>"] #[doc =
6176 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6177 #[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()), (@ peri_type #[doc =
6178 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6179 "<section class=\"warning\">"] #[doc =
6180 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6181 #[doc = "<ul>"] #[doc =
6182 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
6183 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()), (@ peri_type #[doc =
6184 "GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6185 "<section class=\"warning\">"] #[doc =
6186 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6187 #[doc = "<ul>"] #[doc =
6188 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
6189 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()), (@ peri_type #[doc =
6190 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6191 "<section class=\"warning\">"] #[doc =
6192 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6193 #[doc = "<ul>"] #[doc =
6194 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
6195 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()), (@ peri_type #[doc =
6196 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6197 "<section class=\"warning\">"] #[doc =
6198 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6199 #[doc = "<ul>"] #[doc =
6200 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6201 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()), (@ peri_type #[doc =
6202 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
6203 "<section class=\"warning\">"] #[doc =
6204 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
6205 #[doc = "<ul>"] #[doc =
6206 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
6207 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()), (@ peri_type #[doc =
6208 "GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
6209 "GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
6210 "DMA_CH0 peripheral singleton"] DMA_CH0 <= virtual(DMA_IN_CH0 : {
6211 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6212 DMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6213 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6214 "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(DMA_IN_CH1 : {
6215 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6216 DMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6217 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6218 "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual(DMA_IN_CH2 : {
6219 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6220 DMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6221 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6222 "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual(DMA_IN_CH3 : {
6223 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6224 DMA_OUT_CH3 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6225 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6226 "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(DMA_IN_CH4 : {
6227 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
6228 DMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
6229 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
6230 "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)), (@
6231 peri_type #[doc = "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual()
6232 (unstable)), (@ peri_type #[doc = "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2
6233 <= virtual() (unstable)), (@ peri_type #[doc =
6234 "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)), (@
6235 peri_type #[doc = "SDM_CH0 peripheral singleton"] SDM_CH0 <= virtual()
6236 (unstable)), (@ peri_type #[doc = "SDM_CH1 peripheral singleton"] SDM_CH1 <=
6237 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
6238 SDM_CH2 <= virtual() (unstable)), (@ peri_type #[doc =
6239 "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)), (@ peri_type
6240 #[doc = "SDM_CH4 peripheral singleton"] SDM_CH4 <= virtual() (unstable)), (@
6241 peri_type #[doc = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual()
6242 (unstable)), (@ peri_type #[doc = "SDM_CH6 peripheral singleton"] SDM_CH6 <=
6243 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH7 peripheral singleton"]
6244 SDM_CH7 <= virtual() (unstable)), (@ peri_type #[doc =
6245 "AES peripheral singleton"] AES <= AES(AES : { bind_peri_interrupt,
6246 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
6247 = "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)), (@
6248 peri_type #[doc = "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC()
6249 (unstable)), (@ peri_type #[doc = "ASSIST_DEBUG peripheral singleton"]
6250 ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)), (@ peri_type #[doc =
6251 "DMA peripheral singleton"] DMA <= DMA() (unstable)), (@ peri_type #[doc =
6252 "DS peripheral singleton"] DS <= DS() (unstable)), (@ peri_type #[doc =
6253 "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@ peri_type #[doc =
6254 "EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)), (@ peri_type #[doc
6255 = "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)), (@
6256 peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)), (@
6257 peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD()
6258 (unstable)), (@ peri_type #[doc = "HMAC peripheral singleton"] HMAC <= HMAC()
6259 (unstable)), (@ peri_type #[doc = "I2C_ANA_MST peripheral singleton"] I2C_ANA_MST
6260 <= I2C_ANA_MST() (unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"]
6261 I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
6262 disable_peri_interrupt })), (@ peri_type #[doc = "I2C1 peripheral singleton"]
6263 I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
6264 disable_peri_interrupt })), (@ peri_type #[doc = "I2S0 peripheral singleton"]
6265 I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
6266 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
6267 "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
6268 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
6269 = "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
6270 (unstable)), (@ peri_type #[doc = "INTERRUPT_CORE1 peripheral singleton"]
6271 INTERRUPT_CORE1 <= INTERRUPT_CORE1() (unstable)), (@ peri_type #[doc =
6272 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type #[doc
6273 = "LCD_CAM peripheral singleton"] LCD_CAM <= LCD_CAM() (unstable)), (@ peri_type
6274 #[doc = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)), (@ peri_type
6275 #[doc = "LPWR peripheral singleton"] LPWR <= RTC_CNTL() (unstable)), (@ peri_type
6276 #[doc = "RTC_TIMER peripheral singleton"] RTC_TIMER <= RTC_CNTL() (unstable)), (@
6277 peri_type #[doc = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)),
6278 (@ peri_type #[doc = "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1()
6279 (unstable)), (@ peri_type #[doc = "PCNT peripheral singleton"] PCNT <= PCNT(PCNT
6280 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6281 (unstable)), (@ peri_type #[doc = "PERI_BACKUP peripheral singleton"] PERI_BACKUP
6282 <= PERI_BACKUP() (unstable)), (@ peri_type #[doc = "RMT peripheral singleton"]
6283 RMT <= RMT() (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <=
6284 RNG() (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <=
6285 RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6286 (unstable)), (@ peri_type #[doc = "RTC_CNTL peripheral singleton"] RTC_CNTL <=
6287 RTC_CNTL() (unstable)), (@ peri_type #[doc = "LP_I2C0 peripheral singleton"]
6288 LP_I2C0 <= RTC_I2C() (unstable)), (@ peri_type #[doc =
6289 "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)), (@ peri_type #[doc
6290 = "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)), (@ peri_type
6291 #[doc = "SENS peripheral singleton"] SENS <= SENS() (unstable)), (@ peri_type
6292 #[doc = "SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)),
6293 (@ peri_type #[doc = "SHA peripheral singleton"] SHA <= SHA(SHA : {
6294 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6295 (unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0()
6296 (unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1()
6297 (unstable)), (@ peri_type #[doc = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2
6298 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6299 peri_type #[doc = "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : {
6300 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
6301 peri_type #[doc = "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)),
6302 (@ peri_type #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER()
6303 (unstable)), (@ peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0()
6304 (unstable)), (@ peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1()
6305 (unstable)), (@ peri_type #[doc = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0()
6306 (unstable)), (@ peri_type #[doc = "UART0 peripheral singleton"] UART0 <=
6307 UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
6308 disable_peri_interrupt })), (@ peri_type #[doc = "UART1 peripheral singleton"]
6309 UART1 <= UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
6310 disable_peri_interrupt })), (@ peri_type #[doc = "UART2 peripheral singleton"]
6311 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
6312 disable_peri_interrupt })), (@ peri_type #[doc = "UHCI0 peripheral singleton"]
6313 UHCI0 <= UHCI0() (unstable)), (@ peri_type #[doc = "USB_FS peripheral singleton"]
6314 USB_FS <= USB_FS(USB : { bind_peri_interrupt, enable_peri_interrupt,
6315 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
6316 "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
6317 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
6318 (unstable)), (@ peri_type #[doc = "USB_WRAP peripheral singleton"] USB_WRAP <=
6319 USB_WRAP() (unstable)), (@ peri_type #[doc = "WCL peripheral singleton"] WCL <=
6320 WCL() (unstable)), (@ peri_type #[doc = "XTS_AES peripheral singleton"] XTS_AES
6321 <= XTS_AES() (unstable)), (@ peri_type #[doc = "ADC1 peripheral singleton"] ADC1
6322 <= virtual() (unstable)), (@ peri_type #[doc = "ADC2 peripheral singleton"] ADC2
6323 <= virtual() (unstable)), (@ peri_type #[doc = "BT peripheral singleton"] BT <=
6324 virtual(BT_BB : { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt },
6325 RWBLE : { bind_rwble_interrupt, enable_rwble_interrupt, disable_rwble_interrupt
6326 }) (unstable)), (@ peri_type #[doc = "CPU_CTRL peripheral singleton"] CPU_CTRL <=
6327 virtual() (unstable)), (@ peri_type #[doc = "FLASH peripheral singleton"] FLASH
6328 <= virtual() (unstable)), (@ peri_type #[doc =
6329 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
6330 (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
6331 (unstable)), (@ peri_type #[doc = "ULP_RISCV_CORE peripheral singleton"]
6332 ULP_RISCV_CORE <= virtual() (unstable)), (@ peri_type #[doc =
6333 "WIFI peripheral singleton"] WIFI <= virtual(WIFI_MAC : { bind_mac_interrupt,
6334 enable_mac_interrupt, disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt,
6335 enable_pwr_interrupt, disable_pwr_interrupt })), (@ peri_type #[doc =
6336 "IPC peripheral singleton"] IPC <= virtual() (unstable)), (@ peri_type #[doc =
6337 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)),
6338 (@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <=
6339 virtual() (unstable)), (@ peri_type #[doc =
6340 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
6341 (@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
6342 virtual() (unstable)))); _for_each_inner_peripheral!((singletons(GPIO0), (GPIO1),
6343 (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6), (GPIO7), (GPIO8), (GPIO9), (GPIO10),
6344 (GPIO11), (GPIO12), (GPIO13), (GPIO14), (#[cfg(not(use_xtal32k))] GPIO15),
6345 (#[cfg(not(use_xtal32k))] GPIO16), (GPIO17), (GPIO18), (GPIO19), (GPIO20),
6346 (GPIO21), (GPIO26), (GPIO27), (GPIO28), (GPIO29), (GPIO30), (GPIO31), (GPIO32),
6347 (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39), (GPIO40),
6348 (GPIO41), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47), (GPIO48),
6349 (DMA_CH0(unstable)), (DMA_CH1(unstable)), (DMA_CH2(unstable)),
6350 (DMA_CH3(unstable)), (DMA_CH4(unstable)), (PCNT0_UNIT0(unstable)),
6351 (PCNT0_UNIT1(unstable)), (PCNT0_UNIT2(unstable)), (PCNT0_UNIT3(unstable)),
6352 (SDM_CH0(unstable)), (SDM_CH1(unstable)), (SDM_CH2(unstable)),
6353 (SDM_CH3(unstable)), (SDM_CH4(unstable)), (SDM_CH5(unstable)),
6354 (SDM_CH6(unstable)), (SDM_CH7(unstable)), (AES(unstable)), (APB_CTRL(unstable)),
6355 (APB_SARADC(unstable)), (ASSIST_DEBUG(unstable)), (DMA(unstable)),
6356 (DS(unstable)), (EXTMEM(unstable)), (GPIO(unstable)), (GPIO_SD(unstable)),
6357 (HMAC(unstable)), (I2C_ANA_MST(unstable)), (I2C0), (I2C1), (I2S0(unstable)),
6358 (I2S1(unstable)), (INTERRUPT_CORE0(unstable)), (INTERRUPT_CORE1(unstable)),
6359 (IO_MUX(unstable)), (LCD_CAM(unstable)), (LEDC(unstable)), (LPWR(unstable)),
6360 (RTC_TIMER(unstable)), (MCPWM0(unstable)), (MCPWM1(unstable)), (PCNT(unstable)),
6361 (PERI_BACKUP(unstable)), (RMT(unstable)), (RNG(unstable)), (RSA(unstable)),
6362 (RTC_CNTL(unstable)), (LP_I2C0(unstable)), (RTC_IO(unstable)),
6363 (SDHOST(unstable)), (SENS(unstable)), (SENSITIVE(unstable)), (SHA(unstable)),
6364 (SPI0(unstable)), (SPI1(unstable)), (SPI2), (SPI3), (SYSTEM(unstable)),
6365 (SYSTIMER(unstable)), (TIMG0(unstable)), (TIMG1(unstable)), (TWAI0(unstable)),
6366 (UART0), (UART1), (UART2), (UHCI0(unstable)), (USB_FS(unstable)),
6367 (USB_DEVICE(unstable)), (WCL(unstable)), (XTS_AES(unstable)), (ADC1(unstable)),
6368 (ADC2(unstable)), (BT(unstable)), (CPU_CTRL(unstable)), (FLASH(unstable)),
6369 (GPIO_DEDICATED(unstable)), (PSRAM(unstable)), (ULP_RISCV_CORE(unstable)),
6370 (WIFI), (IPC(unstable)), (FROM_CPU_INTR2(unstable)),
6371 (FROM_CPU_INTR3(unstable)))); _for_each_inner_peripheral!((dma_eligible(SPI2,
6372 Spi2, 0, AhbGdmaChannel), (SPI3, Spi3, 1, AhbGdmaChannel), (UHCI0, Uhci0, 2,
6373 AhbGdmaChannel), (I2S0, I2s0, 3, AhbGdmaChannel), (I2S1, I2s1, 4,
6374 AhbGdmaChannel), (LCD_CAM, LcdCam, 5, AhbGdmaChannel), (AES, Aes, 6,
6375 AhbGdmaChannel), (SHA, Sha, 7, AhbGdmaChannel), (APB_SARADC, ApbSaradc, 8,
6376 AhbGdmaChannel), (RMT, Rmt, 9, AhbGdmaChannel)));
6377 };
6378}
6379#[macro_export]
6406#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6407macro_rules! for_each_gpio {
6408 ($($pattern:tt => $code:tt;)*) => {
6409 macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
6410 } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
6411 _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
6412 _for_each_inner_gpio!((2, GPIO2() () ([Input] [Output])));
6413 _for_each_inner_gpio!((3, GPIO3() () ([Input] [Output])));
6414 _for_each_inner_gpio!((4, GPIO4() () ([Input] [Output])));
6415 _for_each_inner_gpio!((5, GPIO5() () ([Input] [Output])));
6416 _for_each_inner_gpio!((6, GPIO6() () ([Input] [Output])));
6417 _for_each_inner_gpio!((7, GPIO7() () ([Input] [Output])));
6418 _for_each_inner_gpio!((8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])));
6419 _for_each_inner_gpio!((9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4
6420 => FSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((10, GPIO10(_2 => FSPIIO4
6421 _4 => FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input]
6422 [Output]))); _for_each_inner_gpio!((11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 =>
6423 FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output])));
6424 _for_each_inner_gpio!((12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
6425 => SUBSPICLK _4 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((13,
6426 GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4
6427 => FSPIQ) ([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14(_3 => SUBSPIWP
6428 _4 => FSPIWP) (_2 => FSPIDQS _3 => SUBSPIWP _4 => FSPIWP) ([Input] [Output])));
6429 _for_each_inner_gpio!((15, GPIO15() (_2 => U0RTS) ([Input] [Output])));
6430 _for_each_inner_gpio!((16, GPIO16(_2 => U0CTS) () ([Input] [Output])));
6431 _for_each_inner_gpio!((17, GPIO17() (_2 => U1TXD) ([Input] [Output])));
6432 _for_each_inner_gpio!((18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
6433 [Output]))); _for_each_inner_gpio!((19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2)
6434 ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20(_2 => U1CTS) (_3 =>
6435 CLK_OUT1) ([Input] [Output]))); _for_each_inner_gpio!((21, GPIO21() () ([Input]
6436 [Output]))); _for_each_inner_gpio!((26, GPIO26() (_0 => SPICS1) ([Input]
6437 [Output]))); _for_each_inner_gpio!((27, GPIO27(_0 => SPIHD) (_0 => SPIHD)
6438 ([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0 => SPIWP) (_0 =>
6439 SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((29, GPIO29() (_0 => SPICS0)
6440 ([Input] [Output]))); _for_each_inner_gpio!((30, GPIO30() (_0 => SPICLK) ([Input]
6441 [Output]))); _for_each_inner_gpio!((31, GPIO31(_0 => SPIQ) (_0 => SPIQ) ([Input]
6442 [Output]))); _for_each_inner_gpio!((32, GPIO32(_0 => SPID) (_0 => SPID) ([Input]
6443 [Output]))); _for_each_inner_gpio!((33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 =>
6444 SPIIO4) (_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])));
6445 _for_each_inner_gpio!((34, GPIO34(_2 => FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3
6446 => SUBSPICS0 _4 => SPIIO5) ([Input] [Output]))); _for_each_inner_gpio!((35,
6447 GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3 => SUBSPID _4 =>
6448 SPIIO6) ([Input] [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => FSPICLK _4
6449 => SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])));
6450 _for_each_inner_gpio!((37, GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 =>
6451 FSPIQ _3 => SUBSPIQ _4 => SPIDQS) ([Input] [Output])));
6452 _for_each_inner_gpio!((38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 => FSPIWP _3
6453 => SUBSPIWP) ([Input] [Output]))); _for_each_inner_gpio!((39, GPIO39(_0 => MTCK)
6454 (_2 => CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output]))); _for_each_inner_gpio!((40,
6455 GPIO40() (_0 => MTDO _2 => CLK_OUT2) ([Input] [Output])));
6456 _for_each_inner_gpio!((41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
6457 [Output]))); _for_each_inner_gpio!((42, GPIO42(_0 => MTMS) () ([Input]
6458 [Output]))); _for_each_inner_gpio!((43, GPIO43() (_0 => U0TXD _2 => CLK_OUT1)
6459 ([Input] [Output]))); _for_each_inner_gpio!((44, GPIO44(_0 => U0RXD) (_2 =>
6460 CLK_OUT2) ([Input] [Output]))); _for_each_inner_gpio!((45, GPIO45() () ([Input]
6461 [Output]))); _for_each_inner_gpio!((46, GPIO46() () ([Input] [Output])));
6462 _for_each_inner_gpio!((47, GPIO47() (_0 => SPICLK_P_DIFF _2 => SUBSPICLK_P_DIFF)
6463 ([Input] [Output]))); _for_each_inner_gpio!((48, GPIO48() (_0 => SPICLK_N_DIFF _2
6464 => SUBSPICLK_N_DIFF) ([Input] [Output]))); _for_each_inner_gpio!((all(0, GPIO0()
6465 () ([Input] [Output])), (1, GPIO1() () ([Input] [Output])), (2, GPIO2() ()
6466 ([Input] [Output])), (3, GPIO3() () ([Input] [Output])), (4, GPIO4() () ([Input]
6467 [Output])), (5, GPIO5() () ([Input] [Output])), (6, GPIO6() () ([Input]
6468 [Output])), (7, GPIO7() () ([Input] [Output])), (8, GPIO8() (_3 => SUBSPICS1)
6469 ([Input] [Output])), (9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4 =>
6470 FSPIHD) ([Input] [Output])), (10, GPIO10(_2 => FSPIIO4 _4 => FSPICS0) (_2 =>
6471 FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input] [Output])), (11, GPIO11(_2 =>
6472 FSPIIO5 _3 => SUBSPID _4 => FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID)
6473 ([Input] [Output])), (12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
6474 => SUBSPICLK _4 => FSPICLK) ([Input] [Output])), (13, GPIO13(_2 => FSPIIO7 _3 =>
6475 SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) ([Input]
6476 [Output])), (14, GPIO14(_3 => SUBSPIWP _4 => FSPIWP) (_2 => FSPIDQS _3 =>
6477 SUBSPIWP _4 => FSPIWP) ([Input] [Output])), (15, GPIO15() (_2 => U0RTS) ([Input]
6478 [Output])), (16, GPIO16(_2 => U0CTS) () ([Input] [Output])), (17, GPIO17() (_2 =>
6479 U1TXD) ([Input] [Output])), (18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
6480 [Output])), (19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2) ([Input] [Output])), (20,
6481 GPIO20(_2 => U1CTS) (_3 => CLK_OUT1) ([Input] [Output])), (21, GPIO21() ()
6482 ([Input] [Output])), (26, GPIO26() (_0 => SPICS1) ([Input] [Output])), (27,
6483 GPIO27(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])), (28, GPIO28(_0 => SPIWP)
6484 (_0 => SPIWP) ([Input] [Output])), (29, GPIO29() (_0 => SPICS0) ([Input]
6485 [Output])), (30, GPIO30() (_0 => SPICLK) ([Input] [Output])), (31, GPIO31(_0 =>
6486 SPIQ) (_0 => SPIQ) ([Input] [Output])), (32, GPIO32(_0 => SPID) (_0 => SPID)
6487 ([Input] [Output])), (33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) (_2 =>
6488 FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])), (34, GPIO34(_2 =>
6489 FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3 => SUBSPICS0 _4 => SPIIO5) ([Input]
6490 [Output])), (35, GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3
6491 => SUBSPID _4 => SPIIO6) ([Input] [Output])), (36, GPIO36(_2 => FSPICLK _4 =>
6492 SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])), (37,
6493 GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 =>
6494 SPIDQS) ([Input] [Output])), (38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 =>
6495 FSPIWP _3 => SUBSPIWP) ([Input] [Output])), (39, GPIO39(_0 => MTCK) (_2 =>
6496 CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output])), (40, GPIO40() (_0 => MTDO _2 =>
6497 CLK_OUT2) ([Input] [Output])), (41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
6498 [Output])), (42, GPIO42(_0 => MTMS) () ([Input] [Output])), (43, GPIO43() (_0 =>
6499 U0TXD _2 => CLK_OUT1) ([Input] [Output])), (44, GPIO44(_0 => U0RXD) (_2 =>
6500 CLK_OUT2) ([Input] [Output])), (45, GPIO45() () ([Input] [Output])), (46,
6501 GPIO46() () ([Input] [Output])), (47, GPIO47() (_0 => SPICLK_P_DIFF _2 =>
6502 SUBSPICLK_P_DIFF) ([Input] [Output])), (48, GPIO48() (_0 => SPICLK_N_DIFF _2 =>
6503 SUBSPICLK_N_DIFF) ([Input] [Output]))));
6504 };
6505}
6506#[macro_export]
6533#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6534macro_rules! for_each_analog_function {
6535 ($($pattern:tt => $code:tt;)*) => {
6536 macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
6537 tt) => {} } _for_each_inner_analog_function!((TOUCH1, GPIO1));
6538 _for_each_inner_analog_function!((ADC1_CH0, GPIO1));
6539 _for_each_inner_analog_function!((TOUCH2, GPIO2));
6540 _for_each_inner_analog_function!((ADC1_CH1, GPIO2));
6541 _for_each_inner_analog_function!((TOUCH3, GPIO3));
6542 _for_each_inner_analog_function!((ADC1_CH2, GPIO3));
6543 _for_each_inner_analog_function!((TOUCH4, GPIO4));
6544 _for_each_inner_analog_function!((ADC1_CH3, GPIO4));
6545 _for_each_inner_analog_function!((TOUCH5, GPIO5));
6546 _for_each_inner_analog_function!((ADC1_CH4, GPIO5));
6547 _for_each_inner_analog_function!((TOUCH6, GPIO6));
6548 _for_each_inner_analog_function!((ADC1_CH5, GPIO6));
6549 _for_each_inner_analog_function!((TOUCH7, GPIO7));
6550 _for_each_inner_analog_function!((ADC1_CH6, GPIO7));
6551 _for_each_inner_analog_function!((TOUCH8, GPIO8));
6552 _for_each_inner_analog_function!((ADC1_CH7, GPIO8));
6553 _for_each_inner_analog_function!((TOUCH9, GPIO9));
6554 _for_each_inner_analog_function!((ADC1_CH8, GPIO9));
6555 _for_each_inner_analog_function!((TOUCH10, GPIO10));
6556 _for_each_inner_analog_function!((ADC1_CH9, GPIO10));
6557 _for_each_inner_analog_function!((TOUCH11, GPIO11));
6558 _for_each_inner_analog_function!((ADC2_CH0, GPIO11));
6559 _for_each_inner_analog_function!((TOUCH12, GPIO12));
6560 _for_each_inner_analog_function!((ADC2_CH1, GPIO12));
6561 _for_each_inner_analog_function!((TOUCH13, GPIO13));
6562 _for_each_inner_analog_function!((ADC2_CH2, GPIO13));
6563 _for_each_inner_analog_function!((TOUCH14, GPIO14));
6564 _for_each_inner_analog_function!((ADC2_CH3, GPIO14));
6565 _for_each_inner_analog_function!((XTAL_32K_P, GPIO15));
6566 _for_each_inner_analog_function!((ADC2_CH4, GPIO15));
6567 _for_each_inner_analog_function!((XTAL_32K_N, GPIO16));
6568 _for_each_inner_analog_function!((ADC2_CH5, GPIO16));
6569 _for_each_inner_analog_function!((ADC2_CH6, GPIO17));
6570 _for_each_inner_analog_function!((ADC2_CH7, GPIO18));
6571 _for_each_inner_analog_function!((USB_FS_DM, GPIO19));
6572 _for_each_inner_analog_function!((ADC2_CH8, GPIO19));
6573 _for_each_inner_analog_function!((USB_FS_DP, GPIO20));
6574 _for_each_inner_analog_function!((ADC2_CH9, GPIO20));
6575 _for_each_inner_analog_function!(((TOUCH1, TOUCHn, 1), GPIO1));
6576 _for_each_inner_analog_function!(((TOUCH2, TOUCHn, 2), GPIO2));
6577 _for_each_inner_analog_function!(((TOUCH3, TOUCHn, 3), GPIO3));
6578 _for_each_inner_analog_function!(((TOUCH4, TOUCHn, 4), GPIO4));
6579 _for_each_inner_analog_function!(((TOUCH5, TOUCHn, 5), GPIO5));
6580 _for_each_inner_analog_function!(((TOUCH6, TOUCHn, 6), GPIO6));
6581 _for_each_inner_analog_function!(((TOUCH7, TOUCHn, 7), GPIO7));
6582 _for_each_inner_analog_function!(((TOUCH8, TOUCHn, 8), GPIO8));
6583 _for_each_inner_analog_function!(((TOUCH9, TOUCHn, 9), GPIO9));
6584 _for_each_inner_analog_function!(((TOUCH10, TOUCHn, 10), GPIO10));
6585 _for_each_inner_analog_function!(((TOUCH11, TOUCHn, 11), GPIO11));
6586 _for_each_inner_analog_function!(((TOUCH12, TOUCHn, 12), GPIO12));
6587 _for_each_inner_analog_function!(((TOUCH13, TOUCHn, 13), GPIO13));
6588 _for_each_inner_analog_function!(((TOUCH14, TOUCHn, 14), GPIO14));
6589 _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1));
6590 _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2));
6591 _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3));
6592 _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4));
6593 _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5));
6594 _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6));
6595 _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7));
6596 _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8));
6597 _for_each_inner_analog_function!(((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9));
6598 _for_each_inner_analog_function!(((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10));
6599 _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11));
6600 _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12));
6601 _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13));
6602 _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14));
6603 _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15));
6604 _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16));
6605 _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17));
6606 _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18));
6607 _for_each_inner_analog_function!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19));
6608 _for_each_inner_analog_function!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20));
6609 _for_each_inner_analog_function!((all(TOUCH1, GPIO1), (ADC1_CH0, GPIO1), (TOUCH2,
6610 GPIO2), (ADC1_CH1, GPIO2), (TOUCH3, GPIO3), (ADC1_CH2, GPIO3), (TOUCH4, GPIO4),
6611 (ADC1_CH3, GPIO4), (TOUCH5, GPIO5), (ADC1_CH4, GPIO5), (TOUCH6, GPIO6),
6612 (ADC1_CH5, GPIO6), (TOUCH7, GPIO7), (ADC1_CH6, GPIO7), (TOUCH8, GPIO8),
6613 (ADC1_CH7, GPIO8), (TOUCH9, GPIO9), (ADC1_CH8, GPIO9), (TOUCH10, GPIO10),
6614 (ADC1_CH9, GPIO10), (TOUCH11, GPIO11), (ADC2_CH0, GPIO11), (TOUCH12, GPIO12),
6615 (ADC2_CH1, GPIO12), (TOUCH13, GPIO13), (ADC2_CH2, GPIO13), (TOUCH14, GPIO14),
6616 (ADC2_CH3, GPIO14), (XTAL_32K_P, GPIO15), (ADC2_CH4, GPIO15), (XTAL_32K_N,
6617 GPIO16), (ADC2_CH5, GPIO16), (ADC2_CH6, GPIO17), (ADC2_CH7, GPIO18), (USB_FS_DM,
6618 GPIO19), (ADC2_CH8, GPIO19), (USB_FS_DP, GPIO20), (ADC2_CH9, GPIO20)));
6619 _for_each_inner_analog_function!((TOUCHn((TOUCH1, TOUCHn, 1), GPIO1), ((TOUCH2,
6620 TOUCHn, 2), GPIO2), ((TOUCH3, TOUCHn, 3), GPIO3), ((TOUCH4, TOUCHn, 4), GPIO4),
6621 ((TOUCH5, TOUCHn, 5), GPIO5), ((TOUCH6, TOUCHn, 6), GPIO6), ((TOUCH7, TOUCHn, 7),
6622 GPIO7), ((TOUCH8, TOUCHn, 8), GPIO8), ((TOUCH9, TOUCHn, 9), GPIO9), ((TOUCH10,
6623 TOUCHn, 10), GPIO10), ((TOUCH11, TOUCHn, 11), GPIO11), ((TOUCH12, TOUCHn, 12),
6624 GPIO12), ((TOUCH13, TOUCHn, 13), GPIO13), ((TOUCH14, TOUCHn, 14), GPIO14)));
6625 _for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1),
6626 ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3),
6627 ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5),
6628 ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7),
6629 ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8), ((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9),
6630 ((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10), ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11),
6631 ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13),
6632 ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14), ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15),
6633 ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16), ((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17),
6634 ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18), ((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19),
6635 ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20)));
6636 };
6637}
6638#[macro_export]
6676#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6677macro_rules! for_each_lp_function {
6678 ($($pattern:tt => $code:tt;)*) => {
6679 macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
6680 => {} } _for_each_inner_lp_function!((LP_GPIO0, GPIO0, _0));
6681 _for_each_inner_lp_function!((SAR_I2C_SCL_0, GPIO0, _3));
6682 _for_each_inner_lp_function!((LP_GPIO1, GPIO1, _0));
6683 _for_each_inner_lp_function!((SAR_I2C_SDA_0, GPIO1, _3));
6684 _for_each_inner_lp_function!((LP_GPIO2, GPIO2, _0));
6685 _for_each_inner_lp_function!((SAR_I2C_SCL_1, GPIO2, _3));
6686 _for_each_inner_lp_function!((LP_GPIO3, GPIO3, _0));
6687 _for_each_inner_lp_function!((SAR_I2C_SDA_1, GPIO3, _3));
6688 _for_each_inner_lp_function!((LP_GPIO4, GPIO4, _0));
6689 _for_each_inner_lp_function!((LP_GPIO5, GPIO5, _0));
6690 _for_each_inner_lp_function!((LP_GPIO6, GPIO6, _0));
6691 _for_each_inner_lp_function!((LP_GPIO7, GPIO7, _0));
6692 _for_each_inner_lp_function!((LP_GPIO8, GPIO8, _0));
6693 _for_each_inner_lp_function!((LP_GPIO9, GPIO9, _0));
6694 _for_each_inner_lp_function!((LP_GPIO10, GPIO10, _0));
6695 _for_each_inner_lp_function!((LP_GPIO11, GPIO11, _0));
6696 _for_each_inner_lp_function!((LP_GPIO12, GPIO12, _0));
6697 _for_each_inner_lp_function!((LP_GPIO13, GPIO13, _0));
6698 _for_each_inner_lp_function!((LP_GPIO14, GPIO14, _0));
6699 _for_each_inner_lp_function!((LP_GPIO15, GPIO15, _0));
6700 _for_each_inner_lp_function!((LP_GPIO16, GPIO16, _0));
6701 _for_each_inner_lp_function!((LP_GPIO17, GPIO17, _0));
6702 _for_each_inner_lp_function!((LP_GPIO18, GPIO18, _0));
6703 _for_each_inner_lp_function!((LP_GPIO19, GPIO19, _0));
6704 _for_each_inner_lp_function!((LP_GPIO20, GPIO20, _0));
6705 _for_each_inner_lp_function!((LP_GPIO21, GPIO21, _0));
6706 _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, () ()));
6707 _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()));
6708 _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _0, () ()));
6709 _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()));
6710 _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _0, () ()));
6711 _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()));
6712 _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()));
6713 _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO7, _0, () ()));
6714 _for_each_inner_lp_function!(((LP_GPIO8, LP_GPIOn, 8), GPIO8, _0, () ()));
6715 _for_each_inner_lp_function!(((LP_GPIO9, LP_GPIOn, 9), GPIO9, _0, () ()));
6716 _for_each_inner_lp_function!(((LP_GPIO10, LP_GPIOn, 10), GPIO10, _0, () ()));
6717 _for_each_inner_lp_function!(((LP_GPIO11, LP_GPIOn, 11), GPIO11, _0, () ()));
6718 _for_each_inner_lp_function!(((LP_GPIO12, LP_GPIOn, 12), GPIO12, _0, () ()));
6719 _for_each_inner_lp_function!(((LP_GPIO13, LP_GPIOn, 13), GPIO13, _0, () ()));
6720 _for_each_inner_lp_function!(((LP_GPIO14, LP_GPIOn, 14), GPIO14, _0, () ()));
6721 _for_each_inner_lp_function!(((LP_GPIO15, LP_GPIOn, 15), GPIO15, _0, () ()));
6722 _for_each_inner_lp_function!(((LP_GPIO16, LP_GPIOn, 16), GPIO16, _0, () ()));
6723 _for_each_inner_lp_function!(((LP_GPIO17, LP_GPIOn, 17), GPIO17, _0, () ()));
6724 _for_each_inner_lp_function!(((LP_GPIO18, LP_GPIOn, 18), GPIO18, _0, () ()));
6725 _for_each_inner_lp_function!(((LP_GPIO19, LP_GPIOn, 19), GPIO19, _0, () ()));
6726 _for_each_inner_lp_function!(((LP_GPIO20, LP_GPIOn, 20), GPIO20, _0, () ()));
6727 _for_each_inner_lp_function!(((LP_GPIO21, LP_GPIOn, 21), GPIO21, _0, () ()));
6728 _for_each_inner_lp_function!(((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0), GPIO0, _3, ()
6729 ())); _for_each_inner_lp_function!(((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2, _3,
6730 () ())); _for_each_inner_lp_function!(((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0), GPIO1,
6731 _3, () ())); _for_each_inner_lp_function!(((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1),
6732 GPIO3, _3, () ())); _for_each_inner_lp_function!((all(LP_GPIO0, GPIO0, _0),
6733 (SAR_I2C_SCL_0, GPIO0, _3), (LP_GPIO1, GPIO1, _0), (SAR_I2C_SDA_0, GPIO1, _3),
6734 (LP_GPIO2, GPIO2, _0), (SAR_I2C_SCL_1, GPIO2, _3), (LP_GPIO3, GPIO3, _0),
6735 (SAR_I2C_SDA_1, GPIO3, _3), (LP_GPIO4, GPIO4, _0), (LP_GPIO5, GPIO5, _0),
6736 (LP_GPIO6, GPIO6, _0), (LP_GPIO7, GPIO7, _0), (LP_GPIO8, GPIO8, _0), (LP_GPIO9,
6737 GPIO9, _0), (LP_GPIO10, GPIO10, _0), (LP_GPIO11, GPIO11, _0), (LP_GPIO12, GPIO12,
6738 _0), (LP_GPIO13, GPIO13, _0), (LP_GPIO14, GPIO14, _0), (LP_GPIO15, GPIO15, _0),
6739 (LP_GPIO16, GPIO16, _0), (LP_GPIO17, GPIO17, _0), (LP_GPIO18, GPIO18, _0),
6740 (LP_GPIO19, GPIO19, _0), (LP_GPIO20, GPIO20, _0), (LP_GPIO21, GPIO21, _0)));
6741 _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, ()
6742 ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()), ((LP_GPIO2, LP_GPIOn, 2),
6743 GPIO2, _0, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()), ((LP_GPIO4,
6744 LP_GPIOn, 4), GPIO4, _0, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()),
6745 ((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()), ((LP_GPIO7, LP_GPIOn, 7), GPIO7, _0,
6746 () ()), ((LP_GPIO8, LP_GPIOn, 8), GPIO8, _0, () ()), ((LP_GPIO9, LP_GPIOn, 9),
6747 GPIO9, _0, () ()), ((LP_GPIO10, LP_GPIOn, 10), GPIO10, _0, () ()), ((LP_GPIO11,
6748 LP_GPIOn, 11), GPIO11, _0, () ()), ((LP_GPIO12, LP_GPIOn, 12), GPIO12, _0, ()
6749 ()), ((LP_GPIO13, LP_GPIOn, 13), GPIO13, _0, () ()), ((LP_GPIO14, LP_GPIOn, 14),
6750 GPIO14, _0, () ()), ((LP_GPIO15, LP_GPIOn, 15), GPIO15, _0, () ()), ((LP_GPIO16,
6751 LP_GPIOn, 16), GPIO16, _0, () ()), ((LP_GPIO17, LP_GPIOn, 17), GPIO17, _0, ()
6752 ()), ((LP_GPIO18, LP_GPIOn, 18), GPIO18, _0, () ()), ((LP_GPIO19, LP_GPIOn, 19),
6753 GPIO19, _0, () ()), ((LP_GPIO20, LP_GPIOn, 20), GPIO20, _0, () ()), ((LP_GPIO21,
6754 LP_GPIOn, 21), GPIO21, _0, () ())));
6755 _for_each_inner_lp_function!((SAR_I2C_SCL_n((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0),
6756 GPIO0, _3, () ()), ((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2, _3, () ())));
6757 _for_each_inner_lp_function!((SAR_I2C_SDA_n((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0),
6758 GPIO1, _3, () ()), ((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1), GPIO3, _3, () ())));
6759 };
6760}
6761#[macro_export]
6792#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6793macro_rules! for_each_iomux_function {
6794 ($($pattern:tt => $code:tt;)*) => {
6795 macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
6796 tt) => {} } _for_each_inner_iomux_function!((SUBSPICS1, GPIO8, _3));
6797 _for_each_inner_iomux_function!((SUBSPIHD, GPIO9, _3));
6798 _for_each_inner_iomux_function!((FSPIHD, GPIO9, _4));
6799 _for_each_inner_iomux_function!((FSPIIO4, GPIO10, _2));
6800 _for_each_inner_iomux_function!((SUBSPICS0, GPIO10, _3));
6801 _for_each_inner_iomux_function!((FSPICS0, GPIO10, _4));
6802 _for_each_inner_iomux_function!((FSPIIO5, GPIO11, _2));
6803 _for_each_inner_iomux_function!((SUBSPID, GPIO11, _3));
6804 _for_each_inner_iomux_function!((FSPID, GPIO11, _4));
6805 _for_each_inner_iomux_function!((FSPIIO6, GPIO12, _2));
6806 _for_each_inner_iomux_function!((SUBSPICLK, GPIO12, _3));
6807 _for_each_inner_iomux_function!((FSPICLK, GPIO12, _4));
6808 _for_each_inner_iomux_function!((FSPIIO7, GPIO13, _2));
6809 _for_each_inner_iomux_function!((SUBSPIQ, GPIO13, _3));
6810 _for_each_inner_iomux_function!((FSPIQ, GPIO13, _4));
6811 _for_each_inner_iomux_function!((FSPIDQS, GPIO14, _2));
6812 _for_each_inner_iomux_function!((SUBSPIWP, GPIO14, _3));
6813 _for_each_inner_iomux_function!((FSPIWP, GPIO14, _4));
6814 _for_each_inner_iomux_function!((U0RTS, GPIO15, _2));
6815 _for_each_inner_iomux_function!((U0CTS, GPIO16, _2));
6816 _for_each_inner_iomux_function!((U1TXD, GPIO17, _2));
6817 _for_each_inner_iomux_function!((U1RXD, GPIO18, _2));
6818 _for_each_inner_iomux_function!((CLK_OUT3, GPIO18, _3));
6819 _for_each_inner_iomux_function!((U1RTS, GPIO19, _2));
6820 _for_each_inner_iomux_function!((CLK_OUT2, GPIO19, _3));
6821 _for_each_inner_iomux_function!((U1CTS, GPIO20, _2));
6822 _for_each_inner_iomux_function!((CLK_OUT1, GPIO20, _3));
6823 _for_each_inner_iomux_function!((SPICS1, GPIO26, _0));
6824 _for_each_inner_iomux_function!((SPIHD, GPIO27, _0));
6825 _for_each_inner_iomux_function!((SPIWP, GPIO28, _0));
6826 _for_each_inner_iomux_function!((SPICS0, GPIO29, _0));
6827 _for_each_inner_iomux_function!((SPICLK, GPIO30, _0));
6828 _for_each_inner_iomux_function!((SPIQ, GPIO31, _0));
6829 _for_each_inner_iomux_function!((SPID, GPIO32, _0));
6830 _for_each_inner_iomux_function!((FSPIHD, GPIO33, _2));
6831 _for_each_inner_iomux_function!((SUBSPIHD, GPIO33, _3));
6832 _for_each_inner_iomux_function!((SPIIO4, GPIO33, _4));
6833 _for_each_inner_iomux_function!((FSPICS0, GPIO34, _2));
6834 _for_each_inner_iomux_function!((SUBSPICS0, GPIO34, _3));
6835 _for_each_inner_iomux_function!((SPIIO5, GPIO34, _4));
6836 _for_each_inner_iomux_function!((FSPID, GPIO35, _2));
6837 _for_each_inner_iomux_function!((SUBSPID, GPIO35, _3));
6838 _for_each_inner_iomux_function!((SPIIO6, GPIO35, _4));
6839 _for_each_inner_iomux_function!((FSPICLK, GPIO36, _2));
6840 _for_each_inner_iomux_function!((SUBSPICLK, GPIO36, _3));
6841 _for_each_inner_iomux_function!((SPIIO7, GPIO36, _4));
6842 _for_each_inner_iomux_function!((FSPIQ, GPIO37, _2));
6843 _for_each_inner_iomux_function!((SUBSPIQ, GPIO37, _3));
6844 _for_each_inner_iomux_function!((SPIDQS, GPIO37, _4));
6845 _for_each_inner_iomux_function!((FSPIWP, GPIO38, _2));
6846 _for_each_inner_iomux_function!((SUBSPIWP, GPIO38, _3));
6847 _for_each_inner_iomux_function!((MTCK, GPIO39, _0));
6848 _for_each_inner_iomux_function!((CLK_OUT3, GPIO39, _2));
6849 _for_each_inner_iomux_function!((SUBSPICS1, GPIO39, _3));
6850 _for_each_inner_iomux_function!((MTDO, GPIO40, _0));
6851 _for_each_inner_iomux_function!((CLK_OUT2, GPIO40, _2));
6852 _for_each_inner_iomux_function!((MTDI, GPIO41, _0));
6853 _for_each_inner_iomux_function!((CLK_OUT1, GPIO41, _2));
6854 _for_each_inner_iomux_function!((MTMS, GPIO42, _0));
6855 _for_each_inner_iomux_function!((U0TXD, GPIO43, _0));
6856 _for_each_inner_iomux_function!((CLK_OUT1, GPIO43, _2));
6857 _for_each_inner_iomux_function!((U0RXD, GPIO44, _0));
6858 _for_each_inner_iomux_function!((CLK_OUT2, GPIO44, _2));
6859 _for_each_inner_iomux_function!((SPICLK_P_DIFF, GPIO47, _0));
6860 _for_each_inner_iomux_function!((SUBSPICLK_P_DIFF, GPIO47, _2));
6861 _for_each_inner_iomux_function!((SPICLK_N_DIFF, GPIO48, _0));
6862 _for_each_inner_iomux_function!((SUBSPICLK_N_DIFF, GPIO48, _2));
6863 _for_each_inner_iomux_function!(((SUBSPICS1, SUBSPICSn, 1), GPIO8, _3));
6864 _for_each_inner_iomux_function!(((SUBSPICS0, SUBSPICSn, 0), GPIO10, _3));
6865 _for_each_inner_iomux_function!(((SUBSPICS0, SUBSPICSn, 0), GPIO34, _3));
6866 _for_each_inner_iomux_function!(((SUBSPICS1, SUBSPICSn, 1), GPIO39, _3));
6867 _for_each_inner_iomux_function!(((FSPIIO4, FSPIIOn, 4), GPIO10, _2));
6868 _for_each_inner_iomux_function!(((FSPIIO5, FSPIIOn, 5), GPIO11, _2));
6869 _for_each_inner_iomux_function!(((FSPIIO6, FSPIIOn, 6), GPIO12, _2));
6870 _for_each_inner_iomux_function!(((FSPIIO7, FSPIIOn, 7), GPIO13, _2));
6871 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO10, _4));
6872 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO34, _2));
6873 _for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO18, _3));
6874 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO19, _3));
6875 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO20, _3));
6876 _for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO39, _2));
6877 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO40, _2));
6878 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO41, _2));
6879 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO43, _2));
6880 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO44, _2));
6881 _for_each_inner_iomux_function!(((SPICS1, SPICSn, 1), GPIO26, _0));
6882 _for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO29, _0));
6883 _for_each_inner_iomux_function!(((SPIIO4, SPIIOn, 4), GPIO33, _4));
6884 _for_each_inner_iomux_function!(((SPIIO5, SPIIOn, 5), GPIO34, _4));
6885 _for_each_inner_iomux_function!(((SPIIO6, SPIIOn, 6), GPIO35, _4));
6886 _for_each_inner_iomux_function!(((SPIIO7, SPIIOn, 7), GPIO36, _4));
6887 _for_each_inner_iomux_function!((all(SUBSPICS1, GPIO8, _3), (SUBSPIHD, GPIO9,
6888 _3), (FSPIHD, GPIO9, _4), (FSPIIO4, GPIO10, _2), (SUBSPICS0, GPIO10, _3),
6889 (FSPICS0, GPIO10, _4), (FSPIIO5, GPIO11, _2), (SUBSPID, GPIO11, _3), (FSPID,
6890 GPIO11, _4), (FSPIIO6, GPIO12, _2), (SUBSPICLK, GPIO12, _3), (FSPICLK, GPIO12,
6891 _4), (FSPIIO7, GPIO13, _2), (SUBSPIQ, GPIO13, _3), (FSPIQ, GPIO13, _4), (FSPIDQS,
6892 GPIO14, _2), (SUBSPIWP, GPIO14, _3), (FSPIWP, GPIO14, _4), (U0RTS, GPIO15, _2),
6893 (U0CTS, GPIO16, _2), (U1TXD, GPIO17, _2), (U1RXD, GPIO18, _2), (CLK_OUT3, GPIO18,
6894 _3), (U1RTS, GPIO19, _2), (CLK_OUT2, GPIO19, _3), (U1CTS, GPIO20, _2), (CLK_OUT1,
6895 GPIO20, _3), (SPICS1, GPIO26, _0), (SPIHD, GPIO27, _0), (SPIWP, GPIO28, _0),
6896 (SPICS0, GPIO29, _0), (SPICLK, GPIO30, _0), (SPIQ, GPIO31, _0), (SPID, GPIO32,
6897 _0), (FSPIHD, GPIO33, _2), (SUBSPIHD, GPIO33, _3), (SPIIO4, GPIO33, _4),
6898 (FSPICS0, GPIO34, _2), (SUBSPICS0, GPIO34, _3), (SPIIO5, GPIO34, _4), (FSPID,
6899 GPIO35, _2), (SUBSPID, GPIO35, _3), (SPIIO6, GPIO35, _4), (FSPICLK, GPIO36, _2),
6900 (SUBSPICLK, GPIO36, _3), (SPIIO7, GPIO36, _4), (FSPIQ, GPIO37, _2), (SUBSPIQ,
6901 GPIO37, _3), (SPIDQS, GPIO37, _4), (FSPIWP, GPIO38, _2), (SUBSPIWP, GPIO38, _3),
6902 (MTCK, GPIO39, _0), (CLK_OUT3, GPIO39, _2), (SUBSPICS1, GPIO39, _3), (MTDO,
6903 GPIO40, _0), (CLK_OUT2, GPIO40, _2), (MTDI, GPIO41, _0), (CLK_OUT1, GPIO41, _2),
6904 (MTMS, GPIO42, _0), (U0TXD, GPIO43, _0), (CLK_OUT1, GPIO43, _2), (U0RXD, GPIO44,
6905 _0), (CLK_OUT2, GPIO44, _2), (SPICLK_P_DIFF, GPIO47, _0), (SUBSPICLK_P_DIFF,
6906 GPIO47, _2), (SPICLK_N_DIFF, GPIO48, _0), (SUBSPICLK_N_DIFF, GPIO48, _2)));
6907 _for_each_inner_iomux_function!((SUBSPICSn((SUBSPICS1, SUBSPICSn, 1), GPIO8, _3),
6908 ((SUBSPICS0, SUBSPICSn, 0), GPIO10, _3), ((SUBSPICS0, SUBSPICSn, 0), GPIO34, _3),
6909 ((SUBSPICS1, SUBSPICSn, 1), GPIO39, _3)));
6910 _for_each_inner_iomux_function!((FSPIIOn((FSPIIO4, FSPIIOn, 4), GPIO10, _2),
6911 ((FSPIIO5, FSPIIOn, 5), GPIO11, _2), ((FSPIIO6, FSPIIOn, 6), GPIO12, _2),
6912 ((FSPIIO7, FSPIIOn, 7), GPIO13, _2)));
6913 _for_each_inner_iomux_function!((FSPICSn((FSPICS0, FSPICSn, 0), GPIO10, _4),
6914 ((FSPICS0, FSPICSn, 0), GPIO34, _2)));
6915 _for_each_inner_iomux_function!((CLK_OUTn((CLK_OUT3, CLK_OUTn, 3), GPIO18, _3),
6916 ((CLK_OUT2, CLK_OUTn, 2), GPIO19, _3), ((CLK_OUT1, CLK_OUTn, 1), GPIO20, _3),
6917 ((CLK_OUT3, CLK_OUTn, 3), GPIO39, _2), ((CLK_OUT2, CLK_OUTn, 2), GPIO40, _2),
6918 ((CLK_OUT1, CLK_OUTn, 1), GPIO41, _2), ((CLK_OUT1, CLK_OUTn, 1), GPIO43, _2),
6919 ((CLK_OUT2, CLK_OUTn, 2), GPIO44, _2)));
6920 _for_each_inner_iomux_function!((SPICSn((SPICS1, SPICSn, 1), GPIO26, _0),
6921 ((SPICS0, SPICSn, 0), GPIO29, _0)));
6922 _for_each_inner_iomux_function!((SPIIOn((SPIIO4, SPIIOn, 4), GPIO33, _4),
6923 ((SPIIO5, SPIIOn, 5), GPIO34, _4), ((SPIIO6, SPIIOn, 6), GPIO35, _4), ((SPIIO7,
6924 SPIIOn, 7), GPIO36, _4)));
6925 };
6926}
6927#[macro_export]
6944#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6945macro_rules! gpio_for_signal {
6946 (LP_GPIO0 $(, $_fallback:literal)?) => {
6947 "GPIO0"
6948 };
6949 (SAR_I2C_SCL_0 $(, $_fallback:literal)?) => {
6950 "GPIO0"
6951 };
6952 (TOUCH1 $(, $_fallback:literal)?) => {
6953 "GPIO1"
6954 };
6955 (ADC1_CH0 $(, $_fallback:literal)?) => {
6956 "GPIO1"
6957 };
6958 (LP_GPIO1 $(, $_fallback:literal)?) => {
6959 "GPIO1"
6960 };
6961 (SAR_I2C_SDA_0 $(, $_fallback:literal)?) => {
6962 "GPIO1"
6963 };
6964 (TOUCH2 $(, $_fallback:literal)?) => {
6965 "GPIO2"
6966 };
6967 (ADC1_CH1 $(, $_fallback:literal)?) => {
6968 "GPIO2"
6969 };
6970 (LP_GPIO2 $(, $_fallback:literal)?) => {
6971 "GPIO2"
6972 };
6973 (SAR_I2C_SCL_1 $(, $_fallback:literal)?) => {
6974 "GPIO2"
6975 };
6976 (TOUCH3 $(, $_fallback:literal)?) => {
6977 "GPIO3"
6978 };
6979 (ADC1_CH2 $(, $_fallback:literal)?) => {
6980 "GPIO3"
6981 };
6982 (LP_GPIO3 $(, $_fallback:literal)?) => {
6983 "GPIO3"
6984 };
6985 (SAR_I2C_SDA_1 $(, $_fallback:literal)?) => {
6986 "GPIO3"
6987 };
6988 (TOUCH4 $(, $_fallback:literal)?) => {
6989 "GPIO4"
6990 };
6991 (ADC1_CH3 $(, $_fallback:literal)?) => {
6992 "GPIO4"
6993 };
6994 (LP_GPIO4 $(, $_fallback:literal)?) => {
6995 "GPIO4"
6996 };
6997 (TOUCH5 $(, $_fallback:literal)?) => {
6998 "GPIO5"
6999 };
7000 (ADC1_CH4 $(, $_fallback:literal)?) => {
7001 "GPIO5"
7002 };
7003 (LP_GPIO5 $(, $_fallback:literal)?) => {
7004 "GPIO5"
7005 };
7006 (TOUCH6 $(, $_fallback:literal)?) => {
7007 "GPIO6"
7008 };
7009 (ADC1_CH5 $(, $_fallback:literal)?) => {
7010 "GPIO6"
7011 };
7012 (LP_GPIO6 $(, $_fallback:literal)?) => {
7013 "GPIO6"
7014 };
7015 (TOUCH7 $(, $_fallback:literal)?) => {
7016 "GPIO7"
7017 };
7018 (ADC1_CH6 $(, $_fallback:literal)?) => {
7019 "GPIO7"
7020 };
7021 (LP_GPIO7 $(, $_fallback:literal)?) => {
7022 "GPIO7"
7023 };
7024 (SUBSPICS1 $(, $_fallback:literal)?) => {
7025 "GPIO8"
7026 };
7027 (TOUCH8 $(, $_fallback:literal)?) => {
7028 "GPIO8"
7029 };
7030 (ADC1_CH7 $(, $_fallback:literal)?) => {
7031 "GPIO8"
7032 };
7033 (LP_GPIO8 $(, $_fallback:literal)?) => {
7034 "GPIO8"
7035 };
7036 (SUBSPIHD $(, $_fallback:literal)?) => {
7037 "GPIO9"
7038 };
7039 (FSPIHD $(, $_fallback:literal)?) => {
7040 "GPIO9"
7041 };
7042 (TOUCH9 $(, $_fallback:literal)?) => {
7043 "GPIO9"
7044 };
7045 (ADC1_CH8 $(, $_fallback:literal)?) => {
7046 "GPIO9"
7047 };
7048 (LP_GPIO9 $(, $_fallback:literal)?) => {
7049 "GPIO9"
7050 };
7051 (FSPIIO4 $(, $_fallback:literal)?) => {
7052 "GPIO10"
7053 };
7054 (SUBSPICS0 $(, $_fallback:literal)?) => {
7055 "GPIO10"
7056 };
7057 (FSPICS0 $(, $_fallback:literal)?) => {
7058 "GPIO10"
7059 };
7060 (TOUCH10 $(, $_fallback:literal)?) => {
7061 "GPIO10"
7062 };
7063 (ADC1_CH9 $(, $_fallback:literal)?) => {
7064 "GPIO10"
7065 };
7066 (LP_GPIO10 $(, $_fallback:literal)?) => {
7067 "GPIO10"
7068 };
7069 (FSPIIO5 $(, $_fallback:literal)?) => {
7070 "GPIO11"
7071 };
7072 (SUBSPID $(, $_fallback:literal)?) => {
7073 "GPIO11"
7074 };
7075 (FSPID $(, $_fallback:literal)?) => {
7076 "GPIO11"
7077 };
7078 (TOUCH11 $(, $_fallback:literal)?) => {
7079 "GPIO11"
7080 };
7081 (ADC2_CH0 $(, $_fallback:literal)?) => {
7082 "GPIO11"
7083 };
7084 (LP_GPIO11 $(, $_fallback:literal)?) => {
7085 "GPIO11"
7086 };
7087 (FSPIIO6 $(, $_fallback:literal)?) => {
7088 "GPIO12"
7089 };
7090 (SUBSPICLK $(, $_fallback:literal)?) => {
7091 "GPIO12"
7092 };
7093 (FSPICLK $(, $_fallback:literal)?) => {
7094 "GPIO12"
7095 };
7096 (TOUCH12 $(, $_fallback:literal)?) => {
7097 "GPIO12"
7098 };
7099 (ADC2_CH1 $(, $_fallback:literal)?) => {
7100 "GPIO12"
7101 };
7102 (LP_GPIO12 $(, $_fallback:literal)?) => {
7103 "GPIO12"
7104 };
7105 (FSPIIO7 $(, $_fallback:literal)?) => {
7106 "GPIO13"
7107 };
7108 (SUBSPIQ $(, $_fallback:literal)?) => {
7109 "GPIO13"
7110 };
7111 (FSPIQ $(, $_fallback:literal)?) => {
7112 "GPIO13"
7113 };
7114 (TOUCH13 $(, $_fallback:literal)?) => {
7115 "GPIO13"
7116 };
7117 (ADC2_CH2 $(, $_fallback:literal)?) => {
7118 "GPIO13"
7119 };
7120 (LP_GPIO13 $(, $_fallback:literal)?) => {
7121 "GPIO13"
7122 };
7123 (FSPIDQS $(, $_fallback:literal)?) => {
7124 "GPIO14"
7125 };
7126 (SUBSPIWP $(, $_fallback:literal)?) => {
7127 "GPIO14"
7128 };
7129 (FSPIWP $(, $_fallback:literal)?) => {
7130 "GPIO14"
7131 };
7132 (TOUCH14 $(, $_fallback:literal)?) => {
7133 "GPIO14"
7134 };
7135 (ADC2_CH3 $(, $_fallback:literal)?) => {
7136 "GPIO14"
7137 };
7138 (LP_GPIO14 $(, $_fallback:literal)?) => {
7139 "GPIO14"
7140 };
7141 (U0RTS $(, $_fallback:literal)?) => {
7142 "GPIO15"
7143 };
7144 (XTAL_32K_P $(, $_fallback:literal)?) => {
7145 "GPIO15"
7146 };
7147 (ADC2_CH4 $(, $_fallback:literal)?) => {
7148 "GPIO15"
7149 };
7150 (LP_GPIO15 $(, $_fallback:literal)?) => {
7151 "GPIO15"
7152 };
7153 (U0CTS $(, $_fallback:literal)?) => {
7154 "GPIO16"
7155 };
7156 (XTAL_32K_N $(, $_fallback:literal)?) => {
7157 "GPIO16"
7158 };
7159 (ADC2_CH5 $(, $_fallback:literal)?) => {
7160 "GPIO16"
7161 };
7162 (LP_GPIO16 $(, $_fallback:literal)?) => {
7163 "GPIO16"
7164 };
7165 (U1TXD $(, $_fallback:literal)?) => {
7166 "GPIO17"
7167 };
7168 (ADC2_CH6 $(, $_fallback:literal)?) => {
7169 "GPIO17"
7170 };
7171 (LP_GPIO17 $(, $_fallback:literal)?) => {
7172 "GPIO17"
7173 };
7174 (U1RXD $(, $_fallback:literal)?) => {
7175 "GPIO18"
7176 };
7177 (CLK_OUT3 $(, $_fallback:literal)?) => {
7178 "GPIO18"
7179 };
7180 (ADC2_CH7 $(, $_fallback:literal)?) => {
7181 "GPIO18"
7182 };
7183 (LP_GPIO18 $(, $_fallback:literal)?) => {
7184 "GPIO18"
7185 };
7186 (U1RTS $(, $_fallback:literal)?) => {
7187 "GPIO19"
7188 };
7189 (CLK_OUT2 $(, $_fallback:literal)?) => {
7190 "GPIO19"
7191 };
7192 (USB_FS_DM $(, $_fallback:literal)?) => {
7193 "GPIO19"
7194 };
7195 (ADC2_CH8 $(, $_fallback:literal)?) => {
7196 "GPIO19"
7197 };
7198 (LP_GPIO19 $(, $_fallback:literal)?) => {
7199 "GPIO19"
7200 };
7201 (U1CTS $(, $_fallback:literal)?) => {
7202 "GPIO20"
7203 };
7204 (CLK_OUT1 $(, $_fallback:literal)?) => {
7205 "GPIO20"
7206 };
7207 (USB_FS_DP $(, $_fallback:literal)?) => {
7208 "GPIO20"
7209 };
7210 (ADC2_CH9 $(, $_fallback:literal)?) => {
7211 "GPIO20"
7212 };
7213 (LP_GPIO20 $(, $_fallback:literal)?) => {
7214 "GPIO20"
7215 };
7216 (LP_GPIO21 $(, $_fallback:literal)?) => {
7217 "GPIO21"
7218 };
7219 (SPICS1 $(, $_fallback:literal)?) => {
7220 "GPIO26"
7221 };
7222 (SPIHD $(, $_fallback:literal)?) => {
7223 "GPIO27"
7224 };
7225 (SPIWP $(, $_fallback:literal)?) => {
7226 "GPIO28"
7227 };
7228 (SPICS0 $(, $_fallback:literal)?) => {
7229 "GPIO29"
7230 };
7231 (SPICLK $(, $_fallback:literal)?) => {
7232 "GPIO30"
7233 };
7234 (SPIQ $(, $_fallback:literal)?) => {
7235 "GPIO31"
7236 };
7237 (SPID $(, $_fallback:literal)?) => {
7238 "GPIO32"
7239 };
7240 (SPIIO4 $(, $_fallback:literal)?) => {
7241 "GPIO33"
7242 };
7243 (SPIIO5 $(, $_fallback:literal)?) => {
7244 "GPIO34"
7245 };
7246 (SPIIO6 $(, $_fallback:literal)?) => {
7247 "GPIO35"
7248 };
7249 (SPIIO7 $(, $_fallback:literal)?) => {
7250 "GPIO36"
7251 };
7252 (SPIDQS $(, $_fallback:literal)?) => {
7253 "GPIO37"
7254 };
7255 (MTCK $(, $_fallback:literal)?) => {
7256 "GPIO39"
7257 };
7258 (MTDO $(, $_fallback:literal)?) => {
7259 "GPIO40"
7260 };
7261 (MTDI $(, $_fallback:literal)?) => {
7262 "GPIO41"
7263 };
7264 (MTMS $(, $_fallback:literal)?) => {
7265 "GPIO42"
7266 };
7267 (U0TXD $(, $_fallback:literal)?) => {
7268 "GPIO43"
7269 };
7270 (U0RXD $(, $_fallback:literal)?) => {
7271 "GPIO44"
7272 };
7273 (SPICLK_P_DIFF $(, $_fallback:literal)?) => {
7274 "GPIO47"
7275 };
7276 (SUBSPICLK_P_DIFF $(, $_fallback:literal)?) => {
7277 "GPIO47"
7278 };
7279 (SPICLK_N_DIFF $(, $_fallback:literal)?) => {
7280 "GPIO48"
7281 };
7282 (SUBSPICLK_N_DIFF $(, $_fallback:literal)?) => {
7283 "GPIO48"
7284 };
7285 ($_signal:ident, $fallback:literal) => {
7286 $fallback
7287 };
7288}
7289#[macro_export]
7293#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7294macro_rules! define_io_mux_signals {
7295 () => {
7296 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
7297 #[derive(Debug, PartialEq, Copy, Clone)]
7298 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
7299 #[doc(hidden)]
7300 pub enum InputSignal {
7301 SPIQ = 0,
7302 SPID = 1,
7303 SPIHD = 2,
7304 SPIWP = 3,
7305 SPID4 = 7,
7306 SPID5 = 8,
7307 SPID6 = 9,
7308 SPID7 = 10,
7309 SPIDQS = 11,
7310 U0RXD = 12,
7311 U0CTS = 13,
7312 U0DSR = 14,
7313 U1RXD = 15,
7314 U1CTS = 16,
7315 U1DSR = 17,
7316 U2RXD = 18,
7317 U2CTS = 19,
7318 U2DSR = 20,
7319 I2S1_MCLK = 21,
7320 I2S0O_BCK = 22,
7321 I2S0_MCLK = 23,
7322 I2S0O_WS = 24,
7323 I2S0I_SD = 25,
7324 I2S0I_BCK = 26,
7325 I2S0I_WS = 27,
7326 I2S1O_BCK = 28,
7327 I2S1O_WS = 29,
7328 I2S1I_SD = 30,
7329 I2S1I_BCK = 31,
7330 I2S1I_WS = 32,
7331 PCNT0_SIG_CH0 = 33,
7332 PCNT0_SIG_CH1 = 34,
7333 PCNT0_CTRL_CH0 = 35,
7334 PCNT0_CTRL_CH1 = 36,
7335 PCNT1_SIG_CH0 = 37,
7336 PCNT1_SIG_CH1 = 38,
7337 PCNT1_CTRL_CH0 = 39,
7338 PCNT1_CTRL_CH1 = 40,
7339 PCNT2_SIG_CH0 = 41,
7340 PCNT2_SIG_CH1 = 42,
7341 PCNT2_CTRL_CH0 = 43,
7342 PCNT2_CTRL_CH1 = 44,
7343 PCNT3_SIG_CH0 = 45,
7344 PCNT3_SIG_CH1 = 46,
7345 PCNT3_CTRL_CH0 = 47,
7346 PCNT3_CTRL_CH1 = 48,
7347 I2S0I_SD1 = 51,
7348 I2S0I_SD2 = 52,
7349 I2S0I_SD3 = 53,
7350 CORE1_GPIO7 = 54,
7351 USB_EXTPHY_VP = 55,
7352 USB_EXTPHY_VM = 56,
7353 USB_EXTPHY_RCV = 57,
7354 USB_FS_IDDIG = 58,
7355 USB_FS_AVALID = 59,
7356 USB_FS_SRP_BVALID = 60,
7357 USB_FS_VBUSVALID = 61,
7358 USB_SRP_SESSEND = 62,
7359 SPI3_CLK = 66,
7360 SPI3_Q = 67,
7361 SPI3_D = 68,
7362 SPI3_HD = 69,
7363 SPI3_WP = 70,
7364 SPI3_CS0 = 71,
7365 RMT_SIG_0 = 81,
7366 RMT_SIG_1 = 82,
7367 RMT_SIG_2 = 83,
7368 RMT_SIG_3 = 84,
7369 I2CEXT0_SCL = 89,
7370 I2CEXT0_SDA = 90,
7371 I2CEXT1_SCL = 91,
7372 I2CEXT1_SDA = 92,
7373 FSPICLK = 101,
7374 FSPIQ = 102,
7375 FSPID = 103,
7376 FSPIHD = 104,
7377 FSPIWP = 105,
7378 FSPIIO4 = 106,
7379 FSPIIO5 = 107,
7380 FSPIIO6 = 108,
7381 FSPIIO7 = 109,
7382 FSPICS0 = 110,
7383 TWAI_RX = 116,
7384 SUBSPIQ = 120,
7385 SUBSPID = 121,
7386 SUBSPIHD = 122,
7387 SUBSPIWP = 123,
7388 CORE1_GPIO0 = 129,
7389 CORE1_GPIO1 = 130,
7390 CORE1_GPIO2 = 131,
7391 CAM_DATA_0 = 133,
7392 CAM_DATA_1 = 134,
7393 CAM_DATA_2 = 135,
7394 CAM_DATA_3 = 136,
7395 CAM_DATA_4 = 137,
7396 CAM_DATA_5 = 138,
7397 CAM_DATA_6 = 139,
7398 CAM_DATA_7 = 140,
7399 CAM_DATA_8 = 141,
7400 CAM_DATA_9 = 142,
7401 CAM_DATA_10 = 143,
7402 CAM_DATA_11 = 144,
7403 CAM_DATA_12 = 145,
7404 CAM_DATA_13 = 146,
7405 CAM_DATA_14 = 147,
7406 CAM_DATA_15 = 148,
7407 CAM_PCLK = 149,
7408 CAM_H_ENABLE = 150,
7409 CAM_H_SYNC = 151,
7410 CAM_V_SYNC = 152,
7411 SUBSPID4 = 155,
7412 SUBSPID5 = 156,
7413 SUBSPID6 = 157,
7414 SUBSPID7 = 158,
7415 SUBSPIDQS = 159,
7416 PWM0_SYNC0 = 160,
7417 PWM0_SYNC1 = 161,
7418 PWM0_SYNC2 = 162,
7419 PWM0_F0 = 163,
7420 PWM0_F1 = 164,
7421 PWM0_F2 = 165,
7422 PWM0_CAP0 = 166,
7423 PWM0_CAP1 = 167,
7424 PWM0_CAP2 = 168,
7425 PWM1_SYNC0 = 169,
7426 PWM1_SYNC1 = 170,
7427 PWM1_SYNC2 = 171,
7428 PWM1_F0 = 172,
7429 PWM1_F1 = 173,
7430 PWM1_F2 = 174,
7431 PWM1_CAP0 = 175,
7432 PWM1_CAP1 = 176,
7433 PWM1_CAP2 = 177,
7434 SDHOST_CCMD_IN_1 = 178,
7435 SDHOST_CCMD_IN_2 = 179,
7436 SDHOST_CDATA_IN_10 = 180,
7437 SDHOST_CDATA_IN_11 = 181,
7438 SDHOST_CDATA_IN_12 = 182,
7439 SDHOST_CDATA_IN_13 = 183,
7440 SDHOST_CDATA_IN_14 = 184,
7441 SDHOST_CDATA_IN_15 = 185,
7442 SDHOST_CDATA_IN_16 = 186,
7443 SDHOST_CDATA_IN_17 = 187,
7444 SDHOST_DATA_STROBE_1 = 192,
7445 SDHOST_DATA_STROBE_2 = 193,
7446 SDHOST_CARD_DETECT_N_1 = 194,
7447 SDHOST_CARD_DETECT_N_2 = 195,
7448 SDHOST_CARD_WRITE_PRT_1 = 196,
7449 SDHOST_CARD_WRITE_PRT_2 = 197,
7450 SDHOST_CARD_INT_N_1 = 198,
7451 SDHOST_CARD_INT_N_2 = 199,
7452 SDHOST_CDATA_IN_20 = 213,
7453 SDHOST_CDATA_IN_21 = 214,
7454 SDHOST_CDATA_IN_22 = 215,
7455 SDHOST_CDATA_IN_23 = 216,
7456 SDHOST_CDATA_IN_24 = 217,
7457 SDHOST_CDATA_IN_25 = 218,
7458 SDHOST_CDATA_IN_26 = 219,
7459 SDHOST_CDATA_IN_27 = 220,
7460 PRO_ALONEGPIO0 = 221,
7461 PRO_ALONEGPIO1 = 222,
7462 PRO_ALONEGPIO2 = 223,
7463 PRO_ALONEGPIO3 = 224,
7464 PRO_ALONEGPIO4 = 225,
7465 PRO_ALONEGPIO5 = 226,
7466 PRO_ALONEGPIO6 = 227,
7467 PRO_ALONEGPIO7 = 228,
7468 USB_JTAG_TDO_BRIDGE = 251,
7469 CORE1_GPIO3 = 252,
7470 CORE1_GPIO4 = 253,
7471 CORE1_GPIO5 = 254,
7472 CORE1_GPIO6 = 255,
7473 SPIIO4,
7474 SPIIO5,
7475 SPIIO6,
7476 SPIIO7,
7477 MTDI,
7478 MTCK,
7479 MTMS,
7480 }
7481 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
7482 #[derive(Debug, PartialEq, Copy, Clone)]
7483 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
7484 #[doc(hidden)]
7485 pub enum OutputSignal {
7486 SPIQ = 0,
7487 SPID = 1,
7488 SPIHD = 2,
7489 SPIWP = 3,
7490 SPICLK = 4,
7491 SPICS0 = 5,
7492 SPICS1 = 6,
7493 SPID4 = 7,
7494 SPID5 = 8,
7495 SPID6 = 9,
7496 SPID7 = 10,
7497 SPIDQS = 11,
7498 U0TXD = 12,
7499 U0RTS = 13,
7500 U0DTR = 14,
7501 U1TXD = 15,
7502 U1RTS = 16,
7503 U1DTR = 17,
7504 U2TXD = 18,
7505 U2RTS = 19,
7506 U2DTR = 20,
7507 I2S1_MCLK = 21,
7508 I2S0O_BCK = 22,
7509 I2S0_MCLK = 23,
7510 I2S0O_WS = 24,
7511 I2S0O_SD = 25,
7512 I2S0I_BCK = 26,
7513 I2S0I_WS = 27,
7514 I2S1O_BCK = 28,
7515 I2S1O_WS = 29,
7516 I2S1O_SD = 30,
7517 I2S1I_BCK = 31,
7518 I2S1I_WS = 32,
7519 CORE1_GPIO7 = 54,
7520 USB_EXTPHY_OEN = 55,
7521 USB_EXTPHY_VPO = 57,
7522 USB_EXTPHY_VMO = 58,
7523 SPI3_CLK = 66,
7524 SPI3_Q = 67,
7525 SPI3_D = 68,
7526 SPI3_HD = 69,
7527 SPI3_WP = 70,
7528 SPI3_CS0 = 71,
7529 SPI3_CS1 = 72,
7530 LEDC_LS_SIG0 = 73,
7531 LEDC_LS_SIG1 = 74,
7532 LEDC_LS_SIG2 = 75,
7533 LEDC_LS_SIG3 = 76,
7534 LEDC_LS_SIG4 = 77,
7535 LEDC_LS_SIG5 = 78,
7536 LEDC_LS_SIG6 = 79,
7537 LEDC_LS_SIG7 = 80,
7538 RMT_SIG_0 = 81,
7539 RMT_SIG_1 = 82,
7540 RMT_SIG_2 = 83,
7541 RMT_SIG_3 = 84,
7542 I2CEXT0_SCL = 89,
7543 I2CEXT0_SDA = 90,
7544 I2CEXT1_SCL = 91,
7545 I2CEXT1_SDA = 92,
7546 GPIO_SD0 = 93,
7547 GPIO_SD1 = 94,
7548 GPIO_SD2 = 95,
7549 GPIO_SD3 = 96,
7550 GPIO_SD4 = 97,
7551 GPIO_SD5 = 98,
7552 GPIO_SD6 = 99,
7553 GPIO_SD7 = 100,
7554 FSPICLK = 101,
7555 FSPIQ = 102,
7556 FSPID = 103,
7557 FSPIHD = 104,
7558 FSPIWP = 105,
7559 FSPIIO4 = 106,
7560 FSPIIO5 = 107,
7561 FSPIIO6 = 108,
7562 FSPIIO7 = 109,
7563 FSPICS0 = 110,
7564 FSPICS1 = 111,
7565 FSPICS2 = 112,
7566 FSPICS3 = 113,
7567 FSPICS4 = 114,
7568 FSPICS5 = 115,
7569 TWAI_TX = 116,
7570 SUBSPICLK = 119,
7571 SUBSPIQ = 120,
7572 SUBSPID = 121,
7573 SUBSPIHD = 122,
7574 SUBSPIWP = 123,
7575 SUBSPICS0 = 124,
7576 SUBSPICS1 = 125,
7577 FSPIDQS = 126,
7578 SPI3_CS2 = 127,
7579 I2S0O_SD1 = 128,
7580 CORE1_GPIO0 = 129,
7581 CORE1_GPIO1 = 130,
7582 CORE1_GPIO2 = 131,
7583 LCD_CS = 132,
7584 LCD_DATA_0 = 133,
7585 LCD_DATA_1 = 134,
7586 LCD_DATA_2 = 135,
7587 LCD_DATA_3 = 136,
7588 LCD_DATA_4 = 137,
7589 LCD_DATA_5 = 138,
7590 LCD_DATA_6 = 139,
7591 LCD_DATA_7 = 140,
7592 LCD_DATA_8 = 141,
7593 LCD_DATA_9 = 142,
7594 LCD_DATA_10 = 143,
7595 LCD_DATA_11 = 144,
7596 LCD_DATA_12 = 145,
7597 LCD_DATA_13 = 146,
7598 LCD_DATA_14 = 147,
7599 LCD_DATA_15 = 148,
7600 CAM_CLK = 149,
7601 LCD_H_ENABLE = 150,
7602 LCD_H_SYNC = 151,
7603 LCD_V_SYNC = 152,
7604 LCD_DC = 153,
7605 LCD_PCLK = 154,
7606 SUBSPID4 = 155,
7607 SUBSPID5 = 156,
7608 SUBSPID6 = 157,
7609 SUBSPID7 = 158,
7610 SUBSPIDQS = 159,
7611 PWM0_0A = 160,
7612 PWM0_0B = 161,
7613 PWM0_1A = 162,
7614 PWM0_1B = 163,
7615 PWM0_2A = 164,
7616 PWM0_2B = 165,
7617 PWM1_0A = 166,
7618 PWM1_0B = 167,
7619 PWM1_1A = 168,
7620 PWM1_1B = 169,
7621 PWM1_2A = 170,
7622 PWM1_2B = 171,
7623 SDHOST_CCLK_OUT_1 = 172,
7624 SDHOST_CCLK_OUT_2 = 173,
7625 SDHOST_RST_N_1 = 174,
7626 SDHOST_RST_N_2 = 175,
7627 SDHOST_CCMD_OD_PULLUP_EN_N = 176,
7628 SDIO_TOHOST_INT = 177,
7629 SDHOST_CCMD_OUT_1 = 178,
7630 SDHOST_CCMD_OUT_2 = 179,
7631 SDHOST_CDATA_OUT_10 = 180,
7632 SDHOST_CDATA_OUT_11 = 181,
7633 SDHOST_CDATA_OUT_12 = 182,
7634 SDHOST_CDATA_OUT_13 = 183,
7635 SDHOST_CDATA_OUT_14 = 184,
7636 SDHOST_CDATA_OUT_15 = 185,
7637 SDHOST_CDATA_OUT_16 = 186,
7638 SDHOST_CDATA_OUT_17 = 187,
7639 SDHOST_CDATA_OUT_20 = 213,
7640 SDHOST_CDATA_OUT_21 = 214,
7641 SDHOST_CDATA_OUT_22 = 215,
7642 SDHOST_CDATA_OUT_23 = 216,
7643 SDHOST_CDATA_OUT_24 = 217,
7644 SDHOST_CDATA_OUT_25 = 218,
7645 SDHOST_CDATA_OUT_26 = 219,
7646 SDHOST_CDATA_OUT_27 = 220,
7647 PRO_ALONEGPIO0 = 221,
7648 PRO_ALONEGPIO1 = 222,
7649 PRO_ALONEGPIO2 = 223,
7650 PRO_ALONEGPIO3 = 224,
7651 PRO_ALONEGPIO4 = 225,
7652 PRO_ALONEGPIO5 = 226,
7653 PRO_ALONEGPIO6 = 227,
7654 PRO_ALONEGPIO7 = 228,
7655 USB_JTAG_TRST = 251,
7656 CORE1_GPIO3 = 252,
7657 CORE1_GPIO4 = 253,
7658 CORE1_GPIO5 = 254,
7659 CORE1_GPIO6 = 255,
7660 GPIO = 256,
7661 SPIIO4,
7662 SPIIO5,
7663 SPIIO6,
7664 SPIIO7,
7665 CLK_OUT1,
7666 CLK_OUT2,
7667 CLK_OUT3,
7668 SPICLK_P_DIFF,
7669 SPICLK_N_DIFF,
7670 SUBSPICLK_P_DIFF,
7671 SUBSPICLK_N_DIFF,
7672 MTDO,
7673 }
7674 };
7675}
7676#[macro_export]
7683#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7684macro_rules! define_lp_functions {
7685 () => {
7686 #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
7691 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
7692 #[doc(hidden)]
7693 pub enum LpFunction {
7694 _0 = 0,
7696 _3 = 3,
7698 }
7699 impl LpFunction {
7700 pub const LP_GPIO: Self = Self::_0;
7702 }
7703 };
7704}
7705#[macro_export]
7718#[expect(clippy::crate_in_macro_def)]
7719#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7720macro_rules! define_io_mux_reg {
7721 () => {
7722 pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
7723 crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
7724 }
7725 };
7726}