# ESP32 Device Metadata
#
# Empty [`device.driver`] tables imply `partial` support status.
#
# If you modify a driver support status, run `cargo xtask update-metadata` to
# update the table in the esp-hal README.

[device]
name   = "esp32"
arch   = "xtensa"
target = "xtensa-esp32-none-elf"
cores  = 2
trm    = "https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf"

peripherals = [
    { name = "AES" },
    { name = "APB_CTRL" },
    { name = "BB" },
    { name = "DPORT" },
    { name = "SYSTEM", pac = "DPORT" },
    { name = "EFUSE" },
    { name = "EMAC_DMA" },
    { name = "EMAC_EXT" },
    { name = "EMAC_MAC" },
    { name = "FLASH_ENCRYPTION" },
    { name = "FRC_TIMER" },
    { name = "GPIO" },
    { name = "GPIO_SD" },
    { name = "HINF" },
    { name = "I2C0", interrupts = { peri = "I2C_EXT0" } },
    { name = "I2C1", interrupts = { peri = "I2C_EXT1" } },
    { name = "I2S0", interrupts = { peri = "I2S0" } },
    { name = "I2S1", interrupts = { peri = "I2S1" } },
    { name = "IO_MUX" },
    { name = "LEDC" },
    { name = "MCPWM0" },
    { name = "MCPWM1" },
    { name = "NRX" },
    { name = "PCNT" },
    { name = "RMT" },
    { name = "RNG" },
    { name = "RSA", interrupts = { peri = "RSA" } },
    { name = "LPWR", pac = "RTC_CNTL" },
    { name = "RTC_I2C" },
    { name = "RTC_IO" },
    { name = "SDHOST" },
    { name = "SENS" },
    { name = "SHA" },
    { name = "SLC" },
    { name = "SLCHOST" },
    { name = "SPI0" },
    { name = "SPI1" },
    { name = "SPI2", interrupts = { peri = "SPI2", dma = "SPI2_DMA" } },
    { name = "SPI3", interrupts = { peri = "SPI3", dma = "SPI3_DMA" } },
    { name = "TIMG0" },
    { name = "TIMG1" },
    { name = "TWAI0" },
    { name = "UART0", interrupts = { peri = "UART0" } },
    { name = "UART1", interrupts = { peri = "UART1" } },
    { name = "UART2", interrupts = { peri = "UART2" } },
    { name = "UHCI0" },
    { name = "UHCI1" },
    { name = "WIFI" },

    { name = "DMA_SPI2", pac = "SPI2" },
    { name = "DMA_SPI3", pac = "SPI3" },
    { name = "DMA_I2S0", pac = "I2S0" },
    { name = "DMA_I2S1", pac = "I2S1" },

    { name = "ADC1", virtual = true },
    { name = "ADC2", virtual = true },
    { name = "BT", virtual = true },
    { name = "CPU_CTRL", virtual = true },
    { name = "DAC1", virtual = true },
    { name = "DAC2", virtual = true },
    { name = "FLASH", virtual = true },
    { name = "PSRAM", virtual = true },
    { name = "SW_INTERRUPT", virtual = true },
    { name = "TOUCH", virtual = true },
]

symbols = [
    # Additional peripherals defined by us (the developers):
    "pdma",
    "phy",
    "psram",
    "touch",

    # ROM capabilities
    "rom_crc_le",
    "rom_crc_be",
    "rom_md5_bsd",

    # Wakeup SOC based on ESP-IDF:
    "pm_support_ext0_wakeup",
    "pm_support_ext1_wakeup",
    "pm_support_touch_sensor_wakeup",
    "ulp_supported",
]

[device.soc]
ref_tick_hz = 1_000_000
rc_fast_clk_default = 8_500_000
rc_slow_clock = 150_000
xtal_options = [26, 40]

memory_map = { ranges = [
    { name = "dram", start = 0x3FFA_E000, end = 0x4000_0000 },
    { name = "dram2_uninit", start = 0x3FFE_7E30, end = 0x4000_0000 },
] }

