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

peripherals = [
    { name = "AES", interrupts = { peri = "AES" } },
    { name = "APB_SARADC" },
    { name = "DEDICATED_GPIO" },
    { name = "DS" },
    { name = "EFUSE" },
    { name = "EXTMEM" },
    { name = "FE" },
    { name = "FE2" },
    { name = "GPIO" },
    { name = "GPIO_SD" },
    { name = "HMAC" },
    { name = "I2C_ANA_MST" },
    { name = "I2C0", interrupts = { peri = "I2C_EXT0" } },
    { name = "I2C1", interrupts = { peri = "I2C_EXT1" } },
    { name = "I2S0", interrupts = { peri = "I2S0" } },
    { name = "INTERRUPT_CORE0" },
    { name = "IO_MUX" },
    { name = "LEDC" },
    { name = "NRX" },
    { name = "PCNT" },
    { name = "PMS" },
    { name = "RMT" },
    { name = "RNG" },
    { name = "RSA", interrupts = { peri = "RSA" } },
    { name = "LPWR", pac = "RTC_CNTL" },
    { name = "RTC_I2C" },
    { name = "RTC_IO" },
    { name = "SENS" },
    { name = "SHA", interrupts = { peri = "SHA" } },
    { name = "SPI0" },
    { name = "SPI1" },
    { name = "SPI2", interrupts = { peri = "SPI2", dma = "SPI2_DMA" } },
    { name = "SPI3", interrupts = { peri = "SPI3", dma = "SPI3_DMA" } },
    { name = "SYSCON" },
    { name = "SYSTEM" },
    { name = "SYSTIMER" },
    { name = "TIMG0" },
    { name = "TIMG1" },
    { name = "TWAI0" },
    { name = "UART0", interrupts = { peri = "UART0" } },
    { name = "UART1", interrupts = { peri = "UART1" } },
    { name = "UHCI0" },
    { name = "USB0" },
    { name = "USB_WRAP" },
    { name = "XTS_AES" },
    { name = "WIFI" },

    { name = "DMA_SPI2", pac = "SPI2" },
    { name = "DMA_SPI3", pac = "SPI3" },
    { name = "DMA_I2S0", pac = "I2S0" },
    { name = "DMA_CRYPTO", pac = "CRYPTO_DMA" },
    { name = "DMA_COPY", pac = "COPY_DMA" },

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

symbols = [
    # Additional peripherals defined by us (the developers):
    "pdma",
    "phy",
    "psram",
    "psram_dma",
    "ulp_riscv_core",
    "soc_has_copy_dma",
    "soc_has_crypto_dma",

    # ROM capabilities
    "rom_crc_le",
    "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",
    "uart_support_wakeup_int",
    "ulp_supported",
    "riscv_coproc_supported",
]

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

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

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 = "Aes", template_params = { reg_group = "en1", peripheral = "crypto_aes" } },
    { name = "Rsa", template_params = { reg_group = "en1", peripheral = "crypto_rsa" } },
    { name = "Sha", template_params = { reg_group = "en1", peripheral = "crypto_sha" } },
    { name = "Ds", template_params = { reg_group = "en1", peripheral = "crypto_ds" } },
    { name = "Hmac", template_params = { reg_group = "en1", peripheral = "crypto_hmac" } },
    { name = "CryptoDma", template_params = { reg_group = "en1" } },
    
    # The exception: CopyDma needs to be enabled in its own register space and its reset is a bit gnarly
    { name = "CopyDma", template_params = { clk_en_template = "crate::peripherals::DMA_COPY::regs().conf().modify(|_, w| w.clk_en().bit(enable));", rst_template = "crate::peripherals::DMA_COPY::regs().conf().modify(|_, w| { w.in_rst().bit(reset).out_rst().bit(reset).cmdfifo_rst().bit(reset).fifo_rst().bit(reset) });" } },

    #{ name = "Adc2Arb" },
    { name = "Systimer", keep_enabled = true },
    { name = "ApbSarAdc", template_params = { peripheral = "apb_saradc" } },
    { name = "Spi3Dma" },
    #{ name = "Pwm3" },
    #{ name = "Pwm2" },
    { name = "UartMem", keep_enabled = true }, # TODO: keep_enabled can be removed once esp-println needs explicit initialization
    { name = "Usb" },
    { name = "Spi2Dma" },
    { 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 }, # used for clock calibration
    { name = "Uhci1" },
    { name = "Ledc" },
    { name = "Pcnt" },
    { name = "Rmt" },
    { name = "Uhci0" },
    { name = "I2cExt0" },
    { name = "Spi2" },
    { name = "Uart1" },
    { name = "I2s0" },
    { name = "Wdg" },
    { 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 = true
dma = true
dma_mode = ["ECB", "CBC", "OFB", "CTR", "CFB8", "CFB128", "GCM"]
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 = 1
input_signal_max = 204
output_signal_max = 256
constant_0_input = 0x3c
constant_1_input = 0x38
pins = [
    { pin =  0,                                                                                                               rtc = { 0 = "RTC_GPIO0"  } },
    { pin =  1,                                                                analog = { 0 = "TOUCH1",     1 = "ADC1_CH0" }, rtc = { 0 = "RTC_GPIO1"  } },
    { pin =  2,                                                                analog = { 0 = "TOUCH2",     1 = "ADC1_CH1" }, rtc = { 0 = "RTC_GPIO2"  } },
    { pin =  3,                                                                analog = { 0 = "TOUCH3",     1 = "ADC1_CH2" }, rtc = { 0 = "RTC_GPIO3"  } },
    { 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 = { 0 = "DAC_1",      1 = "ADC2_CH6" }, rtc = { 0 = "RTC_GPIO17" } },
    { pin = 18, functions = { 2 = "U1RXD",   3 = "CLK_OUT3" },                 analog = { 0 = "DAC_2",      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"              } },
    { pin = 34, functions = {              2 = "FSPICS0",  3 = "SUBSPICS0"             } },
    { pin = 35, functions = {              2 = "FSPID",    3 = "SUBSPID"               } },
    { pin = 36, functions = {              2 = "FSPICLK",  3 = "SUBSPICLK"             } },
    { pin = 37, functions = {              2 = "FSPIQ",    3 = "SUBSPIQ", 4 = "SPIDQS" } },
    { pin = 38, functions = {              2 = "FSPIWP",   3 = "SUBSPIWP"              } },
    { pin = 39, functions = { 0 = "MTCK",  2 = "CLK_OUT3", 3 = "SUBSPICS1" } },
    { pin = 40, functions = { 0 = "MTDO",  2 = "CLK_OUT2" } },
    { pin = 41, functions = { 0 = "MTDI",  2 = "CLK_OUT1" } },
    { pin = 42, functions = { 0 = "MTMS" } },
    { pin = 43, functions = { 0 = "U0TXD", 2 = "CLK_OUT1" } },
    { pin = 44, functions = { 0 = "U0RXD", 2 = "CLK_OUT2" } },
    { pin = 45 },
    { pin = 46 },
]
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 = 14 },
    { name = "U0CTS",             id = 15 },
    { name = "U0DSR",             id = 16 },
    { name = "U1RXD",             id = 17 },
    { name = "U1CTS",             id = 18 },
    { name = "U1DSR",             id = 21 },
    { name = "I2S0O_BCK",         id = 23 },
    { name = "I2S0O_WS",          id = 25 },
    { name = "I2S0I_BCK",         id = 27 },
    { name = "I2S0I_WS",          id = 28 },
    { name = "I2CEXT0_SCL",       id = 29 },
    { name = "I2CEXT0_SDA",       id = 30 },
    { 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 = "USB_EXTPHY_VP",     id = 61 },
    { name = "USB_EXTPHY_VM",     id = 62 },
    { name = "USB_EXTPHY_RCV",    id = 63 },
    { name = "USB_OTG_IDDIG",     id = 64 },
    { name = "USB_OTG_AVALID",    id = 65 },
    { name = "USB_SRP_BVALID",    id = 66 },
    { name = "USB_OTG_VBUSVALID", id = 67 },
    { name = "USB_SRP_SESSEND",   id = 68 },
    { name = "SPI3_CLK",          id = 72 },
    { name = "SPI3_Q",            id = 73 },
    { name = "SPI3_D",            id = 74 },
    { name = "SPI3_HD",           id = 75 },
    { name = "SPI3_CS0",          id = 76 },
    { 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 = "I2CEXT1_SCL",       id = 95 },
    { name = "I2CEXT1_SDA",       id = 96 },
    { name = "FSPICLK",           id = 108 },
    { name = "FSPIQ",             id = 109 },
    { name = "FSPID",             id = 110 },
    { name = "FSPIHD",            id = 111 },
    { name = "FSPIWP",            id = 112 },
    { name = "FSPIIO4",           id = 113 },
    { name = "FSPIIO5",           id = 114 },
    { name = "FSPIIO6",           id = 115 },
    { name = "FSPIIO7",           id = 116 },
    { name = "FSPICS0",           id = 117 },
    { name = "TWAI_RX",           id = 123 },
    { name = "SUBSPIQ",           id = 127 },
    { name = "SUBSPID",           id = 128 },
    { name = "SUBSPIHD",          id = 129 },
    { name = "SUBSPIWP",          id = 130 },
    { name = "I2S0I_DATA_IN15",   id = 158 },
    { name = "SUBSPID4",          id = 167 },
    { name = "SUBSPID5",          id = 168 },
    { name = "SUBSPID6",          id = 169 },
    { name = "SUBSPID7",          id = 170 },
    { name = "SUBSPIDQS",         id = 171 },
    { name = "PCMFSYNC",          id = 203 },
    { name = "PCMCLK",            id = 204 },

    { name = "PRO_ALONEGPIO_IN0", id = 235 },
    { name = "PRO_ALONEGPIO_IN1", id = 236 },
    { name = "PRO_ALONEGPIO_IN2", id = 237 },
    { name = "PRO_ALONEGPIO_IN3", id = 238 },
    { name = "PRO_ALONEGPIO_IN4", id = 239 },
    { name = "PRO_ALONEGPIO_IN5", id = 240 },
    { name = "PRO_ALONEGPIO_IN6", id = 241 },
    { name = "PRO_ALONEGPIO_IN7", id = 242 },

    { 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 = 14 },
    { name = "U0RTS",            id = 15 },
    { name = "U0DTR",            id = 16 },
    { name = "U1TXD",            id = 17 },
    { name = "U1RTS",            id = 18 },
    { name = "U1DTR",            id = 21 },
    { name = "I2S0O_BCK",        id = 23 },
    { name = "I2S0O_WS",         id = 25 },
    { name = "I2S0I_BCK",        id = 27 },
    { name = "I2S0I_WS",         id = 28 },
    { name = "I2CEXT0_SCL",      id = 29 },
    { name = "I2CEXT0_SDA",      id = 30 },
    { name = "SDIO_TOHOST_INT",  id = 31 },
    { name = "USB_EXTPHY_OEN",   id = 61 },
    { name = "USB_EXTPHY_VPO",   id = 63 },
    { name = "USB_EXTPHY_VMO",   id = 64 },
    { name = "SPI3_CLK",         id = 72 },
    { name = "SPI3_Q",           id = 73 },
    { name = "SPI3_D",           id = 74 },
    { name = "SPI3_HD",          id = 75 },
    { name = "SPI3_CS0",         id = 76 },
    { name = "SPI3_CS1",         id = 77 },
    { name = "SPI3_CS2",         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 = "I2CEXT1_SCL",      id = 95 },
    { name = "I2CEXT1_SDA",      id = 96 },
    { 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 = "FSPICLK",          id = 108 },
    { name = "FSPIQ",            id = 109 },
    { name = "FSPID",            id = 110 },
    { name = "FSPIHD",           id = 111 },
    { name = "FSPIWP",           id = 112 },
    { name = "FSPIIO4",          id = 113 },
    { name = "FSPIIO5",          id = 114 },
    { name = "FSPIIO6",          id = 115 },
    { name = "FSPIIO7",          id = 116 },
    { name = "FSPICS0",          id = 117 },
    { name = "FSPICS1",          id = 118 },
    { name = "FSPICS2",          id = 119 },
    { name = "FSPICS3",          id = 120 },
    { name = "FSPICS4",          id = 121 },
    { name = "FSPICS5",          id = 122 },
    { name = "TWAI_TX",          id = 123 },
    { name = "SUBSPICLK",        id = 126 },
    { name = "SUBSPIQ",          id = 127 },
    { name = "SUBSPID",          id = 128 },
    { name = "SUBSPIHD",         id = 129 },
    { name = "SUBSPIWP",         id = 130 },
    { name = "SUBSPICS0",        id = 131 },
    { name = "SUBSPICS1",        id = 132 },
    { name = "FSPIDQS",          id = 133 },
    { name = "FSPI_HSYNC",       id = 134 },
    { name = "FSPI_VSYNC",       id = 135 },
    { name = "FSPI_DE",          id = 136 },
    { name = "FSPICD",           id = 137 },
    { name = "SPI3_CD",          id = 139 },
    { name = "SPI3_DQS",         id = 140 },
    { name = "I2S0O_DATA_OUT23", id = 166 },
    { name = "SUBSPID4",         id = 167 },
    { name = "SUBSPID5",         id = 168 },
    { name = "SUBSPID6",         id = 169 },
    { name = "SUBSPID7",         id = 170 },
    { name = "SUBSPIDQS",        id = 171 },
    { name = "PCMFSYNC",         id = 209 },
    { name = "PCMCLK",           id = 210 },

    { name = "PRO_ALONEGPIO_OUT0", id = 235 },
    { name = "PRO_ALONEGPIO_OUT1", id = 236 },
    { name = "PRO_ALONEGPIO_OUT2", id = 237 },
    { name = "PRO_ALONEGPIO_OUT3", id = 238 },
    { name = "PRO_ALONEGPIO_OUT4", id = 239 },
    { name = "PRO_ALONEGPIO_OUT5", id = 240 },
    { name = "PRO_ALONEGPIO_OUT6", id = 241 },
    { name = "PRO_ALONEGPIO_OUT7", id = 242 },

    { name = "CLK_I2S",          id = 251 },

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

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

    { 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 = 0x1ffff
has_hw_bus_clear = false
fifo_size = 32
has_bus_timeout_enable = true
max_bus_timeout = 0xFFFFFF
separate_filter_config_registers = true
has_arbitration_en = 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 = 0x3f416400
channel_ram_size = 64
channels = ["RxTx", "RxTx", "RxTx", "RxTx"]
has_tx_immediate_stop = true
has_tx_loop_count = true
has_tx_carrier_data_only = true
has_tx_sync = true
has_rx_demodulation = true
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 = 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"], 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" },
]
ram_size = 128

[device.rgb_display] # via SPI and I2S
support_status = "not_supported"

[device.camera] # via I2S
support_status = "not_supported"

[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.ledc]
[device.pcnt]
[device.twai]
[device.usb_otg]

## 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.phy]
