1#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
12#[macro_export]
14#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
15macro_rules! chip {
16 () => {
17 "esp32s3"
18 };
19}
20#[doc = concat!("assert_eq!(chip_name, ", chip_pretty!(), ")")]
28#[macro_export]
30#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
31macro_rules! chip_pretty {
32 () => {
33 "ESP32-S3"
34 };
35}
36#[macro_export]
38#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
39macro_rules! property {
40 ("chip") => {
41 "esp32s3"
42 };
43 ("arch") => {
44 "xtensa"
45 };
46 ("cores") => {
47 2
48 };
49 ("cores", str) => {
50 stringify!(2)
51 };
52 ("trm") => {
53 "https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf"
54 };
55 ("aes.dma") => {
56 true
57 };
58 ("aes.has_split_text_registers") => {
59 true
60 };
61 ("aes.endianness_configurable") => {
62 false
63 };
64 ("assist_debug.has_sp_monitor") => {
65 false
66 };
67 ("assist_debug.has_region_monitor") => {
68 true
69 };
70 ("bt.controller") => {
71 "btdm"
72 };
73 ("dedicated_gpio.needs_initialization") => {
74 true
75 };
76 ("dedicated_gpio.channel_count") => {
77 8
78 };
79 ("dedicated_gpio.channel_count", str) => {
80 stringify!(8)
81 };
82 ("dma.kind") => {
83 "gdma"
84 };
85 ("dma.supports_mem2mem") => {
86 true
87 };
88 ("dma.can_access_psram") => {
89 true
90 };
91 ("dma.ext_mem_configurable_block_size") => {
92 true
93 };
94 ("dma.separate_in_out_interrupts") => {
95 true
96 };
97 ("dma.max_priority") => {
98 9
99 };
100 ("dma.max_priority", str) => {
101 stringify!(9)
102 };
103 ("dma.gdma_version") => {
104 1
105 };
106 ("dma.gdma_version", str) => {
107 stringify!(1)
108 };
109 ("gpio.has_bank_1") => {
110 true
111 };
112 ("gpio.gpio_function") => {
113 1
114 };
115 ("gpio.gpio_function", str) => {
116 stringify!(1)
117 };
118 ("gpio.constant_0_input") => {
119 60
120 };
121 ("gpio.constant_0_input", str) => {
122 stringify!(60)
123 };
124 ("gpio.constant_1_input") => {
125 56
126 };
127 ("gpio.constant_1_input", str) => {
128 stringify!(56)
129 };
130 ("gpio.remap_iomux_pin_registers") => {
131 false
132 };
133 ("gpio.func_in_sel_offset") => {
134 0
135 };
136 ("gpio.func_in_sel_offset", str) => {
137 stringify!(0)
138 };
139 ("gpio.input_signal_max") => {
140 255
141 };
142 ("gpio.input_signal_max", str) => {
143 stringify!(255)
144 };
145 ("gpio.output_signal_max") => {
146 256
147 };
148 ("gpio.output_signal_max", str) => {
149 stringify!(256)
150 };
151 ("i2c_master.has_fsm_timeouts") => {
152 true
153 };
154 ("i2c_master.has_hw_bus_clear") => {
155 false
156 };
157 ("i2c_master.has_bus_timeout_enable") => {
158 true
159 };
160 ("i2c_master.separate_filter_config_registers") => {
161 false
162 };
163 ("i2c_master.can_estimate_nack_reason") => {
164 true
165 };
166 ("i2c_master.has_conf_update") => {
167 true
168 };
169 ("i2c_master.has_reliable_fsm_reset") => {
170 false
171 };
172 ("i2c_master.has_arbitration_en") => {
173 true
174 };
175 ("i2c_master.has_tx_fifo_watermark") => {
176 true
177 };
178 ("i2c_master.bus_timeout_is_exponential") => {
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 ("interrupts.status_registers") => {
200 4
201 };
202 ("interrupts.status_registers", str) => {
203 stringify!(4)
204 };
205 ("phy.combo_module") => {
206 true
207 };
208 ("phy.backed_up_digital_register_count") => {
209 21
210 };
211 ("phy.backed_up_digital_register_count", str) => {
212 stringify!(21)
213 };
214 ("psram.octal_spi") => {
215 true
216 };
217 ("psram.extmem_origin") => {
218 1006632960
219 };
220 ("psram.extmem_origin", str) => {
221 stringify!(1006632960)
222 };
223 ("rmt.ram_start") => {
224 1610704896
225 };
226 ("rmt.ram_start", str) => {
227 stringify!(1610704896)
228 };
229 ("rmt.channel_ram_size") => {
230 48
231 };
232 ("rmt.channel_ram_size", str) => {
233 stringify!(48)
234 };
235 ("rmt.has_tx_immediate_stop") => {
236 true
237 };
238 ("rmt.has_tx_loop_count") => {
239 true
240 };
241 ("rmt.has_tx_loop_auto_stop") => {
242 true
243 };
244 ("rmt.has_tx_carrier_data_only") => {
245 true
246 };
247 ("rmt.has_tx_sync") => {
248 true
249 };
250 ("rmt.has_rx_wrap") => {
251 true
252 };
253 ("rmt.has_rx_demodulation") => {
254 true
255 };
256 ("rmt.has_dma") => {
257 true
258 };
259 ("rmt.has_per_channel_clock") => {
260 false
261 };
262 ("rng.apb_cycle_wait_num") => {
263 16
264 };
265 ("rng.apb_cycle_wait_num", str) => {
266 stringify!(16)
267 };
268 ("rng.trng_supported") => {
269 true
270 };
271 ("rsa.size_increment") => {
272 32
273 };
274 ("rsa.size_increment", str) => {
275 stringify!(32)
276 };
277 ("rsa.memory_size_bytes") => {
278 512
279 };
280 ("rsa.memory_size_bytes", str) => {
281 stringify!(512)
282 };
283 ("sha.dma") => {
284 true
285 };
286 ("sleep.light_sleep") => {
287 true
288 };
289 ("sleep.deep_sleep") => {
290 true
291 };
292 ("soc.cpu_has_branch_predictor") => {
293 false
294 };
295 ("soc.cpu_has_csr_pc") => {
296 false
297 };
298 ("soc.multi_core_enabled") => {
299 true
300 };
301 ("soc.rc_fast_clk_default") => {
302 17500000
303 };
304 ("soc.rc_fast_clk_default", str) => {
305 stringify!(17500000)
306 };
307 ("clock_tree.system_pre_div.divisor") => {
308 (0, 1023)
309 };
310 ("clock_tree.rc_fast_clk_div_n.divisor") => {
311 (0, 3)
312 };
313 ("clock_tree.uart.function_clock.div_num") => {
314 (0, 255)
315 };
316 ("clock_tree.uart.baud_rate_generator.fractional") => {
317 (0, 15)
318 };
319 ("clock_tree.uart.baud_rate_generator.integral") => {
320 (0, 4095)
321 };
322 ("spi_master.supports_dma") => {
323 true
324 };
325 ("spi_master.has_octal") => {
326 true
327 };
328 ("spi_master.has_app_interrupts") => {
329 true
330 };
331 ("spi_master.has_dma_segmented_transfer") => {
332 true
333 };
334 ("spi_master.has_clk_pre_div") => {
335 false
336 };
337 ("spi_slave.supports_dma") => {
338 true
339 };
340 ("timergroup.timg_has_timer1") => {
341 true
342 };
343 ("timergroup.timg_has_divcnt_rst") => {
344 false
345 };
346 ("uart.ram_size") => {
347 128
348 };
349 ("uart.ram_size", str) => {
350 stringify!(128)
351 };
352 ("uart.peripheral_controls_mem_clk") => {
353 false
354 };
355 ("uart.has_sclk_divider") => {
356 true
357 };
358 ("uhci.combined_uart_selector_field") => {
359 false
360 };
361 ("wifi.has_wifi6") => {
362 false
363 };
364 ("wifi.mac_version") => {
365 1
366 };
367 ("wifi.mac_version", str) => {
368 stringify!(1)
369 };
370 ("wifi.has_5g") => {
371 false
372 };
373 ("wifi.csi_supported") => {
374 true
375 };
376}
377#[macro_export]
378#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
379macro_rules! for_each_aes_key_length {
380 ($($pattern:tt => $code:tt;)*) => {
381 macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
382 tt) => {} } _for_each_inner_aes_key_length!((128));
383 _for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
384 4)); _for_each_inner_aes_key_length!((256, 2, 6));
385 _for_each_inner_aes_key_length!((bits(128), (256)));
386 _for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
387 };
388}
389#[macro_export]
390#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
391macro_rules! for_each_dedicated_gpio {
392 ($($pattern:tt => $code:tt;)*) => {
393 macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
394 tt) => {} } _for_each_inner_dedicated_gpio!((0));
395 _for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
396 _for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
397 _for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
398 _for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
399 PRO_ALONEGPIO0)); _for_each_inner_dedicated_gpio!((0, 1, PRO_ALONEGPIO1));
400 _for_each_inner_dedicated_gpio!((0, 2, PRO_ALONEGPIO2));
401 _for_each_inner_dedicated_gpio!((0, 3, PRO_ALONEGPIO3));
402 _for_each_inner_dedicated_gpio!((0, 4, PRO_ALONEGPIO4));
403 _for_each_inner_dedicated_gpio!((0, 5, PRO_ALONEGPIO5));
404 _for_each_inner_dedicated_gpio!((0, 6, PRO_ALONEGPIO6));
405 _for_each_inner_dedicated_gpio!((0, 7, PRO_ALONEGPIO7));
406 _for_each_inner_dedicated_gpio!((1, 0, CORE1_GPIO0));
407 _for_each_inner_dedicated_gpio!((1, 1, CORE1_GPIO1));
408 _for_each_inner_dedicated_gpio!((1, 2, CORE1_GPIO2));
409 _for_each_inner_dedicated_gpio!((1, 3, CORE1_GPIO3));
410 _for_each_inner_dedicated_gpio!((1, 4, CORE1_GPIO4));
411 _for_each_inner_dedicated_gpio!((1, 5, CORE1_GPIO5));
412 _for_each_inner_dedicated_gpio!((1, 6, CORE1_GPIO6));
413 _for_each_inner_dedicated_gpio!((1, 7, CORE1_GPIO7));
414 _for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
415 (7))); _for_each_inner_dedicated_gpio!((signals(0, 0, PRO_ALONEGPIO0), (0, 1,
416 PRO_ALONEGPIO1), (0, 2, PRO_ALONEGPIO2), (0, 3, PRO_ALONEGPIO3), (0, 4,
417 PRO_ALONEGPIO4), (0, 5, PRO_ALONEGPIO5), (0, 6, PRO_ALONEGPIO6), (0, 7,
418 PRO_ALONEGPIO7), (1, 0, CORE1_GPIO0), (1, 1, CORE1_GPIO1), (1, 2, CORE1_GPIO2),
419 (1, 3, CORE1_GPIO3), (1, 4, CORE1_GPIO4), (1, 5, CORE1_GPIO5), (1, 6,
420 CORE1_GPIO6), (1, 7, CORE1_GPIO7)));
421 };
422}
423#[macro_export]
424#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
425macro_rules! for_each_sw_interrupt {
426 ($($pattern:tt => $code:tt;)*) => {
427 macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
428 tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
429 software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
430 software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
431 software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
432 software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
433 software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
434 FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
435 };
436}
437#[macro_export]
438macro_rules! sw_interrupt_delay {
439 () => {
440 unsafe {}
441 };
442}
443#[macro_export]
465#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
466macro_rules! for_each_rmt_channel {
467 ($($pattern:tt => $code:tt;)*) => {
468 macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
469 => {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
470 _for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
471 _for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
472 _for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
473 _for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
474 _for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
475 _for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
476 _for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
477 _for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
478 _for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
479 _for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
480 };
481}
482#[macro_export]
483#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
484macro_rules! for_each_rmt_clock_source {
485 ($($pattern:tt => $code:tt;)*) => {
486 macro_rules! _for_each_inner_rmt_clock_source { $(($pattern) => $code;)* ($other
487 : tt) => {} } _for_each_inner_rmt_clock_source!((Apb, 1));
488 _for_each_inner_rmt_clock_source!((RcFast, 2));
489 _for_each_inner_rmt_clock_source!((Xtal, 3));
490 _for_each_inner_rmt_clock_source!((Apb));
491 _for_each_inner_rmt_clock_source!((all(Apb, 1), (RcFast, 2), (Xtal, 3)));
492 _for_each_inner_rmt_clock_source!((default(Apb)));
493 };
494}
495#[macro_export]
496#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
497macro_rules! for_each_rsa_exponentiation {
498 ($($pattern:tt => $code:tt;)*) => {
499 macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
500 ($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
501 _for_each_inner_rsa_exponentiation!((64));
502 _for_each_inner_rsa_exponentiation!((96));
503 _for_each_inner_rsa_exponentiation!((128));
504 _for_each_inner_rsa_exponentiation!((160));
505 _for_each_inner_rsa_exponentiation!((192));
506 _for_each_inner_rsa_exponentiation!((224));
507 _for_each_inner_rsa_exponentiation!((256));
508 _for_each_inner_rsa_exponentiation!((288));
509 _for_each_inner_rsa_exponentiation!((320));
510 _for_each_inner_rsa_exponentiation!((352));
511 _for_each_inner_rsa_exponentiation!((384));
512 _for_each_inner_rsa_exponentiation!((416));
513 _for_each_inner_rsa_exponentiation!((448));
514 _for_each_inner_rsa_exponentiation!((480));
515 _for_each_inner_rsa_exponentiation!((512));
516 _for_each_inner_rsa_exponentiation!((544));
517 _for_each_inner_rsa_exponentiation!((576));
518 _for_each_inner_rsa_exponentiation!((608));
519 _for_each_inner_rsa_exponentiation!((640));
520 _for_each_inner_rsa_exponentiation!((672));
521 _for_each_inner_rsa_exponentiation!((704));
522 _for_each_inner_rsa_exponentiation!((736));
523 _for_each_inner_rsa_exponentiation!((768));
524 _for_each_inner_rsa_exponentiation!((800));
525 _for_each_inner_rsa_exponentiation!((832));
526 _for_each_inner_rsa_exponentiation!((864));
527 _for_each_inner_rsa_exponentiation!((896));
528 _for_each_inner_rsa_exponentiation!((928));
529 _for_each_inner_rsa_exponentiation!((960));
530 _for_each_inner_rsa_exponentiation!((992));
531 _for_each_inner_rsa_exponentiation!((1024));
532 _for_each_inner_rsa_exponentiation!((1056));
533 _for_each_inner_rsa_exponentiation!((1088));
534 _for_each_inner_rsa_exponentiation!((1120));
535 _for_each_inner_rsa_exponentiation!((1152));
536 _for_each_inner_rsa_exponentiation!((1184));
537 _for_each_inner_rsa_exponentiation!((1216));
538 _for_each_inner_rsa_exponentiation!((1248));
539 _for_each_inner_rsa_exponentiation!((1280));
540 _for_each_inner_rsa_exponentiation!((1312));
541 _for_each_inner_rsa_exponentiation!((1344));
542 _for_each_inner_rsa_exponentiation!((1376));
543 _for_each_inner_rsa_exponentiation!((1408));
544 _for_each_inner_rsa_exponentiation!((1440));
545 _for_each_inner_rsa_exponentiation!((1472));
546 _for_each_inner_rsa_exponentiation!((1504));
547 _for_each_inner_rsa_exponentiation!((1536));
548 _for_each_inner_rsa_exponentiation!((1568));
549 _for_each_inner_rsa_exponentiation!((1600));
550 _for_each_inner_rsa_exponentiation!((1632));
551 _for_each_inner_rsa_exponentiation!((1664));
552 _for_each_inner_rsa_exponentiation!((1696));
553 _for_each_inner_rsa_exponentiation!((1728));
554 _for_each_inner_rsa_exponentiation!((1760));
555 _for_each_inner_rsa_exponentiation!((1792));
556 _for_each_inner_rsa_exponentiation!((1824));
557 _for_each_inner_rsa_exponentiation!((1856));
558 _for_each_inner_rsa_exponentiation!((1888));
559 _for_each_inner_rsa_exponentiation!((1920));
560 _for_each_inner_rsa_exponentiation!((1952));
561 _for_each_inner_rsa_exponentiation!((1984));
562 _for_each_inner_rsa_exponentiation!((2016));
563 _for_each_inner_rsa_exponentiation!((2048));
564 _for_each_inner_rsa_exponentiation!((2080));
565 _for_each_inner_rsa_exponentiation!((2112));
566 _for_each_inner_rsa_exponentiation!((2144));
567 _for_each_inner_rsa_exponentiation!((2176));
568 _for_each_inner_rsa_exponentiation!((2208));
569 _for_each_inner_rsa_exponentiation!((2240));
570 _for_each_inner_rsa_exponentiation!((2272));
571 _for_each_inner_rsa_exponentiation!((2304));
572 _for_each_inner_rsa_exponentiation!((2336));
573 _for_each_inner_rsa_exponentiation!((2368));
574 _for_each_inner_rsa_exponentiation!((2400));
575 _for_each_inner_rsa_exponentiation!((2432));
576 _for_each_inner_rsa_exponentiation!((2464));
577 _for_each_inner_rsa_exponentiation!((2496));
578 _for_each_inner_rsa_exponentiation!((2528));
579 _for_each_inner_rsa_exponentiation!((2560));
580 _for_each_inner_rsa_exponentiation!((2592));
581 _for_each_inner_rsa_exponentiation!((2624));
582 _for_each_inner_rsa_exponentiation!((2656));
583 _for_each_inner_rsa_exponentiation!((2688));
584 _for_each_inner_rsa_exponentiation!((2720));
585 _for_each_inner_rsa_exponentiation!((2752));
586 _for_each_inner_rsa_exponentiation!((2784));
587 _for_each_inner_rsa_exponentiation!((2816));
588 _for_each_inner_rsa_exponentiation!((2848));
589 _for_each_inner_rsa_exponentiation!((2880));
590 _for_each_inner_rsa_exponentiation!((2912));
591 _for_each_inner_rsa_exponentiation!((2944));
592 _for_each_inner_rsa_exponentiation!((2976));
593 _for_each_inner_rsa_exponentiation!((3008));
594 _for_each_inner_rsa_exponentiation!((3040));
595 _for_each_inner_rsa_exponentiation!((3072));
596 _for_each_inner_rsa_exponentiation!((3104));
597 _for_each_inner_rsa_exponentiation!((3136));
598 _for_each_inner_rsa_exponentiation!((3168));
599 _for_each_inner_rsa_exponentiation!((3200));
600 _for_each_inner_rsa_exponentiation!((3232));
601 _for_each_inner_rsa_exponentiation!((3264));
602 _for_each_inner_rsa_exponentiation!((3296));
603 _for_each_inner_rsa_exponentiation!((3328));
604 _for_each_inner_rsa_exponentiation!((3360));
605 _for_each_inner_rsa_exponentiation!((3392));
606 _for_each_inner_rsa_exponentiation!((3424));
607 _for_each_inner_rsa_exponentiation!((3456));
608 _for_each_inner_rsa_exponentiation!((3488));
609 _for_each_inner_rsa_exponentiation!((3520));
610 _for_each_inner_rsa_exponentiation!((3552));
611 _for_each_inner_rsa_exponentiation!((3584));
612 _for_each_inner_rsa_exponentiation!((3616));
613 _for_each_inner_rsa_exponentiation!((3648));
614 _for_each_inner_rsa_exponentiation!((3680));
615 _for_each_inner_rsa_exponentiation!((3712));
616 _for_each_inner_rsa_exponentiation!((3744));
617 _for_each_inner_rsa_exponentiation!((3776));
618 _for_each_inner_rsa_exponentiation!((3808));
619 _for_each_inner_rsa_exponentiation!((3840));
620 _for_each_inner_rsa_exponentiation!((3872));
621 _for_each_inner_rsa_exponentiation!((3904));
622 _for_each_inner_rsa_exponentiation!((3936));
623 _for_each_inner_rsa_exponentiation!((3968));
624 _for_each_inner_rsa_exponentiation!((4000));
625 _for_each_inner_rsa_exponentiation!((4032));
626 _for_each_inner_rsa_exponentiation!((4064));
627 _for_each_inner_rsa_exponentiation!((4096));
628 _for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
629 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
630 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
631 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
632 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
633 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
634 (1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
635 (2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
636 (2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
637 (2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
638 (3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
639 (3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
640 (3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
641 };
642}
643#[macro_export]
644#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
645macro_rules! for_each_rsa_multiplication {
646 ($($pattern:tt => $code:tt;)*) => {
647 macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
648 ($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
649 _for_each_inner_rsa_multiplication!((64));
650 _for_each_inner_rsa_multiplication!((96));
651 _for_each_inner_rsa_multiplication!((128));
652 _for_each_inner_rsa_multiplication!((160));
653 _for_each_inner_rsa_multiplication!((192));
654 _for_each_inner_rsa_multiplication!((224));
655 _for_each_inner_rsa_multiplication!((256));
656 _for_each_inner_rsa_multiplication!((288));
657 _for_each_inner_rsa_multiplication!((320));
658 _for_each_inner_rsa_multiplication!((352));
659 _for_each_inner_rsa_multiplication!((384));
660 _for_each_inner_rsa_multiplication!((416));
661 _for_each_inner_rsa_multiplication!((448));
662 _for_each_inner_rsa_multiplication!((480));
663 _for_each_inner_rsa_multiplication!((512));
664 _for_each_inner_rsa_multiplication!((544));
665 _for_each_inner_rsa_multiplication!((576));
666 _for_each_inner_rsa_multiplication!((608));
667 _for_each_inner_rsa_multiplication!((640));
668 _for_each_inner_rsa_multiplication!((672));
669 _for_each_inner_rsa_multiplication!((704));
670 _for_each_inner_rsa_multiplication!((736));
671 _for_each_inner_rsa_multiplication!((768));
672 _for_each_inner_rsa_multiplication!((800));
673 _for_each_inner_rsa_multiplication!((832));
674 _for_each_inner_rsa_multiplication!((864));
675 _for_each_inner_rsa_multiplication!((896));
676 _for_each_inner_rsa_multiplication!((928));
677 _for_each_inner_rsa_multiplication!((960));
678 _for_each_inner_rsa_multiplication!((992));
679 _for_each_inner_rsa_multiplication!((1024));
680 _for_each_inner_rsa_multiplication!((1056));
681 _for_each_inner_rsa_multiplication!((1088));
682 _for_each_inner_rsa_multiplication!((1120));
683 _for_each_inner_rsa_multiplication!((1152));
684 _for_each_inner_rsa_multiplication!((1184));
685 _for_each_inner_rsa_multiplication!((1216));
686 _for_each_inner_rsa_multiplication!((1248));
687 _for_each_inner_rsa_multiplication!((1280));
688 _for_each_inner_rsa_multiplication!((1312));
689 _for_each_inner_rsa_multiplication!((1344));
690 _for_each_inner_rsa_multiplication!((1376));
691 _for_each_inner_rsa_multiplication!((1408));
692 _for_each_inner_rsa_multiplication!((1440));
693 _for_each_inner_rsa_multiplication!((1472));
694 _for_each_inner_rsa_multiplication!((1504));
695 _for_each_inner_rsa_multiplication!((1536));
696 _for_each_inner_rsa_multiplication!((1568));
697 _for_each_inner_rsa_multiplication!((1600));
698 _for_each_inner_rsa_multiplication!((1632));
699 _for_each_inner_rsa_multiplication!((1664));
700 _for_each_inner_rsa_multiplication!((1696));
701 _for_each_inner_rsa_multiplication!((1728));
702 _for_each_inner_rsa_multiplication!((1760));
703 _for_each_inner_rsa_multiplication!((1792));
704 _for_each_inner_rsa_multiplication!((1824));
705 _for_each_inner_rsa_multiplication!((1856));
706 _for_each_inner_rsa_multiplication!((1888));
707 _for_each_inner_rsa_multiplication!((1920));
708 _for_each_inner_rsa_multiplication!((1952));
709 _for_each_inner_rsa_multiplication!((1984));
710 _for_each_inner_rsa_multiplication!((2016));
711 _for_each_inner_rsa_multiplication!((2048));
712 _for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
713 (224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
714 (576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
715 (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
716 (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
717 (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
718 (1888), (1920), (1952), (1984), (2016), (2048)));
719 };
720}
721#[macro_export]
722#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
723macro_rules! for_each_sha_algorithm {
724 ($($pattern:tt => $code:tt;)*) => {
725 macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
726 tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
727 (insecure_against : "collision", "length extension"), 0));
728 _for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
729 (insecure_against : "length extension"), 1));
730 _for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
731 (insecure_against : "length extension"), 2));
732 _for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
733 (insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
734 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
735 _for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
736 (insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
737 "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
738 _for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
739 (insecure_against : "collision", "length extension"), 0), (Sha224,
740 "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
741 (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
742 2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
743 "SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
744 (Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
745 (Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
746 };
747}
748#[macro_export]
749macro_rules! define_clock_tree_types {
1075 () => {
1076 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1077 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1078 pub enum McpwmInstance {
1079 Mcpwm0 = 0,
1080 Mcpwm1 = 1,
1081 }
1082 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1083 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1084 pub enum RmtInstance {
1085 Rmt = 0,
1086 }
1087 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1088 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1089 pub enum TimgInstance {
1090 Timg0 = 0,
1091 Timg1 = 1,
1092 }
1093 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
1094 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1095 pub enum UartInstance {
1096 Uart0 = 0,
1097 Uart1 = 1,
1098 Uart2 = 2,
1099 }
1100 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1102 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1103 pub enum XtalClkConfig {
1104 _40,
1106 }
1107 impl XtalClkConfig {
1108 pub fn value(&self) -> u32 {
1109 match self {
1110 XtalClkConfig::_40 => 40000000,
1111 }
1112 }
1113 }
1114 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1116 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1117 pub enum PllClkConfig {
1118 _320,
1120 _480,
1122 }
1123 impl PllClkConfig {
1124 pub fn value(&self) -> u32 {
1125 match self {
1126 PllClkConfig::_320 => 320000000,
1127 PllClkConfig::_480 => 480000000,
1128 }
1129 }
1130 }
1131 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1133 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1134 pub enum SystemPreDivInConfig {
1135 Xtal,
1137 RcFast,
1139 }
1140 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1144 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1145 pub struct SystemPreDivConfig {
1146 divisor: u32,
1147 }
1148 impl SystemPreDivConfig {
1149 pub const fn new(divisor: u32) -> Self {
1156 ::core::assert!(
1157 divisor <= 1023,
1158 "`SYSTEM_PRE_DIV` divisor must be between 0 and 1023 (inclusive)."
1159 );
1160 Self { divisor }
1161 }
1162 fn divisor(self) -> u32 {
1163 self.divisor as u32
1164 }
1165 }
1166 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1168 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1169 pub enum CpuPllDivOutConfig {
1170 _80,
1172 _160,
1174 _240,
1176 }
1177 impl CpuPllDivOutConfig {
1178 pub fn value(&self) -> u32 {
1179 match self {
1180 CpuPllDivOutConfig::_80 => 80000000,
1181 CpuPllDivOutConfig::_160 => 160000000,
1182 CpuPllDivOutConfig::_240 => 240000000,
1183 }
1184 }
1185 }
1186 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1188 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1189 pub enum ApbClkConfig {
1190 Pll,
1192 Cpu,
1194 }
1195 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1197 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1198 pub enum CryptoPwmClkConfig {
1199 Pll,
1201 Cpu,
1203 }
1204 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1206 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1207 pub enum CpuClkConfig {
1208 Xtal,
1210 RcFast,
1212 Pll,
1214 }
1215 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1219 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1220 pub struct RcFastClkDivNConfig {
1221 divisor: u32,
1222 }
1223 impl RcFastClkDivNConfig {
1224 pub const fn new(divisor: u32) -> Self {
1231 ::core::assert!(
1232 divisor <= 3,
1233 "`RC_FAST_CLK_DIV_N` divisor must be between 0 and 3 (inclusive)."
1234 );
1235 Self { divisor }
1236 }
1237 fn divisor(self) -> u32 {
1238 self.divisor as u32
1239 }
1240 }
1241 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1243 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1244 pub enum RtcSlowClkConfig {
1245 Xtal32k,
1247 RcSlow,
1249 RcFast,
1251 }
1252 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1254 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1255 pub enum RtcFastClkConfig {
1256 Xtal,
1258 Rc,
1260 }
1261 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1263 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1264 pub enum LowPowerClkConfig {
1265 Xtal,
1267 RcFast,
1269 Xtal32k,
1271 RtcSlow,
1273 }
1274 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1276 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1277 pub enum TimgCalibrationClockConfig {
1278 RcSlowClk,
1280 RcFastDivClk,
1282 Xtal32kClk,
1284 }
1285 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1287 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1288 pub enum McpwmFunctionClockConfig {
1289 #[default]
1290 CryptoPwmClk,
1292 }
1293 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1295 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1296 pub enum RmtSclkConfig {
1297 #[default]
1298 ApbClk,
1300 RcFastClk,
1302 XtalClk,
1304 }
1305 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1307 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1308 pub enum TimgFunctionClockConfig {
1309 #[default]
1310 XtalClk,
1312 ApbClk,
1314 }
1315 #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
1316 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1317 pub enum UartFunctionClockSclk {
1318 Apb,
1320 RcFast,
1322 #[default]
1323 Xtal,
1325 }
1326 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1330 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1331 pub struct UartFunctionClockConfig {
1332 sclk: UartFunctionClockSclk,
1333 div_num: u32,
1334 }
1335 impl UartFunctionClockConfig {
1336 pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
1343 ::core::assert!(
1344 div_num <= 255,
1345 "`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
1346 );
1347 Self { sclk, div_num }
1348 }
1349 fn sclk(self) -> UartFunctionClockSclk {
1350 self.sclk
1351 }
1352 fn div_num(self) -> u32 {
1353 self.div_num as u32
1354 }
1355 }
1356 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1361 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1362 pub struct UartBaudRateGeneratorConfig {
1363 fractional: u32,
1364 integral: u32,
1365 }
1366 impl UartBaudRateGeneratorConfig {
1367 pub const fn new(fractional: u32, integral: u32) -> Self {
1377 ::core::assert!(
1378 fractional <= 15,
1379 "`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
1380 );
1381 ::core::assert!(
1382 integral <= 4095,
1383 "`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
1384 );
1385 Self {
1386 fractional,
1387 integral,
1388 }
1389 }
1390 fn fractional(self) -> u32 {
1391 self.fractional as u32
1392 }
1393 fn integral(self) -> u32 {
1394 self.integral as u32
1395 }
1396 }
1397 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1401 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1402 pub struct UartMemClockConfig {}
1403 impl UartMemClockConfig {
1404 pub const fn new() -> Self {
1406 Self {}
1407 }
1408 }
1409 pub struct ClockTree {
1411 xtal_clk: Option<XtalClkConfig>,
1412 pll_clk: Option<PllClkConfig>,
1413 system_pre_div_in: Option<SystemPreDivInConfig>,
1414 system_pre_div: Option<SystemPreDivConfig>,
1415 cpu_pll_div_out: Option<CpuPllDivOutConfig>,
1416 apb_clk: Option<ApbClkConfig>,
1417 crypto_pwm_clk: Option<CryptoPwmClkConfig>,
1418 cpu_clk: Option<CpuClkConfig>,
1419 rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
1420 rtc_slow_clk: Option<RtcSlowClkConfig>,
1421 rtc_fast_clk: Option<RtcFastClkConfig>,
1422 low_power_clk: Option<LowPowerClkConfig>,
1423 timg_calibration_clock: Option<TimgCalibrationClockConfig>,
1424 mcpwm_function_clock: [Option<McpwmFunctionClockConfig>; 2],
1425 rmt_sclk: [Option<RmtSclkConfig>; 1],
1426 timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
1427 uart_function_clock: [Option<UartFunctionClockConfig>; 3],
1428 uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 3],
1429 uart_mem_clock: [Option<UartMemClockConfig>; 3],
1430 pll_clk_refcount: u32,
1431 rc_fast_clk_refcount: u32,
1432 xtal32k_clk_refcount: u32,
1433 rc_slow_clk_refcount: u32,
1434 rc_fast_div_clk_refcount: u32,
1435 apb_clk_refcount: u32,
1436 crypto_pwm_clk_refcount: u32,
1437 pll_d2_refcount: u32,
1438 rtc_fast_clk_refcount: u32,
1439 low_power_clk_refcount: u32,
1440 uart_mem_clk_refcount: u32,
1441 timg_calibration_clock_refcount: u32,
1442 mcpwm_function_clock_refcount: [u32; 2],
1443 rmt_sclk_refcount: [u32; 1],
1444 timg_function_clock_refcount: [u32; 2],
1445 uart_function_clock_refcount: [u32; 3],
1446 uart_baud_rate_generator_refcount: [u32; 3],
1447 uart_mem_clock_refcount: [u32; 3],
1448 }
1449 impl ClockTree {
1450 pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
1452 CLOCK_TREE.with(f)
1453 }
1454 pub fn xtal_clk(&self) -> Option<XtalClkConfig> {
1456 self.xtal_clk
1457 }
1458 pub fn pll_clk(&self) -> Option<PllClkConfig> {
1460 self.pll_clk
1461 }
1462 pub fn system_pre_div_in(&self) -> Option<SystemPreDivInConfig> {
1464 self.system_pre_div_in
1465 }
1466 pub fn system_pre_div(&self) -> Option<SystemPreDivConfig> {
1468 self.system_pre_div
1469 }
1470 pub fn cpu_pll_div_out(&self) -> Option<CpuPllDivOutConfig> {
1472 self.cpu_pll_div_out
1473 }
1474 pub fn apb_clk(&self) -> Option<ApbClkConfig> {
1476 self.apb_clk
1477 }
1478 pub fn crypto_pwm_clk(&self) -> Option<CryptoPwmClkConfig> {
1480 self.crypto_pwm_clk
1481 }
1482 pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
1484 self.cpu_clk
1485 }
1486 pub fn rc_fast_clk_div_n(&self) -> Option<RcFastClkDivNConfig> {
1488 self.rc_fast_clk_div_n
1489 }
1490 pub fn rtc_slow_clk(&self) -> Option<RtcSlowClkConfig> {
1492 self.rtc_slow_clk
1493 }
1494 pub fn rtc_fast_clk(&self) -> Option<RtcFastClkConfig> {
1496 self.rtc_fast_clk
1497 }
1498 pub fn low_power_clk(&self) -> Option<LowPowerClkConfig> {
1500 self.low_power_clk
1501 }
1502 pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
1504 self.timg_calibration_clock
1505 }
1506 pub fn mcpwm0_function_clock(&self) -> Option<McpwmFunctionClockConfig> {
1508 self.mcpwm_function_clock[McpwmInstance::Mcpwm0 as usize]
1509 }
1510 pub fn mcpwm1_function_clock(&self) -> Option<McpwmFunctionClockConfig> {
1512 self.mcpwm_function_clock[McpwmInstance::Mcpwm1 as usize]
1513 }
1514 pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
1516 self.rmt_sclk[RmtInstance::Rmt as usize]
1517 }
1518 pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
1520 self.timg_function_clock[TimgInstance::Timg0 as usize]
1521 }
1522 pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
1524 self.timg_function_clock[TimgInstance::Timg1 as usize]
1525 }
1526 pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
1528 self.uart_function_clock[UartInstance::Uart0 as usize]
1529 }
1530 pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
1532 self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
1533 }
1534 pub fn uart0_mem_clock(&self) -> Option<UartMemClockConfig> {
1536 self.uart_mem_clock[UartInstance::Uart0 as usize]
1537 }
1538 pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
1540 self.uart_function_clock[UartInstance::Uart1 as usize]
1541 }
1542 pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
1544 self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
1545 }
1546 pub fn uart1_mem_clock(&self) -> Option<UartMemClockConfig> {
1548 self.uart_mem_clock[UartInstance::Uart1 as usize]
1549 }
1550 pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
1552 self.uart_function_clock[UartInstance::Uart2 as usize]
1553 }
1554 pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
1556 self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
1557 }
1558 pub fn uart2_mem_clock(&self) -> Option<UartMemClockConfig> {
1560 self.uart_mem_clock[UartInstance::Uart2 as usize]
1561 }
1562 }
1563 static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
1564 ::esp_sync::NonReentrantMutex::new(ClockTree {
1565 xtal_clk: None,
1566 pll_clk: None,
1567 system_pre_div_in: None,
1568 system_pre_div: None,
1569 cpu_pll_div_out: None,
1570 apb_clk: None,
1571 crypto_pwm_clk: None,
1572 cpu_clk: None,
1573 rc_fast_clk_div_n: None,
1574 rtc_slow_clk: None,
1575 rtc_fast_clk: None,
1576 low_power_clk: None,
1577 timg_calibration_clock: None,
1578 mcpwm_function_clock: [None; 2],
1579 rmt_sclk: [None; 1],
1580 timg_function_clock: [None; 2],
1581 uart_function_clock: [None; 3],
1582 uart_baud_rate_generator: [None; 3],
1583 uart_mem_clock: [None; 3],
1584 pll_clk_refcount: 0,
1585 rc_fast_clk_refcount: 0,
1586 xtal32k_clk_refcount: 0,
1587 rc_slow_clk_refcount: 0,
1588 rc_fast_div_clk_refcount: 0,
1589 apb_clk_refcount: 0,
1590 crypto_pwm_clk_refcount: 0,
1591 pll_d2_refcount: 0,
1592 rtc_fast_clk_refcount: 0,
1593 low_power_clk_refcount: 0,
1594 uart_mem_clk_refcount: 0,
1595 timg_calibration_clock_refcount: 0,
1596 mcpwm_function_clock_refcount: [0; 2],
1597 rmt_sclk_refcount: [0; 1],
1598 timg_function_clock_refcount: [0; 2],
1599 uart_function_clock_refcount: [0; 3],
1600 uart_baud_rate_generator_refcount: [0; 3],
1601 uart_mem_clock_refcount: [0; 3],
1602 });
1603 pub fn configure_xtal_clk(clocks: &mut ClockTree, config: XtalClkConfig) {
1604 let old_config = clocks.xtal_clk.replace(config);
1605 configure_xtal_clk_impl(clocks, old_config, config);
1606 }
1607 pub fn xtal_clk_config(clocks: &mut ClockTree) -> Option<XtalClkConfig> {
1608 clocks.xtal_clk
1609 }
1610 fn request_xtal_clk(_clocks: &mut ClockTree) {}
1611 fn release_xtal_clk(_clocks: &mut ClockTree) {}
1612 #[allow(unused_variables)]
1613 pub fn xtal_clk_config_frequency(clocks: &mut ClockTree, config: XtalClkConfig) -> u32 {
1614 config.value()
1615 }
1616 pub fn xtal_clk_frequency(clocks: &mut ClockTree) -> u32 {
1617 if let Some(config) = clocks.xtal_clk {
1618 xtal_clk_config_frequency(clocks, config)
1619 } else {
1620 0
1621 }
1622 }
1623 pub fn configure_pll_clk(clocks: &mut ClockTree, config: PllClkConfig) {
1624 if clocks.cpu_pll_div_out.is_some() {
1625 assert!(
1626 !((config.value() == 320000000)
1627 && (cpu_pll_div_out_frequency(clocks) == 240000000))
1628 );
1629 }
1630 let old_config = clocks.pll_clk.replace(config);
1631 configure_pll_clk_impl(clocks, old_config, config);
1632 }
1633 pub fn pll_clk_config(clocks: &mut ClockTree) -> Option<PllClkConfig> {
1634 clocks.pll_clk
1635 }
1636 pub fn request_pll_clk(clocks: &mut ClockTree) {
1637 trace!("Requesting PLL_CLK");
1638 if increment_reference_count(&mut clocks.pll_clk_refcount) {
1639 trace!("Enabling PLL_CLK");
1640 request_xtal_clk(clocks);
1641 enable_pll_clk_impl(clocks, true);
1642 }
1643 }
1644 pub fn release_pll_clk(clocks: &mut ClockTree) {
1645 trace!("Releasing PLL_CLK");
1646 if decrement_reference_count(&mut clocks.pll_clk_refcount) {
1647 trace!("Disabling PLL_CLK");
1648 enable_pll_clk_impl(clocks, false);
1649 release_xtal_clk(clocks);
1650 }
1651 }
1652 #[allow(unused_variables)]
1653 pub fn pll_clk_config_frequency(clocks: &mut ClockTree, config: PllClkConfig) -> u32 {
1654 config.value()
1655 }
1656 pub fn pll_clk_frequency(clocks: &mut ClockTree) -> u32 {
1657 if let Some(config) = clocks.pll_clk {
1658 pll_clk_config_frequency(clocks, config)
1659 } else {
1660 0
1661 }
1662 }
1663 pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
1664 trace!("Requesting RC_FAST_CLK");
1665 if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
1666 trace!("Enabling RC_FAST_CLK");
1667 enable_rc_fast_clk_impl(clocks, true);
1668 }
1669 }
1670 pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
1671 trace!("Releasing RC_FAST_CLK");
1672 if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
1673 trace!("Disabling RC_FAST_CLK");
1674 enable_rc_fast_clk_impl(clocks, false);
1675 }
1676 }
1677 pub fn rc_fast_clk_frequency(clocks: &mut ClockTree) -> u32 {
1678 17500000
1679 }
1680 pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
1681 trace!("Requesting XTAL32K_CLK");
1682 if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
1683 trace!("Enabling XTAL32K_CLK");
1684 enable_xtal32k_clk_impl(clocks, true);
1685 }
1686 }
1687 pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
1688 trace!("Releasing XTAL32K_CLK");
1689 if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
1690 trace!("Disabling XTAL32K_CLK");
1691 enable_xtal32k_clk_impl(clocks, false);
1692 }
1693 }
1694 pub fn xtal32k_clk_frequency(clocks: &mut ClockTree) -> u32 {
1695 32768
1696 }
1697 pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
1698 trace!("Requesting RC_SLOW_CLK");
1699 if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
1700 trace!("Enabling RC_SLOW_CLK");
1701 enable_rc_slow_clk_impl(clocks, true);
1702 }
1703 }
1704 pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
1705 trace!("Releasing RC_SLOW_CLK");
1706 if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
1707 trace!("Disabling RC_SLOW_CLK");
1708 enable_rc_slow_clk_impl(clocks, false);
1709 }
1710 }
1711 pub fn rc_slow_clk_frequency(clocks: &mut ClockTree) -> u32 {
1712 136000
1713 }
1714 pub fn request_rc_fast_div_clk(clocks: &mut ClockTree) {
1715 trace!("Requesting RC_FAST_DIV_CLK");
1716 if increment_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
1717 trace!("Enabling RC_FAST_DIV_CLK");
1718 request_rc_fast_clk(clocks);
1719 enable_rc_fast_div_clk_impl(clocks, true);
1720 }
1721 }
1722 pub fn release_rc_fast_div_clk(clocks: &mut ClockTree) {
1723 trace!("Releasing RC_FAST_DIV_CLK");
1724 if decrement_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
1725 trace!("Disabling RC_FAST_DIV_CLK");
1726 enable_rc_fast_div_clk_impl(clocks, false);
1727 release_rc_fast_clk(clocks);
1728 }
1729 }
1730 pub fn rc_fast_div_clk_frequency(clocks: &mut ClockTree) -> u32 {
1731 (rc_fast_clk_frequency(clocks) / 256)
1732 }
1733 pub fn configure_system_pre_div_in(
1734 clocks: &mut ClockTree,
1735 new_selector: SystemPreDivInConfig,
1736 ) {
1737 let old_selector = clocks.system_pre_div_in.replace(new_selector);
1738 match new_selector {
1739 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
1740 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
1741 }
1742 configure_system_pre_div_in_impl(clocks, old_selector, new_selector);
1743 if let Some(old_selector) = old_selector {
1744 match old_selector {
1745 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
1746 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
1747 }
1748 }
1749 }
1750 pub fn system_pre_div_in_config(clocks: &mut ClockTree) -> Option<SystemPreDivInConfig> {
1751 clocks.system_pre_div_in
1752 }
1753 pub fn request_system_pre_div_in(clocks: &mut ClockTree) {
1754 trace!("Requesting SYSTEM_PRE_DIV_IN");
1755 trace!("Enabling SYSTEM_PRE_DIV_IN");
1756 match unwrap!(clocks.system_pre_div_in) {
1757 SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
1758 SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
1759 }
1760 enable_system_pre_div_in_impl(clocks, true);
1761 }
1762 pub fn release_system_pre_div_in(clocks: &mut ClockTree) {
1763 trace!("Releasing SYSTEM_PRE_DIV_IN");
1764 trace!("Disabling SYSTEM_PRE_DIV_IN");
1765 enable_system_pre_div_in_impl(clocks, false);
1766 match unwrap!(clocks.system_pre_div_in) {
1767 SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
1768 SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
1769 }
1770 }
1771 #[allow(unused_variables)]
1772 pub fn system_pre_div_in_config_frequency(
1773 clocks: &mut ClockTree,
1774 config: SystemPreDivInConfig,
1775 ) -> u32 {
1776 match config {
1777 SystemPreDivInConfig::Xtal => xtal_clk_frequency(clocks),
1778 SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(clocks),
1779 }
1780 }
1781 pub fn system_pre_div_in_frequency(clocks: &mut ClockTree) -> u32 {
1782 if let Some(config) = clocks.system_pre_div_in {
1783 system_pre_div_in_config_frequency(clocks, config)
1784 } else {
1785 0
1786 }
1787 }
1788 pub fn configure_system_pre_div(clocks: &mut ClockTree, config: SystemPreDivConfig) {
1789 let old_config = clocks.system_pre_div.replace(config);
1790 configure_system_pre_div_impl(clocks, old_config, config);
1791 }
1792 pub fn system_pre_div_config(clocks: &mut ClockTree) -> Option<SystemPreDivConfig> {
1793 clocks.system_pre_div
1794 }
1795 pub fn request_system_pre_div(clocks: &mut ClockTree) {
1796 trace!("Requesting SYSTEM_PRE_DIV");
1797 trace!("Enabling SYSTEM_PRE_DIV");
1798 request_system_pre_div_in(clocks);
1799 enable_system_pre_div_impl(clocks, true);
1800 }
1801 pub fn release_system_pre_div(clocks: &mut ClockTree) {
1802 trace!("Releasing SYSTEM_PRE_DIV");
1803 trace!("Disabling SYSTEM_PRE_DIV");
1804 enable_system_pre_div_impl(clocks, false);
1805 release_system_pre_div_in(clocks);
1806 }
1807 #[allow(unused_variables)]
1808 pub fn system_pre_div_config_frequency(
1809 clocks: &mut ClockTree,
1810 config: SystemPreDivConfig,
1811 ) -> u32 {
1812 (system_pre_div_in_frequency(clocks) / (config.divisor() + 1))
1813 }
1814 pub fn system_pre_div_frequency(clocks: &mut ClockTree) -> u32 {
1815 if let Some(config) = clocks.system_pre_div {
1816 system_pre_div_config_frequency(clocks, config)
1817 } else {
1818 0
1819 }
1820 }
1821 pub fn configure_cpu_pll_div_out(clocks: &mut ClockTree, config: CpuPllDivOutConfig) {
1822 if clocks.pll_clk.is_some() {
1823 assert!(
1824 !((config.value() == 240000000) && (pll_clk_frequency(clocks) == 320000000))
1825 );
1826 }
1827 let old_config = clocks.cpu_pll_div_out.replace(config);
1828 configure_cpu_pll_div_out_impl(clocks, old_config, config);
1829 }
1830 pub fn cpu_pll_div_out_config(clocks: &mut ClockTree) -> Option<CpuPllDivOutConfig> {
1831 clocks.cpu_pll_div_out
1832 }
1833 pub fn request_cpu_pll_div_out(clocks: &mut ClockTree) {
1834 trace!("Requesting CPU_PLL_DIV_OUT");
1835 trace!("Enabling CPU_PLL_DIV_OUT");
1836 request_pll_clk(clocks);
1837 enable_cpu_pll_div_out_impl(clocks, true);
1838 }
1839 pub fn release_cpu_pll_div_out(clocks: &mut ClockTree) {
1840 trace!("Releasing CPU_PLL_DIV_OUT");
1841 trace!("Disabling CPU_PLL_DIV_OUT");
1842 enable_cpu_pll_div_out_impl(clocks, false);
1843 release_pll_clk(clocks);
1844 }
1845 #[allow(unused_variables)]
1846 pub fn cpu_pll_div_out_config_frequency(
1847 clocks: &mut ClockTree,
1848 config: CpuPllDivOutConfig,
1849 ) -> u32 {
1850 config.value()
1851 }
1852 pub fn cpu_pll_div_out_frequency(clocks: &mut ClockTree) -> u32 {
1853 if let Some(config) = clocks.cpu_pll_div_out {
1854 cpu_pll_div_out_config_frequency(clocks, config)
1855 } else {
1856 0
1857 }
1858 }
1859 pub fn configure_apb_clk(clocks: &mut ClockTree, new_selector: ApbClkConfig) {
1860 let old_selector = clocks.apb_clk.replace(new_selector);
1861 if clocks.apb_clk_refcount > 0 {
1862 match new_selector {
1863 ApbClkConfig::Pll => request_apb_80m(clocks),
1864 ApbClkConfig::Cpu => request_cpu_clk(clocks),
1865 }
1866 configure_apb_clk_impl(clocks, old_selector, new_selector);
1867 if let Some(old_selector) = old_selector {
1868 match old_selector {
1869 ApbClkConfig::Pll => release_apb_80m(clocks),
1870 ApbClkConfig::Cpu => release_cpu_clk(clocks),
1871 }
1872 }
1873 } else {
1874 configure_apb_clk_impl(clocks, old_selector, new_selector);
1875 }
1876 }
1877 pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
1878 clocks.apb_clk
1879 }
1880 pub fn request_apb_clk(clocks: &mut ClockTree) {
1881 trace!("Requesting APB_CLK");
1882 if increment_reference_count(&mut clocks.apb_clk_refcount) {
1883 trace!("Enabling APB_CLK");
1884 match unwrap!(clocks.apb_clk) {
1885 ApbClkConfig::Pll => request_apb_80m(clocks),
1886 ApbClkConfig::Cpu => request_cpu_clk(clocks),
1887 }
1888 enable_apb_clk_impl(clocks, true);
1889 }
1890 }
1891 pub fn release_apb_clk(clocks: &mut ClockTree) {
1892 trace!("Releasing APB_CLK");
1893 if decrement_reference_count(&mut clocks.apb_clk_refcount) {
1894 trace!("Disabling APB_CLK");
1895 enable_apb_clk_impl(clocks, false);
1896 match unwrap!(clocks.apb_clk) {
1897 ApbClkConfig::Pll => release_apb_80m(clocks),
1898 ApbClkConfig::Cpu => release_cpu_clk(clocks),
1899 }
1900 }
1901 }
1902 #[allow(unused_variables)]
1903 pub fn apb_clk_config_frequency(clocks: &mut ClockTree, config: ApbClkConfig) -> u32 {
1904 match config {
1905 ApbClkConfig::Pll => apb_80m_frequency(clocks),
1906 ApbClkConfig::Cpu => cpu_clk_frequency(clocks),
1907 }
1908 }
1909 pub fn apb_clk_frequency(clocks: &mut ClockTree) -> u32 {
1910 if let Some(config) = clocks.apb_clk {
1911 apb_clk_config_frequency(clocks, config)
1912 } else {
1913 0
1914 }
1915 }
1916 pub fn configure_crypto_pwm_clk(clocks: &mut ClockTree, new_selector: CryptoPwmClkConfig) {
1917 let old_selector = clocks.crypto_pwm_clk.replace(new_selector);
1918 if clocks.crypto_pwm_clk_refcount > 0 {
1919 match new_selector {
1920 CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
1921 CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
1922 }
1923 configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
1924 if let Some(old_selector) = old_selector {
1925 match old_selector {
1926 CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
1927 CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
1928 }
1929 }
1930 } else {
1931 configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
1932 }
1933 }
1934 pub fn crypto_pwm_clk_config(clocks: &mut ClockTree) -> Option<CryptoPwmClkConfig> {
1935 clocks.crypto_pwm_clk
1936 }
1937 pub fn request_crypto_pwm_clk(clocks: &mut ClockTree) {
1938 trace!("Requesting CRYPTO_PWM_CLK");
1939 if increment_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
1940 trace!("Enabling CRYPTO_PWM_CLK");
1941 match unwrap!(clocks.crypto_pwm_clk) {
1942 CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
1943 CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
1944 }
1945 enable_crypto_pwm_clk_impl(clocks, true);
1946 }
1947 }
1948 pub fn release_crypto_pwm_clk(clocks: &mut ClockTree) {
1949 trace!("Releasing CRYPTO_PWM_CLK");
1950 if decrement_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
1951 trace!("Disabling CRYPTO_PWM_CLK");
1952 enable_crypto_pwm_clk_impl(clocks, false);
1953 match unwrap!(clocks.crypto_pwm_clk) {
1954 CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
1955 CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
1956 }
1957 }
1958 }
1959 #[allow(unused_variables)]
1960 pub fn crypto_pwm_clk_config_frequency(
1961 clocks: &mut ClockTree,
1962 config: CryptoPwmClkConfig,
1963 ) -> u32 {
1964 match config {
1965 CryptoPwmClkConfig::Pll => pll_160m_frequency(clocks),
1966 CryptoPwmClkConfig::Cpu => cpu_clk_frequency(clocks),
1967 }
1968 }
1969 pub fn crypto_pwm_clk_frequency(clocks: &mut ClockTree) -> u32 {
1970 if let Some(config) = clocks.crypto_pwm_clk {
1971 crypto_pwm_clk_config_frequency(clocks, config)
1972 } else {
1973 0
1974 }
1975 }
1976 pub fn configure_cpu_clk(clocks: &mut ClockTree, new_selector: CpuClkConfig) {
1977 let old_selector = clocks.cpu_clk.replace(new_selector);
1978 match new_selector {
1979 CpuClkConfig::Xtal => {
1980 configure_apb_clk(clocks, ApbClkConfig::Cpu);
1981 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
1982 configure_system_pre_div_in(clocks, SystemPreDivInConfig::Xtal);
1983 }
1984 CpuClkConfig::RcFast => {
1985 configure_apb_clk(clocks, ApbClkConfig::Cpu);
1986 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
1987 configure_system_pre_div_in(clocks, SystemPreDivInConfig::RcFast);
1988 }
1989 CpuClkConfig::Pll => {
1990 configure_apb_clk(clocks, ApbClkConfig::Pll);
1991 configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Pll);
1992 }
1993 }
1994 match new_selector {
1995 CpuClkConfig::Xtal => request_system_pre_div(clocks),
1996 CpuClkConfig::RcFast => request_system_pre_div(clocks),
1997 CpuClkConfig::Pll => request_cpu_pll_div_out(clocks),
1998 }
1999 configure_cpu_clk_impl(clocks, old_selector, new_selector);
2000 if let Some(old_selector) = old_selector {
2001 match old_selector {
2002 CpuClkConfig::Xtal => release_system_pre_div(clocks),
2003 CpuClkConfig::RcFast => release_system_pre_div(clocks),
2004 CpuClkConfig::Pll => release_cpu_pll_div_out(clocks),
2005 }
2006 }
2007 }
2008 pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
2009 clocks.cpu_clk
2010 }
2011 fn request_cpu_clk(_clocks: &mut ClockTree) {}
2012 fn release_cpu_clk(_clocks: &mut ClockTree) {}
2013 #[allow(unused_variables)]
2014 pub fn cpu_clk_config_frequency(clocks: &mut ClockTree, config: CpuClkConfig) -> u32 {
2015 match config {
2016 CpuClkConfig::Xtal => system_pre_div_frequency(clocks),
2017 CpuClkConfig::RcFast => system_pre_div_frequency(clocks),
2018 CpuClkConfig::Pll => cpu_pll_div_out_frequency(clocks),
2019 }
2020 }
2021 pub fn cpu_clk_frequency(clocks: &mut ClockTree) -> u32 {
2022 if let Some(config) = clocks.cpu_clk {
2023 cpu_clk_config_frequency(clocks, config)
2024 } else {
2025 0
2026 }
2027 }
2028 pub fn request_pll_d2(clocks: &mut ClockTree) {
2029 trace!("Requesting PLL_D2");
2030 if increment_reference_count(&mut clocks.pll_d2_refcount) {
2031 trace!("Enabling PLL_D2");
2032 request_pll_clk(clocks);
2033 enable_pll_d2_impl(clocks, true);
2034 }
2035 }
2036 pub fn release_pll_d2(clocks: &mut ClockTree) {
2037 trace!("Releasing PLL_D2");
2038 if decrement_reference_count(&mut clocks.pll_d2_refcount) {
2039 trace!("Disabling PLL_D2");
2040 enable_pll_d2_impl(clocks, false);
2041 release_pll_clk(clocks);
2042 }
2043 }
2044 pub fn pll_d2_frequency(clocks: &mut ClockTree) -> u32 {
2045 (pll_clk_frequency(clocks) / 2)
2046 }
2047 pub fn request_pll_160m(clocks: &mut ClockTree) {
2048 trace!("Requesting PLL_160M");
2049 trace!("Enabling PLL_160M");
2050 request_cpu_clk(clocks);
2051 enable_pll_160m_impl(clocks, true);
2052 }
2053 pub fn release_pll_160m(clocks: &mut ClockTree) {
2054 trace!("Releasing PLL_160M");
2055 trace!("Disabling PLL_160M");
2056 enable_pll_160m_impl(clocks, false);
2057 release_cpu_clk(clocks);
2058 }
2059 pub fn pll_160m_frequency(clocks: &mut ClockTree) -> u32 {
2060 160000000
2061 }
2062 pub fn request_apb_80m(clocks: &mut ClockTree) {
2063 trace!("Requesting APB_80M");
2064 trace!("Enabling APB_80M");
2065 request_cpu_clk(clocks);
2066 enable_apb_80m_impl(clocks, true);
2067 }
2068 pub fn release_apb_80m(clocks: &mut ClockTree) {
2069 trace!("Releasing APB_80M");
2070 trace!("Disabling APB_80M");
2071 enable_apb_80m_impl(clocks, false);
2072 release_cpu_clk(clocks);
2073 }
2074 pub fn apb_80m_frequency(clocks: &mut ClockTree) -> u32 {
2075 80000000
2076 }
2077 pub fn configure_rc_fast_clk_div_n(clocks: &mut ClockTree, config: RcFastClkDivNConfig) {
2078 let old_config = clocks.rc_fast_clk_div_n.replace(config);
2079 configure_rc_fast_clk_div_n_impl(clocks, old_config, config);
2080 }
2081 pub fn rc_fast_clk_div_n_config(clocks: &mut ClockTree) -> Option<RcFastClkDivNConfig> {
2082 clocks.rc_fast_clk_div_n
2083 }
2084 pub fn request_rc_fast_clk_div_n(clocks: &mut ClockTree) {
2085 trace!("Requesting RC_FAST_CLK_DIV_N");
2086 trace!("Enabling RC_FAST_CLK_DIV_N");
2087 request_rc_fast_clk(clocks);
2088 enable_rc_fast_clk_div_n_impl(clocks, true);
2089 }
2090 pub fn release_rc_fast_clk_div_n(clocks: &mut ClockTree) {
2091 trace!("Releasing RC_FAST_CLK_DIV_N");
2092 trace!("Disabling RC_FAST_CLK_DIV_N");
2093 enable_rc_fast_clk_div_n_impl(clocks, false);
2094 release_rc_fast_clk(clocks);
2095 }
2096 #[allow(unused_variables)]
2097 pub fn rc_fast_clk_div_n_config_frequency(
2098 clocks: &mut ClockTree,
2099 config: RcFastClkDivNConfig,
2100 ) -> u32 {
2101 (rc_fast_clk_frequency(clocks) / (config.divisor() + 1))
2102 }
2103 pub fn rc_fast_clk_div_n_frequency(clocks: &mut ClockTree) -> u32 {
2104 if let Some(config) = clocks.rc_fast_clk_div_n {
2105 rc_fast_clk_div_n_config_frequency(clocks, config)
2106 } else {
2107 0
2108 }
2109 }
2110 pub fn request_xtal_div_clk(clocks: &mut ClockTree) {
2111 trace!("Requesting XTAL_DIV_CLK");
2112 trace!("Enabling XTAL_DIV_CLK");
2113 request_xtal_clk(clocks);
2114 enable_xtal_div_clk_impl(clocks, true);
2115 }
2116 pub fn release_xtal_div_clk(clocks: &mut ClockTree) {
2117 trace!("Releasing XTAL_DIV_CLK");
2118 trace!("Disabling XTAL_DIV_CLK");
2119 enable_xtal_div_clk_impl(clocks, false);
2120 release_xtal_clk(clocks);
2121 }
2122 pub fn xtal_div_clk_frequency(clocks: &mut ClockTree) -> u32 {
2123 (xtal_clk_frequency(clocks) / 2)
2124 }
2125 pub fn configure_rtc_slow_clk(clocks: &mut ClockTree, new_selector: RtcSlowClkConfig) {
2126 let old_selector = clocks.rtc_slow_clk.replace(new_selector);
2127 match new_selector {
2128 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2129 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
2130 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
2131 }
2132 configure_rtc_slow_clk_impl(clocks, old_selector, new_selector);
2133 if let Some(old_selector) = old_selector {
2134 match old_selector {
2135 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2136 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
2137 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
2138 }
2139 }
2140 }
2141 pub fn rtc_slow_clk_config(clocks: &mut ClockTree) -> Option<RtcSlowClkConfig> {
2142 clocks.rtc_slow_clk
2143 }
2144 pub fn request_rtc_slow_clk(clocks: &mut ClockTree) {
2145 trace!("Requesting RTC_SLOW_CLK");
2146 trace!("Enabling RTC_SLOW_CLK");
2147 match unwrap!(clocks.rtc_slow_clk) {
2148 RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2149 RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
2150 RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
2151 }
2152 enable_rtc_slow_clk_impl(clocks, true);
2153 }
2154 pub fn release_rtc_slow_clk(clocks: &mut ClockTree) {
2155 trace!("Releasing RTC_SLOW_CLK");
2156 trace!("Disabling RTC_SLOW_CLK");
2157 enable_rtc_slow_clk_impl(clocks, false);
2158 match unwrap!(clocks.rtc_slow_clk) {
2159 RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2160 RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
2161 RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
2162 }
2163 }
2164 #[allow(unused_variables)]
2165 pub fn rtc_slow_clk_config_frequency(
2166 clocks: &mut ClockTree,
2167 config: RtcSlowClkConfig,
2168 ) -> u32 {
2169 match config {
2170 RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(clocks),
2171 RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(clocks),
2172 RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(clocks),
2173 }
2174 }
2175 pub fn rtc_slow_clk_frequency(clocks: &mut ClockTree) -> u32 {
2176 if let Some(config) = clocks.rtc_slow_clk {
2177 rtc_slow_clk_config_frequency(clocks, config)
2178 } else {
2179 0
2180 }
2181 }
2182 pub fn configure_rtc_fast_clk(clocks: &mut ClockTree, new_selector: RtcFastClkConfig) {
2183 let old_selector = clocks.rtc_fast_clk.replace(new_selector);
2184 if clocks.rtc_fast_clk_refcount > 0 {
2185 match new_selector {
2186 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
2187 RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
2188 }
2189 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
2190 if let Some(old_selector) = old_selector {
2191 match old_selector {
2192 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
2193 RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
2194 }
2195 }
2196 } else {
2197 configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
2198 }
2199 }
2200 pub fn rtc_fast_clk_config(clocks: &mut ClockTree) -> Option<RtcFastClkConfig> {
2201 clocks.rtc_fast_clk
2202 }
2203 pub fn request_rtc_fast_clk(clocks: &mut ClockTree) {
2204 trace!("Requesting RTC_FAST_CLK");
2205 if increment_reference_count(&mut clocks.rtc_fast_clk_refcount) {
2206 trace!("Enabling RTC_FAST_CLK");
2207 match unwrap!(clocks.rtc_fast_clk) {
2208 RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
2209 RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
2210 }
2211 enable_rtc_fast_clk_impl(clocks, true);
2212 }
2213 }
2214 pub fn release_rtc_fast_clk(clocks: &mut ClockTree) {
2215 trace!("Releasing RTC_FAST_CLK");
2216 if decrement_reference_count(&mut clocks.rtc_fast_clk_refcount) {
2217 trace!("Disabling RTC_FAST_CLK");
2218 enable_rtc_fast_clk_impl(clocks, false);
2219 match unwrap!(clocks.rtc_fast_clk) {
2220 RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
2221 RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
2222 }
2223 }
2224 }
2225 #[allow(unused_variables)]
2226 pub fn rtc_fast_clk_config_frequency(
2227 clocks: &mut ClockTree,
2228 config: RtcFastClkConfig,
2229 ) -> u32 {
2230 match config {
2231 RtcFastClkConfig::Xtal => xtal_div_clk_frequency(clocks),
2232 RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(clocks),
2233 }
2234 }
2235 pub fn rtc_fast_clk_frequency(clocks: &mut ClockTree) -> u32 {
2236 if let Some(config) = clocks.rtc_fast_clk {
2237 rtc_fast_clk_config_frequency(clocks, config)
2238 } else {
2239 0
2240 }
2241 }
2242 pub fn configure_low_power_clk(clocks: &mut ClockTree, new_selector: LowPowerClkConfig) {
2243 let old_selector = clocks.low_power_clk.replace(new_selector);
2244 if clocks.low_power_clk_refcount > 0 {
2245 match new_selector {
2246 LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
2247 LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
2248 LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2249 LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
2250 }
2251 configure_low_power_clk_impl(clocks, old_selector, new_selector);
2252 if let Some(old_selector) = old_selector {
2253 match old_selector {
2254 LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
2255 LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
2256 LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2257 LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
2258 }
2259 }
2260 } else {
2261 configure_low_power_clk_impl(clocks, old_selector, new_selector);
2262 }
2263 }
2264 pub fn low_power_clk_config(clocks: &mut ClockTree) -> Option<LowPowerClkConfig> {
2265 clocks.low_power_clk
2266 }
2267 pub fn request_low_power_clk(clocks: &mut ClockTree) {
2268 trace!("Requesting LOW_POWER_CLK");
2269 if increment_reference_count(&mut clocks.low_power_clk_refcount) {
2270 trace!("Enabling LOW_POWER_CLK");
2271 match unwrap!(clocks.low_power_clk) {
2272 LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
2273 LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
2274 LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
2275 LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
2276 }
2277 enable_low_power_clk_impl(clocks, true);
2278 }
2279 }
2280 pub fn release_low_power_clk(clocks: &mut ClockTree) {
2281 trace!("Releasing LOW_POWER_CLK");
2282 if decrement_reference_count(&mut clocks.low_power_clk_refcount) {
2283 trace!("Disabling LOW_POWER_CLK");
2284 enable_low_power_clk_impl(clocks, false);
2285 match unwrap!(clocks.low_power_clk) {
2286 LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
2287 LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
2288 LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
2289 LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
2290 }
2291 }
2292 }
2293 #[allow(unused_variables)]
2294 pub fn low_power_clk_config_frequency(
2295 clocks: &mut ClockTree,
2296 config: LowPowerClkConfig,
2297 ) -> u32 {
2298 match config {
2299 LowPowerClkConfig::Xtal => xtal_clk_frequency(clocks),
2300 LowPowerClkConfig::RcFast => rc_fast_clk_frequency(clocks),
2301 LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(clocks),
2302 LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(clocks),
2303 }
2304 }
2305 pub fn low_power_clk_frequency(clocks: &mut ClockTree) -> u32 {
2306 if let Some(config) = clocks.low_power_clk {
2307 low_power_clk_config_frequency(clocks, config)
2308 } else {
2309 0
2310 }
2311 }
2312 pub fn request_uart_mem_clk(clocks: &mut ClockTree) {
2313 trace!("Requesting UART_MEM_CLK");
2314 if increment_reference_count(&mut clocks.uart_mem_clk_refcount) {
2315 trace!("Enabling UART_MEM_CLK");
2316 request_xtal_clk(clocks);
2317 enable_uart_mem_clk_impl(clocks, true);
2318 }
2319 }
2320 pub fn release_uart_mem_clk(clocks: &mut ClockTree) {
2321 trace!("Releasing UART_MEM_CLK");
2322 if decrement_reference_count(&mut clocks.uart_mem_clk_refcount) {
2323 trace!("Disabling UART_MEM_CLK");
2324 enable_uart_mem_clk_impl(clocks, false);
2325 release_xtal_clk(clocks);
2326 }
2327 }
2328 pub fn uart_mem_clk_frequency(clocks: &mut ClockTree) -> u32 {
2329 xtal_clk_frequency(clocks)
2330 }
2331 pub fn configure_timg_calibration_clock(
2332 clocks: &mut ClockTree,
2333 new_selector: TimgCalibrationClockConfig,
2334 ) {
2335 let old_selector = clocks.timg_calibration_clock.replace(new_selector);
2336 if clocks.timg_calibration_clock_refcount > 0 {
2337 match new_selector {
2338 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
2339 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
2340 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
2341 }
2342 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
2343 if let Some(old_selector) = old_selector {
2344 match old_selector {
2345 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
2346 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
2347 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
2348 }
2349 }
2350 } else {
2351 configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
2352 }
2353 }
2354 pub fn timg_calibration_clock_config(
2355 clocks: &mut ClockTree,
2356 ) -> Option<TimgCalibrationClockConfig> {
2357 clocks.timg_calibration_clock
2358 }
2359 pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
2360 trace!("Requesting TIMG_CALIBRATION_CLOCK");
2361 if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
2362 trace!("Enabling TIMG_CALIBRATION_CLOCK");
2363 match unwrap!(clocks.timg_calibration_clock) {
2364 TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
2365 TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
2366 TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
2367 }
2368 enable_timg_calibration_clock_impl(clocks, true);
2369 }
2370 }
2371 pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
2372 trace!("Releasing TIMG_CALIBRATION_CLOCK");
2373 if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
2374 trace!("Disabling TIMG_CALIBRATION_CLOCK");
2375 enable_timg_calibration_clock_impl(clocks, false);
2376 match unwrap!(clocks.timg_calibration_clock) {
2377 TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
2378 TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
2379 TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
2380 }
2381 }
2382 }
2383 #[allow(unused_variables)]
2384 pub fn timg_calibration_clock_config_frequency(
2385 clocks: &mut ClockTree,
2386 config: TimgCalibrationClockConfig,
2387 ) -> u32 {
2388 match config {
2389 TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(clocks),
2390 TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(clocks),
2391 TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(clocks),
2392 }
2393 }
2394 pub fn timg_calibration_clock_frequency(clocks: &mut ClockTree) -> u32 {
2395 if let Some(config) = clocks.timg_calibration_clock {
2396 timg_calibration_clock_config_frequency(clocks, config)
2397 } else {
2398 0
2399 }
2400 }
2401 impl McpwmInstance {
2402 pub fn configure_function_clock(
2403 self,
2404 clocks: &mut ClockTree,
2405 new_selector: McpwmFunctionClockConfig,
2406 ) {
2407 let old_selector = clocks.mcpwm_function_clock[self as usize].replace(new_selector);
2408 if clocks.mcpwm_function_clock_refcount[self as usize] > 0 {
2409 request_crypto_pwm_clk(clocks);
2410 self.configure_function_clock_impl(clocks, old_selector, new_selector);
2411 if let Some(old_selector) = old_selector {
2412 release_crypto_pwm_clk(clocks);
2413 }
2414 } else {
2415 self.configure_function_clock_impl(clocks, old_selector, new_selector);
2416 }
2417 }
2418 pub fn function_clock_config(
2419 self,
2420 clocks: &mut ClockTree,
2421 ) -> Option<McpwmFunctionClockConfig> {
2422 clocks.mcpwm_function_clock[self as usize]
2423 }
2424 pub fn request_function_clock(self, clocks: &mut ClockTree) {
2425 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
2426 if increment_reference_count(
2427 &mut clocks.mcpwm_function_clock_refcount[self as usize],
2428 ) {
2429 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
2430 request_crypto_pwm_clk(clocks);
2431 self.enable_function_clock_impl(clocks, true);
2432 }
2433 }
2434 pub fn release_function_clock(self, clocks: &mut ClockTree) {
2435 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
2436 if decrement_reference_count(
2437 &mut clocks.mcpwm_function_clock_refcount[self as usize],
2438 ) {
2439 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
2440 self.enable_function_clock_impl(clocks, false);
2441 release_crypto_pwm_clk(clocks);
2442 }
2443 }
2444 #[allow(unused_variables)]
2445 pub fn function_clock_config_frequency(
2446 self,
2447 clocks: &mut ClockTree,
2448 config: McpwmFunctionClockConfig,
2449 ) -> u32 {
2450 crypto_pwm_clk_frequency(clocks)
2451 }
2452 pub fn function_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
2453 if let Some(config) = clocks.mcpwm_function_clock[self as usize] {
2454 self.function_clock_config_frequency(clocks, config)
2455 } else {
2456 0
2457 }
2458 }
2459 }
2460 impl RmtInstance {
2461 pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
2462 let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
2463 if clocks.rmt_sclk_refcount[self as usize] > 0 {
2464 match new_selector {
2465 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
2466 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
2467 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
2468 }
2469 self.configure_sclk_impl(clocks, old_selector, new_selector);
2470 if let Some(old_selector) = old_selector {
2471 match old_selector {
2472 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
2473 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
2474 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
2475 }
2476 }
2477 } else {
2478 self.configure_sclk_impl(clocks, old_selector, new_selector);
2479 }
2480 }
2481 pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
2482 clocks.rmt_sclk[self as usize]
2483 }
2484 pub fn request_sclk(self, clocks: &mut ClockTree) {
2485 trace!("Requesting {:?}::SCLK", self);
2486 if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
2487 trace!("Enabling {:?}::SCLK", self);
2488 match unwrap!(clocks.rmt_sclk[self as usize]) {
2489 RmtSclkConfig::ApbClk => request_apb_clk(clocks),
2490 RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
2491 RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
2492 }
2493 self.enable_sclk_impl(clocks, true);
2494 }
2495 }
2496 pub fn release_sclk(self, clocks: &mut ClockTree) {
2497 trace!("Releasing {:?}::SCLK", self);
2498 if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
2499 trace!("Disabling {:?}::SCLK", self);
2500 self.enable_sclk_impl(clocks, false);
2501 match unwrap!(clocks.rmt_sclk[self as usize]) {
2502 RmtSclkConfig::ApbClk => release_apb_clk(clocks),
2503 RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
2504 RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
2505 }
2506 }
2507 }
2508 #[allow(unused_variables)]
2509 pub fn sclk_config_frequency(
2510 self,
2511 clocks: &mut ClockTree,
2512 config: RmtSclkConfig,
2513 ) -> u32 {
2514 match config {
2515 RmtSclkConfig::ApbClk => apb_clk_frequency(clocks),
2516 RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(clocks),
2517 RmtSclkConfig::XtalClk => xtal_clk_frequency(clocks),
2518 }
2519 }
2520 pub fn sclk_frequency(self, clocks: &mut ClockTree) -> u32 {
2521 if let Some(config) = clocks.rmt_sclk[self as usize] {
2522 self.sclk_config_frequency(clocks, config)
2523 } else {
2524 0
2525 }
2526 }
2527 }
2528 impl TimgInstance {
2529 pub fn configure_function_clock(
2530 self,
2531 clocks: &mut ClockTree,
2532 new_selector: TimgFunctionClockConfig,
2533 ) {
2534 let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
2535 if clocks.timg_function_clock_refcount[self as usize] > 0 {
2536 match new_selector {
2537 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
2538 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
2539 }
2540 self.configure_function_clock_impl(clocks, old_selector, new_selector);
2541 if let Some(old_selector) = old_selector {
2542 match old_selector {
2543 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
2544 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
2545 }
2546 }
2547 } else {
2548 self.configure_function_clock_impl(clocks, old_selector, new_selector);
2549 }
2550 }
2551 pub fn function_clock_config(
2552 self,
2553 clocks: &mut ClockTree,
2554 ) -> Option<TimgFunctionClockConfig> {
2555 clocks.timg_function_clock[self as usize]
2556 }
2557 pub fn request_function_clock(self, clocks: &mut ClockTree) {
2558 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
2559 if increment_reference_count(
2560 &mut clocks.timg_function_clock_refcount[self as usize],
2561 ) {
2562 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
2563 match unwrap!(clocks.timg_function_clock[self as usize]) {
2564 TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
2565 TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
2566 }
2567 self.enable_function_clock_impl(clocks, true);
2568 }
2569 }
2570 pub fn release_function_clock(self, clocks: &mut ClockTree) {
2571 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
2572 if decrement_reference_count(
2573 &mut clocks.timg_function_clock_refcount[self as usize],
2574 ) {
2575 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
2576 self.enable_function_clock_impl(clocks, false);
2577 match unwrap!(clocks.timg_function_clock[self as usize]) {
2578 TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
2579 TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
2580 }
2581 }
2582 }
2583 #[allow(unused_variables)]
2584 pub fn function_clock_config_frequency(
2585 self,
2586 clocks: &mut ClockTree,
2587 config: TimgFunctionClockConfig,
2588 ) -> u32 {
2589 match config {
2590 TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(clocks),
2591 TimgFunctionClockConfig::ApbClk => apb_clk_frequency(clocks),
2592 }
2593 }
2594 pub fn function_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
2595 if let Some(config) = clocks.timg_function_clock[self as usize] {
2596 self.function_clock_config_frequency(clocks, config)
2597 } else {
2598 0
2599 }
2600 }
2601 }
2602 impl UartInstance {
2603 pub fn configure_function_clock(
2604 self,
2605 clocks: &mut ClockTree,
2606 config: UartFunctionClockConfig,
2607 ) {
2608 let old_config = clocks.uart_function_clock[self as usize].replace(config);
2609 if clocks.uart_function_clock_refcount[self as usize] > 0 {
2610 match config.sclk {
2611 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
2612 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
2613 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
2614 }
2615 self.configure_function_clock_impl(clocks, old_config, config);
2616 if let Some(old_config) = old_config {
2617 match old_config.sclk {
2618 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
2619 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
2620 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
2621 }
2622 }
2623 } else {
2624 self.configure_function_clock_impl(clocks, old_config, config);
2625 }
2626 }
2627 pub fn function_clock_config(
2628 self,
2629 clocks: &mut ClockTree,
2630 ) -> Option<UartFunctionClockConfig> {
2631 clocks.uart_function_clock[self as usize]
2632 }
2633 pub fn request_function_clock(self, clocks: &mut ClockTree) {
2634 trace!("Requesting {:?}::FUNCTION_CLOCK", self);
2635 if increment_reference_count(
2636 &mut clocks.uart_function_clock_refcount[self as usize],
2637 ) {
2638 trace!("Enabling {:?}::FUNCTION_CLOCK", self);
2639 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
2640 UartFunctionClockSclk::Apb => request_apb_clk(clocks),
2641 UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
2642 UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
2643 }
2644 self.enable_function_clock_impl(clocks, true);
2645 }
2646 }
2647 pub fn release_function_clock(self, clocks: &mut ClockTree) {
2648 trace!("Releasing {:?}::FUNCTION_CLOCK", self);
2649 if decrement_reference_count(
2650 &mut clocks.uart_function_clock_refcount[self as usize],
2651 ) {
2652 trace!("Disabling {:?}::FUNCTION_CLOCK", self);
2653 self.enable_function_clock_impl(clocks, false);
2654 match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
2655 UartFunctionClockSclk::Apb => release_apb_clk(clocks),
2656 UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
2657 UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
2658 }
2659 }
2660 }
2661 #[allow(unused_variables)]
2662 pub fn function_clock_config_frequency(
2663 self,
2664 clocks: &mut ClockTree,
2665 config: UartFunctionClockConfig,
2666 ) -> u32 {
2667 (match config.sclk {
2668 UartFunctionClockSclk::Apb => apb_clk_frequency(clocks),
2669 UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(clocks),
2670 UartFunctionClockSclk::Xtal => xtal_clk_frequency(clocks),
2671 } / (config.div_num() + 1))
2672 }
2673 pub fn function_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
2674 if let Some(config) = clocks.uart_function_clock[self as usize] {
2675 self.function_clock_config_frequency(clocks, config)
2676 } else {
2677 0
2678 }
2679 }
2680 pub fn configure_baud_rate_generator(
2681 self,
2682 clocks: &mut ClockTree,
2683 config: UartBaudRateGeneratorConfig,
2684 ) {
2685 let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
2686 self.configure_baud_rate_generator_impl(clocks, old_config, config);
2687 }
2688 pub fn baud_rate_generator_config(
2689 self,
2690 clocks: &mut ClockTree,
2691 ) -> Option<UartBaudRateGeneratorConfig> {
2692 clocks.uart_baud_rate_generator[self as usize]
2693 }
2694 pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
2695 trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
2696 if increment_reference_count(
2697 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
2698 ) {
2699 trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
2700 self.request_function_clock(clocks);
2701 self.enable_baud_rate_generator_impl(clocks, true);
2702 }
2703 }
2704 pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
2705 trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
2706 if decrement_reference_count(
2707 &mut clocks.uart_baud_rate_generator_refcount[self as usize],
2708 ) {
2709 trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
2710 self.enable_baud_rate_generator_impl(clocks, false);
2711 self.release_function_clock(clocks);
2712 }
2713 }
2714 #[allow(unused_variables)]
2715 pub fn baud_rate_generator_config_frequency(
2716 self,
2717 clocks: &mut ClockTree,
2718 config: UartBaudRateGeneratorConfig,
2719 ) -> u32 {
2720 ((self.function_clock_frequency(clocks) * 16)
2721 / ((config.integral() * 16) + config.fractional()))
2722 }
2723 pub fn baud_rate_generator_frequency(self, clocks: &mut ClockTree) -> u32 {
2724 if let Some(config) = clocks.uart_baud_rate_generator[self as usize] {
2725 self.baud_rate_generator_config_frequency(clocks, config)
2726 } else {
2727 0
2728 }
2729 }
2730 pub fn configure_mem_clock(self, clocks: &mut ClockTree, config: UartMemClockConfig) {
2731 let old_config = clocks.uart_mem_clock[self as usize].replace(config);
2732 self.configure_mem_clock_impl(clocks, old_config, config);
2733 }
2734 pub fn mem_clock_config(self, clocks: &mut ClockTree) -> Option<UartMemClockConfig> {
2735 clocks.uart_mem_clock[self as usize]
2736 }
2737 pub fn request_mem_clock(self, clocks: &mut ClockTree) {
2738 trace!("Requesting {:?}::MEM_CLOCK", self);
2739 if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
2740 trace!("Enabling {:?}::MEM_CLOCK", self);
2741 request_uart_mem_clk(clocks);
2742 self.enable_mem_clock_impl(clocks, true);
2743 }
2744 }
2745 pub fn release_mem_clock(self, clocks: &mut ClockTree) {
2746 trace!("Releasing {:?}::MEM_CLOCK", self);
2747 if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
2748 trace!("Disabling {:?}::MEM_CLOCK", self);
2749 self.enable_mem_clock_impl(clocks, false);
2750 release_uart_mem_clk(clocks);
2751 }
2752 }
2753 #[allow(unused_variables)]
2754 pub fn mem_clock_config_frequency(
2755 self,
2756 clocks: &mut ClockTree,
2757 config: UartMemClockConfig,
2758 ) -> u32 {
2759 uart_mem_clk_frequency(clocks)
2760 }
2761 pub fn mem_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
2762 if let Some(config) = clocks.uart_mem_clock[self as usize] {
2763 self.mem_clock_config_frequency(clocks, config)
2764 } else {
2765 0
2766 }
2767 }
2768 }
2769 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
2777 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2778 #[instability::unstable]
2779 pub struct ClockConfig {
2780 pub xtal_clk: Option<XtalClkConfig>,
2782 pub pll_clk: Option<PllClkConfig>,
2784 pub system_pre_div: Option<SystemPreDivConfig>,
2786 pub cpu_pll_div_out: Option<CpuPllDivOutConfig>,
2788 pub cpu_clk: Option<CpuClkConfig>,
2790 pub rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
2792 pub rtc_slow_clk: Option<RtcSlowClkConfig>,
2794 pub rtc_fast_clk: Option<RtcFastClkConfig>,
2796 pub low_power_clk: Option<LowPowerClkConfig>,
2798 pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
2800 }
2801 impl ClockConfig {
2802 fn apply(&self) {
2803 ClockTree::with(|clocks| {
2804 if let Some(config) = self.xtal_clk {
2805 configure_xtal_clk(clocks, config);
2806 }
2807 if let Some(config) = self.pll_clk {
2808 configure_pll_clk(clocks, config);
2809 }
2810 if let Some(config) = self.system_pre_div {
2811 configure_system_pre_div(clocks, config);
2812 }
2813 if let Some(config) = self.cpu_pll_div_out {
2814 configure_cpu_pll_div_out(clocks, config);
2815 }
2816 if let Some(config) = self.cpu_clk {
2817 configure_cpu_clk(clocks, config);
2818 }
2819 if let Some(config) = self.rc_fast_clk_div_n {
2820 configure_rc_fast_clk_div_n(clocks, config);
2821 }
2822 if let Some(config) = self.rtc_slow_clk {
2823 configure_rtc_slow_clk(clocks, config);
2824 }
2825 if let Some(config) = self.rtc_fast_clk {
2826 configure_rtc_fast_clk(clocks, config);
2827 }
2828 if let Some(config) = self.low_power_clk {
2829 configure_low_power_clk(clocks, config);
2830 }
2831 if let Some(config) = self.timg_calibration_clock {
2832 configure_timg_calibration_clock(clocks, config);
2833 }
2834 });
2835 }
2836 }
2837 fn increment_reference_count(refcount: &mut u32) -> bool {
2838 let first = *refcount == 0;
2839 *refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
2840 first
2841 }
2842 fn decrement_reference_count(refcount: &mut u32) -> bool {
2843 *refcount = refcount.saturating_sub(1);
2844 let last = *refcount == 0;
2845 last
2846 }
2847 };
2848}
2849#[macro_export]
2853#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
2854macro_rules! implement_peripheral_clocks {
2855 () => {
2856 #[doc(hidden)]
2857 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
2858 #[repr(u8)]
2859 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2860 pub enum Peripheral {
2861 Aes,
2863 ApbSarAdc,
2865 DedicatedGpio,
2867 Dma,
2869 Ds,
2871 Hmac,
2873 I2cExt0,
2875 I2cExt1,
2877 I2s0,
2879 I2s1,
2881 LcdCam,
2883 Ledc,
2885 Mcpwm0,
2887 Mcpwm1,
2889 Pcnt,
2891 PeriBackup,
2893 Rmt,
2895 Rsa,
2897 SdioHost,
2899 Sha,
2901 Spi2,
2903 Spi3,
2905 Systimer,
2907 Timg0,
2909 Timg1,
2911 Twai0,
2913 Uart0,
2915 Uart1,
2917 Uart2,
2919 UartMem,
2921 Uhci0,
2923 Usb,
2925 UsbDevice,
2927 }
2928 impl Peripheral {
2929 const KEEP_ENABLED: &[Peripheral] = &[
2930 Self::Systimer,
2931 Self::Timg0,
2932 Self::Uart0,
2933 Self::UartMem,
2934 Self::UsbDevice,
2935 ];
2936 const COUNT: usize = Self::ALL.len();
2937 const ALL: &[Self] = &[
2938 Self::Aes,
2939 Self::ApbSarAdc,
2940 Self::DedicatedGpio,
2941 Self::Dma,
2942 Self::Ds,
2943 Self::Hmac,
2944 Self::I2cExt0,
2945 Self::I2cExt1,
2946 Self::I2s0,
2947 Self::I2s1,
2948 Self::LcdCam,
2949 Self::Ledc,
2950 Self::Mcpwm0,
2951 Self::Mcpwm1,
2952 Self::Pcnt,
2953 Self::PeriBackup,
2954 Self::Rmt,
2955 Self::Rsa,
2956 Self::SdioHost,
2957 Self::Sha,
2958 Self::Spi2,
2959 Self::Spi3,
2960 Self::Systimer,
2961 Self::Timg0,
2962 Self::Timg1,
2963 Self::Twai0,
2964 Self::Uart0,
2965 Self::Uart1,
2966 Self::Uart2,
2967 Self::UartMem,
2968 Self::Uhci0,
2969 Self::Usb,
2970 Self::UsbDevice,
2971 ];
2972 }
2973 unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
2974 match peripheral {
2975 Peripheral::Aes => {
2976 crate::peripherals::SYSTEM::regs()
2977 .perip_clk_en1()
2978 .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
2979 }
2980 Peripheral::ApbSarAdc => {
2981 crate::peripherals::SYSTEM::regs()
2982 .perip_clk_en0()
2983 .modify(|_, w| w.apb_saradc_clk_en().bit(enable));
2984 }
2985 Peripheral::DedicatedGpio => {
2986 crate::peripherals::SYSTEM::regs()
2987 .cpu_peri_clk_en()
2988 .modify(|_, w| w.dedicated_gpio_clk_en().bit(enable));
2989 }
2990 Peripheral::Dma => {
2991 crate::peripherals::SYSTEM::regs()
2992 .perip_clk_en1()
2993 .modify(|_, w| w.dma_clk_en().bit(enable));
2994 }
2995 Peripheral::Ds => {
2996 crate::peripherals::SYSTEM::regs()
2997 .perip_clk_en1()
2998 .modify(|_, w| w.crypto_ds_clk_en().bit(enable));
2999 }
3000 Peripheral::Hmac => {
3001 crate::peripherals::SYSTEM::regs()
3002 .perip_clk_en1()
3003 .modify(|_, w| w.crypto_hmac_clk_en().bit(enable));
3004 }
3005 Peripheral::I2cExt0 => {
3006 crate::peripherals::SYSTEM::regs()
3007 .perip_clk_en0()
3008 .modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
3009 }
3010 Peripheral::I2cExt1 => {
3011 crate::peripherals::SYSTEM::regs()
3012 .perip_clk_en0()
3013 .modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
3014 }
3015 Peripheral::I2s0 => {
3016 crate::peripherals::SYSTEM::regs()
3017 .perip_clk_en0()
3018 .modify(|_, w| w.i2s0_clk_en().bit(enable));
3019 }
3020 Peripheral::I2s1 => {
3021 crate::peripherals::SYSTEM::regs()
3022 .perip_clk_en0()
3023 .modify(|_, w| w.i2s1_clk_en().bit(enable));
3024 }
3025 Peripheral::LcdCam => {
3026 crate::peripherals::SYSTEM::regs()
3027 .perip_clk_en1()
3028 .modify(|_, w| w.lcd_cam_clk_en().bit(enable));
3029 }
3030 Peripheral::Ledc => {
3031 crate::peripherals::SYSTEM::regs()
3032 .perip_clk_en0()
3033 .modify(|_, w| w.ledc_clk_en().bit(enable));
3034 }
3035 Peripheral::Mcpwm0 => {
3036 crate::peripherals::SYSTEM::regs()
3037 .perip_clk_en0()
3038 .modify(|_, w| w.pwm0_clk_en().bit(enable));
3039 }
3040 Peripheral::Mcpwm1 => {
3041 crate::peripherals::SYSTEM::regs()
3042 .perip_clk_en0()
3043 .modify(|_, w| w.pwm1_clk_en().bit(enable));
3044 }
3045 Peripheral::Pcnt => {
3046 crate::peripherals::SYSTEM::regs()
3047 .perip_clk_en0()
3048 .modify(|_, w| w.pcnt_clk_en().bit(enable));
3049 }
3050 Peripheral::PeriBackup => {
3051 crate::peripherals::SYSTEM::regs()
3052 .perip_clk_en1()
3053 .modify(|_, w| w.peri_backup_clk_en().bit(enable));
3054 }
3055 Peripheral::Rmt => {
3056 crate::peripherals::SYSTEM::regs()
3057 .perip_clk_en0()
3058 .modify(|_, w| w.rmt_clk_en().bit(enable));
3059 }
3060 Peripheral::Rsa => {
3061 crate::peripherals::SYSTEM::regs()
3062 .perip_clk_en1()
3063 .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
3064 }
3065 Peripheral::SdioHost => {
3066 crate::peripherals::SYSTEM::regs()
3067 .perip_clk_en1()
3068 .modify(|_, w| w.sdio_host_clk_en().bit(enable));
3069 }
3070 Peripheral::Sha => {
3071 crate::peripherals::SYSTEM::regs()
3072 .perip_clk_en1()
3073 .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
3074 }
3075 Peripheral::Spi2 => {
3076 crate::peripherals::SYSTEM::regs()
3077 .perip_clk_en0()
3078 .modify(|_, w| w.spi2_clk_en().bit(enable));
3079 }
3080 Peripheral::Spi3 => {
3081 crate::peripherals::SYSTEM::regs()
3082 .perip_clk_en0()
3083 .modify(|_, w| w.spi3_clk_en().bit(enable));
3084 }
3085 Peripheral::Systimer => {
3086 crate::peripherals::SYSTEM::regs()
3087 .perip_clk_en0()
3088 .modify(|_, w| w.systimer_clk_en().bit(enable));
3089 }
3090 Peripheral::Timg0 => {
3091 crate::peripherals::SYSTEM::regs()
3092 .perip_clk_en0()
3093 .modify(|_, w| w.timergroup_clk_en().bit(enable));
3094 }
3095 Peripheral::Timg1 => {
3096 crate::peripherals::SYSTEM::regs()
3097 .perip_clk_en0()
3098 .modify(|_, w| w.timergroup1_clk_en().bit(enable));
3099 }
3100 Peripheral::Twai0 => {
3101 crate::peripherals::SYSTEM::regs()
3102 .perip_clk_en0()
3103 .modify(|_, w| w.twai_clk_en().bit(enable));
3104 }
3105 Peripheral::Uart0 => {
3106 crate::peripherals::SYSTEM::regs()
3107 .perip_clk_en0()
3108 .modify(|_, w| w.uart_clk_en().bit(enable));
3109 }
3110 Peripheral::Uart1 => {
3111 crate::peripherals::SYSTEM::regs()
3112 .perip_clk_en0()
3113 .modify(|_, w| w.uart1_clk_en().bit(enable));
3114 }
3115 Peripheral::Uart2 => {
3116 crate::peripherals::SYSTEM::regs()
3117 .perip_clk_en1()
3118 .modify(|_, w| w.uart2_clk_en().bit(enable));
3119 }
3120 Peripheral::UartMem => {
3121 crate::peripherals::SYSTEM::regs()
3122 .perip_clk_en0()
3123 .modify(|_, w| w.uart_mem_clk_en().bit(enable));
3124 }
3125 Peripheral::Uhci0 => {
3126 crate::peripherals::SYSTEM::regs()
3127 .perip_clk_en0()
3128 .modify(|_, w| w.uhci0_clk_en().bit(enable));
3129 }
3130 Peripheral::Usb => {
3131 crate::peripherals::SYSTEM::regs()
3132 .perip_clk_en0()
3133 .modify(|_, w| w.usb_clk_en().bit(enable));
3134 }
3135 Peripheral::UsbDevice => {
3136 crate::peripherals::SYSTEM::regs()
3137 .perip_clk_en1()
3138 .modify(|_, w| w.usb_device_clk_en().bit(enable));
3139 }
3140 }
3141 }
3142 unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
3143 match peripheral {
3144 Peripheral::Aes => {
3145 crate::peripherals::SYSTEM::regs()
3146 .perip_rst_en1()
3147 .modify(|_, w| w.crypto_aes_rst().bit(reset));
3148 }
3149 Peripheral::ApbSarAdc => {
3150 crate::peripherals::SYSTEM::regs()
3151 .perip_rst_en0()
3152 .modify(|_, w| w.apb_saradc_rst().bit(reset));
3153 }
3154 Peripheral::DedicatedGpio => {
3155 crate::peripherals::SYSTEM::regs()
3156 .cpu_peri_rst_en()
3157 .modify(|_, w| w.dedicated_gpio_rst().bit(reset));
3158 }
3159 Peripheral::Dma => {
3160 crate::peripherals::SYSTEM::regs()
3161 .perip_rst_en1()
3162 .modify(|_, w| w.dma_rst().bit(reset));
3163 }
3164 Peripheral::Ds => {
3165 crate::peripherals::SYSTEM::regs()
3166 .perip_rst_en1()
3167 .modify(|_, w| w.crypto_ds_rst().bit(reset));
3168 }
3169 Peripheral::Hmac => {
3170 crate::peripherals::SYSTEM::regs()
3171 .perip_rst_en1()
3172 .modify(|_, w| w.crypto_hmac_rst().bit(reset));
3173 }
3174 Peripheral::I2cExt0 => {
3175 crate::peripherals::SYSTEM::regs()
3176 .perip_rst_en0()
3177 .modify(|_, w| w.i2c_ext0_rst().bit(reset));
3178 }
3179 Peripheral::I2cExt1 => {
3180 crate::peripherals::SYSTEM::regs()
3181 .perip_rst_en0()
3182 .modify(|_, w| w.i2c_ext1_rst().bit(reset));
3183 }
3184 Peripheral::I2s0 => {
3185 crate::peripherals::SYSTEM::regs()
3186 .perip_rst_en0()
3187 .modify(|_, w| w.i2s0_rst().bit(reset));
3188 }
3189 Peripheral::I2s1 => {
3190 crate::peripherals::SYSTEM::regs()
3191 .perip_rst_en0()
3192 .modify(|_, w| w.i2s1_rst().bit(reset));
3193 }
3194 Peripheral::LcdCam => {
3195 crate::peripherals::SYSTEM::regs()
3196 .perip_rst_en1()
3197 .modify(|_, w| w.lcd_cam_rst().bit(reset));
3198 }
3199 Peripheral::Ledc => {
3200 crate::peripherals::SYSTEM::regs()
3201 .perip_rst_en0()
3202 .modify(|_, w| w.ledc_rst().bit(reset));
3203 }
3204 Peripheral::Mcpwm0 => {
3205 crate::peripherals::SYSTEM::regs()
3206 .perip_rst_en0()
3207 .modify(|_, w| w.pwm0_rst().bit(reset));
3208 }
3209 Peripheral::Mcpwm1 => {
3210 crate::peripherals::SYSTEM::regs()
3211 .perip_rst_en0()
3212 .modify(|_, w| w.pwm1_rst().bit(reset));
3213 }
3214 Peripheral::Pcnt => {
3215 crate::peripherals::SYSTEM::regs()
3216 .perip_rst_en0()
3217 .modify(|_, w| w.pcnt_rst().bit(reset));
3218 }
3219 Peripheral::PeriBackup => {
3220 crate::peripherals::SYSTEM::regs()
3221 .perip_rst_en1()
3222 .modify(|_, w| w.peri_backup_rst().bit(reset));
3223 }
3224 Peripheral::Rmt => {
3225 crate::peripherals::SYSTEM::regs()
3226 .perip_rst_en0()
3227 .modify(|_, w| w.rmt_rst().bit(reset));
3228 }
3229 Peripheral::Rsa => {
3230 crate::peripherals::SYSTEM::regs()
3231 .perip_rst_en1()
3232 .modify(|_, w| w.crypto_rsa_rst().bit(reset));
3233 }
3234 Peripheral::SdioHost => {
3235 crate::peripherals::SYSTEM::regs()
3236 .perip_rst_en1()
3237 .modify(|_, w| w.sdio_host_rst().bit(reset));
3238 }
3239 Peripheral::Sha => {
3240 crate::peripherals::SYSTEM::regs()
3241 .perip_rst_en1()
3242 .modify(|_, w| w.crypto_sha_rst().bit(reset));
3243 }
3244 Peripheral::Spi2 => {
3245 crate::peripherals::SYSTEM::regs()
3246 .perip_rst_en0()
3247 .modify(|_, w| w.spi2_rst().bit(reset));
3248 }
3249 Peripheral::Spi3 => {
3250 crate::peripherals::SYSTEM::regs()
3251 .perip_rst_en0()
3252 .modify(|_, w| w.spi3_rst().bit(reset));
3253 }
3254 Peripheral::Systimer => {
3255 crate::peripherals::SYSTEM::regs()
3256 .perip_rst_en0()
3257 .modify(|_, w| w.systimer_rst().bit(reset));
3258 }
3259 Peripheral::Timg0 => {
3260 crate::peripherals::SYSTEM::regs()
3261 .perip_rst_en0()
3262 .modify(|_, w| w.timergroup_rst().bit(reset));
3263 }
3264 Peripheral::Timg1 => {
3265 crate::peripherals::SYSTEM::regs()
3266 .perip_rst_en0()
3267 .modify(|_, w| w.timergroup1_rst().bit(reset));
3268 }
3269 Peripheral::Twai0 => {
3270 crate::peripherals::SYSTEM::regs()
3271 .perip_rst_en0()
3272 .modify(|_, w| w.twai_rst().bit(reset));
3273 }
3274 Peripheral::Uart0 => {
3275 crate::peripherals::SYSTEM::regs()
3276 .perip_rst_en0()
3277 .modify(|_, w| w.uart_rst().bit(reset));
3278 }
3279 Peripheral::Uart1 => {
3280 crate::peripherals::SYSTEM::regs()
3281 .perip_rst_en0()
3282 .modify(|_, w| w.uart1_rst().bit(reset));
3283 }
3284 Peripheral::Uart2 => {
3285 crate::peripherals::SYSTEM::regs()
3286 .perip_rst_en1()
3287 .modify(|_, w| w.uart2_rst().bit(reset));
3288 }
3289 Peripheral::UartMem => {
3290 crate::peripherals::SYSTEM::regs()
3291 .perip_rst_en0()
3292 .modify(|_, w| w.uart_mem_rst().bit(reset));
3293 }
3294 Peripheral::Uhci0 => {
3295 crate::peripherals::SYSTEM::regs()
3296 .perip_rst_en0()
3297 .modify(|_, w| w.uhci0_rst().bit(reset));
3298 }
3299 Peripheral::Usb => {
3300 crate::peripherals::SYSTEM::regs()
3301 .perip_rst_en0()
3302 .modify(|_, w| w.usb_rst().bit(reset));
3303 }
3304 Peripheral::UsbDevice => {
3305 crate::peripherals::SYSTEM::regs()
3306 .perip_rst_en1()
3307 .modify(|_, w| w.usb_device_rst().bit(reset));
3308 }
3309 }
3310 }
3311 };
3312}
3313#[macro_export]
3321#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3322macro_rules! memory_range {
3323 ("DRAM") => {
3324 0x3FC88000..0x3FD00000
3325 };
3326 (size as str, "DRAM") => {
3327 "491520"
3328 };
3329 ("DRAM2_UNINIT") => {
3330 0x3FCDB700..0x3FCED710
3331 };
3332 (size as str, "DRAM2_UNINIT") => {
3333 "73744"
3334 };
3335}
3336#[macro_export]
3353#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3354macro_rules! for_each_i2c_master {
3355 ($($pattern:tt => $code:tt;)*) => {
3356 macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
3357 => {} } _for_each_inner_i2c_master!((0, I2C0, I2cExt0, I2CEXT0_SCL,
3358 I2CEXT0_SDA)); _for_each_inner_i2c_master!((1, I2C1, I2cExt1, I2CEXT1_SCL,
3359 I2CEXT1_SDA)); _for_each_inner_i2c_master!((all(0, I2C0, I2cExt0, I2CEXT0_SCL,
3360 I2CEXT0_SDA), (1, I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA)));
3361 };
3362}
3363#[macro_export]
3382#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3383macro_rules! for_each_uart {
3384 ($($pattern:tt => $code:tt;)*) => {
3385 macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
3386 } _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS));
3387 _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS));
3388 _for_each_inner_uart!((2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS));
3389 _for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS), (1,
3390 UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS,
3391 U2RTS)));
3392 };
3393}
3394#[macro_export]
3416#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3417macro_rules! for_each_spi_master {
3418 ($($pattern:tt => $code:tt;)*) => {
3419 macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
3420 => {} } _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1,
3421 FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4,
3422 FSPIIO5, FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
3423 SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD],
3424 true)); _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1,
3425 FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4,
3426 FSPIIO5, FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CLK[SPI3_CS0, SPI3_CS1,
3427 SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD], true)));
3428 };
3429}
3430#[macro_export]
3447#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3448macro_rules! for_each_spi_slave {
3449 ($($pattern:tt => $code:tt;)*) => {
3450 macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
3451 => {} } _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
3452 _for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0));
3453 _for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
3454 (SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0)));
3455 };
3456}
3457#[macro_export]
3458#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
3459macro_rules! for_each_peripheral {
3460 ($($pattern:tt => $code:tt;)*) => {
3461 macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
3462 => {} } _for_each_inner_peripheral!((@ peri_type #[doc =
3463 "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3464 "<section class=\"warning\">"] #[doc =
3465 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3466 #[doc = "<ul>"] #[doc =
3467 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
3468 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()));
3469 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
3470 GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3471 "GPIO2 peripheral singleton"] GPIO2 <= virtual()));
3472 _for_each_inner_peripheral!((@ peri_type #[doc =
3473 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3474 "<section class=\"warning\">"] #[doc =
3475 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3476 #[doc = "<ul>"] #[doc =
3477 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
3478 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()));
3479 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO4 peripheral singleton"]
3480 GPIO4 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3481 "GPIO5 peripheral singleton"] GPIO5 <= virtual()));
3482 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO6 peripheral singleton"]
3483 GPIO6 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3484 "GPIO7 peripheral singleton"] GPIO7 <= virtual()));
3485 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO8 peripheral singleton"]
3486 GPIO8 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3487 "GPIO9 peripheral singleton"] GPIO9 <= virtual()));
3488 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO10 peripheral singleton"]
3489 GPIO10 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3490 "GPIO11 peripheral singleton"] GPIO11 <= virtual()));
3491 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO12 peripheral singleton"]
3492 GPIO12 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3493 "GPIO13 peripheral singleton"] GPIO13 <= virtual()));
3494 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO14 peripheral singleton"]
3495 GPIO14 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3496 "GPIO15 peripheral singleton"] GPIO15 <= virtual()));
3497 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO16 peripheral singleton"]
3498 GPIO16 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3499 "GPIO17 peripheral singleton"] GPIO17 <= virtual()));
3500 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO18 peripheral singleton"]
3501 GPIO18 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3502 "GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3503 "<section class=\"warning\">"] #[doc =
3504 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3505 #[doc = "<ul>"] #[doc =
3506 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
3507 #[doc = "</section>"] GPIO19 <= virtual())); _for_each_inner_peripheral!((@
3508 peri_type #[doc = "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""]
3509 #[doc = "<section class=\"warning\">"] #[doc =
3510 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3511 #[doc = "<ul>"] #[doc =
3512 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
3513 #[doc = "</section>"] GPIO20 <= virtual())); _for_each_inner_peripheral!((@
3514 peri_type #[doc = "GPIO21 peripheral singleton"] GPIO21 <= virtual()));
3515 _for_each_inner_peripheral!((@ peri_type #[doc =
3516 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3517 "<section class=\"warning\">"] #[doc =
3518 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3519 #[doc = "<ul>"] #[doc =
3520 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3521 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
3522 _for_each_inner_peripheral!((@ peri_type #[doc =
3523 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3524 "<section class=\"warning\">"] #[doc =
3525 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3526 #[doc = "<ul>"] #[doc =
3527 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3528 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3529 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
3530 _for_each_inner_peripheral!((@ peri_type #[doc =
3531 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3532 "<section class=\"warning\">"] #[doc =
3533 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3534 #[doc = "<ul>"] #[doc =
3535 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3536 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3537 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
3538 _for_each_inner_peripheral!((@ peri_type #[doc =
3539 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3540 "<section class=\"warning\">"] #[doc =
3541 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3542 #[doc = "<ul>"] #[doc =
3543 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3544 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3545 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()));
3546 _for_each_inner_peripheral!((@ peri_type #[doc =
3547 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3548 "<section class=\"warning\">"] #[doc =
3549 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3550 #[doc = "<ul>"] #[doc =
3551 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3552 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3553 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
3554 _for_each_inner_peripheral!((@ peri_type #[doc =
3555 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3556 "<section class=\"warning\">"] #[doc =
3557 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3558 #[doc = "<ul>"] #[doc =
3559 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3560 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3561 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
3562 _for_each_inner_peripheral!((@ peri_type #[doc =
3563 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3564 "<section class=\"warning\">"] #[doc =
3565 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3566 #[doc = "<ul>"] #[doc =
3567 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3568 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
3569 _for_each_inner_peripheral!((@ peri_type #[doc =
3570 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3571 "<section class=\"warning\">"] #[doc =
3572 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3573 #[doc = "<ul>"] #[doc =
3574 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3575 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3576 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()));
3577 _for_each_inner_peripheral!((@ peri_type #[doc =
3578 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3579 "<section class=\"warning\">"] #[doc =
3580 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3581 #[doc = "<ul>"] #[doc =
3582 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3583 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3584 #[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
3585 _for_each_inner_peripheral!((@ peri_type #[doc =
3586 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3587 "<section class=\"warning\">"] #[doc =
3588 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3589 #[doc = "<ul>"] #[doc =
3590 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3591 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3592 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
3593 _for_each_inner_peripheral!((@ peri_type #[doc =
3594 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3595 "<section class=\"warning\">"] #[doc =
3596 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3597 #[doc = "<ul>"] #[doc =
3598 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3599 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3600 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
3601 _for_each_inner_peripheral!((@ peri_type #[doc =
3602 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3603 "<section class=\"warning\">"] #[doc =
3604 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3605 #[doc = "<ul>"] #[doc =
3606 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3607 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3608 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
3609 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO38 peripheral singleton"]
3610 GPIO38 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3611 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3612 "<section class=\"warning\">"] #[doc =
3613 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3614 #[doc = "<ul>"] #[doc =
3615 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
3616 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
3617 _for_each_inner_peripheral!((@ peri_type #[doc =
3618 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3619 "<section class=\"warning\">"] #[doc =
3620 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3621 #[doc = "<ul>"] #[doc =
3622 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
3623 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
3624 _for_each_inner_peripheral!((@ peri_type #[doc =
3625 "GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3626 "<section class=\"warning\">"] #[doc =
3627 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3628 #[doc = "<ul>"] #[doc =
3629 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
3630 #[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()));
3631 _for_each_inner_peripheral!((@ peri_type #[doc =
3632 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3633 "<section class=\"warning\">"] #[doc =
3634 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3635 #[doc = "<ul>"] #[doc =
3636 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
3637 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()));
3638 _for_each_inner_peripheral!((@ peri_type #[doc =
3639 "GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3640 "<section class=\"warning\">"] #[doc =
3641 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3642 #[doc = "<ul>"] #[doc =
3643 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
3644 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()));
3645 _for_each_inner_peripheral!((@ peri_type #[doc =
3646 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3647 "<section class=\"warning\">"] #[doc =
3648 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3649 #[doc = "<ul>"] #[doc =
3650 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
3651 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()));
3652 _for_each_inner_peripheral!((@ peri_type #[doc =
3653 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3654 "<section class=\"warning\">"] #[doc =
3655 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3656 #[doc = "<ul>"] #[doc =
3657 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
3658 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()));
3659 _for_each_inner_peripheral!((@ peri_type #[doc =
3660 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3661 "<section class=\"warning\">"] #[doc =
3662 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3663 #[doc = "<ul>"] #[doc =
3664 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
3665 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()));
3666 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO47 peripheral singleton"]
3667 GPIO47 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
3668 "GPIO48 peripheral singleton"] GPIO48 <= virtual()));
3669 _for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
3670 <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
3671 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3672 "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)));
3673 _for_each_inner_peripheral!((@ peri_type #[doc =
3674 "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC() (unstable)));
3675 _for_each_inner_peripheral!((@ peri_type #[doc =
3676 "ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
3677 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
3678 <= DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3679 "DS peripheral singleton"] DS <= DS() (unstable)));
3680 _for_each_inner_peripheral!((@ peri_type #[doc = "EFUSE peripheral singleton"]
3681 EFUSE <= EFUSE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3682 "EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)));
3683 _for_each_inner_peripheral!((@ peri_type #[doc = "GPIO peripheral singleton"]
3684 GPIO <= GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3685 "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)));
3686 _for_each_inner_peripheral!((@ peri_type #[doc = "HMAC peripheral singleton"]
3687 HMAC <= HMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3688 "I2C_ANA_MST peripheral singleton"] I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
3689 _for_each_inner_peripheral!((@ peri_type #[doc = "I2C0 peripheral singleton"]
3690 I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
3691 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
3692 "I2C1 peripheral singleton"] I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt,
3693 enable_peri_interrupt, disable_peri_interrupt })));
3694 _for_each_inner_peripheral!((@ peri_type #[doc = "I2S0 peripheral singleton"]
3695 I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
3696 disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
3697 #[doc = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
3698 enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
3699 _for_each_inner_peripheral!((@ peri_type #[doc =
3700 "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
3701 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3702 "INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
3703 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3704 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
3705 _for_each_inner_peripheral!((@ peri_type #[doc = "LCD_CAM peripheral singleton"]
3706 LCD_CAM <= LCD_CAM() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
3707 = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)));
3708 _for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
3709 LPWR <= RTC_CNTL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3710 "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)));
3711 _for_each_inner_peripheral!((@ peri_type #[doc = "MCPWM1 peripheral singleton"]
3712 MCPWM1 <= MCPWM1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3713 "PCNT peripheral singleton"] PCNT <= PCNT() (unstable)));
3714 _for_each_inner_peripheral!((@ peri_type #[doc =
3715 "PERI_BACKUP peripheral singleton"] PERI_BACKUP <= PERI_BACKUP() (unstable)));
3716 _for_each_inner_peripheral!((@ peri_type #[doc = "RMT peripheral singleton"] RMT
3717 <= RMT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3718 "RNG peripheral singleton"] RNG <= RNG() (unstable)));
3719 _for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
3720 <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
3721 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3722 "RTC_CNTL peripheral singleton"] RTC_CNTL <= RTC_CNTL() (unstable)));
3723 _for_each_inner_peripheral!((@ peri_type #[doc = "RTC_I2C peripheral singleton"]
3724 RTC_I2C <= RTC_I2C() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
3725 = "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)));
3726 _for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
3727 SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3728 "SENS peripheral singleton"] SENS <= SENS() (unstable)));
3729 _for_each_inner_peripheral!((@ peri_type #[doc =
3730 "SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)));
3731 _for_each_inner_peripheral!((@ peri_type #[doc = "SHA peripheral singleton"] SHA
3732 <= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
3733 }) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3734 "SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
3735 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
3736 SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3737 "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
3738 enable_peri_interrupt, disable_peri_interrupt })));
3739 _for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
3740 SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
3741 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
3742 "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)));
3743 _for_each_inner_peripheral!((@ peri_type #[doc = "SYSTIMER peripheral singleton"]
3744 SYSTIMER <= SYSTIMER() (unstable))); _for_each_inner_peripheral!((@ peri_type
3745 #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
3746 _for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
3747 TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3748 "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)));
3749 _for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
3750 UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
3751 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
3752 "UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
3753 enable_peri_interrupt, disable_peri_interrupt })));
3754 _for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
3755 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
3756 disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
3757 "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)));
3758 _for_each_inner_peripheral!((@ peri_type #[doc = "USB0 peripheral singleton"]
3759 USB0 <= USB0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3760 "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
3761 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
3762 (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3763 "USB_WRAP peripheral singleton"] USB_WRAP <= USB_WRAP() (unstable)));
3764 _for_each_inner_peripheral!((@ peri_type #[doc = "WCL peripheral singleton"] WCL
3765 <= WCL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3766 "XTS_AES peripheral singleton"] XTS_AES <= XTS_AES() (unstable)));
3767 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
3768 DMA_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
3769 = "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual() (unstable)));
3770 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH2 peripheral singleton"]
3771 DMA_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
3772 = "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual() (unstable)));
3773 _for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH4 peripheral singleton"]
3774 DMA_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
3775 = "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)));
3776 _for_each_inner_peripheral!((@ peri_type #[doc = "ADC2 peripheral singleton"]
3777 ADC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3778 "BT peripheral singleton"] BT <= virtual(BT_BB : { bind_bb_interrupt,
3779 enable_bb_interrupt, disable_bb_interrupt }, RWBLE : { bind_rwble_interrupt,
3780 enable_rwble_interrupt, disable_rwble_interrupt }) (unstable)));
3781 _for_each_inner_peripheral!((@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
3782 CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
3783 #[doc = "FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
3784 _for_each_inner_peripheral!((@ peri_type #[doc =
3785 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
3786 _for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
3787 PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
3788 "SW_INTERRUPT peripheral singleton"] SW_INTERRUPT <= virtual() (unstable)));
3789 _for_each_inner_peripheral!((@ peri_type #[doc =
3790 "ULP_RISCV_CORE peripheral singleton"] ULP_RISCV_CORE <= virtual() (unstable)));
3791 _for_each_inner_peripheral!((@ peri_type #[doc = "WIFI peripheral singleton"]
3792 WIFI <= virtual(WIFI_MAC : { bind_mac_interrupt, enable_mac_interrupt,
3793 disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt, enable_pwr_interrupt,
3794 disable_pwr_interrupt }))); _for_each_inner_peripheral!((GPIO0));
3795 _for_each_inner_peripheral!((GPIO1)); _for_each_inner_peripheral!((GPIO2));
3796 _for_each_inner_peripheral!((GPIO3)); _for_each_inner_peripheral!((GPIO4));
3797 _for_each_inner_peripheral!((GPIO5)); _for_each_inner_peripheral!((GPIO6));
3798 _for_each_inner_peripheral!((GPIO7)); _for_each_inner_peripheral!((GPIO8));
3799 _for_each_inner_peripheral!((GPIO9)); _for_each_inner_peripheral!((GPIO10));
3800 _for_each_inner_peripheral!((GPIO11)); _for_each_inner_peripheral!((GPIO12));
3801 _for_each_inner_peripheral!((GPIO13)); _for_each_inner_peripheral!((GPIO14));
3802 _for_each_inner_peripheral!((GPIO15)); _for_each_inner_peripheral!((GPIO16));
3803 _for_each_inner_peripheral!((GPIO17)); _for_each_inner_peripheral!((GPIO18));
3804 _for_each_inner_peripheral!((GPIO19)); _for_each_inner_peripheral!((GPIO20));
3805 _for_each_inner_peripheral!((GPIO21)); _for_each_inner_peripheral!((GPIO26));
3806 _for_each_inner_peripheral!((GPIO27)); _for_each_inner_peripheral!((GPIO28));
3807 _for_each_inner_peripheral!((GPIO29)); _for_each_inner_peripheral!((GPIO30));
3808 _for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
3809 _for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
3810 _for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
3811 _for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
3812 _for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
3813 _for_each_inner_peripheral!((GPIO41)); _for_each_inner_peripheral!((GPIO42));
3814 _for_each_inner_peripheral!((GPIO43)); _for_each_inner_peripheral!((GPIO44));
3815 _for_each_inner_peripheral!((GPIO45)); _for_each_inner_peripheral!((GPIO46));
3816 _for_each_inner_peripheral!((GPIO47)); _for_each_inner_peripheral!((GPIO48));
3817 _for_each_inner_peripheral!((AES(unstable)));
3818 _for_each_inner_peripheral!((APB_CTRL(unstable)));
3819 _for_each_inner_peripheral!((APB_SARADC(unstable)));
3820 _for_each_inner_peripheral!((ASSIST_DEBUG(unstable)));
3821 _for_each_inner_peripheral!((DMA(unstable)));
3822 _for_each_inner_peripheral!((DS(unstable)));
3823 _for_each_inner_peripheral!((EXTMEM(unstable)));
3824 _for_each_inner_peripheral!((GPIO(unstable)));
3825 _for_each_inner_peripheral!((GPIO_SD(unstable)));
3826 _for_each_inner_peripheral!((HMAC(unstable)));
3827 _for_each_inner_peripheral!((I2C_ANA_MST(unstable)));
3828 _for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
3829 _for_each_inner_peripheral!((I2S0(unstable)));
3830 _for_each_inner_peripheral!((I2S1(unstable)));
3831 _for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
3832 _for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
3833 _for_each_inner_peripheral!((IO_MUX(unstable)));
3834 _for_each_inner_peripheral!((LCD_CAM(unstable)));
3835 _for_each_inner_peripheral!((LEDC(unstable)));
3836 _for_each_inner_peripheral!((LPWR(unstable)));
3837 _for_each_inner_peripheral!((MCPWM0(unstable)));
3838 _for_each_inner_peripheral!((MCPWM1(unstable)));
3839 _for_each_inner_peripheral!((PCNT(unstable)));
3840 _for_each_inner_peripheral!((PERI_BACKUP(unstable)));
3841 _for_each_inner_peripheral!((RMT(unstable)));
3842 _for_each_inner_peripheral!((RNG(unstable)));
3843 _for_each_inner_peripheral!((RSA(unstable)));
3844 _for_each_inner_peripheral!((RTC_CNTL(unstable)));
3845 _for_each_inner_peripheral!((RTC_I2C(unstable)));
3846 _for_each_inner_peripheral!((RTC_IO(unstable)));
3847 _for_each_inner_peripheral!((SDHOST(unstable)));
3848 _for_each_inner_peripheral!((SENS(unstable)));
3849 _for_each_inner_peripheral!((SENSITIVE(unstable)));
3850 _for_each_inner_peripheral!((SHA(unstable)));
3851 _for_each_inner_peripheral!((SPI0(unstable)));
3852 _for_each_inner_peripheral!((SPI1(unstable)));
3853 _for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
3854 _for_each_inner_peripheral!((SYSTEM(unstable)));
3855 _for_each_inner_peripheral!((SYSTIMER(unstable)));
3856 _for_each_inner_peripheral!((TIMG0(unstable)));
3857 _for_each_inner_peripheral!((TIMG1(unstable)));
3858 _for_each_inner_peripheral!((TWAI0(unstable)));
3859 _for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
3860 _for_each_inner_peripheral!((UART2));
3861 _for_each_inner_peripheral!((UHCI0(unstable)));
3862 _for_each_inner_peripheral!((USB0(unstable)));
3863 _for_each_inner_peripheral!((USB_DEVICE(unstable)));
3864 _for_each_inner_peripheral!((USB_WRAP(unstable)));
3865 _for_each_inner_peripheral!((WCL(unstable)));
3866 _for_each_inner_peripheral!((XTS_AES(unstable)));
3867 _for_each_inner_peripheral!((DMA_CH0(unstable)));
3868 _for_each_inner_peripheral!((DMA_CH1(unstable)));
3869 _for_each_inner_peripheral!((DMA_CH2(unstable)));
3870 _for_each_inner_peripheral!((DMA_CH3(unstable)));
3871 _for_each_inner_peripheral!((DMA_CH4(unstable)));
3872 _for_each_inner_peripheral!((ADC1(unstable)));
3873 _for_each_inner_peripheral!((ADC2(unstable)));
3874 _for_each_inner_peripheral!((BT(unstable)));
3875 _for_each_inner_peripheral!((CPU_CTRL(unstable)));
3876 _for_each_inner_peripheral!((FLASH(unstable)));
3877 _for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
3878 _for_each_inner_peripheral!((PSRAM(unstable)));
3879 _for_each_inner_peripheral!((SW_INTERRUPT(unstable)));
3880 _for_each_inner_peripheral!((ULP_RISCV_CORE(unstable)));
3881 _for_each_inner_peripheral!((WIFI)); _for_each_inner_peripheral!((SPI2, Spi2,
3882 0)); _for_each_inner_peripheral!((SPI3, Spi3, 1));
3883 _for_each_inner_peripheral!((UHCI0, Uhci0, 2));
3884 _for_each_inner_peripheral!((I2S0, I2s0, 3)); _for_each_inner_peripheral!((I2S1,
3885 I2s1, 4)); _for_each_inner_peripheral!((LCD_CAM, LcdCam, 5));
3886 _for_each_inner_peripheral!((AES, Aes, 6)); _for_each_inner_peripheral!((SHA,
3887 Sha, 7)); _for_each_inner_peripheral!((APB_SARADC, ApbSaradc, 8));
3888 _for_each_inner_peripheral!((RMT, Rmt, 9)); _for_each_inner_peripheral!((all(@
3889 peri_type #[doc = "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""]
3890 #[doc = "<section class=\"warning\">"] #[doc =
3891 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3892 #[doc = "<ul>"] #[doc =
3893 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
3894 = "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()), (@ peri_type #[doc =
3895 "GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
3896 "GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
3897 "GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3898 "<section class=\"warning\">"] #[doc =
3899 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3900 #[doc = "<ul>"] #[doc =
3901 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
3902 = "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()), (@ peri_type #[doc =
3903 "GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
3904 "GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
3905 "GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
3906 "GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
3907 "GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
3908 "GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
3909 "GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
3910 "GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
3911 "GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
3912 "GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
3913 "GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
3914 "GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
3915 "GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
3916 "GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
3917 "GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
3918 "GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3919 "<section class=\"warning\">"] #[doc =
3920 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3921 #[doc = "<ul>"] #[doc =
3922 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
3923 #[doc = "</section>"] GPIO19 <= virtual()), (@ peri_type #[doc =
3924 "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3925 "<section class=\"warning\">"] #[doc =
3926 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3927 #[doc = "<ul>"] #[doc =
3928 "<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
3929 #[doc = "</section>"] GPIO20 <= virtual()), (@ peri_type #[doc =
3930 "GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
3931 "GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3932 "<section class=\"warning\">"] #[doc =
3933 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3934 #[doc = "<ul>"] #[doc =
3935 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3936 "</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
3937 "GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3938 "<section class=\"warning\">"] #[doc =
3939 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3940 #[doc = "<ul>"] #[doc =
3941 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3942 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3943 "</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
3944 "GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3945 "<section class=\"warning\">"] #[doc =
3946 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3947 #[doc = "<ul>"] #[doc =
3948 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3949 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3950 "</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
3951 "GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3952 "<section class=\"warning\">"] #[doc =
3953 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3954 #[doc = "<ul>"] #[doc =
3955 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3956 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3957 "</ul>"] #[doc = "</section>"] GPIO29 <= virtual()), (@ peri_type #[doc =
3958 "GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3959 "<section class=\"warning\">"] #[doc =
3960 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3961 #[doc = "<ul>"] #[doc =
3962 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3963 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3964 "</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
3965 "GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3966 "<section class=\"warning\">"] #[doc =
3967 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3968 #[doc = "<ul>"] #[doc =
3969 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3970 "<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
3971 "</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
3972 "GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3973 "<section class=\"warning\">"] #[doc =
3974 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3975 #[doc = "<ul>"] #[doc =
3976 "<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
3977 "</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
3978 "GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3979 "<section class=\"warning\">"] #[doc =
3980 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3981 #[doc = "<ul>"] #[doc =
3982 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3983 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3984 #[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
3985 "GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3986 "<section class=\"warning\">"] #[doc =
3987 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3988 #[doc = "<ul>"] #[doc =
3989 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3990 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3991 #[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
3992 "GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
3993 "<section class=\"warning\">"] #[doc =
3994 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
3995 #[doc = "<ul>"] #[doc =
3996 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
3997 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
3998 #[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
3999 "GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4000 "<section class=\"warning\">"] #[doc =
4001 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4002 #[doc = "<ul>"] #[doc =
4003 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
4004 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
4005 #[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
4006 "GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4007 "<section class=\"warning\">"] #[doc =
4008 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4009 #[doc = "<ul>"] #[doc =
4010 "<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
4011 = "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
4012 #[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
4013 "GPIO38 peripheral singleton"] GPIO38 <= virtual()), (@ peri_type #[doc =
4014 "GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4015 "<section class=\"warning\">"] #[doc =
4016 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4017 #[doc = "<ul>"] #[doc =
4018 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4019 #[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
4020 "GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4021 "<section class=\"warning\">"] #[doc =
4022 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4023 #[doc = "<ul>"] #[doc =
4024 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4025 #[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
4026 "GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4027 "<section class=\"warning\">"] #[doc =
4028 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4029 #[doc = "<ul>"] #[doc =
4030 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4031 #[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()), (@ peri_type #[doc =
4032 "GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4033 "<section class=\"warning\">"] #[doc =
4034 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4035 #[doc = "<ul>"] #[doc =
4036 "<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
4037 #[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()), (@ peri_type #[doc =
4038 "GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4039 "<section class=\"warning\">"] #[doc =
4040 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4041 #[doc = "<ul>"] #[doc =
4042 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
4043 = "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()), (@ peri_type #[doc =
4044 "GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4045 "<section class=\"warning\">"] #[doc =
4046 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4047 #[doc = "<ul>"] #[doc =
4048 "<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
4049 = "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()), (@ peri_type #[doc =
4050 "GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4051 "<section class=\"warning\">"] #[doc =
4052 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4053 #[doc = "<ul>"] #[doc =
4054 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4055 = "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()), (@ peri_type #[doc =
4056 "GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
4057 "<section class=\"warning\">"] #[doc =
4058 "This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
4059 #[doc = "<ul>"] #[doc =
4060 "<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
4061 = "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()), (@ peri_type #[doc =
4062 "GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
4063 "GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
4064 "AES peripheral singleton"] AES <= AES(AES : { bind_peri_interrupt,
4065 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
4066 = "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)), (@
4067 peri_type #[doc = "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC()
4068 (unstable)), (@ peri_type #[doc = "ASSIST_DEBUG peripheral singleton"]
4069 ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)), (@ peri_type #[doc =
4070 "DMA peripheral singleton"] DMA <= DMA() (unstable)), (@ peri_type #[doc =
4071 "DS peripheral singleton"] DS <= DS() (unstable)), (@ peri_type #[doc =
4072 "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@ peri_type #[doc =
4073 "EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)), (@ peri_type #[doc
4074 = "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)), (@ peri_type #[doc =
4075 "GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)), (@ peri_type
4076 #[doc = "HMAC peripheral singleton"] HMAC <= HMAC() (unstable)), (@ peri_type
4077 #[doc = "I2C_ANA_MST peripheral singleton"] I2C_ANA_MST <= I2C_ANA_MST()
4078 (unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"] I2C0 <=
4079 I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
4080 disable_peri_interrupt })), (@ peri_type #[doc = "I2C1 peripheral singleton"]
4081 I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
4082 disable_peri_interrupt })), (@ peri_type #[doc = "I2S0 peripheral singleton"]
4083 I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
4084 disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
4085 "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
4086 enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
4087 = "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
4088 (unstable)), (@ peri_type #[doc = "INTERRUPT_CORE1 peripheral singleton"]
4089 INTERRUPT_CORE1 <= INTERRUPT_CORE1() (unstable)), (@ peri_type #[doc =
4090 "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type #[doc
4091 = "LCD_CAM peripheral singleton"] LCD_CAM <= LCD_CAM() (unstable)), (@ peri_type
4092 #[doc = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)), (@ peri_type
4093 #[doc = "LPWR peripheral singleton"] LPWR <= RTC_CNTL() (unstable)), (@ peri_type
4094 #[doc = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)), (@
4095 peri_type #[doc = "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1() (unstable)),
4096 (@ peri_type #[doc = "PCNT peripheral singleton"] PCNT <= PCNT() (unstable)), (@
4097 peri_type #[doc = "PERI_BACKUP peripheral singleton"] PERI_BACKUP <=
4098 PERI_BACKUP() (unstable)), (@ peri_type #[doc = "RMT peripheral singleton"] RMT
4099 <= RMT() (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <=
4100 RNG() (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <=
4101 RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
4102 (unstable)), (@ peri_type #[doc = "RTC_CNTL peripheral singleton"] RTC_CNTL <=
4103 RTC_CNTL() (unstable)), (@ peri_type #[doc = "RTC_I2C peripheral singleton"]
4104 RTC_I2C <= RTC_I2C() (unstable)), (@ peri_type #[doc =
4105 "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)), (@ peri_type #[doc
4106 = "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)), (@ peri_type
4107 #[doc = "SENS peripheral singleton"] SENS <= SENS() (unstable)), (@ peri_type
4108 #[doc = "SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)),
4109 (@ peri_type #[doc = "SHA peripheral singleton"] SHA <= SHA(SHA : {
4110 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
4111 (unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0()
4112 (unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1()
4113 (unstable)), (@ peri_type #[doc = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2
4114 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
4115 peri_type #[doc = "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : {
4116 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
4117 peri_type #[doc = "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)),
4118 (@ peri_type #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER()
4119 (unstable)), (@ peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0()
4120 (unstable)), (@ peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1()
4121 (unstable)), (@ peri_type #[doc = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0()
4122 (unstable)), (@ peri_type #[doc = "UART0 peripheral singleton"] UART0 <=
4123 UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
4124 disable_peri_interrupt })), (@ peri_type #[doc = "UART1 peripheral singleton"]
4125 UART1 <= UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
4126 disable_peri_interrupt })), (@ peri_type #[doc = "UART2 peripheral singleton"]
4127 UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
4128 disable_peri_interrupt })), (@ peri_type #[doc = "UHCI0 peripheral singleton"]
4129 UHCI0 <= UHCI0() (unstable)), (@ peri_type #[doc = "USB0 peripheral singleton"]
4130 USB0 <= USB0() (unstable)), (@ peri_type #[doc =
4131 "USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
4132 bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
4133 (unstable)), (@ peri_type #[doc = "USB_WRAP peripheral singleton"] USB_WRAP <=
4134 USB_WRAP() (unstable)), (@ peri_type #[doc = "WCL peripheral singleton"] WCL <=
4135 WCL() (unstable)), (@ peri_type #[doc = "XTS_AES peripheral singleton"] XTS_AES
4136 <= XTS_AES() (unstable)), (@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
4137 DMA_CH0 <= virtual() (unstable)), (@ peri_type #[doc =
4138 "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual() (unstable)), (@ peri_type
4139 #[doc = "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual() (unstable)), (@
4140 peri_type #[doc = "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual()
4141 (unstable)), (@ peri_type #[doc = "DMA_CH4 peripheral singleton"] DMA_CH4 <=
4142 virtual() (unstable)), (@ peri_type #[doc = "ADC1 peripheral singleton"] ADC1 <=
4143 virtual() (unstable)), (@ peri_type #[doc = "ADC2 peripheral singleton"] ADC2 <=
4144 virtual() (unstable)), (@ peri_type #[doc = "BT peripheral singleton"] BT <=
4145 virtual(BT_BB : { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt },
4146 RWBLE : { bind_rwble_interrupt, enable_rwble_interrupt, disable_rwble_interrupt
4147 }) (unstable)), (@ peri_type #[doc = "CPU_CTRL peripheral singleton"] CPU_CTRL <=
4148 virtual() (unstable)), (@ peri_type #[doc = "FLASH peripheral singleton"] FLASH
4149 <= virtual() (unstable)), (@ peri_type #[doc =
4150 "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
4151 (@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
4152 (unstable)), (@ peri_type #[doc = "SW_INTERRUPT peripheral singleton"]
4153 SW_INTERRUPT <= virtual() (unstable)), (@ peri_type #[doc =
4154 "ULP_RISCV_CORE peripheral singleton"] ULP_RISCV_CORE <= virtual() (unstable)),
4155 (@ peri_type #[doc = "WIFI peripheral singleton"] WIFI <= virtual(WIFI_MAC : {
4156 bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt }, WIFI_PWR : {
4157 bind_pwr_interrupt, enable_pwr_interrupt, disable_pwr_interrupt }))));
4158 _for_each_inner_peripheral!((singletons(GPIO0), (GPIO1), (GPIO2), (GPIO3),
4159 (GPIO4), (GPIO5), (GPIO6), (GPIO7), (GPIO8), (GPIO9), (GPIO10), (GPIO11),
4160 (GPIO12), (GPIO13), (GPIO14), (GPIO15), (GPIO16), (GPIO17), (GPIO18), (GPIO19),
4161 (GPIO20), (GPIO21), (GPIO26), (GPIO27), (GPIO28), (GPIO29), (GPIO30), (GPIO31),
4162 (GPIO32), (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39),
4163 (GPIO40), (GPIO41), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47),
4164 (GPIO48), (AES(unstable)), (APB_CTRL(unstable)), (APB_SARADC(unstable)),
4165 (ASSIST_DEBUG(unstable)), (DMA(unstable)), (DS(unstable)), (EXTMEM(unstable)),
4166 (GPIO(unstable)), (GPIO_SD(unstable)), (HMAC(unstable)), (I2C_ANA_MST(unstable)),
4167 (I2C0), (I2C1), (I2S0(unstable)), (I2S1(unstable)), (INTERRUPT_CORE0(unstable)),
4168 (INTERRUPT_CORE1(unstable)), (IO_MUX(unstable)), (LCD_CAM(unstable)),
4169 (LEDC(unstable)), (LPWR(unstable)), (MCPWM0(unstable)), (MCPWM1(unstable)),
4170 (PCNT(unstable)), (PERI_BACKUP(unstable)), (RMT(unstable)), (RNG(unstable)),
4171 (RSA(unstable)), (RTC_CNTL(unstable)), (RTC_I2C(unstable)), (RTC_IO(unstable)),
4172 (SDHOST(unstable)), (SENS(unstable)), (SENSITIVE(unstable)), (SHA(unstable)),
4173 (SPI0(unstable)), (SPI1(unstable)), (SPI2), (SPI3), (SYSTEM(unstable)),
4174 (SYSTIMER(unstable)), (TIMG0(unstable)), (TIMG1(unstable)), (TWAI0(unstable)),
4175 (UART0), (UART1), (UART2), (UHCI0(unstable)), (USB0(unstable)),
4176 (USB_DEVICE(unstable)), (USB_WRAP(unstable)), (WCL(unstable)),
4177 (XTS_AES(unstable)), (DMA_CH0(unstable)), (DMA_CH1(unstable)),
4178 (DMA_CH2(unstable)), (DMA_CH3(unstable)), (DMA_CH4(unstable)), (ADC1(unstable)),
4179 (ADC2(unstable)), (BT(unstable)), (CPU_CTRL(unstable)), (FLASH(unstable)),
4180 (GPIO_DEDICATED(unstable)), (PSRAM(unstable)), (SW_INTERRUPT(unstable)),
4181 (ULP_RISCV_CORE(unstable)), (WIFI)));
4182 _for_each_inner_peripheral!((dma_eligible(SPI2, Spi2, 0), (SPI3, Spi3, 1),
4183 (UHCI0, Uhci0, 2), (I2S0, I2s0, 3), (I2S1, I2s1, 4), (LCD_CAM, LcdCam, 5), (AES,
4184 Aes, 6), (SHA, Sha, 7), (APB_SARADC, ApbSaradc, 8), (RMT, Rmt, 9)));
4185 };
4186}
4187#[macro_export]
4214#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4215macro_rules! for_each_gpio {
4216 ($($pattern:tt => $code:tt;)*) => {
4217 macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
4218 } _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
4219 _for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
4220 _for_each_inner_gpio!((2, GPIO2() () ([Input] [Output])));
4221 _for_each_inner_gpio!((3, GPIO3() () ([Input] [Output])));
4222 _for_each_inner_gpio!((4, GPIO4() () ([Input] [Output])));
4223 _for_each_inner_gpio!((5, GPIO5() () ([Input] [Output])));
4224 _for_each_inner_gpio!((6, GPIO6() () ([Input] [Output])));
4225 _for_each_inner_gpio!((7, GPIO7() () ([Input] [Output])));
4226 _for_each_inner_gpio!((8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])));
4227 _for_each_inner_gpio!((9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4
4228 => FSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((10, GPIO10(_2 => FSPIIO4
4229 _4 => FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input]
4230 [Output]))); _for_each_inner_gpio!((11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 =>
4231 FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output])));
4232 _for_each_inner_gpio!((12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
4233 => SUBSPICLK _4 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((13,
4234 GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4
4235 => FSPIQ) ([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14(_3 => SUBSPIWP
4236 _4 => FSPIWP) (_2 => FSPIDQS _3 => SUBSPIWP _4 => FSPIWP) ([Input] [Output])));
4237 _for_each_inner_gpio!((15, GPIO15() (_2 => U0RTS) ([Input] [Output])));
4238 _for_each_inner_gpio!((16, GPIO16(_2 => U0CTS) () ([Input] [Output])));
4239 _for_each_inner_gpio!((17, GPIO17() (_2 => U1TXD) ([Input] [Output])));
4240 _for_each_inner_gpio!((18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
4241 [Output]))); _for_each_inner_gpio!((19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2)
4242 ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20(_2 => U1CTS) (_3 =>
4243 CLK_OUT1) ([Input] [Output]))); _for_each_inner_gpio!((21, GPIO21() () ([Input]
4244 [Output]))); _for_each_inner_gpio!((26, GPIO26() (_0 => SPICS1) ([Input]
4245 [Output]))); _for_each_inner_gpio!((27, GPIO27(_0 => SPIHD) (_0 => SPIHD)
4246 ([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0 => SPIWP) (_0 =>
4247 SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((29, GPIO29() (_0 => SPICS0)
4248 ([Input] [Output]))); _for_each_inner_gpio!((30, GPIO30() (_0 => SPICLK) ([Input]
4249 [Output]))); _for_each_inner_gpio!((31, GPIO31(_0 => SPIQ) (_0 => SPIQ) ([Input]
4250 [Output]))); _for_each_inner_gpio!((32, GPIO32(_0 => SPID) (_0 => SPID) ([Input]
4251 [Output]))); _for_each_inner_gpio!((33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 =>
4252 SPIIO4) (_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])));
4253 _for_each_inner_gpio!((34, GPIO34(_2 => FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3
4254 => SUBSPICS0 _4 => SPIIO5) ([Input] [Output]))); _for_each_inner_gpio!((35,
4255 GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3 => SUBSPID _4 =>
4256 SPIIO6) ([Input] [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => FSPICLK _4
4257 => SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])));
4258 _for_each_inner_gpio!((37, GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 =>
4259 FSPIQ _3 => SUBSPIQ _4 => SPIDQS) ([Input] [Output])));
4260 _for_each_inner_gpio!((38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 => FSPIWP _3
4261 => SUBSPIWP) ([Input] [Output]))); _for_each_inner_gpio!((39, GPIO39(_0 => MTCK)
4262 (_2 => CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output]))); _for_each_inner_gpio!((40,
4263 GPIO40() (_0 => MTDO _2 => CLK_OUT2) ([Input] [Output])));
4264 _for_each_inner_gpio!((41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
4265 [Output]))); _for_each_inner_gpio!((42, GPIO42(_0 => MTMS) () ([Input]
4266 [Output]))); _for_each_inner_gpio!((43, GPIO43() (_0 => U0TXD _2 => CLK_OUT1)
4267 ([Input] [Output]))); _for_each_inner_gpio!((44, GPIO44(_0 => U0RXD) (_2 =>
4268 CLK_OUT2) ([Input] [Output]))); _for_each_inner_gpio!((45, GPIO45() () ([Input]
4269 [Output]))); _for_each_inner_gpio!((46, GPIO46() () ([Input] [Output])));
4270 _for_each_inner_gpio!((47, GPIO47() (_0 => SPICLK_P_DIFF _2 => SUBSPICLK_P_DIFF)
4271 ([Input] [Output]))); _for_each_inner_gpio!((48, GPIO48() (_0 => SPICLK_N_DIFF _2
4272 => SUBSPICLK_N_DIFF) ([Input] [Output]))); _for_each_inner_gpio!((all(0, GPIO0()
4273 () ([Input] [Output])), (1, GPIO1() () ([Input] [Output])), (2, GPIO2() ()
4274 ([Input] [Output])), (3, GPIO3() () ([Input] [Output])), (4, GPIO4() () ([Input]
4275 [Output])), (5, GPIO5() () ([Input] [Output])), (6, GPIO6() () ([Input]
4276 [Output])), (7, GPIO7() () ([Input] [Output])), (8, GPIO8() (_3 => SUBSPICS1)
4277 ([Input] [Output])), (9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4 =>
4278 FSPIHD) ([Input] [Output])), (10, GPIO10(_2 => FSPIIO4 _4 => FSPICS0) (_2 =>
4279 FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input] [Output])), (11, GPIO11(_2 =>
4280 FSPIIO5 _3 => SUBSPID _4 => FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID)
4281 ([Input] [Output])), (12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
4282 => SUBSPICLK _4 => FSPICLK) ([Input] [Output])), (13, GPIO13(_2 => FSPIIO7 _3 =>
4283 SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) ([Input]
4284 [Output])), (14, GPIO14(_3 => SUBSPIWP _4 => FSPIWP) (_2 => FSPIDQS _3 =>
4285 SUBSPIWP _4 => FSPIWP) ([Input] [Output])), (15, GPIO15() (_2 => U0RTS) ([Input]
4286 [Output])), (16, GPIO16(_2 => U0CTS) () ([Input] [Output])), (17, GPIO17() (_2 =>
4287 U1TXD) ([Input] [Output])), (18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
4288 [Output])), (19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2) ([Input] [Output])), (20,
4289 GPIO20(_2 => U1CTS) (_3 => CLK_OUT1) ([Input] [Output])), (21, GPIO21() ()
4290 ([Input] [Output])), (26, GPIO26() (_0 => SPICS1) ([Input] [Output])), (27,
4291 GPIO27(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])), (28, GPIO28(_0 => SPIWP)
4292 (_0 => SPIWP) ([Input] [Output])), (29, GPIO29() (_0 => SPICS0) ([Input]
4293 [Output])), (30, GPIO30() (_0 => SPICLK) ([Input] [Output])), (31, GPIO31(_0 =>
4294 SPIQ) (_0 => SPIQ) ([Input] [Output])), (32, GPIO32(_0 => SPID) (_0 => SPID)
4295 ([Input] [Output])), (33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) (_2 =>
4296 FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])), (34, GPIO34(_2 =>
4297 FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3 => SUBSPICS0 _4 => SPIIO5) ([Input]
4298 [Output])), (35, GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3
4299 => SUBSPID _4 => SPIIO6) ([Input] [Output])), (36, GPIO36(_2 => FSPICLK _4 =>
4300 SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])), (37,
4301 GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 =>
4302 SPIDQS) ([Input] [Output])), (38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 =>
4303 FSPIWP _3 => SUBSPIWP) ([Input] [Output])), (39, GPIO39(_0 => MTCK) (_2 =>
4304 CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output])), (40, GPIO40() (_0 => MTDO _2 =>
4305 CLK_OUT2) ([Input] [Output])), (41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
4306 [Output])), (42, GPIO42(_0 => MTMS) () ([Input] [Output])), (43, GPIO43() (_0 =>
4307 U0TXD _2 => CLK_OUT1) ([Input] [Output])), (44, GPIO44(_0 => U0RXD) (_2 =>
4308 CLK_OUT2) ([Input] [Output])), (45, GPIO45() () ([Input] [Output])), (46,
4309 GPIO46() () ([Input] [Output])), (47, GPIO47() (_0 => SPICLK_P_DIFF _2 =>
4310 SUBSPICLK_P_DIFF) ([Input] [Output])), (48, GPIO48() (_0 => SPICLK_N_DIFF _2 =>
4311 SUBSPICLK_N_DIFF) ([Input] [Output]))));
4312 };
4313}
4314#[macro_export]
4341#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4342macro_rules! for_each_analog_function {
4343 ($($pattern:tt => $code:tt;)*) => {
4344 macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
4345 tt) => {} } _for_each_inner_analog_function!((TOUCH1, GPIO1));
4346 _for_each_inner_analog_function!((ADC1_CH0, GPIO1));
4347 _for_each_inner_analog_function!((TOUCH2, GPIO2));
4348 _for_each_inner_analog_function!((ADC1_CH1, GPIO2));
4349 _for_each_inner_analog_function!((TOUCH3, GPIO3));
4350 _for_each_inner_analog_function!((ADC1_CH2, GPIO3));
4351 _for_each_inner_analog_function!((TOUCH4, GPIO4));
4352 _for_each_inner_analog_function!((ADC1_CH3, GPIO4));
4353 _for_each_inner_analog_function!((TOUCH5, GPIO5));
4354 _for_each_inner_analog_function!((ADC1_CH4, GPIO5));
4355 _for_each_inner_analog_function!((TOUCH6, GPIO6));
4356 _for_each_inner_analog_function!((ADC1_CH5, GPIO6));
4357 _for_each_inner_analog_function!((TOUCH7, GPIO7));
4358 _for_each_inner_analog_function!((ADC1_CH6, GPIO7));
4359 _for_each_inner_analog_function!((TOUCH8, GPIO8));
4360 _for_each_inner_analog_function!((ADC1_CH7, GPIO8));
4361 _for_each_inner_analog_function!((TOUCH9, GPIO9));
4362 _for_each_inner_analog_function!((ADC1_CH8, GPIO9));
4363 _for_each_inner_analog_function!((TOUCH10, GPIO10));
4364 _for_each_inner_analog_function!((ADC1_CH9, GPIO10));
4365 _for_each_inner_analog_function!((TOUCH11, GPIO11));
4366 _for_each_inner_analog_function!((ADC2_CH0, GPIO11));
4367 _for_each_inner_analog_function!((TOUCH12, GPIO12));
4368 _for_each_inner_analog_function!((ADC2_CH1, GPIO12));
4369 _for_each_inner_analog_function!((TOUCH13, GPIO13));
4370 _for_each_inner_analog_function!((ADC2_CH2, GPIO13));
4371 _for_each_inner_analog_function!((TOUCH14, GPIO14));
4372 _for_each_inner_analog_function!((ADC2_CH3, GPIO14));
4373 _for_each_inner_analog_function!((XTAL_32K_P, GPIO15));
4374 _for_each_inner_analog_function!((ADC2_CH4, GPIO15));
4375 _for_each_inner_analog_function!((XTAL_32K_N, GPIO16));
4376 _for_each_inner_analog_function!((ADC2_CH5, GPIO16));
4377 _for_each_inner_analog_function!((ADC2_CH6, GPIO17));
4378 _for_each_inner_analog_function!((ADC2_CH7, GPIO18));
4379 _for_each_inner_analog_function!((USB_DM, GPIO19));
4380 _for_each_inner_analog_function!((ADC2_CH8, GPIO19));
4381 _for_each_inner_analog_function!((USB_DP, GPIO20));
4382 _for_each_inner_analog_function!((ADC2_CH9, GPIO20));
4383 _for_each_inner_analog_function!(((TOUCH1, TOUCHn, 1), GPIO1));
4384 _for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1));
4385 _for_each_inner_analog_function!(((TOUCH2, TOUCHn, 2), GPIO2));
4386 _for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2));
4387 _for_each_inner_analog_function!(((TOUCH3, TOUCHn, 3), GPIO3));
4388 _for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3));
4389 _for_each_inner_analog_function!(((TOUCH4, TOUCHn, 4), GPIO4));
4390 _for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4));
4391 _for_each_inner_analog_function!(((TOUCH5, TOUCHn, 5), GPIO5));
4392 _for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5));
4393 _for_each_inner_analog_function!(((TOUCH6, TOUCHn, 6), GPIO6));
4394 _for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6));
4395 _for_each_inner_analog_function!(((TOUCH7, TOUCHn, 7), GPIO7));
4396 _for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7));
4397 _for_each_inner_analog_function!(((TOUCH8, TOUCHn, 8), GPIO8));
4398 _for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8));
4399 _for_each_inner_analog_function!(((TOUCH9, TOUCHn, 9), GPIO9));
4400 _for_each_inner_analog_function!(((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9));
4401 _for_each_inner_analog_function!(((TOUCH10, TOUCHn, 10), GPIO10));
4402 _for_each_inner_analog_function!(((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10));
4403 _for_each_inner_analog_function!(((TOUCH11, TOUCHn, 11), GPIO11));
4404 _for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11));
4405 _for_each_inner_analog_function!(((TOUCH12, TOUCHn, 12), GPIO12));
4406 _for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12));
4407 _for_each_inner_analog_function!(((TOUCH13, TOUCHn, 13), GPIO13));
4408 _for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13));
4409 _for_each_inner_analog_function!(((TOUCH14, TOUCHn, 14), GPIO14));
4410 _for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14));
4411 _for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15));
4412 _for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16));
4413 _for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17));
4414 _for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18));
4415 _for_each_inner_analog_function!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19));
4416 _for_each_inner_analog_function!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20));
4417 _for_each_inner_analog_function!((all(TOUCH1, GPIO1), (ADC1_CH0, GPIO1), (TOUCH2,
4418 GPIO2), (ADC1_CH1, GPIO2), (TOUCH3, GPIO3), (ADC1_CH2, GPIO3), (TOUCH4, GPIO4),
4419 (ADC1_CH3, GPIO4), (TOUCH5, GPIO5), (ADC1_CH4, GPIO5), (TOUCH6, GPIO6),
4420 (ADC1_CH5, GPIO6), (TOUCH7, GPIO7), (ADC1_CH6, GPIO7), (TOUCH8, GPIO8),
4421 (ADC1_CH7, GPIO8), (TOUCH9, GPIO9), (ADC1_CH8, GPIO9), (TOUCH10, GPIO10),
4422 (ADC1_CH9, GPIO10), (TOUCH11, GPIO11), (ADC2_CH0, GPIO11), (TOUCH12, GPIO12),
4423 (ADC2_CH1, GPIO12), (TOUCH13, GPIO13), (ADC2_CH2, GPIO13), (TOUCH14, GPIO14),
4424 (ADC2_CH3, GPIO14), (XTAL_32K_P, GPIO15), (ADC2_CH4, GPIO15), (XTAL_32K_N,
4425 GPIO16), (ADC2_CH5, GPIO16), (ADC2_CH6, GPIO17), (ADC2_CH7, GPIO18), (USB_DM,
4426 GPIO19), (ADC2_CH8, GPIO19), (USB_DP, GPIO20), (ADC2_CH9, GPIO20)));
4427 _for_each_inner_analog_function!((all_expanded((TOUCH1, TOUCHn, 1), GPIO1),
4428 ((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1), ((TOUCH2, TOUCHn, 2), GPIO2), ((ADC1_CH1,
4429 ADCn_CHm, 1, 1), GPIO2), ((TOUCH3, TOUCHn, 3), GPIO3), ((ADC1_CH2, ADCn_CHm, 1,
4430 2), GPIO3), ((TOUCH4, TOUCHn, 4), GPIO4), ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4),
4431 ((TOUCH5, TOUCHn, 5), GPIO5), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5), ((TOUCH6,
4432 TOUCHn, 6), GPIO6), ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6), ((TOUCH7, TOUCHn, 7),
4433 GPIO7), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7), ((TOUCH8, TOUCHn, 8), GPIO8),
4434 ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8), ((TOUCH9, TOUCHn, 9), GPIO9), ((ADC1_CH8,
4435 ADCn_CHm, 1, 8), GPIO9), ((TOUCH10, TOUCHn, 10), GPIO10), ((ADC1_CH9, ADCn_CHm,
4436 1, 9), GPIO10), ((TOUCH11, TOUCHn, 11), GPIO11), ((ADC2_CH0, ADCn_CHm, 2, 0),
4437 GPIO11), ((TOUCH12, TOUCHn, 12), GPIO12), ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12),
4438 ((TOUCH13, TOUCHn, 13), GPIO13), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13), ((TOUCH14,
4439 TOUCHn, 14), GPIO14), ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14), ((ADC2_CH4, ADCn_CHm,
4440 2, 4), GPIO15), ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16), ((ADC2_CH6, ADCn_CHm, 2,
4441 6), GPIO17), ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18), ((ADC2_CH8, ADCn_CHm, 2, 8),
4442 GPIO19), ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20)));
4443 };
4444}
4445#[macro_export]
4472#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4473macro_rules! for_each_lp_function {
4474 ($($pattern:tt => $code:tt;)*) => {
4475 macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
4476 => {} } _for_each_inner_lp_function!((RTC_GPIO0, GPIO0));
4477 _for_each_inner_lp_function!((SAR_I2C_SCL_0, GPIO0));
4478 _for_each_inner_lp_function!((RTC_GPIO1, GPIO1));
4479 _for_each_inner_lp_function!((SAR_I2C_SDA_0, GPIO1));
4480 _for_each_inner_lp_function!((RTC_GPIO2, GPIO2));
4481 _for_each_inner_lp_function!((SAR_I2C_SCL_1, GPIO2));
4482 _for_each_inner_lp_function!((RTC_GPIO3, GPIO3));
4483 _for_each_inner_lp_function!((SAR_I2C_SDA_1, GPIO3));
4484 _for_each_inner_lp_function!((RTC_GPIO4, GPIO4));
4485 _for_each_inner_lp_function!((RTC_GPIO5, GPIO5));
4486 _for_each_inner_lp_function!((RTC_GPIO6, GPIO6));
4487 _for_each_inner_lp_function!((RTC_GPIO7, GPIO7));
4488 _for_each_inner_lp_function!((RTC_GPIO8, GPIO8));
4489 _for_each_inner_lp_function!((RTC_GPIO9, GPIO9));
4490 _for_each_inner_lp_function!((RTC_GPIO10, GPIO10));
4491 _for_each_inner_lp_function!((RTC_GPIO11, GPIO11));
4492 _for_each_inner_lp_function!((RTC_GPIO12, GPIO12));
4493 _for_each_inner_lp_function!((RTC_GPIO13, GPIO13));
4494 _for_each_inner_lp_function!((RTC_GPIO14, GPIO14));
4495 _for_each_inner_lp_function!((RTC_GPIO15, GPIO15));
4496 _for_each_inner_lp_function!((RTC_GPIO16, GPIO16));
4497 _for_each_inner_lp_function!((RTC_GPIO17, GPIO17));
4498 _for_each_inner_lp_function!((RTC_GPIO18, GPIO18));
4499 _for_each_inner_lp_function!((RTC_GPIO19, GPIO19));
4500 _for_each_inner_lp_function!((RTC_GPIO20, GPIO20));
4501 _for_each_inner_lp_function!((RTC_GPIO21, GPIO21));
4502 _for_each_inner_lp_function!(((RTC_GPIO0, RTC_GPIOn, 0), GPIO0));
4503 _for_each_inner_lp_function!(((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0), GPIO0));
4504 _for_each_inner_lp_function!(((RTC_GPIO1, RTC_GPIOn, 1), GPIO1));
4505 _for_each_inner_lp_function!(((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0), GPIO1));
4506 _for_each_inner_lp_function!(((RTC_GPIO2, RTC_GPIOn, 2), GPIO2));
4507 _for_each_inner_lp_function!(((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2));
4508 _for_each_inner_lp_function!(((RTC_GPIO3, RTC_GPIOn, 3), GPIO3));
4509 _for_each_inner_lp_function!(((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1), GPIO3));
4510 _for_each_inner_lp_function!(((RTC_GPIO4, RTC_GPIOn, 4), GPIO4));
4511 _for_each_inner_lp_function!(((RTC_GPIO5, RTC_GPIOn, 5), GPIO5));
4512 _for_each_inner_lp_function!(((RTC_GPIO6, RTC_GPIOn, 6), GPIO6));
4513 _for_each_inner_lp_function!(((RTC_GPIO7, RTC_GPIOn, 7), GPIO7));
4514 _for_each_inner_lp_function!(((RTC_GPIO8, RTC_GPIOn, 8), GPIO8));
4515 _for_each_inner_lp_function!(((RTC_GPIO9, RTC_GPIOn, 9), GPIO9));
4516 _for_each_inner_lp_function!(((RTC_GPIO10, RTC_GPIOn, 10), GPIO10));
4517 _for_each_inner_lp_function!(((RTC_GPIO11, RTC_GPIOn, 11), GPIO11));
4518 _for_each_inner_lp_function!(((RTC_GPIO12, RTC_GPIOn, 12), GPIO12));
4519 _for_each_inner_lp_function!(((RTC_GPIO13, RTC_GPIOn, 13), GPIO13));
4520 _for_each_inner_lp_function!(((RTC_GPIO14, RTC_GPIOn, 14), GPIO14));
4521 _for_each_inner_lp_function!(((RTC_GPIO15, RTC_GPIOn, 15), GPIO15));
4522 _for_each_inner_lp_function!(((RTC_GPIO16, RTC_GPIOn, 16), GPIO16));
4523 _for_each_inner_lp_function!(((RTC_GPIO17, RTC_GPIOn, 17), GPIO17));
4524 _for_each_inner_lp_function!(((RTC_GPIO18, RTC_GPIOn, 18), GPIO18));
4525 _for_each_inner_lp_function!(((RTC_GPIO19, RTC_GPIOn, 19), GPIO19));
4526 _for_each_inner_lp_function!(((RTC_GPIO20, RTC_GPIOn, 20), GPIO20));
4527 _for_each_inner_lp_function!(((RTC_GPIO21, RTC_GPIOn, 21), GPIO21));
4528 _for_each_inner_lp_function!((all(RTC_GPIO0, GPIO0), (SAR_I2C_SCL_0, GPIO0),
4529 (RTC_GPIO1, GPIO1), (SAR_I2C_SDA_0, GPIO1), (RTC_GPIO2, GPIO2), (SAR_I2C_SCL_1,
4530 GPIO2), (RTC_GPIO3, GPIO3), (SAR_I2C_SDA_1, GPIO3), (RTC_GPIO4, GPIO4),
4531 (RTC_GPIO5, GPIO5), (RTC_GPIO6, GPIO6), (RTC_GPIO7, GPIO7), (RTC_GPIO8, GPIO8),
4532 (RTC_GPIO9, GPIO9), (RTC_GPIO10, GPIO10), (RTC_GPIO11, GPIO11), (RTC_GPIO12,
4533 GPIO12), (RTC_GPIO13, GPIO13), (RTC_GPIO14, GPIO14), (RTC_GPIO15, GPIO15),
4534 (RTC_GPIO16, GPIO16), (RTC_GPIO17, GPIO17), (RTC_GPIO18, GPIO18), (RTC_GPIO19,
4535 GPIO19), (RTC_GPIO20, GPIO20), (RTC_GPIO21, GPIO21)));
4536 _for_each_inner_lp_function!((all_expanded((RTC_GPIO0, RTC_GPIOn, 0), GPIO0),
4537 ((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0), GPIO0), ((RTC_GPIO1, RTC_GPIOn, 1), GPIO1),
4538 ((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0), GPIO1), ((RTC_GPIO2, RTC_GPIOn, 2), GPIO2),
4539 ((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2), ((RTC_GPIO3, RTC_GPIOn, 3), GPIO3),
4540 ((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1), GPIO3), ((RTC_GPIO4, RTC_GPIOn, 4), GPIO4),
4541 ((RTC_GPIO5, RTC_GPIOn, 5), GPIO5), ((RTC_GPIO6, RTC_GPIOn, 6), GPIO6),
4542 ((RTC_GPIO7, RTC_GPIOn, 7), GPIO7), ((RTC_GPIO8, RTC_GPIOn, 8), GPIO8),
4543 ((RTC_GPIO9, RTC_GPIOn, 9), GPIO9), ((RTC_GPIO10, RTC_GPIOn, 10), GPIO10),
4544 ((RTC_GPIO11, RTC_GPIOn, 11), GPIO11), ((RTC_GPIO12, RTC_GPIOn, 12), GPIO12),
4545 ((RTC_GPIO13, RTC_GPIOn, 13), GPIO13), ((RTC_GPIO14, RTC_GPIOn, 14), GPIO14),
4546 ((RTC_GPIO15, RTC_GPIOn, 15), GPIO15), ((RTC_GPIO16, RTC_GPIOn, 16), GPIO16),
4547 ((RTC_GPIO17, RTC_GPIOn, 17), GPIO17), ((RTC_GPIO18, RTC_GPIOn, 18), GPIO18),
4548 ((RTC_GPIO19, RTC_GPIOn, 19), GPIO19), ((RTC_GPIO20, RTC_GPIOn, 20), GPIO20),
4549 ((RTC_GPIO21, RTC_GPIOn, 21), GPIO21)));
4550 };
4551}
4552#[macro_export]
4556#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4557macro_rules! define_io_mux_signals {
4558 () => {
4559 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
4560 #[derive(Debug, PartialEq, Copy, Clone)]
4561 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4562 #[doc(hidden)]
4563 pub enum InputSignal {
4564 SPIQ = 0,
4565 SPID = 1,
4566 SPIHD = 2,
4567 SPIWP = 3,
4568 SPID4 = 7,
4569 SPID5 = 8,
4570 SPID6 = 9,
4571 SPID7 = 10,
4572 SPIDQS = 11,
4573 U0RXD = 12,
4574 U0CTS = 13,
4575 U0DSR = 14,
4576 U1RXD = 15,
4577 U1CTS = 16,
4578 U1DSR = 17,
4579 U2RXD = 18,
4580 U2CTS = 19,
4581 U2DSR = 20,
4582 I2S1_MCLK = 21,
4583 I2S0O_BCK = 22,
4584 I2S0_MCLK = 23,
4585 I2S0O_WS = 24,
4586 I2S0I_SD = 25,
4587 I2S0I_BCK = 26,
4588 I2S0I_WS = 27,
4589 I2S1O_BCK = 28,
4590 I2S1O_WS = 29,
4591 I2S1I_SD = 30,
4592 I2S1I_BCK = 31,
4593 I2S1I_WS = 32,
4594 PCNT0_SIG_CH0 = 33,
4595 PCNT0_SIG_CH1 = 34,
4596 PCNT0_CTRL_CH0 = 35,
4597 PCNT0_CTRL_CH1 = 36,
4598 PCNT1_SIG_CH0 = 37,
4599 PCNT1_SIG_CH1 = 38,
4600 PCNT1_CTRL_CH0 = 39,
4601 PCNT1_CTRL_CH1 = 40,
4602 PCNT2_SIG_CH0 = 41,
4603 PCNT2_SIG_CH1 = 42,
4604 PCNT2_CTRL_CH0 = 43,
4605 PCNT2_CTRL_CH1 = 44,
4606 PCNT3_SIG_CH0 = 45,
4607 PCNT3_SIG_CH1 = 46,
4608 PCNT3_CTRL_CH0 = 47,
4609 PCNT3_CTRL_CH1 = 48,
4610 I2S0I_SD1 = 51,
4611 I2S0I_SD2 = 52,
4612 I2S0I_SD3 = 53,
4613 CORE1_GPIO7 = 54,
4614 USB_EXTPHY_VP = 55,
4615 USB_EXTPHY_VM = 56,
4616 USB_EXTPHY_RCV = 57,
4617 USB_OTG_IDDIG = 58,
4618 USB_OTG_AVALID = 59,
4619 USB_SRP_BVALID = 60,
4620 USB_OTG_VBUSVALID = 61,
4621 USB_SRP_SESSEND = 62,
4622 SPI3_CLK = 66,
4623 SPI3_Q = 67,
4624 SPI3_D = 68,
4625 SPI3_HD = 69,
4626 SPI3_WP = 70,
4627 SPI3_CS0 = 71,
4628 RMT_SIG_0 = 81,
4629 RMT_SIG_1 = 82,
4630 RMT_SIG_2 = 83,
4631 RMT_SIG_3 = 84,
4632 I2CEXT0_SCL = 89,
4633 I2CEXT0_SDA = 90,
4634 I2CEXT1_SCL = 91,
4635 I2CEXT1_SDA = 92,
4636 FSPICLK = 101,
4637 FSPIQ = 102,
4638 FSPID = 103,
4639 FSPIHD = 104,
4640 FSPIWP = 105,
4641 FSPIIO4 = 106,
4642 FSPIIO5 = 107,
4643 FSPIIO6 = 108,
4644 FSPIIO7 = 109,
4645 FSPICS0 = 110,
4646 TWAI_RX = 116,
4647 SUBSPIQ = 120,
4648 SUBSPID = 121,
4649 SUBSPIHD = 122,
4650 SUBSPIWP = 123,
4651 CORE1_GPIO0 = 129,
4652 CORE1_GPIO1 = 130,
4653 CORE1_GPIO2 = 131,
4654 CAM_DATA_0 = 133,
4655 CAM_DATA_1 = 134,
4656 CAM_DATA_2 = 135,
4657 CAM_DATA_3 = 136,
4658 CAM_DATA_4 = 137,
4659 CAM_DATA_5 = 138,
4660 CAM_DATA_6 = 139,
4661 CAM_DATA_7 = 140,
4662 CAM_DATA_8 = 141,
4663 CAM_DATA_9 = 142,
4664 CAM_DATA_10 = 143,
4665 CAM_DATA_11 = 144,
4666 CAM_DATA_12 = 145,
4667 CAM_DATA_13 = 146,
4668 CAM_DATA_14 = 147,
4669 CAM_DATA_15 = 148,
4670 CAM_PCLK = 149,
4671 CAM_H_ENABLE = 150,
4672 CAM_H_SYNC = 151,
4673 CAM_V_SYNC = 152,
4674 SUBSPID4 = 155,
4675 SUBSPID5 = 156,
4676 SUBSPID6 = 157,
4677 SUBSPID7 = 158,
4678 SUBSPIDQS = 159,
4679 PWM0_SYNC0 = 160,
4680 PWM0_SYNC1 = 161,
4681 PWM0_SYNC2 = 162,
4682 PWM0_F0 = 163,
4683 PWM0_F1 = 164,
4684 PWM0_F2 = 165,
4685 PWM0_CAP0 = 166,
4686 PWM0_CAP1 = 167,
4687 PWM0_CAP2 = 168,
4688 PWM1_SYNC0 = 169,
4689 PWM1_SYNC1 = 170,
4690 PWM1_SYNC2 = 171,
4691 PWM1_F0 = 172,
4692 PWM1_F1 = 173,
4693 PWM1_F2 = 174,
4694 PWM1_CAP0 = 175,
4695 PWM1_CAP1 = 176,
4696 PWM1_CAP2 = 177,
4697 SDHOST_CCMD_IN_1 = 178,
4698 SDHOST_CCMD_IN_2 = 179,
4699 SDHOST_CDATA_IN_10 = 180,
4700 SDHOST_CDATA_IN_11 = 181,
4701 SDHOST_CDATA_IN_12 = 182,
4702 SDHOST_CDATA_IN_13 = 183,
4703 SDHOST_CDATA_IN_14 = 184,
4704 SDHOST_CDATA_IN_15 = 185,
4705 SDHOST_CDATA_IN_16 = 186,
4706 SDHOST_CDATA_IN_17 = 187,
4707 SDHOST_DATA_STROBE_1 = 192,
4708 SDHOST_DATA_STROBE_2 = 193,
4709 SDHOST_CARD_DETECT_N_1 = 194,
4710 SDHOST_CARD_DETECT_N_2 = 195,
4711 SDHOST_CARD_WRITE_PRT_1 = 196,
4712 SDHOST_CARD_WRITE_PRT_2 = 197,
4713 SDHOST_CARD_INT_N_1 = 198,
4714 SDHOST_CARD_INT_N_2 = 199,
4715 SDHOST_CDATA_IN_20 = 213,
4716 SDHOST_CDATA_IN_21 = 214,
4717 SDHOST_CDATA_IN_22 = 215,
4718 SDHOST_CDATA_IN_23 = 216,
4719 SDHOST_CDATA_IN_24 = 217,
4720 SDHOST_CDATA_IN_25 = 218,
4721 SDHOST_CDATA_IN_26 = 219,
4722 SDHOST_CDATA_IN_27 = 220,
4723 PRO_ALONEGPIO0 = 221,
4724 PRO_ALONEGPIO1 = 222,
4725 PRO_ALONEGPIO2 = 223,
4726 PRO_ALONEGPIO3 = 224,
4727 PRO_ALONEGPIO4 = 225,
4728 PRO_ALONEGPIO5 = 226,
4729 PRO_ALONEGPIO6 = 227,
4730 PRO_ALONEGPIO7 = 228,
4731 USB_JTAG_TDO_BRIDGE = 251,
4732 CORE1_GPIO3 = 252,
4733 CORE1_GPIO4 = 253,
4734 CORE1_GPIO5 = 254,
4735 CORE1_GPIO6 = 255,
4736 SPIIO4,
4737 SPIIO5,
4738 SPIIO6,
4739 SPIIO7,
4740 MTDI,
4741 MTCK,
4742 MTMS,
4743 }
4744 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
4745 #[derive(Debug, PartialEq, Copy, Clone)]
4746 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
4747 #[doc(hidden)]
4748 pub enum OutputSignal {
4749 SPIQ = 0,
4750 SPID = 1,
4751 SPIHD = 2,
4752 SPIWP = 3,
4753 SPICLK = 4,
4754 SPICS0 = 5,
4755 SPICS1 = 6,
4756 SPID4 = 7,
4757 SPID5 = 8,
4758 SPID6 = 9,
4759 SPID7 = 10,
4760 SPIDQS = 11,
4761 U0TXD = 12,
4762 U0RTS = 13,
4763 U0DTR = 14,
4764 U1TXD = 15,
4765 U1RTS = 16,
4766 U1DTR = 17,
4767 U2TXD = 18,
4768 U2RTS = 19,
4769 U2DTR = 20,
4770 I2S1_MCLK = 21,
4771 I2S0O_BCK = 22,
4772 I2S0_MCLK = 23,
4773 I2S0O_WS = 24,
4774 I2S0O_SD = 25,
4775 I2S0I_BCK = 26,
4776 I2S0I_WS = 27,
4777 I2S1O_BCK = 28,
4778 I2S1O_WS = 29,
4779 I2S1O_SD = 30,
4780 I2S1I_BCK = 31,
4781 I2S1I_WS = 32,
4782 CORE1_GPIO7 = 54,
4783 USB_EXTPHY_OEN = 55,
4784 USB_EXTPHY_VPO = 57,
4785 USB_EXTPHY_VMO = 58,
4786 SPI3_CLK = 66,
4787 SPI3_Q = 67,
4788 SPI3_D = 68,
4789 SPI3_HD = 69,
4790 SPI3_WP = 70,
4791 SPI3_CS0 = 71,
4792 SPI3_CS1 = 72,
4793 LEDC_LS_SIG0 = 73,
4794 LEDC_LS_SIG1 = 74,
4795 LEDC_LS_SIG2 = 75,
4796 LEDC_LS_SIG3 = 76,
4797 LEDC_LS_SIG4 = 77,
4798 LEDC_LS_SIG5 = 78,
4799 LEDC_LS_SIG6 = 79,
4800 LEDC_LS_SIG7 = 80,
4801 RMT_SIG_0 = 81,
4802 RMT_SIG_1 = 82,
4803 RMT_SIG_2 = 83,
4804 RMT_SIG_3 = 84,
4805 I2CEXT0_SCL = 89,
4806 I2CEXT0_SDA = 90,
4807 I2CEXT1_SCL = 91,
4808 I2CEXT1_SDA = 92,
4809 GPIO_SD0 = 93,
4810 GPIO_SD1 = 94,
4811 GPIO_SD2 = 95,
4812 GPIO_SD3 = 96,
4813 GPIO_SD4 = 97,
4814 GPIO_SD5 = 98,
4815 GPIO_SD6 = 99,
4816 GPIO_SD7 = 100,
4817 FSPICLK = 101,
4818 FSPIQ = 102,
4819 FSPID = 103,
4820 FSPIHD = 104,
4821 FSPIWP = 105,
4822 FSPIIO4 = 106,
4823 FSPIIO5 = 107,
4824 FSPIIO6 = 108,
4825 FSPIIO7 = 109,
4826 FSPICS0 = 110,
4827 FSPICS1 = 111,
4828 FSPICS2 = 112,
4829 FSPICS3 = 113,
4830 FSPICS4 = 114,
4831 FSPICS5 = 115,
4832 TWAI_TX = 116,
4833 SUBSPICLK = 119,
4834 SUBSPIQ = 120,
4835 SUBSPID = 121,
4836 SUBSPIHD = 122,
4837 SUBSPIWP = 123,
4838 SUBSPICS0 = 124,
4839 SUBSPICS1 = 125,
4840 FSPIDQS = 126,
4841 SPI3_CS2 = 127,
4842 I2S0O_SD1 = 128,
4843 CORE1_GPIO0 = 129,
4844 CORE1_GPIO1 = 130,
4845 CORE1_GPIO2 = 131,
4846 LCD_CS = 132,
4847 LCD_DATA_0 = 133,
4848 LCD_DATA_1 = 134,
4849 LCD_DATA_2 = 135,
4850 LCD_DATA_3 = 136,
4851 LCD_DATA_4 = 137,
4852 LCD_DATA_5 = 138,
4853 LCD_DATA_6 = 139,
4854 LCD_DATA_7 = 140,
4855 LCD_DATA_8 = 141,
4856 LCD_DATA_9 = 142,
4857 LCD_DATA_10 = 143,
4858 LCD_DATA_11 = 144,
4859 LCD_DATA_12 = 145,
4860 LCD_DATA_13 = 146,
4861 LCD_DATA_14 = 147,
4862 LCD_DATA_15 = 148,
4863 CAM_CLK = 149,
4864 LCD_H_ENABLE = 150,
4865 LCD_H_SYNC = 151,
4866 LCD_V_SYNC = 152,
4867 LCD_DC = 153,
4868 LCD_PCLK = 154,
4869 SUBSPID4 = 155,
4870 SUBSPID5 = 156,
4871 SUBSPID6 = 157,
4872 SUBSPID7 = 158,
4873 SUBSPIDQS = 159,
4874 PWM0_0A = 160,
4875 PWM0_0B = 161,
4876 PWM0_1A = 162,
4877 PWM0_1B = 163,
4878 PWM0_2A = 164,
4879 PWM0_2B = 165,
4880 PWM1_0A = 166,
4881 PWM1_0B = 167,
4882 PWM1_1A = 168,
4883 PWM1_1B = 169,
4884 PWM1_2A = 170,
4885 PWM1_2B = 171,
4886 SDHOST_CCLK_OUT_1 = 172,
4887 SDHOST_CCLK_OUT_2 = 173,
4888 SDHOST_RST_N_1 = 174,
4889 SDHOST_RST_N_2 = 175,
4890 SDHOST_CCMD_OD_PULLUP_EN_N = 176,
4891 SDIO_TOHOST_INT = 177,
4892 SDHOST_CCMD_OUT_1 = 178,
4893 SDHOST_CCMD_OUT_2 = 179,
4894 SDHOST_CDATA_OUT_10 = 180,
4895 SDHOST_CDATA_OUT_11 = 181,
4896 SDHOST_CDATA_OUT_12 = 182,
4897 SDHOST_CDATA_OUT_13 = 183,
4898 SDHOST_CDATA_OUT_14 = 184,
4899 SDHOST_CDATA_OUT_15 = 185,
4900 SDHOST_CDATA_OUT_16 = 186,
4901 SDHOST_CDATA_OUT_17 = 187,
4902 SDHOST_CDATA_OUT_20 = 213,
4903 SDHOST_CDATA_OUT_21 = 214,
4904 SDHOST_CDATA_OUT_22 = 215,
4905 SDHOST_CDATA_OUT_23 = 216,
4906 SDHOST_CDATA_OUT_24 = 217,
4907 SDHOST_CDATA_OUT_25 = 218,
4908 SDHOST_CDATA_OUT_26 = 219,
4909 SDHOST_CDATA_OUT_27 = 220,
4910 PRO_ALONEGPIO0 = 221,
4911 PRO_ALONEGPIO1 = 222,
4912 PRO_ALONEGPIO2 = 223,
4913 PRO_ALONEGPIO3 = 224,
4914 PRO_ALONEGPIO4 = 225,
4915 PRO_ALONEGPIO5 = 226,
4916 PRO_ALONEGPIO6 = 227,
4917 PRO_ALONEGPIO7 = 228,
4918 USB_JTAG_TRST = 251,
4919 CORE1_GPIO3 = 252,
4920 CORE1_GPIO4 = 253,
4921 CORE1_GPIO5 = 254,
4922 CORE1_GPIO6 = 255,
4923 GPIO = 256,
4924 SPIIO4,
4925 SPIIO5,
4926 SPIIO6,
4927 SPIIO7,
4928 CLK_OUT1,
4929 CLK_OUT2,
4930 CLK_OUT3,
4931 SPICLK_P_DIFF,
4932 SPICLK_N_DIFF,
4933 SUBSPICLK_P_DIFF,
4934 SUBSPICLK_N_DIFF,
4935 MTDO,
4936 }
4937 };
4938}
4939#[macro_export]
4952#[expect(clippy::crate_in_macro_def)]
4953#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
4954macro_rules! define_io_mux_reg {
4955 () => {
4956 pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
4957 crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
4958 }
4959 };
4960}