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.default_clock_source") => {
245 2
246 };
247 ("i2s.default_clock_source", str) => {
248 stringify!(2)
249 };
250 ("i2s.mclk_divider_bit_width") => {
251 6
252 };
253 ("i2s.mclk_divider_bit_width", str) => {
254 stringify!(6)
255 };
256 ("i2s.max_ws_width") => {
257 128
258 };
259 ("i2s.max_ws_width", str) => {
260 stringify!(128)
261 };
262 ("i2s.clock_configured_by_pcr") => {
263 false
264 };
265 ("i2s.clock_configured_by_hp_sys_clkrst") => {
266 false
267 };
268 ("i2s.supports_pdm_rx_hp_filter") => {
269 false
270 };
271 ("i2s.supports_pdm_tx") => {
272 true
273 };
274 ("i2s.supports_pdm_rx") => {
275 true
276 };
277 ("i2s.supports_pcm2pdm") => {
278 true
279 };
280 ("i2s.supports_pdm2pcm") => {
281 true
282 };
283 ("rmt.ram_start") => {
284 1610704896
285 };
286 ("rmt.ram_start", str) => {
287 stringify!(1610704896)
288 };
289 ("rmt.channel_ram_size") => {
290 48
291 };
292 ("rmt.channel_ram_size", str) => {
293 stringify!(48)
294 };
295 ("rmt.has_tx_immediate_stop") => {
296 true
297 };
298 ("rmt.has_tx_loop_count") => {
299 true
300 };
301 ("rmt.has_tx_loop_auto_stop") => {
302 true
303 };
304 ("rmt.has_tx_carrier_data_only") => {
305 true
306 };
307 ("rmt.has_tx_sync") => {
308 true
309 };
310 ("rmt.has_rx_wrap") => {
311 true
312 };
313 ("rmt.has_rx_demodulation") => {
314 true
315 };
316 ("rmt.has_per_channel_clock") => {
317 false
318 };
319 ("sdmmc.delay_phase_num") => {
320 4
321 };
322 ("sdmmc.delay_phase_num", str) => {
323 stringify!(4)
324 };
325 ("sdmmc.has_iomux") => {
326 false
327 };
328 ("sdmmc.has_gpio_matrix") => {
329 true
330 };
331 ("sdmmc.psram_dma") => {
332 false
333 };
334 ("sdmmc.uhs") => {
335 false
336 };
337 ("usb_otg.fifo_depth_words") => {
338 256
339 };
340 ("usb_otg.fifo_depth_words", str) => {
341 stringify!(256)
342 };
343 ("bt.controller") => {
344 "btdm"
345 };
346 ("wifi.has_wifi6") => {
347 false
348 };
349 ("wifi.mac_version") => {
350 1
351 };
352 ("wifi.mac_version", str) => {
353 stringify!(1)
354 };
355 ("wifi.has_5g") => {
356 false
357 };
358 ("wifi.csi_supported") => {
359 true
360 };
361 ("phy.combo_module") => {
362 true
363 };
364 ("phy.backed_up_digital_register_count") => {
365 21
366 };
367 ("phy.backed_up_digital_register_count", str) => {
368 stringify!(21)
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 [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, 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, crate
577 ::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}
642#[macro_export]
643#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
644macro_rules! for_each_dedicated_gpio {
645 ($($pattern:tt => $code:tt;)*) => {
646 macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
647 tt) => {} } _for_each_inner_dedicated_gpio!((0));
648 _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
649 _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
650 _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
651 _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
652 PRO_ALONEGPIO0)); _for_each_inner_dedicated_gpio!((0, 1, PRO_ALONEGPIO1));
653 _for_each_inner_dedicated_gpio!((0, 2, PRO_ALONEGPIO2));
654 _for_each_inner_dedicated_gpio!((0, 3, PRO_ALONEGPIO3));
655 _for_each_inner_dedicated_gpio!((0, 4, PRO_ALONEGPIO4));
656 _for_each_inner_dedicated_gpio!((0, 5, PRO_ALONEGPIO5));
657 _for_each_inner_dedicated_gpio!((0, 6, PRO_ALONEGPIO6));
658 _for_each_inner_dedicated_gpio!((0, 7, PRO_ALONEGPIO7));
659 _for_each_inner_dedicated_gpio!((1, 0, CORE1_GPIO0));
660 _for_each_inner_dedicated_gpio!((1, 1, CORE1_GPIO1));
661 _for_each_inner_dedicated_gpio!((1, 2, CORE1_GPIO2));
662 _for_each_inner_dedicated_gpio!((1, 3, CORE1_GPIO3));
663 _for_each_inner_dedicated_gpio!((1, 4, CORE1_GPIO4));
664 _for_each_inner_dedicated_gpio!((1, 5, CORE1_GPIO5));
665 _for_each_inner_dedicated_gpio!((1, 6, CORE1_GPIO6));
666 _for_each_inner_dedicated_gpio!((1, 7, CORE1_GPIO7));
667 _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
668 (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, PRO_ALONEGPIO0), (0, 1,
669 PRO_ALONEGPIO1), (0, 2, PRO_ALONEGPIO2), (0, 3, PRO_ALONEGPIO3), (0, 4,
670 PRO_ALONEGPIO4), (0, 5, PRO_ALONEGPIO5), (0, 6, PRO_ALONEGPIO6), (0, 7,
671 PRO_ALONEGPIO7), (1, 0, CORE1_GPIO0), (1, 1, CORE1_GPIO1), (1, 2, CORE1_GPIO2),
672 (1, 3, CORE1_GPIO3), (1, 4, CORE1_GPIO4), (1, 5, CORE1_GPIO5), (1, 6,
673 CORE1_GPIO6), (1, 7, CORE1_GPIO7)));
674 };
675}
676#[macro_export]
680#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
681macro_rules! define_lp_io_signals {
682 () => {};
683}
684#[macro_export]
706#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
707macro_rules! for_each_rmt_channel {
708 ($($pattern:tt => $code:tt;)*) => {
709 macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
710 => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
711 _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
712 _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
713 _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
714 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
715 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
716 _for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
717 _for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
718 _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
719 _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
720 _for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
721 };
722}
723#[macro_export]
748#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
749macro_rules! for_each_sdmmc {
750 ($($pattern:tt => $code:tt;)*) => {
751 macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
752 } _for_each_inner_sdmmc!((slot0, 0, false, [SDHOST_CCLK_OUT_1],
753 [SDHOST_CCMD_IN_1], [SDHOST_CCMD_OUT_1], [SDHOST_CDATA_IN_10, SDHOST_CDATA_IN_11,
754 SDHOST_CDATA_IN_12, SDHOST_CDATA_IN_13, SDHOST_CDATA_IN_14, SDHOST_CDATA_IN_15,
755 SDHOST_CDATA_IN_16, SDHOST_CDATA_IN_17], [SDHOST_CDATA_OUT_10,
756 SDHOST_CDATA_OUT_11, SDHOST_CDATA_OUT_12, SDHOST_CDATA_OUT_13,
757 SDHOST_CDATA_OUT_14, SDHOST_CDATA_OUT_15, SDHOST_CDATA_OUT_16,
758 SDHOST_CDATA_OUT_17], [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1],
759 [SDHOST_CARD_INT_N_1], [SDHOST_DATA_STROBE_1], [SDHOST_RST_N_1]));
760 _for_each_inner_sdmmc!((slot1, 1, false, [SDHOST_CCLK_OUT_2], [SDHOST_CCMD_IN_2],
761 [SDHOST_CCMD_OUT_2], [SDHOST_CDATA_IN_20, SDHOST_CDATA_IN_21, SDHOST_CDATA_IN_22,
762 SDHOST_CDATA_IN_23, SDHOST_CDATA_IN_24, SDHOST_CDATA_IN_25, SDHOST_CDATA_IN_26,
763 SDHOST_CDATA_IN_27], [SDHOST_CDATA_OUT_20, SDHOST_CDATA_OUT_21,
764 SDHOST_CDATA_OUT_22, SDHOST_CDATA_OUT_23, SDHOST_CDATA_OUT_24,
765 SDHOST_CDATA_OUT_25, SDHOST_CDATA_OUT_26, SDHOST_CDATA_OUT_27],
766 [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2],
767 [SDHOST_DATA_STROBE_2], [SDHOST_RST_N_2])); _for_each_inner_sdmmc!((all(slot0, 0,
768 false, [SDHOST_CCLK_OUT_1], [SDHOST_CCMD_IN_1], [SDHOST_CCMD_OUT_1],
769 [SDHOST_CDATA_IN_10, SDHOST_CDATA_IN_11, SDHOST_CDATA_IN_12, SDHOST_CDATA_IN_13,
770 SDHOST_CDATA_IN_14, SDHOST_CDATA_IN_15, SDHOST_CDATA_IN_16, SDHOST_CDATA_IN_17],
771 [SDHOST_CDATA_OUT_10, SDHOST_CDATA_OUT_11, SDHOST_CDATA_OUT_12,
772 SDHOST_CDATA_OUT_13, SDHOST_CDATA_OUT_14, SDHOST_CDATA_OUT_15,
773 SDHOST_CDATA_OUT_16, SDHOST_CDATA_OUT_17], [SDHOST_CARD_DETECT_N_1],
774 [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1], [SDHOST_DATA_STROBE_1],
775 [SDHOST_RST_N_1]), (slot1, 1, false, [SDHOST_CCLK_OUT_2], [SDHOST_CCMD_IN_2],
776 [SDHOST_CCMD_OUT_2], [SDHOST_CDATA_IN_20, SDHOST_CDATA_IN_21, SDHOST_CDATA_IN_22,
777 SDHOST_CDATA_IN_23, SDHOST_CDATA_IN_24, SDHOST_CDATA_IN_25, SDHOST_CDATA_IN_26,
778 SDHOST_CDATA_IN_27], [SDHOST_CDATA_OUT_20, SDHOST_CDATA_OUT_21,
779 SDHOST_CDATA_OUT_22, SDHOST_CDATA_OUT_23, SDHOST_CDATA_OUT_24,
780 SDHOST_CDATA_OUT_25, SDHOST_CDATA_OUT_26, SDHOST_CDATA_OUT_27],
781 [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2],
782 [SDHOST_DATA_STROBE_2], [SDHOST_RST_N_2])));
783 };
784}
785#[macro_export]
786#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
787macro_rules! for_each_sdm_channel {
788 ($($pattern:tt => $code:tt;)*) => {
789 macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
790 => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
791 _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
792 _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
793 _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
794 _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
795 _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
796 _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
797 _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
798 _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
799 SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
800 GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
801 SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
802 };
803}
804#[macro_export]
805#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
806macro_rules! for_each_aes_key_length {
807 ($($pattern:tt => $code:tt;)*) => {
808 macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
809 tt) => {} } _for_each_inner_aes_key_length!((128));
810 _for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
811 4)); _for_each_inner_aes_key_length!((256, 2, 6));
812 _for_each_inner_aes_key_length!((bits(128), (256)));
813 _for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
814 };
815}
816#[macro_export]
817#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
818macro_rules! for_each_rsa_exponentiation {
819 ($($pattern:tt => $code:tt;)*) => {
820 macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
821 ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
822 _for_each_inner_rsa_exponentiation!((64));
823 _for_each_inner_rsa_exponentiation!((96));
824 _for_each_inner_rsa_exponentiation!((128));
825 _for_each_inner_rsa_exponentiation!((160));
826 _for_each_inner_rsa_exponentiation!((192));
827 _for_each_inner_rsa_exponentiation!((224));
828 _for_each_inner_rsa_exponentiation!((256));
829 _for_each_inner_rsa_exponentiation!((288));
830 _for_each_inner_rsa_exponentiation!((320));
831 _for_each_inner_rsa_exponentiation!((352));
832 _for_each_inner_rsa_exponentiation!((384));
833 _for_each_inner_rsa_exponentiation!((416));
834 _for_each_inner_rsa_exponentiation!((448));
835 _for_each_inner_rsa_exponentiation!((480));
836 _for_each_inner_rsa_exponentiation!((512));
837 _for_each_inner_rsa_exponentiation!((544));
838 _for_each_inner_rsa_exponentiation!((576));
839 _for_each_inner_rsa_exponentiation!((608));
840 _for_each_inner_rsa_exponentiation!((640));
841 _for_each_inner_rsa_exponentiation!((672));
842 _for_each_inner_rsa_exponentiation!((704));
843 _for_each_inner_rsa_exponentiation!((736));
844 _for_each_inner_rsa_exponentiation!((768));
845 _for_each_inner_rsa_exponentiation!((800));
846 _for_each_inner_rsa_exponentiation!((832));
847 _for_each_inner_rsa_exponentiation!((864));
848 _for_each_inner_rsa_exponentiation!((896));
849 _for_each_inner_rsa_exponentiation!((928));
850 _for_each_inner_rsa_exponentiation!((960));
851 _for_each_inner_rsa_exponentiation!((992));
852 _for_each_inner_rsa_exponentiation!((1024));
853 _for_each_inner_rsa_exponentiation!((1056));
854 _for_each_inner_rsa_exponentiation!((1088));
855 _for_each_inner_rsa_exponentiation!((1120));
856 _for_each_inner_rsa_exponentiation!((1152));
857 _for_each_inner_rsa_exponentiation!((1184));
858 _for_each_inner_rsa_exponentiation!((1216));
859 _for_each_inner_rsa_exponentiation!((1248));
860 _for_each_inner_rsa_exponentiation!((1280));
861 _for_each_inner_rsa_exponentiation!((1312));
862 _for_each_inner_rsa_exponentiation!((1344));
863 _for_each_inner_rsa_exponentiation!((1376));
864 _for_each_inner_rsa_exponentiation!((1408));
865 _for_each_inner_rsa_exponentiation!((1440));
866 _for_each_inner_rsa_exponentiation!((1472));
867 _for_each_inner_rsa_exponentiation!((1504));
868 _for_each_inner_rsa_exponentiation!((1536));
869 _for_each_inner_rsa_exponentiation!((1568));
870 _for_each_inner_rsa_exponentiation!((1600));
871 _for_each_inner_rsa_exponentiation!((1632));
872 _for_each_inner_rsa_exponentiation!((1664));
873 _for_each_inner_rsa_exponentiation!((1696));
874 _for_each_inner_rsa_exponentiation!((1728));
875 _for_each_inner_rsa_exponentiation!((1760));
876 _for_each_inner_rsa_exponentiation!((1792));
877 _for_each_inner_rsa_exponentiation!((1824));
878 _for_each_inner_rsa_exponentiation!((1856));
879 _for_each_inner_rsa_exponentiation!((1888));
880 _for_each_inner_rsa_exponentiation!((1920));
881 _for_each_inner_rsa_exponentiation!((1952));
882 _for_each_inner_rsa_exponentiation!((1984));
883 _for_each_inner_rsa_exponentiation!((2016));
884 _for_each_inner_rsa_exponentiation!((2048));
885 _for_each_inner_rsa_exponentiation!((2080));
886 _for_each_inner_rsa_exponentiation!((2112));
887 _for_each_inner_rsa_exponentiation!((2144));
888 _for_each_inner_rsa_exponentiation!((2176));
889 _for_each_inner_rsa_exponentiation!((2208));
890 _for_each_inner_rsa_exponentiation!((2240));
891 _for_each_inner_rsa_exponentiation!((2272));
892 _for_each_inner_rsa_exponentiation!((2304));
893 _for_each_inner_rsa_exponentiation!((2336));
894 _for_each_inner_rsa_exponentiation!((2368));
895 _for_each_inner_rsa_exponentiation!((2400));
896 _for_each_inner_rsa_exponentiation!((2432));
897 _for_each_inner_rsa_exponentiation!((2464));
898 _for_each_inner_rsa_exponentiation!((2496));
899 _for_each_inner_rsa_exponentiation!((2528));
900 _for_each_inner_rsa_exponentiation!((2560));
901 _for_each_inner_rsa_exponentiation!((2592));
902 _for_each_inner_rsa_exponentiation!((2624));
903 _for_each_inner_rsa_exponentiation!((2656));
904 _for_each_inner_rsa_exponentiation!((2688));
905 _for_each_inner_rsa_exponentiation!((2720));
906 _for_each_inner_rsa_exponentiation!((2752));
907 _for_each_inner_rsa_exponentiation!((2784));
908 _for_each_inner_rsa_exponentiation!((2816));
909 _for_each_inner_rsa_exponentiation!((2848));
910 _for_each_inner_rsa_exponentiation!((2880));
911 _for_each_inner_rsa_exponentiation!((2912));
912 _for_each_inner_rsa_exponentiation!((2944));
913 _for_each_inner_rsa_exponentiation!((2976));
914 _for_each_inner_rsa_exponentiation!((3008));
915 _for_each_inner_rsa_exponentiation!((3040));
916 _for_each_inner_rsa_exponentiation!((3072));
917 _for_each_inner_rsa_exponentiation!((3104));
918 _for_each_inner_rsa_exponentiation!((3136));
919 _for_each_inner_rsa_exponentiation!((3168));
920 _for_each_inner_rsa_exponentiation!((3200));
921 _for_each_inner_rsa_exponentiation!((3232));
922 _for_each_inner_rsa_exponentiation!((3264));
923 _for_each_inner_rsa_exponentiation!((3296));
924 _for_each_inner_rsa_exponentiation!((3328));
925 _for_each_inner_rsa_exponentiation!((3360));
926 _for_each_inner_rsa_exponentiation!((3392));
927 _for_each_inner_rsa_exponentiation!((3424));
928 _for_each_inner_rsa_exponentiation!((3456));
929 _for_each_inner_rsa_exponentiation!((3488));
930 _for_each_inner_rsa_exponentiation!((3520));
931 _for_each_inner_rsa_exponentiation!((3552));
932 _for_each_inner_rsa_exponentiation!((3584));
933 _for_each_inner_rsa_exponentiation!((3616));
934 _for_each_inner_rsa_exponentiation!((3648));
935 _for_each_inner_rsa_exponentiation!((3680));
936 _for_each_inner_rsa_exponentiation!((3712));
937 _for_each_inner_rsa_exponentiation!((3744));
938 _for_each_inner_rsa_exponentiation!((3776));
939 _for_each_inner_rsa_exponentiation!((3808));
940 _for_each_inner_rsa_exponentiation!((3840));
941 _for_each_inner_rsa_exponentiation!((3872));
942 _for_each_inner_rsa_exponentiation!((3904));
943 _for_each_inner_rsa_exponentiation!((3936));
944 _for_each_inner_rsa_exponentiation!((3968));
945 _for_each_inner_rsa_exponentiation!((4000));
946 _for_each_inner_rsa_exponentiation!((4032));
947 _for_each_inner_rsa_exponentiation!((4064));
948 _for_each_inner_rsa_exponentiation!((4096));
949 _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
950 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
951 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
952 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
953 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
954 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
955 (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
956 (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
957 (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
958 (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
959 (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
960 (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
961 (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
962 };
963}
964#[macro_export]
965#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
966macro_rules! for_each_rsa_multiplication {
967 ($($pattern:tt => $code:tt;)*) => {
968 macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
969 ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
970 _for_each_inner_rsa_multiplication!((64));
971 _for_each_inner_rsa_multiplication!((96));
972 _for_each_inner_rsa_multiplication!((128));
973 _for_each_inner_rsa_multiplication!((160));
974 _for_each_inner_rsa_multiplication!((192));
975 _for_each_inner_rsa_multiplication!((224));
976 _for_each_inner_rsa_multiplication!((256));
977 _for_each_inner_rsa_multiplication!((288));
978 _for_each_inner_rsa_multiplication!((320));
979 _for_each_inner_rsa_multiplication!((352));
980 _for_each_inner_rsa_multiplication!((384));
981 _for_each_inner_rsa_multiplication!((416));
982 _for_each_inner_rsa_multiplication!((448));
983 _for_each_inner_rsa_multiplication!((480));
984 _for_each_inner_rsa_multiplication!((512));
985 _for_each_inner_rsa_multiplication!((544));
986 _for_each_inner_rsa_multiplication!((576));
987 _for_each_inner_rsa_multiplication!((608));
988 _for_each_inner_rsa_multiplication!((640));
989 _for_each_inner_rsa_multiplication!((672));
990 _for_each_inner_rsa_multiplication!((704));
991 _for_each_inner_rsa_multiplication!((736));
992 _for_each_inner_rsa_multiplication!((768));
993 _for_each_inner_rsa_multiplication!((800));
994 _for_each_inner_rsa_multiplication!((832));
995 _for_each_inner_rsa_multiplication!((864));
996 _for_each_inner_rsa_multiplication!((896));
997 _for_each_inner_rsa_multiplication!((928));
998 _for_each_inner_rsa_multiplication!((960));
999 _for_each_inner_rsa_multiplication!((992));
1000 _for_each_inner_rsa_multiplication!((1024));
1001 _for_each_inner_rsa_multiplication!((1056));
1002 _for_each_inner_rsa_multiplication!((1088));
1003 _for_each_inner_rsa_multiplication!((1120));
1004 _for_each_inner_rsa_multiplication!((1152));
1005 _for_each_inner_rsa_multiplication!((1184));
1006 _for_each_inner_rsa_multiplication!((1216));
1007 _for_each_inner_rsa_multiplication!((1248));
1008 _for_each_inner_rsa_multiplication!((1280));
1009 _for_each_inner_rsa_multiplication!((1312));
1010 _for_each_inner_rsa_multiplication!((1344));
1011 _for_each_inner_rsa_multiplication!((1376));
1012 _for_each_inner_rsa_multiplication!((1408));
1013 _for_each_inner_rsa_multiplication!((1440));
1014 _for_each_inner_rsa_multiplication!((1472));
1015 _for_each_inner_rsa_multiplication!((1504));
1016 _for_each_inner_rsa_multiplication!((1536));
1017 _for_each_inner_rsa_multiplication!((1568));
1018 _for_each_inner_rsa_multiplication!((1600));
1019 _for_each_inner_rsa_multiplication!((1632));
1020 _for_each_inner_rsa_multiplication!((1664));
1021 _for_each_inner_rsa_multiplication!((1696));
1022 _for_each_inner_rsa_multiplication!((1728));
1023 _for_each_inner_rsa_multiplication!((1760));
1024 _for_each_inner_rsa_multiplication!((1792));
1025 _for_each_inner_rsa_multiplication!((1824));
1026 _for_each_inner_rsa_multiplication!((1856));
1027 _for_each_inner_rsa_multiplication!((1888));
1028 _for_each_inner_rsa_multiplication!((1920));
1029 _for_each_inner_rsa_multiplication!((1952));
1030 _for_each_inner_rsa_multiplication!((1984));
1031 _for_each_inner_rsa_multiplication!((2016));
1032 _for_each_inner_rsa_multiplication!((2048));
1033 _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
1034 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
1035 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
1036 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
1037 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
1038 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
1039 (1888), (1920), (1952), (1984), (2016), (2048)));
1040 };
1041}
1042#[macro_export]
1043#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1044macro_rules! for_each_sha_algorithm {
1045 ($($pattern:tt => $code:tt;)*) => {
1046 macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
1047 tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
1048 (insecure_against : "collision", "length extension"), 0));
1049 _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
1050 (insecure_against : "length extension"), 1));
1051 _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
1052 (insecure_against : "length extension"), 2));
1053 _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
1054 (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
1055 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
1056 _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
1057 (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
1058 "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
1059 _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
1060 (insecure_against : "collision", "length extension"), 0), (Sha224,
1061 "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
1062 (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
1063 2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
1064 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
1065 (Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
1066 (Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
1067 };
1068}
1069#[macro_export]
1070#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1071macro_rules! for_each_wakeup_source {
1072 ($($pattern:tt => $code:tt;)*) => {
1073 macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
1074 tt) => {} } _for_each_inner_wakeup_source!((Ext0, 0));
1075 _for_each_inner_wakeup_source!((Ext1, 1)); _for_each_inner_wakeup_source!((Gpio,
1076 2)); _for_each_inner_wakeup_source!((Timer, 3));
1077 _for_each_inner_wakeup_source!((Sdio, 4)); _for_each_inner_wakeup_source!((Wifi,
1078 5)); _for_each_inner_wakeup_source!((Uart0, 6));
1079 _for_each_inner_wakeup_source!((Uart1, 7));
1080 _for_each_inner_wakeup_source!((Touch, 8)); _for_each_inner_wakeup_source!((Bt,
1081 10)); _for_each_inner_wakeup_source!((UlpRiscv, 11));
1082 _for_each_inner_wakeup_source!((UlpRiscvTrap, 13));
1083 _for_each_inner_wakeup_source!((all(Ext0, 0), (Ext1, 1), (Gpio, 2), (Timer, 3),
1084 (Sdio, 4), (Wifi, 5), (Uart0, 6), (Uart1, 7), (Touch, 8), (Bt, 10), (UlpRiscv,
1085 11), (UlpRiscvTrap, 13)));
1086 };
1087}
1088#[macro_export]
1089#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1090macro_rules! for_each_dma_engine {
1091 ($($pattern:tt => $code:tt;)*) => {
1092 macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
1093 => {} } _for_each_inner_dma_engine!(("AHB_GDMA"));
1094 _for_each_inner_dma_engine!((all("AHB_GDMA")));
1095 };
1096}
1097#[macro_export]
1098#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1099macro_rules! for_each_dma_channel {
1100 ($($pattern:tt => $code:tt;)*) => {
1101 macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
1102 => {} } _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0));
1103 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1));
1104 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2));
1105 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3));
1106 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4));
1107 _for_each_inner_dma_channel!(("AHB_GDMA", any_channel = AhbGdmaChannel));
1108 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0, 0, interrupt_in = DMA_IN_CH0,
1109 interrupt_out = DMA_OUT_CH0, compatible = [SPI2, SPI3, UHCI0, I2S0, I2S1,
1110 LCD_CAM, AES, SHA, APB_SARADC, RMT])); _for_each_inner_dma_channel!(("AHB_GDMA",
1111 DMA_CH1, 1, interrupt_in = DMA_IN_CH1, interrupt_out = DMA_OUT_CH1, compatible =
1112 [SPI2, SPI3, UHCI0, I2S0, I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]));
1113 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2, 2, interrupt_in = DMA_IN_CH2,
1114 interrupt_out = DMA_OUT_CH2, compatible = [SPI2, SPI3, UHCI0, I2S0, I2S1,
1115 LCD_CAM, AES, SHA, APB_SARADC, RMT])); _for_each_inner_dma_channel!(("AHB_GDMA",
1116 DMA_CH3, 3, interrupt_in = DMA_IN_CH3, interrupt_out = DMA_OUT_CH3, compatible =
1117 [SPI2, SPI3, UHCI0, I2S0, I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]));
1118 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4, 4, interrupt_in = DMA_IN_CH4,
1119 interrupt_out = DMA_OUT_CH4, compatible = [SPI2, SPI3, UHCI0, I2S0, I2S1,
1120 LCD_CAM, AES, SHA, APB_SARADC, RMT]));
1121 _for_each_inner_dma_channel!((names("AHB_GDMA", DMA_CH0), ("AHB_GDMA", DMA_CH1),
1122 ("AHB_GDMA", DMA_CH2), ("AHB_GDMA", DMA_CH3), ("AHB_GDMA", DMA_CH4)));
1123 _for_each_inner_dma_channel!((separate_any_type("AHB_GDMA", any_channel =
1124 AhbGdmaChannel))); _for_each_inner_dma_channel!((shared));
1125 _for_each_inner_dma_channel!((split("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1126 DMA_IN_CH0, interrupt_out = DMA_OUT_CH0, compatible = [SPI2, SPI3, UHCI0, I2S0,
1127 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH1, 1, interrupt_in
1128 = DMA_IN_CH1, interrupt_out = DMA_OUT_CH1, compatible = [SPI2, SPI3, UHCI0, I2S0,
1129 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH2, 2, interrupt_in
1130 = DMA_IN_CH2, interrupt_out = DMA_OUT_CH2, compatible = [SPI2, SPI3, UHCI0, I2S0,
1131 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH3, 3, interrupt_in
1132 = DMA_IN_CH3, interrupt_out = DMA_OUT_CH3, compatible = [SPI2, SPI3, UHCI0, I2S0,
1133 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT]), ("AHB_GDMA", DMA_CH4, 4, interrupt_in
1134 = DMA_IN_CH4, interrupt_out = DMA_OUT_CH4, compatible = [SPI2, SPI3, UHCI0, I2S0,
1135 I2S1, LCD_CAM, AES, SHA, APB_SARADC, RMT])));
1136 _for_each_inner_dma_channel!((no_own_interrupt));
1137 };
1138}
1139#[macro_export]
1140#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1141macro_rules! for_each_dma_channel_peri_pair {
1142 ($($pattern:tt => $code:tt;)*) => {
1143 macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1144 ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1145 DMA_CH0, SPI2)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0,
1146 SPI3)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, UHCI0));
1147 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S0));
1148 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S1));
1149 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, LCD_CAM));
1150 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, AES));
1151 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, SHA));
1152 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, APB_SARADC));
1153 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, RMT));
1154 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SPI2));
1155 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SPI3));
1156 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, UHCI0));
1157 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S0));
1158 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S1));
1159 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, LCD_CAM));
1160 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, AES));
1161 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SHA));
1162 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, APB_SARADC));
1163 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, RMT));
1164 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SPI2));
1165 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SPI3));
1166 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, UHCI0));
1167 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S0));
1168 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S1));
1169 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, LCD_CAM));
1170 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, AES));
1171 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SHA));
1172 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, APB_SARADC));
1173 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, RMT));
1174 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, SPI2));
1175 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, SPI3));
1176 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, UHCI0));
1177 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S0));
1178 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, I2S1));
1179 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, LCD_CAM));
1180 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, AES));
1181 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, SHA));
1182 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, APB_SARADC));
1183 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, RMT));
1184 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, SPI2));
1185 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, SPI3));
1186 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, UHCI0));
1187 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S0));
1188 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, I2S1));
1189 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, LCD_CAM));
1190 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, AES));
1191 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, SHA));
1192 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, APB_SARADC));
1193 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, RMT));
1194 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1195 SPI2)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1196 AhbGdmaChannel, SPI3)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1197 any_channel = AhbGdmaChannel, UHCI0));
1198 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1199 I2S0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1200 AhbGdmaChannel, I2S1)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1201 any_channel = AhbGdmaChannel, LCD_CAM));
1202 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1203 AES)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
1204 AhbGdmaChannel, SHA)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1205 any_channel = AhbGdmaChannel, APB_SARADC));
1206 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1207 RMT)); _for_each_inner_dma_channel_peri_pair!((channels("AHB_GDMA", DMA_CH0,
1208 SPI2), ("AHB_GDMA", DMA_CH0, SPI3), ("AHB_GDMA", DMA_CH0, UHCI0), ("AHB_GDMA",
1209 DMA_CH0, I2S0), ("AHB_GDMA", DMA_CH0, I2S1), ("AHB_GDMA", DMA_CH0, LCD_CAM),
1210 ("AHB_GDMA", DMA_CH0, AES), ("AHB_GDMA", DMA_CH0, SHA), ("AHB_GDMA", DMA_CH0,
1211 APB_SARADC), ("AHB_GDMA", DMA_CH0, RMT), ("AHB_GDMA", DMA_CH1, SPI2),
1212 ("AHB_GDMA", DMA_CH1, SPI3), ("AHB_GDMA", DMA_CH1, UHCI0), ("AHB_GDMA", DMA_CH1,
1213 I2S0), ("AHB_GDMA", DMA_CH1, I2S1), ("AHB_GDMA", DMA_CH1, LCD_CAM), ("AHB_GDMA",
1214 DMA_CH1, AES), ("AHB_GDMA", DMA_CH1, SHA), ("AHB_GDMA", DMA_CH1, APB_SARADC),
1215 ("AHB_GDMA", DMA_CH1, RMT), ("AHB_GDMA", DMA_CH2, SPI2), ("AHB_GDMA", DMA_CH2,
1216 SPI3), ("AHB_GDMA", DMA_CH2, UHCI0), ("AHB_GDMA", DMA_CH2, I2S0), ("AHB_GDMA",
1217 DMA_CH2, I2S1), ("AHB_GDMA", DMA_CH2, LCD_CAM), ("AHB_GDMA", DMA_CH2, AES),
1218 ("AHB_GDMA", DMA_CH2, SHA), ("AHB_GDMA", DMA_CH2, APB_SARADC), ("AHB_GDMA",
1219 DMA_CH2, RMT), ("AHB_GDMA", DMA_CH3, SPI2), ("AHB_GDMA", DMA_CH3, SPI3),
1220 ("AHB_GDMA", DMA_CH3, UHCI0), ("AHB_GDMA", DMA_CH3, I2S0), ("AHB_GDMA", DMA_CH3,
1221 I2S1), ("AHB_GDMA", DMA_CH3, LCD_CAM), ("AHB_GDMA", DMA_CH3, AES), ("AHB_GDMA",
1222 DMA_CH3, SHA), ("AHB_GDMA", DMA_CH3, APB_SARADC), ("AHB_GDMA", DMA_CH3, RMT),
1223 ("AHB_GDMA", DMA_CH4, SPI2), ("AHB_GDMA", DMA_CH4, SPI3), ("AHB_GDMA", DMA_CH4,
1224 UHCI0), ("AHB_GDMA", DMA_CH4, I2S0), ("AHB_GDMA", DMA_CH4, I2S1), ("AHB_GDMA",
1225 DMA_CH4, LCD_CAM), ("AHB_GDMA", DMA_CH4, AES), ("AHB_GDMA", DMA_CH4, SHA),
1226 ("AHB_GDMA", DMA_CH4, APB_SARADC), ("AHB_GDMA", DMA_CH4, RMT)));
1227 _for_each_inner_dma_channel_peri_pair!((any_channels("AHB_GDMA", any_channel =
1228 AhbGdmaChannel, SPI2), ("AHB_GDMA", any_channel = AhbGdmaChannel, SPI3),
1229 ("AHB_GDMA", any_channel = AhbGdmaChannel, UHCI0), ("AHB_GDMA", any_channel =
1230 AhbGdmaChannel, I2S0), ("AHB_GDMA", any_channel = AhbGdmaChannel, I2S1),
1231 ("AHB_GDMA", any_channel = AhbGdmaChannel, LCD_CAM), ("AHB_GDMA", any_channel =
1232 AhbGdmaChannel, AES), ("AHB_GDMA", any_channel = AhbGdmaChannel, SHA),
1233 ("AHB_GDMA", any_channel = AhbGdmaChannel, APB_SARADC), ("AHB_GDMA", any_channel
1234 = AhbGdmaChannel, RMT)));
1235 };
1236}
1237#[macro_export]
1238#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1239macro_rules! for_each_mem2mem_channel {
1240 ($($pattern:tt => $code:tt;)*) => {
1241 macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
1242 tt) => {} } _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1243 AhbGdmaChannel, DMA_CH0, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1244 AhbGdma, AhbGdmaChannel, DMA_CH1, 0));
1245 _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH2,
1246 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1247 DMA_CH3, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1248 AhbGdmaChannel, DMA_CH4, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1249 AhbGdma, AhbGdmaChannel, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0));
1250 _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel));
1251 _for_each_inner_mem2mem_channel!((channels("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1252 DMA_CH0, 0), ("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH1, 0), ("AHB_GDMA",
1253 AhbGdma, AhbGdmaChannel, DMA_CH2, 0), ("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1254 DMA_CH3, 0), ("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH4, 0)));
1255 _for_each_inner_mem2mem_channel!((erased("AHB_GDMA", AhbGdma, AhbGdmaChannel, 0,
1256 0, 1, 0, 2, 0, 3, 0, 4, 0)));
1257 _for_each_inner_mem2mem_channel!((engines("AHB_GDMA", AhbGdma, AhbGdmaChannel)));
1258 };
1259}
1260#[macro_export]
1261#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1262macro_rules! with_aes_dma_engine {
1263 ($($pattern:tt => $code:tt;)*) => {
1264 macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
1265 => {} } _with_inner_aes_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1266 };
1267}
1268#[macro_export]
1269#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1270macro_rules! with_i2s_dma_engine {
1271 ($($pattern:tt => $code:tt;)*) => {
1272 macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
1273 => {} } _with_inner_i2s_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1274 };
1275}
1276#[macro_export]
1277#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1278macro_rules! with_lcd_cam_dma_engine {
1279 ($($pattern:tt => $code:tt;)*) => {
1280 macro_rules! _with_inner_lcd_cam_dma_engine { $(($pattern) => $code;)* ($other :
1281 tt) => {} } _with_inner_lcd_cam_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1282 };
1283}
1284#[macro_export]
1285#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1286macro_rules! with_rmt_dma_engine {
1287 ($($pattern:tt => $code:tt;)*) => {
1288 macro_rules! _with_inner_rmt_dma_engine { $(($pattern) => $code;)* ($other : tt)
1289 => {} } _with_inner_rmt_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1290 };
1291}
1292#[macro_export]
1293#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1294macro_rules! with_sha_dma_engine {
1295 ($($pattern:tt => $code:tt;)*) => {
1296 macro_rules! _with_inner_sha_dma_engine { $(($pattern) => $code;)* ($other : tt)
1297 => {} } _with_inner_sha_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1298 };
1299}
1300#[macro_export]
1301#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1302macro_rules! with_spi_master_dma_engine {
1303 ($($pattern:tt => $code:tt;)*) => {
1304 macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1305 : tt) => {} } _with_inner_spi_master_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1306 };
1307}
1308#[macro_export]
1309#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1310macro_rules! with_spi_slave_dma_engine {
1311 ($($pattern:tt => $code:tt;)*) => {
1312 macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1313 : tt) => {} } _with_inner_spi_slave_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1314 };
1315}
1316#[macro_export]
1317#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1318macro_rules! with_uhci_dma_engine {
1319 ($($pattern:tt => $code:tt;)*) => {
1320 macro_rules! _with_inner_uhci_dma_engine { $(($pattern) => $code;)* ($other : tt)
1321 => {} } _with_inner_uhci_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1322 };
1323}
1324#[macro_export]
1325#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1326macro_rules! for_each_sw_interrupt {
1327 ($($pattern:tt => $code:tt;)*) => {
1328 macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1329 tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1330 software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1331 software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1332 software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1333 software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1334 software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1335 FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1336 };
1337}
1338#[macro_export]
1339macro_rules! define_clock_tree_types {
1717 () => {
1718 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1719 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1720 pub enum SdmInstance {
1721 GpioSd = 0,
1722 }
1723 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1724 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1725 pub enum I2cInstance {
1726 I2c0 = 0,
1727 I2c1 = 1,
1728 }
1729 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1730 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1731 pub enum LcdCamInstance {
1732 LcdCam = 0,
1733 }
1734 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1735 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1736 pub enum McpwmInstance {
1737 Mcpwm0 = 0,
1738 Mcpwm1 = 1,
1739 }
1740 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1741 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1742 pub enum RmtInstance {
1743 Rmt = 0,
1744 }
1745 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1746 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1747 pub enum SpiInstance {
1748 Spi2 = 0,
1749 Spi3 = 1,
1750 }
1751 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1752 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1753 pub enum TimgInstance {
1754 Timg0 = 0,
1755 Timg1 = 1,
1756 }
1757 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1758 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1759 pub enum UartInstance {
1760 Uart0 = 0,
1761 Uart1 = 1,
1762 Uart2 = 2,
1763 }
1764 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1766 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1767 pub enum XtalClkConfig {
1768 _40,
1770 }
1771 impl XtalClkConfig {
1772 pub fn value(&self) -> u32 {
1773 match self {
1774 XtalClkConfig::_40 => 40000000,
1775 }
1776 }
1777 }
1778 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1780 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1781 pub enum PllClkConfig {
1782 _320,
1784 _480,
1786 }
1787 impl PllClkConfig {
1788 pub fn value(&self) -> u32 {
1789 match self {
1790 PllClkConfig::_320 => 320000000,
1791 PllClkConfig::_480 => 480000000,
1792 }
1793 }
1794 }
1795 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1797 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1798 pub enum SystemPreDivInConfig {
1799 Xtal,
1801 RcFast,
1803 }
1804 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1808 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1809 pub struct SystemPreDivConfig {
1810 divisor: u32,
1811 }
1812 impl SystemPreDivConfig {
1813 pub const fn new(divisor: u32) -> Self {
1820 ::core::assert!(
1821 divisor <= 1023,
1822 "`SYSTEM_PRE_DIV` divisor must be between 0 and 1023 (inclusive)."
1823 );
1824 Self { divisor }
1825 }
1826 pub(crate) fn divisor(self) -> u32 {
1827 self.divisor as u32
1828 }
1829 }
1830 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1832 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1833 pub enum CpuPllDivOutConfig {
1834 _80,
1836 _160,
1838 _240,
1840 }
1841 impl CpuPllDivOutConfig {
1842 pub fn value(&self) -> u32 {
1843 match self {
1844 CpuPllDivOutConfig::_80 => 80000000,
1845 CpuPllDivOutConfig::_160 => 160000000,
1846 CpuPllDivOutConfig::_240 => 240000000,
1847 }
1848 }
1849 }
1850 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1852 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1853 pub enum ApbClkConfig {
1854 Pll,
1856 Cpu,
1858 }
1859 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1861 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1862 pub enum CryptoPwmClkConfig {
1863 Pll,
1865 Cpu,
1867 }
1868 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1870 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1871 pub enum CpuClkConfig {
1872 Xtal,
1874 RcFast,
1876 Pll,
1878 }
1879 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1883 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1884 pub struct RcFastClkDivNConfig {
1885 divisor: u32,
1886 }
1887 impl RcFastClkDivNConfig {
1888 pub const fn new(divisor: u32) -> Self {
1895 ::core::assert!(
1896 divisor <= 3,
1897 "`RC_FAST_CLK_DIV_N` divisor must be between 0 and 3 (inclusive)."
1898 );
1899 Self { divisor }
1900 }
1901 pub(crate) fn divisor(self) -> u32 {
1902 self.divisor as u32
1903 }
1904 }
1905 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1907 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1908 pub enum RtcSlowClkConfig {
1909 Xtal32k,
1911 RcSlow,
1913 RcFast,
1915 }
1916 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1918 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1919 pub enum RtcFastClkConfig {
1920 Xtal,
1922 Rc,
1924 }
1925 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1927 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1928 pub enum LowPowerClkConfig {
1929 Xtal,
1931 RcFast,
1933 Xtal32k,
1935 RtcSlow,
1937 }
1938 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1940 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1941 pub enum UartMemClkConfig {
1942 #[default]
1943 Xtal,
1945 }
1946 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1948 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1949 pub enum TimgCalibrationClockConfig {
1950 RcSlowClk,
1952 RcFastDivClk,
1954 Xtal32kClk,
1956 }
1957 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1958 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1959 pub enum I2cFunctionClockSclk {
1960 #[default]
1961 Xtal,
1963 RcFast,
1965 }
1966 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1970 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1971 pub struct I2cFunctionClockConfig {
1972 sclk: I2cFunctionClockSclk,
1973 div_num: u32,
1974 }
1975 impl I2cFunctionClockConfig {
1976 pub const fn new(sclk: I2cFunctionClockSclk, div_num: u32) -> Self {
1983 ::core::assert!(
1984 div_num <= 255,
1985 "`I2C0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
1986 );
1987 Self { sclk, div_num }
1988 }
1989 pub(crate) fn sclk(self) -> I2cFunctionClockSclk {
1990 self.sclk
1991 }
1992 pub(crate) fn div_num(self) -> u32 {
1993 self.div_num as u32
1994 }
1995 }
1996 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1997 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1998 pub enum LcdCamLcdClockSclk {
1999 #[default]
2000 XtalClk,
2002 PllD2,
2004 Pll160m,
2006 }
2007 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2011 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2012 pub struct LcdCamLcdClockConfig {
2013 sclk: LcdCamLcdClockSclk,
2014 div_num: u32,
2015 div_a: u32,
2016 div_b: u32,
2017 }
2018 impl LcdCamLcdClockConfig {
2019 pub const fn new(
2032 sclk: LcdCamLcdClockSclk,
2033 div_num: u32,
2034 div_a: u32,
2035 div_b: u32,
2036 ) -> Self {
2037 ::core::assert!(
2038 div_num >= 2 && div_num <= 256,
2039 "`LCD_CAM_LCD_CLOCK` div_num must be between 2 and 256 (inclusive)."
2040 );
2041 ::core::assert!(
2042 div_a >= 1 && div_a <= 63,
2043 "`LCD_CAM_LCD_CLOCK` div_a must be between 1 and 63 (inclusive)."
2044 );
2045 ::core::assert!(
2046 div_b <= 63,
2047 "`LCD_CAM_LCD_CLOCK` div_b must be between 0 and 63 (inclusive)."
2048 );
2049 Self {
2050 sclk,
2051 div_num,
2052 div_a,
2053 div_b,
2054 }
2055 }
2056 pub(crate) fn sclk(self) -> LcdCamLcdClockSclk {
2057 self.sclk
2058 }
2059 pub(crate) fn div_num(self) -> u32 {
2060 self.div_num as u32
2061 }
2062 pub(crate) fn div_a(self) -> u32 {
2063 self.div_a as u32
2064 }
2065 pub(crate) fn div_b(self) -> u32 {
2066 self.div_b as u32
2067 }
2068 }
2069 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2070 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2071 pub enum LcdCamCamClockSclk {
2072 #[default]
2073 XtalClk,
2075 PllD2,
2077 Pll160m,
2079 }
2080 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2084 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2085 pub struct LcdCamCamClockConfig {
2086 sclk: LcdCamCamClockSclk,
2087 div_num: u32,
2088 div_a: u32,
2089 div_b: u32,
2090 }
2091 impl LcdCamCamClockConfig {
2092 pub const fn new(
2105 sclk: LcdCamCamClockSclk,
2106 div_num: u32,
2107 div_a: u32,
2108 div_b: u32,
2109 ) -> Self {
2110 ::core::assert!(
2111 div_num >= 2 && div_num <= 256,
2112 "`LCD_CAM_CAM_CLOCK` div_num must be between 2 and 256 (inclusive)."
2113 );
2114 ::core::assert!(
2115 div_a >= 1 && div_a <= 63,
2116 "`LCD_CAM_CAM_CLOCK` div_a must be between 1 and 63 (inclusive)."
2117 );
2118 ::core::assert!(
2119 div_b <= 63,
2120 "`LCD_CAM_CAM_CLOCK` div_b must be between 0 and 63 (inclusive)."
2121 );
2122 Self {
2123 sclk,
2124 div_num,
2125 div_a,
2126 div_b,
2127 }
2128 }
2129 pub(crate) fn sclk(self) -> LcdCamCamClockSclk {
2130 self.sclk
2131 }
2132 pub(crate) fn div_num(self) -> u32 {
2133 self.div_num as u32
2134 }
2135 pub(crate) fn div_a(self) -> u32 {
2136 self.div_a as u32
2137 }
2138 pub(crate) fn div_b(self) -> u32 {
2139 self.div_b as u32
2140 }
2141 }
2142 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2144 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2145 pub enum McpwmFunctionClockConfig {
2146 #[default]
2147 CryptoPwmClk,
2149 }
2150 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2152 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2153 pub enum RmtSclkConfig {
2154 #[default]
2155 ApbClk,
2157 RcFastClk,
2159 XtalClk,
2161 }
2162 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2164 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2165 pub enum SpiFunctionClockConfig {
2166 #[default]
2167 Xtal,
2169 Apb,
2171 }
2172 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2174 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2175 pub enum TimgFunctionClockConfig {
2176 #[default]
2177 XtalClk,
2179 ApbClk,
2181 }
2182 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2183 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2184 pub enum UartFunctionClockSclk {
2185 Apb,
2187 RcFast,
2189 #[default]
2190 Xtal,
2192 }
2193 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2197 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2198 pub struct UartFunctionClockConfig {
2199 sclk: UartFunctionClockSclk,
2200 div_num: u32,
2201 }
2202 impl UartFunctionClockConfig {
2203 pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
2210 ::core::assert!(
2211 div_num <= 255,
2212 "`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
2213 );
2214 Self { sclk, div_num }
2215 }
2216 pub(crate) fn sclk(self) -> UartFunctionClockSclk {
2217 self.sclk
2218 }
2219 pub(crate) fn div_num(self) -> u32 {
2220 self.div_num as u32
2221 }
2222 }
2223 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2228 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2229 pub struct UartBaudRateGeneratorConfig {
2230 fractional: u32,
2231 integral: u32,
2232 }
2233 impl UartBaudRateGeneratorConfig {
2234 pub const fn new(fractional: u32, integral: u32) -> Self {
2244 ::core::assert!(
2245 fractional <= 15,
2246 "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
2247 );
2248 ::core::assert!(
2249 integral <= 4095,
2250 "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
2251 );
2252 Self {
2253 fractional,
2254 integral,
2255 }
2256 }
2257 pub(crate) fn fractional(self) -> u32 {
2258 self.fractional as u32
2259 }
2260 pub(crate) fn integral(self) -> u32 {
2261 self.integral as u32
2262 }
2263 }
2264 pub struct ClockTree {
2266 xtal_clk: Option<XtalClkConfig>,
2267 pll_clk: Option<PllClkConfig>,
2268 system_pre_div_in: Option<SystemPreDivInConfig>,
2269 system_pre_div: Option<SystemPreDivConfig>,
2270 cpu_pll_div_out: Option<CpuPllDivOutConfig>,
2271 apb_clk: Option<ApbClkConfig>,
2272 crypto_pwm_clk: Option<CryptoPwmClkConfig>,
2273 cpu_clk: Option<CpuClkConfig>,
2274 rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
2275 rtc_slow_clk: Option<RtcSlowClkConfig>,
2276 rtc_fast_clk: Option<RtcFastClkConfig>,
2277 low_power_clk: Option<LowPowerClkConfig>,
2278 timg_calibration_clock: Option<TimgCalibrationClockConfig>,
2279 i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
2280 lcd_cam_lcd_clock: [Option<LcdCamLcdClockConfig>; 1],
2281 lcd_cam_cam_clock: [Option<LcdCamCamClockConfig>; 1],
2282 rmt_sclk: [Option<RmtSclkConfig>; 1],
2283 spi_function_clock: [Option<SpiFunctionClockConfig>; 2],
2284 timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
2285 uart_function_clock: [Option<UartFunctionClockConfig>; 3],
2286 uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 3],
2287 pll_clk_refcount: u32,
2288 rc_fast_clk_refcount: u32,
2289 xtal32k_clk_refcount: u32,
2290 rc_slow_clk_refcount: u32,
2291 rc_fast_div_clk_refcount: u32,
2292 apb_clk_refcount: u32,
2293 crypto_pwm_clk_refcount: u32,
2294 pll_d2_refcount: u32,
2295 pll_160m_refcount: u32,
2296 rtc_fast_clk_refcount: u32,
2297 low_power_clk_refcount: u32,
2298 uart_mem_clk_refcount: u32,
2299 timg_calibration_clock_refcount: u32,
2300 sdm_function_clock_refcount: [u32; 1],
2301 i2c_function_clock_refcount: [u32; 2],
2302 lcd_cam_lcd_clock_refcount: [u32; 1],
2303 lcd_cam_cam_clock_refcount: [u32; 1],
2304 mcpwm_function_clock_refcount: [u32; 2],
2305 rmt_sclk_refcount: [u32; 1],
2306 spi_function_clock_refcount: [u32; 2],
2307 timg_function_clock_refcount: [u32; 2],
2308 uart_function_clock_refcount: [u32; 3],
2309 uart_baud_rate_generator_refcount: [u32; 3],
2310 uart_mem_clock_refcount: [u32; 3],
2311 }
2312 impl ClockTree {
2313 pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
2315 CLOCK_TREE.with(f)
2316 }
2317 pub fn xtal_clk(&self) -> Option<XtalClkConfig> {
2319 self.xtal_clk
2320 }
2321 pub fn pll_clk(&self) -> Option<PllClkConfig> {
2323 self.pll_clk
2324 }
2325 pub fn system_pre_div_in(&self) -> Option<SystemPreDivInConfig> {
2327 self.system_pre_div_in
2328 }
2329 pub fn system_pre_div(&self) -> Option<SystemPreDivConfig> {
2331 self.system_pre_div
2332 }
2333 pub fn cpu_pll_div_out(&self) -> Option<CpuPllDivOutConfig> {
2335 self.cpu_pll_div_out
2336 }
2337 pub fn apb_clk(&self) -> Option<ApbClkConfig> {
2339 self.apb_clk
2340 }
2341 pub fn crypto_pwm_clk(&self) -> Option<CryptoPwmClkConfig> {
2343 self.crypto_pwm_clk
2344 }
2345 pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
2347 self.cpu_clk
2348 }
2349 pub fn rc_fast_clk_div_n(&self) -> Option<RcFastClkDivNConfig> {
2351 self.rc_fast_clk_div_n
2352 }
2353 pub fn rtc_slow_clk(&self) -> Option<RtcSlowClkConfig> {
2355 self.rtc_slow_clk
2356 }
2357 pub fn rtc_fast_clk(&self) -> Option<RtcFastClkConfig> {
2359 self.rtc_fast_clk
2360 }
2361 pub fn low_power_clk(&self) -> Option<LowPowerClkConfig> {
2363 self.low_power_clk
2364 }
2365 pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
2367 self.timg_calibration_clock
2368 }
2369 pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2371 self.i2c_function_clock[I2cInstance::I2c0 as usize]
2372 }
2373 pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2375 self.i2c_function_clock[I2cInstance::I2c1 as usize]
2376 }
2377 pub fn lcd_cam_lcd_clock(&self) -> Option<LcdCamLcdClockConfig> {
2379 self.lcd_cam_lcd_clock[LcdCamInstance::LcdCam as usize]
2380 }
2381 pub fn lcd_cam_cam_clock(&self) -> Option<LcdCamCamClockConfig> {
2383 self.lcd_cam_cam_clock[LcdCamInstance::LcdCam as usize]
2384 }
2385 pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
2387 self.rmt_sclk[RmtInstance::Rmt as usize]
2388 }
2389 pub fn spi2_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2391 self.spi_function_clock[SpiInstance::Spi2 as usize]
2392 }
2393 pub fn spi3_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2395 self.spi_function_clock[SpiInstance::Spi3 as usize]
2396 }
2397 pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2399 self.timg_function_clock[TimgInstance::Timg0 as usize]
2400 }
2401 pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2403 self.timg_function_clock[TimgInstance::Timg1 as usize]
2404 }
2405 pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
2407 self.uart_function_clock[UartInstance::Uart0 as usize]
2408 }
2409 pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2411 self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
2412 }
2413 pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
2415 self.uart_function_clock[UartInstance::Uart1 as usize]
2416 }
2417 pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2419 self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
2420 }
2421 pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
2423 self.uart_function_clock[UartInstance::Uart2 as usize]
2424 }
2425 pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2427 self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
2428 }
2429 }
2430 static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
2431 ::esp_sync::NonReentrantMutex::new(ClockTree {
2432 xtal_clk: None,
2433 pll_clk: None,
2434 system_pre_div_in: None,
2435 system_pre_div: None,
2436 cpu_pll_div_out: None,
2437 apb_clk: None,
2438 crypto_pwm_clk: None,
2439 cpu_clk: None,
2440 rc_fast_clk_div_n: None,
2441 rtc_slow_clk: None,
2442 rtc_fast_clk: None,
2443 low_power_clk: None,
2444 timg_calibration_clock: None,
2445 i2c_function_clock: [None; 2],
2446 lcd_cam_lcd_clock: [None; 1],
2447 lcd_cam_cam_clock: [None; 1],
2448 rmt_sclk: [None; 1],
2449 spi_function_clock: [None; 2],
2450 timg_function_clock: [None; 2],
2451 uart_function_clock: [None; 3],
2452 uart_baud_rate_generator: [None; 3],
2453 pll_clk_refcount: 0,
2454 rc_fast_clk_refcount: 0,
2455 xtal32k_clk_refcount: 0,
2456 rc_slow_clk_refcount: 0,
2457 rc_fast_div_clk_refcount: 0,
2458 apb_clk_refcount: 0,
2459 crypto_pwm_clk_refcount: 0,
2460 pll_d2_refcount: 0,
2461 pll_160m_refcount: 0,
2462 rtc_fast_clk_refcount: 0,
2463 low_power_clk_refcount: 0,
2464 uart_mem_clk_refcount: 0,
2465 timg_calibration_clock_refcount: 0,
2466 sdm_function_clock_refcount: [0; 1],
2467 i2c_function_clock_refcount: [0; 2],
2468 lcd_cam_lcd_clock_refcount: [0; 1],
2469 lcd_cam_cam_clock_refcount: [0; 1],
2470 mcpwm_function_clock_refcount: [0; 2],
2471 rmt_sclk_refcount: [0; 1],
2472 spi_function_clock_refcount: [0; 2],
2473 timg_function_clock_refcount: [0; 2],
2474 uart_function_clock_refcount: [0; 3],
2475 uart_baud_rate_generator_refcount: [0; 3],
2476 uart_mem_clock_refcount: [0; 3],
2477 });
2478 static XTAL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2479 ::core::sync::atomic::AtomicU32::new(0);
2480 static PLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2481 ::core::sync::atomic::AtomicU32::new(0);
2482 static SYSTEM_PRE_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2483 ::core::sync::atomic::AtomicU32::new(0);
2484 static SYSTEM_PRE_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2485 ::core::sync::atomic::AtomicU32::new(0);
2486 static CPU_PLL_DIV_OUT_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2487 ::core::sync::atomic::AtomicU32::new(0);
2488 static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2489 ::core::sync::atomic::AtomicU32::new(0);
2490 static RC_FAST_CLK_DIV_N_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2491 ::core::sync::atomic::AtomicU32::new(0);
2492 static RTC_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2493 ::core::sync::atomic::AtomicU32::new(0);
2494 static RTC_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2495 ::core::sync::atomic::AtomicU32::new(0);
2496 static LOW_POWER_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2497 ::core::sync::atomic::AtomicU32::new(0);
2498 static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2499 ::core::sync::atomic::AtomicU32::new(0);
2500 static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2501 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2502 static LCD_CAM_LCD_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2503 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2504 static LCD_CAM_CAM_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2505 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2506 static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2507 ::core::sync::atomic::AtomicU32::new(0);
2508 static CRYPTO_PWM_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2509 ::core::sync::atomic::AtomicU32::new(0);
2510 static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2511 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2512 static SPI_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2513 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2514 static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2515 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2516 static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
2517 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
2518 static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
2519 [const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
2520 pub fn configure_xtal_clk(clocks: &mut ClockTree, config: XtalClkConfig) {
2521 let old_config = clocks.xtal_clk.replace(config);
2522 refresh_xtal_clk_downstream(clocks);
2523 configure_xtal_clk_impl(clocks, old_config, config);
2524 }
2525 pub fn xtal_clk_config(clocks: &mut ClockTree) -> Option<XtalClkConfig> {
2526 clocks.xtal_clk
2527 }
2528 fn request_xtal_clk(_clocks: &mut ClockTree) {}
2529 fn release_xtal_clk(_clocks: &mut ClockTree) {}
2530 #[allow(unused_variables)]
2531 pub fn xtal_clk_config_frequency(clocks: &mut ClockTree, config: XtalClkConfig) -> u32 {
2532 config.value()
2533 }
2534 pub fn xtal_clk_frequency() -> u32 {
2535 XTAL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2536 }
2537 pub fn configure_pll_clk(clocks: &mut ClockTree, config: PllClkConfig) {
2538 if clocks.cpu_pll_div_out.is_some() {
2539 assert!(
2540 !((config.value() == 320000000) && (cpu_pll_div_out_frequency() == 240000000))
2541 );
2542 }
2543 let old_config = clocks.pll_clk.replace(config);
2544 refresh_pll_clk_downstream(clocks);
2545 configure_pll_clk_impl(clocks, old_config, config);
2546 }
2547 pub fn pll_clk_config(clocks: &mut ClockTree) -> Option<PllClkConfig> {
2548 clocks.pll_clk
2549 }
2550 pub fn request_pll_clk(clocks: &mut ClockTree) {
2551 trace!("Requesting PLL_CLK");
2552 if increment_reference_count(&mut clocks.pll_clk_refcount) {
2553 trace!("Enabling PLL_CLK");
2554 request_xtal_clk(clocks);
2555 enable_pll_clk_impl(clocks, true);
2556 }
2557 }
2558 pub fn release_pll_clk(clocks: &mut ClockTree) {
2559 trace!("Releasing PLL_CLK");
2560 if decrement_reference_count(&mut clocks.pll_clk_refcount) {
2561 trace!("Disabling PLL_CLK");
2562 enable_pll_clk_impl(clocks, false);
2563 release_xtal_clk(clocks);
2564 }
2565 }
2566 #[allow(unused_variables)]
2567 pub fn pll_clk_config_frequency(clocks: &mut ClockTree, config: PllClkConfig) -> u32 {
2568 config.value()
2569 }
2570 pub fn pll_clk_frequency() -> u32 {
2571 PLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2572 }
2573 pub fn pll_clk_source_frequency() -> u32 {
2574 xtal_clk_frequency()
2575 }
2576 pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
2577 trace!("Requesting RC_FAST_CLK");
2578 if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
2579 trace!("Enabling RC_FAST_CLK");
2580 enable_rc_fast_clk_impl(clocks, true);
2581 }
2582 }
2583 pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
2584 trace!("Releasing RC_FAST_CLK");
2585 if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
2586 trace!("Disabling RC_FAST_CLK");
2587 enable_rc_fast_clk_impl(clocks, false);
2588 }
2589 }
2590 pub fn rc_fast_clk_frequency() -> u32 {
2591 17500000
2592 }
2593 pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
2594 trace!("Requesting XTAL32K_CLK");
2595 if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
2596 trace!("Enabling XTAL32K_CLK");
2597 enable_xtal32k_clk_impl(clocks, true);
2598 }
2599 }
2600 pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
2601 trace!("Releasing XTAL32K_CLK");
2602 if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
2603 trace!("Disabling XTAL32K_CLK");
2604 enable_xtal32k_clk_impl(clocks, false);
2605 }
2606 }
2607 pub fn xtal32k_clk_frequency() -> u32 {
2608 32768
2609 }
2610 pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
2611 trace!("Requesting RC_SLOW_CLK");
2612 if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
2613 trace!("Enabling RC_SLOW_CLK");
2614 enable_rc_slow_clk_impl(clocks, true);
2615 }
2616 }
2617 pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
2618 trace!("Releasing RC_SLOW_CLK");
2619 if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
2620 trace!("Disabling RC_SLOW_CLK");
2621 enable_rc_slow_clk_impl(clocks, false);
2622 }
2623 }
2624 pub fn rc_slow_clk_frequency() -> u32 {
2625 136000
2626 }
2627 pub fn request_rc_fast_div_clk(clocks: &mut ClockTree) {
2628 trace!("Requesting RC_FAST_DIV_CLK");
2629 if increment_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
2630 trace!("Enabling RC_FAST_DIV_CLK");
2631 request_rc_fast_clk(clocks);
2632 enable_rc_fast_div_clk_impl(clocks, true);
2633 }
2634 }
2635 pub fn release_rc_fast_div_clk(clocks: &mut ClockTree) {
2636 trace!("Releasing RC_FAST_DIV_CLK");
2637 if decrement_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
2638 trace!("Disabling RC_FAST_DIV_CLK");
2639 enable_rc_fast_div_clk_impl(clocks, false);
2640 release_rc_fast_clk(clocks);
2641 }
2642 }
2643 pub fn rc_fast_div_clk_frequency() -> u32 {
2644 (rc_fast_clk_frequency() / 256)
2645 }
2646 pub fn rc_fast_div_clk_source_frequency() -> u32 {
2647 rc_fast_clk_frequency()
2648 }
2649 pub fn configure_system_pre_div_in(
2650 clocks: &mut ClockTree,
2651 new_selector: SystemPreDivInConfig,
2652 ) {
2653 let old_selector = clocks.system_pre_div_in.replace(new_selector);
2654 refresh_system_pre_div_in_downstream(clocks);
2655 match new_selector {
2656 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
2657 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2658 }
2659 configure_system_pre_div_in_impl(clocks, old_selector, new_selector);
2660 if let Some(old_selector) = old_selector {
2661 match old_selector {
2662 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
2663 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2664 }
2665 }
2666 }
2667 pub fn system_pre_div_in_config(clocks: &mut ClockTree) -> Option<SystemPreDivInConfig> {
2668 clocks.system_pre_div_in
2669 }
2670 pub fn request_system_pre_div_in(clocks: &mut ClockTree) {
2671 trace!("Requesting SYSTEM_PRE_DIV_IN");
2672 trace!("Enabling SYSTEM_PRE_DIV_IN");
2673 match unwrap!(clocks.system_pre_div_in) {
2674 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
2675 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2676 }
2677 enable_system_pre_div_in_impl(clocks, true);
2678 }
2679 pub fn release_system_pre_div_in(clocks: &mut ClockTree) {
2680 trace!("Releasing SYSTEM_PRE_DIV_IN");
2681 trace!("Disabling SYSTEM_PRE_DIV_IN");
2682 enable_system_pre_div_in_impl(clocks, false);
2683 match unwrap!(clocks.system_pre_div_in) {
2684 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
2685 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2686 }
2687 }
2688 #[allow(unused_variables)]
2689 pub fn system_pre_div_in_config_frequency(
2690 clocks: &mut ClockTree,
2691 config: SystemPreDivInConfig,
2692 ) -> u32 {
2693 match config {
2694 SystemPreDivInConfig::Xtal => xtal_clk_frequency(),
2695 SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
2696 }
2697 }
2698 pub fn system_pre_div_in_frequency() -> u32 {
2699 SYSTEM_PRE_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2700 }
2701 pub fn system_pre_div_in_source_frequency(source: SystemPreDivInConfig) -> u32 {
2702 match source {
2703 SystemPreDivInConfig::Xtal => xtal_clk_frequency(),
2704 SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
2705 }
2706 }
2707 pub fn configure_system_pre_div(clocks: &mut ClockTree, config: SystemPreDivConfig) {
2708 let old_config = clocks.system_pre_div.replace(config);
2709 refresh_system_pre_div_downstream(clocks);
2710 configure_system_pre_div_impl(clocks, old_config, config);
2711 }
2712 pub fn system_pre_div_config(clocks: &mut ClockTree) -> Option<SystemPreDivConfig> {
2713 clocks.system_pre_div
2714 }
2715 pub fn request_system_pre_div(clocks: &mut ClockTree) {
2716 trace!("Requesting SYSTEM_PRE_DIV");
2717 trace!("Enabling SYSTEM_PRE_DIV");
2718 request_system_pre_div_in(clocks);
2719 enable_system_pre_div_impl(clocks, true);
2720 }
2721 pub fn release_system_pre_div(clocks: &mut ClockTree) {
2722 trace!("Releasing SYSTEM_PRE_DIV");
2723 trace!("Disabling SYSTEM_PRE_DIV");
2724 enable_system_pre_div_impl(clocks, false);
2725 release_system_pre_div_in(clocks);
2726 }
2727 #[allow(unused_variables)]
2728 pub fn system_pre_div_config_frequency(
2729 clocks: &mut ClockTree,
2730 config: SystemPreDivConfig,
2731 ) -> u32 {
2732 (system_pre_div_in_frequency() / (config.divisor() + 1))
2733 }
2734 pub fn system_pre_div_frequency() -> u32 {
2735 SYSTEM_PRE_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2736 }
2737 pub fn system_pre_div_source_frequency() -> u32 {
2738 system_pre_div_in_frequency()
2739 }
2740 pub fn configure_cpu_pll_div_out(clocks: &mut ClockTree, config: CpuPllDivOutConfig) {
2741 if clocks.pll_clk.is_some() {
2742 assert!(!((config.value() == 240000000) && (pll_clk_frequency() == 320000000)));
2743 }
2744 let old_config = clocks.cpu_pll_div_out.replace(config);
2745 refresh_cpu_pll_div_out_downstream(clocks);
2746 configure_cpu_pll_div_out_impl(clocks, old_config, config);
2747 }
2748 pub fn cpu_pll_div_out_config(clocks: &mut ClockTree) -> Option<CpuPllDivOutConfig> {
2749 clocks.cpu_pll_div_out
2750 }
2751 pub fn request_cpu_pll_div_out(clocks: &mut ClockTree) {
2752 trace!("Requesting CPU_PLL_DIV_OUT");
2753 trace!("Enabling CPU_PLL_DIV_OUT");
2754 request_pll_clk(clocks);
2755 enable_cpu_pll_div_out_impl(clocks, true);
2756 }
2757 pub fn release_cpu_pll_div_out(clocks: &mut ClockTree) {
2758 trace!("Releasing CPU_PLL_DIV_OUT");
2759 trace!("Disabling CPU_PLL_DIV_OUT");
2760 enable_cpu_pll_div_out_impl(clocks, false);
2761 release_pll_clk(clocks);
2762 }
2763 #[allow(unused_variables)]
2764 pub fn cpu_pll_div_out_config_frequency(
2765 clocks: &mut ClockTree,
2766 config: CpuPllDivOutConfig,
2767 ) -> u32 {
2768 config.value()
2769 }
2770 pub fn cpu_pll_div_out_frequency() -> u32 {
2771 CPU_PLL_DIV_OUT_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2772 }
2773 pub fn cpu_pll_div_out_source_frequency() -> u32 {
2774 pll_clk_frequency()
2775 }
2776 pub fn configure_apb_clk(clocks: &mut ClockTree, new_selector: ApbClkConfig) {
2777 let old_selector = clocks.apb_clk.replace(new_selector);
2778 refresh_apb_clk_downstream(clocks);
2779 if clocks.apb_clk_refcount > 0 {
2780 match new_selector {
2781 ApbClkConfig::Pll => request_apb_80m(clocks),
2782 ApbClkConfig::Cpu => request_cpu_clk(clocks),
2783 }
2784 configure_apb_clk_impl(clocks, old_selector, new_selector);
2785 if let Some(old_selector) = old_selector {
2786 match old_selector {
2787 ApbClkConfig::Pll => release_apb_80m(clocks),
2788 ApbClkConfig::Cpu => release_cpu_clk(clocks),
2789 }
2790 }
2791 } else {
2792 configure_apb_clk_impl(clocks, old_selector, new_selector);
2793 }
2794 }
2795 pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
2796 clocks.apb_clk
2797 }
2798 pub fn request_apb_clk(clocks: &mut ClockTree) {
2799 trace!("Requesting APB_CLK");
2800 if increment_reference_count(&mut clocks.apb_clk_refcount) {
2801 trace!("Enabling APB_CLK");
2802 match unwrap!(clocks.apb_clk) {
2803 ApbClkConfig::Pll => request_apb_80m(clocks),
2804 ApbClkConfig::Cpu => request_cpu_clk(clocks),
2805 }
2806 enable_apb_clk_impl(clocks, true);
2807 }
2808 }
2809 pub fn release_apb_clk(clocks: &mut ClockTree) {
2810 trace!("Releasing APB_CLK");
2811 if decrement_reference_count(&mut clocks.apb_clk_refcount) {
2812 trace!("Disabling APB_CLK");
2813 enable_apb_clk_impl(clocks, false);
2814 match unwrap!(clocks.apb_clk) {
2815 ApbClkConfig::Pll => release_apb_80m(clocks),
2816 ApbClkConfig::Cpu => release_cpu_clk(clocks),
2817 }
2818 }
2819 }
2820 #[allow(unused_variables)]
2821 pub fn apb_clk_config_frequency(clocks: &mut ClockTree, config: ApbClkConfig) -> u32 {
2822 match config {
2823 ApbClkConfig::Pll => apb_80m_frequency(),
2824 ApbClkConfig::Cpu => cpu_clk_frequency(),
2825 }
2826 }
2827 pub fn apb_clk_frequency() -> u32 {
2828 APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2829 }
2830 pub fn apb_clk_source_frequency(source: ApbClkConfig) -> u32 {
2831 match source {
2832 ApbClkConfig::Pll => apb_80m_frequency(),
2833 ApbClkConfig::Cpu => cpu_clk_frequency(),
2834 }
2835 }
2836 pub fn configure_crypto_pwm_clk(clocks: &mut ClockTree, new_selector: CryptoPwmClkConfig) {
2837 let old_selector = clocks.crypto_pwm_clk.replace(new_selector);
2838 refresh_crypto_pwm_clk_downstream(clocks);
2839 if clocks.crypto_pwm_clk_refcount > 0 {
2840 match new_selector {
2841 CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
2842 CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
2843 }
2844 configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
2845 if let Some(old_selector) = old_selector {
2846 match old_selector {
2847 CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
2848 CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
2849 }
2850 }
2851 } else {
2852 configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
2853 }
2854 }
2855 pub fn crypto_pwm_clk_config(clocks: &mut ClockTree) -> Option<CryptoPwmClkConfig> {
2856 clocks.crypto_pwm_clk
2857 }
2858 pub fn request_crypto_pwm_clk(clocks: &mut ClockTree) {
2859 trace!("Requesting CRYPTO_PWM_CLK");
2860 if increment_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
2861 trace!("Enabling CRYPTO_PWM_CLK");
2862 match unwrap!(clocks.crypto_pwm_clk) {
2863 CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
2864 CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
2865 }
2866 enable_crypto_pwm_clk_impl(clocks, true);
2867 }
2868 }
2869 pub fn release_crypto_pwm_clk(clocks: &mut ClockTree) {
2870 trace!("Releasing CRYPTO_PWM_CLK");
2871 if decrement_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
2872 trace!("Disabling CRYPTO_PWM_CLK");
2873 enable_crypto_pwm_clk_impl(clocks, false);
2874 match unwrap!(clocks.crypto_pwm_clk) {
2875 CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
2876 CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
2877 }
2878 }
2879 }
2880 #[allow(unused_variables)]
2881 pub fn crypto_pwm_clk_config_frequency(
2882 clocks: &mut ClockTree,
2883 config: CryptoPwmClkConfig,
2884 ) -> u32 {
2885 match config {
2886 CryptoPwmClkConfig::Pll => pll_160m_frequency(),
2887 CryptoPwmClkConfig::Cpu => cpu_clk_frequency(),
2888 }
2889 }
2890 pub fn crypto_pwm_clk_frequency() -> u32 {
2891 CRYPTO_PWM_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2892 }
2893 pub fn crypto_pwm_clk_source_frequency(source: CryptoPwmClkConfig) -> u32 {
2894 match source {
2895 CryptoPwmClkConfig::Pll => pll_160m_frequency(),
2896 CryptoPwmClkConfig::Cpu => cpu_clk_frequency(),
2897 }
2898 }
2899 pub fn configure_cpu_clk(clocks: &mut ClockTree, new_selector: CpuClkConfig) {
2900 let old_selector = clocks.cpu_clk.replace(new_selector);
2901 refresh_cpu_clk_downstream(clocks);
2902 match new_selector {
2903 CpuClkConfig::Xtal => {
2904 configure_apb_clk(clocks, ApbClkConfig::Cpu);
2905 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
2906 configure_system_pre_div_in(clocks, SystemPreDivInConfig::Xtal);
2907 }
2908 CpuClkConfig::RcFast => {
2909 configure_apb_clk(clocks, ApbClkConfig::Cpu);
2910 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
2911 configure_system_pre_div_in(clocks, SystemPreDivInConfig::RcFast);
2912 }
2913 CpuClkConfig::Pll => {
2914 configure_apb_clk(clocks, ApbClkConfig::Pll);
2915 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Pll);
2916 }
2917 }
2918 match new_selector {
2919 CpuClkConfig::Xtal => request_system_pre_div(clocks),
2920 CpuClkConfig::RcFast => request_system_pre_div(clocks),
2921 CpuClkConfig::Pll => request_cpu_pll_div_out(clocks),
2922 }
2923 configure_cpu_clk_impl(clocks, old_selector, new_selector);
2924 if let Some(old_selector) = old_selector {
2925 match old_selector {
2926 CpuClkConfig::Xtal => release_system_pre_div(clocks),
2927 CpuClkConfig::RcFast => release_system_pre_div(clocks),
2928 CpuClkConfig::Pll => release_cpu_pll_div_out(clocks),
2929 }
2930 }
2931 }
2932 pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
2933 clocks.cpu_clk
2934 }
2935 fn request_cpu_clk(_clocks: &mut ClockTree) {}
2936 fn release_cpu_clk(_clocks: &mut ClockTree) {}
2937 #[allow(unused_variables)]
2938 pub fn cpu_clk_config_frequency(clocks: &mut ClockTree, config: CpuClkConfig) -> u32 {
2939 match config {
2940 CpuClkConfig::Xtal => system_pre_div_frequency(),
2941 CpuClkConfig::RcFast => system_pre_div_frequency(),
2942 CpuClkConfig::Pll => cpu_pll_div_out_frequency(),
2943 }
2944 }
2945 pub fn cpu_clk_frequency() -> u32 {
2946 CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2947 }
2948 pub fn request_pll_d2(clocks: &mut ClockTree) {
2949 trace!("Requesting PLL_D2");
2950 if increment_reference_count(&mut clocks.pll_d2_refcount) {
2951 trace!("Enabling PLL_D2");
2952 request_pll_clk(clocks);
2953 enable_pll_d2_impl(clocks, true);
2954 }
2955 }
2956 pub fn release_pll_d2(clocks: &mut ClockTree) {
2957 trace!("Releasing PLL_D2");
2958 if decrement_reference_count(&mut clocks.pll_d2_refcount) {
2959 trace!("Disabling PLL_D2");
2960 enable_pll_d2_impl(clocks, false);
2961 release_pll_clk(clocks);
2962 }
2963 }
2964 pub fn pll_d2_frequency() -> u32 {
2965 (pll_clk_frequency() / 2)
2966 }
2967 pub fn pll_d2_source_frequency() -> u32 {
2968 pll_clk_frequency()
2969 }
2970 pub fn request_pll_160m(clocks: &mut ClockTree) {
2971 trace!("Requesting PLL_160M");
2972 if increment_reference_count(&mut clocks.pll_160m_refcount) {
2973 trace!("Enabling PLL_160M");
2974 request_cpu_clk(clocks);
2975 enable_pll_160m_impl(clocks, true);
2976 }
2977 }
2978 pub fn release_pll_160m(clocks: &mut ClockTree) {
2979 trace!("Releasing PLL_160M");
2980 if decrement_reference_count(&mut clocks.pll_160m_refcount) {
2981 trace!("Disabling PLL_160M");
2982 enable_pll_160m_impl(clocks, false);
2983 release_cpu_clk(clocks);
2984 }
2985 }
2986 pub fn pll_160m_frequency() -> u32 {
2987 160000000
2988 }
2989 pub fn pll_160m_source_frequency() -> u32 {
2990 cpu_clk_frequency()
2991 }
2992 pub fn request_apb_80m(clocks: &mut ClockTree) {
2993 trace!("Requesting APB_80M");
2994 trace!("Enabling APB_80M");
2995 request_cpu_clk(clocks);
2996 enable_apb_80m_impl(clocks, true);
2997 }
2998 pub fn release_apb_80m(clocks: &mut ClockTree) {
2999 trace!("Releasing APB_80M");
3000 trace!("Disabling APB_80M");
3001 enable_apb_80m_impl(clocks, false);
3002 release_cpu_clk(clocks);
3003 }
3004 pub fn apb_80m_frequency() -> u32 {
3005 80000000
3006 }
3007 pub fn apb_80m_source_frequency() -> u32 {
3008 cpu_clk_frequency()
3009 }
3010 pub fn configure_rc_fast_clk_div_n(clocks: &mut ClockTree, config: RcFastClkDivNConfig) {
3011 let old_config = clocks.rc_fast_clk_div_n.replace(config);
3012 refresh_rc_fast_clk_div_n_downstream(clocks);
3013 configure_rc_fast_clk_div_n_impl(clocks, old_config, config);
3014 }
3015 pub fn rc_fast_clk_div_n_config(clocks: &mut ClockTree) -> Option<RcFastClkDivNConfig> {
3016 clocks.rc_fast_clk_div_n
3017 }
3018 pub fn request_rc_fast_clk_div_n(clocks: &mut ClockTree) {
3019 trace!("Requesting RC_FAST_CLK_DIV_N");
3020 trace!("Enabling RC_FAST_CLK_DIV_N");
3021 request_rc_fast_clk(clocks);
3022 enable_rc_fast_clk_div_n_impl(clocks, true);
3023 }
3024 pub fn release_rc_fast_clk_div_n(clocks: &mut ClockTree) {
3025 trace!("Releasing RC_FAST_CLK_DIV_N");
3026 trace!("Disabling RC_FAST_CLK_DIV_N");
3027 enable_rc_fast_clk_div_n_impl(clocks, false);
3028 release_rc_fast_clk(clocks);
3029 }
3030 #[allow(unused_variables)]
3031 pub fn rc_fast_clk_div_n_config_frequency(
3032 clocks: &mut ClockTree,
3033 config: RcFastClkDivNConfig,
3034 ) -> u32 {
3035 (rc_fast_clk_frequency() / (config.divisor() + 1))
3036 }
3037 pub fn rc_fast_clk_div_n_frequency() -> u32 {
3038 RC_FAST_CLK_DIV_N_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3039 }
3040 pub fn rc_fast_clk_div_n_source_frequency() -> u32 {
3041 rc_fast_clk_frequency()
3042 }
3043 pub fn request_xtal_div_clk(clocks: &mut ClockTree) {
3044 trace!("Requesting XTAL_DIV_CLK");
3045 trace!("Enabling XTAL_DIV_CLK");
3046 request_xtal_clk(clocks);
3047 enable_xtal_div_clk_impl(clocks, true);
3048 }
3049 pub fn release_xtal_div_clk(clocks: &mut ClockTree) {
3050 trace!("Releasing XTAL_DIV_CLK");
3051 trace!("Disabling XTAL_DIV_CLK");
3052 enable_xtal_div_clk_impl(clocks, false);
3053 release_xtal_clk(clocks);
3054 }
3055 pub fn xtal_div_clk_frequency() -> u32 {
3056 (xtal_clk_frequency() / 2)
3057 }
3058 pub fn xtal_div_clk_source_frequency() -> u32 {
3059 xtal_clk_frequency()
3060 }
3061 pub fn configure_rtc_slow_clk(clocks: &mut ClockTree, new_selector: RtcSlowClkConfig) {
3062 let old_selector = clocks.rtc_slow_clk.replace(new_selector);
3063 refresh_rtc_slow_clk_downstream(clocks);
3064 match new_selector {
3065 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3066 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3067 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
3068 }
3069 configure_rtc_slow_clk_impl(clocks, old_selector, new_selector);
3070 if let Some(old_selector) = old_selector {
3071 match old_selector {
3072 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3073 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3074 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
3075 }
3076 }
3077 }
3078 pub fn rtc_slow_clk_config(clocks: &mut ClockTree) -> Option<RtcSlowClkConfig> {
3079 clocks.rtc_slow_clk
3080 }
3081 pub fn request_rtc_slow_clk(clocks: &mut ClockTree) {
3082 trace!("Requesting RTC_SLOW_CLK");
3083 trace!("Enabling RTC_SLOW_CLK");
3084 match unwrap!(clocks.rtc_slow_clk) {
3085 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3086 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
3087 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
3088 }
3089 enable_rtc_slow_clk_impl(clocks, true);
3090 }
3091 pub fn release_rtc_slow_clk(clocks: &mut ClockTree) {
3092 trace!("Releasing RTC_SLOW_CLK");
3093 trace!("Disabling RTC_SLOW_CLK");
3094 enable_rtc_slow_clk_impl(clocks, false);
3095 match unwrap!(clocks.rtc_slow_clk) {
3096 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3097 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
3098 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
3099 }
3100 }
3101 #[allow(unused_variables)]
3102 pub fn rtc_slow_clk_config_frequency(
3103 clocks: &mut ClockTree,
3104 config: RtcSlowClkConfig,
3105 ) -> u32 {
3106 match config {
3107 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3108 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3109 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
3110 }
3111 }
3112 pub fn rtc_slow_clk_frequency() -> u32 {
3113 RTC_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3114 }
3115 pub fn rtc_slow_clk_source_frequency(source: RtcSlowClkConfig) -> u32 {
3116 match source {
3117 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
3118 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
3119 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
3120 }
3121 }
3122 pub fn configure_rtc_fast_clk(clocks: &mut ClockTree, new_selector: RtcFastClkConfig) {
3123 let old_selector = clocks.rtc_fast_clk.replace(new_selector);
3124 refresh_rtc_fast_clk_downstream(clocks);
3125 if clocks.rtc_fast_clk_refcount > 0 {
3126 match new_selector {
3127 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
3128 RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
3129 }
3130 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
3131 if let Some(old_selector) = old_selector {
3132 match old_selector {
3133 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
3134 RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
3135 }
3136 }
3137 } else {
3138 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
3139 }
3140 }
3141 pub fn rtc_fast_clk_config(clocks: &mut ClockTree) -> Option<RtcFastClkConfig> {
3142 clocks.rtc_fast_clk
3143 }
3144 pub fn request_rtc_fast_clk(clocks: &mut ClockTree) {
3145 trace!("Requesting RTC_FAST_CLK");
3146 if increment_reference_count(&mut clocks.rtc_fast_clk_refcount) {
3147 trace!("Enabling RTC_FAST_CLK");
3148 match unwrap!(clocks.rtc_fast_clk) {
3149 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
3150 RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
3151 }
3152 enable_rtc_fast_clk_impl(clocks, true);
3153 }
3154 }
3155 pub fn release_rtc_fast_clk(clocks: &mut ClockTree) {
3156 trace!("Releasing RTC_FAST_CLK");
3157 if decrement_reference_count(&mut clocks.rtc_fast_clk_refcount) {
3158 trace!("Disabling RTC_FAST_CLK");
3159 enable_rtc_fast_clk_impl(clocks, false);
3160 match unwrap!(clocks.rtc_fast_clk) {
3161 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
3162 RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
3163 }
3164 }
3165 }
3166 #[allow(unused_variables)]
3167 pub fn rtc_fast_clk_config_frequency(
3168 clocks: &mut ClockTree,
3169 config: RtcFastClkConfig,
3170 ) -> u32 {
3171 match config {
3172 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
3173 RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(),
3174 }
3175 }
3176 pub fn rtc_fast_clk_frequency() -> u32 {
3177 RTC_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3178 }
3179 pub fn rtc_fast_clk_source_frequency(source: RtcFastClkConfig) -> u32 {
3180 match source {
3181 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
3182 RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(),
3183 }
3184 }
3185 pub fn configure_low_power_clk(clocks: &mut ClockTree, new_selector: LowPowerClkConfig) {
3186 let old_selector = clocks.low_power_clk.replace(new_selector);
3187 refresh_low_power_clk_downstream(clocks);
3188 if clocks.low_power_clk_refcount > 0 {
3189 match new_selector {
3190 LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
3191 LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
3192 LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3193 LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
3194 }
3195 configure_low_power_clk_impl(clocks, old_selector, new_selector);
3196 if let Some(old_selector) = old_selector {
3197 match old_selector {
3198 LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
3199 LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
3200 LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3201 LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
3202 }
3203 }
3204 } else {
3205 configure_low_power_clk_impl(clocks, old_selector, new_selector);
3206 }
3207 }
3208 pub fn low_power_clk_config(clocks: &mut ClockTree) -> Option<LowPowerClkConfig> {
3209 clocks.low_power_clk
3210 }
3211 pub fn request_low_power_clk(clocks: &mut ClockTree) {
3212 trace!("Requesting LOW_POWER_CLK");
3213 if increment_reference_count(&mut clocks.low_power_clk_refcount) {
3214 trace!("Enabling LOW_POWER_CLK");
3215 match unwrap!(clocks.low_power_clk) {
3216 LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
3217 LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
3218 LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
3219 LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
3220 }
3221 enable_low_power_clk_impl(clocks, true);
3222 }
3223 }
3224 pub fn release_low_power_clk(clocks: &mut ClockTree) {
3225 trace!("Releasing LOW_POWER_CLK");
3226 if decrement_reference_count(&mut clocks.low_power_clk_refcount) {
3227 trace!("Disabling LOW_POWER_CLK");
3228 enable_low_power_clk_impl(clocks, false);
3229 match unwrap!(clocks.low_power_clk) {
3230 LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
3231 LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
3232 LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
3233 LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
3234 }
3235 }
3236 }
3237 #[allow(unused_variables)]
3238 pub fn low_power_clk_config_frequency(
3239 clocks: &mut ClockTree,
3240 config: LowPowerClkConfig,
3241 ) -> u32 {
3242 match config {
3243 LowPowerClkConfig::Xtal => xtal_clk_frequency(),
3244 LowPowerClkConfig::RcFast => rc_fast_clk_frequency(),
3245 LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(),
3246 LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(),
3247 }
3248 }
3249 pub fn low_power_clk_frequency() -> u32 {
3250 LOW_POWER_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3251 }
3252 pub fn low_power_clk_source_frequency(source: LowPowerClkConfig) -> u32 {
3253 match source {
3254 LowPowerClkConfig::Xtal => xtal_clk_frequency(),
3255 LowPowerClkConfig::RcFast => rc_fast_clk_frequency(),
3256 LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(),
3257 LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(),
3258 }
3259 }
3260 pub fn request_uart_mem_clk(clocks: &mut ClockTree) {
3261 trace!("Requesting UART_MEM_CLK");
3262 if increment_reference_count(&mut clocks.uart_mem_clk_refcount) {
3263 trace!("Enabling UART_MEM_CLK");
3264 request_xtal_clk(clocks);
3265 enable_uart_mem_clk_impl(clocks, true);
3266 }
3267 }
3268 pub fn release_uart_mem_clk(clocks: &mut ClockTree) {
3269 trace!("Releasing UART_MEM_CLK");
3270 if decrement_reference_count(&mut clocks.uart_mem_clk_refcount) {
3271 trace!("Disabling UART_MEM_CLK");
3272 enable_uart_mem_clk_impl(clocks, false);
3273 release_xtal_clk(clocks);
3274 }
3275 }
3276 pub fn uart_mem_clk_frequency() -> u32 {
3277 xtal_clk_frequency()
3278 }
3279 pub fn uart_mem_clk_source_frequency(source: UartMemClkConfig) -> u32 {
3280 match source {
3281 UartMemClkConfig::Xtal => xtal_clk_frequency(),
3282 }
3283 }
3284 pub fn configure_timg_calibration_clock(
3285 clocks: &mut ClockTree,
3286 new_selector: TimgCalibrationClockConfig,
3287 ) {
3288 let old_selector = clocks.timg_calibration_clock.replace(new_selector);
3289 refresh_timg_calibration_clock_downstream(clocks);
3290 if clocks.timg_calibration_clock_refcount > 0 {
3291 match new_selector {
3292 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3293 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3294 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3295 }
3296 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3297 if let Some(old_selector) = old_selector {
3298 match old_selector {
3299 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3300 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3301 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3302 }
3303 }
3304 } else {
3305 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3306 }
3307 }
3308 pub fn timg_calibration_clock_config(
3309 clocks: &mut ClockTree,
3310 ) -> Option<TimgCalibrationClockConfig> {
3311 clocks.timg_calibration_clock
3312 }
3313 pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
3314 trace!("Requesting TIMG_CALIBRATION_CLOCK");
3315 if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3316 trace!("Enabling TIMG_CALIBRATION_CLOCK");
3317 crate::rtc_cntl::WakeLock::acquire();
3318 match unwrap!(clocks.timg_calibration_clock) {
3319 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
3320 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3321 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3322 }
3323 enable_timg_calibration_clock_impl(clocks, true);
3324 }
3325 }
3326 pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
3327 trace!("Releasing TIMG_CALIBRATION_CLOCK");
3328 if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3329 trace!("Disabling TIMG_CALIBRATION_CLOCK");
3330 crate::rtc_cntl::WakeLock::release();
3331 enable_timg_calibration_clock_impl(clocks, false);
3332 match unwrap!(clocks.timg_calibration_clock) {
3333 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
3334 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3335 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3336 }
3337 }
3338 }
3339 #[allow(unused_variables)]
3340 pub fn timg_calibration_clock_config_frequency(
3341 clocks: &mut ClockTree,
3342 config: TimgCalibrationClockConfig,
3343 ) -> u32 {
3344 match config {
3345 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
3346 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
3347 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3348 }
3349 }
3350 pub fn timg_calibration_clock_frequency() -> u32 {
3351 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3352 }
3353 pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
3354 match source {
3355 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
3356 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
3357 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3358 }
3359 }
3360 impl SdmInstance {
3361 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3362 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3363 if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3364 {
3365 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3366 request_apb_clk(clocks);
3367 self.enable_function_clock_impl(clocks, true);
3368 }
3369 }
3370 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3371 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3372 if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3373 {
3374 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3375 self.enable_function_clock_impl(clocks, false);
3376 release_apb_clk(clocks);
3377 }
3378 }
3379 pub fn function_clock_frequency(self) -> u32 {
3380 apb_clk_frequency()
3381 }
3382 pub fn function_clock_source_frequency() -> u32 {
3383 apb_clk_frequency()
3384 }
3385 }
3386 impl I2cInstance {
3387 pub fn configure_function_clock(
3388 self,
3389 clocks: &mut ClockTree,
3390 config: I2cFunctionClockConfig,
3391 ) {
3392 let old_config = clocks.i2c_function_clock[self as usize].replace(config);
3393 refresh_i2c_function_clock_downstream(clocks, self);
3394 if clocks.i2c_function_clock_refcount[self as usize] > 0 {
3395 match config.sclk {
3396 I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3397 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3398 }
3399 self.configure_function_clock_impl(clocks, old_config, config);
3400 if let Some(old_config) = old_config {
3401 match old_config.sclk {
3402 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3403 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3404 }
3405 }
3406 } else {
3407 self.configure_function_clock_impl(clocks, old_config, config);
3408 }
3409 }
3410 pub fn function_clock_config(
3411 self,
3412 clocks: &mut ClockTree,
3413 ) -> Option<I2cFunctionClockConfig> {
3414 clocks.i2c_function_clock[self as usize]
3415 }
3416 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3417 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3418 if increment_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3419 {
3420 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3421 crate::rtc_cntl::WakeLock::acquire();
3422 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3423 I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3424 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3425 }
3426 self.enable_function_clock_impl(clocks, true);
3427 }
3428 }
3429 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3430 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3431 if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3432 {
3433 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3434 crate::rtc_cntl::WakeLock::release();
3435 self.enable_function_clock_impl(clocks, false);
3436 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3437 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3438 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3439 }
3440 }
3441 }
3442 #[allow(unused_variables)]
3443 pub fn function_clock_config_frequency(
3444 clocks: &mut ClockTree,
3445 config: I2cFunctionClockConfig,
3446 ) -> u32 {
3447 (match config.sclk {
3448 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3449 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3450 } / (config.div_num() + 1))
3451 }
3452 pub fn function_clock_frequency(self) -> u32 {
3453 I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3454 .load(::core::sync::atomic::Ordering::Acquire)
3455 }
3456 pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
3457 match sclk {
3458 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3459 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3460 }
3461 }
3462 }
3463 impl LcdCamInstance {
3464 pub fn configure_lcd_clock(self, clocks: &mut ClockTree, config: LcdCamLcdClockConfig) {
3465 let old_config = clocks.lcd_cam_lcd_clock[self as usize].replace(config);
3466 refresh_lcd_cam_lcd_clock_downstream(clocks, self);
3467 if clocks.lcd_cam_lcd_clock_refcount[self as usize] > 0 {
3468 match config.sclk {
3469 LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
3470 LcdCamLcdClockSclk::PllD2 => request_pll_d2(clocks),
3471 LcdCamLcdClockSclk::Pll160m => request_pll_160m(clocks),
3472 }
3473 self.configure_lcd_clock_impl(clocks, old_config, config);
3474 if let Some(old_config) = old_config {
3475 match old_config.sclk {
3476 LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
3477 LcdCamLcdClockSclk::PllD2 => release_pll_d2(clocks),
3478 LcdCamLcdClockSclk::Pll160m => release_pll_160m(clocks),
3479 }
3480 }
3481 } else {
3482 self.configure_lcd_clock_impl(clocks, old_config, config);
3483 }
3484 }
3485 pub fn lcd_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamLcdClockConfig> {
3486 clocks.lcd_cam_lcd_clock[self as usize]
3487 }
3488 pub fn request_lcd_clock(self, clocks: &mut ClockTree) {
3489 trace!("Requesting {:?}::LCD_CLOCK", self);
3490 if increment_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
3491 {
3492 trace!("Enabling {:?}::LCD_CLOCK", self);
3493 crate::rtc_cntl::WakeLock::acquire();
3494 match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
3495 LcdCamLcdClockSclk::XtalClk => request_xtal_clk(clocks),
3496 LcdCamLcdClockSclk::PllD2 => request_pll_d2(clocks),
3497 LcdCamLcdClockSclk::Pll160m => request_pll_160m(clocks),
3498 }
3499 self.enable_lcd_clock_impl(clocks, true);
3500 }
3501 }
3502 pub fn release_lcd_clock(self, clocks: &mut ClockTree) {
3503 trace!("Releasing {:?}::LCD_CLOCK", self);
3504 if decrement_reference_count(&mut clocks.lcd_cam_lcd_clock_refcount[self as usize])
3505 {
3506 trace!("Disabling {:?}::LCD_CLOCK", self);
3507 crate::rtc_cntl::WakeLock::release();
3508 self.enable_lcd_clock_impl(clocks, false);
3509 match unwrap!(clocks.lcd_cam_lcd_clock[self as usize]).sclk {
3510 LcdCamLcdClockSclk::XtalClk => release_xtal_clk(clocks),
3511 LcdCamLcdClockSclk::PllD2 => release_pll_d2(clocks),
3512 LcdCamLcdClockSclk::Pll160m => release_pll_160m(clocks),
3513 }
3514 }
3515 }
3516 #[allow(unused_variables)]
3517 pub fn lcd_clock_config_frequency(
3518 clocks: &mut ClockTree,
3519 config: LcdCamLcdClockConfig,
3520 ) -> u32 {
3521 (((match config.sclk {
3522 LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
3523 LcdCamLcdClockSclk::PllD2 => pll_d2_frequency(),
3524 LcdCamLcdClockSclk::Pll160m => pll_160m_frequency(),
3525 } as u64)
3526 * (config.div_a() as u64))
3527 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3528 as u32
3529 }
3530 pub fn lcd_clock_frequency(self) -> u32 {
3531 LCD_CAM_LCD_CLOCK_FREQ_CACHE[self as usize]
3532 .load(::core::sync::atomic::Ordering::Acquire)
3533 }
3534 pub fn lcd_clock_source_frequency(sclk: LcdCamLcdClockSclk) -> u32 {
3535 match sclk {
3536 LcdCamLcdClockSclk::XtalClk => xtal_clk_frequency(),
3537 LcdCamLcdClockSclk::PllD2 => pll_d2_frequency(),
3538 LcdCamLcdClockSclk::Pll160m => pll_160m_frequency(),
3539 }
3540 }
3541 pub fn configure_cam_clock(self, clocks: &mut ClockTree, config: LcdCamCamClockConfig) {
3542 let old_config = clocks.lcd_cam_cam_clock[self as usize].replace(config);
3543 refresh_lcd_cam_cam_clock_downstream(clocks, self);
3544 if clocks.lcd_cam_cam_clock_refcount[self as usize] > 0 {
3545 match config.sclk {
3546 LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
3547 LcdCamCamClockSclk::PllD2 => request_pll_d2(clocks),
3548 LcdCamCamClockSclk::Pll160m => request_pll_160m(clocks),
3549 }
3550 self.configure_cam_clock_impl(clocks, old_config, config);
3551 if let Some(old_config) = old_config {
3552 match old_config.sclk {
3553 LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
3554 LcdCamCamClockSclk::PllD2 => release_pll_d2(clocks),
3555 LcdCamCamClockSclk::Pll160m => release_pll_160m(clocks),
3556 }
3557 }
3558 } else {
3559 self.configure_cam_clock_impl(clocks, old_config, config);
3560 }
3561 }
3562 pub fn cam_clock_config(self, clocks: &mut ClockTree) -> Option<LcdCamCamClockConfig> {
3563 clocks.lcd_cam_cam_clock[self as usize]
3564 }
3565 pub fn request_cam_clock(self, clocks: &mut ClockTree) {
3566 trace!("Requesting {:?}::CAM_CLOCK", self);
3567 if increment_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
3568 {
3569 trace!("Enabling {:?}::CAM_CLOCK", self);
3570 crate::rtc_cntl::WakeLock::acquire();
3571 match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
3572 LcdCamCamClockSclk::XtalClk => request_xtal_clk(clocks),
3573 LcdCamCamClockSclk::PllD2 => request_pll_d2(clocks),
3574 LcdCamCamClockSclk::Pll160m => request_pll_160m(clocks),
3575 }
3576 self.enable_cam_clock_impl(clocks, true);
3577 }
3578 }
3579 pub fn release_cam_clock(self, clocks: &mut ClockTree) {
3580 trace!("Releasing {:?}::CAM_CLOCK", self);
3581 if decrement_reference_count(&mut clocks.lcd_cam_cam_clock_refcount[self as usize])
3582 {
3583 trace!("Disabling {:?}::CAM_CLOCK", self);
3584 crate::rtc_cntl::WakeLock::release();
3585 self.enable_cam_clock_impl(clocks, false);
3586 match unwrap!(clocks.lcd_cam_cam_clock[self as usize]).sclk {
3587 LcdCamCamClockSclk::XtalClk => release_xtal_clk(clocks),
3588 LcdCamCamClockSclk::PllD2 => release_pll_d2(clocks),
3589 LcdCamCamClockSclk::Pll160m => release_pll_160m(clocks),
3590 }
3591 }
3592 }
3593 #[allow(unused_variables)]
3594 pub fn cam_clock_config_frequency(
3595 clocks: &mut ClockTree,
3596 config: LcdCamCamClockConfig,
3597 ) -> u32 {
3598 (((match config.sclk {
3599 LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
3600 LcdCamCamClockSclk::PllD2 => pll_d2_frequency(),
3601 LcdCamCamClockSclk::Pll160m => pll_160m_frequency(),
3602 } as u64)
3603 * (config.div_a() as u64))
3604 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3605 as u32
3606 }
3607 pub fn cam_clock_frequency(self) -> u32 {
3608 LCD_CAM_CAM_CLOCK_FREQ_CACHE[self as usize]
3609 .load(::core::sync::atomic::Ordering::Acquire)
3610 }
3611 pub fn cam_clock_source_frequency(sclk: LcdCamCamClockSclk) -> u32 {
3612 match sclk {
3613 LcdCamCamClockSclk::XtalClk => xtal_clk_frequency(),
3614 LcdCamCamClockSclk::PllD2 => pll_d2_frequency(),
3615 LcdCamCamClockSclk::Pll160m => pll_160m_frequency(),
3616 }
3617 }
3618 }
3619 impl McpwmInstance {
3620 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3621 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3622 if increment_reference_count(
3623 &mut clocks.mcpwm_function_clock_refcount[self as usize],
3624 ) {
3625 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3626 crate::rtc_cntl::WakeLock::acquire();
3627 request_crypto_pwm_clk(clocks);
3628 self.enable_function_clock_impl(clocks, true);
3629 }
3630 }
3631 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3632 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3633 if decrement_reference_count(
3634 &mut clocks.mcpwm_function_clock_refcount[self as usize],
3635 ) {
3636 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3637 crate::rtc_cntl::WakeLock::release();
3638 self.enable_function_clock_impl(clocks, false);
3639 release_crypto_pwm_clk(clocks);
3640 }
3641 }
3642 pub fn function_clock_frequency(self) -> u32 {
3643 crypto_pwm_clk_frequency()
3644 }
3645 pub fn function_clock_source_frequency(source: McpwmFunctionClockConfig) -> u32 {
3646 match source {
3647 McpwmFunctionClockConfig::CryptoPwmClk => crypto_pwm_clk_frequency(),
3648 }
3649 }
3650 }
3651 impl RmtInstance {
3652 pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
3653 let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
3654 refresh_rmt_sclk_downstream(clocks, self);
3655 if clocks.rmt_sclk_refcount[self as usize] > 0 {
3656 match new_selector {
3657 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
3658 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
3659 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
3660 }
3661 self.configure_sclk_impl(clocks, old_selector, new_selector);
3662 if let Some(old_selector) = old_selector {
3663 match old_selector {
3664 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
3665 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
3666 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
3667 }
3668 }
3669 } else {
3670 self.configure_sclk_impl(clocks, old_selector, new_selector);
3671 }
3672 }
3673 pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
3674 clocks.rmt_sclk[self as usize]
3675 }
3676 pub fn request_sclk(self, clocks: &mut ClockTree) {
3677 trace!("Requesting {:?}::SCLK", self);
3678 if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3679 trace!("Enabling {:?}::SCLK", self);
3680 crate::rtc_cntl::WakeLock::acquire();
3681 match unwrap!(clocks.rmt_sclk[self as usize]) {
3682 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
3683 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
3684 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
3685 }
3686 self.enable_sclk_impl(clocks, true);
3687 }
3688 }
3689 pub fn release_sclk(self, clocks: &mut ClockTree) {
3690 trace!("Releasing {:?}::SCLK", self);
3691 if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3692 trace!("Disabling {:?}::SCLK", self);
3693 crate::rtc_cntl::WakeLock::release();
3694 self.enable_sclk_impl(clocks, false);
3695 match unwrap!(clocks.rmt_sclk[self as usize]) {
3696 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
3697 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
3698 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
3699 }
3700 }
3701 }
3702 #[allow(unused_variables)]
3703 pub fn sclk_config_frequency(clocks: &mut ClockTree, config: RmtSclkConfig) -> u32 {
3704 match config {
3705 RmtSclkConfig::ApbClk => apb_clk_frequency(),
3706 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
3707 RmtSclkConfig::XtalClk => xtal_clk_frequency(),
3708 }
3709 }
3710 pub fn sclk_frequency(self) -> u32 {
3711 RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3712 }
3713 pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
3714 match source {
3715 RmtSclkConfig::ApbClk => apb_clk_frequency(),
3716 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
3717 RmtSclkConfig::XtalClk => xtal_clk_frequency(),
3718 }
3719 }
3720 }
3721 impl SpiInstance {
3722 pub fn configure_function_clock(
3723 self,
3724 clocks: &mut ClockTree,
3725 new_selector: SpiFunctionClockConfig,
3726 ) {
3727 let old_selector = clocks.spi_function_clock[self as usize].replace(new_selector);
3728 refresh_spi_function_clock_downstream(clocks, self);
3729 if clocks.spi_function_clock_refcount[self as usize] > 0 {
3730 match new_selector {
3731 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
3732 SpiFunctionClockConfig::Apb => request_apb_clk(clocks),
3733 }
3734 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3735 if let Some(old_selector) = old_selector {
3736 match old_selector {
3737 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
3738 SpiFunctionClockConfig::Apb => release_apb_clk(clocks),
3739 }
3740 }
3741 } else {
3742 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3743 }
3744 }
3745 pub fn function_clock_config(
3746 self,
3747 clocks: &mut ClockTree,
3748 ) -> Option<SpiFunctionClockConfig> {
3749 clocks.spi_function_clock[self as usize]
3750 }
3751 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3752 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3753 if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3754 {
3755 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3756 crate::rtc_cntl::WakeLock::acquire();
3757 match unwrap!(clocks.spi_function_clock[self as usize]) {
3758 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
3759 SpiFunctionClockConfig::Apb => request_apb_clk(clocks),
3760 }
3761 self.enable_function_clock_impl(clocks, true);
3762 }
3763 }
3764 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3765 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3766 if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3767 {
3768 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3769 crate::rtc_cntl::WakeLock::release();
3770 self.enable_function_clock_impl(clocks, false);
3771 match unwrap!(clocks.spi_function_clock[self as usize]) {
3772 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
3773 SpiFunctionClockConfig::Apb => release_apb_clk(clocks),
3774 }
3775 }
3776 }
3777 #[allow(unused_variables)]
3778 pub fn function_clock_config_frequency(
3779 clocks: &mut ClockTree,
3780 config: SpiFunctionClockConfig,
3781 ) -> u32 {
3782 match config {
3783 SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
3784 SpiFunctionClockConfig::Apb => apb_clk_frequency(),
3785 }
3786 }
3787 pub fn function_clock_frequency(self) -> u32 {
3788 SPI_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3789 .load(::core::sync::atomic::Ordering::Acquire)
3790 }
3791 pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
3792 match source {
3793 SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
3794 SpiFunctionClockConfig::Apb => apb_clk_frequency(),
3795 }
3796 }
3797 }
3798 impl TimgInstance {
3799 pub fn configure_function_clock(
3800 self,
3801 clocks: &mut ClockTree,
3802 new_selector: TimgFunctionClockConfig,
3803 ) {
3804 let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
3805 refresh_timg_function_clock_downstream(clocks, self);
3806 if clocks.timg_function_clock_refcount[self as usize] > 0 {
3807 match new_selector {
3808 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
3809 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
3810 }
3811 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3812 if let Some(old_selector) = old_selector {
3813 match old_selector {
3814 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
3815 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
3816 }
3817 }
3818 } else {
3819 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3820 }
3821 }
3822 pub fn function_clock_config(
3823 self,
3824 clocks: &mut ClockTree,
3825 ) -> Option<TimgFunctionClockConfig> {
3826 clocks.timg_function_clock[self as usize]
3827 }
3828 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3829 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3830 if increment_reference_count(
3831 &mut clocks.timg_function_clock_refcount[self as usize],
3832 ) {
3833 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3834 match unwrap!(clocks.timg_function_clock[self as usize]) {
3835 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
3836 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
3837 }
3838 self.enable_function_clock_impl(clocks, true);
3839 }
3840 }
3841 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3842 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3843 if decrement_reference_count(
3844 &mut clocks.timg_function_clock_refcount[self as usize],
3845 ) {
3846 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3847 self.enable_function_clock_impl(clocks, false);
3848 match unwrap!(clocks.timg_function_clock[self as usize]) {
3849 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
3850 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
3851 }
3852 }
3853 }
3854 #[allow(unused_variables)]
3855 pub fn function_clock_config_frequency(
3856 clocks: &mut ClockTree,
3857 config: TimgFunctionClockConfig,
3858 ) -> u32 {
3859 match config {
3860 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
3861 TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
3862 }
3863 }
3864 pub fn function_clock_frequency(self) -> u32 {
3865 TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3866 .load(::core::sync::atomic::Ordering::Acquire)
3867 }
3868 pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
3869 match source {
3870 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
3871 TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
3872 }
3873 }
3874 }
3875 impl UartInstance {
3876 pub fn configure_function_clock(
3877 self,
3878 clocks: &mut ClockTree,
3879 config: UartFunctionClockConfig,
3880 ) {
3881 let old_config = clocks.uart_function_clock[self as usize].replace(config);
3882 refresh_uart_function_clock_downstream(clocks, self);
3883 if clocks.uart_function_clock_refcount[self as usize] > 0 {
3884 match config.sclk {
3885 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
3886 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3887 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3888 }
3889 self.configure_function_clock_impl(clocks, old_config, config);
3890 if let Some(old_config) = old_config {
3891 match old_config.sclk {
3892 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
3893 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3894 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3895 }
3896 }
3897 } else {
3898 self.configure_function_clock_impl(clocks, old_config, config);
3899 }
3900 }
3901 pub fn function_clock_config(
3902 self,
3903 clocks: &mut ClockTree,
3904 ) -> Option<UartFunctionClockConfig> {
3905 clocks.uart_function_clock[self as usize]
3906 }
3907 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3908 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3909 if increment_reference_count(
3910 &mut clocks.uart_function_clock_refcount[self as usize],
3911 ) {
3912 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3913 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3914 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
3915 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3916 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3917 }
3918 self.enable_function_clock_impl(clocks, true);
3919 }
3920 }
3921 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3922 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3923 if decrement_reference_count(
3924 &mut clocks.uart_function_clock_refcount[self as usize],
3925 ) {
3926 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3927 self.enable_function_clock_impl(clocks, false);
3928 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3929 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
3930 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3931 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3932 }
3933 }
3934 }
3935 #[allow(unused_variables)]
3936 pub fn function_clock_config_frequency(
3937 clocks: &mut ClockTree,
3938 config: UartFunctionClockConfig,
3939 ) -> u32 {
3940 (match config.sclk {
3941 UartFunctionClockSclk::Apb => apb_clk_frequency(),
3942 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3943 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
3944 } / (config.div_num() + 1))
3945 }
3946 pub fn function_clock_frequency(self) -> u32 {
3947 UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3948 .load(::core::sync::atomic::Ordering::Acquire)
3949 }
3950 pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
3951 match sclk {
3952 UartFunctionClockSclk::Apb => apb_clk_frequency(),
3953 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3954 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
3955 }
3956 }
3957 pub fn configure_baud_rate_generator(
3958 self,
3959 clocks: &mut ClockTree,
3960 config: UartBaudRateGeneratorConfig,
3961 ) {
3962 let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
3963 refresh_uart_baud_rate_generator_downstream(clocks, self);
3964 self.configure_baud_rate_generator_impl(clocks, old_config, config);
3965 }
3966 pub fn baud_rate_generator_config(
3967 self,
3968 clocks: &mut ClockTree,
3969 ) -> Option<UartBaudRateGeneratorConfig> {
3970 clocks.uart_baud_rate_generator[self as usize]
3971 }
3972 pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
3973 trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
3974 if increment_reference_count(
3975 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3976 ) {
3977 trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
3978 self.request_function_clock(clocks);
3979 self.enable_baud_rate_generator_impl(clocks, true);
3980 }
3981 }
3982 pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
3983 trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
3984 if decrement_reference_count(
3985 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3986 ) {
3987 trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
3988 self.enable_baud_rate_generator_impl(clocks, false);
3989 self.release_function_clock(clocks);
3990 }
3991 }
3992 #[allow(unused_variables)]
3993 pub fn baud_rate_generator_config_frequency(
3994 self,
3995 clocks: &mut ClockTree,
3996 config: UartBaudRateGeneratorConfig,
3997 ) -> u32 {
3998 ((self.function_clock_frequency() * 16)
3999 / ((config.integral() * 16) + config.fractional()))
4000 }
4001 pub fn baud_rate_generator_frequency(self) -> u32 {
4002 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
4003 .load(::core::sync::atomic::Ordering::Acquire)
4004 }
4005 pub fn request_mem_clock(self, clocks: &mut ClockTree) {
4006 trace!("Requesting {:?}::MEM_CLOCK", self);
4007 if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
4008 trace!("Enabling {:?}::MEM_CLOCK", self);
4009 request_uart_mem_clk(clocks);
4010 self.enable_mem_clock_impl(clocks, true);
4011 }
4012 }
4013 pub fn release_mem_clock(self, clocks: &mut ClockTree) {
4014 trace!("Releasing {:?}::MEM_CLOCK", self);
4015 if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
4016 trace!("Disabling {:?}::MEM_CLOCK", self);
4017 self.enable_mem_clock_impl(clocks, false);
4018 release_uart_mem_clk(clocks);
4019 }
4020 }
4021 pub fn mem_clock_frequency(self) -> u32 {
4022 uart_mem_clk_frequency()
4023 }
4024 pub fn mem_clock_source_frequency() -> u32 {
4025 uart_mem_clk_frequency()
4026 }
4027 }
4028 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4036 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4037 #[instability::unstable]
4038 pub struct ClockConfig {
4039 pub xtal_clk: Option<XtalClkConfig>,
4041 pub pll_clk: Option<PllClkConfig>,
4043 pub system_pre_div: Option<SystemPreDivConfig>,
4045 pub cpu_pll_div_out: Option<CpuPllDivOutConfig>,
4047 pub cpu_clk: Option<CpuClkConfig>,
4049 pub rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
4051 pub rtc_slow_clk: Option<RtcSlowClkConfig>,
4053 pub rtc_fast_clk: Option<RtcFastClkConfig>,
4055 pub low_power_clk: Option<LowPowerClkConfig>,
4057 pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
4059 }
4060 impl ClockConfig {
4061 fn apply(&self, clocks: &mut ClockTree) {
4062 if let Some(config) = self.xtal_clk {
4063 configure_xtal_clk(clocks, config);
4064 }
4065 if let Some(config) = self.pll_clk {
4066 configure_pll_clk(clocks, config);
4067 }
4068 if let Some(config) = self.system_pre_div {
4069 configure_system_pre_div(clocks, config);
4070 }
4071 if let Some(config) = self.cpu_pll_div_out {
4072 configure_cpu_pll_div_out(clocks, config);
4073 }
4074 if let Some(config) = self.cpu_clk {
4075 configure_cpu_clk(clocks, config);
4076 }
4077 if let Some(config) = self.rc_fast_clk_div_n {
4078 configure_rc_fast_clk_div_n(clocks, config);
4079 }
4080 if let Some(config) = self.rtc_slow_clk {
4081 configure_rtc_slow_clk(clocks, config);
4082 }
4083 if let Some(config) = self.rtc_fast_clk {
4084 configure_rtc_fast_clk(clocks, config);
4085 }
4086 if let Some(config) = self.low_power_clk {
4087 configure_low_power_clk(clocks, config);
4088 }
4089 if let Some(config) = self.timg_calibration_clock {
4090 configure_timg_calibration_clock(clocks, config);
4091 }
4092 }
4093 }
4094 fn increment_reference_count(refcount: &mut u32) -> bool {
4095 let first = *refcount == 0;
4096 *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
4097 first
4098 }
4099 fn decrement_reference_count(refcount: &mut u32) -> bool {
4100 *refcount = refcount.saturating_sub(1);
4101 let last = *refcount == 0;
4102 last
4103 }
4104 fn refresh_xtal_clk_downstream(clocks: &mut ClockTree) {
4105 if let Some(config) = clocks.xtal_clk {
4106 XTAL_CLK_FREQ_CACHE.store(
4107 xtal_clk_config_frequency(clocks, config),
4108 ::core::sync::atomic::Ordering::Release,
4109 );
4110 }
4111 refresh_pll_clk_downstream(clocks);
4112 refresh_system_pre_div_in_downstream(clocks);
4113 refresh_rtc_fast_clk_downstream(clocks);
4114 refresh_low_power_clk_downstream(clocks);
4115 for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
4116 refresh_i2c_function_clock_downstream(clocks, child_instance);
4117 }
4118 for child_instance in [LcdCamInstance::LcdCam] {
4119 refresh_lcd_cam_lcd_clock_downstream(clocks, child_instance);
4120 refresh_lcd_cam_cam_clock_downstream(clocks, child_instance);
4121 }
4122 for child_instance in [RmtInstance::Rmt] {
4123 refresh_rmt_sclk_downstream(clocks, child_instance);
4124 }
4125 for child_instance in [SpiInstance::Spi2, SpiInstance::Spi3] {
4126 refresh_spi_function_clock_downstream(clocks, child_instance);
4127 }
4128 for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
4129 refresh_timg_function_clock_downstream(clocks, child_instance);
4130 }
4131 for child_instance in [
4132 UartInstance::Uart0,
4133 UartInstance::Uart1,
4134 UartInstance::Uart2,
4135 ] {
4136 refresh_uart_function_clock_downstream(clocks, child_instance);
4137 }
4138 }
4139 fn refresh_pll_clk_downstream(clocks: &mut ClockTree) {
4140 if let Some(config) = clocks.pll_clk {
4141 PLL_CLK_FREQ_CACHE.store(
4142 pll_clk_config_frequency(clocks, config),
4143 ::core::sync::atomic::Ordering::Release,
4144 );
4145 }
4146 refresh_cpu_pll_div_out_downstream(clocks);
4147 for child_instance in [LcdCamInstance::LcdCam] {
4148 refresh_lcd_cam_lcd_clock_downstream(clocks, child_instance);
4149 refresh_lcd_cam_cam_clock_downstream(clocks, child_instance);
4150 }
4151 }
4152 fn refresh_system_pre_div_in_downstream(clocks: &mut ClockTree) {
4153 if let Some(config) = clocks.system_pre_div_in {
4154 SYSTEM_PRE_DIV_IN_FREQ_CACHE.store(
4155 system_pre_div_in_config_frequency(clocks, config),
4156 ::core::sync::atomic::Ordering::Release,
4157 );
4158 }
4159 refresh_system_pre_div_downstream(clocks);
4160 }
4161 fn refresh_system_pre_div_downstream(clocks: &mut ClockTree) {
4162 if let Some(config) = clocks.system_pre_div {
4163 SYSTEM_PRE_DIV_FREQ_CACHE.store(
4164 system_pre_div_config_frequency(clocks, config),
4165 ::core::sync::atomic::Ordering::Release,
4166 );
4167 }
4168 refresh_cpu_clk_downstream(clocks);
4169 }
4170 fn refresh_cpu_pll_div_out_downstream(clocks: &mut ClockTree) {
4171 if let Some(config) = clocks.cpu_pll_div_out {
4172 CPU_PLL_DIV_OUT_FREQ_CACHE.store(
4173 cpu_pll_div_out_config_frequency(clocks, config),
4174 ::core::sync::atomic::Ordering::Release,
4175 );
4176 }
4177 refresh_cpu_clk_downstream(clocks);
4178 }
4179 fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
4180 if let Some(config) = clocks.cpu_clk {
4181 CPU_CLK_FREQ_CACHE.store(
4182 cpu_clk_config_frequency(clocks, config),
4183 ::core::sync::atomic::Ordering::Release,
4184 );
4185 }
4186 refresh_apb_clk_downstream(clocks);
4187 refresh_crypto_pwm_clk_downstream(clocks);
4188 for child_instance in [LcdCamInstance::LcdCam] {
4189 refresh_lcd_cam_lcd_clock_downstream(clocks, child_instance);
4190 refresh_lcd_cam_cam_clock_downstream(clocks, child_instance);
4191 }
4192 }
4193 fn refresh_rc_fast_clk_div_n_downstream(clocks: &mut ClockTree) {
4194 if let Some(config) = clocks.rc_fast_clk_div_n {
4195 RC_FAST_CLK_DIV_N_FREQ_CACHE.store(
4196 rc_fast_clk_div_n_config_frequency(clocks, config),
4197 ::core::sync::atomic::Ordering::Release,
4198 );
4199 }
4200 refresh_rtc_fast_clk_downstream(clocks);
4201 }
4202 fn refresh_rtc_slow_clk_downstream(clocks: &mut ClockTree) {
4203 if let Some(config) = clocks.rtc_slow_clk {
4204 RTC_SLOW_CLK_FREQ_CACHE.store(
4205 rtc_slow_clk_config_frequency(clocks, config),
4206 ::core::sync::atomic::Ordering::Release,
4207 );
4208 }
4209 refresh_low_power_clk_downstream(clocks);
4210 }
4211 fn refresh_rtc_fast_clk_downstream(clocks: &mut ClockTree) {
4212 if let Some(config) = clocks.rtc_fast_clk {
4213 RTC_FAST_CLK_FREQ_CACHE.store(
4214 rtc_fast_clk_config_frequency(clocks, config),
4215 ::core::sync::atomic::Ordering::Release,
4216 );
4217 }
4218 }
4219 fn refresh_low_power_clk_downstream(clocks: &mut ClockTree) {
4220 if let Some(config) = clocks.low_power_clk {
4221 LOW_POWER_CLK_FREQ_CACHE.store(
4222 low_power_clk_config_frequency(clocks, config),
4223 ::core::sync::atomic::Ordering::Release,
4224 );
4225 }
4226 }
4227 fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
4228 if let Some(config) = clocks.timg_calibration_clock {
4229 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
4230 timg_calibration_clock_config_frequency(clocks, config),
4231 ::core::sync::atomic::Ordering::Release,
4232 );
4233 }
4234 }
4235 fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
4236 if let Some(config) = clocks.i2c_function_clock[instance as usize] {
4237 I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4238 I2cInstance::function_clock_config_frequency(clocks, config),
4239 ::core::sync::atomic::Ordering::Release,
4240 );
4241 }
4242 }
4243 fn refresh_lcd_cam_lcd_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
4244 if let Some(config) = clocks.lcd_cam_lcd_clock[instance as usize] {
4245 LCD_CAM_LCD_CLOCK_FREQ_CACHE[instance as usize].store(
4246 LcdCamInstance::lcd_clock_config_frequency(clocks, config),
4247 ::core::sync::atomic::Ordering::Release,
4248 );
4249 }
4250 }
4251 fn refresh_lcd_cam_cam_clock_downstream(clocks: &mut ClockTree, instance: LcdCamInstance) {
4252 if let Some(config) = clocks.lcd_cam_cam_clock[instance as usize] {
4253 LCD_CAM_CAM_CLOCK_FREQ_CACHE[instance as usize].store(
4254 LcdCamInstance::cam_clock_config_frequency(clocks, config),
4255 ::core::sync::atomic::Ordering::Release,
4256 );
4257 }
4258 }
4259 fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
4260 if let Some(config) = clocks.apb_clk {
4261 APB_CLK_FREQ_CACHE.store(
4262 apb_clk_config_frequency(clocks, config),
4263 ::core::sync::atomic::Ordering::Release,
4264 );
4265 }
4266 for child_instance in [RmtInstance::Rmt] {
4267 refresh_rmt_sclk_downstream(clocks, child_instance);
4268 }
4269 for child_instance in [SpiInstance::Spi2, SpiInstance::Spi3] {
4270 refresh_spi_function_clock_downstream(clocks, child_instance);
4271 }
4272 for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
4273 refresh_timg_function_clock_downstream(clocks, child_instance);
4274 }
4275 for child_instance in [
4276 UartInstance::Uart0,
4277 UartInstance::Uart1,
4278 UartInstance::Uart2,
4279 ] {
4280 refresh_uart_function_clock_downstream(clocks, child_instance);
4281 }
4282 }
4283 fn refresh_crypto_pwm_clk_downstream(clocks: &mut ClockTree) {
4284 if let Some(config) = clocks.crypto_pwm_clk {
4285 CRYPTO_PWM_CLK_FREQ_CACHE.store(
4286 crypto_pwm_clk_config_frequency(clocks, config),
4287 ::core::sync::atomic::Ordering::Release,
4288 );
4289 }
4290 }
4291 fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
4292 if let Some(config) = clocks.rmt_sclk[instance as usize] {
4293 RMT_SCLK_FREQ_CACHE[instance as usize].store(
4294 RmtInstance::sclk_config_frequency(clocks, config),
4295 ::core::sync::atomic::Ordering::Release,
4296 );
4297 }
4298 }
4299 fn refresh_spi_function_clock_downstream(clocks: &mut ClockTree, instance: SpiInstance) {
4300 if let Some(config) = clocks.spi_function_clock[instance as usize] {
4301 SPI_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4302 SpiInstance::function_clock_config_frequency(clocks, config),
4303 ::core::sync::atomic::Ordering::Release,
4304 );
4305 }
4306 }
4307 fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
4308 if let Some(config) = clocks.timg_function_clock[instance as usize] {
4309 TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4310 TimgInstance::function_clock_config_frequency(clocks, config),
4311 ::core::sync::atomic::Ordering::Release,
4312 );
4313 }
4314 }
4315 fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
4316 if let Some(config) = clocks.uart_function_clock[instance as usize] {
4317 UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
4318 UartInstance::function_clock_config_frequency(clocks, config),
4319 ::core::sync::atomic::Ordering::Release,
4320 );
4321 }
4322 refresh_uart_baud_rate_generator_downstream(clocks, instance);
4323 }
4324 fn refresh_uart_baud_rate_generator_downstream(
4325 clocks: &mut ClockTree,
4326 instance: UartInstance,
4327 ) {
4328 if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
4329 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
4330 instance.baud_rate_generator_config_frequency(clocks, config),
4331 ::core::sync::atomic::Ordering::Release,
4332 );
4333 }
4334 }
4335 };
4336}
4337#[macro_export]
4341#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4342macro_rules! implement_peripheral_clocks {
4343 () => {
4344 #[doc(hidden)]
4345 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4346 #[repr(u8)]
4347 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4348 pub enum Peripheral {
4349 Aes,
4351 AhbGdma,
4353 ApbSarAdc,
4355 DedicatedGpio,
4357 Ds,
4359 GpioSd,
4361 Hmac,
4363 I2cExt0,
4365 I2cExt1,
4367 I2s0,
4369 I2s1,
4371 LcdCam,
4373 Ledc,
4375 Mcpwm0,
4377 Mcpwm1,
4379 Pcnt,
4381 PeriBackup,
4383 Rmt,
4385 Rsa,
4387 SdioHost,
4389 Sha,
4391 Spi2,
4393 Spi3,
4395 Systimer,
4397 Timg0,
4399 Timg1,
4401 Twai0,
4403 Uart0,
4405 Uart1,
4407 Uart2,
4409 UartMem,
4411 Uhci0,
4413 UsbDevice,
4415 UsbFs,
4417 }
4418 impl Peripheral {
4419 const KEEP_ENABLED: &[Peripheral] = &[
4420 Self::Systimer,
4421 Self::Timg0,
4422 Self::Uart0,
4423 Self::UartMem,
4424 Self::UsbDevice,
4425 ];
4426 const COUNT: usize = Self::ALL.len();
4427 const ALL: &[Self] = &[
4428 Self::Aes,
4429 Self::AhbGdma,
4430 Self::ApbSarAdc,
4431 Self::DedicatedGpio,
4432 Self::Ds,
4433 Self::GpioSd,
4434 Self::Hmac,
4435 Self::I2cExt0,
4436 Self::I2cExt1,
4437 Self::I2s0,
4438 Self::I2s1,
4439 Self::LcdCam,
4440 Self::Ledc,
4441 Self::Mcpwm0,
4442 Self::Mcpwm1,
4443 Self::Pcnt,
4444 Self::PeriBackup,
4445 Self::Rmt,
4446 Self::Rsa,
4447 Self::SdioHost,
4448 Self::Sha,
4449 Self::Spi2,
4450 Self::Spi3,
4451 Self::Systimer,
4452 Self::Timg0,
4453 Self::Timg1,
4454 Self::Twai0,
4455 Self::Uart0,
4456 Self::Uart1,
4457 Self::Uart2,
4458 Self::UartMem,
4459 Self::Uhci0,
4460 Self::UsbDevice,
4461 Self::UsbFs,
4462 ];
4463 }
4464 unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
4465 match peripheral {
4466 Peripheral::Aes => {
4467 crate::peripherals::SYSTEM::regs()
4468 .perip_clk_en1()
4469 .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
4470 }
4471 Peripheral::AhbGdma => {
4472 crate::peripherals::SYSTEM::regs()
4473 .perip_clk_en1()
4474 .modify(|_, w| w.dma_clk_en().bit(enable));
4475 }
4476 Peripheral::ApbSarAdc => {
4477 crate::peripherals::SYSTEM::regs()
4478 .perip_clk_en0()
4479 .modify(|_, w| w.apb_saradc_clk_en().bit(enable));
4480 }
4481 Peripheral::DedicatedGpio => {
4482 crate::peripherals::SYSTEM::regs()
4483 .cpu_peri_clk_en()
4484 .modify(|_, w| w.dedicated_gpio_clk_en().bit(enable));
4485 }
4486 Peripheral::Ds => {
4487 crate::peripherals::SYSTEM::regs()
4488 .perip_clk_en1()
4489 .modify(|_, w| w.crypto_ds_clk_en().bit(enable));
4490 }
4491 Peripheral::GpioSd => {
4492 crate::peripherals::GPIO_SD::regs()
4493 .clock_gate()
4494 .modify(|_, w| w.clk_en().bit(enable));
4495 }
4496 Peripheral::Hmac => {
4497 crate::peripherals::SYSTEM::regs()
4498 .perip_clk_en1()
4499 .modify(|_, w| w.crypto_hmac_clk_en().bit(enable));
4500 }
4501 Peripheral::I2cExt0 => {
4502 crate::peripherals::SYSTEM::regs()
4503 .perip_clk_en0()
4504 .modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
4505 }
4506 Peripheral::I2cExt1 => {
4507 crate::peripherals::SYSTEM::regs()
4508 .perip_clk_en0()
4509 .modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
4510 }
4511 Peripheral::I2s0 => {
4512 crate::peripherals::SYSTEM::regs()
4513 .perip_clk_en0()
4514 .modify(|_, w| w.i2s0_clk_en().bit(enable));
4515 }
4516 Peripheral::I2s1 => {
4517 crate::peripherals::SYSTEM::regs()
4518 .perip_clk_en0()
4519 .modify(|_, w| w.i2s1_clk_en().bit(enable));
4520 }
4521 Peripheral::LcdCam => {
4522 crate::peripherals::SYSTEM::regs()
4523 .perip_clk_en1()
4524 .modify(|_, w| w.lcd_cam_clk_en().bit(enable));
4525 }
4526 Peripheral::Ledc => {
4527 crate::peripherals::SYSTEM::regs()
4528 .perip_clk_en0()
4529 .modify(|_, w| w.ledc_clk_en().bit(enable));
4530 }
4531 Peripheral::Mcpwm0 => {
4532 crate::peripherals::SYSTEM::regs()
4533 .perip_clk_en0()
4534 .modify(|_, w| w.pwm0_clk_en().bit(enable));
4535 }
4536 Peripheral::Mcpwm1 => {
4537 crate::peripherals::SYSTEM::regs()
4538 .perip_clk_en0()
4539 .modify(|_, w| w.pwm1_clk_en().bit(enable));
4540 }
4541 Peripheral::Pcnt => {
4542 crate::peripherals::SYSTEM::regs()
4543 .perip_clk_en0()
4544 .modify(|_, w| w.pcnt_clk_en().bit(enable));
4545 }
4546 Peripheral::PeriBackup => {
4547 crate::peripherals::SYSTEM::regs()
4548 .perip_clk_en1()
4549 .modify(|_, w| w.peri_backup_clk_en().bit(enable));
4550 }
4551 Peripheral::Rmt => {
4552 crate::peripherals::SYSTEM::regs()
4553 .perip_clk_en0()
4554 .modify(|_, w| w.rmt_clk_en().bit(enable));
4555 }
4556 Peripheral::Rsa => {
4557 crate::peripherals::SYSTEM::regs()
4558 .perip_clk_en1()
4559 .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
4560 }
4561 Peripheral::SdioHost => {
4562 crate::peripherals::SYSTEM::regs()
4563 .perip_clk_en1()
4564 .modify(|_, w| w.sdio_host_clk_en().bit(enable));
4565 }
4566 Peripheral::Sha => {
4567 crate::peripherals::SYSTEM::regs()
4568 .perip_clk_en1()
4569 .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
4570 }
4571 Peripheral::Spi2 => {
4572 crate::peripherals::SYSTEM::regs()
4573 .perip_clk_en0()
4574 .modify(|_, w| w.spi2_clk_en().bit(enable));
4575 }
4576 Peripheral::Spi3 => {
4577 crate::peripherals::SYSTEM::regs()
4578 .perip_clk_en0()
4579 .modify(|_, w| w.spi3_clk_en().bit(enable));
4580 }
4581 Peripheral::Systimer => {
4582 crate::peripherals::SYSTEM::regs()
4583 .perip_clk_en0()
4584 .modify(|_, w| w.systimer_clk_en().bit(enable));
4585 }
4586 Peripheral::Timg0 => {
4587 crate::peripherals::SYSTEM::regs()
4588 .perip_clk_en0()
4589 .modify(|_, w| w.timergroup_clk_en().bit(enable));
4590 }
4591 Peripheral::Timg1 => {
4592 crate::peripherals::SYSTEM::regs()
4593 .perip_clk_en0()
4594 .modify(|_, w| w.timergroup1_clk_en().bit(enable));
4595 }
4596 Peripheral::Twai0 => {
4597 crate::peripherals::SYSTEM::regs()
4598 .perip_clk_en0()
4599 .modify(|_, w| w.twai_clk_en().bit(enable));
4600 }
4601 Peripheral::Uart0 => {
4602 crate::peripherals::SYSTEM::regs()
4603 .perip_clk_en0()
4604 .modify(|_, w| w.uart_clk_en().bit(enable));
4605 }
4606 Peripheral::Uart1 => {
4607 crate::peripherals::SYSTEM::regs()
4608 .perip_clk_en0()
4609 .modify(|_, w| w.uart1_clk_en().bit(enable));
4610 }
4611 Peripheral::Uart2 => {
4612 crate::peripherals::SYSTEM::regs()
4613 .perip_clk_en1()
4614 .modify(|_, w| w.uart2_clk_en().bit(enable));
4615 }
4616 Peripheral::UartMem => {
4617 crate::peripherals::SYSTEM::regs()
4618 .perip_clk_en0()
4619 .modify(|_, w| w.uart_mem_clk_en().bit(enable));
4620 }
4621 Peripheral::Uhci0 => {
4622 crate::peripherals::SYSTEM::regs()
4623 .perip_clk_en0()
4624 .modify(|_, w| w.uhci0_clk_en().bit(enable));
4625 }
4626 Peripheral::UsbDevice => {
4627 crate::peripherals::SYSTEM::regs()
4628 .perip_clk_en1()
4629 .modify(|_, w| w.usb_device_clk_en().bit(enable));
4630 }
4631 Peripheral::UsbFs => {
4632 crate::peripherals::SYSTEM::regs()
4633 .perip_clk_en0()
4634 .modify(|_, w| w.usb_clk_en().bit(enable));
4635 }
4636 }
4637 }
4638 unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
4639 match peripheral {
4640 Peripheral::Aes => {
4641 crate::peripherals::SYSTEM::regs()
4642 .perip_rst_en1()
4643 .modify(|_, w| w.crypto_aes_rst().bit(reset));
4644 }
4645 Peripheral::AhbGdma => {
4646 crate::peripherals::SYSTEM::regs()
4647 .perip_rst_en1()
4648 .modify(|_, w| w.dma_rst().bit(reset));
4649 }
4650 Peripheral::ApbSarAdc => {
4651 crate::peripherals::SYSTEM::regs()
4652 .perip_rst_en0()
4653 .modify(|_, w| w.apb_saradc_rst().bit(reset));
4654 }
4655 Peripheral::DedicatedGpio => {
4656 crate::peripherals::SYSTEM::regs()
4657 .cpu_peri_rst_en()
4658 .modify(|_, w| w.dedicated_gpio_rst().bit(reset));
4659 }
4660 Peripheral::Ds => {
4661 crate::peripherals::SYSTEM::regs()
4662 .perip_rst_en1()
4663 .modify(|_, w| w.crypto_ds_rst().bit(reset));
4664 }
4665 Peripheral::GpioSd => {
4666 let _ = reset;
4667 }
4668 Peripheral::Hmac => {
4669 crate::peripherals::SYSTEM::regs()
4670 .perip_rst_en1()
4671 .modify(|_, w| w.crypto_hmac_rst().bit(reset));
4672 }
4673 Peripheral::I2cExt0 => {
4674 crate::peripherals::SYSTEM::regs()
4675 .perip_rst_en0()
4676 .modify(|_, w| w.i2c_ext0_rst().bit(reset));
4677 }
4678 Peripheral::I2cExt1 => {
4679 crate::peripherals::SYSTEM::regs()
4680 .perip_rst_en0()
4681 .modify(|_, w| w.i2c_ext1_rst().bit(reset));
4682 }
4683 Peripheral::I2s0 => {
4684 crate::peripherals::SYSTEM::regs()
4685 .perip_rst_en0()
4686 .modify(|_, w| w.i2s0_rst().bit(reset));
4687 }
4688 Peripheral::I2s1 => {
4689 crate::peripherals::SYSTEM::regs()
4690 .perip_rst_en0()
4691 .modify(|_, w| w.i2s1_rst().bit(reset));
4692 }
4693 Peripheral::LcdCam => {
4694 crate::peripherals::SYSTEM::regs()
4695 .perip_rst_en1()
4696 .modify(|_, w| w.lcd_cam_rst().bit(reset));
4697 }
4698 Peripheral::Ledc => {
4699 crate::peripherals::SYSTEM::regs()
4700 .perip_rst_en0()
4701 .modify(|_, w| w.ledc_rst().bit(reset));
4702 }
4703 Peripheral::Mcpwm0 => {
4704 crate::peripherals::SYSTEM::regs()
4705 .perip_rst_en0()
4706 .modify(|_, w| w.pwm0_rst().bit(reset));
4707 }
4708 Peripheral::Mcpwm1 => {
4709 crate::peripherals::SYSTEM::regs()
4710 .perip_rst_en0()
4711 .modify(|_, w| w.pwm1_rst().bit(reset));
4712 }
4713 Peripheral::Pcnt => {
4714 crate::peripherals::SYSTEM::regs()
4715 .perip_rst_en0()
4716 .modify(|_, w| w.pcnt_rst().bit(reset));
4717 }
4718 Peripheral::PeriBackup => {
4719 crate::peripherals::SYSTEM::regs()
4720 .perip_rst_en1()
4721 .modify(|_, w| w.peri_backup_rst().bit(reset));
4722 }
4723 Peripheral::Rmt => {
4724 crate::peripherals::SYSTEM::regs()
4725 .perip_rst_en0()
4726 .modify(|_, w| w.rmt_rst().bit(reset));
4727 }
4728 Peripheral::Rsa => {
4729 crate::peripherals::SYSTEM::regs()
4730 .perip_rst_en1()
4731 .modify(|_, w| w.crypto_rsa_rst().bit(reset));
4732 }
4733 Peripheral::SdioHost => {
4734 crate::peripherals::SYSTEM::regs()
4735 .perip_rst_en1()
4736 .modify(|_, w| w.sdio_host_rst().bit(reset));
4737 }
4738 Peripheral::Sha => {
4739 crate::peripherals::SYSTEM::regs()
4740 .perip_rst_en1()
4741 .modify(|_, w| w.crypto_sha_rst().bit(reset));
4742 }
4743 Peripheral::Spi2 => {
4744 crate::peripherals::SYSTEM::regs()
4745 .perip_rst_en0()
4746 .modify(|_, w| w.spi2_rst().bit(reset));
4747 }
4748 Peripheral::Spi3 => {
4749 crate::peripherals::SYSTEM::regs()
4750 .perip_rst_en0()
4751 .modify(|_, w| w.spi3_rst().bit(reset));
4752 }
4753 Peripheral::Systimer => {
4754 crate::peripherals::SYSTEM::regs()
4755 .perip_rst_en0()
4756 .modify(|_, w| w.systimer_rst().bit(reset));
4757 }
4758 Peripheral::Timg0 => {
4759 crate::peripherals::SYSTEM::regs()
4760 .perip_rst_en0()
4761 .modify(|_, w| w.timergroup_rst().bit(reset));
4762 }
4763 Peripheral::Timg1 => {
4764 crate::peripherals::SYSTEM::regs()
4765 .perip_rst_en0()
4766 .modify(|_, w| w.timergroup1_rst().bit(reset));
4767 }
4768 Peripheral::Twai0 => {
4769 crate::peripherals::SYSTEM::regs()
4770 .perip_rst_en0()
4771 .modify(|_, w| w.twai_rst().bit(reset));
4772 }
4773 Peripheral::Uart0 => {
4774 crate::peripherals::SYSTEM::regs()
4775 .perip_rst_en0()
4776 .modify(|_, w| w.uart_rst().bit(reset));
4777 }
4778 Peripheral::Uart1 => {
4779 crate::peripherals::SYSTEM::regs()
4780 .perip_rst_en0()
4781 .modify(|_, w| w.uart1_rst().bit(reset));
4782 }
4783 Peripheral::Uart2 => {
4784 crate::peripherals::SYSTEM::regs()
4785 .perip_rst_en1()
4786 .modify(|_, w| w.uart2_rst().bit(reset));
4787 }
4788 Peripheral::UartMem => {
4789 crate::peripherals::SYSTEM::regs()
4790 .perip_rst_en0()
4791 .modify(|_, w| w.uart_mem_rst().bit(reset));
4792 }
4793 Peripheral::Uhci0 => {
4794 crate::peripherals::SYSTEM::regs()
4795 .perip_rst_en0()
4796 .modify(|_, w| w.uhci0_rst().bit(reset));
4797 }
4798 Peripheral::UsbDevice => {
4799 crate::peripherals::SYSTEM::regs()
4800 .perip_rst_en1()
4801 .modify(|_, w| w.usb_device_rst().bit(reset));
4802 }
4803 Peripheral::UsbFs => {
4804 crate::peripherals::SYSTEM::regs()
4805 .perip_rst_en0()
4806 .modify(|_, w| w.usb_rst().bit(reset));
4807 }
4808 }
4809 }
4810 };
4811}
4812#[macro_export]
4820#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4821macro_rules! memory_range {
4822 ("DRAM") => {
4823 0x3FC88000..0x3FD00000
4824 };
4825 (size as str, "DRAM") => {
4826 "491520"
4827 };
4828 ("DRAM2_UNINIT") => {
4829 0x3FCDB700..0x3FCED710
4830 };
4831 (size as str, "DRAM2_UNINIT") => {
4832 "73744"
4833 };
4834 ("IROM") => {
4835 0x42000000..0x44000000
4836 };
4837 (size as str, "IROM") => {
4838 "33554432"
4839 };
4840 ("DROM") => {
4841 0x3C000000..0x3E000000
4842 };
4843 (size as str, "DROM") => {
4844 "33554432"
4845 };
4846}
4847#[macro_export]
4864#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4865macro_rules! for_each_i2c_master {
4866 ($($pattern:tt => $code:tt;)*) => {
4867 macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
4868 => {} } _for_each_inner_i2c_master!((0, I2C0, I2cExt0, I2CEXT0_SCL,
4869 I2CEXT0_SDA)); _for_each_inner_i2c_master!((1, I2C1, I2cExt1, I2CEXT1_SCL,
4870 I2CEXT1_SDA)); _for_each_inner_i2c_master!((all(0, I2C0, I2cExt0, I2CEXT0_SCL,
4871 I2CEXT0_SDA), (1, I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA)));
4872 };
4873}
4874#[macro_export]
4901#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4902macro_rules! for_each_i2s {
4903 ($($pattern:tt => $code:tt;)*) => {
4904 macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
4905 _for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S1));
4906 _for_each_inner_i2s!((I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
4907 I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
4908 true, true, true, true)); _for_each_inner_i2s!((I2S1, I2s1, I2S1_MCLK, I2S1O_BCK,
4909 I2S1O_WS, I2S1I_BCK, I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false,
4910 false)); _for_each_inner_i2s!((names(I2S0), (I2S1)));
4911 _for_each_inner_i2s!((all(I2S0, I2s0, I2S0_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
4912 I2S0I_WS, [I2S0O_SD, I2S0O_SD1], [I2S0I_SD, I2S0I_SD1, I2S0I_SD2, I2S0I_SD3],
4913 true, true, true, true), (I2S1, I2s1, I2S1_MCLK, I2S1O_BCK, I2S1O_WS, I2S1I_BCK,
4914 I2S1I_WS, [I2S1O_SD], [I2S1I_SD], true, true, false, false)));
4915 };
4916}
4917#[macro_export]
4936#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4937macro_rules! for_each_uart {
4938 ($($pattern:tt => $code:tt;)*) => {
4939 macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
4940 } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
4941 wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
4942 U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((2, UART2, Uart2,
4943 U2RXD, U2TXD, U2CTS, U2RTS, wakeup_source = false));
4944 _for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
4945 wakeup_source = true), (1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS,
4946 wakeup_source = true), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS,
4947 wakeup_source = false)));
4948 };
4949}
4950#[macro_export]
4972#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4973macro_rules! for_each_spi_master {
4974 ($($pattern:tt => $code:tt;)*) => {
4975 macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
4976 => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
4977 _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
4978 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
4979 FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
4980 SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD],
4981 true)); _for_each_inner_spi_master!((names(SPI2), (SPI3)));
4982 _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
4983 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
4984 FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2]
4985 [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD], true)));
4986 };
4987}
4988#[macro_export]
5005#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5006macro_rules! for_each_spi_slave {
5007 ($($pattern:tt => $code:tt;)*) => {
5008 macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
5009 => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
5010 _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
5011 _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0));
5012 _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
5013 _for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
5014 (SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0)));
5015 };
5016}
5017#[macro_export]
5018#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5019macro_rules! for_each_peripheral {
5020 ($($pattern:tt => $code:tt;)*) => {
5021 macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
5022 => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
5023 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5024 "<section class=\"warning\">"] #[doc =
5025 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5026 #[doc = "<ul>"] #[doc =
5027 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5028 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()));
5029 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
5030 GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5031 "GPIO2 peripheral singleton"] GPIO2 <= virtual()));
5032 _for_each_inner_peripheral!((@ peri_type #[doc =
5033 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5034 "<section class=\"warning\">"] #[doc =
5035 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5036 #[doc = "<ul>"] #[doc =
5037 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5038 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()));
5039 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO4 peripheral singleton"]
5040 GPIO4 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5041 "GPIO5 peripheral singleton"] GPIO5 <= virtual()));
5042 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO6 peripheral singleton"]
5043 GPIO6 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5044 "GPIO7 peripheral singleton"] GPIO7 <= virtual()));
5045 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO8 peripheral singleton"]
5046 GPIO8 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5047 "GPIO9 peripheral singleton"] GPIO9 <= virtual()));
5048 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO10 peripheral singleton"]
5049 GPIO10 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5050 "GPIO11 peripheral singleton"] GPIO11 <= virtual()));
5051 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO12 peripheral singleton"]
5052 GPIO12 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5053 "GPIO13 peripheral singleton"] GPIO13 <= virtual()));
5054 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO14 peripheral singleton"]
5055 GPIO14 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5056 "GPIO15 peripheral singleton"] GPIO15 <= virtual()));
5057 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO16 peripheral singleton"]
5058 GPIO16 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5059 "GPIO17 peripheral singleton"] GPIO17 <= virtual()));
5060 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO18 peripheral singleton"]
5061 GPIO18 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5062 "GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5063 "<section class=\"warning\">"] #[doc =
5064 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5065 #[doc = "<ul>"] #[doc =
5066 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5067 #[doc = "</section>"] GPIO19 <= virtual())); _for_each_inner_peripheral!((@
5068 peri_type #[doc = "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""]
5069 #[doc = "<section class=\"warning\">"] #[doc =
5070 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5071 #[doc = "<ul>"] #[doc =
5072 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5073 #[doc = "</section>"] GPIO20 <= virtual())); _for_each_inner_peripheral!((@
5074 peri_type #[doc = "GPIO21 peripheral singleton"] GPIO21 <= virtual()));
5075 _for_each_inner_peripheral!((@ peri_type #[doc =
5076 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5077 "<section class=\"warning\">"] #[doc =
5078 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5079 #[doc = "<ul>"] #[doc =
5080 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5081 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
5082 _for_each_inner_peripheral!((@ peri_type #[doc =
5083 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5084 "<section class=\"warning\">"] #[doc =
5085 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5086 #[doc = "<ul>"] #[doc =
5087 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5088 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5089 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
5090 _for_each_inner_peripheral!((@ peri_type #[doc =
5091 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5092 "<section class=\"warning\">"] #[doc =
5093 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5094 #[doc = "<ul>"] #[doc =
5095 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5096 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5097 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
5098 _for_each_inner_peripheral!((@ peri_type #[doc =
5099 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5100 "<section class=\"warning\">"] #[doc =
5101 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5102 #[doc = "<ul>"] #[doc =
5103 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5104 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()));
5105 _for_each_inner_peripheral!((@ peri_type #[doc =
5106 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5107 "<section class=\"warning\">"] #[doc =
5108 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5109 #[doc = "<ul>"] #[doc =
5110 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5111 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5112 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
5113 _for_each_inner_peripheral!((@ peri_type #[doc =
5114 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5115 "<section class=\"warning\">"] #[doc =
5116 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5117 #[doc = "<ul>"] #[doc =
5118 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5119 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5120 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
5121 _for_each_inner_peripheral!((@ peri_type #[doc =
5122 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5123 "<section class=\"warning\">"] #[doc =
5124 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5125 #[doc = "<ul>"] #[doc =
5126 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5127 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
5128 _for_each_inner_peripheral!((@ peri_type #[doc =
5129 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5130 "<section class=\"warning\">"] #[doc =
5131 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5132 #[doc = "<ul>"] #[doc =
5133 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5134 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5135 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()));
5136 _for_each_inner_peripheral!((@ peri_type #[doc =
5137 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5138 "<section class=\"warning\">"] #[doc =
5139 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5140 #[doc = "<ul>"] #[doc =
5141 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5142 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5143 #[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
5144 _for_each_inner_peripheral!((@ peri_type #[doc =
5145 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5146 "<section class=\"warning\">"] #[doc =
5147 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5148 #[doc = "<ul>"] #[doc =
5149 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5150 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5151 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
5152 _for_each_inner_peripheral!((@ peri_type #[doc =
5153 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5154 "<section class=\"warning\">"] #[doc =
5155 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5156 #[doc = "<ul>"] #[doc =
5157 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5158 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5159 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
5160 _for_each_inner_peripheral!((@ peri_type #[doc =
5161 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5162 "<section class=\"warning\">"] #[doc =
5163 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5164 #[doc = "<ul>"] #[doc =
5165 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5166 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5167 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
5168 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO38 peripheral singleton"]
5169 GPIO38 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5170 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5171 "<section class=\"warning\">"] #[doc =
5172 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5173 #[doc = "<ul>"] #[doc =
5174 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5175 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
5176 _for_each_inner_peripheral!((@ peri_type #[doc =
5177 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5178 "<section class=\"warning\">"] #[doc =
5179 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5180 #[doc = "<ul>"] #[doc =
5181 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5182 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
5183 _for_each_inner_peripheral!((@ peri_type #[doc =
5184 "GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5185 "<section class=\"warning\">"] #[doc =
5186 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5187 #[doc = "<ul>"] #[doc =
5188 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5189 #[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()));
5190 _for_each_inner_peripheral!((@ peri_type #[doc =
5191 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5192 "<section class=\"warning\">"] #[doc =
5193 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5194 #[doc = "<ul>"] #[doc =
5195 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5196 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()));
5197 _for_each_inner_peripheral!((@ peri_type #[doc =
5198 "GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5199 "<section class=\"warning\">"] #[doc =
5200 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5201 #[doc = "<ul>"] #[doc =
5202 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5203 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()));
5204 _for_each_inner_peripheral!((@ peri_type #[doc =
5205 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5206 "<section class=\"warning\">"] #[doc =
5207 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5208 #[doc = "<ul>"] #[doc =
5209 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5210 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()));
5211 _for_each_inner_peripheral!((@ peri_type #[doc =
5212 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5213 "<section class=\"warning\">"] #[doc =
5214 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5215 #[doc = "<ul>"] #[doc =
5216 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5217 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()));
5218 _for_each_inner_peripheral!((@ peri_type #[doc =
5219 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5220 "<section class=\"warning\">"] #[doc =
5221 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5222 #[doc = "<ul>"] #[doc =
5223 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5224 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()));
5225 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO47 peripheral singleton"]
5226 GPIO47 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
5227 "GPIO48 peripheral singleton"] GPIO48 <= virtual()));
5228 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
5229 DMA_CH0 <= virtual(DMA_IN_CH0 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5230 disable_dma_in_interrupt }, DMA_OUT_CH0 : { bind_dma_out_interrupt,
5231 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5232 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH1 peripheral singleton"]
5233 DMA_CH1 <= virtual(DMA_IN_CH1 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5234 disable_dma_in_interrupt }, DMA_OUT_CH1 : { bind_dma_out_interrupt,
5235 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5236 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH2 peripheral singleton"]
5237 DMA_CH2 <= virtual(DMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5238 disable_dma_in_interrupt }, DMA_OUT_CH2 : { bind_dma_out_interrupt,
5239 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5240 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH3 peripheral singleton"]
5241 DMA_CH3 <= virtual(DMA_IN_CH3 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5242 disable_dma_in_interrupt }, DMA_OUT_CH3 : { bind_dma_out_interrupt,
5243 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5244 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH4 peripheral singleton"]
5245 DMA_CH4 <= virtual(DMA_IN_CH4 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
5246 disable_dma_in_interrupt }, DMA_OUT_CH4 : { bind_dma_out_interrupt,
5247 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
5248 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
5249 SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5250 = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
5251 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
5252 SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5253 = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
5254 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
5255 SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5256 = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
5257 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
5258 SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5259 = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
5260 _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
5261 <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
5262 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5263 "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)));
5264 _for_each_inner_peripheral!((@ peri_type #[doc =
5265 "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC() (unstable)));
5266 _for_each_inner_peripheral!((@ peri_type #[doc =
5267 "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
5268 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
5269 <= DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5270 "DS peripheral singleton"] DS <= DS() (unstable)));
5271 _for_each_inner_peripheral!((@ peri_type #[doc = "EFUSE peripheral singleton"]
5272 EFUSE <= EFUSE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5273 "EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)));
5274 _for_each_inner_peripheral!((@ peri_type #[doc =
5275 "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)));
5276 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO peripheral singleton"]
5277 GPIO <= GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5278 "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)));
5279 _for_each_inner_peripheral!((@ peri_type #[doc = "HMAC peripheral singleton"]
5280 HMAC <= HMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5281 "I2C_ANA_MST peripheral singleton"] I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
5282 _for_each_inner_peripheral!((@ peri_type #[doc = "I2C0 peripheral singleton"]
5283 I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
5284 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5285 "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt,
5286 enable_peri_interrupt, disable_peri_interrupt })));
5287 _for_each_inner_peripheral!((@ peri_type #[doc = "I2S0 peripheral singleton"]
5288 I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
5289 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5290 #[doc = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
5291 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
5292 _for_each_inner_peripheral!((@ peri_type #[doc =
5293 "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
5294 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5295 "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
5296 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5297 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
5298 _for_each_inner_peripheral!((@ peri_type #[doc = "LCD_CAM peripheral singleton"]
5299 LCD_CAM <= LCD_CAM() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5300 = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)));
5301 _for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
5302 LPWR <= RTC_CNTL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5303 "RTC_TIMER peripheral singleton"] RTC_TIMER <= RTC_CNTL() (unstable)));
5304 _for_each_inner_peripheral!((@ peri_type #[doc = "MCPWM0 peripheral singleton"]
5305 MCPWM0 <= MCPWM0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5306 "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1() (unstable)));
5307 _for_each_inner_peripheral!((@ peri_type #[doc = "PCNT peripheral singleton"]
5308 PCNT <= PCNT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5309 "PERI_BACKUP peripheral singleton"] PERI_BACKUP <= PERI_BACKUP() (unstable)));
5310 _for_each_inner_peripheral!((@ peri_type #[doc = "RMT peripheral singleton"] RMT
5311 <= RMT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5312 "RNG peripheral singleton"] RNG <= RNG() (unstable)));
5313 _for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
5314 <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
5315 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5316 "RTC_CNTL peripheral singleton"] RTC_CNTL <= RTC_CNTL() (unstable)));
5317 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_I2C0 peripheral singleton"]
5318 LP_I2C0 <= RTC_I2C() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
5319 = "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)));
5320 _for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
5321 SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5322 "SENS peripheral singleton"] SENS <= SENS() (unstable)));
5323 _for_each_inner_peripheral!((@ peri_type #[doc =
5324 "SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)));
5325 _for_each_inner_peripheral!((@ peri_type #[doc = "SHA peripheral singleton"] SHA
5326 <= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
5327 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5328 "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
5329 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
5330 SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5331 "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
5332 enable_peri_interrupt, disable_peri_interrupt })));
5333 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
5334 SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
5335 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5336 "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)));
5337 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTIMER peripheral singleton"]
5338 SYSTIMER <= SYSTIMER() (unstable))); _for_each_inner_peripheral!((@ peri_type
5339 #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
5340 _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
5341 TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5342 "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)));
5343 _for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
5344 UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
5345 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5346 "UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
5347 enable_peri_interrupt, disable_peri_interrupt })));
5348 _for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
5349 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
5350 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5351 "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)));
5352 _for_each_inner_peripheral!((@ peri_type #[doc = "USB_FS peripheral singleton"]
5353 USB_FS <= USB_FS(USB : { bind_peri_interrupt, enable_peri_interrupt,
5354 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
5355 #[doc = "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE :
5356 { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5357 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5358 "USB_WRAP peripheral singleton"] USB_WRAP <= USB_WRAP() (unstable)));
5359 _for_each_inner_peripheral!((@ peri_type #[doc = "WCL peripheral singleton"] WCL
5360 <= WCL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5361 "XTS_AES peripheral singleton"] XTS_AES <= XTS_AES() (unstable)));
5362 _for_each_inner_peripheral!((@ peri_type #[doc = "ADC1 peripheral singleton"]
5363 ADC1 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5364 "ADC2 peripheral singleton"] ADC2 <= virtual() (unstable)));
5365 _for_each_inner_peripheral!((@ peri_type #[doc = "BT peripheral singleton"] BT <=
5366 virtual(BT_BB : { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt },
5367 RWBLE : { bind_rwble_interrupt, enable_rwble_interrupt, disable_rwble_interrupt
5368 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5369 "CPU_CTRL peripheral singleton"] CPU_CTRL <= virtual() (unstable)));
5370 _for_each_inner_peripheral!((@ peri_type #[doc = "FLASH peripheral singleton"]
5371 FLASH <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5372 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
5373 _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
5374 PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
5375 "ULP_RISCV_CORE peripheral singleton"] ULP_RISCV_CORE <= virtual() (unstable)));
5376 _for_each_inner_peripheral!((@ peri_type #[doc = "WIFI peripheral singleton"]
5377 WIFI <= virtual(WIFI_MAC : { bind_mac_interrupt, enable_mac_interrupt,
5378 disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt, enable_pwr_interrupt,
5379 disable_pwr_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
5380 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)));
5381 _for_each_inner_peripheral!((@ peri_type #[doc =
5382 "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
5383 _for_each_inner_peripheral!((@ peri_type #[doc =
5384 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
5385 _for_each_inner_peripheral!((@ peri_type #[doc =
5386 "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
5387 _for_each_inner_peripheral!((GPIO0)); _for_each_inner_peripheral!((GPIO1));
5388 _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
5389 _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
5390 _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
5391 _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
5392 _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
5393 _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
5394 _for_each_inner_peripheral!((GPIO14));
5395 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO15));
5396 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO16));
5397 _for_each_inner_peripheral!((GPIO17)); _for_each_inner_peripheral!((GPIO18));
5398 _for_each_inner_peripheral!((GPIO19)); _for_each_inner_peripheral!((GPIO20));
5399 _for_each_inner_peripheral!((GPIO21)); _for_each_inner_peripheral!((GPIO26));
5400 _for_each_inner_peripheral!((GPIO27)); _for_each_inner_peripheral!((GPIO28));
5401 _for_each_inner_peripheral!((GPIO29)); _for_each_inner_peripheral!((GPIO30));
5402 _for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
5403 _for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
5404 _for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
5405 _for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
5406 _for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
5407 _for_each_inner_peripheral!((GPIO41)); _for_each_inner_peripheral!((GPIO42));
5408 _for_each_inner_peripheral!((GPIO43)); _for_each_inner_peripheral!((GPIO44));
5409 _for_each_inner_peripheral!((GPIO45)); _for_each_inner_peripheral!((GPIO46));
5410 _for_each_inner_peripheral!((GPIO47)); _for_each_inner_peripheral!((GPIO48));
5411 _for_each_inner_peripheral!((DMA_CH0(unstable)));
5412 _for_each_inner_peripheral!((DMA_CH1(unstable)));
5413 _for_each_inner_peripheral!((DMA_CH2(unstable)));
5414 _for_each_inner_peripheral!((DMA_CH3(unstable)));
5415 _for_each_inner_peripheral!((DMA_CH4(unstable)));
5416 _for_each_inner_peripheral!((SDM_CH0(unstable)));
5417 _for_each_inner_peripheral!((SDM_CH1(unstable)));
5418 _for_each_inner_peripheral!((SDM_CH2(unstable)));
5419 _for_each_inner_peripheral!((SDM_CH3(unstable)));
5420 _for_each_inner_peripheral!((SDM_CH4(unstable)));
5421 _for_each_inner_peripheral!((SDM_CH5(unstable)));
5422 _for_each_inner_peripheral!((SDM_CH6(unstable)));
5423 _for_each_inner_peripheral!((SDM_CH7(unstable)));
5424 _for_each_inner_peripheral!((AES(unstable)));
5425 _for_each_inner_peripheral!((APB_CTRL(unstable)));
5426 _for_each_inner_peripheral!((APB_SARADC(unstable)));
5427 _for_each_inner_peripheral!((ASSIST_DEBUG(unstable)));
5428 _for_each_inner_peripheral!((DMA(unstable)));
5429 _for_each_inner_peripheral!((DS(unstable)));
5430 _for_each_inner_peripheral!((EXTMEM(unstable)));
5431 _for_each_inner_peripheral!((GPIO(unstable)));
5432 _for_each_inner_peripheral!((GPIO_SD(unstable)));
5433 _for_each_inner_peripheral!((HMAC(unstable)));
5434 _for_each_inner_peripheral!((I2C_ANA_MST(unstable)));
5435 _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
5436 _for_each_inner_peripheral!((I2S0(unstable)));
5437 _for_each_inner_peripheral!((I2S1(unstable)));
5438 _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
5439 _for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
5440 _for_each_inner_peripheral!((IO_MUX(unstable)));
5441 _for_each_inner_peripheral!((LCD_CAM(unstable)));
5442 _for_each_inner_peripheral!((LEDC(unstable)));
5443 _for_each_inner_peripheral!((LPWR(unstable)));
5444 _for_each_inner_peripheral!((RTC_TIMER(unstable)));
5445 _for_each_inner_peripheral!((MCPWM0(unstable)));
5446 _for_each_inner_peripheral!((MCPWM1(unstable)));
5447 _for_each_inner_peripheral!((PCNT(unstable)));
5448 _for_each_inner_peripheral!((PERI_BACKUP(unstable)));
5449 _for_each_inner_peripheral!((RMT(unstable)));
5450 _for_each_inner_peripheral!((RNG(unstable)));
5451 _for_each_inner_peripheral!((RSA(unstable)));
5452 _for_each_inner_peripheral!((RTC_CNTL(unstable)));
5453 _for_each_inner_peripheral!((LP_I2C0(unstable)));
5454 _for_each_inner_peripheral!((RTC_IO(unstable)));
5455 _for_each_inner_peripheral!((SDHOST(unstable)));
5456 _for_each_inner_peripheral!((SENS(unstable)));
5457 _for_each_inner_peripheral!((SENSITIVE(unstable)));
5458 _for_each_inner_peripheral!((SHA(unstable)));
5459 _for_each_inner_peripheral!((SPI0(unstable)));
5460 _for_each_inner_peripheral!((SPI1(unstable)));
5461 _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
5462 _for_each_inner_peripheral!((SYSTEM(unstable)));
5463 _for_each_inner_peripheral!((SYSTIMER(unstable)));
5464 _for_each_inner_peripheral!((TIMG0(unstable)));
5465 _for_each_inner_peripheral!((TIMG1(unstable)));
5466 _for_each_inner_peripheral!((TWAI0(unstable)));
5467 _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
5468 _for_each_inner_peripheral!((UART2));
5469 _for_each_inner_peripheral!((UHCI0(unstable)));
5470 _for_each_inner_peripheral!((USB_FS(unstable)));
5471 _for_each_inner_peripheral!((USB_DEVICE(unstable)));
5472 _for_each_inner_peripheral!((WCL(unstable)));
5473 _for_each_inner_peripheral!((XTS_AES(unstable)));
5474 _for_each_inner_peripheral!((ADC1(unstable)));
5475 _for_each_inner_peripheral!((ADC2(unstable)));
5476 _for_each_inner_peripheral!((BT(unstable)));
5477 _for_each_inner_peripheral!((CPU_CTRL(unstable)));
5478 _for_each_inner_peripheral!((FLASH(unstable)));
5479 _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
5480 _for_each_inner_peripheral!((PSRAM(unstable)));
5481 _for_each_inner_peripheral!((ULP_RISCV_CORE(unstable)));
5482 _for_each_inner_peripheral!((WIFI));
5483 _for_each_inner_peripheral!((FROM_CPU_INTR0(unstable)));
5484 _for_each_inner_peripheral!((FROM_CPU_INTR1(unstable)));
5485 _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
5486 _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
5487 _for_each_inner_peripheral!((SPI2, Spi2, 0, AhbGdmaChannel));
5488 _for_each_inner_peripheral!((SPI3, Spi3, 1, AhbGdmaChannel));
5489 _for_each_inner_peripheral!((UHCI0, Uhci0, 2, AhbGdmaChannel));
5490 _for_each_inner_peripheral!((I2S0, I2s0, 3, AhbGdmaChannel));
5491 _for_each_inner_peripheral!((I2S1, I2s1, 4, AhbGdmaChannel));
5492 _for_each_inner_peripheral!((LCD_CAM, LcdCam, 5, AhbGdmaChannel));
5493 _for_each_inner_peripheral!((AES, Aes, 6, AhbGdmaChannel));
5494 _for_each_inner_peripheral!((SHA, Sha, 7, AhbGdmaChannel));
5495 _for_each_inner_peripheral!((APB_SARADC, ApbSaradc, 8, AhbGdmaChannel));
5496 _for_each_inner_peripheral!((RMT, Rmt, 9, AhbGdmaChannel));
5497 _for_each_inner_peripheral!((all(@ peri_type #[doc =
5498 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5499 "<section class=\"warning\">"] #[doc =
5500 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5501 #[doc = "<ul>"] #[doc =
5502 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5503 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()), (@ peri_type #[doc =
5504 "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
5505 "GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
5506 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5507 "<section class=\"warning\">"] #[doc =
5508 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5509 #[doc = "<ul>"] #[doc =
5510 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5511 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()), (@ peri_type #[doc =
5512 "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
5513 "GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
5514 "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
5515 "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
5516 "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
5517 "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
5518 "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
5519 "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
5520 "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
5521 "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
5522 "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
5523 "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
5524 "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
5525 "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
5526 "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
5527 "GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5528 "<section class=\"warning\">"] #[doc =
5529 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5530 #[doc = "<ul>"] #[doc =
5531 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5532 #[doc = "</section>"] GPIO19 <= virtual()), (@ peri_type #[doc =
5533 "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5534 "<section class=\"warning\">"] #[doc =
5535 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5536 #[doc = "<ul>"] #[doc =
5537 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
5538 #[doc = "</section>"] GPIO20 <= virtual()), (@ peri_type #[doc =
5539 "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
5540 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5541 "<section class=\"warning\">"] #[doc =
5542 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5543 #[doc = "<ul>"] #[doc =
5544 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5545 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
5546 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5547 "<section class=\"warning\">"] #[doc =
5548 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5549 #[doc = "<ul>"] #[doc =
5550 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5551 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5552 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
5553 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5554 "<section class=\"warning\">"] #[doc =
5555 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5556 #[doc = "<ul>"] #[doc =
5557 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5558 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5559 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
5560 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5561 "<section class=\"warning\">"] #[doc =
5562 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5563 #[doc = "<ul>"] #[doc =
5564 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5565 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()), (@ peri_type #[doc =
5566 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5567 "<section class=\"warning\">"] #[doc =
5568 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5569 #[doc = "<ul>"] #[doc =
5570 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5571 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5572 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
5573 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5574 "<section class=\"warning\">"] #[doc =
5575 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5576 #[doc = "<ul>"] #[doc =
5577 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5578 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5579 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
5580 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5581 "<section class=\"warning\">"] #[doc =
5582 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5583 #[doc = "<ul>"] #[doc =
5584 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5585 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
5586 "GPIO33 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>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5591 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5592 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
5593 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5594 "<section class=\"warning\">"] #[doc =
5595 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5596 #[doc = "<ul>"] #[doc =
5597 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5598 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5599 #[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
5600 "GPIO35 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 Octal SPI flash.</li>"] #[doc
5605 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5606 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
5607 "GPIO36 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 Octal SPI flash.</li>"] #[doc
5612 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5613 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
5614 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5615 "<section class=\"warning\">"] #[doc =
5616 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5617 #[doc = "<ul>"] #[doc =
5618 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5619 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5620 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
5621 "GPIO38 peripheral singleton"] GPIO38 <= virtual()), (@ peri_type #[doc =
5622 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5623 "<section class=\"warning\">"] #[doc =
5624 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5625 #[doc = "<ul>"] #[doc =
5626 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5627 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
5628 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5629 "<section class=\"warning\">"] #[doc =
5630 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5631 #[doc = "<ul>"] #[doc =
5632 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5633 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
5634 "GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5635 "<section class=\"warning\">"] #[doc =
5636 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5637 #[doc = "<ul>"] #[doc =
5638 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5639 #[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()), (@ peri_type #[doc =
5640 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5641 "<section class=\"warning\">"] #[doc =
5642 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5643 #[doc = "<ul>"] #[doc =
5644 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5645 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()), (@ peri_type #[doc =
5646 "GPIO43 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>By default, this pin is used by the UART programming interface.</li>"] #[doc
5651 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()), (@ peri_type #[doc =
5652 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5653 "<section class=\"warning\">"] #[doc =
5654 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5655 #[doc = "<ul>"] #[doc =
5656 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5657 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()), (@ peri_type #[doc =
5658 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5659 "<section class=\"warning\">"] #[doc =
5660 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5661 #[doc = "<ul>"] #[doc =
5662 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5663 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()), (@ peri_type #[doc =
5664 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5665 "<section class=\"warning\">"] #[doc =
5666 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5667 #[doc = "<ul>"] #[doc =
5668 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5669 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()), (@ peri_type #[doc =
5670 "GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
5671 "GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
5672 "DMA_CH0 peripheral singleton"] DMA_CH0 <= virtual(DMA_IN_CH0 : {
5673 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5674 DMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5675 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5676 "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(DMA_IN_CH1 : {
5677 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5678 DMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5679 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5680 "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual(DMA_IN_CH2 : {
5681 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5682 DMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5683 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5684 "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual(DMA_IN_CH3 : {
5685 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5686 DMA_OUT_CH3 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5687 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5688 "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(DMA_IN_CH4 : {
5689 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5690 DMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5691 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5692 "SDM_CH0 peripheral singleton"] SDM_CH0 <= virtual() (unstable)), (@ peri_type
5693 #[doc = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)), (@
5694 peri_type #[doc = "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual()
5695 (unstable)), (@ peri_type #[doc = "SDM_CH3 peripheral singleton"] SDM_CH3 <=
5696 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
5697 SDM_CH4 <= virtual() (unstable)), (@ peri_type #[doc =
5698 "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)), (@ peri_type
5699 #[doc = "SDM_CH6 peripheral singleton"] SDM_CH6 <= virtual() (unstable)), (@
5700 peri_type #[doc = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual()
5701 (unstable)), (@ peri_type #[doc = "AES peripheral singleton"] AES <= AES(AES : {
5702 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5703 (unstable)), (@ peri_type #[doc = "APB_CTRL peripheral singleton"] APB_CTRL <=
5704 APB_CTRL() (unstable)), (@ peri_type #[doc = "APB_SARADC peripheral singleton"]
5705 APB_SARADC <= APB_SARADC() (unstable)), (@ peri_type #[doc =
5706 "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)),
5707 (@ peri_type #[doc = "DMA peripheral singleton"] DMA <= DMA() (unstable)), (@
5708 peri_type #[doc = "DS peripheral singleton"] DS <= DS() (unstable)), (@ peri_type
5709 #[doc = "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@ peri_type
5710 #[doc = "EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)), (@
5711 peri_type #[doc = "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE()
5712 (unstable)), (@ peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO()
5713 (unstable)), (@ peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <=
5714 GPIO_SD() (unstable)), (@ peri_type #[doc = "HMAC peripheral singleton"] HMAC <=
5715 HMAC() (unstable)), (@ peri_type #[doc = "I2C_ANA_MST peripheral singleton"]
5716 I2C_ANA_MST <= I2C_ANA_MST() (unstable)), (@ peri_type #[doc =
5717 "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
5718 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5719 "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt,
5720 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5721 "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
5722 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
5723 = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
5724 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
5725 = "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
5726 (unstable)), (@ peri_type #[doc = "INTERRUPT_CORE1 peripheral singleton"]
5727 INTERRUPT_CORE1 <= INTERRUPT_CORE1() (unstable)), (@ peri_type #[doc =
5728 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type #[doc
5729 = "LCD_CAM peripheral singleton"] LCD_CAM <= LCD_CAM() (unstable)), (@ peri_type
5730 #[doc = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)), (@ peri_type
5731 #[doc = "LPWR peripheral singleton"] LPWR <= RTC_CNTL() (unstable)), (@ peri_type
5732 #[doc = "RTC_TIMER peripheral singleton"] RTC_TIMER <= RTC_CNTL() (unstable)), (@
5733 peri_type #[doc = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)),
5734 (@ peri_type #[doc = "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1()
5735 (unstable)), (@ peri_type #[doc = "PCNT peripheral singleton"] PCNT <= PCNT()
5736 (unstable)), (@ peri_type #[doc = "PERI_BACKUP peripheral singleton"] PERI_BACKUP
5737 <= PERI_BACKUP() (unstable)), (@ peri_type #[doc = "RMT peripheral singleton"]
5738 RMT <= RMT() (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <=
5739 RNG() (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <=
5740 RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5741 (unstable)), (@ peri_type #[doc = "RTC_CNTL peripheral singleton"] RTC_CNTL <=
5742 RTC_CNTL() (unstable)), (@ peri_type #[doc = "LP_I2C0 peripheral singleton"]
5743 LP_I2C0 <= RTC_I2C() (unstable)), (@ peri_type #[doc =
5744 "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)), (@ peri_type #[doc
5745 = "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)), (@ peri_type
5746 #[doc = "SENS peripheral singleton"] SENS <= SENS() (unstable)), (@ peri_type
5747 #[doc = "SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)),
5748 (@ peri_type #[doc = "SHA peripheral singleton"] SHA <= SHA(SHA : {
5749 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5750 (unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0()
5751 (unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1()
5752 (unstable)), (@ peri_type #[doc = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2
5753 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5754 peri_type #[doc = "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : {
5755 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5756 peri_type #[doc = "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)),
5757 (@ peri_type #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER()
5758 (unstable)), (@ peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0()
5759 (unstable)), (@ peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1()
5760 (unstable)), (@ peri_type #[doc = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0()
5761 (unstable)), (@ peri_type #[doc = "UART0 peripheral singleton"] UART0 <=
5762 UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
5763 disable_peri_interrupt })), (@ peri_type #[doc = "UART1 peripheral singleton"]
5764 UART1 <= UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
5765 disable_peri_interrupt })), (@ peri_type #[doc = "UART2 peripheral singleton"]
5766 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
5767 disable_peri_interrupt })), (@ peri_type #[doc = "UHCI0 peripheral singleton"]
5768 UHCI0 <= UHCI0() (unstable)), (@ peri_type #[doc = "USB_FS peripheral singleton"]
5769 USB_FS <= USB_FS(USB : { bind_peri_interrupt, enable_peri_interrupt,
5770 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
5771 "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
5772 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5773 (unstable)), (@ peri_type #[doc = "USB_WRAP peripheral singleton"] USB_WRAP <=
5774 USB_WRAP() (unstable)), (@ peri_type #[doc = "WCL peripheral singleton"] WCL <=
5775 WCL() (unstable)), (@ peri_type #[doc = "XTS_AES peripheral singleton"] XTS_AES
5776 <= XTS_AES() (unstable)), (@ peri_type #[doc = "ADC1 peripheral singleton"] ADC1
5777 <= virtual() (unstable)), (@ peri_type #[doc = "ADC2 peripheral singleton"] ADC2
5778 <= virtual() (unstable)), (@ peri_type #[doc = "BT peripheral singleton"] BT <=
5779 virtual(BT_BB : { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt },
5780 RWBLE : { bind_rwble_interrupt, enable_rwble_interrupt, disable_rwble_interrupt
5781 }) (unstable)), (@ peri_type #[doc = "CPU_CTRL peripheral singleton"] CPU_CTRL <=
5782 virtual() (unstable)), (@ peri_type #[doc = "FLASH peripheral singleton"] FLASH
5783 <= virtual() (unstable)), (@ peri_type #[doc =
5784 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
5785 (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
5786 (unstable)), (@ peri_type #[doc = "ULP_RISCV_CORE peripheral singleton"]
5787 ULP_RISCV_CORE <= virtual() (unstable)), (@ peri_type #[doc =
5788 "WIFI peripheral singleton"] WIFI <= virtual(WIFI_MAC : { bind_mac_interrupt,
5789 enable_mac_interrupt, disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt,
5790 enable_pwr_interrupt, disable_pwr_interrupt })), (@ peri_type #[doc =
5791 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)),
5792 (@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <=
5793 virtual() (unstable)), (@ peri_type #[doc =
5794 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
5795 (@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
5796 virtual() (unstable)))); _for_each_inner_peripheral!((singletons(GPIO0), (GPIO1),
5797 (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6), (GPIO7), (GPIO8), (GPIO9), (GPIO10),
5798 (GPIO11), (GPIO12), (GPIO13), (GPIO14), (#[cfg(not(use_xtal32k))] GPIO15),
5799 (#[cfg(not(use_xtal32k))] GPIO16), (GPIO17), (GPIO18), (GPIO19), (GPIO20),
5800 (GPIO21), (GPIO26), (GPIO27), (GPIO28), (GPIO29), (GPIO30), (GPIO31), (GPIO32),
5801 (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39), (GPIO40),
5802 (GPIO41), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47), (GPIO48),
5803 (DMA_CH0(unstable)), (DMA_CH1(unstable)), (DMA_CH2(unstable)),
5804 (DMA_CH3(unstable)), (DMA_CH4(unstable)), (SDM_CH0(unstable)),
5805 (SDM_CH1(unstable)), (SDM_CH2(unstable)), (SDM_CH3(unstable)),
5806 (SDM_CH4(unstable)), (SDM_CH5(unstable)), (SDM_CH6(unstable)),
5807 (SDM_CH7(unstable)), (AES(unstable)), (APB_CTRL(unstable)),
5808 (APB_SARADC(unstable)), (ASSIST_DEBUG(unstable)), (DMA(unstable)),
5809 (DS(unstable)), (EXTMEM(unstable)), (GPIO(unstable)), (GPIO_SD(unstable)),
5810 (HMAC(unstable)), (I2C_ANA_MST(unstable)), (I2C0), (I2C1), (I2S0(unstable)),
5811 (I2S1(unstable)), (INTERRUPT_CORE0(unstable)), (INTERRUPT_CORE1(unstable)),
5812 (IO_MUX(unstable)), (LCD_CAM(unstable)), (LEDC(unstable)), (LPWR(unstable)),
5813 (RTC_TIMER(unstable)), (MCPWM0(unstable)), (MCPWM1(unstable)), (PCNT(unstable)),
5814 (PERI_BACKUP(unstable)), (RMT(unstable)), (RNG(unstable)), (RSA(unstable)),
5815 (RTC_CNTL(unstable)), (LP_I2C0(unstable)), (RTC_IO(unstable)),
5816 (SDHOST(unstable)), (SENS(unstable)), (SENSITIVE(unstable)), (SHA(unstable)),
5817 (SPI0(unstable)), (SPI1(unstable)), (SPI2), (SPI3), (SYSTEM(unstable)),
5818 (SYSTIMER(unstable)), (TIMG0(unstable)), (TIMG1(unstable)), (TWAI0(unstable)),
5819 (UART0), (UART1), (UART2), (UHCI0(unstable)), (USB_FS(unstable)),
5820 (USB_DEVICE(unstable)), (WCL(unstable)), (XTS_AES(unstable)), (ADC1(unstable)),
5821 (ADC2(unstable)), (BT(unstable)), (CPU_CTRL(unstable)), (FLASH(unstable)),
5822 (GPIO_DEDICATED(unstable)), (PSRAM(unstable)), (ULP_RISCV_CORE(unstable)),
5823 (WIFI), (FROM_CPU_INTR0(unstable)), (FROM_CPU_INTR1(unstable)),
5824 (FROM_CPU_INTR2(unstable)), (FROM_CPU_INTR3(unstable))));
5825 _for_each_inner_peripheral!((dma_eligible(SPI2, Spi2, 0, AhbGdmaChannel), (SPI3,
5826 Spi3, 1, AhbGdmaChannel), (UHCI0, Uhci0, 2, AhbGdmaChannel), (I2S0, I2s0, 3,
5827 AhbGdmaChannel), (I2S1, I2s1, 4, AhbGdmaChannel), (LCD_CAM, LcdCam, 5,
5828 AhbGdmaChannel), (AES, Aes, 6, AhbGdmaChannel), (SHA, Sha, 7, AhbGdmaChannel),
5829 (APB_SARADC, ApbSaradc, 8, AhbGdmaChannel), (RMT, Rmt, 9, AhbGdmaChannel)));
5830 };
5831}
5832#[macro_export]
5859#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5860macro_rules! for_each_gpio {
5861 ($($pattern:tt => $code:tt;)*) => {
5862 macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
5863 } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
5864 _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
5865 _for_each_inner_gpio!((2, GPIO2() () ([Input] [Output])));
5866 _for_each_inner_gpio!((3, GPIO3() () ([Input] [Output])));
5867 _for_each_inner_gpio!((4, GPIO4() () ([Input] [Output])));
5868 _for_each_inner_gpio!((5, GPIO5() () ([Input] [Output])));
5869 _for_each_inner_gpio!((6, GPIO6() () ([Input] [Output])));
5870 _for_each_inner_gpio!((7, GPIO7() () ([Input] [Output])));
5871 _for_each_inner_gpio!((8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])));
5872 _for_each_inner_gpio!((9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4
5873 => FSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((10, GPIO10(_2 => FSPIIO4
5874 _4 => FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input]
5875 [Output]))); _for_each_inner_gpio!((11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 =>
5876 FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output])));
5877 _for_each_inner_gpio!((12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
5878 => SUBSPICLK _4 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((13,
5879 GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4
5880 => FSPIQ) ([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14(_3 => SUBSPIWP
5881 _4 => FSPIWP) (_2 => FSPIDQS _3 => SUBSPIWP _4 => FSPIWP) ([Input] [Output])));
5882 _for_each_inner_gpio!((15, GPIO15() (_2 => U0RTS) ([Input] [Output])));
5883 _for_each_inner_gpio!((16, GPIO16(_2 => U0CTS) () ([Input] [Output])));
5884 _for_each_inner_gpio!((17, GPIO17() (_2 => U1TXD) ([Input] [Output])));
5885 _for_each_inner_gpio!((18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
5886 [Output]))); _for_each_inner_gpio!((19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2)
5887 ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20(_2 => U1CTS) (_3 =>
5888 CLK_OUT1) ([Input] [Output]))); _for_each_inner_gpio!((21, GPIO21() () ([Input]
5889 [Output]))); _for_each_inner_gpio!((26, GPIO26() (_0 => SPICS1) ([Input]
5890 [Output]))); _for_each_inner_gpio!((27, GPIO27(_0 => SPIHD) (_0 => SPIHD)
5891 ([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0 => SPIWP) (_0 =>
5892 SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((29, GPIO29() (_0 => SPICS0)
5893 ([Input] [Output]))); _for_each_inner_gpio!((30, GPIO30() (_0 => SPICLK) ([Input]
5894 [Output]))); _for_each_inner_gpio!((31, GPIO31(_0 => SPIQ) (_0 => SPIQ) ([Input]
5895 [Output]))); _for_each_inner_gpio!((32, GPIO32(_0 => SPID) (_0 => SPID) ([Input]
5896 [Output]))); _for_each_inner_gpio!((33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 =>
5897 SPIIO4) (_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])));
5898 _for_each_inner_gpio!((34, GPIO34(_2 => FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3
5899 => SUBSPICS0 _4 => SPIIO5) ([Input] [Output]))); _for_each_inner_gpio!((35,
5900 GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3 => SUBSPID _4 =>
5901 SPIIO6) ([Input] [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => FSPICLK _4
5902 => SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])));
5903 _for_each_inner_gpio!((37, GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 =>
5904 FSPIQ _3 => SUBSPIQ _4 => SPIDQS) ([Input] [Output])));
5905 _for_each_inner_gpio!((38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 => FSPIWP _3
5906 => SUBSPIWP) ([Input] [Output]))); _for_each_inner_gpio!((39, GPIO39(_0 => MTCK)
5907 (_2 => CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output]))); _for_each_inner_gpio!((40,
5908 GPIO40() (_0 => MTDO _2 => CLK_OUT2) ([Input] [Output])));
5909 _for_each_inner_gpio!((41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
5910 [Output]))); _for_each_inner_gpio!((42, GPIO42(_0 => MTMS) () ([Input]
5911 [Output]))); _for_each_inner_gpio!((43, GPIO43() (_0 => U0TXD _2 => CLK_OUT1)
5912 ([Input] [Output]))); _for_each_inner_gpio!((44, GPIO44(_0 => U0RXD) (_2 =>
5913 CLK_OUT2) ([Input] [Output]))); _for_each_inner_gpio!((45, GPIO45() () ([Input]
5914 [Output]))); _for_each_inner_gpio!((46, GPIO46() () ([Input] [Output])));
5915 _for_each_inner_gpio!((47, GPIO47() (_0 => SPICLK_P_DIFF _2 => SUBSPICLK_P_DIFF)
5916 ([Input] [Output]))); _for_each_inner_gpio!((48, GPIO48() (_0 => SPICLK_N_DIFF _2
5917 => SUBSPICLK_N_DIFF) ([Input] [Output]))); _for_each_inner_gpio!((all(0, GPIO0()
5918 () ([Input] [Output])), (1, GPIO1() () ([Input] [Output])), (2, GPIO2() ()
5919 ([Input] [Output])), (3, GPIO3() () ([Input] [Output])), (4, GPIO4() () ([Input]
5920 [Output])), (5, GPIO5() () ([Input] [Output])), (6, GPIO6() () ([Input]
5921 [Output])), (7, GPIO7() () ([Input] [Output])), (8, GPIO8() (_3 => SUBSPICS1)
5922 ([Input] [Output])), (9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4 =>
5923 FSPIHD) ([Input] [Output])), (10, GPIO10(_2 => FSPIIO4 _4 => FSPICS0) (_2 =>
5924 FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input] [Output])), (11, GPIO11(_2 =>
5925 FSPIIO5 _3 => SUBSPID _4 => FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID)
5926 ([Input] [Output])), (12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
5927 => SUBSPICLK _4 => FSPICLK) ([Input] [Output])), (13, GPIO13(_2 => FSPIIO7 _3 =>
5928 SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) ([Input]
5929 [Output])), (14, GPIO14(_3 => SUBSPIWP _4 => FSPIWP) (_2 => FSPIDQS _3 =>
5930 SUBSPIWP _4 => FSPIWP) ([Input] [Output])), (15, GPIO15() (_2 => U0RTS) ([Input]
5931 [Output])), (16, GPIO16(_2 => U0CTS) () ([Input] [Output])), (17, GPIO17() (_2 =>
5932 U1TXD) ([Input] [Output])), (18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
5933 [Output])), (19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2) ([Input] [Output])), (20,
5934 GPIO20(_2 => U1CTS) (_3 => CLK_OUT1) ([Input] [Output])), (21, GPIO21() ()
5935 ([Input] [Output])), (26, GPIO26() (_0 => SPICS1) ([Input] [Output])), (27,
5936 GPIO27(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])), (28, GPIO28(_0 => SPIWP)
5937 (_0 => SPIWP) ([Input] [Output])), (29, GPIO29() (_0 => SPICS0) ([Input]
5938 [Output])), (30, GPIO30() (_0 => SPICLK) ([Input] [Output])), (31, GPIO31(_0 =>
5939 SPIQ) (_0 => SPIQ) ([Input] [Output])), (32, GPIO32(_0 => SPID) (_0 => SPID)
5940 ([Input] [Output])), (33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) (_2 =>
5941 FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])), (34, GPIO34(_2 =>
5942 FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3 => SUBSPICS0 _4 => SPIIO5) ([Input]
5943 [Output])), (35, GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3
5944 => SUBSPID _4 => SPIIO6) ([Input] [Output])), (36, GPIO36(_2 => FSPICLK _4 =>
5945 SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])), (37,
5946 GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 =>
5947 SPIDQS) ([Input] [Output])), (38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 =>
5948 FSPIWP _3 => SUBSPIWP) ([Input] [Output])), (39, GPIO39(_0 => MTCK) (_2 =>
5949 CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output])), (40, GPIO40() (_0 => MTDO _2 =>
5950 CLK_OUT2) ([Input] [Output])), (41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
5951 [Output])), (42, GPIO42(_0 => MTMS) () ([Input] [Output])), (43, GPIO43() (_0 =>
5952 U0TXD _2 => CLK_OUT1) ([Input] [Output])), (44, GPIO44(_0 => U0RXD) (_2 =>
5953 CLK_OUT2) ([Input] [Output])), (45, GPIO45() () ([Input] [Output])), (46,
5954 GPIO46() () ([Input] [Output])), (47, GPIO47() (_0 => SPICLK_P_DIFF _2 =>
5955 SUBSPICLK_P_DIFF) ([Input] [Output])), (48, GPIO48() (_0 => SPICLK_N_DIFF _2 =>
5956 SUBSPICLK_N_DIFF) ([Input] [Output]))));
5957 };
5958}
5959#[macro_export]
5986#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5987macro_rules! for_each_analog_function {
5988 ($($pattern:tt => $code:tt;)*) => {
5989 macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
5990 tt) => {} } _for_each_inner_analog_function!((TOUCH1, GPIO1));
5991 _for_each_inner_analog_function!((ADC1_CH0, GPIO1));
5992 _for_each_inner_analog_function!((TOUCH2, GPIO2));
5993 _for_each_inner_analog_function!((ADC1_CH1, GPIO2));
5994 _for_each_inner_analog_function!((TOUCH3, GPIO3));
5995 _for_each_inner_analog_function!((ADC1_CH2, GPIO3));
5996 _for_each_inner_analog_function!((TOUCH4, GPIO4));
5997 _for_each_inner_analog_function!((ADC1_CH3, GPIO4));
5998 _for_each_inner_analog_function!((TOUCH5, GPIO5));
5999 _for_each_inner_analog_function!((ADC1_CH4, GPIO5));
6000 _for_each_inner_analog_function!((TOUCH6, GPIO6));
6001 _for_each_inner_analog_function!((ADC1_CH5, GPIO6));
6002 _for_each_inner_analog_function!((TOUCH7, GPIO7));
6003 _for_each_inner_analog_function!((ADC1_CH6, GPIO7));
6004 _for_each_inner_analog_function!((TOUCH8, GPIO8));
6005 _for_each_inner_analog_function!((ADC1_CH7, GPIO8));
6006 _for_each_inner_analog_function!((TOUCH9, GPIO9));
6007 _for_each_inner_analog_function!((ADC1_CH8, GPIO9));
6008 _for_each_inner_analog_function!((TOUCH10, GPIO10));
6009 _for_each_inner_analog_function!((ADC1_CH9, GPIO10));
6010 _for_each_inner_analog_function!((TOUCH11, GPIO11));
6011 _for_each_inner_analog_function!((ADC2_CH0, GPIO11));
6012 _for_each_inner_analog_function!((TOUCH12, GPIO12));
6013 _for_each_inner_analog_function!((ADC2_CH1, GPIO12));
6014 _for_each_inner_analog_function!((TOUCH13, GPIO13));
6015 _for_each_inner_analog_function!((ADC2_CH2, GPIO13));
6016 _for_each_inner_analog_function!((TOUCH14, GPIO14));
6017 _for_each_inner_analog_function!((ADC2_CH3, GPIO14));
6018 _for_each_inner_analog_function!((XTAL_32K_P, GPIO15));
6019 _for_each_inner_analog_function!((ADC2_CH4, GPIO15));
6020 _for_each_inner_analog_function!((XTAL_32K_N, GPIO16));
6021 _for_each_inner_analog_function!((ADC2_CH5, GPIO16));
6022 _for_each_inner_analog_function!((ADC2_CH6, GPIO17));
6023 _for_each_inner_analog_function!((ADC2_CH7, GPIO18));
6024 _for_each_inner_analog_function!((USB_FS_DM, GPIO19));
6025 _for_each_inner_analog_function!((ADC2_CH8, GPIO19));
6026 _for_each_inner_analog_function!((USB_FS_DP, GPIO20));
6027 _for_each_inner_analog_function!((ADC2_CH9, GPIO20));
6028 _for_each_inner_analog_function!(((TOUCH1, TOUCHn, 1), GPIO1));
6029 _for_each_inner_analog_function!(((TOUCH2, TOUCHn, 2), GPIO2));
6030 _for_each_inner_analog_function!(((TOUCH3, TOUCHn, 3), GPIO3));
6031 _for_each_inner_analog_function!(((TOUCH4, TOUCHn, 4), GPIO4));
6032 _for_each_inner_analog_function!(((TOUCH5, TOUCHn, 5), GPIO5));
6033 _for_each_inner_analog_function!(((TOUCH6, TOUCHn, 6), GPIO6));
6034 _for_each_inner_analog_function!(((TOUCH7, TOUCHn, 7), GPIO7));
6035 _for_each_inner_analog_function!(((TOUCH8, TOUCHn, 8), GPIO8));
6036 _for_each_inner_analog_function!(((TOUCH9, TOUCHn, 9), GPIO9));
6037 _for_each_inner_analog_function!(((TOUCH10, TOUCHn, 10), GPIO10));
6038 _for_each_inner_analog_function!(((TOUCH11, TOUCHn, 11), GPIO11));
6039 _for_each_inner_analog_function!(((TOUCH12, TOUCHn, 12), GPIO12));
6040 _for_each_inner_analog_function!(((TOUCH13, TOUCHn, 13), GPIO13));
6041 _for_each_inner_analog_function!(((TOUCH14, TOUCHn, 14), GPIO14));
6042 _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1));
6043 _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2));
6044 _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3));
6045 _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4));
6046 _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5));
6047 _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6));
6048 _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7));
6049 _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8));
6050 _for_each_inner_analog_function!(((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9));
6051 _for_each_inner_analog_function!(((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10));
6052 _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11));
6053 _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12));
6054 _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13));
6055 _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14));
6056 _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15));
6057 _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16));
6058 _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17));
6059 _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18));
6060 _for_each_inner_analog_function!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19));
6061 _for_each_inner_analog_function!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20));
6062 _for_each_inner_analog_function!((all(TOUCH1, GPIO1), (ADC1_CH0, GPIO1), (TOUCH2,
6063 GPIO2), (ADC1_CH1, GPIO2), (TOUCH3, GPIO3), (ADC1_CH2, GPIO3), (TOUCH4, GPIO4),
6064 (ADC1_CH3, GPIO4), (TOUCH5, GPIO5), (ADC1_CH4, GPIO5), (TOUCH6, GPIO6),
6065 (ADC1_CH5, GPIO6), (TOUCH7, GPIO7), (ADC1_CH6, GPIO7), (TOUCH8, GPIO8),
6066 (ADC1_CH7, GPIO8), (TOUCH9, GPIO9), (ADC1_CH8, GPIO9), (TOUCH10, GPIO10),
6067 (ADC1_CH9, GPIO10), (TOUCH11, GPIO11), (ADC2_CH0, GPIO11), (TOUCH12, GPIO12),
6068 (ADC2_CH1, GPIO12), (TOUCH13, GPIO13), (ADC2_CH2, GPIO13), (TOUCH14, GPIO14),
6069 (ADC2_CH3, GPIO14), (XTAL_32K_P, GPIO15), (ADC2_CH4, GPIO15), (XTAL_32K_N,
6070 GPIO16), (ADC2_CH5, GPIO16), (ADC2_CH6, GPIO17), (ADC2_CH7, GPIO18), (USB_FS_DM,
6071 GPIO19), (ADC2_CH8, GPIO19), (USB_FS_DP, GPIO20), (ADC2_CH9, GPIO20)));
6072 _for_each_inner_analog_function!((TOUCHn((TOUCH1, TOUCHn, 1), GPIO1), ((TOUCH2,
6073 TOUCHn, 2), GPIO2), ((TOUCH3, TOUCHn, 3), GPIO3), ((TOUCH4, TOUCHn, 4), GPIO4),
6074 ((TOUCH5, TOUCHn, 5), GPIO5), ((TOUCH6, TOUCHn, 6), GPIO6), ((TOUCH7, TOUCHn, 7),
6075 GPIO7), ((TOUCH8, TOUCHn, 8), GPIO8), ((TOUCH9, TOUCHn, 9), GPIO9), ((TOUCH10,
6076 TOUCHn, 10), GPIO10), ((TOUCH11, TOUCHn, 11), GPIO11), ((TOUCH12, TOUCHn, 12),
6077 GPIO12), ((TOUCH13, TOUCHn, 13), GPIO13), ((TOUCH14, TOUCHn, 14), GPIO14)));
6078 _for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1),
6079 ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3),
6080 ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5),
6081 ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7),
6082 ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8), ((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9),
6083 ((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10), ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11),
6084 ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13),
6085 ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14), ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15),
6086 ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16), ((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17),
6087 ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18), ((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19),
6088 ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20)));
6089 };
6090}
6091#[macro_export]
6129#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6130macro_rules! for_each_lp_function {
6131 ($($pattern:tt => $code:tt;)*) => {
6132 macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
6133 => {} } _for_each_inner_lp_function!((LP_GPIO0, GPIO0, _0));
6134 _for_each_inner_lp_function!((SAR_I2C_SCL_0, GPIO0, _3));
6135 _for_each_inner_lp_function!((LP_GPIO1, GPIO1, _0));
6136 _for_each_inner_lp_function!((SAR_I2C_SDA_0, GPIO1, _3));
6137 _for_each_inner_lp_function!((LP_GPIO2, GPIO2, _0));
6138 _for_each_inner_lp_function!((SAR_I2C_SCL_1, GPIO2, _3));
6139 _for_each_inner_lp_function!((LP_GPIO3, GPIO3, _0));
6140 _for_each_inner_lp_function!((SAR_I2C_SDA_1, GPIO3, _3));
6141 _for_each_inner_lp_function!((LP_GPIO4, GPIO4, _0));
6142 _for_each_inner_lp_function!((LP_GPIO5, GPIO5, _0));
6143 _for_each_inner_lp_function!((LP_GPIO6, GPIO6, _0));
6144 _for_each_inner_lp_function!((LP_GPIO7, GPIO7, _0));
6145 _for_each_inner_lp_function!((LP_GPIO8, GPIO8, _0));
6146 _for_each_inner_lp_function!((LP_GPIO9, GPIO9, _0));
6147 _for_each_inner_lp_function!((LP_GPIO10, GPIO10, _0));
6148 _for_each_inner_lp_function!((LP_GPIO11, GPIO11, _0));
6149 _for_each_inner_lp_function!((LP_GPIO12, GPIO12, _0));
6150 _for_each_inner_lp_function!((LP_GPIO13, GPIO13, _0));
6151 _for_each_inner_lp_function!((LP_GPIO14, GPIO14, _0));
6152 _for_each_inner_lp_function!((LP_GPIO15, GPIO15, _0));
6153 _for_each_inner_lp_function!((LP_GPIO16, GPIO16, _0));
6154 _for_each_inner_lp_function!((LP_GPIO17, GPIO17, _0));
6155 _for_each_inner_lp_function!((LP_GPIO18, GPIO18, _0));
6156 _for_each_inner_lp_function!((LP_GPIO19, GPIO19, _0));
6157 _for_each_inner_lp_function!((LP_GPIO20, GPIO20, _0));
6158 _for_each_inner_lp_function!((LP_GPIO21, GPIO21, _0));
6159 _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, () ()));
6160 _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()));
6161 _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _0, () ()));
6162 _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()));
6163 _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _0, () ()));
6164 _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()));
6165 _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()));
6166 _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO7, _0, () ()));
6167 _for_each_inner_lp_function!(((LP_GPIO8, LP_GPIOn, 8), GPIO8, _0, () ()));
6168 _for_each_inner_lp_function!(((LP_GPIO9, LP_GPIOn, 9), GPIO9, _0, () ()));
6169 _for_each_inner_lp_function!(((LP_GPIO10, LP_GPIOn, 10), GPIO10, _0, () ()));
6170 _for_each_inner_lp_function!(((LP_GPIO11, LP_GPIOn, 11), GPIO11, _0, () ()));
6171 _for_each_inner_lp_function!(((LP_GPIO12, LP_GPIOn, 12), GPIO12, _0, () ()));
6172 _for_each_inner_lp_function!(((LP_GPIO13, LP_GPIOn, 13), GPIO13, _0, () ()));
6173 _for_each_inner_lp_function!(((LP_GPIO14, LP_GPIOn, 14), GPIO14, _0, () ()));
6174 _for_each_inner_lp_function!(((LP_GPIO15, LP_GPIOn, 15), GPIO15, _0, () ()));
6175 _for_each_inner_lp_function!(((LP_GPIO16, LP_GPIOn, 16), GPIO16, _0, () ()));
6176 _for_each_inner_lp_function!(((LP_GPIO17, LP_GPIOn, 17), GPIO17, _0, () ()));
6177 _for_each_inner_lp_function!(((LP_GPIO18, LP_GPIOn, 18), GPIO18, _0, () ()));
6178 _for_each_inner_lp_function!(((LP_GPIO19, LP_GPIOn, 19), GPIO19, _0, () ()));
6179 _for_each_inner_lp_function!(((LP_GPIO20, LP_GPIOn, 20), GPIO20, _0, () ()));
6180 _for_each_inner_lp_function!(((LP_GPIO21, LP_GPIOn, 21), GPIO21, _0, () ()));
6181 _for_each_inner_lp_function!(((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0), GPIO0, _3, ()
6182 ())); _for_each_inner_lp_function!(((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2, _3,
6183 () ())); _for_each_inner_lp_function!(((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0), GPIO1,
6184 _3, () ())); _for_each_inner_lp_function!(((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1),
6185 GPIO3, _3, () ())); _for_each_inner_lp_function!((all(LP_GPIO0, GPIO0, _0),
6186 (SAR_I2C_SCL_0, GPIO0, _3), (LP_GPIO1, GPIO1, _0), (SAR_I2C_SDA_0, GPIO1, _3),
6187 (LP_GPIO2, GPIO2, _0), (SAR_I2C_SCL_1, GPIO2, _3), (LP_GPIO3, GPIO3, _0),
6188 (SAR_I2C_SDA_1, GPIO3, _3), (LP_GPIO4, GPIO4, _0), (LP_GPIO5, GPIO5, _0),
6189 (LP_GPIO6, GPIO6, _0), (LP_GPIO7, GPIO7, _0), (LP_GPIO8, GPIO8, _0), (LP_GPIO9,
6190 GPIO9, _0), (LP_GPIO10, GPIO10, _0), (LP_GPIO11, GPIO11, _0), (LP_GPIO12, GPIO12,
6191 _0), (LP_GPIO13, GPIO13, _0), (LP_GPIO14, GPIO14, _0), (LP_GPIO15, GPIO15, _0),
6192 (LP_GPIO16, GPIO16, _0), (LP_GPIO17, GPIO17, _0), (LP_GPIO18, GPIO18, _0),
6193 (LP_GPIO19, GPIO19, _0), (LP_GPIO20, GPIO20, _0), (LP_GPIO21, GPIO21, _0)));
6194 _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, ()
6195 ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()), ((LP_GPIO2, LP_GPIOn, 2),
6196 GPIO2, _0, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()), ((LP_GPIO4,
6197 LP_GPIOn, 4), GPIO4, _0, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()),
6198 ((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()), ((LP_GPIO7, LP_GPIOn, 7), GPIO7, _0,
6199 () ()), ((LP_GPIO8, LP_GPIOn, 8), GPIO8, _0, () ()), ((LP_GPIO9, LP_GPIOn, 9),
6200 GPIO9, _0, () ()), ((LP_GPIO10, LP_GPIOn, 10), GPIO10, _0, () ()), ((LP_GPIO11,
6201 LP_GPIOn, 11), GPIO11, _0, () ()), ((LP_GPIO12, LP_GPIOn, 12), GPIO12, _0, ()
6202 ()), ((LP_GPIO13, LP_GPIOn, 13), GPIO13, _0, () ()), ((LP_GPIO14, LP_GPIOn, 14),
6203 GPIO14, _0, () ()), ((LP_GPIO15, LP_GPIOn, 15), GPIO15, _0, () ()), ((LP_GPIO16,
6204 LP_GPIOn, 16), GPIO16, _0, () ()), ((LP_GPIO17, LP_GPIOn, 17), GPIO17, _0, ()
6205 ()), ((LP_GPIO18, LP_GPIOn, 18), GPIO18, _0, () ()), ((LP_GPIO19, LP_GPIOn, 19),
6206 GPIO19, _0, () ()), ((LP_GPIO20, LP_GPIOn, 20), GPIO20, _0, () ()), ((LP_GPIO21,
6207 LP_GPIOn, 21), GPIO21, _0, () ())));
6208 _for_each_inner_lp_function!((SAR_I2C_SCL_n((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0),
6209 GPIO0, _3, () ()), ((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2, _3, () ())));
6210 _for_each_inner_lp_function!((SAR_I2C_SDA_n((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0),
6211 GPIO1, _3, () ()), ((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1), GPIO3, _3, () ())));
6212 };
6213}
6214#[macro_export]
6245#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6246macro_rules! for_each_iomux_function {
6247 ($($pattern:tt => $code:tt;)*) => {
6248 macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
6249 tt) => {} } _for_each_inner_iomux_function!((SUBSPICS1, GPIO8, _3));
6250 _for_each_inner_iomux_function!((SUBSPIHD, GPIO9, _3));
6251 _for_each_inner_iomux_function!((FSPIHD, GPIO9, _4));
6252 _for_each_inner_iomux_function!((FSPIIO4, GPIO10, _2));
6253 _for_each_inner_iomux_function!((SUBSPICS0, GPIO10, _3));
6254 _for_each_inner_iomux_function!((FSPICS0, GPIO10, _4));
6255 _for_each_inner_iomux_function!((FSPIIO5, GPIO11, _2));
6256 _for_each_inner_iomux_function!((SUBSPID, GPIO11, _3));
6257 _for_each_inner_iomux_function!((FSPID, GPIO11, _4));
6258 _for_each_inner_iomux_function!((FSPIIO6, GPIO12, _2));
6259 _for_each_inner_iomux_function!((SUBSPICLK, GPIO12, _3));
6260 _for_each_inner_iomux_function!((FSPICLK, GPIO12, _4));
6261 _for_each_inner_iomux_function!((FSPIIO7, GPIO13, _2));
6262 _for_each_inner_iomux_function!((SUBSPIQ, GPIO13, _3));
6263 _for_each_inner_iomux_function!((FSPIQ, GPIO13, _4));
6264 _for_each_inner_iomux_function!((FSPIDQS, GPIO14, _2));
6265 _for_each_inner_iomux_function!((SUBSPIWP, GPIO14, _3));
6266 _for_each_inner_iomux_function!((FSPIWP, GPIO14, _4));
6267 _for_each_inner_iomux_function!((U0RTS, GPIO15, _2));
6268 _for_each_inner_iomux_function!((U0CTS, GPIO16, _2));
6269 _for_each_inner_iomux_function!((U1TXD, GPIO17, _2));
6270 _for_each_inner_iomux_function!((U1RXD, GPIO18, _2));
6271 _for_each_inner_iomux_function!((CLK_OUT3, GPIO18, _3));
6272 _for_each_inner_iomux_function!((U1RTS, GPIO19, _2));
6273 _for_each_inner_iomux_function!((CLK_OUT2, GPIO19, _3));
6274 _for_each_inner_iomux_function!((U1CTS, GPIO20, _2));
6275 _for_each_inner_iomux_function!((CLK_OUT1, GPIO20, _3));
6276 _for_each_inner_iomux_function!((SPICS1, GPIO26, _0));
6277 _for_each_inner_iomux_function!((SPIHD, GPIO27, _0));
6278 _for_each_inner_iomux_function!((SPIWP, GPIO28, _0));
6279 _for_each_inner_iomux_function!((SPICS0, GPIO29, _0));
6280 _for_each_inner_iomux_function!((SPICLK, GPIO30, _0));
6281 _for_each_inner_iomux_function!((SPIQ, GPIO31, _0));
6282 _for_each_inner_iomux_function!((SPID, GPIO32, _0));
6283 _for_each_inner_iomux_function!((FSPIHD, GPIO33, _2));
6284 _for_each_inner_iomux_function!((SUBSPIHD, GPIO33, _3));
6285 _for_each_inner_iomux_function!((SPIIO4, GPIO33, _4));
6286 _for_each_inner_iomux_function!((FSPICS0, GPIO34, _2));
6287 _for_each_inner_iomux_function!((SUBSPICS0, GPIO34, _3));
6288 _for_each_inner_iomux_function!((SPIIO5, GPIO34, _4));
6289 _for_each_inner_iomux_function!((FSPID, GPIO35, _2));
6290 _for_each_inner_iomux_function!((SUBSPID, GPIO35, _3));
6291 _for_each_inner_iomux_function!((SPIIO6, GPIO35, _4));
6292 _for_each_inner_iomux_function!((FSPICLK, GPIO36, _2));
6293 _for_each_inner_iomux_function!((SUBSPICLK, GPIO36, _3));
6294 _for_each_inner_iomux_function!((SPIIO7, GPIO36, _4));
6295 _for_each_inner_iomux_function!((FSPIQ, GPIO37, _2));
6296 _for_each_inner_iomux_function!((SUBSPIQ, GPIO37, _3));
6297 _for_each_inner_iomux_function!((SPIDQS, GPIO37, _4));
6298 _for_each_inner_iomux_function!((FSPIWP, GPIO38, _2));
6299 _for_each_inner_iomux_function!((SUBSPIWP, GPIO38, _3));
6300 _for_each_inner_iomux_function!((MTCK, GPIO39, _0));
6301 _for_each_inner_iomux_function!((CLK_OUT3, GPIO39, _2));
6302 _for_each_inner_iomux_function!((SUBSPICS1, GPIO39, _3));
6303 _for_each_inner_iomux_function!((MTDO, GPIO40, _0));
6304 _for_each_inner_iomux_function!((CLK_OUT2, GPIO40, _2));
6305 _for_each_inner_iomux_function!((MTDI, GPIO41, _0));
6306 _for_each_inner_iomux_function!((CLK_OUT1, GPIO41, _2));
6307 _for_each_inner_iomux_function!((MTMS, GPIO42, _0));
6308 _for_each_inner_iomux_function!((U0TXD, GPIO43, _0));
6309 _for_each_inner_iomux_function!((CLK_OUT1, GPIO43, _2));
6310 _for_each_inner_iomux_function!((U0RXD, GPIO44, _0));
6311 _for_each_inner_iomux_function!((CLK_OUT2, GPIO44, _2));
6312 _for_each_inner_iomux_function!((SPICLK_P_DIFF, GPIO47, _0));
6313 _for_each_inner_iomux_function!((SUBSPICLK_P_DIFF, GPIO47, _2));
6314 _for_each_inner_iomux_function!((SPICLK_N_DIFF, GPIO48, _0));
6315 _for_each_inner_iomux_function!((SUBSPICLK_N_DIFF, GPIO48, _2));
6316 _for_each_inner_iomux_function!(((SUBSPICS1, SUBSPICSn, 1), GPIO8, _3));
6317 _for_each_inner_iomux_function!(((SUBSPICS0, SUBSPICSn, 0), GPIO10, _3));
6318 _for_each_inner_iomux_function!(((SUBSPICS0, SUBSPICSn, 0), GPIO34, _3));
6319 _for_each_inner_iomux_function!(((SUBSPICS1, SUBSPICSn, 1), GPIO39, _3));
6320 _for_each_inner_iomux_function!(((FSPIIO4, FSPIIOn, 4), GPIO10, _2));
6321 _for_each_inner_iomux_function!(((FSPIIO5, FSPIIOn, 5), GPIO11, _2));
6322 _for_each_inner_iomux_function!(((FSPIIO6, FSPIIOn, 6), GPIO12, _2));
6323 _for_each_inner_iomux_function!(((FSPIIO7, FSPIIOn, 7), GPIO13, _2));
6324 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO10, _4));
6325 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO34, _2));
6326 _for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO18, _3));
6327 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO19, _3));
6328 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO20, _3));
6329 _for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO39, _2));
6330 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO40, _2));
6331 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO41, _2));
6332 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO43, _2));
6333 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO44, _2));
6334 _for_each_inner_iomux_function!(((SPICS1, SPICSn, 1), GPIO26, _0));
6335 _for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO29, _0));
6336 _for_each_inner_iomux_function!(((SPIIO4, SPIIOn, 4), GPIO33, _4));
6337 _for_each_inner_iomux_function!(((SPIIO5, SPIIOn, 5), GPIO34, _4));
6338 _for_each_inner_iomux_function!(((SPIIO6, SPIIOn, 6), GPIO35, _4));
6339 _for_each_inner_iomux_function!(((SPIIO7, SPIIOn, 7), GPIO36, _4));
6340 _for_each_inner_iomux_function!((all(SUBSPICS1, GPIO8, _3), (SUBSPIHD, GPIO9,
6341 _3), (FSPIHD, GPIO9, _4), (FSPIIO4, GPIO10, _2), (SUBSPICS0, GPIO10, _3),
6342 (FSPICS0, GPIO10, _4), (FSPIIO5, GPIO11, _2), (SUBSPID, GPIO11, _3), (FSPID,
6343 GPIO11, _4), (FSPIIO6, GPIO12, _2), (SUBSPICLK, GPIO12, _3), (FSPICLK, GPIO12,
6344 _4), (FSPIIO7, GPIO13, _2), (SUBSPIQ, GPIO13, _3), (FSPIQ, GPIO13, _4), (FSPIDQS,
6345 GPIO14, _2), (SUBSPIWP, GPIO14, _3), (FSPIWP, GPIO14, _4), (U0RTS, GPIO15, _2),
6346 (U0CTS, GPIO16, _2), (U1TXD, GPIO17, _2), (U1RXD, GPIO18, _2), (CLK_OUT3, GPIO18,
6347 _3), (U1RTS, GPIO19, _2), (CLK_OUT2, GPIO19, _3), (U1CTS, GPIO20, _2), (CLK_OUT1,
6348 GPIO20, _3), (SPICS1, GPIO26, _0), (SPIHD, GPIO27, _0), (SPIWP, GPIO28, _0),
6349 (SPICS0, GPIO29, _0), (SPICLK, GPIO30, _0), (SPIQ, GPIO31, _0), (SPID, GPIO32,
6350 _0), (FSPIHD, GPIO33, _2), (SUBSPIHD, GPIO33, _3), (SPIIO4, GPIO33, _4),
6351 (FSPICS0, GPIO34, _2), (SUBSPICS0, GPIO34, _3), (SPIIO5, GPIO34, _4), (FSPID,
6352 GPIO35, _2), (SUBSPID, GPIO35, _3), (SPIIO6, GPIO35, _4), (FSPICLK, GPIO36, _2),
6353 (SUBSPICLK, GPIO36, _3), (SPIIO7, GPIO36, _4), (FSPIQ, GPIO37, _2), (SUBSPIQ,
6354 GPIO37, _3), (SPIDQS, GPIO37, _4), (FSPIWP, GPIO38, _2), (SUBSPIWP, GPIO38, _3),
6355 (MTCK, GPIO39, _0), (CLK_OUT3, GPIO39, _2), (SUBSPICS1, GPIO39, _3), (MTDO,
6356 GPIO40, _0), (CLK_OUT2, GPIO40, _2), (MTDI, GPIO41, _0), (CLK_OUT1, GPIO41, _2),
6357 (MTMS, GPIO42, _0), (U0TXD, GPIO43, _0), (CLK_OUT1, GPIO43, _2), (U0RXD, GPIO44,
6358 _0), (CLK_OUT2, GPIO44, _2), (SPICLK_P_DIFF, GPIO47, _0), (SUBSPICLK_P_DIFF,
6359 GPIO47, _2), (SPICLK_N_DIFF, GPIO48, _0), (SUBSPICLK_N_DIFF, GPIO48, _2)));
6360 _for_each_inner_iomux_function!((SUBSPICSn((SUBSPICS1, SUBSPICSn, 1), GPIO8, _3),
6361 ((SUBSPICS0, SUBSPICSn, 0), GPIO10, _3), ((SUBSPICS0, SUBSPICSn, 0), GPIO34, _3),
6362 ((SUBSPICS1, SUBSPICSn, 1), GPIO39, _3)));
6363 _for_each_inner_iomux_function!((FSPIIOn((FSPIIO4, FSPIIOn, 4), GPIO10, _2),
6364 ((FSPIIO5, FSPIIOn, 5), GPIO11, _2), ((FSPIIO6, FSPIIOn, 6), GPIO12, _2),
6365 ((FSPIIO7, FSPIIOn, 7), GPIO13, _2)));
6366 _for_each_inner_iomux_function!((FSPICSn((FSPICS0, FSPICSn, 0), GPIO10, _4),
6367 ((FSPICS0, FSPICSn, 0), GPIO34, _2)));
6368 _for_each_inner_iomux_function!((CLK_OUTn((CLK_OUT3, CLK_OUTn, 3), GPIO18, _3),
6369 ((CLK_OUT2, CLK_OUTn, 2), GPIO19, _3), ((CLK_OUT1, CLK_OUTn, 1), GPIO20, _3),
6370 ((CLK_OUT3, CLK_OUTn, 3), GPIO39, _2), ((CLK_OUT2, CLK_OUTn, 2), GPIO40, _2),
6371 ((CLK_OUT1, CLK_OUTn, 1), GPIO41, _2), ((CLK_OUT1, CLK_OUTn, 1), GPIO43, _2),
6372 ((CLK_OUT2, CLK_OUTn, 2), GPIO44, _2)));
6373 _for_each_inner_iomux_function!((SPICSn((SPICS1, SPICSn, 1), GPIO26, _0),
6374 ((SPICS0, SPICSn, 0), GPIO29, _0)));
6375 _for_each_inner_iomux_function!((SPIIOn((SPIIO4, SPIIOn, 4), GPIO33, _4),
6376 ((SPIIO5, SPIIOn, 5), GPIO34, _4), ((SPIIO6, SPIIOn, 6), GPIO35, _4), ((SPIIO7,
6377 SPIIOn, 7), GPIO36, _4)));
6378 };
6379}
6380#[macro_export]
6397#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6398macro_rules! gpio_for_signal {
6399 (LP_GPIO0 $(, $_fallback:literal)?) => {
6400 "GPIO0"
6401 };
6402 (SAR_I2C_SCL_0 $(, $_fallback:literal)?) => {
6403 "GPIO0"
6404 };
6405 (TOUCH1 $(, $_fallback:literal)?) => {
6406 "GPIO1"
6407 };
6408 (ADC1_CH0 $(, $_fallback:literal)?) => {
6409 "GPIO1"
6410 };
6411 (LP_GPIO1 $(, $_fallback:literal)?) => {
6412 "GPIO1"
6413 };
6414 (SAR_I2C_SDA_0 $(, $_fallback:literal)?) => {
6415 "GPIO1"
6416 };
6417 (TOUCH2 $(, $_fallback:literal)?) => {
6418 "GPIO2"
6419 };
6420 (ADC1_CH1 $(, $_fallback:literal)?) => {
6421 "GPIO2"
6422 };
6423 (LP_GPIO2 $(, $_fallback:literal)?) => {
6424 "GPIO2"
6425 };
6426 (SAR_I2C_SCL_1 $(, $_fallback:literal)?) => {
6427 "GPIO2"
6428 };
6429 (TOUCH3 $(, $_fallback:literal)?) => {
6430 "GPIO3"
6431 };
6432 (ADC1_CH2 $(, $_fallback:literal)?) => {
6433 "GPIO3"
6434 };
6435 (LP_GPIO3 $(, $_fallback:literal)?) => {
6436 "GPIO3"
6437 };
6438 (SAR_I2C_SDA_1 $(, $_fallback:literal)?) => {
6439 "GPIO3"
6440 };
6441 (TOUCH4 $(, $_fallback:literal)?) => {
6442 "GPIO4"
6443 };
6444 (ADC1_CH3 $(, $_fallback:literal)?) => {
6445 "GPIO4"
6446 };
6447 (LP_GPIO4 $(, $_fallback:literal)?) => {
6448 "GPIO4"
6449 };
6450 (TOUCH5 $(, $_fallback:literal)?) => {
6451 "GPIO5"
6452 };
6453 (ADC1_CH4 $(, $_fallback:literal)?) => {
6454 "GPIO5"
6455 };
6456 (LP_GPIO5 $(, $_fallback:literal)?) => {
6457 "GPIO5"
6458 };
6459 (TOUCH6 $(, $_fallback:literal)?) => {
6460 "GPIO6"
6461 };
6462 (ADC1_CH5 $(, $_fallback:literal)?) => {
6463 "GPIO6"
6464 };
6465 (LP_GPIO6 $(, $_fallback:literal)?) => {
6466 "GPIO6"
6467 };
6468 (TOUCH7 $(, $_fallback:literal)?) => {
6469 "GPIO7"
6470 };
6471 (ADC1_CH6 $(, $_fallback:literal)?) => {
6472 "GPIO7"
6473 };
6474 (LP_GPIO7 $(, $_fallback:literal)?) => {
6475 "GPIO7"
6476 };
6477 (SUBSPICS1 $(, $_fallback:literal)?) => {
6478 "GPIO8"
6479 };
6480 (TOUCH8 $(, $_fallback:literal)?) => {
6481 "GPIO8"
6482 };
6483 (ADC1_CH7 $(, $_fallback:literal)?) => {
6484 "GPIO8"
6485 };
6486 (LP_GPIO8 $(, $_fallback:literal)?) => {
6487 "GPIO8"
6488 };
6489 (SUBSPIHD $(, $_fallback:literal)?) => {
6490 "GPIO9"
6491 };
6492 (FSPIHD $(, $_fallback:literal)?) => {
6493 "GPIO9"
6494 };
6495 (TOUCH9 $(, $_fallback:literal)?) => {
6496 "GPIO9"
6497 };
6498 (ADC1_CH8 $(, $_fallback:literal)?) => {
6499 "GPIO9"
6500 };
6501 (LP_GPIO9 $(, $_fallback:literal)?) => {
6502 "GPIO9"
6503 };
6504 (FSPIIO4 $(, $_fallback:literal)?) => {
6505 "GPIO10"
6506 };
6507 (SUBSPICS0 $(, $_fallback:literal)?) => {
6508 "GPIO10"
6509 };
6510 (FSPICS0 $(, $_fallback:literal)?) => {
6511 "GPIO10"
6512 };
6513 (TOUCH10 $(, $_fallback:literal)?) => {
6514 "GPIO10"
6515 };
6516 (ADC1_CH9 $(, $_fallback:literal)?) => {
6517 "GPIO10"
6518 };
6519 (LP_GPIO10 $(, $_fallback:literal)?) => {
6520 "GPIO10"
6521 };
6522 (FSPIIO5 $(, $_fallback:literal)?) => {
6523 "GPIO11"
6524 };
6525 (SUBSPID $(, $_fallback:literal)?) => {
6526 "GPIO11"
6527 };
6528 (FSPID $(, $_fallback:literal)?) => {
6529 "GPIO11"
6530 };
6531 (TOUCH11 $(, $_fallback:literal)?) => {
6532 "GPIO11"
6533 };
6534 (ADC2_CH0 $(, $_fallback:literal)?) => {
6535 "GPIO11"
6536 };
6537 (LP_GPIO11 $(, $_fallback:literal)?) => {
6538 "GPIO11"
6539 };
6540 (FSPIIO6 $(, $_fallback:literal)?) => {
6541 "GPIO12"
6542 };
6543 (SUBSPICLK $(, $_fallback:literal)?) => {
6544 "GPIO12"
6545 };
6546 (FSPICLK $(, $_fallback:literal)?) => {
6547 "GPIO12"
6548 };
6549 (TOUCH12 $(, $_fallback:literal)?) => {
6550 "GPIO12"
6551 };
6552 (ADC2_CH1 $(, $_fallback:literal)?) => {
6553 "GPIO12"
6554 };
6555 (LP_GPIO12 $(, $_fallback:literal)?) => {
6556 "GPIO12"
6557 };
6558 (FSPIIO7 $(, $_fallback:literal)?) => {
6559 "GPIO13"
6560 };
6561 (SUBSPIQ $(, $_fallback:literal)?) => {
6562 "GPIO13"
6563 };
6564 (FSPIQ $(, $_fallback:literal)?) => {
6565 "GPIO13"
6566 };
6567 (TOUCH13 $(, $_fallback:literal)?) => {
6568 "GPIO13"
6569 };
6570 (ADC2_CH2 $(, $_fallback:literal)?) => {
6571 "GPIO13"
6572 };
6573 (LP_GPIO13 $(, $_fallback:literal)?) => {
6574 "GPIO13"
6575 };
6576 (FSPIDQS $(, $_fallback:literal)?) => {
6577 "GPIO14"
6578 };
6579 (SUBSPIWP $(, $_fallback:literal)?) => {
6580 "GPIO14"
6581 };
6582 (FSPIWP $(, $_fallback:literal)?) => {
6583 "GPIO14"
6584 };
6585 (TOUCH14 $(, $_fallback:literal)?) => {
6586 "GPIO14"
6587 };
6588 (ADC2_CH3 $(, $_fallback:literal)?) => {
6589 "GPIO14"
6590 };
6591 (LP_GPIO14 $(, $_fallback:literal)?) => {
6592 "GPIO14"
6593 };
6594 (U0RTS $(, $_fallback:literal)?) => {
6595 "GPIO15"
6596 };
6597 (XTAL_32K_P $(, $_fallback:literal)?) => {
6598 "GPIO15"
6599 };
6600 (ADC2_CH4 $(, $_fallback:literal)?) => {
6601 "GPIO15"
6602 };
6603 (LP_GPIO15 $(, $_fallback:literal)?) => {
6604 "GPIO15"
6605 };
6606 (U0CTS $(, $_fallback:literal)?) => {
6607 "GPIO16"
6608 };
6609 (XTAL_32K_N $(, $_fallback:literal)?) => {
6610 "GPIO16"
6611 };
6612 (ADC2_CH5 $(, $_fallback:literal)?) => {
6613 "GPIO16"
6614 };
6615 (LP_GPIO16 $(, $_fallback:literal)?) => {
6616 "GPIO16"
6617 };
6618 (U1TXD $(, $_fallback:literal)?) => {
6619 "GPIO17"
6620 };
6621 (ADC2_CH6 $(, $_fallback:literal)?) => {
6622 "GPIO17"
6623 };
6624 (LP_GPIO17 $(, $_fallback:literal)?) => {
6625 "GPIO17"
6626 };
6627 (U1RXD $(, $_fallback:literal)?) => {
6628 "GPIO18"
6629 };
6630 (CLK_OUT3 $(, $_fallback:literal)?) => {
6631 "GPIO18"
6632 };
6633 (ADC2_CH7 $(, $_fallback:literal)?) => {
6634 "GPIO18"
6635 };
6636 (LP_GPIO18 $(, $_fallback:literal)?) => {
6637 "GPIO18"
6638 };
6639 (U1RTS $(, $_fallback:literal)?) => {
6640 "GPIO19"
6641 };
6642 (CLK_OUT2 $(, $_fallback:literal)?) => {
6643 "GPIO19"
6644 };
6645 (USB_FS_DM $(, $_fallback:literal)?) => {
6646 "GPIO19"
6647 };
6648 (ADC2_CH8 $(, $_fallback:literal)?) => {
6649 "GPIO19"
6650 };
6651 (LP_GPIO19 $(, $_fallback:literal)?) => {
6652 "GPIO19"
6653 };
6654 (U1CTS $(, $_fallback:literal)?) => {
6655 "GPIO20"
6656 };
6657 (CLK_OUT1 $(, $_fallback:literal)?) => {
6658 "GPIO20"
6659 };
6660 (USB_FS_DP $(, $_fallback:literal)?) => {
6661 "GPIO20"
6662 };
6663 (ADC2_CH9 $(, $_fallback:literal)?) => {
6664 "GPIO20"
6665 };
6666 (LP_GPIO20 $(, $_fallback:literal)?) => {
6667 "GPIO20"
6668 };
6669 (LP_GPIO21 $(, $_fallback:literal)?) => {
6670 "GPIO21"
6671 };
6672 (SPICS1 $(, $_fallback:literal)?) => {
6673 "GPIO26"
6674 };
6675 (SPIHD $(, $_fallback:literal)?) => {
6676 "GPIO27"
6677 };
6678 (SPIWP $(, $_fallback:literal)?) => {
6679 "GPIO28"
6680 };
6681 (SPICS0 $(, $_fallback:literal)?) => {
6682 "GPIO29"
6683 };
6684 (SPICLK $(, $_fallback:literal)?) => {
6685 "GPIO30"
6686 };
6687 (SPIQ $(, $_fallback:literal)?) => {
6688 "GPIO31"
6689 };
6690 (SPID $(, $_fallback:literal)?) => {
6691 "GPIO32"
6692 };
6693 (SPIIO4 $(, $_fallback:literal)?) => {
6694 "GPIO33"
6695 };
6696 (SPIIO5 $(, $_fallback:literal)?) => {
6697 "GPIO34"
6698 };
6699 (SPIIO6 $(, $_fallback:literal)?) => {
6700 "GPIO35"
6701 };
6702 (SPIIO7 $(, $_fallback:literal)?) => {
6703 "GPIO36"
6704 };
6705 (SPIDQS $(, $_fallback:literal)?) => {
6706 "GPIO37"
6707 };
6708 (MTCK $(, $_fallback:literal)?) => {
6709 "GPIO39"
6710 };
6711 (MTDO $(, $_fallback:literal)?) => {
6712 "GPIO40"
6713 };
6714 (MTDI $(, $_fallback:literal)?) => {
6715 "GPIO41"
6716 };
6717 (MTMS $(, $_fallback:literal)?) => {
6718 "GPIO42"
6719 };
6720 (U0TXD $(, $_fallback:literal)?) => {
6721 "GPIO43"
6722 };
6723 (U0RXD $(, $_fallback:literal)?) => {
6724 "GPIO44"
6725 };
6726 (SPICLK_P_DIFF $(, $_fallback:literal)?) => {
6727 "GPIO47"
6728 };
6729 (SUBSPICLK_P_DIFF $(, $_fallback:literal)?) => {
6730 "GPIO47"
6731 };
6732 (SPICLK_N_DIFF $(, $_fallback:literal)?) => {
6733 "GPIO48"
6734 };
6735 (SUBSPICLK_N_DIFF $(, $_fallback:literal)?) => {
6736 "GPIO48"
6737 };
6738 ($_signal:ident, $fallback:literal) => {
6739 $fallback
6740 };
6741}
6742#[macro_export]
6746#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6747macro_rules! define_io_mux_signals {
6748 () => {
6749 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6750 #[derive(Debug, PartialEq, Copy, Clone)]
6751 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6752 #[doc(hidden)]
6753 pub enum InputSignal {
6754 SPIQ = 0,
6755 SPID = 1,
6756 SPIHD = 2,
6757 SPIWP = 3,
6758 SPID4 = 7,
6759 SPID5 = 8,
6760 SPID6 = 9,
6761 SPID7 = 10,
6762 SPIDQS = 11,
6763 U0RXD = 12,
6764 U0CTS = 13,
6765 U0DSR = 14,
6766 U1RXD = 15,
6767 U1CTS = 16,
6768 U1DSR = 17,
6769 U2RXD = 18,
6770 U2CTS = 19,
6771 U2DSR = 20,
6772 I2S1_MCLK = 21,
6773 I2S0O_BCK = 22,
6774 I2S0_MCLK = 23,
6775 I2S0O_WS = 24,
6776 I2S0I_SD = 25,
6777 I2S0I_BCK = 26,
6778 I2S0I_WS = 27,
6779 I2S1O_BCK = 28,
6780 I2S1O_WS = 29,
6781 I2S1I_SD = 30,
6782 I2S1I_BCK = 31,
6783 I2S1I_WS = 32,
6784 PCNT0_SIG_CH0 = 33,
6785 PCNT0_SIG_CH1 = 34,
6786 PCNT0_CTRL_CH0 = 35,
6787 PCNT0_CTRL_CH1 = 36,
6788 PCNT1_SIG_CH0 = 37,
6789 PCNT1_SIG_CH1 = 38,
6790 PCNT1_CTRL_CH0 = 39,
6791 PCNT1_CTRL_CH1 = 40,
6792 PCNT2_SIG_CH0 = 41,
6793 PCNT2_SIG_CH1 = 42,
6794 PCNT2_CTRL_CH0 = 43,
6795 PCNT2_CTRL_CH1 = 44,
6796 PCNT3_SIG_CH0 = 45,
6797 PCNT3_SIG_CH1 = 46,
6798 PCNT3_CTRL_CH0 = 47,
6799 PCNT3_CTRL_CH1 = 48,
6800 I2S0I_SD1 = 51,
6801 I2S0I_SD2 = 52,
6802 I2S0I_SD3 = 53,
6803 CORE1_GPIO7 = 54,
6804 USB_EXTPHY_VP = 55,
6805 USB_EXTPHY_VM = 56,
6806 USB_EXTPHY_RCV = 57,
6807 USB_FS_IDDIG = 58,
6808 USB_FS_AVALID = 59,
6809 USB_FS_SRP_BVALID = 60,
6810 USB_FS_VBUSVALID = 61,
6811 USB_SRP_SESSEND = 62,
6812 SPI3_CLK = 66,
6813 SPI3_Q = 67,
6814 SPI3_D = 68,
6815 SPI3_HD = 69,
6816 SPI3_WP = 70,
6817 SPI3_CS0 = 71,
6818 RMT_SIG_0 = 81,
6819 RMT_SIG_1 = 82,
6820 RMT_SIG_2 = 83,
6821 RMT_SIG_3 = 84,
6822 I2CEXT0_SCL = 89,
6823 I2CEXT0_SDA = 90,
6824 I2CEXT1_SCL = 91,
6825 I2CEXT1_SDA = 92,
6826 FSPICLK = 101,
6827 FSPIQ = 102,
6828 FSPID = 103,
6829 FSPIHD = 104,
6830 FSPIWP = 105,
6831 FSPIIO4 = 106,
6832 FSPIIO5 = 107,
6833 FSPIIO6 = 108,
6834 FSPIIO7 = 109,
6835 FSPICS0 = 110,
6836 TWAI_RX = 116,
6837 SUBSPIQ = 120,
6838 SUBSPID = 121,
6839 SUBSPIHD = 122,
6840 SUBSPIWP = 123,
6841 CORE1_GPIO0 = 129,
6842 CORE1_GPIO1 = 130,
6843 CORE1_GPIO2 = 131,
6844 CAM_DATA_0 = 133,
6845 CAM_DATA_1 = 134,
6846 CAM_DATA_2 = 135,
6847 CAM_DATA_3 = 136,
6848 CAM_DATA_4 = 137,
6849 CAM_DATA_5 = 138,
6850 CAM_DATA_6 = 139,
6851 CAM_DATA_7 = 140,
6852 CAM_DATA_8 = 141,
6853 CAM_DATA_9 = 142,
6854 CAM_DATA_10 = 143,
6855 CAM_DATA_11 = 144,
6856 CAM_DATA_12 = 145,
6857 CAM_DATA_13 = 146,
6858 CAM_DATA_14 = 147,
6859 CAM_DATA_15 = 148,
6860 CAM_PCLK = 149,
6861 CAM_H_ENABLE = 150,
6862 CAM_H_SYNC = 151,
6863 CAM_V_SYNC = 152,
6864 SUBSPID4 = 155,
6865 SUBSPID5 = 156,
6866 SUBSPID6 = 157,
6867 SUBSPID7 = 158,
6868 SUBSPIDQS = 159,
6869 PWM0_SYNC0 = 160,
6870 PWM0_SYNC1 = 161,
6871 PWM0_SYNC2 = 162,
6872 PWM0_F0 = 163,
6873 PWM0_F1 = 164,
6874 PWM0_F2 = 165,
6875 PWM0_CAP0 = 166,
6876 PWM0_CAP1 = 167,
6877 PWM0_CAP2 = 168,
6878 PWM1_SYNC0 = 169,
6879 PWM1_SYNC1 = 170,
6880 PWM1_SYNC2 = 171,
6881 PWM1_F0 = 172,
6882 PWM1_F1 = 173,
6883 PWM1_F2 = 174,
6884 PWM1_CAP0 = 175,
6885 PWM1_CAP1 = 176,
6886 PWM1_CAP2 = 177,
6887 SDHOST_CCMD_IN_1 = 178,
6888 SDHOST_CCMD_IN_2 = 179,
6889 SDHOST_CDATA_IN_10 = 180,
6890 SDHOST_CDATA_IN_11 = 181,
6891 SDHOST_CDATA_IN_12 = 182,
6892 SDHOST_CDATA_IN_13 = 183,
6893 SDHOST_CDATA_IN_14 = 184,
6894 SDHOST_CDATA_IN_15 = 185,
6895 SDHOST_CDATA_IN_16 = 186,
6896 SDHOST_CDATA_IN_17 = 187,
6897 SDHOST_DATA_STROBE_1 = 192,
6898 SDHOST_DATA_STROBE_2 = 193,
6899 SDHOST_CARD_DETECT_N_1 = 194,
6900 SDHOST_CARD_DETECT_N_2 = 195,
6901 SDHOST_CARD_WRITE_PRT_1 = 196,
6902 SDHOST_CARD_WRITE_PRT_2 = 197,
6903 SDHOST_CARD_INT_N_1 = 198,
6904 SDHOST_CARD_INT_N_2 = 199,
6905 SDHOST_CDATA_IN_20 = 213,
6906 SDHOST_CDATA_IN_21 = 214,
6907 SDHOST_CDATA_IN_22 = 215,
6908 SDHOST_CDATA_IN_23 = 216,
6909 SDHOST_CDATA_IN_24 = 217,
6910 SDHOST_CDATA_IN_25 = 218,
6911 SDHOST_CDATA_IN_26 = 219,
6912 SDHOST_CDATA_IN_27 = 220,
6913 PRO_ALONEGPIO0 = 221,
6914 PRO_ALONEGPIO1 = 222,
6915 PRO_ALONEGPIO2 = 223,
6916 PRO_ALONEGPIO3 = 224,
6917 PRO_ALONEGPIO4 = 225,
6918 PRO_ALONEGPIO5 = 226,
6919 PRO_ALONEGPIO6 = 227,
6920 PRO_ALONEGPIO7 = 228,
6921 USB_JTAG_TDO_BRIDGE = 251,
6922 CORE1_GPIO3 = 252,
6923 CORE1_GPIO4 = 253,
6924 CORE1_GPIO5 = 254,
6925 CORE1_GPIO6 = 255,
6926 SPIIO4,
6927 SPIIO5,
6928 SPIIO6,
6929 SPIIO7,
6930 MTDI,
6931 MTCK,
6932 MTMS,
6933 }
6934 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6935 #[derive(Debug, PartialEq, Copy, Clone)]
6936 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6937 #[doc(hidden)]
6938 pub enum OutputSignal {
6939 SPIQ = 0,
6940 SPID = 1,
6941 SPIHD = 2,
6942 SPIWP = 3,
6943 SPICLK = 4,
6944 SPICS0 = 5,
6945 SPICS1 = 6,
6946 SPID4 = 7,
6947 SPID5 = 8,
6948 SPID6 = 9,
6949 SPID7 = 10,
6950 SPIDQS = 11,
6951 U0TXD = 12,
6952 U0RTS = 13,
6953 U0DTR = 14,
6954 U1TXD = 15,
6955 U1RTS = 16,
6956 U1DTR = 17,
6957 U2TXD = 18,
6958 U2RTS = 19,
6959 U2DTR = 20,
6960 I2S1_MCLK = 21,
6961 I2S0O_BCK = 22,
6962 I2S0_MCLK = 23,
6963 I2S0O_WS = 24,
6964 I2S0O_SD = 25,
6965 I2S0I_BCK = 26,
6966 I2S0I_WS = 27,
6967 I2S1O_BCK = 28,
6968 I2S1O_WS = 29,
6969 I2S1O_SD = 30,
6970 I2S1I_BCK = 31,
6971 I2S1I_WS = 32,
6972 CORE1_GPIO7 = 54,
6973 USB_EXTPHY_OEN = 55,
6974 USB_EXTPHY_VPO = 57,
6975 USB_EXTPHY_VMO = 58,
6976 SPI3_CLK = 66,
6977 SPI3_Q = 67,
6978 SPI3_D = 68,
6979 SPI3_HD = 69,
6980 SPI3_WP = 70,
6981 SPI3_CS0 = 71,
6982 SPI3_CS1 = 72,
6983 LEDC_LS_SIG0 = 73,
6984 LEDC_LS_SIG1 = 74,
6985 LEDC_LS_SIG2 = 75,
6986 LEDC_LS_SIG3 = 76,
6987 LEDC_LS_SIG4 = 77,
6988 LEDC_LS_SIG5 = 78,
6989 LEDC_LS_SIG6 = 79,
6990 LEDC_LS_SIG7 = 80,
6991 RMT_SIG_0 = 81,
6992 RMT_SIG_1 = 82,
6993 RMT_SIG_2 = 83,
6994 RMT_SIG_3 = 84,
6995 I2CEXT0_SCL = 89,
6996 I2CEXT0_SDA = 90,
6997 I2CEXT1_SCL = 91,
6998 I2CEXT1_SDA = 92,
6999 GPIO_SD0 = 93,
7000 GPIO_SD1 = 94,
7001 GPIO_SD2 = 95,
7002 GPIO_SD3 = 96,
7003 GPIO_SD4 = 97,
7004 GPIO_SD5 = 98,
7005 GPIO_SD6 = 99,
7006 GPIO_SD7 = 100,
7007 FSPICLK = 101,
7008 FSPIQ = 102,
7009 FSPID = 103,
7010 FSPIHD = 104,
7011 FSPIWP = 105,
7012 FSPIIO4 = 106,
7013 FSPIIO5 = 107,
7014 FSPIIO6 = 108,
7015 FSPIIO7 = 109,
7016 FSPICS0 = 110,
7017 FSPICS1 = 111,
7018 FSPICS2 = 112,
7019 FSPICS3 = 113,
7020 FSPICS4 = 114,
7021 FSPICS5 = 115,
7022 TWAI_TX = 116,
7023 SUBSPICLK = 119,
7024 SUBSPIQ = 120,
7025 SUBSPID = 121,
7026 SUBSPIHD = 122,
7027 SUBSPIWP = 123,
7028 SUBSPICS0 = 124,
7029 SUBSPICS1 = 125,
7030 FSPIDQS = 126,
7031 SPI3_CS2 = 127,
7032 I2S0O_SD1 = 128,
7033 CORE1_GPIO0 = 129,
7034 CORE1_GPIO1 = 130,
7035 CORE1_GPIO2 = 131,
7036 LCD_CS = 132,
7037 LCD_DATA_0 = 133,
7038 LCD_DATA_1 = 134,
7039 LCD_DATA_2 = 135,
7040 LCD_DATA_3 = 136,
7041 LCD_DATA_4 = 137,
7042 LCD_DATA_5 = 138,
7043 LCD_DATA_6 = 139,
7044 LCD_DATA_7 = 140,
7045 LCD_DATA_8 = 141,
7046 LCD_DATA_9 = 142,
7047 LCD_DATA_10 = 143,
7048 LCD_DATA_11 = 144,
7049 LCD_DATA_12 = 145,
7050 LCD_DATA_13 = 146,
7051 LCD_DATA_14 = 147,
7052 LCD_DATA_15 = 148,
7053 CAM_CLK = 149,
7054 LCD_H_ENABLE = 150,
7055 LCD_H_SYNC = 151,
7056 LCD_V_SYNC = 152,
7057 LCD_DC = 153,
7058 LCD_PCLK = 154,
7059 SUBSPID4 = 155,
7060 SUBSPID5 = 156,
7061 SUBSPID6 = 157,
7062 SUBSPID7 = 158,
7063 SUBSPIDQS = 159,
7064 PWM0_0A = 160,
7065 PWM0_0B = 161,
7066 PWM0_1A = 162,
7067 PWM0_1B = 163,
7068 PWM0_2A = 164,
7069 PWM0_2B = 165,
7070 PWM1_0A = 166,
7071 PWM1_0B = 167,
7072 PWM1_1A = 168,
7073 PWM1_1B = 169,
7074 PWM1_2A = 170,
7075 PWM1_2B = 171,
7076 SDHOST_CCLK_OUT_1 = 172,
7077 SDHOST_CCLK_OUT_2 = 173,
7078 SDHOST_RST_N_1 = 174,
7079 SDHOST_RST_N_2 = 175,
7080 SDHOST_CCMD_OD_PULLUP_EN_N = 176,
7081 SDIO_TOHOST_INT = 177,
7082 SDHOST_CCMD_OUT_1 = 178,
7083 SDHOST_CCMD_OUT_2 = 179,
7084 SDHOST_CDATA_OUT_10 = 180,
7085 SDHOST_CDATA_OUT_11 = 181,
7086 SDHOST_CDATA_OUT_12 = 182,
7087 SDHOST_CDATA_OUT_13 = 183,
7088 SDHOST_CDATA_OUT_14 = 184,
7089 SDHOST_CDATA_OUT_15 = 185,
7090 SDHOST_CDATA_OUT_16 = 186,
7091 SDHOST_CDATA_OUT_17 = 187,
7092 SDHOST_CDATA_OUT_20 = 213,
7093 SDHOST_CDATA_OUT_21 = 214,
7094 SDHOST_CDATA_OUT_22 = 215,
7095 SDHOST_CDATA_OUT_23 = 216,
7096 SDHOST_CDATA_OUT_24 = 217,
7097 SDHOST_CDATA_OUT_25 = 218,
7098 SDHOST_CDATA_OUT_26 = 219,
7099 SDHOST_CDATA_OUT_27 = 220,
7100 PRO_ALONEGPIO0 = 221,
7101 PRO_ALONEGPIO1 = 222,
7102 PRO_ALONEGPIO2 = 223,
7103 PRO_ALONEGPIO3 = 224,
7104 PRO_ALONEGPIO4 = 225,
7105 PRO_ALONEGPIO5 = 226,
7106 PRO_ALONEGPIO6 = 227,
7107 PRO_ALONEGPIO7 = 228,
7108 USB_JTAG_TRST = 251,
7109 CORE1_GPIO3 = 252,
7110 CORE1_GPIO4 = 253,
7111 CORE1_GPIO5 = 254,
7112 CORE1_GPIO6 = 255,
7113 GPIO = 256,
7114 SPIIO4,
7115 SPIIO5,
7116 SPIIO6,
7117 SPIIO7,
7118 CLK_OUT1,
7119 CLK_OUT2,
7120 CLK_OUT3,
7121 SPICLK_P_DIFF,
7122 SPICLK_N_DIFF,
7123 SUBSPICLK_P_DIFF,
7124 SUBSPICLK_N_DIFF,
7125 MTDO,
7126 }
7127 };
7128}
7129#[macro_export]
7136#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7137macro_rules! define_lp_functions {
7138 () => {
7139 #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
7144 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
7145 #[doc(hidden)]
7146 pub enum LpFunction {
7147 _0 = 0,
7149 _3 = 3,
7151 }
7152 impl LpFunction {
7153 pub const LP_GPIO: Self = Self::_0;
7155 }
7156 };
7157}
7158#[macro_export]
7171#[expect(clippy::crate_in_macro_def)]
7172#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
7173macro_rules! define_io_mux_reg {
7174 () => {
7175 pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
7176 crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
7177 }
7178 };
7179}