# peripheral_clocks: PeripheralClockControl templates.
#
# Clock control code is generated by recursively substituting fields into the `clk_en_template` and `rst_template` templates.
# Each peripheral clock can overwrite any of the default fields, including the templates.
clocks = { peripheral_clocks = { templates = [
    # templates
    { name = "clk_en_template", value = "{{control}}::regs().{{clk_en_register}}().modify(|_, w| w.{{clk_en_field}}().bit(enable));" },
    { name = "rst_template", value = "{{control}}::regs().{{rst_register}}().modify(|_, w| w.{{rst_field}}().bit(reset));" },
    # substitutions
    { name = "control", value = "crate::peripherals::SYSTEM" },
    { name = "reg_group", value = "perip" },
    { name = "clk_en_register", value = "{{reg_group}}_clk_en" },
    { name = "clk_en_field", value = "{{peripheral}}_clk_en" },
    { name = "rst_register", value = "{{reg_group}}_rst_en" },
    { name = "rst_field", value = "{{peripheral}}_rst" },
    # {{peripheral}} is derived automatically (e.g. SpiDma -> spi_dma)
], peripheral_clocks = [
    { name = "Aes", template_params = { reg_group = "peri", peripheral = "crypto_aes" } },
    { name = "Rsa", template_params = { reg_group = "peri", peripheral = "crypto_rsa" } },
    { name = "Sha", template_params = { reg_group = "peri", peripheral = "crypto_sha" } },
    
    #{ name = "Emac", template_params = { reg_group = "wifi_clk" } },
    #{ name = "SdioHost", template_params = { reg_group = "wifi_clk" } },
    #{ name = "SdioSlave", template_params = { reg_group = "wifi_clk" } },

    { name = "UartMem", keep_enabled = true }, # TODO: keep_enabled can be removed once esp-println needs explicit initialization
    { name = "Uart2" },
    { name = "SpiDma" },
    { name = "I2s1" },
    { name = "Mcpwm1", template_params = { peripheral = "pwm1" } },
    { name = "Twai0", template_params = { peripheral = "twai" } },
    { name = "I2cExt1" },
    { name = "Mcpwm0", template_params = { peripheral = "pwm0" } },
    { name = "Spi3" },
    { name = "Timg1", template_params = { peripheral = "timergroup1" } },
    #{ name = "Efuse" },
    { name = "Timg0", template_params = { peripheral = "timergroup" }, keep_enabled = true },
    { name = "Uhci1" },
    { name = "Ledc" },
    { name = "Pcnt" },
    { name = "Rmt" },
    { name = "Uhci0" },
    { name = "I2cExt0" },
    { name = "Spi2" },
    { name = "Uart1" },
    { name = "I2s0" },
    { name = "Uart0", template_params = { peripheral = "uart" }, keep_enabled = true },
    #{ name = "Spi01" },
    
    # Radio clocks not modeled here.
] } }

[device.adc]
support_status = "partial"
instances = [
    { name = "adc1" },
    { name = "adc2" },
]

[device.aes]
support_status = "partial"
has_split_text_registers = false
endianness_configurable = true
key_length = { options = [
    { bits = 128, encrypt_mode = 0, decrypt_mode = 4 },
    { bits = 192, encrypt_mode = 1, decrypt_mode = 5 },
    { bits = 256, encrypt_mode = 2, decrypt_mode = 6 }
] }

[device.dac]
support_status = "partial"
instances = [
    { name = "dac1" },
    { name = "dac2" },
]

