#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! chip {
() => {
"esp32c3"
};
}
#[doc = concat!("assert_eq!(chip_name, ", chip_pretty!(), ")")]
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! chip_pretty {
() => {
"ESP32-C3"
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! property {
("chip") => {
"esp32c3"
};
("arch") => {
"riscv"
};
("cores") => {
1
};
("cores", str) => {
stringify!(1)
};
("trm") => {
"https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf"
};
("gpio.version") => {
2
};
("gpio.version", str) => {
stringify!(2)
};
("gpio.has_input_sync") => {
true
};
("gpio.gpio_function") => {
1
};
("gpio.gpio_function", str) => {
stringify!(1)
};
("gpio.constant_0_input") => {
31
};
("gpio.constant_0_input", str) => {
stringify!(31)
};
("gpio.constant_1_input") => {
30
};
("gpio.constant_1_input", str) => {
stringify!(30)
};
("gpio.remap_iomux_pin_registers") => {
false
};
("gpio.func_in_sel_offset") => {
0
};
("gpio.func_in_sel_offset", str) => {
stringify!(0)
};
("gpio.has_bank_1") => {
false
};
("gpio.input_signal_max") => {
100
};
("gpio.input_signal_max", str) => {
stringify!(100)
};
("gpio.output_signal_max") => {
128
};
("gpio.output_signal_max", str) => {
stringify!(128)
};
("dedicated_gpio.version") => {
"riscv_v1"
};
("dedicated_gpio.needs_initialization") => {
false
};
("dedicated_gpio.channel_count") => {
8
};
("dedicated_gpio.channel_count", str) => {
stringify!(8)
};
("lp_io.version") => {
"v3"
};
("lp_io.has_gpio_matrix") => {
false
};
("uart.ram_size") => {
128
};
("uart.ram_size", str) => {
stringify!(128)
};
("uart.version") => {
1
};
("uart.version", str) => {
stringify!(1)
};
("uart.peripheral_controls_mem_clk") => {
false
};
("uart.has_sclk_divider") => {
true
};
("uart.has_sclk_enable") => {
true
};
("uhci.combined_uart_selector_field") => {
false
};
("i2c_master.version") => {
3
};
("i2c_master.version", str) => {
stringify!(3)
};
("i2c_master.has_fsm_timeouts") => {
true
};
("i2c_master.has_hw_bus_clear") => {
true
};
("i2c_master.has_bus_timeout_enable") => {
true
};
("i2c_master.separate_filter_config_registers") => {
false
};
("i2c_master.can_estimate_nack_reason") => {
false
};
("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.has_pd_en") => {
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)
};
("spi_master.version") => {
3
};
("spi_master.version", str) => {
stringify!(3)
};
("spi_master.fifo_size") => {
64
};
("spi_master.fifo_size", str) => {
stringify!(64)
};
("spi_master.bit_order_is_bool") => {
true
};
("spi_master.has_octal") => {
false
};
("spi_master.has_app_interrupts") => {
true
};
("spi_master.has_dma_segmented_transfer") => {
true
};
("spi_master.has_clk_pre_div") => {
false
};
("spi_master.dma_can_access_flash") => {
false
};
("i2s.version") => {
2
};
("i2s.version", str) => {
stringify!(2)
};
("i2s.default_clock_source") => {
2
};
("i2s.default_clock_source", str) => {
stringify!(2)
};
("i2s.mclk_divider_bit_width") => {
9
};
("i2s.mclk_divider_bit_width", str) => {
stringify!(9)
};
("i2s.max_ws_width") => {
128
};
("i2s.max_ws_width", str) => {
stringify!(128)
};
("i2s.clock_configured_by_pcr") => {
false
};
("i2s.clock_configured_by_hp_sys_clkrst") => {
false
};
("i2s.supports_pdm_rx_hp_filter") => {
false
};
("i2s.supports_pdm_tx") => {
true
};
("i2s.supports_pdm_rx") => {
true
};
("i2s.supports_pcm2pdm") => {
true
};
("i2s.supports_pdm2pcm") => {
false
};
("rmt.ram_start") => {
1610703872
};
("rmt.ram_start", str) => {
stringify!(1610703872)
};
("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") => {
false
};
("rmt.has_tx_carrier_data_only") => {
true
};
("rmt.has_tx_sync") => {
true
};
("rmt.has_rx_wrap") => {
true
};
("rmt.has_rx_demodulation") => {
true
};
("rmt.has_per_channel_clock") => {
false
};
("bt.controller") => {
"btdm"
};
("wifi.has_wifi6") => {
false
};
("wifi.mac_version") => {
1
};
("wifi.mac_version", str) => {
stringify!(1)
};
("wifi.has_5g") => {
false
};
("wifi.csi_supported") => {
true
};
("phy.combo_module") => {
true
};
("phy.backed_up_digital_register_count") => {
21
};
("phy.backed_up_digital_register_count", str) => {
stringify!(21)
};
("ledc.version") => {
2
};
("ledc.version", str) => {
stringify!(2)
};
("ledc.channel_count") => {
6
};
("ledc.channel_count", str) => {
stringify!(6)
};
("sdm.channel_count") => {
4
};
("sdm.channel_count", str) => {
stringify!(4)
};
("timergroup.timg_has_timer1") => {
false
};
("timergroup.timg_has_divcnt_rst") => {
true
};
("aes.has_split_text_registers") => {
true
};
("aes.endianness_configurable") => {
false
};
("rng.apb_cycle_wait_num") => {
16
};
("rng.apb_cycle_wait_num", str) => {
stringify!(16)
};
("rng.trng_supported") => {
true
};
("rng.is_lp_sys") => {
false
};
("rsa.version") => {
3
};
("rsa.version", str) => {
stringify!(3)
};
("rsa.size_increment") => {
32
};
("rsa.size_increment", str) => {
stringify!(32)
};
("rsa.memory_size_bytes") => {
384
};
("rsa.memory_size_bytes", str) => {
stringify!(384)
};
("sleep.light_sleep") => {
true
};
("sleep.deep_sleep") => {
true
};
("sleep.rejectable_mask") => {
1852
};
("sleep.pin_wakeup_version") => {
2
};
("sleep.pin_wakeup_version", str) => {
stringify!(2)
};
("sleep.deep_sleep_needs_gpio_isolation") => {
true
};
("assist_debug.has_sp_monitor") => {
true
};
("assist_debug.has_region_monitor") => {
true
};
("dma.mem2mem_requires_peripheral") => {
true
};
("dma.ext_mem_configurable_block_size") => {
false
};
("dma.separate_in_out_interrupts") => {
false
};
("dma.gdma_version") => {
1
};
("dma.gdma_version", str) => {
stringify!(1)
};
("interrupts.status_registers") => {
2
};
("interrupts.status_registers", str) => {
stringify!(2)
};
("interrupts.disabled_interrupt") => {
0
};
("mmu.page_size") => {
65536
};
("mmu.page_size", str) => {
stringify!(65536)
};
("mmu.entry_num") => {
128
};
("mmu.entry_num", str) => {
stringify!(128)
};
("rom.has_crc_le") => {
true
};
("rom.has_crc_be") => {
true
};
("rom.has_md5_bsd") => {
true
};
("rom.has_md5_mbedtls") => {
false
};
("soc.cpu_has_branch_predictor") => {
false
};
("soc.cpu_has_csr_pc") => {
true
};
("soc.multi_core_enabled") => {
false
};
("soc.internal_memory_cached") => {
false
};
("soc.has_swd_watchdog") => {
true
};
("soc.cpu_mcause_mask") => {
31
};
("soc.cpu_mcause_mask", str) => {
stringify!(31)
};
("clock_tree.system_pre_div_in") => {
[crate ::soc::clocks::SystemPreDivInConfig::Xtal, crate
::soc::clocks::SystemPreDivInConfig::RcFast]
};
("clock_tree.system_pre_div.divisor") => {
(0, 1023)
};
("clock_tree.cpu_clk") => {
[crate ::soc::clocks::CpuClkConfig::Xtal, crate
::soc::clocks::CpuClkConfig::RcFast, crate ::soc::clocks::CpuClkConfig::Pll]
};
("clock_tree.apb_clk") => {
[crate ::soc::clocks::ApbClkConfig::Pll80m, crate
::soc::clocks::ApbClkConfig::Cpu]
};
("clock_tree.crypto_clk") => {
[crate ::soc::clocks::CryptoClkConfig::Pll160m, crate
::soc::clocks::CryptoClkConfig::Cpu]
};
("clock_tree.rc_fast_clk_div_n.divisor") => {
(0, 3)
};
("clock_tree.rtc_slow_clk") => {
[#[cfg(use_xtal32k)] crate ::soc::clocks::RtcSlowClkConfig::Xtal32k, crate
::soc::clocks::RtcSlowClkConfig::RcSlow, crate
::soc::clocks::RtcSlowClkConfig::RcFast]
};
("clock_tree.rtc_fast_clk") => {
[crate ::soc::clocks::RtcFastClkConfig::Xtal, crate
::soc::clocks::RtcFastClkConfig::Rc]
};
("clock_tree.low_power_clk") => {
[crate ::soc::clocks::LowPowerClkConfig::Xtal, crate
::soc::clocks::LowPowerClkConfig::RcFast, #[cfg(use_xtal32k)] crate
::soc::clocks::LowPowerClkConfig::Xtal32k, crate
::soc::clocks::LowPowerClkConfig::RtcSlow]
};
("clock_tree.timg_calibration_clock") => {
[crate ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, crate
::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
};
("clock_tree.timg.function_clock") => {
[crate ::soc::clocks::TimgFunctionClockConfig::XtalClk, crate
::soc::clocks::TimgFunctionClockConfig::ApbClk]
};
("clock_tree.timg.wdt_clock") => {
[crate ::soc::clocks::TimgWdtClockConfig::ApbClk, crate
::soc::clocks::TimgWdtClockConfig::XtalClk]
};
("clock_tree.rmt.sclk") => {
[crate ::soc::clocks::RmtSclkConfig::ApbClk, crate
::soc::clocks::RmtSclkConfig::RcFastClk, crate
::soc::clocks::RmtSclkConfig::XtalClk]
};
("clock_tree.uart.function_clock.sclk") => {
[crate ::soc::clocks::UartFunctionClockSclk::Apb, crate
::soc::clocks::UartFunctionClockSclk::RcFast, crate
::soc::clocks::UartFunctionClockSclk::Xtal]
};
("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)
};
("clock_tree.i2c.function_clock.sclk") => {
[crate ::soc::clocks::I2cFunctionClockSclk::Xtal, crate
::soc::clocks::I2cFunctionClockSclk::RcFast]
};
("clock_tree.i2c.function_clock.div_num") => {
(0, 255)
};
("clock_tree.spi.function_clock") => {
[crate ::soc::clocks::SpiFunctionClockConfig::Xtal, crate
::soc::clocks::SpiFunctionClockConfig::Pll80m]
};
}
#[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,
CPU_GPIO_0)); _for_each_inner_dedicated_gpio!((0, 1, CPU_GPIO_1));
_for_each_inner_dedicated_gpio!((0, 2, CPU_GPIO_2));
_for_each_inner_dedicated_gpio!((0, 3, CPU_GPIO_3));
_for_each_inner_dedicated_gpio!((0, 4, CPU_GPIO_4));
_for_each_inner_dedicated_gpio!((0, 5, CPU_GPIO_5));
_for_each_inner_dedicated_gpio!((0, 6, CPU_GPIO_6));
_for_each_inner_dedicated_gpio!((0, 7, CPU_GPIO_7));
_for_each_inner_dedicated_gpio!((channels(0), (1), (2), (3), (4), (5), (6),
(7))); _for_each_inner_dedicated_gpio!((signals(0, 0, CPU_GPIO_0), (0, 1,
CPU_GPIO_1), (0, 2, CPU_GPIO_2), (0, 3, CPU_GPIO_3), (0, 4, CPU_GPIO_4), (0, 5,
CPU_GPIO_5), (0, 6, CPU_GPIO_6), (0, 7, CPU_GPIO_7)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! define_lp_io_signals {
() => {};
}
#[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!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
_for_each_inner_rmt_channel!((2, 0)); _for_each_inner_rmt_channel!((3, 1));
_for_each_inner_rmt_channel!((all(0), (1), (2), (3)));
_for_each_inner_rmt_channel!((tx(0, 0), (1, 1)));
_for_each_inner_rmt_channel!((rx(2, 0), (3, 1)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_sdm_channel {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_sdm_channel { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_sdm_channel!((0, SDM_CH0, SdmCh0, GPIO_SD0));
_for_each_inner_sdm_channel!((1, SDM_CH1, SdmCh1, GPIO_SD1));
_for_each_inner_sdm_channel!((2, SDM_CH2, SdmCh2, GPIO_SD2));
_for_each_inner_sdm_channel!((3, SDM_CH3, SdmCh3, GPIO_SD3));
_for_each_inner_sdm_channel!((channels(0, SDM_CH0, SdmCh0, GPIO_SD0), (1,
SDM_CH1, SdmCh1, GPIO_SD1), (2, SDM_CH2, SdmCh2, GPIO_SD2), (3, SDM_CH3, SdmCh3,
GPIO_SD3)));
};
}
#[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_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!((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)));
};
}
#[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!((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)));
};
}
#[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!((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)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_wakeup_source {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_wakeup_source { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_wakeup_source!((Gpio, 2));
_for_each_inner_wakeup_source!((Timer, 3)); _for_each_inner_wakeup_source!((Sdio,
4)); _for_each_inner_wakeup_source!((Wifi, 5));
_for_each_inner_wakeup_source!((Uart0, 6));
_for_each_inner_wakeup_source!((Uart1, 7));
_for_each_inner_wakeup_source!((Touch, 8)); _for_each_inner_wakeup_source!((Ulp,
9)); _for_each_inner_wakeup_source!((Bt, 10));
_for_each_inner_wakeup_source!((all(Gpio, 2), (Timer, 3), (Sdio, 4), (Wifi, 5),
(Uart0, 6), (Uart1, 7), (Touch, 8), (Ulp, 9), (Bt, 10)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_dma_engine {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_dma_engine { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_dma_engine!(("AHB_GDMA"));
_for_each_inner_dma_engine!((all("AHB_GDMA")));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_dma_channel {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_dma_channel { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0));
_for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1));
_for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2));
_for_each_inner_dma_channel!(("AHB_GDMA", any_channel = AhbGdmaChannel));
_for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH0, 0, interrupt = DMA_CH0,
compatible = [SPI2, UHCI0, I2S0, AES, SHA, APB_SARADC]));
_for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH1, 1, interrupt = DMA_CH1,
compatible = [SPI2, UHCI0, I2S0, AES, SHA, APB_SARADC]));
_for_each_inner_dma_channel!(("AHB_GDMA", DMA_CH2, 2, interrupt = DMA_CH2,
compatible = [SPI2, UHCI0, I2S0, AES, SHA, APB_SARADC]));
_for_each_inner_dma_channel!((names("AHB_GDMA", DMA_CH0), ("AHB_GDMA", DMA_CH1),
("AHB_GDMA", DMA_CH2)));
_for_each_inner_dma_channel!((separate_any_type("AHB_GDMA", any_channel =
AhbGdmaChannel))); _for_each_inner_dma_channel!((shared("AHB_GDMA", DMA_CH0, 0,
interrupt = DMA_CH0, compatible = [SPI2, UHCI0, I2S0, AES, SHA, APB_SARADC]),
("AHB_GDMA", DMA_CH1, 1, interrupt = DMA_CH1, compatible = [SPI2, UHCI0, I2S0,
AES, SHA, APB_SARADC]), ("AHB_GDMA", DMA_CH2, 2, interrupt = DMA_CH2, compatible
= [SPI2, UHCI0, I2S0, AES, SHA, APB_SARADC])));
_for_each_inner_dma_channel!((split));
_for_each_inner_dma_channel!((no_own_interrupt));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_dma_channel_peri_pair {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_dma_channel_peri_pair { $(($pattern) => $code;)*
($other : tt) => {} } _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
DMA_CH0, SPI2)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0,
UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, I2S0));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, AES));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, SHA));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH0, APB_SARADC));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SPI2));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, UHCI0));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, I2S0));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, AES));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, SHA));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH1, APB_SARADC));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SPI2));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, UHCI0));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, I2S0));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, AES));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, SHA));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", DMA_CH2, APB_SARADC));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
SPI2)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
AhbGdmaChannel, UHCI0)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
any_channel = AhbGdmaChannel, I2S0));
_for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel = AhbGdmaChannel,
AES)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA", any_channel =
AhbGdmaChannel, SHA)); _for_each_inner_dma_channel_peri_pair!(("AHB_GDMA",
any_channel = AhbGdmaChannel, APB_SARADC));
_for_each_inner_dma_channel_peri_pair!((channels("AHB_GDMA", DMA_CH0, SPI2),
("AHB_GDMA", DMA_CH0, UHCI0), ("AHB_GDMA", DMA_CH0, I2S0), ("AHB_GDMA", DMA_CH0,
AES), ("AHB_GDMA", DMA_CH0, SHA), ("AHB_GDMA", DMA_CH0, APB_SARADC), ("AHB_GDMA",
DMA_CH1, SPI2), ("AHB_GDMA", DMA_CH1, UHCI0), ("AHB_GDMA", DMA_CH1, I2S0),
("AHB_GDMA", DMA_CH1, AES), ("AHB_GDMA", DMA_CH1, SHA), ("AHB_GDMA", DMA_CH1,
APB_SARADC), ("AHB_GDMA", DMA_CH2, SPI2), ("AHB_GDMA", DMA_CH2, UHCI0),
("AHB_GDMA", DMA_CH2, I2S0), ("AHB_GDMA", DMA_CH2, AES), ("AHB_GDMA", DMA_CH2,
SHA), ("AHB_GDMA", DMA_CH2, APB_SARADC)));
_for_each_inner_dma_channel_peri_pair!((any_channels("AHB_GDMA", any_channel =
AhbGdmaChannel, SPI2), ("AHB_GDMA", any_channel = AhbGdmaChannel, UHCI0),
("AHB_GDMA", any_channel = AhbGdmaChannel, I2S0), ("AHB_GDMA", any_channel =
AhbGdmaChannel, AES), ("AHB_GDMA", any_channel = AhbGdmaChannel, SHA),
("AHB_GDMA", any_channel = AhbGdmaChannel, APB_SARADC)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_mem2mem_channel {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_mem2mem_channel { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
AhbGdmaChannel, DMA_CH0, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA",
AhbGdma, AhbGdmaChannel, DMA_CH1, 0));
_for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH2,
0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma, AhbGdmaChannel, 0, 0,
1, 0, 2, 0)); _for_each_inner_mem2mem_channel!(("AHB_GDMA", AhbGdma,
AhbGdmaChannel)); _for_each_inner_mem2mem_channel!((channels("AHB_GDMA", AhbGdma,
AhbGdmaChannel, DMA_CH0, 0), ("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH1, 0),
("AHB_GDMA", AhbGdma, AhbGdmaChannel, DMA_CH2, 0)));
_for_each_inner_mem2mem_channel!((erased("AHB_GDMA", AhbGdma, AhbGdmaChannel, 0,
0, 1, 0, 2, 0))); _for_each_inner_mem2mem_channel!((engines("AHB_GDMA", AhbGdma,
AhbGdmaChannel)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! with_aes_dma_engine {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _with_inner_aes_dma_engine { $(($pattern) => $code;)* ($other : tt)
=> {} } _with_inner_aes_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! with_i2s_dma_engine {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _with_inner_i2s_dma_engine { $(($pattern) => $code;)* ($other : tt)
=> {} } _with_inner_i2s_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! with_sha_dma_engine {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _with_inner_sha_dma_engine { $(($pattern) => $code;)* ($other : tt)
=> {} } _with_inner_sha_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! with_spi_master_dma_engine {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _with_inner_spi_master_dma_engine { $(($pattern) => $code;)* ($other
: tt) => {} } _with_inner_spi_master_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! with_spi_slave_dma_engine {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _with_inner_spi_slave_dma_engine { $(($pattern) => $code;)* ($other
: tt) => {} } _with_inner_spi_slave_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! with_uhci_dma_engine {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _with_inner_uhci_dma_engine { $(($pattern) => $code;)* ($other : tt)
=> {} } _with_inner_uhci_dma_engine!(("AHB_GDMA", AhbGdmaChannel));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_interrupt {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_interrupt { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_interrupt!(([disabled 0] 0));
_for_each_inner_interrupt!(([reserved 0] 1));
_for_each_inner_interrupt!(([direct_bindable 0] 2));
_for_each_inner_interrupt!(([direct_bindable 1] 3));
_for_each_inner_interrupt!(([direct_bindable 2] 4));
_for_each_inner_interrupt!(([direct_bindable 3] 5));
_for_each_inner_interrupt!(([direct_bindable 4] 6));
_for_each_inner_interrupt!(([direct_bindable 5] 7));
_for_each_inner_interrupt!(([direct_bindable 6] 8));
_for_each_inner_interrupt!(([direct_bindable 7] 9));
_for_each_inner_interrupt!(([direct_bindable 8] 10));
_for_each_inner_interrupt!(([direct_bindable 9] 11));
_for_each_inner_interrupt!(([direct_bindable 10] 12));
_for_each_inner_interrupt!(([direct_bindable 11] 13));
_for_each_inner_interrupt!(([direct_bindable 12] 14));
_for_each_inner_interrupt!(([direct_bindable 13] 15));
_for_each_inner_interrupt!(([direct_bindable 14] 16));
_for_each_inner_interrupt!(([vector 0] 17)); _for_each_inner_interrupt!(([vector
1] 18)); _for_each_inner_interrupt!(([vector 2] 19));
_for_each_inner_interrupt!(([vector 3] 20)); _for_each_inner_interrupt!(([vector
4] 21)); _for_each_inner_interrupt!(([vector 5] 22));
_for_each_inner_interrupt!(([vector 6] 23)); _for_each_inner_interrupt!(([vector
7] 24)); _for_each_inner_interrupt!(([vector 8] 25));
_for_each_inner_interrupt!(([vector 9] 26)); _for_each_inner_interrupt!(([vector
10] 27)); _for_each_inner_interrupt!(([vector 11] 28));
_for_each_inner_interrupt!(([vector 12] 29)); _for_each_inner_interrupt!(([vector
13] 30)); _for_each_inner_interrupt!(([vector 14] 31));
_for_each_inner_interrupt!((all([disabled 0] 0), ([reserved 0] 1),
([direct_bindable 0] 2), ([direct_bindable 1] 3), ([direct_bindable 2] 4),
([direct_bindable 3] 5), ([direct_bindable 4] 6), ([direct_bindable 5] 7),
([direct_bindable 6] 8), ([direct_bindable 7] 9), ([direct_bindable 8] 10),
([direct_bindable 9] 11), ([direct_bindable 10] 12), ([direct_bindable 11] 13),
([direct_bindable 12] 14), ([direct_bindable 13] 15), ([direct_bindable 14] 16),
([vector 0] 17), ([vector 1] 18), ([vector 2] 19), ([vector 3] 20), ([vector 4]
21), ([vector 5] 22), ([vector 6] 23), ([vector 7] 24), ([vector 8] 25), ([vector
9] 26), ([vector 10] 27), ([vector 11] 28), ([vector 12] 29), ([vector 13] 30),
([vector 14] 31)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_classified_interrupt {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_classified_interrupt { $(($pattern) => $code;)*
($other : tt) => {} } _for_each_inner_classified_interrupt!(([direct_bindable 0]
2)); _for_each_inner_classified_interrupt!(([direct_bindable 1] 3));
_for_each_inner_classified_interrupt!(([direct_bindable 2] 4));
_for_each_inner_classified_interrupt!(([direct_bindable 3] 5));
_for_each_inner_classified_interrupt!(([direct_bindable 4] 6));
_for_each_inner_classified_interrupt!(([direct_bindable 5] 7));
_for_each_inner_classified_interrupt!(([direct_bindable 6] 8));
_for_each_inner_classified_interrupt!(([direct_bindable 7] 9));
_for_each_inner_classified_interrupt!(([direct_bindable 8] 10));
_for_each_inner_classified_interrupt!(([direct_bindable 9] 11));
_for_each_inner_classified_interrupt!(([direct_bindable 10] 12));
_for_each_inner_classified_interrupt!(([direct_bindable 11] 13));
_for_each_inner_classified_interrupt!(([direct_bindable 12] 14));
_for_each_inner_classified_interrupt!(([direct_bindable 13] 15));
_for_each_inner_classified_interrupt!(([direct_bindable 14] 16));
_for_each_inner_classified_interrupt!(([vector 0] 17));
_for_each_inner_classified_interrupt!(([vector 1] 18));
_for_each_inner_classified_interrupt!(([vector 2] 19));
_for_each_inner_classified_interrupt!(([vector 3] 20));
_for_each_inner_classified_interrupt!(([vector 4] 21));
_for_each_inner_classified_interrupt!(([vector 5] 22));
_for_each_inner_classified_interrupt!(([vector 6] 23));
_for_each_inner_classified_interrupt!(([vector 7] 24));
_for_each_inner_classified_interrupt!(([vector 8] 25));
_for_each_inner_classified_interrupt!(([vector 9] 26));
_for_each_inner_classified_interrupt!(([vector 10] 27));
_for_each_inner_classified_interrupt!(([vector 11] 28));
_for_each_inner_classified_interrupt!(([vector 12] 29));
_for_each_inner_classified_interrupt!(([vector 13] 30));
_for_each_inner_classified_interrupt!(([vector 14] 31));
_for_each_inner_classified_interrupt!(([reserved 0] 1));
_for_each_inner_classified_interrupt!((direct_bindable([direct_bindable 0] 2),
([direct_bindable 1] 3), ([direct_bindable 2] 4), ([direct_bindable 3] 5),
([direct_bindable 4] 6), ([direct_bindable 5] 7), ([direct_bindable 6] 8),
([direct_bindable 7] 9), ([direct_bindable 8] 10), ([direct_bindable 9] 11),
([direct_bindable 10] 12), ([direct_bindable 11] 13), ([direct_bindable 12] 14),
([direct_bindable 13] 15), ([direct_bindable 14] 16)));
_for_each_inner_classified_interrupt!((vector([vector 0] 17), ([vector 1] 18),
([vector 2] 19), ([vector 3] 20), ([vector 4] 21), ([vector 5] 22), ([vector 6]
23), ([vector 7] 24), ([vector 8] 25), ([vector 9] 26), ([vector 10] 27),
([vector 11] 28), ([vector 12] 29), ([vector 13] 30), ([vector 14] 31)));
_for_each_inner_classified_interrupt!((reserved([reserved 0] 1)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_interrupt_priority {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_interrupt_priority { $(($pattern) => $code;)*
($other : tt) => {} } _for_each_inner_interrupt_priority!((0, 1, Priority1,
Level1)); _for_each_inner_interrupt_priority!((1, 2, Priority2, Level2));
_for_each_inner_interrupt_priority!((2, 3, Priority3, Level3));
_for_each_inner_interrupt_priority!((3, 4, Priority4, Level4));
_for_each_inner_interrupt_priority!((4, 5, Priority5, Level5));
_for_each_inner_interrupt_priority!((5, 6, Priority6, Level6));
_for_each_inner_interrupt_priority!((6, 7, Priority7, Level7));
_for_each_inner_interrupt_priority!((7, 8, Priority8, Level8));
_for_each_inner_interrupt_priority!((8, 9, Priority9, Level9));
_for_each_inner_interrupt_priority!((9, 10, Priority10, Level10));
_for_each_inner_interrupt_priority!((10, 11, Priority11, Level11));
_for_each_inner_interrupt_priority!((11, 12, Priority12, Level12));
_for_each_inner_interrupt_priority!((12, 13, Priority13, Level13));
_for_each_inner_interrupt_priority!((13, 14, Priority14, Level14));
_for_each_inner_interrupt_priority!((14, 15, Priority15, Level15));
_for_each_inner_interrupt_priority!((all(0, 1, Priority1, Level1), (1, 2,
Priority2, Level2), (2, 3, Priority3, Level3), (3, 4, Priority4, Level4), (4, 5,
Priority5, Level5), (5, 6, Priority6, Level6), (6, 7, Priority7, Level7), (7, 8,
Priority8, Level8), (8, 9, Priority9, Level9), (9, 10, Priority10, Level10), (10,
11, Priority11, Level11), (11, 12, Priority12, Level12), (12, 13, Priority13,
Level13), (13, 14, Priority14, Level14), (14, 15, Priority15, Level15)));
};
}
#[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! define_clock_tree_types {
() => {
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SdmInstance {
GpioSd = 0,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum I2cInstance {
I2c0 = 0,
}
#[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 SpiInstance {
Spi2 = 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,
}
#[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 }
}
pub(crate) 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,
}
impl CpuPllDivOutConfig {
pub fn value(&self) -> u32 {
match self {
CpuPllDivOutConfig::_80 => 80000000,
CpuPllDivOutConfig::_160 => 160000000,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ApbClkConfig {
Pll80m,
Cpu,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CryptoClkConfig {
Pll160m,
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 }
}
pub(crate) 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 {
#[cfg(use_xtal32k)]
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,
#[cfg(use_xtal32k)]
Xtal32k,
RtcSlow,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum UartMemClkConfig {
#[default]
Xtal,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TimgCalibrationClockConfig {
RcSlowClk,
RcFastDivClk,
#[cfg(use_xtal32k)]
Xtal32kClk,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum I2cFunctionClockSclk {
#[default]
Xtal,
RcFast,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct I2cFunctionClockConfig {
sclk: I2cFunctionClockSclk,
div_num: u32,
}
impl I2cFunctionClockConfig {
pub const fn new(sclk: I2cFunctionClockSclk, div_num: u32) -> Self {
::core::assert!(
div_num <= 255,
"`I2C0_FUNCTION_CLOCK` div_num must be between 0 and 255 (inclusive)."
);
Self { sclk, div_num }
}
pub(crate) fn sclk(self) -> I2cFunctionClockSclk {
self.sclk
}
pub(crate) fn div_num(self) -> u32 {
self.div_num as u32
}
}
#[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 SpiFunctionClockConfig {
Xtal,
#[default]
Pll80m,
}
#[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 TimgWdtClockConfig {
#[default]
ApbClk,
XtalClk,
}
#[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 }
}
pub(crate) fn sclk(self) -> UartFunctionClockSclk {
self.sclk
}
pub(crate) 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,
}
}
pub(crate) fn fractional(self) -> u32 {
self.fractional as u32
}
pub(crate) fn integral(self) -> u32 {
self.integral as u32
}
}
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_clk: Option<CryptoClkConfig>,
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>,
i2c_function_clock: [Option<I2cFunctionClockConfig>; 1],
rmt_sclk: [Option<RmtSclkConfig>; 1],
spi_function_clock: [Option<SpiFunctionClockConfig>; 1],
timg_function_clock: [Option<TimgFunctionClockConfig>; 2],
timg_wdt_clock: [Option<TimgWdtClockConfig>; 2],
uart_function_clock: [Option<UartFunctionClockConfig>; 2],
uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 2],
rc_fast_clk_refcount: u32,
#[cfg(use_xtal32k)]
xtal32k_clk_refcount: u32,
rc_slow_clk_refcount: u32,
rc_fast_div_clk_refcount: u32,
apb_clk_refcount: u32,
crypto_clk_refcount: u32,
pll_80m_refcount: u32,
rtc_fast_clk_refcount: u32,
low_power_clk_refcount: u32,
uart_mem_clk_refcount: u32,
timg_calibration_clock_refcount: u32,
sdm_function_clock_refcount: [u32; 1],
i2c_function_clock_refcount: [u32; 1],
rmt_sclk_refcount: [u32; 1],
spi_function_clock_refcount: [u32; 1],
timg_function_clock_refcount: [u32; 2],
timg_wdt_clock_refcount: [u32; 2],
uart_function_clock_refcount: [u32; 2],
uart_mem_clock_refcount: [u32; 2],
uart_baud_rate_generator_refcount: [u32; 2],
}
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_clk(&self) -> Option<CryptoClkConfig> {
self.crypto_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 i2c0_function_clock(&self) -> Option<I2cFunctionClockConfig> {
self.i2c_function_clock[I2cInstance::I2c0 as usize]
}
pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
self.rmt_sclk[RmtInstance::Rmt as usize]
}
pub fn spi2_function_clock(&self) -> Option<SpiFunctionClockConfig> {
self.spi_function_clock[SpiInstance::Spi2 as usize]
}
pub fn timg0_function_clock(&self) -> Option<TimgFunctionClockConfig> {
self.timg_function_clock[TimgInstance::Timg0 as usize]
}
pub fn timg0_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
self.timg_wdt_clock[TimgInstance::Timg0 as usize]
}
pub fn timg1_function_clock(&self) -> Option<TimgFunctionClockConfig> {
self.timg_function_clock[TimgInstance::Timg1 as usize]
}
pub fn timg1_wdt_clock(&self) -> Option<TimgWdtClockConfig> {
self.timg_wdt_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 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]
}
}
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_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,
i2c_function_clock: [None; 1],
rmt_sclk: [None; 1],
spi_function_clock: [None; 1],
timg_function_clock: [None; 2],
timg_wdt_clock: [None; 2],
uart_function_clock: [None; 2],
uart_baud_rate_generator: [None; 2],
rc_fast_clk_refcount: 0,
#[cfg(use_xtal32k)]
xtal32k_clk_refcount: 0,
rc_slow_clk_refcount: 0,
rc_fast_div_clk_refcount: 0,
apb_clk_refcount: 0,
crypto_clk_refcount: 0,
pll_80m_refcount: 0,
rtc_fast_clk_refcount: 0,
low_power_clk_refcount: 0,
uart_mem_clk_refcount: 0,
timg_calibration_clock_refcount: 0,
sdm_function_clock_refcount: [0; 1],
i2c_function_clock_refcount: [0; 1],
rmt_sclk_refcount: [0; 1],
spi_function_clock_refcount: [0; 1],
timg_function_clock_refcount: [0; 2],
timg_wdt_clock_refcount: [0; 2],
uart_function_clock_refcount: [0; 2],
uart_mem_clock_refcount: [0; 2],
uart_baud_rate_generator_refcount: [0; 2],
});
static XTAL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static PLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static SYSTEM_PRE_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static SYSTEM_PRE_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static CPU_PLL_DIV_OUT_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static CPU_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static RC_FAST_CLK_DIV_N_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static RTC_SLOW_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static RTC_FAST_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static LOW_POWER_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static I2C_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
static SPI_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static CRYPTO_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static RMT_SCLK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 1] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 1];
static TIMG_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
static TIMG_WDT_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
static UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 2] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 2];
pub fn configure_xtal_clk(clocks: &mut ClockTree, config: XtalClkConfig) {
let old_config = clocks.xtal_clk.replace(config);
refresh_xtal_clk_downstream(clocks);
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() -> u32 {
XTAL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn configure_pll_clk(clocks: &mut ClockTree, config: PllClkConfig) {
let old_config = clocks.pll_clk.replace(config);
refresh_pll_clk_downstream(clocks);
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");
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");
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() -> u32 {
PLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn pll_clk_source_frequency() -> u32 {
xtal_clk_frequency()
}
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() -> u32 {
17500000
}
#[cfg(use_xtal32k)]
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);
}
}
#[cfg(use_xtal32k)]
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);
}
}
#[cfg(use_xtal32k)]
pub fn xtal32k_clk_frequency() -> 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() -> 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() -> u32 {
(rc_fast_clk_frequency() / 256)
}
pub fn rc_fast_div_clk_source_frequency() -> u32 {
rc_fast_clk_frequency()
}
pub fn configure_system_pre_div_in(
clocks: &mut ClockTree,
new_selector: SystemPreDivInConfig,
) {
let old_selector = clocks.system_pre_div_in.replace(new_selector);
refresh_system_pre_div_in_downstream(clocks);
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(),
SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
}
}
pub fn system_pre_div_in_frequency() -> u32 {
SYSTEM_PRE_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn system_pre_div_in_source_frequency(source: SystemPreDivInConfig) -> u32 {
match source {
SystemPreDivInConfig::Xtal => xtal_clk_frequency(),
SystemPreDivInConfig::RcFast => rc_fast_clk_frequency(),
}
}
pub fn configure_system_pre_div(clocks: &mut ClockTree, config: SystemPreDivConfig) {
let old_config = clocks.system_pre_div.replace(config);
refresh_system_pre_div_downstream(clocks);
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() / (config.divisor() + 1))
}
pub fn system_pre_div_frequency() -> u32 {
SYSTEM_PRE_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn system_pre_div_source_frequency() -> u32 {
system_pre_div_in_frequency()
}
pub fn configure_cpu_pll_div_out(clocks: &mut ClockTree, config: CpuPllDivOutConfig) {
let old_config = clocks.cpu_pll_div_out.replace(config);
refresh_cpu_pll_div_out_downstream(clocks);
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() -> u32 {
CPU_PLL_DIV_OUT_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn cpu_pll_div_out_source_frequency() -> u32 {
pll_clk_frequency()
}
pub fn configure_apb_clk(clocks: &mut ClockTree, new_selector: ApbClkConfig) {
let old_selector = clocks.apb_clk.replace(new_selector);
refresh_apb_clk_downstream(clocks);
if clocks.apb_clk_refcount > 0 {
match new_selector {
ApbClkConfig::Pll80m => request_pll_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::Pll80m => release_pll_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::Pll80m => request_pll_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::Pll80m => release_pll_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::Pll80m => pll_80m_frequency(),
ApbClkConfig::Cpu => cpu_clk_frequency(),
}
}
pub fn apb_clk_frequency() -> u32 {
APB_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn apb_clk_source_frequency(source: ApbClkConfig) -> u32 {
match source {
ApbClkConfig::Pll80m => pll_80m_frequency(),
ApbClkConfig::Cpu => cpu_clk_frequency(),
}
}
pub fn configure_crypto_clk(clocks: &mut ClockTree, new_selector: CryptoClkConfig) {
let old_selector = clocks.crypto_clk.replace(new_selector);
refresh_crypto_clk_downstream(clocks);
if clocks.crypto_clk_refcount > 0 {
match new_selector {
CryptoClkConfig::Pll160m => request_pll_160m(clocks),
CryptoClkConfig::Cpu => request_cpu_clk(clocks),
}
configure_crypto_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
CryptoClkConfig::Pll160m => release_pll_160m(clocks),
CryptoClkConfig::Cpu => release_cpu_clk(clocks),
}
}
} else {
configure_crypto_clk_impl(clocks, old_selector, new_selector);
}
}
pub fn crypto_clk_config(clocks: &mut ClockTree) -> Option<CryptoClkConfig> {
clocks.crypto_clk
}
pub fn request_crypto_clk(clocks: &mut ClockTree) {
trace!("Requesting CRYPTO_CLK");
if increment_reference_count(&mut clocks.crypto_clk_refcount) {
trace!("Enabling CRYPTO_CLK");
match unwrap!(clocks.crypto_clk) {
CryptoClkConfig::Pll160m => request_pll_160m(clocks),
CryptoClkConfig::Cpu => request_cpu_clk(clocks),
}
enable_crypto_clk_impl(clocks, true);
}
}
pub fn release_crypto_clk(clocks: &mut ClockTree) {
trace!("Releasing CRYPTO_CLK");
if decrement_reference_count(&mut clocks.crypto_clk_refcount) {
trace!("Disabling CRYPTO_CLK");
enable_crypto_clk_impl(clocks, false);
match unwrap!(clocks.crypto_clk) {
CryptoClkConfig::Pll160m => release_pll_160m(clocks),
CryptoClkConfig::Cpu => release_cpu_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn crypto_clk_config_frequency(clocks: &mut ClockTree, config: CryptoClkConfig) -> u32 {
match config {
CryptoClkConfig::Pll160m => pll_160m_frequency(),
CryptoClkConfig::Cpu => cpu_clk_frequency(),
}
}
pub fn crypto_clk_frequency() -> u32 {
CRYPTO_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn crypto_clk_source_frequency(source: CryptoClkConfig) -> u32 {
match source {
CryptoClkConfig::Pll160m => pll_160m_frequency(),
CryptoClkConfig::Cpu => cpu_clk_frequency(),
}
}
pub fn configure_cpu_clk(clocks: &mut ClockTree, new_selector: CpuClkConfig) {
let old_selector = clocks.cpu_clk.replace(new_selector);
refresh_cpu_clk_downstream(clocks);
match new_selector {
CpuClkConfig::Xtal => {
configure_apb_clk(clocks, ApbClkConfig::Cpu);
configure_crypto_clk(clocks, CryptoClkConfig::Cpu);
configure_system_pre_div_in(clocks, SystemPreDivInConfig::Xtal);
}
CpuClkConfig::RcFast => {
configure_apb_clk(clocks, ApbClkConfig::Cpu);
configure_crypto_clk(clocks, CryptoClkConfig::Cpu);
configure_system_pre_div_in(clocks, SystemPreDivInConfig::RcFast);
}
CpuClkConfig::Pll => {
configure_apb_clk(clocks, ApbClkConfig::Pll80m);
configure_crypto_clk(clocks, CryptoClkConfig::Pll160m);
}
}
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(),
CpuClkConfig::RcFast => system_pre_div_frequency(),
CpuClkConfig::Pll => cpu_pll_div_out_frequency(),
}
}
pub fn cpu_clk_frequency() -> u32 {
CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn request_pll_80m(clocks: &mut ClockTree) {
trace!("Requesting PLL_80M");
if increment_reference_count(&mut clocks.pll_80m_refcount) {
trace!("Enabling PLL_80M");
request_cpu_clk(clocks);
enable_pll_80m_impl(clocks, true);
}
}
pub fn release_pll_80m(clocks: &mut ClockTree) {
trace!("Releasing PLL_80M");
if decrement_reference_count(&mut clocks.pll_80m_refcount) {
trace!("Disabling PLL_80M");
enable_pll_80m_impl(clocks, false);
release_cpu_clk(clocks);
}
}
pub fn pll_80m_frequency() -> u32 {
80000000
}
pub fn pll_80m_source_frequency() -> u32 {
cpu_clk_frequency()
}
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() -> u32 {
160000000
}
pub fn pll_160m_source_frequency() -> u32 {
cpu_clk_frequency()
}
pub fn configure_rc_fast_clk_div_n(clocks: &mut ClockTree, config: RcFastClkDivNConfig) {
let old_config = clocks.rc_fast_clk_div_n.replace(config);
refresh_rc_fast_clk_div_n_downstream(clocks);
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() / (config.divisor() + 1))
}
pub fn rc_fast_clk_div_n_frequency() -> u32 {
RC_FAST_CLK_DIV_N_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn rc_fast_clk_div_n_source_frequency() -> u32 {
rc_fast_clk_frequency()
}
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() -> u32 {
(xtal_clk_frequency() / 2)
}
pub fn xtal_div_clk_source_frequency() -> u32 {
xtal_clk_frequency()
}
pub fn configure_rtc_slow_clk(clocks: &mut ClockTree, new_selector: RtcSlowClkConfig) {
let old_selector = clocks.rtc_slow_clk.replace(new_selector);
refresh_rtc_slow_clk_downstream(clocks);
match new_selector {
#[cfg(use_xtal32k)]
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 {
#[cfg(use_xtal32k)]
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) {
#[cfg(use_xtal32k)]
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) {
#[cfg(use_xtal32k)]
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 {
#[cfg(use_xtal32k)]
RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
}
}
pub fn rtc_slow_clk_frequency() -> u32 {
RTC_SLOW_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn rtc_slow_clk_source_frequency(source: RtcSlowClkConfig) -> u32 {
match source {
#[cfg(use_xtal32k)]
RtcSlowClkConfig::Xtal32k => xtal32k_clk_frequency(),
RtcSlowClkConfig::RcSlow => rc_slow_clk_frequency(),
RtcSlowClkConfig::RcFast => rc_fast_div_clk_frequency(),
}
}
pub fn configure_rtc_fast_clk(clocks: &mut ClockTree, new_selector: RtcFastClkConfig) {
let old_selector = clocks.rtc_fast_clk.replace(new_selector);
refresh_rtc_fast_clk_downstream(clocks);
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(),
RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(),
}
}
pub fn rtc_fast_clk_frequency() -> u32 {
RTC_FAST_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn rtc_fast_clk_source_frequency(source: RtcFastClkConfig) -> u32 {
match source {
RtcFastClkConfig::Xtal => xtal_div_clk_frequency(),
RtcFastClkConfig::Rc => rc_fast_clk_div_n_frequency(),
}
}
pub fn configure_low_power_clk(clocks: &mut ClockTree, new_selector: LowPowerClkConfig) {
let old_selector = clocks.low_power_clk.replace(new_selector);
refresh_low_power_clk_downstream(clocks);
if clocks.low_power_clk_refcount > 0 {
match new_selector {
LowPowerClkConfig::Xtal => request_xtal_clk(clocks),
LowPowerClkConfig::RcFast => request_rc_fast_clk(clocks),
#[cfg(use_xtal32k)]
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),
#[cfg(use_xtal32k)]
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),
#[cfg(use_xtal32k)]
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),
#[cfg(use_xtal32k)]
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(),
LowPowerClkConfig::RcFast => rc_fast_clk_frequency(),
#[cfg(use_xtal32k)]
LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(),
LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(),
}
}
pub fn low_power_clk_frequency() -> u32 {
LOW_POWER_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn low_power_clk_source_frequency(source: LowPowerClkConfig) -> u32 {
match source {
LowPowerClkConfig::Xtal => xtal_clk_frequency(),
LowPowerClkConfig::RcFast => rc_fast_clk_frequency(),
#[cfg(use_xtal32k)]
LowPowerClkConfig::Xtal32k => xtal32k_clk_frequency(),
LowPowerClkConfig::RtcSlow => rtc_slow_clk_frequency(),
}
}
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() -> u32 {
xtal_clk_frequency()
}
pub fn uart_mem_clk_source_frequency(source: UartMemClkConfig) -> u32 {
match source {
UartMemClkConfig::Xtal => xtal_clk_frequency(),
}
}
pub fn configure_timg_calibration_clock(
clocks: &mut ClockTree,
new_selector: TimgCalibrationClockConfig,
) {
let old_selector = clocks.timg_calibration_clock.replace(new_selector);
refresh_timg_calibration_clock_downstream(clocks);
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),
#[cfg(use_xtal32k)]
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),
#[cfg(use_xtal32k)]
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");
crate::rtc_cntl::WakeLock::acquire();
match unwrap!(clocks.timg_calibration_clock) {
TimgCalibrationClockConfig::RcSlowClk => request_rc_slow_clk(clocks),
TimgCalibrationClockConfig::RcFastDivClk => request_rc_fast_div_clk(clocks),
#[cfg(use_xtal32k)]
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");
crate::rtc_cntl::WakeLock::release();
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),
#[cfg(use_xtal32k)]
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(),
TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
#[cfg(use_xtal32k)]
TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
}
}
pub fn timg_calibration_clock_frequency() -> u32 {
TIMG_CALIBRATION_CLOCK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn timg_calibration_clock_source_frequency(source: TimgCalibrationClockConfig) -> u32 {
match source {
TimgCalibrationClockConfig::RcSlowClk => rc_slow_clk_frequency(),
TimgCalibrationClockConfig::RcFastDivClk => rc_fast_div_clk_frequency(),
#[cfg(use_xtal32k)]
TimgCalibrationClockConfig::Xtal32kClk => xtal32k_clk_frequency(),
}
}
impl SdmInstance {
pub fn request_function_clock(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::FUNCTION_CLOCK", self);
if increment_reference_count(&mut clocks.sdm_function_clock_refcount[self as usize])
{
trace!("Enabling {:?}::FUNCTION_CLOCK", self);
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.sdm_function_clock_refcount[self as usize])
{
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
self.enable_function_clock_impl(clocks, false);
release_apb_clk(clocks);
}
}
pub fn function_clock_frequency(self) -> u32 {
apb_clk_frequency()
}
pub fn function_clock_source_frequency() -> u32 {
apb_clk_frequency()
}
}
impl I2cInstance {
pub fn configure_function_clock(
self,
clocks: &mut ClockTree,
config: I2cFunctionClockConfig,
) {
let old_config = clocks.i2c_function_clock[self as usize].replace(config);
refresh_i2c_function_clock_downstream(clocks, self);
if clocks.i2c_function_clock_refcount[self as usize] > 0 {
match config.sclk {
I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
I2cFunctionClockSclk::RcFast => request_rc_fast_clk(clocks),
}
self.configure_function_clock_impl(clocks, old_config, config);
if let Some(old_config) = old_config {
match old_config.sclk {
I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
}
}
} else {
self.configure_function_clock_impl(clocks, old_config, config);
}
}
pub fn function_clock_config(
self,
clocks: &mut ClockTree,
) -> Option<I2cFunctionClockConfig> {
clocks.i2c_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.i2c_function_clock_refcount[self as usize])
{
trace!("Enabling {:?}::FUNCTION_CLOCK", self);
crate::rtc_cntl::WakeLock::acquire();
match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
I2cFunctionClockSclk::Xtal => request_xtal_clk(clocks),
I2cFunctionClockSclk::RcFast => request_rc_fast_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.i2c_function_clock_refcount[self as usize])
{
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
crate::rtc_cntl::WakeLock::release();
self.enable_function_clock_impl(clocks, false);
match unwrap!(clocks.i2c_function_clock[self as usize]).sclk {
I2cFunctionClockSclk::Xtal => release_xtal_clk(clocks),
I2cFunctionClockSclk::RcFast => release_rc_fast_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn function_clock_config_frequency(
clocks: &mut ClockTree,
config: I2cFunctionClockConfig,
) -> u32 {
(match config.sclk {
I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
} / (config.div_num() + 1))
}
pub fn function_clock_frequency(self) -> u32 {
I2C_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
match sclk {
I2cFunctionClockSclk::Xtal => xtal_clk_frequency(),
I2cFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
}
}
}
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);
refresh_rmt_sclk_downstream(clocks, self);
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);
crate::rtc_cntl::WakeLock::acquire();
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);
crate::rtc_cntl::WakeLock::release();
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(clocks: &mut ClockTree, config: RmtSclkConfig) -> u32 {
match config {
RmtSclkConfig::ApbClk => apb_clk_frequency(),
RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
RmtSclkConfig::XtalClk => xtal_clk_frequency(),
}
}
pub fn sclk_frequency(self) -> u32 {
RMT_SCLK_FREQ_CACHE[self as usize].load(::core::sync::atomic::Ordering::Acquire)
}
pub fn sclk_source_frequency(source: RmtSclkConfig) -> u32 {
match source {
RmtSclkConfig::ApbClk => apb_clk_frequency(),
RmtSclkConfig::RcFastClk => rc_fast_clk_frequency(),
RmtSclkConfig::XtalClk => xtal_clk_frequency(),
}
}
}
impl SpiInstance {
pub fn configure_function_clock(
self,
clocks: &mut ClockTree,
new_selector: SpiFunctionClockConfig,
) {
let old_selector = clocks.spi_function_clock[self as usize].replace(new_selector);
refresh_spi_function_clock_downstream(clocks, self);
if clocks.spi_function_clock_refcount[self as usize] > 0 {
match new_selector {
SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
SpiFunctionClockConfig::Pll80m => request_pll_80m(clocks),
}
self.configure_function_clock_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
SpiFunctionClockConfig::Pll80m => release_pll_80m(clocks),
}
}
} else {
self.configure_function_clock_impl(clocks, old_selector, new_selector);
}
}
pub fn function_clock_config(
self,
clocks: &mut ClockTree,
) -> Option<SpiFunctionClockConfig> {
clocks.spi_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.spi_function_clock_refcount[self as usize])
{
trace!("Enabling {:?}::FUNCTION_CLOCK", self);
crate::rtc_cntl::WakeLock::acquire();
match unwrap!(clocks.spi_function_clock[self as usize]) {
SpiFunctionClockConfig::Xtal => request_xtal_clk(clocks),
SpiFunctionClockConfig::Pll80m => request_pll_80m(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.spi_function_clock_refcount[self as usize])
{
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
crate::rtc_cntl::WakeLock::release();
self.enable_function_clock_impl(clocks, false);
match unwrap!(clocks.spi_function_clock[self as usize]) {
SpiFunctionClockConfig::Xtal => release_xtal_clk(clocks),
SpiFunctionClockConfig::Pll80m => release_pll_80m(clocks),
}
}
}
#[allow(unused_variables)]
pub fn function_clock_config_frequency(
clocks: &mut ClockTree,
config: SpiFunctionClockConfig,
) -> u32 {
match config {
SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
SpiFunctionClockConfig::Pll80m => pll_80m_frequency(),
}
}
pub fn function_clock_frequency(self) -> u32 {
SPI_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn function_clock_source_frequency(source: SpiFunctionClockConfig) -> u32 {
match source {
SpiFunctionClockConfig::Xtal => xtal_clk_frequency(),
SpiFunctionClockConfig::Pll80m => pll_80m_frequency(),
}
}
}
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);
refresh_timg_function_clock_downstream(clocks, self);
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(
clocks: &mut ClockTree,
config: TimgFunctionClockConfig,
) -> u32 {
match config {
TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
}
}
pub fn function_clock_frequency(self) -> u32 {
TIMG_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn function_clock_source_frequency(source: TimgFunctionClockConfig) -> u32 {
match source {
TimgFunctionClockConfig::XtalClk => xtal_clk_frequency(),
TimgFunctionClockConfig::ApbClk => apb_clk_frequency(),
}
}
pub fn configure_wdt_clock(
self,
clocks: &mut ClockTree,
new_selector: TimgWdtClockConfig,
) {
let old_selector = clocks.timg_wdt_clock[self as usize].replace(new_selector);
refresh_timg_wdt_clock_downstream(clocks, self);
if clocks.timg_wdt_clock_refcount[self as usize] > 0 {
match new_selector {
TimgWdtClockConfig::ApbClk => request_apb_clk(clocks),
TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
}
self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
TimgWdtClockConfig::ApbClk => release_apb_clk(clocks),
TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
}
}
} else {
self.configure_wdt_clock_impl(clocks, old_selector, new_selector);
}
}
pub fn wdt_clock_config(self, clocks: &mut ClockTree) -> Option<TimgWdtClockConfig> {
clocks.timg_wdt_clock[self as usize]
}
pub fn request_wdt_clock(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::WDT_CLOCK", self);
if increment_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
trace!("Enabling {:?}::WDT_CLOCK", self);
match unwrap!(clocks.timg_wdt_clock[self as usize]) {
TimgWdtClockConfig::ApbClk => request_apb_clk(clocks),
TimgWdtClockConfig::XtalClk => request_xtal_clk(clocks),
}
self.enable_wdt_clock_impl(clocks, true);
}
}
pub fn release_wdt_clock(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::WDT_CLOCK", self);
if decrement_reference_count(&mut clocks.timg_wdt_clock_refcount[self as usize]) {
trace!("Disabling {:?}::WDT_CLOCK", self);
self.enable_wdt_clock_impl(clocks, false);
match unwrap!(clocks.timg_wdt_clock[self as usize]) {
TimgWdtClockConfig::ApbClk => release_apb_clk(clocks),
TimgWdtClockConfig::XtalClk => release_xtal_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn wdt_clock_config_frequency(
clocks: &mut ClockTree,
config: TimgWdtClockConfig,
) -> u32 {
match config {
TimgWdtClockConfig::ApbClk => apb_clk_frequency(),
TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
}
}
pub fn wdt_clock_frequency(self) -> u32 {
TIMG_WDT_CLOCK_FREQ_CACHE[self as usize]
.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn wdt_clock_source_frequency(source: TimgWdtClockConfig) -> u32 {
match source {
TimgWdtClockConfig::ApbClk => apb_clk_frequency(),
TimgWdtClockConfig::XtalClk => xtal_clk_frequency(),
}
}
}
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);
refresh_uart_function_clock_downstream(clocks, self);
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(
clocks: &mut ClockTree,
config: UartFunctionClockConfig,
) -> u32 {
(match config.sclk {
UartFunctionClockSclk::Apb => apb_clk_frequency(),
UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
} / (config.div_num() + 1))
}
pub fn function_clock_frequency(self) -> u32 {
UART_FUNCTION_CLOCK_FREQ_CACHE[self as usize]
.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn function_clock_source_frequency(sclk: UartFunctionClockSclk) -> u32 {
match sclk {
UartFunctionClockSclk::Apb => apb_clk_frequency(),
UartFunctionClockSclk::RcFast => rc_fast_clk_frequency(),
UartFunctionClockSclk::Xtal => xtal_clk_frequency(),
}
}
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);
}
}
pub fn mem_clock_frequency(self) -> u32 {
uart_mem_clk_frequency()
}
pub fn mem_clock_source_frequency() -> u32 {
uart_mem_clk_frequency()
}
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);
refresh_uart_baud_rate_generator_downstream(clocks, self);
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() * 16)
/ ((config.integral() * 16) + config.fractional()))
}
pub fn baud_rate_generator_frequency(self) -> u32 {
UART_BAUD_RATE_GENERATOR_FREQ_CACHE[self as usize]
.load(::core::sync::atomic::Ordering::Acquire)
}
}
#[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, clocks: &mut ClockTree) {
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
}
fn refresh_xtal_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.xtal_clk {
XTAL_CLK_FREQ_CACHE.store(
xtal_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_pll_clk_downstream(clocks);
refresh_system_pre_div_in_downstream(clocks);
refresh_rtc_fast_clk_downstream(clocks);
refresh_low_power_clk_downstream(clocks);
for child_instance in [I2cInstance::I2c0] {
refresh_i2c_function_clock_downstream(clocks, child_instance);
}
for child_instance in [SpiInstance::Spi2] {
refresh_spi_function_clock_downstream(clocks, child_instance);
}
for child_instance in [RmtInstance::Rmt] {
refresh_rmt_sclk_downstream(clocks, child_instance);
}
for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
refresh_timg_function_clock_downstream(clocks, child_instance);
refresh_timg_wdt_clock_downstream(clocks, child_instance);
}
for child_instance in [UartInstance::Uart0, UartInstance::Uart1] {
refresh_uart_function_clock_downstream(clocks, child_instance);
}
}
fn refresh_pll_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.pll_clk {
PLL_CLK_FREQ_CACHE.store(
pll_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_cpu_pll_div_out_downstream(clocks);
}
fn refresh_system_pre_div_in_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.system_pre_div_in {
SYSTEM_PRE_DIV_IN_FREQ_CACHE.store(
system_pre_div_in_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_system_pre_div_downstream(clocks);
}
fn refresh_system_pre_div_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.system_pre_div {
SYSTEM_PRE_DIV_FREQ_CACHE.store(
system_pre_div_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_cpu_clk_downstream(clocks);
}
fn refresh_cpu_pll_div_out_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.cpu_pll_div_out {
CPU_PLL_DIV_OUT_FREQ_CACHE.store(
cpu_pll_div_out_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_cpu_clk_downstream(clocks);
}
fn refresh_cpu_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.cpu_clk {
CPU_CLK_FREQ_CACHE.store(
cpu_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_apb_clk_downstream(clocks);
refresh_crypto_clk_downstream(clocks);
for child_instance in [SpiInstance::Spi2] {
refresh_spi_function_clock_downstream(clocks, child_instance);
}
}
fn refresh_rc_fast_clk_div_n_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.rc_fast_clk_div_n {
RC_FAST_CLK_DIV_N_FREQ_CACHE.store(
rc_fast_clk_div_n_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_rtc_fast_clk_downstream(clocks);
}
fn refresh_rtc_slow_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.rtc_slow_clk {
RTC_SLOW_CLK_FREQ_CACHE.store(
rtc_slow_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_low_power_clk_downstream(clocks);
}
fn refresh_rtc_fast_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.rtc_fast_clk {
RTC_FAST_CLK_FREQ_CACHE.store(
rtc_fast_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_low_power_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.low_power_clk {
LOW_POWER_CLK_FREQ_CACHE.store(
low_power_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_timg_calibration_clock_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.timg_calibration_clock {
TIMG_CALIBRATION_CLOCK_FREQ_CACHE.store(
timg_calibration_clock_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {
if let Some(config) = clocks.i2c_function_clock[instance as usize] {
I2C_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
I2cInstance::function_clock_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_spi_function_clock_downstream(clocks: &mut ClockTree, instance: SpiInstance) {
if let Some(config) = clocks.spi_function_clock[instance as usize] {
SPI_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
SpiInstance::function_clock_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_apb_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.apb_clk {
APB_CLK_FREQ_CACHE.store(
apb_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
for child_instance in [RmtInstance::Rmt] {
refresh_rmt_sclk_downstream(clocks, child_instance);
}
for child_instance in [TimgInstance::Timg0, TimgInstance::Timg1] {
refresh_timg_function_clock_downstream(clocks, child_instance);
refresh_timg_wdt_clock_downstream(clocks, child_instance);
}
for child_instance in [UartInstance::Uart0, UartInstance::Uart1] {
refresh_uart_function_clock_downstream(clocks, child_instance);
}
}
fn refresh_crypto_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.crypto_clk {
CRYPTO_CLK_FREQ_CACHE.store(
crypto_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_rmt_sclk_downstream(clocks: &mut ClockTree, instance: RmtInstance) {
if let Some(config) = clocks.rmt_sclk[instance as usize] {
RMT_SCLK_FREQ_CACHE[instance as usize].store(
RmtInstance::sclk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_timg_function_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
if let Some(config) = clocks.timg_function_clock[instance as usize] {
TIMG_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
TimgInstance::function_clock_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_timg_wdt_clock_downstream(clocks: &mut ClockTree, instance: TimgInstance) {
if let Some(config) = clocks.timg_wdt_clock[instance as usize] {
TIMG_WDT_CLOCK_FREQ_CACHE[instance as usize].store(
TimgInstance::wdt_clock_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
fn refresh_uart_function_clock_downstream(clocks: &mut ClockTree, instance: UartInstance) {
if let Some(config) = clocks.uart_function_clock[instance as usize] {
UART_FUNCTION_CLOCK_FREQ_CACHE[instance as usize].store(
UartInstance::function_clock_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_uart_baud_rate_generator_downstream(clocks, instance);
}
fn refresh_uart_baud_rate_generator_downstream(
clocks: &mut ClockTree,
instance: UartInstance,
) {
if let Some(config) = clocks.uart_baud_rate_generator[instance as usize] {
UART_BAUD_RATE_GENERATOR_FREQ_CACHE[instance as usize].store(
instance.baud_rate_generator_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
}
};
}
#[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,
AhbGdma,
ApbSarAdc,
Ds,
GpioSd,
Hmac,
I2cExt0,
I2s0,
Ledc,
Rmt,
Rsa,
Sha,
Spi2,
Systimer,
Timg0,
Timg1,
Tsens,
Twai0,
Uart0,
Uart1,
UartMem,
Uhci0,
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::AhbGdma,
Self::ApbSarAdc,
Self::Ds,
Self::GpioSd,
Self::Hmac,
Self::I2cExt0,
Self::I2s0,
Self::Ledc,
Self::Rmt,
Self::Rsa,
Self::Sha,
Self::Spi2,
Self::Systimer,
Self::Timg0,
Self::Timg1,
Self::Tsens,
Self::Twai0,
Self::Uart0,
Self::Uart1,
Self::UartMem,
Self::Uhci0,
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::AhbGdma => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.dma_clk_en().bit(enable));
}
Peripheral::ApbSarAdc => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.apb_saradc_clk_en().bit(enable));
}
Peripheral::Ds => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.crypto_ds_clk_en().bit(enable));
}
Peripheral::GpioSd => {
crate::peripherals::GPIO_SD::regs()
.clock_gate()
.modify(|_, w| w.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::I2s0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.i2s0_clk_en().bit(enable));
}
Peripheral::Ledc => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.modify(|_, w| w.ledc_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::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::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::Tsens => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en1()
.modify(|_, w| w.tsens_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::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::UsbDevice => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en0()
.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::AhbGdma => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.dma_rst().bit(reset));
}
Peripheral::ApbSarAdc => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.apb_saradc_rst().bit(reset));
}
Peripheral::Ds => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.crypto_ds_rst().bit(reset));
}
Peripheral::GpioSd => {
let _ = 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::I2s0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.i2s0_rst().bit(reset));
}
Peripheral::Ledc => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.ledc_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::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::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::Tsens => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en1()
.modify(|_, w| w.tsens_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::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::UsbDevice => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en0()
.modify(|_, w| w.usb_device_rst().bit(reset));
}
}
}
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! memory_range {
("DRAM") => {
0x3FC80000..0x3FCE0000
};
(size as str, "DRAM") => {
"393216"
};
("DRAM2_UNINIT") => {
0x3FCCE400..0x3FCDE710
};
(size as str, "DRAM2_UNINIT") => {
"66320"
};
("IROM") => {
0x42000000..0x42800000
};
(size as str, "IROM") => {
"8388608"
};
("DROM") => {
0x3C000000..0x3C800000
};
(size as str, "DROM") => {
"8388608"
};
}
#[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!((all(0, I2C0, I2cExt0, I2CEXT0_SCL,
I2CEXT0_SDA)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_i2s {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
_for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S0, I2s0, I2S_MCLK,
I2SO_BCK, I2SO_WS, I2SI_BCK, I2SI_WS, [I2SO_SD], [I2SI_SD], true, true, true,
false)); _for_each_inner_i2s!((names(I2S0))); _for_each_inner_i2s!((all(I2S0,
I2s0, I2S_MCLK, I2SO_BCK, I2SO_WS, I2SI_BCK, I2SI_WS, [I2SO_SD], [I2SI_SD], true,
true, true, false)));
};
}
#[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,
wakeup_source = true)); _for_each_inner_uart!((1, UART1, Uart1, U1RXD, U1TXD,
U1CTS, U1RTS, wakeup_source = true)); _for_each_inner_uart!((all(0, UART0, Uart0,
U0RXD, U0TXD, U0CTS, U0RTS, wakeup_source = true), (1, UART1, Uart1, U1RXD,
U1TXD, U1CTS, U1RTS, wakeup_source = true)));
};
}
#[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)); _for_each_inner_spi_master!((SPI2,
Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID,
FSPIQ, FSPIWP, FSPIHD], true)); _for_each_inner_spi_master!((names(SPI2)));
_for_each_inner_spi_master!((all(SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2,
FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD], 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)); _for_each_inner_spi_slave!((SPI2,
Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
_for_each_inner_spi_slave!((names(SPI2))); _for_each_inner_spi_slave!((all(SPI2,
Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)));
};
}
#[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"] GPIO0 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO1 peripheral singleton"]
GPIO1 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO2 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>"] GPIO2 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO3 peripheral singleton"]
GPIO3 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO4 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>"] GPIO4 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO5 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>"] GPIO5 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO6 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>"] GPIO6 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO7 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>"] GPIO7 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO8 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>"] GPIO8 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO9 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>"] GPIO9 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO10 peripheral singleton"]
GPIO10 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO11 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>"] GPIO11 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO12 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>"] GPIO12 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO13 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>"] GPIO13 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO14 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>"] GPIO14 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO15 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>"] GPIO15 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO16 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>"] GPIO16 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO17 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>"] GPIO17 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO18 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>"] 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>By default, this pin is used by the UART programming interface.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO20 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO21 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>"] GPIO21 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH0 peripheral singleton"]
DMA_CH0 <= virtual(DMA_CH0 : { bind_dma_interrupt, enable_dma_interrupt,
disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(DMA_CH1 : {
bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA_CH2 peripheral singleton"]
DMA_CH2 <= virtual(DMA_CH2 : { bind_dma_interrupt, enable_dma_interrupt,
disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "SDM_CH0 peripheral singleton"] SDM_CH0 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH1 peripheral singleton"]
SDM_CH1 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "SDM_CH2 peripheral singleton"] SDM_CH2 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH3 peripheral singleton"]
SDM_CH3 <= virtual() (unstable))); _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 = "BB peripheral singleton"] BB <=
BB() (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 =
"MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "FE peripheral singleton"] FE <=
FE() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"FE2 peripheral singleton"] FE2 <= FE2() (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 =
"I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { 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 =
"IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "LEDC peripheral singleton"]
LEDC <= LEDC() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"NRX peripheral singleton"] NRX <= NRX() (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 =
"LPWR peripheral singleton"] LPWR <= RTC_CNTL() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"RTC_TIMER peripheral singleton"] RTC_TIMER <= RTC_CNTL() (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 = "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 =
"UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (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 =
"XTS_AES peripheral singleton"] XTS_AES <= XTS_AES() (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
}, RWBT : { bind_rwbt_interrupt, enable_rwbt_interrupt, disable_rwbt_interrupt })
(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 = "TSENS peripheral singleton"]
TSENS <= 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!((@
peri_type #[doc = "FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <=
virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <= virtual() (unstable)));
_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!((DMA_CH0(unstable)));
_for_each_inner_peripheral!((DMA_CH1(unstable)));
_for_each_inner_peripheral!((DMA_CH2(unstable)));
_for_each_inner_peripheral!((SDM_CH0(unstable)));
_for_each_inner_peripheral!((SDM_CH1(unstable)));
_for_each_inner_peripheral!((SDM_CH2(unstable)));
_for_each_inner_peripheral!((SDM_CH3(unstable)));
_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!((BB(unstable)));
_for_each_inner_peripheral!((DMA(unstable)));
_for_each_inner_peripheral!((DS(unstable)));
_for_each_inner_peripheral!((EXTMEM(unstable)));
_for_each_inner_peripheral!((FE(unstable)));
_for_each_inner_peripheral!((FE2(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!((I2S0(unstable)));
_for_each_inner_peripheral!((INTERRUPT_CORE0(unstable)));
_for_each_inner_peripheral!((IO_MUX(unstable)));
_for_each_inner_peripheral!((LEDC(unstable)));
_for_each_inner_peripheral!((NRX(unstable)));
_for_each_inner_peripheral!((RMT(unstable)));
_for_each_inner_peripheral!((RNG(unstable)));
_for_each_inner_peripheral!((RSA(unstable)));
_for_each_inner_peripheral!((LPWR(unstable)));
_for_each_inner_peripheral!((RTC_TIMER(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!((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!((UHCI0(unstable)));
_for_each_inner_peripheral!((USB_DEVICE(unstable)));
_for_each_inner_peripheral!((XTS_AES(unstable)));
_for_each_inner_peripheral!((ADC1(unstable)));
_for_each_inner_peripheral!((ADC2(unstable)));
_for_each_inner_peripheral!((BT(unstable)));
_for_each_inner_peripheral!((FLASH(unstable)));
_for_each_inner_peripheral!((GPIO_DEDICATED(unstable)));
_for_each_inner_peripheral!((TSENS(unstable)));
_for_each_inner_peripheral!((WIFI));
_for_each_inner_peripheral!((FROM_CPU_INTR0(unstable)));
_for_each_inner_peripheral!((FROM_CPU_INTR1(unstable)));
_for_each_inner_peripheral!((FROM_CPU_INTR2(unstable)));
_for_each_inner_peripheral!((FROM_CPU_INTR3(unstable)));
_for_each_inner_peripheral!((SPI2, Spi2, 0, AhbGdmaChannel));
_for_each_inner_peripheral!((UHCI0, Uhci0, 2, AhbGdmaChannel));
_for_each_inner_peripheral!((I2S0, I2s0, 3, AhbGdmaChannel));
_for_each_inner_peripheral!((AES, Aes, 6, AhbGdmaChannel));
_for_each_inner_peripheral!((SHA, Sha, 7, AhbGdmaChannel));
_for_each_inner_peripheral!((APB_SARADC, ApbSaradc, 8, AhbGdmaChannel));
_for_each_inner_peripheral!((all(@ peri_type #[doc =
"GPIO0 peripheral singleton"] GPIO0 <= virtual()), (@ peri_type #[doc =
"GPIO1 peripheral singleton"] GPIO1 <= virtual()), (@ peri_type #[doc =
"GPIO2 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>"] GPIO2 <= virtual()), (@ peri_type #[doc =
"GPIO3 peripheral singleton"] GPIO3 <= virtual()), (@ peri_type #[doc =
"GPIO4 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>"] GPIO4 <= virtual()), (@ peri_type #[doc =
"GPIO5 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>"] GPIO5 <= virtual()), (@ peri_type #[doc =
"GPIO6 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>"] GPIO6 <= virtual()), (@ peri_type #[doc =
"GPIO7 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>"] GPIO7 <= virtual()), (@ peri_type #[doc =
"GPIO8 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>"] GPIO8 <= virtual()), (@ peri_type #[doc =
"GPIO9 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>"] GPIO9 <= virtual()), (@ peri_type #[doc =
"GPIO10 peripheral singleton"] GPIO10 <= virtual()), (@ peri_type #[doc =
"GPIO11 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>"] GPIO11 <= virtual()), (@ peri_type #[doc =
"GPIO12 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>"] GPIO12 <= virtual()), (@ peri_type #[doc =
"GPIO13 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>"] GPIO13 <= virtual()), (@ peri_type #[doc =
"GPIO14 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>"] GPIO14 <= virtual()), (@ peri_type #[doc =
"GPIO15 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>"] GPIO15 <= virtual()), (@ peri_type #[doc =
"GPIO16 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>"] GPIO16 <= virtual()), (@ peri_type #[doc =
"GPIO17 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>"] GPIO17 <= virtual()), (@ peri_type #[doc =
"GPIO18 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>"] 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>By default, this pin is used by the UART programming interface.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO20 <= virtual()), (@ peri_type #[doc =
"GPIO21 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>"] GPIO21 <= virtual()), (@ peri_type #[doc =
"DMA_CH0 peripheral singleton"] DMA_CH0 <= virtual(DMA_CH0 : {
bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
(@ peri_type #[doc = "DMA_CH1 peripheral singleton"] DMA_CH1 <= virtual(DMA_CH1 :
{ bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
(@ peri_type #[doc = "DMA_CH2 peripheral singleton"] DMA_CH2 <= virtual(DMA_CH2 :
{ bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
(@ peri_type #[doc = "SDM_CH0 peripheral singleton"] SDM_CH0 <= virtual()
(unstable)), (@ peri_type #[doc = "SDM_CH1 peripheral singleton"] SDM_CH1 <=
virtual() (unstable)), (@ peri_type #[doc = "SDM_CH2 peripheral singleton"]
SDM_CH2 <= virtual() (unstable)), (@ peri_type #[doc =
"SDM_CH3 peripheral singleton"] SDM_CH3 <= virtual() (unstable)), (@ 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 =
"BB peripheral singleton"] BB <= BB() (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
= "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)), (@
peri_type #[doc = "FE peripheral singleton"] FE <= FE() (unstable)), (@ peri_type
#[doc = "FE2 peripheral singleton"] FE2 <= FE2() (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 = "I2S0 peripheral singleton"]
I2S0 <= I2S0(I2S0 : { 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 = "IO_MUX peripheral singleton"] IO_MUX <=
IO_MUX() (unstable)), (@ peri_type #[doc = "LEDC peripheral singleton"] LEDC <=
LEDC() (unstable)), (@ peri_type #[doc = "NRX peripheral singleton"] NRX <= NRX()
(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 = "LPWR peripheral singleton"] LPWR <= RTC_CNTL()
(unstable)), (@ peri_type #[doc = "RTC_TIMER peripheral singleton"] RTC_TIMER <=
RTC_CNTL() (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 =
"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 = "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (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 =
"XTS_AES peripheral singleton"] XTS_AES <= XTS_AES() (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 }, RWBT : { bind_rwbt_interrupt,
enable_rwbt_interrupt, disable_rwbt_interrupt }) (unstable)), (@ peri_type #[doc
= "FLASH peripheral singleton"] FLASH <= virtual() (unstable)), (@ peri_type
#[doc = "GPIO_DEDICATED peripheral singleton"] GPIO_DEDICATED <= virtual()
(unstable)), (@ peri_type #[doc = "TSENS peripheral singleton"] TSENS <=
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 })), (@ peri_type #[doc =
"FROM_CPU_INTR0 peripheral singleton"] FROM_CPU_INTR0 <= virtual() (unstable)),
(@ peri_type #[doc = "FROM_CPU_INTR1 peripheral singleton"] FROM_CPU_INTR1 <=
virtual() (unstable)), (@ peri_type #[doc =
"FROM_CPU_INTR2 peripheral singleton"] FROM_CPU_INTR2 <= virtual() (unstable)),
(@ peri_type #[doc = "FROM_CPU_INTR3 peripheral singleton"] FROM_CPU_INTR3 <=
virtual() (unstable)))); _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), (DMA_CH0(unstable)), (DMA_CH1(unstable)),
(DMA_CH2(unstable)), (SDM_CH0(unstable)), (SDM_CH1(unstable)),
(SDM_CH2(unstable)), (SDM_CH3(unstable)), (AES(unstable)), (APB_CTRL(unstable)),
(APB_SARADC(unstable)), (ASSIST_DEBUG(unstable)), (BB(unstable)),
(DMA(unstable)), (DS(unstable)), (EXTMEM(unstable)), (FE(unstable)),
(FE2(unstable)), (GPIO(unstable)), (GPIO_SD(unstable)), (HMAC(unstable)),
(I2C_ANA_MST(unstable)), (I2C0), (I2S0(unstable)), (INTERRUPT_CORE0(unstable)),
(IO_MUX(unstable)), (LEDC(unstable)), (NRX(unstable)), (RMT(unstable)),
(RNG(unstable)), (RSA(unstable)), (LPWR(unstable)), (RTC_TIMER(unstable)),
(SENSITIVE(unstable)), (SHA(unstable)), (SPI0(unstable)), (SPI1(unstable)),
(SPI2), (SYSTEM(unstable)), (SYSTIMER(unstable)), (TIMG0(unstable)),
(TIMG1(unstable)), (TWAI0(unstable)), (UART0), (UART1), (UHCI0(unstable)),
(USB_DEVICE(unstable)), (XTS_AES(unstable)), (ADC1(unstable)), (ADC2(unstable)),
(BT(unstable)), (FLASH(unstable)), (GPIO_DEDICATED(unstable)), (TSENS(unstable)),
(WIFI), (FROM_CPU_INTR0(unstable)), (FROM_CPU_INTR1(unstable)),
(FROM_CPU_INTR2(unstable)), (FROM_CPU_INTR3(unstable))));
_for_each_inner_peripheral!((dma_eligible(SPI2, Spi2, 0, AhbGdmaChannel), (UHCI0,
Uhci0, 2, AhbGdmaChannel), (I2S0, I2s0, 3, AhbGdmaChannel), (AES, Aes, 6,
AhbGdmaChannel), (SHA, Sha, 7, AhbGdmaChannel), (APB_SARADC, ApbSaradc, 8,
AhbGdmaChannel)));
};
}
#[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(_2 => FSPIQ) (_2 => FSPIQ) ([Input] [Output])));
_for_each_inner_gpio!((3, GPIO3() () ([Input] [Output])));
_for_each_inner_gpio!((4, GPIO4(_0 => MTMS _2 => FSPIHD) (_2 => FSPIHD) ([Input]
[Output]))); _for_each_inner_gpio!((5, GPIO5(_0 => MTDI _2 => FSPIWP) (_2 =>
FSPIWP) ([Input] [Output]))); _for_each_inner_gpio!((6, GPIO6(_0 => MTCK _2 =>
FSPICLK) (_2 => FSPICLK) ([Input] [Output]))); _for_each_inner_gpio!((7, GPIO7(_2
=> FSPID) (_0 => MTDO _2 => FSPID) ([Input] [Output])));
_for_each_inner_gpio!((8, GPIO8() () ([Input] [Output])));
_for_each_inner_gpio!((9, GPIO9() () ([Input] [Output])));
_for_each_inner_gpio!((10, GPIO10(_2 => FSPICS0) (_2 => FSPICS0) ([Input]
[Output]))); _for_each_inner_gpio!((11, GPIO11() () ([Input] [Output])));
_for_each_inner_gpio!((12, GPIO12(_0 => SPIHD) (_0 => SPIHD) ([Input]
[Output]))); _for_each_inner_gpio!((13, GPIO13(_0 => SPIWP) (_0 => SPIWP)
([Input] [Output]))); _for_each_inner_gpio!((14, GPIO14() (_0 => SPICS0) ([Input]
[Output]))); _for_each_inner_gpio!((15, GPIO15() (_0 => SPICLK) ([Input]
[Output]))); _for_each_inner_gpio!((16, GPIO16(_0 => SPID) (_0 => SPID) ([Input]
[Output]))); _for_each_inner_gpio!((17, GPIO17(_0 => SPIQ) (_0 => SPIQ) ([Input]
[Output]))); _for_each_inner_gpio!((18, GPIO18() () ([Input] [Output])));
_for_each_inner_gpio!((19, GPIO19() () ([Input] [Output])));
_for_each_inner_gpio!((20, GPIO20(_0 => U0RXD) () ([Input] [Output])));
_for_each_inner_gpio!((21, GPIO21() (_0 => U0TXD) ([Input] [Output])));
_for_each_inner_gpio!((all(0, GPIO0() () ([Input] [Output])), (1, GPIO1() ()
([Input] [Output])), (2, GPIO2(_2 => FSPIQ) (_2 => FSPIQ) ([Input] [Output])),
(3, GPIO3() () ([Input] [Output])), (4, GPIO4(_0 => MTMS _2 => FSPIHD) (_2 =>
FSPIHD) ([Input] [Output])), (5, GPIO5(_0 => MTDI _2 => FSPIWP) (_2 => FSPIWP)
([Input] [Output])), (6, GPIO6(_0 => MTCK _2 => FSPICLK) (_2 => FSPICLK) ([Input]
[Output])), (7, GPIO7(_2 => FSPID) (_0 => MTDO _2 => FSPID) ([Input] [Output])),
(8, GPIO8() () ([Input] [Output])), (9, GPIO9() () ([Input] [Output])), (10,
GPIO10(_2 => FSPICS0) (_2 => FSPICS0) ([Input] [Output])), (11, GPIO11() ()
([Input] [Output])), (12, GPIO12(_0 => SPIHD) (_0 => SPIHD) ([Input] [Output])),
(13, GPIO13(_0 => SPIWP) (_0 => SPIWP) ([Input] [Output])), (14, GPIO14() (_0 =>
SPICS0) ([Input] [Output])), (15, GPIO15() (_0 => SPICLK) ([Input] [Output])),
(16, GPIO16(_0 => SPID) (_0 => SPID) ([Input] [Output])), (17, GPIO17(_0 => SPIQ)
(_0 => SPIQ) ([Input] [Output])), (18, GPIO18() () ([Input] [Output])), (19,
GPIO19() () ([Input] [Output])), (20, GPIO20(_0 => U0RXD) () ([Input] [Output])),
(21, GPIO21() (_0 => U0TXD) ([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!((ADC1_CH0, GPIO0));
_for_each_inner_analog_function!((ADC1_CH1, GPIO1));
_for_each_inner_analog_function!((ADC1_CH2, GPIO2));
_for_each_inner_analog_function!((ADC1_CH3, GPIO3));
_for_each_inner_analog_function!((ADC1_CH4, GPIO4));
_for_each_inner_analog_function!((ADC2_CH0, GPIO5));
_for_each_inner_analog_function!((USJ_DM, GPIO18));
_for_each_inner_analog_function!((USJ_DP, GPIO19));
_for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO0));
_for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO1));
_for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO2));
_for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO3));
_for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO4));
_for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO5));
_for_each_inner_analog_function!((all(ADC1_CH0, GPIO0), (ADC1_CH1, GPIO1),
(ADC1_CH2, GPIO2), (ADC1_CH3, GPIO3), (ADC1_CH4, GPIO4), (ADC2_CH0, GPIO5),
(USJ_DM, GPIO18), (USJ_DP, GPIO19)));
_for_each_inner_analog_function!((ADCn_CHm((ADC1_CH0, ADCn_CHm, 1, 0), GPIO0),
((ADC1_CH1, ADCn_CHm, 1, 1), GPIO1), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO2),
((ADC1_CH3, ADCn_CHm, 1, 3), GPIO3), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO4),
((ADC2_CH0, ADCn_CHm, 2, 0), GPIO5)));
};
}
#[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!((LP_GPIO0, GPIO0, _0));
_for_each_inner_lp_function!((LP_GPIO1, GPIO1, _0));
_for_each_inner_lp_function!((LP_GPIO2, GPIO2, _0));
_for_each_inner_lp_function!((LP_GPIO3, GPIO3, _0));
_for_each_inner_lp_function!((LP_GPIO4, GPIO4, _0));
_for_each_inner_lp_function!((LP_GPIO5, GPIO5, _0));
_for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO0, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO2, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO4, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0, () ()));
_for_each_inner_lp_function!((all(LP_GPIO0, GPIO0, _0), (LP_GPIO1, GPIO1, _0),
(LP_GPIO2, GPIO2, _0), (LP_GPIO3, GPIO3, _0), (LP_GPIO4, GPIO4, _0), (LP_GPIO5,
GPIO5, _0))); _for_each_inner_lp_function!((LP_GPIOn((LP_GPIO0, LP_GPIOn, 0),
GPIO0, _0, () ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO1, _0, () ()), ((LP_GPIO2,
LP_GPIOn, 2), GPIO2, _0, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO3, _0, () ()),
((LP_GPIO4, LP_GPIOn, 4), GPIO4, _0, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO5, _0,
() ())));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_iomux_function {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_iomux_function { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_iomux_function!((FSPIQ, GPIO2, _2));
_for_each_inner_iomux_function!((MTMS, GPIO4, _0));
_for_each_inner_iomux_function!((FSPIHD, GPIO4, _2));
_for_each_inner_iomux_function!((MTDI, GPIO5, _0));
_for_each_inner_iomux_function!((FSPIWP, GPIO5, _2));
_for_each_inner_iomux_function!((MTCK, GPIO6, _0));
_for_each_inner_iomux_function!((FSPICLK, GPIO6, _2));
_for_each_inner_iomux_function!((MTDO, GPIO7, _0));
_for_each_inner_iomux_function!((FSPID, GPIO7, _2));
_for_each_inner_iomux_function!((FSPICS0, GPIO10, _2));
_for_each_inner_iomux_function!((SPIHD, GPIO12, _0));
_for_each_inner_iomux_function!((SPIWP, GPIO13, _0));
_for_each_inner_iomux_function!((SPICS0, GPIO14, _0));
_for_each_inner_iomux_function!((SPICLK, GPIO15, _0));
_for_each_inner_iomux_function!((SPID, GPIO16, _0));
_for_each_inner_iomux_function!((SPIQ, GPIO17, _0));
_for_each_inner_iomux_function!((U0RXD, GPIO20, _0));
_for_each_inner_iomux_function!((U0TXD, GPIO21, _0));
_for_each_inner_iomux_function!(((FSPICS0, FSPICSn, 0), GPIO10, _2));
_for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO14, _0));
_for_each_inner_iomux_function!((all(FSPIQ, GPIO2, _2), (MTMS, GPIO4, _0),
(FSPIHD, GPIO4, _2), (MTDI, GPIO5, _0), (FSPIWP, GPIO5, _2), (MTCK, GPIO6, _0),
(FSPICLK, GPIO6, _2), (MTDO, GPIO7, _0), (FSPID, GPIO7, _2), (FSPICS0, GPIO10,
_2), (SPIHD, GPIO12, _0), (SPIWP, GPIO13, _0), (SPICS0, GPIO14, _0), (SPICLK,
GPIO15, _0), (SPID, GPIO16, _0), (SPIQ, GPIO17, _0), (U0RXD, GPIO20, _0), (U0TXD,
GPIO21, _0))); _for_each_inner_iomux_function!((FSPICSn((FSPICS0, FSPICSn, 0),
GPIO10, _2))); _for_each_inner_iomux_function!((SPICSn((SPICS0, SPICSn, 0),
GPIO14, _0)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! gpio_for_signal {
(ADC1_CH0 $(, $_fallback:literal)?) => {
"GPIO0"
};
(LP_GPIO0 $(, $_fallback:literal)?) => {
"GPIO0"
};
(ADC1_CH1 $(, $_fallback:literal)?) => {
"GPIO1"
};
(LP_GPIO1 $(, $_fallback:literal)?) => {
"GPIO1"
};
(FSPIQ $(, $_fallback:literal)?) => {
"GPIO2"
};
(ADC1_CH2 $(, $_fallback:literal)?) => {
"GPIO2"
};
(LP_GPIO2 $(, $_fallback:literal)?) => {
"GPIO2"
};
(ADC1_CH3 $(, $_fallback:literal)?) => {
"GPIO3"
};
(LP_GPIO3 $(, $_fallback:literal)?) => {
"GPIO3"
};
(MTMS $(, $_fallback:literal)?) => {
"GPIO4"
};
(FSPIHD $(, $_fallback:literal)?) => {
"GPIO4"
};
(ADC1_CH4 $(, $_fallback:literal)?) => {
"GPIO4"
};
(LP_GPIO4 $(, $_fallback:literal)?) => {
"GPIO4"
};
(MTDI $(, $_fallback:literal)?) => {
"GPIO5"
};
(FSPIWP $(, $_fallback:literal)?) => {
"GPIO5"
};
(ADC2_CH0 $(, $_fallback:literal)?) => {
"GPIO5"
};
(LP_GPIO5 $(, $_fallback:literal)?) => {
"GPIO5"
};
(MTCK $(, $_fallback:literal)?) => {
"GPIO6"
};
(FSPICLK $(, $_fallback:literal)?) => {
"GPIO6"
};
(MTDO $(, $_fallback:literal)?) => {
"GPIO7"
};
(FSPID $(, $_fallback:literal)?) => {
"GPIO7"
};
(FSPICS0 $(, $_fallback:literal)?) => {
"GPIO10"
};
(SPIHD $(, $_fallback:literal)?) => {
"GPIO12"
};
(SPIWP $(, $_fallback:literal)?) => {
"GPIO13"
};
(SPICS0 $(, $_fallback:literal)?) => {
"GPIO14"
};
(SPICLK $(, $_fallback:literal)?) => {
"GPIO15"
};
(SPID $(, $_fallback:literal)?) => {
"GPIO16"
};
(SPIQ $(, $_fallback:literal)?) => {
"GPIO17"
};
(USJ_DM $(, $_fallback:literal)?) => {
"GPIO18"
};
(USJ_DP $(, $_fallback:literal)?) => {
"GPIO19"
};
(U0RXD $(, $_fallback:literal)?) => {
"GPIO20"
};
(U0TXD $(, $_fallback:literal)?) => {
"GPIO21"
};
($_signal:ident, $fallback:literal) => {
$fallback
};
}
#[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,
U0RXD = 6,
U0CTS = 7,
U0DSR = 8,
U1RXD = 9,
U1CTS = 10,
U1DSR = 11,
I2S_MCLK = 12,
I2SO_BCK = 13,
I2SO_WS = 14,
I2SI_SD = 15,
I2SI_BCK = 16,
I2SI_WS = 17,
GPIO_BT_PRIORITY = 18,
GPIO_BT_ACTIVE = 19,
CPU_GPIO_0 = 28,
CPU_GPIO_1 = 29,
CPU_GPIO_2 = 30,
CPU_GPIO_3 = 31,
CPU_GPIO_4 = 32,
CPU_GPIO_5 = 33,
CPU_GPIO_6 = 34,
CPU_GPIO_7 = 35,
EXT_ADC_START = 45,
RMT_SIG_0 = 51,
RMT_SIG_1 = 52,
I2CEXT0_SCL = 53,
I2CEXT0_SDA = 54,
FSPICLK = 63,
FSPIQ = 64,
FSPID = 65,
FSPIHD = 66,
FSPIWP = 67,
FSPICS0 = 68,
TWAI_RX = 74,
SIG_FUNC_97 = 97,
SIG_FUNC_98 = 98,
SIG_FUNC_99 = 99,
SIG_FUNC_100 = 100,
MTCK,
MTMS,
MTDI,
}
#[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,
U0TXD = 6,
U0RTS = 7,
U0DTR = 8,
U1TXD = 9,
U1RTS = 10,
U1DTR = 11,
I2S_MCLK = 12,
I2SO_BCK = 13,
I2SO_WS = 14,
I2SO_SD = 15,
I2SI_BCK = 16,
I2SI_WS = 17,
GPIO_WLAN_PRIO = 18,
GPIO_WLAN_ACTIVE = 19,
CPU_GPIO_0 = 28,
CPU_GPIO_1 = 29,
CPU_GPIO_2 = 30,
CPU_GPIO_3 = 31,
CPU_GPIO_4 = 32,
CPU_GPIO_5 = 33,
CPU_GPIO_6 = 34,
CPU_GPIO_7 = 35,
USB_JTAG_TCK = 36,
USB_JTAG_TMS = 37,
USB_JTAG_TDI = 38,
USB_JTAG_TDO = 39,
LEDC_LS_SIG0 = 45,
LEDC_LS_SIG1 = 46,
LEDC_LS_SIG2 = 47,
LEDC_LS_SIG3 = 48,
LEDC_LS_SIG4 = 49,
LEDC_LS_SIG5 = 50,
RMT_SIG_0 = 51,
RMT_SIG_1 = 52,
I2CEXT0_SCL = 53,
I2CEXT0_SDA = 54,
GPIO_SD0 = 55,
GPIO_SD1 = 56,
GPIO_SD2 = 57,
GPIO_SD3 = 58,
I2SO_SD1 = 59,
FSPICLK = 63,
FSPIQ = 64,
FSPID = 65,
FSPIHD = 66,
FSPIWP = 67,
FSPICS0 = 68,
FSPICS1 = 69,
FSPICS3 = 70,
FSPICS2 = 71,
FSPICS4 = 72,
FSPICS5 = 73,
TWAI_TX = 74,
TWAI_BUS_OFF_ON = 75,
TWAI_CLKOUT = 76,
ANT_SEL0 = 89,
ANT_SEL1 = 90,
ANT_SEL2 = 91,
ANT_SEL3 = 92,
ANT_SEL4 = 93,
ANT_SEL5 = 94,
ANT_SEL6 = 95,
ANT_SEL7 = 96,
SIG_FUNC_97 = 97,
SIG_FUNC_98 = 98,
SIG_FUNC_99 = 99,
SIG_FUNC_100 = 100,
CLK_OUT1 = 123,
CLK_OUT2 = 124,
CLK_OUT3 = 125,
SPICS1 = 126,
USB_JTAG_TRST = 127,
GPIO = 128,
MTDO,
}
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! define_lp_functions {
() => {
#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[doc(hidden)]
pub enum LpFunction {
_0 = 0,
}
impl LpFunction {
pub const LP_GPIO: Self = Self::_0;
}
};
}
#[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)
}
};
}