#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! chip {
() => {
"esp32s3"
};
}
#[doc = concat!("assert_eq!(chip_name, ", chip_pretty!(), ")")]
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! chip_pretty {
() => {
"ESP32-S3"
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! property {
("chip") => {
"esp32s3"
};
("arch") => {
"xtensa"
};
("cores") => {
2
};
("cores", str) => {
stringify!(2)
};
("trm") => {
"https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf"
};
("aes.dma") => {
true
};
("aes.has_split_text_registers") => {
true
};
("aes.endianness_configurable") => {
false
};
("assist_debug.has_sp_monitor") => {
false
};
("assist_debug.has_region_monitor") => {
true
};
("bt.controller") => {
"btdm"
};
("dedicated_gpio.needs_initialization") => {
true
};
("dedicated_gpio.channel_count") => {
8
};
("dedicated_gpio.channel_count", str) => {
stringify!(8)
};
("dma.kind") => {
"gdma"
};
("dma.supports_mem2mem") => {
true
};
("dma.can_access_psram") => {
true
};
("dma.ext_mem_configurable_block_size") => {
true
};
("dma.separate_in_out_interrupts") => {
true
};
("dma.max_priority") => {
9
};
("dma.max_priority", str) => {
stringify!(9)
};
("dma.gdma_version") => {
1
};
("dma.gdma_version", str) => {
stringify!(1)
};
("gpio.has_bank_1") => {
true
};
("gpio.gpio_function") => {
1
};
("gpio.gpio_function", str) => {
stringify!(1)
};
("gpio.constant_0_input") => {
60
};
("gpio.constant_0_input", str) => {
stringify!(60)
};
("gpio.constant_1_input") => {
56
};
("gpio.constant_1_input", str) => {
stringify!(56)
};
("gpio.remap_iomux_pin_registers") => {
false
};
("gpio.func_in_sel_offset") => {
0
};
("gpio.func_in_sel_offset", str) => {
stringify!(0)
};
("gpio.input_signal_max") => {
255
};
("gpio.input_signal_max", str) => {
stringify!(255)
};
("gpio.output_signal_max") => {
256
};
("gpio.output_signal_max", str) => {
stringify!(256)
};
("i2c_master.has_fsm_timeouts") => {
true
};
("i2c_master.has_hw_bus_clear") => {
false
};
("i2c_master.has_bus_timeout_enable") => {
true
};
("i2c_master.separate_filter_config_registers") => {
false
};
("i2c_master.can_estimate_nack_reason") => {
true
};
("i2c_master.has_conf_update") => {
true
};
("i2c_master.has_reliable_fsm_reset") => {
false
};
("i2c_master.has_arbitration_en") => {
true
};
("i2c_master.has_tx_fifo_watermark") => {
true
};
("i2c_master.bus_timeout_is_exponential") => {
true
};
("i2c_master.max_bus_timeout") => {
31
};
("i2c_master.max_bus_timeout", str) => {
stringify!(31)
};
("i2c_master.ll_intr_mask") => {
262143
};
("i2c_master.ll_intr_mask", str) => {
stringify!(262143)
};
("i2c_master.fifo_size") => {
32
};
("i2c_master.fifo_size", str) => {
stringify!(32)
};
("interrupts.status_registers") => {
4
};
("interrupts.status_registers", str) => {
stringify!(4)
};
("phy.combo_module") => {
true
};
("phy.backed_up_digital_register_count") => {
21
};
("phy.backed_up_digital_register_count", str) => {
stringify!(21)
};
("psram.octal_spi") => {
true
};
("psram.extmem_origin") => {
1006632960
};
("psram.extmem_origin", str) => {
stringify!(1006632960)
};
("rmt.ram_start") => {
1610704896
};
("rmt.ram_start", str) => {
stringify!(1610704896)
};
("rmt.channel_ram_size") => {
48
};
("rmt.channel_ram_size", str) => {
stringify!(48)
};
("rmt.has_tx_immediate_stop") => {
true
};
("rmt.has_tx_loop_count") => {
true
};
("rmt.has_tx_loop_auto_stop") => {
true
};
("rmt.has_tx_carrier_data_only") => {
true
};
("rmt.has_tx_sync") => {
true
};
("rmt.has_rx_wrap") => {
true
};
("rmt.has_rx_demodulation") => {
true
};
("rmt.has_dma") => {
true
};
("rmt.has_per_channel_clock") => {
false
};
("rng.apb_cycle_wait_num") => {
16
};
("rng.apb_cycle_wait_num", str) => {
stringify!(16)
};
("rng.trng_supported") => {
true
};
("rsa.size_increment") => {
32
};
("rsa.size_increment", str) => {
stringify!(32)
};
("rsa.memory_size_bytes") => {
512
};
("rsa.memory_size_bytes", str) => {
stringify!(512)
};
("sha.dma") => {
true
};
("sleep.light_sleep") => {
true
};
("sleep.deep_sleep") => {
true
};
("soc.cpu_has_branch_predictor") => {
false
};
("soc.cpu_has_csr_pc") => {
false
};
("soc.multi_core_enabled") => {
true
};
("soc.rc_fast_clk_default") => {
17500000
};
("soc.rc_fast_clk_default", str) => {
stringify!(17500000)
};
("clock_tree.system_pre_div.divisor") => {
(0, 1023)
};
("clock_tree.rc_fast_clk_div_n.divisor") => {
(0, 3)
};
("clock_tree.uart.function_clock.div_num") => {
(0, 255)
};
("clock_tree.uart.baud_rate_generator.fractional") => {
(0, 15)
};
("clock_tree.uart.baud_rate_generator.integral") => {
(0, 4095)
};
("spi_master.supports_dma") => {
true
};
("spi_master.has_octal") => {
true
};
("spi_master.has_app_interrupts") => {
true
};
("spi_master.has_dma_segmented_transfer") => {
true
};
("spi_master.has_clk_pre_div") => {
false
};
("spi_slave.supports_dma") => {
true
};
("timergroup.timg_has_timer1") => {
true
};
("timergroup.timg_has_divcnt_rst") => {
false
};
("uart.ram_size") => {
128
};
("uart.ram_size", str) => {
stringify!(128)
};
("uart.peripheral_controls_mem_clk") => {
false
};
("uart.has_sclk_divider") => {
true
};
("uhci.combined_uart_selector_field") => {
false
};
("wifi.has_wifi6") => {
false
};
("wifi.mac_version") => {
1
};
("wifi.mac_version", str) => {
stringify!(1)
};
("wifi.has_5g") => {
false
};
("wifi.csi_supported") => {
true
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_aes_key_length {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_aes_key_length { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_aes_key_length!((128));
_for_each_inner_aes_key_length!((256)); _for_each_inner_aes_key_length!((128, 0,
4)); _for_each_inner_aes_key_length!((256, 2, 6));
_for_each_inner_aes_key_length!((bits(128), (256)));
_for_each_inner_aes_key_length!((modes(128, 0, 4), (256, 2, 6)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_dedicated_gpio {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_dedicated_gpio { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_dedicated_gpio!((0));
_for_each_inner_dedicated_gpio!((1)); _for_each_inner_dedicated_gpio!((2));
_for_each_inner_dedicated_gpio!((3)); _for_each_inner_dedicated_gpio!((4));
_for_each_inner_dedicated_gpio!((5)); _for_each_inner_dedicated_gpio!((6));
_for_each_inner_dedicated_gpio!((7)); _for_each_inner_dedicated_gpio!((0, 0,
PRO_ALONEGPIO0)); _for_each_inner_dedicated_gpio!((0, 1, PRO_ALONEGPIO1));
_for_each_inner_dedicated_gpio!((0, 2, PRO_ALONEGPIO2));
_for_each_inner_dedicated_gpio!((0, 3, PRO_ALONEGPIO3));
_for_each_inner_dedicated_gpio!((0, 4, PRO_ALONEGPIO4));
_for_each_inner_dedicated_gpio!((0, 5, PRO_ALONEGPIO5));
_for_each_inner_dedicated_gpio!((0, 6, PRO_ALONEGPIO6));
_for_each_inner_dedicated_gpio!((0, 7, PRO_ALONEGPIO7));
_for_each_inner_dedicated_gpio!((1, 0, CORE1_GPIO0));
_for_each_inner_dedicated_gpio!((1, 1, CORE1_GPIO1));
_for_each_inner_dedicated_gpio!((1, 2, CORE1_GPIO2));
_for_each_inner_dedicated_gpio!((1, 3, CORE1_GPIO3));
_for_each_inner_dedicated_gpio!((1, 4, CORE1_GPIO4));
_for_each_inner_dedicated_gpio!((1, 5, CORE1_GPIO5));
_for_each_inner_dedicated_gpio!((1, 6, CORE1_GPIO6));
_for_each_inner_dedicated_gpio!((1, 7, CORE1_GPIO7));
_for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
(7))); _for_each_inner_dedicated_gpio!((signals(0, 0, PRO_ALONEGPIO0), (0, 1,
PRO_ALONEGPIO1), (0, 2, PRO_ALONEGPIO2), (0, 3, PRO_ALONEGPIO3), (0, 4,
PRO_ALONEGPIO4), (0, 5, PRO_ALONEGPIO5), (0, 6, PRO_ALONEGPIO6), (0, 7,
PRO_ALONEGPIO7), (1, 0, CORE1_GPIO0), (1, 1, CORE1_GPIO1), (1, 2, CORE1_GPIO2),
(1, 3, CORE1_GPIO3), (1, 4, CORE1_GPIO4), (1, 5, CORE1_GPIO5), (1, 6,
CORE1_GPIO6), (1, 7, CORE1_GPIO7)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_sw_interrupt {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_sw_interrupt { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_sw_interrupt!((0, FROM_CPU_INTR0,
software_interrupt0)); _for_each_inner_sw_interrupt!((1, FROM_CPU_INTR1,
software_interrupt1)); _for_each_inner_sw_interrupt!((2, FROM_CPU_INTR2,
software_interrupt2)); _for_each_inner_sw_interrupt!((3, FROM_CPU_INTR3,
software_interrupt3)); _for_each_inner_sw_interrupt!((all(0, FROM_CPU_INTR0,
software_interrupt0), (1, FROM_CPU_INTR1, software_interrupt1), (2,
FROM_CPU_INTR2, software_interrupt2), (3, FROM_CPU_INTR3, software_interrupt3)));
};
}
#[macro_export]
macro_rules! sw_interrupt_delay {
() => {
unsafe {}
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rmt_channel {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_rmt_channel { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_rmt_channel!((0)); _for_each_inner_rmt_channel!((1));
_for_each_inner_rmt_channel!((2)); _for_each_inner_rmt_channel!((3));
_for_each_inner_rmt_channel!((4)); _for_each_inner_rmt_channel!((5));
_for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
_for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
_for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
_for_each_inner_rmt_channel!((4, 0)); _for_each_inner_rmt_channel!((5, 1));
_for_each_inner_rmt_channel!((6, 2)); _for_each_inner_rmt_channel!((7, 3));
_for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
_for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3)));
_for_each_inner_rmt_channel!((rx(4, 0), (5, 1), (6, 2), (7, 3)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rmt_clock_source {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_rmt_clock_source { $(($pattern) => $code;)* ($other
: tt) => {} } _for_each_inner_rmt_clock_source!((Apb, 1));
_for_each_inner_rmt_clock_source!((RcFast, 2));
_for_each_inner_rmt_clock_source!((Xtal, 3));
_for_each_inner_rmt_clock_source!((Apb));
_for_each_inner_rmt_clock_source!((all(Apb, 1), (RcFast, 2), (Xtal, 3)));
_for_each_inner_rmt_clock_source!((default(Apb)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rsa_exponentiation {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_rsa_exponentiation { $(($pattern) => $code;)*
($other : tt) => {} } _for_each_inner_rsa_exponentiation!((32));
_for_each_inner_rsa_exponentiation!((64));
_for_each_inner_rsa_exponentiation!((96));
_for_each_inner_rsa_exponentiation!((128));
_for_each_inner_rsa_exponentiation!((160));
_for_each_inner_rsa_exponentiation!((192));
_for_each_inner_rsa_exponentiation!((224));
_for_each_inner_rsa_exponentiation!((256));
_for_each_inner_rsa_exponentiation!((288));
_for_each_inner_rsa_exponentiation!((320));
_for_each_inner_rsa_exponentiation!((352));
_for_each_inner_rsa_exponentiation!((384));
_for_each_inner_rsa_exponentiation!((416));
_for_each_inner_rsa_exponentiation!((448));
_for_each_inner_rsa_exponentiation!((480));
_for_each_inner_rsa_exponentiation!((512));
_for_each_inner_rsa_exponentiation!((544));
_for_each_inner_rsa_exponentiation!((576));
_for_each_inner_rsa_exponentiation!((608));
_for_each_inner_rsa_exponentiation!((640));
_for_each_inner_rsa_exponentiation!((672));
_for_each_inner_rsa_exponentiation!((704));
_for_each_inner_rsa_exponentiation!((736));
_for_each_inner_rsa_exponentiation!((768));
_for_each_inner_rsa_exponentiation!((800));
_for_each_inner_rsa_exponentiation!((832));
_for_each_inner_rsa_exponentiation!((864));
_for_each_inner_rsa_exponentiation!((896));
_for_each_inner_rsa_exponentiation!((928));
_for_each_inner_rsa_exponentiation!((960));
_for_each_inner_rsa_exponentiation!((992));
_for_each_inner_rsa_exponentiation!((1024));
_for_each_inner_rsa_exponentiation!((1056));
_for_each_inner_rsa_exponentiation!((1088));
_for_each_inner_rsa_exponentiation!((1120));
_for_each_inner_rsa_exponentiation!((1152));
_for_each_inner_rsa_exponentiation!((1184));
_for_each_inner_rsa_exponentiation!((1216));
_for_each_inner_rsa_exponentiation!((1248));
_for_each_inner_rsa_exponentiation!((1280));
_for_each_inner_rsa_exponentiation!((1312));
_for_each_inner_rsa_exponentiation!((1344));
_for_each_inner_rsa_exponentiation!((1376));
_for_each_inner_rsa_exponentiation!((1408));
_for_each_inner_rsa_exponentiation!((1440));
_for_each_inner_rsa_exponentiation!((1472));
_for_each_inner_rsa_exponentiation!((1504));
_for_each_inner_rsa_exponentiation!((1536));
_for_each_inner_rsa_exponentiation!((1568));
_for_each_inner_rsa_exponentiation!((1600));
_for_each_inner_rsa_exponentiation!((1632));
_for_each_inner_rsa_exponentiation!((1664));
_for_each_inner_rsa_exponentiation!((1696));
_for_each_inner_rsa_exponentiation!((1728));
_for_each_inner_rsa_exponentiation!((1760));
_for_each_inner_rsa_exponentiation!((1792));
_for_each_inner_rsa_exponentiation!((1824));
_for_each_inner_rsa_exponentiation!((1856));
_for_each_inner_rsa_exponentiation!((1888));
_for_each_inner_rsa_exponentiation!((1920));
_for_each_inner_rsa_exponentiation!((1952));
_for_each_inner_rsa_exponentiation!((1984));
_for_each_inner_rsa_exponentiation!((2016));
_for_each_inner_rsa_exponentiation!((2048));
_for_each_inner_rsa_exponentiation!((2080));
_for_each_inner_rsa_exponentiation!((2112));
_for_each_inner_rsa_exponentiation!((2144));
_for_each_inner_rsa_exponentiation!((2176));
_for_each_inner_rsa_exponentiation!((2208));
_for_each_inner_rsa_exponentiation!((2240));
_for_each_inner_rsa_exponentiation!((2272));
_for_each_inner_rsa_exponentiation!((2304));
_for_each_inner_rsa_exponentiation!((2336));
_for_each_inner_rsa_exponentiation!((2368));
_for_each_inner_rsa_exponentiation!((2400));
_for_each_inner_rsa_exponentiation!((2432));
_for_each_inner_rsa_exponentiation!((2464));
_for_each_inner_rsa_exponentiation!((2496));
_for_each_inner_rsa_exponentiation!((2528));
_for_each_inner_rsa_exponentiation!((2560));
_for_each_inner_rsa_exponentiation!((2592));
_for_each_inner_rsa_exponentiation!((2624));
_for_each_inner_rsa_exponentiation!((2656));
_for_each_inner_rsa_exponentiation!((2688));
_for_each_inner_rsa_exponentiation!((2720));
_for_each_inner_rsa_exponentiation!((2752));
_for_each_inner_rsa_exponentiation!((2784));
_for_each_inner_rsa_exponentiation!((2816));
_for_each_inner_rsa_exponentiation!((2848));
_for_each_inner_rsa_exponentiation!((2880));
_for_each_inner_rsa_exponentiation!((2912));
_for_each_inner_rsa_exponentiation!((2944));
_for_each_inner_rsa_exponentiation!((2976));
_for_each_inner_rsa_exponentiation!((3008));
_for_each_inner_rsa_exponentiation!((3040));
_for_each_inner_rsa_exponentiation!((3072));
_for_each_inner_rsa_exponentiation!((3104));
_for_each_inner_rsa_exponentiation!((3136));
_for_each_inner_rsa_exponentiation!((3168));
_for_each_inner_rsa_exponentiation!((3200));
_for_each_inner_rsa_exponentiation!((3232));
_for_each_inner_rsa_exponentiation!((3264));
_for_each_inner_rsa_exponentiation!((3296));
_for_each_inner_rsa_exponentiation!((3328));
_for_each_inner_rsa_exponentiation!((3360));
_for_each_inner_rsa_exponentiation!((3392));
_for_each_inner_rsa_exponentiation!((3424));
_for_each_inner_rsa_exponentiation!((3456));
_for_each_inner_rsa_exponentiation!((3488));
_for_each_inner_rsa_exponentiation!((3520));
_for_each_inner_rsa_exponentiation!((3552));
_for_each_inner_rsa_exponentiation!((3584));
_for_each_inner_rsa_exponentiation!((3616));
_for_each_inner_rsa_exponentiation!((3648));
_for_each_inner_rsa_exponentiation!((3680));
_for_each_inner_rsa_exponentiation!((3712));
_for_each_inner_rsa_exponentiation!((3744));
_for_each_inner_rsa_exponentiation!((3776));
_for_each_inner_rsa_exponentiation!((3808));
_for_each_inner_rsa_exponentiation!((3840));
_for_each_inner_rsa_exponentiation!((3872));
_for_each_inner_rsa_exponentiation!((3904));
_for_each_inner_rsa_exponentiation!((3936));
_for_each_inner_rsa_exponentiation!((3968));
_for_each_inner_rsa_exponentiation!((4000));
_for_each_inner_rsa_exponentiation!((4032));
_for_each_inner_rsa_exponentiation!((4064));
_for_each_inner_rsa_exponentiation!((4096));
_for_each_inner_rsa_exponentiation!((all(32), (64), (96), (128), (160), (192),
(224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
(576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
(928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
(1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
(1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
(1888), (1920), (1952), (1984), (2016), (2048), (2080), (2112), (2144), (2176),
(2208), (2240), (2272), (2304), (2336), (2368), (2400), (2432), (2464), (2496),
(2528), (2560), (2592), (2624), (2656), (2688), (2720), (2752), (2784), (2816),
(2848), (2880), (2912), (2944), (2976), (3008), (3040), (3072), (3104), (3136),
(3168), (3200), (3232), (3264), (3296), (3328), (3360), (3392), (3424), (3456),
(3488), (3520), (3552), (3584), (3616), (3648), (3680), (3712), (3744), (3776),
(3808), (3840), (3872), (3904), (3936), (3968), (4000), (4032), (4064), (4096)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rsa_multiplication {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
($other : tt) => {} } _for_each_inner_rsa_multiplication!((32));
_for_each_inner_rsa_multiplication!((64));
_for_each_inner_rsa_multiplication!((96));
_for_each_inner_rsa_multiplication!((128));
_for_each_inner_rsa_multiplication!((160));
_for_each_inner_rsa_multiplication!((192));
_for_each_inner_rsa_multiplication!((224));
_for_each_inner_rsa_multiplication!((256));
_for_each_inner_rsa_multiplication!((288));
_for_each_inner_rsa_multiplication!((320));
_for_each_inner_rsa_multiplication!((352));
_for_each_inner_rsa_multiplication!((384));
_for_each_inner_rsa_multiplication!((416));
_for_each_inner_rsa_multiplication!((448));
_for_each_inner_rsa_multiplication!((480));
_for_each_inner_rsa_multiplication!((512));
_for_each_inner_rsa_multiplication!((544));
_for_each_inner_rsa_multiplication!((576));
_for_each_inner_rsa_multiplication!((608));
_for_each_inner_rsa_multiplication!((640));
_for_each_inner_rsa_multiplication!((672));
_for_each_inner_rsa_multiplication!((704));
_for_each_inner_rsa_multiplication!((736));
_for_each_inner_rsa_multiplication!((768));
_for_each_inner_rsa_multiplication!((800));
_for_each_inner_rsa_multiplication!((832));
_for_each_inner_rsa_multiplication!((864));
_for_each_inner_rsa_multiplication!((896));
_for_each_inner_rsa_multiplication!((928));
_for_each_inner_rsa_multiplication!((960));
_for_each_inner_rsa_multiplication!((992));
_for_each_inner_rsa_multiplication!((1024));
_for_each_inner_rsa_multiplication!((1056));
_for_each_inner_rsa_multiplication!((1088));
_for_each_inner_rsa_multiplication!((1120));
_for_each_inner_rsa_multiplication!((1152));
_for_each_inner_rsa_multiplication!((1184));
_for_each_inner_rsa_multiplication!((1216));
_for_each_inner_rsa_multiplication!((1248));
_for_each_inner_rsa_multiplication!((1280));
_for_each_inner_rsa_multiplication!((1312));
_for_each_inner_rsa_multiplication!((1344));
_for_each_inner_rsa_multiplication!((1376));
_for_each_inner_rsa_multiplication!((1408));
_for_each_inner_rsa_multiplication!((1440));
_for_each_inner_rsa_multiplication!((1472));
_for_each_inner_rsa_multiplication!((1504));
_for_each_inner_rsa_multiplication!((1536));
_for_each_inner_rsa_multiplication!((1568));
_for_each_inner_rsa_multiplication!((1600));
_for_each_inner_rsa_multiplication!((1632));
_for_each_inner_rsa_multiplication!((1664));
_for_each_inner_rsa_multiplication!((1696));
_for_each_inner_rsa_multiplication!((1728));
_for_each_inner_rsa_multiplication!((1760));
_for_each_inner_rsa_multiplication!((1792));
_for_each_inner_rsa_multiplication!((1824));
_for_each_inner_rsa_multiplication!((1856));
_for_each_inner_rsa_multiplication!((1888));
_for_each_inner_rsa_multiplication!((1920));
_for_each_inner_rsa_multiplication!((1952));
_for_each_inner_rsa_multiplication!((1984));
_for_each_inner_rsa_multiplication!((2016));
_for_each_inner_rsa_multiplication!((2048));
_for_each_inner_rsa_multiplication!((all(32), (64), (96), (128), (160), (192),
(224), (256), (288), (320), (352), (384), (416), (448), (480), (512), (544),
(576), (608), (640), (672), (704), (736), (768), (800), (832), (864), (896),
(928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184), (1216),
(1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504), (1536),
(1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824), (1856),
(1888), (1920), (1952), (1984), (2016), (2048)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_sha_algorithm {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
(insecure_against : "collision", "length extension"), 0));
_for_each_inner_sha_algorithm!((Sha224, "SHA-224"(sizes : 64, 28, 8)
(insecure_against : "length extension"), 1));
_for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
(insecure_against : "length extension"), 2));
_for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
(insecure_against :), 3)); _for_each_inner_sha_algorithm!((Sha512,
"SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4));
_for_each_inner_sha_algorithm!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
(insecure_against :), 5)); _for_each_inner_sha_algorithm!((Sha512_256,
"SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6));
_for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
(insecure_against : "collision", "length extension"), 0), (Sha224,
"SHA-224"(sizes : 64, 28, 8) (insecure_against : "length extension"), 1),
(Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"),
2), (Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 3), (Sha512,
"SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 4),
(Sha512_224, "SHA-512/224"(sizes : 128, 28, 16) (insecure_against :), 5),
(Sha512_256, "SHA-512/256"(sizes : 128, 32, 16) (insecure_against :), 6)));
};
}
#[macro_export]
macro_rules! define_clock_tree_types {
() => {
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum McpwmInstance {
Mcpwm0 = 0,
Mcpwm1 = 1,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RmtInstance {
Rmt = 0,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TimgInstance {
Timg0 = 0,
Timg1 = 1,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum UartInstance {
Uart0 = 0,
Uart1 = 1,
Uart2 = 2,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum XtalClkConfig {
_40,
}
impl XtalClkConfig {
pub fn value(&self) -> u32 {
match self {
XtalClkConfig::_40 => 40000000,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum PllClkConfig {
_320,
_480,
}
impl PllClkConfig {
pub fn value(&self) -> u32 {
match self {
PllClkConfig::_320 => 320000000,
PllClkConfig::_480 => 480000000,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SystemPreDivInConfig {
Xtal,
RcFast,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct SystemPreDivConfig {
divisor: u32,
}
impl SystemPreDivConfig {
pub const fn new(divisor: u32) -> Self {
::core::assert!(
divisor <= 1023,
"`SYSTEM_PRE_DIV` divisor must be between 0 and 1023 (inclusive)."
);
Self { divisor }
}
fn divisor(self) -> u32 {
self.divisor as u32
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CpuPllDivOutConfig {
_80,
_160,
_240,
}
impl CpuPllDivOutConfig {
pub fn value(&self) -> u32 {
match self {
CpuPllDivOutConfig::_80 => 80000000,
CpuPllDivOutConfig::_160 => 160000000,
CpuPllDivOutConfig::_240 => 240000000,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ApbClkConfig {
Pll,
Cpu,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CryptoPwmClkConfig {
Pll,
Cpu,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CpuClkConfig {
Xtal,
RcFast,
Pll,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct RcFastClkDivNConfig {
divisor: u32,
}
impl RcFastClkDivNConfig {
pub const fn new(divisor: u32) -> Self {
::core::assert!(
divisor <= 3,
"`RC_FAST_CLK_DIV_N` divisor must be between 0 and 3 (inclusive)."
);
Self { divisor }
}
fn divisor(self) -> u32 {
self.divisor as u32
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RtcSlowClkConfig {
Xtal32k,
RcSlow,
RcFast,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RtcFastClkConfig {
Xtal,
Rc,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum LowPowerClkConfig {
Xtal,
RcFast,
Xtal32k,
RtcSlow,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TimgCalibrationClockConfig {
RcSlowClk,
RcFastDivClk,
Xtal32kClk,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum McpwmFunctionClockConfig {
#[default]
CryptoPwmClk,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RmtSclkConfig {
#[default]
ApbClk,
RcFastClk,
XtalClk,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TimgFunctionClockConfig {
#[default]
XtalClk,
ApbClk,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum UartFunctionClockSclk {
Apb,
RcFast,
#[default]
Xtal,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct UartFunctionClockConfig {
sclk: UartFunctionClockSclk,
div_num: u32,
}
impl UartFunctionClockConfig {
pub const fn new(sclk: UartFunctionClockSclk, div_num: u32) -> Self {
::core::assert!(
div_num <= 255,
"`UART0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
);
Self { sclk, div_num }
}
fn sclk(self) -> UartFunctionClockSclk {
self.sclk
}
fn div_num(self) -> u32 {
self.div_num as u32
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct UartBaudRateGeneratorConfig {
fractional: u32,
integral: u32,
}
impl UartBaudRateGeneratorConfig {
pub const fn new(fractional: u32, integral: u32) -> Self {
::core::assert!(
fractional <= 15,
"`UART0_BAUD_RATE_GENERATOR` fractional must be between 0 and 15 (inclusive)."
);
::core::assert!(
integral <= 4095,
"`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 4095 (inclusive)."
);
Self {
fractional,
integral,
}
}
fn fractional(self) -> u32 {
self.fractional as u32
}
fn integral(self) -> u32 {
self.integral as u32
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct UartMemClockConfig {}
impl UartMemClockConfig {
pub const fn new() -> Self {
Self {}
}
}
pub struct ClockTree {
xtal_clk: Option<XtalClkConfig>,
pll_clk: Option<PllClkConfig>,
system_pre_div_in: Option<SystemPreDivInConfig>,
system_pre_div: Option<SystemPreDivConfig>,
cpu_pll_div_out: Option<CpuPllDivOutConfig>,
apb_clk: Option<ApbClkConfig>,
crypto_pwm_clk: Option<CryptoPwmClkConfig>,
cpu_clk: Option<CpuClkConfig>,
rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
rtc_slow_clk: Option<RtcSlowClkConfig>,
rtc_fast_clk: Option<RtcFastClkConfig>,
low_power_clk: Option<LowPowerClkConfig>,
timg_calibration_clock: Option<TimgCalibrationClockConfig>,
mcpwm_function_clock: [Option<McpwmFunctionClockConfig>; 2],
rmt_sclk: [Option<RmtSclkConfig>; 1],
timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
uart_function_clock: [Option<UartFunctionClockConfig>; 3],
uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 3],
uart_mem_clock: [Option<UartMemClockConfig>; 3],
pll_clk_refcount: u32,
rc_fast_clk_refcount: u32,
xtal32k_clk_refcount: u32,
rc_slow_clk_refcount: u32,
rc_fast_div_clk_refcount: u32,
apb_clk_refcount: u32,
crypto_pwm_clk_refcount: u32,
pll_d2_refcount: u32,
rtc_fast_clk_refcount: u32,
low_power_clk_refcount: u32,
uart_mem_clk_refcount: u32,
timg_calibration_clock_refcount: u32,
mcpwm_function_clock_refcount: [u32; 2],
rmt_sclk_refcount: [u32; 1],
timg_function_clock_refcount: [u32; 2],
uart_function_clock_refcount: [u32; 3],
uart_baud_rate_generator_refcount: [u32; 3],
uart_mem_clock_refcount: [u32; 3],
}
impl ClockTree {
pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
CLOCK_TREE.with(f)
}
pub fn xtal_clk(&self) -> Option<XtalClkConfig> {
self.xtal_clk
}
pub fn pll_clk(&self) -> Option<PllClkConfig> {
self.pll_clk
}
pub fn system_pre_div_in(&self) -> Option<SystemPreDivInConfig> {
self.system_pre_div_in
}
pub fn system_pre_div(&self) -> Option<SystemPreDivConfig> {
self.system_pre_div
}
pub fn cpu_pll_div_out(&self) -> Option<CpuPllDivOutConfig> {
self.cpu_pll_div_out
}
pub fn apb_clk(&self) -> Option<ApbClkConfig> {
self.apb_clk
}
pub fn crypto_pwm_clk(&self) -> Option<CryptoPwmClkConfig> {
self.crypto_pwm_clk
}
pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
self.cpu_clk
}
pub fn rc_fast_clk_div_n(&self) -> Option<RcFastClkDivNConfig> {
self.rc_fast_clk_div_n
}
pub fn rtc_slow_clk(&self) -> Option<RtcSlowClkConfig> {
self.rtc_slow_clk
}
pub fn rtc_fast_clk(&self) -> Option<RtcFastClkConfig> {
self.rtc_fast_clk
}
pub fn low_power_clk(&self) -> Option<LowPowerClkConfig> {
self.low_power_clk
}
pub fn timg_calibration_clock(&self) -> Option<TimgCalibrationClockConfig> {
self.timg_calibration_clock
}
pub fn mcpwm0_function_clock(&self) -> Option<McpwmFunctionClockConfig> {
self.mcpwm_function_clock[McpwmInstance::Mcpwm0 as usize]
}
pub fn mcpwm1_function_clock(&self) -> Option<McpwmFunctionClockConfig> {
self.mcpwm_function_clock[McpwmInstance::Mcpwm1 as usize]
}
pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
self.rmt_sclk[RmtInstance::Rmt as usize]
}
pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
self.timg_function_clock[TimgInstance::Timg0 as usize]
}
pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
self.timg_function_clock[TimgInstance::Timg1 as usize]
}
pub fn uart0_function_clock(&self) -> Option<UartFunctionClockConfig> {
self.uart_function_clock[UartInstance::Uart0 as usize]
}
pub fn uart0_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
self.uart_baud_rate_generator[UartInstance::Uart0 as usize]
}
pub fn uart0_mem_clock(&self) -> Option<UartMemClockConfig> {
self.uart_mem_clock[UartInstance::Uart0 as usize]
}
pub fn uart1_function_clock(&self) -> Option<UartFunctionClockConfig> {
self.uart_function_clock[UartInstance::Uart1 as usize]
}
pub fn uart1_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
self.uart_baud_rate_generator[UartInstance::Uart1 as usize]
}
pub fn uart1_mem_clock(&self) -> Option<UartMemClockConfig> {
self.uart_mem_clock[UartInstance::Uart1 as usize]
}
pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
self.uart_function_clock[UartInstance::Uart2 as usize]
}
pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
}
pub fn uart2_mem_clock(&self) -> Option<UartMemClockConfig> {
self.uart_mem_clock[UartInstance::Uart2 as usize]
}
}
static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
::esp_sync::NonReentrantMutex::new(ClockTree {
xtal_clk: None,
pll_clk: None,
system_pre_div_in: None,
system_pre_div: None,
cpu_pll_div_out: None,
apb_clk: None,
crypto_pwm_clk: None,
cpu_clk: None,
rc_fast_clk_div_n: None,
rtc_slow_clk: None,
rtc_fast_clk: None,
low_power_clk: None,
timg_calibration_clock: None,
mcpwm_function_clock: [None; 2],
rmt_sclk: [None; 1],
timg_function_clock: [None; 2],
uart_function_clock: [None; 3],
uart_baud_rate_generator: [None; 3],
uart_mem_clock: [None; 3],
pll_clk_refcount: 0,
rc_fast_clk_refcount: 0,
xtal32k_clk_refcount: 0,
rc_slow_clk_refcount: 0,
rc_fast_div_clk_refcount: 0,
apb_clk_refcount: 0,
crypto_pwm_clk_refcount: 0,
pll_d2_refcount: 0,
rtc_fast_clk_refcount: 0,
low_power_clk_refcount: 0,
uart_mem_clk_refcount: 0,
timg_calibration_clock_refcount: 0,
mcpwm_function_clock_refcount: [0; 2],
rmt_sclk_refcount: [0; 1],
timg_function_clock_refcount: [0; 2],
uart_function_clock_refcount: [0; 3],
uart_baud_rate_generator_refcount: [0; 3],
uart_mem_clock_refcount: [0; 3],
});
pub fn configure_xtal_clk(clocks: &mut ClockTree, config: XtalClkConfig) {
let old_config = clocks.xtal_clk.replace(config);
configure_xtal_clk_impl(clocks, old_config, config);
}
pub fn xtal_clk_config(clocks: &mut ClockTree) -> Option<XtalClkConfig> {
clocks.xtal_clk
}
fn request_xtal_clk(_clocks: &mut ClockTree) {}
fn release_xtal_clk(_clocks: &mut ClockTree) {}
#[allow(unused_variables)]
pub fn xtal_clk_config_frequency(clocks: &mut ClockTree, config: XtalClkConfig) -> u32 {
config.value()
}
pub fn xtal_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.xtal_clk {
xtal_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_pll_clk(clocks: &mut ClockTree, config: PllClkConfig) {
if clocks.cpu_pll_div_out.is_some() {
assert!(
!((config.value() == 320000000)
&& (cpu_pll_div_out_frequency(clocks) == 240000000))
);
}
let old_config = clocks.pll_clk.replace(config);
configure_pll_clk_impl(clocks, old_config, config);
}
pub fn pll_clk_config(clocks: &mut ClockTree) -> Option<PllClkConfig> {
clocks.pll_clk
}
pub fn request_pll_clk(clocks: &mut ClockTree) {
trace!("Requesting PLL_CLK");
if increment_reference_count(&mut clocks.pll_clk_refcount) {
trace!("Enabling PLL_CLK");
request_xtal_clk(clocks);
enable_pll_clk_impl(clocks, true);
}
}
pub fn release_pll_clk(clocks: &mut ClockTree) {
trace!("Releasing PLL_CLK");
if decrement_reference_count(&mut clocks.pll_clk_refcount) {
trace!("Disabling PLL_CLK");
enable_pll_clk_impl(clocks, false);
release_xtal_clk(clocks);
}
}
#[allow(unused_variables)]
pub fn pll_clk_config_frequency(clocks: &mut ClockTree, config: PllClkConfig) -> u32 {
config.value()
}
pub fn pll_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.pll_clk {
pll_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn request_rc_fast_clk(clocks: &mut ClockTree) {
trace!("Requesting RC_FAST_CLK");
if increment_reference_count(&mut clocks.rc_fast_clk_refcount) {
trace!("Enabling RC_FAST_CLK");
enable_rc_fast_clk_impl(clocks, true);
}
}
pub fn release_rc_fast_clk(clocks: &mut ClockTree) {
trace!("Releasing RC_FAST_CLK");
if decrement_reference_count(&mut clocks.rc_fast_clk_refcount) {
trace!("Disabling RC_FAST_CLK");
enable_rc_fast_clk_impl(clocks, false);
}
}
pub fn rc_fast_clk_frequency(clocks: &mut ClockTree) -> u32 {
17500000
}
pub fn request_xtal32k_clk(clocks: &mut ClockTree) {
trace!("Requesting XTAL32K_CLK");
if increment_reference_count(&mut clocks.xtal32k_clk_refcount) {
trace!("Enabling XTAL32K_CLK");
enable_xtal32k_clk_impl(clocks, true);
}
}
pub fn release_xtal32k_clk(clocks: &mut ClockTree) {
trace!("Releasing XTAL32K_CLK");
if decrement_reference_count(&mut clocks.xtal32k_clk_refcount) {
trace!("Disabling XTAL32K_CLK");
enable_xtal32k_clk_impl(clocks, false);
}
}
pub fn xtal32k_clk_frequency(clocks: &mut ClockTree) -> u32 {
32768
}
pub fn request_rc_slow_clk(clocks: &mut ClockTree) {
trace!("Requesting RC_SLOW_CLK");
if increment_reference_count(&mut clocks.rc_slow_clk_refcount) {
trace!("Enabling RC_SLOW_CLK");
enable_rc_slow_clk_impl(clocks, true);
}
}
pub fn release_rc_slow_clk(clocks: &mut ClockTree) {
trace!("Releasing RC_SLOW_CLK");
if decrement_reference_count(&mut clocks.rc_slow_clk_refcount) {
trace!("Disabling RC_SLOW_CLK");
enable_rc_slow_clk_impl(clocks, false);
}
}
pub fn rc_slow_clk_frequency(clocks: &mut ClockTree) -> u32 {
136000
}
pub fn request_rc_fast_div_clk(clocks: &mut ClockTree) {
trace!("Requesting RC_FAST_DIV_CLK");
if increment_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
trace!("Enabling RC_FAST_DIV_CLK");
request_rc_fast_clk(clocks);
enable_rc_fast_div_clk_impl(clocks, true);
}
}
pub fn release_rc_fast_div_clk(clocks: &mut ClockTree) {
trace!("Releasing RC_FAST_DIV_CLK");
if decrement_reference_count(&mut clocks.rc_fast_div_clk_refcount) {
trace!("Disabling RC_FAST_DIV_CLK");
enable_rc_fast_div_clk_impl(clocks, false);
release_rc_fast_clk(clocks);
}
}
pub fn rc_fast_div_clk_frequency(clocks: &mut ClockTree) -> u32 {
(rc_fast_clk_frequency(clocks) / 256)
}
pub fn configure_system_pre_div_in(
clocks: &mut ClockTree,
new_selector: SystemPreDivInConfig,
) {
let old_selector = clocks.system_pre_div_in.replace(new_selector);
match new_selector {
SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
}
configure_system_pre_div_in_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
}
}
}
pub fn system_pre_div_in_config(clocks: &mut ClockTree) -> Option<SystemPreDivInConfig> {
clocks.system_pre_div_in
}
pub fn request_system_pre_div_in(clocks: &mut ClockTree) {
trace!("Requesting SYSTEM_PRE_DIV_IN");
trace!("Enabling SYSTEM_PRE_DIV_IN");
match unwrap!(clocks.system_pre_div_in) {
SystemPreDivInConfig::Xtal => request_xtal_clk(clocks),
SystemPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
}
enable_system_pre_div_in_impl(clocks, true);
}
pub fn release_system_pre_div_in(clocks: &mut ClockTree) {
trace!("Releasing SYSTEM_PRE_DIV_IN");
trace!("Disabling SYSTEM_PRE_DIV_IN");
enable_system_pre_div_in_impl(clocks, false);
match unwrap!(clocks.system_pre_div_in) {
SystemPreDivInConfig::Xtal => release_xtal_clk(clocks),
SystemPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
}
}
#[allow(unused_variables)]
pub fn system_pre_div_in_config_frequency(
clocks: &mut ClockTree,
config: SystemPreDivInConfig,
) -> u32 {
match config {
SystemPreDivInConfig::Xtal => xtal_clk_frequency(clocks),
SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(clocks),
}
}
pub fn system_pre_div_in_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.system_pre_div_in {
system_pre_div_in_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_system_pre_div(clocks: &mut ClockTree, config: SystemPreDivConfig) {
let old_config = clocks.system_pre_div.replace(config);
configure_system_pre_div_impl(clocks, old_config, config);
}
pub fn system_pre_div_config(clocks: &mut ClockTree) -> Option<SystemPreDivConfig> {
clocks.system_pre_div
}
pub fn request_system_pre_div(clocks: &mut ClockTree) {
trace!("Requesting SYSTEM_PRE_DIV");
trace!("Enabling SYSTEM_PRE_DIV");
request_system_pre_div_in(clocks);
enable_system_pre_div_impl(clocks, true);
}
pub fn release_system_pre_div(clocks: &mut ClockTree) {
trace!("Releasing SYSTEM_PRE_DIV");
trace!("Disabling SYSTEM_PRE_DIV");
enable_system_pre_div_impl(clocks, false);
release_system_pre_div_in(clocks);
}
#[allow(unused_variables)]
pub fn system_pre_div_config_frequency(
clocks: &mut ClockTree,
config: SystemPreDivConfig,
) -> u32 {
(system_pre_div_in_frequency(clocks) / (config.divisor() + 1))
}
pub fn system_pre_div_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.system_pre_div {
system_pre_div_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_cpu_pll_div_out(clocks: &mut ClockTree, config: CpuPllDivOutConfig) {
if clocks.pll_clk.is_some() {
assert!(
!((config.value() == 240000000) && (pll_clk_frequency(clocks) == 320000000))
);
}
let old_config = clocks.cpu_pll_div_out.replace(config);
configure_cpu_pll_div_out_impl(clocks, old_config, config);
}
pub fn cpu_pll_div_out_config(clocks: &mut ClockTree) -> Option<CpuPllDivOutConfig> {
clocks.cpu_pll_div_out
}
pub fn request_cpu_pll_div_out(clocks: &mut ClockTree) {
trace!("Requesting CPU_PLL_DIV_OUT");
trace!("Enabling CPU_PLL_DIV_OUT");
request_pll_clk(clocks);
enable_cpu_pll_div_out_impl(clocks, true);
}
pub fn release_cpu_pll_div_out(clocks: &mut ClockTree) {
trace!("Releasing CPU_PLL_DIV_OUT");
trace!("Disabling CPU_PLL_DIV_OUT");
enable_cpu_pll_div_out_impl(clocks, false);
release_pll_clk(clocks);
}
#[allow(unused_variables)]
pub fn cpu_pll_div_out_config_frequency(
clocks: &mut ClockTree,
config: CpuPllDivOutConfig,
) -> u32 {
config.value()
}
pub fn cpu_pll_div_out_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.cpu_pll_div_out {
cpu_pll_div_out_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_apb_clk(clocks: &mut ClockTree, new_selector: ApbClkConfig) {
let old_selector = clocks.apb_clk.replace(new_selector);
if clocks.apb_clk_refcount > 0 {
match new_selector {
ApbClkConfig::Pll => request_apb_80m(clocks),
ApbClkConfig::Cpu => request_cpu_clk(clocks),
}
configure_apb_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
ApbClkConfig::Pll => release_apb_80m(clocks),
ApbClkConfig::Cpu => release_cpu_clk(clocks),
}
}
} else {
configure_apb_clk_impl(clocks, old_selector, new_selector);
}
}
pub fn apb_clk_config(clocks: &mut ClockTree) -> Option<ApbClkConfig> {
clocks.apb_clk
}
pub fn request_apb_clk(clocks: &mut ClockTree) {
trace!("Requesting APB_CLK");
if increment_reference_count(&mut clocks.apb_clk_refcount) {
trace!("Enabling APB_CLK");
match unwrap!(clocks.apb_clk) {
ApbClkConfig::Pll => request_apb_80m(clocks),
ApbClkConfig::Cpu => request_cpu_clk(clocks),
}
enable_apb_clk_impl(clocks, true);
}
}
pub fn release_apb_clk(clocks: &mut ClockTree) {
trace!("Releasing APB_CLK");
if decrement_reference_count(&mut clocks.apb_clk_refcount) {
trace!("Disabling APB_CLK");
enable_apb_clk_impl(clocks, false);
match unwrap!(clocks.apb_clk) {
ApbClkConfig::Pll => release_apb_80m(clocks),
ApbClkConfig::Cpu => release_cpu_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn apb_clk_config_frequency(clocks: &mut ClockTree, config: ApbClkConfig) -> u32 {
match config {
ApbClkConfig::Pll => apb_80m_frequency(clocks),
ApbClkConfig::Cpu => cpu_clk_frequency(clocks),
}
}
pub fn apb_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.apb_clk {
apb_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_crypto_pwm_clk(clocks: &mut ClockTree, new_selector: CryptoPwmClkConfig) {
let old_selector = clocks.crypto_pwm_clk.replace(new_selector);
if clocks.crypto_pwm_clk_refcount > 0 {
match new_selector {
CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
}
configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
}
}
} else {
configure_crypto_pwm_clk_impl(clocks, old_selector, new_selector);
}
}
pub fn crypto_pwm_clk_config(clocks: &mut ClockTree) -> Option<CryptoPwmClkConfig> {
clocks.crypto_pwm_clk
}
pub fn request_crypto_pwm_clk(clocks: &mut ClockTree) {
trace!("Requesting CRYPTO_PWM_CLK");
if increment_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
trace!("Enabling CRYPTO_PWM_CLK");
match unwrap!(clocks.crypto_pwm_clk) {
CryptoPwmClkConfig::Pll => request_pll_160m(clocks),
CryptoPwmClkConfig::Cpu => request_cpu_clk(clocks),
}
enable_crypto_pwm_clk_impl(clocks, true);
}
}
pub fn release_crypto_pwm_clk(clocks: &mut ClockTree) {
trace!("Releasing CRYPTO_PWM_CLK");
if decrement_reference_count(&mut clocks.crypto_pwm_clk_refcount) {
trace!("Disabling CRYPTO_PWM_CLK");
enable_crypto_pwm_clk_impl(clocks, false);
match unwrap!(clocks.crypto_pwm_clk) {
CryptoPwmClkConfig::Pll => release_pll_160m(clocks),
CryptoPwmClkConfig::Cpu => release_cpu_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn crypto_pwm_clk_config_frequency(
clocks: &mut ClockTree,
config: CryptoPwmClkConfig,
) -> u32 {
match config {
CryptoPwmClkConfig::Pll => pll_160m_frequency(clocks),
CryptoPwmClkConfig::Cpu => cpu_clk_frequency(clocks),
}
}
pub fn crypto_pwm_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.crypto_pwm_clk {
crypto_pwm_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_cpu_clk(clocks: &mut ClockTree, new_selector: CpuClkConfig) {
let old_selector = clocks.cpu_clk.replace(new_selector);
match new_selector {
CpuClkConfig::Xtal => {
configure_apb_clk(clocks, ApbClkConfig::Cpu);
configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
configure_system_pre_div_in(clocks, SystemPreDivInConfig::Xtal);
}
CpuClkConfig::RcFast => {
configure_apb_clk(clocks, ApbClkConfig::Cpu);
configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Cpu);
configure_system_pre_div_in(clocks, SystemPreDivInConfig::RcFast);
}
CpuClkConfig::Pll => {
configure_apb_clk(clocks, ApbClkConfig::Pll);
configure_crypto_pwm_clk(clocks, CryptoPwmClkConfig::Pll);
}
}
match new_selector {
CpuClkConfig::Xtal => request_system_pre_div(clocks),
CpuClkConfig::RcFast => request_system_pre_div(clocks),
CpuClkConfig::Pll => request_cpu_pll_div_out(clocks),
}
configure_cpu_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
CpuClkConfig::Xtal => release_system_pre_div(clocks),
CpuClkConfig::RcFast => release_system_pre_div(clocks),
CpuClkConfig::Pll => release_cpu_pll_div_out(clocks),
}
}
}
pub fn cpu_clk_config(clocks: &mut ClockTree) -> Option<CpuClkConfig> {
clocks.cpu_clk
}
fn request_cpu_clk(_clocks: &mut ClockTree) {}
fn release_cpu_clk(_clocks: &mut ClockTree) {}
#[allow(unused_variables)]
pub fn cpu_clk_config_frequency(clocks: &mut ClockTree, config: CpuClkConfig) -> u32 {
match config {
CpuClkConfig::Xtal => system_pre_div_frequency(clocks),
CpuClkConfig::RcFast => system_pre_div_frequency(clocks),
CpuClkConfig::Pll => cpu_pll_div_out_frequency(clocks),
}
}
pub fn cpu_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.cpu_clk {
cpu_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn request_pll_d2(clocks: &mut ClockTree) {
trace!("Requesting PLL_D2");
if increment_reference_count(&mut clocks.pll_d2_refcount) {
trace!("Enabling PLL_D2");
request_pll_clk(clocks);
enable_pll_d2_impl(clocks, true);
}
}
pub fn release_pll_d2(clocks: &mut ClockTree) {
trace!("Releasing PLL_D2");
if decrement_reference_count(&mut clocks.pll_d2_refcount) {
trace!("Disabling PLL_D2");
enable_pll_d2_impl(clocks, false);
release_pll_clk(clocks);
}
}
pub fn pll_d2_frequency(clocks: &mut ClockTree) -> u32 {
(pll_clk_frequency(clocks) / 2)
}
pub fn request_pll_160m(clocks: &mut ClockTree) {
trace!("Requesting PLL_160M");
trace!("Enabling PLL_160M");
request_cpu_clk(clocks);
enable_pll_160m_impl(clocks, true);
}
pub fn release_pll_160m(clocks: &mut ClockTree) {
trace!("Releasing PLL_160M");
trace!("Disabling PLL_160M");
enable_pll_160m_impl(clocks, false);
release_cpu_clk(clocks);
}
pub fn pll_160m_frequency(clocks: &mut ClockTree) -> u32 {
160000000
}
pub fn request_apb_80m(clocks: &mut ClockTree) {
trace!("Requesting APB_80M");
trace!("Enabling APB_80M");
request_cpu_clk(clocks);
enable_apb_80m_impl(clocks, true);
}
pub fn release_apb_80m(clocks: &mut ClockTree) {
trace!("Releasing APB_80M");
trace!("Disabling APB_80M");
enable_apb_80m_impl(clocks, false);
release_cpu_clk(clocks);
}
pub fn apb_80m_frequency(clocks: &mut ClockTree) -> u32 {
80000000
}
pub fn configure_rc_fast_clk_div_n(clocks: &mut ClockTree, config: RcFastClkDivNConfig) {
let old_config = clocks.rc_fast_clk_div_n.replace(config);
configure_rc_fast_clk_div_n_impl(clocks, old_config, config);
}
pub fn rc_fast_clk_div_n_config(clocks: &mut ClockTree) -> Option<RcFastClkDivNConfig> {
clocks.rc_fast_clk_div_n
}
pub fn request_rc_fast_clk_div_n(clocks: &mut ClockTree) {
trace!("Requesting RC_FAST_CLK_DIV_N");
trace!("Enabling RC_FAST_CLK_DIV_N");
request_rc_fast_clk(clocks);
enable_rc_fast_clk_div_n_impl(clocks, true);
}
pub fn release_rc_fast_clk_div_n(clocks: &mut ClockTree) {
trace!("Releasing RC_FAST_CLK_DIV_N");
trace!("Disabling RC_FAST_CLK_DIV_N");
enable_rc_fast_clk_div_n_impl(clocks, false);
release_rc_fast_clk(clocks);
}
#[allow(unused_variables)]
pub fn rc_fast_clk_div_n_config_frequency(
clocks: &mut ClockTree,
config: RcFastClkDivNConfig,
) -> u32 {
(rc_fast_clk_frequency(clocks) / (config.divisor() + 1))
}
pub fn rc_fast_clk_div_n_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.rc_fast_clk_div_n {
rc_fast_clk_div_n_config_frequency(clocks, config)
} else {
0
}
}
pub fn request_xtal_div_clk(clocks: &mut ClockTree) {
trace!("Requesting XTAL_DIV_CLK");
trace!("Enabling XTAL_DIV_CLK");
request_xtal_clk(clocks);
enable_xtal_div_clk_impl(clocks, true);
}
pub fn release_xtal_div_clk(clocks: &mut ClockTree) {
trace!("Releasing XTAL_DIV_CLK");
trace!("Disabling XTAL_DIV_CLK");
enable_xtal_div_clk_impl(clocks, false);
release_xtal_clk(clocks);
}
pub fn xtal_div_clk_frequency(clocks: &mut ClockTree) -> u32 {
(xtal_clk_frequency(clocks) / 2)
}
pub fn configure_rtc_slow_clk(clocks: &mut ClockTree, new_selector: RtcSlowClkConfig) {
let old_selector = clocks.rtc_slow_clk.replace(new_selector);
match new_selector {
RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
}
configure_rtc_slow_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
}
}
}
pub fn rtc_slow_clk_config(clocks: &mut ClockTree) -> Option<RtcSlowClkConfig> {
clocks.rtc_slow_clk
}
pub fn request_rtc_slow_clk(clocks: &mut ClockTree) {
trace!("Requesting RTC_SLOW_CLK");
trace!("Enabling RTC_SLOW_CLK");
match unwrap!(clocks.rtc_slow_clk) {
RtcSlowClkConfig::Xtal32k => request_xtal32k_clk(clocks),
RtcSlowClkConfig::RcSlow => request_rc_slow_clk(clocks),
RtcSlowClkConfig::RcFast => request_rc_fast_div_clk(clocks),
}
enable_rtc_slow_clk_impl(clocks, true);
}
pub fn release_rtc_slow_clk(clocks: &mut ClockTree) {
trace!("Releasing RTC_SLOW_CLK");
trace!("Disabling RTC_SLOW_CLK");
enable_rtc_slow_clk_impl(clocks, false);
match unwrap!(clocks.rtc_slow_clk) {
RtcSlowClkConfig::Xtal32k => release_xtal32k_clk(clocks),
RtcSlowClkConfig::RcSlow => release_rc_slow_clk(clocks),
RtcSlowClkConfig::RcFast => release_rc_fast_div_clk(clocks),
}
}
#[allow(unused_variables)]
pub fn rtc_slow_clk_config_frequency(
clocks: &mut ClockTree,
config: RtcSlowClkConfig,
) -> u32 {
match config {
RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(clocks),
RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(clocks),
RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(clocks),
}
}
pub fn rtc_slow_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.rtc_slow_clk {
rtc_slow_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_rtc_fast_clk(clocks: &mut ClockTree, new_selector: RtcFastClkConfig) {
let old_selector = clocks.rtc_fast_clk.replace(new_selector);
if clocks.rtc_fast_clk_refcount > 0 {
match new_selector {
RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
}
configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
}
}
} else {
configure_rtc_fast_clk_impl(clocks, old_selector, new_selector);
}
}
pub fn rtc_fast_clk_config(clocks: &mut ClockTree) -> Option<RtcFastClkConfig> {
clocks.rtc_fast_clk
}
pub fn request_rtc_fast_clk(clocks: &mut ClockTree) {
trace!("Requesting RTC_FAST_CLK");
if increment_reference_count(&mut clocks.rtc_fast_clk_refcount) {
trace!("Enabling RTC_FAST_CLK");
match unwrap!(clocks.rtc_fast_clk) {
RtcFastClkConfig::Xtal => request_xtal_div_clk(clocks),
RtcFastClkConfig::Rc => request_rc_fast_clk_div_n(clocks),
}
enable_rtc_fast_clk_impl(clocks, true);
}
}
pub fn release_rtc_fast_clk(clocks: &mut ClockTree) {
trace!("Releasing RTC_FAST_CLK");
if decrement_reference_count(&mut clocks.rtc_fast_clk_refcount) {
trace!("Disabling RTC_FAST_CLK");
enable_rtc_fast_clk_impl(clocks, false);
match unwrap!(clocks.rtc_fast_clk) {
RtcFastClkConfig::Xtal => release_xtal_div_clk(clocks),
RtcFastClkConfig::Rc => release_rc_fast_clk_div_n(clocks),
}
}
}
#[allow(unused_variables)]
pub fn rtc_fast_clk_config_frequency(
clocks: &mut ClockTree,
config: RtcFastClkConfig,
) -> u32 {
match config {
RtcFastClkConfig::Xtal => xtal_div_clk_frequency(clocks),
RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(clocks),
}
}
pub fn rtc_fast_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.rtc_fast_clk {
rtc_fast_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_low_power_clk(clocks: &mut ClockTree, new_selector: LowPowerClkConfig) {
let old_selector = clocks.low_power_clk.replace(new_selector);
if clocks.low_power_clk_refcount > 0 {
match new_selector {
LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
}
configure_low_power_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
}
}
} else {
configure_low_power_clk_impl(clocks, old_selector, new_selector);
}
}
pub fn low_power_clk_config(clocks: &mut ClockTree) -> Option<LowPowerClkConfig> {
clocks.low_power_clk
}
pub fn request_low_power_clk(clocks: &mut ClockTree) {
trace!("Requesting LOW_POWER_CLK");
if increment_reference_count(&mut clocks.low_power_clk_refcount) {
trace!("Enabling LOW_POWER_CLK");
match unwrap!(clocks.low_power_clk) {
LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
LowPowerClkConfig::Xtal32k => request_xtal32k_clk(clocks),
LowPowerClkConfig::RtcSlow => request_rtc_slow_clk(clocks),
}
enable_low_power_clk_impl(clocks, true);
}
}
pub fn release_low_power_clk(clocks: &mut ClockTree) {
trace!("Releasing LOW_POWER_CLK");
if decrement_reference_count(&mut clocks.low_power_clk_refcount) {
trace!("Disabling LOW_POWER_CLK");
enable_low_power_clk_impl(clocks, false);
match unwrap!(clocks.low_power_clk) {
LowPowerClkConfig::Xtal => release_xtal_clk(clocks),
LowPowerClkConfig::RcFast => release_rc_fast_clk(clocks),
LowPowerClkConfig::Xtal32k => release_xtal32k_clk(clocks),
LowPowerClkConfig::RtcSlow => release_rtc_slow_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn low_power_clk_config_frequency(
clocks: &mut ClockTree,
config: LowPowerClkConfig,
) -> u32 {
match config {
LowPowerClkConfig::Xtal => xtal_clk_frequency(clocks),
LowPowerClkConfig::RcFast => rc_fast_clk_frequency(clocks),
LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(clocks),
LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(clocks),
}
}
pub fn low_power_clk_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.low_power_clk {
low_power_clk_config_frequency(clocks, config)
} else {
0
}
}
pub fn request_uart_mem_clk(clocks: &mut ClockTree) {
trace!("Requesting UART_MEM_CLK");
if increment_reference_count(&mut clocks.uart_mem_clk_refcount) {
trace!("Enabling UART_MEM_CLK");
request_xtal_clk(clocks);
enable_uart_mem_clk_impl(clocks, true);
}
}
pub fn release_uart_mem_clk(clocks: &mut ClockTree) {
trace!("Releasing UART_MEM_CLK");
if decrement_reference_count(&mut clocks.uart_mem_clk_refcount) {
trace!("Disabling UART_MEM_CLK");
enable_uart_mem_clk_impl(clocks, false);
release_xtal_clk(clocks);
}
}
pub fn uart_mem_clk_frequency(clocks: &mut ClockTree) -> u32 {
xtal_clk_frequency(clocks)
}
pub fn configure_timg_calibration_clock(
clocks: &mut ClockTree,
new_selector: TimgCalibrationClockConfig,
) {
let old_selector = clocks.timg_calibration_clock.replace(new_selector);
if clocks.timg_calibration_clock_refcount > 0 {
match new_selector {
TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
}
configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
}
}
} else {
configure_timg_calibration_clock_impl(clocks, old_selector, new_selector);
}
}
pub fn timg_calibration_clock_config(
clocks: &mut ClockTree,
) -> Option<TimgCalibrationClockConfig> {
clocks.timg_calibration_clock
}
pub fn request_timg_calibration_clock(clocks: &mut ClockTree) {
trace!("Requesting TIMG_CALIBRATION_CLOCK");
if increment_reference_count(&mut clocks.timg_calibration_clock_refcount) {
trace!("Enabling TIMG_CALIBRATION_CLOCK");
match unwrap!(clocks.timg_calibration_clock) {
TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
TimgCalibrationClockConfig::Xtal32kClk => request_xtal32k_clk(clocks),
}
enable_timg_calibration_clock_impl(clocks, true);
}
}
pub fn release_timg_calibration_clock(clocks: &mut ClockTree) {
trace!("Releasing TIMG_CALIBRATION_CLOCK");
if decrement_reference_count(&mut clocks.timg_calibration_clock_refcount) {
trace!("Disabling TIMG_CALIBRATION_CLOCK");
enable_timg_calibration_clock_impl(clocks, false);
match unwrap!(clocks.timg_calibration_clock) {
TimgCalibrationClockConfig::RcSlowClk => release_rc_slow_clk(clocks),
TimgCalibrationClockConfig::RcFastDivClk => release_rc_fast_div_clk(clocks),
TimgCalibrationClockConfig::Xtal32kClk => release_xtal32k_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn timg_calibration_clock_config_frequency(
clocks: &mut ClockTree,
config: TimgCalibrationClockConfig,
) -> u32 {
match config {
TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(clocks),
TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(clocks),
TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(clocks),
}
}
pub fn timg_calibration_clock_frequency(clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.timg_calibration_clock {
timg_calibration_clock_config_frequency(clocks, config)
} else {
0
}
}
impl McpwmInstance {
pub fn configure_function_clock(
self,
clocks: &mut ClockTree,
new_selector: McpwmFunctionClockConfig,
) {
let old_selector = clocks.mcpwm_function_clock[self as usize].replace(new_selector);
if clocks.mcpwm_function_clock_refcount[self as usize] > 0 {
request_crypto_pwm_clk(clocks);
self.configure_function_clock_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
release_crypto_pwm_clk(clocks);
}
} else {
self.configure_function_clock_impl(clocks, old_selector, new_selector);
}
}
pub fn function_clock_config(
self,
clocks: &mut ClockTree,
) -> Option<McpwmFunctionClockConfig> {
clocks.mcpwm_function_clock[self as usize]
}
pub fn request_function_clock(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::FUNCTION_CLOCK", self);
if increment_reference_count(
&mut clocks.mcpwm_function_clock_refcount[self as usize],
) {
trace!("Enabling {:?}::FUNCTION_CLOCK", self);
request_crypto_pwm_clk(clocks);
self.enable_function_clock_impl(clocks, true);
}
}
pub fn release_function_clock(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::FUNCTION_CLOCK", self);
if decrement_reference_count(
&mut clocks.mcpwm_function_clock_refcount[self as usize],
) {
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
self.enable_function_clock_impl(clocks, false);
release_crypto_pwm_clk(clocks);
}
}
#[allow(unused_variables)]
pub fn function_clock_config_frequency(
self,
clocks: &mut ClockTree,
config: McpwmFunctionClockConfig,
) -> u32 {
crypto_pwm_clk_frequency(clocks)
}
pub fn function_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.mcpwm_function_clock[self as usize] {
self.function_clock_config_frequency(clocks, config)
} else {
0
}
}
}
impl RmtInstance {
pub fn configure_sclk(self, clocks: &mut ClockTree, new_selector: RmtSclkConfig) {
let old_selector = clocks.rmt_sclk[self as usize].replace(new_selector);
if clocks.rmt_sclk_refcount[self as usize] > 0 {
match new_selector {
RmtSclkConfig::ApbClk => request_apb_clk(clocks),
RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
}
self.configure_sclk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
RmtSclkConfig::ApbClk => release_apb_clk(clocks),
RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
}
}
} else {
self.configure_sclk_impl(clocks, old_selector, new_selector);
}
}
pub fn sclk_config(self, clocks: &mut ClockTree) -> Option<RmtSclkConfig> {
clocks.rmt_sclk[self as usize]
}
pub fn request_sclk(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::SCLK", self);
if increment_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
trace!("Enabling {:?}::SCLK", self);
match unwrap!(clocks.rmt_sclk[self as usize]) {
RmtSclkConfig::ApbClk => request_apb_clk(clocks),
RmtSclkConfig::RcFastClk => request_rc_fast_clk(clocks),
RmtSclkConfig::XtalClk => request_xtal_clk(clocks),
}
self.enable_sclk_impl(clocks, true);
}
}
pub fn release_sclk(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::SCLK", self);
if decrement_reference_count(&mut clocks.rmt_sclk_refcount[self as usize]) {
trace!("Disabling {:?}::SCLK", self);
self.enable_sclk_impl(clocks, false);
match unwrap!(clocks.rmt_sclk[self as usize]) {
RmtSclkConfig::ApbClk => release_apb_clk(clocks),
RmtSclkConfig::RcFastClk => release_rc_fast_clk(clocks),
RmtSclkConfig::XtalClk => release_xtal_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn sclk_config_frequency(
self,
clocks: &mut ClockTree,
config: RmtSclkConfig,
) -> u32 {
match config {
RmtSclkConfig::ApbClk => apb_clk_frequency(clocks),
RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(clocks),
RmtSclkConfig::XtalClk => xtal_clk_frequency(clocks),
}
}
pub fn sclk_frequency(self, clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.rmt_sclk[self as usize] {
self.sclk_config_frequency(clocks, config)
} else {
0
}
}
}
impl TimgInstance {
pub fn configure_function_clock(
self,
clocks: &mut ClockTree,
new_selector: TimgFunctionClockConfig,
) {
let old_selector = clocks.timg_function_clock[self as usize].replace(new_selector);
if clocks.timg_function_clock_refcount[self as usize] > 0 {
match new_selector {
TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
}
self.configure_function_clock_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
}
}
} else {
self.configure_function_clock_impl(clocks, old_selector, new_selector);
}
}
pub fn function_clock_config(
self,
clocks: &mut ClockTree,
) -> Option<TimgFunctionClockConfig> {
clocks.timg_function_clock[self as usize]
}
pub fn request_function_clock(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::FUNCTION_CLOCK", self);
if increment_reference_count(
&mut clocks.timg_function_clock_refcount[self as usize],
) {
trace!("Enabling {:?}::FUNCTION_CLOCK", self);
match unwrap!(clocks.timg_function_clock[self as usize]) {
TimgFunctionClockConfig::XtalClk => request_xtal_clk(clocks),
TimgFunctionClockConfig::ApbClk => request_apb_clk(clocks),
}
self.enable_function_clock_impl(clocks, true);
}
}
pub fn release_function_clock(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::FUNCTION_CLOCK", self);
if decrement_reference_count(
&mut clocks.timg_function_clock_refcount[self as usize],
) {
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
self.enable_function_clock_impl(clocks, false);
match unwrap!(clocks.timg_function_clock[self as usize]) {
TimgFunctionClockConfig::XtalClk => release_xtal_clk(clocks),
TimgFunctionClockConfig::ApbClk => release_apb_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn function_clock_config_frequency(
self,
clocks: &mut ClockTree,
config: TimgFunctionClockConfig,
) -> u32 {
match config {
TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(clocks),
TimgFunctionClockConfig::ApbClk => apb_clk_frequency(clocks),
}
}
pub fn function_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.timg_function_clock[self as usize] {
self.function_clock_config_frequency(clocks, config)
} else {
0
}
}
}
impl UartInstance {
pub fn configure_function_clock(
self,
clocks: &mut ClockTree,
config: UartFunctionClockConfig,
) {
let old_config = clocks.uart_function_clock[self as usize].replace(config);
if clocks.uart_function_clock_refcount[self as usize] > 0 {
match config.sclk {
UartFunctionClockSclk::Apb => request_apb_clk(clocks),
UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
}
self.configure_function_clock_impl(clocks, old_config, config);
if let Some(old_config) = old_config {
match old_config.sclk {
UartFunctionClockSclk::Apb => release_apb_clk(clocks),
UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
}
}
} else {
self.configure_function_clock_impl(clocks, old_config, config);
}
}
pub fn function_clock_config(
self,
clocks: &mut ClockTree,
) -> Option<UartFunctionClockConfig> {
clocks.uart_function_clock[self as usize]
}
pub fn request_function_clock(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::FUNCTION_CLOCK", self);
if increment_reference_count(
&mut clocks.uart_function_clock_refcount[self as usize],
) {
trace!("Enabling {:?}::FUNCTION_CLOCK", self);
match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
UartFunctionClockSclk::Apb => request_apb_clk(clocks),
UartFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
UartFunctionClockSclk::Xtal => request_xtal_clk(clocks),
}
self.enable_function_clock_impl(clocks, true);
}
}
pub fn release_function_clock(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::FUNCTION_CLOCK", self);
if decrement_reference_count(
&mut clocks.uart_function_clock_refcount[self as usize],
) {
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
self.enable_function_clock_impl(clocks, false);
match unwrap!(clocks.uart_function_clock[self as usize]).sclk {
UartFunctionClockSclk::Apb => release_apb_clk(clocks),
UartFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
UartFunctionClockSclk::Xtal => release_xtal_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn function_clock_config_frequency(
self,
clocks: &mut ClockTree,
config: UartFunctionClockConfig,
) -> u32 {
(match config.sclk {
UartFunctionClockSclk::Apb => apb_clk_frequency(clocks),
UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(clocks),
UartFunctionClockSclk::Xtal => xtal_clk_frequency(clocks),
} / (config.div_num() + 1))
}
pub fn function_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.uart_function_clock[self as usize] {
self.function_clock_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_baud_rate_generator(
self,
clocks: &mut ClockTree,
config: UartBaudRateGeneratorConfig,
) {
let old_config = clocks.uart_baud_rate_generator[self as usize].replace(config);
self.configure_baud_rate_generator_impl(clocks, old_config, config);
}
pub fn baud_rate_generator_config(
self,
clocks: &mut ClockTree,
) -> Option<UartBaudRateGeneratorConfig> {
clocks.uart_baud_rate_generator[self as usize]
}
pub fn request_baud_rate_generator(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::BAUD_RATE_GENERATOR", self);
if increment_reference_count(
&mut clocks.uart_baud_rate_generator_refcount[self as usize],
) {
trace!("Enabling {:?}::BAUD_RATE_GENERATOR", self);
self.request_function_clock(clocks);
self.enable_baud_rate_generator_impl(clocks, true);
}
}
pub fn release_baud_rate_generator(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::BAUD_RATE_GENERATOR", self);
if decrement_reference_count(
&mut clocks.uart_baud_rate_generator_refcount[self as usize],
) {
trace!("Disabling {:?}::BAUD_RATE_GENERATOR", self);
self.enable_baud_rate_generator_impl(clocks, false);
self.release_function_clock(clocks);
}
}
#[allow(unused_variables)]
pub fn baud_rate_generator_config_frequency(
self,
clocks: &mut ClockTree,
config: UartBaudRateGeneratorConfig,
) -> u32 {
((self.function_clock_frequency(clocks) * 16)
/ ((config.integral() * 16) + config.fractional()))
}
pub fn baud_rate_generator_frequency(self, clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.uart_baud_rate_generator[self as usize] {
self.baud_rate_generator_config_frequency(clocks, config)
} else {
0
}
}
pub fn configure_mem_clock(self, clocks: &mut ClockTree, config: UartMemClockConfig) {
let old_config = clocks.uart_mem_clock[self as usize].replace(config);
self.configure_mem_clock_impl(clocks, old_config, config);
}
pub fn mem_clock_config(self, clocks: &mut ClockTree) -> Option<UartMemClockConfig> {
clocks.uart_mem_clock[self as usize]
}
pub fn request_mem_clock(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::MEM_CLOCK", self);
if increment_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
trace!("Enabling {:?}::MEM_CLOCK", self);
request_uart_mem_clk(clocks);
self.enable_mem_clock_impl(clocks, true);
}
}
pub fn release_mem_clock(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::MEM_CLOCK", self);
if decrement_reference_count(&mut clocks.uart_mem_clock_refcount[self as usize]) {
trace!("Disabling {:?}::MEM_CLOCK", self);
self.enable_mem_clock_impl(clocks, false);
release_uart_mem_clk(clocks);
}
}
#[allow(unused_variables)]
pub fn mem_clock_config_frequency(
self,
clocks: &mut ClockTree,
config: UartMemClockConfig,
) -> u32 {
uart_mem_clk_frequency(clocks)
}
pub fn mem_clock_frequency(self, clocks: &mut ClockTree) -> u32 {
if let Some(config) = clocks.uart_mem_clock[self as usize] {
self.mem_clock_config_frequency(clocks, config)
} else {
0
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[instability::unstable]
pub struct ClockConfig {
pub xtal_clk: Option<XtalClkConfig>,
pub pll_clk: Option<PllClkConfig>,
pub system_pre_div: Option<SystemPreDivConfig>,
pub cpu_pll_div_out: Option<CpuPllDivOutConfig>,
pub cpu_clk: Option<CpuClkConfig>,
pub rc_fast_clk_div_n: Option<RcFastClkDivNConfig>,
pub rtc_slow_clk: Option<RtcSlowClkConfig>,
pub rtc_fast_clk: Option<RtcFastClkConfig>,
pub low_power_clk: Option<LowPowerClkConfig>,
pub timg_calibration_clock: Option<TimgCalibrationClockConfig>,
}
impl ClockConfig {
fn apply(&self) {
ClockTree::with(|clocks| {
if let Some(config) = self.xtal_clk {
configure_xtal_clk(clocks, config);
}
if let Some(config) = self.pll_clk {
configure_pll_clk(clocks, config);
}
if let Some(config) = self.system_pre_div {
configure_system_pre_div(clocks, config);
}
if let Some(config) = self.cpu_pll_div_out {
configure_cpu_pll_div_out(clocks, config);
}
if let Some(config) = self.cpu_clk {
configure_cpu_clk(clocks, config);
}
if let Some(config) = self.rc_fast_clk_div_n {
configure_rc_fast_clk_div_n(clocks, config);
}
if let Some(config) = self.rtc_slow_clk {
configure_rtc_slow_clk(clocks, config);
}
if let Some(config) = self.rtc_fast_clk {
configure_rtc_fast_clk(clocks, config);
}
if let Some(config) = self.low_power_clk {
configure_low_power_clk(clocks, config);
}
if let Some(config) = self.timg_calibration_clock {
configure_timg_calibration_clock(clocks, config);
}
});
}
}
fn increment_reference_count(refcount: &mut u32) -> bool {
let first = *refcount == 0;
*refcount = unwrap!(refcount.checked_add(1), "Reference count overflow");
first
}
fn decrement_reference_count(refcount: &mut u32) -> bool {
*refcount = refcount.saturating_sub(1);
let last = *refcount == 0;
last
}
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! implement_peripheral_clocks {
() => {
#[doc(hidden)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Peripheral {
Aes,
ApbSarAdc,
DedicatedGpio,
Dma,
Ds,
Hmac,
I2cExt0,
I2cExt1,
I2s0,
I2s1,
LcdCam,
Ledc,
Mcpwm0,
Mcpwm1,
Pcnt,
PeriBackup,
Rmt,
Rsa,
SdioHost,
Sha,
Spi2,
Spi3,
Systimer,
Timg0,
Timg1,
Twai0,
Uart0,
Uart1,
Uart2,
UartMem,
Uhci0,
Usb,
UsbDevice,
}
impl Peripheral {
const KEEP_ENABLED: &[Peripheral] = &[
Self::Systimer,
Self::Timg0,
Self::Uart0,
Self::UartMem,
Self::UsbDevice,
];
const COUNT: usize = Self::ALL.len();
const ALL: &[Self] = &[
Self::Aes,
Self::ApbSarAdc,
Self::DedicatedGpio,
Self::Dma,
Self::Ds,
Self::Hmac,
Self::I2cExt0,
Self::I2cExt1,
Self::I2s0,
Self::I2s1,
Self::LcdCam,
Self::Ledc,
Self::Mcpwm0,
Self::Mcpwm1,
Self::Pcnt,
Self::PeriBackup,
Self::Rmt,
Self::Rsa,
Self::SdioHost,
Self::Sha,
Self::Spi2,
Self::Spi3,
Self::Systimer,
Self::Timg0,
Self::Timg1,
Self::Twai0,
Self::Uart0,
Self::Uart1,
Self::Uart2,
Self::UartMem,
Self::Uhci0,
Self::Usb,
Self::UsbDevice,
];
}
unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
match peripheral {
Peripheral::Aes => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.crypto_aes_clk_en().bit(enable));
}
Peripheral::ApbSarAdc => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.apb_saradc_clk_en().bit(enable));
}
Peripheral::DedicatedGpio => {
crate::peripherals::SYSTEM::regs()
.cpu_peri_clk_en()
.modify(|_, w| w.dedicated_gpio_clk_en().bit(enable));
}
Peripheral::Dma => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.dma_clk_en().bit(enable));
}
Peripheral::Ds => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.crypto_ds_clk_en().bit(enable));
}
Peripheral::Hmac => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.crypto_hmac_clk_en().bit(enable));
}
Peripheral::I2cExt0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
}
Peripheral::I2cExt1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
}
Peripheral::I2s0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.i2s0_clk_en().bit(enable));
}
Peripheral::I2s1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.i2s1_clk_en().bit(enable));
}
Peripheral::LcdCam => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.lcd_cam_clk_en().bit(enable));
}
Peripheral::Ledc => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.ledc_clk_en().bit(enable));
}
Peripheral::Mcpwm0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.pwm0_clk_en().bit(enable));
}
Peripheral::Mcpwm1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.pwm1_clk_en().bit(enable));
}
Peripheral::Pcnt => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.pcnt_clk_en().bit(enable));
}
Peripheral::PeriBackup => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.peri_backup_clk_en().bit(enable));
}
Peripheral::Rmt => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.rmt_clk_en().bit(enable));
}
Peripheral::Rsa => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
}
Peripheral::SdioHost => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.sdio_host_clk_en().bit(enable));
}
Peripheral::Sha => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.crypto_sha_clk_en().bit(enable));
}
Peripheral::Spi2 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.spi2_clk_en().bit(enable));
}
Peripheral::Spi3 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.spi3_clk_en().bit(enable));
}
Peripheral::Systimer => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.systimer_clk_en().bit(enable));
}
Peripheral::Timg0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.timergroup_clk_en().bit(enable));
}
Peripheral::Timg1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.timergroup1_clk_en().bit(enable));
}
Peripheral::Twai0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.twai_clk_en().bit(enable));
}
Peripheral::Uart0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.uart_clk_en().bit(enable));
}
Peripheral::Uart1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.uart1_clk_en().bit(enable));
}
Peripheral::Uart2 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.uart2_clk_en().bit(enable));
}
Peripheral::UartMem => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.uart_mem_clk_en().bit(enable));
}
Peripheral::Uhci0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.uhci0_clk_en().bit(enable));
}
Peripheral::Usb => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.usb_clk_en().bit(enable));
}
Peripheral::UsbDevice => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.usb_device_clk_en().bit(enable));
}
}
}
unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
match peripheral {
Peripheral::Aes => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.crypto_aes_rst().bit(reset));
}
Peripheral::ApbSarAdc => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.apb_saradc_rst().bit(reset));
}
Peripheral::DedicatedGpio => {
crate::peripherals::SYSTEM::regs()
.cpu_peri_rst_en()
.modify(|_, w| w.dedicated_gpio_rst().bit(reset));
}
Peripheral::Dma => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.dma_rst().bit(reset));
}
Peripheral::Ds => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.crypto_ds_rst().bit(reset));
}
Peripheral::Hmac => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.crypto_hmac_rst().bit(reset));
}
Peripheral::I2cExt0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.i2c_ext0_rst().bit(reset));
}
Peripheral::I2cExt1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.i2c_ext1_rst().bit(reset));
}
Peripheral::I2s0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.i2s0_rst().bit(reset));
}
Peripheral::I2s1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.i2s1_rst().bit(reset));
}
Peripheral::LcdCam => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.lcd_cam_rst().bit(reset));
}
Peripheral::Ledc => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.ledc_rst().bit(reset));
}
Peripheral::Mcpwm0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.pwm0_rst().bit(reset));
}
Peripheral::Mcpwm1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.pwm1_rst().bit(reset));
}
Peripheral::Pcnt => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.pcnt_rst().bit(reset));
}
Peripheral::PeriBackup => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.peri_backup_rst().bit(reset));
}
Peripheral::Rmt => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.rmt_rst().bit(reset));
}
Peripheral::Rsa => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.crypto_rsa_rst().bit(reset));
}
Peripheral::SdioHost => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.sdio_host_rst().bit(reset));
}
Peripheral::Sha => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.crypto_sha_rst().bit(reset));
}
Peripheral::Spi2 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.spi2_rst().bit(reset));
}
Peripheral::Spi3 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.spi3_rst().bit(reset));
}
Peripheral::Systimer => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.systimer_rst().bit(reset));
}
Peripheral::Timg0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.timergroup_rst().bit(reset));
}
Peripheral::Timg1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.timergroup1_rst().bit(reset));
}
Peripheral::Twai0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.twai_rst().bit(reset));
}
Peripheral::Uart0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.uart_rst().bit(reset));
}
Peripheral::Uart1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.uart1_rst().bit(reset));
}
Peripheral::Uart2 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.uart2_rst().bit(reset));
}
Peripheral::UartMem => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.uart_mem_rst().bit(reset));
}
Peripheral::Uhci0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.uhci0_rst().bit(reset));
}
Peripheral::Usb => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.usb_rst().bit(reset));
}
Peripheral::UsbDevice => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.usb_device_rst().bit(reset));
}
}
}
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! memory_range {
("DRAM") => {
0x3FC88000..0x3FD00000
};
(size as str, "DRAM") => {
"491520"
};
("DRAM2_UNINIT") => {
0x3FCDB700..0x3FCED710
};
(size as str, "DRAM2_UNINIT") => {
"73744"
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_i2c_master {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_i2c_master!((0, I2C0, I2cExt0, I2CEXT0_SCL,
I2CEXT0_SDA)); _for_each_inner_i2c_master!((1, I2C1, I2cExt1, I2CEXT1_SCL,
I2CEXT1_SDA)); _for_each_inner_i2c_master!((all(0, I2C0, I2cExt0, I2CEXT0_SCL,
I2CEXT0_SDA), (1, I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_uart {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_uart { $(($pattern) => $code;)* ($other : tt) => {}
} _for_each_inner_uart!((0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS));
_for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS));
_for_each_inner_uart!((2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS));
_for_each_inner_uart!((all(0, UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS), (1,
UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS,
U2RTS)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_spi_master {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_spi_master { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_spi_master!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1,
FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4,
FSPIIO5, FSPIIO6, FSPIIO7], true)); _for_each_inner_spi_master!((SPI3, Spi3,
SPI3_CLK[SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD],
true)); _for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1,
FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4,
FSPIIO5, FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CLK[SPI3_CS0, SPI3_CS1,
SPI3_CS2] [SPI3_D, SPI3_Q, SPI3_WP, SPI3_HD], true)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_spi_slave {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_spi_slave { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_spi_slave!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
_for_each_inner_spi_slave!((SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0));
_for_each_inner_spi_slave!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0),
(SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_peripheral {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO2 peripheral singleton"] GPIO2 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO4 peripheral singleton"]
GPIO4 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO5 peripheral singleton"] GPIO5 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO6 peripheral singleton"]
GPIO6 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO7 peripheral singleton"] GPIO7 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO8 peripheral singleton"]
GPIO8 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO9 peripheral singleton"] GPIO9 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO10 peripheral singleton"]
GPIO10 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO11 peripheral singleton"] GPIO11 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO12 peripheral singleton"]
GPIO12 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO13 peripheral singleton"] GPIO13 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO14 peripheral singleton"]
GPIO14 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO15 peripheral singleton"] GPIO15 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO16 peripheral singleton"]
GPIO16 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO17 peripheral singleton"] GPIO17 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO18 peripheral singleton"]
GPIO18 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
#[doc = "</section>"] GPIO19 <= virtual())); _for_each_inner_peripheral!((@
peri_type #[doc = "GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""]
#[doc = "<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
#[doc = "</section>"] GPIO20 <= virtual())); _for_each_inner_peripheral!((@
peri_type #[doc = "GPIO21 peripheral singleton"] GPIO21 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO26 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO27 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO28 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO29 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO30 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO31 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO32 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO38 peripheral singleton"]
GPIO38 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO47 peripheral singleton"]
GPIO47 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO48 peripheral singleton"] GPIO48 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
<= AES(AES : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
}) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"ASSIST_DEBUG peripheral singleton"] ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA peripheral singleton"] DMA
<= DMA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"DS peripheral singleton"] DS <= DS() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "EFUSE peripheral singleton"]
EFUSE <= EFUSE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO peripheral singleton"]
GPIO <= GPIO() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "HMAC peripheral singleton"]
HMAC <= HMAC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"I2C_ANA_MST peripheral singleton"] I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "I2C0 peripheral singleton"]
I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"I2C1 peripheral singleton"] I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt })));
_for_each_inner_peripheral!((@ peri_type #[doc = "I2S0 peripheral singleton"]
I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
(unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"INTERRUPT_CORE1 peripheral singleton"] INTERRUPT_CORE1 <= INTERRUPT_CORE1()
(unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "LCD_CAM peripheral singleton"]
LCD_CAM <= LCD_CAM() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "LPWR peripheral singleton"]
LPWR <= RTC_CNTL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "MCPWM1 peripheral singleton"]
MCPWM1 <= MCPWM1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"PCNT peripheral singleton"] PCNT <= PCNT() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"PERI_BACKUP peripheral singleton"] PERI_BACKUP <= PERI_BACKUP() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "RMT peripheral singleton"] RMT
<= RMT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"RNG peripheral singleton"] RNG <= RNG() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "RSA peripheral singleton"] RSA
<= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
}) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"RTC_CNTL peripheral singleton"] RTC_CNTL <= RTC_CNTL() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "RTC_I2C peripheral singleton"]
RTC_I2C <= RTC_I2C() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"SENS peripheral singleton"] SENS <= SENS() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SHA peripheral singleton"] SHA
<= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
}) (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"SPI0 peripheral singleton"] SPI0 <= SPI0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SPI1 peripheral singleton"]
SPI1 <= SPI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt })));
_for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
SPI3 <= SPI3(SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SYSTIMER peripheral singleton"]
SYSTIMER <= SYSTIMER() (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt })));
_for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "USB0 peripheral singleton"]
USB0 <= USB0() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
(unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"USB_WRAP peripheral singleton"] USB_WRAP <= USB_WRAP() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "WCL peripheral singleton"] WCL
<= WCL() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"XTS_AES peripheral singleton"] XTS_AES <= XTS_AES() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
DMA_CH0 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH2 peripheral singleton"]
DMA_CH2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH4 peripheral singleton"]
DMA_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "ADC1 peripheral singleton"] ADC1 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "ADC2 peripheral singleton"]
ADC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"BT peripheral singleton"] BT <= virtual(BT_BB : { bind_bb_interrupt,
enable_bb_interrupt, disable_bb_interrupt }, RWBLE : { bind_rwble_interrupt,
enable_rwble_interrupt, disable_rwble_interrupt }) (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "CPU_CTRL peripheral singleton"]
CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"SW_INTERRUPT peripheral singleton"] SW_INTERRUPT <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"ULP_RISCV_CORE peripheral singleton"] ULP_RISCV_CORE <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "WIFI peripheral singleton"]
WIFI <= virtual(WIFI_MAC : { bind_mac_interrupt, enable_mac_interrupt,
disable_mac_interrupt }, WIFI_PWR : { bind_pwr_interrupt, enable_pwr_interrupt,
disable_pwr_interrupt }))); _for_each_inner_peripheral!((GPIO0));
_for_each_inner_peripheral!((GPIO1)); _for_each_inner_peripheral!((GPIO2));
_for_each_inner_peripheral!((GPIO3)); _for_each_inner_peripheral!((GPIO4));
_for_each_inner_peripheral!((GPIO5)); _for_each_inner_peripheral!((GPIO6));
_for_each_inner_peripheral!((GPIO7)); _for_each_inner_peripheral!((GPIO8));
_for_each_inner_peripheral!((GPIO9)); _for_each_inner_peripheral!((GPIO10));
_for_each_inner_peripheral!((GPIO11)); _for_each_inner_peripheral!((GPIO12));
_for_each_inner_peripheral!((GPIO13)); _for_each_inner_peripheral!((GPIO14));
_for_each_inner_peripheral!((GPIO15)); _for_each_inner_peripheral!((GPIO16));
_for_each_inner_peripheral!((GPIO17)); _for_each_inner_peripheral!((GPIO18));
_for_each_inner_peripheral!((GPIO19)); _for_each_inner_peripheral!((GPIO20));
_for_each_inner_peripheral!((GPIO21)); _for_each_inner_peripheral!((GPIO26));
_for_each_inner_peripheral!((GPIO27)); _for_each_inner_peripheral!((GPIO28));
_for_each_inner_peripheral!((GPIO29)); _for_each_inner_peripheral!((GPIO30));
_for_each_inner_peripheral!((GPIO31)); _for_each_inner_peripheral!((GPIO32));
_for_each_inner_peripheral!((GPIO33)); _for_each_inner_peripheral!((GPIO34));
_for_each_inner_peripheral!((GPIO35)); _for_each_inner_peripheral!((GPIO36));
_for_each_inner_peripheral!((GPIO37)); _for_each_inner_peripheral!((GPIO38));
_for_each_inner_peripheral!((GPIO39)); _for_each_inner_peripheral!((GPIO40));
_for_each_inner_peripheral!((GPIO41)); _for_each_inner_peripheral!((GPIO42));
_for_each_inner_peripheral!((GPIO43)); _for_each_inner_peripheral!((GPIO44));
_for_each_inner_peripheral!((GPIO45)); _for_each_inner_peripheral!((GPIO46));
_for_each_inner_peripheral!((GPIO47)); _for_each_inner_peripheral!((GPIO48));
_for_each_inner_peripheral!((AES(unstable)));
_for_each_inner_peripheral!((APB_CTRL(unstable)));
_for_each_inner_peripheral!((APB_SARADC(unstable)));
_for_each_inner_peripheral!((ASSIST_DEBUG(unstable)));
_for_each_inner_peripheral!((DMA(unstable)));
_for_each_inner_peripheral!((DS(unstable)));
_for_each_inner_peripheral!((EXTMEM(unstable)));
_for_each_inner_peripheral!((GPIO(unstable)));
_for_each_inner_peripheral!((GPIO_SD(unstable)));
_for_each_inner_peripheral!((HMAC(unstable)));
_for_each_inner_peripheral!((I2C_ANA_MST(unstable)));
_for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
_for_each_inner_peripheral!((I2S0(unstable)));
_for_each_inner_peripheral!((I2S1(unstable)));
_for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
_for_each_inner_peripheral!((INTERRUPT_CORE1(unstable)));
_for_each_inner_peripheral!((IO_MUX(unstable)));
_for_each_inner_peripheral!((LCD_CAM(unstable)));
_for_each_inner_peripheral!((LEDC(unstable)));
_for_each_inner_peripheral!((LPWR(unstable)));
_for_each_inner_peripheral!((MCPWM0(unstable)));
_for_each_inner_peripheral!((MCPWM1(unstable)));
_for_each_inner_peripheral!((PCNT(unstable)));
_for_each_inner_peripheral!((PERI_BACKUP(unstable)));
_for_each_inner_peripheral!((RMT(unstable)));
_for_each_inner_peripheral!((RNG(unstable)));
_for_each_inner_peripheral!((RSA(unstable)));
_for_each_inner_peripheral!((RTC_CNTL(unstable)));
_for_each_inner_peripheral!((RTC_I2C(unstable)));
_for_each_inner_peripheral!((RTC_IO(unstable)));
_for_each_inner_peripheral!((SDHOST(unstable)));
_for_each_inner_peripheral!((SENS(unstable)));
_for_each_inner_peripheral!((SENSITIVE(unstable)));
_for_each_inner_peripheral!((SHA(unstable)));
_for_each_inner_peripheral!((SPI0(unstable)));
_for_each_inner_peripheral!((SPI1(unstable)));
_for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
_for_each_inner_peripheral!((SYSTEM(unstable)));
_for_each_inner_peripheral!((SYSTIMER(unstable)));
_for_each_inner_peripheral!((TIMG0(unstable)));
_for_each_inner_peripheral!((TIMG1(unstable)));
_for_each_inner_peripheral!((TWAI0(unstable)));
_for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
_for_each_inner_peripheral!((UART2));
_for_each_inner_peripheral!((UHCI0(unstable)));
_for_each_inner_peripheral!((USB0(unstable)));
_for_each_inner_peripheral!((USB_DEVICE(unstable)));
_for_each_inner_peripheral!((USB_WRAP(unstable)));
_for_each_inner_peripheral!((WCL(unstable)));
_for_each_inner_peripheral!((XTS_AES(unstable)));
_for_each_inner_peripheral!((DMA_CH0(unstable)));
_for_each_inner_peripheral!((DMA_CH1(unstable)));
_for_each_inner_peripheral!((DMA_CH2(unstable)));
_for_each_inner_peripheral!((DMA_CH3(unstable)));
_for_each_inner_peripheral!((DMA_CH4(unstable)));
_for_each_inner_peripheral!((ADC1(unstable)));
_for_each_inner_peripheral!((ADC2(unstable)));
_for_each_inner_peripheral!((BT(unstable)));
_for_each_inner_peripheral!((CPU_CTRL(unstable)));
_for_each_inner_peripheral!((FLASH(unstable)));
_for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
_for_each_inner_peripheral!((PSRAM(unstable)));
_for_each_inner_peripheral!((SW_INTERRUPT(unstable)));
_for_each_inner_peripheral!((ULP_RISCV_CORE(unstable)));
_for_each_inner_peripheral!((WIFI)); _for_each_inner_peripheral!((SPI2, Spi2,
0)); _for_each_inner_peripheral!((SPI3, Spi3, 1));
_for_each_inner_peripheral!((UHCI0, Uhci0, 2));
_for_each_inner_peripheral!((I2S0, I2s0, 3)); _for_each_inner_peripheral!((I2S1,
I2s1, 4)); _for_each_inner_peripheral!((LCD_CAM, LcdCam, 5));
_for_each_inner_peripheral!((AES, Aes, 6)); _for_each_inner_peripheral!((SHA,
Sha, 7)); _for_each_inner_peripheral!((APB_SARADC, ApbSaradc, 8));
_for_each_inner_peripheral!((RMT, Rmt, 9)); _for_each_inner_peripheral!((all(@
peri_type #[doc = "GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""]
#[doc = "<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()), (@ peri_type #[doc =
"GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
"GPIO2 peripheral singleton"] GPIO2 <= virtual()), (@ peri_type #[doc =
"GPIO3 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO3 <= virtual()), (@ peri_type #[doc =
"GPIO4 peripheral singleton"] GPIO4 <= virtual()), (@ peri_type #[doc =
"GPIO5 peripheral singleton"] GPIO5 <= virtual()), (@ peri_type #[doc =
"GPIO6 peripheral singleton"] GPIO6 <= virtual()), (@ peri_type #[doc =
"GPIO7 peripheral singleton"] GPIO7 <= virtual()), (@ peri_type #[doc =
"GPIO8 peripheral singleton"] GPIO8 <= virtual()), (@ peri_type #[doc =
"GPIO9 peripheral singleton"] GPIO9 <= virtual()), (@ peri_type #[doc =
"GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
"GPIO11 peripheral singleton"] GPIO11 <= virtual()), (@ peri_type #[doc =
"GPIO12 peripheral singleton"] GPIO12 <= virtual()), (@ peri_type #[doc =
"GPIO13 peripheral singleton"] GPIO13 <= virtual()), (@ peri_type #[doc =
"GPIO14 peripheral singleton"] GPIO14 <= virtual()), (@ peri_type #[doc =
"GPIO15 peripheral singleton"] GPIO15 <= virtual()), (@ peri_type #[doc =
"GPIO16 peripheral singleton"] GPIO16 <= virtual()), (@ peri_type #[doc =
"GPIO17 peripheral singleton"] GPIO17 <= virtual()), (@ peri_type #[doc =
"GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
"GPIO19 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
#[doc = "</section>"] GPIO19 <= virtual()), (@ peri_type #[doc =
"GPIO20 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using USB.</li>"] #[doc = "</ul>"]
#[doc = "</section>"] GPIO20 <= virtual()), (@ peri_type #[doc =
"GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
"GPIO26 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO26 <= virtual()), (@ peri_type #[doc =
"GPIO27 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO27 <= virtual()), (@ peri_type #[doc =
"GPIO28 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO28 <= virtual()), (@ peri_type #[doc =
"GPIO29 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO29 <= virtual()), (@ peri_type #[doc =
"GPIO30 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO30 <= virtual()), (@ peri_type #[doc =
"GPIO31 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO31 <= virtual()), (@ peri_type #[doc =
"GPIO32 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO32 <= virtual()), (@ peri_type #[doc =
"GPIO33 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO33 <= virtual()), (@ peri_type #[doc =
"GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
"GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
"GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
"GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with Octal SPI flash.</li>"] #[doc
= "<li>This pin may be reserved for interfacing with Octal SPI PSRAM.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
"GPIO38 peripheral singleton"] GPIO38 <= virtual()), (@ peri_type #[doc =
"GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
"GPIO40 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO40 <= virtual()), (@ peri_type #[doc =
"GPIO41 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO41 <= virtual()), (@ peri_type #[doc =
"GPIO42 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>These pins may be used to debug the chip using an external JTAG debugger.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO42 <= virtual()), (@ peri_type #[doc =
"GPIO43 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO43 <= virtual()), (@ peri_type #[doc =
"GPIO44 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>By default, this pin is used by the UART programming interface.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO44 <= virtual()), (@ peri_type #[doc =
"GPIO45 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO45 <= virtual()), (@ peri_type #[doc =
"GPIO46 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO46 <= virtual()), (@ peri_type #[doc =
"GPIO47 peripheral singleton"] GPIO47 <= virtual()), (@ peri_type #[doc =
"GPIO48 peripheral singleton"] GPIO48 <= virtual()), (@ peri_type #[doc =
"AES peripheral singleton"] AES <= AES(AES : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
= "APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)), (@
peri_type #[doc = "APB_SARADC peripheral singleton"] APB_SARADC <= APB_SARADC()
(unstable)), (@ peri_type #[doc = "ASSIST_DEBUG peripheral singleton"]
ASSIST_DEBUG <= ASSIST_DEBUG() (unstable)), (@ peri_type #[doc =
"DMA peripheral singleton"] DMA <= DMA() (unstable)), (@ peri_type #[doc =
"DS peripheral singleton"] DS <= DS() (unstable)), (@ peri_type #[doc =
"EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@ peri_type #[doc =
"EXTMEM peripheral singleton"] EXTMEM <= EXTMEM() (unstable)), (@ peri_type #[doc
= "GPIO peripheral singleton"] GPIO <= GPIO() (unstable)), (@ peri_type #[doc =
"GPIO_SD peripheral singleton"] GPIO_SD <= GPIO_SD() (unstable)), (@ peri_type
#[doc = "HMAC peripheral singleton"] HMAC <= HMAC() (unstable)), (@ peri_type
#[doc = "I2C_ANA_MST peripheral singleton"] I2C_ANA_MST <= I2C_ANA_MST()
(unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"] I2C0 <=
I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt })), (@ peri_type #[doc = "I2C1 peripheral singleton"]
I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt })), (@ peri_type #[doc = "I2S0 peripheral singleton"]
I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
"I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
= "INTERRUPT_CORE0 peripheral singleton"] INTERRUPT_CORE0 <= INTERRUPT_CORE0()
(unstable)), (@ peri_type #[doc = "INTERRUPT_CORE1 peripheral singleton"]
INTERRUPT_CORE1 <= INTERRUPT_CORE1() (unstable)), (@ peri_type #[doc =
"IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type #[doc
= "LCD_CAM peripheral singleton"] LCD_CAM <= LCD_CAM() (unstable)), (@ peri_type
#[doc = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)), (@ peri_type
#[doc = "LPWR peripheral singleton"] LPWR <= RTC_CNTL() (unstable)), (@ peri_type
#[doc = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)), (@
peri_type #[doc = "MCPWM1 peripheral singleton"] MCPWM1 <= MCPWM1() (unstable)),
(@ peri_type #[doc = "PCNT peripheral singleton"] PCNT <= PCNT() (unstable)), (@
peri_type #[doc = "PERI_BACKUP peripheral singleton"] PERI_BACKUP <=
PERI_BACKUP() (unstable)), (@ peri_type #[doc = "RMT peripheral singleton"] RMT
<= RMT() (unstable)), (@ peri_type #[doc = "RNG peripheral singleton"] RNG <=
RNG() (unstable)), (@ peri_type #[doc = "RSA peripheral singleton"] RSA <=
RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
(unstable)), (@ peri_type #[doc = "RTC_CNTL peripheral singleton"] RTC_CNTL <=
RTC_CNTL() (unstable)), (@ peri_type #[doc = "RTC_I2C peripheral singleton"]
RTC_I2C <= RTC_I2C() (unstable)), (@ peri_type #[doc =
"RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)), (@ peri_type #[doc
= "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)), (@ peri_type
#[doc = "SENS peripheral singleton"] SENS <= SENS() (unstable)), (@ peri_type
#[doc = "SENSITIVE peripheral singleton"] SENSITIVE <= SENSITIVE() (unstable)),
(@ peri_type #[doc = "SHA peripheral singleton"] SHA <= SHA(SHA : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
(unstable)), (@ peri_type #[doc = "SPI0 peripheral singleton"] SPI0 <= SPI0()
(unstable)), (@ peri_type #[doc = "SPI1 peripheral singleton"] SPI1 <= SPI1()
(unstable)), (@ peri_type #[doc = "SPI2 peripheral singleton"] SPI2 <= SPI2(SPI2
: { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
peri_type #[doc = "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3 : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
peri_type #[doc = "SYSTEM peripheral singleton"] SYSTEM <= SYSTEM() (unstable)),
(@ peri_type #[doc = "SYSTIMER peripheral singleton"] SYSTIMER <= SYSTIMER()
(unstable)), (@ peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0()
(unstable)), (@ peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1()
(unstable)), (@ peri_type #[doc = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0()
(unstable)), (@ peri_type #[doc = "UART0 peripheral singleton"] UART0 <=
UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt })), (@ peri_type #[doc = "UART1 peripheral singleton"]
UART1 <= UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt })), (@ peri_type #[doc = "UART2 peripheral singleton"]
UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt })), (@ peri_type #[doc = "UHCI0 peripheral singleton"]
UHCI0 <= UHCI0() (unstable)), (@ peri_type #[doc = "USB0 peripheral singleton"]
USB0 <= USB0() (unstable)), (@ peri_type #[doc =
"USB_DEVICE peripheral singleton"] USB_DEVICE <= USB_DEVICE(USB_DEVICE : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
(unstable)), (@ peri_type #[doc = "USB_WRAP peripheral singleton"] USB_WRAP <=
USB_WRAP() (unstable)), (@ peri_type #[doc = "WCL peripheral singleton"] WCL <=
WCL() (unstable)), (@ peri_type #[doc = "XTS_AES peripheral singleton"] XTS_AES
<= XTS_AES() (unstable)), (@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
DMA_CH0 <= virtual() (unstable)), (@ peri_type #[doc =
"DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual() (unstable)), (@ peri_type
#[doc = "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual() (unstable)), (@
peri_type #[doc = "DMA_CH3 peripheral singleton"] DMA_CH3 <= virtual()
(unstable)), (@ peri_type #[doc = "DMA_CH4 peripheral singleton"] DMA_CH4 <=
virtual() (unstable)), (@ peri_type #[doc = "ADC1 peripheral singleton"] ADC1 <=
virtual() (unstable)), (@ peri_type #[doc = "ADC2 peripheral singleton"] ADC2 <=
virtual() (unstable)), (@ peri_type #[doc = "BT peripheral singleton"] BT <=
virtual(BT_BB : { bind_bb_interrupt, enable_bb_interrupt, disable_bb_interrupt },
RWBLE : { bind_rwble_interrupt, enable_rwble_interrupt, disable_rwble_interrupt
}) (unstable)), (@ peri_type #[doc = "CPU_CTRL peripheral singleton"] CPU_CTRL <=
virtual() (unstable)), (@ peri_type #[doc = "FLASH peripheral singleton"] FLASH
<= virtual() (unstable)), (@ peri_type #[doc =
"GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual() (unstable)),
(@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
(unstable)), (@ peri_type #[doc = "SW_INTERRUPT peripheral singleton"]
SW_INTERRUPT <= virtual() (unstable)), (@ peri_type #[doc =
"ULP_RISCV_CORE peripheral singleton"] ULP_RISCV_CORE <= virtual() (unstable)),
(@ peri_type #[doc = "WIFI peripheral singleton"] WIFI <= virtual(WIFI_MAC : {
bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt }, WIFI_PWR : {
bind_pwr_interrupt, enable_pwr_interrupt, disable_pwr_interrupt }))));
_for_each_inner_peripheral!((singletons(GPIO0), (GPIO1), (GPIO2), (GPIO3),
(GPIO4), (GPIO5), (GPIO6), (GPIO7), (GPIO8), (GPIO9), (GPIO10), (GPIO11),
(GPIO12), (GPIO13), (GPIO14), (GPIO15), (GPIO16), (GPIO17), (GPIO18), (GPIO19),
(GPIO20), (GPIO21), (GPIO26), (GPIO27), (GPIO28), (GPIO29), (GPIO30), (GPIO31),
(GPIO32), (GPIO33), (GPIO34), (GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39),
(GPIO40), (GPIO41), (GPIO42), (GPIO43), (GPIO44), (GPIO45), (GPIO46), (GPIO47),
(GPIO48), (AES(unstable)), (APB_CTRL(unstable)), (APB_SARADC(unstable)),
(ASSIST_DEBUG(unstable)), (DMA(unstable)), (DS(unstable)), (EXTMEM(unstable)),
(GPIO(unstable)), (GPIO_SD(unstable)), (HMAC(unstable)), (I2C_ANA_MST(unstable)),
(I2C0), (I2C1), (I2S0(unstable)), (I2S1(unstable)), (INTERRUPT_CORE0(unstable)),
(INTERRUPT_CORE1(unstable)), (IO_MUX(unstable)), (LCD_CAM(unstable)),
(LEDC(unstable)), (LPWR(unstable)), (MCPWM0(unstable)), (MCPWM1(unstable)),
(PCNT(unstable)), (PERI_BACKUP(unstable)), (RMT(unstable)), (RNG(unstable)),
(RSA(unstable)), (RTC_CNTL(unstable)), (RTC_I2C(unstable)), (RTC_IO(unstable)),
(SDHOST(unstable)), (SENS(unstable)), (SENSITIVE(unstable)), (SHA(unstable)),
(SPI0(unstable)), (SPI1(unstable)), (SPI2), (SPI3), (SYSTEM(unstable)),
(SYSTIMER(unstable)), (TIMG0(unstable)), (TIMG1(unstable)), (TWAI0(unstable)),
(UART0), (UART1), (UART2), (UHCI0(unstable)), (USB0(unstable)),
(USB_DEVICE(unstable)), (USB_WRAP(unstable)), (WCL(unstable)),
(XTS_AES(unstable)), (DMA_CH0(unstable)), (DMA_CH1(unstable)),
(DMA_CH2(unstable)), (DMA_CH3(unstable)), (DMA_CH4(unstable)), (ADC1(unstable)),
(ADC2(unstable)), (BT(unstable)), (CPU_CTRL(unstable)), (FLASH(unstable)),
(GPIO_DEDICATED(unstable)), (PSRAM(unstable)), (SW_INTERRUPT(unstable)),
(ULP_RISCV_CORE(unstable)), (WIFI)));
_for_each_inner_peripheral!((dma_eligible(SPI2, Spi2, 0), (SPI3, Spi3, 1),
(UHCI0, Uhci0, 2), (I2S0, I2s0, 3), (I2S1, I2s1, 4), (LCD_CAM, LcdCam, 5), (AES,
Aes, 6), (SHA, Sha, 7), (APB_SARADC, ApbSaradc, 8), (RMT, Rmt, 9)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_gpio {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_gpio { $(($pattern) => $code;)* ($other : tt) => {}
} _for_each_inner_gpio!((0, GPIO0() () ([Input] [Output])));
_for_each_inner_gpio!((1, GPIO1() () ([Input] [Output])));
_for_each_inner_gpio!((2, GPIO2() () ([Input] [Output])));
_for_each_inner_gpio!((3, GPIO3() () ([Input] [Output])));
_for_each_inner_gpio!((4, GPIO4() () ([Input] [Output])));
_for_each_inner_gpio!((5, GPIO5() () ([Input] [Output])));
_for_each_inner_gpio!((6, GPIO6() () ([Input] [Output])));
_for_each_inner_gpio!((7, GPIO7() () ([Input] [Output])));
_for_each_inner_gpio!((8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])));
_for_each_inner_gpio!((9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4
=> FSPIHD) ([Input] [Output]))); _for_each_inner_gpio!((10, GPIO10(_2 => FSPIIO4
_4 => FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input]
[Output]))); _for_each_inner_gpio!((11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 =>
FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output])));
_for_each_inner_gpio!((12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
=> SUBSPICLK _4 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((13,
GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4
=> FSPIQ) ([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14(_3 => SUBSPIWP
_4 => FSPIWP) (_2 => FSPIDQS _3 => SUBSPIWP _4 => FSPIWP) ([Input] [Output])));
_for_each_inner_gpio!((15, GPIO15() (_2 => U0RTS) ([Input] [Output])));
_for_each_inner_gpio!((16, GPIO16(_2 => U0CTS) () ([Input] [Output])));
_for_each_inner_gpio!((17, GPIO17() (_2 => U1TXD) ([Input] [Output])));
_for_each_inner_gpio!((18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
[Output]))); _for_each_inner_gpio!((19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2)
([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20(_2 => U1CTS) (_3 =>
CLK_OUT1) ([Input] [Output]))); _for_each_inner_gpio!((21, GPIO21() () ([Input]
[Output]))); _for_each_inner_gpio!((26, GPIO26() (_0 => SPICS1) ([Input]
[Output]))); _for_each_inner_gpio!((27, GPIO27(_0 => SPIHD) (_0 => SPIHD)
([Input] [Output]))); _for_each_inner_gpio!((28, GPIO28(_0 => SPIWP) (_0 =>
SPIWP) ([Input] [Output]))); _for_each_inner_gpio!((29, GPIO29() (_0 => SPICS0)
([Input] [Output]))); _for_each_inner_gpio!((30, GPIO30() (_0 => SPICLK) ([Input]
[Output]))); _for_each_inner_gpio!((31, GPIO31(_0 => SPIQ) (_0 => SPIQ) ([Input]
[Output]))); _for_each_inner_gpio!((32, GPIO32(_0 => SPID) (_0 => SPID) ([Input]
[Output]))); _for_each_inner_gpio!((33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 =>
SPIIO4) (_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])));
_for_each_inner_gpio!((34, GPIO34(_2 => FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3
=> SUBSPICS0 _4 => SPIIO5) ([Input] [Output]))); _for_each_inner_gpio!((35,
GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3 => SUBSPID _4 =>
SPIIO6) ([Input] [Output]))); _for_each_inner_gpio!((36, GPIO36(_2 => FSPICLK _4
=> SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])));
_for_each_inner_gpio!((37, GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 =>
FSPIQ _3 => SUBSPIQ _4 => SPIDQS) ([Input] [Output])));
_for_each_inner_gpio!((38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 => FSPIWP _3
=> SUBSPIWP) ([Input] [Output]))); _for_each_inner_gpio!((39, GPIO39(_0 => MTCK)
(_2 => CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output]))); _for_each_inner_gpio!((40,
GPIO40() (_0 => MTDO _2 => CLK_OUT2) ([Input] [Output])));
_for_each_inner_gpio!((41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
[Output]))); _for_each_inner_gpio!((42, GPIO42(_0 => MTMS) () ([Input]
[Output]))); _for_each_inner_gpio!((43, GPIO43() (_0 => U0TXD _2 => CLK_OUT1)
([Input] [Output]))); _for_each_inner_gpio!((44, GPIO44(_0 => U0RXD) (_2 =>
CLK_OUT2) ([Input] [Output]))); _for_each_inner_gpio!((45, GPIO45() () ([Input]
[Output]))); _for_each_inner_gpio!((46, GPIO46() () ([Input] [Output])));
_for_each_inner_gpio!((47, GPIO47() (_0 => SPICLK_P_DIFF _2 => SUBSPICLK_P_DIFF)
([Input] [Output]))); _for_each_inner_gpio!((48, GPIO48() (_0 => SPICLK_N_DIFF _2
=> SUBSPICLK_N_DIFF) ([Input] [Output]))); _for_each_inner_gpio!((all(0, GPIO0()
() ([Input] [Output])), (1, GPIO1() () ([Input] [Output])), (2, GPIO2() ()
([Input] [Output])), (3, GPIO3() () ([Input] [Output])), (4, GPIO4() () ([Input]
[Output])), (5, GPIO5() () ([Input] [Output])), (6, GPIO6() () ([Input]
[Output])), (7, GPIO7() () ([Input] [Output])), (8, GPIO8() (_3 => SUBSPICS1)
([Input] [Output])), (9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4 =>
FSPIHD) ([Input] [Output])), (10, GPIO10(_2 => FSPIIO4 _4 => FSPICS0) (_2 =>
FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input] [Output])), (11, GPIO11(_2 =>
FSPIIO5 _3 => SUBSPID _4 => FSPID) (_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID)
([Input] [Output])), (12, GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3
=> SUBSPICLK _4 => FSPICLK) ([Input] [Output])), (13, GPIO13(_2 => FSPIIO7 _3 =>
SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) ([Input]
[Output])), (14, GPIO14(_3 => SUBSPIWP _4 => FSPIWP) (_2 => FSPIDQS _3 =>
SUBSPIWP _4 => FSPIWP) ([Input] [Output])), (15, GPIO15() (_2 => U0RTS) ([Input]
[Output])), (16, GPIO16(_2 => U0CTS) () ([Input] [Output])), (17, GPIO17() (_2 =>
U1TXD) ([Input] [Output])), (18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
[Output])), (19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2) ([Input] [Output])), (20,
GPIO20(_2 => U1CTS) (_3 => CLK_OUT1) ([Input] [Output])), (21, GPIO21() ()
([Input] [Output])), (26, GPIO26() (_0 => SPICS1) ([Input] [Output])), (27,
GPIO27(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])), (28, GPIO28(_0 => SPIWP)
(_0 => SPIWP) ([Input] [Output])), (29, GPIO29() (_0 => SPICS0) ([Input]
[Output])), (30, GPIO30() (_0 => SPICLK) ([Input] [Output])), (31, GPIO31(_0 =>
SPIQ) (_0 => SPIQ) ([Input] [Output])), (32, GPIO32(_0 => SPID) (_0 => SPID)
([Input] [Output])), (33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD _4 => SPIIO4) (_2 =>
FSPIHD _3 => SUBSPIHD _4 => SPIIO4) ([Input] [Output])), (34, GPIO34(_2 =>
FSPICS0 _4 => SPIIO5) (_2 => FSPICS0 _3 => SUBSPICS0 _4 => SPIIO5) ([Input]
[Output])), (35, GPIO35(_2 => FSPID _3 => SUBSPID _4 => SPIIO6) (_2 => FSPID _3
=> SUBSPID _4 => SPIIO6) ([Input] [Output])), (36, GPIO36(_2 => FSPICLK _4 =>
SPIIO7) (_2 => FSPICLK _3 => SUBSPICLK _4 => SPIIO7) ([Input] [Output])), (37,
GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 =>
SPIDQS) ([Input] [Output])), (38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 =>
FSPIWP _3 => SUBSPIWP) ([Input] [Output])), (39, GPIO39(_0 => MTCK) (_2 =>
CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output])), (40, GPIO40() (_0 => MTDO _2 =>
CLK_OUT2) ([Input] [Output])), (41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
[Output])), (42, GPIO42(_0 => MTMS) () ([Input] [Output])), (43, GPIO43() (_0 =>
U0TXD _2 => CLK_OUT1) ([Input] [Output])), (44, GPIO44(_0 => U0RXD) (_2 =>
CLK_OUT2) ([Input] [Output])), (45, GPIO45() () ([Input] [Output])), (46,
GPIO46() () ([Input] [Output])), (47, GPIO47() (_0 => SPICLK_P_DIFF _2 =>
SUBSPICLK_P_DIFF) ([Input] [Output])), (48, GPIO48() (_0 => SPICLK_N_DIFF _2 =>
SUBSPICLK_N_DIFF) ([Input] [Output]))));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_analog_function {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_analog_function { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_analog_function!((TOUCH1, GPIO1));
_for_each_inner_analog_function!((ADC1_CH0, GPIO1));
_for_each_inner_analog_function!((TOUCH2, GPIO2));
_for_each_inner_analog_function!((ADC1_CH1, GPIO2));
_for_each_inner_analog_function!((TOUCH3, GPIO3));
_for_each_inner_analog_function!((ADC1_CH2, GPIO3));
_for_each_inner_analog_function!((TOUCH4, GPIO4));
_for_each_inner_analog_function!((ADC1_CH3, GPIO4));
_for_each_inner_analog_function!((TOUCH5, GPIO5));
_for_each_inner_analog_function!((ADC1_CH4, GPIO5));
_for_each_inner_analog_function!((TOUCH6, GPIO6));
_for_each_inner_analog_function!((ADC1_CH5, GPIO6));
_for_each_inner_analog_function!((TOUCH7, GPIO7));
_for_each_inner_analog_function!((ADC1_CH6, GPIO7));
_for_each_inner_analog_function!((TOUCH8, GPIO8));
_for_each_inner_analog_function!((ADC1_CH7, GPIO8));
_for_each_inner_analog_function!((TOUCH9, GPIO9));
_for_each_inner_analog_function!((ADC1_CH8, GPIO9));
_for_each_inner_analog_function!((TOUCH10, GPIO10));
_for_each_inner_analog_function!((ADC1_CH9, GPIO10));
_for_each_inner_analog_function!((TOUCH11, GPIO11));
_for_each_inner_analog_function!((ADC2_CH0, GPIO11));
_for_each_inner_analog_function!((TOUCH12, GPIO12));
_for_each_inner_analog_function!((ADC2_CH1, GPIO12));
_for_each_inner_analog_function!((TOUCH13, GPIO13));
_for_each_inner_analog_function!((ADC2_CH2, GPIO13));
_for_each_inner_analog_function!((TOUCH14, GPIO14));
_for_each_inner_analog_function!((ADC2_CH3, GPIO14));
_for_each_inner_analog_function!((XTAL_32K_P, GPIO15));
_for_each_inner_analog_function!((ADC2_CH4, GPIO15));
_for_each_inner_analog_function!((XTAL_32K_N, GPIO16));
_for_each_inner_analog_function!((ADC2_CH5, GPIO16));
_for_each_inner_analog_function!((ADC2_CH6, GPIO17));
_for_each_inner_analog_function!((ADC2_CH7, GPIO18));
_for_each_inner_analog_function!((USB_DM, GPIO19));
_for_each_inner_analog_function!((ADC2_CH8, GPIO19));
_for_each_inner_analog_function!((USB_DP, GPIO20));
_for_each_inner_analog_function!((ADC2_CH9, GPIO20));
_for_each_inner_analog_function!(((TOUCH1, TOUCHn, 1), GPIO1));
_for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1));
_for_each_inner_analog_function!(((TOUCH2, TOUCHn, 2), GPIO2));
_for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2));
_for_each_inner_analog_function!(((TOUCH3, TOUCHn, 3), GPIO3));
_for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3));
_for_each_inner_analog_function!(((TOUCH4, TOUCHn, 4), GPIO4));
_for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4));
_for_each_inner_analog_function!(((TOUCH5, TOUCHn, 5), GPIO5));
_for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5));
_for_each_inner_analog_function!(((TOUCH6, TOUCHn, 6), GPIO6));
_for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6));
_for_each_inner_analog_function!(((TOUCH7, TOUCHn, 7), GPIO7));
_for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7));
_for_each_inner_analog_function!(((TOUCH8, TOUCHn, 8), GPIO8));
_for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8));
_for_each_inner_analog_function!(((TOUCH9, TOUCHn, 9), GPIO9));
_for_each_inner_analog_function!(((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9));
_for_each_inner_analog_function!(((TOUCH10, TOUCHn, 10), GPIO10));
_for_each_inner_analog_function!(((ADC1_CH9, ADCn_CHm, 1, 9), GPIO10));
_for_each_inner_analog_function!(((TOUCH11, TOUCHn, 11), GPIO11));
_for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11));
_for_each_inner_analog_function!(((TOUCH12, TOUCHn, 12), GPIO12));
_for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12));
_for_each_inner_analog_function!(((TOUCH13, TOUCHn, 13), GPIO13));
_for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13));
_for_each_inner_analog_function!(((TOUCH14, TOUCHn, 14), GPIO14));
_for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14));
_for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15));
_for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16));
_for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17));
_for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18));
_for_each_inner_analog_function!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19));
_for_each_inner_analog_function!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20));
_for_each_inner_analog_function!((all(TOUCH1, GPIO1), (ADC1_CH0, GPIO1), (TOUCH2,
GPIO2), (ADC1_CH1, GPIO2), (TOUCH3, GPIO3), (ADC1_CH2, GPIO3), (TOUCH4, GPIO4),
(ADC1_CH3, GPIO4), (TOUCH5, GPIO5), (ADC1_CH4, GPIO5), (TOUCH6, GPIO6),
(ADC1_CH5, GPIO6), (TOUCH7, GPIO7), (ADC1_CH6, GPIO7), (TOUCH8, GPIO8),
(ADC1_CH7, GPIO8), (TOUCH9, GPIO9), (ADC1_CH8, GPIO9), (TOUCH10, GPIO10),
(ADC1_CH9, GPIO10), (TOUCH11, GPIO11), (ADC2_CH0, GPIO11), (TOUCH12, GPIO12),
(ADC2_CH1, GPIO12), (TOUCH13, GPIO13), (ADC2_CH2, GPIO13), (TOUCH14, GPIO14),
(ADC2_CH3, GPIO14), (XTAL_32K_P, GPIO15), (ADC2_CH4, GPIO15), (XTAL_32K_N,
GPIO16), (ADC2_CH5, GPIO16), (ADC2_CH6, GPIO17), (ADC2_CH7, GPIO18), (USB_DM,
GPIO19), (ADC2_CH8, GPIO19), (USB_DP, GPIO20), (ADC2_CH9, GPIO20)));
_for_each_inner_analog_function!((all_expanded((TOUCH1, TOUCHn, 1), GPIO1),
((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1), ((TOUCH2, TOUCHn, 2), GPIO2), ((ADC1_CH1,
ADCn_CHm, 1, 1), GPIO2), ((TOUCH3, TOUCHn, 3), GPIO3), ((ADC1_CH2, ADCn_CHm, 1,
2), GPIO3), ((TOUCH4, TOUCHn, 4), GPIO4), ((ADC1_CH3, ADCn_CHm, 1, 3), GPIO4),
((TOUCH5, TOUCHn, 5), GPIO5), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5), ((TOUCH6,
TOUCHn, 6), GPIO6), ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6), ((TOUCH7, TOUCHn, 7),
GPIO7), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7), ((TOUCH8, TOUCHn, 8), GPIO8),
((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8), ((TOUCH9, TOUCHn, 9), GPIO9), ((ADC1_CH8,
ADCn_CHm, 1, 8), GPIO9), ((TOUCH10, TOUCHn, 10), GPIO10), ((ADC1_CH9, ADCn_CHm,
1, 9), GPIO10), ((TOUCH11, TOUCHn, 11), GPIO11), ((ADC2_CH0, ADCn_CHm, 2, 0),
GPIO11), ((TOUCH12, TOUCHn, 12), GPIO12), ((ADC2_CH1, ADCn_CHm, 2, 1), GPIO12),
((TOUCH13, TOUCHn, 13), GPIO13), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13), ((TOUCH14,
TOUCHn, 14), GPIO14), ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14), ((ADC2_CH4, ADCn_CHm,
2, 4), GPIO15), ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16), ((ADC2_CH6, ADCn_CHm, 2,
6), GPIO17), ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18), ((ADC2_CH8, ADCn_CHm, 2, 8),
GPIO19), ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_lp_function {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_lp_function { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_lp_function!((RTC_GPIO0, GPIO0));
_for_each_inner_lp_function!((SAR_I2C_SCL_0, GPIO0));
_for_each_inner_lp_function!((RTC_GPIO1, GPIO1));
_for_each_inner_lp_function!((SAR_I2C_SDA_0, GPIO1));
_for_each_inner_lp_function!((RTC_GPIO2, GPIO2));
_for_each_inner_lp_function!((SAR_I2C_SCL_1, GPIO2));
_for_each_inner_lp_function!((RTC_GPIO3, GPIO3));
_for_each_inner_lp_function!((SAR_I2C_SDA_1, GPIO3));
_for_each_inner_lp_function!((RTC_GPIO4, GPIO4));
_for_each_inner_lp_function!((RTC_GPIO5, GPIO5));
_for_each_inner_lp_function!((RTC_GPIO6, GPIO6));
_for_each_inner_lp_function!((RTC_GPIO7, GPIO7));
_for_each_inner_lp_function!((RTC_GPIO8, GPIO8));
_for_each_inner_lp_function!((RTC_GPIO9, GPIO9));
_for_each_inner_lp_function!((RTC_GPIO10, GPIO10));
_for_each_inner_lp_function!((RTC_GPIO11, GPIO11));
_for_each_inner_lp_function!((RTC_GPIO12, GPIO12));
_for_each_inner_lp_function!((RTC_GPIO13, GPIO13));
_for_each_inner_lp_function!((RTC_GPIO14, GPIO14));
_for_each_inner_lp_function!((RTC_GPIO15, GPIO15));
_for_each_inner_lp_function!((RTC_GPIO16, GPIO16));
_for_each_inner_lp_function!((RTC_GPIO17, GPIO17));
_for_each_inner_lp_function!((RTC_GPIO18, GPIO18));
_for_each_inner_lp_function!((RTC_GPIO19, GPIO19));
_for_each_inner_lp_function!((RTC_GPIO20, GPIO20));
_for_each_inner_lp_function!((RTC_GPIO21, GPIO21));
_for_each_inner_lp_function!(((RTC_GPIO0, RTC_GPIOn, 0), GPIO0));
_for_each_inner_lp_function!(((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0), GPIO0));
_for_each_inner_lp_function!(((RTC_GPIO1, RTC_GPIOn, 1), GPIO1));
_for_each_inner_lp_function!(((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0), GPIO1));
_for_each_inner_lp_function!(((RTC_GPIO2, RTC_GPIOn, 2), GPIO2));
_for_each_inner_lp_function!(((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2));
_for_each_inner_lp_function!(((RTC_GPIO3, RTC_GPIOn, 3), GPIO3));
_for_each_inner_lp_function!(((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1), GPIO3));
_for_each_inner_lp_function!(((RTC_GPIO4, RTC_GPIOn, 4), GPIO4));
_for_each_inner_lp_function!(((RTC_GPIO5, RTC_GPIOn, 5), GPIO5));
_for_each_inner_lp_function!(((RTC_GPIO6, RTC_GPIOn, 6), GPIO6));
_for_each_inner_lp_function!(((RTC_GPIO7, RTC_GPIOn, 7), GPIO7));
_for_each_inner_lp_function!(((RTC_GPIO8, RTC_GPIOn, 8), GPIO8));
_for_each_inner_lp_function!(((RTC_GPIO9, RTC_GPIOn, 9), GPIO9));
_for_each_inner_lp_function!(((RTC_GPIO10, RTC_GPIOn, 10), GPIO10));
_for_each_inner_lp_function!(((RTC_GPIO11, RTC_GPIOn, 11), GPIO11));
_for_each_inner_lp_function!(((RTC_GPIO12, RTC_GPIOn, 12), GPIO12));
_for_each_inner_lp_function!(((RTC_GPIO13, RTC_GPIOn, 13), GPIO13));
_for_each_inner_lp_function!(((RTC_GPIO14, RTC_GPIOn, 14), GPIO14));
_for_each_inner_lp_function!(((RTC_GPIO15, RTC_GPIOn, 15), GPIO15));
_for_each_inner_lp_function!(((RTC_GPIO16, RTC_GPIOn, 16), GPIO16));
_for_each_inner_lp_function!(((RTC_GPIO17, RTC_GPIOn, 17), GPIO17));
_for_each_inner_lp_function!(((RTC_GPIO18, RTC_GPIOn, 18), GPIO18));
_for_each_inner_lp_function!(((RTC_GPIO19, RTC_GPIOn, 19), GPIO19));
_for_each_inner_lp_function!(((RTC_GPIO20, RTC_GPIOn, 20), GPIO20));
_for_each_inner_lp_function!(((RTC_GPIO21, RTC_GPIOn, 21), GPIO21));
_for_each_inner_lp_function!((all(RTC_GPIO0, GPIO0), (SAR_I2C_SCL_0, GPIO0),
(RTC_GPIO1, GPIO1), (SAR_I2C_SDA_0, GPIO1), (RTC_GPIO2, GPIO2), (SAR_I2C_SCL_1,
GPIO2), (RTC_GPIO3, GPIO3), (SAR_I2C_SDA_1, GPIO3), (RTC_GPIO4, GPIO4),
(RTC_GPIO5, GPIO5), (RTC_GPIO6, GPIO6), (RTC_GPIO7, GPIO7), (RTC_GPIO8, GPIO8),
(RTC_GPIO9, GPIO9), (RTC_GPIO10, GPIO10), (RTC_GPIO11, GPIO11), (RTC_GPIO12,
GPIO12), (RTC_GPIO13, GPIO13), (RTC_GPIO14, GPIO14), (RTC_GPIO15, GPIO15),
(RTC_GPIO16, GPIO16), (RTC_GPIO17, GPIO17), (RTC_GPIO18, GPIO18), (RTC_GPIO19,
GPIO19), (RTC_GPIO20, GPIO20), (RTC_GPIO21, GPIO21)));
_for_each_inner_lp_function!((all_expanded((RTC_GPIO0, RTC_GPIOn, 0), GPIO0),
((SAR_I2C_SCL_0, SAR_I2C_SCL_n, 0), GPIO0), ((RTC_GPIO1, RTC_GPIOn, 1), GPIO1),
((SAR_I2C_SDA_0, SAR_I2C_SDA_n, 0), GPIO1), ((RTC_GPIO2, RTC_GPIOn, 2), GPIO2),
((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2), ((RTC_GPIO3, RTC_GPIOn, 3), GPIO3),
((SAR_I2C_SDA_1, SAR_I2C_SDA_n, 1), GPIO3), ((RTC_GPIO4, RTC_GPIOn, 4), GPIO4),
((RTC_GPIO5, RTC_GPIOn, 5), GPIO5), ((RTC_GPIO6, RTC_GPIOn, 6), GPIO6),
((RTC_GPIO7, RTC_GPIOn, 7), GPIO7), ((RTC_GPIO8, RTC_GPIOn, 8), GPIO8),
((RTC_GPIO9, RTC_GPIOn, 9), GPIO9), ((RTC_GPIO10, RTC_GPIOn, 10), GPIO10),
((RTC_GPIO11, RTC_GPIOn, 11), GPIO11), ((RTC_GPIO12, RTC_GPIOn, 12), GPIO12),
((RTC_GPIO13, RTC_GPIOn, 13), GPIO13), ((RTC_GPIO14, RTC_GPIOn, 14), GPIO14),
((RTC_GPIO15, RTC_GPIOn, 15), GPIO15), ((RTC_GPIO16, RTC_GPIOn, 16), GPIO16),
((RTC_GPIO17, RTC_GPIOn, 17), GPIO17), ((RTC_GPIO18, RTC_GPIOn, 18), GPIO18),
((RTC_GPIO19, RTC_GPIOn, 19), GPIO19), ((RTC_GPIO20, RTC_GPIOn, 20), GPIO20),
((RTC_GPIO21, RTC_GPIOn, 21), GPIO21)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! define_io_mux_signals {
() => {
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
#[derive(Debug, PartialEq, Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[doc(hidden)]
pub enum InputSignal {
SPIQ = 0,
SPID = 1,
SPIHD = 2,
SPIWP = 3,
SPID4 = 7,
SPID5 = 8,
SPID6 = 9,
SPID7 = 10,
SPIDQS = 11,
U0RXD = 12,
U0CTS = 13,
U0DSR = 14,
U1RXD = 15,
U1CTS = 16,
U1DSR = 17,
U2RXD = 18,
U2CTS = 19,
U2DSR = 20,
I2S1_MCLK = 21,
I2S0O_BCK = 22,
I2S0_MCLK = 23,
I2S0O_WS = 24,
I2S0I_SD = 25,
I2S0I_BCK = 26,
I2S0I_WS = 27,
I2S1O_BCK = 28,
I2S1O_WS = 29,
I2S1I_SD = 30,
I2S1I_BCK = 31,
I2S1I_WS = 32,
PCNT0_SIG_CH0 = 33,
PCNT0_SIG_CH1 = 34,
PCNT0_CTRL_CH0 = 35,
PCNT0_CTRL_CH1 = 36,
PCNT1_SIG_CH0 = 37,
PCNT1_SIG_CH1 = 38,
PCNT1_CTRL_CH0 = 39,
PCNT1_CTRL_CH1 = 40,
PCNT2_SIG_CH0 = 41,
PCNT2_SIG_CH1 = 42,
PCNT2_CTRL_CH0 = 43,
PCNT2_CTRL_CH1 = 44,
PCNT3_SIG_CH0 = 45,
PCNT3_SIG_CH1 = 46,
PCNT3_CTRL_CH0 = 47,
PCNT3_CTRL_CH1 = 48,
I2S0I_SD1 = 51,
I2S0I_SD2 = 52,
I2S0I_SD3 = 53,
CORE1_GPIO7 = 54,
USB_EXTPHY_VP = 55,
USB_EXTPHY_VM = 56,
USB_EXTPHY_RCV = 57,
USB_OTG_IDDIG = 58,
USB_OTG_AVALID = 59,
USB_SRP_BVALID = 60,
USB_OTG_VBUSVALID = 61,
USB_SRP_SESSEND = 62,
SPI3_CLK = 66,
SPI3_Q = 67,
SPI3_D = 68,
SPI3_HD = 69,
SPI3_WP = 70,
SPI3_CS0 = 71,
RMT_SIG_0 = 81,
RMT_SIG_1 = 82,
RMT_SIG_2 = 83,
RMT_SIG_3 = 84,
I2CEXT0_SCL = 89,
I2CEXT0_SDA = 90,
I2CEXT1_SCL = 91,
I2CEXT1_SDA = 92,
FSPICLK = 101,
FSPIQ = 102,
FSPID = 103,
FSPIHD = 104,
FSPIWP = 105,
FSPIIO4 = 106,
FSPIIO5 = 107,
FSPIIO6 = 108,
FSPIIO7 = 109,
FSPICS0 = 110,
TWAI_RX = 116,
SUBSPIQ = 120,
SUBSPID = 121,
SUBSPIHD = 122,
SUBSPIWP = 123,
CORE1_GPIO0 = 129,
CORE1_GPIO1 = 130,
CORE1_GPIO2 = 131,
CAM_DATA_0 = 133,
CAM_DATA_1 = 134,
CAM_DATA_2 = 135,
CAM_DATA_3 = 136,
CAM_DATA_4 = 137,
CAM_DATA_5 = 138,
CAM_DATA_6 = 139,
CAM_DATA_7 = 140,
CAM_DATA_8 = 141,
CAM_DATA_9 = 142,
CAM_DATA_10 = 143,
CAM_DATA_11 = 144,
CAM_DATA_12 = 145,
CAM_DATA_13 = 146,
CAM_DATA_14 = 147,
CAM_DATA_15 = 148,
CAM_PCLK = 149,
CAM_H_ENABLE = 150,
CAM_H_SYNC = 151,
CAM_V_SYNC = 152,
SUBSPID4 = 155,
SUBSPID5 = 156,
SUBSPID6 = 157,
SUBSPID7 = 158,
SUBSPIDQS = 159,
PWM0_SYNC0 = 160,
PWM0_SYNC1 = 161,
PWM0_SYNC2 = 162,
PWM0_F0 = 163,
PWM0_F1 = 164,
PWM0_F2 = 165,
PWM0_CAP0 = 166,
PWM0_CAP1 = 167,
PWM0_CAP2 = 168,
PWM1_SYNC0 = 169,
PWM1_SYNC1 = 170,
PWM1_SYNC2 = 171,
PWM1_F0 = 172,
PWM1_F1 = 173,
PWM1_F2 = 174,
PWM1_CAP0 = 175,
PWM1_CAP1 = 176,
PWM1_CAP2 = 177,
SDHOST_CCMD_IN_1 = 178,
SDHOST_CCMD_IN_2 = 179,
SDHOST_CDATA_IN_10 = 180,
SDHOST_CDATA_IN_11 = 181,
SDHOST_CDATA_IN_12 = 182,
SDHOST_CDATA_IN_13 = 183,
SDHOST_CDATA_IN_14 = 184,
SDHOST_CDATA_IN_15 = 185,
SDHOST_CDATA_IN_16 = 186,
SDHOST_CDATA_IN_17 = 187,
SDHOST_DATA_STROBE_1 = 192,
SDHOST_DATA_STROBE_2 = 193,
SDHOST_CARD_DETECT_N_1 = 194,
SDHOST_CARD_DETECT_N_2 = 195,
SDHOST_CARD_WRITE_PRT_1 = 196,
SDHOST_CARD_WRITE_PRT_2 = 197,
SDHOST_CARD_INT_N_1 = 198,
SDHOST_CARD_INT_N_2 = 199,
SDHOST_CDATA_IN_20 = 213,
SDHOST_CDATA_IN_21 = 214,
SDHOST_CDATA_IN_22 = 215,
SDHOST_CDATA_IN_23 = 216,
SDHOST_CDATA_IN_24 = 217,
SDHOST_CDATA_IN_25 = 218,
SDHOST_CDATA_IN_26 = 219,
SDHOST_CDATA_IN_27 = 220,
PRO_ALONEGPIO0 = 221,
PRO_ALONEGPIO1 = 222,
PRO_ALONEGPIO2 = 223,
PRO_ALONEGPIO3 = 224,
PRO_ALONEGPIO4 = 225,
PRO_ALONEGPIO5 = 226,
PRO_ALONEGPIO6 = 227,
PRO_ALONEGPIO7 = 228,
USB_JTAG_TDO_BRIDGE = 251,
CORE1_GPIO3 = 252,
CORE1_GPIO4 = 253,
CORE1_GPIO5 = 254,
CORE1_GPIO6 = 255,
SPIIO4,
SPIIO5,
SPIIO6,
SPIIO7,
MTDI,
MTCK,
MTMS,
}
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
#[derive(Debug, PartialEq, Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[doc(hidden)]
pub enum OutputSignal {
SPIQ = 0,
SPID = 1,
SPIHD = 2,
SPIWP = 3,
SPICLK = 4,
SPICS0 = 5,
SPICS1 = 6,
SPID4 = 7,
SPID5 = 8,
SPID6 = 9,
SPID7 = 10,
SPIDQS = 11,
U0TXD = 12,
U0RTS = 13,
U0DTR = 14,
U1TXD = 15,
U1RTS = 16,
U1DTR = 17,
U2TXD = 18,
U2RTS = 19,
U2DTR = 20,
I2S1_MCLK = 21,
I2S0O_BCK = 22,
I2S0_MCLK = 23,
I2S0O_WS = 24,
I2S0O_SD = 25,
I2S0I_BCK = 26,
I2S0I_WS = 27,
I2S1O_BCK = 28,
I2S1O_WS = 29,
I2S1O_SD = 30,
I2S1I_BCK = 31,
I2S1I_WS = 32,
CORE1_GPIO7 = 54,
USB_EXTPHY_OEN = 55,
USB_EXTPHY_VPO = 57,
USB_EXTPHY_VMO = 58,
SPI3_CLK = 66,
SPI3_Q = 67,
SPI3_D = 68,
SPI3_HD = 69,
SPI3_WP = 70,
SPI3_CS0 = 71,
SPI3_CS1 = 72,
LEDC_LS_SIG0 = 73,
LEDC_LS_SIG1 = 74,
LEDC_LS_SIG2 = 75,
LEDC_LS_SIG3 = 76,
LEDC_LS_SIG4 = 77,
LEDC_LS_SIG5 = 78,
LEDC_LS_SIG6 = 79,
LEDC_LS_SIG7 = 80,
RMT_SIG_0 = 81,
RMT_SIG_1 = 82,
RMT_SIG_2 = 83,
RMT_SIG_3 = 84,
I2CEXT0_SCL = 89,
I2CEXT0_SDA = 90,
I2CEXT1_SCL = 91,
I2CEXT1_SDA = 92,
GPIO_SD0 = 93,
GPIO_SD1 = 94,
GPIO_SD2 = 95,
GPIO_SD3 = 96,
GPIO_SD4 = 97,
GPIO_SD5 = 98,
GPIO_SD6 = 99,
GPIO_SD7 = 100,
FSPICLK = 101,
FSPIQ = 102,
FSPID = 103,
FSPIHD = 104,
FSPIWP = 105,
FSPIIO4 = 106,
FSPIIO5 = 107,
FSPIIO6 = 108,
FSPIIO7 = 109,
FSPICS0 = 110,
FSPICS1 = 111,
FSPICS2 = 112,
FSPICS3 = 113,
FSPICS4 = 114,
FSPICS5 = 115,
TWAI_TX = 116,
SUBSPICLK = 119,
SUBSPIQ = 120,
SUBSPID = 121,
SUBSPIHD = 122,
SUBSPIWP = 123,
SUBSPICS0 = 124,
SUBSPICS1 = 125,
FSPIDQS = 126,
SPI3_CS2 = 127,
I2S0O_SD1 = 128,
CORE1_GPIO0 = 129,
CORE1_GPIO1 = 130,
CORE1_GPIO2 = 131,
LCD_CS = 132,
LCD_DATA_0 = 133,
LCD_DATA_1 = 134,
LCD_DATA_2 = 135,
LCD_DATA_3 = 136,
LCD_DATA_4 = 137,
LCD_DATA_5 = 138,
LCD_DATA_6 = 139,
LCD_DATA_7 = 140,
LCD_DATA_8 = 141,
LCD_DATA_9 = 142,
LCD_DATA_10 = 143,
LCD_DATA_11 = 144,
LCD_DATA_12 = 145,
LCD_DATA_13 = 146,
LCD_DATA_14 = 147,
LCD_DATA_15 = 148,
CAM_CLK = 149,
LCD_H_ENABLE = 150,
LCD_H_SYNC = 151,
LCD_V_SYNC = 152,
LCD_DC = 153,
LCD_PCLK = 154,
SUBSPID4 = 155,
SUBSPID5 = 156,
SUBSPID6 = 157,
SUBSPID7 = 158,
SUBSPIDQS = 159,
PWM0_0A = 160,
PWM0_0B = 161,
PWM0_1A = 162,
PWM0_1B = 163,
PWM0_2A = 164,
PWM0_2B = 165,
PWM1_0A = 166,
PWM1_0B = 167,
PWM1_1A = 168,
PWM1_1B = 169,
PWM1_2A = 170,
PWM1_2B = 171,
SDHOST_CCLK_OUT_1 = 172,
SDHOST_CCLK_OUT_2 = 173,
SDHOST_RST_N_1 = 174,
SDHOST_RST_N_2 = 175,
SDHOST_CCMD_OD_PULLUP_EN_N = 176,
SDIO_TOHOST_INT = 177,
SDHOST_CCMD_OUT_1 = 178,
SDHOST_CCMD_OUT_2 = 179,
SDHOST_CDATA_OUT_10 = 180,
SDHOST_CDATA_OUT_11 = 181,
SDHOST_CDATA_OUT_12 = 182,
SDHOST_CDATA_OUT_13 = 183,
SDHOST_CDATA_OUT_14 = 184,
SDHOST_CDATA_OUT_15 = 185,
SDHOST_CDATA_OUT_16 = 186,
SDHOST_CDATA_OUT_17 = 187,
SDHOST_CDATA_OUT_20 = 213,
SDHOST_CDATA_OUT_21 = 214,
SDHOST_CDATA_OUT_22 = 215,
SDHOST_CDATA_OUT_23 = 216,
SDHOST_CDATA_OUT_24 = 217,
SDHOST_CDATA_OUT_25 = 218,
SDHOST_CDATA_OUT_26 = 219,
SDHOST_CDATA_OUT_27 = 220,
PRO_ALONEGPIO0 = 221,
PRO_ALONEGPIO1 = 222,
PRO_ALONEGPIO2 = 223,
PRO_ALONEGPIO3 = 224,
PRO_ALONEGPIO4 = 225,
PRO_ALONEGPIO5 = 226,
PRO_ALONEGPIO6 = 227,
PRO_ALONEGPIO7 = 228,
USB_JTAG_TRST = 251,
CORE1_GPIO3 = 252,
CORE1_GPIO4 = 253,
CORE1_GPIO5 = 254,
CORE1_GPIO6 = 255,
GPIO = 256,
SPIIO4,
SPIIO5,
SPIIO6,
SPIIO7,
CLK_OUT1,
CLK_OUT2,
CLK_OUT3,
SPICLK_P_DIFF,
SPICLK_N_DIFF,
SUBSPICLK_P_DIFF,
SUBSPICLK_N_DIFF,
MTDO,
}
};
}
#[macro_export]
#[expect(clippy::crate_in_macro_def)]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! define_io_mux_reg {
() => {
pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
}
};
}