[device.gpio]
support_status = "supported"
has_bank_1 = true
gpio_function = 2
constant_0_input = 0x30
constant_1_input = 0x38
remap_iomux_pin_registers = true
pins = [
    { pin =  0, functions = {                 1 = "CLK_OUT1",                                 5 = "EMAC_TX_CLK"  }, analog = { 1 = "ADC2_CH1", 2 = "TOUCH1" }, rtc = { 0 = "RTC_GPIO11", 1 = "SAR_I2C_SDA" } },
    { pin =  1, functions = { 0 = "U0TXD",    1 = "CLK_OUT3",                                 5 = "EMAC_RXD2"    } },
    { pin =  2, functions = {                 1 = "HSPIWP",  3 = "HS2_DATA0", 4 = "SD_DATA0"                     }, analog = { 1 = "ADC2_CH2", 2 = "TOUCH2" }, rtc = { 0 = "RTC_GPIO12", 1 = "SAR_I2C_SCL" } },
    { pin =  3, functions = { 0 = "U0RXD",    1 = "CLK_OUT2"                                                     } },
    { pin =  4, functions = {                 1 = "HSPIHD",  3 = "HS2_DATA1", 4 = "SD_DATA1", 5 = "EMAC_TX_ER"   }, analog = { 1 = "ADC2_CH0", 2 = "TOUCH0" }, rtc = { 0 = "RTC_GPIO10", 1 = "SAR_I2C_SCL" } },
    { pin =  5, functions = {                 1 = "VSPICS0", 3 = "HS1_DATA6",                 5 = "EMAC_RX_CLK"  } },
    { pin = 12, functions = { 0 = "MTDI",     1 = "HSPIQ",   3 = "HS2_DATA2", 4 = "SD_DATA2", 5 = "EMAC_TXD3"    }, analog = { 1 = "ADC2_CH5", 2 = "TOUCH5" }, rtc = { 0 = "RTC_GPIO15" } },
    { pin = 13, functions = { 0 = "MTCK",     1 = "HSPID",   3 = "HS2_DATA3", 4 = "SD_DATA3", 5 = "EMAC_RX_ER"   }, analog = { 1 = "ADC2_CH4", 2 = "TOUCH4" }, rtc = { 0 = "RTC_GPIO14" } },
    { pin = 14, functions = { 0 = "MTMS",     1 = "HSPICLK", 3 = "HS2_CLK",   4 = "SD_CLK",   5 = "EMAC_TXD2"    }, analog = { 1 = "ADC2_CH6", 2 = "TOUCH6" }, rtc = { 0 = "RTC_GPIO16" } },
    { pin = 15, functions = { 0 = "MTDO",     1 = "HSPICS0", 3 = "HS2_CMD",   4 = "SD_CMD",   5 = "EMAC_RXD3"    }, analog = { 1 = "ADC2_CH3", 2 = "TOUCH3" }, rtc = { 0 = "RTC_GPIO13", 1 = "SAR_I2C_SDA" } },
    { pin = 16, functions = {                                3 = "HS1_DATA4", 4 = "U2RXD",    5 = "EMAC_CLK_OUT" }, analog = {}, rtc = {} },
    { pin = 17, functions = {                                3 = "HS1_DATA5", 4 = "U2TXD",    5 = "EMAC_CLK_180" }, analog = {}, rtc = {} },
    { pin = 18, functions = {                 1 = "VSPICLK", 3 = "HS1_DATA7"                                     }, analog = {}, rtc = {} },
    { pin = 19, functions = {                 1 = "VSPIQ",   3 = "U0CTS",                     5 = "EMAC_TXD0"    }, analog = {}, rtc = {} },
    # { pin = 20 }, # ESP32-PICO-V3 only see https://github.com/esp-rs/esp-hal/pull/4202#discussion_r2390041983
    { pin = 21, functions = { 1 = "VSPIHD",              5 = "EMAC_TX_EN" } },
    { pin = 22, functions = { 1 = "VSPIWP", 3 = "U0RTS", 5 = "EMAC_TXD1"  } },
    { pin = 23, functions = { 1 = "VSPID",  3 = "HS1_STROBE"              } },
    { pin = 25, functions = {                            5 = "EMAC_RXD0"  }, analog = { 0 = "DAC1",       1 = "ADC2_CH8"               }, rtc = { 0 = "RTC_GPIO6" } },
    { pin = 26, functions = {                            5 = "EMAC_RXD1"  }, analog = { 0 = "DAC2",       1 = "ADC2_CH9"               }, rtc = { 0 = "RTC_GPIO7" } },
    { pin = 27, functions = {                            5 = "EMAC_RX_DV" }, analog = {                   1 = "ADC2_CH7", 2 = "TOUCH7" }, rtc = { 0 = "RTC_GPIO17" } },
    { pin = 32,                                                              analog = { 0 = "XTAL_32K_P", 1 = "ADC1_CH4", 2 = "TOUCH9" }, rtc = { 0 = "RTC_GPIO9" } },
    { pin = 33,                                                              analog = { 0 = "XTAL_32K_N", 1 = "ADC1_CH5", 2 = "TOUCH8" }, rtc = { 0 = "RTC_GPIO8" } },
    { pin = 34, input_only = true,                                           analog = {                   1 = "ADC1_CH6"               }, rtc = { 0 = "RTC_GPIO4" } },
    { pin = 35, input_only = true,                                           analog = {                   1 = "ADC1_CH7"               }, rtc = { 0 = "RTC_GPIO5" } },
    { pin = 36, input_only = true,                                           analog = { 0 = "ADC_H",      1 = "ADC1_CH0"               }, rtc = { 0 = "RTC_GPIO0" } },
    { pin = 37, input_only = true,                                           analog = { 0 = "ADC_H",      1 = "ADC1_CH1"               }, rtc = { 0 = "RTC_GPIO1" } },
    { pin = 38, input_only = true,                                           analog = { 0 = "ADC_H",      1 = "ADC1_CH2"               }, rtc = { 0 = "RTC_GPIO2" } },
    { pin = 39, input_only = true,                                           analog = { 0 = "ADC_H",      1 = "ADC1_CH3"               }, rtc = { 0 = "RTC_GPIO3" } },
]
input_signals = [
    { name = "SPICLK",               id = 0 },
    { name = "SPIQ",                 id = 1 },
    { name = "SPID",                 id = 2 },
    { name = "SPIHD",                id = 3 },
    { name = "SPIWP",                id = 4 },
    { name = "SPICS0",               id = 5 },
    { name = "SPICS1",               id = 6 },
    { name = "SPICS2",               id = 7 },
    { name = "HSPICLK",              id = 8 },
    { name = "HSPIQ",                id = 9 },
    { name = "HSPID",                id = 10 },
    { name = "HSPICS0",              id = 11 },
    { name = "HSPIHD",               id = 12 },
    { name = "HSPIWP",               id = 13 },
    { name = "U0RXD",                id = 14 },
    { name = "U0CTS",                id = 15 },
    { name = "U0DSR",                id = 16 },
    { name = "U1RXD",                id = 17 },
    { name = "U1CTS",                id = 18 },
    { name = "I2S0O_BCK",            id = 23 },
    { name = "I2S1O_BCK",            id = 24 },
    { name = "I2S0O_WS",             id = 25 },
    { name = "I2S1O_WS",             id = 26 },
    { name = "I2S0I_BCK",            id = 27 },
    { name = "I2S0I_WS",             id = 28 },
    { name = "I2CEXT0_SCL",          id = 29 },
    { name = "I2CEXT0_SDA",          id = 30 },
    { name = "PWM0_SYNC0",           id = 31 },
    { name = "PWM0_SYNC1",           id = 32 },
    { name = "PWM0_SYNC2",           id = 33 },
    { name = "PWM0_F0",              id = 34 },
    { name = "PWM0_F1",              id = 35 },
    { name = "PWM0_F2",              id = 36 },
    { name = "PCNT0_SIG_CH0",        id = 39 },
    { name = "PCNT0_SIG_CH1",        id = 40 },
    { name = "PCNT0_CTRL_CH0",       id = 41 },
    { name = "PCNT0_CTRL_CH1",       id = 42 },
    { name = "PCNT1_SIG_CH0",        id = 43 },
    { name = "PCNT1_SIG_CH1",        id = 44 },
    { name = "PCNT1_CTRL_CH0",       id = 45 },
    { name = "PCNT1_CTRL_CH1",       id = 46 },
    { name = "PCNT2_SIG_CH0",        id = 47 },
    { name = "PCNT2_SIG_CH1",        id = 48 },
    { name = "PCNT2_CTRL_CH0",       id = 49 },
    { name = "PCNT2_CTRL_CH1",       id = 50 },
    { name = "PCNT3_SIG_CH0",        id = 51 },
    { name = "PCNT3_SIG_CH1",        id = 52 },
    { name = "PCNT3_CTRL_CH0",       id = 53 },
    { name = "PCNT3_CTRL_CH1",       id = 54 },
    { name = "PCNT4_SIG_CH0",        id = 55 },
    { name = "PCNT4_SIG_CH1",        id = 56 },
    { name = "PCNT4_CTRL_CH0",       id = 57 },
    { name = "PCNT4_CTRL_CH1",       id = 58 },
    { name = "HSPICS1",              id = 61 },
    { name = "HSPICS2",              id = 62 },
    { name = "VSPICLK",              id = 63 },
    { name = "VSPIQ",                id = 64 },
    { name = "VSPID",                id = 65 },
    { name = "VSPIHD",               id = 66 },
    { name = "VSPIWP",               id = 67 },
    { name = "VSPICS0",              id = 68 },
    { name = "VSPICS1",              id = 69 },
    { name = "VSPICS2",              id = 70 },
    { name = "PCNT5_SIG_CH0",        id = 71 },
    { name = "PCNT5_SIG_CH1",        id = 72 },
    { name = "PCNT5_CTRL_CH0",       id = 73 },
    { name = "PCNT5_CTRL_CH1",       id = 74 },
    { name = "PCNT6_SIG_CH0",        id = 75 },
    { name = "PCNT6_SIG_CH1",        id = 76 },
    { name = "PCNT6_CTRL_CH0",       id = 77 },
    { name = "PCNT6_CTRL_CH1",       id = 78 },
    { name = "PCNT7_SIG_CH0",        id = 79 },
    { name = "PCNT7_SIG_CH1",        id = 80 },
    { name = "PCNT7_CTRL_CH0",       id = 81 },
    { name = "PCNT7_CTRL_CH1",       id = 82 },
    { name = "RMT_SIG_0",            id = 83 },
    { name = "RMT_SIG_1",            id = 84 },
    { name = "RMT_SIG_2",            id = 85 },
    { name = "RMT_SIG_3",            id = 86 },
    { name = "RMT_SIG_4",            id = 87 },
    { name = "RMT_SIG_5",            id = 88 },
    { name = "RMT_SIG_6",            id = 89 },
    { name = "RMT_SIG_7",            id = 90 },
    { name = "TWAI_RX",              id = 94 },
    { name = "I2CEXT1_SCL",          id = 95 },
    { name = "I2CEXT1_SDA",          id = 96 },
    { name = "HOST_CARD_DETECT_N_1", id = 97 },
    { name = "HOST_CARD_DETECT_N_2", id = 98 },
    { name = "HOST_CARD_WRITE_PRT_1",id = 99 },
    { name = "HOST_CARD_WRITE_PRT_2",id = 100 },
    { name = "HOST_CARD_INT_N_1",    id = 101 },
    { name = "HOST_CARD_INT_N_2",    id = 102 },
    { name = "PWM1_SYNC0",           id = 103 },
    { name = "PWM1_SYNC1",           id = 104 },
    { name = "PWM1_SYNC2",           id = 105 },
    { name = "PWM1_F0",              id = 106 },
    { name = "PWM1_F1",              id = 107 },
    { name = "PWM1_F2",              id = 108 },
    { name = "PWM0_CAP0",            id = 109 },
    { name = "PWM0_CAP1",            id = 110 },
    { name = "PWM0_CAP2",            id = 111 },
    { name = "PWM1_CAP0",            id = 112 },
    { name = "PWM1_CAP1",            id = 113 },
    { name = "PWM1_CAP2",            id = 114 },
    { name = "I2S0I_DATA_0",         id = 140 },
    { name = "I2S0I_DATA_1",         id = 141 },
    { name = "I2S0I_DATA_2",         id = 142 },
    { name = "I2S0I_DATA_3",         id = 143 },
    { name = "I2S0I_DATA_4",         id = 144 },
    { name = "I2S0I_DATA_5",         id = 145 },
    { name = "I2S0I_DATA_6",         id = 146 },
    { name = "I2S0I_DATA_7",         id = 147 },
    { name = "I2S0I_DATA_8",         id = 148 },
    { name = "I2S0I_DATA_9",         id = 149 },
    { name = "I2S0I_DATA_10",        id = 150 },
    { name = "I2S0I_DATA_11",        id = 151 },
    { name = "I2S0I_DATA_12",        id = 152 },
    { name = "I2S0I_DATA_13",        id = 153 },
    { name = "I2S0I_DATA_14",        id = 154 },
    { name = "I2S0I_DATA_15",        id = 155 },
    { name = "I2S1I_BCK",            id = 164 },
    { name = "I2S1I_WS",             id = 165 },
    { name = "I2S1I_DATA_0",         id = 166 },
    { name = "I2S1I_DATA_1",         id = 167 },
    { name = "I2S1I_DATA_2",         id = 168 },
    { name = "I2S1I_DATA_3",         id = 169 },
    { name = "I2S1I_DATA_4",         id = 170 },
    { name = "I2S1I_DATA_5",         id = 171 },
    { name = "I2S1I_DATA_6",         id = 172 },
    { name = "I2S1I_DATA_7",         id = 173 },
    { name = "I2S1I_DATA_8",         id = 174 },
    { name = "I2S1I_DATA_9",         id = 175 },
    { name = "I2S1I_DATA_10",        id = 176 },
    { name = "I2S1I_DATA_11",        id = 177 },
    { name = "I2S1I_DATA_12",        id = 178 },
    { name = "I2S1I_DATA_13",        id = 179 },
    { name = "I2S1I_DATA_14",        id = 180 },
    { name = "I2S1I_DATA_15",        id = 181 },
    { name = "I2S0I_H_SYNC",         id = 190 },
    { name = "I2S0I_V_SYNC",         id = 191 },
    { name = "I2S0I_H_ENABLE",       id = 192 },
    { name = "I2S1I_H_SYNC",         id = 193 },
    { name = "I2S1I_V_SYNC",         id = 194 },
    { name = "I2S1I_H_ENABLE",       id = 195 },
    { name = "U2RXD",                id = 198 },
    { name = "U2CTS",                id = 199 },
    { name = "EMAC_MDC",             id = 200 },
    { name = "EMAC_MDI",             id = 201 },
    { name = "EMAC_CRS",             id = 202 },
    { name = "EMAC_COL",             id = 203 },
    { name = "PCMFSYNC",             id = 204 },
    { name = "PCMCLK",               id = 205 },
    { name = "PCMDIN",               id = 206 },

    { name = "SD_CMD" },
    { name = "SD_DATA0" },
    { name = "SD_DATA1" },
    { name = "SD_DATA2" },
    { name = "SD_DATA3" },
    { name = "HS1_DATA0" },
    { name = "HS1_DATA1" },
    { name = "HS1_DATA2" },
    { name = "HS1_DATA3" },
    { name = "HS1_DATA4" },
    { name = "HS1_DATA5" },
    { name = "HS1_DATA6" },
    { name = "HS1_DATA7" },
    { name = "HS2_DATA0" },
    { name = "HS2_DATA1" },
    { name = "HS2_DATA2" },
    { name = "HS2_DATA3" },

    { name = "EMAC_TX_CLK" },
    { name = "EMAC_RXD2" },
    { name = "EMAC_TX_ER" },
    { name = "EMAC_RX_CLK" },
    { name = "EMAC_RX_ER" },
    { name = "EMAC_RXD3" },
    { name = "EMAC_RXD0" },
    { name = "EMAC_RXD1" },
    { name = "EMAC_RX_DV" },

    { name = "MTDI" },
    { name = "MTCK" },
    { name = "MTMS" },
]
output_signals = [
    { name = "SPICLK",                   id = 0 },
    { name = "SPIQ",                     id = 1 },
    { name = "SPID",                     id = 2 },
    { name = "SPIHD",                    id = 3 },
    { name = "SPIWP",                    id = 4 },
    { name = "SPICS0",                   id = 5 },
    { name = "SPICS1",                   id = 6 },
    { name = "SPICS2",                   id = 7 },
    { name = "HSPICLK",                  id = 8 },
    { name = "HSPIQ",                    id = 9 },
    { name = "HSPID",                    id = 10 },
    { name = "HSPICS0",                  id = 11 },
    { name = "HSPIHD",                   id = 12 },
    { name = "HSPIWP",                   id = 13 },
    { name = "U0TXD",                    id = 14 },
    { name = "U0RTS",                    id = 15 },
    { name = "U0DTR",                    id = 16 },
    { name = "U1TXD",                    id = 17 },
    { name = "U1RTS",                    id = 18 },
    { name = "I2S0O_BCK",                id = 23 },
    { name = "I2S1O_BCK",                id = 24 },
    { name = "I2S0O_WS",                 id = 25 },
    { name = "I2S1O_WS",                 id = 26 },
    { name = "I2S0I_BCK",                id = 27 },
    { name = "I2S0I_WS",                 id = 28 },
    { name = "I2CEXT0_SCL",              id = 29 },
    { name = "I2CEXT0_SDA",              id = 30 },
    { name = "SDIO_TOHOSTT",             id = 31 },
    { name = "PWM0_0A",                  id = 32 },
    { name = "PWM0_0B",                  id = 33 },
    { name = "PWM0_1A",                  id = 34 },
    { name = "PWM0_1B",                  id = 35 },
    { name = "PWM0_2A",                  id = 36 },
    { name = "PWM0_2B",                  id = 37 },
    { name = "HSPICS1",                  id = 61 },
    { name = "HSPICS2",                  id = 62 },
    { name = "VSPICLK",                  id = 63 },
    { name = "VSPIQ",                    id = 64 },
    { name = "VSPID",                    id = 65 },
    { name = "VSPIHD",                   id = 66 },
    { name = "VSPIWP",                   id = 67 },
    { name = "VSPICS0",                  id = 68 },
    { name = "VSPICS1",                  id = 69 },
    { name = "VSPICS2",                  id = 70 },
    { name = "LEDC_HS_SIG0",             id = 71 },
    { name = "LEDC_HS_SIG1",             id = 72 },
    { name = "LEDC_HS_SIG2",             id = 73 },
    { name = "LEDC_HS_SIG3",             id = 74 },
    { name = "LEDC_HS_SIG4",             id = 75 },
    { name = "LEDC_HS_SIG5",             id = 76 },
    { name = "LEDC_HS_SIG6",             id = 77 },
    { name = "LEDC_HS_SIG7",             id = 78 },
    { name = "LEDC_LS_SIG0",             id = 79 },
    { name = "LEDC_LS_SIG1",             id = 80 },
    { name = "LEDC_LS_SIG2",             id = 81 },
    { name = "LEDC_LS_SIG3",             id = 82 },
    { name = "LEDC_LS_SIG4",             id = 83 },
    { name = "LEDC_LS_SIG5",             id = 84 },
    { name = "LEDC_LS_SIG6",             id = 85 },
    { name = "LEDC_LS_SIG7",             id = 86 },
    { name = "RMT_SIG_0",                id = 87 },
    { name = "RMT_SIG_1",                id = 88 },
    { name = "RMT_SIG_2",                id = 89 },
    { name = "RMT_SIG_3",                id = 90 },
    { name = "RMT_SIG_4",                id = 91 },
    { name = "RMT_SIG_5",                id = 92 },
    { name = "RMT_SIG_6",                id = 93 },
    { name = "RMT_SIG_7",                id = 94 },
    { name = "I2CEXT1_SCL",              id = 95 },
    { name = "I2CEXT1_SDA",              id = 96 },
    { name = "HOST_CCMD_OD_PULLUP_EN_N", id = 97 },
    { name = "HOST_RST_N_1",             id = 98 },
    { name = "HOST_RST_N_2",             id = 99 },
    { name = "GPIO_SD0",                 id = 100 },
    { name = "GPIO_SD1",                 id = 101 },
    { name = "GPIO_SD2",                 id = 102 },
    { name = "GPIO_SD3",                 id = 103 },
    { name = "GPIO_SD4",                 id = 104 },
    { name = "GPIO_SD5",                 id = 105 },
    { name = "GPIO_SD6",                 id = 106 },
    { name = "GPIO_SD7",                 id = 107 },
    { name = "PWM1_0A",                  id = 108 },
    { name = "PWM1_0B",                  id = 109 },
    { name = "PWM1_1A",                  id = 110 },
    { name = "PWM1_1B",                  id = 111 },
    { name = "PWM1_2A",                  id = 112 },
    { name = "PWM1_2B",                  id = 113 },
    { name = "TWAI_TX",                  id = 123 },
    { name = "TWAI_BUS_OFF_ON",          id = 124 },
    { name = "TWAI_CLKOUT",              id = 125 },
    { name = "I2S0O_DATA_0",             id = 140 },
    { name = "I2S0O_DATA_1",             id = 141 },
    { name = "I2S0O_DATA_2",             id = 142 },
    { name = "I2S0O_DATA_3",             id = 143 },
    { name = "I2S0O_DATA_4",             id = 144 },
    { name = "I2S0O_DATA_5",             id = 145 },
    { name = "I2S0O_DATA_6",             id = 146 },
    { name = "I2S0O_DATA_7",             id = 147 },
    { name = "I2S0O_DATA_8",             id = 148 },
    { name = "I2S0O_DATA_9",             id = 149 },
    { name = "I2S0O_DATA_10",            id = 150 },
    { name = "I2S0O_DATA_11",            id = 151 },
    { name = "I2S0O_DATA_12",            id = 152 },
    { name = "I2S0O_DATA_13",            id = 153 },
    { name = "I2S0O_DATA_14",            id = 154 },
    { name = "I2S0O_DATA_15",            id = 155 },
    { name = "I2S0O_DATA_16",            id = 156 },
    { name = "I2S0O_DATA_17",            id = 157 },
    { name = "I2S0O_DATA_18",            id = 158 },
    { name = "I2S0O_DATA_19",            id = 159 },
    { name = "I2S0O_DATA_20",            id = 160 },
    { name = "I2S0O_DATA_21",            id = 161 },
    { name = "I2S0O_DATA_22",            id = 162 },
    { name = "I2S0O_DATA_23",            id = 163 },
    { name = "I2S1I_BCK",                id = 164 },
    { name = "I2S1I_WS",                 id = 165 },
    { name = "I2S1O_DATA_0",             id = 166 },
    { name = "I2S1O_DATA_1",             id = 167 },
    { name = "I2S1O_DATA_2",             id = 168 },
    { name = "I2S1O_DATA_3",             id = 169 },
    { name = "I2S1O_DATA_4",             id = 170 },
    { name = "I2S1O_DATA_5",             id = 171 },
    { name = "I2S1O_DATA_6",             id = 172 },
    { name = "I2S1O_DATA_7",             id = 173 },
    { name = "I2S1O_DATA_8",             id = 174 },
    { name = "I2S1O_DATA_9",             id = 175 },
    { name = "I2S1O_DATA_10",            id = 176 },
    { name = "I2S1O_DATA_11",            id = 177 },
    { name = "I2S1O_DATA_12",            id = 178 },
    { name = "I2S1O_DATA_13",            id = 179 },
    { name = "I2S1O_DATA_14",            id = 180 },
    { name = "I2S1O_DATA_15",            id = 181 },
    { name = "I2S1O_DATA_16",            id = 182 },
    { name = "I2S1O_DATA_17",            id = 183 },
    { name = "I2S1O_DATA_18",            id = 184 },
    { name = "I2S1O_DATA_19",            id = 185 },
    { name = "I2S1O_DATA_20",            id = 186 },
    { name = "I2S1O_DATA_21",            id = 187 },
    { name = "I2S1O_DATA_22",            id = 188 },
    { name = "I2S1O_DATA_23",            id = 189 },
    { name = "U2TXD",                    id = 198 },
    { name = "U2RTS",                    id = 199 },
    { name = "EMAC_MDC",                 id = 200 },
    { name = "EMAC_MDO",                 id = 201 },
    { name = "EMAC_CRS",                 id = 202 },
    { name = "EMAC_COL",                 id = 203 },
    { name = "BT_AUDIO0RQ",              id = 204 },
    { name = "BT_AUDIO1RQ",              id = 205 },
    { name = "BT_AUDIO2RQ",              id = 206 },
    { name = "BLE_AUDIO0RQ",             id = 207 },
    { name = "BLE_AUDIO1RQ",             id = 208 },
    { name = "BLE_AUDIO2RQ",             id = 209 },
    { name = "PCMFSYNC",                 id = 210 },
    { name = "PCMCLK",                   id = 211 },
    { name = "PCMDOUT",                  id = 212 },
    { name = "BLE_AUDIO_SYNC0_P",        id = 213 },
    { name = "BLE_AUDIO_SYNC1_P",        id = 214 },
    { name = "BLE_AUDIO_SYNC2_P",        id = 215 },
    { name = "ANT_SEL0",                 id = 216 },
    { name = "ANT_SEL1",                 id = 217 },
    { name = "ANT_SEL2",                 id = 218 },
    { name = "ANT_SEL3",                 id = 219 },
    { name = "ANT_SEL4",                 id = 220 },
    { name = "ANT_SEL5",                 id = 221 },
    { name = "ANT_SEL6",                 id = 222 },
    { name = "ANT_SEL7",                 id = 223 },
    { name = "SIGNAL_224",               id = 224 },
    { name = "SIGNAL_225",               id = 225 },
    { name = "SIGNAL_226",               id = 226 },
    { name = "SIGNAL_227",               id = 227 },
    { name = "SIGNAL_228",               id = 228 },
    { name = "GPIO",                     id = 256 },

    { name = "CLK_OUT1" },
    { name = "CLK_OUT2" },
    { name = "CLK_OUT3" },
    { name = "SD_CLK" },
    { name = "SD_CMD" },
    { name = "SD_DATA0" },
    { name = "SD_DATA1" },
    { name = "SD_DATA2" },
    { name = "SD_DATA3" },
    { name = "HS1_CLK" },
    { name = "HS1_CMD" },
    { name = "HS1_DATA0" },
    { name = "HS1_DATA1" },
    { name = "HS1_DATA2" },
    { name = "HS1_DATA3" },
    { name = "HS1_DATA4" },
    { name = "HS1_DATA5" },
    { name = "HS1_DATA6" },
    { name = "HS1_DATA7" },
    { name = "HS1_STROBE" },
    { name = "HS2_CLK" },
    { name = "HS2_CMD" },
    { name = "HS2_DATA0" },
    { name = "HS2_DATA1" },
    { name = "HS2_DATA2" },
    { name = "HS2_DATA3" },

    { name = "EMAC_TX_CLK" },
    { name = "EMAC_TX_ER" },
    { name = "EMAC_TXD3" },
    { name = "EMAC_RX_ER" },
    { name = "EMAC_TXD2" },
    { name = "EMAC_CLK_OUT" },
    { name = "EMAC_CLK_180" },
    { name = "EMAC_TXD0" },
    { name = "EMAC_TX_EN" },
    { name = "EMAC_TXD1" },

    { name = "MTDO" },
]

