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 "esp32s2"
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-S2"
34 };
35}
36#[macro_export]
38#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
39macro_rules! property {
40 ("chip") => {
41 "esp32s2"
42 };
43 ("arch") => {
44 "xtensa"
45 };
46 ("cores") => {
47 1
48 };
49 ("cores", str) => {
50 stringify!(1)
51 };
52 ("trm") => {
53 "https://www.espressif.com/sites/default/files/documentation/esp32-s2_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 242
96 };
97 ("gpio.input_signal_max", str) => {
98 stringify!(242)
99 };
100 ("gpio.output_signal_max") => {
101 256
102 };
103 ("gpio.output_signal_max", str) => {
104 stringify!(256)
105 };
106 ("dedicated_gpio.version") => {
107 "esp32s2"
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 false
141 };
142 ("uart.has_sclk_enable") => {
143 false
144 };
145 ("i2c_master.version") => {
146 2
147 };
148 ("i2c_master.version", str) => {
149 stringify!(2)
150 };
151 ("i2c_master.has_fsm_timeouts") => {
152 false
153 };
154 ("i2c_master.has_hw_bus_clear") => {
155 false
156 };
157 ("i2c_master.has_bus_timeout_enable") => {
158 true
159 };
160 ("i2c_master.separate_filter_config_registers") => {
161 true
162 };
163 ("i2c_master.can_estimate_nack_reason") => {
164 false
165 };
166 ("i2c_master.has_conf_update") => {
167 false
168 };
169 ("i2c_master.has_reliable_fsm_reset") => {
170 false
171 };
172 ("i2c_master.has_arbitration_en") => {
173 true
174 };
175 ("i2c_master.has_tx_fifo_watermark") => {
176 false
177 };
178 ("i2c_master.bus_timeout_is_exponential") => {
179 false
180 };
181 ("i2c_master.has_pd_en") => {
182 true
183 };
184 ("i2c_master.i2c0_data_register_ahb_address") => {
185 1610690588
186 };
187 ("i2c_master.i2c0_data_register_ahb_address", str) => {
188 stringify!(1610690588)
189 };
190 ("i2c_master.max_bus_timeout") => {
191 16777215
192 };
193 ("i2c_master.max_bus_timeout", str) => {
194 stringify!(16777215)
195 };
196 ("i2c_master.ll_intr_mask") => {
197 131071
198 };
199 ("i2c_master.ll_intr_mask", str) => {
200 stringify!(131071)
201 };
202 ("i2c_master.fifo_size") => {
203 32
204 };
205 ("i2c_master.fifo_size", str) => {
206 stringify!(32)
207 };
208 ("spi_master.version") => {
209 2
210 };
211 ("spi_master.version", str) => {
212 stringify!(2)
213 };
214 ("spi_master.fifo_size") => {
215 72
216 };
217 ("spi_master.fifo_size", str) => {
218 stringify!(72)
219 };
220 ("spi_master.bit_order_is_bool") => {
221 true
222 };
223 ("spi_master.has_octal") => {
224 true
225 };
226 ("spi_master.has_app_interrupts") => {
227 false
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 1
240 };
241 ("i2s.version", str) => {
242 stringify!(1)
243 };
244 ("i2s.mclk_divider_bit_width") => {
245 6
246 };
247 ("i2s.mclk_divider_bit_width", str) => {
248 stringify!(6)
249 };
250 ("i2s.max_ws_width") => {
251 128
252 };
253 ("i2s.max_ws_width", str) => {
254 stringify!(128)
255 };
256 ("i2s.clock_configured_by_pcr") => {
257 false
258 };
259 ("i2s.clock_configured_by_hp_sys_clkrst") => {
260 false
261 };
262 ("i2s.supports_pdm_rx_hp_filter") => {
263 false
264 };
265 ("i2s.supports_pdm_tx") => {
266 false
267 };
268 ("i2s.supports_pdm_rx") => {
269 false
270 };
271 ("i2s.supports_pcm2pdm") => {
272 false
273 };
274 ("i2s.supports_pdm2pcm") => {
275 false
276 };
277 ("rmt.ram_start") => {
278 1061250048
279 };
280 ("rmt.ram_start", str) => {
281 stringify!(1061250048)
282 };
283 ("rmt.channel_ram_size") => {
284 64
285 };
286 ("rmt.channel_ram_size", str) => {
287 stringify!(64)
288 };
289 ("rmt.has_tx_immediate_stop") => {
290 true
291 };
292 ("rmt.has_tx_loop_count") => {
293 true
294 };
295 ("rmt.has_tx_loop_auto_stop") => {
296 false
297 };
298 ("rmt.has_tx_carrier_data_only") => {
299 true
300 };
301 ("rmt.has_tx_sync") => {
302 true
303 };
304 ("rmt.has_rx_wrap") => {
305 false
306 };
307 ("rmt.has_rx_demodulation") => {
308 true
309 };
310 ("rmt.has_per_channel_clock") => {
311 true
312 };
313 ("usb_otg.fifo_depth_words") => {
314 256
315 };
316 ("usb_otg.fifo_depth_words", str) => {
317 stringify!(256)
318 };
319 ("wifi.has_wifi6") => {
320 false
321 };
322 ("wifi.mac_version") => {
323 1
324 };
325 ("wifi.mac_version", str) => {
326 stringify!(1)
327 };
328 ("wifi.has_5g") => {
329 false
330 };
331 ("wifi.csi_supported") => {
332 true
333 };
334 ("phy.combo_module") => {
335 false
336 };
337 ("ledc.version") => {
338 2
339 };
340 ("ledc.version", str) => {
341 stringify!(2)
342 };
343 ("ledc.channel_count") => {
344 8
345 };
346 ("ledc.channel_count", str) => {
347 stringify!(8)
348 };
349 ("sdm.channel_count") => {
350 8
351 };
352 ("sdm.channel_count", str) => {
353 stringify!(8)
354 };
355 ("timergroup.timg_has_timer1") => {
356 true
357 };
358 ("timergroup.timg_has_divcnt_rst") => {
359 false
360 };
361 ("aes.has_split_text_registers") => {
362 true
363 };
364 ("aes.endianness_configurable") => {
365 true
366 };
367 ("rng.apb_cycle_wait_num") => {
368 16
369 };
370 ("rng.apb_cycle_wait_num", str) => {
371 stringify!(16)
372 };
373 ("rng.trng_supported") => {
374 true
375 };
376 ("rng.is_lp_sys") => {
377 false
378 };
379 ("rsa.version") => {
380 2
381 };
382 ("rsa.version", str) => {
383 stringify!(2)
384 };
385 ("rsa.size_increment") => {
386 32
387 };
388 ("rsa.size_increment", str) => {
389 stringify!(32)
390 };
391 ("rsa.memory_size_bytes") => {
392 512
393 };
394 ("rsa.memory_size_bytes", str) => {
395 stringify!(512)
396 };
397 ("sleep.light_sleep") => {
398 true
399 };
400 ("sleep.deep_sleep") => {
401 true
402 };
403 ("sleep.rejectable_mask") => {
404 10543
405 };
406 ("sleep.ext1_version") => {
407 1
408 };
409 ("sleep.ext1_version", str) => {
410 stringify!(1)
411 };
412 ("sleep.pin_wakeup_version") => {
413 1
414 };
415 ("sleep.pin_wakeup_version", str) => {
416 stringify!(1)
417 };
418 ("sleep.deep_sleep_needs_gpio_isolation") => {
419 true
420 };
421 ("dma.mem2mem_requires_peripheral") => {
422 false
423 };
424 ("dma.ext_mem_configurable_block_size") => {
425 true
426 };
427 ("dma.separate_in_out_interrupts") => {
428 false
429 };
430 ("interrupts.status_registers") => {
431 3
432 };
433 ("interrupts.status_registers", str) => {
434 stringify!(3)
435 };
436 ("mmu.page_size") => {
437 65536
438 };
439 ("mmu.page_size", str) => {
440 stringify!(65536)
441 };
442 ("mmu.entry_num") => {
443 256
444 };
445 ("mmu.entry_num", str) => {
446 stringify!(256)
447 };
448 ("psram.octal_spi") => {
449 false
450 };
451 ("psram.hex_spi") => {
452 false
453 };
454 ("psram.extmem_origin") => {
455 1062207488
456 };
457 ("psram.extmem_origin", str) => {
458 stringify!(1062207488)
459 };
460 ("rom.has_crc_le") => {
461 true
462 };
463 ("rom.has_crc_be") => {
464 false
465 };
466 ("rom.has_md5_bsd") => {
467 true
468 };
469 ("rom.has_md5_mbedtls") => {
470 false
471 };
472 ("soc.cpu_has_branch_predictor") => {
473 false
474 };
475 ("soc.cpu_has_csr_pc") => {
476 false
477 };
478 ("soc.multi_core_enabled") => {
479 false
480 };
481 ("soc.internal_memory_cached") => {
482 false
483 };
484 ("soc.has_swd_watchdog") => {
485 true
486 };
487 ("soc.cpu_mcause_mask") => {
488 0
489 };
490 ("soc.cpu_mcause_mask", str) => {
491 stringify!(0)
492 };
493 ("clock_tree.cpu_pll_div_in") => {
494 [crate ::soc::clocks::CpuPllDivInConfig::Pll, crate
495 ::soc::clocks::CpuPllDivInConfig::Apll]
496 };
497 ("clock_tree.cpu_pll_div.divisor") => {
498 [2, 3, 4, 6]
499 };
500 ("clock_tree.system_pre_div_in") => {
501 [crate ::soc::clocks::SystemPreDivInConfig::Xtal, crate
502 ::soc::clocks::SystemPreDivInConfig::RcFast]
503 };
504 ("clock_tree.system_pre_div.divisor") => {
505 (0, 1023)
506 };
507 ("clock_tree.cpu_clk") => {
508 [crate ::soc::clocks::CpuClkConfig::Xtal, crate
509 ::soc::clocks::CpuClkConfig::RcFast, crate ::soc::clocks::CpuClkConfig::Apll,
510 crate ::soc::clocks::CpuClkConfig::Pll]
511 };
512 ("clock_tree.apb_clk") => {
513 [crate ::soc::clocks::ApbClkConfig::Pll, crate ::soc::clocks::ApbClkConfig::Apll,
514 crate ::soc::clocks::ApbClkConfig::Xtal, crate
515 ::soc::clocks::ApbClkConfig::RcFast]
516 };
517 ("clock_tree.ref_tick_xtal.divisor") => {
518 (0, 255)
519 };
520 ("clock_tree.ref_tick_ck8m.divisor") => {
521 (0, 255)
522 };
523 ("clock_tree.ref_tick") => {
524 [crate ::soc::clocks::RefTickConfig::Pll, crate
525 ::soc::clocks::RefTickConfig::Apll, crate ::soc::clocks::RefTickConfig::Xtal,
526 crate ::soc::clocks::RefTickConfig::RcFast]
527 };
528 ("clock_tree.rtc_slow_clk") => {
529 [#[cfg(use_xtal32k)] crate ::soc::clocks::RtcSlowClkConfig::Xtal32k, crate
530 ::soc::clocks::RtcSlowClkConfig::RcSlow, crate
531 ::soc::clocks::RtcSlowClkConfig::RcFast]
532 };
533 ("clock_tree.rtc_fast_clk") => {
534 [crate ::soc::clocks::RtcFastClkConfig::Xtal, crate
535 ::soc::clocks::RtcFastClkConfig::Rc]
536 };
537 ("clock_tree.timg_calibration_clock") => {
538 [crate ::soc::clocks::TimgCalibrationClockConfig::RtcClk, crate
539 ::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
540 crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
541 };
542 ("clock_tree.timg.function_clock") => {
543 [crate ::soc::clocks::TimgFunctionClockConfig::XtalClk, crate
544 ::soc::clocks::TimgFunctionClockConfig::ApbClk]
545 };
546 ("clock_tree.uart.function_clock.sclk") => {
547 [crate ::soc::clocks::UartFunctionClockSclk::Apb, crate
548 ::soc::clocks::UartFunctionClockSclk::RefTick]
549 };
550 ("clock_tree.uart.baud_rate_generator.fractional") => {
551 (0, 15)
552 };
553 ("clock_tree.uart.baud_rate_generator.integral") => {
554 (0, 1048575)
555 };
556 ("clock_tree.rmt.sclk") => {
557 [crate ::soc::clocks::RmtSclkConfig::RefTick, crate
558 ::soc::clocks::RmtSclkConfig::ApbClk]
559 };
560 ("clock_tree.i2c.function_clock.sclk") => {
561 [crate ::soc::clocks::I2cFunctionClockSclk::Apb, crate
562 ::soc::clocks::I2cFunctionClockSclk::RefTick]
563 };
564 ("clock_tree.i2s.mclk.sclk") => {
565 [crate ::soc::clocks::I2sMclkSclk::PllF160m, crate
566 ::soc::clocks::I2sMclkSclk::Apll]
567 };
568 ("clock_tree.i2s.mclk.div_num") => {
569 (1, 255)
570 };
571 ("clock_tree.i2s.mclk.div_a") => {
572 (1, 63)
573 };
574 ("clock_tree.i2s.mclk.div_b") => {
575 (0, 63)
576 };
577}
578#[macro_export]
579#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
580macro_rules! for_each_dedicated_gpio {
581 ($($pattern:tt => $code:tt;)*) => {
582 macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
583 tt) => {} } _for_each_inner_dedicated_gpio!((0));
584 _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
585 _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
586 _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
587 _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
588 PRO_ALONEGPIO0)); _for_each_inner_dedicated_gpio!((0, 1, PRO_ALONEGPIO1));
589 _for_each_inner_dedicated_gpio!((0, 2, PRO_ALONEGPIO2));
590 _for_each_inner_dedicated_gpio!((0, 3, PRO_ALONEGPIO3));
591 _for_each_inner_dedicated_gpio!((0, 4, PRO_ALONEGPIO4));
592 _for_each_inner_dedicated_gpio!((0, 5, PRO_ALONEGPIO5));
593 _for_each_inner_dedicated_gpio!((0, 6, PRO_ALONEGPIO6));
594 _for_each_inner_dedicated_gpio!((0, 7, PRO_ALONEGPIO7));
595 _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
596 (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, PRO_ALONEGPIO0), (0, 1,
597 PRO_ALONEGPIO1), (0, 2, PRO_ALONEGPIO2), (0, 3, PRO_ALONEGPIO3), (0, 4,
598 PRO_ALONEGPIO4), (0, 5, PRO_ALONEGPIO5), (0, 6, PRO_ALONEGPIO6), (0, 7,
599 PRO_ALONEGPIO7)));
600 };
601}
602#[macro_export]
606#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
607macro_rules! define_lp_io_signals {
608 () => {};
609}
610#[macro_export]
632#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
633macro_rules! for_each_rmt_channel {
634 ($($pattern:tt => $code:tt;)*) => {
635 macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
636 => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
637 _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
638 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
639 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
640 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
641 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
642 _for_each_inner_rmt_channel!((all(0), (1), (2), (3)));
643 _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
644 _for_each_inner_rmt_channel!((rx(0, 0), (1, 1), (2, 2), (3, 3)));
645 };
646}
647#[macro_export]
648#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
649macro_rules! for_each_sdm_channel {
650 ($($pattern:tt => $code:tt;)*) => {
651 macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
652 => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
653 _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
654 _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
655 _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
656 _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
657 _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
658 _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
659 _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
660 _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
661 SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
662 GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
663 SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
664 };
665}
666#[macro_export]
667#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
668macro_rules! for_each_aes_key_length {
669 ($($pattern:tt => $code:tt;)*) => {
670 macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
671 tt) => {} } _for_each_inner_aes_key_length!((128));
672 _for_each_inner_aes_key_length!((192)); _for_each_inner_aes_key_length!((256));
673 _for_each_inner_aes_key_length!((128, 0, 4));
674 _for_each_inner_aes_key_length!((192, 1, 5));
675 _for_each_inner_aes_key_length!((256, 2, 6));
676 _for_each_inner_aes_key_length!((bits(128), (192), (256)));
677 _for_each_inner_aes_key_length!((modes(128, 0, 4), (192, 1, 5), (256, 2, 6)));
678 };
679}
680#[macro_export]
681#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
682macro_rules! for_each_rsa_exponentiation {
683 ($($pattern:tt => $code:tt;)*) => {
684 macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
685 ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
686 _for_each_inner_rsa_exponentiation!((64));
687 _for_each_inner_rsa_exponentiation!((96));
688 _for_each_inner_rsa_exponentiation!((128));
689 _for_each_inner_rsa_exponentiation!((160));
690 _for_each_inner_rsa_exponentiation!((192));
691 _for_each_inner_rsa_exponentiation!((224));
692 _for_each_inner_rsa_exponentiation!((256));
693 _for_each_inner_rsa_exponentiation!((288));
694 _for_each_inner_rsa_exponentiation!((320));
695 _for_each_inner_rsa_exponentiation!((352));
696 _for_each_inner_rsa_exponentiation!((384));
697 _for_each_inner_rsa_exponentiation!((416));
698 _for_each_inner_rsa_exponentiation!((448));
699 _for_each_inner_rsa_exponentiation!((480));
700 _for_each_inner_rsa_exponentiation!((512));
701 _for_each_inner_rsa_exponentiation!((544));
702 _for_each_inner_rsa_exponentiation!((576));
703 _for_each_inner_rsa_exponentiation!((608));
704 _for_each_inner_rsa_exponentiation!((640));
705 _for_each_inner_rsa_exponentiation!((672));
706 _for_each_inner_rsa_exponentiation!((704));
707 _for_each_inner_rsa_exponentiation!((736));
708 _for_each_inner_rsa_exponentiation!((768));
709 _for_each_inner_rsa_exponentiation!((800));
710 _for_each_inner_rsa_exponentiation!((832));
711 _for_each_inner_rsa_exponentiation!((864));
712 _for_each_inner_rsa_exponentiation!((896));
713 _for_each_inner_rsa_exponentiation!((928));
714 _for_each_inner_rsa_exponentiation!((960));
715 _for_each_inner_rsa_exponentiation!((992));
716 _for_each_inner_rsa_exponentiation!((1024));
717 _for_each_inner_rsa_exponentiation!((1056));
718 _for_each_inner_rsa_exponentiation!((1088));
719 _for_each_inner_rsa_exponentiation!((1120));
720 _for_each_inner_rsa_exponentiation!((1152));
721 _for_each_inner_rsa_exponentiation!((1184));
722 _for_each_inner_rsa_exponentiation!((1216));
723 _for_each_inner_rsa_exponentiation!((1248));
724 _for_each_inner_rsa_exponentiation!((1280));
725 _for_each_inner_rsa_exponentiation!((1312));
726 _for_each_inner_rsa_exponentiation!((1344));
727 _for_each_inner_rsa_exponentiation!((1376));
728 _for_each_inner_rsa_exponentiation!((1408));
729 _for_each_inner_rsa_exponentiation!((1440));
730 _for_each_inner_rsa_exponentiation!((1472));
731 _for_each_inner_rsa_exponentiation!((1504));
732 _for_each_inner_rsa_exponentiation!((1536));
733 _for_each_inner_rsa_exponentiation!((1568));
734 _for_each_inner_rsa_exponentiation!((1600));
735 _for_each_inner_rsa_exponentiation!((1632));
736 _for_each_inner_rsa_exponentiation!((1664));
737 _for_each_inner_rsa_exponentiation!((1696));
738 _for_each_inner_rsa_exponentiation!((1728));
739 _for_each_inner_rsa_exponentiation!((1760));
740 _for_each_inner_rsa_exponentiation!((1792));
741 _for_each_inner_rsa_exponentiation!((1824));
742 _for_each_inner_rsa_exponentiation!((1856));
743 _for_each_inner_rsa_exponentiation!((1888));
744 _for_each_inner_rsa_exponentiation!((1920));
745 _for_each_inner_rsa_exponentiation!((1952));
746 _for_each_inner_rsa_exponentiation!((1984));
747 _for_each_inner_rsa_exponentiation!((2016));
748 _for_each_inner_rsa_exponentiation!((2048));
749 _for_each_inner_rsa_exponentiation!((2080));
750 _for_each_inner_rsa_exponentiation!((2112));
751 _for_each_inner_rsa_exponentiation!((2144));
752 _for_each_inner_rsa_exponentiation!((2176));
753 _for_each_inner_rsa_exponentiation!((2208));
754 _for_each_inner_rsa_exponentiation!((2240));
755 _for_each_inner_rsa_exponentiation!((2272));
756 _for_each_inner_rsa_exponentiation!((2304));
757 _for_each_inner_rsa_exponentiation!((2336));
758 _for_each_inner_rsa_exponentiation!((2368));
759 _for_each_inner_rsa_exponentiation!((2400));
760 _for_each_inner_rsa_exponentiation!((2432));
761 _for_each_inner_rsa_exponentiation!((2464));
762 _for_each_inner_rsa_exponentiation!((2496));
763 _for_each_inner_rsa_exponentiation!((2528));
764 _for_each_inner_rsa_exponentiation!((2560));
765 _for_each_inner_rsa_exponentiation!((2592));
766 _for_each_inner_rsa_exponentiation!((2624));
767 _for_each_inner_rsa_exponentiation!((2656));
768 _for_each_inner_rsa_exponentiation!((2688));
769 _for_each_inner_rsa_exponentiation!((2720));
770 _for_each_inner_rsa_exponentiation!((2752));
771 _for_each_inner_rsa_exponentiation!((2784));
772 _for_each_inner_rsa_exponentiation!((2816));
773 _for_each_inner_rsa_exponentiation!((2848));
774 _for_each_inner_rsa_exponentiation!((2880));
775 _for_each_inner_rsa_exponentiation!((2912));
776 _for_each_inner_rsa_exponentiation!((2944));
777 _for_each_inner_rsa_exponentiation!((2976));
778 _for_each_inner_rsa_exponentiation!((3008));
779 _for_each_inner_rsa_exponentiation!((3040));
780 _for_each_inner_rsa_exponentiation!((3072));
781 _for_each_inner_rsa_exponentiation!((3104));
782 _for_each_inner_rsa_exponentiation!((3136));
783 _for_each_inner_rsa_exponentiation!((3168));
784 _for_each_inner_rsa_exponentiation!((3200));
785 _for_each_inner_rsa_exponentiation!((3232));
786 _for_each_inner_rsa_exponentiation!((3264));
787 _for_each_inner_rsa_exponentiation!((3296));
788 _for_each_inner_rsa_exponentiation!((3328));
789 _for_each_inner_rsa_exponentiation!((3360));
790 _for_each_inner_rsa_exponentiation!((3392));
791 _for_each_inner_rsa_exponentiation!((3424));
792 _for_each_inner_rsa_exponentiation!((3456));
793 _for_each_inner_rsa_exponentiation!((3488));
794 _for_each_inner_rsa_exponentiation!((3520));
795 _for_each_inner_rsa_exponentiation!((3552));
796 _for_each_inner_rsa_exponentiation!((3584));
797 _for_each_inner_rsa_exponentiation!((3616));
798 _for_each_inner_rsa_exponentiation!((3648));
799 _for_each_inner_rsa_exponentiation!((3680));
800 _for_each_inner_rsa_exponentiation!((3712));
801 _for_each_inner_rsa_exponentiation!((3744));
802 _for_each_inner_rsa_exponentiation!((3776));
803 _for_each_inner_rsa_exponentiation!((3808));
804 _for_each_inner_rsa_exponentiation!((3840));
805 _for_each_inner_rsa_exponentiation!((3872));
806 _for_each_inner_rsa_exponentiation!((3904));
807 _for_each_inner_rsa_exponentiation!((3936));
808 _for_each_inner_rsa_exponentiation!((3968));
809 _for_each_inner_rsa_exponentiation!((4000));
810 _for_each_inner_rsa_exponentiation!((4032));
811 _for_each_inner_rsa_exponentiation!((4064));
812 _for_each_inner_rsa_exponentiation!((4096));
813 _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
814 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
815 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
816 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
817 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
818 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
819 (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
820 (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
821 (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
822 (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
823 (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
824 (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
825 (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
826 };
827}
828#[macro_export]
829#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
830macro_rules! for_each_rsa_multiplication {
831 ($($pattern:tt => $code:tt;)*) => {
832 macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
833 ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
834 _for_each_inner_rsa_multiplication!((64));
835 _for_each_inner_rsa_multiplication!((96));
836 _for_each_inner_rsa_multiplication!((128));
837 _for_each_inner_rsa_multiplication!((160));
838 _for_each_inner_rsa_multiplication!((192));
839 _for_each_inner_rsa_multiplication!((224));
840 _for_each_inner_rsa_multiplication!((256));
841 _for_each_inner_rsa_multiplication!((288));
842 _for_each_inner_rsa_multiplication!((320));
843 _for_each_inner_rsa_multiplication!((352));
844 _for_each_inner_rsa_multiplication!((384));
845 _for_each_inner_rsa_multiplication!((416));
846 _for_each_inner_rsa_multiplication!((448));
847 _for_each_inner_rsa_multiplication!((480));
848 _for_each_inner_rsa_multiplication!((512));
849 _for_each_inner_rsa_multiplication!((544));
850 _for_each_inner_rsa_multiplication!((576));
851 _for_each_inner_rsa_multiplication!((608));
852 _for_each_inner_rsa_multiplication!((640));
853 _for_each_inner_rsa_multiplication!((672));
854 _for_each_inner_rsa_multiplication!((704));
855 _for_each_inner_rsa_multiplication!((736));
856 _for_each_inner_rsa_multiplication!((768));
857 _for_each_inner_rsa_multiplication!((800));
858 _for_each_inner_rsa_multiplication!((832));
859 _for_each_inner_rsa_multiplication!((864));
860 _for_each_inner_rsa_multiplication!((896));
861 _for_each_inner_rsa_multiplication!((928));
862 _for_each_inner_rsa_multiplication!((960));
863 _for_each_inner_rsa_multiplication!((992));
864 _for_each_inner_rsa_multiplication!((1024));
865 _for_each_inner_rsa_multiplication!((1056));
866 _for_each_inner_rsa_multiplication!((1088));
867 _for_each_inner_rsa_multiplication!((1120));
868 _for_each_inner_rsa_multiplication!((1152));
869 _for_each_inner_rsa_multiplication!((1184));
870 _for_each_inner_rsa_multiplication!((1216));
871 _for_each_inner_rsa_multiplication!((1248));
872 _for_each_inner_rsa_multiplication!((1280));
873 _for_each_inner_rsa_multiplication!((1312));
874 _for_each_inner_rsa_multiplication!((1344));
875 _for_each_inner_rsa_multiplication!((1376));
876 _for_each_inner_rsa_multiplication!((1408));
877 _for_each_inner_rsa_multiplication!((1440));
878 _for_each_inner_rsa_multiplication!((1472));
879 _for_each_inner_rsa_multiplication!((1504));
880 _for_each_inner_rsa_multiplication!((1536));
881 _for_each_inner_rsa_multiplication!((1568));
882 _for_each_inner_rsa_multiplication!((1600));
883 _for_each_inner_rsa_multiplication!((1632));
884 _for_each_inner_rsa_multiplication!((1664));
885 _for_each_inner_rsa_multiplication!((1696));
886 _for_each_inner_rsa_multiplication!((1728));
887 _for_each_inner_rsa_multiplication!((1760));
888 _for_each_inner_rsa_multiplication!((1792));
889 _for_each_inner_rsa_multiplication!((1824));
890 _for_each_inner_rsa_multiplication!((1856));
891 _for_each_inner_rsa_multiplication!((1888));
892 _for_each_inner_rsa_multiplication!((1920));
893 _for_each_inner_rsa_multiplication!((1952));
894 _for_each_inner_rsa_multiplication!((1984));
895 _for_each_inner_rsa_multiplication!((2016));
896 _for_each_inner_rsa_multiplication!((2048));
897 _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
898 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
899 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
900 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
901 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
902 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
903 (1888), (1920), (1952), (1984), (2016), (2048)));
904 };
905}
906#[macro_export]
907#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
908macro_rules! for_each_sha_algorithm {
909 ($($pattern:tt => $code:tt;)*) => {
910 macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
911 tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
912 (insecure_against : "collision", "length extension"), 0));
913 _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
914 (insecure_against : "length extension"), 1));
915 _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
916 (insecure_against : "length extension"), 2));
917 _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
918 (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
919 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
920 _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
921 (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
922 "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
923 _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
924 (insecure_against : "collision", "length extension"), 0), (Sha224,
925 "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
926 (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
927 2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
928 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
929 (Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
930 (Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
931 };
932}
933#[macro_export]
934#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
935macro_rules! for_each_wakeup_source {
936 ($($pattern:tt => $code:tt;)*) => {
937 macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
938 tt) => {} } _for_each_inner_wakeup_source!((Ext0, 0));
939 _for_each_inner_wakeup_source!((Ext1, 1)); _for_each_inner_wakeup_source!((Gpio,
940 2)); _for_each_inner_wakeup_source!((Timer, 3));
941 _for_each_inner_wakeup_source!((Wifi, 5)); _for_each_inner_wakeup_source!((Uart0,
942 6)); _for_each_inner_wakeup_source!((Uart1, 7));
943 _for_each_inner_wakeup_source!((Touch, 8));
944 _for_each_inner_wakeup_source!((UlpRiscv, 11));
945 _for_each_inner_wakeup_source!((UlpRiscvTrap, 13));
946 _for_each_inner_wakeup_source!((all(Ext0, 0), (Ext1, 1), (Gpio, 2), (Timer, 3),
947 (Wifi, 5), (Uart0, 6), (Uart1, 7), (Touch, 8), (UlpRiscv, 11), (UlpRiscvTrap,
948 13)));
949 };
950}
951#[macro_export]
952#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
953macro_rules! for_each_dma_engine {
954 ($($pattern:tt => $code:tt;)*) => {
955 macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
956 => {} } _for_each_inner_dma_engine!(("SPI_DMA"));
957 _for_each_inner_dma_engine!(("I2S_DMA"));
958 _for_each_inner_dma_engine!(("CRYPTO_DMA"));
959 _for_each_inner_dma_engine!(("COPY_DMA"));
960 _for_each_inner_dma_engine!((all("SPI_DMA"), ("I2S_DMA"), ("CRYPTO_DMA"),
961 ("COPY_DMA")));
962 };
963}
964#[macro_export]
965#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
966macro_rules! for_each_dma_channel {
967 ($($pattern:tt => $code:tt;)*) => {
968 macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
969 => {} } _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI2));
970 _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI3));
971 _for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S0));
972 _for_each_inner_dma_channel!(("CRYPTO_DMA", DMA_CRYPTO));
973 _for_each_inner_dma_channel!(("COPY_DMA", DMA_COPY));
974 _for_each_inner_dma_channel!(("SPI_DMA", any_channel = SpiDmaChannel));
975 _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI2, 0, interrupt = SPI2_DMA,
976 compatible = [SPI2])); _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI3, 1,
977 interrupt = SPI3_DMA, compatible = [SPI3]));
978 _for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S0, 0, interrupt = I2S0,
979 compatible = [I2S0])); _for_each_inner_dma_channel!(("CRYPTO_DMA", DMA_CRYPTO, 0,
980 interrupt = CRYPTO_DMA, compatible = [AES, SHA]));
981 _for_each_inner_dma_channel!(("COPY_DMA", DMA_COPY, 0, interrupt = DMA_COPY,
982 compatible = [])); _for_each_inner_dma_channel!((names("SPI_DMA", DMA_SPI2),
983 ("SPI_DMA", DMA_SPI3), ("I2S_DMA", DMA_I2S0), ("CRYPTO_DMA", DMA_CRYPTO),
984 ("COPY_DMA", DMA_COPY)));
985 _for_each_inner_dma_channel!((separate_any_type("SPI_DMA", any_channel =
986 SpiDmaChannel))); _for_each_inner_dma_channel!((shared("SPI_DMA", DMA_SPI2, 0,
987 interrupt = SPI2_DMA, compatible = [SPI2]), ("SPI_DMA", DMA_SPI3, 1, interrupt =
988 SPI3_DMA, compatible = [SPI3]), ("I2S_DMA", DMA_I2S0, 0, interrupt = I2S0,
989 compatible = [I2S0]), ("CRYPTO_DMA", DMA_CRYPTO, 0, interrupt = CRYPTO_DMA,
990 compatible = [AES, SHA]), ("COPY_DMA", DMA_COPY, 0, interrupt = DMA_COPY,
991 compatible = []))); _for_each_inner_dma_channel!((split));
992 _for_each_inner_dma_channel!((no_own_interrupt));
993 };
994}
995#[macro_export]
996#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
997macro_rules! for_each_dma_channel_peri_pair {
998 ($($pattern:tt => $code:tt;)*) => {
999 macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1000 ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("SPI_DMA",
1001 DMA_SPI2, SPI2)); _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", DMA_SPI3,
1002 SPI3)); _for_each_inner_dma_channel_peri_pair!(("I2S_DMA", DMA_I2S0, I2S0));
1003 _for_each_inner_dma_channel_peri_pair!(("CRYPTO_DMA", DMA_CRYPTO, AES));
1004 _for_each_inner_dma_channel_peri_pair!(("CRYPTO_DMA", DMA_CRYPTO, SHA));
1005 _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", any_channel = SpiDmaChannel,
1006 SPI2)); _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", any_channel =
1007 SpiDmaChannel, SPI3));
1008 _for_each_inner_dma_channel_peri_pair!((channels("SPI_DMA", DMA_SPI2, SPI2),
1009 ("SPI_DMA", DMA_SPI3, SPI3), ("I2S_DMA", DMA_I2S0, I2S0), ("CRYPTO_DMA",
1010 DMA_CRYPTO, AES), ("CRYPTO_DMA", DMA_CRYPTO, SHA)));
1011 _for_each_inner_dma_channel_peri_pair!((any_channels("SPI_DMA", any_channel =
1012 SpiDmaChannel, SPI2), ("SPI_DMA", any_channel = SpiDmaChannel, SPI3)));
1013 };
1014}
1015#[macro_export]
1016#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1017macro_rules! for_each_mem2mem_channel {
1018 ($($pattern:tt => $code:tt;)*) => {
1019 macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
1020 tt) => {} } _for_each_inner_mem2mem_channel!(("CRYPTO_DMA", CryptoDma,
1021 CryptoDmaChannel, DMA_CRYPTO, 0)); _for_each_inner_mem2mem_channel!(("COPY_DMA",
1022 CopyDma, CopyDmaChannel, DMA_COPY, 0));
1023 _for_each_inner_mem2mem_channel!(("CRYPTO_DMA", CryptoDma, CryptoDmaChannel));
1024 _for_each_inner_mem2mem_channel!(("COPY_DMA", CopyDma, CopyDmaChannel));
1025 _for_each_inner_mem2mem_channel!((channels("CRYPTO_DMA", CryptoDma,
1026 CryptoDmaChannel, DMA_CRYPTO, 0), ("COPY_DMA", CopyDma, CopyDmaChannel, DMA_COPY,
1027 0))); _for_each_inner_mem2mem_channel!((erased));
1028 _for_each_inner_mem2mem_channel!((engines("CRYPTO_DMA", CryptoDma,
1029 CryptoDmaChannel), ("COPY_DMA", CopyDma, CopyDmaChannel)));
1030 };
1031}
1032#[macro_export]
1033#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1034macro_rules! with_aes_dma_engine {
1035 ($($pattern:tt => $code:tt;)*) => {
1036 macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
1037 => {} } _with_inner_aes_dma_engine!(("CRYPTO_DMA", CryptoDmaChannel));
1038 };
1039}
1040#[macro_export]
1041#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1042macro_rules! with_i2s_dma_engine {
1043 ($($pattern:tt => $code:tt;)*) => {
1044 macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
1045 => {} } _with_inner_i2s_dma_engine!(("I2S_DMA", I2sDmaChannel));
1046 };
1047}
1048#[macro_export]
1049#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1050macro_rules! with_sha_dma_engine {
1051 ($($pattern:tt => $code:tt;)*) => {
1052 macro_rules! _with_inner_sha_dma_engine { $(($pattern) => $code;)* ($other : tt)
1053 => {} } _with_inner_sha_dma_engine!(("CRYPTO_DMA", CryptoDmaChannel));
1054 };
1055}
1056#[macro_export]
1057#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1058macro_rules! with_spi_master_dma_engine {
1059 ($($pattern:tt => $code:tt;)*) => {
1060 macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1061 : tt) => {} } _with_inner_spi_master_dma_engine!(("SPI_DMA", SpiDmaChannel));
1062 };
1063}
1064#[macro_export]
1065#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1066macro_rules! with_spi_slave_dma_engine {
1067 ($($pattern:tt => $code:tt;)*) => {
1068 macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1069 : tt) => {} } _with_inner_spi_slave_dma_engine!(("SPI_DMA", SpiDmaChannel));
1070 };
1071}
1072#[macro_export]
1073#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1074macro_rules! for_each_sw_interrupt {
1075 ($($pattern:tt => $code:tt;)*) => {
1076 macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1077 tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1078 software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1079 software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1080 software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1081 software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1082 software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1083 FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1084 };
1085}
1086#[macro_export]
1087macro_rules! define_clock_tree_types {
1463 () => {
1464 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1465 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1466 pub enum SdmInstance {
1467 GpioSd = 0,
1468 }
1469 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1470 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1471 pub enum I2cInstance {
1472 I2c0 = 0,
1473 I2c1 = 1,
1474 }
1475 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1476 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1477 pub enum I2sInstance {
1478 I2s0 = 0,
1479 }
1480 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1481 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1482 pub enum RmtInstance {
1483 Rmt = 0,
1484 }
1485 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1486 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1487 pub enum SpiInstance {
1488 Spi2 = 0,
1489 Spi3 = 1,
1490 }
1491 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1492 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1493 pub enum TimgInstance {
1494 Timg0 = 0,
1495 Timg1 = 1,
1496 }
1497 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1498 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1499 pub enum UartInstance {
1500 Uart0 = 0,
1501 Uart1 = 1,
1502 }
1503 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1505 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1506 pub enum XtalClkConfig {
1507 _40,
1509 }
1510 impl XtalClkConfig {
1511 pub fn value(&self) -> u32 {
1512 match self {
1513 XtalClkConfig::_40 => 40000000,
1514 }
1515 }
1516 }
1517 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1519 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1520 pub enum PllClkConfig {
1521 _320,
1523 _480,
1525 }
1526 impl PllClkConfig {
1527 pub fn value(&self) -> u32 {
1528 match self {
1529 PllClkConfig::_320 => 320000000,
1530 PllClkConfig::_480 => 480000000,
1531 }
1532 }
1533 }
1534 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1536 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1537 pub struct ApllClkConfig(u32);
1538 impl ApllClkConfig {
1539 pub const fn new(frequency: u32) -> Self {
1546 ::core::assert!(
1547 frequency >= 16000000u32 && frequency <= 128000000u32,
1548 "`APLL_CLK` output frequency value must be between 16000000 and 128000000 \
1549 (inclusive)."
1550 );
1551 Self(frequency)
1552 }
1553 }
1554 impl ApllClkConfig {
1555 pub fn value(&self) -> u32 {
1556 self.0
1557 }
1558 }
1559 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1561 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1562 pub enum CpuPllDivInConfig {
1563 Pll,
1565 Apll,
1567 }
1568 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1569 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1570 pub enum CpuPllDivDivisor {
1571 _2 = 2,
1573 _3 = 3,
1575 _4 = 4,
1577 _6 = 6,
1579 }
1580 impl CpuPllDivDivisor {
1581 pub const fn new(raw: u32) -> Self {
1583 match raw {
1584 2 => Self::_2,
1585 3 => Self::_3,
1586 4 => Self::_4,
1587 6 => Self::_6,
1588 _ => ::core::panic!("Invalid CPU_PLL_DIV divisor value"),
1589 }
1590 }
1591 }
1592 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1596 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1597 pub struct CpuPllDivConfig {
1598 divisor: CpuPllDivDivisor,
1599 }
1600 impl CpuPllDivConfig {
1601 pub const fn new(divisor: CpuPllDivDivisor) -> Self {
1603 Self { divisor }
1604 }
1605 pub(crate) fn divisor(self) -> u32 {
1606 self.divisor as u32
1607 }
1608 }
1609 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1611 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1612 pub enum SystemPreDivInConfig {
1613 Xtal,
1615 RcFast,
1617 }
1618 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1622 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1623 pub struct SystemPreDivConfig {
1624 divisor: u32,
1625 }
1626 impl SystemPreDivConfig {
1627 pub const fn new(divisor: u32) -> Self {
1634 ::core::assert!(
1635 divisor <= 1023,
1636 "`SYSTEM_PRE_DIV` divisor must be between 0 and 1023 (inclusive)."
1637 );
1638 Self { divisor }
1639 }
1640 pub(crate) fn divisor(self) -> u32 {
1641 self.divisor as u32
1642 }
1643 }
1644 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1646 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1647 pub enum ApbClkConfig {
1648 Pll,
1650 Apll,
1652 Xtal,
1654 RcFast,
1656 }
1657 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1659 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1660 pub enum RefTickConfig {
1661 Pll,
1663 Apll,
1665 Xtal,
1667 RcFast,
1669 }
1670 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1674 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1675 pub struct RefTickXtalConfig {
1676 divisor: u32,
1677 }
1678 impl RefTickXtalConfig {
1679 pub const fn new(divisor: u32) -> Self {
1686 ::core::assert!(
1687 divisor <= 255,
1688 "`REF_TICK_XTAL` divisor must be between 0 and 255 (inclusive)."
1689 );
1690 Self { divisor }
1691 }
1692 pub(crate) fn divisor(self) -> u32 {
1693 self.divisor as u32
1694 }
1695 }
1696 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1700 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1701 pub struct RefTickCk8mConfig {
1702 divisor: u32,
1703 }
1704 impl RefTickCk8mConfig {
1705 pub const fn new(divisor: u32) -> Self {
1712 ::core::assert!(
1713 divisor <= 255,
1714 "`REF_TICK_CK8M` divisor must be between 0 and 255 (inclusive)."
1715 );
1716 Self { divisor }
1717 }
1718 pub(crate) fn divisor(self) -> u32 {
1719 self.divisor as u32
1720 }
1721 }
1722 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1724 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1725 pub enum CpuClkConfig {
1726 Xtal,
1728 RcFast,
1730 Apll,
1732 Pll,
1734 }
1735 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1737 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1738 pub enum RtcSlowClkConfig {
1739 #[cfg(use_xtal32k)]
1740 Xtal32k,
1742 RcSlow,
1744 RcFast,
1746 }
1747 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1749 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1750 pub enum RtcFastClkConfig {
1751 Xtal,
1753 Rc,
1755 }
1756 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1758 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1759 pub enum UartMemClkConfig {
1760 #[default]
1761 Xtal,
1763 }
1764 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1766 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1767 pub enum TimgCalibrationClockConfig {
1768 RtcClk,
1770 RcFastDivClk,
1772 #[cfg(use_xtal32k)]
1773 Xtal32kClk,
1775 }
1776 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1777 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1778 pub enum I2cFunctionClockSclk {
1779 #[default]
1780 Apb,
1782 RefTick,
1784 }
1785 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1789 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1790 pub struct I2cFunctionClockConfig {
1791 sclk: I2cFunctionClockSclk,
1792 }
1793 impl I2cFunctionClockConfig {
1794 pub const fn new(sclk: I2cFunctionClockSclk) -> Self {
1796 Self { sclk }
1797 }
1798 pub(crate) fn sclk(self) -> I2cFunctionClockSclk {
1799 self.sclk
1800 }
1801 }
1802 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1803 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1804 pub enum I2sMclkSclk {
1805 #[default]
1806 PllF160m,
1808 Apll,
1810 }
1811 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1815 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1816 pub struct I2sMclkConfig {
1817 sclk: I2sMclkSclk,
1818 div_num: u32,
1819 div_a: u32,
1820 div_b: u32,
1821 }
1822 impl I2sMclkConfig {
1823 pub const fn new(sclk: I2sMclkSclk, div_num: u32, div_a: u32, div_b: u32) -> Self {
1836 ::core::assert!(
1837 div_num >= 1 && div_num <= 255,
1838 "`I2S0_MCLK` div_num must be between 1 and 255 (inclusive)."
1839 );
1840 ::core::assert!(
1841 div_a >= 1 && div_a <= 63,
1842 "`I2S0_MCLK` div_a must be between 1 and 63 (inclusive)."
1843 );
1844 ::core::assert!(
1845 div_b <= 63,
1846 "`I2S0_MCLK` div_b must be between 0 and 63 (inclusive)."
1847 );
1848 Self {
1849 sclk,
1850 div_num,
1851 div_a,
1852 div_b,
1853 }
1854 }
1855 pub(crate) fn sclk(self) -> I2sMclkSclk {
1856 self.sclk
1857 }
1858 pub(crate) fn div_num(self) -> u32 {
1859 self.div_num as u32
1860 }
1861 pub(crate) fn div_a(self) -> u32 {
1862 self.div_a as u32
1863 }
1864 pub(crate) fn div_b(self) -> u32 {
1865 self.div_b as u32
1866 }
1867 }
1868 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1870 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1871 pub enum RmtSclkConfig {
1872 RefTick,
1874 #[default]
1875 ApbClk,
1877 }
1878 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1880 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1881 pub enum SpiFunctionClockConfig {
1882 #[default]
1883 Apb,
1885 }
1886 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1888 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1889 pub enum TimgFunctionClockConfig {
1890 #[default]
1891 XtalClk,
1893 ApbClk,
1895 }
1896 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1897 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1898 pub enum UartFunctionClockSclk {
1899 #[default]
1900 Apb,
1902 RefTick,
1904 }
1905 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1909 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1910 pub struct UartFunctionClockConfig {
1911 sclk: UartFunctionClockSclk,
1912 }
1913 impl UartFunctionClockConfig {
1914 pub const fn new(sclk: UartFunctionClockSclk) -> Self {
1916 Self { sclk }
1917 }
1918 pub(crate) fn sclk(self) -> UartFunctionClockSclk {
1919 self.sclk
1920 }
1921 }
1922 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1927 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1928 pub struct UartBaudRateGeneratorConfig {
1929 fractional: u32,
1930 integral: u32,
1931 }
1932 impl UartBaudRateGeneratorConfig {
1933 pub const fn new(fractional: u32, integral: u32) -> Self {
1943 ::core::assert!(
1944 fractional <= 15,
1945 "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
1946 );
1947 ::core::assert!(
1948 integral <= 1048575,
1949 "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 1048575 \
1950 (inclusive)."
1951 );
1952 Self {
1953 fractional,
1954 integral,
1955 }
1956 }
1957 pub(crate) fn fractional(self) -> u32 {
1958 self.fractional as u32
1959 }
1960 pub(crate) fn integral(self) -> u32 {
1961 self.integral as u32
1962 }
1963 }
1964 pub struct ClockTree {
1966 xtal_clk: Option<XtalClkConfig>,
1967 pll_clk: Option<PllClkConfig>,
1968 apll_clk: Option<ApllClkConfig>,
1969 cpu_pll_div_in: Option<CpuPllDivInConfig>,
1970 cpu_pll_div: Option<CpuPllDivConfig>,
1971 system_pre_div_in: Option<SystemPreDivInConfig>,
1972 system_pre_div: Option<SystemPreDivConfig>,
1973 apb_clk: Option<ApbClkConfig>,
1974 ref_tick: Option<RefTickConfig>,
1975 ref_tick_xtal: Option<RefTickXtalConfig>,
1976 ref_tick_ck8m: Option<RefTickCk8mConfig>,
1977 cpu_clk: Option<CpuClkConfig>,
1978 rtc_slow_clk: Option<RtcSlowClkConfig>,
1979 rtc_fast_clk: Option<RtcFastClkConfig>,
1980 timg_calibration_clock: Option<TimgCalibrationClockConfig>,
1981 i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
1982 i2s_mclk: [Option<I2sMclkConfig>; 1],
1983 rmt_sclk: [Option<RmtSclkConfig>; 1],
1984 timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
1985 uart_function_clock: [Option<UartFunctionClockConfig>; 2],
1986 uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 2],
1987 pll_clk_refcount: u32,
1988 apll_clk_refcount: u32,
1989 rc_fast_clk_refcount: u32,
1990 apb_clk_refcount: u32,
1991 ref_tick_refcount: u32,
1992 #[cfg(use_xtal32k)]
1993 xtal32k_clk_refcount: u32,
1994 rc_fast_div_clk_refcount: u32,
1995 rtc_fast_clk_refcount: u32,
1996 uart_mem_clk_refcount: u32,
1997 timg_calibration_clock_refcount: u32,
1998 sdm_function_clock_refcount: [u32; 1],
1999 i2c_function_clock_refcount: [u32; 2],
2000 i2s_mclk_refcount: [u32; 1],
2001 rmt_sclk_refcount: [u32; 1],
2002 spi_function_clock_refcount: [u32; 2],
2003 timg_function_clock_refcount: [u32; 2],
2004 uart_function_clock_refcount: [u32; 2],
2005 uart_baud_rate_generator_refcount: [u32; 2],
2006 uart_mem_clock_refcount: [u32; 2],
2007 }
2008 impl ClockTree {
2009 pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
2011 CLOCK_TREE.with(f)
2012 }
2013 pub fn xtal_clk(&self) -> Option<XtalClkConfig> {
2015 self.xtal_clk
2016 }
2017 pub fn pll_clk(&self) -> Option<PllClkConfig> {
2019 self.pll_clk
2020 }
2021 pub fn apll_clk(&self) -> Option<ApllClkConfig> {
2023 self.apll_clk
2024 }
2025 pub fn cpu_pll_div_in(&self) -> Option<CpuPllDivInConfig> {
2027 self.cpu_pll_div_in
2028 }
2029 pub fn cpu_pll_div(&self) -> Option<CpuPllDivConfig> {
2031 self.cpu_pll_div
2032 }
2033 pub fn system_pre_div_in(&self) -> Option<SystemPreDivInConfig> {
2035 self.system_pre_div_in
2036 }
2037 pub fn system_pre_div(&self) -> Option<SystemPreDivConfig> {
2039 self.system_pre_div
2040 }
2041 pub fn apb_clk(&self) -> Option<ApbClkConfig> {
2043 self.apb_clk
2044 }
2045 pub fn ref_tick(&self) -> Option<RefTickConfig> {
2047 self.ref_tick
2048 }
2049 pub fn ref_tick_xtal(&self) -> Option<RefTickXtalConfig> {
2051 self.ref_tick_xtal
2052 }
2053 pub fn ref_tick_ck8m(&self) -> Option<RefTickCk8mConfig> {
2055 self.ref_tick_ck8m
2056 }
2057 pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
2059 self.cpu_clk
2060 }
2061 pub fn rtc_slow_clk(&self) -> Option<RtcSlowClkConfig> {
2063 self.rtc_slow_clk
2064 }
2065 pub fn rtc_fast_clk(&self) -> Option<RtcFastClkConfig> {
2067 self.rtc_fast_clk
2068 }
2069 pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
2071 self.timg_calibration_clock
2072 }
2073 pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2075 self.i2c_function_clock[I2cInstance::I2c0 as usize]
2076 }
2077 pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2079 self.i2c_function_clock[I2cInstance::I2c1 as usize]
2080 }
2081 pub fn i2s0_mclk(&self) -> Option<I2sMclkConfig> {
2083 self.i2s_mclk[I2sInstance::I2s0 as usize]
2084 }
2085 pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
2087 self.rmt_sclk[RmtInstance::Rmt as usize]
2088 }
2089 pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2091 self.timg_function_clock[TimgInstance::Timg0 as usize]
2092 }
2093 pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2095 self.timg_function_clock[TimgInstance::Timg1 as usize]
2096 }
2097 pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
2099 self.uart_function_clock[UartInstance::Uart0 as usize]
2100 }
2101 pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2103 self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
2104 }
2105 pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
2107 self.uart_function_clock[UartInstance::Uart1 as usize]
2108 }
2109 pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2111 self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
2112 }
2113 }
2114 static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
2115 ::esp_sync::NonReentrantMutex::new(ClockTree {
2116 xtal_clk: None,
2117 pll_clk: None,
2118 apll_clk: None,
2119 cpu_pll_div_in: None,
2120 cpu_pll_div: None,
2121 system_pre_div_in: None,
2122 system_pre_div: None,
2123 apb_clk: None,
2124 ref_tick: None,
2125 ref_tick_xtal: None,
2126 ref_tick_ck8m: None,
2127 cpu_clk: None,
2128 rtc_slow_clk: None,
2129 rtc_fast_clk: None,
2130 timg_calibration_clock: None,
2131 i2c_function_clock: [None; 2],
2132 i2s_mclk: [None; 1],
2133 rmt_sclk: [None; 1],
2134 timg_function_clock: [None; 2],
2135 uart_function_clock: [None; 2],
2136 uart_baud_rate_generator: [None; 2],
2137 pll_clk_refcount: 0,
2138 apll_clk_refcount: 0,
2139 rc_fast_clk_refcount: 0,
2140 apb_clk_refcount: 0,
2141 ref_tick_refcount: 0,
2142 #[cfg(use_xtal32k)]
2143 xtal32k_clk_refcount: 0,
2144 rc_fast_div_clk_refcount: 0,
2145 rtc_fast_clk_refcount: 0,
2146 uart_mem_clk_refcount: 0,
2147 timg_calibration_clock_refcount: 0,
2148 sdm_function_clock_refcount: [0; 1],
2149 i2c_function_clock_refcount: [0; 2],
2150 i2s_mclk_refcount: [0; 1],
2151 rmt_sclk_refcount: [0; 1],
2152 spi_function_clock_refcount: [0; 2],
2153 timg_function_clock_refcount: [0; 2],
2154 uart_function_clock_refcount: [0; 2],
2155 uart_baud_rate_generator_refcount: [0; 2],
2156 uart_mem_clock_refcount: [0; 2],
2157 });
2158 static XTAL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2159 ::core::sync::atomic::AtomicU32::new(0);
2160 static PLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2161 ::core::sync::atomic::AtomicU32::new(0);
2162 static APLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2163 ::core::sync::atomic::AtomicU32::new(0);
2164 static CPU_PLL_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2165 ::core::sync::atomic::AtomicU32::new(0);
2166 static CPU_PLL_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2167 ::core::sync::atomic::AtomicU32::new(0);
2168 static SYSTEM_PRE_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2169 ::core::sync::atomic::AtomicU32::new(0);
2170 static SYSTEM_PRE_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2171 ::core::sync::atomic::AtomicU32::new(0);
2172 static REF_TICK_XTAL_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2173 ::core::sync::atomic::AtomicU32::new(0);
2174 static REF_TICK_CK8M_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2175 ::core::sync::atomic::AtomicU32::new(0);
2176 static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2177 ::core::sync::atomic::AtomicU32::new(0);
2178 static RTC_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2179 ::core::sync::atomic::AtomicU32::new(0);
2180 static RTC_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2181 ::core::sync::atomic::AtomicU32::new(0);
2182 static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2183 ::core::sync::atomic::AtomicU32::new(0);
2184 static I2S_MCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2185 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2186 static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2187 ::core::sync::atomic::AtomicU32::new(0);
2188 static REF_TICK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2189 ::core::sync::atomic::AtomicU32::new(0);
2190 static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2191 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2192 static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2193 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2194 static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2195 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2196 static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2197 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2198 static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2199 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2200 pub fn configure_xtal_clk(clocks: &mut ClockTree, config: XtalClkConfig) {
2201 let old_config = clocks.xtal_clk.replace(config);
2202 refresh_xtal_clk_downstream(clocks);
2203 configure_xtal_clk_impl(clocks, old_config, config);
2204 }
2205 pub fn xtal_clk_config(clocks: &mut ClockTree) -> Option<XtalClkConfig> {
2206 clocks.xtal_clk
2207 }
2208 fn request_xtal_clk(_clocks: &mut ClockTree) {}
2209 fn release_xtal_clk(_clocks: &mut ClockTree) {}
2210 #[allow(unused_variables)]
2211 pub fn xtal_clk_config_frequency(clocks: &mut ClockTree, config: XtalClkConfig) -> u32 {
2212 config.value()
2213 }
2214 pub fn xtal_clk_frequency() -> u32 {
2215 XTAL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2216 }
2217 pub fn configure_pll_clk(clocks: &mut ClockTree, config: PllClkConfig) {
2218 let old_config = clocks.pll_clk.replace(config);
2219 refresh_pll_clk_downstream(clocks);
2220 configure_pll_clk_impl(clocks, old_config, config);
2221 }
2222 pub fn pll_clk_config(clocks: &mut ClockTree) -> Option<PllClkConfig> {
2223 clocks.pll_clk
2224 }
2225 pub fn request_pll_clk(clocks: &mut ClockTree) {
2226 trace!("Requesting PLL_CLK");
2227 if increment_reference_count(&mut clocks.pll_clk_refcount) {
2228 trace!("Enabling PLL_CLK");
2229 request_xtal_clk(clocks);
2230 enable_pll_clk_impl(clocks, true);
2231 }
2232 }
2233 pub fn release_pll_clk(clocks: &mut ClockTree) {
2234 trace!("Releasing PLL_CLK");
2235 if decrement_reference_count(&mut clocks.pll_clk_refcount) {
2236 trace!("Disabling PLL_CLK");
2237 enable_pll_clk_impl(clocks, false);
2238 release_xtal_clk(clocks);
2239 }
2240 }
2241 #[allow(unused_variables)]
2242 pub fn pll_clk_config_frequency(clocks: &mut ClockTree, config: PllClkConfig) -> u32 {
2243 config.value()
2244 }
2245 pub fn pll_clk_frequency() -> u32 {
2246 PLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2247 }
2248 pub fn pll_clk_source_frequency() -> u32 {
2249 xtal_clk_frequency()
2250 }
2251 pub fn configure_apll_clk(clocks: &mut ClockTree, config: ApllClkConfig) {
2252 let old_config = clocks.apll_clk.replace(config);
2253 refresh_apll_clk_downstream(clocks);
2254 configure_apll_clk_impl(clocks, old_config, config);
2255 }
2256 pub fn apll_clk_config(clocks: &mut ClockTree) -> Option<ApllClkConfig> {
2257 clocks.apll_clk
2258 }
2259 pub fn request_apll_clk(clocks: &mut ClockTree) {
2260 trace!("Requesting APLL_CLK");
2261 if increment_reference_count(&mut clocks.apll_clk_refcount) {
2262 trace!("Enabling APLL_CLK");
2263 request_pll_clk(clocks);
2264 enable_apll_clk_impl(clocks, true);
2265 }
2266 }
2267 pub fn release_apll_clk(clocks: &mut ClockTree) {
2268 trace!("Releasing APLL_CLK");
2269 if decrement_reference_count(&mut clocks.apll_clk_refcount) {
2270 trace!("Disabling APLL_CLK");
2271 enable_apll_clk_impl(clocks, false);
2272 release_pll_clk(clocks);
2273 }
2274 }
2275 #[allow(unused_variables)]
2276 pub fn apll_clk_config_frequency(clocks: &mut ClockTree, config: ApllClkConfig) -> u32 {
2277 config.value()
2278 }
2279 pub fn apll_clk_frequency() -> u32 {
2280 APLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2281 }
2282 pub fn apll_clk_source_frequency() -> u32 {
2283 pll_clk_frequency()
2284 }
2285 pub fn request_pll_f160m_clk(clocks: &mut ClockTree) {
2286 trace!("Requesting PLL_F160M_CLK");
2287 trace!("Enabling PLL_F160M_CLK");
2288 request_pll_clk(clocks);
2289 enable_pll_f160m_clk_impl(clocks, true);
2290 }
2291 pub fn release_pll_f160m_clk(clocks: &mut ClockTree) {
2292 trace!("Releasing PLL_F160M_CLK");
2293 trace!("Disabling PLL_F160M_CLK");
2294 enable_pll_f160m_clk_impl(clocks, false);
2295 release_pll_clk(clocks);
2296 }
2297 pub fn pll_f160m_clk_frequency() -> u32 {
2298 160000000
2299 }
2300 pub fn pll_f160m_clk_source_frequency() -> u32 {
2301 pll_clk_frequency()
2302 }
2303 pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
2304 trace!("Requesting RC_FAST_CLK");
2305 if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
2306 trace!("Enabling RC_FAST_CLK");
2307 enable_rc_fast_clk_impl(clocks, true);
2308 }
2309 }
2310 pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
2311 trace!("Releasing RC_FAST_CLK");
2312 if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
2313 trace!("Disabling RC_FAST_CLK");
2314 enable_rc_fast_clk_impl(clocks, false);
2315 }
2316 }
2317 pub fn rc_fast_clk_frequency() -> u32 {
2318 8000000
2319 }
2320 pub fn configure_cpu_pll_div_in(clocks: &mut ClockTree, new_selector: CpuPllDivInConfig) {
2321 let old_selector = clocks.cpu_pll_div_in.replace(new_selector);
2322 refresh_cpu_pll_div_in_downstream(clocks);
2323 match new_selector {
2324 CpuPllDivInConfig::Pll => request_pll_clk(clocks),
2325 CpuPllDivInConfig::Apll => request_apll_clk(clocks),
2326 }
2327 configure_cpu_pll_div_in_impl(clocks, old_selector, new_selector);
2328 if let Some(old_selector) = old_selector {
2329 match old_selector {
2330 CpuPllDivInConfig::Pll => release_pll_clk(clocks),
2331 CpuPllDivInConfig::Apll => release_apll_clk(clocks),
2332 }
2333 }
2334 }
2335 pub fn cpu_pll_div_in_config(clocks: &mut ClockTree) -> Option<CpuPllDivInConfig> {
2336 clocks.cpu_pll_div_in
2337 }
2338 pub fn request_cpu_pll_div_in(clocks: &mut ClockTree) {
2339 trace!("Requesting CPU_PLL_DIV_IN");
2340 trace!("Enabling CPU_PLL_DIV_IN");
2341 match unwrap!(clocks.cpu_pll_div_in) {
2342 CpuPllDivInConfig::Pll => request_pll_clk(clocks),
2343 CpuPllDivInConfig::Apll => request_apll_clk(clocks),
2344 }
2345 enable_cpu_pll_div_in_impl(clocks, true);
2346 }
2347 pub fn release_cpu_pll_div_in(clocks: &mut ClockTree) {
2348 trace!("Releasing CPU_PLL_DIV_IN");
2349 trace!("Disabling CPU_PLL_DIV_IN");
2350 enable_cpu_pll_div_in_impl(clocks, false);
2351 match unwrap!(clocks.cpu_pll_div_in) {
2352 CpuPllDivInConfig::Pll => release_pll_clk(clocks),
2353 CpuPllDivInConfig::Apll => release_apll_clk(clocks),
2354 }
2355 }
2356 #[allow(unused_variables)]
2357 pub fn cpu_pll_div_in_config_frequency(
2358 clocks: &mut ClockTree,
2359 config: CpuPllDivInConfig,
2360 ) -> u32 {
2361 match config {
2362 CpuPllDivInConfig::Pll => pll_clk_frequency(),
2363 CpuPllDivInConfig::Apll => apll_clk_frequency(),
2364 }
2365 }
2366 pub fn cpu_pll_div_in_frequency() -> u32 {
2367 CPU_PLL_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2368 }
2369 pub fn cpu_pll_div_in_source_frequency(source: CpuPllDivInConfig) -> u32 {
2370 match source {
2371 CpuPllDivInConfig::Pll => pll_clk_frequency(),
2372 CpuPllDivInConfig::Apll => apll_clk_frequency(),
2373 }
2374 }
2375 pub fn configure_cpu_pll_div(clocks: &mut ClockTree, config: CpuPllDivConfig) {
2376 let old_config = clocks.cpu_pll_div.replace(config);
2377 refresh_cpu_pll_div_downstream(clocks);
2378 configure_cpu_pll_div_impl(clocks, old_config, config);
2379 }
2380 pub fn cpu_pll_div_config(clocks: &mut ClockTree) -> Option<CpuPllDivConfig> {
2381 clocks.cpu_pll_div
2382 }
2383 pub fn request_cpu_pll_div(clocks: &mut ClockTree) {
2384 trace!("Requesting CPU_PLL_DIV");
2385 trace!("Enabling CPU_PLL_DIV");
2386 request_cpu_pll_div_in(clocks);
2387 enable_cpu_pll_div_impl(clocks, true);
2388 }
2389 pub fn release_cpu_pll_div(clocks: &mut ClockTree) {
2390 trace!("Releasing CPU_PLL_DIV");
2391 trace!("Disabling CPU_PLL_DIV");
2392 enable_cpu_pll_div_impl(clocks, false);
2393 release_cpu_pll_div_in(clocks);
2394 }
2395 #[allow(unused_variables)]
2396 pub fn cpu_pll_div_config_frequency(
2397 clocks: &mut ClockTree,
2398 config: CpuPllDivConfig,
2399 ) -> u32 {
2400 (cpu_pll_div_in_frequency() / config.divisor())
2401 }
2402 pub fn cpu_pll_div_frequency() -> u32 {
2403 CPU_PLL_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2404 }
2405 pub fn cpu_pll_div_source_frequency() -> u32 {
2406 cpu_pll_div_in_frequency()
2407 }
2408 pub fn configure_system_pre_div_in(
2409 clocks: &mut ClockTree,
2410 new_selector: SystemPreDivInConfig,
2411 ) {
2412 let old_selector = clocks.system_pre_div_in.replace(new_selector);
2413 refresh_system_pre_div_in_downstream(clocks);
2414 match new_selector {
2415 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
2416 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2417 }
2418 configure_system_pre_div_in_impl(clocks, old_selector, new_selector);
2419 if let Some(old_selector) = old_selector {
2420 match old_selector {
2421 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
2422 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2423 }
2424 }
2425 }
2426 pub fn system_pre_div_in_config(clocks: &mut ClockTree) -> Option<SystemPreDivInConfig> {
2427 clocks.system_pre_div_in
2428 }
2429 pub fn request_system_pre_div_in(clocks: &mut ClockTree) {
2430 trace!("Requesting SYSTEM_PRE_DIV_IN");
2431 trace!("Enabling SYSTEM_PRE_DIV_IN");
2432 match unwrap!(clocks.system_pre_div_in) {
2433 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
2434 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
2435 }
2436 enable_system_pre_div_in_impl(clocks, true);
2437 }
2438 pub fn release_system_pre_div_in(clocks: &mut ClockTree) {
2439 trace!("Releasing SYSTEM_PRE_DIV_IN");
2440 trace!("Disabling SYSTEM_PRE_DIV_IN");
2441 enable_system_pre_div_in_impl(clocks, false);
2442 match unwrap!(clocks.system_pre_div_in) {
2443 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
2444 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
2445 }
2446 }
2447 #[allow(unused_variables)]
2448 pub fn system_pre_div_in_config_frequency(
2449 clocks: &mut ClockTree,
2450 config: SystemPreDivInConfig,
2451 ) -> u32 {
2452 match config {
2453 SystemPreDivInConfig::Xtal => xtal_clk_frequency(),
2454 SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
2455 }
2456 }
2457 pub fn system_pre_div_in_frequency() -> u32 {
2458 SYSTEM_PRE_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2459 }
2460 pub fn system_pre_div_in_source_frequency(source: SystemPreDivInConfig) -> u32 {
2461 match source {
2462 SystemPreDivInConfig::Xtal => xtal_clk_frequency(),
2463 SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
2464 }
2465 }
2466 pub fn configure_system_pre_div(clocks: &mut ClockTree, config: SystemPreDivConfig) {
2467 let old_config = clocks.system_pre_div.replace(config);
2468 refresh_system_pre_div_downstream(clocks);
2469 configure_system_pre_div_impl(clocks, old_config, config);
2470 }
2471 pub fn system_pre_div_config(clocks: &mut ClockTree) -> Option<SystemPreDivConfig> {
2472 clocks.system_pre_div
2473 }
2474 pub fn request_system_pre_div(clocks: &mut ClockTree) {
2475 trace!("Requesting SYSTEM_PRE_DIV");
2476 trace!("Enabling SYSTEM_PRE_DIV");
2477 request_system_pre_div_in(clocks);
2478 enable_system_pre_div_impl(clocks, true);
2479 }
2480 pub fn release_system_pre_div(clocks: &mut ClockTree) {
2481 trace!("Releasing SYSTEM_PRE_DIV");
2482 trace!("Disabling SYSTEM_PRE_DIV");
2483 enable_system_pre_div_impl(clocks, false);
2484 release_system_pre_div_in(clocks);
2485 }
2486 #[allow(unused_variables)]
2487 pub fn system_pre_div_config_frequency(
2488 clocks: &mut ClockTree,
2489 config: SystemPreDivConfig,
2490 ) -> u32 {
2491 (system_pre_div_in_frequency() / (config.divisor() + 1))
2492 }
2493 pub fn system_pre_div_frequency() -> u32 {
2494 SYSTEM_PRE_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2495 }
2496 pub fn system_pre_div_source_frequency() -> u32 {
2497 system_pre_div_in_frequency()
2498 }
2499 pub fn configure_apb_clk(clocks: &mut ClockTree, new_selector: ApbClkConfig) {
2500 let old_selector = clocks.apb_clk.replace(new_selector);
2501 refresh_apb_clk_downstream(clocks);
2502 if clocks.apb_clk_refcount > 0 {
2503 match new_selector {
2504 ApbClkConfig::Pll => request_apb_clk_80m(clocks),
2505 ApbClkConfig::Apll => request_apb_clk_cpu_div2(clocks),
2506 ApbClkConfig::Xtal => request_cpu_clk(clocks),
2507 ApbClkConfig::RcFast => request_cpu_clk(clocks),
2508 }
2509 configure_apb_clk_impl(clocks, old_selector, new_selector);
2510 if let Some(old_selector) = old_selector {
2511 match old_selector {
2512 ApbClkConfig::Pll => release_apb_clk_80m(clocks),
2513 ApbClkConfig::Apll => release_apb_clk_cpu_div2(clocks),
2514 ApbClkConfig::Xtal => release_cpu_clk(clocks),
2515 ApbClkConfig::RcFast => release_cpu_clk(clocks),
2516 }
2517 }
2518 } else {
2519 configure_apb_clk_impl(clocks, old_selector, new_selector);
2520 }
2521 }
2522 pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
2523 clocks.apb_clk
2524 }
2525 pub fn request_apb_clk(clocks: &mut ClockTree) {
2526 trace!("Requesting APB_CLK");
2527 if increment_reference_count(&mut clocks.apb_clk_refcount) {
2528 trace!("Enabling APB_CLK");
2529 match unwrap!(clocks.apb_clk) {
2530 ApbClkConfig::Pll => request_apb_clk_80m(clocks),
2531 ApbClkConfig::Apll => request_apb_clk_cpu_div2(clocks),
2532 ApbClkConfig::Xtal => request_cpu_clk(clocks),
2533 ApbClkConfig::RcFast => request_cpu_clk(clocks),
2534 }
2535 enable_apb_clk_impl(clocks, true);
2536 }
2537 }
2538 pub fn release_apb_clk(clocks: &mut ClockTree) {
2539 trace!("Releasing APB_CLK");
2540 if decrement_reference_count(&mut clocks.apb_clk_refcount) {
2541 trace!("Disabling APB_CLK");
2542 enable_apb_clk_impl(clocks, false);
2543 match unwrap!(clocks.apb_clk) {
2544 ApbClkConfig::Pll => release_apb_clk_80m(clocks),
2545 ApbClkConfig::Apll => release_apb_clk_cpu_div2(clocks),
2546 ApbClkConfig::Xtal => release_cpu_clk(clocks),
2547 ApbClkConfig::RcFast => release_cpu_clk(clocks),
2548 }
2549 }
2550 }
2551 #[allow(unused_variables)]
2552 pub fn apb_clk_config_frequency(clocks: &mut ClockTree, config: ApbClkConfig) -> u32 {
2553 match config {
2554 ApbClkConfig::Pll => apb_clk_80m_frequency(),
2555 ApbClkConfig::Apll => apb_clk_cpu_div2_frequency(),
2556 ApbClkConfig::Xtal => cpu_clk_frequency(),
2557 ApbClkConfig::RcFast => cpu_clk_frequency(),
2558 }
2559 }
2560 pub fn apb_clk_frequency() -> u32 {
2561 APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2562 }
2563 pub fn apb_clk_source_frequency(source: ApbClkConfig) -> u32 {
2564 match source {
2565 ApbClkConfig::Pll => apb_clk_80m_frequency(),
2566 ApbClkConfig::Apll => apb_clk_cpu_div2_frequency(),
2567 ApbClkConfig::Xtal => cpu_clk_frequency(),
2568 ApbClkConfig::RcFast => cpu_clk_frequency(),
2569 }
2570 }
2571 pub fn configure_ref_tick(clocks: &mut ClockTree, new_selector: RefTickConfig) {
2572 let old_selector = clocks.ref_tick.replace(new_selector);
2573 refresh_ref_tick_downstream(clocks);
2574 if clocks.ref_tick_refcount > 0 {
2575 match new_selector {
2576 RefTickConfig::Pll => request_ref_tick_xtal(clocks),
2577 RefTickConfig::Apll => request_ref_tick_xtal(clocks),
2578 RefTickConfig::Xtal => request_ref_tick_xtal(clocks),
2579 RefTickConfig::RcFast => request_ref_tick_ck8m(clocks),
2580 }
2581 configure_ref_tick_impl(clocks, old_selector, new_selector);
2582 if let Some(old_selector) = old_selector {
2583 match old_selector {
2584 RefTickConfig::Pll => release_ref_tick_xtal(clocks),
2585 RefTickConfig::Apll => release_ref_tick_xtal(clocks),
2586 RefTickConfig::Xtal => release_ref_tick_xtal(clocks),
2587 RefTickConfig::RcFast => release_ref_tick_ck8m(clocks),
2588 }
2589 }
2590 } else {
2591 configure_ref_tick_impl(clocks, old_selector, new_selector);
2592 }
2593 }
2594 pub fn ref_tick_config(clocks: &mut ClockTree) -> Option<RefTickConfig> {
2595 clocks.ref_tick
2596 }
2597 pub fn request_ref_tick(clocks: &mut ClockTree) {
2598 trace!("Requesting REF_TICK");
2599 if increment_reference_count(&mut clocks.ref_tick_refcount) {
2600 trace!("Enabling REF_TICK");
2601 match unwrap!(clocks.ref_tick) {
2602 RefTickConfig::Pll => request_ref_tick_xtal(clocks),
2603 RefTickConfig::Apll => request_ref_tick_xtal(clocks),
2604 RefTickConfig::Xtal => request_ref_tick_xtal(clocks),
2605 RefTickConfig::RcFast => request_ref_tick_ck8m(clocks),
2606 }
2607 enable_ref_tick_impl(clocks, true);
2608 }
2609 }
2610 pub fn release_ref_tick(clocks: &mut ClockTree) {
2611 trace!("Releasing REF_TICK");
2612 if decrement_reference_count(&mut clocks.ref_tick_refcount) {
2613 trace!("Disabling REF_TICK");
2614 enable_ref_tick_impl(clocks, false);
2615 match unwrap!(clocks.ref_tick) {
2616 RefTickConfig::Pll => release_ref_tick_xtal(clocks),
2617 RefTickConfig::Apll => release_ref_tick_xtal(clocks),
2618 RefTickConfig::Xtal => release_ref_tick_xtal(clocks),
2619 RefTickConfig::RcFast => release_ref_tick_ck8m(clocks),
2620 }
2621 }
2622 }
2623 #[allow(unused_variables)]
2624 pub fn ref_tick_config_frequency(clocks: &mut ClockTree, config: RefTickConfig) -> u32 {
2625 match config {
2626 RefTickConfig::Pll => ref_tick_xtal_frequency(),
2627 RefTickConfig::Apll => ref_tick_xtal_frequency(),
2628 RefTickConfig::Xtal => ref_tick_xtal_frequency(),
2629 RefTickConfig::RcFast => ref_tick_ck8m_frequency(),
2630 }
2631 }
2632 pub fn ref_tick_frequency() -> u32 {
2633 REF_TICK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2634 }
2635 pub fn ref_tick_source_frequency(source: RefTickConfig) -> u32 {
2636 match source {
2637 RefTickConfig::Pll => ref_tick_xtal_frequency(),
2638 RefTickConfig::Apll => ref_tick_xtal_frequency(),
2639 RefTickConfig::Xtal => ref_tick_xtal_frequency(),
2640 RefTickConfig::RcFast => ref_tick_ck8m_frequency(),
2641 }
2642 }
2643 pub fn configure_ref_tick_xtal(clocks: &mut ClockTree, config: RefTickXtalConfig) {
2644 let old_config = clocks.ref_tick_xtal.replace(config);
2645 refresh_ref_tick_xtal_downstream(clocks);
2646 configure_ref_tick_xtal_impl(clocks, old_config, config);
2647 }
2648 pub fn ref_tick_xtal_config(clocks: &mut ClockTree) -> Option<RefTickXtalConfig> {
2649 clocks.ref_tick_xtal
2650 }
2651 pub fn request_ref_tick_xtal(clocks: &mut ClockTree) {
2652 trace!("Requesting REF_TICK_XTAL");
2653 trace!("Enabling REF_TICK_XTAL");
2654 request_xtal_clk(clocks);
2655 enable_ref_tick_xtal_impl(clocks, true);
2656 }
2657 pub fn release_ref_tick_xtal(clocks: &mut ClockTree) {
2658 trace!("Releasing REF_TICK_XTAL");
2659 trace!("Disabling REF_TICK_XTAL");
2660 enable_ref_tick_xtal_impl(clocks, false);
2661 release_xtal_clk(clocks);
2662 }
2663 #[allow(unused_variables)]
2664 pub fn ref_tick_xtal_config_frequency(
2665 clocks: &mut ClockTree,
2666 config: RefTickXtalConfig,
2667 ) -> u32 {
2668 (xtal_clk_frequency() / (config.divisor() + 1))
2669 }
2670 pub fn ref_tick_xtal_frequency() -> u32 {
2671 REF_TICK_XTAL_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2672 }
2673 pub fn ref_tick_xtal_source_frequency() -> u32 {
2674 xtal_clk_frequency()
2675 }
2676 pub fn configure_ref_tick_ck8m(clocks: &mut ClockTree, config: RefTickCk8mConfig) {
2677 let old_config = clocks.ref_tick_ck8m.replace(config);
2678 refresh_ref_tick_ck8m_downstream(clocks);
2679 configure_ref_tick_ck8m_impl(clocks, old_config, config);
2680 }
2681 pub fn ref_tick_ck8m_config(clocks: &mut ClockTree) -> Option<RefTickCk8mConfig> {
2682 clocks.ref_tick_ck8m
2683 }
2684 pub fn request_ref_tick_ck8m(clocks: &mut ClockTree) {
2685 trace!("Requesting REF_TICK_CK8M");
2686 trace!("Enabling REF_TICK_CK8M");
2687 request_rc_fast_clk(clocks);
2688 enable_ref_tick_ck8m_impl(clocks, true);
2689 }
2690 pub fn release_ref_tick_ck8m(clocks: &mut ClockTree) {
2691 trace!("Releasing REF_TICK_CK8M");
2692 trace!("Disabling REF_TICK_CK8M");
2693 enable_ref_tick_ck8m_impl(clocks, false);
2694 release_rc_fast_clk(clocks);
2695 }
2696 #[allow(unused_variables)]
2697 pub fn ref_tick_ck8m_config_frequency(
2698 clocks: &mut ClockTree,
2699 config: RefTickCk8mConfig,
2700 ) -> u32 {
2701 (rc_fast_clk_frequency() / (config.divisor() + 1))
2702 }
2703 pub fn ref_tick_ck8m_frequency() -> u32 {
2704 REF_TICK_CK8M_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2705 }
2706 pub fn ref_tick_ck8m_source_frequency() -> u32 {
2707 rc_fast_clk_frequency()
2708 }
2709 pub fn configure_cpu_clk(clocks: &mut ClockTree, new_selector: CpuClkConfig) {
2710 let old_selector = clocks.cpu_clk.replace(new_selector);
2711 refresh_cpu_clk_downstream(clocks);
2712 match new_selector {
2713 CpuClkConfig::Xtal => {
2714 configure_system_pre_div_in(clocks, SystemPreDivInConfig::Xtal);
2715 configure_apb_clk(clocks, ApbClkConfig::Xtal);
2716 configure_ref_tick(clocks, RefTickConfig::Xtal);
2717 let config_value =
2718 RefTickXtalConfig::new(((xtal_clk_frequency() / 1000000) - 1));
2719 configure_ref_tick_xtal(clocks, config_value);
2720 }
2721 CpuClkConfig::RcFast => {
2722 configure_system_pre_div_in(clocks, SystemPreDivInConfig::RcFast);
2723 configure_apb_clk(clocks, ApbClkConfig::RcFast);
2724 configure_ref_tick(clocks, RefTickConfig::RcFast);
2725 let config_value =
2726 RefTickCk8mConfig::new(((rc_fast_clk_frequency() / 1000000) - 1));
2727 configure_ref_tick_ck8m(clocks, config_value);
2728 }
2729 CpuClkConfig::Apll => {
2730 configure_cpu_pll_div_in(clocks, CpuPllDivInConfig::Apll);
2731 configure_apb_clk(clocks, ApbClkConfig::Apll);
2732 configure_ref_tick(clocks, RefTickConfig::Apll);
2733 let config_value =
2734 RefTickXtalConfig::new(((xtal_clk_frequency() / 1000000) - 1));
2735 configure_ref_tick_xtal(clocks, config_value);
2736 }
2737 CpuClkConfig::Pll => {
2738 configure_cpu_pll_div_in(clocks, CpuPllDivInConfig::Pll);
2739 configure_apb_clk(clocks, ApbClkConfig::Pll);
2740 configure_ref_tick(clocks, RefTickConfig::Pll);
2741 let config_value =
2742 RefTickXtalConfig::new(((xtal_clk_frequency() / 1000000) - 1));
2743 configure_ref_tick_xtal(clocks, config_value);
2744 }
2745 }
2746 match new_selector {
2747 CpuClkConfig::Xtal => request_system_pre_div(clocks),
2748 CpuClkConfig::RcFast => request_system_pre_div(clocks),
2749 CpuClkConfig::Apll => request_cpu_pll_div(clocks),
2750 CpuClkConfig::Pll => request_cpu_pll_div(clocks),
2751 }
2752 configure_cpu_clk_impl(clocks, old_selector, new_selector);
2753 if let Some(old_selector) = old_selector {
2754 match old_selector {
2755 CpuClkConfig::Xtal => release_system_pre_div(clocks),
2756 CpuClkConfig::RcFast => release_system_pre_div(clocks),
2757 CpuClkConfig::Apll => release_cpu_pll_div(clocks),
2758 CpuClkConfig::Pll => release_cpu_pll_div(clocks),
2759 }
2760 }
2761 }
2762 pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
2763 clocks.cpu_clk
2764 }
2765 fn request_cpu_clk(_clocks: &mut ClockTree) {}
2766 fn release_cpu_clk(_clocks: &mut ClockTree) {}
2767 #[allow(unused_variables)]
2768 pub fn cpu_clk_config_frequency(clocks: &mut ClockTree, config: CpuClkConfig) -> u32 {
2769 match config {
2770 CpuClkConfig::Xtal => system_pre_div_frequency(),
2771 CpuClkConfig::RcFast => system_pre_div_frequency(),
2772 CpuClkConfig::Apll => cpu_pll_div_frequency(),
2773 CpuClkConfig::Pll => cpu_pll_div_frequency(),
2774 }
2775 }
2776 pub fn cpu_clk_frequency() -> u32 {
2777 CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2778 }
2779 pub fn request_apb_clk_cpu_div2(clocks: &mut ClockTree) {
2780 trace!("Requesting APB_CLK_CPU_DIV2");
2781 trace!("Enabling APB_CLK_CPU_DIV2");
2782 request_cpu_clk(clocks);
2783 enable_apb_clk_cpu_div2_impl(clocks, true);
2784 }
2785 pub fn release_apb_clk_cpu_div2(clocks: &mut ClockTree) {
2786 trace!("Releasing APB_CLK_CPU_DIV2");
2787 trace!("Disabling APB_CLK_CPU_DIV2");
2788 enable_apb_clk_cpu_div2_impl(clocks, false);
2789 release_cpu_clk(clocks);
2790 }
2791 pub fn apb_clk_cpu_div2_frequency() -> u32 {
2792 (cpu_clk_frequency() / 2)
2793 }
2794 pub fn apb_clk_cpu_div2_source_frequency() -> u32 {
2795 cpu_clk_frequency()
2796 }
2797 pub fn request_apb_clk_80m(clocks: &mut ClockTree) {
2798 trace!("Requesting APB_CLK_80M");
2799 trace!("Enabling APB_CLK_80M");
2800 request_cpu_clk(clocks);
2801 enable_apb_clk_80m_impl(clocks, true);
2802 }
2803 pub fn release_apb_clk_80m(clocks: &mut ClockTree) {
2804 trace!("Releasing APB_CLK_80M");
2805 trace!("Disabling APB_CLK_80M");
2806 enable_apb_clk_80m_impl(clocks, false);
2807 release_cpu_clk(clocks);
2808 }
2809 pub fn apb_clk_80m_frequency() -> u32 {
2810 80000000
2811 }
2812 pub fn apb_clk_80m_source_frequency() -> u32 {
2813 cpu_clk_frequency()
2814 }
2815 #[cfg(use_xtal32k)]
2816 pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
2817 trace!("Requesting XTAL32K_CLK");
2818 if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
2819 trace!("Enabling XTAL32K_CLK");
2820 enable_xtal32k_clk_impl(clocks, true);
2821 }
2822 }
2823 #[cfg(use_xtal32k)]
2824 pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
2825 trace!("Releasing XTAL32K_CLK");
2826 if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
2827 trace!("Disabling XTAL32K_CLK");
2828 enable_xtal32k_clk_impl(clocks, false);
2829 }
2830 }
2831 #[cfg(use_xtal32k)]
2832 pub fn xtal32k_clk_frequency() -> u32 {
2833 32768
2834 }
2835 pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
2836 trace!("Requesting RC_SLOW_CLK");
2837 trace!("Enabling RC_SLOW_CLK");
2838 enable_rc_slow_clk_impl(clocks, true);
2839 }
2840 pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
2841 trace!("Releasing RC_SLOW_CLK");
2842 trace!("Disabling RC_SLOW_CLK");
2843 enable_rc_slow_clk_impl(clocks, false);
2844 }
2845 pub fn rc_slow_clk_frequency() -> u32 {
2846 90000
2847 }
2848 pub fn request_rc_fast_div_clk(clocks: &mut ClockTree) {
2849 trace!("Requesting RC_FAST_DIV_CLK");
2850 if increment_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
2851 trace!("Enabling RC_FAST_DIV_CLK");
2852 request_rc_fast_clk(clocks);
2853 enable_rc_fast_div_clk_impl(clocks, true);
2854 }
2855 }
2856 pub fn release_rc_fast_div_clk(clocks: &mut ClockTree) {
2857 trace!("Releasing RC_FAST_DIV_CLK");
2858 if decrement_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
2859 trace!("Disabling RC_FAST_DIV_CLK");
2860 enable_rc_fast_div_clk_impl(clocks, false);
2861 release_rc_fast_clk(clocks);
2862 }
2863 }
2864 pub fn rc_fast_div_clk_frequency() -> u32 {
2865 (rc_fast_clk_frequency() / 256)
2866 }
2867 pub fn rc_fast_div_clk_source_frequency() -> u32 {
2868 rc_fast_clk_frequency()
2869 }
2870 pub fn request_xtal_div_clk(clocks: &mut ClockTree) {
2871 trace!("Requesting XTAL_DIV_CLK");
2872 trace!("Enabling XTAL_DIV_CLK");
2873 request_xtal_clk(clocks);
2874 enable_xtal_div_clk_impl(clocks, true);
2875 }
2876 pub fn release_xtal_div_clk(clocks: &mut ClockTree) {
2877 trace!("Releasing XTAL_DIV_CLK");
2878 trace!("Disabling XTAL_DIV_CLK");
2879 enable_xtal_div_clk_impl(clocks, false);
2880 release_xtal_clk(clocks);
2881 }
2882 pub fn xtal_div_clk_frequency() -> u32 {
2883 (xtal_clk_frequency() / 4)
2884 }
2885 pub fn xtal_div_clk_source_frequency() -> u32 {
2886 xtal_clk_frequency()
2887 }
2888 pub fn configure_rtc_slow_clk(clocks: &mut ClockTree, new_selector: RtcSlowClkConfig) {
2889 let old_selector = clocks.rtc_slow_clk.replace(new_selector);
2890 refresh_rtc_slow_clk_downstream(clocks);
2891 match new_selector {
2892 #[cfg(use_xtal32k)]
2893 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2894 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
2895 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
2896 }
2897 configure_rtc_slow_clk_impl(clocks, old_selector, new_selector);
2898 if let Some(old_selector) = old_selector {
2899 match old_selector {
2900 #[cfg(use_xtal32k)]
2901 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2902 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
2903 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
2904 }
2905 }
2906 }
2907 pub fn rtc_slow_clk_config(clocks: &mut ClockTree) -> Option<RtcSlowClkConfig> {
2908 clocks.rtc_slow_clk
2909 }
2910 pub fn request_rtc_slow_clk(clocks: &mut ClockTree) {
2911 trace!("Requesting RTC_SLOW_CLK");
2912 trace!("Enabling RTC_SLOW_CLK");
2913 match unwrap!(clocks.rtc_slow_clk) {
2914 #[cfg(use_xtal32k)]
2915 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2916 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
2917 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
2918 }
2919 enable_rtc_slow_clk_impl(clocks, true);
2920 }
2921 pub fn release_rtc_slow_clk(clocks: &mut ClockTree) {
2922 trace!("Releasing RTC_SLOW_CLK");
2923 trace!("Disabling RTC_SLOW_CLK");
2924 enable_rtc_slow_clk_impl(clocks, false);
2925 match unwrap!(clocks.rtc_slow_clk) {
2926 #[cfg(use_xtal32k)]
2927 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2928 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
2929 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
2930 }
2931 }
2932 #[allow(unused_variables)]
2933 pub fn rtc_slow_clk_config_frequency(
2934 clocks: &mut ClockTree,
2935 config: RtcSlowClkConfig,
2936 ) -> u32 {
2937 match config {
2938 #[cfg(use_xtal32k)]
2939 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
2940 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
2941 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
2942 }
2943 }
2944 pub fn rtc_slow_clk_frequency() -> u32 {
2945 RTC_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2946 }
2947 pub fn rtc_slow_clk_source_frequency(source: RtcSlowClkConfig) -> u32 {
2948 match source {
2949 #[cfg(use_xtal32k)]
2950 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
2951 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
2952 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
2953 }
2954 }
2955 pub fn configure_rtc_fast_clk(clocks: &mut ClockTree, new_selector: RtcFastClkConfig) {
2956 let old_selector = clocks.rtc_fast_clk.replace(new_selector);
2957 refresh_rtc_fast_clk_downstream(clocks);
2958 if clocks.rtc_fast_clk_refcount > 0 {
2959 match new_selector {
2960 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
2961 RtcFastClkConfig::Rc => request_rc_fast_clk(clocks),
2962 }
2963 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
2964 if let Some(old_selector) = old_selector {
2965 match old_selector {
2966 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
2967 RtcFastClkConfig::Rc => release_rc_fast_clk(clocks),
2968 }
2969 }
2970 } else {
2971 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
2972 }
2973 }
2974 pub fn rtc_fast_clk_config(clocks: &mut ClockTree) -> Option<RtcFastClkConfig> {
2975 clocks.rtc_fast_clk
2976 }
2977 pub fn request_rtc_fast_clk(clocks: &mut ClockTree) {
2978 trace!("Requesting RTC_FAST_CLK");
2979 if increment_reference_count(&mut clocks.rtc_fast_clk_refcount) {
2980 trace!("Enabling RTC_FAST_CLK");
2981 match unwrap!(clocks.rtc_fast_clk) {
2982 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
2983 RtcFastClkConfig::Rc => request_rc_fast_clk(clocks),
2984 }
2985 enable_rtc_fast_clk_impl(clocks, true);
2986 }
2987 }
2988 pub fn release_rtc_fast_clk(clocks: &mut ClockTree) {
2989 trace!("Releasing RTC_FAST_CLK");
2990 if decrement_reference_count(&mut clocks.rtc_fast_clk_refcount) {
2991 trace!("Disabling RTC_FAST_CLK");
2992 enable_rtc_fast_clk_impl(clocks, false);
2993 match unwrap!(clocks.rtc_fast_clk) {
2994 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
2995 RtcFastClkConfig::Rc => release_rc_fast_clk(clocks),
2996 }
2997 }
2998 }
2999 #[allow(unused_variables)]
3000 pub fn rtc_fast_clk_config_frequency(
3001 clocks: &mut ClockTree,
3002 config: RtcFastClkConfig,
3003 ) -> u32 {
3004 match config {
3005 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
3006 RtcFastClkConfig::Rc => rc_fast_clk_frequency(),
3007 }
3008 }
3009 pub fn rtc_fast_clk_frequency() -> u32 {
3010 RTC_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3011 }
3012 pub fn rtc_fast_clk_source_frequency(source: RtcFastClkConfig) -> u32 {
3013 match source {
3014 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
3015 RtcFastClkConfig::Rc => rc_fast_clk_frequency(),
3016 }
3017 }
3018 pub fn request_uart_mem_clk(clocks: &mut ClockTree) {
3019 trace!("Requesting UART_MEM_CLK");
3020 if increment_reference_count(&mut clocks.uart_mem_clk_refcount) {
3021 trace!("Enabling UART_MEM_CLK");
3022 request_xtal_clk(clocks);
3023 enable_uart_mem_clk_impl(clocks, true);
3024 }
3025 }
3026 pub fn release_uart_mem_clk(clocks: &mut ClockTree) {
3027 trace!("Releasing UART_MEM_CLK");
3028 if decrement_reference_count(&mut clocks.uart_mem_clk_refcount) {
3029 trace!("Disabling UART_MEM_CLK");
3030 enable_uart_mem_clk_impl(clocks, false);
3031 release_xtal_clk(clocks);
3032 }
3033 }
3034 pub fn uart_mem_clk_frequency() -> u32 {
3035 xtal_clk_frequency()
3036 }
3037 pub fn uart_mem_clk_source_frequency(source: UartMemClkConfig) -> u32 {
3038 match source {
3039 UartMemClkConfig::Xtal => xtal_clk_frequency(),
3040 }
3041 }
3042 pub fn configure_timg_calibration_clock(
3043 clocks: &mut ClockTree,
3044 new_selector: TimgCalibrationClockConfig,
3045 ) {
3046 let old_selector = clocks.timg_calibration_clock.replace(new_selector);
3047 refresh_timg_calibration_clock_downstream(clocks);
3048 if clocks.timg_calibration_clock_refcount > 0 {
3049 match new_selector {
3050 TimgCalibrationClockConfig::RtcClk => request_rtc_slow_clk(clocks),
3051 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3052 #[cfg(use_xtal32k)]
3053 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3054 }
3055 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3056 if let Some(old_selector) = old_selector {
3057 match old_selector {
3058 TimgCalibrationClockConfig::RtcClk => release_rtc_slow_clk(clocks),
3059 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3060 #[cfg(use_xtal32k)]
3061 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3062 }
3063 }
3064 } else {
3065 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
3066 }
3067 }
3068 pub fn timg_calibration_clock_config(
3069 clocks: &mut ClockTree,
3070 ) -> Option<TimgCalibrationClockConfig> {
3071 clocks.timg_calibration_clock
3072 }
3073 pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
3074 trace!("Requesting TIMG_CALIBRATION_CLOCK");
3075 if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3076 trace!("Enabling TIMG_CALIBRATION_CLOCK");
3077 crate::rtc_cntl::WakeLock::acquire();
3078 match unwrap!(clocks.timg_calibration_clock) {
3079 TimgCalibrationClockConfig::RtcClk => request_rtc_slow_clk(clocks),
3080 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
3081 #[cfg(use_xtal32k)]
3082 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
3083 }
3084 enable_timg_calibration_clock_impl(clocks, true);
3085 }
3086 }
3087 pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
3088 trace!("Releasing TIMG_CALIBRATION_CLOCK");
3089 if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
3090 trace!("Disabling TIMG_CALIBRATION_CLOCK");
3091 crate::rtc_cntl::WakeLock::release();
3092 enable_timg_calibration_clock_impl(clocks, false);
3093 match unwrap!(clocks.timg_calibration_clock) {
3094 TimgCalibrationClockConfig::RtcClk => release_rtc_slow_clk(clocks),
3095 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
3096 #[cfg(use_xtal32k)]
3097 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
3098 }
3099 }
3100 }
3101 #[allow(unused_variables)]
3102 pub fn timg_calibration_clock_config_frequency(
3103 clocks: &mut ClockTree,
3104 config: TimgCalibrationClockConfig,
3105 ) -> u32 {
3106 match config {
3107 TimgCalibrationClockConfig::RtcClk => rtc_slow_clk_frequency(),
3108 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
3109 #[cfg(use_xtal32k)]
3110 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3111 }
3112 }
3113 pub fn timg_calibration_clock_frequency() -> u32 {
3114 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
3115 }
3116 pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
3117 match source {
3118 TimgCalibrationClockConfig::RtcClk => rtc_slow_clk_frequency(),
3119 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
3120 #[cfg(use_xtal32k)]
3121 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
3122 }
3123 }
3124 impl SdmInstance {
3125 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3126 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3127 if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3128 {
3129 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3130 request_apb_clk(clocks);
3131 self.enable_function_clock_impl(clocks, true);
3132 }
3133 }
3134 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3135 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3136 if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
3137 {
3138 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3139 self.enable_function_clock_impl(clocks, false);
3140 release_apb_clk(clocks);
3141 }
3142 }
3143 pub fn function_clock_frequency(self) -> u32 {
3144 apb_clk_frequency()
3145 }
3146 pub fn function_clock_source_frequency() -> u32 {
3147 apb_clk_frequency()
3148 }
3149 }
3150 impl I2cInstance {
3151 pub fn configure_function_clock(
3152 self,
3153 clocks: &mut ClockTree,
3154 config: I2cFunctionClockConfig,
3155 ) {
3156 let old_config = clocks.i2c_function_clock[self as usize].replace(config);
3157 refresh_i2c_function_clock_downstream(clocks, self);
3158 if clocks.i2c_function_clock_refcount[self as usize] > 0 {
3159 match config.sclk {
3160 I2cFunctionClockSclk::Apb => request_apb_clk(clocks),
3161 I2cFunctionClockSclk::RefTick => request_ref_tick(clocks),
3162 }
3163 self.configure_function_clock_impl(clocks, old_config, config);
3164 if let Some(old_config) = old_config {
3165 match old_config.sclk {
3166 I2cFunctionClockSclk::Apb => release_apb_clk(clocks),
3167 I2cFunctionClockSclk::RefTick => release_ref_tick(clocks),
3168 }
3169 }
3170 } else {
3171 self.configure_function_clock_impl(clocks, old_config, config);
3172 }
3173 }
3174 pub fn function_clock_config(
3175 self,
3176 clocks: &mut ClockTree,
3177 ) -> Option<I2cFunctionClockConfig> {
3178 clocks.i2c_function_clock[self as usize]
3179 }
3180 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3181 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3182 if increment_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3183 {
3184 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3185 crate::rtc_cntl::WakeLock::acquire();
3186 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3187 I2cFunctionClockSclk::Apb => request_apb_clk(clocks),
3188 I2cFunctionClockSclk::RefTick => request_ref_tick(clocks),
3189 }
3190 self.enable_function_clock_impl(clocks, true);
3191 }
3192 }
3193 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3194 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3195 if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3196 {
3197 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3198 crate::rtc_cntl::WakeLock::release();
3199 self.enable_function_clock_impl(clocks, false);
3200 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3201 I2cFunctionClockSclk::Apb => release_apb_clk(clocks),
3202 I2cFunctionClockSclk::RefTick => release_ref_tick(clocks),
3203 }
3204 }
3205 }
3206 #[allow(unused_variables)]
3207 pub fn function_clock_config_frequency(
3208 clocks: &mut ClockTree,
3209 config: I2cFunctionClockConfig,
3210 ) -> u32 {
3211 match config.sclk {
3212 I2cFunctionClockSclk::Apb => apb_clk_frequency(),
3213 I2cFunctionClockSclk::RefTick => ref_tick_frequency(),
3214 }
3215 }
3216 pub fn function_clock_frequency(self) -> u32 {
3217 I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3218 .load(::core::sync::atomic::Ordering::Acquire)
3219 }
3220 pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
3221 match sclk {
3222 I2cFunctionClockSclk::Apb => apb_clk_frequency(),
3223 I2cFunctionClockSclk::RefTick => ref_tick_frequency(),
3224 }
3225 }
3226 }
3227 impl I2sInstance {
3228 pub fn configure_mclk(self, clocks: &mut ClockTree, config: I2sMclkConfig) {
3229 let old_config = clocks.i2s_mclk[self as usize].replace(config);
3230 refresh_i2s_mclk_downstream(clocks, self);
3231 if clocks.i2s_mclk_refcount[self as usize] > 0 {
3232 match config.sclk {
3233 I2sMclkSclk::PllF160m => request_pll_f160m_clk(clocks),
3234 I2sMclkSclk::Apll => request_apll_clk(clocks),
3235 }
3236 self.configure_mclk_impl(clocks, old_config, config);
3237 if let Some(old_config) = old_config {
3238 match old_config.sclk {
3239 I2sMclkSclk::PllF160m => release_pll_f160m_clk(clocks),
3240 I2sMclkSclk::Apll => release_apll_clk(clocks),
3241 }
3242 }
3243 } else {
3244 self.configure_mclk_impl(clocks, old_config, config);
3245 }
3246 }
3247 pub fn mclk_config(self, clocks: &mut ClockTree) -> Option<I2sMclkConfig> {
3248 clocks.i2s_mclk[self as usize]
3249 }
3250 pub fn request_mclk(self, clocks: &mut ClockTree) {
3251 trace!("Requesting {:?}::MCLK", self);
3252 if increment_reference_count(&mut clocks.i2s_mclk_refcount[self as usize]) {
3253 trace!("Enabling {:?}::MCLK", self);
3254 crate::rtc_cntl::WakeLock::acquire();
3255 match unwrap!(clocks.i2s_mclk[self as usize]).sclk {
3256 I2sMclkSclk::PllF160m => request_pll_f160m_clk(clocks),
3257 I2sMclkSclk::Apll => request_apll_clk(clocks),
3258 }
3259 self.enable_mclk_impl(clocks, true);
3260 }
3261 }
3262 pub fn release_mclk(self, clocks: &mut ClockTree) {
3263 trace!("Releasing {:?}::MCLK", self);
3264 if decrement_reference_count(&mut clocks.i2s_mclk_refcount[self as usize]) {
3265 trace!("Disabling {:?}::MCLK", self);
3266 crate::rtc_cntl::WakeLock::release();
3267 self.enable_mclk_impl(clocks, false);
3268 match unwrap!(clocks.i2s_mclk[self as usize]).sclk {
3269 I2sMclkSclk::PllF160m => release_pll_f160m_clk(clocks),
3270 I2sMclkSclk::Apll => release_apll_clk(clocks),
3271 }
3272 }
3273 }
3274 #[allow(unused_variables)]
3275 pub fn mclk_config_frequency(clocks: &mut ClockTree, config: I2sMclkConfig) -> u32 {
3276 (((match config.sclk {
3277 I2sMclkSclk::PllF160m => pll_f160m_clk_frequency(),
3278 I2sMclkSclk::Apll => apll_clk_frequency(),
3279 } as u64)
3280 * (config.div_a() as u64))
3281 / (((config.div_num() * config.div_a()) + config.div_b()) as u64))
3282 as u32
3283 }
3284 pub fn mclk_frequency(self) -> u32 {
3285 I2S_MCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3286 }
3287 pub fn mclk_source_frequency(sclk: I2sMclkSclk) -> u32 {
3288 match sclk {
3289 I2sMclkSclk::PllF160m => pll_f160m_clk_frequency(),
3290 I2sMclkSclk::Apll => apll_clk_frequency(),
3291 }
3292 }
3293 }
3294 impl RmtInstance {
3295 pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
3296 let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
3297 refresh_rmt_sclk_downstream(clocks, self);
3298 if clocks.rmt_sclk_refcount[self as usize] > 0 {
3299 match new_selector {
3300 RmtSclkConfig::RefTick => request_ref_tick(clocks),
3301 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
3302 }
3303 self.configure_sclk_impl(clocks, old_selector, new_selector);
3304 if let Some(old_selector) = old_selector {
3305 match old_selector {
3306 RmtSclkConfig::RefTick => release_ref_tick(clocks),
3307 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
3308 }
3309 }
3310 } else {
3311 self.configure_sclk_impl(clocks, old_selector, new_selector);
3312 }
3313 }
3314 pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
3315 clocks.rmt_sclk[self as usize]
3316 }
3317 pub fn request_sclk(self, clocks: &mut ClockTree) {
3318 trace!("Requesting {:?}::SCLK", self);
3319 if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3320 trace!("Enabling {:?}::SCLK", self);
3321 crate::rtc_cntl::WakeLock::acquire();
3322 match unwrap!(clocks.rmt_sclk[self as usize]) {
3323 RmtSclkConfig::RefTick => request_ref_tick(clocks),
3324 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
3325 }
3326 self.enable_sclk_impl(clocks, true);
3327 }
3328 }
3329 pub fn release_sclk(self, clocks: &mut ClockTree) {
3330 trace!("Releasing {:?}::SCLK", self);
3331 if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3332 trace!("Disabling {:?}::SCLK", self);
3333 crate::rtc_cntl::WakeLock::release();
3334 self.enable_sclk_impl(clocks, false);
3335 match unwrap!(clocks.rmt_sclk[self as usize]) {
3336 RmtSclkConfig::RefTick => release_ref_tick(clocks),
3337 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
3338 }
3339 }
3340 }
3341 #[allow(unused_variables)]
3342 pub fn sclk_config_frequency(clocks: &mut ClockTree, config: RmtSclkConfig) -> u32 {
3343 match config {
3344 RmtSclkConfig::RefTick => ref_tick_frequency(),
3345 RmtSclkConfig::ApbClk => apb_clk_frequency(),
3346 }
3347 }
3348 pub fn sclk_frequency(self) -> u32 {
3349 RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3350 }
3351 pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
3352 match source {
3353 RmtSclkConfig::RefTick => ref_tick_frequency(),
3354 RmtSclkConfig::ApbClk => apb_clk_frequency(),
3355 }
3356 }
3357 }
3358 impl SpiInstance {
3359 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3360 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3361 if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3362 {
3363 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3364 crate::rtc_cntl::WakeLock::acquire();
3365 request_apb_clk(clocks);
3366 self.enable_function_clock_impl(clocks, true);
3367 }
3368 }
3369 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3370 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3371 if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3372 {
3373 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3374 crate::rtc_cntl::WakeLock::release();
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(source: SpiFunctionClockConfig) -> u32 {
3383 match source {
3384 SpiFunctionClockConfig::Apb => apb_clk_frequency(),
3385 }
3386 }
3387 }
3388 impl TimgInstance {
3389 pub fn configure_function_clock(
3390 self,
3391 clocks: &mut ClockTree,
3392 new_selector: TimgFunctionClockConfig,
3393 ) {
3394 let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
3395 refresh_timg_function_clock_downstream(clocks, self);
3396 if clocks.timg_function_clock_refcount[self as usize] > 0 {
3397 match new_selector {
3398 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
3399 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
3400 }
3401 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3402 if let Some(old_selector) = old_selector {
3403 match old_selector {
3404 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
3405 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
3406 }
3407 }
3408 } else {
3409 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3410 }
3411 }
3412 pub fn function_clock_config(
3413 self,
3414 clocks: &mut ClockTree,
3415 ) -> Option<TimgFunctionClockConfig> {
3416 clocks.timg_function_clock[self as usize]
3417 }
3418 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3419 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3420 if increment_reference_count(
3421 &mut clocks.timg_function_clock_refcount[self as usize],
3422 ) {
3423 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3424 match unwrap!(clocks.timg_function_clock[self as usize]) {
3425 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
3426 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
3427 }
3428 self.enable_function_clock_impl(clocks, true);
3429 }
3430 }
3431 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3432 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3433 if decrement_reference_count(
3434 &mut clocks.timg_function_clock_refcount[self as usize],
3435 ) {
3436 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3437 self.enable_function_clock_impl(clocks, false);
3438 match unwrap!(clocks.timg_function_clock[self as usize]) {
3439 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
3440 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
3441 }
3442 }
3443 }
3444 #[allow(unused_variables)]
3445 pub fn function_clock_config_frequency(
3446 clocks: &mut ClockTree,
3447 config: TimgFunctionClockConfig,
3448 ) -> u32 {
3449 match config {
3450 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
3451 TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
3452 }
3453 }
3454 pub fn function_clock_frequency(self) -> u32 {
3455 TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3456 .load(::core::sync::atomic::Ordering::Acquire)
3457 }
3458 pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
3459 match source {
3460 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
3461 TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
3462 }
3463 }
3464 }
3465 impl UartInstance {
3466 pub fn configure_function_clock(
3467 self,
3468 clocks: &mut ClockTree,
3469 config: UartFunctionClockConfig,
3470 ) {
3471 let old_config = clocks.uart_function_clock[self as usize].replace(config);
3472 refresh_uart_function_clock_downstream(clocks, self);
3473 if clocks.uart_function_clock_refcount[self as usize] > 0 {
3474 match config.sclk {
3475 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
3476 UartFunctionClockSclk::RefTick => request_ref_tick(clocks),
3477 }
3478 self.configure_function_clock_impl(clocks, old_config, config);
3479 if let Some(old_config) = old_config {
3480 match old_config.sclk {
3481 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
3482 UartFunctionClockSclk::RefTick => release_ref_tick(clocks),
3483 }
3484 }
3485 } else {
3486 self.configure_function_clock_impl(clocks, old_config, config);
3487 }
3488 }
3489 pub fn function_clock_config(
3490 self,
3491 clocks: &mut ClockTree,
3492 ) -> Option<UartFunctionClockConfig> {
3493 clocks.uart_function_clock[self as usize]
3494 }
3495 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3496 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3497 if increment_reference_count(
3498 &mut clocks.uart_function_clock_refcount[self as usize],
3499 ) {
3500 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3501 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3502 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
3503 UartFunctionClockSclk::RefTick => request_ref_tick(clocks),
3504 }
3505 self.enable_function_clock_impl(clocks, true);
3506 }
3507 }
3508 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3509 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3510 if decrement_reference_count(
3511 &mut clocks.uart_function_clock_refcount[self as usize],
3512 ) {
3513 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3514 self.enable_function_clock_impl(clocks, false);
3515 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3516 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
3517 UartFunctionClockSclk::RefTick => release_ref_tick(clocks),
3518 }
3519 }
3520 }
3521 #[allow(unused_variables)]
3522 pub fn function_clock_config_frequency(
3523 clocks: &mut ClockTree,
3524 config: UartFunctionClockConfig,
3525 ) -> u32 {
3526 match config.sclk {
3527 UartFunctionClockSclk::Apb => apb_clk_frequency(),
3528 UartFunctionClockSclk::RefTick => ref_tick_frequency(),
3529 }
3530 }
3531 pub fn function_clock_frequency(self) -> u32 {
3532 UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3533 .load(::core::sync::atomic::Ordering::Acquire)
3534 }
3535 pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
3536 match sclk {
3537 UartFunctionClockSclk::Apb => apb_clk_frequency(),
3538 UartFunctionClockSclk::RefTick => ref_tick_frequency(),
3539 }
3540 }
3541 pub fn configure_baud_rate_generator(
3542 self,
3543 clocks: &mut ClockTree,
3544 config: UartBaudRateGeneratorConfig,
3545 ) {
3546 let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
3547 refresh_uart_baud_rate_generator_downstream(clocks, self);
3548 self.configure_baud_rate_generator_impl(clocks, old_config, config);
3549 }
3550 pub fn baud_rate_generator_config(
3551 self,
3552 clocks: &mut ClockTree,
3553 ) -> Option<UartBaudRateGeneratorConfig> {
3554 clocks.uart_baud_rate_generator[self as usize]
3555 }
3556 pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
3557 trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
3558 if increment_reference_count(
3559 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3560 ) {
3561 trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
3562 self.request_function_clock(clocks);
3563 self.enable_baud_rate_generator_impl(clocks, true);
3564 }
3565 }
3566 pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
3567 trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
3568 if decrement_reference_count(
3569 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3570 ) {
3571 trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
3572 self.enable_baud_rate_generator_impl(clocks, false);
3573 self.release_function_clock(clocks);
3574 }
3575 }
3576 #[allow(unused_variables)]
3577 pub fn baud_rate_generator_config_frequency(
3578 self,
3579 clocks: &mut ClockTree,
3580 config: UartBaudRateGeneratorConfig,
3581 ) -> u32 {
3582 ((self.function_clock_frequency() * 16)
3583 / ((config.integral() * 16) + config.fractional()))
3584 }
3585 pub fn baud_rate_generator_frequency(self) -> u32 {
3586 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
3587 .load(::core::sync::atomic::Ordering::Acquire)
3588 }
3589 pub fn request_mem_clock(self, clocks: &mut ClockTree) {
3590 trace!("Requesting {:?}::MEM_CLOCK", self);
3591 if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
3592 trace!("Enabling {:?}::MEM_CLOCK", self);
3593 request_uart_mem_clk(clocks);
3594 self.enable_mem_clock_impl(clocks, true);
3595 }
3596 }
3597 pub fn release_mem_clock(self, clocks: &mut ClockTree) {
3598 trace!("Releasing {:?}::MEM_CLOCK", self);
3599 if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
3600 trace!("Disabling {:?}::MEM_CLOCK", self);
3601 self.enable_mem_clock_impl(clocks, false);
3602 release_uart_mem_clk(clocks);
3603 }
3604 }
3605 pub fn mem_clock_frequency(self) -> u32 {
3606 uart_mem_clk_frequency()
3607 }
3608 pub fn mem_clock_source_frequency() -> u32 {
3609 uart_mem_clk_frequency()
3610 }
3611 }
3612 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
3620 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3621 #[instability::unstable]
3622 pub struct ClockConfig {
3623 pub xtal_clk: Option<XtalClkConfig>,
3625 pub pll_clk: Option<PllClkConfig>,
3627 pub apll_clk: Option<ApllClkConfig>,
3629 pub cpu_pll_div: Option<CpuPllDivConfig>,
3631 pub system_pre_div: Option<SystemPreDivConfig>,
3633 pub cpu_clk: Option<CpuClkConfig>,
3635 pub rtc_slow_clk: Option<RtcSlowClkConfig>,
3637 pub rtc_fast_clk: Option<RtcFastClkConfig>,
3639 pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
3641 }
3642 impl ClockConfig {
3643 fn apply(&self, clocks: &mut ClockTree) {
3644 if let Some(config) = self.xtal_clk {
3645 configure_xtal_clk(clocks, config);
3646 }
3647 if let Some(config) = self.pll_clk {
3648 configure_pll_clk(clocks, config);
3649 }
3650 if let Some(config) = self.apll_clk {
3651 configure_apll_clk(clocks, config);
3652 }
3653 if let Some(config) = self.cpu_pll_div {
3654 configure_cpu_pll_div(clocks, config);
3655 }
3656 if let Some(config) = self.system_pre_div {
3657 configure_system_pre_div(clocks, config);
3658 }
3659 if let Some(config) = self.cpu_clk {
3660 configure_cpu_clk(clocks, config);
3661 }
3662 if let Some(config) = self.rtc_slow_clk {
3663 configure_rtc_slow_clk(clocks, config);
3664 }
3665 if let Some(config) = self.rtc_fast_clk {
3666 configure_rtc_fast_clk(clocks, config);
3667 }
3668 if let Some(config) = self.timg_calibration_clock {
3669 configure_timg_calibration_clock(clocks, config);
3670 }
3671 }
3672 }
3673 fn increment_reference_count(refcount: &mut u32) -> bool {
3674 let first = *refcount == 0;
3675 *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
3676 first
3677 }
3678 fn decrement_reference_count(refcount: &mut u32) -> bool {
3679 *refcount = refcount.saturating_sub(1);
3680 let last = *refcount == 0;
3681 last
3682 }
3683 fn refresh_xtal_clk_downstream(clocks: &mut ClockTree) {
3684 if let Some(config) = clocks.xtal_clk {
3685 XTAL_CLK_FREQ_CACHE.store(
3686 xtal_clk_config_frequency(clocks, config),
3687 ::core::sync::atomic::Ordering::Release,
3688 );
3689 }
3690 refresh_pll_clk_downstream(clocks);
3691 refresh_system_pre_div_in_downstream(clocks);
3692 refresh_ref_tick_xtal_downstream(clocks);
3693 refresh_rtc_fast_clk_downstream(clocks);
3694 for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
3695 refresh_timg_function_clock_downstream(clocks, child_instance);
3696 }
3697 }
3698 fn refresh_pll_clk_downstream(clocks: &mut ClockTree) {
3699 if let Some(config) = clocks.pll_clk {
3700 PLL_CLK_FREQ_CACHE.store(
3701 pll_clk_config_frequency(clocks, config),
3702 ::core::sync::atomic::Ordering::Release,
3703 );
3704 }
3705 refresh_apll_clk_downstream(clocks);
3706 refresh_cpu_pll_div_in_downstream(clocks);
3707 for child_instance in [I2sInstance::I2s0] {
3708 refresh_i2s_mclk_downstream(clocks, child_instance);
3709 }
3710 }
3711 fn refresh_apll_clk_downstream(clocks: &mut ClockTree) {
3712 if let Some(config) = clocks.apll_clk {
3713 APLL_CLK_FREQ_CACHE.store(
3714 apll_clk_config_frequency(clocks, config),
3715 ::core::sync::atomic::Ordering::Release,
3716 );
3717 }
3718 refresh_cpu_pll_div_in_downstream(clocks);
3719 for child_instance in [I2sInstance::I2s0] {
3720 refresh_i2s_mclk_downstream(clocks, child_instance);
3721 }
3722 }
3723 fn refresh_cpu_pll_div_in_downstream(clocks: &mut ClockTree) {
3724 if let Some(config) = clocks.cpu_pll_div_in {
3725 CPU_PLL_DIV_IN_FREQ_CACHE.store(
3726 cpu_pll_div_in_config_frequency(clocks, config),
3727 ::core::sync::atomic::Ordering::Release,
3728 );
3729 }
3730 refresh_cpu_pll_div_downstream(clocks);
3731 }
3732 fn refresh_cpu_pll_div_downstream(clocks: &mut ClockTree) {
3733 if let Some(config) = clocks.cpu_pll_div {
3734 CPU_PLL_DIV_FREQ_CACHE.store(
3735 cpu_pll_div_config_frequency(clocks, config),
3736 ::core::sync::atomic::Ordering::Release,
3737 );
3738 }
3739 refresh_cpu_clk_downstream(clocks);
3740 }
3741 fn refresh_system_pre_div_in_downstream(clocks: &mut ClockTree) {
3742 if let Some(config) = clocks.system_pre_div_in {
3743 SYSTEM_PRE_DIV_IN_FREQ_CACHE.store(
3744 system_pre_div_in_config_frequency(clocks, config),
3745 ::core::sync::atomic::Ordering::Release,
3746 );
3747 }
3748 refresh_system_pre_div_downstream(clocks);
3749 }
3750 fn refresh_system_pre_div_downstream(clocks: &mut ClockTree) {
3751 if let Some(config) = clocks.system_pre_div {
3752 SYSTEM_PRE_DIV_FREQ_CACHE.store(
3753 system_pre_div_config_frequency(clocks, config),
3754 ::core::sync::atomic::Ordering::Release,
3755 );
3756 }
3757 refresh_cpu_clk_downstream(clocks);
3758 }
3759 fn refresh_ref_tick_xtal_downstream(clocks: &mut ClockTree) {
3760 if let Some(config) = clocks.ref_tick_xtal {
3761 REF_TICK_XTAL_FREQ_CACHE.store(
3762 ref_tick_xtal_config_frequency(clocks, config),
3763 ::core::sync::atomic::Ordering::Release,
3764 );
3765 }
3766 refresh_ref_tick_downstream(clocks);
3767 }
3768 fn refresh_ref_tick_ck8m_downstream(clocks: &mut ClockTree) {
3769 if let Some(config) = clocks.ref_tick_ck8m {
3770 REF_TICK_CK8M_FREQ_CACHE.store(
3771 ref_tick_ck8m_config_frequency(clocks, config),
3772 ::core::sync::atomic::Ordering::Release,
3773 );
3774 }
3775 refresh_ref_tick_downstream(clocks);
3776 }
3777 fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
3778 if let Some(config) = clocks.cpu_clk {
3779 CPU_CLK_FREQ_CACHE.store(
3780 cpu_clk_config_frequency(clocks, config),
3781 ::core::sync::atomic::Ordering::Release,
3782 );
3783 }
3784 refresh_apb_clk_downstream(clocks);
3785 }
3786 fn refresh_rtc_slow_clk_downstream(clocks: &mut ClockTree) {
3787 if let Some(config) = clocks.rtc_slow_clk {
3788 RTC_SLOW_CLK_FREQ_CACHE.store(
3789 rtc_slow_clk_config_frequency(clocks, config),
3790 ::core::sync::atomic::Ordering::Release,
3791 );
3792 }
3793 refresh_timg_calibration_clock_downstream(clocks);
3794 }
3795 fn refresh_rtc_fast_clk_downstream(clocks: &mut ClockTree) {
3796 if let Some(config) = clocks.rtc_fast_clk {
3797 RTC_FAST_CLK_FREQ_CACHE.store(
3798 rtc_fast_clk_config_frequency(clocks, config),
3799 ::core::sync::atomic::Ordering::Release,
3800 );
3801 }
3802 }
3803 fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
3804 if let Some(config) = clocks.timg_calibration_clock {
3805 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
3806 timg_calibration_clock_config_frequency(clocks, config),
3807 ::core::sync::atomic::Ordering::Release,
3808 );
3809 }
3810 }
3811 fn refresh_i2s_mclk_downstream(clocks: &mut ClockTree, instance: I2sInstance) {
3812 if let Some(config) = clocks.i2s_mclk[instance as usize] {
3813 I2S_MCLK_FREQ_CACHE[instance as usize].store(
3814 I2sInstance::mclk_config_frequency(clocks, config),
3815 ::core::sync::atomic::Ordering::Release,
3816 );
3817 }
3818 }
3819 fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
3820 if let Some(config) = clocks.apb_clk {
3821 APB_CLK_FREQ_CACHE.store(
3822 apb_clk_config_frequency(clocks, config),
3823 ::core::sync::atomic::Ordering::Release,
3824 );
3825 }
3826 for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
3827 refresh_i2c_function_clock_downstream(clocks, child_instance);
3828 }
3829 for child_instance in [RmtInstance::Rmt] {
3830 refresh_rmt_sclk_downstream(clocks, child_instance);
3831 }
3832 for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
3833 refresh_timg_function_clock_downstream(clocks, child_instance);
3834 }
3835 for child_instance in [UartInstance::Uart0, UartInstance::Uart1] {
3836 refresh_uart_function_clock_downstream(clocks, child_instance);
3837 }
3838 }
3839 fn refresh_ref_tick_downstream(clocks: &mut ClockTree) {
3840 if let Some(config) = clocks.ref_tick {
3841 REF_TICK_FREQ_CACHE.store(
3842 ref_tick_config_frequency(clocks, config),
3843 ::core::sync::atomic::Ordering::Release,
3844 );
3845 }
3846 for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
3847 refresh_i2c_function_clock_downstream(clocks, child_instance);
3848 }
3849 for child_instance in [RmtInstance::Rmt] {
3850 refresh_rmt_sclk_downstream(clocks, child_instance);
3851 }
3852 for child_instance in [UartInstance::Uart0, UartInstance::Uart1] {
3853 refresh_uart_function_clock_downstream(clocks, child_instance);
3854 }
3855 }
3856 fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
3857 if let Some(config) = clocks.i2c_function_clock[instance as usize] {
3858 I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3859 I2cInstance::function_clock_config_frequency(clocks, config),
3860 ::core::sync::atomic::Ordering::Release,
3861 );
3862 }
3863 }
3864 fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
3865 if let Some(config) = clocks.rmt_sclk[instance as usize] {
3866 RMT_SCLK_FREQ_CACHE[instance as usize].store(
3867 RmtInstance::sclk_config_frequency(clocks, config),
3868 ::core::sync::atomic::Ordering::Release,
3869 );
3870 }
3871 }
3872 fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
3873 if let Some(config) = clocks.timg_function_clock[instance as usize] {
3874 TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3875 TimgInstance::function_clock_config_frequency(clocks, config),
3876 ::core::sync::atomic::Ordering::Release,
3877 );
3878 }
3879 }
3880 fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
3881 if let Some(config) = clocks.uart_function_clock[instance as usize] {
3882 UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3883 UartInstance::function_clock_config_frequency(clocks, config),
3884 ::core::sync::atomic::Ordering::Release,
3885 );
3886 }
3887 refresh_uart_baud_rate_generator_downstream(clocks, instance);
3888 }
3889 fn refresh_uart_baud_rate_generator_downstream(
3890 clocks: &mut ClockTree,
3891 instance: UartInstance,
3892 ) {
3893 if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
3894 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
3895 instance.baud_rate_generator_config_frequency(clocks, config),
3896 ::core::sync::atomic::Ordering::Release,
3897 );
3898 }
3899 }
3900 };
3901}
3902#[macro_export]
3906#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3907macro_rules! implement_peripheral_clocks {
3908 () => {
3909 #[doc(hidden)]
3910 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
3911 #[repr(u8)]
3912 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3913 pub enum Peripheral {
3914 Aes,
3916 ApbSarAdc,
3918 CopyDma,
3920 CryptoDma,
3922 DedicatedGpio,
3924 Ds,
3926 GpioSd,
3928 Hmac,
3930 I2cExt0,
3932 I2cExt1,
3934 I2s0,
3936 Ledc,
3938 Mcpwm0,
3940 Mcpwm1,
3942 Pcnt,
3944 Rmt,
3946 Rsa,
3948 Sha,
3950 Spi2,
3952 Spi2Dma,
3954 Spi3,
3956 Spi3Dma,
3958 Systimer,
3960 Timg0,
3962 Timg1,
3964 Twai0,
3966 Uart0,
3968 Uart1,
3970 UartMem,
3972 Uhci0,
3974 Uhci1,
3976 UsbFs,
3978 Wdg,
3980 }
3981 impl Peripheral {
3982 const KEEP_ENABLED: &[Peripheral] =
3983 &[Self::Systimer, Self::Timg0, Self::Uart0, Self::UartMem];
3984 const COUNT: usize = Self::ALL.len();
3985 const ALL: &[Self] = &[
3986 Self::Aes,
3987 Self::ApbSarAdc,
3988 Self::CopyDma,
3989 Self::CryptoDma,
3990 Self::DedicatedGpio,
3991 Self::Ds,
3992 Self::GpioSd,
3993 Self::Hmac,
3994 Self::I2cExt0,
3995 Self::I2cExt1,
3996 Self::I2s0,
3997 Self::Ledc,
3998 Self::Mcpwm0,
3999 Self::Mcpwm1,
4000 Self::Pcnt,
4001 Self::Rmt,
4002 Self::Rsa,
4003 Self::Sha,
4004 Self::Spi2,
4005 Self::Spi2Dma,
4006 Self::Spi3,
4007 Self::Spi3Dma,
4008 Self::Systimer,
4009 Self::Timg0,
4010 Self::Timg1,
4011 Self::Twai0,
4012 Self::Uart0,
4013 Self::Uart1,
4014 Self::UartMem,
4015 Self::Uhci0,
4016 Self::Uhci1,
4017 Self::UsbFs,
4018 Self::Wdg,
4019 ];
4020 }
4021 unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
4022 match peripheral {
4023 Peripheral::Aes => {
4024 crate::peripherals::SYSTEM::regs()
4025 .perip_clk_en1()
4026 .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
4027 }
4028 Peripheral::ApbSarAdc => {
4029 crate::peripherals::SYSTEM::regs()
4030 .perip_clk_en0()
4031 .modify(|_, w| w.apb_saradc_clk_en().bit(enable));
4032 }
4033 Peripheral::CopyDma => {
4034 crate::peripherals::DMA_COPY::regs()
4035 .conf()
4036 .modify(|_, w| w.clk_en().bit(enable));
4037 }
4038 Peripheral::CryptoDma => {
4039 crate::peripherals::SYSTEM::regs()
4040 .perip_clk_en1()
4041 .modify(|_, w| w.crypto_dma_clk_en().bit(enable));
4042 }
4043 Peripheral::DedicatedGpio => {
4044 crate::peripherals::SYSTEM::regs()
4045 .cpu_peri_clk_en()
4046 .modify(|_, w| w.dedicated_gpio_clk_en().bit(enable));
4047 }
4048 Peripheral::Ds => {
4049 crate::peripherals::SYSTEM::regs()
4050 .perip_clk_en1()
4051 .modify(|_, w| w.crypto_ds_clk_en().bit(enable));
4052 }
4053 Peripheral::GpioSd => {
4054 crate::peripherals::GPIO_SD::regs()
4055 .clock_gate()
4056 .modify(|_, w| w.clk_en().bit(enable));
4057 }
4058 Peripheral::Hmac => {
4059 crate::peripherals::SYSTEM::regs()
4060 .perip_clk_en1()
4061 .modify(|_, w| w.crypto_hmac_clk_en().bit(enable));
4062 }
4063 Peripheral::I2cExt0 => {
4064 crate::peripherals::SYSTEM::regs()
4065 .perip_clk_en0()
4066 .modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
4067 }
4068 Peripheral::I2cExt1 => {
4069 crate::peripherals::SYSTEM::regs()
4070 .perip_clk_en0()
4071 .modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
4072 }
4073 Peripheral::I2s0 => {
4074 crate::peripherals::SYSTEM::regs()
4075 .perip_clk_en0()
4076 .modify(|_, w| w.i2s0_clk_en().bit(enable));
4077 }
4078 Peripheral::Ledc => {
4079 crate::peripherals::SYSTEM::regs()
4080 .perip_clk_en0()
4081 .modify(|_, w| w.ledc_clk_en().bit(enable));
4082 }
4083 Peripheral::Mcpwm0 => {
4084 crate::peripherals::SYSTEM::regs()
4085 .perip_clk_en0()
4086 .modify(|_, w| w.pwm0_clk_en().bit(enable));
4087 }
4088 Peripheral::Mcpwm1 => {
4089 crate::peripherals::SYSTEM::regs()
4090 .perip_clk_en0()
4091 .modify(|_, w| w.pwm1_clk_en().bit(enable));
4092 }
4093 Peripheral::Pcnt => {
4094 crate::peripherals::SYSTEM::regs()
4095 .perip_clk_en0()
4096 .modify(|_, w| w.pcnt_clk_en().bit(enable));
4097 }
4098 Peripheral::Rmt => {
4099 crate::peripherals::SYSTEM::regs()
4100 .perip_clk_en0()
4101 .modify(|_, w| w.rmt_clk_en().bit(enable));
4102 }
4103 Peripheral::Rsa => {
4104 crate::peripherals::SYSTEM::regs()
4105 .perip_clk_en1()
4106 .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
4107 }
4108 Peripheral::Sha => {
4109 crate::peripherals::SYSTEM::regs()
4110 .perip_clk_en1()
4111 .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
4112 }
4113 Peripheral::Spi2 => {
4114 crate::peripherals::SYSTEM::regs()
4115 .perip_clk_en0()
4116 .modify(|_, w| w.spi2_clk_en().bit(enable));
4117 }
4118 Peripheral::Spi2Dma => {
4119 crate::peripherals::SYSTEM::regs()
4120 .perip_clk_en0()
4121 .modify(|_, w| w.spi2_dma_clk_en().bit(enable));
4122 }
4123 Peripheral::Spi3 => {
4124 crate::peripherals::SYSTEM::regs()
4125 .perip_clk_en0()
4126 .modify(|_, w| w.spi3_clk_en().bit(enable));
4127 }
4128 Peripheral::Spi3Dma => {
4129 crate::peripherals::SYSTEM::regs()
4130 .perip_clk_en0()
4131 .modify(|_, w| w.spi3_dma_clk_en().bit(enable));
4132 }
4133 Peripheral::Systimer => {
4134 crate::peripherals::SYSTEM::regs()
4135 .perip_clk_en0()
4136 .modify(|_, w| w.systimer_clk_en().bit(enable));
4137 }
4138 Peripheral::Timg0 => {
4139 crate::peripherals::SYSTEM::regs()
4140 .perip_clk_en0()
4141 .modify(|_, w| w.timergroup_clk_en().bit(enable));
4142 }
4143 Peripheral::Timg1 => {
4144 crate::peripherals::SYSTEM::regs()
4145 .perip_clk_en0()
4146 .modify(|_, w| w.timergroup1_clk_en().bit(enable));
4147 }
4148 Peripheral::Twai0 => {
4149 crate::peripherals::SYSTEM::regs()
4150 .perip_clk_en0()
4151 .modify(|_, w| w.twai_clk_en().bit(enable));
4152 }
4153 Peripheral::Uart0 => {
4154 crate::peripherals::SYSTEM::regs()
4155 .perip_clk_en0()
4156 .modify(|_, w| w.uart_clk_en().bit(enable));
4157 }
4158 Peripheral::Uart1 => {
4159 crate::peripherals::SYSTEM::regs()
4160 .perip_clk_en0()
4161 .modify(|_, w| w.uart1_clk_en().bit(enable));
4162 }
4163 Peripheral::UartMem => {
4164 crate::peripherals::SYSTEM::regs()
4165 .perip_clk_en0()
4166 .modify(|_, w| w.uart_mem_clk_en().bit(enable));
4167 }
4168 Peripheral::Uhci0 => {
4169 crate::peripherals::SYSTEM::regs()
4170 .perip_clk_en0()
4171 .modify(|_, w| w.uhci0_clk_en().bit(enable));
4172 }
4173 Peripheral::Uhci1 => {
4174 crate::peripherals::SYSTEM::regs()
4175 .perip_clk_en0()
4176 .modify(|_, w| w.uhci1_clk_en().bit(enable));
4177 }
4178 Peripheral::UsbFs => {
4179 crate::peripherals::SYSTEM::regs()
4180 .perip_clk_en0()
4181 .modify(|_, w| w.usb_clk_en().bit(enable));
4182 }
4183 Peripheral::Wdg => {
4184 crate::peripherals::SYSTEM::regs()
4185 .perip_clk_en0()
4186 .modify(|_, w| w.wdg_clk_en().bit(enable));
4187 }
4188 }
4189 }
4190 unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
4191 match peripheral {
4192 Peripheral::Aes => {
4193 crate::peripherals::SYSTEM::regs()
4194 .perip_rst_en1()
4195 .modify(|_, w| w.crypto_aes_rst().bit(reset));
4196 }
4197 Peripheral::ApbSarAdc => {
4198 crate::peripherals::SYSTEM::regs()
4199 .perip_rst_en0()
4200 .modify(|_, w| w.apb_saradc_rst().bit(reset));
4201 }
4202 Peripheral::CopyDma => {
4203 crate::peripherals::DMA_COPY::regs().conf().modify(|_, w| {
4204 w.in_rst()
4205 .bit(reset)
4206 .out_rst()
4207 .bit(reset)
4208 .cmdfifo_rst()
4209 .bit(reset)
4210 .fifo_rst()
4211 .bit(reset)
4212 });
4213 }
4214 Peripheral::CryptoDma => {
4215 crate::peripherals::SYSTEM::regs()
4216 .perip_rst_en1()
4217 .modify(|_, w| w.crypto_dma_rst().bit(reset));
4218 }
4219 Peripheral::DedicatedGpio => {
4220 crate::peripherals::SYSTEM::regs()
4221 .cpu_peri_rst_en()
4222 .modify(|_, w| w.dedicated_gpio_rst().bit(reset));
4223 }
4224 Peripheral::Ds => {
4225 crate::peripherals::SYSTEM::regs()
4226 .perip_rst_en1()
4227 .modify(|_, w| w.crypto_ds_rst().bit(reset));
4228 }
4229 Peripheral::GpioSd => {
4230 let _ = reset;
4231 }
4232 Peripheral::Hmac => {
4233 crate::peripherals::SYSTEM::regs()
4234 .perip_rst_en1()
4235 .modify(|_, w| w.crypto_hmac_rst().bit(reset));
4236 }
4237 Peripheral::I2cExt0 => {
4238 crate::peripherals::SYSTEM::regs()
4239 .perip_rst_en0()
4240 .modify(|_, w| w.i2c_ext0_rst().bit(reset));
4241 }
4242 Peripheral::I2cExt1 => {
4243 crate::peripherals::SYSTEM::regs()
4244 .perip_rst_en0()
4245 .modify(|_, w| w.i2c_ext1_rst().bit(reset));
4246 }
4247 Peripheral::I2s0 => {
4248 crate::peripherals::SYSTEM::regs()
4249 .perip_rst_en0()
4250 .modify(|_, w| w.i2s0_rst().bit(reset));
4251 }
4252 Peripheral::Ledc => {
4253 crate::peripherals::SYSTEM::regs()
4254 .perip_rst_en0()
4255 .modify(|_, w| w.ledc_rst().bit(reset));
4256 }
4257 Peripheral::Mcpwm0 => {
4258 crate::peripherals::SYSTEM::regs()
4259 .perip_rst_en0()
4260 .modify(|_, w| w.pwm0_rst().bit(reset));
4261 }
4262 Peripheral::Mcpwm1 => {
4263 crate::peripherals::SYSTEM::regs()
4264 .perip_rst_en0()
4265 .modify(|_, w| w.pwm1_rst().bit(reset));
4266 }
4267 Peripheral::Pcnt => {
4268 crate::peripherals::SYSTEM::regs()
4269 .perip_rst_en0()
4270 .modify(|_, w| w.pcnt_rst().bit(reset));
4271 }
4272 Peripheral::Rmt => {
4273 crate::peripherals::SYSTEM::regs()
4274 .perip_rst_en0()
4275 .modify(|_, w| w.rmt_rst().bit(reset));
4276 }
4277 Peripheral::Rsa => {
4278 crate::peripherals::SYSTEM::regs()
4279 .perip_rst_en1()
4280 .modify(|_, w| w.crypto_rsa_rst().bit(reset));
4281 }
4282 Peripheral::Sha => {
4283 crate::peripherals::SYSTEM::regs()
4284 .perip_rst_en1()
4285 .modify(|_, w| w.crypto_sha_rst().bit(reset));
4286 }
4287 Peripheral::Spi2 => {
4288 crate::peripherals::SYSTEM::regs()
4289 .perip_rst_en0()
4290 .modify(|_, w| w.spi2_rst().bit(reset));
4291 }
4292 Peripheral::Spi2Dma => {
4293 crate::peripherals::SYSTEM::regs()
4294 .perip_rst_en0()
4295 .modify(|_, w| w.spi2_dma_rst().bit(reset));
4296 }
4297 Peripheral::Spi3 => {
4298 crate::peripherals::SYSTEM::regs()
4299 .perip_rst_en0()
4300 .modify(|_, w| w.spi3_rst().bit(reset));
4301 }
4302 Peripheral::Spi3Dma => {
4303 crate::peripherals::SYSTEM::regs()
4304 .perip_rst_en0()
4305 .modify(|_, w| w.spi3_dma_rst().bit(reset));
4306 }
4307 Peripheral::Systimer => {
4308 crate::peripherals::SYSTEM::regs()
4309 .perip_rst_en0()
4310 .modify(|_, w| w.systimer_rst().bit(reset));
4311 }
4312 Peripheral::Timg0 => {
4313 crate::peripherals::SYSTEM::regs()
4314 .perip_rst_en0()
4315 .modify(|_, w| w.timergroup_rst().bit(reset));
4316 }
4317 Peripheral::Timg1 => {
4318 crate::peripherals::SYSTEM::regs()
4319 .perip_rst_en0()
4320 .modify(|_, w| w.timergroup1_rst().bit(reset));
4321 }
4322 Peripheral::Twai0 => {
4323 crate::peripherals::SYSTEM::regs()
4324 .perip_rst_en0()
4325 .modify(|_, w| w.twai_rst().bit(reset));
4326 }
4327 Peripheral::Uart0 => {
4328 crate::peripherals::SYSTEM::regs()
4329 .perip_rst_en0()
4330 .modify(|_, w| w.uart_rst().bit(reset));
4331 }
4332 Peripheral::Uart1 => {
4333 crate::peripherals::SYSTEM::regs()
4334 .perip_rst_en0()
4335 .modify(|_, w| w.uart1_rst().bit(reset));
4336 }
4337 Peripheral::UartMem => {
4338 crate::peripherals::SYSTEM::regs()
4339 .perip_rst_en0()
4340 .modify(|_, w| w.uart_mem_rst().bit(reset));
4341 }
4342 Peripheral::Uhci0 => {
4343 crate::peripherals::SYSTEM::regs()
4344 .perip_rst_en0()
4345 .modify(|_, w| w.uhci0_rst().bit(reset));
4346 }
4347 Peripheral::Uhci1 => {
4348 crate::peripherals::SYSTEM::regs()
4349 .perip_rst_en0()
4350 .modify(|_, w| w.uhci1_rst().bit(reset));
4351 }
4352 Peripheral::UsbFs => {
4353 crate::peripherals::SYSTEM::regs()
4354 .perip_rst_en0()
4355 .modify(|_, w| w.usb_rst().bit(reset));
4356 }
4357 Peripheral::Wdg => {
4358 crate::peripherals::SYSTEM::regs()
4359 .perip_rst_en0()
4360 .modify(|_, w| w.wdg_rst().bit(reset));
4361 }
4362 }
4363 }
4364 };
4365}
4366#[macro_export]
4374#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4375macro_rules! memory_range {
4376 ("DRAM") => {
4377 0x3FFB0000..0x40000000
4378 };
4379 (size as str, "DRAM") => {
4380 "327680"
4381 };
4382 ("DRAM2_UNINIT") => {
4383 0x3FFDE000..0x40000000
4384 };
4385 (size as str, "DRAM2_UNINIT") => {
4386 "139264"
4387 };
4388 ("IROM") => {
4389 0x40080000..0x40800000
4390 };
4391 (size as str, "IROM") => {
4392 "7864320"
4393 };
4394 ("DROM") => {
4395 0x3F000000..0x3F400000
4396 };
4397 (size as str, "DROM") => {
4398 "4194304"
4399 };
4400}
4401#[macro_export]
4418#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4419macro_rules! for_each_i2c_master {
4420 ($($pattern:tt => $code:tt;)*) => {
4421 macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
4422 => {} } _for_each_inner_i2c_master!((0, I2C0, I2cExt0, I2CEXT0_SCL,
4423 I2CEXT0_SDA)); _for_each_inner_i2c_master!((1, I2C1, I2cExt1, I2CEXT1_SCL,
4424 I2CEXT1_SDA)); _for_each_inner_i2c_master!((all(0, I2C0, I2cExt0, I2CEXT0_SCL,
4425 I2CEXT0_SDA), (1, I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA)));
4426 };
4427}
4428#[macro_export]
4455#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4456macro_rules! for_each_i2s {
4457 ($($pattern:tt => $code:tt;)*) => {
4458 macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
4459 _for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S0, I2s0, CLK_I2S,
4460 I2S0O_BCK, I2S0O_WS, I2S0I_BCK, I2S0I_WS, [I2S0O_DATA_OUT23], [I2S0I_DATA_IN15],
4461 false, false, false, false)); _for_each_inner_i2s!((names(I2S0)));
4462 _for_each_inner_i2s!((all(I2S0, I2s0, CLK_I2S, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
4463 I2S0I_WS, [I2S0O_DATA_OUT23], [I2S0I_DATA_IN15], false, false, false, false)));
4464 };
4465}
4466#[macro_export]
4485#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4486macro_rules! for_each_uart {
4487 ($($pattern:tt => $code:tt;)*) => {
4488 macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
4489 } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
4490 wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
4491 U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((all(0, UART0, Uart0,
4492 U0RXD, U0TXD, U0CTS, U0RTS, wakeup_source = true), (1, UART1, Uart1, U1RXD,
4493 U1TXD, U1CTS, U1RTS, wakeup_source = true)));
4494 };
4495}
4496#[macro_export]
4518#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4519macro_rules! for_each_spi_master {
4520 ($($pattern:tt => $code:tt;)*) => {
4521 macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
4522 => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
4523 _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
4524 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
4525 FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
4526 SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q]));
4527 _for_each_inner_spi_master!((names(SPI2), (SPI3)));
4528 _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
4529 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
4530 FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2]
4531 [SPI3_D, SPI3_Q])));
4532 };
4533}
4534#[macro_export]
4551#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4552macro_rules! for_each_spi_slave {
4553 ($($pattern:tt => $code:tt;)*) => {
4554 macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
4555 => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
4556 _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
4557 _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0));
4558 _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
4559 _for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
4560 (SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0)));
4561 };
4562}
4563#[macro_export]
4586#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4587macro_rules! for_each_pcnt_unit {
4588 ($($pattern:tt => $code:tt;)*) => {
4589 macro_rules! _for_each_inner_pcnt_unit { $(($pattern) => $code;)* ($other : tt)
4590 => {} } _for_each_inner_pcnt_unit!((PCNT0_UNIT0));
4591 _for_each_inner_pcnt_unit!((PCNT0_UNIT1));
4592 _for_each_inner_pcnt_unit!((PCNT0_UNIT2));
4593 _for_each_inner_pcnt_unit!((PCNT0_UNIT3));
4594 _for_each_inner_pcnt_unit!((PCNT0_UNIT0, Pcnt0Unit0, Pcnt, PCNT, 0, PCNT,
4595 PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1));
4596 _for_each_inner_pcnt_unit!((PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT,
4597 PCNT1_SIG_CH0, PCNT1_SIG_CH1, PCNT1_CTRL_CH0, PCNT1_CTRL_CH1));
4598 _for_each_inner_pcnt_unit!((PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT,
4599 PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1));
4600 _for_each_inner_pcnt_unit!((PCNT0_UNIT3, Pcnt0Unit3, Pcnt, PCNT, 3, PCNT,
4601 PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0, PCNT3_CTRL_CH1));
4602 _for_each_inner_pcnt_unit!((PCNT)); _for_each_inner_pcnt_unit!((PCNT));
4603 _for_each_inner_pcnt_unit!((names(PCNT0_UNIT0), (PCNT0_UNIT1), (PCNT0_UNIT2),
4604 (PCNT0_UNIT3))); _for_each_inner_pcnt_unit!((all(PCNT0_UNIT0, Pcnt0Unit0, Pcnt,
4605 PCNT, 0, PCNT, PCNT0_SIG_CH0, PCNT0_SIG_CH1, PCNT0_CTRL_CH0, PCNT0_CTRL_CH1),
4606 (PCNT0_UNIT1, Pcnt0Unit1, Pcnt, PCNT, 1, PCNT, PCNT1_SIG_CH0, PCNT1_SIG_CH1,
4607 PCNT1_CTRL_CH0, PCNT1_CTRL_CH1), (PCNT0_UNIT2, Pcnt0Unit2, Pcnt, PCNT, 2, PCNT,
4608 PCNT2_SIG_CH0, PCNT2_SIG_CH1, PCNT2_CTRL_CH0, PCNT2_CTRL_CH1), (PCNT0_UNIT3,
4609 Pcnt0Unit3, Pcnt, PCNT, 3, PCNT, PCNT3_SIG_CH0, PCNT3_SIG_CH1, PCNT3_CTRL_CH0,
4610 PCNT3_CTRL_CH1))); _for_each_inner_pcnt_unit!((interrupt(PCNT)));
4611 _for_each_inner_pcnt_unit!((regs(PCNT)));
4612 };
4613}
4614#[macro_export]
4615#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4616macro_rules! for_each_peripheral {
4617 ($($pattern:tt => $code:tt;)*) => {
4618 macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
4619 => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
4620 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4621 "<section class=\"warning\">"] #[doc =
4622 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4623 #[doc = "<ul>"] #[doc =
4624 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4625 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()));
4626 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
4627 GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4628 "GPIO2 peripheral singleton"] GPIO2 <= virtual()));
4629 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO3 peripheral singleton"]
4630 GPIO3 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4631 "GPIO4 peripheral singleton"] GPIO4 <= virtual()));
4632 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO5 peripheral singleton"]
4633 GPIO5 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4634 "GPIO6 peripheral singleton"] GPIO6 <= virtual()));
4635 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO7 peripheral singleton"]
4636 GPIO7 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4637 "GPIO8 peripheral singleton"] GPIO8 <= virtual()));
4638 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO9 peripheral singleton"]
4639 GPIO9 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4640 "GPIO10 peripheral singleton"] GPIO10 <= virtual()));
4641 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO11 peripheral singleton"]
4642 GPIO11 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4643 "GPIO12 peripheral singleton"] GPIO12 <= virtual()));
4644 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO13 peripheral singleton"]
4645 GPIO13 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4646 "GPIO14 peripheral singleton"] GPIO14 <= virtual()));
4647 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO15 peripheral singleton"]
4648 GPIO15 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4649 "GPIO16 peripheral singleton"] GPIO16 <= virtual()));
4650 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO17 peripheral singleton"]
4651 GPIO17 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4652 "GPIO18 peripheral singleton"] GPIO18 <= virtual()));
4653 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO19 peripheral singleton"]
4654 GPIO19 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4655 "GPIO20 peripheral singleton"] GPIO20 <= virtual()));
4656 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO21 peripheral singleton"]
4657 GPIO21 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4658 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4659 "<section class=\"warning\">"] #[doc =
4660 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4661 #[doc = "<ul>"] #[doc =
4662 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
4663 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
4664 _for_each_inner_peripheral!((@ peri_type #[doc =
4665 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4666 "<section class=\"warning\">"] #[doc =
4667 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4668 #[doc = "<ul>"] #[doc =
4669 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4670 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
4671 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
4672 _for_each_inner_peripheral!((@ peri_type #[doc =
4673 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4674 "<section class=\"warning\">"] #[doc =
4675 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4676 #[doc = "<ul>"] #[doc =
4677 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4678 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
4679 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
4680 _for_each_inner_peripheral!((@ peri_type #[doc =
4681 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4682 "<section class=\"warning\">"] #[doc =
4683 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4684 #[doc = "<ul>"] #[doc =
4685 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4686 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()));
4687 _for_each_inner_peripheral!((@ peri_type #[doc =
4688 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4689 "<section class=\"warning\">"] #[doc =
4690 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4691 #[doc = "<ul>"] #[doc =
4692 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4693 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
4694 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
4695 _for_each_inner_peripheral!((@ peri_type #[doc =
4696 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4697 "<section class=\"warning\">"] #[doc =
4698 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4699 #[doc = "<ul>"] #[doc =
4700 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4701 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
4702 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
4703 _for_each_inner_peripheral!((@ peri_type #[doc =
4704 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4705 "<section class=\"warning\">"] #[doc =
4706 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4707 #[doc = "<ul>"] #[doc =
4708 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4709 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
4710 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
4711 _for_each_inner_peripheral!((@ peri_type #[doc =
4712 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4713 "<section class=\"warning\">"] #[doc =
4714 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4715 #[doc = "<ul>"] #[doc =
4716 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
4717 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
4718 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()));
4719 _for_each_inner_peripheral!((@ peri_type #[doc =
4720 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4721 "<section class=\"warning\">"] #[doc =
4722 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4723 #[doc = "<ul>"] #[doc =
4724 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
4725 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
4726 #[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
4727 _for_each_inner_peripheral!((@ peri_type #[doc =
4728 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4729 "<section class=\"warning\">"] #[doc =
4730 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4731 #[doc = "<ul>"] #[doc =
4732 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
4733 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
4734 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
4735 _for_each_inner_peripheral!((@ peri_type #[doc =
4736 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4737 "<section class=\"warning\">"] #[doc =
4738 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4739 #[doc = "<ul>"] #[doc =
4740 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
4741 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
4742 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
4743 _for_each_inner_peripheral!((@ peri_type #[doc =
4744 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4745 "<section class=\"warning\">"] #[doc =
4746 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4747 #[doc = "<ul>"] #[doc =
4748 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
4749 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
4750 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
4751 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO38 peripheral singleton"]
4752 GPIO38 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4753 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4754 "<section class=\"warning\">"] #[doc =
4755 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4756 #[doc = "<ul>"] #[doc =
4757 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4758 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
4759 _for_each_inner_peripheral!((@ peri_type #[doc =
4760 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4761 "<section class=\"warning\">"] #[doc =
4762 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4763 #[doc = "<ul>"] #[doc =
4764 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4765 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
4766 _for_each_inner_peripheral!((@ peri_type #[doc =
4767 "GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4768 "<section class=\"warning\">"] #[doc =
4769 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4770 #[doc = "<ul>"] #[doc =
4771 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4772 #[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()));
4773 _for_each_inner_peripheral!((@ peri_type #[doc =
4774 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4775 "<section class=\"warning\">"] #[doc =
4776 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4777 #[doc = "<ul>"] #[doc =
4778 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4779 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()));
4780 _for_each_inner_peripheral!((@ peri_type #[doc =
4781 "GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4782 "<section class=\"warning\">"] #[doc =
4783 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4784 #[doc = "<ul>"] #[doc =
4785 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
4786 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()));
4787 _for_each_inner_peripheral!((@ peri_type #[doc =
4788 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4789 "<section class=\"warning\">"] #[doc =
4790 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4791 #[doc = "<ul>"] #[doc =
4792 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
4793 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()));
4794 _for_each_inner_peripheral!((@ peri_type #[doc =
4795 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4796 "<section class=\"warning\">"] #[doc =
4797 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4798 #[doc = "<ul>"] #[doc =
4799 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4800 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()));
4801 _for_each_inner_peripheral!((@ peri_type #[doc =
4802 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4803 "<section class=\"warning\">"] #[doc =
4804 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4805 #[doc = "<ul>"] #[doc =
4806 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4807 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()));
4808 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_SPI2 peripheral singleton"]
4809 DMA_SPI2 <= SPI2(SPI2_DMA : { bind_dma_interrupt, enable_dma_interrupt,
4810 disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
4811 #[doc = "DMA_SPI3 peripheral singleton"] DMA_SPI3 <= SPI3(SPI3_DMA : {
4812 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)));
4813 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_I2S0 peripheral singleton"]
4814 DMA_I2S0 <= I2S0(I2S0 : { bind_dma_interrupt, enable_dma_interrupt,
4815 disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
4816 #[doc = "DMA_CRYPTO peripheral singleton"] DMA_CRYPTO <= CRYPTO_DMA(CRYPTO_DMA :
4817 { bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt })
4818 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4819 "DMA_COPY peripheral singleton"] DMA_COPY <= COPY_DMA(DMA_COPY : {
4820 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)));
4821 _for_each_inner_peripheral!((@ peri_type #[doc =
4822 "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual() (unstable)));
4823 _for_each_inner_peripheral!((@ peri_type #[doc =
4824 "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1 <= virtual() (unstable)));
4825 _for_each_inner_peripheral!((@ peri_type #[doc =
4826 "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)));
4827 _for_each_inner_peripheral!((@ peri_type #[doc =
4828 "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual() (unstable)));
4829 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
4830 SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4831 = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
4832 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
4833 SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4834 = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
4835 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
4836 SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4837 = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
4838 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
4839 SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4840 = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
4841 _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
4842 <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
4843 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4844 "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC() (unstable)));
4845 _for_each_inner_peripheral!((@ peri_type #[doc = "DS peripheral singleton"] DS <=
4846 DS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4847 "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)));
4848 _for_each_inner_peripheral!((@ peri_type #[doc = "EXTMEM peripheral singleton"]
4849 EXTMEM <= EXTMEM() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4850 "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)));
4851 _for_each_inner_peripheral!((@ peri_type #[doc = "FE peripheral singleton"] FE <=
4852 FE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4853 "FE2 peripheral singleton"] FE2 <= FE2() (unstable)));
4854 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO peripheral singleton"]
4855 GPIO <= GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4856 "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)));
4857 _for_each_inner_peripheral!((@ peri_type #[doc = "HMAC peripheral singleton"]
4858 HMAC <= HMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4859 "I2C_ANA_MST peripheral singleton"] I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
4860 _for_each_inner_peripheral!((@ peri_type #[doc = "I2C0 peripheral singleton"]
4861 I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
4862 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4863 "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt,
4864 enable_peri_interrupt, disable_peri_interrupt })));
4865 _for_each_inner_peripheral!((@ peri_type #[doc = "I2S0 peripheral singleton"]
4866 I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
4867 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
4868 #[doc = "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <=
4869 INTERRUPT_CORE0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4870 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
4871 _for_each_inner_peripheral!((@ peri_type #[doc = "LEDC peripheral singleton"]
4872 LEDC <= LEDC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4873 "NRX peripheral singleton"] NRX <= NRX() (unstable)));
4874 _for_each_inner_peripheral!((@ peri_type #[doc = "PCNT peripheral singleton"]
4875 PCNT <= PCNT(PCNT : { bind_peri_interrupt, enable_peri_interrupt,
4876 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
4877 #[doc = "PMS peripheral singleton"] PMS <= PMS() (unstable)));
4878 _for_each_inner_peripheral!((@ peri_type #[doc = "RMT peripheral singleton"] RMT
4879 <= RMT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4880 "RNG peripheral singleton"] RNG <= RNG() (unstable)));
4881 _for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
4882 <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
4883 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4884 "LPWR peripheral singleton"] LPWR <= RTC_CNTL() (unstable)));
4885 _for_each_inner_peripheral!((@ peri_type #[doc =
4886 "RTC_TIMER peripheral singleton"] RTC_TIMER <= RTC_CNTL() (unstable)));
4887 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_I2C0 peripheral singleton"]
4888 LP_I2C0 <= RTC_I2C() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4889 = "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)));
4890 _for_each_inner_peripheral!((@ peri_type #[doc = "SENS peripheral singleton"]
4891 SENS <= SENS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4892 "SHA peripheral singleton"] SHA <= SHA(SHA : { bind_peri_interrupt,
4893 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
4894 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI0 peripheral singleton"]
4895 SPI0 <= SPI0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4896 "SPI1 peripheral singleton"] SPI1 <= SPI1() (unstable)));
4897 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI2 peripheral singleton"]
4898 SPI2 <= SPI2(SPI2_DMA : { bind_dma_interrupt, enable_dma_interrupt,
4899 disable_dma_interrupt }, SPI2 : { bind_peri_interrupt, enable_peri_interrupt,
4900 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4901 "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3_DMA : { bind_dma_interrupt,
4902 enable_dma_interrupt, disable_dma_interrupt }, SPI3 : { bind_peri_interrupt,
4903 enable_peri_interrupt, disable_peri_interrupt })));
4904 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSCON peripheral singleton"]
4905 SYSCON <= SYSCON() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4906 "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)));
4907 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTIMER peripheral singleton"]
4908 SYSTIMER <= SYSTIMER() (unstable))); _for_each_inner_peripheral!((@ peri_type
4909 #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
4910 _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
4911 TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4912 "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)));
4913 _for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
4914 UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
4915 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4916 "UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
4917 enable_peri_interrupt, disable_peri_interrupt })));
4918 _for_each_inner_peripheral!((@ peri_type #[doc = "UHCI0 peripheral singleton"]
4919 UHCI0 <= UHCI0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4920 "USB_FS peripheral singleton"] USB_FS <= USB_FS(USB : { bind_peri_interrupt,
4921 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
4922 _for_each_inner_peripheral!((@ peri_type #[doc = "USB_WRAP peripheral singleton"]
4923 USB_WRAP <= USB_WRAP() (unstable))); _for_each_inner_peripheral!((@ peri_type
4924 #[doc = "XTS_AES peripheral singleton"] XTS_AES <= XTS_AES() (unstable)));
4925 _for_each_inner_peripheral!((@ peri_type #[doc = "WIFI peripheral singleton"]
4926 WIFI <= WIFI(WIFI_MAC : { bind_mac_interrupt, enable_mac_interrupt,
4927 disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt, enable_pwr_interrupt,
4928 disable_pwr_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4929 "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)));
4930 _for_each_inner_peripheral!((@ peri_type #[doc = "ADC2 peripheral singleton"]
4931 ADC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4932 "DAC1 peripheral singleton"] DAC1 <= virtual() (unstable)));
4933 _for_each_inner_peripheral!((@ peri_type #[doc = "DAC2 peripheral singleton"]
4934 DAC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4935 "FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
4936 _for_each_inner_peripheral!((@ peri_type #[doc =
4937 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
4938 _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
4939 PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4940 "ULP_RISCV_CORE peripheral singleton"] ULP_RISCV_CORE <= virtual() (unstable)));
4941 _for_each_inner_peripheral!((@ peri_type #[doc =
4942 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)));
4943 _for_each_inner_peripheral!((@ peri_type #[doc =
4944 "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
4945 _for_each_inner_peripheral!((@ peri_type #[doc =
4946 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
4947 _for_each_inner_peripheral!((@ peri_type #[doc =
4948 "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
4949 _for_each_inner_peripheral!((GPIO0)); _for_each_inner_peripheral!((GPIO1));
4950 _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
4951 _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
4952 _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
4953 _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
4954 _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
4955 _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
4956 _for_each_inner_peripheral!((GPIO14));
4957 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO15));
4958 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO16));
4959 _for_each_inner_peripheral!((GPIO17)); _for_each_inner_peripheral!((GPIO18));
4960 _for_each_inner_peripheral!((GPIO19)); _for_each_inner_peripheral!((GPIO20));
4961 _for_each_inner_peripheral!((GPIO21)); _for_each_inner_peripheral!((GPIO26));
4962 _for_each_inner_peripheral!((GPIO27)); _for_each_inner_peripheral!((GPIO28));
4963 _for_each_inner_peripheral!((GPIO29)); _for_each_inner_peripheral!((GPIO30));
4964 _for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
4965 _for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
4966 _for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
4967 _for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
4968 _for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
4969 _for_each_inner_peripheral!((GPIO41)); _for_each_inner_peripheral!((GPIO42));
4970 _for_each_inner_peripheral!((GPIO43)); _for_each_inner_peripheral!((GPIO44));
4971 _for_each_inner_peripheral!((GPIO45)); _for_each_inner_peripheral!((GPIO46));
4972 _for_each_inner_peripheral!((DMA_SPI2(unstable)));
4973 _for_each_inner_peripheral!((DMA_SPI3(unstable)));
4974 _for_each_inner_peripheral!((DMA_I2S0(unstable)));
4975 _for_each_inner_peripheral!((DMA_CRYPTO(unstable)));
4976 _for_each_inner_peripheral!((DMA_COPY(unstable)));
4977 _for_each_inner_peripheral!((PCNT0_UNIT0(unstable)));
4978 _for_each_inner_peripheral!((PCNT0_UNIT1(unstable)));
4979 _for_each_inner_peripheral!((PCNT0_UNIT2(unstable)));
4980 _for_each_inner_peripheral!((PCNT0_UNIT3(unstable)));
4981 _for_each_inner_peripheral!((SDM_CH0(unstable)));
4982 _for_each_inner_peripheral!((SDM_CH1(unstable)));
4983 _for_each_inner_peripheral!((SDM_CH2(unstable)));
4984 _for_each_inner_peripheral!((SDM_CH3(unstable)));
4985 _for_each_inner_peripheral!((SDM_CH4(unstable)));
4986 _for_each_inner_peripheral!((SDM_CH5(unstable)));
4987 _for_each_inner_peripheral!((SDM_CH6(unstable)));
4988 _for_each_inner_peripheral!((SDM_CH7(unstable)));
4989 _for_each_inner_peripheral!((AES(unstable)));
4990 _for_each_inner_peripheral!((APB_SARADC(unstable)));
4991 _for_each_inner_peripheral!((DS(unstable)));
4992 _for_each_inner_peripheral!((EXTMEM(unstable)));
4993 _for_each_inner_peripheral!((FE(unstable)));
4994 _for_each_inner_peripheral!((FE2(unstable)));
4995 _for_each_inner_peripheral!((GPIO(unstable)));
4996 _for_each_inner_peripheral!((GPIO_SD(unstable)));
4997 _for_each_inner_peripheral!((HMAC(unstable)));
4998 _for_each_inner_peripheral!((I2C_ANA_MST(unstable)));
4999 _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
5000 _for_each_inner_peripheral!((I2S0(unstable)));
5001 _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
5002 _for_each_inner_peripheral!((IO_MUX(unstable)));
5003 _for_each_inner_peripheral!((LEDC(unstable)));
5004 _for_each_inner_peripheral!((NRX(unstable)));
5005 _for_each_inner_peripheral!((PCNT(unstable)));
5006 _for_each_inner_peripheral!((PMS(unstable)));
5007 _for_each_inner_peripheral!((RMT(unstable)));
5008 _for_each_inner_peripheral!((RNG(unstable)));
5009 _for_each_inner_peripheral!((RSA(unstable)));
5010 _for_each_inner_peripheral!((LPWR(unstable)));
5011 _for_each_inner_peripheral!((RTC_TIMER(unstable)));
5012 _for_each_inner_peripheral!((LP_I2C0(unstable)));
5013 _for_each_inner_peripheral!((RTC_IO(unstable)));
5014 _for_each_inner_peripheral!((SENS(unstable)));
5015 _for_each_inner_peripheral!((SHA(unstable)));
5016 _for_each_inner_peripheral!((SPI0(unstable)));
5017 _for_each_inner_peripheral!((SPI1(unstable)));
5018 _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
5019 _for_each_inner_peripheral!((SYSCON(unstable)));
5020 _for_each_inner_peripheral!((SYSTEM(unstable)));
5021 _for_each_inner_peripheral!((SYSTIMER(unstable)));
5022 _for_each_inner_peripheral!((TIMG0(unstable)));
5023 _for_each_inner_peripheral!((TIMG1(unstable)));
5024 _for_each_inner_peripheral!((TWAI0(unstable)));
5025 _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
5026 _for_each_inner_peripheral!((UHCI0(unstable)));
5027 _for_each_inner_peripheral!((USB_FS(unstable)));
5028 _for_each_inner_peripheral!((XTS_AES(unstable)));
5029 _for_each_inner_peripheral!((WIFI));
5030 _for_each_inner_peripheral!((ADC1(unstable)));
5031 _for_each_inner_peripheral!((ADC2(unstable)));
5032 _for_each_inner_peripheral!((DAC1(unstable)));
5033 _for_each_inner_peripheral!((DAC2(unstable)));
5034 _for_each_inner_peripheral!((FLASH(unstable)));
5035 _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
5036 _for_each_inner_peripheral!((PSRAM(unstable)));
5037 _for_each_inner_peripheral!((ULP_RISCV_CORE(unstable)));
5038 _for_each_inner_peripheral!((FROM_CPU_INTR0(unstable)));
5039 _for_each_inner_peripheral!((FROM_CPU_INTR1(unstable)));
5040 _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
5041 _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
5042 _for_each_inner_peripheral!((SPI2, Spi2, 0, SpiDmaChannel));
5043 _for_each_inner_peripheral!((I2S0, I2s0, 0, I2sDmaChannel));
5044 _for_each_inner_peripheral!((AES, Aes, 0, CryptoDmaChannel));
5045 _for_each_inner_peripheral!((SPI3, Spi3, 1, SpiDmaChannel));
5046 _for_each_inner_peripheral!((SHA, Sha, 1, CryptoDmaChannel));
5047 _for_each_inner_peripheral!((all(@ peri_type #[doc =
5048 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5049 "<section class=\"warning\">"] #[doc =
5050 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5051 #[doc = "<ul>"] #[doc =
5052 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5053 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()), (@ peri_type #[doc =
5054 "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
5055 "GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
5056 "GPIO3 peripheral singleton"] GPIO3 <= virtual()), (@ peri_type #[doc =
5057 "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
5058 "GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
5059 "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
5060 "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
5061 "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
5062 "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
5063 "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
5064 "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
5065 "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
5066 "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
5067 "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
5068 "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
5069 "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
5070 "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
5071 "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
5072 "GPIO19 peripheral singleton"] GPIO19 <= virtual()), (@ peri_type #[doc =
5073 "GPIO20 peripheral singleton"] GPIO20 <= virtual()), (@ peri_type #[doc =
5074 "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
5075 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5076 "<section class=\"warning\">"] #[doc =
5077 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5078 #[doc = "<ul>"] #[doc =
5079 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5080 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
5081 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5082 "<section class=\"warning\">"] #[doc =
5083 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5084 #[doc = "<ul>"] #[doc =
5085 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5086 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5087 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
5088 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5089 "<section class=\"warning\">"] #[doc =
5090 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5091 #[doc = "<ul>"] #[doc =
5092 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5093 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5094 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
5095 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5096 "<section class=\"warning\">"] #[doc =
5097 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5098 #[doc = "<ul>"] #[doc =
5099 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5100 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()), (@ peri_type #[doc =
5101 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5102 "<section class=\"warning\">"] #[doc =
5103 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5104 #[doc = "<ul>"] #[doc =
5105 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5106 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5107 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
5108 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5109 "<section class=\"warning\">"] #[doc =
5110 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5111 #[doc = "<ul>"] #[doc =
5112 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5113 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5114 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
5115 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5116 "<section class=\"warning\">"] #[doc =
5117 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5118 #[doc = "<ul>"] #[doc =
5119 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
5120 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
5121 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
5122 "GPIO33 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 Octal SPI flash.</li>"] #[doc
5127 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5128 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
5129 "GPIO34 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>"] GPIO34 <= virtual()), (@ peri_type #[doc =
5136 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5137 "<section class=\"warning\">"] #[doc =
5138 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5139 #[doc = "<ul>"] #[doc =
5140 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5141 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5142 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
5143 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5144 "<section class=\"warning\">"] #[doc =
5145 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5146 #[doc = "<ul>"] #[doc =
5147 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5148 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5149 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
5150 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5151 "<section class=\"warning\">"] #[doc =
5152 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5153 #[doc = "<ul>"] #[doc =
5154 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
5155 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
5156 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
5157 "GPIO38 peripheral singleton"] GPIO38 <= virtual()), (@ peri_type #[doc =
5158 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5159 "<section class=\"warning\">"] #[doc =
5160 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5161 #[doc = "<ul>"] #[doc =
5162 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5163 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
5164 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5165 "<section class=\"warning\">"] #[doc =
5166 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5167 #[doc = "<ul>"] #[doc =
5168 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5169 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
5170 "GPIO41 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>"] GPIO41 <= virtual()), (@ peri_type #[doc =
5176 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5177 "<section class=\"warning\">"] #[doc =
5178 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5179 #[doc = "<ul>"] #[doc =
5180 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5181 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()), (@ peri_type #[doc =
5182 "GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5183 "<section class=\"warning\">"] #[doc =
5184 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5185 #[doc = "<ul>"] #[doc =
5186 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5187 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()), (@ peri_type #[doc =
5188 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5189 "<section class=\"warning\">"] #[doc =
5190 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5191 #[doc = "<ul>"] #[doc =
5192 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5193 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()), (@ peri_type #[doc =
5194 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5195 "<section class=\"warning\">"] #[doc =
5196 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5197 #[doc = "<ul>"] #[doc =
5198 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5199 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()), (@ peri_type #[doc =
5200 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5201 "<section class=\"warning\">"] #[doc =
5202 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5203 #[doc = "<ul>"] #[doc =
5204 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5205 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()), (@ peri_type #[doc =
5206 "DMA_SPI2 peripheral singleton"] DMA_SPI2 <= SPI2(SPI2_DMA : {
5207 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5208 (@ peri_type #[doc = "DMA_SPI3 peripheral singleton"] DMA_SPI3 <= SPI3(SPI3_DMA :
5209 { bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5210 (@ peri_type #[doc = "DMA_I2S0 peripheral singleton"] DMA_I2S0 <= I2S0(I2S0 : {
5211 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5212 (@ peri_type #[doc = "DMA_CRYPTO peripheral singleton"] DMA_CRYPTO <=
5213 CRYPTO_DMA(CRYPTO_DMA : { bind_dma_interrupt, enable_dma_interrupt,
5214 disable_dma_interrupt }) (unstable)), (@ peri_type #[doc =
5215 "DMA_COPY peripheral singleton"] DMA_COPY <= COPY_DMA(DMA_COPY : {
5216 bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
5217 (@ peri_type #[doc = "PCNT0_UNIT0 peripheral singleton"] PCNT0_UNIT0 <= virtual()
5218 (unstable)), (@ peri_type #[doc = "PCNT0_UNIT1 peripheral singleton"] PCNT0_UNIT1
5219 <= virtual() (unstable)), (@ peri_type #[doc =
5220 "PCNT0_UNIT2 peripheral singleton"] PCNT0_UNIT2 <= virtual() (unstable)), (@
5221 peri_type #[doc = "PCNT0_UNIT3 peripheral singleton"] PCNT0_UNIT3 <= virtual()
5222 (unstable)), (@ peri_type #[doc = "SDM_CH0 peripheral singleton"] SDM_CH0 <=
5223 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH1 peripheral singleton"]
5224 SDM_CH1 <= virtual() (unstable)), (@ peri_type #[doc =
5225 "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual() (unstable)), (@ peri_type
5226 #[doc = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)), (@
5227 peri_type #[doc = "SDM_CH4 peripheral singleton"] SDM_CH4 <= virtual()
5228 (unstable)), (@ peri_type #[doc = "SDM_CH5 peripheral singleton"] SDM_CH5 <=
5229 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
5230 SDM_CH6 <= virtual() (unstable)), (@ peri_type #[doc =
5231 "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)), (@ peri_type
5232 #[doc = "AES peripheral singleton"] AES <= AES(AES : { bind_peri_interrupt,
5233 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
5234 = "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC() (unstable)), (@
5235 peri_type #[doc = "DS peripheral singleton"] DS <= DS() (unstable)), (@ peri_type
5236 #[doc = "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@ peri_type
5237 #[doc = "EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)), (@
5238 peri_type #[doc = "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE()
5239 (unstable)), (@ peri_type #[doc = "FE peripheral singleton"] FE <= FE()
5240 (unstable)), (@ peri_type #[doc = "FE2 peripheral singleton"] FE2 <= FE2()
5241 (unstable)), (@ peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO()
5242 (unstable)), (@ peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <=
5243 GPIO_SD() (unstable)), (@ peri_type #[doc = "HMAC peripheral singleton"] HMAC <=
5244 HMAC() (unstable)), (@ peri_type #[doc = "I2C_ANA_MST peripheral singleton"]
5245 I2C_ANA_MST <= I2C_ANA_MST() (unstable)), (@ peri_type #[doc =
5246 "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
5247 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5248 "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt,
5249 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5250 "I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
5251 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
5252 = "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
5253 (unstable)), (@ peri_type #[doc = "IO_MUX peripheral singleton"] IO_MUX <=
5254 IO_MUX() (unstable)), (@ peri_type #[doc = "LEDC peripheral singleton"] LEDC <=
5255 LEDC() (unstable)), (@ peri_type #[doc = "NRX peripheral singleton"] NRX <= NRX()
5256 (unstable)), (@ peri_type #[doc = "PCNT peripheral singleton"] PCNT <= PCNT(PCNT
5257 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5258 (unstable)), (@ peri_type #[doc = "PMS peripheral singleton"] PMS <= PMS()
5259 (unstable)), (@ peri_type #[doc = "RMT peripheral singleton"] RMT <= RMT()
5260 (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <= RNG()
5261 (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <= RSA(RSA : {
5262 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5263 (unstable)), (@ peri_type #[doc = "LPWR peripheral singleton"] LPWR <= RTC_CNTL()
5264 (unstable)), (@ peri_type #[doc = "RTC_TIMER peripheral singleton"] RTC_TIMER <=
5265 RTC_CNTL() (unstable)), (@ peri_type #[doc = "LP_I2C0 peripheral singleton"]
5266 LP_I2C0 <= RTC_I2C() (unstable)), (@ peri_type #[doc =
5267 "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)), (@ peri_type #[doc
5268 = "SENS peripheral singleton"] SENS <= SENS() (unstable)), (@ peri_type #[doc =
5269 "SHA peripheral singleton"] SHA <= SHA(SHA : { bind_peri_interrupt,
5270 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
5271 = "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)), (@ peri_type #[doc =
5272 "SPI1 peripheral singleton"] SPI1 <= SPI1() (unstable)), (@ peri_type #[doc =
5273 "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2_DMA : { bind_dma_interrupt,
5274 enable_dma_interrupt, disable_dma_interrupt }, SPI2 : { bind_peri_interrupt,
5275 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5276 "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3_DMA : { bind_dma_interrupt,
5277 enable_dma_interrupt, disable_dma_interrupt }, SPI3 : { bind_peri_interrupt,
5278 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5279 "SYSCON peripheral singleton"] SYSCON <= SYSCON() (unstable)), (@ peri_type #[doc
5280 = "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)), (@ peri_type
5281 #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER() (unstable)), (@
5282 peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)), (@
5283 peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)), (@
5284 peri_type #[doc = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)), (@
5285 peri_type #[doc = "UART0 peripheral singleton"] UART0 <= UART0(UART0 : {
5286 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5287 peri_type #[doc = "UART1 peripheral singleton"] UART1 <= UART1(UART1 : {
5288 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5289 peri_type #[doc = "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)), (@
5290 peri_type #[doc = "USB_FS peripheral singleton"] USB_FS <= USB_FS(USB : {
5291 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5292 (unstable)), (@ peri_type #[doc = "USB_WRAP peripheral singleton"] USB_WRAP <=
5293 USB_WRAP() (unstable)), (@ peri_type #[doc = "XTS_AES peripheral singleton"]
5294 XTS_AES <= XTS_AES() (unstable)), (@ peri_type #[doc =
5295 "WIFI peripheral singleton"] WIFI <= WIFI(WIFI_MAC : { bind_mac_interrupt,
5296 enable_mac_interrupt, disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt,
5297 enable_pwr_interrupt, disable_pwr_interrupt })), (@ peri_type #[doc =
5298 "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)), (@ peri_type #[doc =
5299 "ADC2 peripheral singleton"] ADC2 <= virtual() (unstable)), (@ peri_type #[doc =
5300 "DAC1 peripheral singleton"] DAC1 <= virtual() (unstable)), (@ peri_type #[doc =
5301 "DAC2 peripheral singleton"] DAC2 <= virtual() (unstable)), (@ peri_type #[doc =
5302 "FLASH peripheral singleton"] FLASH <= virtual() (unstable)), (@ peri_type #[doc
5303 = "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
5304 (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
5305 (unstable)), (@ peri_type #[doc = "ULP_RISCV_CORE peripheral singleton"]
5306 ULP_RISCV_CORE <= virtual() (unstable)), (@ peri_type #[doc =
5307 "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)),
5308 (@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <=
5309 virtual() (unstable)), (@ peri_type #[doc =
5310 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
5311 (@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
5312 virtual() (unstable)))); _for_each_inner_peripheral!((singletons(GPIO0), (GPIO1),
5313 (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6), (GPIO7), (GPIO8), (GPIO9), (GPIO10),
5314 (GPIO11), (GPIO12), (GPIO13), (GPIO14), (#[cfg(not(use_xtal32k))] GPIO15),
5315 (#[cfg(not(use_xtal32k))] GPIO16), (GPIO17), (GPIO18), (GPIO19), (GPIO20),
5316 (GPIO21), (GPIO26), (GPIO27), (GPIO28), (GPIO29), (GPIO30), (GPIO31), (GPIO32),
5317 (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39), (GPIO40),
5318 (GPIO41), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (DMA_SPI2(unstable)),
5319 (DMA_SPI3(unstable)), (DMA_I2S0(unstable)), (DMA_CRYPTO(unstable)),
5320 (DMA_COPY(unstable)), (PCNT0_UNIT0(unstable)), (PCNT0_UNIT1(unstable)),
5321 (PCNT0_UNIT2(unstable)), (PCNT0_UNIT3(unstable)), (SDM_CH0(unstable)),
5322 (SDM_CH1(unstable)), (SDM_CH2(unstable)), (SDM_CH3(unstable)),
5323 (SDM_CH4(unstable)), (SDM_CH5(unstable)), (SDM_CH6(unstable)),
5324 (SDM_CH7(unstable)), (AES(unstable)), (APB_SARADC(unstable)), (DS(unstable)),
5325 (EXTMEM(unstable)), (FE(unstable)), (FE2(unstable)), (GPIO(unstable)),
5326 (GPIO_SD(unstable)), (HMAC(unstable)), (I2C_ANA_MST(unstable)), (I2C0), (I2C1),
5327 (I2S0(unstable)), (INTERRUPT_CORE0(unstable)), (IO_MUX(unstable)),
5328 (LEDC(unstable)), (NRX(unstable)), (PCNT(unstable)), (PMS(unstable)),
5329 (RMT(unstable)), (RNG(unstable)), (RSA(unstable)), (LPWR(unstable)),
5330 (RTC_TIMER(unstable)), (LP_I2C0(unstable)), (RTC_IO(unstable)), (SENS(unstable)),
5331 (SHA(unstable)), (SPI0(unstable)), (SPI1(unstable)), (SPI2), (SPI3),
5332 (SYSCON(unstable)), (SYSTEM(unstable)), (SYSTIMER(unstable)), (TIMG0(unstable)),
5333 (TIMG1(unstable)), (TWAI0(unstable)), (UART0), (UART1), (UHCI0(unstable)),
5334 (USB_FS(unstable)), (XTS_AES(unstable)), (WIFI), (ADC1(unstable)),
5335 (ADC2(unstable)), (DAC1(unstable)), (DAC2(unstable)), (FLASH(unstable)),
5336 (GPIO_DEDICATED(unstable)), (PSRAM(unstable)), (ULP_RISCV_CORE(unstable)),
5337 (FROM_CPU_INTR0(unstable)), (FROM_CPU_INTR1(unstable)),
5338 (FROM_CPU_INTR2(unstable)), (FROM_CPU_INTR3(unstable))));
5339 _for_each_inner_peripheral!((dma_eligible(SPI2, Spi2, 0, SpiDmaChannel), (I2S0,
5340 I2s0, 0, I2sDmaChannel), (AES, Aes, 0, CryptoDmaChannel), (SPI3, Spi3, 1,
5341 SpiDmaChannel), (SHA, Sha, 1, CryptoDmaChannel)));
5342 };
5343}
5344#[macro_export]
5371#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5372macro_rules! for_each_gpio {
5373 ($($pattern:tt => $code:tt;)*) => {
5374 macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
5375 } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
5376 _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
5377 _for_each_inner_gpio!((2, GPIO2() () ([Input] [Output])));
5378 _for_each_inner_gpio!((3, GPIO3() () ([Input] [Output])));
5379 _for_each_inner_gpio!((4, GPIO4() () ([Input] [Output])));
5380 _for_each_inner_gpio!((5, GPIO5() () ([Input] [Output])));
5381 _for_each_inner_gpio!((6, GPIO6() () ([Input] [Output])));
5382 _for_each_inner_gpio!((7, GPIO7() () ([Input] [Output])));
5383 _for_each_inner_gpio!((8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])));
5384 _for_each_inner_gpio!((9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4
5385 => FSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((10, GPIO10(_2 => FSPIIO4
5386 _4 => FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input]
5387 [Output]))); _for_each_inner_gpio!((11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 =>
5388 FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output])));
5389 _for_each_inner_gpio!((12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
5390 => SUBSPICLK _4 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((13,
5391 GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4
5392 => FSPIQ) ([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14(_3 => SUBSPIWP
5393 _4 => FSPIWP) (_2 => FSPIDQS _3 => SUBSPIWP _4 => FSPIWP) ([Input] [Output])));
5394 _for_each_inner_gpio!((15, GPIO15() (_2 => U0RTS) ([Input] [Output])));
5395 _for_each_inner_gpio!((16, GPIO16(_2 => U0CTS) () ([Input] [Output])));
5396 _for_each_inner_gpio!((17, GPIO17() (_2 => U1TXD) ([Input] [Output])));
5397 _for_each_inner_gpio!((18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
5398 [Output]))); _for_each_inner_gpio!((19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2)
5399 ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20(_2 => U1CTS) (_3 =>
5400 CLK_OUT1) ([Input] [Output]))); _for_each_inner_gpio!((21, GPIO21() () ([Input]
5401 [Output]))); _for_each_inner_gpio!((26, GPIO26() (_0 => SPICS1) ([Input]
5402 [Output]))); _for_each_inner_gpio!((27, GPIO27(_0 => SPIHD) (_0 => SPIHD)
5403 ([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0 => SPIWP) (_0 =>
5404 SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((29, GPIO29() (_0 => SPICS0)
5405 ([Input] [Output]))); _for_each_inner_gpio!((30, GPIO30() (_0 => SPICLK) ([Input]
5406 [Output]))); _for_each_inner_gpio!((31, GPIO31(_0 => SPIQ) (_0 => SPIQ) ([Input]
5407 [Output]))); _for_each_inner_gpio!((32, GPIO32(_0 => SPID) (_0 => SPID) ([Input]
5408 [Output]))); _for_each_inner_gpio!((33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD) (_2
5409 => FSPIHD _3 => SUBSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((34,
5410 GPIO34(_2 => FSPICS0) (_2 => FSPICS0 _3 => SUBSPICS0) ([Input] [Output])));
5411 _for_each_inner_gpio!((35, GPIO35(_2 => FSPID _3 => SUBSPID) (_2 => FSPID _3 =>
5412 SUBSPID) ([Input] [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => FSPICLK)
5413 (_2 => FSPICLK _3 => SUBSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((37,
5414 GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 =>
5415 SPIDQS) ([Input] [Output]))); _for_each_inner_gpio!((38, GPIO38(_2 => FSPIWP _3
5416 => SUBSPIWP) (_2 => FSPIWP _3 => SUBSPIWP) ([Input] [Output])));
5417 _for_each_inner_gpio!((39, GPIO39(_0 => MTCK) (_2 => CLK_OUT3 _3 => SUBSPICS1)
5418 ([Input] [Output]))); _for_each_inner_gpio!((40, GPIO40() (_0 => MTDO _2 =>
5419 CLK_OUT2) ([Input] [Output]))); _for_each_inner_gpio!((41, GPIO41(_0 => MTDI) (_2
5420 => CLK_OUT1) ([Input] [Output]))); _for_each_inner_gpio!((42, GPIO42(_0 => MTMS)
5421 () ([Input] [Output]))); _for_each_inner_gpio!((43, GPIO43() (_0 => U0TXD _2 =>
5422 CLK_OUT1) ([Input] [Output]))); _for_each_inner_gpio!((44, GPIO44(_0 => U0RXD)
5423 (_2 => CLK_OUT2) ([Input] [Output]))); _for_each_inner_gpio!((45, GPIO45() ()
5424 ([Input] [Output]))); _for_each_inner_gpio!((46, GPIO46() () ([Input]
5425 [Output]))); _for_each_inner_gpio!((all(0, GPIO0() () ([Input] [Output])), (1,
5426 GPIO1() () ([Input] [Output])), (2, GPIO2() () ([Input] [Output])), (3, GPIO3()
5427 () ([Input] [Output])), (4, GPIO4() () ([Input] [Output])), (5, GPIO5() ()
5428 ([Input] [Output])), (6, GPIO6() () ([Input] [Output])), (7, GPIO7() () ([Input]
5429 [Output])), (8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])), (9, GPIO9(_3 =>
5430 SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4 => FSPIHD) ([Input] [Output])), (10,
5431 GPIO10(_2 => FSPIIO4 _4 => FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0)
5432 ([Input] [Output])), (11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) (_2 =>
5433 FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output])), (12, GPIO12(_2 => FSPIIO6
5434 _4 => FSPICLK) (_2 => FSPIIO6 _3 => SUBSPICLK _4 => FSPICLK) ([Input] [Output])),
5435 (13, GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ
5436 _4 => FSPIQ) ([Input] [Output])), (14, GPIO14(_3 => SUBSPIWP _4 => FSPIWP) (_2 =>
5437 FSPIDQS _3 => SUBSPIWP _4 => FSPIWP) ([Input] [Output])), (15, GPIO15() (_2 =>
5438 U0RTS) ([Input] [Output])), (16, GPIO16(_2 => U0CTS) () ([Input] [Output])), (17,
5439 GPIO17() (_2 => U1TXD) ([Input] [Output])), (18, GPIO18(_2 => U1RXD) (_3 =>
5440 CLK_OUT3) ([Input] [Output])), (19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2)
5441 ([Input] [Output])), (20, GPIO20(_2 => U1CTS) (_3 => CLK_OUT1) ([Input]
5442 [Output])), (21, GPIO21() () ([Input] [Output])), (26, GPIO26() (_0 => SPICS1)
5443 ([Input] [Output])), (27, GPIO27(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])),
5444 (28, GPIO28(_0 => SPIWP) (_0 => SPIWP) ([Input] [Output])), (29, GPIO29() (_0 =>
5445 SPICS0) ([Input] [Output])), (30, GPIO30() (_0 => SPICLK) ([Input] [Output])),
5446 (31, GPIO31(_0 => SPIQ) (_0 => SPIQ) ([Input] [Output])), (32, GPIO32(_0 => SPID)
5447 (_0 => SPID) ([Input] [Output])), (33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD) (_2 =>
5448 FSPIHD _3 => SUBSPIHD) ([Input] [Output])), (34, GPIO34(_2 => FSPICS0) (_2 =>
5449 FSPICS0 _3 => SUBSPICS0) ([Input] [Output])), (35, GPIO35(_2 => FSPID _3 =>
5450 SUBSPID) (_2 => FSPID _3 => SUBSPID) ([Input] [Output])), (36, GPIO36(_2 =>
5451 FSPICLK) (_2 => FSPICLK _3 => SUBSPICLK) ([Input] [Output])), (37, GPIO37(_2 =>
5452 FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS)
5453 ([Input] [Output])), (38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 => FSPIWP _3 =>
5454 SUBSPIWP) ([Input] [Output])), (39, GPIO39(_0 => MTCK) (_2 => CLK_OUT3 _3 =>
5455 SUBSPICS1) ([Input] [Output])), (40, GPIO40() (_0 => MTDO _2 => CLK_OUT2)
5456 ([Input] [Output])), (41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
5457 [Output])), (42, GPIO42(_0 => MTMS) () ([Input] [Output])), (43, GPIO43() (_0 =>
5458 U0TXD _2 => CLK_OUT1) ([Input] [Output])), (44, GPIO44(_0 => U0RXD) (_2 =>
5459 CLK_OUT2) ([Input] [Output])), (45, GPIO45() () ([Input] [Output])), (46,
5460 GPIO46() () ([Input] [Output]))));
5461 };
5462}
5463#[macro_export]
5490#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5491macro_rules! for_each_analog_function {
5492 ($($pattern:tt => $code:tt;)*) => {
5493 macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
5494 tt) => {} } _for_each_inner_analog_function!((TOUCH1, GPIO1));
5495 _for_each_inner_analog_function!((ADC1_CH0, GPIO1));
5496 _for_each_inner_analog_function!((TOUCH2, GPIO2));
5497 _for_each_inner_analog_function!((ADC1_CH1, GPIO2));
5498 _for_each_inner_analog_function!((TOUCH3, GPIO3));
5499 _for_each_inner_analog_function!((ADC1_CH2, GPIO3));
5500 _for_each_inner_analog_function!((TOUCH4, GPIO4));
5501 _for_each_inner_analog_function!((ADC1_CH3, GPIO4));
5502 _for_each_inner_analog_function!((TOUCH5, GPIO5));
5503 _for_each_inner_analog_function!((ADC1_CH4, GPIO5));
5504 _for_each_inner_analog_function!((TOUCH6, GPIO6));
5505 _for_each_inner_analog_function!((ADC1_CH5, GPIO6));
5506 _for_each_inner_analog_function!((TOUCH7, GPIO7));
5507 _for_each_inner_analog_function!((ADC1_CH6, GPIO7));
5508 _for_each_inner_analog_function!((TOUCH8, GPIO8));
5509 _for_each_inner_analog_function!((ADC1_CH7, GPIO8));
5510 _for_each_inner_analog_function!((TOUCH9, GPIO9));
5511 _for_each_inner_analog_function!((ADC1_CH8, GPIO9));
5512 _for_each_inner_analog_function!((TOUCH10, GPIO10));
5513 _for_each_inner_analog_function!((ADC1_CH9, GPIO10));
5514 _for_each_inner_analog_function!((TOUCH11, GPIO11));
5515 _for_each_inner_analog_function!((ADC2_CH0, GPIO11));
5516 _for_each_inner_analog_function!((TOUCH12, GPIO12));
5517 _for_each_inner_analog_function!((ADC2_CH1, GPIO12));
5518 _for_each_inner_analog_function!((TOUCH13, GPIO13));
5519 _for_each_inner_analog_function!((ADC2_CH2, GPIO13));
5520 _for_each_inner_analog_function!((TOUCH14, GPIO14));
5521 _for_each_inner_analog_function!((ADC2_CH3, GPIO14));
5522 _for_each_inner_analog_function!((XTAL_32K_P, GPIO15));
5523 _for_each_inner_analog_function!((ADC2_CH4, GPIO15));
5524 _for_each_inner_analog_function!((XTAL_32K_N, GPIO16));
5525 _for_each_inner_analog_function!((ADC2_CH5, GPIO16));
5526 _for_each_inner_analog_function!((DAC1, GPIO17));
5527 _for_each_inner_analog_function!((ADC2_CH6, GPIO17));
5528 _for_each_inner_analog_function!((DAC2, GPIO18));
5529 _for_each_inner_analog_function!((ADC2_CH7, GPIO18));
5530 _for_each_inner_analog_function!((USB_FS_DM, GPIO19));
5531 _for_each_inner_analog_function!((ADC2_CH8, GPIO19));
5532 _for_each_inner_analog_function!((USB_FS_DP, GPIO20));
5533 _for_each_inner_analog_function!((ADC2_CH9, GPIO20));
5534 _for_each_inner_analog_function!(((TOUCH1, TOUCHn, 1), GPIO1));
5535 _for_each_inner_analog_function!(((TOUCH2, TOUCHn, 2), GPIO2));
5536 _for_each_inner_analog_function!(((TOUCH3, TOUCHn, 3), GPIO3));
5537 _for_each_inner_analog_function!(((TOUCH4, TOUCHn, 4), GPIO4));
5538 _for_each_inner_analog_function!(((TOUCH5, TOUCHn, 5), GPIO5));
5539 _for_each_inner_analog_function!(((TOUCH6, TOUCHn, 6), GPIO6));
5540 _for_each_inner_analog_function!(((TOUCH7, TOUCHn, 7), GPIO7));
5541 _for_each_inner_analog_function!(((TOUCH8, TOUCHn, 8), GPIO8));
5542 _for_each_inner_analog_function!(((TOUCH9, TOUCHn, 9), GPIO9));
5543 _for_each_inner_analog_function!(((TOUCH10, TOUCHn, 10), GPIO10));
5544 _for_each_inner_analog_function!(((TOUCH11, TOUCHn, 11), GPIO11));
5545 _for_each_inner_analog_function!(((TOUCH12, TOUCHn, 12), GPIO12));
5546 _for_each_inner_analog_function!(((TOUCH13, TOUCHn, 13), GPIO13));
5547 _for_each_inner_analog_function!(((TOUCH14, TOUCHn, 14), GPIO14));
5548 _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1));
5549 _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2));
5550 _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3));
5551 _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4));
5552 _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5));
5553 _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6));
5554 _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7));
5555 _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8));
5556 _for_each_inner_analog_function!(((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9));
5557 _for_each_inner_analog_function!(((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10));
5558 _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11));
5559 _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12));
5560 _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13));
5561 _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14));
5562 _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15));
5563 _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16));
5564 _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17));
5565 _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18));
5566 _for_each_inner_analog_function!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19));
5567 _for_each_inner_analog_function!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20));
5568 _for_each_inner_analog_function!(((DAC1, DACn, 1), GPIO17));
5569 _for_each_inner_analog_function!(((DAC2, DACn, 2), GPIO18));
5570 _for_each_inner_analog_function!((all(TOUCH1, GPIO1), (ADC1_CH0, GPIO1), (TOUCH2,
5571 GPIO2), (ADC1_CH1, GPIO2), (TOUCH3, GPIO3), (ADC1_CH2, GPIO3), (TOUCH4, GPIO4),
5572 (ADC1_CH3, GPIO4), (TOUCH5, GPIO5), (ADC1_CH4, GPIO5), (TOUCH6, GPIO6),
5573 (ADC1_CH5, GPIO6), (TOUCH7, GPIO7), (ADC1_CH6, GPIO7), (TOUCH8, GPIO8),
5574 (ADC1_CH7, GPIO8), (TOUCH9, GPIO9), (ADC1_CH8, GPIO9), (TOUCH10, GPIO10),
5575 (ADC1_CH9, GPIO10), (TOUCH11, GPIO11), (ADC2_CH0, GPIO11), (TOUCH12, GPIO12),
5576 (ADC2_CH1, GPIO12), (TOUCH13, GPIO13), (ADC2_CH2, GPIO13), (TOUCH14, GPIO14),
5577 (ADC2_CH3, GPIO14), (XTAL_32K_P, GPIO15), (ADC2_CH4, GPIO15), (XTAL_32K_N,
5578 GPIO16), (ADC2_CH5, GPIO16), (DAC1, GPIO17), (ADC2_CH6, GPIO17), (DAC2, GPIO18),
5579 (ADC2_CH7, GPIO18), (USB_FS_DM, GPIO19), (ADC2_CH8, GPIO19), (USB_FS_DP, GPIO20),
5580 (ADC2_CH9, GPIO20))); _for_each_inner_analog_function!((TOUCHn((TOUCH1, TOUCHn,
5581 1), GPIO1), ((TOUCH2, TOUCHn, 2), GPIO2), ((TOUCH3, TOUCHn, 3), GPIO3), ((TOUCH4,
5582 TOUCHn, 4), GPIO4), ((TOUCH5, TOUCHn, 5), GPIO5), ((TOUCH6, TOUCHn, 6), GPIO6),
5583 ((TOUCH7, TOUCHn, 7), GPIO7), ((TOUCH8, TOUCHn, 8), GPIO8), ((TOUCH9, TOUCHn, 9),
5584 GPIO9), ((TOUCH10, TOUCHn, 10), GPIO10), ((TOUCH11, TOUCHn, 11), GPIO11),
5585 ((TOUCH12, TOUCHn, 12), GPIO12), ((TOUCH13, TOUCHn, 13), GPIO13), ((TOUCH14,
5586 TOUCHn, 14), GPIO14))); _for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0,
5587 ADCn_CHm, 1, 0), GPIO1), ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2), ((ADC1_CH2,
5588 ADCn_CHm, 1, 2), GPIO3), ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4), ((ADC1_CH4,
5589 ADCn_CHm, 1, 4), GPIO5), ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6), ((ADC1_CH6,
5590 ADCn_CHm, 1, 6), GPIO7), ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8), ((ADC1_CH8,
5591 ADCn_CHm, 1, 8), GPIO9), ((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10), ((ADC2_CH0,
5592 ADCn_CHm, 2, 0), GPIO11), ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12), ((ADC2_CH2,
5593 ADCn_CHm, 2, 2), GPIO13), ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14), ((ADC2_CH4,
5594 ADCn_CHm, 2, 4), GPIO15), ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16), ((ADC2_CH6,
5595 ADCn_CHm, 2, 6), GPIO17), ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18), ((ADC2_CH8,
5596 ADCn_CHm, 2, 8), GPIO19), ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20)));
5597 _for_each_inner_analog_function!((DACn((DAC1, DACn, 1), GPIO17), ((DAC2, DACn,
5598 2), GPIO18)));
5599 };
5600}
5601#[macro_export]
5639#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5640macro_rules! for_each_lp_function {
5641 ($($pattern:tt => $code:tt;)*) => {
5642 macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
5643 => {} } _for_each_inner_lp_function!((LP_GPIO0, GPIO0, _0));
5644 _for_each_inner_lp_function!((LP_GPIO1, GPIO1, _0));
5645 _for_each_inner_lp_function!((LP_GPIO2, GPIO2, _0));
5646 _for_each_inner_lp_function!((LP_GPIO3, GPIO3, _0));
5647 _for_each_inner_lp_function!((LP_GPIO4, GPIO4, _0));
5648 _for_each_inner_lp_function!((LP_GPIO5, GPIO5, _0));
5649 _for_each_inner_lp_function!((LP_GPIO6, GPIO6, _0));
5650 _for_each_inner_lp_function!((LP_GPIO7, GPIO7, _0));
5651 _for_each_inner_lp_function!((LP_GPIO8, GPIO8, _0));
5652 _for_each_inner_lp_function!((LP_GPIO9, GPIO9, _0));
5653 _for_each_inner_lp_function!((LP_GPIO10, GPIO10, _0));
5654 _for_each_inner_lp_function!((LP_GPIO11, GPIO11, _0));
5655 _for_each_inner_lp_function!((LP_GPIO12, GPIO12, _0));
5656 _for_each_inner_lp_function!((LP_GPIO13, GPIO13, _0));
5657 _for_each_inner_lp_function!((LP_GPIO14, GPIO14, _0));
5658 _for_each_inner_lp_function!((LP_GPIO15, GPIO15, _0));
5659 _for_each_inner_lp_function!((LP_GPIO16, GPIO16, _0));
5660 _for_each_inner_lp_function!((LP_GPIO17, GPIO17, _0));
5661 _for_each_inner_lp_function!((LP_GPIO18, GPIO18, _0));
5662 _for_each_inner_lp_function!((LP_GPIO19, GPIO19, _0));
5663 _for_each_inner_lp_function!((LP_GPIO20, GPIO20, _0));
5664 _for_each_inner_lp_function!((LP_GPIO21, GPIO21, _0));
5665 _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, () ()));
5666 _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()));
5667 _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _0, () ()));
5668 _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()));
5669 _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _0, () ()));
5670 _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()));
5671 _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()));
5672 _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO7, _0, () ()));
5673 _for_each_inner_lp_function!(((LP_GPIO8, LP_GPIOn, 8), GPIO8, _0, () ()));
5674 _for_each_inner_lp_function!(((LP_GPIO9, LP_GPIOn, 9), GPIO9, _0, () ()));
5675 _for_each_inner_lp_function!(((LP_GPIO10, LP_GPIOn, 10), GPIO10, _0, () ()));
5676 _for_each_inner_lp_function!(((LP_GPIO11, LP_GPIOn, 11), GPIO11, _0, () ()));
5677 _for_each_inner_lp_function!(((LP_GPIO12, LP_GPIOn, 12), GPIO12, _0, () ()));
5678 _for_each_inner_lp_function!(((LP_GPIO13, LP_GPIOn, 13), GPIO13, _0, () ()));
5679 _for_each_inner_lp_function!(((LP_GPIO14, LP_GPIOn, 14), GPIO14, _0, () ()));
5680 _for_each_inner_lp_function!(((LP_GPIO15, LP_GPIOn, 15), GPIO15, _0, () ()));
5681 _for_each_inner_lp_function!(((LP_GPIO16, LP_GPIOn, 16), GPIO16, _0, () ()));
5682 _for_each_inner_lp_function!(((LP_GPIO17, LP_GPIOn, 17), GPIO17, _0, () ()));
5683 _for_each_inner_lp_function!(((LP_GPIO18, LP_GPIOn, 18), GPIO18, _0, () ()));
5684 _for_each_inner_lp_function!(((LP_GPIO19, LP_GPIOn, 19), GPIO19, _0, () ()));
5685 _for_each_inner_lp_function!(((LP_GPIO20, LP_GPIOn, 20), GPIO20, _0, () ()));
5686 _for_each_inner_lp_function!(((LP_GPIO21, LP_GPIOn, 21), GPIO21, _0, () ()));
5687 _for_each_inner_lp_function!((all(LP_GPIO0, GPIO0, _0), (LP_GPIO1, GPIO1, _0),
5688 (LP_GPIO2, GPIO2, _0), (LP_GPIO3, GPIO3, _0), (LP_GPIO4, GPIO4, _0), (LP_GPIO5,
5689 GPIO5, _0), (LP_GPIO6, GPIO6, _0), (LP_GPIO7, GPIO7, _0), (LP_GPIO8, GPIO8, _0),
5690 (LP_GPIO9, GPIO9, _0), (LP_GPIO10, GPIO10, _0), (LP_GPIO11, GPIO11, _0),
5691 (LP_GPIO12, GPIO12, _0), (LP_GPIO13, GPIO13, _0), (LP_GPIO14, GPIO14, _0),
5692 (LP_GPIO15, GPIO15, _0), (LP_GPIO16, GPIO16, _0), (LP_GPIO17, GPIO17, _0),
5693 (LP_GPIO18, GPIO18, _0), (LP_GPIO19, GPIO19, _0), (LP_GPIO20, GPIO20, _0),
5694 (LP_GPIO21, GPIO21, _0))); _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0,
5695 LP_GPIOn, 0), GPIO0, _0, () ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()),
5696 ((LP_GPIO2, LP_GPIOn, 2), GPIO2, _0, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0,
5697 () ()), ((LP_GPIO4, LP_GPIOn, 4), GPIO4, _0, () ()), ((LP_GPIO5, LP_GPIOn, 5),
5698 GPIO5, _0, () ()), ((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()), ((LP_GPIO7,
5699 LP_GPIOn, 7), GPIO7, _0, () ()), ((LP_GPIO8, LP_GPIOn, 8), GPIO8, _0, () ()),
5700 ((LP_GPIO9, LP_GPIOn, 9), GPIO9, _0, () ()), ((LP_GPIO10, LP_GPIOn, 10), GPIO10,
5701 _0, () ()), ((LP_GPIO11, LP_GPIOn, 11), GPIO11, _0, () ()), ((LP_GPIO12,
5702 LP_GPIOn, 12), GPIO12, _0, () ()), ((LP_GPIO13, LP_GPIOn, 13), GPIO13, _0, ()
5703 ()), ((LP_GPIO14, LP_GPIOn, 14), GPIO14, _0, () ()), ((LP_GPIO15, LP_GPIOn, 15),
5704 GPIO15, _0, () ()), ((LP_GPIO16, LP_GPIOn, 16), GPIO16, _0, () ()), ((LP_GPIO17,
5705 LP_GPIOn, 17), GPIO17, _0, () ()), ((LP_GPIO18, LP_GPIOn, 18), GPIO18, _0, ()
5706 ()), ((LP_GPIO19, LP_GPIOn, 19), GPIO19, _0, () ()), ((LP_GPIO20, LP_GPIOn, 20),
5707 GPIO20, _0, () ()), ((LP_GPIO21, LP_GPIOn, 21), GPIO21, _0, () ())));
5708 };
5709}
5710#[macro_export]
5741#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5742macro_rules! for_each_iomux_function {
5743 ($($pattern:tt => $code:tt;)*) => {
5744 macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
5745 tt) => {} } _for_each_inner_iomux_function!((SUBSPICS1, GPIO8, _3));
5746 _for_each_inner_iomux_function!((SUBSPIHD, GPIO9, _3));
5747 _for_each_inner_iomux_function!((FSPIHD, GPIO9, _4));
5748 _for_each_inner_iomux_function!((FSPIIO4, GPIO10, _2));
5749 _for_each_inner_iomux_function!((SUBSPICS0, GPIO10, _3));
5750 _for_each_inner_iomux_function!((FSPICS0, GPIO10, _4));
5751 _for_each_inner_iomux_function!((FSPIIO5, GPIO11, _2));
5752 _for_each_inner_iomux_function!((SUBSPID, GPIO11, _3));
5753 _for_each_inner_iomux_function!((FSPID, GPIO11, _4));
5754 _for_each_inner_iomux_function!((FSPIIO6, GPIO12, _2));
5755 _for_each_inner_iomux_function!((SUBSPICLK, GPIO12, _3));
5756 _for_each_inner_iomux_function!((FSPICLK, GPIO12, _4));
5757 _for_each_inner_iomux_function!((FSPIIO7, GPIO13, _2));
5758 _for_each_inner_iomux_function!((SUBSPIQ, GPIO13, _3));
5759 _for_each_inner_iomux_function!((FSPIQ, GPIO13, _4));
5760 _for_each_inner_iomux_function!((FSPIDQS, GPIO14, _2));
5761 _for_each_inner_iomux_function!((SUBSPIWP, GPIO14, _3));
5762 _for_each_inner_iomux_function!((FSPIWP, GPIO14, _4));
5763 _for_each_inner_iomux_function!((U0RTS, GPIO15, _2));
5764 _for_each_inner_iomux_function!((U0CTS, GPIO16, _2));
5765 _for_each_inner_iomux_function!((U1TXD, GPIO17, _2));
5766 _for_each_inner_iomux_function!((U1RXD, GPIO18, _2));
5767 _for_each_inner_iomux_function!((CLK_OUT3, GPIO18, _3));
5768 _for_each_inner_iomux_function!((U1RTS, GPIO19, _2));
5769 _for_each_inner_iomux_function!((CLK_OUT2, GPIO19, _3));
5770 _for_each_inner_iomux_function!((U1CTS, GPIO20, _2));
5771 _for_each_inner_iomux_function!((CLK_OUT1, GPIO20, _3));
5772 _for_each_inner_iomux_function!((SPICS1, GPIO26, _0));
5773 _for_each_inner_iomux_function!((SPIHD, GPIO27, _0));
5774 _for_each_inner_iomux_function!((SPIWP, GPIO28, _0));
5775 _for_each_inner_iomux_function!((SPICS0, GPIO29, _0));
5776 _for_each_inner_iomux_function!((SPICLK, GPIO30, _0));
5777 _for_each_inner_iomux_function!((SPIQ, GPIO31, _0));
5778 _for_each_inner_iomux_function!((SPID, GPIO32, _0));
5779 _for_each_inner_iomux_function!((FSPIHD, GPIO33, _2));
5780 _for_each_inner_iomux_function!((SUBSPIHD, GPIO33, _3));
5781 _for_each_inner_iomux_function!((FSPICS0, GPIO34, _2));
5782 _for_each_inner_iomux_function!((SUBSPICS0, GPIO34, _3));
5783 _for_each_inner_iomux_function!((FSPID, GPIO35, _2));
5784 _for_each_inner_iomux_function!((SUBSPID, GPIO35, _3));
5785 _for_each_inner_iomux_function!((FSPICLK, GPIO36, _2));
5786 _for_each_inner_iomux_function!((SUBSPICLK, GPIO36, _3));
5787 _for_each_inner_iomux_function!((FSPIQ, GPIO37, _2));
5788 _for_each_inner_iomux_function!((SUBSPIQ, GPIO37, _3));
5789 _for_each_inner_iomux_function!((SPIDQS, GPIO37, _4));
5790 _for_each_inner_iomux_function!((FSPIWP, GPIO38, _2));
5791 _for_each_inner_iomux_function!((SUBSPIWP, GPIO38, _3));
5792 _for_each_inner_iomux_function!((MTCK, GPIO39, _0));
5793 _for_each_inner_iomux_function!((CLK_OUT3, GPIO39, _2));
5794 _for_each_inner_iomux_function!((SUBSPICS1, GPIO39, _3));
5795 _for_each_inner_iomux_function!((MTDO, GPIO40, _0));
5796 _for_each_inner_iomux_function!((CLK_OUT2, GPIO40, _2));
5797 _for_each_inner_iomux_function!((MTDI, GPIO41, _0));
5798 _for_each_inner_iomux_function!((CLK_OUT1, GPIO41, _2));
5799 _for_each_inner_iomux_function!((MTMS, GPIO42, _0));
5800 _for_each_inner_iomux_function!((U0TXD, GPIO43, _0));
5801 _for_each_inner_iomux_function!((CLK_OUT1, GPIO43, _2));
5802 _for_each_inner_iomux_function!((U0RXD, GPIO44, _0));
5803 _for_each_inner_iomux_function!((CLK_OUT2, GPIO44, _2));
5804 _for_each_inner_iomux_function!(((SUBSPICS1, SUBSPICSn, 1), GPIO8, _3));
5805 _for_each_inner_iomux_function!(((SUBSPICS0, SUBSPICSn, 0), GPIO10, _3));
5806 _for_each_inner_iomux_function!(((SUBSPICS0, SUBSPICSn, 0), GPIO34, _3));
5807 _for_each_inner_iomux_function!(((SUBSPICS1, SUBSPICSn, 1), GPIO39, _3));
5808 _for_each_inner_iomux_function!(((FSPIIO4, FSPIIOn, 4), GPIO10, _2));
5809 _for_each_inner_iomux_function!(((FSPIIO5, FSPIIOn, 5), GPIO11, _2));
5810 _for_each_inner_iomux_function!(((FSPIIO6, FSPIIOn, 6), GPIO12, _2));
5811 _for_each_inner_iomux_function!(((FSPIIO7, FSPIIOn, 7), GPIO13, _2));
5812 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO10, _4));
5813 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO34, _2));
5814 _for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO18, _3));
5815 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO19, _3));
5816 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO20, _3));
5817 _for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO39, _2));
5818 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO40, _2));
5819 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO41, _2));
5820 _for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO43, _2));
5821 _for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO44, _2));
5822 _for_each_inner_iomux_function!(((SPICS1, SPICSn, 1), GPIO26, _0));
5823 _for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO29, _0));
5824 _for_each_inner_iomux_function!((all(SUBSPICS1, GPIO8, _3), (SUBSPIHD, GPIO9,
5825 _3), (FSPIHD, GPIO9, _4), (FSPIIO4, GPIO10, _2), (SUBSPICS0, GPIO10, _3),
5826 (FSPICS0, GPIO10, _4), (FSPIIO5, GPIO11, _2), (SUBSPID, GPIO11, _3), (FSPID,
5827 GPIO11, _4), (FSPIIO6, GPIO12, _2), (SUBSPICLK, GPIO12, _3), (FSPICLK, GPIO12,
5828 _4), (FSPIIO7, GPIO13, _2), (SUBSPIQ, GPIO13, _3), (FSPIQ, GPIO13, _4), (FSPIDQS,
5829 GPIO14, _2), (SUBSPIWP, GPIO14, _3), (FSPIWP, GPIO14, _4), (U0RTS, GPIO15, _2),
5830 (U0CTS, GPIO16, _2), (U1TXD, GPIO17, _2), (U1RXD, GPIO18, _2), (CLK_OUT3, GPIO18,
5831 _3), (U1RTS, GPIO19, _2), (CLK_OUT2, GPIO19, _3), (U1CTS, GPIO20, _2), (CLK_OUT1,
5832 GPIO20, _3), (SPICS1, GPIO26, _0), (SPIHD, GPIO27, _0), (SPIWP, GPIO28, _0),
5833 (SPICS0, GPIO29, _0), (SPICLK, GPIO30, _0), (SPIQ, GPIO31, _0), (SPID, GPIO32,
5834 _0), (FSPIHD, GPIO33, _2), (SUBSPIHD, GPIO33, _3), (FSPICS0, GPIO34, _2),
5835 (SUBSPICS0, GPIO34, _3), (FSPID, GPIO35, _2), (SUBSPID, GPIO35, _3), (FSPICLK,
5836 GPIO36, _2), (SUBSPICLK, GPIO36, _3), (FSPIQ, GPIO37, _2), (SUBSPIQ, GPIO37, _3),
5837 (SPIDQS, GPIO37, _4), (FSPIWP, GPIO38, _2), (SUBSPIWP, GPIO38, _3), (MTCK,
5838 GPIO39, _0), (CLK_OUT3, GPIO39, _2), (SUBSPICS1, GPIO39, _3), (MTDO, GPIO40, _0),
5839 (CLK_OUT2, GPIO40, _2), (MTDI, GPIO41, _0), (CLK_OUT1, GPIO41, _2), (MTMS,
5840 GPIO42, _0), (U0TXD, GPIO43, _0), (CLK_OUT1, GPIO43, _2), (U0RXD, GPIO44, _0),
5841 (CLK_OUT2, GPIO44, _2))); _for_each_inner_iomux_function!((SUBSPICSn((SUBSPICS1,
5842 SUBSPICSn, 1), GPIO8, _3), ((SUBSPICS0, SUBSPICSn, 0), GPIO10, _3), ((SUBSPICS0,
5843 SUBSPICSn, 0), GPIO34, _3), ((SUBSPICS1, SUBSPICSn, 1), GPIO39, _3)));
5844 _for_each_inner_iomux_function!((FSPIIOn((FSPIIO4, FSPIIOn, 4), GPIO10, _2),
5845 ((FSPIIO5, FSPIIOn, 5), GPIO11, _2), ((FSPIIO6, FSPIIOn, 6), GPIO12, _2),
5846 ((FSPIIO7, FSPIIOn, 7), GPIO13, _2)));
5847 _for_each_inner_iomux_function!((FSPICSn((FSPICS0, FSPICSn, 0), GPIO10, _4),
5848 ((FSPICS0, FSPICSn, 0), GPIO34, _2)));
5849 _for_each_inner_iomux_function!((CLK_OUTn((CLK_OUT3, CLK_OUTn, 3), GPIO18, _3),
5850 ((CLK_OUT2, CLK_OUTn, 2), GPIO19, _3), ((CLK_OUT1, CLK_OUTn, 1), GPIO20, _3),
5851 ((CLK_OUT3, CLK_OUTn, 3), GPIO39, _2), ((CLK_OUT2, CLK_OUTn, 2), GPIO40, _2),
5852 ((CLK_OUT1, CLK_OUTn, 1), GPIO41, _2), ((CLK_OUT1, CLK_OUTn, 1), GPIO43, _2),
5853 ((CLK_OUT2, CLK_OUTn, 2), GPIO44, _2)));
5854 _for_each_inner_iomux_function!((SPICSn((SPICS1, SPICSn, 1), GPIO26, _0),
5855 ((SPICS0, SPICSn, 0), GPIO29, _0)));
5856 };
5857}
5858#[macro_export]
5875#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5876macro_rules! gpio_for_signal {
5877 (LP_GPIO0 $(, $_fallback:literal)?) => {
5878 "GPIO0"
5879 };
5880 (TOUCH1 $(, $_fallback:literal)?) => {
5881 "GPIO1"
5882 };
5883 (ADC1_CH0 $(, $_fallback:literal)?) => {
5884 "GPIO1"
5885 };
5886 (LP_GPIO1 $(, $_fallback:literal)?) => {
5887 "GPIO1"
5888 };
5889 (TOUCH2 $(, $_fallback:literal)?) => {
5890 "GPIO2"
5891 };
5892 (ADC1_CH1 $(, $_fallback:literal)?) => {
5893 "GPIO2"
5894 };
5895 (LP_GPIO2 $(, $_fallback:literal)?) => {
5896 "GPIO2"
5897 };
5898 (TOUCH3 $(, $_fallback:literal)?) => {
5899 "GPIO3"
5900 };
5901 (ADC1_CH2 $(, $_fallback:literal)?) => {
5902 "GPIO3"
5903 };
5904 (LP_GPIO3 $(, $_fallback:literal)?) => {
5905 "GPIO3"
5906 };
5907 (TOUCH4 $(, $_fallback:literal)?) => {
5908 "GPIO4"
5909 };
5910 (ADC1_CH3 $(, $_fallback:literal)?) => {
5911 "GPIO4"
5912 };
5913 (LP_GPIO4 $(, $_fallback:literal)?) => {
5914 "GPIO4"
5915 };
5916 (TOUCH5 $(, $_fallback:literal)?) => {
5917 "GPIO5"
5918 };
5919 (ADC1_CH4 $(, $_fallback:literal)?) => {
5920 "GPIO5"
5921 };
5922 (LP_GPIO5 $(, $_fallback:literal)?) => {
5923 "GPIO5"
5924 };
5925 (TOUCH6 $(, $_fallback:literal)?) => {
5926 "GPIO6"
5927 };
5928 (ADC1_CH5 $(, $_fallback:literal)?) => {
5929 "GPIO6"
5930 };
5931 (LP_GPIO6 $(, $_fallback:literal)?) => {
5932 "GPIO6"
5933 };
5934 (TOUCH7 $(, $_fallback:literal)?) => {
5935 "GPIO7"
5936 };
5937 (ADC1_CH6 $(, $_fallback:literal)?) => {
5938 "GPIO7"
5939 };
5940 (LP_GPIO7 $(, $_fallback:literal)?) => {
5941 "GPIO7"
5942 };
5943 (SUBSPICS1 $(, $_fallback:literal)?) => {
5944 "GPIO8"
5945 };
5946 (TOUCH8 $(, $_fallback:literal)?) => {
5947 "GPIO8"
5948 };
5949 (ADC1_CH7 $(, $_fallback:literal)?) => {
5950 "GPIO8"
5951 };
5952 (LP_GPIO8 $(, $_fallback:literal)?) => {
5953 "GPIO8"
5954 };
5955 (SUBSPIHD $(, $_fallback:literal)?) => {
5956 "GPIO9"
5957 };
5958 (FSPIHD $(, $_fallback:literal)?) => {
5959 "GPIO9"
5960 };
5961 (TOUCH9 $(, $_fallback:literal)?) => {
5962 "GPIO9"
5963 };
5964 (ADC1_CH8 $(, $_fallback:literal)?) => {
5965 "GPIO9"
5966 };
5967 (LP_GPIO9 $(, $_fallback:literal)?) => {
5968 "GPIO9"
5969 };
5970 (FSPIIO4 $(, $_fallback:literal)?) => {
5971 "GPIO10"
5972 };
5973 (SUBSPICS0 $(, $_fallback:literal)?) => {
5974 "GPIO10"
5975 };
5976 (FSPICS0 $(, $_fallback:literal)?) => {
5977 "GPIO10"
5978 };
5979 (TOUCH10 $(, $_fallback:literal)?) => {
5980 "GPIO10"
5981 };
5982 (ADC1_CH9 $(, $_fallback:literal)?) => {
5983 "GPIO10"
5984 };
5985 (LP_GPIO10 $(, $_fallback:literal)?) => {
5986 "GPIO10"
5987 };
5988 (FSPIIO5 $(, $_fallback:literal)?) => {
5989 "GPIO11"
5990 };
5991 (SUBSPID $(, $_fallback:literal)?) => {
5992 "GPIO11"
5993 };
5994 (FSPID $(, $_fallback:literal)?) => {
5995 "GPIO11"
5996 };
5997 (TOUCH11 $(, $_fallback:literal)?) => {
5998 "GPIO11"
5999 };
6000 (ADC2_CH0 $(, $_fallback:literal)?) => {
6001 "GPIO11"
6002 };
6003 (LP_GPIO11 $(, $_fallback:literal)?) => {
6004 "GPIO11"
6005 };
6006 (FSPIIO6 $(, $_fallback:literal)?) => {
6007 "GPIO12"
6008 };
6009 (SUBSPICLK $(, $_fallback:literal)?) => {
6010 "GPIO12"
6011 };
6012 (FSPICLK $(, $_fallback:literal)?) => {
6013 "GPIO12"
6014 };
6015 (TOUCH12 $(, $_fallback:literal)?) => {
6016 "GPIO12"
6017 };
6018 (ADC2_CH1 $(, $_fallback:literal)?) => {
6019 "GPIO12"
6020 };
6021 (LP_GPIO12 $(, $_fallback:literal)?) => {
6022 "GPIO12"
6023 };
6024 (FSPIIO7 $(, $_fallback:literal)?) => {
6025 "GPIO13"
6026 };
6027 (SUBSPIQ $(, $_fallback:literal)?) => {
6028 "GPIO13"
6029 };
6030 (FSPIQ $(, $_fallback:literal)?) => {
6031 "GPIO13"
6032 };
6033 (TOUCH13 $(, $_fallback:literal)?) => {
6034 "GPIO13"
6035 };
6036 (ADC2_CH2 $(, $_fallback:literal)?) => {
6037 "GPIO13"
6038 };
6039 (LP_GPIO13 $(, $_fallback:literal)?) => {
6040 "GPIO13"
6041 };
6042 (FSPIDQS $(, $_fallback:literal)?) => {
6043 "GPIO14"
6044 };
6045 (SUBSPIWP $(, $_fallback:literal)?) => {
6046 "GPIO14"
6047 };
6048 (FSPIWP $(, $_fallback:literal)?) => {
6049 "GPIO14"
6050 };
6051 (TOUCH14 $(, $_fallback:literal)?) => {
6052 "GPIO14"
6053 };
6054 (ADC2_CH3 $(, $_fallback:literal)?) => {
6055 "GPIO14"
6056 };
6057 (LP_GPIO14 $(, $_fallback:literal)?) => {
6058 "GPIO14"
6059 };
6060 (U0RTS $(, $_fallback:literal)?) => {
6061 "GPIO15"
6062 };
6063 (XTAL_32K_P $(, $_fallback:literal)?) => {
6064 "GPIO15"
6065 };
6066 (ADC2_CH4 $(, $_fallback:literal)?) => {
6067 "GPIO15"
6068 };
6069 (LP_GPIO15 $(, $_fallback:literal)?) => {
6070 "GPIO15"
6071 };
6072 (U0CTS $(, $_fallback:literal)?) => {
6073 "GPIO16"
6074 };
6075 (XTAL_32K_N $(, $_fallback:literal)?) => {
6076 "GPIO16"
6077 };
6078 (ADC2_CH5 $(, $_fallback:literal)?) => {
6079 "GPIO16"
6080 };
6081 (LP_GPIO16 $(, $_fallback:literal)?) => {
6082 "GPIO16"
6083 };
6084 (U1TXD $(, $_fallback:literal)?) => {
6085 "GPIO17"
6086 };
6087 (DAC1 $(, $_fallback:literal)?) => {
6088 "GPIO17"
6089 };
6090 (ADC2_CH6 $(, $_fallback:literal)?) => {
6091 "GPIO17"
6092 };
6093 (LP_GPIO17 $(, $_fallback:literal)?) => {
6094 "GPIO17"
6095 };
6096 (U1RXD $(, $_fallback:literal)?) => {
6097 "GPIO18"
6098 };
6099 (CLK_OUT3 $(, $_fallback:literal)?) => {
6100 "GPIO18"
6101 };
6102 (DAC2 $(, $_fallback:literal)?) => {
6103 "GPIO18"
6104 };
6105 (ADC2_CH7 $(, $_fallback:literal)?) => {
6106 "GPIO18"
6107 };
6108 (LP_GPIO18 $(, $_fallback:literal)?) => {
6109 "GPIO18"
6110 };
6111 (U1RTS $(, $_fallback:literal)?) => {
6112 "GPIO19"
6113 };
6114 (CLK_OUT2 $(, $_fallback:literal)?) => {
6115 "GPIO19"
6116 };
6117 (USB_FS_DM $(, $_fallback:literal)?) => {
6118 "GPIO19"
6119 };
6120 (ADC2_CH8 $(, $_fallback:literal)?) => {
6121 "GPIO19"
6122 };
6123 (LP_GPIO19 $(, $_fallback:literal)?) => {
6124 "GPIO19"
6125 };
6126 (U1CTS $(, $_fallback:literal)?) => {
6127 "GPIO20"
6128 };
6129 (CLK_OUT1 $(, $_fallback:literal)?) => {
6130 "GPIO20"
6131 };
6132 (USB_FS_DP $(, $_fallback:literal)?) => {
6133 "GPIO20"
6134 };
6135 (ADC2_CH9 $(, $_fallback:literal)?) => {
6136 "GPIO20"
6137 };
6138 (LP_GPIO20 $(, $_fallback:literal)?) => {
6139 "GPIO20"
6140 };
6141 (LP_GPIO21 $(, $_fallback:literal)?) => {
6142 "GPIO21"
6143 };
6144 (SPICS1 $(, $_fallback:literal)?) => {
6145 "GPIO26"
6146 };
6147 (SPIHD $(, $_fallback:literal)?) => {
6148 "GPIO27"
6149 };
6150 (SPIWP $(, $_fallback:literal)?) => {
6151 "GPIO28"
6152 };
6153 (SPICS0 $(, $_fallback:literal)?) => {
6154 "GPIO29"
6155 };
6156 (SPICLK $(, $_fallback:literal)?) => {
6157 "GPIO30"
6158 };
6159 (SPIQ $(, $_fallback:literal)?) => {
6160 "GPIO31"
6161 };
6162 (SPID $(, $_fallback:literal)?) => {
6163 "GPIO32"
6164 };
6165 (SPIDQS $(, $_fallback:literal)?) => {
6166 "GPIO37"
6167 };
6168 (MTCK $(, $_fallback:literal)?) => {
6169 "GPIO39"
6170 };
6171 (MTDO $(, $_fallback:literal)?) => {
6172 "GPIO40"
6173 };
6174 (MTDI $(, $_fallback:literal)?) => {
6175 "GPIO41"
6176 };
6177 (MTMS $(, $_fallback:literal)?) => {
6178 "GPIO42"
6179 };
6180 (U0TXD $(, $_fallback:literal)?) => {
6181 "GPIO43"
6182 };
6183 (U0RXD $(, $_fallback:literal)?) => {
6184 "GPIO44"
6185 };
6186 ($_signal:ident, $fallback:literal) => {
6187 $fallback
6188 };
6189}
6190#[macro_export]
6194#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6195macro_rules! define_io_mux_signals {
6196 () => {
6197 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6198 #[derive(Debug, PartialEq, Copy, Clone)]
6199 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6200 #[doc(hidden)]
6201 pub enum InputSignal {
6202 SPIQ = 0,
6203 SPID = 1,
6204 SPIHD = 2,
6205 SPIWP = 3,
6206 SPID4 = 7,
6207 SPID5 = 8,
6208 SPID6 = 9,
6209 SPID7 = 10,
6210 SPIDQS = 11,
6211 U0RXD = 14,
6212 U0CTS = 15,
6213 U0DSR = 16,
6214 U1RXD = 17,
6215 U1CTS = 18,
6216 U1DSR = 21,
6217 I2S0O_BCK = 23,
6218 I2S0O_WS = 25,
6219 I2S0I_BCK = 27,
6220 I2S0I_WS = 28,
6221 I2CEXT0_SCL = 29,
6222 I2CEXT0_SDA = 30,
6223 PCNT0_SIG_CH0 = 39,
6224 PCNT0_SIG_CH1 = 40,
6225 PCNT0_CTRL_CH0 = 41,
6226 PCNT0_CTRL_CH1 = 42,
6227 PCNT1_SIG_CH0 = 43,
6228 PCNT1_SIG_CH1 = 44,
6229 PCNT1_CTRL_CH0 = 45,
6230 PCNT1_CTRL_CH1 = 46,
6231 PCNT2_SIG_CH0 = 47,
6232 PCNT2_SIG_CH1 = 48,
6233 PCNT2_CTRL_CH0 = 49,
6234 PCNT2_CTRL_CH1 = 50,
6235 PCNT3_SIG_CH0 = 51,
6236 PCNT3_SIG_CH1 = 52,
6237 PCNT3_CTRL_CH0 = 53,
6238 PCNT3_CTRL_CH1 = 54,
6239 USB_EXTPHY_VP = 61,
6240 USB_EXTPHY_VM = 62,
6241 USB_EXTPHY_RCV = 63,
6242 USB_FS_IDDIG = 64,
6243 USB_FS_AVALID = 65,
6244 USB_FS_SRP_BVALID = 66,
6245 USB_FS_VBUSVALID = 67,
6246 USB_SRP_SESSEND = 68,
6247 SPI3_CLK = 72,
6248 SPI3_Q = 73,
6249 SPI3_D = 74,
6250 SPI3_HD = 75,
6251 SPI3_CS0 = 76,
6252 RMT_SIG_0 = 83,
6253 RMT_SIG_1 = 84,
6254 RMT_SIG_2 = 85,
6255 RMT_SIG_3 = 86,
6256 I2CEXT1_SCL = 95,
6257 I2CEXT1_SDA = 96,
6258 FSPICLK = 108,
6259 FSPIQ = 109,
6260 FSPID = 110,
6261 FSPIHD = 111,
6262 FSPIWP = 112,
6263 FSPIIO4 = 113,
6264 FSPIIO5 = 114,
6265 FSPIIO6 = 115,
6266 FSPIIO7 = 116,
6267 FSPICS0 = 117,
6268 TWAI_RX = 123,
6269 SUBSPIQ = 127,
6270 SUBSPID = 128,
6271 SUBSPIHD = 129,
6272 SUBSPIWP = 130,
6273 I2S0I_DATA_IN15 = 158,
6274 SUBSPID4 = 167,
6275 SUBSPID5 = 168,
6276 SUBSPID6 = 169,
6277 SUBSPID7 = 170,
6278 SUBSPIDQS = 171,
6279 PCMFSYNC = 203,
6280 PCMCLK = 204,
6281 PRO_ALONEGPIO0 = 235,
6282 PRO_ALONEGPIO1 = 236,
6283 PRO_ALONEGPIO2 = 237,
6284 PRO_ALONEGPIO3 = 238,
6285 PRO_ALONEGPIO4 = 239,
6286 PRO_ALONEGPIO5 = 240,
6287 PRO_ALONEGPIO6 = 241,
6288 PRO_ALONEGPIO7 = 242,
6289 MTDI,
6290 MTCK,
6291 MTMS,
6292 }
6293 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6294 #[derive(Debug, PartialEq, Copy, Clone)]
6295 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6296 #[doc(hidden)]
6297 pub enum OutputSignal {
6298 SPIQ = 0,
6299 SPID = 1,
6300 SPIHD = 2,
6301 SPIWP = 3,
6302 SPICLK = 4,
6303 SPICS0 = 5,
6304 SPICS1 = 6,
6305 SPID4 = 7,
6306 SPID5 = 8,
6307 SPID6 = 9,
6308 SPID7 = 10,
6309 SPIDQS = 11,
6310 U0TXD = 14,
6311 U0RTS = 15,
6312 U0DTR = 16,
6313 U1TXD = 17,
6314 U1RTS = 18,
6315 U1DTR = 21,
6316 I2S0O_BCK = 23,
6317 I2S0O_WS = 25,
6318 I2S0I_BCK = 27,
6319 I2S0I_WS = 28,
6320 I2CEXT0_SCL = 29,
6321 I2CEXT0_SDA = 30,
6322 SDIO_TOHOST_INT = 31,
6323 USB_EXTPHY_OEN = 61,
6324 USB_EXTPHY_VPO = 63,
6325 USB_EXTPHY_VMO = 64,
6326 SPI3_CLK = 72,
6327 SPI3_Q = 73,
6328 SPI3_D = 74,
6329 SPI3_HD = 75,
6330 SPI3_CS0 = 76,
6331 SPI3_CS1 = 77,
6332 SPI3_CS2 = 78,
6333 LEDC_LS_SIG0 = 79,
6334 LEDC_LS_SIG1 = 80,
6335 LEDC_LS_SIG2 = 81,
6336 LEDC_LS_SIG3 = 82,
6337 LEDC_LS_SIG4 = 83,
6338 LEDC_LS_SIG5 = 84,
6339 LEDC_LS_SIG6 = 85,
6340 LEDC_LS_SIG7 = 86,
6341 RMT_SIG_0 = 87,
6342 RMT_SIG_1 = 88,
6343 RMT_SIG_2 = 89,
6344 RMT_SIG_3 = 90,
6345 I2CEXT1_SCL = 95,
6346 I2CEXT1_SDA = 96,
6347 GPIO_SD0 = 100,
6348 GPIO_SD1 = 101,
6349 GPIO_SD2 = 102,
6350 GPIO_SD3 = 103,
6351 GPIO_SD4 = 104,
6352 GPIO_SD5 = 105,
6353 GPIO_SD6 = 106,
6354 GPIO_SD7 = 107,
6355 FSPICLK = 108,
6356 FSPIQ = 109,
6357 FSPID = 110,
6358 FSPIHD = 111,
6359 FSPIWP = 112,
6360 FSPIIO4 = 113,
6361 FSPIIO5 = 114,
6362 FSPIIO6 = 115,
6363 FSPIIO7 = 116,
6364 FSPICS0 = 117,
6365 FSPICS1 = 118,
6366 FSPICS2 = 119,
6367 FSPICS3 = 120,
6368 FSPICS4 = 121,
6369 FSPICS5 = 122,
6370 TWAI_TX = 123,
6371 SUBSPICLK = 126,
6372 SUBSPIQ = 127,
6373 SUBSPID = 128,
6374 SUBSPIHD = 129,
6375 SUBSPIWP = 130,
6376 SUBSPICS0 = 131,
6377 SUBSPICS1 = 132,
6378 FSPIDQS = 133,
6379 FSPI_HSYNC = 134,
6380 FSPI_VSYNC = 135,
6381 FSPI_DE = 136,
6382 FSPICD = 137,
6383 SPI3_CD = 139,
6384 SPI3_DQS = 140,
6385 I2S0O_DATA_OUT23 = 166,
6386 SUBSPID4 = 167,
6387 SUBSPID5 = 168,
6388 SUBSPID6 = 169,
6389 SUBSPID7 = 170,
6390 SUBSPIDQS = 171,
6391 PCMFSYNC = 209,
6392 PCMCLK = 210,
6393 PRO_ALONEGPIO0 = 235,
6394 PRO_ALONEGPIO1 = 236,
6395 PRO_ALONEGPIO2 = 237,
6396 PRO_ALONEGPIO3 = 238,
6397 PRO_ALONEGPIO4 = 239,
6398 PRO_ALONEGPIO5 = 240,
6399 PRO_ALONEGPIO6 = 241,
6400 PRO_ALONEGPIO7 = 242,
6401 CLK_I2S = 251,
6402 GPIO = 256,
6403 CLK_OUT1,
6404 CLK_OUT2,
6405 CLK_OUT3,
6406 MTDO,
6407 }
6408 };
6409}
6410#[macro_export]
6417#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6418macro_rules! define_lp_functions {
6419 () => {
6420 #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
6425 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6426 #[doc(hidden)]
6427 pub enum LpFunction {
6428 _0 = 0,
6430 }
6431 impl LpFunction {
6432 pub const LP_GPIO: Self = Self::_0;
6434 }
6435 };
6436}
6437#[macro_export]
6450#[expect(clippy::crate_in_macro_def)]
6451#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6452macro_rules! define_io_mux_reg {
6453 () => {
6454 pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
6455 crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
6456 }
6457 };
6458}