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 "esp32s31"
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-S31"
34 };
35}
36#[macro_export]
38#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
39macro_rules! property {
40 ("chip") => {
41 "esp32s31"
42 };
43 ("arch") => {
44 "riscv"
45 };
46 ("cores") => {
47 2
48 };
49 ("cores", str) => {
50 stringify!(2)
51 };
52 ("trm") => {
53 "https://www.espressif.com/sites/default/files/documentation/esp32-s31_technical_reference_manual_en.pdf"
54 };
55 ("gpio.version") => {
56 3
57 };
58 ("gpio.version", str) => {
59 stringify!(3)
60 };
61 ("gpio.has_input_sync") => {
62 true
63 };
64 ("gpio.gpio_function") => {
65 1
66 };
67 ("gpio.gpio_function", str) => {
68 stringify!(1)
69 };
70 ("gpio.constant_0_input") => {
71 192
72 };
73 ("gpio.constant_0_input", str) => {
74 stringify!(192)
75 };
76 ("gpio.constant_1_input") => {
77 128
78 };
79 ("gpio.constant_1_input", str) => {
80 stringify!(128)
81 };
82 ("gpio.remap_iomux_pin_registers") => {
83 false
84 };
85 ("gpio.func_in_sel_offset") => {
86 0
87 };
88 ("gpio.func_in_sel_offset", str) => {
89 stringify!(0)
90 };
91 ("gpio.has_bank_1") => {
92 true
93 };
94 ("gpio.input_signal_max") => {
95 255
96 };
97 ("gpio.input_signal_max", str) => {
98 stringify!(255)
99 };
100 ("gpio.output_signal_max") => {
101 256
102 };
103 ("gpio.output_signal_max", str) => {
104 stringify!(256)
105 };
106 ("dedicated_gpio.version") => {
107 "riscv_v2"
108 };
109 ("dedicated_gpio.needs_initialization") => {
110 false
111 };
112 ("dedicated_gpio.channel_count") => {
113 8
114 };
115 ("dedicated_gpio.channel_count", str) => {
116 stringify!(8)
117 };
118 ("uart.ram_size") => {
119 128
120 };
121 ("uart.ram_size", str) => {
122 stringify!(128)
123 };
124 ("uart.version") => {
125 2
126 };
127 ("uart.version", str) => {
128 stringify!(2)
129 };
130 ("uart.peripheral_controls_mem_clk") => {
131 true
132 };
133 ("uart.has_sclk_divider") => {
134 false
135 };
136 ("uart.has_sclk_enable") => {
137 true
138 };
139 ("uhci.combined_uart_selector_field") => {
140 true
141 };
142 ("i2c_master.version") => {
143 4
144 };
145 ("i2c_master.version", str) => {
146 stringify!(4)
147 };
148 ("i2c_master.has_fsm_timeouts") => {
149 true
150 };
151 ("i2c_master.has_hw_bus_clear") => {
152 true
153 };
154 ("i2c_master.has_bus_timeout_enable") => {
155 true
156 };
157 ("i2c_master.separate_filter_config_registers") => {
158 false
159 };
160 ("i2c_master.can_estimate_nack_reason") => {
161 true
162 };
163 ("i2c_master.has_conf_update") => {
164 true
165 };
166 ("i2c_master.has_reliable_fsm_reset") => {
167 true
168 };
169 ("i2c_master.has_arbitration_en") => {
170 true
171 };
172 ("i2c_master.has_tx_fifo_watermark") => {
173 true
174 };
175 ("i2c_master.bus_timeout_is_exponential") => {
176 true
177 };
178 ("i2c_master.has_pd_en") => {
179 true
180 };
181 ("i2c_master.max_bus_timeout") => {
182 31
183 };
184 ("i2c_master.max_bus_timeout", str) => {
185 stringify!(31)
186 };
187 ("i2c_master.ll_intr_mask") => {
188 262143
189 };
190 ("i2c_master.ll_intr_mask", str) => {
191 stringify!(262143)
192 };
193 ("i2c_master.fifo_size") => {
194 32
195 };
196 ("i2c_master.fifo_size", str) => {
197 stringify!(32)
198 };
199 ("spi_master.version") => {
200 3
201 };
202 ("spi_master.version", str) => {
203 stringify!(3)
204 };
205 ("spi_master.fifo_size") => {
206 64
207 };
208 ("spi_master.fifo_size", str) => {
209 stringify!(64)
210 };
211 ("spi_master.bit_order_is_bool") => {
212 false
213 };
214 ("spi_master.has_octal") => {
215 true
216 };
217 ("spi_master.has_app_interrupts") => {
218 true
219 };
220 ("spi_master.has_dma_segmented_transfer") => {
221 true
222 };
223 ("spi_master.has_clk_pre_div") => {
224 false
225 };
226 ("spi_master.dma_can_access_flash") => {
227 false
228 };
229 ("rmt.ram_start") => {
230 540366848
231 };
232 ("rmt.ram_start", str) => {
233 stringify!(540366848)
234 };
235 ("rmt.channel_ram_size") => {
236 48
237 };
238 ("rmt.channel_ram_size", str) => {
239 stringify!(48)
240 };
241 ("rmt.has_tx_immediate_stop") => {
242 true
243 };
244 ("rmt.has_tx_loop_count") => {
245 true
246 };
247 ("rmt.has_tx_loop_auto_stop") => {
248 true
249 };
250 ("rmt.has_tx_carrier_data_only") => {
251 true
252 };
253 ("rmt.has_tx_sync") => {
254 true
255 };
256 ("rmt.has_rx_wrap") => {
257 true
258 };
259 ("rmt.has_rx_demodulation") => {
260 true
261 };
262 ("rmt.has_per_channel_clock") => {
263 false
264 };
265 ("sdmmc.delay_phase_num") => {
266 8
267 };
268 ("sdmmc.delay_phase_num", str) => {
269 stringify!(8)
270 };
271 ("sdmmc.has_iomux") => {
272 true
273 };
274 ("sdmmc.has_gpio_matrix") => {
275 false
276 };
277 ("sdmmc.psram_dma") => {
278 true
279 };
280 ("sdmmc.uhs") => {
281 false
282 };
283 ("usb_otg_hs.fifo_depth_words") => {
284 896
285 };
286 ("usb_otg_hs.fifo_depth_words", str) => {
287 stringify!(896)
288 };
289 ("sdm.channel_count") => {
290 8
291 };
292 ("sdm.channel_count", str) => {
293 stringify!(8)
294 };
295 ("timergroup.timg_has_timer1") => {
296 false
297 };
298 ("timergroup.timg_has_divcnt_rst") => {
299 true
300 };
301 ("timergroup.rc_fast_calibration_divider_min_rev") => {
302 0
303 };
304 ("timergroup.rc_fast_calibration_divider") => {
305 50
306 };
307 ("timergroup.rc_fast_calibration_tick_enable") => {
308 false
309 };
310 ("aes.has_split_text_registers") => {
311 true
312 };
313 ("aes.endianness_configurable") => {
314 false
315 };
316 ("ecc.zero_extend_writes") => {
317 false
318 };
319 ("ecc.separate_jacobian_point_memory") => {
320 true
321 };
322 ("ecc.has_memory_clock_gate") => {
323 true
324 };
325 ("ecc.supports_enhanced_security") => {
326 true
327 };
328 ("ecc.mem_block_size") => {
329 48
330 };
331 ("rng.apb_cycle_wait_num") => {
332 16
333 };
334 ("rng.apb_cycle_wait_num", str) => {
335 stringify!(16)
336 };
337 ("rng.trng_supported") => {
338 false
339 };
340 ("rng.is_lp_sys") => {
341 false
342 };
343 ("rsa.version") => {
344 3
345 };
346 ("rsa.version", str) => {
347 stringify!(3)
348 };
349 ("rsa.size_increment") => {
350 32
351 };
352 ("rsa.size_increment", str) => {
353 stringify!(32)
354 };
355 ("rsa.memory_size_bytes") => {
356 512
357 };
358 ("rsa.memory_size_bytes", str) => {
359 stringify!(512)
360 };
361 ("dma.mem2mem_requires_peripheral") => {
362 false
363 };
364 ("dma.ext_mem_configurable_block_size") => {
365 false
366 };
367 ("dma.separate_in_out_interrupts") => {
368 true
369 };
370 ("dma.gdma_version") => {
371 3
372 };
373 ("dma.gdma_version", str) => {
374 stringify!(3)
375 };
376 ("interrupts.status_registers") => {
377 6
378 };
379 ("interrupts.status_registers", str) => {
380 stringify!(6)
381 };
382 ("interrupts.disabled_interrupt") => {
383 0
384 };
385 ("mmu.page_size") => {
386 65536
387 };
388 ("mmu.page_size", str) => {
389 stringify!(65536)
390 };
391 ("mmu.entry_num") => {
392 1024
393 };
394 ("mmu.entry_num", str) => {
395 stringify!(1024)
396 };
397 ("psram.octal_spi") => {
398 true
399 };
400 ("psram.hex_spi") => {
401 false
402 };
403 ("psram.extmem_origin") => {
404 1342177280
405 };
406 ("psram.extmem_origin", str) => {
407 stringify!(1342177280)
408 };
409 ("rom.has_crc_le") => {
410 true
411 };
412 ("rom.has_crc_be") => {
413 true
414 };
415 ("rom.has_md5_bsd") => {
416 true
417 };
418 ("rom.has_md5_mbedtls") => {
419 false
420 };
421 ("soc.cpu_has_branch_predictor") => {
422 true
423 };
424 ("soc.cpu_has_csr_pc") => {
425 false
426 };
427 ("soc.multi_core_enabled") => {
428 true
429 };
430 ("soc.cpu_csr_prv_mode") => {
431 2064
432 };
433 ("soc.cpu_csr_prv_mode", str) => {
434 stringify!(2064)
435 };
436 ("soc.internal_memory_cached") => {
437 false
438 };
439 ("soc.has_swd_watchdog") => {
440 true
441 };
442 ("soc.cpu_mcause_mask") => {
443 63
444 };
445 ("soc.cpu_mcause_mask", str) => {
446 stringify!(63)
447 };
448 ("clock_tree.cpu_root_clk") => {
449 [crate ::soc::clocks::CpuRootClkConfig::Xtal, crate
450 ::soc::clocks::CpuRootClkConfig::Cpll, crate
451 ::soc::clocks::CpuRootClkConfig::RcFast, crate
452 ::soc::clocks::CpuRootClkConfig::PllF240m]
453 };
454 ("clock_tree.cpu_clk.divisor") => {
455 (0, 255)
456 };
457 ("clock_tree.ahb_clk.divisor") => {
458 (0, 255)
459 };
460 ("clock_tree.apb_clk.divisor") => {
461 (0, 255)
462 };
463 ("clock_tree.lp_fast_clk") => {
464 [crate ::soc::clocks::LpFastClkConfig::RcFast, crate
465 ::soc::clocks::LpFastClkConfig::Xtal]
466 };
467 ("clock_tree.lp_slow_clk") => {
468 [crate ::soc::clocks::LpSlowClkConfig::RcSlow, #[cfg(use_xtal32k)] crate
469 ::soc::clocks::LpSlowClkConfig::Xtal32k]
470 };
471 ("clock_tree.iomux_function_clock.source") => {
472 [crate ::soc::clocks::IomuxFunctionClockSource::XtalClk, crate
473 ::soc::clocks::IomuxFunctionClockSource::PllF80m]
474 };
475 ("clock_tree.iomux_function_clock.div_num") => {
476 (0, 255)
477 };
478 ("clock_tree.timg_calibration_clock") => {
479 [crate ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, crate
480 ::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
481 crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
482 };
483 ("clock_tree.psram.function_clock") => {
484 [crate ::soc::clocks::PsramFunctionClockConfig::Xtal, crate
485 ::soc::clocks::PsramFunctionClockConfig::Mpll, crate
486 ::soc::clocks::PsramFunctionClockConfig::Cpll]
487 };
488 ("clock_tree.uart.function_clock.sclk") => {
489 [crate ::soc::clocks::UartFunctionClockSclk::PllF80m, crate
490 ::soc::clocks::UartFunctionClockSclk::Xtal, crate
491 ::soc::clocks::UartFunctionClockSclk::RcFast]
492 };
493 ("clock_tree.uart.function_clock.div_num") => {
494 (0, 255)
495 };
496 ("clock_tree.uart.baud_rate_generator.fractional") => {
497 (0, 15)
498 };
499 ("clock_tree.uart.baud_rate_generator.integral") => {
500 (0, 4095)
501 };
502 ("clock_tree.timg.function_clock") => {
503 [crate ::soc::clocks::TimgFunctionClockConfig::PllF80m, crate
504 ::soc::clocks::TimgFunctionClockConfig::RcFastClk, crate
505 ::soc::clocks::TimgFunctionClockConfig::XtalClk]
506 };
507 ("clock_tree.timg.wdt_clock") => {
508 [crate ::soc::clocks::TimgWdtClockConfig::XtalClk, crate
509 ::soc::clocks::TimgWdtClockConfig::PllF80m, crate
510 ::soc::clocks::TimgWdtClockConfig::RcFastClk]
511 };
512 ("clock_tree.spi.function_clock") => {
513 [crate ::soc::clocks::SpiFunctionClockConfig::Bbpll, crate
514 ::soc::clocks::SpiFunctionClockConfig::Xtal, crate
515 ::soc::clocks::SpiFunctionClockConfig::RcFast]
516 };
517 ("clock_tree.i2c.function_clock.sclk") => {
518 [crate ::soc::clocks::I2cFunctionClockSclk::Xtal, crate
519 ::soc::clocks::I2cFunctionClockSclk::RcFast]
520 };
521 ("clock_tree.i2c.function_clock.div_num") => {
522 (0, 255)
523 };
524 ("clock_tree.rmt.sclk") => {
525 [crate ::soc::clocks::RmtSclkConfig::PllF80m, crate
526 ::soc::clocks::RmtSclkConfig::RcFastClk, crate
527 ::soc::clocks::RmtSclkConfig::XtalClk]
528 };
529}
530#[macro_export]
531#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
532macro_rules! for_each_dedicated_gpio {
533 ($($pattern:tt => $code:tt;)*) => {
534 macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
535 tt) => {} } _for_each_inner_dedicated_gpio!((0));
536 _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
537 _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
538 _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
539 _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
540 CPU_GPIO_0)); _for_each_inner_dedicated_gpio!((0, 1, CPU_GPIO_1));
541 _for_each_inner_dedicated_gpio!((0, 2, CPU_GPIO_2));
542 _for_each_inner_dedicated_gpio!((0, 3, CPU_GPIO_3));
543 _for_each_inner_dedicated_gpio!((0, 4, CPU_GPIO_4));
544 _for_each_inner_dedicated_gpio!((0, 5, CPU_GPIO_5));
545 _for_each_inner_dedicated_gpio!((0, 6, CPU_GPIO_6));
546 _for_each_inner_dedicated_gpio!((0, 7, CPU_GPIO_7));
547 _for_each_inner_dedicated_gpio!((1, 0, CPU_GPIO_8));
548 _for_each_inner_dedicated_gpio!((1, 1, CPU_GPIO_9));
549 _for_each_inner_dedicated_gpio!((1, 2, CPU_GPIO_10));
550 _for_each_inner_dedicated_gpio!((1, 3, CPU_GPIO_11));
551 _for_each_inner_dedicated_gpio!((1, 4, CPU_GPIO_12));
552 _for_each_inner_dedicated_gpio!((1, 5, CPU_GPIO_13));
553 _for_each_inner_dedicated_gpio!((1, 6, CPU_GPIO_14));
554 _for_each_inner_dedicated_gpio!((1, 7, CPU_GPIO_15));
555 _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
556 (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, CPU_GPIO_0), (0, 1,
557 CPU_GPIO_1), (0, 2, CPU_GPIO_2), (0, 3, CPU_GPIO_3), (0, 4, CPU_GPIO_4), (0, 5,
558 CPU_GPIO_5), (0, 6, CPU_GPIO_6), (0, 7, CPU_GPIO_7), (1, 0, CPU_GPIO_8), (1, 1,
559 CPU_GPIO_9), (1, 2, CPU_GPIO_10), (1, 3, CPU_GPIO_11), (1, 4, CPU_GPIO_12), (1,
560 5, CPU_GPIO_13), (1, 6, CPU_GPIO_14), (1, 7, CPU_GPIO_15)));
561 };
562}
563#[macro_export]
585#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
586macro_rules! for_each_rmt_channel {
587 ($($pattern:tt => $code:tt;)*) => {
588 macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
589 => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
590 _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
591 _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
592 _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
593 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
594 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
595 _for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
596 _for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
597 _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
598 _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
599 _for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
600 };
601}
602#[macro_export]
627#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
628macro_rules! for_each_sdmmc {
629 ($($pattern:tt => $code:tt;)*) => {
630 macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
631 } _for_each_inner_sdmmc!((slot0, 0, true, [], [], [], [], [],
632 [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
633 [SDHOST_DATA_STROBE_1], [SD_RST_N_1])); _for_each_inner_sdmmc!((slot1, 1, true,
634 [], [], [], [], [], [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2],
635 [SDHOST_CARD_INT_N_2], [SDHOST_DATA_STROBE_2], [SD_RST_N_2]));
636 _for_each_inner_sdmmc!((all(slot0, 0, true, [], [], [], [], [],
637 [SDHOST_CARD_DETECT_N_1], [SDHOST_CARD_WRITE_PRT_1], [SDHOST_CARD_INT_N_1],
638 [SDHOST_DATA_STROBE_1], [SD_RST_N_1]), (slot1, 1, true, [], [], [], [], [],
639 [SDHOST_CARD_DETECT_N_2], [SDHOST_CARD_WRITE_PRT_2], [SDHOST_CARD_INT_N_2],
640 [SDHOST_DATA_STROBE_2], [SD_RST_N_2])));
641 };
642}
643#[macro_export]
644#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
645macro_rules! for_each_sdm_channel {
646 ($($pattern:tt => $code:tt;)*) => {
647 macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
648 => {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
649 _for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
650 _for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
651 _for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
652 _for_each_inner_sdm_channel!((4, SDM_CH4, SdmCh4, GPIO_SD4));
653 _for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
654 _for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
655 _for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
656 _for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
657 SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
658 GPIO_SD3), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
659 SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
660 };
661}
662#[macro_export]
663#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
664macro_rules! for_each_aes_key_length {
665 ($($pattern:tt => $code:tt;)*) => {
666 macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
667 tt) => {} } _for_each_inner_aes_key_length!((128));
668 _for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
669 4)); _for_each_inner_aes_key_length!((256, 2, 6));
670 _for_each_inner_aes_key_length!((bits(128), (256)));
671 _for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
672 };
673}
674#[macro_export]
675#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
676macro_rules! for_each_ecc_working_mode {
677 ($($pattern:tt => $code:tt;)*) => {
678 macro_rules! _for_each_inner_ecc_working_mode { $(($pattern) => $code;)* ($other
679 : tt) => {} } _for_each_inner_ecc_working_mode!((0, AffinePointMultiplication));
680 _for_each_inner_ecc_working_mode!((2, AffinePointVerification));
681 _for_each_inner_ecc_working_mode!((3, AffinePointVerificationAndMultiplication));
682 _for_each_inner_ecc_working_mode!((4, JacobianPointMultiplication));
683 _for_each_inner_ecc_working_mode!((5, AffinePointAddition));
684 _for_each_inner_ecc_working_mode!((6, JacobianPointVerification));
685 _for_each_inner_ecc_working_mode!((7,
686 AffinePointVerificationAndJacobianPointMultiplication));
687 _for_each_inner_ecc_working_mode!((8, ModularAddition));
688 _for_each_inner_ecc_working_mode!((9, ModularSubtraction));
689 _for_each_inner_ecc_working_mode!((10, ModularMultiplication));
690 _for_each_inner_ecc_working_mode!((11, ModularDivision));
691 _for_each_inner_ecc_working_mode!((all(0, AffinePointMultiplication), (2,
692 AffinePointVerification), (3, AffinePointVerificationAndMultiplication), (4,
693 JacobianPointMultiplication), (5, AffinePointAddition), (6,
694 JacobianPointVerification), (7,
695 AffinePointVerificationAndJacobianPointMultiplication), (8, ModularAddition), (9,
696 ModularSubtraction), (10, ModularMultiplication), (11, ModularDivision)));
697 };
698}
699#[macro_export]
700#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
701macro_rules! for_each_ecc_curve {
702 ($($pattern:tt => $code:tt;)*) => {
703 macro_rules! _for_each_inner_ecc_curve { $(($pattern) => $code;)* ($other : tt)
704 => {} } _for_each_inner_ecc_curve!((0, P192, 192));
705 _for_each_inner_ecc_curve!((1, P256, 256)); _for_each_inner_ecc_curve!((2, P384,
706 384)); _for_each_inner_ecc_curve!((all(0, P192, 192), (1, P256, 256), (2, P384,
707 384)));
708 };
709}
710#[macro_export]
711#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
712macro_rules! for_each_rsa_exponentiation {
713 ($($pattern:tt => $code:tt;)*) => {
714 macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
715 ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
716 _for_each_inner_rsa_exponentiation!((64));
717 _for_each_inner_rsa_exponentiation!((96));
718 _for_each_inner_rsa_exponentiation!((128));
719 _for_each_inner_rsa_exponentiation!((160));
720 _for_each_inner_rsa_exponentiation!((192));
721 _for_each_inner_rsa_exponentiation!((224));
722 _for_each_inner_rsa_exponentiation!((256));
723 _for_each_inner_rsa_exponentiation!((288));
724 _for_each_inner_rsa_exponentiation!((320));
725 _for_each_inner_rsa_exponentiation!((352));
726 _for_each_inner_rsa_exponentiation!((384));
727 _for_each_inner_rsa_exponentiation!((416));
728 _for_each_inner_rsa_exponentiation!((448));
729 _for_each_inner_rsa_exponentiation!((480));
730 _for_each_inner_rsa_exponentiation!((512));
731 _for_each_inner_rsa_exponentiation!((544));
732 _for_each_inner_rsa_exponentiation!((576));
733 _for_each_inner_rsa_exponentiation!((608));
734 _for_each_inner_rsa_exponentiation!((640));
735 _for_each_inner_rsa_exponentiation!((672));
736 _for_each_inner_rsa_exponentiation!((704));
737 _for_each_inner_rsa_exponentiation!((736));
738 _for_each_inner_rsa_exponentiation!((768));
739 _for_each_inner_rsa_exponentiation!((800));
740 _for_each_inner_rsa_exponentiation!((832));
741 _for_each_inner_rsa_exponentiation!((864));
742 _for_each_inner_rsa_exponentiation!((896));
743 _for_each_inner_rsa_exponentiation!((928));
744 _for_each_inner_rsa_exponentiation!((960));
745 _for_each_inner_rsa_exponentiation!((992));
746 _for_each_inner_rsa_exponentiation!((1024));
747 _for_each_inner_rsa_exponentiation!((1056));
748 _for_each_inner_rsa_exponentiation!((1088));
749 _for_each_inner_rsa_exponentiation!((1120));
750 _for_each_inner_rsa_exponentiation!((1152));
751 _for_each_inner_rsa_exponentiation!((1184));
752 _for_each_inner_rsa_exponentiation!((1216));
753 _for_each_inner_rsa_exponentiation!((1248));
754 _for_each_inner_rsa_exponentiation!((1280));
755 _for_each_inner_rsa_exponentiation!((1312));
756 _for_each_inner_rsa_exponentiation!((1344));
757 _for_each_inner_rsa_exponentiation!((1376));
758 _for_each_inner_rsa_exponentiation!((1408));
759 _for_each_inner_rsa_exponentiation!((1440));
760 _for_each_inner_rsa_exponentiation!((1472));
761 _for_each_inner_rsa_exponentiation!((1504));
762 _for_each_inner_rsa_exponentiation!((1536));
763 _for_each_inner_rsa_exponentiation!((1568));
764 _for_each_inner_rsa_exponentiation!((1600));
765 _for_each_inner_rsa_exponentiation!((1632));
766 _for_each_inner_rsa_exponentiation!((1664));
767 _for_each_inner_rsa_exponentiation!((1696));
768 _for_each_inner_rsa_exponentiation!((1728));
769 _for_each_inner_rsa_exponentiation!((1760));
770 _for_each_inner_rsa_exponentiation!((1792));
771 _for_each_inner_rsa_exponentiation!((1824));
772 _for_each_inner_rsa_exponentiation!((1856));
773 _for_each_inner_rsa_exponentiation!((1888));
774 _for_each_inner_rsa_exponentiation!((1920));
775 _for_each_inner_rsa_exponentiation!((1952));
776 _for_each_inner_rsa_exponentiation!((1984));
777 _for_each_inner_rsa_exponentiation!((2016));
778 _for_each_inner_rsa_exponentiation!((2048));
779 _for_each_inner_rsa_exponentiation!((2080));
780 _for_each_inner_rsa_exponentiation!((2112));
781 _for_each_inner_rsa_exponentiation!((2144));
782 _for_each_inner_rsa_exponentiation!((2176));
783 _for_each_inner_rsa_exponentiation!((2208));
784 _for_each_inner_rsa_exponentiation!((2240));
785 _for_each_inner_rsa_exponentiation!((2272));
786 _for_each_inner_rsa_exponentiation!((2304));
787 _for_each_inner_rsa_exponentiation!((2336));
788 _for_each_inner_rsa_exponentiation!((2368));
789 _for_each_inner_rsa_exponentiation!((2400));
790 _for_each_inner_rsa_exponentiation!((2432));
791 _for_each_inner_rsa_exponentiation!((2464));
792 _for_each_inner_rsa_exponentiation!((2496));
793 _for_each_inner_rsa_exponentiation!((2528));
794 _for_each_inner_rsa_exponentiation!((2560));
795 _for_each_inner_rsa_exponentiation!((2592));
796 _for_each_inner_rsa_exponentiation!((2624));
797 _for_each_inner_rsa_exponentiation!((2656));
798 _for_each_inner_rsa_exponentiation!((2688));
799 _for_each_inner_rsa_exponentiation!((2720));
800 _for_each_inner_rsa_exponentiation!((2752));
801 _for_each_inner_rsa_exponentiation!((2784));
802 _for_each_inner_rsa_exponentiation!((2816));
803 _for_each_inner_rsa_exponentiation!((2848));
804 _for_each_inner_rsa_exponentiation!((2880));
805 _for_each_inner_rsa_exponentiation!((2912));
806 _for_each_inner_rsa_exponentiation!((2944));
807 _for_each_inner_rsa_exponentiation!((2976));
808 _for_each_inner_rsa_exponentiation!((3008));
809 _for_each_inner_rsa_exponentiation!((3040));
810 _for_each_inner_rsa_exponentiation!((3072));
811 _for_each_inner_rsa_exponentiation!((3104));
812 _for_each_inner_rsa_exponentiation!((3136));
813 _for_each_inner_rsa_exponentiation!((3168));
814 _for_each_inner_rsa_exponentiation!((3200));
815 _for_each_inner_rsa_exponentiation!((3232));
816 _for_each_inner_rsa_exponentiation!((3264));
817 _for_each_inner_rsa_exponentiation!((3296));
818 _for_each_inner_rsa_exponentiation!((3328));
819 _for_each_inner_rsa_exponentiation!((3360));
820 _for_each_inner_rsa_exponentiation!((3392));
821 _for_each_inner_rsa_exponentiation!((3424));
822 _for_each_inner_rsa_exponentiation!((3456));
823 _for_each_inner_rsa_exponentiation!((3488));
824 _for_each_inner_rsa_exponentiation!((3520));
825 _for_each_inner_rsa_exponentiation!((3552));
826 _for_each_inner_rsa_exponentiation!((3584));
827 _for_each_inner_rsa_exponentiation!((3616));
828 _for_each_inner_rsa_exponentiation!((3648));
829 _for_each_inner_rsa_exponentiation!((3680));
830 _for_each_inner_rsa_exponentiation!((3712));
831 _for_each_inner_rsa_exponentiation!((3744));
832 _for_each_inner_rsa_exponentiation!((3776));
833 _for_each_inner_rsa_exponentiation!((3808));
834 _for_each_inner_rsa_exponentiation!((3840));
835 _for_each_inner_rsa_exponentiation!((3872));
836 _for_each_inner_rsa_exponentiation!((3904));
837 _for_each_inner_rsa_exponentiation!((3936));
838 _for_each_inner_rsa_exponentiation!((3968));
839 _for_each_inner_rsa_exponentiation!((4000));
840 _for_each_inner_rsa_exponentiation!((4032));
841 _for_each_inner_rsa_exponentiation!((4064));
842 _for_each_inner_rsa_exponentiation!((4096));
843 _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
844 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
845 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
846 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
847 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
848 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
849 (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
850 (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
851 (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
852 (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
853 (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
854 (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
855 (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
856 };
857}
858#[macro_export]
859#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
860macro_rules! for_each_rsa_multiplication {
861 ($($pattern:tt => $code:tt;)*) => {
862 macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
863 ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
864 _for_each_inner_rsa_multiplication!((64));
865 _for_each_inner_rsa_multiplication!((96));
866 _for_each_inner_rsa_multiplication!((128));
867 _for_each_inner_rsa_multiplication!((160));
868 _for_each_inner_rsa_multiplication!((192));
869 _for_each_inner_rsa_multiplication!((224));
870 _for_each_inner_rsa_multiplication!((256));
871 _for_each_inner_rsa_multiplication!((288));
872 _for_each_inner_rsa_multiplication!((320));
873 _for_each_inner_rsa_multiplication!((352));
874 _for_each_inner_rsa_multiplication!((384));
875 _for_each_inner_rsa_multiplication!((416));
876 _for_each_inner_rsa_multiplication!((448));
877 _for_each_inner_rsa_multiplication!((480));
878 _for_each_inner_rsa_multiplication!((512));
879 _for_each_inner_rsa_multiplication!((544));
880 _for_each_inner_rsa_multiplication!((576));
881 _for_each_inner_rsa_multiplication!((608));
882 _for_each_inner_rsa_multiplication!((640));
883 _for_each_inner_rsa_multiplication!((672));
884 _for_each_inner_rsa_multiplication!((704));
885 _for_each_inner_rsa_multiplication!((736));
886 _for_each_inner_rsa_multiplication!((768));
887 _for_each_inner_rsa_multiplication!((800));
888 _for_each_inner_rsa_multiplication!((832));
889 _for_each_inner_rsa_multiplication!((864));
890 _for_each_inner_rsa_multiplication!((896));
891 _for_each_inner_rsa_multiplication!((928));
892 _for_each_inner_rsa_multiplication!((960));
893 _for_each_inner_rsa_multiplication!((992));
894 _for_each_inner_rsa_multiplication!((1024));
895 _for_each_inner_rsa_multiplication!((1056));
896 _for_each_inner_rsa_multiplication!((1088));
897 _for_each_inner_rsa_multiplication!((1120));
898 _for_each_inner_rsa_multiplication!((1152));
899 _for_each_inner_rsa_multiplication!((1184));
900 _for_each_inner_rsa_multiplication!((1216));
901 _for_each_inner_rsa_multiplication!((1248));
902 _for_each_inner_rsa_multiplication!((1280));
903 _for_each_inner_rsa_multiplication!((1312));
904 _for_each_inner_rsa_multiplication!((1344));
905 _for_each_inner_rsa_multiplication!((1376));
906 _for_each_inner_rsa_multiplication!((1408));
907 _for_each_inner_rsa_multiplication!((1440));
908 _for_each_inner_rsa_multiplication!((1472));
909 _for_each_inner_rsa_multiplication!((1504));
910 _for_each_inner_rsa_multiplication!((1536));
911 _for_each_inner_rsa_multiplication!((1568));
912 _for_each_inner_rsa_multiplication!((1600));
913 _for_each_inner_rsa_multiplication!((1632));
914 _for_each_inner_rsa_multiplication!((1664));
915 _for_each_inner_rsa_multiplication!((1696));
916 _for_each_inner_rsa_multiplication!((1728));
917 _for_each_inner_rsa_multiplication!((1760));
918 _for_each_inner_rsa_multiplication!((1792));
919 _for_each_inner_rsa_multiplication!((1824));
920 _for_each_inner_rsa_multiplication!((1856));
921 _for_each_inner_rsa_multiplication!((1888));
922 _for_each_inner_rsa_multiplication!((1920));
923 _for_each_inner_rsa_multiplication!((1952));
924 _for_each_inner_rsa_multiplication!((1984));
925 _for_each_inner_rsa_multiplication!((2016));
926 _for_each_inner_rsa_multiplication!((2048));
927 _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
928 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
929 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
930 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
931 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
932 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
933 (1888), (1920), (1952), (1984), (2016), (2048)));
934 };
935}
936#[macro_export]
937#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
938macro_rules! for_each_sha_algorithm {
939 ($($pattern:tt => $code:tt;)*) => {
940 macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
941 tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
942 (insecure_against : "collision", "length extension"), 0));
943 _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
944 (insecure_against : "length extension"), 1));
945 _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
946 (insecure_against : "length extension"), 2));
947 _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
948 (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
949 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
950 _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
951 (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
952 "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
953 _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
954 (insecure_against : "collision", "length extension"), 0), (Sha224,
955 "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
956 (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
957 2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
958 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
959 (Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
960 (Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
961 };
962}
963#[macro_export]
964#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
965macro_rules! for_each_dma_engine {
966 ($($pattern:tt => $code:tt;)*) => {
967 macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
968 => {} } _for_each_inner_dma_engine!(("AHB_GDMA"));
969 _for_each_inner_dma_engine!(("AXI_GDMA"));
970 _for_each_inner_dma_engine!((all("AHB_GDMA"), ("AXI_GDMA")));
971 };
972}
973#[macro_export]
974#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
975macro_rules! for_each_dma_channel {
976 ($($pattern:tt => $code:tt;)*) => {
977 macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
978 => {} } _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0));
979 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1));
980 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2));
981 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3));
982 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4));
983 _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0));
984 _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH1));
985 _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH2));
986 _for_each_inner_dma_channel!(("AHB_GDMA", any_channel = AhbGdmaChannel));
987 _for_each_inner_dma_channel!(("AXI_GDMA", any_channel = AxiGdmaChannel));
988 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0, 0, interrupt_in =
989 AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0]));
990 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1, 1, interrupt_in =
991 AHB_PDMA_IN_CH1, interrupt_out = AHB_PDMA_OUT_CH1, compatible = [UHCI0]));
992 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2, 2, interrupt_in =
993 AHB_PDMA_IN_CH2, interrupt_out = AHB_PDMA_OUT_CH2, compatible = [UHCI0]));
994 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH3, 3, interrupt_in =
995 AHB_PDMA_IN_CH3, interrupt_out = AHB_PDMA_OUT_CH3, compatible = [UHCI0]));
996 _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH4, 4, interrupt_in =
997 AHB_PDMA_IN_CH4, interrupt_out = AHB_PDMA_OUT_CH4, compatible = [UHCI0]));
998 _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH0, 0, interrupt_in =
999 AXI_PDMA_IN_CH0, interrupt_out = AXI_PDMA_OUT_CH0, compatible = [SPI2, SPI3, AES,
1000 SHA])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH1, 1, interrupt_in =
1001 AXI_PDMA_IN_CH1, interrupt_out = AXI_PDMA_OUT_CH1, compatible = [SPI2, SPI3, AES,
1002 SHA])); _for_each_inner_dma_channel!(("AXI_GDMA", DMA_AXI_CH2, 2, interrupt_in =
1003 AXI_PDMA_IN_CH2, interrupt_out = AXI_PDMA_OUT_CH2, compatible = [SPI2, SPI3, AES,
1004 SHA])); _for_each_inner_dma_channel!((names("AHB_GDMA", DMA_CH0), ("AHB_GDMA",
1005 DMA_CH1), ("AHB_GDMA", DMA_CH2), ("AHB_GDMA", DMA_CH3), ("AHB_GDMA", DMA_CH4),
1006 ("AXI_GDMA", DMA_AXI_CH0), ("AXI_GDMA", DMA_AXI_CH1), ("AXI_GDMA",
1007 DMA_AXI_CH2))); _for_each_inner_dma_channel!((separate_any_type("AHB_GDMA",
1008 any_channel = AhbGdmaChannel), ("AXI_GDMA", any_channel = AxiGdmaChannel)));
1009 _for_each_inner_dma_channel!((shared));
1010 _for_each_inner_dma_channel!((split("AHB_GDMA", DMA_CH0, 0, interrupt_in =
1011 AHB_PDMA_IN_CH0, interrupt_out = AHB_PDMA_OUT_CH0, compatible = [UHCI0]),
1012 ("AHB_GDMA", DMA_CH1, 1, interrupt_in = AHB_PDMA_IN_CH1, interrupt_out =
1013 AHB_PDMA_OUT_CH1, compatible = [UHCI0]), ("AHB_GDMA", DMA_CH2, 2, interrupt_in =
1014 AHB_PDMA_IN_CH2, interrupt_out = AHB_PDMA_OUT_CH2, compatible = [UHCI0]),
1015 ("AHB_GDMA", DMA_CH3, 3, interrupt_in = AHB_PDMA_IN_CH3, interrupt_out =
1016 AHB_PDMA_OUT_CH3, compatible = [UHCI0]), ("AHB_GDMA", DMA_CH4, 4, interrupt_in =
1017 AHB_PDMA_IN_CH4, interrupt_out = AHB_PDMA_OUT_CH4, compatible = [UHCI0]),
1018 ("AXI_GDMA", DMA_AXI_CH0, 0, interrupt_in = AXI_PDMA_IN_CH0, interrupt_out =
1019 AXI_PDMA_OUT_CH0, compatible = [SPI2, SPI3, AES, SHA]), ("AXI_GDMA", DMA_AXI_CH1,
1020 1, interrupt_in = AXI_PDMA_IN_CH1, interrupt_out = AXI_PDMA_OUT_CH1, compatible =
1021 [SPI2, SPI3, AES, SHA]), ("AXI_GDMA", DMA_AXI_CH2, 2, interrupt_in =
1022 AXI_PDMA_IN_CH2, interrupt_out = AXI_PDMA_OUT_CH2, compatible = [SPI2, SPI3, AES,
1023 SHA]))); _for_each_inner_dma_channel!((no_own_interrupt));
1024 };
1025}
1026#[macro_export]
1027#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1028macro_rules! for_each_dma_channel_peri_pair {
1029 ($($pattern:tt => $code:tt;)*) => {
1030 macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
1031 ($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
1032 DMA_CH0, UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1,
1033 UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, UHCI0));
1034 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH3, UHCI0));
1035 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH4, UHCI0));
1036 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI2));
1037 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SPI3));
1038 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, AES));
1039 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH0, SHA));
1040 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI2));
1041 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SPI3));
1042 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, AES));
1043 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH1, SHA));
1044 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI2));
1045 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SPI3));
1046 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, AES));
1047 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", DMA_AXI_CH2, SHA));
1048 _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
1049 UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1050 AxiGdmaChannel, SPI2)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA",
1051 any_channel = AxiGdmaChannel, SPI3));
1052 _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel = AxiGdmaChannel,
1053 AES)); _for_each_inner_dma_channel_peri_pair!(("AXI_GDMA", any_channel =
1054 AxiGdmaChannel, SHA));
1055 _for_each_inner_dma_channel_peri_pair!((channels("AHB_GDMA", DMA_CH0, UHCI0),
1056 ("AHB_GDMA", DMA_CH1, UHCI0), ("AHB_GDMA", DMA_CH2, UHCI0), ("AHB_GDMA", DMA_CH3,
1057 UHCI0), ("AHB_GDMA", DMA_CH4, UHCI0), ("AXI_GDMA", DMA_AXI_CH0, SPI2),
1058 ("AXI_GDMA", DMA_AXI_CH0, SPI3), ("AXI_GDMA", DMA_AXI_CH0, AES), ("AXI_GDMA",
1059 DMA_AXI_CH0, SHA), ("AXI_GDMA", DMA_AXI_CH1, SPI2), ("AXI_GDMA", DMA_AXI_CH1,
1060 SPI3), ("AXI_GDMA", DMA_AXI_CH1, AES), ("AXI_GDMA", DMA_AXI_CH1, SHA),
1061 ("AXI_GDMA", DMA_AXI_CH2, SPI2), ("AXI_GDMA", DMA_AXI_CH2, SPI3), ("AXI_GDMA",
1062 DMA_AXI_CH2, AES), ("AXI_GDMA", DMA_AXI_CH2, SHA)));
1063 _for_each_inner_dma_channel_peri_pair!((any_channels("AHB_GDMA", any_channel =
1064 AhbGdmaChannel, UHCI0), ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI2),
1065 ("AXI_GDMA", any_channel = AxiGdmaChannel, SPI3), ("AXI_GDMA", any_channel =
1066 AxiGdmaChannel, AES), ("AXI_GDMA", any_channel = AxiGdmaChannel, SHA)));
1067 };
1068}
1069#[macro_export]
1070#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1071macro_rules! for_each_mem2mem_channel {
1072 ($($pattern:tt => $code:tt;)*) => {
1073 macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
1074 tt) => {} } _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
1075 AhbGdmaChannel, DMA_CH0, 9)); _for_each_inner_mem2mem_channel!(("AXI_GDMA",
1076 AxiGdma, AxiGdmaChannel, DMA_AXI_CH0, 6));
1077 _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1078 DMA_AXI_CH1, 7)); _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma,
1079 AxiGdmaChannel, DMA_AXI_CH2, 8)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
1080 AhbGdma, AhbGdmaChannel, 0, 9)); _for_each_inner_mem2mem_channel!(("AXI_GDMA",
1081 AxiGdma, AxiGdmaChannel, 0, 6, 1, 7, 2, 8));
1082 _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel));
1083 _for_each_inner_mem2mem_channel!(("AXI_GDMA", AxiGdma, AxiGdmaChannel));
1084 _for_each_inner_mem2mem_channel!((channels("AHB_GDMA", AhbGdma, AhbGdmaChannel,
1085 DMA_CH0, 9), ("AXI_GDMA", AxiGdma, AxiGdmaChannel, DMA_AXI_CH0, 6), ("AXI_GDMA",
1086 AxiGdma, AxiGdmaChannel, DMA_AXI_CH1, 7), ("AXI_GDMA", AxiGdma, AxiGdmaChannel,
1087 DMA_AXI_CH2, 8))); _for_each_inner_mem2mem_channel!((erased("AHB_GDMA", AhbGdma,
1088 AhbGdmaChannel, 0, 9), ("AXI_GDMA", AxiGdma, AxiGdmaChannel, 0, 6, 1, 7, 2, 8)));
1089 _for_each_inner_mem2mem_channel!((engines("AHB_GDMA", AhbGdma, AhbGdmaChannel),
1090 ("AXI_GDMA", AxiGdma, AxiGdmaChannel)));
1091 };
1092}
1093#[macro_export]
1094#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1095macro_rules! with_aes_dma_engine {
1096 ($($pattern:tt => $code:tt;)*) => {
1097 macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
1098 => {} } _with_inner_aes_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1099 };
1100}
1101#[macro_export]
1102#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1103macro_rules! with_spi_master_dma_engine {
1104 ($($pattern:tt => $code:tt;)*) => {
1105 macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
1106 : tt) => {} } _with_inner_spi_master_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1107 };
1108}
1109#[macro_export]
1110#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1111macro_rules! with_spi_slave_dma_engine {
1112 ($($pattern:tt => $code:tt;)*) => {
1113 macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
1114 : tt) => {} } _with_inner_spi_slave_dma_engine!(("AXI_GDMA", AxiGdmaChannel));
1115 };
1116}
1117#[macro_export]
1118#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1119macro_rules! with_uhci_dma_engine {
1120 ($($pattern:tt => $code:tt;)*) => {
1121 macro_rules! _with_inner_uhci_dma_engine { $(($pattern) => $code;)* ($other : tt)
1122 => {} } _with_inner_uhci_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
1123 };
1124}
1125#[macro_export]
1126#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1127macro_rules! for_each_interrupt {
1128 ($($pattern:tt => $code:tt;)*) => {
1129 macro_rules! _for_each_inner_interrupt { $(($pattern) => $code;)* ($other : tt)
1130 => {} } _for_each_inner_interrupt!(([disabled 0] 0));
1131 _for_each_inner_interrupt!(([reserved 0] 1));
1132 _for_each_inner_interrupt!(([reserved 1] 2));
1133 _for_each_inner_interrupt!(([reserved 2] 3));
1134 _for_each_inner_interrupt!(([reserved 3] 4));
1135 _for_each_inner_interrupt!(([reserved 4] 5));
1136 _for_each_inner_interrupt!(([reserved 5] 6));
1137 _for_each_inner_interrupt!(([reserved 6] 7));
1138 _for_each_inner_interrupt!(([reserved 7] 8));
1139 _for_each_inner_interrupt!(([reserved 8] 9));
1140 _for_each_inner_interrupt!(([reserved 9] 10));
1141 _for_each_inner_interrupt!(([reserved 10] 11));
1142 _for_each_inner_interrupt!(([reserved 11] 12));
1143 _for_each_inner_interrupt!(([reserved 12] 13));
1144 _for_each_inner_interrupt!(([reserved 13] 14));
1145 _for_each_inner_interrupt!(([reserved 14] 15));
1146 _for_each_inner_interrupt!(([vector 0] 16)); _for_each_inner_interrupt!(([vector
1147 1] 17)); _for_each_inner_interrupt!(([vector 2] 18));
1148 _for_each_inner_interrupt!(([vector 3] 19)); _for_each_inner_interrupt!(([vector
1149 4] 20)); _for_each_inner_interrupt!(([vector 5] 21));
1150 _for_each_inner_interrupt!(([vector 6] 22)); _for_each_inner_interrupt!(([vector
1151 7] 23)); _for_each_inner_interrupt!(([direct_bindable 0] 24));
1152 _for_each_inner_interrupt!(([direct_bindable 1] 25));
1153 _for_each_inner_interrupt!(([direct_bindable 2] 26));
1154 _for_each_inner_interrupt!(([direct_bindable 3] 27));
1155 _for_each_inner_interrupt!(([direct_bindable 4] 28));
1156 _for_each_inner_interrupt!(([direct_bindable 5] 29));
1157 _for_each_inner_interrupt!(([direct_bindable 6] 30));
1158 _for_each_inner_interrupt!(([direct_bindable 7] 31));
1159 _for_each_inner_interrupt!(([direct_bindable 8] 32));
1160 _for_each_inner_interrupt!(([direct_bindable 9] 33));
1161 _for_each_inner_interrupt!(([direct_bindable 10] 34));
1162 _for_each_inner_interrupt!(([direct_bindable 11] 35));
1163 _for_each_inner_interrupt!(([direct_bindable 12] 36));
1164 _for_each_inner_interrupt!(([direct_bindable 13] 37));
1165 _for_each_inner_interrupt!(([direct_bindable 14] 38));
1166 _for_each_inner_interrupt!(([direct_bindable 15] 39));
1167 _for_each_inner_interrupt!(([direct_bindable 16] 40));
1168 _for_each_inner_interrupt!(([direct_bindable 17] 41));
1169 _for_each_inner_interrupt!(([direct_bindable 18] 42));
1170 _for_each_inner_interrupt!(([direct_bindable 19] 43));
1171 _for_each_inner_interrupt!(([direct_bindable 20] 44));
1172 _for_each_inner_interrupt!(([direct_bindable 21] 45));
1173 _for_each_inner_interrupt!(([direct_bindable 22] 46));
1174 _for_each_inner_interrupt!(([direct_bindable 23] 47));
1175 _for_each_inner_interrupt!((all([disabled 0] 0), ([reserved 0] 1), ([reserved 1]
1176 2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5), ([reserved 5] 6),
1177 ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9), ([reserved 9] 10),
1178 ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13), ([reserved 13] 14),
1179 ([reserved 14] 15), ([vector 0] 16), ([vector 1] 17), ([vector 2] 18), ([vector
1180 3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6] 22), ([vector 7] 23),
1181 ([direct_bindable 0] 24), ([direct_bindable 1] 25), ([direct_bindable 2] 26),
1182 ([direct_bindable 3] 27), ([direct_bindable 4] 28), ([direct_bindable 5] 29),
1183 ([direct_bindable 6] 30), ([direct_bindable 7] 31), ([direct_bindable 8] 32),
1184 ([direct_bindable 9] 33), ([direct_bindable 10] 34), ([direct_bindable 11] 35),
1185 ([direct_bindable 12] 36), ([direct_bindable 13] 37), ([direct_bindable 14] 38),
1186 ([direct_bindable 15] 39), ([direct_bindable 16] 40), ([direct_bindable 17] 41),
1187 ([direct_bindable 18] 42), ([direct_bindable 19] 43), ([direct_bindable 20] 44),
1188 ([direct_bindable 21] 45), ([direct_bindable 22] 46), ([direct_bindable 23]
1189 47)));
1190 };
1191}
1192#[macro_export]
1193#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1194macro_rules! for_each_classified_interrupt {
1195 ($($pattern:tt => $code:tt;)*) => {
1196 macro_rules! _for_each_inner_classified_interrupt { $(($pattern) => $code;)*
1197 ($other : tt) => {} } _for_each_inner_classified_interrupt!(([direct_bindable 0]
1198 24)); _for_each_inner_classified_interrupt!(([direct_bindable 1] 25));
1199 _for_each_inner_classified_interrupt!(([direct_bindable 2] 26));
1200 _for_each_inner_classified_interrupt!(([direct_bindable 3] 27));
1201 _for_each_inner_classified_interrupt!(([direct_bindable 4] 28));
1202 _for_each_inner_classified_interrupt!(([direct_bindable 5] 29));
1203 _for_each_inner_classified_interrupt!(([direct_bindable 6] 30));
1204 _for_each_inner_classified_interrupt!(([direct_bindable 7] 31));
1205 _for_each_inner_classified_interrupt!(([direct_bindable 8] 32));
1206 _for_each_inner_classified_interrupt!(([direct_bindable 9] 33));
1207 _for_each_inner_classified_interrupt!(([direct_bindable 10] 34));
1208 _for_each_inner_classified_interrupt!(([direct_bindable 11] 35));
1209 _for_each_inner_classified_interrupt!(([direct_bindable 12] 36));
1210 _for_each_inner_classified_interrupt!(([direct_bindable 13] 37));
1211 _for_each_inner_classified_interrupt!(([direct_bindable 14] 38));
1212 _for_each_inner_classified_interrupt!(([direct_bindable 15] 39));
1213 _for_each_inner_classified_interrupt!(([direct_bindable 16] 40));
1214 _for_each_inner_classified_interrupt!(([direct_bindable 17] 41));
1215 _for_each_inner_classified_interrupt!(([direct_bindable 18] 42));
1216 _for_each_inner_classified_interrupt!(([direct_bindable 19] 43));
1217 _for_each_inner_classified_interrupt!(([direct_bindable 20] 44));
1218 _for_each_inner_classified_interrupt!(([direct_bindable 21] 45));
1219 _for_each_inner_classified_interrupt!(([direct_bindable 22] 46));
1220 _for_each_inner_classified_interrupt!(([direct_bindable 23] 47));
1221 _for_each_inner_classified_interrupt!(([vector 0] 16));
1222 _for_each_inner_classified_interrupt!(([vector 1] 17));
1223 _for_each_inner_classified_interrupt!(([vector 2] 18));
1224 _for_each_inner_classified_interrupt!(([vector 3] 19));
1225 _for_each_inner_classified_interrupt!(([vector 4] 20));
1226 _for_each_inner_classified_interrupt!(([vector 5] 21));
1227 _for_each_inner_classified_interrupt!(([vector 6] 22));
1228 _for_each_inner_classified_interrupt!(([vector 7] 23));
1229 _for_each_inner_classified_interrupt!(([reserved 0] 1));
1230 _for_each_inner_classified_interrupt!(([reserved 1] 2));
1231 _for_each_inner_classified_interrupt!(([reserved 2] 3));
1232 _for_each_inner_classified_interrupt!(([reserved 3] 4));
1233 _for_each_inner_classified_interrupt!(([reserved 4] 5));
1234 _for_each_inner_classified_interrupt!(([reserved 5] 6));
1235 _for_each_inner_classified_interrupt!(([reserved 6] 7));
1236 _for_each_inner_classified_interrupt!(([reserved 7] 8));
1237 _for_each_inner_classified_interrupt!(([reserved 8] 9));
1238 _for_each_inner_classified_interrupt!(([reserved 9] 10));
1239 _for_each_inner_classified_interrupt!(([reserved 10] 11));
1240 _for_each_inner_classified_interrupt!(([reserved 11] 12));
1241 _for_each_inner_classified_interrupt!(([reserved 12] 13));
1242 _for_each_inner_classified_interrupt!(([reserved 13] 14));
1243 _for_each_inner_classified_interrupt!(([reserved 14] 15));
1244 _for_each_inner_classified_interrupt!((direct_bindable([direct_bindable 0] 24),
1245 ([direct_bindable 1] 25), ([direct_bindable 2] 26), ([direct_bindable 3] 27),
1246 ([direct_bindable 4] 28), ([direct_bindable 5] 29), ([direct_bindable 6] 30),
1247 ([direct_bindable 7] 31), ([direct_bindable 8] 32), ([direct_bindable 9] 33),
1248 ([direct_bindable 10] 34), ([direct_bindable 11] 35), ([direct_bindable 12] 36),
1249 ([direct_bindable 13] 37), ([direct_bindable 14] 38), ([direct_bindable 15] 39),
1250 ([direct_bindable 16] 40), ([direct_bindable 17] 41), ([direct_bindable 18] 42),
1251 ([direct_bindable 19] 43), ([direct_bindable 20] 44), ([direct_bindable 21] 45),
1252 ([direct_bindable 22] 46), ([direct_bindable 23] 47)));
1253 _for_each_inner_classified_interrupt!((vector([vector 0] 16), ([vector 1] 17),
1254 ([vector 2] 18), ([vector 3] 19), ([vector 4] 20), ([vector 5] 21), ([vector 6]
1255 22), ([vector 7] 23))); _for_each_inner_classified_interrupt!((reserved([reserved
1256 0] 1), ([reserved 1] 2), ([reserved 2] 3), ([reserved 3] 4), ([reserved 4] 5),
1257 ([reserved 5] 6), ([reserved 6] 7), ([reserved 7] 8), ([reserved 8] 9),
1258 ([reserved 9] 10), ([reserved 10] 11), ([reserved 11] 12), ([reserved 12] 13),
1259 ([reserved 13] 14), ([reserved 14] 15)));
1260 };
1261}
1262#[macro_export]
1263#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1264macro_rules! for_each_interrupt_priority {
1265 ($($pattern:tt => $code:tt;)*) => {
1266 macro_rules! _for_each_inner_interrupt_priority { $(($pattern) => $code;)*
1267 ($other : tt) => {} } _for_each_inner_interrupt_priority!((0, 1, Priority1,
1268 Level1)); _for_each_inner_interrupt_priority!((1, 2, Priority2, Level2));
1269 _for_each_inner_interrupt_priority!((2, 3, Priority3, Level3));
1270 _for_each_inner_interrupt_priority!((3, 4, Priority4, Level4));
1271 _for_each_inner_interrupt_priority!((4, 5, Priority5, Level5));
1272 _for_each_inner_interrupt_priority!((5, 6, Priority6, Level6));
1273 _for_each_inner_interrupt_priority!((6, 7, Priority7, Level7));
1274 _for_each_inner_interrupt_priority!((7, 8, Priority8, Level8));
1275 _for_each_inner_interrupt_priority!((all(0, 1, Priority1, Level1), (1, 2,
1276 Priority2, Level2), (2, 3, Priority3, Level3), (3, 4, Priority4, Level4), (4, 5,
1277 Priority5, Level5), (5, 6, Priority6, Level6), (6, 7, Priority7, Level7), (7, 8,
1278 Priority8, Level8)));
1279 };
1280}
1281#[macro_export]
1282#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1283macro_rules! for_each_sw_interrupt {
1284 ($($pattern:tt => $code:tt;)*) => {
1285 macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
1286 tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
1287 software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
1288 software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
1289 software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
1290 software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
1291 software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
1292 FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
1293 };
1294}
1295#[macro_export]
1296macro_rules! define_clock_tree_types {
1636 () => {
1637 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1638 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1639 pub enum SdmInstance {
1640 GpioSd = 0,
1641 }
1642 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1643 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1644 pub enum I2cInstance {
1645 I2c0 = 0,
1646 I2c1 = 1,
1647 }
1648 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1649 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1650 pub enum RmtInstance {
1651 Rmt = 0,
1652 }
1653 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1654 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1655 pub enum SpiInstance {
1656 Spi2 = 0,
1657 Spi3 = 1,
1658 }
1659 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1660 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1661 pub enum TimgInstance {
1662 Timg0 = 0,
1663 Timg1 = 1,
1664 }
1665 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1666 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1667 pub enum UartInstance {
1668 Uart0 = 0,
1669 Uart1 = 1,
1670 Uart2 = 2,
1671 Uart3 = 3,
1672 }
1673 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1674 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1675 pub enum PsramInstance {
1676 Psram = 0,
1677 }
1678 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1680 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1681 pub enum CpuRootClkConfig {
1682 Xtal,
1684 Cpll,
1686 RcFast,
1688 PllF240m,
1690 }
1691 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1695 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1696 pub struct CpuClkConfig {
1697 divisor: u32,
1698 }
1699 impl CpuClkConfig {
1700 pub const fn new(divisor: u32) -> Self {
1707 ::core::assert!(
1708 divisor <= 255,
1709 "`CPU_CLK` divisor must be between 0 and 255 (inclusive)."
1710 );
1711 Self { divisor }
1712 }
1713 pub(crate) fn divisor(self) -> u32 {
1714 self.divisor as u32
1715 }
1716 }
1717 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1721 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1722 pub struct AhbClkConfig {
1723 divisor: u32,
1724 }
1725 impl AhbClkConfig {
1726 pub const fn new(divisor: u32) -> Self {
1733 ::core::assert!(
1734 divisor <= 255,
1735 "`AHB_CLK` divisor must be between 0 and 255 (inclusive)."
1736 );
1737 Self { divisor }
1738 }
1739 pub(crate) fn divisor(self) -> u32 {
1740 self.divisor as u32
1741 }
1742 }
1743 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1747 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1748 pub struct ApbClkConfig {
1749 divisor: u32,
1750 }
1751 impl ApbClkConfig {
1752 pub const fn new(divisor: u32) -> Self {
1759 ::core::assert!(
1760 divisor <= 255,
1761 "`APB_CLK` divisor must be between 0 and 255 (inclusive)."
1762 );
1763 Self { divisor }
1764 }
1765 pub(crate) fn divisor(self) -> u32 {
1766 self.divisor as u32
1767 }
1768 }
1769 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1771 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1772 pub enum LpFastClkConfig {
1773 RcFast,
1775 Xtal,
1777 }
1778 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1780 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1781 pub enum LpSlowClkConfig {
1782 RcSlow,
1784 #[cfg(use_xtal32k)]
1785 Xtal32k,
1787 }
1788 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1789 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1790 pub enum IomuxFunctionClockSource {
1791 XtalClk,
1793 #[default]
1794 PllF80m,
1796 }
1797 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1801 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1802 pub struct IomuxFunctionClockConfig {
1803 source: IomuxFunctionClockSource,
1804 div_num: u32,
1805 }
1806 impl IomuxFunctionClockConfig {
1807 pub const fn new(source: IomuxFunctionClockSource, div_num: u32) -> Self {
1814 ::core::assert!(
1815 div_num <= 255,
1816 "`IOMUX_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
1817 );
1818 Self { source, div_num }
1819 }
1820 pub(crate) fn source(self) -> IomuxFunctionClockSource {
1821 self.source
1822 }
1823 pub(crate) fn div_num(self) -> u32 {
1824 self.div_num as u32
1825 }
1826 }
1827 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1829 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1830 pub enum TimgCalibrationClockConfig {
1831 RcSlowClk,
1833 RcFastDivClk,
1835 #[cfg(use_xtal32k)]
1836 Xtal32kClk,
1838 }
1839 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1840 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1841 pub enum I2cFunctionClockSclk {
1842 #[default]
1843 Xtal,
1845 RcFast,
1847 }
1848 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1852 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1853 pub struct I2cFunctionClockConfig {
1854 sclk: I2cFunctionClockSclk,
1855 div_num: u32,
1856 }
1857 impl I2cFunctionClockConfig {
1858 pub const fn new(sclk: I2cFunctionClockSclk, div_num: u32) -> Self {
1865 ::core::assert!(
1866 div_num <= 255,
1867 "`I2C0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
1868 );
1869 Self { sclk, div_num }
1870 }
1871 pub(crate) fn sclk(self) -> I2cFunctionClockSclk {
1872 self.sclk
1873 }
1874 pub(crate) fn div_num(self) -> u32 {
1875 self.div_num as u32
1876 }
1877 }
1878 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1880 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1881 pub enum RmtSclkConfig {
1882 #[default]
1883 PllF80m,
1885 RcFastClk,
1887 XtalClk,
1889 }
1890 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1892 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1893 pub enum SpiFunctionClockConfig {
1894 #[default]
1895 Bbpll,
1897 Xtal,
1899 RcFast,
1901 }
1902 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1904 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1905 pub enum TimgFunctionClockConfig {
1906 #[default]
1907 PllF80m,
1909 RcFastClk,
1911 XtalClk,
1913 }
1914 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1916 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1917 pub enum TimgWdtClockConfig {
1918 #[default]
1919 XtalClk,
1921 PllF80m,
1923 RcFastClk,
1925 }
1926 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1927 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1928 pub enum UartFunctionClockSclk {
1929 #[default]
1930 PllF80m,
1932 Xtal,
1934 RcFast,
1936 }
1937 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1941 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1942 pub struct UartFunctionClockConfig {
1943 sclk: UartFunctionClockSclk,
1944 div_num: u32,
1945 }
1946 impl UartFunctionClockConfig {
1947 pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
1954 ::core::assert!(
1955 div_num <= 255,
1956 "`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
1957 );
1958 Self { sclk, div_num }
1959 }
1960 pub(crate) fn sclk(self) -> UartFunctionClockSclk {
1961 self.sclk
1962 }
1963 pub(crate) fn div_num(self) -> u32 {
1964 self.div_num as u32
1965 }
1966 }
1967 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1972 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1973 pub struct UartBaudRateGeneratorConfig {
1974 fractional: u32,
1975 integral: u32,
1976 }
1977 impl UartBaudRateGeneratorConfig {
1978 pub const fn new(fractional: u32, integral: u32) -> Self {
1988 ::core::assert!(
1989 fractional <= 15,
1990 "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
1991 );
1992 ::core::assert!(
1993 integral <= 4095,
1994 "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
1995 );
1996 Self {
1997 fractional,
1998 integral,
1999 }
2000 }
2001 pub(crate) fn fractional(self) -> u32 {
2002 self.fractional as u32
2003 }
2004 pub(crate) fn integral(self) -> u32 {
2005 self.integral as u32
2006 }
2007 }
2008 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2010 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2011 pub enum PsramFunctionClockConfig {
2012 #[default]
2013 Xtal,
2015 Mpll,
2017 Cpll,
2019 }
2020 pub struct ClockTree {
2022 cpu_root_clk: Option<CpuRootClkConfig>,
2023 cpu_clk: Option<CpuClkConfig>,
2024 ahb_clk: Option<AhbClkConfig>,
2025 apb_clk: Option<ApbClkConfig>,
2026 lp_fast_clk: Option<LpFastClkConfig>,
2027 lp_slow_clk: Option<LpSlowClkConfig>,
2028 iomux_function_clock: Option<IomuxFunctionClockConfig>,
2029 timg_calibration_clock: Option<TimgCalibrationClockConfig>,
2030 i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
2031 rmt_sclk: [Option<RmtSclkConfig>; 1],
2032 spi_function_clock: [Option<SpiFunctionClockConfig>; 2],
2033 timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
2034 timg_wdt_clock: [Option<TimgWdtClockConfig>; 2],
2035 uart_function_clock: [Option<UartFunctionClockConfig>; 4],
2036 uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 4],
2037 psram_function_clock: [Option<PsramFunctionClockConfig>; 1],
2038 bbpll_clk_refcount: u32,
2039 cpll_clk_refcount: u32,
2040 mpll_clk_refcount: u32,
2041 rc_fast_clk_refcount: u32,
2042 #[cfg(use_xtal32k)]
2043 xtal32k_clk_refcount: u32,
2044 rc_slow_clk_refcount: u32,
2045 pll_f20m_refcount: u32,
2046 pll_f80m_refcount: u32,
2047 pll_f120m_refcount: u32,
2048 pll_f160m_refcount: u32,
2049 bbpll_d3_clock_refcount: u32,
2050 pll_f25m_refcount: u32,
2051 pll_f50m_refcount: u32,
2052 xtal_d2_clk_refcount: u32,
2053 lp_fast_clk_refcount: u32,
2054 lp_slow_clk_refcount: u32,
2055 timg_calibration_clock_refcount: u32,
2056 sdm_function_clock_refcount: [u32; 1],
2057 i2c_function_clock_refcount: [u32; 2],
2058 rmt_sclk_refcount: [u32; 1],
2059 spi_function_clock_refcount: [u32; 2],
2060 timg_function_clock_refcount: [u32; 2],
2061 timg_wdt_clock_refcount: [u32; 2],
2062 uart_function_clock_refcount: [u32; 4],
2063 uart_baud_rate_generator_refcount: [u32; 4],
2064 uart_mem_clock_refcount: [u32; 4],
2065 psram_function_clock_refcount: [u32; 1],
2066 }
2067 impl ClockTree {
2068 pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
2070 CLOCK_TREE.with(f)
2071 }
2072 pub fn cpu_root_clk(&self) -> Option<CpuRootClkConfig> {
2074 self.cpu_root_clk
2075 }
2076 pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
2078 self.cpu_clk
2079 }
2080 pub fn ahb_clk(&self) -> Option<AhbClkConfig> {
2082 self.ahb_clk
2083 }
2084 pub fn apb_clk(&self) -> Option<ApbClkConfig> {
2086 self.apb_clk
2087 }
2088 pub fn lp_fast_clk(&self) -> Option<LpFastClkConfig> {
2090 self.lp_fast_clk
2091 }
2092 pub fn lp_slow_clk(&self) -> Option<LpSlowClkConfig> {
2094 self.lp_slow_clk
2095 }
2096 pub fn iomux_function_clock(&self) -> Option<IomuxFunctionClockConfig> {
2098 self.iomux_function_clock
2099 }
2100 pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
2102 self.timg_calibration_clock
2103 }
2104 pub fn i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2106 self.i2c_function_clock[I2cInstance::I2c0 as usize]
2107 }
2108 pub fn i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
2110 self.i2c_function_clock[I2cInstance::I2c1 as usize]
2111 }
2112 pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
2114 self.rmt_sclk[RmtInstance::Rmt as usize]
2115 }
2116 pub fn spi2_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2118 self.spi_function_clock[SpiInstance::Spi2 as usize]
2119 }
2120 pub fn spi3_function_clock(&self) -> Option<SpiFunctionClockConfig> {
2122 self.spi_function_clock[SpiInstance::Spi3 as usize]
2123 }
2124 pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2126 self.timg_function_clock[TimgInstance::Timg0 as usize]
2127 }
2128 pub fn timg0_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
2130 self.timg_wdt_clock[TimgInstance::Timg0 as usize]
2131 }
2132 pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
2134 self.timg_function_clock[TimgInstance::Timg1 as usize]
2135 }
2136 pub fn timg1_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
2138 self.timg_wdt_clock[TimgInstance::Timg1 as usize]
2139 }
2140 pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
2142 self.uart_function_clock[UartInstance::Uart0 as usize]
2143 }
2144 pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2146 self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
2147 }
2148 pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
2150 self.uart_function_clock[UartInstance::Uart1 as usize]
2151 }
2152 pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2154 self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
2155 }
2156 pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
2158 self.uart_function_clock[UartInstance::Uart2 as usize]
2159 }
2160 pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2162 self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
2163 }
2164 pub fn uart3_function_clock(&self) -> Option<UartFunctionClockConfig> {
2166 self.uart_function_clock[UartInstance::Uart3 as usize]
2167 }
2168 pub fn uart3_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
2170 self.uart_baud_rate_generator[UartInstance::Uart3 as usize]
2171 }
2172 pub fn psram_function_clock(&self) -> Option<PsramFunctionClockConfig> {
2174 self.psram_function_clock[PsramInstance::Psram as usize]
2175 }
2176 }
2177 static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
2178 ::esp_sync::NonReentrantMutex::new(ClockTree {
2179 cpu_root_clk: None,
2180 cpu_clk: None,
2181 ahb_clk: None,
2182 apb_clk: None,
2183 lp_fast_clk: None,
2184 lp_slow_clk: None,
2185 iomux_function_clock: None,
2186 timg_calibration_clock: None,
2187 i2c_function_clock: [None; 2],
2188 rmt_sclk: [None; 1],
2189 spi_function_clock: [None; 2],
2190 timg_function_clock: [None; 2],
2191 timg_wdt_clock: [None; 2],
2192 uart_function_clock: [None; 4],
2193 uart_baud_rate_generator: [None; 4],
2194 psram_function_clock: [None; 1],
2195 bbpll_clk_refcount: 0,
2196 cpll_clk_refcount: 0,
2197 mpll_clk_refcount: 0,
2198 rc_fast_clk_refcount: 0,
2199 #[cfg(use_xtal32k)]
2200 xtal32k_clk_refcount: 0,
2201 rc_slow_clk_refcount: 0,
2202 pll_f20m_refcount: 0,
2203 pll_f80m_refcount: 0,
2204 pll_f120m_refcount: 0,
2205 pll_f160m_refcount: 0,
2206 bbpll_d3_clock_refcount: 0,
2207 pll_f25m_refcount: 0,
2208 pll_f50m_refcount: 0,
2209 xtal_d2_clk_refcount: 0,
2210 lp_fast_clk_refcount: 0,
2211 lp_slow_clk_refcount: 0,
2212 timg_calibration_clock_refcount: 0,
2213 sdm_function_clock_refcount: [0; 1],
2214 i2c_function_clock_refcount: [0; 2],
2215 rmt_sclk_refcount: [0; 1],
2216 spi_function_clock_refcount: [0; 2],
2217 timg_function_clock_refcount: [0; 2],
2218 timg_wdt_clock_refcount: [0; 2],
2219 uart_function_clock_refcount: [0; 4],
2220 uart_baud_rate_generator_refcount: [0; 4],
2221 uart_mem_clock_refcount: [0; 4],
2222 psram_function_clock_refcount: [0; 1],
2223 });
2224 static CPU_ROOT_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2225 ::core::sync::atomic::AtomicU32::new(0);
2226 static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2227 ::core::sync::atomic::AtomicU32::new(0);
2228 static AHB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2229 ::core::sync::atomic::AtomicU32::new(0);
2230 static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2231 ::core::sync::atomic::AtomicU32::new(0);
2232 static LP_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2233 ::core::sync::atomic::AtomicU32::new(0);
2234 static LP_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2235 ::core::sync::atomic::AtomicU32::new(0);
2236 static IOMUX_FUNCTION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2237 ::core::sync::atomic::AtomicU32::new(0);
2238 static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
2239 ::core::sync::atomic::AtomicU32::new(0);
2240 static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2241 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2242 static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2243 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2244 static SPI_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2245 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2246 static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2247 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2248 static TIMG_WDT_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
2249 [const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
2250 static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 4] =
2251 [const { ::core::sync::atomic::AtomicU32::new(0) }; 4];
2252 static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 4] =
2253 [const { ::core::sync::atomic::AtomicU32::new(0) }; 4];
2254 static PSRAM_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
2255 [const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
2256 fn request_xtal_clk(_clocks: &mut ClockTree) {}
2257 fn release_xtal_clk(_clocks: &mut ClockTree) {}
2258 pub fn xtal_clk_frequency() -> u32 {
2259 40000000
2260 }
2261 pub fn request_bbpll_clk(clocks: &mut ClockTree) {
2262 trace!("Requesting BBPLL_CLK");
2263 if increment_reference_count(&mut clocks.bbpll_clk_refcount) {
2264 trace!("Enabling BBPLL_CLK");
2265 request_xtal_clk(clocks);
2266 enable_bbpll_clk_impl(clocks, true);
2267 }
2268 }
2269 pub fn release_bbpll_clk(clocks: &mut ClockTree) {
2270 trace!("Releasing BBPLL_CLK");
2271 if decrement_reference_count(&mut clocks.bbpll_clk_refcount) {
2272 trace!("Disabling BBPLL_CLK");
2273 enable_bbpll_clk_impl(clocks, false);
2274 release_xtal_clk(clocks);
2275 }
2276 }
2277 pub fn bbpll_clk_frequency() -> u32 {
2278 (480 * 1000000)
2279 }
2280 pub fn bbpll_clk_source_frequency() -> u32 {
2281 xtal_clk_frequency()
2282 }
2283 pub fn request_cpll_clk(clocks: &mut ClockTree) {
2284 trace!("Requesting CPLL_CLK");
2285 if increment_reference_count(&mut clocks.cpll_clk_refcount) {
2286 trace!("Enabling CPLL_CLK");
2287 request_xtal_clk(clocks);
2288 enable_cpll_clk_impl(clocks, true);
2289 }
2290 }
2291 pub fn release_cpll_clk(clocks: &mut ClockTree) {
2292 trace!("Releasing CPLL_CLK");
2293 if decrement_reference_count(&mut clocks.cpll_clk_refcount) {
2294 trace!("Disabling CPLL_CLK");
2295 enable_cpll_clk_impl(clocks, false);
2296 release_xtal_clk(clocks);
2297 }
2298 }
2299 pub fn cpll_clk_frequency() -> u32 {
2300 (320 * 1000000)
2301 }
2302 pub fn cpll_clk_source_frequency() -> u32 {
2303 xtal_clk_frequency()
2304 }
2305 pub fn request_mpll_clk(clocks: &mut ClockTree) {
2306 trace!("Requesting MPLL_CLK");
2307 if increment_reference_count(&mut clocks.mpll_clk_refcount) {
2308 trace!("Enabling MPLL_CLK");
2309 request_xtal_clk(clocks);
2310 enable_mpll_clk_impl(clocks, true);
2311 }
2312 }
2313 pub fn release_mpll_clk(clocks: &mut ClockTree) {
2314 trace!("Releasing MPLL_CLK");
2315 if decrement_reference_count(&mut clocks.mpll_clk_refcount) {
2316 trace!("Disabling MPLL_CLK");
2317 enable_mpll_clk_impl(clocks, false);
2318 release_xtal_clk(clocks);
2319 }
2320 }
2321 pub fn mpll_clk_frequency() -> u32 {
2322 (500 * 1000000)
2323 }
2324 pub fn mpll_clk_source_frequency() -> u32 {
2325 xtal_clk_frequency()
2326 }
2327 pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
2328 trace!("Requesting RC_FAST_CLK");
2329 if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
2330 trace!("Enabling RC_FAST_CLK");
2331 enable_rc_fast_clk_impl(clocks, true);
2332 }
2333 }
2334 pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
2335 trace!("Releasing RC_FAST_CLK");
2336 if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
2337 trace!("Disabling RC_FAST_CLK");
2338 enable_rc_fast_clk_impl(clocks, false);
2339 }
2340 }
2341 pub fn rc_fast_clk_frequency() -> u32 {
2342 17500000
2343 }
2344 #[cfg(use_xtal32k)]
2345 pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
2346 trace!("Requesting XTAL32K_CLK");
2347 if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
2348 trace!("Enabling XTAL32K_CLK");
2349 enable_xtal32k_clk_impl(clocks, true);
2350 }
2351 }
2352 #[cfg(use_xtal32k)]
2353 pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
2354 trace!("Releasing XTAL32K_CLK");
2355 if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
2356 trace!("Disabling XTAL32K_CLK");
2357 enable_xtal32k_clk_impl(clocks, false);
2358 }
2359 }
2360 #[cfg(use_xtal32k)]
2361 pub fn xtal32k_clk_frequency() -> u32 {
2362 32768
2363 }
2364 pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
2365 trace!("Requesting RC_SLOW_CLK");
2366 if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
2367 trace!("Enabling RC_SLOW_CLK");
2368 enable_rc_slow_clk_impl(clocks, true);
2369 }
2370 }
2371 pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
2372 trace!("Releasing RC_SLOW_CLK");
2373 if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
2374 trace!("Disabling RC_SLOW_CLK");
2375 enable_rc_slow_clk_impl(clocks, false);
2376 }
2377 }
2378 pub fn rc_slow_clk_frequency() -> u32 {
2379 136000
2380 }
2381 pub fn request_pll_f20m(clocks: &mut ClockTree) {
2382 trace!("Requesting PLL_F20M");
2383 if increment_reference_count(&mut clocks.pll_f20m_refcount) {
2384 trace!("Enabling PLL_F20M");
2385 request_bbpll_clk(clocks);
2386 enable_pll_f20m_impl(clocks, true);
2387 }
2388 }
2389 pub fn release_pll_f20m(clocks: &mut ClockTree) {
2390 trace!("Releasing PLL_F20M");
2391 if decrement_reference_count(&mut clocks.pll_f20m_refcount) {
2392 trace!("Disabling PLL_F20M");
2393 enable_pll_f20m_impl(clocks, false);
2394 release_bbpll_clk(clocks);
2395 }
2396 }
2397 pub fn pll_f20m_frequency() -> u32 {
2398 (bbpll_clk_frequency() / 24)
2399 }
2400 pub fn pll_f20m_source_frequency() -> u32 {
2401 bbpll_clk_frequency()
2402 }
2403 pub fn request_pll_f80m(clocks: &mut ClockTree) {
2404 trace!("Requesting PLL_F80M");
2405 if increment_reference_count(&mut clocks.pll_f80m_refcount) {
2406 trace!("Enabling PLL_F80M");
2407 request_bbpll_clk(clocks);
2408 enable_pll_f80m_impl(clocks, true);
2409 }
2410 }
2411 pub fn release_pll_f80m(clocks: &mut ClockTree) {
2412 trace!("Releasing PLL_F80M");
2413 if decrement_reference_count(&mut clocks.pll_f80m_refcount) {
2414 trace!("Disabling PLL_F80M");
2415 enable_pll_f80m_impl(clocks, false);
2416 release_bbpll_clk(clocks);
2417 }
2418 }
2419 pub fn pll_f80m_frequency() -> u32 {
2420 (bbpll_clk_frequency() / 6)
2421 }
2422 pub fn pll_f80m_source_frequency() -> u32 {
2423 bbpll_clk_frequency()
2424 }
2425 pub fn request_pll_f120m(clocks: &mut ClockTree) {
2426 trace!("Requesting PLL_F120M");
2427 if increment_reference_count(&mut clocks.pll_f120m_refcount) {
2428 trace!("Enabling PLL_F120M");
2429 request_bbpll_clk(clocks);
2430 enable_pll_f120m_impl(clocks, true);
2431 }
2432 }
2433 pub fn release_pll_f120m(clocks: &mut ClockTree) {
2434 trace!("Releasing PLL_F120M");
2435 if decrement_reference_count(&mut clocks.pll_f120m_refcount) {
2436 trace!("Disabling PLL_F120M");
2437 enable_pll_f120m_impl(clocks, false);
2438 release_bbpll_clk(clocks);
2439 }
2440 }
2441 pub fn pll_f120m_frequency() -> u32 {
2442 (bbpll_clk_frequency() / 4)
2443 }
2444 pub fn pll_f120m_source_frequency() -> u32 {
2445 bbpll_clk_frequency()
2446 }
2447 pub fn request_pll_f160m(clocks: &mut ClockTree) {
2448 trace!("Requesting PLL_F160M");
2449 if increment_reference_count(&mut clocks.pll_f160m_refcount) {
2450 trace!("Enabling PLL_F160M");
2451 request_bbpll_clk(clocks);
2452 enable_pll_f160m_impl(clocks, true);
2453 }
2454 }
2455 pub fn release_pll_f160m(clocks: &mut ClockTree) {
2456 trace!("Releasing PLL_F160M");
2457 if decrement_reference_count(&mut clocks.pll_f160m_refcount) {
2458 trace!("Disabling PLL_F160M");
2459 enable_pll_f160m_impl(clocks, false);
2460 release_bbpll_clk(clocks);
2461 }
2462 }
2463 pub fn pll_f160m_frequency() -> u32 {
2464 (bbpll_clk_frequency() / 3)
2465 }
2466 pub fn pll_f160m_source_frequency() -> u32 {
2467 bbpll_clk_frequency()
2468 }
2469 pub fn request_pll_f240m(clocks: &mut ClockTree) {
2470 trace!("Requesting PLL_F240M");
2471 trace!("Enabling PLL_F240M");
2472 request_bbpll_clk(clocks);
2473 enable_pll_f240m_impl(clocks, true);
2474 }
2475 pub fn release_pll_f240m(clocks: &mut ClockTree) {
2476 trace!("Releasing PLL_F240M");
2477 trace!("Disabling PLL_F240M");
2478 enable_pll_f240m_impl(clocks, false);
2479 release_bbpll_clk(clocks);
2480 }
2481 pub fn pll_f240m_frequency() -> u32 {
2482 (bbpll_clk_frequency() / 2)
2483 }
2484 pub fn pll_f240m_source_frequency() -> u32 {
2485 bbpll_clk_frequency()
2486 }
2487 pub fn request_bbpll_d3_clock(clocks: &mut ClockTree) {
2488 trace!("Requesting BBPLL_D3_CLOCK");
2489 if increment_reference_count(&mut clocks.bbpll_d3_clock_refcount) {
2490 trace!("Enabling BBPLL_D3_CLOCK");
2491 request_bbpll_clk(clocks);
2492 enable_bbpll_d3_clock_impl(clocks, true);
2493 }
2494 }
2495 pub fn release_bbpll_d3_clock(clocks: &mut ClockTree) {
2496 trace!("Releasing BBPLL_D3_CLOCK");
2497 if decrement_reference_count(&mut clocks.bbpll_d3_clock_refcount) {
2498 trace!("Disabling BBPLL_D3_CLOCK");
2499 enable_bbpll_d3_clock_impl(clocks, false);
2500 release_bbpll_clk(clocks);
2501 }
2502 }
2503 pub fn bbpll_d3_clock_frequency() -> u32 {
2504 (bbpll_clk_frequency() / 3)
2505 }
2506 pub fn bbpll_d3_clock_source_frequency() -> u32 {
2507 bbpll_clk_frequency()
2508 }
2509 pub fn request_pll_f25m(clocks: &mut ClockTree) {
2510 trace!("Requesting PLL_F25M");
2511 if increment_reference_count(&mut clocks.pll_f25m_refcount) {
2512 trace!("Enabling PLL_F25M");
2513 request_mpll_clk(clocks);
2514 enable_pll_f25m_impl(clocks, true);
2515 }
2516 }
2517 pub fn release_pll_f25m(clocks: &mut ClockTree) {
2518 trace!("Releasing PLL_F25M");
2519 if decrement_reference_count(&mut clocks.pll_f25m_refcount) {
2520 trace!("Disabling PLL_F25M");
2521 enable_pll_f25m_impl(clocks, false);
2522 release_mpll_clk(clocks);
2523 }
2524 }
2525 pub fn pll_f25m_frequency() -> u32 {
2526 (mpll_clk_frequency() / 20)
2527 }
2528 pub fn pll_f25m_source_frequency() -> u32 {
2529 mpll_clk_frequency()
2530 }
2531 pub fn request_pll_f50m(clocks: &mut ClockTree) {
2532 trace!("Requesting PLL_F50M");
2533 if increment_reference_count(&mut clocks.pll_f50m_refcount) {
2534 trace!("Enabling PLL_F50M");
2535 request_mpll_clk(clocks);
2536 enable_pll_f50m_impl(clocks, true);
2537 }
2538 }
2539 pub fn release_pll_f50m(clocks: &mut ClockTree) {
2540 trace!("Releasing PLL_F50M");
2541 if decrement_reference_count(&mut clocks.pll_f50m_refcount) {
2542 trace!("Disabling PLL_F50M");
2543 enable_pll_f50m_impl(clocks, false);
2544 release_mpll_clk(clocks);
2545 }
2546 }
2547 pub fn pll_f50m_frequency() -> u32 {
2548 (mpll_clk_frequency() / 10)
2549 }
2550 pub fn pll_f50m_source_frequency() -> u32 {
2551 mpll_clk_frequency()
2552 }
2553 pub fn request_xtal_d2_clk(clocks: &mut ClockTree) {
2554 trace!("Requesting XTAL_D2_CLK");
2555 if increment_reference_count(&mut clocks.xtal_d2_clk_refcount) {
2556 trace!("Enabling XTAL_D2_CLK");
2557 request_xtal_clk(clocks);
2558 enable_xtal_d2_clk_impl(clocks, true);
2559 }
2560 }
2561 pub fn release_xtal_d2_clk(clocks: &mut ClockTree) {
2562 trace!("Releasing XTAL_D2_CLK");
2563 if decrement_reference_count(&mut clocks.xtal_d2_clk_refcount) {
2564 trace!("Disabling XTAL_D2_CLK");
2565 enable_xtal_d2_clk_impl(clocks, false);
2566 release_xtal_clk(clocks);
2567 }
2568 }
2569 pub fn xtal_d2_clk_frequency() -> u32 {
2570 (xtal_clk_frequency() / 2)
2571 }
2572 pub fn xtal_d2_clk_source_frequency() -> u32 {
2573 xtal_clk_frequency()
2574 }
2575 pub fn configure_cpu_root_clk(clocks: &mut ClockTree, new_selector: CpuRootClkConfig) {
2576 let old_selector = clocks.cpu_root_clk.replace(new_selector);
2577 refresh_cpu_root_clk_downstream(clocks);
2578 match new_selector {
2579 CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
2580 CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
2581 CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
2582 CpuRootClkConfig::PllF240m => request_pll_f240m(clocks),
2583 }
2584 configure_cpu_root_clk_impl(clocks, old_selector, new_selector);
2585 if let Some(old_selector) = old_selector {
2586 match old_selector {
2587 CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
2588 CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
2589 CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
2590 CpuRootClkConfig::PllF240m => release_pll_f240m(clocks),
2591 }
2592 }
2593 }
2594 pub fn cpu_root_clk_config(clocks: &mut ClockTree) -> Option<CpuRootClkConfig> {
2595 clocks.cpu_root_clk
2596 }
2597 pub fn request_cpu_root_clk(clocks: &mut ClockTree) {
2598 trace!("Requesting CPU_ROOT_CLK");
2599 trace!("Enabling CPU_ROOT_CLK");
2600 match unwrap!(clocks.cpu_root_clk) {
2601 CpuRootClkConfig::Xtal => request_xtal_clk(clocks),
2602 CpuRootClkConfig::Cpll => request_cpll_clk(clocks),
2603 CpuRootClkConfig::RcFast => request_rc_fast_clk(clocks),
2604 CpuRootClkConfig::PllF240m => request_pll_f240m(clocks),
2605 }
2606 enable_cpu_root_clk_impl(clocks, true);
2607 }
2608 pub fn release_cpu_root_clk(clocks: &mut ClockTree) {
2609 trace!("Releasing CPU_ROOT_CLK");
2610 trace!("Disabling CPU_ROOT_CLK");
2611 enable_cpu_root_clk_impl(clocks, false);
2612 match unwrap!(clocks.cpu_root_clk) {
2613 CpuRootClkConfig::Xtal => release_xtal_clk(clocks),
2614 CpuRootClkConfig::Cpll => release_cpll_clk(clocks),
2615 CpuRootClkConfig::RcFast => release_rc_fast_clk(clocks),
2616 CpuRootClkConfig::PllF240m => release_pll_f240m(clocks),
2617 }
2618 }
2619 #[allow(unused_variables)]
2620 pub fn cpu_root_clk_config_frequency(
2621 clocks: &mut ClockTree,
2622 config: CpuRootClkConfig,
2623 ) -> u32 {
2624 match config {
2625 CpuRootClkConfig::Xtal => xtal_clk_frequency(),
2626 CpuRootClkConfig::Cpll => cpll_clk_frequency(),
2627 CpuRootClkConfig::RcFast => rc_fast_clk_frequency(),
2628 CpuRootClkConfig::PllF240m => pll_f240m_frequency(),
2629 }
2630 }
2631 pub fn cpu_root_clk_frequency() -> u32 {
2632 CPU_ROOT_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2633 }
2634 pub fn cpu_root_clk_source_frequency(source: CpuRootClkConfig) -> u32 {
2635 match source {
2636 CpuRootClkConfig::Xtal => xtal_clk_frequency(),
2637 CpuRootClkConfig::Cpll => cpll_clk_frequency(),
2638 CpuRootClkConfig::RcFast => rc_fast_clk_frequency(),
2639 CpuRootClkConfig::PllF240m => pll_f240m_frequency(),
2640 }
2641 }
2642 pub fn configure_cpu_clk(clocks: &mut ClockTree, config: CpuClkConfig) {
2643 let old_config = clocks.cpu_clk.replace(config);
2644 refresh_cpu_clk_downstream(clocks);
2645 configure_cpu_clk_impl(clocks, old_config, config);
2646 }
2647 pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
2648 clocks.cpu_clk
2649 }
2650 pub fn request_cpu_clk(clocks: &mut ClockTree) {
2651 trace!("Requesting CPU_CLK");
2652 trace!("Enabling CPU_CLK");
2653 request_cpu_root_clk(clocks);
2654 enable_cpu_clk_impl(clocks, true);
2655 }
2656 pub fn release_cpu_clk(clocks: &mut ClockTree) {
2657 trace!("Releasing CPU_CLK");
2658 trace!("Disabling CPU_CLK");
2659 enable_cpu_clk_impl(clocks, false);
2660 release_cpu_root_clk(clocks);
2661 }
2662 #[allow(unused_variables)]
2663 pub fn cpu_clk_config_frequency(clocks: &mut ClockTree, config: CpuClkConfig) -> u32 {
2664 (cpu_root_clk_frequency() / (config.divisor() + 1))
2665 }
2666 pub fn cpu_clk_frequency() -> u32 {
2667 CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2668 }
2669 pub fn cpu_clk_source_frequency() -> u32 {
2670 cpu_root_clk_frequency()
2671 }
2672 pub fn configure_ahb_clk(clocks: &mut ClockTree, config: AhbClkConfig) {
2673 let old_config = clocks.ahb_clk.replace(config);
2674 refresh_ahb_clk_downstream(clocks);
2675 configure_ahb_clk_impl(clocks, old_config, config);
2676 }
2677 pub fn ahb_clk_config(clocks: &mut ClockTree) -> Option<AhbClkConfig> {
2678 clocks.ahb_clk
2679 }
2680 pub fn request_ahb_clk(clocks: &mut ClockTree) {
2681 trace!("Requesting AHB_CLK");
2682 trace!("Enabling AHB_CLK");
2683 request_cpu_clk(clocks);
2684 enable_ahb_clk_impl(clocks, true);
2685 }
2686 pub fn release_ahb_clk(clocks: &mut ClockTree) {
2687 trace!("Releasing AHB_CLK");
2688 trace!("Disabling AHB_CLK");
2689 enable_ahb_clk_impl(clocks, false);
2690 release_cpu_clk(clocks);
2691 }
2692 #[allow(unused_variables)]
2693 pub fn ahb_clk_config_frequency(clocks: &mut ClockTree, config: AhbClkConfig) -> u32 {
2694 (cpu_clk_frequency() / (config.divisor() + 1))
2695 }
2696 pub fn ahb_clk_frequency() -> u32 {
2697 AHB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2698 }
2699 pub fn ahb_clk_source_frequency() -> u32 {
2700 cpu_clk_frequency()
2701 }
2702 pub fn configure_apb_clk(clocks: &mut ClockTree, config: ApbClkConfig) {
2703 let old_config = clocks.apb_clk.replace(config);
2704 refresh_apb_clk_downstream(clocks);
2705 configure_apb_clk_impl(clocks, old_config, config);
2706 }
2707 pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
2708 clocks.apb_clk
2709 }
2710 fn request_apb_clk(_clocks: &mut ClockTree) {}
2711 fn release_apb_clk(_clocks: &mut ClockTree) {}
2712 #[allow(unused_variables)]
2713 pub fn apb_clk_config_frequency(clocks: &mut ClockTree, config: ApbClkConfig) -> u32 {
2714 (ahb_clk_frequency() / (config.divisor() + 1))
2715 }
2716 pub fn apb_clk_frequency() -> u32 {
2717 APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2718 }
2719 pub fn apb_clk_source_frequency() -> u32 {
2720 ahb_clk_frequency()
2721 }
2722 pub fn configure_lp_fast_clk(clocks: &mut ClockTree, new_selector: LpFastClkConfig) {
2723 let old_selector = clocks.lp_fast_clk.replace(new_selector);
2724 refresh_lp_fast_clk_downstream(clocks);
2725 if clocks.lp_fast_clk_refcount > 0 {
2726 match new_selector {
2727 LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
2728 LpFastClkConfig::Xtal => request_xtal_clk(clocks),
2729 }
2730 configure_lp_fast_clk_impl(clocks, old_selector, new_selector);
2731 if let Some(old_selector) = old_selector {
2732 match old_selector {
2733 LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
2734 LpFastClkConfig::Xtal => release_xtal_clk(clocks),
2735 }
2736 }
2737 } else {
2738 configure_lp_fast_clk_impl(clocks, old_selector, new_selector);
2739 }
2740 }
2741 pub fn lp_fast_clk_config(clocks: &mut ClockTree) -> Option<LpFastClkConfig> {
2742 clocks.lp_fast_clk
2743 }
2744 pub fn request_lp_fast_clk(clocks: &mut ClockTree) {
2745 trace!("Requesting LP_FAST_CLK");
2746 if increment_reference_count(&mut clocks.lp_fast_clk_refcount) {
2747 trace!("Enabling LP_FAST_CLK");
2748 match unwrap!(clocks.lp_fast_clk) {
2749 LpFastClkConfig::RcFast => request_rc_fast_clk(clocks),
2750 LpFastClkConfig::Xtal => request_xtal_clk(clocks),
2751 }
2752 enable_lp_fast_clk_impl(clocks, true);
2753 }
2754 }
2755 pub fn release_lp_fast_clk(clocks: &mut ClockTree) {
2756 trace!("Releasing LP_FAST_CLK");
2757 if decrement_reference_count(&mut clocks.lp_fast_clk_refcount) {
2758 trace!("Disabling LP_FAST_CLK");
2759 enable_lp_fast_clk_impl(clocks, false);
2760 match unwrap!(clocks.lp_fast_clk) {
2761 LpFastClkConfig::RcFast => release_rc_fast_clk(clocks),
2762 LpFastClkConfig::Xtal => release_xtal_clk(clocks),
2763 }
2764 }
2765 }
2766 #[allow(unused_variables)]
2767 pub fn lp_fast_clk_config_frequency(
2768 clocks: &mut ClockTree,
2769 config: LpFastClkConfig,
2770 ) -> u32 {
2771 match config {
2772 LpFastClkConfig::RcFast => rc_fast_clk_frequency(),
2773 LpFastClkConfig::Xtal => xtal_clk_frequency(),
2774 }
2775 }
2776 pub fn lp_fast_clk_frequency() -> u32 {
2777 LP_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2778 }
2779 pub fn lp_fast_clk_source_frequency(source: LpFastClkConfig) -> u32 {
2780 match source {
2781 LpFastClkConfig::RcFast => rc_fast_clk_frequency(),
2782 LpFastClkConfig::Xtal => xtal_clk_frequency(),
2783 }
2784 }
2785 pub fn configure_lp_slow_clk(clocks: &mut ClockTree, new_selector: LpSlowClkConfig) {
2786 let old_selector = clocks.lp_slow_clk.replace(new_selector);
2787 refresh_lp_slow_clk_downstream(clocks);
2788 if clocks.lp_slow_clk_refcount > 0 {
2789 match new_selector {
2790 LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
2791 #[cfg(use_xtal32k)]
2792 LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2793 }
2794 configure_lp_slow_clk_impl(clocks, old_selector, new_selector);
2795 if let Some(old_selector) = old_selector {
2796 match old_selector {
2797 LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
2798 #[cfg(use_xtal32k)]
2799 LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2800 }
2801 }
2802 } else {
2803 configure_lp_slow_clk_impl(clocks, old_selector, new_selector);
2804 }
2805 }
2806 pub fn lp_slow_clk_config(clocks: &mut ClockTree) -> Option<LpSlowClkConfig> {
2807 clocks.lp_slow_clk
2808 }
2809 pub fn request_lp_slow_clk(clocks: &mut ClockTree) {
2810 trace!("Requesting LP_SLOW_CLK");
2811 if increment_reference_count(&mut clocks.lp_slow_clk_refcount) {
2812 trace!("Enabling LP_SLOW_CLK");
2813 match unwrap!(clocks.lp_slow_clk) {
2814 LpSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
2815 #[cfg(use_xtal32k)]
2816 LpSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2817 }
2818 enable_lp_slow_clk_impl(clocks, true);
2819 }
2820 }
2821 pub fn release_lp_slow_clk(clocks: &mut ClockTree) {
2822 trace!("Releasing LP_SLOW_CLK");
2823 if decrement_reference_count(&mut clocks.lp_slow_clk_refcount) {
2824 trace!("Disabling LP_SLOW_CLK");
2825 enable_lp_slow_clk_impl(clocks, false);
2826 match unwrap!(clocks.lp_slow_clk) {
2827 LpSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
2828 #[cfg(use_xtal32k)]
2829 LpSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2830 }
2831 }
2832 }
2833 #[allow(unused_variables)]
2834 pub fn lp_slow_clk_config_frequency(
2835 clocks: &mut ClockTree,
2836 config: LpSlowClkConfig,
2837 ) -> u32 {
2838 match config {
2839 LpSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
2840 #[cfg(use_xtal32k)]
2841 LpSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
2842 }
2843 }
2844 pub fn lp_slow_clk_frequency() -> u32 {
2845 LP_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2846 }
2847 pub fn lp_slow_clk_source_frequency(source: LpSlowClkConfig) -> u32 {
2848 match source {
2849 LpSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
2850 #[cfg(use_xtal32k)]
2851 LpSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
2852 }
2853 }
2854 pub fn configure_iomux_function_clock(
2855 clocks: &mut ClockTree,
2856 config: IomuxFunctionClockConfig,
2857 ) {
2858 let old_config = clocks.iomux_function_clock.replace(config);
2859 refresh_iomux_function_clock_downstream(clocks);
2860 match config.source {
2861 IomuxFunctionClockSource::XtalClk => request_xtal_clk(clocks),
2862 IomuxFunctionClockSource::PllF80m => request_pll_f80m(clocks),
2863 }
2864 configure_iomux_function_clock_impl(clocks, old_config, config);
2865 if let Some(old_config) = old_config {
2866 match old_config.source {
2867 IomuxFunctionClockSource::XtalClk => release_xtal_clk(clocks),
2868 IomuxFunctionClockSource::PllF80m => release_pll_f80m(clocks),
2869 }
2870 }
2871 }
2872 pub fn iomux_function_clock_config(
2873 clocks: &mut ClockTree,
2874 ) -> Option<IomuxFunctionClockConfig> {
2875 clocks.iomux_function_clock
2876 }
2877 fn request_iomux_function_clock(_clocks: &mut ClockTree) {}
2878 fn release_iomux_function_clock(_clocks: &mut ClockTree) {}
2879 #[allow(unused_variables)]
2880 pub fn iomux_function_clock_config_frequency(
2881 clocks: &mut ClockTree,
2882 config: IomuxFunctionClockConfig,
2883 ) -> u32 {
2884 (match config.source {
2885 IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
2886 IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
2887 } / (config.div_num() + 1))
2888 }
2889 pub fn iomux_function_clock_frequency() -> u32 {
2890 IOMUX_FUNCTION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2891 }
2892 pub fn iomux_function_clock_source_frequency(source: IomuxFunctionClockSource) -> u32 {
2893 match source {
2894 IomuxFunctionClockSource::XtalClk => xtal_clk_frequency(),
2895 IomuxFunctionClockSource::PllF80m => pll_f80m_frequency(),
2896 }
2897 }
2898 pub fn configure_timg_calibration_clock(
2899 clocks: &mut ClockTree,
2900 new_selector: TimgCalibrationClockConfig,
2901 ) {
2902 let old_selector = clocks.timg_calibration_clock.replace(new_selector);
2903 refresh_timg_calibration_clock_downstream(clocks);
2904 if clocks.timg_calibration_clock_refcount > 0 {
2905 match new_selector {
2906 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
2907 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
2908 #[cfg(use_xtal32k)]
2909 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
2910 }
2911 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
2912 if let Some(old_selector) = old_selector {
2913 match old_selector {
2914 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
2915 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
2916 #[cfg(use_xtal32k)]
2917 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
2918 }
2919 }
2920 } else {
2921 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
2922 }
2923 }
2924 pub fn timg_calibration_clock_config(
2925 clocks: &mut ClockTree,
2926 ) -> Option<TimgCalibrationClockConfig> {
2927 clocks.timg_calibration_clock
2928 }
2929 pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
2930 trace!("Requesting TIMG_CALIBRATION_CLOCK");
2931 if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
2932 trace!("Enabling TIMG_CALIBRATION_CLOCK");
2933 crate::rtc_cntl::WakeLock::acquire();
2934 match unwrap!(clocks.timg_calibration_clock) {
2935 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
2936 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_clk(clocks),
2937 #[cfg(use_xtal32k)]
2938 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
2939 }
2940 enable_timg_calibration_clock_impl(clocks, true);
2941 }
2942 }
2943 pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
2944 trace!("Releasing TIMG_CALIBRATION_CLOCK");
2945 if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
2946 trace!("Disabling TIMG_CALIBRATION_CLOCK");
2947 crate::rtc_cntl::WakeLock::release();
2948 enable_timg_calibration_clock_impl(clocks, false);
2949 match unwrap!(clocks.timg_calibration_clock) {
2950 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
2951 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_clk(clocks),
2952 #[cfg(use_xtal32k)]
2953 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
2954 }
2955 }
2956 }
2957 #[allow(unused_variables)]
2958 pub fn timg_calibration_clock_config_frequency(
2959 clocks: &mut ClockTree,
2960 config: TimgCalibrationClockConfig,
2961 ) -> u32 {
2962 match config {
2963 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
2964 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_frequency(),
2965 #[cfg(use_xtal32k)]
2966 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
2967 }
2968 }
2969 pub fn timg_calibration_clock_frequency() -> u32 {
2970 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
2971 }
2972 pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
2973 match source {
2974 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
2975 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_clk_frequency(),
2976 #[cfg(use_xtal32k)]
2977 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
2978 }
2979 }
2980 impl SdmInstance {
2981 pub fn request_function_clock(self, clocks: &mut ClockTree) {
2982 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
2983 if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
2984 {
2985 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
2986 request_iomux_function_clock(clocks);
2987 self.enable_function_clock_impl(clocks, true);
2988 }
2989 }
2990 pub fn release_function_clock(self, clocks: &mut ClockTree) {
2991 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
2992 if decrement_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
2993 {
2994 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
2995 self.enable_function_clock_impl(clocks, false);
2996 release_iomux_function_clock(clocks);
2997 }
2998 }
2999 pub fn function_clock_frequency(self) -> u32 {
3000 iomux_function_clock_frequency()
3001 }
3002 pub fn function_clock_source_frequency() -> u32 {
3003 iomux_function_clock_frequency()
3004 }
3005 }
3006 impl I2cInstance {
3007 pub fn configure_function_clock(
3008 self,
3009 clocks: &mut ClockTree,
3010 config: I2cFunctionClockConfig,
3011 ) {
3012 let old_config = clocks.i2c_function_clock[self as usize].replace(config);
3013 refresh_i2c_function_clock_downstream(clocks, self);
3014 if clocks.i2c_function_clock_refcount[self as usize] > 0 {
3015 match config.sclk {
3016 I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3017 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3018 }
3019 self.configure_function_clock_impl(clocks, old_config, config);
3020 if let Some(old_config) = old_config {
3021 match old_config.sclk {
3022 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3023 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3024 }
3025 }
3026 } else {
3027 self.configure_function_clock_impl(clocks, old_config, config);
3028 }
3029 }
3030 pub fn function_clock_config(
3031 self,
3032 clocks: &mut ClockTree,
3033 ) -> Option<I2cFunctionClockConfig> {
3034 clocks.i2c_function_clock[self as usize]
3035 }
3036 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3037 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3038 if increment_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3039 {
3040 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3041 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3042 I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3043 I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3044 }
3045 self.enable_function_clock_impl(clocks, true);
3046 }
3047 }
3048 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3049 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3050 if decrement_reference_count(&mut clocks.i2c_function_clock_refcount[self as usize])
3051 {
3052 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3053 self.enable_function_clock_impl(clocks, false);
3054 match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
3055 I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3056 I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3057 }
3058 }
3059 }
3060 #[allow(unused_variables)]
3061 pub fn function_clock_config_frequency(
3062 clocks: &mut ClockTree,
3063 config: I2cFunctionClockConfig,
3064 ) -> u32 {
3065 (match config.sclk {
3066 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3067 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3068 } / (config.div_num() + 1))
3069 }
3070 pub fn function_clock_frequency(self) -> u32 {
3071 I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3072 .load(::core::sync::atomic::Ordering::Acquire)
3073 }
3074 pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
3075 match sclk {
3076 I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
3077 I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3078 }
3079 }
3080 }
3081 impl RmtInstance {
3082 pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
3083 let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
3084 refresh_rmt_sclk_downstream(clocks, self);
3085 if clocks.rmt_sclk_refcount[self as usize] > 0 {
3086 match new_selector {
3087 RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
3088 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
3089 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
3090 }
3091 self.configure_sclk_impl(clocks, old_selector, new_selector);
3092 if let Some(old_selector) = old_selector {
3093 match old_selector {
3094 RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
3095 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
3096 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
3097 }
3098 }
3099 } else {
3100 self.configure_sclk_impl(clocks, old_selector, new_selector);
3101 }
3102 }
3103 pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
3104 clocks.rmt_sclk[self as usize]
3105 }
3106 pub fn request_sclk(self, clocks: &mut ClockTree) {
3107 trace!("Requesting {:?}::SCLK", self);
3108 if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3109 trace!("Enabling {:?}::SCLK", self);
3110 crate::rtc_cntl::WakeLock::acquire();
3111 match unwrap!(clocks.rmt_sclk[self as usize]) {
3112 RmtSclkConfig::PllF80m => request_pll_f80m(clocks),
3113 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
3114 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
3115 }
3116 self.enable_sclk_impl(clocks, true);
3117 }
3118 }
3119 pub fn release_sclk(self, clocks: &mut ClockTree) {
3120 trace!("Releasing {:?}::SCLK", self);
3121 if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
3122 trace!("Disabling {:?}::SCLK", self);
3123 crate::rtc_cntl::WakeLock::release();
3124 self.enable_sclk_impl(clocks, false);
3125 match unwrap!(clocks.rmt_sclk[self as usize]) {
3126 RmtSclkConfig::PllF80m => release_pll_f80m(clocks),
3127 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
3128 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
3129 }
3130 }
3131 }
3132 #[allow(unused_variables)]
3133 pub fn sclk_config_frequency(clocks: &mut ClockTree, config: RmtSclkConfig) -> u32 {
3134 match config {
3135 RmtSclkConfig::PllF80m => pll_f80m_frequency(),
3136 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
3137 RmtSclkConfig::XtalClk => xtal_clk_frequency(),
3138 }
3139 }
3140 pub fn sclk_frequency(self) -> u32 {
3141 RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
3142 }
3143 pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
3144 match source {
3145 RmtSclkConfig::PllF80m => pll_f80m_frequency(),
3146 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
3147 RmtSclkConfig::XtalClk => xtal_clk_frequency(),
3148 }
3149 }
3150 }
3151 impl SpiInstance {
3152 pub fn configure_function_clock(
3153 self,
3154 clocks: &mut ClockTree,
3155 new_selector: SpiFunctionClockConfig,
3156 ) {
3157 let old_selector = clocks.spi_function_clock[self as usize].replace(new_selector);
3158 refresh_spi_function_clock_downstream(clocks, self);
3159 if clocks.spi_function_clock_refcount[self as usize] > 0 {
3160 match new_selector {
3161 SpiFunctionClockConfig::Bbpll => request_bbpll_d3_clock(clocks),
3162 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
3163 SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
3164 }
3165 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3166 if let Some(old_selector) = old_selector {
3167 match old_selector {
3168 SpiFunctionClockConfig::Bbpll => release_bbpll_d3_clock(clocks),
3169 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
3170 SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
3171 }
3172 }
3173 } else {
3174 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3175 }
3176 }
3177 pub fn function_clock_config(
3178 self,
3179 clocks: &mut ClockTree,
3180 ) -> Option<SpiFunctionClockConfig> {
3181 clocks.spi_function_clock[self as usize]
3182 }
3183 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3184 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3185 if increment_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3186 {
3187 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3188 match unwrap!(clocks.spi_function_clock[self as usize]) {
3189 SpiFunctionClockConfig::Bbpll => request_bbpll_d3_clock(clocks),
3190 SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
3191 SpiFunctionClockConfig::RcFast => request_rc_fast_clk(clocks),
3192 }
3193 self.enable_function_clock_impl(clocks, true);
3194 }
3195 }
3196 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3197 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3198 if decrement_reference_count(&mut clocks.spi_function_clock_refcount[self as usize])
3199 {
3200 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3201 self.enable_function_clock_impl(clocks, false);
3202 match unwrap!(clocks.spi_function_clock[self as usize]) {
3203 SpiFunctionClockConfig::Bbpll => release_bbpll_d3_clock(clocks),
3204 SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
3205 SpiFunctionClockConfig::RcFast => release_rc_fast_clk(clocks),
3206 }
3207 }
3208 }
3209 #[allow(unused_variables)]
3210 pub fn function_clock_config_frequency(
3211 clocks: &mut ClockTree,
3212 config: SpiFunctionClockConfig,
3213 ) -> u32 {
3214 match config {
3215 SpiFunctionClockConfig::Bbpll => bbpll_d3_clock_frequency(),
3216 SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
3217 SpiFunctionClockConfig::RcFast => rc_fast_clk_frequency(),
3218 }
3219 }
3220 pub fn function_clock_frequency(self) -> u32 {
3221 SPI_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3222 .load(::core::sync::atomic::Ordering::Acquire)
3223 }
3224 pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
3225 match source {
3226 SpiFunctionClockConfig::Bbpll => bbpll_d3_clock_frequency(),
3227 SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
3228 SpiFunctionClockConfig::RcFast => rc_fast_clk_frequency(),
3229 }
3230 }
3231 }
3232 impl TimgInstance {
3233 pub fn configure_function_clock(
3234 self,
3235 clocks: &mut ClockTree,
3236 new_selector: TimgFunctionClockConfig,
3237 ) {
3238 let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
3239 refresh_timg_function_clock_downstream(clocks, self);
3240 if clocks.timg_function_clock_refcount[self as usize] > 0 {
3241 match new_selector {
3242 TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
3243 TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
3244 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
3245 }
3246 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3247 if let Some(old_selector) = old_selector {
3248 match old_selector {
3249 TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
3250 TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
3251 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
3252 }
3253 }
3254 } else {
3255 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3256 }
3257 }
3258 pub fn function_clock_config(
3259 self,
3260 clocks: &mut ClockTree,
3261 ) -> Option<TimgFunctionClockConfig> {
3262 clocks.timg_function_clock[self as usize]
3263 }
3264 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3265 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3266 if increment_reference_count(
3267 &mut clocks.timg_function_clock_refcount[self as usize],
3268 ) {
3269 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3270 match unwrap!(clocks.timg_function_clock[self as usize]) {
3271 TimgFunctionClockConfig::PllF80m => request_pll_f80m(clocks),
3272 TimgFunctionClockConfig::RcFastClk => request_rc_fast_clk(clocks),
3273 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
3274 }
3275 self.enable_function_clock_impl(clocks, true);
3276 }
3277 }
3278 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3279 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3280 if decrement_reference_count(
3281 &mut clocks.timg_function_clock_refcount[self as usize],
3282 ) {
3283 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3284 self.enable_function_clock_impl(clocks, false);
3285 match unwrap!(clocks.timg_function_clock[self as usize]) {
3286 TimgFunctionClockConfig::PllF80m => release_pll_f80m(clocks),
3287 TimgFunctionClockConfig::RcFastClk => release_rc_fast_clk(clocks),
3288 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
3289 }
3290 }
3291 }
3292 #[allow(unused_variables)]
3293 pub fn function_clock_config_frequency(
3294 clocks: &mut ClockTree,
3295 config: TimgFunctionClockConfig,
3296 ) -> u32 {
3297 match config {
3298 TimgFunctionClockConfig::PllF80m => pll_f80m_frequency(),
3299 TimgFunctionClockConfig::RcFastClk => rc_fast_clk_frequency(),
3300 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
3301 }
3302 }
3303 pub fn function_clock_frequency(self) -> u32 {
3304 TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3305 .load(::core::sync::atomic::Ordering::Acquire)
3306 }
3307 pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
3308 match source {
3309 TimgFunctionClockConfig::PllF80m => pll_f80m_frequency(),
3310 TimgFunctionClockConfig::RcFastClk => rc_fast_clk_frequency(),
3311 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
3312 }
3313 }
3314 pub fn configure_wdt_clock(
3315 self,
3316 clocks: &mut ClockTree,
3317 new_selector: TimgWdtClockConfig,
3318 ) {
3319 let old_selector = clocks.timg_wdt_clock[self as usize].replace(new_selector);
3320 refresh_timg_wdt_clock_downstream(clocks, self);
3321 if clocks.timg_wdt_clock_refcount[self as usize] > 0 {
3322 match new_selector {
3323 TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
3324 TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
3325 TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
3326 }
3327 self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
3328 if let Some(old_selector) = old_selector {
3329 match old_selector {
3330 TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
3331 TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
3332 TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
3333 }
3334 }
3335 } else {
3336 self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
3337 }
3338 }
3339 pub fn wdt_clock_config(self, clocks: &mut ClockTree) -> Option<TimgWdtClockConfig> {
3340 clocks.timg_wdt_clock[self as usize]
3341 }
3342 pub fn request_wdt_clock(self, clocks: &mut ClockTree) {
3343 trace!("Requesting {:?}::WDT_CLOCK", self);
3344 if increment_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
3345 trace!("Enabling {:?}::WDT_CLOCK", self);
3346 match unwrap!(clocks.timg_wdt_clock[self as usize]) {
3347 TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
3348 TimgWdtClockConfig::PllF80m => request_pll_f80m(clocks),
3349 TimgWdtClockConfig::RcFastClk => request_rc_fast_clk(clocks),
3350 }
3351 self.enable_wdt_clock_impl(clocks, true);
3352 }
3353 }
3354 pub fn release_wdt_clock(self, clocks: &mut ClockTree) {
3355 trace!("Releasing {:?}::WDT_CLOCK", self);
3356 if decrement_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
3357 trace!("Disabling {:?}::WDT_CLOCK", self);
3358 self.enable_wdt_clock_impl(clocks, false);
3359 match unwrap!(clocks.timg_wdt_clock[self as usize]) {
3360 TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
3361 TimgWdtClockConfig::PllF80m => release_pll_f80m(clocks),
3362 TimgWdtClockConfig::RcFastClk => release_rc_fast_clk(clocks),
3363 }
3364 }
3365 }
3366 #[allow(unused_variables)]
3367 pub fn wdt_clock_config_frequency(
3368 clocks: &mut ClockTree,
3369 config: TimgWdtClockConfig,
3370 ) -> u32 {
3371 match config {
3372 TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
3373 TimgWdtClockConfig::PllF80m => pll_f80m_frequency(),
3374 TimgWdtClockConfig::RcFastClk => rc_fast_clk_frequency(),
3375 }
3376 }
3377 pub fn wdt_clock_frequency(self) -> u32 {
3378 TIMG_WDT_CLOCK_FREQ_CACHE[self as usize]
3379 .load(::core::sync::atomic::Ordering::Acquire)
3380 }
3381 pub fn wdt_clock_source_frequency(source: TimgWdtClockConfig) -> u32 {
3382 match source {
3383 TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
3384 TimgWdtClockConfig::PllF80m => pll_f80m_frequency(),
3385 TimgWdtClockConfig::RcFastClk => rc_fast_clk_frequency(),
3386 }
3387 }
3388 }
3389 impl UartInstance {
3390 pub fn configure_function_clock(
3391 self,
3392 clocks: &mut ClockTree,
3393 config: UartFunctionClockConfig,
3394 ) {
3395 let old_config = clocks.uart_function_clock[self as usize].replace(config);
3396 refresh_uart_function_clock_downstream(clocks, self);
3397 if clocks.uart_function_clock_refcount[self as usize] > 0 {
3398 match config.sclk {
3399 UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
3400 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3401 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3402 }
3403 self.configure_function_clock_impl(clocks, old_config, config);
3404 if let Some(old_config) = old_config {
3405 match old_config.sclk {
3406 UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
3407 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3408 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3409 }
3410 }
3411 } else {
3412 self.configure_function_clock_impl(clocks, old_config, config);
3413 }
3414 }
3415 pub fn function_clock_config(
3416 self,
3417 clocks: &mut ClockTree,
3418 ) -> Option<UartFunctionClockConfig> {
3419 clocks.uart_function_clock[self as usize]
3420 }
3421 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3422 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3423 if increment_reference_count(
3424 &mut clocks.uart_function_clock_refcount[self as usize],
3425 ) {
3426 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3427 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3428 UartFunctionClockSclk::PllF80m => request_pll_f80m(clocks),
3429 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
3430 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
3431 }
3432 self.enable_function_clock_impl(clocks, true);
3433 }
3434 }
3435 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3436 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3437 if decrement_reference_count(
3438 &mut clocks.uart_function_clock_refcount[self as usize],
3439 ) {
3440 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3441 self.enable_function_clock_impl(clocks, false);
3442 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
3443 UartFunctionClockSclk::PllF80m => release_pll_f80m(clocks),
3444 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
3445 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
3446 }
3447 }
3448 }
3449 #[allow(unused_variables)]
3450 pub fn function_clock_config_frequency(
3451 clocks: &mut ClockTree,
3452 config: UartFunctionClockConfig,
3453 ) -> u32 {
3454 (match config.sclk {
3455 UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
3456 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
3457 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3458 } / (config.div_num() + 1))
3459 }
3460 pub fn function_clock_frequency(self) -> u32 {
3461 UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3462 .load(::core::sync::atomic::Ordering::Acquire)
3463 }
3464 pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
3465 match sclk {
3466 UartFunctionClockSclk::PllF80m => pll_f80m_frequency(),
3467 UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
3468 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
3469 }
3470 }
3471 pub fn configure_baud_rate_generator(
3472 self,
3473 clocks: &mut ClockTree,
3474 config: UartBaudRateGeneratorConfig,
3475 ) {
3476 let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
3477 refresh_uart_baud_rate_generator_downstream(clocks, self);
3478 self.configure_baud_rate_generator_impl(clocks, old_config, config);
3479 }
3480 pub fn baud_rate_generator_config(
3481 self,
3482 clocks: &mut ClockTree,
3483 ) -> Option<UartBaudRateGeneratorConfig> {
3484 clocks.uart_baud_rate_generator[self as usize]
3485 }
3486 pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
3487 trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
3488 if increment_reference_count(
3489 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3490 ) {
3491 trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
3492 self.request_function_clock(clocks);
3493 self.enable_baud_rate_generator_impl(clocks, true);
3494 }
3495 }
3496 pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
3497 trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
3498 if decrement_reference_count(
3499 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
3500 ) {
3501 trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
3502 self.enable_baud_rate_generator_impl(clocks, false);
3503 self.release_function_clock(clocks);
3504 }
3505 }
3506 #[allow(unused_variables)]
3507 pub fn baud_rate_generator_config_frequency(
3508 self,
3509 clocks: &mut ClockTree,
3510 config: UartBaudRateGeneratorConfig,
3511 ) -> u32 {
3512 ((self.function_clock_frequency() * 16)
3513 / ((config.integral() * 16) + config.fractional()))
3514 }
3515 pub fn baud_rate_generator_frequency(self) -> u32 {
3516 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
3517 .load(::core::sync::atomic::Ordering::Acquire)
3518 }
3519 pub fn request_mem_clock(self, clocks: &mut ClockTree) {
3520 trace!("Requesting {:?}::MEM_CLOCK", self);
3521 if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
3522 trace!("Enabling {:?}::MEM_CLOCK", self);
3523 request_apb_clk(clocks);
3524 self.enable_mem_clock_impl(clocks, true);
3525 }
3526 }
3527 pub fn release_mem_clock(self, clocks: &mut ClockTree) {
3528 trace!("Releasing {:?}::MEM_CLOCK", self);
3529 if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
3530 trace!("Disabling {:?}::MEM_CLOCK", self);
3531 self.enable_mem_clock_impl(clocks, false);
3532 release_apb_clk(clocks);
3533 }
3534 }
3535 pub fn mem_clock_frequency(self) -> u32 {
3536 apb_clk_frequency()
3537 }
3538 pub fn mem_clock_source_frequency() -> u32 {
3539 apb_clk_frequency()
3540 }
3541 }
3542 impl PsramInstance {
3543 pub fn configure_function_clock(
3544 self,
3545 clocks: &mut ClockTree,
3546 new_selector: PsramFunctionClockConfig,
3547 ) {
3548 let old_selector = clocks.psram_function_clock[self as usize].replace(new_selector);
3549 refresh_psram_function_clock_downstream(clocks, self);
3550 if clocks.psram_function_clock_refcount[self as usize] > 0 {
3551 match new_selector {
3552 PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
3553 PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
3554 PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
3555 }
3556 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3557 if let Some(old_selector) = old_selector {
3558 match old_selector {
3559 PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
3560 PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
3561 PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
3562 }
3563 }
3564 } else {
3565 self.configure_function_clock_impl(clocks, old_selector, new_selector);
3566 }
3567 }
3568 pub fn function_clock_config(
3569 self,
3570 clocks: &mut ClockTree,
3571 ) -> Option<PsramFunctionClockConfig> {
3572 clocks.psram_function_clock[self as usize]
3573 }
3574 pub fn request_function_clock(self, clocks: &mut ClockTree) {
3575 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
3576 if increment_reference_count(
3577 &mut clocks.psram_function_clock_refcount[self as usize],
3578 ) {
3579 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
3580 match unwrap!(clocks.psram_function_clock[self as usize]) {
3581 PsramFunctionClockConfig::Xtal => request_xtal_clk(clocks),
3582 PsramFunctionClockConfig::Mpll => request_mpll_clk(clocks),
3583 PsramFunctionClockConfig::Cpll => request_cpll_clk(clocks),
3584 }
3585 self.enable_function_clock_impl(clocks, true);
3586 }
3587 }
3588 pub fn release_function_clock(self, clocks: &mut ClockTree) {
3589 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
3590 if decrement_reference_count(
3591 &mut clocks.psram_function_clock_refcount[self as usize],
3592 ) {
3593 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
3594 self.enable_function_clock_impl(clocks, false);
3595 match unwrap!(clocks.psram_function_clock[self as usize]) {
3596 PsramFunctionClockConfig::Xtal => release_xtal_clk(clocks),
3597 PsramFunctionClockConfig::Mpll => release_mpll_clk(clocks),
3598 PsramFunctionClockConfig::Cpll => release_cpll_clk(clocks),
3599 }
3600 }
3601 }
3602 #[allow(unused_variables)]
3603 pub fn function_clock_config_frequency(
3604 clocks: &mut ClockTree,
3605 config: PsramFunctionClockConfig,
3606 ) -> u32 {
3607 match config {
3608 PsramFunctionClockConfig::Xtal => xtal_clk_frequency(),
3609 PsramFunctionClockConfig::Mpll => mpll_clk_frequency(),
3610 PsramFunctionClockConfig::Cpll => cpll_clk_frequency(),
3611 }
3612 }
3613 pub fn function_clock_frequency(self) -> u32 {
3614 PSRAM_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
3615 .load(::core::sync::atomic::Ordering::Acquire)
3616 }
3617 pub fn function_clock_source_frequency(source: PsramFunctionClockConfig) -> u32 {
3618 match source {
3619 PsramFunctionClockConfig::Xtal => xtal_clk_frequency(),
3620 PsramFunctionClockConfig::Mpll => mpll_clk_frequency(),
3621 PsramFunctionClockConfig::Cpll => cpll_clk_frequency(),
3622 }
3623 }
3624 }
3625 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
3633 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3634 #[instability::unstable]
3635 pub struct ClockConfig {
3636 pub cpu_root_clk: Option<CpuRootClkConfig>,
3638 pub cpu_clk: Option<CpuClkConfig>,
3640 pub ahb_clk: Option<AhbClkConfig>,
3642 pub apb_clk: Option<ApbClkConfig>,
3644 pub lp_fast_clk: Option<LpFastClkConfig>,
3646 pub lp_slow_clk: Option<LpSlowClkConfig>,
3648 pub iomux_function_clock: Option<IomuxFunctionClockConfig>,
3650 pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
3652 }
3653 impl ClockConfig {
3654 fn apply(&self, clocks: &mut ClockTree) {
3655 if let Some(config) = self.cpu_root_clk {
3656 configure_cpu_root_clk(clocks, config);
3657 }
3658 if let Some(config) = self.cpu_clk {
3659 configure_cpu_clk(clocks, config);
3660 }
3661 if let Some(config) = self.ahb_clk {
3662 configure_ahb_clk(clocks, config);
3663 }
3664 if let Some(config) = self.apb_clk {
3665 configure_apb_clk(clocks, config);
3666 }
3667 if let Some(config) = self.lp_fast_clk {
3668 configure_lp_fast_clk(clocks, config);
3669 }
3670 if let Some(config) = self.lp_slow_clk {
3671 configure_lp_slow_clk(clocks, config);
3672 }
3673 if let Some(config) = self.iomux_function_clock {
3674 configure_iomux_function_clock(clocks, config);
3675 }
3676 if let Some(config) = self.timg_calibration_clock {
3677 configure_timg_calibration_clock(clocks, config);
3678 }
3679 }
3680 }
3681 fn increment_reference_count(refcount: &mut u32) -> bool {
3682 let first = *refcount == 0;
3683 *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
3684 first
3685 }
3686 fn decrement_reference_count(refcount: &mut u32) -> bool {
3687 *refcount = refcount.saturating_sub(1);
3688 let last = *refcount == 0;
3689 last
3690 }
3691 fn refresh_cpu_root_clk_downstream(clocks: &mut ClockTree) {
3692 if let Some(config) = clocks.cpu_root_clk {
3693 CPU_ROOT_CLK_FREQ_CACHE.store(
3694 cpu_root_clk_config_frequency(clocks, config),
3695 ::core::sync::atomic::Ordering::Release,
3696 );
3697 }
3698 refresh_cpu_clk_downstream(clocks);
3699 }
3700 fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
3701 if let Some(config) = clocks.cpu_clk {
3702 CPU_CLK_FREQ_CACHE.store(
3703 cpu_clk_config_frequency(clocks, config),
3704 ::core::sync::atomic::Ordering::Release,
3705 );
3706 }
3707 refresh_ahb_clk_downstream(clocks);
3708 }
3709 fn refresh_ahb_clk_downstream(clocks: &mut ClockTree) {
3710 if let Some(config) = clocks.ahb_clk {
3711 AHB_CLK_FREQ_CACHE.store(
3712 ahb_clk_config_frequency(clocks, config),
3713 ::core::sync::atomic::Ordering::Release,
3714 );
3715 }
3716 refresh_apb_clk_downstream(clocks);
3717 }
3718 fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
3719 if let Some(config) = clocks.apb_clk {
3720 APB_CLK_FREQ_CACHE.store(
3721 apb_clk_config_frequency(clocks, config),
3722 ::core::sync::atomic::Ordering::Release,
3723 );
3724 }
3725 }
3726 fn refresh_lp_fast_clk_downstream(clocks: &mut ClockTree) {
3727 if let Some(config) = clocks.lp_fast_clk {
3728 LP_FAST_CLK_FREQ_CACHE.store(
3729 lp_fast_clk_config_frequency(clocks, config),
3730 ::core::sync::atomic::Ordering::Release,
3731 );
3732 }
3733 }
3734 fn refresh_lp_slow_clk_downstream(clocks: &mut ClockTree) {
3735 if let Some(config) = clocks.lp_slow_clk {
3736 LP_SLOW_CLK_FREQ_CACHE.store(
3737 lp_slow_clk_config_frequency(clocks, config),
3738 ::core::sync::atomic::Ordering::Release,
3739 );
3740 }
3741 }
3742 fn refresh_iomux_function_clock_downstream(clocks: &mut ClockTree) {
3743 if let Some(config) = clocks.iomux_function_clock {
3744 IOMUX_FUNCTION_CLOCK_FREQ_CACHE.store(
3745 iomux_function_clock_config_frequency(clocks, config),
3746 ::core::sync::atomic::Ordering::Release,
3747 );
3748 }
3749 }
3750 fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
3751 if let Some(config) = clocks.timg_calibration_clock {
3752 TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
3753 timg_calibration_clock_config_frequency(clocks, config),
3754 ::core::sync::atomic::Ordering::Release,
3755 );
3756 }
3757 }
3758 fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
3759 if let Some(config) = clocks.i2c_function_clock[instance as usize] {
3760 I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3761 I2cInstance::function_clock_config_frequency(clocks, config),
3762 ::core::sync::atomic::Ordering::Release,
3763 );
3764 }
3765 }
3766 fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
3767 if let Some(config) = clocks.rmt_sclk[instance as usize] {
3768 RMT_SCLK_FREQ_CACHE[instance as usize].store(
3769 RmtInstance::sclk_config_frequency(clocks, config),
3770 ::core::sync::atomic::Ordering::Release,
3771 );
3772 }
3773 }
3774 fn refresh_spi_function_clock_downstream(clocks: &mut ClockTree, instance: SpiInstance) {
3775 if let Some(config) = clocks.spi_function_clock[instance as usize] {
3776 SPI_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3777 SpiInstance::function_clock_config_frequency(clocks, config),
3778 ::core::sync::atomic::Ordering::Release,
3779 );
3780 }
3781 }
3782 fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
3783 if let Some(config) = clocks.timg_function_clock[instance as usize] {
3784 TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3785 TimgInstance::function_clock_config_frequency(clocks, config),
3786 ::core::sync::atomic::Ordering::Release,
3787 );
3788 }
3789 }
3790 fn refresh_timg_wdt_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
3791 if let Some(config) = clocks.timg_wdt_clock[instance as usize] {
3792 TIMG_WDT_CLOCK_FREQ_CACHE[instance as usize].store(
3793 TimgInstance::wdt_clock_config_frequency(clocks, config),
3794 ::core::sync::atomic::Ordering::Release,
3795 );
3796 }
3797 }
3798 fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
3799 if let Some(config) = clocks.uart_function_clock[instance as usize] {
3800 UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3801 UartInstance::function_clock_config_frequency(clocks, config),
3802 ::core::sync::atomic::Ordering::Release,
3803 );
3804 }
3805 refresh_uart_baud_rate_generator_downstream(clocks, instance);
3806 }
3807 fn refresh_uart_baud_rate_generator_downstream(
3808 clocks: &mut ClockTree,
3809 instance: UartInstance,
3810 ) {
3811 if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
3812 UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
3813 instance.baud_rate_generator_config_frequency(clocks, config),
3814 ::core::sync::atomic::Ordering::Release,
3815 );
3816 }
3817 }
3818 fn refresh_psram_function_clock_downstream(
3819 clocks: &mut ClockTree,
3820 instance: PsramInstance,
3821 ) {
3822 if let Some(config) = clocks.psram_function_clock[instance as usize] {
3823 PSRAM_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
3824 PsramInstance::function_clock_config_frequency(clocks, config),
3825 ::core::sync::atomic::Ordering::Release,
3826 );
3827 }
3828 }
3829 };
3830}
3831#[macro_export]
3835#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3836macro_rules! implement_peripheral_clocks {
3837 () => {
3838 #[doc(hidden)]
3839 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
3840 #[repr(u8)]
3841 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3842 pub enum Peripheral {
3843 Aes,
3845 AhbGdma,
3847 ApbSarAdc,
3849 AxiGdma,
3851 Ecc,
3853 GpioSd,
3855 I2c0,
3857 I2c1,
3859 Rmt,
3861 Rsa,
3863 SdioHost,
3865 Sha,
3867 Spi2,
3869 Spi3,
3871 Systimer,
3873 Timg0,
3875 Timg1,
3877 Uart0,
3879 Uart1,
3881 Uart2,
3883 Uart3,
3885 Uhci0,
3887 UsbDevice,
3889 UsbHs,
3891 }
3892 impl Peripheral {
3893 const KEEP_ENABLED: &[Peripheral] =
3894 &[Self::Systimer, Self::Timg0, Self::Uart0, Self::UsbDevice];
3895 const COUNT: usize = Self::ALL.len();
3896 const ALL: &[Self] = &[
3897 Self::Aes,
3898 Self::AhbGdma,
3899 Self::ApbSarAdc,
3900 Self::AxiGdma,
3901 Self::Ecc,
3902 Self::GpioSd,
3903 Self::I2c0,
3904 Self::I2c1,
3905 Self::Rmt,
3906 Self::Rsa,
3907 Self::SdioHost,
3908 Self::Sha,
3909 Self::Spi2,
3910 Self::Spi3,
3911 Self::Systimer,
3912 Self::Timg0,
3913 Self::Timg1,
3914 Self::Uart0,
3915 Self::Uart1,
3916 Self::Uart2,
3917 Self::Uart3,
3918 Self::Uhci0,
3919 Self::UsbDevice,
3920 Self::UsbHs,
3921 ];
3922 }
3923 unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
3924 match peripheral {
3925 Peripheral::Aes => {
3926 crate::peripherals::HP_SYS_CLKRST::regs()
3927 .crypto_ctrl0()
3928 .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
3929 }
3930 Peripheral::AhbGdma => {
3931 crate::peripherals::HP_SYS_CLKRST::regs()
3932 .ahb_pdma_ctrl0()
3933 .modify(|_, w| w.sys_clk_en().bit(enable));
3934 }
3935 Peripheral::ApbSarAdc => {
3936 crate::peripherals::LP_PERI::regs()
3937 .adc_ctrl()
3938 .modify(|_, w| w.lp_adc_clk_en().bit(enable));
3939 }
3940 Peripheral::AxiGdma => {
3941 crate::peripherals::HP_SYS_CLKRST::regs()
3942 .axi_pdma_ctrl0()
3943 .modify(|_, w| w.sys_clk_en().bit(enable));
3944 }
3945 Peripheral::Ecc => {
3946 crate::peripherals::HP_SYS_CLKRST::regs()
3947 .crypto_ctrl0()
3948 .modify(|_, w| w.crypto_ecc_clk_en().bit(enable));
3949 }
3950 Peripheral::GpioSd => {
3951 crate::peripherals::GPIO_SD::regs()
3952 .clock_gate()
3953 .modify(|_, w| w.clk_en().bit(enable));
3954 }
3955 Peripheral::I2c0 => {
3956 crate::peripherals::HP_SYS_CLKRST::regs()
3957 .i2c_ctrl0(0)
3958 .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
3959 }
3960 Peripheral::I2c1 => {
3961 crate::peripherals::HP_SYS_CLKRST::regs()
3962 .i2c_ctrl0(1)
3963 .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
3964 }
3965 Peripheral::Rmt => {
3966 crate::peripherals::HP_SYS_CLKRST::regs()
3967 .rmt_ctrl0()
3968 .modify(|_, w| w.sys_clk_en().bit(enable));
3969 }
3970 Peripheral::Rsa => {
3971 crate::peripherals::HP_SYS_CLKRST::regs()
3972 .crypto_ctrl0()
3973 .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
3974 }
3975 Peripheral::SdioHost => {
3976 crate::peripherals::HP_SYS_CLKRST::regs()
3977 .sdio_host_ctrl0()
3978 .modify(|_, w| w.sys_clk_en().bit(enable));
3979 }
3980 Peripheral::Sha => {
3981 crate::peripherals::HP_SYS_CLKRST::regs()
3982 .crypto_ctrl0()
3983 .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
3984 }
3985 Peripheral::Spi2 => {
3986 crate::peripherals::HP_SYS_CLKRST::regs()
3987 .gpspi2_ctrl0()
3988 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
3989 }
3990 Peripheral::Spi3 => {
3991 crate::peripherals::HP_SYS_CLKRST::regs()
3992 .gpspi3_ctrl0()
3993 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
3994 }
3995 Peripheral::Systimer => {
3996 crate::peripherals::HP_SYS_CLKRST::regs()
3997 .systimer_ctrl0()
3998 .modify(|_, w| w.apb_clk_en().bit(enable).clk_en().bit(enable));
3999 }
4000 Peripheral::Timg0 => {
4001 crate::peripherals::HP_SYS_CLKRST::regs()
4002 .timergrp0_ctrl0()
4003 .modify(|_, w| w.apb_clk_en().bit(enable));
4004 }
4005 Peripheral::Timg1 => {
4006 crate::peripherals::HP_SYS_CLKRST::regs()
4007 .timergrp1_ctrl0()
4008 .modify(|_, w| w.apb_clk_en().bit(enable));
4009 }
4010 Peripheral::Uart0 => {
4011 crate::peripherals::HP_SYS_CLKRST::regs()
4012 .uart_ctrl0(0)
4013 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
4014 }
4015 Peripheral::Uart1 => {
4016 crate::peripherals::HP_SYS_CLKRST::regs()
4017 .uart_ctrl0(1)
4018 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
4019 }
4020 Peripheral::Uart2 => {
4021 crate::peripherals::HP_SYS_CLKRST::regs()
4022 .uart_ctrl0(2)
4023 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
4024 }
4025 Peripheral::Uart3 => {
4026 crate::peripherals::HP_SYS_CLKRST::regs()
4027 .uart_ctrl0(3)
4028 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
4029 }
4030 Peripheral::Uhci0 => {
4031 crate::peripherals::HP_SYS_CLKRST::regs()
4032 .uhci_ctrl0()
4033 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
4034 }
4035 Peripheral::UsbDevice => {
4036 crate::peripherals::HP_SYS_CLKRST::regs()
4037 .usb_device_ctrl0()
4038 .modify(|_, w| w.apb_clk_en().bit(enable));
4039 crate::peripherals::CNNT_SYS::regs()
4040 .sys_hp_usb_device_ctrl()
4041 .modify(|_, w| w.sys_usb_device_48m_clk_en().bit(enable));
4042 }
4043 Peripheral::UsbHs => {
4044 crate::peripherals::HP_SYS_CLKRST::regs()
4045 .usb_otghs_ctrl0()
4046 .modify(|_, w| w.sys_clk_en().bit(enable).apb_clk_en().bit(enable));
4047 }
4048 }
4049 }
4050 unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
4051 match peripheral {
4052 Peripheral::Aes => {
4053 crate::peripherals::HP_SYS_CLKRST::regs()
4054 .crypto_ctrl0()
4055 .modify(|_, w| w.crypto_aes_rst_en().bit(reset));
4056 }
4057 Peripheral::AhbGdma => {
4058 crate::peripherals::HP_SYS_CLKRST::regs()
4059 .ahb_pdma_ctrl0()
4060 .modify(|_, w| w.rst_en().bit(reset));
4061 }
4062 Peripheral::ApbSarAdc => {
4063 crate::peripherals::LP_PERI::regs()
4064 .adc_ctrl()
4065 .modify(|_, w| w.lp_adc_rst_en().bit(reset));
4066 }
4067 Peripheral::AxiGdma => {
4068 crate::peripherals::HP_SYS_CLKRST::regs()
4069 .axi_pdma_ctrl0()
4070 .modify(|_, w| w.rst_en().bit(reset));
4071 }
4072 Peripheral::Ecc => {
4073 crate::peripherals::HP_SYS_CLKRST::regs()
4074 .crypto_ctrl0()
4075 .modify(|_, w| w.crypto_ecc_rst_en().bit(reset));
4076 }
4077 Peripheral::GpioSd => {
4078 let _ = reset;
4079 }
4080 Peripheral::I2c0 => {
4081 crate::peripherals::HP_SYS_CLKRST::regs()
4082 .i2c_ctrl0(0)
4083 .modify(|_, w| w.rst_en().bit(reset));
4084 }
4085 Peripheral::I2c1 => {
4086 crate::peripherals::HP_SYS_CLKRST::regs()
4087 .i2c_ctrl0(1)
4088 .modify(|_, w| w.rst_en().bit(reset));
4089 }
4090 Peripheral::Rmt => {
4091 crate::peripherals::HP_SYS_CLKRST::regs()
4092 .rmt_ctrl0()
4093 .modify(|_, w| w.rst_en().bit(reset));
4094 }
4095 Peripheral::Rsa => {
4096 crate::peripherals::HP_SYS_CLKRST::regs()
4097 .crypto_ctrl0()
4098 .modify(|_, w| w.crypto_rsa_rst_en().bit(reset));
4099 }
4100 Peripheral::SdioHost => {
4101 crate::peripherals::CNNT_SYS::regs()
4102 .sys_hp_sdmmc_ctrl()
4103 .modify(|_, w| w.sys_sdmmc_rst_en().bit(reset));
4104 }
4105 Peripheral::Sha => {
4106 crate::peripherals::HP_SYS_CLKRST::regs()
4107 .crypto_ctrl0()
4108 .modify(|_, w| w.crypto_sha_rst_en().bit(reset));
4109 }
4110 Peripheral::Spi2 => {
4111 crate::peripherals::HP_SYS_CLKRST::regs()
4112 .gpspi2_ctrl0()
4113 .modify(|_, w| w.rst_en().bit(reset));
4114 }
4115 Peripheral::Spi3 => {
4116 crate::peripherals::HP_SYS_CLKRST::regs()
4117 .gpspi3_ctrl0()
4118 .modify(|_, w| w.rst_en().bit(reset));
4119 }
4120 Peripheral::Systimer => {
4121 crate::peripherals::HP_SYS_CLKRST::regs()
4122 .systimer_ctrl0()
4123 .modify(|_, w| w.rst_en().bit(reset));
4124 }
4125 Peripheral::Timg0 => {
4126 crate::peripherals::HP_SYS_CLKRST::regs()
4127 .timergrp0_ctrl0()
4128 .modify(|_, w| w.rst_en().bit(reset));
4129 }
4130 Peripheral::Timg1 => {
4131 crate::peripherals::HP_SYS_CLKRST::regs()
4132 .timergrp1_ctrl0()
4133 .modify(|_, w| w.rst_en().bit(reset));
4134 }
4135 Peripheral::Uart0 => {
4136 crate::peripherals::HP_SYS_CLKRST::regs()
4137 .uart_ctrl0(0)
4138 .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
4139 }
4140 Peripheral::Uart1 => {
4141 crate::peripherals::HP_SYS_CLKRST::regs()
4142 .uart_ctrl0(1)
4143 .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
4144 }
4145 Peripheral::Uart2 => {
4146 crate::peripherals::HP_SYS_CLKRST::regs()
4147 .uart_ctrl0(2)
4148 .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
4149 }
4150 Peripheral::Uart3 => {
4151 crate::peripherals::HP_SYS_CLKRST::regs()
4152 .uart_ctrl0(3)
4153 .modify(|_, w| w.core_rst_en().bit(reset).apb_rst_en().bit(reset));
4154 }
4155 Peripheral::Uhci0 => {
4156 crate::peripherals::HP_SYS_CLKRST::regs()
4157 .uhci_ctrl0()
4158 .modify(|_, w| w.rst_en().bit(reset));
4159 }
4160 Peripheral::UsbDevice => {
4161 crate::peripherals::CNNT_SYS::regs()
4162 .sys_hp_usb_device_ctrl()
4163 .modify(|_, w| w.sys_usb_device_rst_en().bit(reset));
4164 }
4165 Peripheral::UsbHs => {
4166 let _ = reset;
4167 }
4168 }
4169 }
4170 };
4171}
4172#[macro_export]
4180#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4181macro_rules! memory_range {
4182 ("DRAM") => {
4183 0x2F000000..0x2F07AFC0
4184 };
4185 (size as str, "DRAM") => {
4186 "503744"
4187 };
4188 ("DRAM2_UNINIT") => {
4189 0x2F07AFC0..0x2F07CFB0
4190 };
4191 (size as str, "DRAM2_UNINIT") => {
4192 "8176"
4193 };
4194 ("IROM") => {
4195 0x40000000..0x50000000
4196 };
4197 (size as str, "IROM") => {
4198 "268435456"
4199 };
4200 ("DROM") => {
4201 0x40000000..0x50000000
4202 };
4203 (size as str, "DROM") => {
4204 "268435456"
4205 };
4206}
4207#[macro_export]
4224#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4225macro_rules! for_each_i2c_master {
4226 ($($pattern:tt => $code:tt;)*) => {
4227 macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
4228 => {} } _for_each_inner_i2c_master!((0, I2C0, I2c0, I2CEXT0_SCL, I2CEXT0_SDA));
4229 _for_each_inner_i2c_master!((1, I2C1, I2c1, I2CEXT1_SCL, I2CEXT1_SDA));
4230 _for_each_inner_i2c_master!((all(0, I2C0, I2c0, I2CEXT0_SCL, I2CEXT0_SDA), (1,
4231 I2C1, I2c1, I2CEXT1_SCL, I2CEXT1_SDA)));
4232 };
4233}
4234#[macro_export]
4261#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4262macro_rules! for_each_i2s {
4263 ($($pattern:tt => $code:tt;)*) => {
4264 macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
4265 _for_each_inner_i2s!((names)); _for_each_inner_i2s!((all));
4266 };
4267}
4268#[macro_export]
4287#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4288macro_rules! for_each_uart {
4289 ($($pattern:tt => $code:tt;)*) => {
4290 macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
4291 } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
4292 wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
4293 U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((2, UART2, Uart2,
4294 U2RXD, U2TXD, U2CTS, U2RTS, wakeup_source = true)); _for_each_inner_uart!((3,
4295 UART3, Uart3, U3RXD, U3TXD, U3CTS, U3RTS, wakeup_source = true));
4296 _for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS,
4297 wakeup_source = true), (1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS,
4298 wakeup_source = true), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS,
4299 wakeup_source = true), (3, UART3, Uart3, U3RXD, U3TXD, U3CTS, U3RTS,
4300 wakeup_source = true)));
4301 };
4302}
4303#[macro_export]
4325#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4326macro_rules! for_each_spi_master {
4327 ($($pattern:tt => $code:tt;)*) => {
4328 macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
4329 => {} } _for_each_inner_spi_master!((SPI2)); _for_each_inner_spi_master!((SPI3));
4330 _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
4331 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
4332 FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
4333 SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD],
4334 true)); _for_each_inner_spi_master!((names(SPI2), (SPI3)));
4335 _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
4336 FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5,
4337 FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CK[SPI3_CS, SPI3_CS1, SPI3_CS2]
4338 [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HOLD], true)));
4339 };
4340}
4341#[macro_export]
4358#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4359macro_rules! for_each_spi_slave {
4360 ($($pattern:tt => $code:tt;)*) => {
4361 macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
4362 => {} } _for_each_inner_spi_slave!((SPI2)); _for_each_inner_spi_slave!((SPI3));
4363 _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
4364 _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS));
4365 _for_each_inner_spi_slave!((names(SPI2), (SPI3)));
4366 _for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
4367 (SPI3, Spi3, SPI3_CK, SPI3_D, SPI3_Q, SPI3_CS)));
4368 };
4369}
4370#[macro_export]
4371#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4372macro_rules! for_each_peripheral {
4373 ($($pattern:tt => $code:tt;)*) => {
4374 macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
4375 => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
4376 "GPIO0 peripheral singleton"] GPIO0 <= virtual()));
4377 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
4378 GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4379 "GPIO2 peripheral singleton"] GPIO2 <= virtual()));
4380 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO3 peripheral singleton"]
4381 GPIO3 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4382 "GPIO4 peripheral singleton"] GPIO4 <= virtual()));
4383 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO5 peripheral singleton"]
4384 GPIO5 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4385 "GPIO6 peripheral singleton"] GPIO6 <= virtual()));
4386 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO7 peripheral singleton"]
4387 GPIO7 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4388 "GPIO8 peripheral singleton"] GPIO8 <= virtual()));
4389 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO9 peripheral singleton"]
4390 GPIO9 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4391 "GPIO10 peripheral singleton"] GPIO10 <= virtual()));
4392 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO11 peripheral singleton"]
4393 GPIO11 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4394 "GPIO12 peripheral singleton"] GPIO12 <= virtual()));
4395 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO13 peripheral singleton"]
4396 GPIO13 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4397 "GPIO14 peripheral singleton"] GPIO14 <= virtual()));
4398 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO15 peripheral singleton"]
4399 GPIO15 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4400 "GPIO16 peripheral singleton"] GPIO16 <= virtual()));
4401 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO17 peripheral singleton"]
4402 GPIO17 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4403 "GPIO18 peripheral singleton"] GPIO18 <= virtual()));
4404 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO19 peripheral singleton"]
4405 GPIO19 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4406 "GPIO20 peripheral singleton"] GPIO20 <= virtual()));
4407 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO21 peripheral singleton"]
4408 GPIO21 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4409 "GPIO22 peripheral singleton"] GPIO22 <= virtual()));
4410 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO23 peripheral singleton"]
4411 GPIO23 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4412 "GPIO24 peripheral singleton"] GPIO24 <= virtual()));
4413 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO25 peripheral singleton"]
4414 GPIO25 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4415 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4416 "<section class=\"warning\">"] #[doc =
4417 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4418 #[doc = "<ul>"] #[doc =
4419 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4420 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
4421 _for_each_inner_peripheral!((@ peri_type #[doc =
4422 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4423 "<section class=\"warning\">"] #[doc =
4424 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4425 #[doc = "<ul>"] #[doc =
4426 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4427 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4428 = "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
4429 _for_each_inner_peripheral!((@ peri_type #[doc =
4430 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4431 "<section class=\"warning\">"] #[doc =
4432 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4433 #[doc = "<ul>"] #[doc =
4434 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4435 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4436 = "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
4437 _for_each_inner_peripheral!((@ peri_type #[doc =
4438 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4439 "<section class=\"warning\">"] #[doc =
4440 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4441 #[doc = "<ul>"] #[doc =
4442 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4443 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
4444 _for_each_inner_peripheral!((@ peri_type #[doc =
4445 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4446 "<section class=\"warning\">"] #[doc =
4447 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4448 #[doc = "<ul>"] #[doc =
4449 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4450 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
4451 _for_each_inner_peripheral!((@ peri_type #[doc =
4452 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4453 "<section class=\"warning\">"] #[doc =
4454 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4455 #[doc = "<ul>"] #[doc =
4456 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4457 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
4458 _for_each_inner_peripheral!((@ peri_type #[doc =
4459 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4460 "<section class=\"warning\">"] #[doc =
4461 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4462 #[doc = "<ul>"] #[doc =
4463 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
4464 #[doc = "</section>"] GPIO33 <= virtual())); _for_each_inner_peripheral!((@
4465 peri_type #[doc = "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""]
4466 #[doc = "<section class=\"warning\">"] #[doc =
4467 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4468 #[doc = "<ul>"] #[doc =
4469 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
4470 #[doc = "</section>"] GPIO34 <= virtual())); _for_each_inner_peripheral!((@
4471 peri_type #[doc = "GPIO35 peripheral singleton"] GPIO35 <= virtual()));
4472 _for_each_inner_peripheral!((@ peri_type #[doc =
4473 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4474 "<section class=\"warning\">"] #[doc =
4475 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4476 #[doc = "<ul>"] #[doc =
4477 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4478 = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
4479 _for_each_inner_peripheral!((@ peri_type #[doc =
4480 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4481 "<section class=\"warning\">"] #[doc =
4482 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4483 #[doc = "<ul>"] #[doc =
4484 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4485 = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
4486 _for_each_inner_peripheral!((@ peri_type #[doc =
4487 "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4488 "<section class=\"warning\">"] #[doc =
4489 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4490 #[doc = "<ul>"] #[doc =
4491 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4492 = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()));
4493 _for_each_inner_peripheral!((@ peri_type #[doc =
4494 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4495 "<section class=\"warning\">"] #[doc =
4496 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4497 #[doc = "<ul>"] #[doc =
4498 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4499 = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
4500 _for_each_inner_peripheral!((@ peri_type #[doc =
4501 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4502 "<section class=\"warning\">"] #[doc =
4503 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4504 #[doc = "<ul>"] #[doc =
4505 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4506 = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
4507 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO42 peripheral singleton"]
4508 GPIO42 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4509 "GPIO43 peripheral singleton"] GPIO43 <= virtual()));
4510 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO44 peripheral singleton"]
4511 GPIO44 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4512 "GPIO45 peripheral singleton"] GPIO45 <= virtual()));
4513 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO46 peripheral singleton"]
4514 GPIO46 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4515 "GPIO47 peripheral singleton"] GPIO47 <= virtual()));
4516 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO48 peripheral singleton"]
4517 GPIO48 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4518 "GPIO49 peripheral singleton"] GPIO49 <= virtual()));
4519 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO50 peripheral singleton"]
4520 GPIO50 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4521 "GPIO51 peripheral singleton"] GPIO51 <= virtual()));
4522 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO52 peripheral singleton"]
4523 GPIO52 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
4524 "GPIO53 peripheral singleton"] GPIO53 <= virtual()));
4525 _for_each_inner_peripheral!((@ peri_type #[doc =
4526 "GPIO54 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4527 "<section class=\"warning\">"] #[doc =
4528 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4529 #[doc = "<ul>"] #[doc =
4530 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4531 #[doc = "</ul>"] #[doc = "</section>"] GPIO54 <= virtual()));
4532 _for_each_inner_peripheral!((@ peri_type #[doc =
4533 "GPIO55 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4534 "<section class=\"warning\">"] #[doc =
4535 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4536 #[doc = "<ul>"] #[doc =
4537 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4538 #[doc = "</ul>"] #[doc = "</section>"] GPIO55 <= virtual()));
4539 _for_each_inner_peripheral!((@ peri_type #[doc =
4540 "GPIO56 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4541 "<section class=\"warning\">"] #[doc =
4542 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4543 #[doc = "<ul>"] #[doc =
4544 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4545 #[doc = "</ul>"] #[doc = "</section>"] GPIO56 <= virtual()));
4546 _for_each_inner_peripheral!((@ peri_type #[doc =
4547 "GPIO57 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4548 "<section class=\"warning\">"] #[doc =
4549 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4550 #[doc = "<ul>"] #[doc =
4551 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4552 #[doc = "</ul>"] #[doc = "</section>"] GPIO57 <= virtual()));
4553 _for_each_inner_peripheral!((@ peri_type #[doc =
4554 "GPIO58 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4555 "<section class=\"warning\">"] #[doc =
4556 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4557 #[doc = "<ul>"] #[doc =
4558 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
4559 = "</ul>"] #[doc = "</section>"] GPIO58 <= virtual()));
4560 _for_each_inner_peripheral!((@ peri_type #[doc =
4561 "GPIO59 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4562 "<section class=\"warning\">"] #[doc =
4563 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4564 #[doc = "<ul>"] #[doc =
4565 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
4566 = "</ul>"] #[doc = "</section>"] GPIO59 <= virtual()));
4567 _for_each_inner_peripheral!((@ peri_type #[doc =
4568 "GPIO60 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4569 "<section class=\"warning\">"] #[doc =
4570 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4571 #[doc = "<ul>"] #[doc =
4572 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4573 = "</ul>"] #[doc = "</section>"] GPIO60 <= virtual()));
4574 _for_each_inner_peripheral!((@ peri_type #[doc =
4575 "GPIO61 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4576 "<section class=\"warning\">"] #[doc =
4577 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4578 #[doc = "<ul>"] #[doc =
4579 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4580 = "</ul>"] #[doc = "</section>"] GPIO61 <= virtual()));
4581 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
4582 DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : { bind_dma_in_interrupt,
4583 enable_dma_in_interrupt, disable_dma_in_interrupt }, AHB_PDMA_OUT_CH0 : {
4584 bind_dma_out_interrupt, enable_dma_out_interrupt, disable_dma_out_interrupt })
4585 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4586 "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
4587 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
4588 AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
4589 disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
4590 peri_type #[doc = "DMA_CH2 peripheral singleton"] DMA_CH2 <=
4591 virtual(AHB_PDMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
4592 disable_dma_in_interrupt }, AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt,
4593 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
4594 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH3 peripheral singleton"]
4595 DMA_CH3 <= virtual(AHB_PDMA_IN_CH3 : { bind_dma_in_interrupt,
4596 enable_dma_in_interrupt, disable_dma_in_interrupt }, AHB_PDMA_OUT_CH3 : {
4597 bind_dma_out_interrupt, enable_dma_out_interrupt, disable_dma_out_interrupt })
4598 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4599 "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(AHB_PDMA_IN_CH4 : {
4600 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
4601 AHB_PDMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
4602 disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
4603 peri_type #[doc = "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <=
4604 virtual(AXI_PDMA_IN_CH0 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
4605 disable_dma_in_interrupt }, AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt,
4606 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
4607 _for_each_inner_peripheral!((@ peri_type #[doc =
4608 "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <= virtual(AXI_PDMA_IN_CH1 : {
4609 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
4610 AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
4611 disable_dma_out_interrupt }) (unstable))); _for_each_inner_peripheral!((@
4612 peri_type #[doc = "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <=
4613 virtual(AXI_PDMA_IN_CH2 : { bind_dma_in_interrupt, enable_dma_in_interrupt,
4614 disable_dma_in_interrupt }, AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt,
4615 enable_dma_out_interrupt, disable_dma_out_interrupt }) (unstable)));
4616 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH0 peripheral singleton"]
4617 SDM_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4618 = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)));
4619 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
4620 SDM_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4621 = "SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)));
4622 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
4623 SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4624 = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
4625 _for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
4626 SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4627 = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
4628 _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
4629 <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
4630 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4631 "APB_SARADC peripheral singleton"] APB_SARADC <= ADC() (unstable)));
4632 _for_each_inner_peripheral!((@ peri_type #[doc =
4633 "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
4634 _for_each_inner_peripheral!((@ peri_type #[doc = "CACHE peripheral singleton"]
4635 CACHE <= CACHE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4636 "CLIC peripheral singleton"] CLIC <= CLIC() (unstable)));
4637 _for_each_inner_peripheral!((@ peri_type #[doc = "CNNT_SYS peripheral singleton"]
4638 CNNT_SYS <= CNNT_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type
4639 #[doc = "CNNT_IO_MUX peripheral singleton"] CNNT_IO_MUX <= CNNT_IO_MUX()
4640 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4641 "ECC peripheral singleton"] ECC <= ECC() (unstable)));
4642 _for_each_inner_peripheral!((@ peri_type #[doc = "EFUSE peripheral singleton"]
4643 EFUSE <= EFUSE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4644 "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)));
4645 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO_SD peripheral singleton"]
4646 GPIO_SD <= GPIO_EXT() (unstable))); _for_each_inner_peripheral!((@ peri_type
4647 #[doc = "HP_APM peripheral singleton"] HP_APM <= HP_APM() (unstable)));
4648 _for_each_inner_peripheral!((@ peri_type #[doc =
4649 "HP_MEM_APM peripheral singleton"] HP_MEM_APM <= HP_MEM_APM() (unstable)));
4650 _for_each_inner_peripheral!((@ peri_type #[doc = "HP_SYS peripheral singleton"]
4651 HP_SYS <= HP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4652 "HP_ALIVE_SYS peripheral singleton"] HP_ALIVE_SYS <= HP_ALIVE_SYS() (unstable)));
4653 _for_each_inner_peripheral!((@ peri_type #[doc =
4654 "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
4655 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4656 "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0 : { bind_peri_interrupt,
4657 enable_peri_interrupt, disable_peri_interrupt })));
4658 _for_each_inner_peripheral!((@ peri_type #[doc = "I2C1 peripheral singleton"]
4659 I2C1 <= I2C1(I2C1 : { bind_peri_interrupt, enable_peri_interrupt,
4660 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4661 "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
4662 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4663 "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
4664 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4665 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
4666 _for_each_inner_peripheral!((@ peri_type #[doc =
4667 "IOMUX_MSPI_PIN peripheral singleton"] IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN()
4668 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4669 "LP_AON_CLK_RST peripheral singleton"] LP_AON_CLK_RST <= LP_AON_CLKRST()
4670 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4671 "LP_APM peripheral singleton"] LP_APM <= LP_APM() (unstable)));
4672 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_GPIO peripheral singleton"]
4673 LP_GPIO <= LP_GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4674 = "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)));
4675 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_PERI peripheral singleton"]
4676 LP_PERI <= LP_PERICLKRST() (unstable))); _for_each_inner_peripheral!((@ peri_type
4677 #[doc = "LP_SYS peripheral singleton"] LP_SYS <= LP_SYS() (unstable)));
4678 _for_each_inner_peripheral!((@ peri_type #[doc = "LP_TEE peripheral singleton"]
4679 LP_TEE <= LP_TEE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4680 "LP_WDT peripheral singleton"] LP_WDT <= LP_WDT() (unstable)));
4681 _for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
4682 LPWR <= PMU() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4683 "MEM_MONITOR peripheral singleton"] MEM_MONITOR <= MEM_MONITOR0() (unstable)));
4684 _for_each_inner_peripheral!((@ peri_type #[doc =
4685 "MODEM_LPCON peripheral singleton"] MODEM_LPCON <= MODEM_LPCON() (unstable)));
4686 _for_each_inner_peripheral!((@ peri_type #[doc =
4687 "MODEM_SYSCON peripheral singleton"] MODEM_SYSCON <= MODEM_SYSCON() (unstable)));
4688 _for_each_inner_peripheral!((@ peri_type #[doc = "PAU peripheral singleton"] PAU
4689 <= PAU() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4690 "PMU peripheral singleton"] PMU <= PMU() (unstable)));
4691 _for_each_inner_peripheral!((@ peri_type #[doc =
4692 "RTC_TIMER peripheral singleton"] RTC_TIMER <= LP_TIMER() (unstable)));
4693 _for_each_inner_peripheral!((@ peri_type #[doc = "RNG peripheral singleton"] RNG
4694 <= TRNG() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4695 "RMT peripheral singleton"] RMT <= virtual(RMT : { bind_peri_interrupt,
4696 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
4697 _for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
4698 <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
4699 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4700 "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
4701 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
4702 SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4703 "MEMSPI2 peripheral singleton"] MEMSPI2 <= MEMSPI2() (unstable)));
4704 _for_each_inner_peripheral!((@ peri_type #[doc = "MEMSPI3 peripheral singleton"]
4705 MEMSPI3 <= MEMSPI3() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
4706 = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
4707 enable_peri_interrupt, disable_peri_interrupt })));
4708 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
4709 SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
4710 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4711 "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)));
4712 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
4713 <= AHB_DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4714 "SHA peripheral singleton"] SHA <= SHA() (unstable)));
4715 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTEM peripheral singleton"]
4716 SYSTEM <= HP_SYS() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4717 "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER() (unstable)));
4718 _for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
4719 SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4720 "TEE peripheral singleton"] TEE <= TEE() (unstable)));
4721 _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG0 peripheral singleton"]
4722 TIMG0 <= TIMG0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4723 "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)));
4724 _for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
4725 UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
4726 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4727 "UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
4728 enable_peri_interrupt, disable_peri_interrupt })));
4729 _for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
4730 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
4731 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
4732 "UART3 peripheral singleton"] UART3 <= UART3(UART3 : { bind_peri_interrupt,
4733 enable_peri_interrupt, disable_peri_interrupt })));
4734 _for_each_inner_peripheral!((@ peri_type #[doc = "UHCI0 peripheral singleton"]
4735 UHCI0 <= UHCI0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4736 "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
4737 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
4738 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4739 "USB_HS peripheral singleton"] USB_HS <= USB_OTG_HS(USB_OTG_HS : {
4740 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
4741 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4742 "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)));
4743 _for_each_inner_peripheral!((@ peri_type #[doc = "ADC2 peripheral singleton"]
4744 ADC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4745 "FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
4746 _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
4747 PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4748 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
4749 _for_each_inner_peripheral!((@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
4750 CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
4751 #[doc = "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual()
4752 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
4753 "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
4754 _for_each_inner_peripheral!((@ peri_type #[doc =
4755 "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
4756 _for_each_inner_peripheral!((@ peri_type #[doc =
4757 "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
4758 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO0));
4759 _for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO1));
4760 _for_each_inner_peripheral!((GPIO2)); _for_each_inner_peripheral!((GPIO3));
4761 _for_each_inner_peripheral!((GPIO4)); _for_each_inner_peripheral!((GPIO5));
4762 _for_each_inner_peripheral!((GPIO6)); _for_each_inner_peripheral!((GPIO7));
4763 _for_each_inner_peripheral!((GPIO8)); _for_each_inner_peripheral!((GPIO9));
4764 _for_each_inner_peripheral!((GPIO10)); _for_each_inner_peripheral!((GPIO11));
4765 _for_each_inner_peripheral!((GPIO12)); _for_each_inner_peripheral!((GPIO13));
4766 _for_each_inner_peripheral!((GPIO14)); _for_each_inner_peripheral!((GPIO15));
4767 _for_each_inner_peripheral!((GPIO16)); _for_each_inner_peripheral!((GPIO17));
4768 _for_each_inner_peripheral!((GPIO18)); _for_each_inner_peripheral!((GPIO19));
4769 _for_each_inner_peripheral!((GPIO20)); _for_each_inner_peripheral!((GPIO21));
4770 _for_each_inner_peripheral!((GPIO22)); _for_each_inner_peripheral!((GPIO23));
4771 _for_each_inner_peripheral!((GPIO24)); _for_each_inner_peripheral!((GPIO25));
4772 _for_each_inner_peripheral!((GPIO26)); _for_each_inner_peripheral!((GPIO27));
4773 _for_each_inner_peripheral!((GPIO28)); _for_each_inner_peripheral!((GPIO30));
4774 _for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
4775 _for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
4776 _for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
4777 _for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
4778 _for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
4779 _for_each_inner_peripheral!((GPIO42)); _for_each_inner_peripheral!((GPIO43));
4780 _for_each_inner_peripheral!((GPIO44)); _for_each_inner_peripheral!((GPIO45));
4781 _for_each_inner_peripheral!((GPIO46)); _for_each_inner_peripheral!((GPIO47));
4782 _for_each_inner_peripheral!((GPIO48)); _for_each_inner_peripheral!((GPIO49));
4783 _for_each_inner_peripheral!((GPIO50)); _for_each_inner_peripheral!((GPIO51));
4784 _for_each_inner_peripheral!((GPIO52)); _for_each_inner_peripheral!((GPIO53));
4785 _for_each_inner_peripheral!((GPIO54)); _for_each_inner_peripheral!((GPIO55));
4786 _for_each_inner_peripheral!((GPIO56)); _for_each_inner_peripheral!((GPIO57));
4787 _for_each_inner_peripheral!((GPIO58)); _for_each_inner_peripheral!((GPIO59));
4788 _for_each_inner_peripheral!((GPIO60)); _for_each_inner_peripheral!((GPIO61));
4789 _for_each_inner_peripheral!((DMA_CH0(unstable)));
4790 _for_each_inner_peripheral!((DMA_CH1(unstable)));
4791 _for_each_inner_peripheral!((DMA_CH2(unstable)));
4792 _for_each_inner_peripheral!((DMA_CH3(unstable)));
4793 _for_each_inner_peripheral!((DMA_CH4(unstable)));
4794 _for_each_inner_peripheral!((DMA_AXI_CH0(unstable)));
4795 _for_each_inner_peripheral!((DMA_AXI_CH1(unstable)));
4796 _for_each_inner_peripheral!((DMA_AXI_CH2(unstable)));
4797 _for_each_inner_peripheral!((SDM_CH0(unstable)));
4798 _for_each_inner_peripheral!((SDM_CH1(unstable)));
4799 _for_each_inner_peripheral!((SDM_CH2(unstable)));
4800 _for_each_inner_peripheral!((SDM_CH3(unstable)));
4801 _for_each_inner_peripheral!((SDM_CH4(unstable)));
4802 _for_each_inner_peripheral!((SDM_CH5(unstable)));
4803 _for_each_inner_peripheral!((SDM_CH6(unstable)));
4804 _for_each_inner_peripheral!((SDM_CH7(unstable)));
4805 _for_each_inner_peripheral!((AES(unstable)));
4806 _for_each_inner_peripheral!((APB_SARADC(unstable)));
4807 _for_each_inner_peripheral!((ASSIST_DEBUG(unstable)));
4808 _for_each_inner_peripheral!((CACHE(unstable)));
4809 _for_each_inner_peripheral!((CLIC(unstable)));
4810 _for_each_inner_peripheral!((ECC(unstable)));
4811 _for_each_inner_peripheral!((GPIO(unstable)));
4812 _for_each_inner_peripheral!((GPIO_SD(unstable)));
4813 _for_each_inner_peripheral!((HP_APM(unstable)));
4814 _for_each_inner_peripheral!((HP_MEM_APM(unstable)));
4815 _for_each_inner_peripheral!((HP_SYS(unstable)));
4816 _for_each_inner_peripheral!((HP_ALIVE_SYS(unstable)));
4817 _for_each_inner_peripheral!((HP_SYS_CLKRST(unstable)));
4818 _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
4819 _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
4820 _for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
4821 _for_each_inner_peripheral!((IO_MUX(unstable)));
4822 _for_each_inner_peripheral!((LP_AON_CLK_RST(unstable)));
4823 _for_each_inner_peripheral!((LP_APM(unstable)));
4824 _for_each_inner_peripheral!((LP_GPIO(unstable)));
4825 _for_each_inner_peripheral!((LP_IO_MUX(unstable)));
4826 _for_each_inner_peripheral!((LP_PERI(unstable)));
4827 _for_each_inner_peripheral!((LP_SYS(unstable)));
4828 _for_each_inner_peripheral!((LP_TEE(unstable)));
4829 _for_each_inner_peripheral!((LP_WDT(unstable)));
4830 _for_each_inner_peripheral!((LPWR(unstable)));
4831 _for_each_inner_peripheral!((MEM_MONITOR(unstable)));
4832 _for_each_inner_peripheral!((MODEM_LPCON(unstable)));
4833 _for_each_inner_peripheral!((MODEM_SYSCON(unstable)));
4834 _for_each_inner_peripheral!((PAU(unstable)));
4835 _for_each_inner_peripheral!((PMU(unstable)));
4836 _for_each_inner_peripheral!((RTC_TIMER(unstable)));
4837 _for_each_inner_peripheral!((RNG(unstable)));
4838 _for_each_inner_peripheral!((RMT(unstable)));
4839 _for_each_inner_peripheral!((RSA(unstable)));
4840 _for_each_inner_peripheral!((SPI0(unstable)));
4841 _for_each_inner_peripheral!((SPI1(unstable)));
4842 _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
4843 _for_each_inner_peripheral!((AXI_GDMA(unstable)));
4844 _for_each_inner_peripheral!((DMA(unstable)));
4845 _for_each_inner_peripheral!((SHA(unstable)));
4846 _for_each_inner_peripheral!((SYSTEM(unstable)));
4847 _for_each_inner_peripheral!((SYSTIMER(unstable)));
4848 _for_each_inner_peripheral!((SDHOST(unstable)));
4849 _for_each_inner_peripheral!((TEE(unstable)));
4850 _for_each_inner_peripheral!((TIMG0(unstable)));
4851 _for_each_inner_peripheral!((TIMG1(unstable)));
4852 _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
4853 _for_each_inner_peripheral!((UART2)); _for_each_inner_peripheral!((UART3));
4854 _for_each_inner_peripheral!((UHCI0(unstable)));
4855 _for_each_inner_peripheral!((USB_DEVICE(unstable)));
4856 _for_each_inner_peripheral!((USB_HS(unstable)));
4857 _for_each_inner_peripheral!((ADC1(unstable)));
4858 _for_each_inner_peripheral!((ADC2(unstable)));
4859 _for_each_inner_peripheral!((FLASH(unstable)));
4860 _for_each_inner_peripheral!((PSRAM(unstable)));
4861 _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
4862 _for_each_inner_peripheral!((CPU_CTRL(unstable)));
4863 _for_each_inner_peripheral!((FROM_CPU_INTR0(unstable)));
4864 _for_each_inner_peripheral!((FROM_CPU_INTR1(unstable)));
4865 _for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
4866 _for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
4867 _for_each_inner_peripheral!((UHCI0, Uhci0, 0, AhbGdmaChannel));
4868 _for_each_inner_peripheral!((SPI2, Spi2, 1, AxiGdmaChannel));
4869 _for_each_inner_peripheral!((SPI3, Spi3, 2, AxiGdmaChannel));
4870 _for_each_inner_peripheral!((AES, Aes, 4, AxiGdmaChannel));
4871 _for_each_inner_peripheral!((SHA, Sha, 5, AxiGdmaChannel));
4872 _for_each_inner_peripheral!((all(@ peri_type #[doc =
4873 "GPIO0 peripheral singleton"] GPIO0 <= virtual()), (@ peri_type #[doc =
4874 "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
4875 "GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
4876 "GPIO3 peripheral singleton"] GPIO3 <= virtual()), (@ peri_type #[doc =
4877 "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
4878 "GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
4879 "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
4880 "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
4881 "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
4882 "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
4883 "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
4884 "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
4885 "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
4886 "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
4887 "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
4888 "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
4889 "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
4890 "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
4891 "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
4892 "GPIO19 peripheral singleton"] GPIO19 <= virtual()), (@ peri_type #[doc =
4893 "GPIO20 peripheral singleton"] GPIO20 <= virtual()), (@ peri_type #[doc =
4894 "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
4895 "GPIO22 peripheral singleton"] GPIO22 <= virtual()), (@ peri_type #[doc =
4896 "GPIO23 peripheral singleton"] GPIO23 <= virtual()), (@ peri_type #[doc =
4897 "GPIO24 peripheral singleton"] GPIO24 <= virtual()), (@ peri_type #[doc =
4898 "GPIO25 peripheral singleton"] GPIO25 <= virtual()), (@ peri_type #[doc =
4899 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4900 "<section class=\"warning\">"] #[doc =
4901 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4902 #[doc = "<ul>"] #[doc =
4903 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4904 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
4905 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4906 "<section class=\"warning\">"] #[doc =
4907 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4908 #[doc = "<ul>"] #[doc =
4909 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4910 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4911 = "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
4912 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4913 "<section class=\"warning\">"] #[doc =
4914 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4915 #[doc = "<ul>"] #[doc =
4916 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4917 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4918 = "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
4919 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4920 "<section class=\"warning\">"] #[doc =
4921 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4922 #[doc = "<ul>"] #[doc =
4923 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4924 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
4925 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4926 "<section class=\"warning\">"] #[doc =
4927 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4928 #[doc = "<ul>"] #[doc =
4929 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4930 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
4931 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4932 "<section class=\"warning\">"] #[doc =
4933 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4934 #[doc = "<ul>"] #[doc =
4935 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
4936 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
4937 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4938 "<section class=\"warning\">"] #[doc =
4939 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4940 #[doc = "<ul>"] #[doc =
4941 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
4942 #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
4943 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4944 "<section class=\"warning\">"] #[doc =
4945 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4946 #[doc = "<ul>"] #[doc =
4947 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
4948 #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
4949 "GPIO35 peripheral singleton"] GPIO35 <= virtual()), (@ peri_type #[doc =
4950 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4951 "<section class=\"warning\">"] #[doc =
4952 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4953 #[doc = "<ul>"] #[doc =
4954 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4955 = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
4956 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4957 "<section class=\"warning\">"] #[doc =
4958 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4959 #[doc = "<ul>"] #[doc =
4960 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4961 = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
4962 "GPIO38 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4963 "<section class=\"warning\">"] #[doc =
4964 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4965 #[doc = "<ul>"] #[doc =
4966 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4967 = "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()), (@ peri_type #[doc =
4968 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4969 "<section class=\"warning\">"] #[doc =
4970 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4971 #[doc = "<ul>"] #[doc =
4972 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4973 = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
4974 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4975 "<section class=\"warning\">"] #[doc =
4976 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4977 #[doc = "<ul>"] #[doc =
4978 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4979 = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
4980 "GPIO42 peripheral singleton"] GPIO42 <= virtual()), (@ peri_type #[doc =
4981 "GPIO43 peripheral singleton"] GPIO43 <= virtual()), (@ peri_type #[doc =
4982 "GPIO44 peripheral singleton"] GPIO44 <= virtual()), (@ peri_type #[doc =
4983 "GPIO45 peripheral singleton"] GPIO45 <= virtual()), (@ peri_type #[doc =
4984 "GPIO46 peripheral singleton"] GPIO46 <= virtual()), (@ peri_type #[doc =
4985 "GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
4986 "GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
4987 "GPIO49 peripheral singleton"] GPIO49 <= virtual()), (@ peri_type #[doc =
4988 "GPIO50 peripheral singleton"] GPIO50 <= virtual()), (@ peri_type #[doc =
4989 "GPIO51 peripheral singleton"] GPIO51 <= virtual()), (@ peri_type #[doc =
4990 "GPIO52 peripheral singleton"] GPIO52 <= virtual()), (@ peri_type #[doc =
4991 "GPIO53 peripheral singleton"] GPIO53 <= virtual()), (@ peri_type #[doc =
4992 "GPIO54 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4993 "<section class=\"warning\">"] #[doc =
4994 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4995 #[doc = "<ul>"] #[doc =
4996 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4997 #[doc = "</ul>"] #[doc = "</section>"] GPIO54 <= virtual()), (@ peri_type #[doc =
4998 "GPIO55 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4999 "<section class=\"warning\">"] #[doc =
5000 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5001 #[doc = "<ul>"] #[doc =
5002 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5003 #[doc = "</ul>"] #[doc = "</section>"] GPIO55 <= virtual()), (@ peri_type #[doc =
5004 "GPIO56 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5005 "<section class=\"warning\">"] #[doc =
5006 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5007 #[doc = "<ul>"] #[doc =
5008 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5009 #[doc = "</ul>"] #[doc = "</section>"] GPIO56 <= virtual()), (@ peri_type #[doc =
5010 "GPIO57 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5011 "<section class=\"warning\">"] #[doc =
5012 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5013 #[doc = "<ul>"] #[doc =
5014 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
5015 #[doc = "</ul>"] #[doc = "</section>"] GPIO57 <= virtual()), (@ peri_type #[doc =
5016 "GPIO58 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5017 "<section class=\"warning\">"] #[doc =
5018 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5019 #[doc = "<ul>"] #[doc =
5020 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5021 = "</ul>"] #[doc = "</section>"] GPIO58 <= virtual()), (@ peri_type #[doc =
5022 "GPIO59 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5023 "<section class=\"warning\">"] #[doc =
5024 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5025 #[doc = "<ul>"] #[doc =
5026 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
5027 = "</ul>"] #[doc = "</section>"] GPIO59 <= virtual()), (@ peri_type #[doc =
5028 "GPIO60 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5029 "<section class=\"warning\">"] #[doc =
5030 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5031 #[doc = "<ul>"] #[doc =
5032 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5033 = "</ul>"] #[doc = "</section>"] GPIO60 <= virtual()), (@ peri_type #[doc =
5034 "GPIO61 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
5035 "<section class=\"warning\">"] #[doc =
5036 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
5037 #[doc = "<ul>"] #[doc =
5038 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
5039 = "</ul>"] #[doc = "</section>"] GPIO61 <= virtual()), (@ peri_type #[doc =
5040 "DMA_CH0 peripheral singleton"] DMA_CH0 <= virtual(AHB_PDMA_IN_CH0 : {
5041 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5042 AHB_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5043 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5044 "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(AHB_PDMA_IN_CH1 : {
5045 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5046 AHB_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5047 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5048 "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual(AHB_PDMA_IN_CH2 : {
5049 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5050 AHB_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5051 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5052 "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual(AHB_PDMA_IN_CH3 : {
5053 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5054 AHB_PDMA_OUT_CH3 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5055 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5056 "DMA_CH4 peripheral singleton"] DMA_CH4 <= virtual(AHB_PDMA_IN_CH4 : {
5057 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5058 AHB_PDMA_OUT_CH4 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5059 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5060 "DMA_AXI_CH0 peripheral singleton"] DMA_AXI_CH0 <= virtual(AXI_PDMA_IN_CH0 : {
5061 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5062 AXI_PDMA_OUT_CH0 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5063 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5064 "DMA_AXI_CH1 peripheral singleton"] DMA_AXI_CH1 <= virtual(AXI_PDMA_IN_CH1 : {
5065 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5066 AXI_PDMA_OUT_CH1 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5067 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5068 "DMA_AXI_CH2 peripheral singleton"] DMA_AXI_CH2 <= virtual(AXI_PDMA_IN_CH2 : {
5069 bind_dma_in_interrupt, enable_dma_in_interrupt, disable_dma_in_interrupt },
5070 AXI_PDMA_OUT_CH2 : { bind_dma_out_interrupt, enable_dma_out_interrupt,
5071 disable_dma_out_interrupt }) (unstable)), (@ peri_type #[doc =
5072 "SDM_CH0 peripheral singleton"] SDM_CH0 <= virtual() (unstable)), (@ peri_type
5073 #[doc = "SDM_CH1 peripheral singleton"] SDM_CH1 <= virtual() (unstable)), (@
5074 peri_type #[doc = "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual()
5075 (unstable)), (@ peri_type #[doc = "SDM_CH3 peripheral singleton"] SDM_CH3 <=
5076 virtual() (unstable)), (@ peri_type #[doc = "SDM_CH4 peripheral singleton"]
5077 SDM_CH4 <= virtual() (unstable)), (@ peri_type #[doc =
5078 "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)), (@ peri_type
5079 #[doc = "SDM_CH6 peripheral singleton"] SDM_CH6 <= virtual() (unstable)), (@
5080 peri_type #[doc = "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual()
5081 (unstable)), (@ peri_type #[doc = "AES peripheral singleton"] AES <= AES(AES : {
5082 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5083 (unstable)), (@ peri_type #[doc = "APB_SARADC peripheral singleton"] APB_SARADC
5084 <= ADC() (unstable)), (@ peri_type #[doc = "ASSIST_DEBUG peripheral singleton"]
5085 ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)), (@ peri_type #[doc =
5086 "CACHE peripheral singleton"] CACHE <= CACHE() (unstable)), (@ peri_type #[doc =
5087 "CLIC peripheral singleton"] CLIC <= CLIC() (unstable)), (@ peri_type #[doc =
5088 "CNNT_SYS peripheral singleton"] CNNT_SYS <= CNNT_SYS() (unstable)), (@ peri_type
5089 #[doc = "CNNT_IO_MUX peripheral singleton"] CNNT_IO_MUX <= CNNT_IO_MUX()
5090 (unstable)), (@ peri_type #[doc = "ECC peripheral singleton"] ECC <= ECC()
5091 (unstable)), (@ peri_type #[doc = "EFUSE peripheral singleton"] EFUSE <= EFUSE()
5092 (unstable)), (@ peri_type #[doc = "GPIO peripheral singleton"] GPIO <= GPIO()
5093 (unstable)), (@ peri_type #[doc = "GPIO_SD peripheral singleton"] GPIO_SD <=
5094 GPIO_EXT() (unstable)), (@ peri_type #[doc = "HP_APM peripheral singleton"]
5095 HP_APM <= HP_APM() (unstable)), (@ peri_type #[doc =
5096 "HP_MEM_APM peripheral singleton"] HP_MEM_APM <= HP_MEM_APM() (unstable)), (@
5097 peri_type #[doc = "HP_SYS peripheral singleton"] HP_SYS <= HP_SYS() (unstable)),
5098 (@ peri_type #[doc = "HP_ALIVE_SYS peripheral singleton"] HP_ALIVE_SYS <=
5099 HP_ALIVE_SYS() (unstable)), (@ peri_type #[doc =
5100 "HP_SYS_CLKRST peripheral singleton"] HP_SYS_CLKRST <= HP_SYS_CLKRST()
5101 (unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"] I2C0 <= I2C0(I2C0
5102 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5103 peri_type #[doc = "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C1 : {
5104 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5105 peri_type #[doc = "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <=
5106 INTERRUPT_CORE0() (unstable)), (@ peri_type #[doc =
5107 "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
5108 (unstable)), (@ peri_type #[doc = "IO_MUX peripheral singleton"] IO_MUX <=
5109 IO_MUX() (unstable)), (@ peri_type #[doc = "IOMUX_MSPI_PIN peripheral singleton"]
5110 IOMUX_MSPI_PIN <= IOMUX_MSPI_PIN() (unstable)), (@ peri_type #[doc =
5111 "LP_AON_CLK_RST peripheral singleton"] LP_AON_CLK_RST <= LP_AON_CLKRST()
5112 (unstable)), (@ peri_type #[doc = "LP_APM peripheral singleton"] LP_APM <=
5113 LP_APM() (unstable)), (@ peri_type #[doc = "LP_GPIO peripheral singleton"]
5114 LP_GPIO <= LP_GPIO() (unstable)), (@ peri_type #[doc =
5115 "LP_IO_MUX peripheral singleton"] LP_IO_MUX <= LP_IO_MUX() (unstable)), (@
5116 peri_type #[doc = "LP_PERI peripheral singleton"] LP_PERI <= LP_PERICLKRST()
5117 (unstable)), (@ peri_type #[doc = "LP_SYS peripheral singleton"] LP_SYS <=
5118 LP_SYS() (unstable)), (@ peri_type #[doc = "LP_TEE peripheral singleton"] LP_TEE
5119 <= LP_TEE() (unstable)), (@ peri_type #[doc = "LP_WDT peripheral singleton"]
5120 LP_WDT <= LP_WDT() (unstable)), (@ peri_type #[doc = "LPWR peripheral singleton"]
5121 LPWR <= PMU() (unstable)), (@ peri_type #[doc =
5122 "MEM_MONITOR peripheral singleton"] MEM_MONITOR <= MEM_MONITOR0() (unstable)), (@
5123 peri_type #[doc = "MODEM_LPCON peripheral singleton"] MODEM_LPCON <=
5124 MODEM_LPCON() (unstable)), (@ peri_type #[doc =
5125 "MODEM_SYSCON peripheral singleton"] MODEM_SYSCON <= MODEM_SYSCON() (unstable)),
5126 (@ peri_type #[doc = "PAU peripheral singleton"] PAU <= PAU() (unstable)), (@
5127 peri_type #[doc = "PMU peripheral singleton"] PMU <= PMU() (unstable)), (@
5128 peri_type #[doc = "RTC_TIMER peripheral singleton"] RTC_TIMER <= LP_TIMER()
5129 (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <= TRNG()
5130 (unstable)), (@ peri_type #[doc = "RMT peripheral singleton"] RMT <= virtual(RMT
5131 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5132 (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <= RSA(RSA : {
5133 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5134 (unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0()
5135 (unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1()
5136 (unstable)), (@ peri_type #[doc = "MEMSPI2 peripheral singleton"] MEMSPI2 <=
5137 MEMSPI2() (unstable)), (@ peri_type #[doc = "MEMSPI3 peripheral singleton"]
5138 MEMSPI3 <= MEMSPI3() (unstable)), (@ peri_type #[doc =
5139 "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
5140 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5141 "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : { bind_peri_interrupt,
5142 enable_peri_interrupt, disable_peri_interrupt })), (@ peri_type #[doc =
5143 "AXI_GDMA peripheral singleton"] AXI_GDMA <= AXI_DMA() (unstable)), (@ peri_type
5144 #[doc = "DMA peripheral singleton"] DMA <= AHB_DMA() (unstable)), (@ peri_type
5145 #[doc = "SHA peripheral singleton"] SHA <= SHA() (unstable)), (@ peri_type #[doc
5146 = "SYSTEM peripheral singleton"] SYSTEM <= HP_SYS() (unstable)), (@ peri_type
5147 #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER() (unstable)), (@
5148 peri_type #[doc = "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)),
5149 (@ peri_type #[doc = "TEE peripheral singleton"] TEE <= TEE() (unstable)), (@
5150 peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)), (@
5151 peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)), (@
5152 peri_type #[doc = "UART0 peripheral singleton"] UART0 <= UART0(UART0 : {
5153 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5154 peri_type #[doc = "UART1 peripheral singleton"] UART1 <= UART1(UART1 : {
5155 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5156 peri_type #[doc = "UART2 peripheral singleton"] UART2 <= UART2(UART2 : {
5157 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5158 peri_type #[doc = "UART3 peripheral singleton"] UART3 <= UART3(UART3 : {
5159 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
5160 peri_type #[doc = "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)), (@
5161 peri_type #[doc = "USB_DEVICE peripheral singleton"] USB_DEVICE <=
5162 USB_DEVICE(USB_DEVICE : { bind_peri_interrupt, enable_peri_interrupt,
5163 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
5164 "USB_HS peripheral singleton"] USB_HS <= USB_OTG_HS(USB_OTG_HS : {
5165 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
5166 (unstable)), (@ peri_type #[doc = "ADC1 peripheral singleton"] ADC1 <= virtual()
5167 (unstable)), (@ peri_type #[doc = "ADC2 peripheral singleton"] ADC2 <= virtual()
5168 (unstable)), (@ peri_type #[doc = "FLASH peripheral singleton"] FLASH <=
5169 virtual() (unstable)), (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM
5170 <= virtual() (unstable)), (@ peri_type #[doc =
5171 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
5172 (@ peri_type #[doc = "CPU_CTRL peripheral singleton"] CPU_CTRL <= virtual()
5173 (unstable)), (@ peri_type #[doc = "FROM_CPU_INTR0 peripheral singleton"]
5174 FROM_CPU_INTR0 <= virtual() (unstable)), (@ peri_type #[doc =
5175 "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)),
5176 (@ peri_type #[doc = "FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <=
5177 virtual() (unstable)), (@ peri_type #[doc =
5178 "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable))));
5179 _for_each_inner_peripheral!((singletons(#[cfg(not(use_xtal32k))] GPIO0),
5180 (#[cfg(not(use_xtal32k))] GPIO1), (GPIO2), (GPIO3), (GPIO4), (GPIO5), (GPIO6),
5181 (GPIO7), (GPIO8), (GPIO9), (GPIO10), (GPIO11), (GPIO12), (GPIO13), (GPIO14),
5182 (GPIO15), (GPIO16), (GPIO17), (GPIO18), (GPIO19), (GPIO20), (GPIO21), (GPIO22),
5183 (GPIO23), (GPIO24), (GPIO25), (GPIO26), (GPIO27), (GPIO28), (GPIO30), (GPIO31),
5184 (GPIO32), (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39),
5185 (GPIO40), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47), (GPIO48),
5186 (GPIO49), (GPIO50), (GPIO51), (GPIO52), (GPIO53), (GPIO54), (GPIO55), (GPIO56),
5187 (GPIO57), (GPIO58), (GPIO59), (GPIO60), (GPIO61), (DMA_CH0(unstable)),
5188 (DMA_CH1(unstable)), (DMA_CH2(unstable)), (DMA_CH3(unstable)),
5189 (DMA_CH4(unstable)), (DMA_AXI_CH0(unstable)), (DMA_AXI_CH1(unstable)),
5190 (DMA_AXI_CH2(unstable)), (SDM_CH0(unstable)), (SDM_CH1(unstable)),
5191 (SDM_CH2(unstable)), (SDM_CH3(unstable)), (SDM_CH4(unstable)),
5192 (SDM_CH5(unstable)), (SDM_CH6(unstable)), (SDM_CH7(unstable)), (AES(unstable)),
5193 (APB_SARADC(unstable)), (ASSIST_DEBUG(unstable)), (CACHE(unstable)),
5194 (CLIC(unstable)), (ECC(unstable)), (GPIO(unstable)), (GPIO_SD(unstable)),
5195 (HP_APM(unstable)), (HP_MEM_APM(unstable)), (HP_SYS(unstable)),
5196 (HP_ALIVE_SYS(unstable)), (HP_SYS_CLKRST(unstable)), (I2C0), (I2C1),
5197 (INTERRUPT_CORE0(unstable)), (INTERRUPT_CORE1(unstable)), (IO_MUX(unstable)),
5198 (LP_AON_CLK_RST(unstable)), (LP_APM(unstable)), (LP_GPIO(unstable)),
5199 (LP_IO_MUX(unstable)), (LP_PERI(unstable)), (LP_SYS(unstable)),
5200 (LP_TEE(unstable)), (LP_WDT(unstable)), (LPWR(unstable)),
5201 (MEM_MONITOR(unstable)), (MODEM_LPCON(unstable)), (MODEM_SYSCON(unstable)),
5202 (PAU(unstable)), (PMU(unstable)), (RTC_TIMER(unstable)), (RNG(unstable)),
5203 (RMT(unstable)), (RSA(unstable)), (SPI0(unstable)), (SPI1(unstable)), (SPI2),
5204 (SPI3), (AXI_GDMA(unstable)), (DMA(unstable)), (SHA(unstable)),
5205 (SYSTEM(unstable)), (SYSTIMER(unstable)), (SDHOST(unstable)), (TEE(unstable)),
5206 (TIMG0(unstable)), (TIMG1(unstable)), (UART0), (UART1), (UART2), (UART3),
5207 (UHCI0(unstable)), (USB_DEVICE(unstable)), (USB_HS(unstable)), (ADC1(unstable)),
5208 (ADC2(unstable)), (FLASH(unstable)), (PSRAM(unstable)),
5209 (GPIO_DEDICATED(unstable)), (CPU_CTRL(unstable)), (FROM_CPU_INTR0(unstable)),
5210 (FROM_CPU_INTR1(unstable)), (FROM_CPU_INTR2(unstable)),
5211 (FROM_CPU_INTR3(unstable)))); _for_each_inner_peripheral!((dma_eligible(UHCI0,
5212 Uhci0, 0, AhbGdmaChannel), (SPI2, Spi2, 1, AxiGdmaChannel), (SPI3, Spi3, 2,
5213 AxiGdmaChannel), (AES, Aes, 4, AxiGdmaChannel), (SHA, Sha, 5, AxiGdmaChannel)));
5214 };
5215}
5216#[macro_export]
5243#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5244macro_rules! for_each_gpio {
5245 ($($pattern:tt => $code:tt;)*) => {
5246 macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
5247 } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
5248 _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
5249 _for_each_inner_gpio!((2, GPIO2(_3 => LCD_DATA19) (_3 => LCD_DATA19) ([Input]
5250 [Output]))); _for_each_inner_gpio!((3, GPIO3(_3 => LCD_DATA20) (_3 => LCD_DATA20)
5251 ([Input] [Output]))); _for_each_inner_gpio!((4, GPIO4(_3 => LCD_DATA21) (_3 =>
5252 LCD_DATA21) ([Input] [Output]))); _for_each_inner_gpio!((5, GPIO5(_3 =>
5253 LCD_DATA22) (_3 => LCD_DATA22) ([Input] [Output]))); _for_each_inner_gpio!((6,
5254 GPIO6() () ([Input] [Output]))); _for_each_inner_gpio!((7, GPIO7(_3 =>
5255 LCD_DATA23) (_3 => LCD_DATA23) ([Input] [Output]))); _for_each_inner_gpio!((8,
5256 GPIO8(_2 => GMAC_PHY_TXD0 _3 => LCD_DATA0) (_2 => GMAC_PHY_TXD0 _3 => LCD_DATA0)
5257 ([Input] [Output]))); _for_each_inner_gpio!((9, GPIO9(_0 => FSPIHD _2 =>
5258 GMAC_PHY_TXD1 _3 => LCD_DATA1 _4 => DBG_PSRAM_CK) (_0 => FSPIHD _2 =>
5259 GMAC_PHY_TXD1 _3 => LCD_DATA1 _4 => DBG_PSRAM_CK) ([Input] [Output])));
5260 _for_each_inner_gpio!((10, GPIO10(_0 => FSPICS0 _2 => GMAC_PHY_TXD2 _3 =>
5261 LCD_DATA2 _4 => DBG_PSRAM_CS) (_0 => FSPICS0 _2 => GMAC_PHY_TXD2 _3 => LCD_DATA2
5262 _4 => DBG_PSRAM_CS) ([Input] [Output]))); _for_each_inner_gpio!((11, GPIO11(_0 =>
5263 FSPID _2 => GMAC_PHY_TXD3 _3 => LCD_DATA3 _4 => DBG_PSRAM_D) (_0 => FSPID _2 =>
5264 GMAC_PHY_TXD3 _3 => LCD_DATA3 _4 => DBG_PSRAM_D) ([Input] [Output])));
5265 _for_each_inner_gpio!((12, GPIO12(_0 => FSPICLK _2 => GMAC_PHY_TXEN _3 =>
5266 LCD_DATA4 _4 => DBG_PSRAM_Q) (_0 => FSPICLK _2 => GMAC_PHY_TXEN _3 => LCD_DATA4
5267 _4 => DBG_PSRAM_Q) ([Input] [Output]))); _for_each_inner_gpio!((13, GPIO13(_0 =>
5268 FSPIQ _2 => GMAC_RMII_CLK _3 => LCD_DATA5 _4 => DBG_PSRAM_WP) (_0 => FSPIQ _2 =>
5269 GMAC_RMII_CLK _3 => LCD_DATA5 _4 => DBG_PSRAM_WP) ([Input] [Output])));
5270 _for_each_inner_gpio!((14, GPIO14(_0 => FSPIWP _2 => GMAC_RX_CLK _3 => LCD_DATA6
5271 _4 => DBG_PSRAM_HOLD) (_0 => FSPIWP _2 => GMAC_RX_CLK _3 => LCD_DATA6 _4 =>
5272 DBG_PSRAM_HOLD) ([Input] [Output]))); _for_each_inner_gpio!((15, GPIO15(_0 =>
5273 FSPIIO4 _2 => GMAC_PHY_RXDV _3 => LCD_DATA7 _4 => DBG_PSRAM_DQ4) (_0 => FSPIIO4
5274 _2 => GMAC_PHY_RXDV _3 => LCD_DATA7 _4 => DBG_PSRAM_DQ4) ([Input] [Output])));
5275 _for_each_inner_gpio!((16, GPIO16(_0 => FSPIIO5 _2 => GMAC_PHY_RXD3 _3 =>
5276 LCD_DATA8 _4 => DBG_PSRAM_DQ5) (_0 => FSPIIO5 _2 => GMAC_PHY_RXD3 _3 => LCD_DATA8
5277 _4 => DBG_PSRAM_DQ5) ([Input] [Output]))); _for_each_inner_gpio!((17, GPIO17(_0
5278 => FSPIIO6 _2 => GMAC_PHY_RXD2 _3 => LCD_DATA9 _4 => DBG_PSRAM_DQ6) (_0 =>
5279 FSPIIO6 _2 => GMAC_PHY_RXD2 _3 => LCD_DATA9 _4 => DBG_PSRAM_DQ6) ([Input]
5280 [Output]))); _for_each_inner_gpio!((18, GPIO18(_0 => FSPIIO7 _2 => GMAC_PHY_RXD1
5281 _3 => LCD_DATA10 _4 => DBG_PSRAM_DQ7) (_0 => FSPIIO7 _2 => GMAC_PHY_RXD1 _3 =>
5282 LCD_DATA10 _4 => DBG_PSRAM_DQ7) ([Input] [Output]))); _for_each_inner_gpio!((19,
5283 GPIO19(_2 => GMAC_PHY_RXD0 _3 => LCD_DATA11 _4 => DBG_PSRAM_DQS_0) (_0 => FSPIDQS
5284 _2 => GMAC_PHY_RXD0 _3 => LCD_DATA11 _4 => DBG_PSRAM_DQS_0) ([Input] [Output])));
5285 _for_each_inner_gpio!((20, GPIO20(_0 => SD1_DATA0 _2 => FSPICLK _4 =>
5286 DBG_FLASH_CK) (_0 => SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) ([Input]
5287 [Output]))); _for_each_inner_gpio!((21, GPIO21(_0 => SD1_DATA1 _2 => FSPID _4 =>
5288 DBG_FLASH_D) (_0 => SD1_DATA1 _2 => FSPID _4 => DBG_FLASH_D) ([Input]
5289 [Output]))); _for_each_inner_gpio!((22, GPIO22(_0 => SD1_DATA2 _2 => FSPIQ _4 =>
5290 DBG_FLASH_CS) (_0 => SD1_DATA2 _2 => FSPIQ _4 => DBG_FLASH_CS) ([Input]
5291 [Output]))); _for_each_inner_gpio!((23, GPIO23(_0 => SD1_DATA3 _2 => FSPICS0 _4
5292 => DBG_FLASH_Q) (_0 => SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) ([Input]
5293 [Output]))); _for_each_inner_gpio!((24, GPIO24(_0 => SD1_CLK _2 => FSPIHD _4 =>
5294 DBG_FLASH_WP) (_0 => SD1_CLK _2 => FSPIHD _4 => DBG_FLASH_WP) ([Input]
5295 [Output]))); _for_each_inner_gpio!((25, GPIO25(_0 => SD1_CMD _2 => FSPIWP _4 =>
5296 DBG_FLASH_HOLD) (_0 => SD1_CMD _2 => FSPIWP _4 => DBG_FLASH_HOLD) ([Input]
5297 [Output]))); _for_each_inner_gpio!((26, GPIO26(_0 => SPICS0) (_0 => SPICS0)
5298 ([Input] [Output]))); _for_each_inner_gpio!((27, GPIO27(_0 => SPIQ) (_0 => SPIQ)
5299 ([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0 => SPIWP) (_0 =>
5300 SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((30, GPIO30(_0 => SPIHD) (_0
5301 => SPIHD) ([Input] [Output]))); _for_each_inner_gpio!((31, GPIO31(_0 => SPICLK)
5302 (_0 => SPICLK) ([Input] [Output]))); _for_each_inner_gpio!((32, GPIO32(_0 =>
5303 SPID) (_0 => SPID) ([Input] [Output]))); _for_each_inner_gpio!((33, GPIO33(_3 =>
5304 LCD_DATA12) (_3 => LCD_DATA12) ([Input] [Output]))); _for_each_inner_gpio!((34,
5305 GPIO34(_3 => LCD_DATA13) (_3 => LCD_DATA13) ([Input] [Output])));
5306 _for_each_inner_gpio!((35, GPIO35(_2 => REF_GMAC_CLK _3 => LCD_DATA14 _4 =>
5307 SD2_CDATA0) (_2 => REF_GMAC_CLK _3 => LCD_DATA14 _4 => SD2_CDATA0) ([Input]
5308 [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => GMAC_PHY_RXDV _3 =>
5309 LCD_DATA15 _4 => SD2_CDATA1) (_2 => GMAC_PHY_RXDV _3 => LCD_DATA15 _4 =>
5310 SD2_CDATA1) ([Input] [Output]))); _for_each_inner_gpio!((37, GPIO37(_2 =>
5311 GMAC_PHY_TXEN _3 => LCD_DATA16 _4 => SD2_CDATA2) (_2 => GMAC_PHY_TXEN _3 =>
5312 LCD_DATA16 _4 => SD2_CDATA2) ([Input] [Output]))); _for_each_inner_gpio!((38,
5313 GPIO38(_2 => GMAC_PHY_RXD3 _3 => LCD_DATA17 _4 => SD2_CDATA3) (_2 =>
5314 GMAC_PHY_RXD3 _3 => LCD_DATA17 _4 => SD2_CDATA3) ([Input] [Output])));
5315 _for_each_inner_gpio!((39, GPIO39(_2 => GMAC_PHY_RXD2 _3 => LCD_DATA18 _4 =>
5316 SD2_CCLK) (_2 => GMAC_PHY_RXD2 _3 => LCD_DATA18 _4 => SD2_CCLK) ([Input]
5317 [Output]))); _for_each_inner_gpio!((40, GPIO40(_2 => GMAC_PHY_RXD1 _3 => LCD_PCLK
5318 _4 => SD2_CCMD) (_2 => GMAC_PHY_RXD1 _3 => LCD_PCLK _4 => SD2_CCMD) ([Input]
5319 [Output]))); _for_each_inner_gpio!((42, GPIO42(_2 => GMAC_RX_CLK) (_2 =>
5320 GMAC_RX_CLK) ([Input] [Output]))); _for_each_inner_gpio!((43, GPIO43(_2 =>
5321 GMAC_RMII_CLK _3 => LCD_H_ENABLE) (_2 => GMAC_RMII_CLK _3 => LCD_H_ENABLE)
5322 ([Input] [Output]))); _for_each_inner_gpio!((44, GPIO44(_2 => GMAC_PHY_TXD0 _3 =>
5323 LCD_H_SYNC) (_2 => GMAC_PHY_TXD0 _3 => LCD_H_SYNC) ([Input] [Output])));
5324 _for_each_inner_gpio!((45, GPIO45(_2 => GMAC_PHY_TXD1 _3 => LCD_V_SYNC) (_2 =>
5325 GMAC_PHY_TXD1 _3 => LCD_V_SYNC) ([Input] [Output]))); _for_each_inner_gpio!((46,
5326 GPIO46(_2 => GMAC_PHY_TXD2 _3 => CAM_DATA0) (_2 => GMAC_PHY_TXD2 _3 => CAM_DATA0)
5327 ([Input] [Output]))); _for_each_inner_gpio!((47, GPIO47(_2 => GMAC_PHY_TXD3 _3 =>
5328 CAM_DATA1) (_2 => GMAC_PHY_TXD3 _3 => CAM_DATA1) ([Input] [Output])));
5329 _for_each_inner_gpio!((48, GPIO48(_3 => CAM_DATA2) (_3 => CAM_DATA2) ([Input]
5330 [Output]))); _for_each_inner_gpio!((49, GPIO49(_3 => CAM_DATA3) (_3 => CAM_DATA3)
5331 ([Input] [Output]))); _for_each_inner_gpio!((50, GPIO50(_3 => CAM_DATA4) (_3 =>
5332 CAM_DATA4) ([Input] [Output]))); _for_each_inner_gpio!((51, GPIO51(_3 =>
5333 CAM_DATA5) (_3 => CAM_DATA5) ([Input] [Output]))); _for_each_inner_gpio!((52,
5334 GPIO52(_2 => FSPICS0 _3 => CAM_DATA6) (_2 => FSPICS0 _3 => CAM_DATA6) ([Input]
5335 [Output]))); _for_each_inner_gpio!((53, GPIO53(_2 => FSPICLK _3 => CAM_DATA7) (_2
5336 => FSPICLK _3 => CAM_DATA7) ([Input] [Output]))); _for_each_inner_gpio!((54,
5337 GPIO54(_0 => MTDO _2 => FSPID _3 => CAM_PCLK) (_0 => MTDO _2 => FSPID _3 =>
5338 CAM_PCLK) ([Input] [Output]))); _for_each_inner_gpio!((55, GPIO55(_0 => MTCK _2
5339 => FSPIQ _3 => CAM_XCLK) (_0 => MTCK _2 => FSPIQ _3 => CAM_XCLK) ([Input]
5340 [Output]))); _for_each_inner_gpio!((56, GPIO56(_0 => MTDI _2 => FSPIHD _3 =>
5341 CAM_V_SYNC) (_0 => MTDI _2 => FSPIHD _3 => CAM_V_SYNC) ([Input] [Output])));
5342 _for_each_inner_gpio!((57, GPIO57(_0 => MTMS _2 => FSPIWP _3 => CAM_H_SYNC) (_0
5343 => MTMS _2 => FSPIWP _3 => CAM_H_SYNC) ([Input] [Output])));
5344 _for_each_inner_gpio!((58, GPIO58() (_0 => U0TXD) ([Input] [Output])));
5345 _for_each_inner_gpio!((59, GPIO59(_0 => U0RXD) () ([Input] [Output])));
5346 _for_each_inner_gpio!((60, GPIO60() () ([Input] [Output])));
5347 _for_each_inner_gpio!((61, GPIO61() () ([Input] [Output])));
5348 _for_each_inner_gpio!((all(0, GPIO0() () ([Input] [Output])), (1, GPIO1() ()
5349 ([Input] [Output])), (2, GPIO2(_3 => LCD_DATA19) (_3 => LCD_DATA19) ([Input]
5350 [Output])), (3, GPIO3(_3 => LCD_DATA20) (_3 => LCD_DATA20) ([Input] [Output])),
5351 (4, GPIO4(_3 => LCD_DATA21) (_3 => LCD_DATA21) ([Input] [Output])), (5, GPIO5(_3
5352 => LCD_DATA22) (_3 => LCD_DATA22) ([Input] [Output])), (6, GPIO6() () ([Input]
5353 [Output])), (7, GPIO7(_3 => LCD_DATA23) (_3 => LCD_DATA23) ([Input] [Output])),
5354 (8, GPIO8(_2 => GMAC_PHY_TXD0 _3 => LCD_DATA0) (_2 => GMAC_PHY_TXD0 _3 =>
5355 LCD_DATA0) ([Input] [Output])), (9, GPIO9(_0 => FSPIHD _2 => GMAC_PHY_TXD1 _3 =>
5356 LCD_DATA1 _4 => DBG_PSRAM_CK) (_0 => FSPIHD _2 => GMAC_PHY_TXD1 _3 => LCD_DATA1
5357 _4 => DBG_PSRAM_CK) ([Input] [Output])), (10, GPIO10(_0 => FSPICS0 _2 =>
5358 GMAC_PHY_TXD2 _3 => LCD_DATA2 _4 => DBG_PSRAM_CS) (_0 => FSPICS0 _2 =>
5359 GMAC_PHY_TXD2 _3 => LCD_DATA2 _4 => DBG_PSRAM_CS) ([Input] [Output])), (11,
5360 GPIO11(_0 => FSPID _2 => GMAC_PHY_TXD3 _3 => LCD_DATA3 _4 => DBG_PSRAM_D) (_0 =>
5361 FSPID _2 => GMAC_PHY_TXD3 _3 => LCD_DATA3 _4 => DBG_PSRAM_D) ([Input] [Output])),
5362 (12, GPIO12(_0 => FSPICLK _2 => GMAC_PHY_TXEN _3 => LCD_DATA4 _4 => DBG_PSRAM_Q)
5363 (_0 => FSPICLK _2 => GMAC_PHY_TXEN _3 => LCD_DATA4 _4 => DBG_PSRAM_Q) ([Input]
5364 [Output])), (13, GPIO13(_0 => FSPIQ _2 => GMAC_RMII_CLK _3 => LCD_DATA5 _4 =>
5365 DBG_PSRAM_WP) (_0 => FSPIQ _2 => GMAC_RMII_CLK _3 => LCD_DATA5 _4 =>
5366 DBG_PSRAM_WP) ([Input] [Output])), (14, GPIO14(_0 => FSPIWP _2 => GMAC_RX_CLK _3
5367 => LCD_DATA6 _4 => DBG_PSRAM_HOLD) (_0 => FSPIWP _2 => GMAC_RX_CLK _3 =>
5368 LCD_DATA6 _4 => DBG_PSRAM_HOLD) ([Input] [Output])), (15, GPIO15(_0 => FSPIIO4 _2
5369 => GMAC_PHY_RXDV _3 => LCD_DATA7 _4 => DBG_PSRAM_DQ4) (_0 => FSPIIO4 _2 =>
5370 GMAC_PHY_RXDV _3 => LCD_DATA7 _4 => DBG_PSRAM_DQ4) ([Input] [Output])), (16,
5371 GPIO16(_0 => FSPIIO5 _2 => GMAC_PHY_RXD3 _3 => LCD_DATA8 _4 => DBG_PSRAM_DQ5) (_0
5372 => FSPIIO5 _2 => GMAC_PHY_RXD3 _3 => LCD_DATA8 _4 => DBG_PSRAM_DQ5) ([Input]
5373 [Output])), (17, GPIO17(_0 => FSPIIO6 _2 => GMAC_PHY_RXD2 _3 => LCD_DATA9 _4 =>
5374 DBG_PSRAM_DQ6) (_0 => FSPIIO6 _2 => GMAC_PHY_RXD2 _3 => LCD_DATA9 _4 =>
5375 DBG_PSRAM_DQ6) ([Input] [Output])), (18, GPIO18(_0 => FSPIIO7 _2 => GMAC_PHY_RXD1
5376 _3 => LCD_DATA10 _4 => DBG_PSRAM_DQ7) (_0 => FSPIIO7 _2 => GMAC_PHY_RXD1 _3 =>
5377 LCD_DATA10 _4 => DBG_PSRAM_DQ7) ([Input] [Output])), (19, GPIO19(_2 =>
5378 GMAC_PHY_RXD0 _3 => LCD_DATA11 _4 => DBG_PSRAM_DQS_0) (_0 => FSPIDQS _2 =>
5379 GMAC_PHY_RXD0 _3 => LCD_DATA11 _4 => DBG_PSRAM_DQS_0) ([Input] [Output])), (20,
5380 GPIO20(_0 => SD1_DATA0 _2 => FSPICLK _4 => DBG_FLASH_CK) (_0 => SD1_DATA0 _2 =>
5381 FSPICLK _4 => DBG_FLASH_CK) ([Input] [Output])), (21, GPIO21(_0 => SD1_DATA1 _2
5382 => FSPID _4 => DBG_FLASH_D) (_0 => SD1_DATA1 _2 => FSPID _4 => DBG_FLASH_D)
5383 ([Input] [Output])), (22, GPIO22(_0 => SD1_DATA2 _2 => FSPIQ _4 => DBG_FLASH_CS)
5384 (_0 => SD1_DATA2 _2 => FSPIQ _4 => DBG_FLASH_CS) ([Input] [Output])), (23,
5385 GPIO23(_0 => SD1_DATA3 _2 => FSPICS0 _4 => DBG_FLASH_Q) (_0 => SD1_DATA3 _2 =>
5386 FSPICS0 _4 => DBG_FLASH_Q) ([Input] [Output])), (24, GPIO24(_0 => SD1_CLK _2 =>
5387 FSPIHD _4 => DBG_FLASH_WP) (_0 => SD1_CLK _2 => FSPIHD _4 => DBG_FLASH_WP)
5388 ([Input] [Output])), (25, GPIO25(_0 => SD1_CMD _2 => FSPIWP _4 => DBG_FLASH_HOLD)
5389 (_0 => SD1_CMD _2 => FSPIWP _4 => DBG_FLASH_HOLD) ([Input] [Output])), (26,
5390 GPIO26(_0 => SPICS0) (_0 => SPICS0) ([Input] [Output])), (27, GPIO27(_0 => SPIQ)
5391 (_0 => SPIQ) ([Input] [Output])), (28, GPIO28(_0 => SPIWP) (_0 => SPIWP) ([Input]
5392 [Output])), (30, GPIO30(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])), (31,
5393 GPIO31(_0 => SPICLK) (_0 => SPICLK) ([Input] [Output])), (32, GPIO32(_0 => SPID)
5394 (_0 => SPID) ([Input] [Output])), (33, GPIO33(_3 => LCD_DATA12) (_3 =>
5395 LCD_DATA12) ([Input] [Output])), (34, GPIO34(_3 => LCD_DATA13) (_3 => LCD_DATA13)
5396 ([Input] [Output])), (35, GPIO35(_2 => REF_GMAC_CLK _3 => LCD_DATA14 _4 =>
5397 SD2_CDATA0) (_2 => REF_GMAC_CLK _3 => LCD_DATA14 _4 => SD2_CDATA0) ([Input]
5398 [Output])), (36, GPIO36(_2 => GMAC_PHY_RXDV _3 => LCD_DATA15 _4 => SD2_CDATA1)
5399 (_2 => GMAC_PHY_RXDV _3 => LCD_DATA15 _4 => SD2_CDATA1) ([Input] [Output])), (37,
5400 GPIO37(_2 => GMAC_PHY_TXEN _3 => LCD_DATA16 _4 => SD2_CDATA2) (_2 =>
5401 GMAC_PHY_TXEN _3 => LCD_DATA16 _4 => SD2_CDATA2) ([Input] [Output])), (38,
5402 GPIO38(_2 => GMAC_PHY_RXD3 _3 => LCD_DATA17 _4 => SD2_CDATA3) (_2 =>
5403 GMAC_PHY_RXD3 _3 => LCD_DATA17 _4 => SD2_CDATA3) ([Input] [Output])), (39,
5404 GPIO39(_2 => GMAC_PHY_RXD2 _3 => LCD_DATA18 _4 => SD2_CCLK) (_2 => GMAC_PHY_RXD2
5405 _3 => LCD_DATA18 _4 => SD2_CCLK) ([Input] [Output])), (40, GPIO40(_2 =>
5406 GMAC_PHY_RXD1 _3 => LCD_PCLK _4 => SD2_CCMD) (_2 => GMAC_PHY_RXD1 _3 => LCD_PCLK
5407 _4 => SD2_CCMD) ([Input] [Output])), (42, GPIO42(_2 => GMAC_RX_CLK) (_2 =>
5408 GMAC_RX_CLK) ([Input] [Output])), (43, GPIO43(_2 => GMAC_RMII_CLK _3 =>
5409 LCD_H_ENABLE) (_2 => GMAC_RMII_CLK _3 => LCD_H_ENABLE) ([Input] [Output])), (44,
5410 GPIO44(_2 => GMAC_PHY_TXD0 _3 => LCD_H_SYNC) (_2 => GMAC_PHY_TXD0 _3 =>
5411 LCD_H_SYNC) ([Input] [Output])), (45, GPIO45(_2 => GMAC_PHY_TXD1 _3 =>
5412 LCD_V_SYNC) (_2 => GMAC_PHY_TXD1 _3 => LCD_V_SYNC) ([Input] [Output])), (46,
5413 GPIO46(_2 => GMAC_PHY_TXD2 _3 => CAM_DATA0) (_2 => GMAC_PHY_TXD2 _3 => CAM_DATA0)
5414 ([Input] [Output])), (47, GPIO47(_2 => GMAC_PHY_TXD3 _3 => CAM_DATA1) (_2 =>
5415 GMAC_PHY_TXD3 _3 => CAM_DATA1) ([Input] [Output])), (48, GPIO48(_3 => CAM_DATA2)
5416 (_3 => CAM_DATA2) ([Input] [Output])), (49, GPIO49(_3 => CAM_DATA3) (_3 =>
5417 CAM_DATA3) ([Input] [Output])), (50, GPIO50(_3 => CAM_DATA4) (_3 => CAM_DATA4)
5418 ([Input] [Output])), (51, GPIO51(_3 => CAM_DATA5) (_3 => CAM_DATA5) ([Input]
5419 [Output])), (52, GPIO52(_2 => FSPICS0 _3 => CAM_DATA6) (_2 => FSPICS0 _3 =>
5420 CAM_DATA6) ([Input] [Output])), (53, GPIO53(_2 => FSPICLK _3 => CAM_DATA7) (_2 =>
5421 FSPICLK _3 => CAM_DATA7) ([Input] [Output])), (54, GPIO54(_0 => MTDO _2 => FSPID
5422 _3 => CAM_PCLK) (_0 => MTDO _2 => FSPID _3 => CAM_PCLK) ([Input] [Output])), (55,
5423 GPIO55(_0 => MTCK _2 => FSPIQ _3 => CAM_XCLK) (_0 => MTCK _2 => FSPIQ _3 =>
5424 CAM_XCLK) ([Input] [Output])), (56, GPIO56(_0 => MTDI _2 => FSPIHD _3 =>
5425 CAM_V_SYNC) (_0 => MTDI _2 => FSPIHD _3 => CAM_V_SYNC) ([Input] [Output])), (57,
5426 GPIO57(_0 => MTMS _2 => FSPIWP _3 => CAM_H_SYNC) (_0 => MTMS _2 => FSPIWP _3 =>
5427 CAM_H_SYNC) ([Input] [Output])), (58, GPIO58() (_0 => U0TXD) ([Input] [Output])),
5428 (59, GPIO59(_0 => U0RXD) () ([Input] [Output])), (60, GPIO60() () ([Input]
5429 [Output])), (61, GPIO61() () ([Input] [Output]))));
5430 };
5431}
5432#[macro_export]
5459#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5460macro_rules! for_each_analog_function {
5461 ($($pattern:tt => $code:tt;)*) => {
5462 macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
5463 tt) => {} } _for_each_inner_analog_function!((XTAL_32K_N, GPIO0));
5464 _for_each_inner_analog_function!((XTAL_32K_P, GPIO1));
5465 _for_each_inner_analog_function!((USJ_DM, GPIO33));
5466 _for_each_inner_analog_function!((USJ_DP, GPIO34));
5467 _for_each_inner_analog_function!((ADC1_CH0, GPIO42));
5468 _for_each_inner_analog_function!((ADC1_CH1, GPIO43));
5469 _for_each_inner_analog_function!((ADC1_CH2, GPIO44));
5470 _for_each_inner_analog_function!((ADC1_CH3, GPIO45));
5471 _for_each_inner_analog_function!((ADC1_CH4, GPIO46));
5472 _for_each_inner_analog_function!((ADC1_CH5, GPIO47));
5473 _for_each_inner_analog_function!((ADC1_CH6, GPIO48));
5474 _for_each_inner_analog_function!((ADC1_CH7, GPIO49));
5475 _for_each_inner_analog_function!((ADC2_CH0, GPIO50));
5476 _for_each_inner_analog_function!((ADC2_CH1, GPIO51));
5477 _for_each_inner_analog_function!((ADC2_CH2, GPIO52));
5478 _for_each_inner_analog_function!((ADC2_CH3, GPIO53));
5479 _for_each_inner_analog_function!((ADC2_CH4, GPIO54));
5480 _for_each_inner_analog_function!((ADC2_CH5, GPIO55));
5481 _for_each_inner_analog_function!((ADC2_CH6, GPIO56));
5482 _for_each_inner_analog_function!((ADC2_CH7, GPIO57));
5483 _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO42));
5484 _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO43));
5485 _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO44));
5486 _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO45));
5487 _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO46));
5488 _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO47));
5489 _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO48));
5490 _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO49));
5491 _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO50));
5492 _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO51));
5493 _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO52));
5494 _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO53));
5495 _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO54));
5496 _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO55));
5497 _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO56));
5498 _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO57));
5499 _for_each_inner_analog_function!((all(XTAL_32K_N, GPIO0), (XTAL_32K_P, GPIO1),
5500 (USJ_DM, GPIO33), (USJ_DP, GPIO34), (ADC1_CH0, GPIO42), (ADC1_CH1, GPIO43),
5501 (ADC1_CH2, GPIO44), (ADC1_CH3, GPIO45), (ADC1_CH4, GPIO46), (ADC1_CH5, GPIO47),
5502 (ADC1_CH6, GPIO48), (ADC1_CH7, GPIO49), (ADC2_CH0, GPIO50), (ADC2_CH1, GPIO51),
5503 (ADC2_CH2, GPIO52), (ADC2_CH3, GPIO53), (ADC2_CH4, GPIO54), (ADC2_CH5, GPIO55),
5504 (ADC2_CH6, GPIO56), (ADC2_CH7, GPIO57)));
5505 _for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0, ADCn_CHm, 1, 0), GPIO42),
5506 ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO43), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO44),
5507 ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO45), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO46),
5508 ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO47), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO48),
5509 ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO49), ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO50),
5510 ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO51), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO52),
5511 ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO53), ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO54),
5512 ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO55), ((ADC2_CH6, ADCn_CHm, 2, 6), GPIO56),
5513 ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO57)));
5514 };
5515}
5516#[macro_export]
5554#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5555macro_rules! for_each_lp_function {
5556 ($($pattern:tt => $code:tt;)*) => {
5557 macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
5558 => {} } _for_each_inner_lp_function!((LP_GPIO0, GPIO0, _0));
5559 _for_each_inner_lp_function!((LP_GPIO1, GPIO1, _0));
5560 _for_each_inner_lp_function!((LP_GPIO2, GPIO2, _0));
5561 _for_each_inner_lp_function!((LP_GPIO3, GPIO3, _0));
5562 _for_each_inner_lp_function!((LP_GPIO4, GPIO4, _0));
5563 _for_each_inner_lp_function!((LP_GPIO5, GPIO5, _0));
5564 _for_each_inner_lp_function!((LP_GPIO6, GPIO6, _0));
5565 _for_each_inner_lp_function!((LP_GPIO7, GPIO7, _0));
5566 _for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, () ()));
5567 _for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()));
5568 _for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _0, () ()));
5569 _for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()));
5570 _for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _0, () ()));
5571 _for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()));
5572 _for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()));
5573 _for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO7, _0, () ()));
5574 _for_each_inner_lp_function!((all(LP_GPIO0, GPIO0, _0), (LP_GPIO1, GPIO1, _0),
5575 (LP_GPIO2, GPIO2, _0), (LP_GPIO3, GPIO3, _0), (LP_GPIO4, GPIO4, _0), (LP_GPIO5,
5576 GPIO5, _0), (LP_GPIO6, GPIO6, _0), (LP_GPIO7, GPIO7, _0)));
5577 _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, ()
5578 ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()), ((LP_GPIO2, LP_GPIOn, 2),
5579 GPIO2, _0, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()), ((LP_GPIO4,
5580 LP_GPIOn, 4), GPIO4, _0, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()),
5581 ((LP_GPIO6, LP_GPIOn, 6), GPIO6, _0, () ()), ((LP_GPIO7, LP_GPIOn, 7), GPIO7, _0,
5582 () ())));
5583 };
5584}
5585#[macro_export]
5616#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5617macro_rules! for_each_iomux_function {
5618 ($($pattern:tt => $code:tt;)*) => {
5619 macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
5620 tt) => {} } _for_each_inner_iomux_function!((LCD_DATA19, GPIO2, _3));
5621 _for_each_inner_iomux_function!((LCD_DATA20, GPIO3, _3));
5622 _for_each_inner_iomux_function!((LCD_DATA21, GPIO4, _3));
5623 _for_each_inner_iomux_function!((LCD_DATA22, GPIO5, _3));
5624 _for_each_inner_iomux_function!((LCD_DATA23, GPIO7, _3));
5625 _for_each_inner_iomux_function!((GMAC_PHY_TXD0, GPIO8, _2));
5626 _for_each_inner_iomux_function!((LCD_DATA0, GPIO8, _3));
5627 _for_each_inner_iomux_function!((FSPIHD, GPIO9, _0));
5628 _for_each_inner_iomux_function!((GMAC_PHY_TXD1, GPIO9, _2));
5629 _for_each_inner_iomux_function!((LCD_DATA1, GPIO9, _3));
5630 _for_each_inner_iomux_function!((DBG_PSRAM_CK, GPIO9, _4));
5631 _for_each_inner_iomux_function!((FSPICS0, GPIO10, _0));
5632 _for_each_inner_iomux_function!((GMAC_PHY_TXD2, GPIO10, _2));
5633 _for_each_inner_iomux_function!((LCD_DATA2, GPIO10, _3));
5634 _for_each_inner_iomux_function!((DBG_PSRAM_CS, GPIO10, _4));
5635 _for_each_inner_iomux_function!((FSPID, GPIO11, _0));
5636 _for_each_inner_iomux_function!((GMAC_PHY_TXD3, GPIO11, _2));
5637 _for_each_inner_iomux_function!((LCD_DATA3, GPIO11, _3));
5638 _for_each_inner_iomux_function!((DBG_PSRAM_D, GPIO11, _4));
5639 _for_each_inner_iomux_function!((FSPICLK, GPIO12, _0));
5640 _for_each_inner_iomux_function!((GMAC_PHY_TXEN, GPIO12, _2));
5641 _for_each_inner_iomux_function!((LCD_DATA4, GPIO12, _3));
5642 _for_each_inner_iomux_function!((DBG_PSRAM_Q, GPIO12, _4));
5643 _for_each_inner_iomux_function!((FSPIQ, GPIO13, _0));
5644 _for_each_inner_iomux_function!((GMAC_RMII_CLK, GPIO13, _2));
5645 _for_each_inner_iomux_function!((LCD_DATA5, GPIO13, _3));
5646 _for_each_inner_iomux_function!((DBG_PSRAM_WP, GPIO13, _4));
5647 _for_each_inner_iomux_function!((FSPIWP, GPIO14, _0));
5648 _for_each_inner_iomux_function!((GMAC_RX_CLK, GPIO14, _2));
5649 _for_each_inner_iomux_function!((LCD_DATA6, GPIO14, _3));
5650 _for_each_inner_iomux_function!((DBG_PSRAM_HOLD, GPIO14, _4));
5651 _for_each_inner_iomux_function!((FSPIIO4, GPIO15, _0));
5652 _for_each_inner_iomux_function!((GMAC_PHY_RXDV, GPIO15, _2));
5653 _for_each_inner_iomux_function!((LCD_DATA7, GPIO15, _3));
5654 _for_each_inner_iomux_function!((DBG_PSRAM_DQ4, GPIO15, _4));
5655 _for_each_inner_iomux_function!((FSPIIO5, GPIO16, _0));
5656 _for_each_inner_iomux_function!((GMAC_PHY_RXD3, GPIO16, _2));
5657 _for_each_inner_iomux_function!((LCD_DATA8, GPIO16, _3));
5658 _for_each_inner_iomux_function!((DBG_PSRAM_DQ5, GPIO16, _4));
5659 _for_each_inner_iomux_function!((FSPIIO6, GPIO17, _0));
5660 _for_each_inner_iomux_function!((GMAC_PHY_RXD2, GPIO17, _2));
5661 _for_each_inner_iomux_function!((LCD_DATA9, GPIO17, _3));
5662 _for_each_inner_iomux_function!((DBG_PSRAM_DQ6, GPIO17, _4));
5663 _for_each_inner_iomux_function!((FSPIIO7, GPIO18, _0));
5664 _for_each_inner_iomux_function!((GMAC_PHY_RXD1, GPIO18, _2));
5665 _for_each_inner_iomux_function!((LCD_DATA10, GPIO18, _3));
5666 _for_each_inner_iomux_function!((DBG_PSRAM_DQ7, GPIO18, _4));
5667 _for_each_inner_iomux_function!((FSPIDQS, GPIO19, _0));
5668 _for_each_inner_iomux_function!((GMAC_PHY_RXD0, GPIO19, _2));
5669 _for_each_inner_iomux_function!((LCD_DATA11, GPIO19, _3));
5670 _for_each_inner_iomux_function!((DBG_PSRAM_DQS_0, GPIO19, _4));
5671 _for_each_inner_iomux_function!((SD1_DATA0, GPIO20, _0));
5672 _for_each_inner_iomux_function!((FSPICLK, GPIO20, _2));
5673 _for_each_inner_iomux_function!((DBG_FLASH_CK, GPIO20, _4));
5674 _for_each_inner_iomux_function!((SD1_DATA1, GPIO21, _0));
5675 _for_each_inner_iomux_function!((FSPID, GPIO21, _2));
5676 _for_each_inner_iomux_function!((DBG_FLASH_D, GPIO21, _4));
5677 _for_each_inner_iomux_function!((SD1_DATA2, GPIO22, _0));
5678 _for_each_inner_iomux_function!((FSPIQ, GPIO22, _2));
5679 _for_each_inner_iomux_function!((DBG_FLASH_CS, GPIO22, _4));
5680 _for_each_inner_iomux_function!((SD1_DATA3, GPIO23, _0));
5681 _for_each_inner_iomux_function!((FSPICS0, GPIO23, _2));
5682 _for_each_inner_iomux_function!((DBG_FLASH_Q, GPIO23, _4));
5683 _for_each_inner_iomux_function!((SD1_CLK, GPIO24, _0));
5684 _for_each_inner_iomux_function!((FSPIHD, GPIO24, _2));
5685 _for_each_inner_iomux_function!((DBG_FLASH_WP, GPIO24, _4));
5686 _for_each_inner_iomux_function!((SD1_CMD, GPIO25, _0));
5687 _for_each_inner_iomux_function!((FSPIWP, GPIO25, _2));
5688 _for_each_inner_iomux_function!((DBG_FLASH_HOLD, GPIO25, _4));
5689 _for_each_inner_iomux_function!((SPICS0, GPIO26, _0));
5690 _for_each_inner_iomux_function!((SPIQ, GPIO27, _0));
5691 _for_each_inner_iomux_function!((SPIWP, GPIO28, _0));
5692 _for_each_inner_iomux_function!((SPIHD, GPIO30, _0));
5693 _for_each_inner_iomux_function!((SPICLK, GPIO31, _0));
5694 _for_each_inner_iomux_function!((SPID, GPIO32, _0));
5695 _for_each_inner_iomux_function!((LCD_DATA12, GPIO33, _3));
5696 _for_each_inner_iomux_function!((LCD_DATA13, GPIO34, _3));
5697 _for_each_inner_iomux_function!((REF_GMAC_CLK, GPIO35, _2));
5698 _for_each_inner_iomux_function!((LCD_DATA14, GPIO35, _3));
5699 _for_each_inner_iomux_function!((SD2_CDATA0, GPIO35, _4));
5700 _for_each_inner_iomux_function!((GMAC_PHY_RXDV, GPIO36, _2));
5701 _for_each_inner_iomux_function!((LCD_DATA15, GPIO36, _3));
5702 _for_each_inner_iomux_function!((SD2_CDATA1, GPIO36, _4));
5703 _for_each_inner_iomux_function!((GMAC_PHY_TXEN, GPIO37, _2));
5704 _for_each_inner_iomux_function!((LCD_DATA16, GPIO37, _3));
5705 _for_each_inner_iomux_function!((SD2_CDATA2, GPIO37, _4));
5706 _for_each_inner_iomux_function!((GMAC_PHY_RXD3, GPIO38, _2));
5707 _for_each_inner_iomux_function!((LCD_DATA17, GPIO38, _3));
5708 _for_each_inner_iomux_function!((SD2_CDATA3, GPIO38, _4));
5709 _for_each_inner_iomux_function!((GMAC_PHY_RXD2, GPIO39, _2));
5710 _for_each_inner_iomux_function!((LCD_DATA18, GPIO39, _3));
5711 _for_each_inner_iomux_function!((SD2_CCLK, GPIO39, _4));
5712 _for_each_inner_iomux_function!((GMAC_PHY_RXD1, GPIO40, _2));
5713 _for_each_inner_iomux_function!((LCD_PCLK, GPIO40, _3));
5714 _for_each_inner_iomux_function!((SD2_CCMD, GPIO40, _4));
5715 _for_each_inner_iomux_function!((GMAC_RX_CLK, GPIO42, _2));
5716 _for_each_inner_iomux_function!((GMAC_RMII_CLK, GPIO43, _2));
5717 _for_each_inner_iomux_function!((LCD_H_ENABLE, GPIO43, _3));
5718 _for_each_inner_iomux_function!((GMAC_PHY_TXD0, GPIO44, _2));
5719 _for_each_inner_iomux_function!((LCD_H_SYNC, GPIO44, _3));
5720 _for_each_inner_iomux_function!((GMAC_PHY_TXD1, GPIO45, _2));
5721 _for_each_inner_iomux_function!((LCD_V_SYNC, GPIO45, _3));
5722 _for_each_inner_iomux_function!((GMAC_PHY_TXD2, GPIO46, _2));
5723 _for_each_inner_iomux_function!((CAM_DATA0, GPIO46, _3));
5724 _for_each_inner_iomux_function!((GMAC_PHY_TXD3, GPIO47, _2));
5725 _for_each_inner_iomux_function!((CAM_DATA1, GPIO47, _3));
5726 _for_each_inner_iomux_function!((CAM_DATA2, GPIO48, _3));
5727 _for_each_inner_iomux_function!((CAM_DATA3, GPIO49, _3));
5728 _for_each_inner_iomux_function!((CAM_DATA4, GPIO50, _3));
5729 _for_each_inner_iomux_function!((CAM_DATA5, GPIO51, _3));
5730 _for_each_inner_iomux_function!((FSPICS0, GPIO52, _2));
5731 _for_each_inner_iomux_function!((CAM_DATA6, GPIO52, _3));
5732 _for_each_inner_iomux_function!((FSPICLK, GPIO53, _2));
5733 _for_each_inner_iomux_function!((CAM_DATA7, GPIO53, _3));
5734 _for_each_inner_iomux_function!((MTDO, GPIO54, _0));
5735 _for_each_inner_iomux_function!((FSPID, GPIO54, _2));
5736 _for_each_inner_iomux_function!((CAM_PCLK, GPIO54, _3));
5737 _for_each_inner_iomux_function!((MTCK, GPIO55, _0));
5738 _for_each_inner_iomux_function!((FSPIQ, GPIO55, _2));
5739 _for_each_inner_iomux_function!((CAM_XCLK, GPIO55, _3));
5740 _for_each_inner_iomux_function!((MTDI, GPIO56, _0));
5741 _for_each_inner_iomux_function!((FSPIHD, GPIO56, _2));
5742 _for_each_inner_iomux_function!((CAM_V_SYNC, GPIO56, _3));
5743 _for_each_inner_iomux_function!((MTMS, GPIO57, _0));
5744 _for_each_inner_iomux_function!((FSPIWP, GPIO57, _2));
5745 _for_each_inner_iomux_function!((CAM_H_SYNC, GPIO57, _3));
5746 _for_each_inner_iomux_function!((U0TXD, GPIO58, _0));
5747 _for_each_inner_iomux_function!((U0RXD, GPIO59, _0));
5748 _for_each_inner_iomux_function!(((LCD_DATA19, LCD_DATAn, 19), GPIO2, _3));
5749 _for_each_inner_iomux_function!(((LCD_DATA20, LCD_DATAn, 20), GPIO3, _3));
5750 _for_each_inner_iomux_function!(((LCD_DATA21, LCD_DATAn, 21), GPIO4, _3));
5751 _for_each_inner_iomux_function!(((LCD_DATA22, LCD_DATAn, 22), GPIO5, _3));
5752 _for_each_inner_iomux_function!(((LCD_DATA23, LCD_DATAn, 23), GPIO7, _3));
5753 _for_each_inner_iomux_function!(((LCD_DATA0, LCD_DATAn, 0), GPIO8, _3));
5754 _for_each_inner_iomux_function!(((LCD_DATA1, LCD_DATAn, 1), GPIO9, _3));
5755 _for_each_inner_iomux_function!(((LCD_DATA2, LCD_DATAn, 2), GPIO10, _3));
5756 _for_each_inner_iomux_function!(((LCD_DATA3, LCD_DATAn, 3), GPIO11, _3));
5757 _for_each_inner_iomux_function!(((LCD_DATA4, LCD_DATAn, 4), GPIO12, _3));
5758 _for_each_inner_iomux_function!(((LCD_DATA5, LCD_DATAn, 5), GPIO13, _3));
5759 _for_each_inner_iomux_function!(((LCD_DATA6, LCD_DATAn, 6), GPIO14, _3));
5760 _for_each_inner_iomux_function!(((LCD_DATA7, LCD_DATAn, 7), GPIO15, _3));
5761 _for_each_inner_iomux_function!(((LCD_DATA8, LCD_DATAn, 8), GPIO16, _3));
5762 _for_each_inner_iomux_function!(((LCD_DATA9, LCD_DATAn, 9), GPIO17, _3));
5763 _for_each_inner_iomux_function!(((LCD_DATA10, LCD_DATAn, 10), GPIO18, _3));
5764 _for_each_inner_iomux_function!(((LCD_DATA11, LCD_DATAn, 11), GPIO19, _3));
5765 _for_each_inner_iomux_function!(((LCD_DATA12, LCD_DATAn, 12), GPIO33, _3));
5766 _for_each_inner_iomux_function!(((LCD_DATA13, LCD_DATAn, 13), GPIO34, _3));
5767 _for_each_inner_iomux_function!(((LCD_DATA14, LCD_DATAn, 14), GPIO35, _3));
5768 _for_each_inner_iomux_function!(((LCD_DATA15, LCD_DATAn, 15), GPIO36, _3));
5769 _for_each_inner_iomux_function!(((LCD_DATA16, LCD_DATAn, 16), GPIO37, _3));
5770 _for_each_inner_iomux_function!(((LCD_DATA17, LCD_DATAn, 17), GPIO38, _3));
5771 _for_each_inner_iomux_function!(((LCD_DATA18, LCD_DATAn, 18), GPIO39, _3));
5772 _for_each_inner_iomux_function!(((GMAC_PHY_TXD0, GMAC_PHY_TXDn, 0), GPIO8, _2));
5773 _for_each_inner_iomux_function!(((GMAC_PHY_TXD1, GMAC_PHY_TXDn, 1), GPIO9, _2));
5774 _for_each_inner_iomux_function!(((GMAC_PHY_TXD2, GMAC_PHY_TXDn, 2), GPIO10, _2));
5775 _for_each_inner_iomux_function!(((GMAC_PHY_TXD3, GMAC_PHY_TXDn, 3), GPIO11, _2));
5776 _for_each_inner_iomux_function!(((GMAC_PHY_TXD0, GMAC_PHY_TXDn, 0), GPIO44, _2));
5777 _for_each_inner_iomux_function!(((GMAC_PHY_TXD1, GMAC_PHY_TXDn, 1), GPIO45, _2));
5778 _for_each_inner_iomux_function!(((GMAC_PHY_TXD2, GMAC_PHY_TXDn, 2), GPIO46, _2));
5779 _for_each_inner_iomux_function!(((GMAC_PHY_TXD3, GMAC_PHY_TXDn, 3), GPIO47, _2));
5780 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO10, _0));
5781 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO23, _2));
5782 _for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO52, _2));
5783 _for_each_inner_iomux_function!(((FSPIIO4, FSPIIOn, 4), GPIO15, _0));
5784 _for_each_inner_iomux_function!(((FSPIIO5, FSPIIOn, 5), GPIO16, _0));
5785 _for_each_inner_iomux_function!(((FSPIIO6, FSPIIOn, 6), GPIO17, _0));
5786 _for_each_inner_iomux_function!(((FSPIIO7, FSPIIOn, 7), GPIO18, _0));
5787 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4), GPIO15, _4));
5788 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO16, _4));
5789 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ6, DBG_PSRAM_DQn, 6), GPIO17, _4));
5790 _for_each_inner_iomux_function!(((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO18, _4));
5791 _for_each_inner_iomux_function!(((GMAC_PHY_RXD3, GMAC_PHY_RXDn, 3), GPIO16, _2));
5792 _for_each_inner_iomux_function!(((GMAC_PHY_RXD2, GMAC_PHY_RXDn, 2), GPIO17, _2));
5793 _for_each_inner_iomux_function!(((GMAC_PHY_RXD1, GMAC_PHY_RXDn, 1), GPIO18, _2));
5794 _for_each_inner_iomux_function!(((GMAC_PHY_RXD0, GMAC_PHY_RXDn, 0), GPIO19, _2));
5795 _for_each_inner_iomux_function!(((GMAC_PHY_RXD3, GMAC_PHY_RXDn, 3), GPIO38, _2));
5796 _for_each_inner_iomux_function!(((GMAC_PHY_RXD2, GMAC_PHY_RXDn, 2), GPIO39, _2));
5797 _for_each_inner_iomux_function!(((GMAC_PHY_RXD1, GMAC_PHY_RXDn, 1), GPIO40, _2));
5798 _for_each_inner_iomux_function!(((DBG_PSRAM_DQS_0, DBG_PSRAM_DQS_n, 0), GPIO19,
5799 _4)); _for_each_inner_iomux_function!(((SD1_DATA0, SDn_DATAm, 1, 0), GPIO20,
5800 _0)); _for_each_inner_iomux_function!(((SD1_DATA1, SDn_DATAm, 1, 1), GPIO21,
5801 _0)); _for_each_inner_iomux_function!(((SD1_DATA2, SDn_DATAm, 1, 2), GPIO22,
5802 _0)); _for_each_inner_iomux_function!(((SD1_DATA3, SDn_DATAm, 1, 3), GPIO23,
5803 _0)); _for_each_inner_iomux_function!(((SD1_CLK, SDn_CLK, 1), GPIO24, _0));
5804 _for_each_inner_iomux_function!(((SD1_CMD, SDn_CMD, 1), GPIO25, _0));
5805 _for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO26, _0));
5806 _for_each_inner_iomux_function!(((SD2_CDATA0, SDn_CDATAm, 2, 0), GPIO35, _4));
5807 _for_each_inner_iomux_function!(((SD2_CDATA1, SDn_CDATAm, 2, 1), GPIO36, _4));
5808 _for_each_inner_iomux_function!(((SD2_CDATA2, SDn_CDATAm, 2, 2), GPIO37, _4));
5809 _for_each_inner_iomux_function!(((SD2_CDATA3, SDn_CDATAm, 2, 3), GPIO38, _4));
5810 _for_each_inner_iomux_function!(((SD2_CCLK, SDn_CCLK, 2), GPIO39, _4));
5811 _for_each_inner_iomux_function!(((SD2_CCMD, SDn_CCMD, 2), GPIO40, _4));
5812 _for_each_inner_iomux_function!(((CAM_DATA0, CAM_DATAn, 0), GPIO46, _3));
5813 _for_each_inner_iomux_function!(((CAM_DATA1, CAM_DATAn, 1), GPIO47, _3));
5814 _for_each_inner_iomux_function!(((CAM_DATA2, CAM_DATAn, 2), GPIO48, _3));
5815 _for_each_inner_iomux_function!(((CAM_DATA3, CAM_DATAn, 3), GPIO49, _3));
5816 _for_each_inner_iomux_function!(((CAM_DATA4, CAM_DATAn, 4), GPIO50, _3));
5817 _for_each_inner_iomux_function!(((CAM_DATA5, CAM_DATAn, 5), GPIO51, _3));
5818 _for_each_inner_iomux_function!(((CAM_DATA6, CAM_DATAn, 6), GPIO52, _3));
5819 _for_each_inner_iomux_function!(((CAM_DATA7, CAM_DATAn, 7), GPIO53, _3));
5820 _for_each_inner_iomux_function!((all(LCD_DATA19, GPIO2, _3), (LCD_DATA20, GPIO3,
5821 _3), (LCD_DATA21, GPIO4, _3), (LCD_DATA22, GPIO5, _3), (LCD_DATA23, GPIO7, _3),
5822 (GMAC_PHY_TXD0, GPIO8, _2), (LCD_DATA0, GPIO8, _3), (FSPIHD, GPIO9, _0),
5823 (GMAC_PHY_TXD1, GPIO9, _2), (LCD_DATA1, GPIO9, _3), (DBG_PSRAM_CK, GPIO9, _4),
5824 (FSPICS0, GPIO10, _0), (GMAC_PHY_TXD2, GPIO10, _2), (LCD_DATA2, GPIO10, _3),
5825 (DBG_PSRAM_CS, GPIO10, _4), (FSPID, GPIO11, _0), (GMAC_PHY_TXD3, GPIO11, _2),
5826 (LCD_DATA3, GPIO11, _3), (DBG_PSRAM_D, GPIO11, _4), (FSPICLK, GPIO12, _0),
5827 (GMAC_PHY_TXEN, GPIO12, _2), (LCD_DATA4, GPIO12, _3), (DBG_PSRAM_Q, GPIO12, _4),
5828 (FSPIQ, GPIO13, _0), (GMAC_RMII_CLK, GPIO13, _2), (LCD_DATA5, GPIO13, _3),
5829 (DBG_PSRAM_WP, GPIO13, _4), (FSPIWP, GPIO14, _0), (GMAC_RX_CLK, GPIO14, _2),
5830 (LCD_DATA6, GPIO14, _3), (DBG_PSRAM_HOLD, GPIO14, _4), (FSPIIO4, GPIO15, _0),
5831 (GMAC_PHY_RXDV, GPIO15, _2), (LCD_DATA7, GPIO15, _3), (DBG_PSRAM_DQ4, GPIO15,
5832 _4), (FSPIIO5, GPIO16, _0), (GMAC_PHY_RXD3, GPIO16, _2), (LCD_DATA8, GPIO16, _3),
5833 (DBG_PSRAM_DQ5, GPIO16, _4), (FSPIIO6, GPIO17, _0), (GMAC_PHY_RXD2, GPIO17, _2),
5834 (LCD_DATA9, GPIO17, _3), (DBG_PSRAM_DQ6, GPIO17, _4), (FSPIIO7, GPIO18, _0),
5835 (GMAC_PHY_RXD1, GPIO18, _2), (LCD_DATA10, GPIO18, _3), (DBG_PSRAM_DQ7, GPIO18,
5836 _4), (FSPIDQS, GPIO19, _0), (GMAC_PHY_RXD0, GPIO19, _2), (LCD_DATA11, GPIO19,
5837 _3), (DBG_PSRAM_DQS_0, GPIO19, _4), (SD1_DATA0, GPIO20, _0), (FSPICLK, GPIO20,
5838 _2), (DBG_FLASH_CK, GPIO20, _4), (SD1_DATA1, GPIO21, _0), (FSPID, GPIO21, _2),
5839 (DBG_FLASH_D, GPIO21, _4), (SD1_DATA2, GPIO22, _0), (FSPIQ, GPIO22, _2),
5840 (DBG_FLASH_CS, GPIO22, _4), (SD1_DATA3, GPIO23, _0), (FSPICS0, GPIO23, _2),
5841 (DBG_FLASH_Q, GPIO23, _4), (SD1_CLK, GPIO24, _0), (FSPIHD, GPIO24, _2),
5842 (DBG_FLASH_WP, GPIO24, _4), (SD1_CMD, GPIO25, _0), (FSPIWP, GPIO25, _2),
5843 (DBG_FLASH_HOLD, GPIO25, _4), (SPICS0, GPIO26, _0), (SPIQ, GPIO27, _0), (SPIWP,
5844 GPIO28, _0), (SPIHD, GPIO30, _0), (SPICLK, GPIO31, _0), (SPID, GPIO32, _0),
5845 (LCD_DATA12, GPIO33, _3), (LCD_DATA13, GPIO34, _3), (REF_GMAC_CLK, GPIO35, _2),
5846 (LCD_DATA14, GPIO35, _3), (SD2_CDATA0, GPIO35, _4), (GMAC_PHY_RXDV, GPIO36, _2),
5847 (LCD_DATA15, GPIO36, _3), (SD2_CDATA1, GPIO36, _4), (GMAC_PHY_TXEN, GPIO37, _2),
5848 (LCD_DATA16, GPIO37, _3), (SD2_CDATA2, GPIO37, _4), (GMAC_PHY_RXD3, GPIO38, _2),
5849 (LCD_DATA17, GPIO38, _3), (SD2_CDATA3, GPIO38, _4), (GMAC_PHY_RXD2, GPIO39, _2),
5850 (LCD_DATA18, GPIO39, _3), (SD2_CCLK, GPIO39, _4), (GMAC_PHY_RXD1, GPIO40, _2),
5851 (LCD_PCLK, GPIO40, _3), (SD2_CCMD, GPIO40, _4), (GMAC_RX_CLK, GPIO42, _2),
5852 (GMAC_RMII_CLK, GPIO43, _2), (LCD_H_ENABLE, GPIO43, _3), (GMAC_PHY_TXD0, GPIO44,
5853 _2), (LCD_H_SYNC, GPIO44, _3), (GMAC_PHY_TXD1, GPIO45, _2), (LCD_V_SYNC, GPIO45,
5854 _3), (GMAC_PHY_TXD2, GPIO46, _2), (CAM_DATA0, GPIO46, _3), (GMAC_PHY_TXD3,
5855 GPIO47, _2), (CAM_DATA1, GPIO47, _3), (CAM_DATA2, GPIO48, _3), (CAM_DATA3,
5856 GPIO49, _3), (CAM_DATA4, GPIO50, _3), (CAM_DATA5, GPIO51, _3), (FSPICS0, GPIO52,
5857 _2), (CAM_DATA6, GPIO52, _3), (FSPICLK, GPIO53, _2), (CAM_DATA7, GPIO53, _3),
5858 (MTDO, GPIO54, _0), (FSPID, GPIO54, _2), (CAM_PCLK, GPIO54, _3), (MTCK, GPIO55,
5859 _0), (FSPIQ, GPIO55, _2), (CAM_XCLK, GPIO55, _3), (MTDI, GPIO56, _0), (FSPIHD,
5860 GPIO56, _2), (CAM_V_SYNC, GPIO56, _3), (MTMS, GPIO57, _0), (FSPIWP, GPIO57, _2),
5861 (CAM_H_SYNC, GPIO57, _3), (U0TXD, GPIO58, _0), (U0RXD, GPIO59, _0)));
5862 _for_each_inner_iomux_function!((LCD_DATAn((LCD_DATA19, LCD_DATAn, 19), GPIO2,
5863 _3), ((LCD_DATA20, LCD_DATAn, 20), GPIO3, _3), ((LCD_DATA21, LCD_DATAn, 21),
5864 GPIO4, _3), ((LCD_DATA22, LCD_DATAn, 22), GPIO5, _3), ((LCD_DATA23, LCD_DATAn,
5865 23), GPIO7, _3), ((LCD_DATA0, LCD_DATAn, 0), GPIO8, _3), ((LCD_DATA1, LCD_DATAn,
5866 1), GPIO9, _3), ((LCD_DATA2, LCD_DATAn, 2), GPIO10, _3), ((LCD_DATA3, LCD_DATAn,
5867 3), GPIO11, _3), ((LCD_DATA4, LCD_DATAn, 4), GPIO12, _3), ((LCD_DATA5, LCD_DATAn,
5868 5), GPIO13, _3), ((LCD_DATA6, LCD_DATAn, 6), GPIO14, _3), ((LCD_DATA7, LCD_DATAn,
5869 7), GPIO15, _3), ((LCD_DATA8, LCD_DATAn, 8), GPIO16, _3), ((LCD_DATA9, LCD_DATAn,
5870 9), GPIO17, _3), ((LCD_DATA10, LCD_DATAn, 10), GPIO18, _3), ((LCD_DATA11,
5871 LCD_DATAn, 11), GPIO19, _3), ((LCD_DATA12, LCD_DATAn, 12), GPIO33, _3),
5872 ((LCD_DATA13, LCD_DATAn, 13), GPIO34, _3), ((LCD_DATA14, LCD_DATAn, 14), GPIO35,
5873 _3), ((LCD_DATA15, LCD_DATAn, 15), GPIO36, _3), ((LCD_DATA16, LCD_DATAn, 16),
5874 GPIO37, _3), ((LCD_DATA17, LCD_DATAn, 17), GPIO38, _3), ((LCD_DATA18, LCD_DATAn,
5875 18), GPIO39, _3)));
5876 _for_each_inner_iomux_function!((GMAC_PHY_TXDn((GMAC_PHY_TXD0, GMAC_PHY_TXDn, 0),
5877 GPIO8, _2), ((GMAC_PHY_TXD1, GMAC_PHY_TXDn, 1), GPIO9, _2), ((GMAC_PHY_TXD2,
5878 GMAC_PHY_TXDn, 2), GPIO10, _2), ((GMAC_PHY_TXD3, GMAC_PHY_TXDn, 3), GPIO11, _2),
5879 ((GMAC_PHY_TXD0, GMAC_PHY_TXDn, 0), GPIO44, _2), ((GMAC_PHY_TXD1, GMAC_PHY_TXDn,
5880 1), GPIO45, _2), ((GMAC_PHY_TXD2, GMAC_PHY_TXDn, 2), GPIO46, _2),
5881 ((GMAC_PHY_TXD3, GMAC_PHY_TXDn, 3), GPIO47, _2)));
5882 _for_each_inner_iomux_function!((FSPICSn((FSPICS0, FSPICSn, 0), GPIO10, _0),
5883 ((FSPICS0, FSPICSn, 0), GPIO23, _2), ((FSPICS0, FSPICSn, 0), GPIO52, _2)));
5884 _for_each_inner_iomux_function!((FSPIIOn((FSPIIO4, FSPIIOn, 4), GPIO15, _0),
5885 ((FSPIIO5, FSPIIOn, 5), GPIO16, _0), ((FSPIIO6, FSPIIOn, 6), GPIO17, _0),
5886 ((FSPIIO7, FSPIIOn, 7), GPIO18, _0)));
5887 _for_each_inner_iomux_function!((DBG_PSRAM_DQn((DBG_PSRAM_DQ4, DBG_PSRAM_DQn, 4),
5888 GPIO15, _4), ((DBG_PSRAM_DQ5, DBG_PSRAM_DQn, 5), GPIO16, _4), ((DBG_PSRAM_DQ6,
5889 DBG_PSRAM_DQn, 6), GPIO17, _4), ((DBG_PSRAM_DQ7, DBG_PSRAM_DQn, 7), GPIO18,
5890 _4))); _for_each_inner_iomux_function!((GMAC_PHY_RXDn((GMAC_PHY_RXD3,
5891 GMAC_PHY_RXDn, 3), GPIO16, _2), ((GMAC_PHY_RXD2, GMAC_PHY_RXDn, 2), GPIO17, _2),
5892 ((GMAC_PHY_RXD1, GMAC_PHY_RXDn, 1), GPIO18, _2), ((GMAC_PHY_RXD0, GMAC_PHY_RXDn,
5893 0), GPIO19, _2), ((GMAC_PHY_RXD3, GMAC_PHY_RXDn, 3), GPIO38, _2),
5894 ((GMAC_PHY_RXD2, GMAC_PHY_RXDn, 2), GPIO39, _2), ((GMAC_PHY_RXD1, GMAC_PHY_RXDn,
5895 1), GPIO40, _2)));
5896 _for_each_inner_iomux_function!((DBG_PSRAM_DQS_n((DBG_PSRAM_DQS_0,
5897 DBG_PSRAM_DQS_n, 0), GPIO19, _4)));
5898 _for_each_inner_iomux_function!((SDn_DATAm((SD1_DATA0, SDn_DATAm, 1, 0), GPIO20,
5899 _0), ((SD1_DATA1, SDn_DATAm, 1, 1), GPIO21, _0), ((SD1_DATA2, SDn_DATAm, 1, 2),
5900 GPIO22, _0), ((SD1_DATA3, SDn_DATAm, 1, 3), GPIO23, _0)));
5901 _for_each_inner_iomux_function!((SDn_CLK((SD1_CLK, SDn_CLK, 1), GPIO24, _0)));
5902 _for_each_inner_iomux_function!((SDn_CMD((SD1_CMD, SDn_CMD, 1), GPIO25, _0)));
5903 _for_each_inner_iomux_function!((SPICSn((SPICS0, SPICSn, 0), GPIO26, _0)));
5904 _for_each_inner_iomux_function!((SDn_CDATAm((SD2_CDATA0, SDn_CDATAm, 2, 0),
5905 GPIO35, _4), ((SD2_CDATA1, SDn_CDATAm, 2, 1), GPIO36, _4), ((SD2_CDATA2,
5906 SDn_CDATAm, 2, 2), GPIO37, _4), ((SD2_CDATA3, SDn_CDATAm, 2, 3), GPIO38, _4)));
5907 _for_each_inner_iomux_function!((SDn_CCLK((SD2_CCLK, SDn_CCLK, 2), GPIO39, _4)));
5908 _for_each_inner_iomux_function!((SDn_CCMD((SD2_CCMD, SDn_CCMD, 2), GPIO40, _4)));
5909 _for_each_inner_iomux_function!((CAM_DATAn((CAM_DATA0, CAM_DATAn, 0), GPIO46,
5910 _3), ((CAM_DATA1, CAM_DATAn, 1), GPIO47, _3), ((CAM_DATA2, CAM_DATAn, 2), GPIO48,
5911 _3), ((CAM_DATA3, CAM_DATAn, 3), GPIO49, _3), ((CAM_DATA4, CAM_DATAn, 4), GPIO50,
5912 _3), ((CAM_DATA5, CAM_DATAn, 5), GPIO51, _3), ((CAM_DATA6, CAM_DATAn, 6), GPIO52,
5913 _3), ((CAM_DATA7, CAM_DATAn, 7), GPIO53, _3)));
5914 };
5915}
5916#[macro_export]
5933#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
5934macro_rules! gpio_for_signal {
5935 (XTAL_32K_N $(, $_fallback:literal)?) => {
5936 "GPIO0"
5937 };
5938 (LP_GPIO0 $(, $_fallback:literal)?) => {
5939 "GPIO0"
5940 };
5941 (XTAL_32K_P $(, $_fallback:literal)?) => {
5942 "GPIO1"
5943 };
5944 (LP_GPIO1 $(, $_fallback:literal)?) => {
5945 "GPIO1"
5946 };
5947 (LCD_DATA19 $(, $_fallback:literal)?) => {
5948 "GPIO2"
5949 };
5950 (LP_GPIO2 $(, $_fallback:literal)?) => {
5951 "GPIO2"
5952 };
5953 (LCD_DATA20 $(, $_fallback:literal)?) => {
5954 "GPIO3"
5955 };
5956 (LP_GPIO3 $(, $_fallback:literal)?) => {
5957 "GPIO3"
5958 };
5959 (LCD_DATA21 $(, $_fallback:literal)?) => {
5960 "GPIO4"
5961 };
5962 (LP_GPIO4 $(, $_fallback:literal)?) => {
5963 "GPIO4"
5964 };
5965 (LCD_DATA22 $(, $_fallback:literal)?) => {
5966 "GPIO5"
5967 };
5968 (LP_GPIO5 $(, $_fallback:literal)?) => {
5969 "GPIO5"
5970 };
5971 (LP_GPIO6 $(, $_fallback:literal)?) => {
5972 "GPIO6"
5973 };
5974 (LCD_DATA23 $(, $_fallback:literal)?) => {
5975 "GPIO7"
5976 };
5977 (LP_GPIO7 $(, $_fallback:literal)?) => {
5978 "GPIO7"
5979 };
5980 (GMAC_PHY_TXD0 $(, $_fallback:literal)?) => {
5981 "GPIO8"
5982 };
5983 (LCD_DATA0 $(, $_fallback:literal)?) => {
5984 "GPIO8"
5985 };
5986 (FSPIHD $(, $_fallback:literal)?) => {
5987 "GPIO9"
5988 };
5989 (GMAC_PHY_TXD1 $(, $_fallback:literal)?) => {
5990 "GPIO9"
5991 };
5992 (LCD_DATA1 $(, $_fallback:literal)?) => {
5993 "GPIO9"
5994 };
5995 (DBG_PSRAM_CK $(, $_fallback:literal)?) => {
5996 "GPIO9"
5997 };
5998 (FSPICS0 $(, $_fallback:literal)?) => {
5999 "GPIO10"
6000 };
6001 (GMAC_PHY_TXD2 $(, $_fallback:literal)?) => {
6002 "GPIO10"
6003 };
6004 (LCD_DATA2 $(, $_fallback:literal)?) => {
6005 "GPIO10"
6006 };
6007 (DBG_PSRAM_CS $(, $_fallback:literal)?) => {
6008 "GPIO10"
6009 };
6010 (FSPID $(, $_fallback:literal)?) => {
6011 "GPIO11"
6012 };
6013 (GMAC_PHY_TXD3 $(, $_fallback:literal)?) => {
6014 "GPIO11"
6015 };
6016 (LCD_DATA3 $(, $_fallback:literal)?) => {
6017 "GPIO11"
6018 };
6019 (DBG_PSRAM_D $(, $_fallback:literal)?) => {
6020 "GPIO11"
6021 };
6022 (FSPICLK $(, $_fallback:literal)?) => {
6023 "GPIO12"
6024 };
6025 (GMAC_PHY_TXEN $(, $_fallback:literal)?) => {
6026 "GPIO12"
6027 };
6028 (LCD_DATA4 $(, $_fallback:literal)?) => {
6029 "GPIO12"
6030 };
6031 (DBG_PSRAM_Q $(, $_fallback:literal)?) => {
6032 "GPIO12"
6033 };
6034 (FSPIQ $(, $_fallback:literal)?) => {
6035 "GPIO13"
6036 };
6037 (GMAC_RMII_CLK $(, $_fallback:literal)?) => {
6038 "GPIO13"
6039 };
6040 (LCD_DATA5 $(, $_fallback:literal)?) => {
6041 "GPIO13"
6042 };
6043 (DBG_PSRAM_WP $(, $_fallback:literal)?) => {
6044 "GPIO13"
6045 };
6046 (FSPIWP $(, $_fallback:literal)?) => {
6047 "GPIO14"
6048 };
6049 (GMAC_RX_CLK $(, $_fallback:literal)?) => {
6050 "GPIO14"
6051 };
6052 (LCD_DATA6 $(, $_fallback:literal)?) => {
6053 "GPIO14"
6054 };
6055 (DBG_PSRAM_HOLD $(, $_fallback:literal)?) => {
6056 "GPIO14"
6057 };
6058 (FSPIIO4 $(, $_fallback:literal)?) => {
6059 "GPIO15"
6060 };
6061 (GMAC_PHY_RXDV $(, $_fallback:literal)?) => {
6062 "GPIO15"
6063 };
6064 (LCD_DATA7 $(, $_fallback:literal)?) => {
6065 "GPIO15"
6066 };
6067 (DBG_PSRAM_DQ4 $(, $_fallback:literal)?) => {
6068 "GPIO15"
6069 };
6070 (FSPIIO5 $(, $_fallback:literal)?) => {
6071 "GPIO16"
6072 };
6073 (GMAC_PHY_RXD3 $(, $_fallback:literal)?) => {
6074 "GPIO16"
6075 };
6076 (LCD_DATA8 $(, $_fallback:literal)?) => {
6077 "GPIO16"
6078 };
6079 (DBG_PSRAM_DQ5 $(, $_fallback:literal)?) => {
6080 "GPIO16"
6081 };
6082 (FSPIIO6 $(, $_fallback:literal)?) => {
6083 "GPIO17"
6084 };
6085 (GMAC_PHY_RXD2 $(, $_fallback:literal)?) => {
6086 "GPIO17"
6087 };
6088 (LCD_DATA9 $(, $_fallback:literal)?) => {
6089 "GPIO17"
6090 };
6091 (DBG_PSRAM_DQ6 $(, $_fallback:literal)?) => {
6092 "GPIO17"
6093 };
6094 (FSPIIO7 $(, $_fallback:literal)?) => {
6095 "GPIO18"
6096 };
6097 (GMAC_PHY_RXD1 $(, $_fallback:literal)?) => {
6098 "GPIO18"
6099 };
6100 (LCD_DATA10 $(, $_fallback:literal)?) => {
6101 "GPIO18"
6102 };
6103 (DBG_PSRAM_DQ7 $(, $_fallback:literal)?) => {
6104 "GPIO18"
6105 };
6106 (FSPIDQS $(, $_fallback:literal)?) => {
6107 "GPIO19"
6108 };
6109 (GMAC_PHY_RXD0 $(, $_fallback:literal)?) => {
6110 "GPIO19"
6111 };
6112 (LCD_DATA11 $(, $_fallback:literal)?) => {
6113 "GPIO19"
6114 };
6115 (DBG_PSRAM_DQS_0 $(, $_fallback:literal)?) => {
6116 "GPIO19"
6117 };
6118 (SD1_DATA0 $(, $_fallback:literal)?) => {
6119 "GPIO20"
6120 };
6121 (DBG_FLASH_CK $(, $_fallback:literal)?) => {
6122 "GPIO20"
6123 };
6124 (SD1_DATA1 $(, $_fallback:literal)?) => {
6125 "GPIO21"
6126 };
6127 (DBG_FLASH_D $(, $_fallback:literal)?) => {
6128 "GPIO21"
6129 };
6130 (SD1_DATA2 $(, $_fallback:literal)?) => {
6131 "GPIO22"
6132 };
6133 (DBG_FLASH_CS $(, $_fallback:literal)?) => {
6134 "GPIO22"
6135 };
6136 (SD1_DATA3 $(, $_fallback:literal)?) => {
6137 "GPIO23"
6138 };
6139 (DBG_FLASH_Q $(, $_fallback:literal)?) => {
6140 "GPIO23"
6141 };
6142 (SD1_CLK $(, $_fallback:literal)?) => {
6143 "GPIO24"
6144 };
6145 (DBG_FLASH_WP $(, $_fallback:literal)?) => {
6146 "GPIO24"
6147 };
6148 (SD1_CMD $(, $_fallback:literal)?) => {
6149 "GPIO25"
6150 };
6151 (DBG_FLASH_HOLD $(, $_fallback:literal)?) => {
6152 "GPIO25"
6153 };
6154 (SPICS0 $(, $_fallback:literal)?) => {
6155 "GPIO26"
6156 };
6157 (SPIQ $(, $_fallback:literal)?) => {
6158 "GPIO27"
6159 };
6160 (SPIWP $(, $_fallback:literal)?) => {
6161 "GPIO28"
6162 };
6163 (SPIHD $(, $_fallback:literal)?) => {
6164 "GPIO30"
6165 };
6166 (SPICLK $(, $_fallback:literal)?) => {
6167 "GPIO31"
6168 };
6169 (SPID $(, $_fallback:literal)?) => {
6170 "GPIO32"
6171 };
6172 (LCD_DATA12 $(, $_fallback:literal)?) => {
6173 "GPIO33"
6174 };
6175 (USJ_DM $(, $_fallback:literal)?) => {
6176 "GPIO33"
6177 };
6178 (LCD_DATA13 $(, $_fallback:literal)?) => {
6179 "GPIO34"
6180 };
6181 (USJ_DP $(, $_fallback:literal)?) => {
6182 "GPIO34"
6183 };
6184 (REF_GMAC_CLK $(, $_fallback:literal)?) => {
6185 "GPIO35"
6186 };
6187 (LCD_DATA14 $(, $_fallback:literal)?) => {
6188 "GPIO35"
6189 };
6190 (SD2_CDATA0 $(, $_fallback:literal)?) => {
6191 "GPIO35"
6192 };
6193 (LCD_DATA15 $(, $_fallback:literal)?) => {
6194 "GPIO36"
6195 };
6196 (SD2_CDATA1 $(, $_fallback:literal)?) => {
6197 "GPIO36"
6198 };
6199 (LCD_DATA16 $(, $_fallback:literal)?) => {
6200 "GPIO37"
6201 };
6202 (SD2_CDATA2 $(, $_fallback:literal)?) => {
6203 "GPIO37"
6204 };
6205 (LCD_DATA17 $(, $_fallback:literal)?) => {
6206 "GPIO38"
6207 };
6208 (SD2_CDATA3 $(, $_fallback:literal)?) => {
6209 "GPIO38"
6210 };
6211 (LCD_DATA18 $(, $_fallback:literal)?) => {
6212 "GPIO39"
6213 };
6214 (SD2_CCLK $(, $_fallback:literal)?) => {
6215 "GPIO39"
6216 };
6217 (LCD_PCLK $(, $_fallback:literal)?) => {
6218 "GPIO40"
6219 };
6220 (SD2_CCMD $(, $_fallback:literal)?) => {
6221 "GPIO40"
6222 };
6223 (ADC1_CH0 $(, $_fallback:literal)?) => {
6224 "GPIO42"
6225 };
6226 (LCD_H_ENABLE $(, $_fallback:literal)?) => {
6227 "GPIO43"
6228 };
6229 (ADC1_CH1 $(, $_fallback:literal)?) => {
6230 "GPIO43"
6231 };
6232 (LCD_H_SYNC $(, $_fallback:literal)?) => {
6233 "GPIO44"
6234 };
6235 (ADC1_CH2 $(, $_fallback:literal)?) => {
6236 "GPIO44"
6237 };
6238 (LCD_V_SYNC $(, $_fallback:literal)?) => {
6239 "GPIO45"
6240 };
6241 (ADC1_CH3 $(, $_fallback:literal)?) => {
6242 "GPIO45"
6243 };
6244 (CAM_DATA0 $(, $_fallback:literal)?) => {
6245 "GPIO46"
6246 };
6247 (ADC1_CH4 $(, $_fallback:literal)?) => {
6248 "GPIO46"
6249 };
6250 (CAM_DATA1 $(, $_fallback:literal)?) => {
6251 "GPIO47"
6252 };
6253 (ADC1_CH5 $(, $_fallback:literal)?) => {
6254 "GPIO47"
6255 };
6256 (CAM_DATA2 $(, $_fallback:literal)?) => {
6257 "GPIO48"
6258 };
6259 (ADC1_CH6 $(, $_fallback:literal)?) => {
6260 "GPIO48"
6261 };
6262 (CAM_DATA3 $(, $_fallback:literal)?) => {
6263 "GPIO49"
6264 };
6265 (ADC1_CH7 $(, $_fallback:literal)?) => {
6266 "GPIO49"
6267 };
6268 (CAM_DATA4 $(, $_fallback:literal)?) => {
6269 "GPIO50"
6270 };
6271 (ADC2_CH0 $(, $_fallback:literal)?) => {
6272 "GPIO50"
6273 };
6274 (CAM_DATA5 $(, $_fallback:literal)?) => {
6275 "GPIO51"
6276 };
6277 (ADC2_CH1 $(, $_fallback:literal)?) => {
6278 "GPIO51"
6279 };
6280 (CAM_DATA6 $(, $_fallback:literal)?) => {
6281 "GPIO52"
6282 };
6283 (ADC2_CH2 $(, $_fallback:literal)?) => {
6284 "GPIO52"
6285 };
6286 (CAM_DATA7 $(, $_fallback:literal)?) => {
6287 "GPIO53"
6288 };
6289 (ADC2_CH3 $(, $_fallback:literal)?) => {
6290 "GPIO53"
6291 };
6292 (MTDO $(, $_fallback:literal)?) => {
6293 "GPIO54"
6294 };
6295 (CAM_PCLK $(, $_fallback:literal)?) => {
6296 "GPIO54"
6297 };
6298 (ADC2_CH4 $(, $_fallback:literal)?) => {
6299 "GPIO54"
6300 };
6301 (MTCK $(, $_fallback:literal)?) => {
6302 "GPIO55"
6303 };
6304 (CAM_XCLK $(, $_fallback:literal)?) => {
6305 "GPIO55"
6306 };
6307 (ADC2_CH5 $(, $_fallback:literal)?) => {
6308 "GPIO55"
6309 };
6310 (MTDI $(, $_fallback:literal)?) => {
6311 "GPIO56"
6312 };
6313 (CAM_V_SYNC $(, $_fallback:literal)?) => {
6314 "GPIO56"
6315 };
6316 (ADC2_CH6 $(, $_fallback:literal)?) => {
6317 "GPIO56"
6318 };
6319 (MTMS $(, $_fallback:literal)?) => {
6320 "GPIO57"
6321 };
6322 (CAM_H_SYNC $(, $_fallback:literal)?) => {
6323 "GPIO57"
6324 };
6325 (ADC2_CH7 $(, $_fallback:literal)?) => {
6326 "GPIO57"
6327 };
6328 (U0TXD $(, $_fallback:literal)?) => {
6329 "GPIO58"
6330 };
6331 (U0RXD $(, $_fallback:literal)?) => {
6332 "GPIO59"
6333 };
6334 ($_signal:ident, $fallback:literal) => {
6335 $fallback
6336 };
6337}
6338#[macro_export]
6342#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6343macro_rules! define_io_mux_signals {
6344 () => {
6345 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6346 #[derive(Debug, PartialEq, Copy, Clone)]
6347 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6348 #[doc(hidden)]
6349 pub enum InputSignal {
6350 U0RXD = 10,
6351 U0CTS = 11,
6352 U0DSR = 12,
6353 U1RXD = 13,
6354 U1CTS = 14,
6355 U1DSR = 15,
6356 U2RXD = 16,
6357 U2CTS = 17,
6358 U2DSR = 18,
6359 U3RXD = 137,
6360 U3CTS = 138,
6361 U3DSR = 139,
6362 I2SO_BCK = 25,
6363 I2S_MCLK = 26,
6364 I2SO_WS = 27,
6365 I2SI_SD = 28,
6366 I2SI_BCK = 29,
6367 I2SI_WS = 30,
6368 FSPICLK = 53,
6369 FSPIQ = 54,
6370 FSPID = 55,
6371 FSPIHD = 56,
6372 FSPIWP = 57,
6373 FSPIIO4 = 58,
6374 FSPIIO5 = 59,
6375 FSPIIO6 = 60,
6376 FSPIIO7 = 61,
6377 FSPICS0 = 62,
6378 FSPICS1 = 63,
6379 FSPICS2 = 64,
6380 FSPICS3 = 65,
6381 FSPICS4 = 66,
6382 FSPICS5 = 67,
6383 SPI3_CS2 = 45,
6384 SPI3_CS1 = 46,
6385 SPI3_CK = 47,
6386 SPI3_Q = 48,
6387 SPI3_D = 49,
6388 SPI3_HOLD = 50,
6389 SPI3_WP = 51,
6390 SPI3_CS = 52,
6391 I2CEXT0_SCL = 68,
6392 I2CEXT0_SDA = 69,
6393 I2CEXT1_SCL = 70,
6394 I2CEXT1_SDA = 71,
6395 USB_JTAG_TDO_BRIDGE = 140,
6396 CPU_GPIO_0 = 214,
6397 CPU_GPIO_1 = 215,
6398 CPU_GPIO_2 = 216,
6399 CPU_GPIO_3 = 217,
6400 CPU_GPIO_4 = 218,
6401 CPU_GPIO_5 = 219,
6402 CPU_GPIO_6 = 220,
6403 CPU_GPIO_7 = 221,
6404 CPU_GPIO_8 = 222,
6405 CPU_GPIO_9 = 223,
6406 CPU_GPIO_10 = 224,
6407 CPU_GPIO_11 = 225,
6408 CPU_GPIO_12 = 226,
6409 CPU_GPIO_13 = 227,
6410 CPU_GPIO_14 = 228,
6411 CPU_GPIO_15 = 229,
6412 RMT_SIG_0 = 246,
6413 RMT_SIG_1 = 247,
6414 RMT_SIG_2 = 248,
6415 RMT_SIG_3 = 249,
6416 SDHOST_CDATA_IN_41 = 0,
6417 SDHOST_CDATA_IN_51 = 1,
6418 SDHOST_CDATA_IN_61 = 2,
6419 SDHOST_CDATA_IN_71 = 3,
6420 SDHOST_CDATA_IN_42 = 4,
6421 SDHOST_CDATA_IN_52 = 5,
6422 SDHOST_CDATA_IN_62 = 6,
6423 SDHOST_CDATA_IN_72 = 7,
6424 SDHOST_CARD_DETECT_N_1 = 126,
6425 SDHOST_CARD_DETECT_N_2 = 127,
6426 SDHOST_CARD_INT_N_1 = 128,
6427 SDHOST_CARD_INT_N_2 = 129,
6428 SDHOST_CARD_WRITE_PRT_1 = 130,
6429 SDHOST_CARD_WRITE_PRT_2 = 131,
6430 SDHOST_DATA_STROBE_1 = 132,
6431 SDHOST_DATA_STROBE_2 = 133,
6432 SIG_IN_FUNC251 = 251,
6433 SIG_IN_FUNC252 = 252,
6434 SIG_IN_FUNC253 = 253,
6435 SIG_IN_FUNC254 = 254,
6436 SIG_IN_FUNC255 = 255,
6437 MTDO,
6438 MTCK,
6439 MTDI,
6440 MTMS,
6441 SD1_DATA0,
6442 SD1_DATA1,
6443 SD1_DATA2,
6444 SD1_DATA3,
6445 SD1_CLK,
6446 SD1_CMD,
6447 SPICS0,
6448 SPIQ,
6449 SPIWP,
6450 SPIHD,
6451 SPICLK,
6452 SPID,
6453 GMAC_PHY_TXD0,
6454 GMAC_PHY_TXD1,
6455 GMAC_PHY_TXD2,
6456 GMAC_PHY_TXD3,
6457 GMAC_PHY_TXEN,
6458 GMAC_RMII_CLK,
6459 GMAC_RX_CLK,
6460 GMAC_PHY_RXDV,
6461 GMAC_PHY_RXD0,
6462 GMAC_PHY_RXD1,
6463 GMAC_PHY_RXD2,
6464 GMAC_PHY_RXD3,
6465 REF_GMAC_CLK,
6466 LCD_DATA0,
6467 LCD_DATA1,
6468 LCD_DATA2,
6469 LCD_DATA3,
6470 LCD_DATA4,
6471 LCD_DATA5,
6472 LCD_DATA6,
6473 LCD_DATA7,
6474 LCD_DATA8,
6475 LCD_DATA9,
6476 LCD_DATA10,
6477 LCD_DATA11,
6478 LCD_DATA12,
6479 LCD_DATA13,
6480 LCD_DATA14,
6481 LCD_DATA15,
6482 LCD_DATA16,
6483 LCD_DATA17,
6484 LCD_DATA18,
6485 LCD_DATA19,
6486 LCD_DATA20,
6487 LCD_DATA21,
6488 LCD_DATA22,
6489 LCD_DATA23,
6490 LCD_PCLK,
6491 LCD_H_ENABLE,
6492 LCD_H_SYNC,
6493 LCD_V_SYNC,
6494 CAM_DATA0,
6495 CAM_DATA1,
6496 CAM_DATA2,
6497 CAM_DATA3,
6498 CAM_DATA4,
6499 CAM_DATA5,
6500 CAM_DATA6,
6501 CAM_DATA7,
6502 CAM_PCLK,
6503 CAM_XCLK,
6504 CAM_V_SYNC,
6505 CAM_H_SYNC,
6506 SD2_CDATA0,
6507 SD2_CDATA1,
6508 SD2_CDATA2,
6509 SD2_CDATA3,
6510 SD2_CCLK,
6511 SD2_CCMD,
6512 DBG_PSRAM_CK,
6513 DBG_PSRAM_CS,
6514 DBG_PSRAM_D,
6515 DBG_PSRAM_Q,
6516 DBG_PSRAM_WP,
6517 DBG_PSRAM_HOLD,
6518 DBG_PSRAM_DQ4,
6519 DBG_PSRAM_DQ5,
6520 DBG_PSRAM_DQ6,
6521 DBG_PSRAM_DQ7,
6522 DBG_PSRAM_DQS_0,
6523 DBG_FLASH_CK,
6524 DBG_FLASH_D,
6525 DBG_FLASH_CS,
6526 DBG_FLASH_Q,
6527 DBG_FLASH_WP,
6528 DBG_FLASH_HOLD,
6529 }
6530 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
6531 #[derive(Debug, PartialEq, Copy, Clone)]
6532 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6533 #[doc(hidden)]
6534 pub enum OutputSignal {
6535 SDHOST_CDATA_OUT_41 = 0,
6536 SDHOST_CDATA_OUT_51 = 1,
6537 SDHOST_CDATA_OUT_61 = 2,
6538 SDHOST_CDATA_OUT_71 = 3,
6539 SDHOST_CDATA_OUT_42 = 4,
6540 SDHOST_CDATA_OUT_52 = 5,
6541 SDHOST_CDATA_OUT_62 = 6,
6542 SDHOST_CDATA_OUT_72 = 7,
6543 SD_RST_N_1 = 146,
6544 SD_RST_N_2 = 147,
6545 SD_CCMD_OD_PULLUP_EN_N = 148,
6546 U0TXD = 10,
6547 U0RTS = 11,
6548 U0DTR = 12,
6549 U1TXD = 13,
6550 U1RTS = 14,
6551 U1DTR = 15,
6552 U2TXD = 16,
6553 U2RTS = 17,
6554 U2DTR = 18,
6555 U3TXD = 137,
6556 U3RTS = 138,
6557 U3DTR = 116,
6558 I2SO_BCK = 25,
6559 I2S_MCLK = 26,
6560 I2SO_WS = 27,
6561 I2SO_SD = 28,
6562 I2SI_BCK = 29,
6563 I2SI_WS = 30,
6564 FSPICLK = 53,
6565 FSPIQ = 54,
6566 FSPID = 55,
6567 FSPIHD = 56,
6568 FSPIWP = 57,
6569 FSPIIO4 = 58,
6570 FSPIIO5 = 59,
6571 FSPIIO6 = 60,
6572 FSPIIO7 = 61,
6573 FSPIDQS = 44,
6574 FSPICS0 = 62,
6575 FSPICS1 = 63,
6576 FSPICS2 = 64,
6577 FSPICS3 = 65,
6578 FSPICS4 = 66,
6579 FSPICS5 = 67,
6580 SPI3_CS2 = 45,
6581 SPI3_CS1 = 46,
6582 SPI3_CK = 47,
6583 SPI3_Q = 48,
6584 SPI3_D = 49,
6585 SPI3_HOLD = 50,
6586 SPI3_WP = 51,
6587 SPI3_CS = 52,
6588 I2CEXT0_SCL = 68,
6589 I2CEXT0_SDA = 69,
6590 I2CEXT1_SCL = 70,
6591 I2CEXT1_SDA = 71,
6592 GPIO_SD0 = 72,
6593 GPIO_SD1 = 73,
6594 GPIO_SD2 = 74,
6595 GPIO_SD3 = 75,
6596 GPIO_SD4 = 76,
6597 GPIO_SD5 = 77,
6598 GPIO_SD6 = 78,
6599 GPIO_SD7 = 79,
6600 CPU_GPIO_0 = 214,
6601 CPU_GPIO_1 = 215,
6602 CPU_GPIO_2 = 216,
6603 CPU_GPIO_3 = 217,
6604 CPU_GPIO_4 = 218,
6605 CPU_GPIO_5 = 219,
6606 CPU_GPIO_6 = 220,
6607 CPU_GPIO_7 = 221,
6608 CPU_GPIO_8 = 222,
6609 CPU_GPIO_9 = 223,
6610 CPU_GPIO_10 = 224,
6611 CPU_GPIO_11 = 225,
6612 CPU_GPIO_12 = 226,
6613 CPU_GPIO_13 = 227,
6614 CPU_GPIO_14 = 228,
6615 CPU_GPIO_15 = 229,
6616 RMT_SIG_0 = 246,
6617 RMT_SIG_1 = 247,
6618 RMT_SIG_2 = 248,
6619 RMT_SIG_3 = 249,
6620 GPIO = 256,
6621 MTDO,
6622 MTCK,
6623 MTDI,
6624 MTMS,
6625 SD1_DATA0,
6626 SD1_DATA1,
6627 SD1_DATA2,
6628 SD1_DATA3,
6629 SD1_CLK,
6630 SD1_CMD,
6631 SPICS0,
6632 SPIQ,
6633 SPIWP,
6634 SPIHD,
6635 SPICLK,
6636 SPID,
6637 GMAC_PHY_TXD0,
6638 GMAC_PHY_TXD1,
6639 GMAC_PHY_TXD2,
6640 GMAC_PHY_TXD3,
6641 GMAC_PHY_TXEN,
6642 GMAC_RMII_CLK,
6643 GMAC_RX_CLK,
6644 GMAC_PHY_RXDV,
6645 GMAC_PHY_RXD0,
6646 GMAC_PHY_RXD1,
6647 GMAC_PHY_RXD2,
6648 GMAC_PHY_RXD3,
6649 REF_GMAC_CLK,
6650 LCD_DATA0,
6651 LCD_DATA1,
6652 LCD_DATA2,
6653 LCD_DATA3,
6654 LCD_DATA4,
6655 LCD_DATA5,
6656 LCD_DATA6,
6657 LCD_DATA7,
6658 LCD_DATA8,
6659 LCD_DATA9,
6660 LCD_DATA10,
6661 LCD_DATA11,
6662 LCD_DATA12,
6663 LCD_DATA13,
6664 LCD_DATA14,
6665 LCD_DATA15,
6666 LCD_DATA16,
6667 LCD_DATA17,
6668 LCD_DATA18,
6669 LCD_DATA19,
6670 LCD_DATA20,
6671 LCD_DATA21,
6672 LCD_DATA22,
6673 LCD_DATA23,
6674 LCD_PCLK,
6675 LCD_H_ENABLE,
6676 LCD_H_SYNC,
6677 LCD_V_SYNC,
6678 CAM_DATA0,
6679 CAM_DATA1,
6680 CAM_DATA2,
6681 CAM_DATA3,
6682 CAM_DATA4,
6683 CAM_DATA5,
6684 CAM_DATA6,
6685 CAM_DATA7,
6686 CAM_PCLK,
6687 CAM_XCLK,
6688 CAM_V_SYNC,
6689 CAM_H_SYNC,
6690 SD2_CDATA0,
6691 SD2_CDATA1,
6692 SD2_CDATA2,
6693 SD2_CDATA3,
6694 SD2_CCLK,
6695 SD2_CCMD,
6696 DBG_PSRAM_CK,
6697 DBG_PSRAM_CS,
6698 DBG_PSRAM_D,
6699 DBG_PSRAM_Q,
6700 DBG_PSRAM_WP,
6701 DBG_PSRAM_HOLD,
6702 DBG_PSRAM_DQ4,
6703 DBG_PSRAM_DQ5,
6704 DBG_PSRAM_DQ6,
6705 DBG_PSRAM_DQ7,
6706 DBG_PSRAM_DQS_0,
6707 DBG_FLASH_CK,
6708 DBG_FLASH_D,
6709 DBG_FLASH_CS,
6710 DBG_FLASH_Q,
6711 DBG_FLASH_WP,
6712 DBG_FLASH_HOLD,
6713 }
6714 };
6715}
6716#[macro_export]
6723#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6724macro_rules! define_lp_functions {
6725 () => {
6726 #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
6731 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6732 #[doc(hidden)]
6733 pub enum LpFunction {
6734 _0 = 0,
6736 }
6737 impl LpFunction {
6738 pub const LP_GPIO: Self = Self::_0;
6740 }
6741 };
6742}
6743#[macro_export]
6756#[expect(clippy::crate_in_macro_def)]
6757#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
6758macro_rules! define_io_mux_reg {
6759 () => {
6760 pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
6761 crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
6762 }
6763 };
6764}