[device.i2c_master]
support_status = "supported"
instances = [
    { name = "i2c0", sys_instance = "I2cExt0", scl = "I2CEXT0_SCL", sda = "I2CEXT0_SDA" },
    { name = "i2c1", sys_instance = "I2cExt1", scl = "I2CEXT1_SCL", sda = "I2CEXT1_SDA" },
]
ll_intr_mask = 0x3ffff
fifo_size = 32
max_bus_timeout = 0xFFFFF
separate_filter_config_registers = true
i2c0_data_register_ahb_address = 0x6001301c

[device.i2c_slave]
support_status = "not_supported"

[device.interrupts]
support_status = "partial"
status_registers = 3

[device.rmt]
support_status = "partial"
ram_start = 0x3ff56800
channel_ram_size = 64
channels = ["RxTx", "RxTx", "RxTx", "RxTx", "RxTx", "RxTx", "RxTx", "RxTx"]
has_per_channel_clock = true
clock_sources.supported = [ "RefTick", "Apb" ]
# Power-on value is RefTick!
clock_sources.default = "Apb"

[device.rsa]
support_status = "partial"
size_increment = 512
memory_size_bytes = 512

[device.sha]
support_status = "partial"
algo = { sha1 = 0, sha256 = 0, sha384 = 0, sha512 = 0 } # fake mode bits, ESP32 has separate register sets

