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