# ESP32-S3 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   = "esp32s3"
arch   = "xtensa"
target = "xtensa-esp32s3-none-elf"
cores  = 2
trm    = "https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf"

peripherals = [
    { name = "AES", interrupts = { peri = "AES" } },
    { name = "APB_CTRL" },
    { name = "APB_SARADC" },
    { name = "ASSIST_DEBUG" },
    { name = "DMA" },
    { name = "DS" },
    { name = "EFUSE" },
    { name = "EXTMEM" },
    { name = "GPIO" },
    { name = "GPIO_SD" },
    { name = "HMAC" },
    { name = "I2C0", interrupts = { peri = "I2C_EXT0" } },
    { name = "I2C1", interrupts = { peri = "I2C_EXT1" } },
    { name = "I2S0", interrupts = { peri = "I2S0" } },
    { name = "I2S1", interrupts = { peri = "I2S1" } },
    { name = "INTERRUPT_CORE0" },
    { name = "INTERRUPT_CORE1" },
    { name = "IO_MUX" },
    { name = "LCD_CAM" },
    { name = "LEDC" },
    { name = "LPWR", pac = "RTC_CNTL" },
    { name = "MCPWM0" },
    { name = "MCPWM1" },
    { name = "PCNT" },
    { name = "PERI_BACKUP" },
    { name = "RMT" },
    { name = "RNG" },
    { name = "RSA", interrupts = { peri = "RSA" } },
    { name = "RTC_CNTL" },
    { name = "RTC_I2C" },
    { name = "RTC_IO" },
    { name = "SDHOST" },
    { name = "SENS" },
    { name = "SENSITIVE" },
    { name = "SHA", interrupts = { peri = "SHA" } },
    { name = "SPI0" },
    { name = "SPI1" },
    { name = "SPI2", interrupts = { peri = "SPI2" } },
    { name = "SPI3", interrupts = { peri = "SPI3" } },
    { name = "SYSTEM" },
    { name = "SYSTIMER" },
    { name = "TIMG0" },
    { name = "TIMG1" },
    { name = "TWAI0" },
    { name = "UART0", interrupts = { peri = "UART0" } },
    { name = "UART1", interrupts = { peri = "UART1" } },
    { name = "UART2", interrupts = { peri = "UART2" } },
    { name = "UHCI0" },
    { name = "USB0" },
    { name = "USB_DEVICE", interrupts = { peri = "USB_DEVICE" } },
    { name = "USB_WRAP" },
    { name = "WCL" },
    { name = "XTS_AES" },

    { name = "DMA_CH0", virtual = true },
    { name = "DMA_CH1", virtual = true },
    { name = "DMA_CH2", virtual = true },
    { name = "DMA_CH3", virtual = true },
    { name = "DMA_CH4", virtual = true },

    { name = "ADC1", virtual = true },
    { name = "ADC2", virtual = true },
    { name = "BT", virtual = true },
    { name = "CPU_CTRL", virtual = true },
    { name = "FLASH", virtual = true },
    { name = "PSRAM", virtual = true },
    { name = "SW_INTERRUPT", virtual = true },
    { name = "ULP_RISCV_CORE", virtual = true },
    { name = "WIFI", virtual = true },
]

symbols = [
    # Additional peripherals defined by us (the developers):
    "gdma",
    "phy",
    "psram",
    "psram_dma",
    "octal_psram",
    "swd",
    "ulp_riscv_core",

    # 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",
    "pm_support_wifi_wakeup",
    "pm_support_bt_wakeup",
    "uart_support_wakeup_int",
    "ulp_supported",
    "riscv_coproc_supported",
]

[device.soc]
rc_fast_clk_default = 17_500_000
rc_slow_clock = 136_000
xtal_options = [40]

