esp_metadata_generated/
_generated_esp32c6.rs

1// Do NOT edit this file directly. Make your changes to esp-metadata,
2// then run `cargo xtask update-metadata`.
3
4/// The name of the chip as `&str`
5///
6/// # Example
7///
8/// ```rust, no_run
9/// use esp_hal::chip;
10/// let chip_name = chip!();
11#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
12/// ```
13#[macro_export]
14#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
15macro_rules! chip {
16    () => {
17        "esp32c6"
18    };
19}
20/// The properties of this chip and its drivers.
21#[macro_export]
22#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
23macro_rules! property {
24    ("chip") => {
25        "esp32c6"
26    };
27    ("arch") => {
28        "riscv"
29    };
30    ("cores") => {
31        1
32    };
33    ("cores", str) => {
34        stringify!(1)
35    };
36    ("trm") => {
37        "https://www.espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf"
38    };
39    ("soc.cpu_has_csr_pc") => {
40        true
41    };
42    ("soc.cpu_has_prv_mode") => {
43        true
44    };
45    ("soc.rc_fast_clk_default") => {
46        17500000
47    };
48    ("soc.rc_fast_clk_default", str) => {
49        stringify!(17500000)
50    };
51    ("soc.rc_slow_clock") => {
52        136000
53    };
54    ("soc.rc_slow_clock", str) => {
55        stringify!(136000)
56    };
57    ("soc.xtal_frequency") => {
58        40
59    };
60    ("soc.xtal_frequency", str) => {
61        stringify!(40)
62    };
63    ("aes.dma") => {
64        true
65    };
66    ("aes.has_split_text_registers") => {
67        true
68    };
69    ("aes.endianness_configurable") => {
70        false
71    };
72    ("assist_debug.has_sp_monitor") => {
73        true
74    };
75    ("assist_debug.has_region_monitor") => {
76        true
77    };
78    ("gpio.has_bank_1") => {
79        false
80    };
81    ("gpio.gpio_function") => {
82        1
83    };
84    ("gpio.gpio_function", str) => {
85        stringify!(1)
86    };
87    ("gpio.constant_0_input") => {
88        60
89    };
90    ("gpio.constant_0_input", str) => {
91        stringify!(60)
92    };
93    ("gpio.constant_1_input") => {
94        56
95    };
96    ("gpio.constant_1_input", str) => {
97        stringify!(56)
98    };
99    ("gpio.remap_iomux_pin_registers") => {
100        false
101    };
102    ("gpio.func_in_sel_offset") => {
103        0
104    };
105    ("gpio.func_in_sel_offset", str) => {
106        stringify!(0)
107    };
108    ("gpio.input_signal_max") => {
109        124
110    };
111    ("gpio.input_signal_max", str) => {
112        stringify!(124)
113    };
114    ("gpio.output_signal_max") => {
115        128
116    };
117    ("gpio.output_signal_max", str) => {
118        stringify!(128)
119    };
120    ("i2c_master.has_fsm_timeouts") => {
121        true
122    };
123    ("i2c_master.has_hw_bus_clear") => {
124        true
125    };
126    ("i2c_master.has_bus_timeout_enable") => {
127        true
128    };
129    ("i2c_master.separate_filter_config_registers") => {
130        false
131    };
132    ("i2c_master.can_estimate_nack_reason") => {
133        true
134    };
135    ("i2c_master.has_conf_update") => {
136        true
137    };
138    ("i2c_master.has_reliable_fsm_reset") => {
139        true
140    };
141    ("i2c_master.has_arbitration_en") => {
142        true
143    };
144    ("i2c_master.has_tx_fifo_watermark") => {
145        true
146    };
147    ("i2c_master.bus_timeout_is_exponential") => {
148        true
149    };
150    ("i2c_master.max_bus_timeout") => {
151        31
152    };
153    ("i2c_master.max_bus_timeout", str) => {
154        stringify!(31)
155    };
156    ("i2c_master.ll_intr_mask") => {
157        262143
158    };
159    ("i2c_master.ll_intr_mask", str) => {
160        stringify!(262143)
161    };
162    ("i2c_master.fifo_size") => {
163        32
164    };
165    ("i2c_master.fifo_size", str) => {
166        stringify!(32)
167    };
168    ("lp_i2c_master.fifo_size") => {
169        16
170    };
171    ("lp_i2c_master.fifo_size", str) => {
172        stringify!(16)
173    };
174    ("interrupts.status_registers") => {
175        3
176    };
177    ("interrupts.status_registers", str) => {
178        stringify!(3)
179    };
180    ("rmt.ram_start") => {
181        1610638336
182    };
183    ("rmt.ram_start", str) => {
184        stringify!(1610638336)
185    };
186    ("rmt.channel_ram_size") => {
187        48
188    };
189    ("rmt.channel_ram_size", str) => {
190        stringify!(48)
191    };
192    ("rmt.has_tx_immediate_stop") => {
193        true
194    };
195    ("rmt.has_tx_loop_count") => {
196        true
197    };
198    ("rmt.has_tx_loop_auto_stop") => {
199        true
200    };
201    ("rmt.has_tx_carrier_data_only") => {
202        true
203    };
204    ("rmt.has_tx_sync") => {
205        true
206    };
207    ("rmt.has_rx_wrap") => {
208        true
209    };
210    ("rmt.has_rx_demodulation") => {
211        true
212    };
213    ("rmt.has_dma") => {
214        false
215    };
216    ("rmt.has_per_channel_clock") => {
217        false
218    };
219    ("rng.apb_cycle_wait_num") => {
220        16
221    };
222    ("rng.apb_cycle_wait_num", str) => {
223        stringify!(16)
224    };
225    ("rsa.size_increment") => {
226        32
227    };
228    ("rsa.size_increment", str) => {
229        stringify!(32)
230    };
231    ("rsa.memory_size_bytes") => {
232        384
233    };
234    ("rsa.memory_size_bytes", str) => {
235        stringify!(384)
236    };
237    ("sha.dma") => {
238        true
239    };
240    ("spi_master.has_octal") => {
241        false
242    };
243    ("timergroup.timg_has_timer1") => {
244        false
245    };
246    ("timergroup.timg_has_divcnt_rst") => {
247        true
248    };
249    ("timergroup.default_clock_source") => {
250        1
251    };
252    ("timergroup.default_clock_source", str) => {
253        stringify!(1)
254    };
255    ("timergroup.default_wdt_clock_source") => {
256        1
257    };
258    ("timergroup.default_wdt_clock_source", str) => {
259        stringify!(1)
260    };
261    ("uart.ram_size") => {
262        128
263    };
264    ("uart.ram_size", str) => {
265        stringify!(128)
266    };
267    ("lp_uart.ram_size") => {
268        32
269    };
270    ("lp_uart.ram_size", str) => {
271        stringify!(32)
272    };
273    ("wifi.has_wifi6") => {
274        true
275    };
276    ("bt.controller") => {
277        "npl"
278    };
279    ("phy.combo_module") => {
280        true
281    };
282}
283/// Macro to get the address range of the given memory region.
284#[macro_export]
285#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
286macro_rules! memory_range {
287    ("DRAM") => {
288        1082130432..1082654720
289    };
290}
291#[macro_export]
292#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
293macro_rules! for_each_soc_xtal_options {
294    ($($pattern:tt => $code:tt;)*) => {
295        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
296        _for_each_inner!((40)); _for_each_inner!((all(40)));
297    };
298}
299#[macro_export]
300#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
301macro_rules! for_each_aes_key_length {
302    ($($pattern:tt => $code:tt;)*) => {
303        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
304        _for_each_inner!((128)); _for_each_inner!((256)); _for_each_inner!((128, 0, 4));
305        _for_each_inner!((256, 2, 6)); _for_each_inner!((bits(128), (256)));
306        _for_each_inner!((modes(128, 0, 4), (256, 2, 6)));
307    };
308}
309/// This macro can be used to generate code for each channel of the RMT peripheral.
310///
311/// For an explanation on the general syntax, as well as usage of individual/repeated
312/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
313///
314/// This macro has three options for its "Individual matcher" case:
315///
316/// - `all`: `($num:literal)`
317/// - `tx`: `($num:literal, $idx:literal)`
318/// - `rx`: `($num:literal, $idx:literal)`
319///
320/// Macro fragments:
321///
322/// - `$num`: number of the channel, e.g. `0`
323/// - `$idx`: index of the channel among channels of the same capability, e.g. `0`
324///
325/// Example data:
326///
327/// - `all`: `(0)`
328/// - `tx`: `(1, 1)`
329/// - `rx`: `(2, 0)`
330#[macro_export]
331#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
332macro_rules! for_each_rmt_channel {
333    ($($pattern:tt => $code:tt;)*) => {
334        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
335        _for_each_inner!((0)); _for_each_inner!((1)); _for_each_inner!((2));
336        _for_each_inner!((3)); _for_each_inner!((0, 0)); _for_each_inner!((1, 1));
337        _for_each_inner!((2, 0)); _for_each_inner!((3, 1)); _for_each_inner!((all(0),
338        (1), (2), (3))); _for_each_inner!((tx(0, 0), (1, 1))); _for_each_inner!((rx(2,
339        0), (3, 1)));
340    };
341}
342#[macro_export]
343#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
344macro_rules! for_each_rmt_clock_source {
345    ($($pattern:tt => $code:tt;)*) => {
346        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
347        _for_each_inner!((Pll80MHz, 1)); _for_each_inner!((RcFast, 2));
348        _for_each_inner!((Xtal, 3)); _for_each_inner!((Pll80MHz));
349        _for_each_inner!((all(Pll80MHz, 1), (RcFast, 2), (Xtal, 3)));
350        _for_each_inner!((default(Pll80MHz)));
351    };
352}
353#[macro_export]
354#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
355macro_rules! for_each_rsa_exponentiation {
356    ($($pattern:tt => $code:tt;)*) => {
357        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
358        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
359        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
360        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
361        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
362        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
363        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
364        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
365        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
366        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
367        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
368        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
369        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
370        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
371        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
372        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
373        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
374        _for_each_inner!((1568)); _for_each_inner!((1600)); _for_each_inner!((1632));
375        _for_each_inner!((1664)); _for_each_inner!((1696)); _for_each_inner!((1728));
376        _for_each_inner!((1760)); _for_each_inner!((1792)); _for_each_inner!((1824));
377        _for_each_inner!((1856)); _for_each_inner!((1888)); _for_each_inner!((1920));
378        _for_each_inner!((1952)); _for_each_inner!((1984)); _for_each_inner!((2016));
379        _for_each_inner!((2048)); _for_each_inner!((2080)); _for_each_inner!((2112));
380        _for_each_inner!((2144)); _for_each_inner!((2176)); _for_each_inner!((2208));
381        _for_each_inner!((2240)); _for_each_inner!((2272)); _for_each_inner!((2304));
382        _for_each_inner!((2336)); _for_each_inner!((2368)); _for_each_inner!((2400));
383        _for_each_inner!((2432)); _for_each_inner!((2464)); _for_each_inner!((2496));
384        _for_each_inner!((2528)); _for_each_inner!((2560)); _for_each_inner!((2592));
385        _for_each_inner!((2624)); _for_each_inner!((2656)); _for_each_inner!((2688));
386        _for_each_inner!((2720)); _for_each_inner!((2752)); _for_each_inner!((2784));
387        _for_each_inner!((2816)); _for_each_inner!((2848)); _for_each_inner!((2880));
388        _for_each_inner!((2912)); _for_each_inner!((2944)); _for_each_inner!((2976));
389        _for_each_inner!((3008)); _for_each_inner!((3040)); _for_each_inner!((3072));
390        _for_each_inner!((all(32), (64), (96), (128), (160), (192), (224), (256), (288),
391        (320), (352), (384), (416), (448), (480), (512), (544), (576), (608), (640),
392        (672), (704), (736), (768), (800), (832), (864), (896), (928), (960), (992),
393        (1024), (1056), (1088), (1120), (1152), (1184), (1216), (1248), (1280), (1312),
394        (1344), (1376), (1408), (1440), (1472), (1504), (1536), (1568), (1600), (1632),
395        (1664), (1696), (1728), (1760), (1792), (1824), (1856), (1888), (1920), (1952),
396        (1984), (2016), (2048), (2080), (2112), (2144), (2176), (2208), (2240), (2272),
397        (2304), (2336), (2368), (2400), (2432), (2464), (2496), (2528), (2560), (2592),
398        (2624), (2656), (2688), (2720), (2752), (2784), (2816), (2848), (2880), (2912),
399        (2944), (2976), (3008), (3040), (3072)));
400    };
401}
402#[macro_export]
403#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
404macro_rules! for_each_rsa_multiplication {
405    ($($pattern:tt => $code:tt;)*) => {
406        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
407        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
408        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
409        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
410        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
411        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
412        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
413        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
414        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
415        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
416        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
417        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
418        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
419        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
420        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
421        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
422        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
423        _for_each_inner!((all(32), (64), (96), (128), (160), (192), (224), (256), (288),
424        (320), (352), (384), (416), (448), (480), (512), (544), (576), (608), (640),
425        (672), (704), (736), (768), (800), (832), (864), (896), (928), (960), (992),
426        (1024), (1056), (1088), (1120), (1152), (1184), (1216), (1248), (1280), (1312),
427        (1344), (1376), (1408), (1440), (1472), (1504), (1536)));
428    };
429}
430#[macro_export]
431#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
432macro_rules! for_each_sha_algorithm {
433    ($($pattern:tt => $code:tt;)*) => {
434        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
435        _for_each_inner!((Sha1, "SHA-1"(sizes : 64, 20, 8) (insecure_against :
436        "collision", "length extension"), 0)); _for_each_inner!((Sha224, "SHA-224"(sizes
437        : 64, 28, 8) (insecure_against : "length extension"), 1));
438        _for_each_inner!((Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against :
439        "length extension"), 2)); _for_each_inner!((algos(Sha1, "SHA-1"(sizes : 64, 20,
440        8) (insecure_against : "collision", "length extension"), 0), (Sha224,
441        "SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
442        (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
443        2)));
444    };
445}
446/// This macro can be used to generate code for each peripheral instance of the I2C master driver.
447///
448/// For an explanation on the general syntax, as well as usage of individual/repeated
449/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
450///
451/// This macro has one option for its "Individual matcher" case:
452///
453/// Syntax: `($instance:ident, $sys:ident, $scl:ident, $sda:ident)`
454///
455/// Macro fragments:
456///
457/// - `$instance`: the name of the I2C instance
458/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
459/// - `$scl`, `$sda`: peripheral signal names.
460///
461/// Example data: `(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)`
462#[macro_export]
463#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
464macro_rules! for_each_i2c_master {
465    ($($pattern:tt => $code:tt;)*) => {
466        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
467        _for_each_inner!((I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA));
468        _for_each_inner!((all(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)));
469    };
470}
471/// This macro can be used to generate code for each peripheral instance of the UART driver.
472///
473/// For an explanation on the general syntax, as well as usage of individual/repeated
474/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
475///
476/// This macro has one option for its "Individual matcher" case:
477///
478/// Syntax: `($instance:ident, $sys:ident, $rx:ident, $tx:ident, $cts:ident, $rts:ident)`
479///
480/// Macro fragments:
481///
482/// - `$instance`: the name of the UART instance
483/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
484/// - `$rx`, `$tx`, `$cts`, `$rts`: signal names.
485///
486/// Example data: `(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS)`
487#[macro_export]
488#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
489macro_rules! for_each_uart {
490    ($($pattern:tt => $code:tt;)*) => {
491        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
492        _for_each_inner!((UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS));
493        _for_each_inner!((UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS));
494        _for_each_inner!((all(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS), (UART1, Uart1,
495        U1RXD, U1TXD, U1CTS, U1RTS)));
496    };
497}
498/// This macro can be used to generate code for each peripheral instance of the SPI master driver.
499///
500/// For an explanation on the general syntax, as well as usage of individual/repeated
501/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
502///
503/// This macro has one option for its "Individual matcher" case:
504///
505/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, [$($cs:ident),*] [$($sio:ident),*
506/// $($is_qspi:iteral)?])`
507///
508/// Macro fragments:
509///
510/// - `$instance`: the name of the SPI instance
511/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
512/// - `$cs`, `$sio`: chip select and SIO signal names.
513/// - `$is_qspi`: a `true` literal present if the SPI instance supports QSPI.
514///
515/// Example data:
516/// - `(SPI2, Spi2, FSPICLK [FSPICS0, FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ,
517///   FSPIWP, FSPIHD, FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7], true)`
518/// - `(SPI3, Spi3, SPI3_CLK [SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q])`
519#[macro_export]
520#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
521macro_rules! for_each_spi_master {
522    ($($pattern:tt => $code:tt;)*) => {
523        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
524        _for_each_inner!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3,
525        FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD], true));
526        _for_each_inner!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3,
527        FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD], true)));
528    };
529}
530/// This macro can be used to generate code for each peripheral instance of the SPI slave driver.
531///
532/// For an explanation on the general syntax, as well as usage of individual/repeated
533/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
534///
535/// This macro has one option for its "Individual matcher" case:
536///
537/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, $mosi:ident, $miso:ident, $cs:ident)`
538///
539/// Macro fragments:
540///
541/// - `$instance`: the name of the I2C instance
542/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
543/// - `$mosi`, `$miso`, `$cs`: signal names.
544///
545/// Example data: `(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)`
546#[macro_export]
547#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
548macro_rules! for_each_spi_slave {
549    ($($pattern:tt => $code:tt;)*) => {
550        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
551        _for_each_inner!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
552        _for_each_inner!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)));
553    };
554}
555#[macro_export]
556#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
557macro_rules! for_each_peripheral {
558    ($($pattern:tt => $code:tt;)*) => {
559        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
560        _for_each_inner!((GPIO0 <= virtual())); _for_each_inner!((GPIO1 <= virtual()));
561        _for_each_inner!((GPIO2 <= virtual())); _for_each_inner!((GPIO3 <= virtual()));
562        _for_each_inner!((GPIO4 <= virtual())); _for_each_inner!((GPIO5 <= virtual()));
563        _for_each_inner!((GPIO6 <= virtual())); _for_each_inner!((GPIO7 <= virtual()));
564        _for_each_inner!((GPIO8 <= virtual())); _for_each_inner!((GPIO9 <= virtual()));
565        _for_each_inner!((GPIO10 <= virtual())); _for_each_inner!((GPIO11 <= virtual()));
566        _for_each_inner!((GPIO12 <= virtual())); _for_each_inner!((GPIO13 <= virtual()));
567        _for_each_inner!((GPIO14 <= virtual())); _for_each_inner!((GPIO15 <= virtual()));
568        _for_each_inner!((GPIO16 <= virtual())); _for_each_inner!((GPIO17 <= virtual()));
569        _for_each_inner!((GPIO18 <= virtual())); _for_each_inner!((GPIO19 <= virtual()));
570        _for_each_inner!((GPIO20 <= virtual())); _for_each_inner!((GPIO21 <= virtual()));
571        _for_each_inner!((GPIO22 <= virtual())); _for_each_inner!((GPIO23 <= virtual()));
572        _for_each_inner!((GPIO27 <= virtual())); _for_each_inner!((AES <= AES(AES : {
573        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
574        (unstable))); _for_each_inner!((APB_SARADC <= APB_SARADC() (unstable)));
575        _for_each_inner!((ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
576        _for_each_inner!((ATOMIC <= ATOMIC() (unstable))); _for_each_inner!((DMA <= DMA()
577        (unstable))); _for_each_inner!((DS <= DS() (unstable))); _for_each_inner!((ECC <=
578        ECC() (unstable))); _for_each_inner!((EFUSE <= EFUSE() (unstable)));
579        _for_each_inner!((EXTMEM <= EXTMEM() (unstable))); _for_each_inner!((GPIO <=
580        GPIO() (unstable))); _for_each_inner!((GPIO_SD <= GPIO_SD() (unstable)));
581        _for_each_inner!((HINF <= HINF() (unstable))); _for_each_inner!((HMAC <= HMAC()
582        (unstable))); _for_each_inner!((HP_APM <= HP_APM() (unstable)));
583        _for_each_inner!((HP_SYS <= HP_SYS() (unstable))); _for_each_inner!((I2C_ANA_MST
584        <= I2C_ANA_MST() (unstable))); _for_each_inner!((I2C0 <= I2C0(I2C_EXT0 : {
585        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })));
586        _for_each_inner!((I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
587        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
588        _for_each_inner!((IEEE802154 <= IEEE802154() (unstable)));
589        _for_each_inner!((INTERRUPT_CORE0 <= INTERRUPT_CORE0() (unstable)));
590        _for_each_inner!((INTPRI <= INTPRI() (unstable))); _for_each_inner!((IO_MUX <=
591        IO_MUX() (unstable))); _for_each_inner!((LEDC <= LEDC() (unstable)));
592        _for_each_inner!((LP_ANA <= LP_ANA() (unstable))); _for_each_inner!((LP_AON <=
593        LP_AON() (unstable))); _for_each_inner!((LP_APM <= LP_APM() (unstable)));
594        _for_each_inner!((LP_APM0 <= LP_APM0() (unstable))); _for_each_inner!((LP_CLKRST
595        <= LP_CLKRST() (unstable))); _for_each_inner!((LP_I2C0 <= LP_I2C0() (unstable)));
596        _for_each_inner!((LP_I2C_ANA_MST <= LP_I2C_ANA_MST() (unstable)));
597        _for_each_inner!((LP_IO <= LP_IO() (unstable))); _for_each_inner!((LP_PERI <=
598        LP_PERI() (unstable))); _for_each_inner!((LP_TEE <= LP_TEE() (unstable)));
599        _for_each_inner!((LP_TIMER <= LP_TIMER() (unstable))); _for_each_inner!((LP_UART
600        <= LP_UART() (unstable))); _for_each_inner!((LP_WDT <= LP_WDT() (unstable)));
601        _for_each_inner!((LPWR <= LP_CLKRST() (unstable))); _for_each_inner!((MCPWM0 <=
602        MCPWM0() (unstable))); _for_each_inner!((MEM_MONITOR <= MEM_MONITOR()
603        (unstable))); _for_each_inner!((MODEM_LPCON <= MODEM_LPCON() (unstable)));
604        _for_each_inner!((MODEM_SYSCON <= MODEM_SYSCON() (unstable)));
605        _for_each_inner!((OTP_DEBUG <= OTP_DEBUG() (unstable)));
606        _for_each_inner!((PARL_IO <= PARL_IO(PARL_IO : { bind_peri_interrupt,
607        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
608        _for_each_inner!((PAU <= PAU() (unstable))); _for_each_inner!((PCNT <= PCNT()
609        (unstable))); _for_each_inner!((PCR <= PCR() (unstable)));
610        _for_each_inner!((PLIC_MX <= PLIC_MX() (unstable))); _for_each_inner!((PMU <=
611        PMU() (unstable))); _for_each_inner!((RMT <= RMT() (unstable)));
612        _for_each_inner!((RNG <= RNG() (unstable))); _for_each_inner!((RSA <= RSA(RSA : {
613        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
614        (unstable))); _for_each_inner!((SHA <= SHA(SHA : { bind_peri_interrupt,
615        enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
616        _for_each_inner!((SLCHOST <= SLCHOST() (unstable))); _for_each_inner!((ETM <=
617        SOC_ETM() (unstable))); _for_each_inner!((SPI0 <= SPI0() (unstable)));
618        _for_each_inner!((SPI1 <= SPI1() (unstable))); _for_each_inner!((SPI2 <=
619        SPI2(SPI2 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
620        }))); _for_each_inner!((SYSTEM <= PCR() (unstable))); _for_each_inner!((SYSTIMER
621        <= SYSTIMER() (unstable))); _for_each_inner!((TEE <= TEE() (unstable)));
622        _for_each_inner!((TIMG0 <= TIMG0() (unstable))); _for_each_inner!((TIMG1 <=
623        TIMG1() (unstable))); _for_each_inner!((TRACE0 <= TRACE() (unstable)));
624        _for_each_inner!((TWAI0 <= TWAI0() (unstable))); _for_each_inner!((TWAI1 <=
625        TWAI1() (unstable))); _for_each_inner!((UART0 <= UART0(UART0 : {
626        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })));
627        _for_each_inner!((UART1 <= UART1(UART1 : { bind_peri_interrupt,
628        enable_peri_interrupt, disable_peri_interrupt }))); _for_each_inner!((UHCI0 <=
629        UHCI0() (unstable))); _for_each_inner!((USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
630        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
631        (unstable))); _for_each_inner!((DMA_CH0 <= virtual() (unstable)));
632        _for_each_inner!((DMA_CH1 <= virtual() (unstable))); _for_each_inner!((DMA_CH2 <=
633        virtual() (unstable))); _for_each_inner!((ADC1 <= virtual() (unstable)));
634        _for_each_inner!((BT <= virtual() (unstable))); _for_each_inner!((FLASH <=
635        virtual() (unstable))); _for_each_inner!((LP_CORE <= virtual() (unstable)));
636        _for_each_inner!((SW_INTERRUPT <= virtual() (unstable))); _for_each_inner!((TSENS
637        <= virtual() (unstable))); _for_each_inner!((WIFI <= virtual() (unstable)));
638        _for_each_inner!((MEM2MEM1 <= virtual() (unstable))); _for_each_inner!((MEM2MEM4
639        <= virtual() (unstable))); _for_each_inner!((MEM2MEM5 <= virtual() (unstable)));
640        _for_each_inner!((MEM2MEM10 <= virtual() (unstable)));
641        _for_each_inner!((MEM2MEM11 <= virtual() (unstable)));
642        _for_each_inner!((MEM2MEM12 <= virtual() (unstable)));
643        _for_each_inner!((MEM2MEM13 <= virtual() (unstable)));
644        _for_each_inner!((MEM2MEM14 <= virtual() (unstable)));
645        _for_each_inner!((MEM2MEM15 <= virtual() (unstable)));
646        _for_each_inner!((all(GPIO0 <= virtual()), (GPIO1 <= virtual()), (GPIO2 <=
647        virtual()), (GPIO3 <= virtual()), (GPIO4 <= virtual()), (GPIO5 <= virtual()),
648        (GPIO6 <= virtual()), (GPIO7 <= virtual()), (GPIO8 <= virtual()), (GPIO9 <=
649        virtual()), (GPIO10 <= virtual()), (GPIO11 <= virtual()), (GPIO12 <= virtual()),
650        (GPIO13 <= virtual()), (GPIO14 <= virtual()), (GPIO15 <= virtual()), (GPIO16 <=
651        virtual()), (GPIO17 <= virtual()), (GPIO18 <= virtual()), (GPIO19 <= virtual()),
652        (GPIO20 <= virtual()), (GPIO21 <= virtual()), (GPIO22 <= virtual()), (GPIO23 <=
653        virtual()), (GPIO27 <= virtual()), (AES <= AES(AES : { bind_peri_interrupt,
654        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (APB_SARADC <=
655        APB_SARADC() (unstable)), (ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)), (ATOMIC <=
656        ATOMIC() (unstable)), (DMA <= DMA() (unstable)), (DS <= DS() (unstable)), (ECC <=
657        ECC() (unstable)), (EFUSE <= EFUSE() (unstable)), (EXTMEM <= EXTMEM()
658        (unstable)), (GPIO <= GPIO() (unstable)), (GPIO_SD <= GPIO_SD() (unstable)),
659        (HINF <= HINF() (unstable)), (HMAC <= HMAC() (unstable)), (HP_APM <= HP_APM()
660        (unstable)), (HP_SYS <= HP_SYS() (unstable)), (I2C_ANA_MST <= I2C_ANA_MST()
661        (unstable)), (I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
662        enable_peri_interrupt, disable_peri_interrupt })), (I2S0 <= I2S0(I2S0 : {
663        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
664        (unstable)), (IEEE802154 <= IEEE802154() (unstable)), (INTERRUPT_CORE0 <=
665        INTERRUPT_CORE0() (unstable)), (INTPRI <= INTPRI() (unstable)), (IO_MUX <=
666        IO_MUX() (unstable)), (LEDC <= LEDC() (unstable)), (LP_ANA <= LP_ANA()
667        (unstable)), (LP_AON <= LP_AON() (unstable)), (LP_APM <= LP_APM() (unstable)),
668        (LP_APM0 <= LP_APM0() (unstable)), (LP_CLKRST <= LP_CLKRST() (unstable)),
669        (LP_I2C0 <= LP_I2C0() (unstable)), (LP_I2C_ANA_MST <= LP_I2C_ANA_MST()
670        (unstable)), (LP_IO <= LP_IO() (unstable)), (LP_PERI <= LP_PERI() (unstable)),
671        (LP_TEE <= LP_TEE() (unstable)), (LP_TIMER <= LP_TIMER() (unstable)), (LP_UART <=
672        LP_UART() (unstable)), (LP_WDT <= LP_WDT() (unstable)), (LPWR <= LP_CLKRST()
673        (unstable)), (MCPWM0 <= MCPWM0() (unstable)), (MEM_MONITOR <= MEM_MONITOR()
674        (unstable)), (MODEM_LPCON <= MODEM_LPCON() (unstable)), (MODEM_SYSCON <=
675        MODEM_SYSCON() (unstable)), (OTP_DEBUG <= OTP_DEBUG() (unstable)), (PARL_IO <=
676        PARL_IO(PARL_IO : { bind_peri_interrupt, enable_peri_interrupt,
677        disable_peri_interrupt }) (unstable)), (PAU <= PAU() (unstable)), (PCNT <= PCNT()
678        (unstable)), (PCR <= PCR() (unstable)), (PLIC_MX <= PLIC_MX() (unstable)), (PMU
679        <= PMU() (unstable)), (RMT <= RMT() (unstable)), (RNG <= RNG() (unstable)), (RSA
680        <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
681        }) (unstable)), (SHA <= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt,
682        disable_peri_interrupt }) (unstable)), (SLCHOST <= SLCHOST() (unstable)), (ETM <=
683        SOC_ETM() (unstable)), (SPI0 <= SPI0() (unstable)), (SPI1 <= SPI1() (unstable)),
684        (SPI2 <= SPI2(SPI2 : { bind_peri_interrupt, enable_peri_interrupt,
685        disable_peri_interrupt })), (SYSTEM <= PCR() (unstable)), (SYSTIMER <= SYSTIMER()
686        (unstable)), (TEE <= TEE() (unstable)), (TIMG0 <= TIMG0() (unstable)), (TIMG1 <=
687        TIMG1() (unstable)), (TRACE0 <= TRACE() (unstable)), (TWAI0 <= TWAI0()
688        (unstable)), (TWAI1 <= TWAI1() (unstable)), (UART0 <= UART0(UART0 : {
689        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (UART1 <=
690        UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
691        disable_peri_interrupt })), (UHCI0 <= UHCI0() (unstable)), (USB_DEVICE <=
692        USB_DEVICE(USB_DEVICE : { bind_peri_interrupt, enable_peri_interrupt,
693        disable_peri_interrupt }) (unstable)), (DMA_CH0 <= virtual() (unstable)),
694        (DMA_CH1 <= virtual() (unstable)), (DMA_CH2 <= virtual() (unstable)), (ADC1 <=
695        virtual() (unstable)), (BT <= virtual() (unstable)), (FLASH <= virtual()
696        (unstable)), (LP_CORE <= virtual() (unstable)), (SW_INTERRUPT <= virtual()
697        (unstable)), (TSENS <= virtual() (unstable)), (WIFI <= virtual() (unstable)),
698        (MEM2MEM1 <= virtual() (unstable)), (MEM2MEM4 <= virtual() (unstable)), (MEM2MEM5
699        <= virtual() (unstable)), (MEM2MEM10 <= virtual() (unstable)), (MEM2MEM11 <=
700        virtual() (unstable)), (MEM2MEM12 <= virtual() (unstable)), (MEM2MEM13 <=
701        virtual() (unstable)), (MEM2MEM14 <= virtual() (unstable)), (MEM2MEM15 <=
702        virtual() (unstable))));
703    };
704}
705/// This macro can be used to generate code for each `GPIOn` instance.
706///
707/// For an explanation on the general syntax, as well as usage of individual/repeated
708/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
709///
710/// This macro has one option for its "Individual matcher" case:
711///
712/// Syntax: `($n:literal, $gpio:ident ($($digital_input_function:ident =>
713/// $digital_input_signal:ident)*) ($($digital_output_function:ident =>
714/// $digital_output_signal:ident)*) ($([$pin_attribute:ident])*))`
715///
716/// Macro fragments:
717///
718/// - `$n`: the number of the GPIO. For `GPIO0`, `$n` is 0.
719/// - `$gpio`: the name of the GPIO.
720/// - `$digital_input_function`: the number of the digital function, as an identifier (i.e. for
721///   function 0 this is `_0`).
722/// - `$digital_input_function`: the name of the digital function, as an identifier.
723/// - `$digital_output_function`: the number of the digital function, as an identifier (i.e. for
724///   function 0 this is `_0`).
725/// - `$digital_output_function`: the name of the digital function, as an identifier.
726/// - `$pin_attribute`: `Input` and/or `Output`, marks the possible directions of the GPIO.
727///   Bracketed so that they can also be matched as optional fragments. Order is always Input first.
728///
729/// Example data: `(0, GPIO0 (_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input]
730/// [Output]))`
731#[macro_export]
732#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
733macro_rules! for_each_gpio {
734    ($($pattern:tt => $code:tt;)*) => {
735        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
736        _for_each_inner!((0, GPIO0() () ([Input] [Output]))); _for_each_inner!((1,
737        GPIO1() () ([Input] [Output]))); _for_each_inner!((2, GPIO2(_2 => FSPIQ) (_2 =>
738        FSPIQ) ([Input] [Output]))); _for_each_inner!((3, GPIO3() () ([Input]
739        [Output]))); _for_each_inner!((4, GPIO4(_0 => MTMS _2 => FSPIHD) (_2 => FSPIHD)
740        ([Input] [Output]))); _for_each_inner!((5, GPIO5(_0 => MTDI _2 => FSPIWP) (_2 =>
741        FSPIWP) ([Input] [Output]))); _for_each_inner!((6, GPIO6(_0 => MTCK _2 =>
742        FSPICLK) (_2 => FSPICLK) ([Input] [Output]))); _for_each_inner!((7, GPIO7(_2 =>
743        FSPID) (_0 => MTDO _2 => FSPID) ([Input] [Output]))); _for_each_inner!((8,
744        GPIO8() () ([Input] [Output]))); _for_each_inner!((9, GPIO9() () ([Input]
745        [Output]))); _for_each_inner!((10, GPIO10() () ([Input] [Output])));
746        _for_each_inner!((11, GPIO11() () ([Input] [Output]))); _for_each_inner!((12,
747        GPIO12() () ([Input] [Output]))); _for_each_inner!((13, GPIO13() () ([Input]
748        [Output]))); _for_each_inner!((14, GPIO14() () ([Input] [Output])));
749        _for_each_inner!((15, GPIO15() () ([Input] [Output]))); _for_each_inner!((16,
750        GPIO16(_2 => FSPICS0) (_0 => U0TXD _2 => FSPICS0) ([Input] [Output])));
751        _for_each_inner!((17, GPIO17(_0 => U0RXD) (_2 => FSPICS1) ([Input] [Output])));
752        _for_each_inner!((18, GPIO18(_0 => SDIO_CMD) (_0 => SDIO_CMD _2 => FSPICS2)
753        ([Input] [Output]))); _for_each_inner!((19, GPIO19() (_0 => SDIO_CLK _2 =>
754        FSPICS3) ([Input] [Output]))); _for_each_inner!((20, GPIO20(_0 => SDIO_DATA0) (_0
755        => SDIO_DATA0 _2 => FSPICS4) ([Input] [Output]))); _for_each_inner!((21,
756        GPIO21(_0 => SDIO_DATA1) (_0 => SDIO_DATA1 _2 => FSPICS5) ([Input] [Output])));
757        _for_each_inner!((22, GPIO22(_0 => SDIO_DATA2) (_0 => SDIO_DATA2) ([Input]
758        [Output]))); _for_each_inner!((23, GPIO23(_0 => SDIO_DATA3) (_0 => SDIO_DATA3)
759        ([Input] [Output]))); _for_each_inner!((27, GPIO27() () ([Input] [Output])));
760        _for_each_inner!((all(0, GPIO0() () ([Input] [Output])), (1, GPIO1() () ([Input]
761        [Output])), (2, GPIO2(_2 => FSPIQ) (_2 => FSPIQ) ([Input] [Output])), (3, GPIO3()
762        () ([Input] [Output])), (4, GPIO4(_0 => MTMS _2 => FSPIHD) (_2 => FSPIHD)
763        ([Input] [Output])), (5, GPIO5(_0 => MTDI _2 => FSPIWP) (_2 => FSPIWP) ([Input]
764        [Output])), (6, GPIO6(_0 => MTCK _2 => FSPICLK) (_2 => FSPICLK) ([Input]
765        [Output])), (7, GPIO7(_2 => FSPID) (_0 => MTDO _2 => FSPID) ([Input] [Output])),
766        (8, GPIO8() () ([Input] [Output])), (9, GPIO9() () ([Input] [Output])), (10,
767        GPIO10() () ([Input] [Output])), (11, GPIO11() () ([Input] [Output])), (12,
768        GPIO12() () ([Input] [Output])), (13, GPIO13() () ([Input] [Output])), (14,
769        GPIO14() () ([Input] [Output])), (15, GPIO15() () ([Input] [Output])), (16,
770        GPIO16(_2 => FSPICS0) (_0 => U0TXD _2 => FSPICS0) ([Input] [Output])), (17,
771        GPIO17(_0 => U0RXD) (_2 => FSPICS1) ([Input] [Output])), (18, GPIO18(_0 =>
772        SDIO_CMD) (_0 => SDIO_CMD _2 => FSPICS2) ([Input] [Output])), (19, GPIO19() (_0
773        => SDIO_CLK _2 => FSPICS3) ([Input] [Output])), (20, GPIO20(_0 => SDIO_DATA0) (_0
774        => SDIO_DATA0 _2 => FSPICS4) ([Input] [Output])), (21, GPIO21(_0 => SDIO_DATA1)
775        (_0 => SDIO_DATA1 _2 => FSPICS5) ([Input] [Output])), (22, GPIO22(_0 =>
776        SDIO_DATA2) (_0 => SDIO_DATA2) ([Input] [Output])), (23, GPIO23(_0 => SDIO_DATA3)
777        (_0 => SDIO_DATA3) ([Input] [Output])), (27, GPIO27() () ([Input] [Output]))));
778    };
779}
780/// This macro can be used to generate code for each analog function of each GPIO.
781///
782/// For an explanation on the general syntax, as well as usage of individual/repeated
783/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
784///
785/// This macro has two options for its "Individual matcher" case:
786///
787/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
788/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
789///   expanded signal case, where you need the number(s) of a signal, or the general group to which
790///   the signal belongs. For example, in case of `ADC2_CH3` the expanded form looks like
791///   `(ADC2_CH3, ADCn_CHm, 2, 3)`.
792///
793/// Macro fragments:
794///
795/// - `$signal`: the name of the signal.
796/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
797///   is `ADCn_CHm`.
798/// - `$number`: the numbers extracted from `$signal`.
799/// - `$gpio`: the name of the GPIO.
800///
801/// Example data:
802/// - `(ADC2_CH5, GPIO12)`
803/// - `((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12)`
804///
805/// The expanded syntax is only available when the signal has at least one numbered component.
806#[macro_export]
807#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
808macro_rules! for_each_analog_function {
809    ($($pattern:tt => $code:tt;)*) => {
810        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
811        _for_each_inner!((XTAL_32K_P, GPIO0)); _for_each_inner!((ADC0_CH0, GPIO0));
812        _for_each_inner!((XTAL_32K_N, GPIO1)); _for_each_inner!((ADC0_CH1, GPIO1));
813        _for_each_inner!((ADC0_CH2, GPIO2)); _for_each_inner!((ADC0_CH3, GPIO3));
814        _for_each_inner!((ADC0_CH4, GPIO4)); _for_each_inner!((ADC0_CH5, GPIO5));
815        _for_each_inner!((ADC0_CH6, GPIO6)); _for_each_inner!((USB_DM, GPIO12));
816        _for_each_inner!((USB_DP, GPIO13)); _for_each_inner!(((ADC0_CH0, ADCn_CHm, 0, 0),
817        GPIO0)); _for_each_inner!(((ADC0_CH1, ADCn_CHm, 0, 1), GPIO1));
818        _for_each_inner!(((ADC0_CH2, ADCn_CHm, 0, 2), GPIO2));
819        _for_each_inner!(((ADC0_CH3, ADCn_CHm, 0, 3), GPIO3));
820        _for_each_inner!(((ADC0_CH4, ADCn_CHm, 0, 4), GPIO4));
821        _for_each_inner!(((ADC0_CH5, ADCn_CHm, 0, 5), GPIO5));
822        _for_each_inner!(((ADC0_CH6, ADCn_CHm, 0, 6), GPIO6));
823        _for_each_inner!((all(XTAL_32K_P, GPIO0), (ADC0_CH0, GPIO0), (XTAL_32K_N, GPIO1),
824        (ADC0_CH1, GPIO1), (ADC0_CH2, GPIO2), (ADC0_CH3, GPIO3), (ADC0_CH4, GPIO4),
825        (ADC0_CH5, GPIO5), (ADC0_CH6, GPIO6), (USB_DM, GPIO12), (USB_DP, GPIO13)));
826        _for_each_inner!((all_expanded((ADC0_CH0, ADCn_CHm, 0, 0), GPIO0), ((ADC0_CH1,
827        ADCn_CHm, 0, 1), GPIO1), ((ADC0_CH2, ADCn_CHm, 0, 2), GPIO2), ((ADC0_CH3,
828        ADCn_CHm, 0, 3), GPIO3), ((ADC0_CH4, ADCn_CHm, 0, 4), GPIO4), ((ADC0_CH5,
829        ADCn_CHm, 0, 5), GPIO5), ((ADC0_CH6, ADCn_CHm, 0, 6), GPIO6)));
830    };
831}
832/// This macro can be used to generate code for each LP/RTC function of each GPIO.
833///
834/// For an explanation on the general syntax, as well as usage of individual/repeated
835/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
836///
837/// This macro has two options for its "Individual matcher" case:
838///
839/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
840/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
841///   expanded signal case, where you need the number(s) of a signal, or the general group to which
842///   the signal belongs. For example, in case of `SAR_I2C_SCL_1` the expanded form looks like
843///   `(SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1)`.
844///
845/// Macro fragments:
846///
847/// - `$signal`: the name of the signal.
848/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
849///   is `ADCn_CHm`.
850/// - `$number`: the numbers extracted from `$signal`.
851/// - `$gpio`: the name of the GPIO.
852///
853/// Example data:
854/// - `(RTC_GPIO15, GPIO12)`
855/// - `((RTC_GPIO15, RTC_GPIOn, 15), GPIO12)`
856///
857/// The expanded syntax is only available when the signal has at least one numbered component.
858#[macro_export]
859#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
860macro_rules! for_each_lp_function {
861    ($($pattern:tt => $code:tt;)*) => {
862        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
863        _for_each_inner!((LP_GPIO0, GPIO0)); _for_each_inner!((LP_UART_DTRN, GPIO0));
864        _for_each_inner!((LP_GPIO1, GPIO1)); _for_each_inner!((LP_UART_DSRN, GPIO1));
865        _for_each_inner!((LP_GPIO2, GPIO2)); _for_each_inner!((LP_UART_RTSN, GPIO2));
866        _for_each_inner!((LP_GPIO3, GPIO3)); _for_each_inner!((LP_UART_CTSN, GPIO3));
867        _for_each_inner!((LP_GPIO4, GPIO4)); _for_each_inner!((LP_UART_RXD, GPIO4));
868        _for_each_inner!((LP_GPIO5, GPIO5)); _for_each_inner!((LP_UART_TXD, GPIO5));
869        _for_each_inner!((LP_GPIO6, GPIO6)); _for_each_inner!((LP_I2C_SDA, GPIO6));
870        _for_each_inner!((LP_GPIO7, GPIO7)); _for_each_inner!((LP_I2C_SCL, GPIO7));
871        _for_each_inner!(((LP_GPIO0, LP_GPIOn, 0), GPIO0)); _for_each_inner!(((LP_GPIO1,
872        LP_GPIOn, 1), GPIO1)); _for_each_inner!(((LP_GPIO2, LP_GPIOn, 2), GPIO2));
873        _for_each_inner!(((LP_GPIO3, LP_GPIOn, 3), GPIO3)); _for_each_inner!(((LP_GPIO4,
874        LP_GPIOn, 4), GPIO4)); _for_each_inner!(((LP_GPIO5, LP_GPIOn, 5), GPIO5));
875        _for_each_inner!(((LP_GPIO6, LP_GPIOn, 6), GPIO6)); _for_each_inner!(((LP_GPIO7,
876        LP_GPIOn, 7), GPIO7)); _for_each_inner!((all(LP_GPIO0, GPIO0), (LP_UART_DTRN,
877        GPIO0), (LP_GPIO1, GPIO1), (LP_UART_DSRN, GPIO1), (LP_GPIO2, GPIO2),
878        (LP_UART_RTSN, GPIO2), (LP_GPIO3, GPIO3), (LP_UART_CTSN, GPIO3), (LP_GPIO4,
879        GPIO4), (LP_UART_RXD, GPIO4), (LP_GPIO5, GPIO5), (LP_UART_TXD, GPIO5), (LP_GPIO6,
880        GPIO6), (LP_I2C_SDA, GPIO6), (LP_GPIO7, GPIO7), (LP_I2C_SCL, GPIO7)));
881        _for_each_inner!((all_expanded((LP_GPIO0, LP_GPIOn, 0), GPIO0), ((LP_GPIO1,
882        LP_GPIOn, 1), GPIO1), ((LP_GPIO2, LP_GPIOn, 2), GPIO2), ((LP_GPIO3, LP_GPIOn, 3),
883        GPIO3), ((LP_GPIO4, LP_GPIOn, 4), GPIO4), ((LP_GPIO5, LP_GPIOn, 5), GPIO5),
884        ((LP_GPIO6, LP_GPIOn, 6), GPIO6), ((LP_GPIO7, LP_GPIOn, 7), GPIO7)));
885    };
886}
887/// Defines the `InputSignal` and `OutputSignal` enums.
888///
889/// This macro is intended to be called in esp-hal only.
890#[macro_export]
891#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
892macro_rules! define_io_mux_signals {
893    () => {
894        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
895        #[derive(Debug, PartialEq, Copy, Clone)]
896        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
897        #[doc(hidden)]
898        pub enum InputSignal {
899            EXT_ADC_START       = 0,
900            U0RXD               = 6,
901            U0CTS               = 7,
902            U0DSR               = 8,
903            U1RXD               = 9,
904            U1CTS               = 10,
905            U1DSR               = 11,
906            I2S_MCLK            = 12,
907            I2SO_BCK            = 13,
908            I2SO_WS             = 14,
909            I2SI_SD             = 15,
910            I2SI_BCK            = 16,
911            I2SI_WS             = 17,
912            USB_JTAG_TDO_BRIDGE = 19,
913            CPU_TESTBUS0        = 20,
914            CPU_TESTBUS1        = 21,
915            CPU_TESTBUS2        = 22,
916            CPU_TESTBUS3        = 23,
917            CPU_TESTBUS4        = 24,
918            CPU_TESTBUS5        = 25,
919            CPU_TESTBUS6        = 26,
920            CPU_TESTBUS7        = 27,
921            CPU_GPIO_IN0        = 28,
922            CPU_GPIO_IN1        = 29,
923            CPU_GPIO_IN2        = 30,
924            CPU_GPIO_IN3        = 31,
925            CPU_GPIO_IN4        = 32,
926            CPU_GPIO_IN5        = 33,
927            CPU_GPIO_IN6        = 34,
928            CPU_GPIO_IN7        = 35,
929            USB_JTAG_TMS        = 37,
930            USB_EXTPHY_OEN      = 40,
931            USB_EXTPHY_VM       = 41,
932            USB_EXTPHY_VPO      = 42,
933            I2CEXT0_SCL         = 45,
934            I2CEXT0_SDA         = 46,
935            PARL_RX_DATA0       = 47,
936            PARL_RX_DATA1       = 48,
937            PARL_RX_DATA2       = 49,
938            PARL_RX_DATA3       = 50,
939            PARL_RX_DATA4       = 51,
940            PARL_RX_DATA5       = 52,
941            PARL_RX_DATA6       = 53,
942            PARL_RX_DATA7       = 54,
943            PARL_RX_DATA8       = 55,
944            PARL_RX_DATA9       = 56,
945            PARL_RX_DATA10      = 57,
946            PARL_RX_DATA11      = 58,
947            PARL_RX_DATA12      = 59,
948            PARL_RX_DATA13      = 60,
949            PARL_RX_DATA14      = 61,
950            PARL_RX_DATA15      = 62,
951            FSPICLK             = 63,
952            FSPIQ               = 64,
953            FSPID               = 65,
954            FSPIHD              = 66,
955            FSPIWP              = 67,
956            FSPICS0             = 68,
957            PARL_RX_CLK         = 69,
958            PARL_TX_CLK         = 70,
959            RMT_SIG_0           = 71,
960            RMT_SIG_1           = 72,
961            TWAI0_RX            = 73,
962            TWAI1_RX            = 77,
963            PWM0_SYNC0          = 87,
964            PWM0_SYNC1          = 88,
965            PWM0_SYNC2          = 89,
966            PWM0_F0             = 90,
967            PWM0_F1             = 91,
968            PWM0_F2             = 92,
969            PWM0_CAP0           = 93,
970            PWM0_CAP1           = 94,
971            PWM0_CAP2           = 95,
972            SIG_IN_FUNC97       = 97,
973            SIG_IN_FUNC98       = 98,
974            SIG_IN_FUNC99       = 99,
975            SIG_IN_FUNC100      = 100,
976            PCNT0_SIG_CH0       = 101,
977            PCNT0_SIG_CH1       = 102,
978            PCNT0_CTRL_CH0      = 103,
979            PCNT0_CTRL_CH1      = 104,
980            PCNT1_SIG_CH0       = 105,
981            PCNT1_SIG_CH1       = 106,
982            PCNT1_CTRL_CH0      = 107,
983            PCNT1_CTRL_CH1      = 108,
984            PCNT2_SIG_CH0       = 109,
985            PCNT2_SIG_CH1       = 110,
986            PCNT2_CTRL_CH0      = 111,
987            PCNT2_CTRL_CH1      = 112,
988            PCNT3_SIG_CH0       = 113,
989            PCNT3_SIG_CH1       = 114,
990            PCNT3_CTRL_CH0      = 115,
991            PCNT3_CTRL_CH1      = 116,
992            SPIQ                = 121,
993            SPID                = 122,
994            SPIHD               = 123,
995            SPIWP               = 124,
996            SDIO_CMD,
997            SDIO_DATA0,
998            SDIO_DATA1,
999            SDIO_DATA2,
1000            SDIO_DATA3,
1001            MTDI,
1002            MTCK,
1003            MTMS,
1004        }
1005        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
1006        #[derive(Debug, PartialEq, Copy, Clone)]
1007        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
1008        #[doc(hidden)]
1009        pub enum OutputSignal {
1010            LEDC_LS_SIG0          = 0,
1011            LEDC_LS_SIG1          = 1,
1012            LEDC_LS_SIG2          = 2,
1013            LEDC_LS_SIG3          = 3,
1014            LEDC_LS_SIG4          = 4,
1015            LEDC_LS_SIG5          = 5,
1016            U0TXD                 = 6,
1017            U0RTS                 = 7,
1018            U0DTR                 = 8,
1019            U1TXD                 = 9,
1020            U1RTS                 = 10,
1021            U1DTR                 = 11,
1022            I2S_MCLK              = 12,
1023            I2SO_BCK              = 13,
1024            I2SO_WS               = 14,
1025            I2SO_SD               = 15,
1026            I2SI_BCK              = 16,
1027            I2SI_WS               = 17,
1028            I2SO_SD1              = 18,
1029            USB_JTAG_TDO_BRIDGE   = 19,
1030            CPU_TESTBUS0          = 20,
1031            CPU_TESTBUS1          = 21,
1032            CPU_TESTBUS2          = 22,
1033            CPU_TESTBUS3          = 23,
1034            CPU_TESTBUS4          = 24,
1035            CPU_TESTBUS5          = 25,
1036            CPU_TESTBUS6          = 26,
1037            CPU_TESTBUS7          = 27,
1038            CPU_GPIO_OUT0         = 28,
1039            CPU_GPIO_OUT1         = 29,
1040            CPU_GPIO_OUT2         = 30,
1041            CPU_GPIO_OUT3         = 31,
1042            CPU_GPIO_OUT4         = 32,
1043            CPU_GPIO_OUT5         = 33,
1044            CPU_GPIO_OUT6         = 34,
1045            CPU_GPIO_OUT7         = 35,
1046            USB_JTAG_TCK          = 36,
1047            USB_JTAG_TMS          = 37,
1048            USB_JTAG_TDI          = 38,
1049            USB_JTAG_TDO          = 39,
1050            I2CEXT0_SCL           = 45,
1051            I2CEXT0_SDA           = 46,
1052            PARL_TX_DATA0         = 47,
1053            PARL_TX_DATA1         = 48,
1054            PARL_TX_DATA2         = 49,
1055            PARL_TX_DATA3         = 50,
1056            PARL_TX_DATA4         = 51,
1057            PARL_TX_DATA5         = 52,
1058            PARL_TX_DATA6         = 53,
1059            PARL_TX_DATA7         = 54,
1060            PARL_TX_DATA8         = 55,
1061            PARL_TX_DATA9         = 56,
1062            PARL_TX_DATA10        = 57,
1063            PARL_TX_DATA11        = 58,
1064            PARL_TX_DATA12        = 59,
1065            PARL_TX_DATA13        = 60,
1066            PARL_TX_DATA14        = 61,
1067            PARL_TX_DATA15        = 62,
1068            FSPICLK               = 63,
1069            FSPIQ                 = 64,
1070            FSPID                 = 65,
1071            FSPIHD                = 66,
1072            FSPIWP                = 67,
1073            FSPICS0               = 68,
1074            SDIO_TOHOST_INT       = 69,
1075            PARL_TX_CLK           = 70,
1076            RMT_SIG_0             = 71,
1077            RMT_SIG_1             = 72,
1078            TWAI0_TX              = 73,
1079            TWAI0_BUS_OFF_ON      = 74,
1080            TWAI0_CLKOUT          = 75,
1081            TWAI0_STANDBY         = 76,
1082            TWAI1_TX              = 77,
1083            TWAI1_BUS_OFF_ON      = 78,
1084            TWAI1_CLKOUT          = 79,
1085            TWAI1_STANDBY         = 80,
1086            GPIO_SD0              = 83,
1087            GPIO_SD1              = 84,
1088            GPIO_SD2              = 85,
1089            GPIO_SD3              = 86,
1090            PWM0_0A               = 87,
1091            PWM0_0B               = 88,
1092            PWM0_1A               = 89,
1093            PWM0_1B               = 90,
1094            PWM0_2A               = 91,
1095            PWM0_2B               = 92,
1096            SIG_IN_FUNC97         = 97,
1097            SIG_IN_FUNC98         = 98,
1098            SIG_IN_FUNC99         = 99,
1099            SIG_IN_FUNC100        = 100,
1100            FSPICS1               = 101,
1101            FSPICS2               = 102,
1102            FSPICS3               = 103,
1103            FSPICS4               = 104,
1104            FSPICS5               = 105,
1105            SPICLK                = 114,
1106            SPICS0                = 115,
1107            SPICS1                = 116,
1108            GPIO_TASK_MATRIX_OUT0 = 117,
1109            GPIO_TASK_MATRIX_OUT1 = 118,
1110            GPIO_TASK_MATRIX_OUT2 = 119,
1111            GPIO_TASK_MATRIX_OUT3 = 120,
1112            SPIQ                  = 121,
1113            SPID                  = 122,
1114            SPIHD                 = 123,
1115            SPIWP                 = 124,
1116            CLK_OUT_OUT1          = 125,
1117            CLK_OUT_OUT2          = 126,
1118            CLK_OUT_OUT3          = 127,
1119            GPIO                  = 128,
1120            SDIO_CLK,
1121            SDIO_CMD,
1122            SDIO_DATA0,
1123            SDIO_DATA1,
1124            SDIO_DATA2,
1125            SDIO_DATA3,
1126            MTDO,
1127        }
1128    };
1129}
1130/// Defines and implements the `io_mux_reg` function.
1131///
1132/// The generated function has the following signature:
1133///
1134/// ```rust,ignore
1135/// pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO0 {
1136///     // ...
1137/// # unimplemented!()
1138/// }
1139/// ```
1140///
1141/// This macro is intended to be called in esp-hal only.
1142#[macro_export]
1143#[expect(clippy::crate_in_macro_def)]
1144#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
1145macro_rules! define_io_mux_reg {
1146    () => {
1147        pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
1148            crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
1149        }
1150    };
1151}