#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! chip {
() => {
"esp32"
};
}
#[doc = concat!("assert_eq!(chip_name, ", chip_pretty!(), ")")]
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! chip_pretty {
() => {
"ESP32"
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! property {
("chip") => {
"esp32"
};
("arch") => {
"xtensa"
};
("cores") => {
2
};
("cores", str) => {
stringify!(2)
};
("trm") => {
"https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf"
};
("gpio.version") => {
1
};
("gpio.version", str) => {
stringify!(1)
};
("gpio.has_input_sync") => {
false
};
("gpio.gpio_function") => {
2
};
("gpio.gpio_function", str) => {
stringify!(2)
};
("gpio.constant_0_input") => {
48
};
("gpio.constant_0_input", str) => {
stringify!(48)
};
("gpio.constant_1_input") => {
56
};
("gpio.constant_1_input", str) => {
stringify!(56)
};
("gpio.remap_iomux_pin_registers") => {
true
};
("gpio.func_in_sel_offset") => {
0
};
("gpio.func_in_sel_offset", str) => {
stringify!(0)
};
("gpio.has_bank_1") => {
true
};
("gpio.input_signal_max") => {
206
};
("gpio.input_signal_max", str) => {
stringify!(206)
};
("gpio.output_signal_max") => {
256
};
("gpio.output_signal_max", str) => {
stringify!(256)
};
("lp_io.version") => {
"esp32"
};
("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") => {
false
};
("uart.has_sclk_enable") => {
false
};
("i2c_master.version") => {
1
};
("i2c_master.version", str) => {
stringify!(1)
};
("i2c_master.has_fsm_timeouts") => {
false
};
("i2c_master.has_hw_bus_clear") => {
false
};
("i2c_master.has_bus_timeout_enable") => {
false
};
("i2c_master.separate_filter_config_registers") => {
true
};
("i2c_master.can_estimate_nack_reason") => {
false
};
("i2c_master.has_conf_update") => {
false
};
("i2c_master.has_reliable_fsm_reset") => {
false
};
("i2c_master.has_arbitration_en") => {
false
};
("i2c_master.has_tx_fifo_watermark") => {
false
};
("i2c_master.bus_timeout_is_exponential") => {
false
};
("i2c_master.has_pd_en") => {
false
};
("i2c_master.i2c0_data_register_ahb_address") => {
1610690588
};
("i2c_master.i2c0_data_register_ahb_address", str) => {
stringify!(1610690588)
};
("i2c_master.max_bus_timeout") => {
1048575
};
("i2c_master.max_bus_timeout", str) => {
stringify!(1048575)
};
("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") => {
1
};
("spi_master.version", str) => {
stringify!(1)
};
("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") => {
false
};
("spi_master.has_dma_segmented_transfer") => {
false
};
("spi_master.has_clk_pre_div") => {
false
};
("spi_master.dma_can_access_flash") => {
false
};
("i2s.version") => {
1
};
("i2s.version", str) => {
stringify!(1)
};
("i2s.default_clock_source") => {
2
};
("i2s.default_clock_source", str) => {
stringify!(2)
};
("i2s.mclk_divider_bit_width") => {
6
};
("i2s.mclk_divider_bit_width", str) => {
stringify!(6)
};
("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") => {
true
};
("rmt.ram_start") => {
1073047552
};
("rmt.ram_start", str) => {
stringify!(1073047552)
};
("rmt.channel_ram_size") => {
64
};
("rmt.channel_ram_size", str) => {
stringify!(64)
};
("rmt.has_tx_immediate_stop") => {
false
};
("rmt.has_tx_loop_count") => {
false
};
("rmt.has_tx_loop_auto_stop") => {
false
};
("rmt.has_tx_carrier_data_only") => {
false
};
("rmt.has_tx_sync") => {
false
};
("rmt.has_rx_wrap") => {
false
};
("rmt.has_rx_demodulation") => {
false
};
("rmt.has_per_channel_clock") => {
true
};
("sdmmc.has_iomux") => {
true
};
("sdmmc.has_gpio_matrix") => {
false
};
("sdmmc.psram_dma") => {
false
};
("sdmmc.uhs") => {
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
};
("ethernet.mii_via_gpio_matrix") => {
false
};
("phy.combo_module") => {
true
};
("ledc.version") => {
1
};
("ledc.version", str) => {
stringify!(1)
};
("ledc.channel_count") => {
8
};
("ledc.channel_count", str) => {
stringify!(8)
};
("sdm.channel_count") => {
8
};
("sdm.channel_count", str) => {
stringify!(8)
};
("timergroup.timg_has_timer1") => {
true
};
("timergroup.timg_has_divcnt_rst") => {
false
};
("aes.has_split_text_registers") => {
false
};
("aes.endianness_configurable") => {
true
};
("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") => {
1
};
("rsa.version", str) => {
stringify!(1)
};
("rsa.size_increment") => {
512
};
("rsa.size_increment", str) => {
stringify!(512)
};
("rsa.memory_size_bytes") => {
512
};
("rsa.memory_size_bytes", str) => {
stringify!(512)
};
("sleep.light_sleep") => {
true
};
("sleep.deep_sleep") => {
true
};
("sleep.rejectable_mask") => {
20
};
("sleep.ext1_version") => {
1
};
("sleep.ext1_version", str) => {
stringify!(1)
};
("sleep.pin_wakeup_version") => {
1
};
("sleep.pin_wakeup_version", str) => {
stringify!(1)
};
("sleep.deep_sleep_needs_gpio_isolation") => {
true
};
("dma.mem2mem_requires_peripheral") => {
false
};
("dma.ext_mem_configurable_block_size") => {
false
};
("dma.separate_in_out_interrupts") => {
false
};
("interrupts.status_registers") => {
3
};
("interrupts.status_registers", str) => {
stringify!(3)
};
("mmu.page_size") => {
65536
};
("mmu.page_size", str) => {
stringify!(65536)
};
("mmu.entry_num") => {
256
};
("mmu.entry_num", str) => {
stringify!(256)
};
("psram.octal_spi") => {
false
};
("psram.hex_spi") => {
false
};
("psram.extmem_origin") => {
1065353216
};
("psram.extmem_origin", str) => {
stringify!(1065353216)
};
("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") => {
false
};
("soc.multi_core_enabled") => {
true
};
("soc.internal_memory_cached") => {
false
};
("soc.has_swd_watchdog") => {
false
};
("soc.cpu_mcause_mask") => {
0
};
("soc.cpu_mcause_mask", str) => {
stringify!(0)
};
("clock_tree.cpu_pll_div_in") => {
[crate ::soc::clocks::CpuPllDivInConfig::Pll, crate
::soc::clocks::CpuPllDivInConfig::Apll]
};
("clock_tree.cpu_pll_div.divisor") => {
[2, 4]
};
("clock_tree.syscon_pre_div_in") => {
[crate ::soc::clocks::SysconPreDivInConfig::Xtal, crate
::soc::clocks::SysconPreDivInConfig::RcFast]
};
("clock_tree.syscon_pre_div.divisor") => {
(0, 1023)
};
("clock_tree.cpu_clk") => {
[crate ::soc::clocks::CpuClkConfig::Xtal, crate
::soc::clocks::CpuClkConfig::RcFast, crate ::soc::clocks::CpuClkConfig::Apll,
crate ::soc::clocks::CpuClkConfig::Pll]
};
("clock_tree.apb_clk") => {
[crate ::soc::clocks::ApbClkConfig::Pll80m, crate
::soc::clocks::ApbClkConfig::CpuDiv2, crate ::soc::clocks::ApbClkConfig::Cpu]
};
("clock_tree.ref_tick_pll.divisor") => {
(0, 255)
};
("clock_tree.ref_tick_apll.divisor") => {
(0, 255)
};
("clock_tree.ref_tick_xtal.divisor") => {
(0, 255)
};
("clock_tree.ref_tick_fosc.divisor") => {
(0, 255)
};
("clock_tree.ref_tick") => {
[crate ::soc::clocks::RefTickConfig::Pll, crate
::soc::clocks::RefTickConfig::Apll, crate ::soc::clocks::RefTickConfig::Xtal,
crate ::soc::clocks::RefTickConfig::Fosc]
};
("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.timg_calibration_clock") => {
[crate ::soc::clocks::TimgCalibrationClockConfig::RcSlowClk, crate
::soc::clocks::TimgCalibrationClockConfig::RcFastDivClk, #[cfg(use_xtal32k)]
crate ::soc::clocks::TimgCalibrationClockConfig::Xtal32kClk]
};
("clock_tree.i2c.function_clock.sclk") => {
[crate ::soc::clocks::I2cFunctionClockSclk::Apb]
};
("clock_tree.uart.function_clock.sclk") => {
[crate ::soc::clocks::UartFunctionClockSclk::Apb, crate
::soc::clocks::UartFunctionClockSclk::RefTick]
};
("clock_tree.uart.baud_rate_generator.fractional") => {
(0, 15)
};
("clock_tree.uart.baud_rate_generator.integral") => {
(0, 1048575)
};
("clock_tree.rmt.sclk") => {
[crate ::soc::clocks::RmtSclkConfig::RefTick, crate
::soc::clocks::RmtSclkConfig::ApbClk]
};
}
#[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!((4)); _for_each_inner_rmt_channel!((5));
_for_each_inner_rmt_channel!((6)); _for_each_inner_rmt_channel!((7));
_for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
_for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
_for_each_inner_rmt_channel!((4, 4)); _for_each_inner_rmt_channel!((5, 5));
_for_each_inner_rmt_channel!((6, 6)); _for_each_inner_rmt_channel!((7, 7));
_for_each_inner_rmt_channel!((0, 0)); _for_each_inner_rmt_channel!((1, 1));
_for_each_inner_rmt_channel!((2, 2)); _for_each_inner_rmt_channel!((3, 3));
_for_each_inner_rmt_channel!((4, 4)); _for_each_inner_rmt_channel!((5, 5));
_for_each_inner_rmt_channel!((6, 6)); _for_each_inner_rmt_channel!((7, 7));
_for_each_inner_rmt_channel!((all(0), (1), (2), (3), (4), (5), (6), (7)));
_for_each_inner_rmt_channel!((tx(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
(6, 6), (7, 7))); _for_each_inner_rmt_channel!((rx(0, 0), (1, 1), (2, 2), (3, 3),
(4, 4), (5, 5), (6, 6), (7, 7)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_sdmmc {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_sdmmc { $(($pattern) => $code;)* ($other : tt) => {}
} _for_each_inner_sdmmc!((slot0, 0, true, [], [], [], [], [],
[HOST_CARD_DETECT_N_1], [HOST_CARD_WRITE_PRT_1], [HOST_CARD_INT_N_1], [],
[HOST_RST_N_1])); _for_each_inner_sdmmc!((slot1, 1, true, [], [], [], [], [],
[HOST_CARD_DETECT_N_2], [HOST_CARD_WRITE_PRT_2], [HOST_CARD_INT_N_2], [],
[HOST_RST_N_2])); _for_each_inner_sdmmc!((all(slot0, 0, true, [], [], [], [], [],
[HOST_CARD_DETECT_N_1], [HOST_CARD_WRITE_PRT_1], [HOST_CARD_INT_N_1], [],
[HOST_RST_N_1]), (slot1, 1, true, [], [], [], [], [], [HOST_CARD_DETECT_N_2],
[HOST_CARD_WRITE_PRT_2], [HOST_CARD_INT_N_2], [], [HOST_RST_N_2])));
};
}
#[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!((4, SDM_CH4, SdmCh4, GPIO_SD4));
_for_each_inner_sdm_channel!((5, SDM_CH5, SdmCh5, GPIO_SD5));
_for_each_inner_sdm_channel!((6, SDM_CH6, SdmCh6, GPIO_SD6));
_for_each_inner_sdm_channel!((7, SDM_CH7, SdmCh7, GPIO_SD7));
_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), (4, SDM_CH4, SdmCh4, GPIO_SD4), (5, SDM_CH5, SdmCh5, GPIO_SD5), (6,
SDM_CH6, SdmCh6, GPIO_SD6), (7, SDM_CH7, SdmCh7, GPIO_SD7)));
};
}
#[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!((192)); _for_each_inner_aes_key_length!((256));
_for_each_inner_aes_key_length!((128, 0, 4));
_for_each_inner_aes_key_length!((192, 1, 5));
_for_each_inner_aes_key_length!((256, 2, 6));
_for_each_inner_aes_key_length!((bits(128), (192), (256)));
_for_each_inner_aes_key_length!((modes(128, 0, 4), (192, 1, 5), (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!((512));
_for_each_inner_rsa_exponentiation!((1024));
_for_each_inner_rsa_exponentiation!((1536));
_for_each_inner_rsa_exponentiation!((2048));
_for_each_inner_rsa_exponentiation!((2560));
_for_each_inner_rsa_exponentiation!((3072));
_for_each_inner_rsa_exponentiation!((3584));
_for_each_inner_rsa_exponentiation!((4096));
_for_each_inner_rsa_exponentiation!((all(512), (1024), (1536), (2048), (2560),
(3072), (3584), (4096)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rsa_multiplication {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_rsa_multiplication { $(($pattern) => $code;)*
($other : tt) => {} } _for_each_inner_rsa_multiplication!((512));
_for_each_inner_rsa_multiplication!((1024));
_for_each_inner_rsa_multiplication!((1536));
_for_each_inner_rsa_multiplication!((2048));
_for_each_inner_rsa_multiplication!((all(512), (1024), (1536), (2048)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_sha_algorithm {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_sha_algorithm { $(($pattern) => $code;)* ($other :
tt) => {} } _for_each_inner_sha_algorithm!((Sha1, "SHA-1"(sizes : 64, 20, 8)
(insecure_against : "collision", "length extension"), 0));
_for_each_inner_sha_algorithm!((Sha256, "SHA-256"(sizes : 64, 32, 8)
(insecure_against : "length extension"), 0));
_for_each_inner_sha_algorithm!((Sha384, "SHA-384"(sizes : 128, 48, 16)
(insecure_against :), 0)); _for_each_inner_sha_algorithm!((Sha512,
"SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 0));
_for_each_inner_sha_algorithm!((algos(Sha1, "SHA-1"(sizes : 64, 20, 8)
(insecure_against : "collision", "length extension"), 0), (Sha256,
"SHA-256"(sizes : 64, 32, 8) (insecure_against : "length extension"), 0),
(Sha384, "SHA-384"(sizes : 128, 48, 16) (insecure_against :), 0), (Sha512,
"SHA-512"(sizes : 128, 64, 16) (insecure_against : "length extension"), 0)));
};
}
#[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!((Ext0, 0));
_for_each_inner_wakeup_source!((Ext1, 1)); _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(Ext0, 0), (Ext1, 1), (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!(("SPI_DMA"));
_for_each_inner_dma_engine!(("I2S_DMA"));
_for_each_inner_dma_engine!((all("SPI_DMA"), ("I2S_DMA")));
};
}
#[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!(("SPI_DMA", DMA_SPI2));
_for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI3));
_for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S0));
_for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S1));
_for_each_inner_dma_channel!(("SPI_DMA", any_channel = SpiDmaChannel));
_for_each_inner_dma_channel!(("I2S_DMA", any_channel = I2sDmaChannel));
_for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI2, 0, interrupt = SPI2_DMA,
compatible = [SPI2])); _for_each_inner_dma_channel!(("SPI_DMA", DMA_SPI3, 1,
interrupt = SPI3_DMA, compatible = [SPI3]));
_for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S0, 0, interrupt = I2S0,
compatible = [I2S0])); _for_each_inner_dma_channel!(("I2S_DMA", DMA_I2S1, 1,
interrupt = I2S1, compatible = [I2S1]));
_for_each_inner_dma_channel!((names("SPI_DMA", DMA_SPI2), ("SPI_DMA", DMA_SPI3),
("I2S_DMA", DMA_I2S0), ("I2S_DMA", DMA_I2S1)));
_for_each_inner_dma_channel!((separate_any_type("SPI_DMA", any_channel =
SpiDmaChannel), ("I2S_DMA", any_channel = I2sDmaChannel)));
_for_each_inner_dma_channel!((shared("SPI_DMA", DMA_SPI2, 0, interrupt =
SPI2_DMA, compatible = [SPI2]), ("SPI_DMA", DMA_SPI3, 1, interrupt = SPI3_DMA,
compatible = [SPI3]), ("I2S_DMA", DMA_I2S0, 0, interrupt = I2S0, compatible =
[I2S0]), ("I2S_DMA", DMA_I2S1, 1, interrupt = I2S1, compatible = [I2S1])));
_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!(("SPI_DMA",
DMA_SPI2, SPI2)); _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", DMA_SPI3,
SPI3)); _for_each_inner_dma_channel_peri_pair!(("I2S_DMA", DMA_I2S0, I2S0));
_for_each_inner_dma_channel_peri_pair!(("I2S_DMA", DMA_I2S1, I2S1));
_for_each_inner_dma_channel_peri_pair!(("SPI_DMA", any_channel = SpiDmaChannel,
SPI2)); _for_each_inner_dma_channel_peri_pair!(("SPI_DMA", any_channel =
SpiDmaChannel, SPI3)); _for_each_inner_dma_channel_peri_pair!(("I2S_DMA",
any_channel = I2sDmaChannel, I2S0));
_for_each_inner_dma_channel_peri_pair!(("I2S_DMA", any_channel = I2sDmaChannel,
I2S1)); _for_each_inner_dma_channel_peri_pair!((channels("SPI_DMA", DMA_SPI2,
SPI2), ("SPI_DMA", DMA_SPI3, SPI3), ("I2S_DMA", DMA_I2S0, I2S0), ("I2S_DMA",
DMA_I2S1, I2S1)));
_for_each_inner_dma_channel_peri_pair!((any_channels("SPI_DMA", any_channel =
SpiDmaChannel, SPI2), ("SPI_DMA", any_channel = SpiDmaChannel, SPI3), ("I2S_DMA",
any_channel = I2sDmaChannel, I2S0), ("I2S_DMA", any_channel = I2sDmaChannel,
I2S1)));
};
}
#[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!(("I2S_DMA", I2sDmaChannel));
};
}
#[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!(("SPI_DMA", SpiDmaChannel));
};
}
#[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!(("SPI_DMA", SpiDmaChannel));
};
}
#[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,
I2c1 = 1,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum McpwmInstance {
Mcpwm0 = 0,
Mcpwm1 = 1,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RmtInstance {
Rmt = 0,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SpiInstance {
Spi2 = 0,
Spi3 = 1,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum UartInstance {
Uart0 = 0,
Uart1 = 1,
Uart2 = 2,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum XtalClkConfig {
_26,
_40,
}
impl XtalClkConfig {
pub fn value(&self) -> u32 {
match self {
XtalClkConfig::_26 => 26000000,
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 struct ApllClkConfig(u32);
impl ApllClkConfig {
pub const fn new(frequency: u32) -> Self {
::core::assert!(
frequency >= 16000000u32 && frequency <= 128000000u32,
"`APLL_CLK` output frequency value must be between 16000000 and 128000000 \
(inclusive)."
);
Self(frequency)
}
}
impl ApllClkConfig {
pub fn value(&self) -> u32 {
self.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CpuPllDivInConfig {
Pll,
Apll,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum CpuPllDivDivisor {
_2 = 2,
_4 = 4,
}
impl CpuPllDivDivisor {
pub const fn new(raw: u32) -> Self {
match raw {
2 => Self::_2,
4 => Self::_4,
_ => ::core::panic!("Invalid CPU_PLL_DIV divisor value"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct CpuPllDivConfig {
divisor: CpuPllDivDivisor,
}
impl CpuPllDivConfig {
pub const fn new(divisor: CpuPllDivDivisor) -> Self {
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 SysconPreDivInConfig {
Xtal,
RcFast,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct SysconPreDivConfig {
divisor: u32,
}
impl SysconPreDivConfig {
pub const fn new(divisor: u32) -> Self {
::core::assert!(
divisor <= 1023,
"`SYSCON_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 ApbClkConfig {
Pll80m,
CpuDiv2,
Cpu,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RefTickConfig {
Pll,
Apll,
Xtal,
Fosc,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct RefTickXtalConfig {
divisor: u32,
}
impl RefTickXtalConfig {
pub const fn new(divisor: u32) -> Self {
::core::assert!(
divisor <= 255,
"`REF_TICK_XTAL` divisor must be between 0 and 255 (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 struct RefTickFoscConfig {
divisor: u32,
}
impl RefTickFoscConfig {
pub const fn new(divisor: u32) -> Self {
::core::assert!(
divisor <= 255,
"`REF_TICK_FOSC` divisor must be between 0 and 255 (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 struct RefTickApllConfig {
divisor: u32,
}
impl RefTickApllConfig {
pub const fn new(divisor: u32) -> Self {
::core::assert!(
divisor <= 255,
"`REF_TICK_APLL` divisor must be between 0 and 255 (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 struct RefTickPllConfig {
divisor: u32,
}
impl RefTickPllConfig {
pub const fn new(divisor: u32) -> Self {
::core::assert!(
divisor <= 255,
"`REF_TICK_PLL` divisor must be between 0 and 255 (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 CpuClkConfig {
Xtal,
RcFast,
Apll,
Pll,
}
#[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, 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]
Apb,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct I2cFunctionClockConfig {
sclk: I2cFunctionClockSclk,
}
impl I2cFunctionClockConfig {
pub const fn new(sclk: I2cFunctionClockSclk) -> Self {
Self { sclk }
}
pub(crate) fn sclk(self) -> I2cFunctionClockSclk {
self.sclk
}
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum McpwmFunctionClockConfig {
#[default]
PllF160m,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RmtSclkConfig {
RefTick,
#[default]
ApbClk,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum SpiFunctionClockConfig {
#[default]
Apb,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum UartFunctionClockSclk {
#[default]
Apb,
RefTick,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct UartFunctionClockConfig {
sclk: UartFunctionClockSclk,
}
impl UartFunctionClockConfig {
pub const fn new(sclk: UartFunctionClockSclk) -> Self {
Self { sclk }
}
pub(crate) fn sclk(self) -> UartFunctionClockSclk {
self.sclk
}
}
#[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 <= 1048575,
"`UART0_BAUD_RATE_GENERATOR` integral must be between 0 and 1048575 \
(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>,
apll_clk: Option<ApllClkConfig>,
cpu_pll_div_in: Option<CpuPllDivInConfig>,
cpu_pll_div: Option<CpuPllDivConfig>,
syscon_pre_div_in: Option<SysconPreDivInConfig>,
syscon_pre_div: Option<SysconPreDivConfig>,
apb_clk: Option<ApbClkConfig>,
ref_tick: Option<RefTickConfig>,
ref_tick_xtal: Option<RefTickXtalConfig>,
ref_tick_fosc: Option<RefTickFoscConfig>,
ref_tick_apll: Option<RefTickApllConfig>,
ref_tick_pll: Option<RefTickPllConfig>,
cpu_clk: Option<CpuClkConfig>,
rtc_slow_clk: Option<RtcSlowClkConfig>,
rtc_fast_clk: Option<RtcFastClkConfig>,
timg_calibration_clock: Option<TimgCalibrationClockConfig>,
i2c_function_clock: [Option<I2cFunctionClockConfig>; 2],
rmt_sclk: [Option<RmtSclkConfig>; 1],
uart_function_clock: [Option<UartFunctionClockConfig>; 3],
uart_baud_rate_generator: [Option<UartBaudRateGeneratorConfig>; 3],
pll_clk_refcount: u32,
rc_fast_clk_refcount: u32,
pll_f160m_clk_refcount: u32,
apb_clk_refcount: u32,
ref_tick_refcount: u32,
#[cfg(use_xtal32k)]
xtal32k_clk_refcount: u32,
rc_slow_clk_refcount: u32,
rc_fast_div_clk_refcount: u32,
rtc_slow_clk_refcount: u32,
rtc_fast_clk_refcount: u32,
uart_mem_clk_refcount: u32,
timg_calibration_clock_refcount: u32,
sdm_function_clock_refcount: [u32; 1],
i2c_function_clock_refcount: [u32; 2],
mcpwm_function_clock_refcount: [u32; 2],
rmt_sclk_refcount: [u32; 1],
spi_function_clock_refcount: [u32; 2],
uart_function_clock_refcount: [u32; 3],
uart_mem_clock_refcount: [u32; 3],
uart_baud_rate_generator_refcount: [u32; 3],
}
impl ClockTree {
pub fn with<R>(f: impl FnOnce(&mut ClockTree) -> R) -> R {
CLOCK_TREE.with(f)
}
pub fn xtal_clk(&self) -> Option<XtalClkConfig> {
self.xtal_clk
}
pub fn pll_clk(&self) -> Option<PllClkConfig> {
self.pll_clk
}
pub fn apll_clk(&self) -> Option<ApllClkConfig> {
self.apll_clk
}
pub fn cpu_pll_div_in(&self) -> Option<CpuPllDivInConfig> {
self.cpu_pll_div_in
}
pub fn cpu_pll_div(&self) -> Option<CpuPllDivConfig> {
self.cpu_pll_div
}
pub fn syscon_pre_div_in(&self) -> Option<SysconPreDivInConfig> {
self.syscon_pre_div_in
}
pub fn syscon_pre_div(&self) -> Option<SysconPreDivConfig> {
self.syscon_pre_div
}
pub fn apb_clk(&self) -> Option<ApbClkConfig> {
self.apb_clk
}
pub fn ref_tick(&self) -> Option<RefTickConfig> {
self.ref_tick
}
pub fn ref_tick_xtal(&self) -> Option<RefTickXtalConfig> {
self.ref_tick_xtal
}
pub fn ref_tick_fosc(&self) -> Option<RefTickFoscConfig> {
self.ref_tick_fosc
}
pub fn ref_tick_apll(&self) -> Option<RefTickApllConfig> {
self.ref_tick_apll
}
pub fn ref_tick_pll(&self) -> Option<RefTickPllConfig> {
self.ref_tick_pll
}
pub fn cpu_clk(&self) -> Option<CpuClkConfig> {
self.cpu_clk
}
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 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 i2c1_function_clock(&self) -> Option<I2cFunctionClockConfig> {
self.i2c_function_clock[I2cInstance::I2c1 as usize]
}
pub fn rmt_sclk(&self) -> Option<RmtSclkConfig> {
self.rmt_sclk[RmtInstance::Rmt 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]
}
pub fn uart2_function_clock(&self) -> Option<UartFunctionClockConfig> {
self.uart_function_clock[UartInstance::Uart2 as usize]
}
pub fn uart2_baud_rate_generator(&self) -> Option<UartBaudRateGeneratorConfig> {
self.uart_baud_rate_generator[UartInstance::Uart2 as usize]
}
}
static CLOCK_TREE: ::esp_sync::NonReentrantMutex<ClockTree> =
::esp_sync::NonReentrantMutex::new(ClockTree {
xtal_clk: None,
pll_clk: None,
apll_clk: None,
cpu_pll_div_in: None,
cpu_pll_div: None,
syscon_pre_div_in: None,
syscon_pre_div: None,
apb_clk: None,
ref_tick: None,
ref_tick_xtal: None,
ref_tick_fosc: None,
ref_tick_apll: None,
ref_tick_pll: None,
cpu_clk: None,
rtc_slow_clk: None,
rtc_fast_clk: None,
timg_calibration_clock: None,
i2c_function_clock: [None; 2],
rmt_sclk: [None; 1],
uart_function_clock: [None; 3],
uart_baud_rate_generator: [None; 3],
pll_clk_refcount: 0,
rc_fast_clk_refcount: 0,
pll_f160m_clk_refcount: 0,
apb_clk_refcount: 0,
ref_tick_refcount: 0,
#[cfg(use_xtal32k)]
xtal32k_clk_refcount: 0,
rc_slow_clk_refcount: 0,
rc_fast_div_clk_refcount: 0,
rtc_slow_clk_refcount: 0,
rtc_fast_clk_refcount: 0,
uart_mem_clk_refcount: 0,
timg_calibration_clock_refcount: 0,
sdm_function_clock_refcount: [0; 1],
i2c_function_clock_refcount: [0; 2],
mcpwm_function_clock_refcount: [0; 2],
rmt_sclk_refcount: [0; 1],
spi_function_clock_refcount: [0; 2],
uart_function_clock_refcount: [0; 3],
uart_mem_clock_refcount: [0; 3],
uart_baud_rate_generator_refcount: [0; 3],
});
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 APLL_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static CPU_PLL_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static CPU_PLL_DIV_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static SYSCON_PRE_DIV_IN_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static SYSCON_PRE_DIV_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 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 TIMG_CALIBRATION_CLOCK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static APB_CLK_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static REF_TICK_XTAL_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static REF_TICK_FOSC_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static REF_TICK_APLL_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static REF_TICK_PLL_FREQ_CACHE: ::core::sync::atomic::AtomicU32 =
::core::sync::atomic::AtomicU32::new(0);
static REF_TICK_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 UART_FUNCTION_CLOCK_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
static UART_BAUD_RATE_GENERATOR_FREQ_CACHE: [::core::sync::atomic::AtomicU32; 3] =
[const { ::core::sync::atomic::AtomicU32::new(0) }; 3];
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) {
if clocks.cpu_pll_div.is_some() {
assert!(
!((config.value() == 480000000)
&& (unwrap!(clocks.cpu_pll_div).divisor() == 4))
);
}
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");
if increment_reference_count(&mut clocks.pll_clk_refcount) {
trace!("Enabling PLL_CLK");
request_xtal_clk(clocks);
enable_pll_clk_impl(clocks, true);
}
}
pub fn release_pll_clk(clocks: &mut ClockTree) {
trace!("Releasing PLL_CLK");
if decrement_reference_count(&mut clocks.pll_clk_refcount) {
trace!("Disabling PLL_CLK");
enable_pll_clk_impl(clocks, false);
release_xtal_clk(clocks);
}
}
#[allow(unused_variables)]
pub fn pll_clk_config_frequency(clocks: &mut ClockTree, config: PllClkConfig) -> u32 {
config.value()
}
pub fn pll_clk_frequency() -> u32 {
PLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn pll_clk_source_frequency() -> u32 {
xtal_clk_frequency()
}
pub fn configure_apll_clk(clocks: &mut ClockTree, config: ApllClkConfig) {
let old_config = clocks.apll_clk.replace(config);
refresh_apll_clk_downstream(clocks);
configure_apll_clk_impl(clocks, old_config, config);
}
pub fn apll_clk_config(clocks: &mut ClockTree) -> Option<ApllClkConfig> {
clocks.apll_clk
}
pub fn request_apll_clk(clocks: &mut ClockTree) {
trace!("Requesting APLL_CLK");
trace!("Enabling APLL_CLK");
request_pll_clk(clocks);
enable_apll_clk_impl(clocks, true);
}
pub fn release_apll_clk(clocks: &mut ClockTree) {
trace!("Releasing APLL_CLK");
trace!("Disabling APLL_CLK");
enable_apll_clk_impl(clocks, false);
release_pll_clk(clocks);
}
#[allow(unused_variables)]
pub fn apll_clk_config_frequency(clocks: &mut ClockTree, config: ApllClkConfig) -> u32 {
config.value()
}
pub fn apll_clk_frequency() -> u32 {
APLL_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn apll_clk_source_frequency() -> u32 {
pll_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 {
8000000
}
pub fn request_pll_f160m_clk(clocks: &mut ClockTree) {
trace!("Requesting PLL_F160M_CLK");
if increment_reference_count(&mut clocks.pll_f160m_clk_refcount) {
trace!("Enabling PLL_F160M_CLK");
request_pll_clk(clocks);
enable_pll_f160m_clk_impl(clocks, true);
}
}
pub fn release_pll_f160m_clk(clocks: &mut ClockTree) {
trace!("Releasing PLL_F160M_CLK");
if decrement_reference_count(&mut clocks.pll_f160m_clk_refcount) {
trace!("Disabling PLL_F160M_CLK");
enable_pll_f160m_clk_impl(clocks, false);
release_pll_clk(clocks);
}
}
pub fn pll_f160m_clk_frequency() -> u32 {
160000000
}
pub fn pll_f160m_clk_source_frequency() -> u32 {
pll_clk_frequency()
}
pub fn configure_cpu_pll_div_in(clocks: &mut ClockTree, new_selector: CpuPllDivInConfig) {
let old_selector = clocks.cpu_pll_div_in.replace(new_selector);
refresh_cpu_pll_div_in_downstream(clocks);
match new_selector {
CpuPllDivInConfig::Pll => request_pll_clk(clocks),
CpuPllDivInConfig::Apll => request_apll_clk(clocks),
}
configure_cpu_pll_div_in_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
CpuPllDivInConfig::Pll => release_pll_clk(clocks),
CpuPllDivInConfig::Apll => release_apll_clk(clocks),
}
}
}
pub fn cpu_pll_div_in_config(clocks: &mut ClockTree) -> Option<CpuPllDivInConfig> {
clocks.cpu_pll_div_in
}
pub fn request_cpu_pll_div_in(clocks: &mut ClockTree) {
trace!("Requesting CPU_PLL_DIV_IN");
trace!("Enabling CPU_PLL_DIV_IN");
match unwrap!(clocks.cpu_pll_div_in) {
CpuPllDivInConfig::Pll => request_pll_clk(clocks),
CpuPllDivInConfig::Apll => request_apll_clk(clocks),
}
enable_cpu_pll_div_in_impl(clocks, true);
}
pub fn release_cpu_pll_div_in(clocks: &mut ClockTree) {
trace!("Releasing CPU_PLL_DIV_IN");
trace!("Disabling CPU_PLL_DIV_IN");
enable_cpu_pll_div_in_impl(clocks, false);
match unwrap!(clocks.cpu_pll_div_in) {
CpuPllDivInConfig::Pll => release_pll_clk(clocks),
CpuPllDivInConfig::Apll => release_apll_clk(clocks),
}
}
#[allow(unused_variables)]
pub fn cpu_pll_div_in_config_frequency(
clocks: &mut ClockTree,
config: CpuPllDivInConfig,
) -> u32 {
match config {
CpuPllDivInConfig::Pll => pll_clk_frequency(),
CpuPllDivInConfig::Apll => apll_clk_frequency(),
}
}
pub fn cpu_pll_div_in_frequency() -> u32 {
CPU_PLL_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn cpu_pll_div_in_source_frequency(source: CpuPllDivInConfig) -> u32 {
match source {
CpuPllDivInConfig::Pll => pll_clk_frequency(),
CpuPllDivInConfig::Apll => apll_clk_frequency(),
}
}
pub fn configure_cpu_pll_div(clocks: &mut ClockTree, config: CpuPllDivConfig) {
if clocks.pll_clk.is_some() {
assert!(!((pll_clk_frequency() == 480000000) && (config.divisor() == 4)));
}
let old_config = clocks.cpu_pll_div.replace(config);
refresh_cpu_pll_div_downstream(clocks);
configure_cpu_pll_div_impl(clocks, old_config, config);
}
pub fn cpu_pll_div_config(clocks: &mut ClockTree) -> Option<CpuPllDivConfig> {
clocks.cpu_pll_div
}
pub fn request_cpu_pll_div(clocks: &mut ClockTree) {
trace!("Requesting CPU_PLL_DIV");
trace!("Enabling CPU_PLL_DIV");
request_cpu_pll_div_in(clocks);
enable_cpu_pll_div_impl(clocks, true);
}
pub fn release_cpu_pll_div(clocks: &mut ClockTree) {
trace!("Releasing CPU_PLL_DIV");
trace!("Disabling CPU_PLL_DIV");
enable_cpu_pll_div_impl(clocks, false);
release_cpu_pll_div_in(clocks);
}
#[allow(unused_variables)]
pub fn cpu_pll_div_config_frequency(
clocks: &mut ClockTree,
config: CpuPllDivConfig,
) -> u32 {
(cpu_pll_div_in_frequency() / config.divisor())
}
pub fn cpu_pll_div_frequency() -> u32 {
CPU_PLL_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn cpu_pll_div_source_frequency() -> u32 {
cpu_pll_div_in_frequency()
}
pub fn configure_syscon_pre_div_in(
clocks: &mut ClockTree,
new_selector: SysconPreDivInConfig,
) {
let old_selector = clocks.syscon_pre_div_in.replace(new_selector);
refresh_syscon_pre_div_in_downstream(clocks);
match new_selector {
SysconPreDivInConfig::Xtal => request_xtal_clk(clocks),
SysconPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
}
configure_syscon_pre_div_in_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
SysconPreDivInConfig::Xtal => release_xtal_clk(clocks),
SysconPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
}
}
}
pub fn syscon_pre_div_in_config(clocks: &mut ClockTree) -> Option<SysconPreDivInConfig> {
clocks.syscon_pre_div_in
}
pub fn request_syscon_pre_div_in(clocks: &mut ClockTree) {
trace!("Requesting SYSCON_PRE_DIV_IN");
trace!("Enabling SYSCON_PRE_DIV_IN");
match unwrap!(clocks.syscon_pre_div_in) {
SysconPreDivInConfig::Xtal => request_xtal_clk(clocks),
SysconPreDivInConfig::RcFast => request_rc_fast_clk(clocks),
}
enable_syscon_pre_div_in_impl(clocks, true);
}
pub fn release_syscon_pre_div_in(clocks: &mut ClockTree) {
trace!("Releasing SYSCON_PRE_DIV_IN");
trace!("Disabling SYSCON_PRE_DIV_IN");
enable_syscon_pre_div_in_impl(clocks, false);
match unwrap!(clocks.syscon_pre_div_in) {
SysconPreDivInConfig::Xtal => release_xtal_clk(clocks),
SysconPreDivInConfig::RcFast => release_rc_fast_clk(clocks),
}
}
#[allow(unused_variables)]
pub fn syscon_pre_div_in_config_frequency(
clocks: &mut ClockTree,
config: SysconPreDivInConfig,
) -> u32 {
match config {
SysconPreDivInConfig::Xtal => xtal_clk_frequency(),
SysconPreDivInConfig::RcFast => rc_fast_clk_frequency(),
}
}
pub fn syscon_pre_div_in_frequency() -> u32 {
SYSCON_PRE_DIV_IN_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn syscon_pre_div_in_source_frequency(source: SysconPreDivInConfig) -> u32 {
match source {
SysconPreDivInConfig::Xtal => xtal_clk_frequency(),
SysconPreDivInConfig::RcFast => rc_fast_clk_frequency(),
}
}
pub fn configure_syscon_pre_div(clocks: &mut ClockTree, config: SysconPreDivConfig) {
let old_config = clocks.syscon_pre_div.replace(config);
refresh_syscon_pre_div_downstream(clocks);
configure_syscon_pre_div_impl(clocks, old_config, config);
}
pub fn syscon_pre_div_config(clocks: &mut ClockTree) -> Option<SysconPreDivConfig> {
clocks.syscon_pre_div
}
pub fn request_syscon_pre_div(clocks: &mut ClockTree) {
trace!("Requesting SYSCON_PRE_DIV");
trace!("Enabling SYSCON_PRE_DIV");
request_syscon_pre_div_in(clocks);
enable_syscon_pre_div_impl(clocks, true);
}
pub fn release_syscon_pre_div(clocks: &mut ClockTree) {
trace!("Releasing SYSCON_PRE_DIV");
trace!("Disabling SYSCON_PRE_DIV");
enable_syscon_pre_div_impl(clocks, false);
release_syscon_pre_div_in(clocks);
}
#[allow(unused_variables)]
pub fn syscon_pre_div_config_frequency(
clocks: &mut ClockTree,
config: SysconPreDivConfig,
) -> u32 {
(syscon_pre_div_in_frequency() / (config.divisor() + 1))
}
pub fn syscon_pre_div_frequency() -> u32 {
SYSCON_PRE_DIV_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn syscon_pre_div_source_frequency() -> u32 {
syscon_pre_div_in_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_apb_clk_80m(clocks),
ApbClkConfig::CpuDiv2 => request_apb_clk_cpu_div2(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_apb_clk_80m(clocks),
ApbClkConfig::CpuDiv2 => release_apb_clk_cpu_div2(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_apb_clk_80m(clocks),
ApbClkConfig::CpuDiv2 => request_apb_clk_cpu_div2(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_apb_clk_80m(clocks),
ApbClkConfig::CpuDiv2 => release_apb_clk_cpu_div2(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 => apb_clk_80m_frequency(),
ApbClkConfig::CpuDiv2 => apb_clk_cpu_div2_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 => apb_clk_80m_frequency(),
ApbClkConfig::CpuDiv2 => apb_clk_cpu_div2_frequency(),
ApbClkConfig::Cpu => cpu_clk_frequency(),
}
}
pub fn configure_ref_tick(clocks: &mut ClockTree, new_selector: RefTickConfig) {
let old_selector = clocks.ref_tick.replace(new_selector);
refresh_ref_tick_downstream(clocks);
if clocks.ref_tick_refcount > 0 {
match new_selector {
RefTickConfig::Pll => request_ref_tick_pll(clocks),
RefTickConfig::Apll => request_ref_tick_apll(clocks),
RefTickConfig::Xtal => request_ref_tick_xtal(clocks),
RefTickConfig::Fosc => request_ref_tick_fosc(clocks),
}
configure_ref_tick_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
RefTickConfig::Pll => release_ref_tick_pll(clocks),
RefTickConfig::Apll => release_ref_tick_apll(clocks),
RefTickConfig::Xtal => release_ref_tick_xtal(clocks),
RefTickConfig::Fosc => release_ref_tick_fosc(clocks),
}
}
} else {
configure_ref_tick_impl(clocks, old_selector, new_selector);
}
}
pub fn ref_tick_config(clocks: &mut ClockTree) -> Option<RefTickConfig> {
clocks.ref_tick
}
pub fn request_ref_tick(clocks: &mut ClockTree) {
trace!("Requesting REF_TICK");
if increment_reference_count(&mut clocks.ref_tick_refcount) {
trace!("Enabling REF_TICK");
match unwrap!(clocks.ref_tick) {
RefTickConfig::Pll => request_ref_tick_pll(clocks),
RefTickConfig::Apll => request_ref_tick_apll(clocks),
RefTickConfig::Xtal => request_ref_tick_xtal(clocks),
RefTickConfig::Fosc => request_ref_tick_fosc(clocks),
}
enable_ref_tick_impl(clocks, true);
}
}
pub fn release_ref_tick(clocks: &mut ClockTree) {
trace!("Releasing REF_TICK");
if decrement_reference_count(&mut clocks.ref_tick_refcount) {
trace!("Disabling REF_TICK");
enable_ref_tick_impl(clocks, false);
match unwrap!(clocks.ref_tick) {
RefTickConfig::Pll => release_ref_tick_pll(clocks),
RefTickConfig::Apll => release_ref_tick_apll(clocks),
RefTickConfig::Xtal => release_ref_tick_xtal(clocks),
RefTickConfig::Fosc => release_ref_tick_fosc(clocks),
}
}
}
#[allow(unused_variables)]
pub fn ref_tick_config_frequency(clocks: &mut ClockTree, config: RefTickConfig) -> u32 {
match config {
RefTickConfig::Pll => ref_tick_pll_frequency(),
RefTickConfig::Apll => ref_tick_apll_frequency(),
RefTickConfig::Xtal => ref_tick_xtal_frequency(),
RefTickConfig::Fosc => ref_tick_fosc_frequency(),
}
}
pub fn ref_tick_frequency() -> u32 {
REF_TICK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn ref_tick_source_frequency(source: RefTickConfig) -> u32 {
match source {
RefTickConfig::Pll => ref_tick_pll_frequency(),
RefTickConfig::Apll => ref_tick_apll_frequency(),
RefTickConfig::Xtal => ref_tick_xtal_frequency(),
RefTickConfig::Fosc => ref_tick_fosc_frequency(),
}
}
pub fn configure_ref_tick_xtal(clocks: &mut ClockTree, config: RefTickXtalConfig) {
let old_config = clocks.ref_tick_xtal.replace(config);
refresh_ref_tick_xtal_downstream(clocks);
configure_ref_tick_xtal_impl(clocks, old_config, config);
}
pub fn ref_tick_xtal_config(clocks: &mut ClockTree) -> Option<RefTickXtalConfig> {
clocks.ref_tick_xtal
}
pub fn request_ref_tick_xtal(clocks: &mut ClockTree) {
trace!("Requesting REF_TICK_XTAL");
trace!("Enabling REF_TICK_XTAL");
request_apb_clk(clocks);
enable_ref_tick_xtal_impl(clocks, true);
}
pub fn release_ref_tick_xtal(clocks: &mut ClockTree) {
trace!("Releasing REF_TICK_XTAL");
trace!("Disabling REF_TICK_XTAL");
enable_ref_tick_xtal_impl(clocks, false);
release_apb_clk(clocks);
}
#[allow(unused_variables)]
pub fn ref_tick_xtal_config_frequency(
clocks: &mut ClockTree,
config: RefTickXtalConfig,
) -> u32 {
(apb_clk_frequency() / (config.divisor() + 1))
}
pub fn ref_tick_xtal_frequency() -> u32 {
REF_TICK_XTAL_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn ref_tick_xtal_source_frequency() -> u32 {
apb_clk_frequency()
}
pub fn configure_ref_tick_fosc(clocks: &mut ClockTree, config: RefTickFoscConfig) {
let old_config = clocks.ref_tick_fosc.replace(config);
refresh_ref_tick_fosc_downstream(clocks);
configure_ref_tick_fosc_impl(clocks, old_config, config);
}
pub fn ref_tick_fosc_config(clocks: &mut ClockTree) -> Option<RefTickFoscConfig> {
clocks.ref_tick_fosc
}
pub fn request_ref_tick_fosc(clocks: &mut ClockTree) {
trace!("Requesting REF_TICK_FOSC");
trace!("Enabling REF_TICK_FOSC");
request_apb_clk(clocks);
enable_ref_tick_fosc_impl(clocks, true);
}
pub fn release_ref_tick_fosc(clocks: &mut ClockTree) {
trace!("Releasing REF_TICK_FOSC");
trace!("Disabling REF_TICK_FOSC");
enable_ref_tick_fosc_impl(clocks, false);
release_apb_clk(clocks);
}
#[allow(unused_variables)]
pub fn ref_tick_fosc_config_frequency(
clocks: &mut ClockTree,
config: RefTickFoscConfig,
) -> u32 {
(apb_clk_frequency() / (config.divisor() + 1))
}
pub fn ref_tick_fosc_frequency() -> u32 {
REF_TICK_FOSC_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn ref_tick_fosc_source_frequency() -> u32 {
apb_clk_frequency()
}
pub fn configure_ref_tick_apll(clocks: &mut ClockTree, config: RefTickApllConfig) {
let old_config = clocks.ref_tick_apll.replace(config);
refresh_ref_tick_apll_downstream(clocks);
configure_ref_tick_apll_impl(clocks, old_config, config);
}
pub fn ref_tick_apll_config(clocks: &mut ClockTree) -> Option<RefTickApllConfig> {
clocks.ref_tick_apll
}
pub fn request_ref_tick_apll(clocks: &mut ClockTree) {
trace!("Requesting REF_TICK_APLL");
trace!("Enabling REF_TICK_APLL");
request_apb_clk(clocks);
enable_ref_tick_apll_impl(clocks, true);
}
pub fn release_ref_tick_apll(clocks: &mut ClockTree) {
trace!("Releasing REF_TICK_APLL");
trace!("Disabling REF_TICK_APLL");
enable_ref_tick_apll_impl(clocks, false);
release_apb_clk(clocks);
}
#[allow(unused_variables)]
pub fn ref_tick_apll_config_frequency(
clocks: &mut ClockTree,
config: RefTickApllConfig,
) -> u32 {
(apb_clk_frequency() / (config.divisor() + 1))
}
pub fn ref_tick_apll_frequency() -> u32 {
REF_TICK_APLL_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn ref_tick_apll_source_frequency() -> u32 {
apb_clk_frequency()
}
pub fn configure_ref_tick_pll(clocks: &mut ClockTree, config: RefTickPllConfig) {
let old_config = clocks.ref_tick_pll.replace(config);
refresh_ref_tick_pll_downstream(clocks);
configure_ref_tick_pll_impl(clocks, old_config, config);
}
pub fn ref_tick_pll_config(clocks: &mut ClockTree) -> Option<RefTickPllConfig> {
clocks.ref_tick_pll
}
pub fn request_ref_tick_pll(clocks: &mut ClockTree) {
trace!("Requesting REF_TICK_PLL");
trace!("Enabling REF_TICK_PLL");
request_apb_clk(clocks);
enable_ref_tick_pll_impl(clocks, true);
}
pub fn release_ref_tick_pll(clocks: &mut ClockTree) {
trace!("Releasing REF_TICK_PLL");
trace!("Disabling REF_TICK_PLL");
enable_ref_tick_pll_impl(clocks, false);
release_apb_clk(clocks);
}
#[allow(unused_variables)]
pub fn ref_tick_pll_config_frequency(
clocks: &mut ClockTree,
config: RefTickPllConfig,
) -> u32 {
(apb_clk_frequency() / (config.divisor() + 1))
}
pub fn ref_tick_pll_frequency() -> u32 {
REF_TICK_PLL_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn ref_tick_pll_source_frequency() -> u32 {
apb_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_syscon_pre_div_in(clocks, SysconPreDivInConfig::Xtal);
configure_ref_tick(clocks, RefTickConfig::Xtal);
let config_value =
RefTickXtalConfig::new(((apb_clk_frequency() / 1000000) - 1));
configure_ref_tick_xtal(clocks, config_value);
}
CpuClkConfig::RcFast => {
configure_apb_clk(clocks, ApbClkConfig::Cpu);
configure_syscon_pre_div_in(clocks, SysconPreDivInConfig::RcFast);
configure_ref_tick(clocks, RefTickConfig::Fosc);
let config_value =
RefTickFoscConfig::new(((apb_clk_frequency() / 1000000) - 1));
configure_ref_tick_fosc(clocks, config_value);
}
CpuClkConfig::Apll => {
configure_apb_clk(clocks, ApbClkConfig::CpuDiv2);
configure_cpu_pll_div_in(clocks, CpuPllDivInConfig::Apll);
configure_ref_tick(clocks, RefTickConfig::Apll);
let config_value =
RefTickApllConfig::new(((apb_clk_frequency() / 1000000) - 1));
configure_ref_tick_apll(clocks, config_value);
}
CpuClkConfig::Pll => {
configure_apb_clk(clocks, ApbClkConfig::Pll80m);
configure_cpu_pll_div_in(clocks, CpuPllDivInConfig::Pll);
configure_ref_tick(clocks, RefTickConfig::Pll);
let config_value = RefTickPllConfig::new(((apb_clk_frequency() / 1000000) - 1));
configure_ref_tick_pll(clocks, config_value);
}
}
match new_selector {
CpuClkConfig::Xtal => request_syscon_pre_div(clocks),
CpuClkConfig::RcFast => request_syscon_pre_div(clocks),
CpuClkConfig::Apll => request_cpu_pll_div(clocks),
CpuClkConfig::Pll => request_cpu_pll_div(clocks),
}
configure_cpu_clk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
CpuClkConfig::Xtal => release_syscon_pre_div(clocks),
CpuClkConfig::RcFast => release_syscon_pre_div(clocks),
CpuClkConfig::Apll => release_cpu_pll_div(clocks),
CpuClkConfig::Pll => release_cpu_pll_div(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 => syscon_pre_div_frequency(),
CpuClkConfig::RcFast => syscon_pre_div_frequency(),
CpuClkConfig::Apll => cpu_pll_div_frequency(),
CpuClkConfig::Pll => cpu_pll_div_frequency(),
}
}
pub fn cpu_clk_frequency() -> u32 {
CPU_CLK_FREQ_CACHE.load(::core::sync::atomic::Ordering::Acquire)
}
pub fn request_apb_clk_cpu_div2(clocks: &mut ClockTree) {
trace!("Requesting APB_CLK_CPU_DIV2");
trace!("Enabling APB_CLK_CPU_DIV2");
request_cpu_clk(clocks);
enable_apb_clk_cpu_div2_impl(clocks, true);
}
pub fn release_apb_clk_cpu_div2(clocks: &mut ClockTree) {
trace!("Releasing APB_CLK_CPU_DIV2");
trace!("Disabling APB_CLK_CPU_DIV2");
enable_apb_clk_cpu_div2_impl(clocks, false);
release_cpu_clk(clocks);
}
pub fn apb_clk_cpu_div2_frequency() -> u32 {
(cpu_clk_frequency() / 2)
}
pub fn apb_clk_cpu_div2_source_frequency() -> u32 {
cpu_clk_frequency()
}
pub fn request_apb_clk_80m(clocks: &mut ClockTree) {
trace!("Requesting APB_CLK_80M");
trace!("Enabling APB_CLK_80M");
request_cpu_clk(clocks);
enable_apb_clk_80m_impl(clocks, true);
}
pub fn release_apb_clk_80m(clocks: &mut ClockTree) {
trace!("Releasing APB_CLK_80M");
trace!("Disabling APB_CLK_80M");
enable_apb_clk_80m_impl(clocks, false);
release_cpu_clk(clocks);
}
pub fn apb_clk_80m_frequency() -> u32 {
80000000
}
pub fn apb_clk_80m_source_frequency() -> u32 {
cpu_clk_frequency()
}
#[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 {
150000
}
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 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() / 4)
}
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);
if clocks.rtc_slow_clk_refcount > 0 {
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),
}
}
} else {
configure_rtc_slow_clk_impl(clocks, old_selector, new_selector);
}
}
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");
if increment_reference_count(&mut clocks.rtc_slow_clk_refcount) {
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");
if decrement_reference_count(&mut clocks.rtc_slow_clk_refcount) {
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(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(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(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(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_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_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);
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::Apb => 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.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::Apb => release_apb_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn function_clock_config_frequency(
clocks: &mut ClockTree,
config: I2cFunctionClockConfig,
) -> u32 {
apb_clk_frequency()
}
pub fn function_clock_frequency(self) -> u32 {
apb_clk_frequency()
}
pub fn function_clock_source_frequency(sclk: I2cFunctionClockSclk) -> u32 {
match sclk {
I2cFunctionClockSclk::Apb => apb_clk_frequency(),
}
}
}
impl McpwmInstance {
pub fn request_function_clock(self, clocks: &mut ClockTree) {
trace!("Requesting {:?}::FUNCTION_CLOCK", self);
if increment_reference_count(
&mut clocks.mcpwm_function_clock_refcount[self as usize],
) {
trace!("Enabling {:?}::FUNCTION_CLOCK", self);
crate::rtc_cntl::WakeLock::acquire();
request_pll_f160m_clk(clocks);
self.enable_function_clock_impl(clocks, true);
}
}
pub fn release_function_clock(self, clocks: &mut ClockTree) {
trace!("Releasing {:?}::FUNCTION_CLOCK", self);
if decrement_reference_count(
&mut clocks.mcpwm_function_clock_refcount[self as usize],
) {
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
crate::rtc_cntl::WakeLock::release();
self.enable_function_clock_impl(clocks, false);
release_pll_f160m_clk(clocks);
}
}
pub fn function_clock_frequency(self) -> u32 {
pll_f160m_clk_frequency()
}
pub fn function_clock_source_frequency(source: McpwmFunctionClockConfig) -> u32 {
match source {
McpwmFunctionClockConfig::PllF160m => pll_f160m_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::RefTick => request_ref_tick(clocks),
RmtSclkConfig::ApbClk => request_apb_clk(clocks),
}
self.configure_sclk_impl(clocks, old_selector, new_selector);
if let Some(old_selector) = old_selector {
match old_selector {
RmtSclkConfig::RefTick => release_ref_tick(clocks),
RmtSclkConfig::ApbClk => release_apb_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::RefTick => request_ref_tick(clocks),
RmtSclkConfig::ApbClk => request_apb_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::RefTick => release_ref_tick(clocks),
RmtSclkConfig::ApbClk => release_apb_clk(clocks),
}
}
}
#[allow(unused_variables)]
pub fn sclk_config_frequency(clocks: &mut ClockTree, config: RmtSclkConfig) -> u32 {
match config {
RmtSclkConfig::RefTick => ref_tick_frequency(),
RmtSclkConfig::ApbClk => apb_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::RefTick => ref_tick_frequency(),
RmtSclkConfig::ApbClk => apb_clk_frequency(),
}
}
}
impl SpiInstance {
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();
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.spi_function_clock_refcount[self as usize])
{
trace!("Disabling {:?}::FUNCTION_CLOCK", self);
crate::rtc_cntl::WakeLock::release();
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(source: SpiFunctionClockConfig) -> u32 {
match source {
SpiFunctionClockConfig::Apb => apb_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::RefTick => request_ref_tick(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::RefTick => release_ref_tick(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::RefTick => request_ref_tick(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::RefTick => release_ref_tick(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::RefTick => ref_tick_frequency(),
}
}
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::RefTick => ref_tick_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 apll_clk: Option<ApllClkConfig>,
pub cpu_pll_div: Option<CpuPllDivConfig>,
pub syscon_pre_div: Option<SysconPreDivConfig>,
pub cpu_clk: Option<CpuClkConfig>,
pub rtc_slow_clk: Option<RtcSlowClkConfig>,
pub rtc_fast_clk: Option<RtcFastClkConfig>,
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.apll_clk {
configure_apll_clk(clocks, config);
}
if let Some(config) = self.cpu_pll_div {
configure_cpu_pll_div(clocks, config);
}
if let Some(config) = self.syscon_pre_div {
configure_syscon_pre_div(clocks, config);
}
if let Some(config) = self.cpu_clk {
configure_cpu_clk(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.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_syscon_pre_div_in_downstream(clocks);
refresh_rtc_fast_clk_downstream(clocks);
}
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_apll_clk_downstream(clocks);
refresh_cpu_pll_div_in_downstream(clocks);
}
fn refresh_apll_clk_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.apll_clk {
APLL_CLK_FREQ_CACHE.store(
apll_clk_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_cpu_pll_div_in_downstream(clocks);
}
fn refresh_cpu_pll_div_in_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.cpu_pll_div_in {
CPU_PLL_DIV_IN_FREQ_CACHE.store(
cpu_pll_div_in_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_cpu_pll_div_downstream(clocks);
}
fn refresh_cpu_pll_div_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.cpu_pll_div {
CPU_PLL_DIV_FREQ_CACHE.store(
cpu_pll_div_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_cpu_clk_downstream(clocks);
}
fn refresh_syscon_pre_div_in_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.syscon_pre_div_in {
SYSCON_PRE_DIV_IN_FREQ_CACHE.store(
syscon_pre_div_in_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_syscon_pre_div_downstream(clocks);
}
fn refresh_syscon_pre_div_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.syscon_pre_div {
SYSCON_PRE_DIV_FREQ_CACHE.store(
syscon_pre_div_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);
}
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,
);
}
}
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_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_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,
);
}
refresh_ref_tick_xtal_downstream(clocks);
refresh_ref_tick_fosc_downstream(clocks);
refresh_ref_tick_apll_downstream(clocks);
refresh_ref_tick_pll_downstream(clocks);
for child_instance in [I2cInstance::I2c0, I2cInstance::I2c1] {
refresh_i2c_function_clock_downstream(clocks, child_instance);
}
for child_instance in [RmtInstance::Rmt] {
refresh_rmt_sclk_downstream(clocks, child_instance);
}
for child_instance in [
UartInstance::Uart0,
UartInstance::Uart1,
UartInstance::Uart2,
] {
refresh_uart_function_clock_downstream(clocks, child_instance);
}
}
fn refresh_ref_tick_xtal_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.ref_tick_xtal {
REF_TICK_XTAL_FREQ_CACHE.store(
ref_tick_xtal_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_ref_tick_downstream(clocks);
}
fn refresh_ref_tick_fosc_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.ref_tick_fosc {
REF_TICK_FOSC_FREQ_CACHE.store(
ref_tick_fosc_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_ref_tick_downstream(clocks);
}
fn refresh_ref_tick_apll_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.ref_tick_apll {
REF_TICK_APLL_FREQ_CACHE.store(
ref_tick_apll_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_ref_tick_downstream(clocks);
}
fn refresh_ref_tick_pll_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.ref_tick_pll {
REF_TICK_PLL_FREQ_CACHE.store(
ref_tick_pll_config_frequency(clocks, config),
::core::sync::atomic::Ordering::Release,
);
}
refresh_ref_tick_downstream(clocks);
}
fn refresh_i2c_function_clock_downstream(clocks: &mut ClockTree, instance: I2cInstance) {}
fn refresh_ref_tick_downstream(clocks: &mut ClockTree) {
if let Some(config) = clocks.ref_tick {
REF_TICK_FREQ_CACHE.store(
ref_tick_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 [
UartInstance::Uart0,
UartInstance::Uart1,
UartInstance::Uart2,
] {
refresh_uart_function_clock_downstream(clocks, child_instance);
}
}
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_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,
Emac,
GpioSd,
I2cExt0,
I2cExt1,
I2s0,
I2s1,
Ledc,
Mcpwm0,
Mcpwm1,
Pcnt,
Rmt,
Rsa,
SdioHost,
Sha,
Spi2,
Spi3,
SpiDma,
Timg0,
Timg1,
Twai0,
Uart0,
Uart1,
Uart2,
UartMem,
Uhci0,
Uhci1,
}
impl Peripheral {
const KEEP_ENABLED: &[Peripheral] = &[Self::Timg0, Self::Uart0, Self::UartMem];
const COUNT: usize = Self::ALL.len();
const ALL: &[Self] = &[
Self::Aes,
Self::Emac,
Self::GpioSd,
Self::I2cExt0,
Self::I2cExt1,
Self::I2s0,
Self::I2s1,
Self::Ledc,
Self::Mcpwm0,
Self::Mcpwm1,
Self::Pcnt,
Self::Rmt,
Self::Rsa,
Self::SdioHost,
Self::Sha,
Self::Spi2,
Self::Spi3,
Self::SpiDma,
Self::Timg0,
Self::Timg1,
Self::Twai0,
Self::Uart0,
Self::Uart1,
Self::Uart2,
Self::UartMem,
Self::Uhci0,
Self::Uhci1,
];
}
unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
match peripheral {
Peripheral::Aes => {
crate::peripherals::SYSTEM::regs()
.peri_clk_en()
.modify(|_, w| w.crypto_aes_clk_en().bit(enable));
}
Peripheral::Emac => {
crate::peripherals::SYSTEM::regs()
.wifi_clk_en()
.modify(|_, w| w.emac_clk_en().bit(enable));
}
Peripheral::GpioSd => {
let _ = enable;
}
Peripheral::I2cExt0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
}
Peripheral::I2cExt1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
}
Peripheral::I2s0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.i2s0_clk_en().bit(enable));
}
Peripheral::I2s1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.i2s1_clk_en().bit(enable));
}
Peripheral::Ledc => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.ledc_clk_en().bit(enable));
}
Peripheral::Mcpwm0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.pwm0_clk_en().bit(enable));
}
Peripheral::Mcpwm1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.pwm1_clk_en().bit(enable));
}
Peripheral::Pcnt => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.pcnt_clk_en().bit(enable));
}
Peripheral::Rmt => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.rmt_clk_en().bit(enable));
}
Peripheral::Rsa => {
crate::peripherals::SYSTEM::regs()
.peri_clk_en()
.modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
}
Peripheral::SdioHost => {
crate::peripherals::SYSTEM::regs()
.wifi_clk_en()
.modify(|_, w| w.sdio_host_clk_en().bit(enable));
}
Peripheral::Sha => {
crate::peripherals::SYSTEM::regs()
.peri_clk_en()
.modify(|_, w| w.crypto_sha_clk_en().bit(enable));
}
Peripheral::Spi2 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.spi2_clk_en().bit(enable));
}
Peripheral::Spi3 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.spi3_clk_en().bit(enable));
}
Peripheral::SpiDma => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.spi_dma_clk_en().bit(enable));
}
Peripheral::Timg0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.timergroup_clk_en().bit(enable));
}
Peripheral::Timg1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.timergroup1_clk_en().bit(enable));
}
Peripheral::Twai0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.twai_clk_en().bit(enable));
}
Peripheral::Uart0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.uart_clk_en().bit(enable));
}
Peripheral::Uart1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.uart1_clk_en().bit(enable));
}
Peripheral::Uart2 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.uart2_clk_en().bit(enable));
}
Peripheral::UartMem => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.uart_mem_clk_en().bit(enable));
}
Peripheral::Uhci0 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.uhci0_clk_en().bit(enable));
}
Peripheral::Uhci1 => {
crate::peripherals::SYSTEM::regs()
.perip_clk_en()
.modify(|_, w| w.uhci1_clk_en().bit(enable));
}
}
}
unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
match peripheral {
Peripheral::Aes => {
crate::peripherals::SYSTEM::regs()
.peri_rst_en()
.modify(|_, w| w.crypto_aes_rst().bit(reset));
}
Peripheral::Emac => {
crate::peripherals::SYSTEM::regs()
.wifi_rst_en()
.modify(|_, w| w.emac_rst().bit(reset));
}
Peripheral::GpioSd => {
let _ = reset;
}
Peripheral::I2cExt0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.i2c_ext0_rst().bit(reset));
}
Peripheral::I2cExt1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.i2c_ext1_rst().bit(reset));
}
Peripheral::I2s0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.i2s0_rst().bit(reset));
}
Peripheral::I2s1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.i2s1_rst().bit(reset));
}
Peripheral::Ledc => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.ledc_rst().bit(reset));
}
Peripheral::Mcpwm0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.pwm0_rst().bit(reset));
}
Peripheral::Mcpwm1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.pwm1_rst().bit(reset));
}
Peripheral::Pcnt => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.pcnt_rst().bit(reset));
}
Peripheral::Rmt => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.rmt_rst().bit(reset));
}
Peripheral::Rsa => {
crate::peripherals::SYSTEM::regs()
.peri_rst_en()
.modify(|_, w| w.crypto_rsa_rst().bit(reset));
}
Peripheral::SdioHost => {
crate::peripherals::SYSTEM::regs()
.wifi_rst_en()
.modify(|_, w| w.sdio_host_rst().bit(reset));
}
Peripheral::Sha => {
crate::peripherals::SYSTEM::regs()
.peri_rst_en()
.modify(|_, w| w.crypto_sha_rst().bit(reset));
}
Peripheral::Spi2 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.spi2_rst().bit(reset));
}
Peripheral::Spi3 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.spi3_rst().bit(reset));
}
Peripheral::SpiDma => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.spi_dma_rst().bit(reset));
}
Peripheral::Timg0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.timergroup_rst().bit(reset));
}
Peripheral::Timg1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.timergroup1_rst().bit(reset));
}
Peripheral::Twai0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.twai_rst().bit(reset));
}
Peripheral::Uart0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.uart_rst().bit(reset));
}
Peripheral::Uart1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.uart1_rst().bit(reset));
}
Peripheral::Uart2 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.uart2_rst().bit(reset));
}
Peripheral::UartMem => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.uart_mem_rst().bit(reset));
}
Peripheral::Uhci0 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.uhci0_rst().bit(reset));
}
Peripheral::Uhci1 => {
crate::peripherals::SYSTEM::regs()
.perip_rst_en()
.modify(|_, w| w.uhci1_rst().bit(reset));
}
}
}
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! memory_range {
("DRAM") => {
0x3FFAE000..0x40000000
};
(size as str, "DRAM") => {
"335872"
};
("DRAM2_UNINIT") => {
0x3FFE7E30..0x40000000
};
(size as str, "DRAM2_UNINIT") => {
"98768"
};
("IROM") => {
0x400D0000..0x40400000
};
(size as str, "IROM") => {
"3342336"
};
("DROM") => {
0x3F400000..0x3F800000
};
(size as str, "DROM") => {
"4194304"
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_i2c_master {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_i2c_master { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_i2c_master!((0, I2C0, I2cExt0, I2CEXT0_SCL,
I2CEXT0_SDA)); _for_each_inner_i2c_master!((1, I2C1, I2cExt1, I2CEXT1_SCL,
I2CEXT1_SDA)); _for_each_inner_i2c_master!((all(0, I2C0, I2cExt0, I2CEXT0_SCL,
I2CEXT0_SDA), (1, I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_i2s {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_i2s { $(($pattern) => $code;)* ($other : tt) => {} }
_for_each_inner_i2s!((I2S0)); _for_each_inner_i2s!((I2S1));
_for_each_inner_i2s!((I2S0, I2s0, __NO_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK,
I2S0I_WS, [I2S0O_DATA_23], [I2S0I_DATA_15], true, true, true, true));
_for_each_inner_i2s!((I2S1, I2s1, __NO_MCLK, I2S1O_BCK, I2S1O_WS, I2S1I_BCK,
I2S1I_WS, [I2S1O_DATA_23], [I2S1I_DATA_15], true, false, false, false));
_for_each_inner_i2s!((names(I2S0), (I2S1))); _for_each_inner_i2s!((all(I2S0,
I2s0, __NO_MCLK, I2S0O_BCK, I2S0O_WS, I2S0I_BCK, I2S0I_WS, [I2S0O_DATA_23],
[I2S0I_DATA_15], true, true, true, true), (I2S1, I2s1, __NO_MCLK, I2S1O_BCK,
I2S1O_WS, I2S1I_BCK, I2S1I_WS, [I2S1O_DATA_23], [I2S1I_DATA_15], true, false,
false, 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!((2, UART2, Uart2,
U2RXD, U2TXD, U2CTS, U2RTS, wakeup_source = false));
_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), (2, UART2, Uart2, U2RXD, U2TXD, U2CTS, U2RTS,
wakeup_source = false)));
};
}
#[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!((SPI3));
_for_each_inner_spi_master!((SPI2, Spi2, HSPICLK[HSPICS0, HSPICS1, HSPICS2]
[HSPID, HSPIQ, HSPIWP, HSPIHD], true)); _for_each_inner_spi_master!((SPI3, Spi3,
VSPICLK[VSPICS0, VSPICS1, VSPICS2] [VSPID, VSPIQ, VSPIWP, VSPIHD], true));
_for_each_inner_spi_master!((names(SPI2), (SPI3)));
_for_each_inner_spi_master!((all(SPI2, Spi2, HSPICLK[HSPICS0, HSPICS1, HSPICS2]
[HSPID, HSPIQ, HSPIWP, HSPIHD], true), (SPI3, Spi3, VSPICLK[VSPICS0, VSPICS1,
VSPICS2] [VSPID, VSPIQ, VSPIWP, VSPIHD], 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!((SPI3));
_for_each_inner_spi_slave!((SPI2, Spi2, HSPICLK, HSPID, HSPIQ, HSPICS0));
_for_each_inner_spi_slave!((SPI3, Spi3, VSPICLK, VSPID, VSPIQ, VSPICS0));
_for_each_inner_spi_slave!((names(SPI2), (SPI3)));
_for_each_inner_spi_slave!((all(SPI2, Spi2, HSPICLK, HSPID, HSPIQ, HSPICS0),
(SPI3, Spi3, VSPICLK, VSPID, VSPIQ, VSPICS0)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_peripheral {
($($pattern:tt => $code:tt;)*) => {
macro_rules! _for_each_inner_peripheral { $(($pattern) => $code;)* ($other : tt)
=> {} } _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO1 peripheral singleton (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>"] 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 (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>"] GPIO3 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO4 peripheral singleton"]
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>This pin is a strapping pin, it determines how the chip boots.</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>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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 may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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 may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO9 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO10 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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 =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</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 is a strapping pin, it determines how the chip boots.</li>"] #[doc
=
"<li>These pins may be used to debug the chip using an external JTAG debugger.</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>These pins may be used to debug the chip using an external JTAG debugger.</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>These pins may be used to debug the chip using an external JTAG debugger.</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 is a strapping pin, it determines how the chip boots.</li>"] #[doc
=
"<li>These pins may be used to debug the chip using an external JTAG debugger.</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 =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</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 PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO17 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO18 peripheral singleton"]
GPIO18 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO19 peripheral singleton"] 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>This pin is only available on ESP32-PICO-V3.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO20 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO21 peripheral singleton"]
GPIO21 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO22 peripheral singleton"] GPIO22 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO23 peripheral singleton"]
GPIO23 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO25 peripheral singleton"] GPIO25 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO26 peripheral singleton"]
GPIO26 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO27 peripheral singleton"] GPIO27 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "GPIO32 peripheral singleton"]
GPIO32 <= virtual())); _for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO33 peripheral singleton"] GPIO33 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO38 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 can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc =
"GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA_SPI2 peripheral singleton"]
DMA_SPI2 <= SPI2(SPI2_DMA : { bind_dma_interrupt, enable_dma_interrupt,
disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "DMA_SPI3 peripheral singleton"] DMA_SPI3 <= SPI3(SPI3_DMA : {
bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "DMA_I2S0 peripheral singleton"]
DMA_I2S0 <= I2S0(I2S0 : { bind_dma_interrupt, enable_dma_interrupt,
disable_dma_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "DMA_I2S1 peripheral singleton"] DMA_I2S1 <= I2S1(I2S1 : {
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 = "SDM_CH4 peripheral singleton"]
SDM_CH4 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SDM_CH6 peripheral singleton"]
SDM_CH6 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "SDM_CH7 peripheral singleton"] SDM_CH7 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "AES peripheral singleton"] AES
<= AES() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "BB peripheral singleton"] BB <=
BB() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"DPORT peripheral singleton"] DPORT <= DPORT() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SYSTEM peripheral singleton"]
SYSTEM <= DPORT() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "ETH peripheral singleton"] ETH
<= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"EMAC_DMA peripheral singleton"] EMAC_DMA <= EMAC_DMA() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "EMAC_EXT peripheral singleton"]
EMAC_EXT <= EMAC_EXT() (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "EMAC_MAC peripheral singleton"] EMAC_MAC <= EMAC_MAC() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"FLASH_ENCRYPTION peripheral singleton"] FLASH_ENCRYPTION <= FLASH_ENCRYPTION()
(unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"FRC_TIMER peripheral singleton"] FRC_TIMER <= FRC_TIMER() (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 = "HINF peripheral singleton"]
HINF <= HINF() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"I2C0 peripheral singleton"] I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt })));
_for_each_inner_peripheral!((@ peri_type #[doc = "I2C1 peripheral singleton"]
I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"I2S0 peripheral singleton"] I2S0 <= I2S0(I2S0 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt }) (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "I2S1 peripheral singleton"]
I2S1 <= I2S1(I2S1 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }) (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "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 =
"MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc =
"MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "MCPWM1 peripheral singleton"]
MCPWM1 <= MCPWM1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"NRX peripheral singleton"] NRX <= NRX() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "PCNT peripheral singleton"]
PCNT <= PCNT() (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 = "LP_I2C0 peripheral singleton"]
LP_I2C0 <= RTC_I2C() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc
= "RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SDHOST peripheral singleton"]
SDHOST <= SDHOST() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"SENS peripheral singleton"] SENS <= SENS() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SHA peripheral singleton"] SHA
<= SHA() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"SLC peripheral singleton"] SLC <= SLC() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "SLCHOST peripheral singleton"]
SLCHOST <= SLCHOST() (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_DMA : { bind_dma_interrupt,
enable_dma_interrupt, disable_dma_interrupt }, SPI2 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt })));
_for_each_inner_peripheral!((@ peri_type #[doc = "SPI3 peripheral singleton"]
SPI3 <= SPI3(SPI3_DMA : { bind_dma_interrupt, enable_dma_interrupt,
disable_dma_interrupt }, SPI3 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "TIMG1 peripheral singleton"]
TIMG1 <= TIMG1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "UART0 peripheral singleton"]
UART0 <= UART0(UART0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"UART1 peripheral singleton"] UART1 <= UART1(UART1 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt })));
_for_each_inner_peripheral!((@ peri_type #[doc = "UART2 peripheral singleton"]
UART2 <= UART2(UART2 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }))); _for_each_inner_peripheral!((@ peri_type #[doc =
"UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "UHCI1 peripheral singleton"]
UHCI1 <= UHCI1() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"WIFI peripheral singleton"] WIFI <= WIFI(WIFI_MAC : { bind_mac_interrupt,
enable_mac_interrupt, disable_mac_interrupt }))); _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 = "CPU_CTRL peripheral singleton"]
CPU_CTRL <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type
#[doc = "DAC1 peripheral singleton"] DAC1 <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "DAC2 peripheral singleton"]
DAC2 <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"FLASH peripheral singleton"] FLASH <= virtual() (unstable)));
_for_each_inner_peripheral!((@ peri_type #[doc = "PSRAM peripheral singleton"]
PSRAM <= virtual() (unstable))); _for_each_inner_peripheral!((@ peri_type #[doc =
"TOUCH peripheral singleton"] TOUCH <= virtual() (unstable)));
_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!((GPIO22)); _for_each_inner_peripheral!((GPIO23));
_for_each_inner_peripheral!((GPIO25)); _for_each_inner_peripheral!((GPIO26));
_for_each_inner_peripheral!((GPIO27));
_for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO32));
_for_each_inner_peripheral!((#[cfg(not(use_xtal32k))] GPIO33));
_for_each_inner_peripheral!((GPIO34)); _for_each_inner_peripheral!((GPIO35));
_for_each_inner_peripheral!((GPIO36)); _for_each_inner_peripheral!((GPIO37));
_for_each_inner_peripheral!((GPIO38)); _for_each_inner_peripheral!((GPIO39));
_for_each_inner_peripheral!((DMA_SPI2(unstable)));
_for_each_inner_peripheral!((DMA_SPI3(unstable)));
_for_each_inner_peripheral!((DMA_I2S0(unstable)));
_for_each_inner_peripheral!((DMA_I2S1(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!((SDM_CH4(unstable)));
_for_each_inner_peripheral!((SDM_CH5(unstable)));
_for_each_inner_peripheral!((SDM_CH6(unstable)));
_for_each_inner_peripheral!((SDM_CH7(unstable)));
_for_each_inner_peripheral!((AES(unstable)));
_for_each_inner_peripheral!((APB_CTRL(unstable)));
_for_each_inner_peripheral!((BB(unstable)));
_for_each_inner_peripheral!((DPORT(unstable)));
_for_each_inner_peripheral!((SYSTEM(unstable)));
_for_each_inner_peripheral!((ETH(unstable)));
_for_each_inner_peripheral!((FLASH_ENCRYPTION(unstable)));
_for_each_inner_peripheral!((FRC_TIMER(unstable)));
_for_each_inner_peripheral!((GPIO(unstable)));
_for_each_inner_peripheral!((GPIO_SD(unstable)));
_for_each_inner_peripheral!((HINF(unstable)));
_for_each_inner_peripheral!((I2C0)); _for_each_inner_peripheral!((I2C1));
_for_each_inner_peripheral!((I2S0(unstable)));
_for_each_inner_peripheral!((I2S1(unstable)));
_for_each_inner_peripheral!((IO_MUX(unstable)));
_for_each_inner_peripheral!((LEDC(unstable)));
_for_each_inner_peripheral!((MCPWM0(unstable)));
_for_each_inner_peripheral!((MCPWM1(unstable)));
_for_each_inner_peripheral!((NRX(unstable)));
_for_each_inner_peripheral!((PCNT(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!((LP_I2C0(unstable)));
_for_each_inner_peripheral!((RTC_IO(unstable)));
_for_each_inner_peripheral!((SDHOST(unstable)));
_for_each_inner_peripheral!((SENS(unstable)));
_for_each_inner_peripheral!((SHA(unstable)));
_for_each_inner_peripheral!((SLC(unstable)));
_for_each_inner_peripheral!((SLCHOST(unstable)));
_for_each_inner_peripheral!((SPI0(unstable)));
_for_each_inner_peripheral!((SPI1(unstable)));
_for_each_inner_peripheral!((SPI2)); _for_each_inner_peripheral!((SPI3));
_for_each_inner_peripheral!((TIMG0(unstable)));
_for_each_inner_peripheral!((TIMG1(unstable)));
_for_each_inner_peripheral!((TWAI0(unstable)));
_for_each_inner_peripheral!((UART0)); _for_each_inner_peripheral!((UART1));
_for_each_inner_peripheral!((UART2));
_for_each_inner_peripheral!((UHCI0(unstable)));
_for_each_inner_peripheral!((UHCI1(unstable)));
_for_each_inner_peripheral!((WIFI));
_for_each_inner_peripheral!((ADC1(unstable)));
_for_each_inner_peripheral!((ADC2(unstable)));
_for_each_inner_peripheral!((BT(unstable)));
_for_each_inner_peripheral!((CPU_CTRL(unstable)));
_for_each_inner_peripheral!((DAC1(unstable)));
_for_each_inner_peripheral!((DAC2(unstable)));
_for_each_inner_peripheral!((FLASH(unstable)));
_for_each_inner_peripheral!((PSRAM(unstable)));
_for_each_inner_peripheral!((TOUCH(unstable)));
_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, SpiDmaChannel));
_for_each_inner_peripheral!((I2S0, I2s0, 0, I2sDmaChannel));
_for_each_inner_peripheral!((SPI3, Spi3, 1, SpiDmaChannel));
_for_each_inner_peripheral!((I2S1, I2s1, 1, I2sDmaChannel));
_for_each_inner_peripheral!((all(@ peri_type #[doc =
"GPIO0 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin is a strapping pin, it determines how the chip boots.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO0 <= virtual()), (@ peri_type #[doc =
"GPIO1 peripheral singleton (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>"] 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 (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>"] GPIO3 <= virtual()), (@ peri_type #[doc =
"GPIO4 peripheral singleton"] 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>This pin is a strapping pin, it determines how the chip boots.</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>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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 may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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 may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO9 <= virtual()), (@ peri_type #[doc =
"GPIO10 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI flash.</li>"] #[doc =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] 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 =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</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 is a strapping pin, it determines how the chip boots.</li>"] #[doc
=
"<li>These pins may be used to debug the chip using an external JTAG debugger.</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>These pins may be used to debug the chip using an external JTAG debugger.</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>These pins may be used to debug the chip using an external JTAG debugger.</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 is a strapping pin, it determines how the chip boots.</li>"] #[doc
=
"<li>These pins may be used to debug the chip using an external JTAG debugger.</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 =
"<li>This pin may be reserved for interfacing with SPI PSRAM.</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 PSRAM.</li>"] #[doc =
"</ul>"] #[doc = "</section>"] GPIO17 <= virtual()), (@ peri_type #[doc =
"GPIO18 peripheral singleton"] GPIO18 <= virtual()), (@ peri_type #[doc =
"GPIO19 peripheral singleton"] 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>This pin is only available on ESP32-PICO-V3.</li>"]
#[doc = "</ul>"] #[doc = "</section>"] GPIO20 <= virtual()), (@ peri_type #[doc =
"GPIO21 peripheral singleton"] GPIO21 <= virtual()), (@ peri_type #[doc =
"GPIO22 peripheral singleton"] GPIO22 <= virtual()), (@ peri_type #[doc =
"GPIO23 peripheral singleton"] GPIO23 <= virtual()), (@ peri_type #[doc =
"GPIO25 peripheral singleton"] GPIO25 <= virtual()), (@ peri_type #[doc =
"GPIO26 peripheral singleton"] GPIO26 <= virtual()), (@ peri_type #[doc =
"GPIO27 peripheral singleton"] GPIO27 <= virtual()), (@ peri_type #[doc =
"GPIO32 peripheral singleton"] GPIO32 <= virtual()), (@ peri_type #[doc =
"GPIO33 peripheral singleton"] GPIO33 <= virtual()), (@ peri_type #[doc =
"GPIO34 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO34 <= virtual()), (@ peri_type #[doc =
"GPIO35 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO35 <= virtual()), (@ peri_type #[doc =
"GPIO36 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO36 <= virtual()), (@ peri_type #[doc =
"GPIO37 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO37 <= virtual()), (@ peri_type #[doc =
"GPIO38 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 can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO38 <= virtual()), (@ peri_type #[doc =
"GPIO39 peripheral singleton (Limitations exist)"] #[doc = ""] #[doc =
"<section class=\"warning\">"] #[doc =
"This pin may be available with certain limitations. Check your hardware to make sure whether you can use it."]
#[doc = "<ul>"] #[doc = "<li>This pin can only be used as an input.</li>"] #[doc
= "</ul>"] #[doc = "</section>"] GPIO39 <= virtual()), (@ peri_type #[doc =
"DMA_SPI2 peripheral singleton"] DMA_SPI2 <= SPI2(SPI2_DMA : {
bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
(@ peri_type #[doc = "DMA_SPI3 peripheral singleton"] DMA_SPI3 <= SPI3(SPI3_DMA :
{ bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
(@ peri_type #[doc = "DMA_I2S0 peripheral singleton"] DMA_I2S0 <= I2S0(I2S0 : {
bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }) (unstable)),
(@ peri_type #[doc = "DMA_I2S1 peripheral singleton"] DMA_I2S1 <= I2S1(I2S1 : {
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 = "SDM_CH4 peripheral singleton"] SDM_CH4 <= virtual() (unstable)), (@
peri_type #[doc = "SDM_CH5 peripheral singleton"] SDM_CH5 <= virtual()
(unstable)), (@ peri_type #[doc = "SDM_CH6 peripheral singleton"] SDM_CH6 <=
virtual() (unstable)), (@ peri_type #[doc = "SDM_CH7 peripheral singleton"]
SDM_CH7 <= virtual() (unstable)), (@ peri_type #[doc =
"AES peripheral singleton"] AES <= AES() (unstable)), (@ peri_type #[doc =
"APB_CTRL peripheral singleton"] APB_CTRL <= APB_CTRL() (unstable)), (@ peri_type
#[doc = "BB peripheral singleton"] BB <= BB() (unstable)), (@ peri_type #[doc =
"DPORT peripheral singleton"] DPORT <= DPORT() (unstable)), (@ peri_type #[doc =
"SYSTEM peripheral singleton"] SYSTEM <= DPORT() (unstable)), (@ peri_type #[doc
= "EFUSE peripheral singleton"] EFUSE <= EFUSE() (unstable)), (@ peri_type #[doc
= "ETH peripheral singleton"] ETH <= virtual() (unstable)), (@ peri_type #[doc =
"EMAC_DMA peripheral singleton"] EMAC_DMA <= EMAC_DMA() (unstable)), (@ peri_type
#[doc = "EMAC_EXT peripheral singleton"] EMAC_EXT <= EMAC_EXT() (unstable)), (@
peri_type #[doc = "EMAC_MAC peripheral singleton"] EMAC_MAC <= EMAC_MAC()
(unstable)), (@ peri_type #[doc = "FLASH_ENCRYPTION peripheral singleton"]
FLASH_ENCRYPTION <= FLASH_ENCRYPTION() (unstable)), (@ peri_type #[doc =
"FRC_TIMER peripheral singleton"] FRC_TIMER <= FRC_TIMER() (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 = "HINF peripheral singleton"] HINF <= HINF()
(unstable)), (@ peri_type #[doc = "I2C0 peripheral singleton"] I2C0 <=
I2C0(I2C_EXT0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt })), (@ peri_type #[doc = "I2C1 peripheral singleton"]
I2C1 <= I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt })), (@ peri_type #[doc = "I2S0 peripheral singleton"]
I2S0 <= I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt,
disable_peri_interrupt }) (unstable)), (@ peri_type #[doc =
"I2S1 peripheral singleton"] I2S1 <= I2S1(I2S1 : { bind_peri_interrupt,
enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (@ peri_type #[doc
= "IO_MUX peripheral singleton"] IO_MUX <= IO_MUX() (unstable)), (@ peri_type
#[doc = "LEDC peripheral singleton"] LEDC <= LEDC() (unstable)), (@ peri_type
#[doc = "MCPWM0 peripheral singleton"] MCPWM0 <= MCPWM0() (unstable)), (@
peri_type #[doc = "MMU_TABLE peripheral singleton"] MMU_TABLE <= MMU_TABLE()
(unstable)), (@ peri_type #[doc = "MCPWM1 peripheral singleton"] MCPWM1 <=
MCPWM1() (unstable)), (@ peri_type #[doc = "NRX peripheral singleton"] NRX <=
NRX() (unstable)), (@ peri_type #[doc = "PCNT peripheral singleton"] PCNT <=
PCNT() (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 = "LP_I2C0 peripheral singleton"]
LP_I2C0 <= RTC_I2C() (unstable)), (@ peri_type #[doc =
"RTC_IO peripheral singleton"] RTC_IO <= RTC_IO() (unstable)), (@ peri_type #[doc
= "SDHOST peripheral singleton"] SDHOST <= SDHOST() (unstable)), (@ peri_type
#[doc = "SENS peripheral singleton"] SENS <= SENS() (unstable)), (@ peri_type
#[doc = "SHA peripheral singleton"] SHA <= SHA() (unstable)), (@ peri_type #[doc
= "SLC peripheral singleton"] SLC <= SLC() (unstable)), (@ peri_type #[doc =
"SLCHOST peripheral singleton"] SLCHOST <= SLCHOST() (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_DMA : {
bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }, SPI2 : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
peri_type #[doc = "SPI3 peripheral singleton"] SPI3 <= SPI3(SPI3_DMA : {
bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }, SPI3 : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
peri_type #[doc = "TIMG0 peripheral singleton"] TIMG0 <= TIMG0() (unstable)), (@
peri_type #[doc = "TIMG1 peripheral singleton"] TIMG1 <= TIMG1() (unstable)), (@
peri_type #[doc = "TWAI0 peripheral singleton"] TWAI0 <= TWAI0() (unstable)), (@
peri_type #[doc = "UART0 peripheral singleton"] UART0 <= UART0(UART0 : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
peri_type #[doc = "UART1 peripheral singleton"] UART1 <= UART1(UART1 : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
peri_type #[doc = "UART2 peripheral singleton"] UART2 <= UART2(UART2 : {
bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (@
peri_type #[doc = "UHCI0 peripheral singleton"] UHCI0 <= UHCI0() (unstable)), (@
peri_type #[doc = "UHCI1 peripheral singleton"] UHCI1 <= UHCI1() (unstable)), (@
peri_type #[doc = "WIFI peripheral singleton"] WIFI <= WIFI(WIFI_MAC : {
bind_mac_interrupt, enable_mac_interrupt, disable_mac_interrupt })), (@ 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
= "CPU_CTRL peripheral singleton"] CPU_CTRL <= virtual() (unstable)), (@
peri_type #[doc = "DAC1 peripheral singleton"] DAC1 <= virtual() (unstable)), (@
peri_type #[doc = "DAC2 peripheral singleton"] DAC2 <= virtual() (unstable)), (@
peri_type #[doc = "FLASH peripheral singleton"] FLASH <= virtual() (unstable)),
(@ peri_type #[doc = "PSRAM peripheral singleton"] PSRAM <= virtual()
(unstable)), (@ peri_type #[doc = "TOUCH peripheral singleton"] TOUCH <=
virtual() (unstable)), (@ 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), (GPIO22), (GPIO23), (GPIO25), (GPIO26), (GPIO27),
(#[cfg(not(use_xtal32k))] GPIO32), (#[cfg(not(use_xtal32k))] GPIO33), (GPIO34),
(GPIO35), (GPIO36), (GPIO37), (GPIO38), (GPIO39), (DMA_SPI2(unstable)),
(DMA_SPI3(unstable)), (DMA_I2S0(unstable)), (DMA_I2S1(unstable)),
(SDM_CH0(unstable)), (SDM_CH1(unstable)), (SDM_CH2(unstable)),
(SDM_CH3(unstable)), (SDM_CH4(unstable)), (SDM_CH5(unstable)),
(SDM_CH6(unstable)), (SDM_CH7(unstable)), (AES(unstable)), (APB_CTRL(unstable)),
(BB(unstable)), (DPORT(unstable)), (SYSTEM(unstable)), (ETH(unstable)),
(FLASH_ENCRYPTION(unstable)), (FRC_TIMER(unstable)), (GPIO(unstable)),
(GPIO_SD(unstable)), (HINF(unstable)), (I2C0), (I2C1), (I2S0(unstable)),
(I2S1(unstable)), (IO_MUX(unstable)), (LEDC(unstable)), (MCPWM0(unstable)),
(MCPWM1(unstable)), (NRX(unstable)), (PCNT(unstable)), (RMT(unstable)),
(RNG(unstable)), (RSA(unstable)), (LPWR(unstable)), (RTC_TIMER(unstable)),
(LP_I2C0(unstable)), (RTC_IO(unstable)), (SDHOST(unstable)), (SENS(unstable)),
(SHA(unstable)), (SLC(unstable)), (SLCHOST(unstable)), (SPI0(unstable)),
(SPI1(unstable)), (SPI2), (SPI3), (TIMG0(unstable)), (TIMG1(unstable)),
(TWAI0(unstable)), (UART0), (UART1), (UART2), (UHCI0(unstable)),
(UHCI1(unstable)), (WIFI), (ADC1(unstable)), (ADC2(unstable)), (BT(unstable)),
(CPU_CTRL(unstable)), (DAC1(unstable)), (DAC2(unstable)), (FLASH(unstable)),
(PSRAM(unstable)), (TOUCH(unstable)), (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, SpiDmaChannel), (I2S0, I2s0, 0, I2sDmaChannel), (SPI3, Spi3, 1,
SpiDmaChannel), (I2S1, I2s1, 1, I2sDmaChannel)));
};
}
#[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(_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 =>
EMAC_TX_CLK) ([Input] [Output]))); _for_each_inner_gpio!((1, GPIO1(_5 =>
EMAC_RXD2) (_0 => U0TXD _1 => CLK_OUT3) ([Input] [Output])));
_for_each_inner_gpio!((2, GPIO2(_1 => HSPIWP _3 => SD2_DATA0 _4 => SD_DATA0) (_1
=> HSPIWP _3 => SD2_DATA0 _4 => SD_DATA0) ([Input] [Output])));
_for_each_inner_gpio!((3, GPIO3(_0 => U0RXD) (_1 => CLK_OUT2) ([Input]
[Output]))); _for_each_inner_gpio!((4, GPIO4(_1 => HSPIHD _3 => SD2_DATA1 _4 =>
SD_DATA1 _5 => EMAC_TXER) (_1 => HSPIHD _3 => SD2_DATA1 _4 => SD_DATA1 _5 =>
EMAC_TXER) ([Input] [Output]))); _for_each_inner_gpio!((5, GPIO5(_1 => VSPICS0 _3
=> SD1_DATA6 _5 => EMAC_RX_CLK) (_1 => VSPICS0 _3 => SD1_DATA6) ([Input]
[Output]))); _for_each_inner_gpio!((6, GPIO6(_1 => SPICLK _4 => U1CTS) (_0 =>
SD_CLK _1 => SPICLK _3 => SD1_CLK) ([Input] [Output])));
_for_each_inner_gpio!((7, GPIO7(_0 => SD_DATA0 _1 => SPIQ _3 => SD1_DATA0) (_0 =>
SD_DATA0 _1 => SPIQ _3 => SD1_DATA0 _4 => U2RTS) ([Input] [Output])));
_for_each_inner_gpio!((8, GPIO8(_0 => SD_DATA1 _1 => SPID _3 => SD1_DATA1 _4 =>
U2CTS) (_0 => SD_DATA1 _1 => SPID _3 => SD1_DATA1) ([Input] [Output])));
_for_each_inner_gpio!((9, GPIO9(_0 => SD_DATA2 _1 => SPIHD _3 => SD1_DATA2 _4 =>
U1RXD) (_0 => SD_DATA2 _1 => SPIHD _3 => SD1_DATA2) ([Input] [Output])));
_for_each_inner_gpio!((10, GPIO10(_0 => SD_DATA3 _1 => SPIWP _3 => SD1_DATA3) (_0
=> SD_DATA3 _1 => SPIWP _3 => SD1_DATA3 _4 => U1TXD) ([Input] [Output])));
_for_each_inner_gpio!((11, GPIO11(_0 => SD_CMD _1 => SPICS0) (_0 => SD_CMD _1 =>
SPICS0 _3 => SD1_CMD _4 => U1RTS) ([Input] [Output])));
_for_each_inner_gpio!((12, GPIO12(_0 => MTDI _1 => HSPIQ _3 => SD2_DATA2 _4 =>
SD_DATA2) (_1 => HSPIQ _3 => SD2_DATA2 _4 => SD_DATA2 _5 => EMAC_TXD3) ([Input]
[Output]))); _for_each_inner_gpio!((13, GPIO13(_0 => MTCK _1 => HSPID _3 =>
SD2_DATA3 _4 => SD_DATA3 _5 => EMAC_RXER) (_1 => HSPID _3 => SD2_DATA3 _4 =>
SD_DATA3 _5 => EMAC_RXER) ([Input] [Output]))); _for_each_inner_gpio!((14,
GPIO14(_0 => MTMS _1 => HSPICLK) (_1 => HSPICLK _3 => SD2_CLK _4 => SD_CLK _5 =>
EMAC_TXD2) ([Input] [Output]))); _for_each_inner_gpio!((15, GPIO15(_1 => HSPICS0
_4 => SD_CMD _5 => EMAC_RXD3) (_0 => MTDO _1 => HSPICS0 _3 => SD2_CMD _4 =>
SD_CMD) ([Input] [Output]))); _for_each_inner_gpio!((16, GPIO16(_3 => SD1_DATA4
_4 => U2RXD) (_3 => SD1_DATA4 _5 => EMAC_CLK_OUT) ([Input] [Output])));
_for_each_inner_gpio!((17, GPIO17(_3 => SD1_DATA5) (_3 => SD1_DATA5 _4 => U2TXD
_5 => EMAC_CLK_180) ([Input] [Output]))); _for_each_inner_gpio!((18, GPIO18(_1 =>
VSPICLK _3 => SD1_DATA7) (_1 => VSPICLK _3 => SD1_DATA7) ([Input] [Output])));
_for_each_inner_gpio!((19, GPIO19(_1 => VSPIQ _3 => U0CTS) (_1 => VSPIQ _5 =>
EMAC_TXD0) ([Input] [Output]))); _for_each_inner_gpio!((20, GPIO20() () ([Input]
[Output]))); _for_each_inner_gpio!((21, GPIO21(_1 => VSPIHD) (_1 => VSPIHD _5 =>
EMAC_TXEN) ([Input] [Output]))); _for_each_inner_gpio!((22, GPIO22(_1 => VSPIWP)
(_1 => VSPIWP _3 => U0RTS _5 => EMAC_TXD1) ([Input] [Output])));
_for_each_inner_gpio!((23, GPIO23(_1 => VSPID) (_1 => VSPID _3 => SD1_STROBE)
([Input] [Output]))); _for_each_inner_gpio!((25, GPIO25(_5 => EMAC_RXD0) ()
([Input] [Output]))); _for_each_inner_gpio!((26, GPIO26(_5 => EMAC_RXD1) ()
([Input] [Output]))); _for_each_inner_gpio!((27, GPIO27(_5 => EMAC_RXDV) ()
([Input] [Output]))); _for_each_inner_gpio!((32, GPIO32() () ([Input]
[Output]))); _for_each_inner_gpio!((33, GPIO33() () ([Input] [Output])));
_for_each_inner_gpio!((34, GPIO34() () ([Input] []))); _for_each_inner_gpio!((35,
GPIO35() () ([Input] []))); _for_each_inner_gpio!((36, GPIO36() () ([Input]
[]))); _for_each_inner_gpio!((37, GPIO37() () ([Input] [])));
_for_each_inner_gpio!((38, GPIO38() () ([Input] []))); _for_each_inner_gpio!((39,
GPIO39() () ([Input] []))); _for_each_inner_gpio!((all(0, GPIO0(_5 =>
EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input] [Output])), (1, GPIO1(_5
=> EMAC_RXD2) (_0 => U0TXD _1 => CLK_OUT3) ([Input] [Output])), (2, GPIO2(_1 =>
HSPIWP _3 => SD2_DATA0 _4 => SD_DATA0) (_1 => HSPIWP _3 => SD2_DATA0 _4 =>
SD_DATA0) ([Input] [Output])), (3, GPIO3(_0 => U0RXD) (_1 => CLK_OUT2) ([Input]
[Output])), (4, GPIO4(_1 => HSPIHD _3 => SD2_DATA1 _4 => SD_DATA1 _5 =>
EMAC_TXER) (_1 => HSPIHD _3 => SD2_DATA1 _4 => SD_DATA1 _5 => EMAC_TXER) ([Input]
[Output])), (5, GPIO5(_1 => VSPICS0 _3 => SD1_DATA6 _5 => EMAC_RX_CLK) (_1 =>
VSPICS0 _3 => SD1_DATA6) ([Input] [Output])), (6, GPIO6(_1 => SPICLK _4 => U1CTS)
(_0 => SD_CLK _1 => SPICLK _3 => SD1_CLK) ([Input] [Output])), (7, GPIO7(_0 =>
SD_DATA0 _1 => SPIQ _3 => SD1_DATA0) (_0 => SD_DATA0 _1 => SPIQ _3 => SD1_DATA0
_4 => U2RTS) ([Input] [Output])), (8, GPIO8(_0 => SD_DATA1 _1 => SPID _3 =>
SD1_DATA1 _4 => U2CTS) (_0 => SD_DATA1 _1 => SPID _3 => SD1_DATA1) ([Input]
[Output])), (9, GPIO9(_0 => SD_DATA2 _1 => SPIHD _3 => SD1_DATA2 _4 => U1RXD) (_0
=> SD_DATA2 _1 => SPIHD _3 => SD1_DATA2) ([Input] [Output])), (10, GPIO10(_0 =>
SD_DATA3 _1 => SPIWP _3 => SD1_DATA3) (_0 => SD_DATA3 _1 => SPIWP _3 => SD1_DATA3
_4 => U1TXD) ([Input] [Output])), (11, GPIO11(_0 => SD_CMD _1 => SPICS0) (_0 =>
SD_CMD _1 => SPICS0 _3 => SD1_CMD _4 => U1RTS) ([Input] [Output])), (12,
GPIO12(_0 => MTDI _1 => HSPIQ _3 => SD2_DATA2 _4 => SD_DATA2) (_1 => HSPIQ _3 =>
SD2_DATA2 _4 => SD_DATA2 _5 => EMAC_TXD3) ([Input] [Output])), (13, GPIO13(_0 =>
MTCK _1 => HSPID _3 => SD2_DATA3 _4 => SD_DATA3 _5 => EMAC_RXER) (_1 => HSPID _3
=> SD2_DATA3 _4 => SD_DATA3 _5 => EMAC_RXER) ([Input] [Output])), (14, GPIO14(_0
=> MTMS _1 => HSPICLK) (_1 => HSPICLK _3 => SD2_CLK _4 => SD_CLK _5 => EMAC_TXD2)
([Input] [Output])), (15, GPIO15(_1 => HSPICS0 _4 => SD_CMD _5 => EMAC_RXD3) (_0
=> MTDO _1 => HSPICS0 _3 => SD2_CMD _4 => SD_CMD) ([Input] [Output])), (16,
GPIO16(_3 => SD1_DATA4 _4 => U2RXD) (_3 => SD1_DATA4 _5 => EMAC_CLK_OUT) ([Input]
[Output])), (17, GPIO17(_3 => SD1_DATA5) (_3 => SD1_DATA5 _4 => U2TXD _5 =>
EMAC_CLK_180) ([Input] [Output])), (18, GPIO18(_1 => VSPICLK _3 => SD1_DATA7) (_1
=> VSPICLK _3 => SD1_DATA7) ([Input] [Output])), (19, GPIO19(_1 => VSPIQ _3 =>
U0CTS) (_1 => VSPIQ _5 => EMAC_TXD0) ([Input] [Output])), (20, GPIO20() ()
([Input] [Output])), (21, GPIO21(_1 => VSPIHD) (_1 => VSPIHD _5 => EMAC_TXEN)
([Input] [Output])), (22, GPIO22(_1 => VSPIWP) (_1 => VSPIWP _3 => U0RTS _5 =>
EMAC_TXD1) ([Input] [Output])), (23, GPIO23(_1 => VSPID) (_1 => VSPID _3 =>
SD1_STROBE) ([Input] [Output])), (25, GPIO25(_5 => EMAC_RXD0) () ([Input]
[Output])), (26, GPIO26(_5 => EMAC_RXD1) () ([Input] [Output])), (27, GPIO27(_5
=> EMAC_RXDV) () ([Input] [Output])), (32, GPIO32() () ([Input] [Output])), (33,
GPIO33() () ([Input] [Output])), (34, GPIO34() () ([Input] [])), (35, GPIO35() ()
([Input] [])), (36, GPIO36() () ([Input] [])), (37, GPIO37() () ([Input] [])),
(38, GPIO38() () ([Input] [])), (39, GPIO39() () ([Input] []))));
};
}
#[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!((ADC2_CH1, GPIO0));
_for_each_inner_analog_function!((TOUCH1, GPIO0));
_for_each_inner_analog_function!((ADC2_CH2, GPIO2));
_for_each_inner_analog_function!((TOUCH2, GPIO2));
_for_each_inner_analog_function!((ADC2_CH0, GPIO4));
_for_each_inner_analog_function!((TOUCH0, GPIO4));
_for_each_inner_analog_function!((ADC2_CH5, GPIO12));
_for_each_inner_analog_function!((TOUCH5, GPIO12));
_for_each_inner_analog_function!((ADC2_CH4, GPIO13));
_for_each_inner_analog_function!((TOUCH4, GPIO13));
_for_each_inner_analog_function!((ADC2_CH6, GPIO14));
_for_each_inner_analog_function!((TOUCH6, GPIO14));
_for_each_inner_analog_function!((ADC2_CH3, GPIO15));
_for_each_inner_analog_function!((TOUCH3, GPIO15));
_for_each_inner_analog_function!((DAC1, GPIO25));
_for_each_inner_analog_function!((ADC2_CH8, GPIO25));
_for_each_inner_analog_function!((DAC2, GPIO26));
_for_each_inner_analog_function!((ADC2_CH9, GPIO26));
_for_each_inner_analog_function!((ADC2_CH7, GPIO27));
_for_each_inner_analog_function!((TOUCH7, GPIO27));
_for_each_inner_analog_function!((XTAL_32K_P, GPIO32));
_for_each_inner_analog_function!((ADC1_CH4, GPIO32));
_for_each_inner_analog_function!((TOUCH9, GPIO32));
_for_each_inner_analog_function!((XTAL_32K_N, GPIO33));
_for_each_inner_analog_function!((ADC1_CH5, GPIO33));
_for_each_inner_analog_function!((TOUCH8, GPIO33));
_for_each_inner_analog_function!((ADC1_CH6, GPIO34));
_for_each_inner_analog_function!((ADC1_CH7, GPIO35));
_for_each_inner_analog_function!((ADC_H, GPIO36));
_for_each_inner_analog_function!((ADC1_CH0, GPIO36));
_for_each_inner_analog_function!((ADC_H, GPIO37));
_for_each_inner_analog_function!((ADC1_CH1, GPIO37));
_for_each_inner_analog_function!((ADC_H, GPIO38));
_for_each_inner_analog_function!((ADC1_CH2, GPIO38));
_for_each_inner_analog_function!((ADC_H, GPIO39));
_for_each_inner_analog_function!((ADC1_CH3, GPIO39));
_for_each_inner_analog_function!(((ADC2_CH1, ADCn_CHm, 2, 1), GPIO0));
_for_each_inner_analog_function!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO2));
_for_each_inner_analog_function!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO4));
_for_each_inner_analog_function!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12));
_for_each_inner_analog_function!(((ADC2_CH4, ADCn_CHm, 2, 4), GPIO13));
_for_each_inner_analog_function!(((ADC2_CH6, ADCn_CHm, 2, 6), GPIO14));
_for_each_inner_analog_function!(((ADC2_CH3, ADCn_CHm, 2, 3), GPIO15));
_for_each_inner_analog_function!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO25));
_for_each_inner_analog_function!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO26));
_for_each_inner_analog_function!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO27));
_for_each_inner_analog_function!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO32));
_for_each_inner_analog_function!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO33));
_for_each_inner_analog_function!(((ADC1_CH6, ADCn_CHm, 1, 6), GPIO34));
_for_each_inner_analog_function!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO35));
_for_each_inner_analog_function!(((ADC1_CH0, ADCn_CHm, 1, 0), GPIO36));
_for_each_inner_analog_function!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO37));
_for_each_inner_analog_function!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO38));
_for_each_inner_analog_function!(((ADC1_CH3, ADCn_CHm, 1, 3), GPIO39));
_for_each_inner_analog_function!(((TOUCH1, TOUCHn, 1), GPIO0));
_for_each_inner_analog_function!(((TOUCH2, TOUCHn, 2), GPIO2));
_for_each_inner_analog_function!(((TOUCH0, TOUCHn, 0), GPIO4));
_for_each_inner_analog_function!(((TOUCH5, TOUCHn, 5), GPIO12));
_for_each_inner_analog_function!(((TOUCH4, TOUCHn, 4), GPIO13));
_for_each_inner_analog_function!(((TOUCH6, TOUCHn, 6), GPIO14));
_for_each_inner_analog_function!(((TOUCH3, TOUCHn, 3), GPIO15));
_for_each_inner_analog_function!(((TOUCH7, TOUCHn, 7), GPIO27));
_for_each_inner_analog_function!(((TOUCH9, TOUCHn, 9), GPIO32));
_for_each_inner_analog_function!(((TOUCH8, TOUCHn, 8), GPIO33));
_for_each_inner_analog_function!(((DAC1, DACn, 1), GPIO25));
_for_each_inner_analog_function!(((DAC2, DACn, 2), GPIO26));
_for_each_inner_analog_function!((all(ADC2_CH1, GPIO0), (TOUCH1, GPIO0),
(ADC2_CH2, GPIO2), (TOUCH2, GPIO2), (ADC2_CH0, GPIO4), (TOUCH0, GPIO4),
(ADC2_CH5, GPIO12), (TOUCH5, GPIO12), (ADC2_CH4, GPIO13), (TOUCH4, GPIO13),
(ADC2_CH6, GPIO14), (TOUCH6, GPIO14), (ADC2_CH3, GPIO15), (TOUCH3, GPIO15),
(DAC1, GPIO25), (ADC2_CH8, GPIO25), (DAC2, GPIO26), (ADC2_CH9, GPIO26),
(ADC2_CH7, GPIO27), (TOUCH7, GPIO27), (XTAL_32K_P, GPIO32), (ADC1_CH4, GPIO32),
(TOUCH9, GPIO32), (XTAL_32K_N, GPIO33), (ADC1_CH5, GPIO33), (TOUCH8, GPIO33),
(ADC1_CH6, GPIO34), (ADC1_CH7, GPIO35), (ADC_H, GPIO36), (ADC1_CH0, GPIO36),
(ADC_H, GPIO37), (ADC1_CH1, GPIO37), (ADC_H, GPIO38), (ADC1_CH2, GPIO38), (ADC_H,
GPIO39), (ADC1_CH3, GPIO39)));
_for_each_inner_analog_function!((ADCn_CHm((ADC2_CH1, ADCn_CHm, 2, 1), GPIO0),
((ADC2_CH2, ADCn_CHm, 2, 2), GPIO2), ((ADC2_CH0, ADCn_CHm, 2, 0), GPIO4),
((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12), ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO13),
((ADC2_CH6, ADCn_CHm, 2, 6), GPIO14), ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO15),
((ADC2_CH8, ADCn_CHm, 2, 8), GPIO25), ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO26),
((ADC2_CH7, ADCn_CHm, 2, 7), GPIO27), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO32),
((ADC1_CH5, ADCn_CHm, 1, 5), GPIO33), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO34),
((ADC1_CH7, ADCn_CHm, 1, 7), GPIO35), ((ADC1_CH0, ADCn_CHm, 1, 0), GPIO36),
((ADC1_CH1, ADCn_CHm, 1, 1), GPIO37), ((ADC1_CH2, ADCn_CHm, 1, 2), GPIO38),
((ADC1_CH3, ADCn_CHm, 1, 3), GPIO39)));
_for_each_inner_analog_function!((TOUCHn((TOUCH1, TOUCHn, 1), GPIO0), ((TOUCH2,
TOUCHn, 2), GPIO2), ((TOUCH0, TOUCHn, 0), GPIO4), ((TOUCH5, TOUCHn, 5), GPIO12),
((TOUCH4, TOUCHn, 4), GPIO13), ((TOUCH6, TOUCHn, 6), GPIO14), ((TOUCH3, TOUCHn,
3), GPIO15), ((TOUCH7, TOUCHn, 7), GPIO27), ((TOUCH9, TOUCHn, 9), GPIO32),
((TOUCH8, TOUCHn, 8), GPIO33))); _for_each_inner_analog_function!((DACn((DAC1,
DACn, 1), GPIO25), ((DAC2, DACn, 2), GPIO26)));
};
}
#[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_GPIO11, GPIO0, _0));
_for_each_inner_lp_function!((SAR_I2C_SDA, GPIO0, _3));
_for_each_inner_lp_function!((LP_GPIO12, GPIO2, _0));
_for_each_inner_lp_function!((SAR_I2C_SCL, GPIO2, _3));
_for_each_inner_lp_function!((LP_GPIO10, GPIO4, _0));
_for_each_inner_lp_function!((SAR_I2C_SCL, GPIO4, _3));
_for_each_inner_lp_function!((LP_GPIO15, GPIO12, _0));
_for_each_inner_lp_function!((LP_GPIO14, GPIO13, _0));
_for_each_inner_lp_function!((LP_GPIO16, GPIO14, _0));
_for_each_inner_lp_function!((LP_GPIO13, GPIO15, _0));
_for_each_inner_lp_function!((SAR_I2C_SDA, GPIO15, _3));
_for_each_inner_lp_function!((LP_GPIO6, GPIO25, _0));
_for_each_inner_lp_function!((LP_GPIO7, GPIO26, _0));
_for_each_inner_lp_function!((LP_GPIO17, GPIO27, _0));
_for_each_inner_lp_function!((LP_GPIO9, GPIO32, _0));
_for_each_inner_lp_function!((LP_GPIO8, GPIO33, _0));
_for_each_inner_lp_function!((LP_GPIO4, GPIO34, _0));
_for_each_inner_lp_function!((LP_GPIO5, GPIO35, _0));
_for_each_inner_lp_function!((LP_GPIO0, GPIO36, _0));
_for_each_inner_lp_function!((LP_GPIO1, GPIO37, _0));
_for_each_inner_lp_function!((LP_GPIO2, GPIO38, _0));
_for_each_inner_lp_function!((LP_GPIO3, GPIO39, _0));
_for_each_inner_lp_function!(((LP_GPIO11, LP_GPIOn, 11), GPIO0, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO12, LP_GPIOn, 12), GPIO2, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO10, LP_GPIOn, 10), GPIO4, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO15, LP_GPIOn, 15), GPIO12, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO14, LP_GPIOn, 14), GPIO13, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO16, LP_GPIOn, 16), GPIO14, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO13, LP_GPIOn, 13), GPIO15, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO6, LP_GPIOn, 6), GPIO25, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO7, LP_GPIOn, 7), GPIO26, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO17, LP_GPIOn, 17), GPIO27, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO9, LP_GPIOn, 9), GPIO32, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO8, LP_GPIOn, 8), GPIO33, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO4, LP_GPIOn, 4), GPIO34, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO5, LP_GPIOn, 5), GPIO35, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO0, LP_GPIOn, 0), GPIO36, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO1, LP_GPIOn, 1), GPIO37, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO2, LP_GPIOn, 2), GPIO38, _0, () ()));
_for_each_inner_lp_function!(((LP_GPIO3, LP_GPIOn, 3), GPIO39, _0, () ()));
_for_each_inner_lp_function!((all(LP_GPIO11, GPIO0, _0), (SAR_I2C_SDA, GPIO0,
_3), (LP_GPIO12, GPIO2, _0), (SAR_I2C_SCL, GPIO2, _3), (LP_GPIO10, GPIO4, _0),
(SAR_I2C_SCL, GPIO4, _3), (LP_GPIO15, GPIO12, _0), (LP_GPIO14, GPIO13, _0),
(LP_GPIO16, GPIO14, _0), (LP_GPIO13, GPIO15, _0), (SAR_I2C_SDA, GPIO15, _3),
(LP_GPIO6, GPIO25, _0), (LP_GPIO7, GPIO26, _0), (LP_GPIO17, GPIO27, _0),
(LP_GPIO9, GPIO32, _0), (LP_GPIO8, GPIO33, _0), (LP_GPIO4, GPIO34, _0),
(LP_GPIO5, GPIO35, _0), (LP_GPIO0, GPIO36, _0), (LP_GPIO1, GPIO37, _0),
(LP_GPIO2, GPIO38, _0), (LP_GPIO3, GPIO39, _0)));
_for_each_inner_lp_function!((LP_GPIOn((LP_GPIO11, LP_GPIOn, 11), GPIO0, _0, ()
()), ((LP_GPIO12, LP_GPIOn, 12), GPIO2, _0, () ()), ((LP_GPIO10, LP_GPIOn, 10),
GPIO4, _0, () ()), ((LP_GPIO15, LP_GPIOn, 15), GPIO12, _0, () ()), ((LP_GPIO14,
LP_GPIOn, 14), GPIO13, _0, () ()), ((LP_GPIO16, LP_GPIOn, 16), GPIO14, _0, ()
()), ((LP_GPIO13, LP_GPIOn, 13), GPIO15, _0, () ()), ((LP_GPIO6, LP_GPIOn, 6),
GPIO25, _0, () ()), ((LP_GPIO7, LP_GPIOn, 7), GPIO26, _0, () ()), ((LP_GPIO17,
LP_GPIOn, 17), GPIO27, _0, () ()), ((LP_GPIO9, LP_GPIOn, 9), GPIO32, _0, () ()),
((LP_GPIO8, LP_GPIOn, 8), GPIO33, _0, () ()), ((LP_GPIO4, LP_GPIOn, 4), GPIO34,
_0, () ()), ((LP_GPIO5, LP_GPIOn, 5), GPIO35, _0, () ()), ((LP_GPIO0, LP_GPIOn,
0), GPIO36, _0, () ()), ((LP_GPIO1, LP_GPIOn, 1), GPIO37, _0, () ()), ((LP_GPIO2,
LP_GPIOn, 2), GPIO38, _0, () ()), ((LP_GPIO3, LP_GPIOn, 3), GPIO39, _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!((CLK_OUT1, GPIO0, _1));
_for_each_inner_iomux_function!((EMAC_TX_CLK, GPIO0, _5));
_for_each_inner_iomux_function!((U0TXD, GPIO1, _0));
_for_each_inner_iomux_function!((CLK_OUT3, GPIO1, _1));
_for_each_inner_iomux_function!((EMAC_RXD2, GPIO1, _5));
_for_each_inner_iomux_function!((HSPIWP, GPIO2, _1));
_for_each_inner_iomux_function!((SD2_DATA0, GPIO2, _3));
_for_each_inner_iomux_function!((SD_DATA0, GPIO2, _4));
_for_each_inner_iomux_function!((U0RXD, GPIO3, _0));
_for_each_inner_iomux_function!((CLK_OUT2, GPIO3, _1));
_for_each_inner_iomux_function!((HSPIHD, GPIO4, _1));
_for_each_inner_iomux_function!((SD2_DATA1, GPIO4, _3));
_for_each_inner_iomux_function!((SD_DATA1, GPIO4, _4));
_for_each_inner_iomux_function!((EMAC_TXER, GPIO4, _5));
_for_each_inner_iomux_function!((VSPICS0, GPIO5, _1));
_for_each_inner_iomux_function!((SD1_DATA6, GPIO5, _3));
_for_each_inner_iomux_function!((EMAC_RX_CLK, GPIO5, _5));
_for_each_inner_iomux_function!((SD_CLK, GPIO6, _0));
_for_each_inner_iomux_function!((SPICLK, GPIO6, _1));
_for_each_inner_iomux_function!((SD1_CLK, GPIO6, _3));
_for_each_inner_iomux_function!((U1CTS, GPIO6, _4));
_for_each_inner_iomux_function!((SD_DATA0, GPIO7, _0));
_for_each_inner_iomux_function!((SPIQ, GPIO7, _1));
_for_each_inner_iomux_function!((SD1_DATA0, GPIO7, _3));
_for_each_inner_iomux_function!((U2RTS, GPIO7, _4));
_for_each_inner_iomux_function!((SD_DATA1, GPIO8, _0));
_for_each_inner_iomux_function!((SPID, GPIO8, _1));
_for_each_inner_iomux_function!((SD1_DATA1, GPIO8, _3));
_for_each_inner_iomux_function!((U2CTS, GPIO8, _4));
_for_each_inner_iomux_function!((SD_DATA2, GPIO9, _0));
_for_each_inner_iomux_function!((SPIHD, GPIO9, _1));
_for_each_inner_iomux_function!((SD1_DATA2, GPIO9, _3));
_for_each_inner_iomux_function!((U1RXD, GPIO9, _4));
_for_each_inner_iomux_function!((SD_DATA3, GPIO10, _0));
_for_each_inner_iomux_function!((SPIWP, GPIO10, _1));
_for_each_inner_iomux_function!((SD1_DATA3, GPIO10, _3));
_for_each_inner_iomux_function!((U1TXD, GPIO10, _4));
_for_each_inner_iomux_function!((SD_CMD, GPIO11, _0));
_for_each_inner_iomux_function!((SPICS0, GPIO11, _1));
_for_each_inner_iomux_function!((SD1_CMD, GPIO11, _3));
_for_each_inner_iomux_function!((U1RTS, GPIO11, _4));
_for_each_inner_iomux_function!((MTDI, GPIO12, _0));
_for_each_inner_iomux_function!((HSPIQ, GPIO12, _1));
_for_each_inner_iomux_function!((SD2_DATA2, GPIO12, _3));
_for_each_inner_iomux_function!((SD_DATA2, GPIO12, _4));
_for_each_inner_iomux_function!((EMAC_TXD3, GPIO12, _5));
_for_each_inner_iomux_function!((MTCK, GPIO13, _0));
_for_each_inner_iomux_function!((HSPID, GPIO13, _1));
_for_each_inner_iomux_function!((SD2_DATA3, GPIO13, _3));
_for_each_inner_iomux_function!((SD_DATA3, GPIO13, _4));
_for_each_inner_iomux_function!((EMAC_RXER, GPIO13, _5));
_for_each_inner_iomux_function!((MTMS, GPIO14, _0));
_for_each_inner_iomux_function!((HSPICLK, GPIO14, _1));
_for_each_inner_iomux_function!((SD2_CLK, GPIO14, _3));
_for_each_inner_iomux_function!((SD_CLK, GPIO14, _4));
_for_each_inner_iomux_function!((EMAC_TXD2, GPIO14, _5));
_for_each_inner_iomux_function!((MTDO, GPIO15, _0));
_for_each_inner_iomux_function!((HSPICS0, GPIO15, _1));
_for_each_inner_iomux_function!((SD2_CMD, GPIO15, _3));
_for_each_inner_iomux_function!((SD_CMD, GPIO15, _4));
_for_each_inner_iomux_function!((EMAC_RXD3, GPIO15, _5));
_for_each_inner_iomux_function!((SD1_DATA4, GPIO16, _3));
_for_each_inner_iomux_function!((U2RXD, GPIO16, _4));
_for_each_inner_iomux_function!((EMAC_CLK_OUT, GPIO16, _5));
_for_each_inner_iomux_function!((SD1_DATA5, GPIO17, _3));
_for_each_inner_iomux_function!((U2TXD, GPIO17, _4));
_for_each_inner_iomux_function!((EMAC_CLK_180, GPIO17, _5));
_for_each_inner_iomux_function!((VSPICLK, GPIO18, _1));
_for_each_inner_iomux_function!((SD1_DATA7, GPIO18, _3));
_for_each_inner_iomux_function!((VSPIQ, GPIO19, _1));
_for_each_inner_iomux_function!((U0CTS, GPIO19, _3));
_for_each_inner_iomux_function!((EMAC_TXD0, GPIO19, _5));
_for_each_inner_iomux_function!((VSPIHD, GPIO21, _1));
_for_each_inner_iomux_function!((EMAC_TXEN, GPIO21, _5));
_for_each_inner_iomux_function!((VSPIWP, GPIO22, _1));
_for_each_inner_iomux_function!((U0RTS, GPIO22, _3));
_for_each_inner_iomux_function!((EMAC_TXD1, GPIO22, _5));
_for_each_inner_iomux_function!((VSPID, GPIO23, _1));
_for_each_inner_iomux_function!((SD1_STROBE, GPIO23, _3));
_for_each_inner_iomux_function!((EMAC_RXD0, GPIO25, _5));
_for_each_inner_iomux_function!((EMAC_RXD1, GPIO26, _5));
_for_each_inner_iomux_function!((EMAC_RXDV, GPIO27, _5));
_for_each_inner_iomux_function!(((CLK_OUT1, CLK_OUTn, 1), GPIO0, _1));
_for_each_inner_iomux_function!(((CLK_OUT3, CLK_OUTn, 3), GPIO1, _1));
_for_each_inner_iomux_function!(((CLK_OUT2, CLK_OUTn, 2), GPIO3, _1));
_for_each_inner_iomux_function!(((EMAC_RXD2, EMAC_RXDn, 2), GPIO1, _5));
_for_each_inner_iomux_function!(((EMAC_RXD3, EMAC_RXDn, 3), GPIO15, _5));
_for_each_inner_iomux_function!(((EMAC_RXD0, EMAC_RXDn, 0), GPIO25, _5));
_for_each_inner_iomux_function!(((EMAC_RXD1, EMAC_RXDn, 1), GPIO26, _5));
_for_each_inner_iomux_function!(((SD2_DATA0, SDn_DATAm, 2, 0), GPIO2, _3));
_for_each_inner_iomux_function!(((SD2_DATA1, SDn_DATAm, 2, 1), GPIO4, _3));
_for_each_inner_iomux_function!(((SD1_DATA6, SDn_DATAm, 1, 6), GPIO5, _3));
_for_each_inner_iomux_function!(((SD1_DATA0, SDn_DATAm, 1, 0), GPIO7, _3));
_for_each_inner_iomux_function!(((SD1_DATA1, SDn_DATAm, 1, 1), GPIO8, _3));
_for_each_inner_iomux_function!(((SD1_DATA2, SDn_DATAm, 1, 2), GPIO9, _3));
_for_each_inner_iomux_function!(((SD1_DATA3, SDn_DATAm, 1, 3), GPIO10, _3));
_for_each_inner_iomux_function!(((SD2_DATA2, SDn_DATAm, 2, 2), GPIO12, _3));
_for_each_inner_iomux_function!(((SD2_DATA3, SDn_DATAm, 2, 3), GPIO13, _3));
_for_each_inner_iomux_function!(((SD1_DATA4, SDn_DATAm, 1, 4), GPIO16, _3));
_for_each_inner_iomux_function!(((SD1_DATA5, SDn_DATAm, 1, 5), GPIO17, _3));
_for_each_inner_iomux_function!(((SD1_DATA7, SDn_DATAm, 1, 7), GPIO18, _3));
_for_each_inner_iomux_function!(((SD_DATA0, SD_DATAn, 0), GPIO2, _4));
_for_each_inner_iomux_function!(((SD_DATA1, SD_DATAn, 1), GPIO4, _4));
_for_each_inner_iomux_function!(((SD_DATA0, SD_DATAn, 0), GPIO7, _0));
_for_each_inner_iomux_function!(((SD_DATA1, SD_DATAn, 1), GPIO8, _0));
_for_each_inner_iomux_function!(((SD_DATA2, SD_DATAn, 2), GPIO9, _0));
_for_each_inner_iomux_function!(((SD_DATA3, SD_DATAn, 3), GPIO10, _0));
_for_each_inner_iomux_function!(((SD_DATA2, SD_DATAn, 2), GPIO12, _4));
_for_each_inner_iomux_function!(((SD_DATA3, SD_DATAn, 3), GPIO13, _4));
_for_each_inner_iomux_function!(((VSPICS0, VSPICSn, 0), GPIO5, _1));
_for_each_inner_iomux_function!(((SD1_CLK, SDn_CLK, 1), GPIO6, _3));
_for_each_inner_iomux_function!(((SD2_CLK, SDn_CLK, 2), GPIO14, _3));
_for_each_inner_iomux_function!(((SPICS0, SPICSn, 0), GPIO11, _1));
_for_each_inner_iomux_function!(((SD1_CMD, SDn_CMD, 1), GPIO11, _3));
_for_each_inner_iomux_function!(((SD2_CMD, SDn_CMD, 2), GPIO15, _3));
_for_each_inner_iomux_function!(((EMAC_TXD3, EMAC_TXDn, 3), GPIO12, _5));
_for_each_inner_iomux_function!(((EMAC_TXD2, EMAC_TXDn, 2), GPIO14, _5));
_for_each_inner_iomux_function!(((EMAC_TXD0, EMAC_TXDn, 0), GPIO19, _5));
_for_each_inner_iomux_function!(((EMAC_TXD1, EMAC_TXDn, 1), GPIO22, _5));
_for_each_inner_iomux_function!(((HSPICS0, HSPICSn, 0), GPIO15, _1));
_for_each_inner_iomux_function!(((EMAC_CLK_180, EMAC_CLK_n, 180), GPIO17, _5));
_for_each_inner_iomux_function!(((SD1_STROBE, SDn_STROBE, 1), GPIO23, _3));
_for_each_inner_iomux_function!((all(CLK_OUT1, GPIO0, _1), (EMAC_TX_CLK, GPIO0,
_5), (U0TXD, GPIO1, _0), (CLK_OUT3, GPIO1, _1), (EMAC_RXD2, GPIO1, _5), (HSPIWP,
GPIO2, _1), (SD2_DATA0, GPIO2, _3), (SD_DATA0, GPIO2, _4), (U0RXD, GPIO3, _0),
(CLK_OUT2, GPIO3, _1), (HSPIHD, GPIO4, _1), (SD2_DATA1, GPIO4, _3), (SD_DATA1,
GPIO4, _4), (EMAC_TXER, GPIO4, _5), (VSPICS0, GPIO5, _1), (SD1_DATA6, GPIO5, _3),
(EMAC_RX_CLK, GPIO5, _5), (SD_CLK, GPIO6, _0), (SPICLK, GPIO6, _1), (SD1_CLK,
GPIO6, _3), (U1CTS, GPIO6, _4), (SD_DATA0, GPIO7, _0), (SPIQ, GPIO7, _1),
(SD1_DATA0, GPIO7, _3), (U2RTS, GPIO7, _4), (SD_DATA1, GPIO8, _0), (SPID, GPIO8,
_1), (SD1_DATA1, GPIO8, _3), (U2CTS, GPIO8, _4), (SD_DATA2, GPIO9, _0), (SPIHD,
GPIO9, _1), (SD1_DATA2, GPIO9, _3), (U1RXD, GPIO9, _4), (SD_DATA3, GPIO10, _0),
(SPIWP, GPIO10, _1), (SD1_DATA3, GPIO10, _3), (U1TXD, GPIO10, _4), (SD_CMD,
GPIO11, _0), (SPICS0, GPIO11, _1), (SD1_CMD, GPIO11, _3), (U1RTS, GPIO11, _4),
(MTDI, GPIO12, _0), (HSPIQ, GPIO12, _1), (SD2_DATA2, GPIO12, _3), (SD_DATA2,
GPIO12, _4), (EMAC_TXD3, GPIO12, _5), (MTCK, GPIO13, _0), (HSPID, GPIO13, _1),
(SD2_DATA3, GPIO13, _3), (SD_DATA3, GPIO13, _4), (EMAC_RXER, GPIO13, _5), (MTMS,
GPIO14, _0), (HSPICLK, GPIO14, _1), (SD2_CLK, GPIO14, _3), (SD_CLK, GPIO14, _4),
(EMAC_TXD2, GPIO14, _5), (MTDO, GPIO15, _0), (HSPICS0, GPIO15, _1), (SD2_CMD,
GPIO15, _3), (SD_CMD, GPIO15, _4), (EMAC_RXD3, GPIO15, _5), (SD1_DATA4, GPIO16,
_3), (U2RXD, GPIO16, _4), (EMAC_CLK_OUT, GPIO16, _5), (SD1_DATA5, GPIO17, _3),
(U2TXD, GPIO17, _4), (EMAC_CLK_180, GPIO17, _5), (VSPICLK, GPIO18, _1),
(SD1_DATA7, GPIO18, _3), (VSPIQ, GPIO19, _1), (U0CTS, GPIO19, _3), (EMAC_TXD0,
GPIO19, _5), (VSPIHD, GPIO21, _1), (EMAC_TXEN, GPIO21, _5), (VSPIWP, GPIO22, _1),
(U0RTS, GPIO22, _3), (EMAC_TXD1, GPIO22, _5), (VSPID, GPIO23, _1), (SD1_STROBE,
GPIO23, _3), (EMAC_RXD0, GPIO25, _5), (EMAC_RXD1, GPIO26, _5), (EMAC_RXDV,
GPIO27, _5))); _for_each_inner_iomux_function!((CLK_OUTn((CLK_OUT1, CLK_OUTn, 1),
GPIO0, _1), ((CLK_OUT3, CLK_OUTn, 3), GPIO1, _1), ((CLK_OUT2, CLK_OUTn, 2),
GPIO3, _1))); _for_each_inner_iomux_function!((EMAC_RXDn((EMAC_RXD2, EMAC_RXDn,
2), GPIO1, _5), ((EMAC_RXD3, EMAC_RXDn, 3), GPIO15, _5), ((EMAC_RXD0, EMAC_RXDn,
0), GPIO25, _5), ((EMAC_RXD1, EMAC_RXDn, 1), GPIO26, _5)));
_for_each_inner_iomux_function!((SDn_DATAm((SD2_DATA0, SDn_DATAm, 2, 0), GPIO2,
_3), ((SD2_DATA1, SDn_DATAm, 2, 1), GPIO4, _3), ((SD1_DATA6, SDn_DATAm, 1, 6),
GPIO5, _3), ((SD1_DATA0, SDn_DATAm, 1, 0), GPIO7, _3), ((SD1_DATA1, SDn_DATAm, 1,
1), GPIO8, _3), ((SD1_DATA2, SDn_DATAm, 1, 2), GPIO9, _3), ((SD1_DATA3,
SDn_DATAm, 1, 3), GPIO10, _3), ((SD2_DATA2, SDn_DATAm, 2, 2), GPIO12, _3),
((SD2_DATA3, SDn_DATAm, 2, 3), GPIO13, _3), ((SD1_DATA4, SDn_DATAm, 1, 4),
GPIO16, _3), ((SD1_DATA5, SDn_DATAm, 1, 5), GPIO17, _3), ((SD1_DATA7, SDn_DATAm,
1, 7), GPIO18, _3))); _for_each_inner_iomux_function!((SD_DATAn((SD_DATA0,
SD_DATAn, 0), GPIO2, _4), ((SD_DATA1, SD_DATAn, 1), GPIO4, _4), ((SD_DATA0,
SD_DATAn, 0), GPIO7, _0), ((SD_DATA1, SD_DATAn, 1), GPIO8, _0), ((SD_DATA2,
SD_DATAn, 2), GPIO9, _0), ((SD_DATA3, SD_DATAn, 3), GPIO10, _0), ((SD_DATA2,
SD_DATAn, 2), GPIO12, _4), ((SD_DATA3, SD_DATAn, 3), GPIO13, _4)));
_for_each_inner_iomux_function!((VSPICSn((VSPICS0, VSPICSn, 0), GPIO5, _1)));
_for_each_inner_iomux_function!((SDn_CLK((SD1_CLK, SDn_CLK, 1), GPIO6, _3),
((SD2_CLK, SDn_CLK, 2), GPIO14, _3)));
_for_each_inner_iomux_function!((SPICSn((SPICS0, SPICSn, 0), GPIO11, _1)));
_for_each_inner_iomux_function!((SDn_CMD((SD1_CMD, SDn_CMD, 1), GPIO11, _3),
((SD2_CMD, SDn_CMD, 2), GPIO15, _3)));
_for_each_inner_iomux_function!((EMAC_TXDn((EMAC_TXD3, EMAC_TXDn, 3), GPIO12,
_5), ((EMAC_TXD2, EMAC_TXDn, 2), GPIO14, _5), ((EMAC_TXD0, EMAC_TXDn, 0), GPIO19,
_5), ((EMAC_TXD1, EMAC_TXDn, 1), GPIO22, _5)));
_for_each_inner_iomux_function!((HSPICSn((HSPICS0, HSPICSn, 0), GPIO15, _1)));
_for_each_inner_iomux_function!((EMAC_CLK_n((EMAC_CLK_180, EMAC_CLK_n, 180),
GPIO17, _5))); _for_each_inner_iomux_function!((SDn_STROBE((SD1_STROBE,
SDn_STROBE, 1), GPIO23, _3)));
};
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! gpio_for_signal {
(CLK_OUT1 $(, $_fallback:literal)?) => {
"GPIO0"
};
(EMAC_TX_CLK $(, $_fallback:literal)?) => {
"GPIO0"
};
(ADC2_CH1 $(, $_fallback:literal)?) => {
"GPIO0"
};
(TOUCH1 $(, $_fallback:literal)?) => {
"GPIO0"
};
(LP_GPIO11 $(, $_fallback:literal)?) => {
"GPIO0"
};
(SAR_I2C_SDA $(, $_fallback:literal)?) => {
"GPIO0"
};
(U0TXD $(, $_fallback:literal)?) => {
"GPIO1"
};
(CLK_OUT3 $(, $_fallback:literal)?) => {
"GPIO1"
};
(EMAC_RXD2 $(, $_fallback:literal)?) => {
"GPIO1"
};
(HSPIWP $(, $_fallback:literal)?) => {
"GPIO2"
};
(SD2_DATA0 $(, $_fallback:literal)?) => {
"GPIO2"
};
(SD_DATA0 $(, $_fallback:literal)?) => {
"GPIO2"
};
(ADC2_CH2 $(, $_fallback:literal)?) => {
"GPIO2"
};
(TOUCH2 $(, $_fallback:literal)?) => {
"GPIO2"
};
(LP_GPIO12 $(, $_fallback:literal)?) => {
"GPIO2"
};
(SAR_I2C_SCL $(, $_fallback:literal)?) => {
"GPIO4"
};
(U0RXD $(, $_fallback:literal)?) => {
"GPIO3"
};
(CLK_OUT2 $(, $_fallback:literal)?) => {
"GPIO3"
};
(HSPIHD $(, $_fallback:literal)?) => {
"GPIO4"
};
(SD2_DATA1 $(, $_fallback:literal)?) => {
"GPIO4"
};
(SD_DATA1 $(, $_fallback:literal)?) => {
"GPIO4"
};
(EMAC_TXER $(, $_fallback:literal)?) => {
"GPIO4"
};
(ADC2_CH0 $(, $_fallback:literal)?) => {
"GPIO4"
};
(TOUCH0 $(, $_fallback:literal)?) => {
"GPIO4"
};
(LP_GPIO10 $(, $_fallback:literal)?) => {
"GPIO4"
};
(VSPICS0 $(, $_fallback:literal)?) => {
"GPIO5"
};
(SD1_DATA6 $(, $_fallback:literal)?) => {
"GPIO5"
};
(EMAC_RX_CLK $(, $_fallback:literal)?) => {
"GPIO5"
};
(SD_CLK $(, $_fallback:literal)?) => {
"GPIO6"
};
(SPICLK $(, $_fallback:literal)?) => {
"GPIO6"
};
(SD1_CLK $(, $_fallback:literal)?) => {
"GPIO6"
};
(U1CTS $(, $_fallback:literal)?) => {
"GPIO6"
};
(SPIQ $(, $_fallback:literal)?) => {
"GPIO7"
};
(SD1_DATA0 $(, $_fallback:literal)?) => {
"GPIO7"
};
(U2RTS $(, $_fallback:literal)?) => {
"GPIO7"
};
(SPID $(, $_fallback:literal)?) => {
"GPIO8"
};
(SD1_DATA1 $(, $_fallback:literal)?) => {
"GPIO8"
};
(U2CTS $(, $_fallback:literal)?) => {
"GPIO8"
};
(SD_DATA2 $(, $_fallback:literal)?) => {
"GPIO9"
};
(SPIHD $(, $_fallback:literal)?) => {
"GPIO9"
};
(SD1_DATA2 $(, $_fallback:literal)?) => {
"GPIO9"
};
(U1RXD $(, $_fallback:literal)?) => {
"GPIO9"
};
(SD_DATA3 $(, $_fallback:literal)?) => {
"GPIO10"
};
(SPIWP $(, $_fallback:literal)?) => {
"GPIO10"
};
(SD1_DATA3 $(, $_fallback:literal)?) => {
"GPIO10"
};
(U1TXD $(, $_fallback:literal)?) => {
"GPIO10"
};
(SD_CMD $(, $_fallback:literal)?) => {
"GPIO11"
};
(SPICS0 $(, $_fallback:literal)?) => {
"GPIO11"
};
(SD1_CMD $(, $_fallback:literal)?) => {
"GPIO11"
};
(U1RTS $(, $_fallback:literal)?) => {
"GPIO11"
};
(MTDI $(, $_fallback:literal)?) => {
"GPIO12"
};
(HSPIQ $(, $_fallback:literal)?) => {
"GPIO12"
};
(SD2_DATA2 $(, $_fallback:literal)?) => {
"GPIO12"
};
(EMAC_TXD3 $(, $_fallback:literal)?) => {
"GPIO12"
};
(ADC2_CH5 $(, $_fallback:literal)?) => {
"GPIO12"
};
(TOUCH5 $(, $_fallback:literal)?) => {
"GPIO12"
};
(LP_GPIO15 $(, $_fallback:literal)?) => {
"GPIO12"
};
(MTCK $(, $_fallback:literal)?) => {
"GPIO13"
};
(HSPID $(, $_fallback:literal)?) => {
"GPIO13"
};
(SD2_DATA3 $(, $_fallback:literal)?) => {
"GPIO13"
};
(EMAC_RXER $(, $_fallback:literal)?) => {
"GPIO13"
};
(ADC2_CH4 $(, $_fallback:literal)?) => {
"GPIO13"
};
(TOUCH4 $(, $_fallback:literal)?) => {
"GPIO13"
};
(LP_GPIO14 $(, $_fallback:literal)?) => {
"GPIO13"
};
(MTMS $(, $_fallback:literal)?) => {
"GPIO14"
};
(HSPICLK $(, $_fallback:literal)?) => {
"GPIO14"
};
(SD2_CLK $(, $_fallback:literal)?) => {
"GPIO14"
};
(EMAC_TXD2 $(, $_fallback:literal)?) => {
"GPIO14"
};
(ADC2_CH6 $(, $_fallback:literal)?) => {
"GPIO14"
};
(TOUCH6 $(, $_fallback:literal)?) => {
"GPIO14"
};
(LP_GPIO16 $(, $_fallback:literal)?) => {
"GPIO14"
};
(MTDO $(, $_fallback:literal)?) => {
"GPIO15"
};
(HSPICS0 $(, $_fallback:literal)?) => {
"GPIO15"
};
(SD2_CMD $(, $_fallback:literal)?) => {
"GPIO15"
};
(EMAC_RXD3 $(, $_fallback:literal)?) => {
"GPIO15"
};
(ADC2_CH3 $(, $_fallback:literal)?) => {
"GPIO15"
};
(TOUCH3 $(, $_fallback:literal)?) => {
"GPIO15"
};
(LP_GPIO13 $(, $_fallback:literal)?) => {
"GPIO15"
};
(SD1_DATA4 $(, $_fallback:literal)?) => {
"GPIO16"
};
(U2RXD $(, $_fallback:literal)?) => {
"GPIO16"
};
(EMAC_CLK_OUT $(, $_fallback:literal)?) => {
"GPIO16"
};
(SD1_DATA5 $(, $_fallback:literal)?) => {
"GPIO17"
};
(U2TXD $(, $_fallback:literal)?) => {
"GPIO17"
};
(EMAC_CLK_180 $(, $_fallback:literal)?) => {
"GPIO17"
};
(VSPICLK $(, $_fallback:literal)?) => {
"GPIO18"
};
(SD1_DATA7 $(, $_fallback:literal)?) => {
"GPIO18"
};
(VSPIQ $(, $_fallback:literal)?) => {
"GPIO19"
};
(U0CTS $(, $_fallback:literal)?) => {
"GPIO19"
};
(EMAC_TXD0 $(, $_fallback:literal)?) => {
"GPIO19"
};
(VSPIHD $(, $_fallback:literal)?) => {
"GPIO21"
};
(EMAC_TXEN $(, $_fallback:literal)?) => {
"GPIO21"
};
(VSPIWP $(, $_fallback:literal)?) => {
"GPIO22"
};
(U0RTS $(, $_fallback:literal)?) => {
"GPIO22"
};
(EMAC_TXD1 $(, $_fallback:literal)?) => {
"GPIO22"
};
(VSPID $(, $_fallback:literal)?) => {
"GPIO23"
};
(SD1_STROBE $(, $_fallback:literal)?) => {
"GPIO23"
};
(EMAC_RXD0 $(, $_fallback:literal)?) => {
"GPIO25"
};
(DAC1 $(, $_fallback:literal)?) => {
"GPIO25"
};
(ADC2_CH8 $(, $_fallback:literal)?) => {
"GPIO25"
};
(LP_GPIO6 $(, $_fallback:literal)?) => {
"GPIO25"
};
(EMAC_RXD1 $(, $_fallback:literal)?) => {
"GPIO26"
};
(DAC2 $(, $_fallback:literal)?) => {
"GPIO26"
};
(ADC2_CH9 $(, $_fallback:literal)?) => {
"GPIO26"
};
(LP_GPIO7 $(, $_fallback:literal)?) => {
"GPIO26"
};
(EMAC_RXDV $(, $_fallback:literal)?) => {
"GPIO27"
};
(ADC2_CH7 $(, $_fallback:literal)?) => {
"GPIO27"
};
(TOUCH7 $(, $_fallback:literal)?) => {
"GPIO27"
};
(LP_GPIO17 $(, $_fallback:literal)?) => {
"GPIO27"
};
(XTAL_32K_P $(, $_fallback:literal)?) => {
"GPIO32"
};
(ADC1_CH4 $(, $_fallback:literal)?) => {
"GPIO32"
};
(TOUCH9 $(, $_fallback:literal)?) => {
"GPIO32"
};
(LP_GPIO9 $(, $_fallback:literal)?) => {
"GPIO32"
};
(XTAL_32K_N $(, $_fallback:literal)?) => {
"GPIO33"
};
(ADC1_CH5 $(, $_fallback:literal)?) => {
"GPIO33"
};
(TOUCH8 $(, $_fallback:literal)?) => {
"GPIO33"
};
(LP_GPIO8 $(, $_fallback:literal)?) => {
"GPIO33"
};
(ADC1_CH6 $(, $_fallback:literal)?) => {
"GPIO34"
};
(LP_GPIO4 $(, $_fallback:literal)?) => {
"GPIO34"
};
(ADC1_CH7 $(, $_fallback:literal)?) => {
"GPIO35"
};
(LP_GPIO5 $(, $_fallback:literal)?) => {
"GPIO35"
};
(ADC_H $(, $_fallback:literal)?) => {
"GPIO36"
};
(ADC1_CH0 $(, $_fallback:literal)?) => {
"GPIO36"
};
(LP_GPIO0 $(, $_fallback:literal)?) => {
"GPIO36"
};
(ADC1_CH1 $(, $_fallback:literal)?) => {
"GPIO37"
};
(LP_GPIO1 $(, $_fallback:literal)?) => {
"GPIO37"
};
(ADC1_CH2 $(, $_fallback:literal)?) => {
"GPIO38"
};
(LP_GPIO2 $(, $_fallback:literal)?) => {
"GPIO38"
};
(ADC1_CH3 $(, $_fallback:literal)?) => {
"GPIO39"
};
(LP_GPIO3 $(, $_fallback:literal)?) => {
"GPIO39"
};
($_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 {
SPICLK = 0,
SPIQ = 1,
SPID = 2,
SPIHD = 3,
SPIWP = 4,
SPICS0 = 5,
SPICS1 = 6,
SPICS2 = 7,
HSPICLK = 8,
HSPIQ = 9,
HSPID = 10,
HSPICS0 = 11,
HSPIHD = 12,
HSPIWP = 13,
U0RXD = 14,
U0CTS = 15,
U0DSR = 16,
U1RXD = 17,
U1CTS = 18,
I2S0O_BCK = 23,
I2S1O_BCK = 24,
I2S0O_WS = 25,
I2S1O_WS = 26,
I2S0I_BCK = 27,
I2S0I_WS = 28,
I2CEXT0_SCL = 29,
I2CEXT0_SDA = 30,
PWM0_SYNC0 = 31,
PWM0_SYNC1 = 32,
PWM0_SYNC2 = 33,
PWM0_F0 = 34,
PWM0_F1 = 35,
PWM0_F2 = 36,
PCNT0_SIG_CH0 = 39,
PCNT0_SIG_CH1 = 40,
PCNT0_CTRL_CH0 = 41,
PCNT0_CTRL_CH1 = 42,
PCNT1_SIG_CH0 = 43,
PCNT1_SIG_CH1 = 44,
PCNT1_CTRL_CH0 = 45,
PCNT1_CTRL_CH1 = 46,
PCNT2_SIG_CH0 = 47,
PCNT2_SIG_CH1 = 48,
PCNT2_CTRL_CH0 = 49,
PCNT2_CTRL_CH1 = 50,
PCNT3_SIG_CH0 = 51,
PCNT3_SIG_CH1 = 52,
PCNT3_CTRL_CH0 = 53,
PCNT3_CTRL_CH1 = 54,
PCNT4_SIG_CH0 = 55,
PCNT4_SIG_CH1 = 56,
PCNT4_CTRL_CH0 = 57,
PCNT4_CTRL_CH1 = 58,
HSPICS1 = 61,
HSPICS2 = 62,
VSPICLK = 63,
VSPIQ = 64,
VSPID = 65,
VSPIHD = 66,
VSPIWP = 67,
VSPICS0 = 68,
VSPICS1 = 69,
VSPICS2 = 70,
PCNT5_SIG_CH0 = 71,
PCNT5_SIG_CH1 = 72,
PCNT5_CTRL_CH0 = 73,
PCNT5_CTRL_CH1 = 74,
PCNT6_SIG_CH0 = 75,
PCNT6_SIG_CH1 = 76,
PCNT6_CTRL_CH0 = 77,
PCNT6_CTRL_CH1 = 78,
PCNT7_SIG_CH0 = 79,
PCNT7_SIG_CH1 = 80,
PCNT7_CTRL_CH0 = 81,
PCNT7_CTRL_CH1 = 82,
RMT_SIG_0 = 83,
RMT_SIG_1 = 84,
RMT_SIG_2 = 85,
RMT_SIG_3 = 86,
RMT_SIG_4 = 87,
RMT_SIG_5 = 88,
RMT_SIG_6 = 89,
RMT_SIG_7 = 90,
TWAI_RX = 94,
I2CEXT1_SCL = 95,
I2CEXT1_SDA = 96,
HOST_CARD_DETECT_N_1 = 97,
HOST_CARD_DETECT_N_2 = 98,
HOST_CARD_WRITE_PRT_1 = 99,
HOST_CARD_WRITE_PRT_2 = 100,
HOST_CARD_INT_N_1 = 101,
HOST_CARD_INT_N_2 = 102,
PWM1_SYNC0 = 103,
PWM1_SYNC1 = 104,
PWM1_SYNC2 = 105,
PWM1_F0 = 106,
PWM1_F1 = 107,
PWM1_F2 = 108,
PWM0_CAP0 = 109,
PWM0_CAP1 = 110,
PWM0_CAP2 = 111,
PWM1_CAP0 = 112,
PWM1_CAP1 = 113,
PWM1_CAP2 = 114,
I2S0I_DATA_0 = 140,
I2S0I_DATA_1 = 141,
I2S0I_DATA_2 = 142,
I2S0I_DATA_3 = 143,
I2S0I_DATA_4 = 144,
I2S0I_DATA_5 = 145,
I2S0I_DATA_6 = 146,
I2S0I_DATA_7 = 147,
I2S0I_DATA_8 = 148,
I2S0I_DATA_9 = 149,
I2S0I_DATA_10 = 150,
I2S0I_DATA_11 = 151,
I2S0I_DATA_12 = 152,
I2S0I_DATA_13 = 153,
I2S0I_DATA_14 = 154,
I2S0I_DATA_15 = 155,
I2S1I_BCK = 164,
I2S1I_WS = 165,
I2S1I_DATA_0 = 166,
I2S1I_DATA_1 = 167,
I2S1I_DATA_2 = 168,
I2S1I_DATA_3 = 169,
I2S1I_DATA_4 = 170,
I2S1I_DATA_5 = 171,
I2S1I_DATA_6 = 172,
I2S1I_DATA_7 = 173,
I2S1I_DATA_8 = 174,
I2S1I_DATA_9 = 175,
I2S1I_DATA_10 = 176,
I2S1I_DATA_11 = 177,
I2S1I_DATA_12 = 178,
I2S1I_DATA_13 = 179,
I2S1I_DATA_14 = 180,
I2S1I_DATA_15 = 181,
I2S0I_H_SYNC = 190,
I2S0I_V_SYNC = 191,
I2S0I_H_ENABLE = 192,
I2S1I_H_SYNC = 193,
I2S1I_V_SYNC = 194,
I2S1I_H_ENABLE = 195,
U2RXD = 198,
U2CTS = 199,
EMAC_MDC = 200,
EMAC_MDI = 201,
EMAC_CRS = 202,
EMAC_COL = 203,
PCMFSYNC = 204,
PCMCLK = 205,
PCMDIN = 206,
SD_CMD,
SD_DATA0,
SD_DATA1,
SD_DATA2,
SD_DATA3,
SD1_DATA0,
SD1_DATA1,
SD1_DATA2,
SD1_DATA3,
SD1_DATA4,
SD1_DATA5,
SD1_DATA6,
SD1_DATA7,
SD2_DATA0,
SD2_DATA1,
SD2_DATA2,
SD2_DATA3,
EMAC_TX_CLK,
EMAC_RXD2,
EMAC_TXER,
EMAC_RX_CLK,
EMAC_RXER,
EMAC_RXD3,
EMAC_RXD0,
EMAC_RXD1,
EMAC_RXDV,
MTDI,
MTCK,
MTMS,
}
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
#[derive(Debug, PartialEq, Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[doc(hidden)]
pub enum OutputSignal {
SPICLK = 0,
SPIQ = 1,
SPID = 2,
SPIHD = 3,
SPIWP = 4,
SPICS0 = 5,
SPICS1 = 6,
SPICS2 = 7,
HSPICLK = 8,
HSPIQ = 9,
HSPID = 10,
HSPICS0 = 11,
HSPIHD = 12,
HSPIWP = 13,
U0TXD = 14,
U0RTS = 15,
U0DTR = 16,
U1TXD = 17,
U1RTS = 18,
I2S0O_BCK = 23,
I2S1O_BCK = 24,
I2S0O_WS = 25,
I2S1O_WS = 26,
I2S0I_BCK = 27,
I2S0I_WS = 28,
I2CEXT0_SCL = 29,
I2CEXT0_SDA = 30,
SDIO_TOHOST_INT = 31,
PWM0_0A = 32,
PWM0_0B = 33,
PWM0_1A = 34,
PWM0_1B = 35,
PWM0_2A = 36,
PWM0_2B = 37,
HSPICS1 = 61,
HSPICS2 = 62,
VSPICLK = 63,
VSPIQ = 64,
VSPID = 65,
VSPIHD = 66,
VSPIWP = 67,
VSPICS0 = 68,
VSPICS1 = 69,
VSPICS2 = 70,
LEDC_HS_SIG0 = 71,
LEDC_HS_SIG1 = 72,
LEDC_HS_SIG2 = 73,
LEDC_HS_SIG3 = 74,
LEDC_HS_SIG4 = 75,
LEDC_HS_SIG5 = 76,
LEDC_HS_SIG6 = 77,
LEDC_HS_SIG7 = 78,
LEDC_LS_SIG0 = 79,
LEDC_LS_SIG1 = 80,
LEDC_LS_SIG2 = 81,
LEDC_LS_SIG3 = 82,
LEDC_LS_SIG4 = 83,
LEDC_LS_SIG5 = 84,
LEDC_LS_SIG6 = 85,
LEDC_LS_SIG7 = 86,
RMT_SIG_0 = 87,
RMT_SIG_1 = 88,
RMT_SIG_2 = 89,
RMT_SIG_3 = 90,
RMT_SIG_4 = 91,
RMT_SIG_5 = 92,
RMT_SIG_6 = 93,
RMT_SIG_7 = 94,
I2CEXT1_SCL = 95,
I2CEXT1_SDA = 96,
HOST_CCMD_OD_PULLUP_EN_N = 97,
HOST_RST_N_1 = 98,
HOST_RST_N_2 = 99,
GPIO_SD0 = 100,
GPIO_SD1 = 101,
GPIO_SD2 = 102,
GPIO_SD3 = 103,
GPIO_SD4 = 104,
GPIO_SD5 = 105,
GPIO_SD6 = 106,
GPIO_SD7 = 107,
PWM1_0A = 108,
PWM1_0B = 109,
PWM1_1A = 110,
PWM1_1B = 111,
PWM1_2A = 112,
PWM1_2B = 113,
TWAI_TX = 123,
TWAI_BUS_OFF_ON = 124,
TWAI_CLKOUT = 125,
I2S0O_DATA_0 = 140,
I2S0O_DATA_1 = 141,
I2S0O_DATA_2 = 142,
I2S0O_DATA_3 = 143,
I2S0O_DATA_4 = 144,
I2S0O_DATA_5 = 145,
I2S0O_DATA_6 = 146,
I2S0O_DATA_7 = 147,
I2S0O_DATA_8 = 148,
I2S0O_DATA_9 = 149,
I2S0O_DATA_10 = 150,
I2S0O_DATA_11 = 151,
I2S0O_DATA_12 = 152,
I2S0O_DATA_13 = 153,
I2S0O_DATA_14 = 154,
I2S0O_DATA_15 = 155,
I2S0O_DATA_16 = 156,
I2S0O_DATA_17 = 157,
I2S0O_DATA_18 = 158,
I2S0O_DATA_19 = 159,
I2S0O_DATA_20 = 160,
I2S0O_DATA_21 = 161,
I2S0O_DATA_22 = 162,
I2S0O_DATA_23 = 163,
I2S1I_BCK = 164,
I2S1I_WS = 165,
I2S1O_DATA_0 = 166,
I2S1O_DATA_1 = 167,
I2S1O_DATA_2 = 168,
I2S1O_DATA_3 = 169,
I2S1O_DATA_4 = 170,
I2S1O_DATA_5 = 171,
I2S1O_DATA_6 = 172,
I2S1O_DATA_7 = 173,
I2S1O_DATA_8 = 174,
I2S1O_DATA_9 = 175,
I2S1O_DATA_10 = 176,
I2S1O_DATA_11 = 177,
I2S1O_DATA_12 = 178,
I2S1O_DATA_13 = 179,
I2S1O_DATA_14 = 180,
I2S1O_DATA_15 = 181,
I2S1O_DATA_16 = 182,
I2S1O_DATA_17 = 183,
I2S1O_DATA_18 = 184,
I2S1O_DATA_19 = 185,
I2S1O_DATA_20 = 186,
I2S1O_DATA_21 = 187,
I2S1O_DATA_22 = 188,
I2S1O_DATA_23 = 189,
U2TXD = 198,
U2RTS = 199,
EMAC_MDC = 200,
EMAC_MDO = 201,
EMAC_CRS = 202,
EMAC_COL = 203,
BT_AUDIO0RQ = 204,
BT_AUDIO1RQ = 205,
BT_AUDIO2RQ = 206,
BLE_AUDIO0RQ = 207,
BLE_AUDIO1RQ = 208,
BLE_AUDIO2RQ = 209,
PCMFSYNC = 210,
PCMCLK = 211,
PCMDOUT = 212,
BLE_AUDIO_SYNC0_P = 213,
BLE_AUDIO_SYNC1_P = 214,
BLE_AUDIO_SYNC2_P = 215,
ANT_SEL0 = 216,
ANT_SEL1 = 217,
ANT_SEL2 = 218,
ANT_SEL3 = 219,
ANT_SEL4 = 220,
ANT_SEL5 = 221,
ANT_SEL6 = 222,
ANT_SEL7 = 223,
SIGNAL_224 = 224,
SIGNAL_225 = 225,
SIGNAL_226 = 226,
SIGNAL_227 = 227,
SIGNAL_228 = 228,
GPIO = 256,
CLK_OUT1,
CLK_OUT2,
CLK_OUT3,
SD_CLK,
SD_CMD,
SD_DATA0,
SD_DATA1,
SD_DATA2,
SD_DATA3,
SD1_CLK,
SD1_CMD,
SD1_DATA0,
SD1_DATA1,
SD1_DATA2,
SD1_DATA3,
SD1_DATA4,
SD1_DATA5,
SD1_DATA6,
SD1_DATA7,
SD1_STROBE,
SD2_CLK,
SD2_CMD,
SD2_DATA0,
SD2_DATA1,
SD2_DATA2,
SD2_DATA3,
EMAC_TX_CLK,
EMAC_TXER,
EMAC_TXD3,
EMAC_RXER,
EMAC_TXD2,
EMAC_CLK_OUT,
EMAC_CLK_180,
EMAC_TXD0,
EMAC_TXEN,
EMAC_TXD1,
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,
_3 = 3,
}
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::GPIO0 {
let iomux = crate::peripherals::IO_MUX::regs();
match gpio_num {
0 => iomux.gpio0(),
1 => iomux.gpio1(),
2 => iomux.gpio2(),
3 => iomux.gpio3(),
4 => iomux.gpio4(),
5 => iomux.gpio5(),
6 => iomux.gpio6(),
7 => iomux.gpio7(),
8 => iomux.gpio8(),
9 => iomux.gpio9(),
10 => iomux.gpio10(),
11 => iomux.gpio11(),
12 => iomux.gpio12(),
13 => iomux.gpio13(),
14 => iomux.gpio14(),
15 => iomux.gpio15(),
16 => iomux.gpio16(),
17 => iomux.gpio17(),
18 => iomux.gpio18(),
19 => iomux.gpio19(),
20 => iomux.gpio20(),
21 => iomux.gpio21(),
22 => iomux.gpio22(),
23 => iomux.gpio23(),
25 => iomux.gpio25(),
26 => iomux.gpio26(),
27 => iomux.gpio27(),
32 => iomux.gpio32(),
33 => iomux.gpio33(),
34 => iomux.gpio34(),
35 => iomux.gpio35(),
36 => iomux.gpio36(),
37 => iomux.gpio37(),
38 => iomux.gpio38(),
39 => iomux.gpio39(),
other => panic!("GPIO {} does not exist", other),
}
}
};
}