memory_map = { ranges = [
    { name = "dram", start = 0x3FC8_8000, end = 0x3FD0_0000 },
    { name = "dram2_uninit", start = 0x3FCD_B700, end = 0x3FCE_D710 },
] }

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 = "en0" },
    { name = "clk_en_register", value = "perip_clk_{{reg_group}}" },
    { name = "clk_en_field", value = "{{peripheral}}_clk_en" },
    { name = "rst_register", value = "perip_rst_{{reg_group}}" },
    { name = "rst_field", value = "{{peripheral}}_rst" },
], peripheral_clocks = [
    { name = "PeriBackup", template_params = { reg_group = "en1", peripheral = "peri_backup" } },
    { name = "Aes", template_params = { reg_group = "en1", peripheral = "crypto_aes" } },
    { name = "Sha", template_params = { reg_group = "en1", peripheral = "crypto_sha" } },
    { name = "Rsa", template_params = { reg_group = "en1", peripheral = "crypto_rsa" } },
    { name = "Ds", template_params = { reg_group = "en1", peripheral = "crypto_ds" } },
    { name = "Hmac", template_params = { reg_group = "en1", peripheral = "crypto_hmac" } },
    { name = "Dma", template_params = { reg_group = "en1" } },
    { name = "SdioHost", template_params = { reg_group = "en1" } },
    { name = "LcdCam", template_params = { reg_group = "en1" } },
    { name = "Uart2", template_params = { reg_group = "en1" } },
    { name = "UsbDevice", template_params = { reg_group = "en1" }, keep_enabled = true },

    #{ name = "Adc2Arb" },
    { name = "Systimer", keep_enabled = true },
    { name = "ApbSarAdc", template_params = { peripheral = "apb_saradc" } },
    { name = "UartMem", keep_enabled = true }, # TODO: keep_enabled can be removed once esp-println needs explicit initialization
    { name = "Usb" },
    { 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 = "Timg0", template_params = { peripheral = "timergroup" }, keep_enabled = true }, # used for clock calibration
    { 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" },
    #{ name = "Timers" },
    
    # Radio clocks not modeled here.
] } }

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

[device.aes]
support_status = "partial"
has_split_text_registers = true
endianness_configurable = false
dma = true
dma_mode = ["ECB", "CBC", "OFB", "CTR", "CFB8", "CFB128"]
key_length = { options = [
    { bits = 128, encrypt_mode = 0, decrypt_mode = 4 },
    { bits = 256, encrypt_mode = 2, decrypt_mode = 6 }
] }

[device.assist_debug]
support_status = "partial"
has_region_monitor = true