[device.spi_master]
support_status = "supported"
instances = [
    { name = "spi2", sys_instance = "Spi2", sclk = "HSPICLK", sio = ["HSPID", "HSPIQ", "HSPIWP", "HSPIHD"], cs = ["HSPICS0", "HSPICS1", "HSPICS2"] },
    { name = "spi3", sys_instance = "Spi3", sclk = "VSPICLK", sio = ["VSPID", "VSPIQ", "VSPIWP", "VSPIHD"], cs = ["VSPICS0", "VSPICS1", "VSPICS2"] },
]

[device.spi_slave]
support_status = "partial"
instances = [
    { name = "spi2", sys_instance = "Spi2", sclk = "HSPICLK", mosi = "HSPID", miso = "HSPIQ", cs = "HSPICS0" },
    { name = "spi3", sys_instance = "Spi3", sclk = "VSPICLK", mosi = "VSPID", miso = "VSPIQ", cs = "VSPICS0" },
]

[device.timergroup]
support_status = "partial"
timg_has_timer1 = true
timg_has_divcnt_rst = false
instances = [{ name = "timg0" }, { name = "timg1" }]

[device.uart]
support_status = "supported"
instances = [
    { name = "uart0", sys_instance = "Uart0", tx = "U0TXD", rx = "U0RXD", cts = "U0CTS", rts = "U0RTS" },
    { name = "uart1", sys_instance = "Uart1", tx = "U1TXD", rx = "U1RXD", cts = "U1CTS", rts = "U1RTS" },
    { name = "uart2", sys_instance = "Uart2", tx = "U2TXD", rx = "U2RXD", cts = "U2CTS", rts = "U2RTS" },
]
ram_size = 128

[device.ethernet]
support_status = "not_supported"

[device.camera]
support_status = "not_supported"
[device.rgb_display]
support_status = "partial"

[device.rng]
support_status = "partial"
apb_cycle_wait_num = 16 # TODO

# Other drivers which are partially supported but have no other configuration:

## Interfaces
[device.i2s]
[device.ledc]
[device.mcpwm]
[device.pcnt]
[device.sd_host]
[device.sd_slave]
[device.touch]
[device.twai]

## Miscellaneous
[device.dma]
[device.io_mux]
[device.psram]
[device.temp_sensor]
[device.sleep]

[device.ulp_fsm]

## Radio
[device.wifi]

[device.bt]
support_status = "partial"
controller = "btdm"

[device.phy]
combo_module = true