[device.gpio]
support_status = "supported"
has_bank_1 = true
gpio_function = 1
constant_0_input = 0x3c
constant_1_input = 0x38
pins = [
    { pin =  0,                                                                                                                rtc = { 0 = "RTC_GPIO0", 1 = "SAR_I2C_SCL_0" } },
    { pin =  1,                                                                analog = { 0 = "TOUCH1",     1 = "ADC1_CH0"  }, rtc = { 0 = "RTC_GPIO1", 1 = "SAR_I2C_SDA_0" } },
    { pin =  2,                                                                analog = { 0 = "TOUCH2",     1 = "ADC1_CH1"  }, rtc = { 0 = "RTC_GPIO2", 1 = "SAR_I2C_SCL_1" } },
    { pin =  3,                                                                analog = { 0 = "TOUCH3",     1 = "ADC1_CH2"  }, rtc = { 0 = "RTC_GPIO3", 1 = "SAR_I2C_SDA_1" } },
    { pin =  4,                                                                analog = { 0 = "TOUCH4",     1 = "ADC1_CH3"  }, rtc = { 0 = "RTC_GPIO4" } },
    { pin =  5,                                                                analog = { 0 = "TOUCH5",     1 = "ADC1_CH4"  }, rtc = { 0 = "RTC_GPIO5" } },
    { pin =  6,                                                                analog = { 0 = "TOUCH6",     1 = "ADC1_CH5"  }, rtc = { 0 = "RTC_GPIO6" } },
    { pin =  7,                                                                analog = { 0 = "TOUCH7",     1 = "ADC1_CH6"  }, rtc = { 0 = "RTC_GPIO7" } },
    { pin =  8, functions = {                3 = "SUBSPICS1"                }, analog = { 0 = "TOUCH8",     1 = "ADC1_CH7"  }, rtc = { 0 = "RTC_GPIO8" } },
    { pin =  9, functions = {                3 = "SUBSPIHD",  4 = "FSPIHD"  }, analog = { 0 = "TOUCH9",     1 = "ADC1_CH8"  }, rtc = { 0 = "RTC_GPIO9" } },
    { pin = 10, functions = { 2 = "FSPIIO4", 3 = "SUBSPICS0", 4 = "FSPICS0" }, analog = { 0 = "TOUCH10",    1 = "ADC1_CH9"  }, rtc = { 0 = "RTC_GPIO10" } },
    { pin = 11, functions = { 2 = "FSPIIO5", 3 = "SUBSPID",   4 = "FSPID"   }, analog = { 0 = "TOUCH11",    1 = "ADC2_CH0"  }, rtc = { 0 = "RTC_GPIO11" } },
    { pin = 12, functions = { 2 = "FSPIIO6", 3 = "SUBSPICLK", 4 = "FSPICLK" }, analog = { 0 = "TOUCH12",    1 = "ADC2_CH1"  }, rtc = { 0 = "RTC_GPIO12" } },
    { pin = 13, functions = { 2 = "FSPIIO7", 3 = "SUBSPIQ",   4 = "FSPIQ"   }, analog = { 0 = "TOUCH13",    1 = "ADC2_CH2"  }, rtc = { 0 = "RTC_GPIO13" } },
    { pin = 14, functions = { 2 = "FSPIDQS", 3 = "SUBSPIWP",  4 = "FSPIWP"  }, analog = { 0 = "TOUCH14",    1 = "ADC2_CH3"  }, rtc = { 0 = "RTC_GPIO14" } },
    { pin = 15, functions = { 2 = "U0RTS" },                                   analog = { 0 = "XTAL_32K_P", 1 = "ADC2_CH4"  }, rtc = { 0 = "RTC_GPIO15" } },
    { pin = 16, functions = { 2 = "U0CTS" },                                   analog = { 0 = "XTAL_32K_N", 1 = "ADC2_CH5"  }, rtc = { 0 = "RTC_GPIO16" } },
    { pin = 17, functions = { 2 = "U1TXD" },                                   analog = {                   1 = "ADC2_CH6"  }, rtc = { 0 = "RTC_GPIO17" } },
    { pin = 18, functions = { 2 = "U1RXD",   3 = "CLK_OUT3" },                 analog = {                   1 = "ADC2_CH7"  }, rtc = { 0 = "RTC_GPIO18" } },
    { pin = 19, functions = { 2 = "U1RTS",   3 = "CLK_OUT2" },                 analog = { 0 = "USB_DM",     1 = "ADC2_CH8"  }, rtc = { 0 = "RTC_GPIO19" } },
    { pin = 20, functions = { 2 = "U1CTS",   3 = "CLK_OUT1" },                 analog = { 0 = "USB_DP",     1 = "ADC2_CH9"  }, rtc = { 0 = "RTC_GPIO20" } },
    { pin = 21,                                                                                                                rtc = { 0 = "RTC_GPIO21" } },

    { pin = 33, functions = { 2 = "FSPIHD",   3 = "SUBSPIHD",  4 = "SPIIO4" } },
    { pin = 34, functions = { 2 = "FSPICS0",  3 = "SUBSPICS0", 4 = "SPIIO5" } },
    { pin = 35, functions = { 2 = "FSPID",    3 = "SUBSPID",   4 = "SPIIO6" } },
    { pin = 36, functions = { 2 = "FSPICLK",  3 = "SUBSPICLK", 4 = "SPIIO7" } },
    { pin = 37, functions = { 2 = "FSPIQ",    3 = "SUBSPIQ",   4 = "SPIDQS" } },
    { pin = 38, functions = { 2 = "FSPIWP",   3 = "SUBSPIWP"                } },
    { pin = 39, functions = { 2 = "CLK_OUT3", 3 = "SUBSPICS1"               } },
    { pin = 40, functions = { 2 = "CLK_OUT2" } },
    { pin = 41, functions = { 2 = "CLK_OUT1" } },
    { pin = 42 },
    { pin = 43, functions = { 0 = "U0TXD", 2 = "CLK_OUT1" } },
    { pin = 44, functions = { 0 = "U0RXD", 2 = "CLK_OUT2" } },
    { pin = 45 },
    { pin = 46 },
    { pin = 47, functions = { 0 = "SPICLK_P_DIFF", 2 = "SUBSPICLK_P_DIFF" } },
    { pin = 48, functions = { 0 = "SPICLK_N_DIFF", 2 = "SUBSPICLK_N_DIFF" } },
]
input_signals = [
    { name = "SPIQ",                    id = 0 },
    { name = "SPID",                    id = 1 },
    { name = "SPIHD",                   id = 2 },
    { name = "SPIWP",                   id = 3 },
    { name = "SPID4",                   id = 7 },
    { name = "SPID5",                   id = 8 },
    { name = "SPID6",                   id = 9 },
    { name = "SPID7",                   id = 10 },
    { name = "SPIDQS",                  id = 11 },
    { name = "U0RXD",                   id = 12 },
    { name = "U0CTS",                   id = 13 },
    { name = "U0DSR",                   id = 14 },
    { name = "U1RXD",                   id = 15 },
    { name = "U1CTS",                   id = 16 },
    { name = "U1DSR",                   id = 17 },
    { name = "U2RXD",                   id = 18 },
    { name = "U2CTS",                   id = 19 },
    { name = "U2DSR",                   id = 20 },
    { name = "I2S1_MCLK",               id = 21 },
    { name = "I2S0O_BCK",               id = 22 },
    { name = "I2S0_MCLK",               id = 23 },
    { name = "I2S0O_WS",                id = 24 },
    { name = "I2S0I_SD",                id = 25 },
    { name = "I2S0I_BCK",               id = 26 },
    { name = "I2S0I_WS",                id = 27 },
    { name = "I2S1O_BCK",               id = 28 },
    { name = "I2S1O_WS",                id = 29 },
    { name = "I2S1I_SD",                id = 30 },
    { name = "I2S1I_BCK",               id = 31 },
    { name = "I2S1I_WS",                id = 32 },
    { name = "PCNT0_SIG_CH0",           id = 33 },
    { name = "PCNT0_SIG_CH1",           id = 34 },
    { name = "PCNT0_CTRL_CH0",          id = 35 },
    { name = "PCNT0_CTRL_CH1",          id = 36 },
    { name = "PCNT1_SIG_CH0",           id = 37 },
    { name = "PCNT1_SIG_CH1",           id = 38 },
    { name = "PCNT1_CTRL_CH0",          id = 39 },
    { name = "PCNT1_CTRL_CH1",          id = 40 },
    { name = "PCNT2_SIG_CH0",           id = 41 },
    { name = "PCNT2_SIG_CH1",           id = 42 },
    { name = "PCNT2_CTRL_CH0",          id = 43 },
    { name = "PCNT2_CTRL_CH1",          id = 44 },
    { name = "PCNT3_SIG_CH0",           id = 45 },
    { name = "PCNT3_SIG_CH1",           id = 46 },
    { name = "PCNT3_CTRL_CH0",          id = 47 },
    { name = "PCNT3_CTRL_CH1",          id = 48 },
    { name = "I2S0I_SD1",               id = 51 },
    { name = "I2S0I_SD2",               id = 52 },
    { name = "I2S0I_SD3",               id = 53 },
    { name = "USB_EXTPHY_VP",           id = 55 },
    { name = "USB_EXTPHY_VM",           id = 56 },
    { name = "USB_EXTPHY_RCV",          id = 57 },
    { name = "USB_OTG_IDDIG",           id = 58 },
    { name = "USB_OTG_AVALID",          id = 59 },
    { name = "USB_SRP_BVALID",          id = 60 },
    { name = "USB_OTG_VBUSVALID",       id = 61 },
    { name = "USB_SRP_SESSEND",         id = 62 },
    { name = "SPI3_CLK",                id = 66 },
    { name = "SPI3_Q",                  id = 67 },
    { name = "SPI3_D",                  id = 68 },
    { name = "SPI3_HD",                 id = 69 },
    { name = "SPI3_WP",                 id = 70 },
    { name = "SPI3_CS0",                id = 71 },
    { name = "RMT_SIG_0",               id = 81 },
    { name = "RMT_SIG_1",               id = 82 },
    { name = "RMT_SIG_2",               id = 83 },
    { name = "RMT_SIG_3",               id = 84 },
    { name = "I2CEXT0_SCL",             id = 89 },
    { name = "I2CEXT0_SDA",             id = 90 },
    { name = "I2CEXT1_SCL",             id = 91 },
    { name = "I2CEXT1_SDA",             id = 92 },
    { name = "FSPICLK",                 id = 101 },
    { name = "FSPIQ",                   id = 102 },
    { name = "FSPID",                   id = 103 },
    { name = "FSPIHD",                  id = 104 },
    { name = "FSPIWP",                  id = 105 },
    { name = "FSPIIO4",                 id = 106 },
    { name = "FSPIIO5",                 id = 107 },
    { name = "FSPIIO6",                 id = 108 },
    { name = "FSPIIO7",                 id = 109 },
    { name = "FSPICS0",                 id = 110 },
    { name = "TWAI_RX",                 id = 116 },
    { name = "SUBSPIQ",                 id = 120 },
    { name = "SUBSPID",                 id = 121 },
    { name = "SUBSPIHD",                id = 122 },
    { name = "SUBSPIWP",                id = 123 },
    { name = "CAM_DATA_0",              id = 133 },
    { name = "CAM_DATA_1",              id = 134 },
    { name = "CAM_DATA_2",              id = 135 },
    { name = "CAM_DATA_3",              id = 136 },
    { name = "CAM_DATA_4",              id = 137 },
    { name = "CAM_DATA_5",              id = 138 },
    { name = "CAM_DATA_6",              id = 139 },
    { name = "CAM_DATA_7",              id = 140 },
    { name = "CAM_DATA_8",              id = 141 },
    { name = "CAM_DATA_9",              id = 142 },
    { name = "CAM_DATA_10",             id = 143 },
    { name = "CAM_DATA_11",             id = 144 },
    { name = "CAM_DATA_12",             id = 145 },
    { name = "CAM_DATA_13",             id = 146 },
    { name = "CAM_DATA_14",             id = 147 },
    { name = "CAM_DATA_15",             id = 148 },
    { name = "CAM_PCLK",                id = 149 },
    { name = "CAM_H_ENABLE",            id = 150 },
    { name = "CAM_H_SYNC",              id = 151 },
    { name = "CAM_V_SYNC",              id = 152 },
    { name = "SUBSPID4",                id = 155 },
    { name = "SUBSPID5",                id = 156 },
    { name = "SUBSPID6",                id = 157 },
    { name = "SUBSPID7",                id = 158 },
    { name = "SUBSPIDQS",               id = 159 },
    { name = "PWM0_SYNC0",              id = 160 },
    { name = "PWM0_SYNC1",              id = 161 },
    { name = "PWM0_SYNC2",              id = 162 },
    { name = "PWM0_F0",                 id = 163 },
    { name = "PWM0_F1",                 id = 164 },
    { name = "PWM0_F2",                 id = 165 },
    { name = "PWM0_CAP0",               id = 166 },
    { name = "PWM0_CAP1",               id = 167 },
    { name = "PWM0_CAP2",               id = 168 },
    { name = "PWM1_SYNC0",              id = 169 },
    { name = "PWM1_SYNC1",              id = 170 },
    { name = "PWM1_SYNC2",              id = 171 },
    { name = "PWM1_F0",                 id = 172 },
    { name = "PWM1_F1",                 id = 173 },
    { name = "PWM1_F2",                 id = 174 },
    { name = "PWM1_CAP0",               id = 175 },
    { name = "PWM1_CAP1",               id = 176 },
    { name = "PWM1_CAP2",               id = 177 },
    { name = "SDHOST_CCMD_IN_1",        id = 178 },
    { name = "SDHOST_CCMD_IN_2",        id = 179 },
    { name = "SDHOST_CDATA_IN_10",      id = 180 },
    { name = "SDHOST_CDATA_IN_11",      id = 181 },
    { name = "SDHOST_CDATA_IN_12",      id = 182 },
    { name = "SDHOST_CDATA_IN_13",      id = 183 },
    { name = "SDHOST_CDATA_IN_14",      id = 184 },
    { name = "SDHOST_CDATA_IN_15",      id = 185 },
    { name = "SDHOST_CDATA_IN_16",      id = 186 },
    { name = "SDHOST_CDATA_IN_17",      id = 187 },
    { name = "SDHOST_DATA_STROBE_1",    id = 192 },
    { name = "SDHOST_DATA_STROBE_2",    id = 193 },
    { name = "SDHOST_CARD_DETECT_N_1",  id = 194 },
    { name = "SDHOST_CARD_DETECT_N_2",  id = 195 },
    { name = "SDHOST_CARD_WRITE_PRT_1", id = 196 },
    { name = "SDHOST_CARD_WRITE_PRT_2", id = 197 },
    { name = "SDHOST_CARD_INT_N_1",     id = 198 },
    { name = "SDHOST_CARD_INT_N_2",     id = 199 },
    { name = "SDHOST_CDATA_IN_20",      id = 213 },
    { name = "SDHOST_CDATA_IN_21",      id = 214 },
    { name = "SDHOST_CDATA_IN_22",      id = 215 },
    { name = "SDHOST_CDATA_IN_23",      id = 216 },
    { name = "SDHOST_CDATA_IN_24",      id = 217 },
    { name = "SDHOST_CDATA_IN_25",      id = 218 },
    { name = "SDHOST_CDATA_IN_26",      id = 219 },
    { name = "SDHOST_CDATA_IN_27",      id = 220 },

    { name = "PRO_ALONEGPIO_IN0",      id = 221 },
    { name = "PRO_ALONEGPIO_IN1",      id = 222 },
    { name = "PRO_ALONEGPIO_IN2",      id = 223 },
    { name = "PRO_ALONEGPIO_IN3",      id = 224 },
    { name = "PRO_ALONEGPIO_IN4",      id = 225 },
    { name = "PRO_ALONEGPIO_IN5",      id = 226 },
    { name = "PRO_ALONEGPIO_IN6",      id = 227 },
    { name = "PRO_ALONEGPIO_IN7",      id = 228 },

    { name = "USB_JTAG_TDO_BRIDGE",   id = 251 },
    { name = "CORE1_GPIO_IN3",        id = 252 },
    { name = "CORE1_GPIO_IN4",        id = 253 },
    { name = "CORE1_GPIO_IN5",        id = 254 },
    { name = "CORE1_GPIO_IN6",        id = 255 },

    { name = "SPIIO4" },
    { name = "SPIIO5" },
    { name = "SPIIO6" },
    { name = "SPIIO7" },

    { name = "MTDI" },
    { name = "MTCK" },
    { name = "MTMS" },
]
output_signals = [
    { name = "SPIQ",                       id = 0 },
    { name = "SPID",                       id = 1 },
    { name = "SPIHD",                      id = 2 },
    { name = "SPIWP",                      id = 3 },
    { name = "SPICLK",                     id = 4 },
    { name = "SPICS0",                     id = 5 },
    { name = "SPICS1",                     id = 6 },
    { name = "SPID4",                      id = 7 },
    { name = "SPID5",                      id = 8 },
    { name = "SPID6",                      id = 9 },
    { name = "SPID7",                      id = 10 },
    { name = "SPIDQS",                     id = 11 },
    { name = "U0TXD",                      id = 12 },
    { name = "U0RTS",                      id = 13 },
    { name = "U0DTR",                      id = 14 },
    { name = "U1TXD",                      id = 15 },
    { name = "U1RTS",                      id = 16 },
    { name = "U1DTR",                      id = 17 },
    { name = "U2TXD",                      id = 18 },
    { name = "U2RTS",                      id = 19 },
    { name = "U2DTR",                      id = 20 },
    { name = "I2S1_MCLK",                  id = 21 },
    { name = "I2S0O_BCK",                  id = 22 },
    { name = "I2S0_MCLK",                  id = 23 },
    { name = "I2S0O_WS",                   id = 24 },
    { name = "I2S0O_SD",                   id = 25 },
    { name = "I2S0I_BCK",                  id = 26 },
    { name = "I2S0I_WS",                   id = 27 },
    { name = "I2S1O_BCK",                  id = 28 },
    { name = "I2S1O_WS",                   id = 29 },
    { name = "I2S1O_SD",                   id = 30 },
    { name = "I2S1I_BCK",                  id = 31 },
    { name = "I2S1I_WS",                   id = 32 },
    { name = "USB_EXTPHY_OEN",             id = 55 },
    { name = "USB_EXTPHY_VPO",             id = 57 },
    { name = "USB_EXTPHY_VMO",             id = 58 },
    { name = "SPI3_CLK",                   id = 66 },
    { name = "SPI3_Q",                     id = 67 },
    { name = "SPI3_D",                     id = 68 },
    { name = "SPI3_HD",                    id = 69 },
    { name = "SPI3_WP",                    id = 70 },
    { name = "SPI3_CS0",                   id = 71 },
    { name = "SPI3_CS1",                   id = 72 },
    { name = "LEDC_LS_SIG0",               id = 73 },
    { name = "LEDC_LS_SIG1",               id = 74 },
    { name = "LEDC_LS_SIG2",               id = 75 },
    { name = "LEDC_LS_SIG3",               id = 76 },
    { name = "LEDC_LS_SIG4",               id = 77 },
    { name = "LEDC_LS_SIG5",               id = 78 },
    { name = "LEDC_LS_SIG6",               id = 79 },
    { name = "LEDC_LS_SIG7",               id = 80 },
    { name = "RMT_SIG_0",                  id = 81 },
    { name = "RMT_SIG_1",                  id = 82 },
    { name = "RMT_SIG_2",                  id = 83 },
    { name = "RMT_SIG_3",                  id = 84 },
    { name = "I2CEXT0_SCL",                id = 89 },
    { name = "I2CEXT0_SDA",                id = 90 },
    { name = "I2CEXT1_SCL",                id = 91 },
    { name = "I2CEXT1_SDA",                id = 92 },
    { name = "GPIO_SD0",                   id = 93 },
    { name = "GPIO_SD1",                   id = 94 },
    { name = "GPIO_SD2",                   id = 95 },
    { name = "GPIO_SD3",                   id = 96 },
    { name = "GPIO_SD4",                   id = 97 },
    { name = "GPIO_SD5",                   id = 98 },
    { name = "GPIO_SD6",                   id = 99 },
    { name = "GPIO_SD7",                   id = 100 },
    { name = "FSPICLK",                    id = 101 },
    { name = "FSPIQ",                      id = 102 },
    { name = "FSPID",                      id = 103 },
    { name = "FSPIHD",                     id = 104 },
    { name = "FSPIWP",                     id = 105 },
    { name = "FSPIIO4",                    id = 106 },
    { name = "FSPIIO5",                    id = 107 },
    { name = "FSPIIO6",                    id = 108 },
    { name = "FSPIIO7",                    id = 109 },
    { name = "FSPICS0",                    id = 110 },
    { name = "FSPICS1",                    id = 111 },
    { name = "FSPICS2",                    id = 112 },
    { name = "FSPICS3",                    id = 113 },
    { name = "FSPICS4",                    id = 114 },
    { name = "FSPICS5",                    id = 115 },
    { name = "TWAI_TX",                    id = 116 },
    { name = "SUBSPICLK",                  id = 119 },
    { name = "SUBSPIQ",                    id = 120 },
    { name = "SUBSPID",                    id = 121 },
    { name = "SUBSPIHD",                   id = 122 },
    { name = "SUBSPIWP",                   id = 123 },
    { name = "SUBSPICS0",                  id = 124 },
    { name = "SUBSPICS1",                  id = 125 },
    { name = "FSPIDQS",                    id = 126 },
    { name = "SPI3_CS2",                   id = 127 },
    { name = "I2S0O_SD1",                  id = 128 },
    { name = "LCD_CS",                     id = 132 },
    { name = "LCD_DATA_0",                 id = 133 },
    { name = "LCD_DATA_1",                 id = 134 },
    { name = "LCD_DATA_2",                 id = 135 },
    { name = "LCD_DATA_3",                 id = 136 },
    { name = "LCD_DATA_4",                 id = 137 },
    { name = "LCD_DATA_5",                 id = 138 },
    { name = "LCD_DATA_6",                 id = 139 },
    { name = "LCD_DATA_7",                 id = 140 },
    { name = "LCD_DATA_8",                 id = 141 },
    { name = "LCD_DATA_9",                 id = 142 },
    { name = "LCD_DATA_10",                id = 143 },
    { name = "LCD_DATA_11",                id = 144 },
    { name = "LCD_DATA_12",                id = 145 },
    { name = "LCD_DATA_13",                id = 146 },
    { name = "LCD_DATA_14",                id = 147 },
    { name = "LCD_DATA_15",                id = 148 },
    { name = "CAM_CLK",                    id = 149 },
    { name = "LCD_H_ENABLE",               id = 150 },
    { name = "LCD_H_SYNC",                 id = 151 },
    { name = "LCD_V_SYNC",                 id = 152 },
    { name = "LCD_DC",                     id = 153 },
    { name = "LCD_PCLK",                   id = 154 },
    { name = "SUBSPID4",                   id = 155 },
    { name = "SUBSPID5",                   id = 156 },
    { name = "SUBSPID6",                   id = 157 },
    { name = "SUBSPID7",                   id = 158 },
    { name = "SUBSPIDQS",                  id = 159 },
    { name = "PWM0_0A",                    id = 160 },
    { name = "PWM0_0B",                    id = 161 },
    { name = "PWM0_1A",                    id = 162 },
    { name = "PWM0_1B",                    id = 163 },
    { name = "PWM0_2A",                    id = 164 },
    { name = "PWM0_2B",                    id = 165 },
    { name = "PWM1_0A",                    id = 166 },
    { name = "PWM1_0B",                    id = 167 },
    { name = "PWM1_1A",                    id = 168 },
    { name = "PWM1_1B",                    id = 169 },
    { name = "PWM1_2A",                    id = 170 },
    { name = "PWM1_2B",                    id = 171 },
    { name = "SDHOST_CCLK_OUT_1",          id = 172 },
    { name = "SDHOST_CCLK_OUT_2",          id = 173 },
    { name = "SDHOST_RST_N_1",             id = 174 },
    { name = "SDHOST_RST_N_2",             id = 175 },
    { name = "SDHOST_CCMD_OD_PULLUP_EN_N", id = 176 },
    { name = "SDIO_TOHOST_INT",            id = 177 },
    { name = "SDHOST_CCMD_OUT_1",          id = 178 },
    { name = "SDHOST_CCMD_OUT_2",          id = 179 },
    { name = "SDHOST_CDATA_OUT_10",        id = 180 },
    { name = "SDHOST_CDATA_OUT_11",        id = 181 },
    { name = "SDHOST_CDATA_OUT_12",        id = 182 },
    { name = "SDHOST_CDATA_OUT_13",        id = 183 },
    { name = "SDHOST_CDATA_OUT_14",        id = 184 },
    { name = "SDHOST_CDATA_OUT_15",        id = 185 },
    { name = "SDHOST_CDATA_OUT_16",        id = 186 },
    { name = "SDHOST_CDATA_OUT_17",        id = 187 },
    { name = "SDHOST_CDATA_OUT_20",        id = 213 },
    { name = "SDHOST_CDATA_OUT_21",        id = 214 },
    { name = "SDHOST_CDATA_OUT_22",        id = 215 },
    { name = "SDHOST_CDATA_OUT_23",        id = 216 },
    { name = "SDHOST_CDATA_OUT_24",        id = 217 },
    { name = "SDHOST_CDATA_OUT_25",        id = 218 },
    { name = "SDHOST_CDATA_OUT_26",        id = 219 },
    { name = "SDHOST_CDATA_OUT_27",        id = 220 },

    { name = "PRO_ALONEGPIO_OUT0",      id = 221 },
    { name = "PRO_ALONEGPIO_OUT1",      id = 222 },
    { name = "PRO_ALONEGPIO_OUT2",      id = 223 },
    { name = "PRO_ALONEGPIO_OUT3",      id = 224 },
    { name = "PRO_ALONEGPIO_OUT4",      id = 225 },
    { name = "PRO_ALONEGPIO_OUT5",      id = 226 },
    { name = "PRO_ALONEGPIO_OUT6",      id = 227 },
    { name = "PRO_ALONEGPIO_OUT7",      id = 228 },

    { name = "USB_JTAG_TRST",           id = 251 },
    { name = "CORE1_GPIO_OUT3",         id = 252 },
    { name = "CORE1_GPIO_OUT4",         id = 253 },
    { name = "CORE1_GPIO_OUT5",         id = 254 },
    { name = "CORE1_GPIO_OUT6",         id = 255 },

    { name = "GPIO",                       id = 256 },

    { name = "SPIIO4" },
    { name = "SPIIO5" },
    { name = "SPIIO6" },
    { name = "SPIIO7" },

    { name = "CLK_OUT1" },
    { name = "CLK_OUT2" },
    { name = "CLK_OUT3" },

    { name = "SPICLK_P_DIFF" },
    { name = "SPICLK_N_DIFF" },
    { name = "SUBSPICLK_P_DIFF" },
    { name = "SUBSPICLK_N_DIFF" },

    { 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" },
]
has_fsm_timeouts = true
has_hw_bus_clear = false
ll_intr_mask = 0x3ffff
fifo_size = 32
has_bus_timeout_enable = true
max_bus_timeout = 0x1F
can_estimate_nack_reason = true
has_conf_update = true
has_arbitration_en = true
has_tx_fifo_watermark = true
bus_timeout_is_exponential = true

[device.i2c_slave]
support_status = "not_supported"

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

[device.rmt]
support_status = "partial"
ram_start = 0x60016800
channel_ram_size = 48
channels = ["Tx", "Tx", "Tx", "Tx", "Rx", "Rx", "Rx", "Rx"]
has_tx_immediate_stop = true
has_tx_loop_count = true
has_tx_loop_auto_stop = true
has_tx_carrier_data_only = true
has_tx_sync = true
has_rx_wrap = true
has_rx_demodulation = true
has_dma = true
clock_sources.supported = [ "None", "Apb", "RcFast", "Xtal" ]
clock_sources.default = "Apb"

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

[device.sha]
support_status = "partial"
dma = true
algo = { sha1 = 0, sha224 = 1, sha256 = 2, sha384 = 3, sha512 = 4, sha512_224 = 5, sha512_256 = 6, sha512_t = 7 }

[device.spi_master]
support_status = "supported"
has_octal = true
instances = [
    { name = "spi2", sys_instance = "Spi2", sclk = "FSPICLK",  sio = ["FSPID", "FSPIQ", "FSPIWP", "FSPIHD", "FSPIIO4", "FSPIIO5", "FSPIIO6", "FSPIIO7"], cs = ["FSPICS0", "FSPICS1", "FSPICS2", "FSPICS3", "FSPICS4", "FSPICS5"] },
    { name = "spi3", sys_instance = "Spi3", sclk = "SPI3_CLK", sio = ["SPI3_D", "SPI3_Q", "SPI3_WP", "SPI3_HD"], cs = ["SPI3_CS0", "SPI3_CS1", "SPI3_CS2"] },
]

[device.spi_slave]
support_status = "partial"
instances = [
    { name = "spi2", sys_instance = "Spi2", sclk = "FSPICLK",  mosi = "FSPID",  miso = "FSPIQ",  cs = "FSPICS0" },
    { name = "spi3", sys_instance = "Spi3", sclk = "SPI3_CLK", mosi = "SPI3_D", miso = "SPI3_Q", cs = "SPI3_CS0" },
]

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

[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.touch]
support_status = "not_supported"

[device.ds]
support_status = "not_supported"

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

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

## Crypto
[device.hmac]

## Interfaces
[device.i2s]
[device.camera]
[device.rgb_display]
[device.ledc]
[device.mcpwm]
[device.pcnt]
[device.sd_host]
[device.twai]
[device.usb_otg]
[device.usb_serial_jtag]

## Miscellaneous
[device.dma]
[device.io_mux]
[device.psram]
[device.sleep]
[device.systimer]
[device.temp_sensor]
[device.ulp_fsm]
[device.ulp_riscv]

## Radio
[device.wifi]

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

[device.phy]
combo_module = true
backed_up_digital_register_count = 21
