#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_CHIP_ESP32S3

comment "ESP32-S3 Configuration Options"

choice
	prompt "ESP32-S3 Chip Selection"
	default ARCH_CHIP_ESP32S3WROOM1

config ARCH_CHIP_ESP32S3WROOM1
	bool "ESP32-S3-WROOM-1"
	select ESP32S3_FLASH_4M
	select ARCH_HAVE_I2CRESET
	---help---
		Generic module with an embedded ESP32-S3.

config ARCH_CHIP_ESP32S3WROOM2
	bool "ESP32-S3-WROOM-2"
	select ESP32S3_FLASH_16M
	select ESP32S3_PSRAM_8M
	select ARCH_HAVE_I2CRESET
	---help---
		Generic module with an embedded ESP32-S3.

config ARCH_CHIP_ESP32S3MINI1
	bool "ESP32-S3-MINI-1"
	select ESP32S3_FLASH_8M
	select ARCH_HAVE_I2CRESET
	---help---
		Generic module with an embedded ESP32-S3.

endchoice # ESP32-S3 Chip Selection

choice ESP32S3_DEFAULT_CPU_FREQ
	prompt "CPU frequency"
	default ESP32S3_DEFAULT_CPU_FREQ_240
	---help---
		CPU frequency to be set on application startup.

	config ESP32S3_DEFAULT_CPU_FREQ_80
		bool "80 MHz"

	config ESP32S3_DEFAULT_CPU_FREQ_160
		bool "160 MHz"

	config ESP32S3_DEFAULT_CPU_FREQ_240
		bool "240 MHz"

endchoice # CPU frequency

config ESP32S3_DEFAULT_CPU_FREQ_MHZ
	int
	default 80 if ESP32S3_DEFAULT_CPU_FREQ_80
	default 160 if ESP32S3_DEFAULT_CPU_FREQ_160
	default 240 if ESP32S3_DEFAULT_CPU_FREQ_240

menu "Cache configuration"

choice
	prompt "Instruction cache size"
	default ESP32S3_INSTRUCTION_CACHE_16KB
	---help---
		Instruction cache size to be set on application startup.
		If you use 16KB instruction cache rather than 32KB instruction cache,
		then the other 16KB will be managed by heap allocator.

config ESP32S3_INSTRUCTION_CACHE_16KB
	bool "16KB"
	---help---
		Use 16KB of SRAM as Instruction Cache

config ESP32S3_INSTRUCTION_CACHE_32KB
	bool "32KB"
	---help---
		Use 32KB of SRAM as Instruction Cache

endchoice # Instruction cache size

config ESP32S3_INSTRUCTION_CACHE_SIZE
	hex
	default 0x4000 if ESP32S3_INSTRUCTION_CACHE_16KB
	default 0x8000 if ESP32S3_INSTRUCTION_CACHE_32KB

choice ESP32S3_ICACHE_ASSOCIATED_WAYS
	prompt "Instruction cache associated ways"
	default ESP32S3_INSTRUCTION_CACHE_8WAYS
	---help---
		Instruction cache associated ways to be set on application startup.

	config ESP32S3_INSTRUCTION_CACHE_4WAYS
		bool "4 ways"

	config ESP32S3_INSTRUCTION_CACHE_8WAYS
		bool "8 ways"

endchoice

config ESP32S3_ICACHE_ASSOCIATED_WAYS
	int
	default 4 if ESP32S3_INSTRUCTION_CACHE_4WAYS
	default 8 if ESP32S3_INSTRUCTION_CACHE_8WAYS

choice ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
	prompt "Instruction cache line size"
	default ESP32S3_INSTRUCTION_CACHE_LINE_32B
	---help---
		Instruction cache line size to be set on application startup.

	config ESP32S3_INSTRUCTION_CACHE_LINE_16B
		bool "16 Bytes"
		depends on ESP32S3_INSTRUCTION_CACHE_16KB

	config ESP32S3_INSTRUCTION_CACHE_LINE_32B
		bool "32 Bytes"

endchoice

config ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
	int
	default 16 if ESP32S3_INSTRUCTION_CACHE_LINE_16B
	default 32 if ESP32S3_INSTRUCTION_CACHE_LINE_32B

choice
	prompt "Data cache size"
	default ESP32S3_DATA_CACHE_32KB
	---help---
		Data cache size to be set on application startup.
		If you use 32KB data cache rather than 64KB data cache,
		the other 32KB will be added to the heap.

config ESP32S3_DATA_CACHE_16KB
	bool "16KB"
	---help---
		Use 16KB of SRAM as Data Cache

config ESP32S3_DATA_CACHE_32KB
	bool "32KB"
	---help---
		Use 32KB of SRAM as Data Cache

config ESP32S3_DATA_CACHE_64KB
	bool "64KB"
	---help---
		Use 64KB of SRAM as Data Cache

endchoice # Data cache size

config ESP32S3_DATA_CACHE_SIZE
	hex
	# For 16KB the actual configuration is 32kb cache, but 16kb will be reserved for heap at startup
	default 0x8000 if ESP32S3_DATA_CACHE_16KB
	default 0x8000 if ESP32S3_DATA_CACHE_32KB
	default 0x10000 if ESP32S3_DATA_CACHE_64KB

choice ESP32S3_DCACHE_ASSOCIATED_WAYS
	prompt "Data cache associated ways"
	default ESP32S3_DATA_CACHE_8WAYS
	---help---
		Data cache associated ways to be set on application startup.

	config ESP32S3_DATA_CACHE_4WAYS
		bool "4 ways"

	config ESP32S3_DATA_CACHE_8WAYS
		bool "8 ways"

endchoice

config ESP32S3_DCACHE_ASSOCIATED_WAYS
	int
	default 4 if ESP32S3_DATA_CACHE_4WAYS
	default 8 if ESP32S3_DATA_CACHE_8WAYS

choice ESP32S3_DATA_CACHE_LINE_SIZE
	prompt "Data cache line size"
	default ESP32S3_DATA_CACHE_LINE_32B
	---help---
		Data cache line size to be set on application startup.

	config ESP32S3_DATA_CACHE_LINE_16B
		bool "16 Bytes"
		depends on ESP32S3_DATA_CACHE_16KB || ESP32S3_DATA_CACHE_32KB

	config ESP32S3_DATA_CACHE_LINE_32B
		bool "32 Bytes"

	config ESP32S3_DATA_CACHE_LINE_64B
		bool "64 Bytes"

endchoice

config ESP32S3_DATA_CACHE_LINE_SIZE
	int
	default 16 if ESP32S3_DATA_CACHE_LINE_16B
	default 32 if ESP32S3_DATA_CACHE_LINE_32B
	default 64 if ESP32S3_DATA_CACHE_LINE_64B

endmenu # Cache config

config ESP32S3_ULP_COPROC_ENABLED
	bool "Enable Ultra Low Power (ULP) Coprocessor"
	default n
	---help---
		Set to 'y' if you plan to load a firmware for the coprocessor.

config ESP32S3_ULP_COPROC_RESERVE_MEM
	int
	prompt "RTC slow memory reserved for coprocessor" if ESP32S3_ULP_COPROC_ENABLED
	default 512 if ESP32S3_ULP_COPROC_ENABLED
	range 32 8176 if ESP32S3_ULP_COPROC_ENABLED
	default 0 if !ESP32S3_ULP_COPROC_ENABLED
	range 0 0 if !ESP32S3_ULP_COPROC_ENABLED
	help
		Bytes of memory to reserve for ULP coprocessor firmware & data.
		Data is reserved at the beginning of RTC slow memory.

config ESP32S3_FLASH_4M
	bool
	default n

config ESP32S3_FLASH_8M
	bool
	default n

config ESP32S3_FLASH_16M
	bool
	default n

config ESP32S3_ESPTOOLPY_NO_STUB
	bool "Disable download stub"
	default n
	---help---
		The flasher tool sends a precompiled download stub first by default.
		That stub allows things like compressed downloads and more.
		Usually you should not need to disable that feature.
		It is only required to be disabled in certain scenarios when either
		Secure Boot V2 or Flash Encryption is enabled.

config ESP32S3_FLASH_DETECT
	bool "Auto-detect FLASH size"
	default y
	---help---
		Auto detect flash size when flashing.

config ESP32S3_PSRAM_8M
	bool
	default n

config ESP32S3_RUN_IRAM
	bool "Run from IRAM"
	default n
	---help---
		This loads all of NuttX inside IRAM. Used to test somewhat small
		images that can fit entirely in IRAM.

menu "ESP32-S3 Peripheral Selection"

config ESP32S3_UART
	bool
	default n

config ESP32S3_TIMER
	bool
	default n

config ESP32S3_I2C
	bool
	default n

config ESP32S3_SPI
	bool
	default n

config ESP32S3_WDT
	bool
	default n

config ESP32S3_EFUSE
	bool "EFUSE support"
	default n
	---help---
		Enable ESP32-S3 efuse support.

config ESP32S3_RNG
	bool "Random Number Generator (RNG)"
	default n
	select ARCH_HAVE_RNG
	---help---
		ESP32-S3 supports a RNG that passed on Dieharder test suite.

config ESP32S3_SPIRAM
	bool "SPI RAM Support"
	default n

config ESP32S3_SPI2
	bool "SPI 2"
	default n
	select ESP32S3_SPI
	select SPI

config ESP32S3_SPI3
	bool "SPI 3"
	default n
	select ESP32S3_SPI
	select SPI

config ESP32S3_DMA
	bool "General DMA (GDMA)"
	default n
	select ARCH_DMA

config ESP32S3_UART0
	bool "UART 0"
	default n
	select ESP32S3_UART
	select UART0_SERIALDRIVER
	select ARCH_HAVE_SERIAL_TERMIOS

config ESP32S3_UART1
	bool "UART 1"
	default n
	select ESP32S3_UART
	select UART1_SERIALDRIVER
	select ARCH_HAVE_SERIAL_TERMIOS

config ESP32S3_UART2
	bool "UART 2"
	default n
	select ESP32S3_UART
	select UART2_SERIALDRIVER
	select ARCH_HAVE_SERIAL_TERMIOS

config ESP32S3_WIRELESS
	bool
	default n
	select NET
	select ARCH_PHY_INTERRUPT
	select ESP32S3_RNG
	select ESP32S3_RT_TIMER
	select ESP32S3_TIMER0
	---help---
		Enable Wireless support

config ESP32S3_WIFI
	bool "Wi-Fi"
	default n
	select ESP32S3_WIRELESS
	---help---
		Enable Wi-Fi support

config ESP32S3_I2C0
	bool "I2C 0"
	default n
	select ESP32S3_I2C
	select I2C

config ESP32S3_I2C1
	bool "I2C 1"
	default n
	select ESP32S3_I2C
	select I2C

config ESP32S3_LEDC
	bool "LEDC (PWM)"
	default n
	select PWM
	select ARCH_HAVE_PWM_MULTICHAN
	---help---
		Enable support to PWM on ESP32S3 using LEDC peripheral.


config ESP32S3_USBSERIAL
	bool "USB-Serial Driver"
	default n
	select OTHER_UART_SERIALDRIVER
	select ARCH_HAVE_SERIAL_TERMIOS

config ESP32S3_TIMER0
	bool "54-bit Timer 0 (Group 0 Timer 0)"
	default n
	select ESP32S3_TIMER
	---help---
		Enables Timer 0

config ESP32S3_TIMER1
	bool "54-bit Timer 1 (Group 0 Timer 1)"
	default n
	select ESP32S3_TIMER
	---help---
		Enables Timer 1

config ESP32S3_TIMER2
	bool "54-bit Timer 2 (Group 1 Timer 0)"
	default n
	select ESP32S3_TIMER
	---help---
		Enables Timer 2

config ESP32S3_TIMER3
	bool "54-bit Timer 3 (Group 1 Timer 1)"
	default n
	select ESP32S3_TIMER
	---help---
		Enables Timer 3

config ESP32S3_MWDT0
	bool "Main System Watchdog Timer (Group 0)"
	default n
	select ESP32S3_WDT
	---help---
		Includes MWDT0. This watchdog timer is part of the Group 0
		timer submodule.

config ESP32S3_MWDT1
	bool "Main System Watchdog Timer (Group 1)"
	default n
	select ESP32S3_WDT
	---help---
		Includes MWDT1. This watchdog timer is part of the Group 0
		timer submodule.

config ESP32S3_RWDT
	bool "RTC Watchdog Timer"
	default n
	select ESP32S3_WDT
	select ESP32S3_RTCIO_IRQ
	---help---
		Includes RWDT. This watchdog timer is from the RTC module.
		When it is selected, if the developer sets it to reset on expiration
		it will reset Main System and the RTC module. If you don't want
		to have the RTC module reset, please, use the Timers' Module WDTs.
		They will only reset Main System.

config ESP32S3_RT_TIMER
	bool "Real-Time Timer"
	default n
	---help---
		Real-Time Timer is relying upon the Systimer 1.

config ESP32S3_WCL
	bool "World Controller"
	default n
	select ARCH_USE_MPU
	select XTENSA_HAVE_GENERAL_EXCEPTION_HOOKS if BUILD_PROTECTED

endmenu # ESP32-S3 Peripheral Selection

menu "SPI RAM Configuration"
	depends on ESP32S3_SPIRAM

choice ESP32S3_SPIRAM_MODE
	prompt "Mode (QUAD/OCT) of SPI RAM chip"
	default ESP32S3_SPIRAM_MODE_QUAD

config ESP32S3_SPIRAM_MODE_QUAD
	bool "Quad Mode PSRAM"

config ESP32S3_SPIRAM_MODE_OCT
	bool "Octal Mode PSRAM"

endchoice # ESP32S3_SPIRAM_MODE

config ESP32S3_DEFAULT_PSRAM_CLK_IO
	int "PSRAM CLK pin"
	default 30

config ESP32S3_DEFAULT_PSRAM_CS_IO
	int "PSRAM CS pin"
	default 26

choice ESP32S3_SPIRAM_TYPE
	prompt "Type of SPI RAM chip in use"
	default ESP32S3_SPIRAM_TYPE_AUTO

config ESP32S3_SPIRAM_TYPE_AUTO
	bool "Auto-detect"

config ESP32S3_SPIRAM_TYPE_ESPPSRAM16
	bool "ESP-PSRAM16 or APS1604"

config ESP32S3_SPIRAM_TYPE_ESPPSRAM32
	bool "ESP-PSRAM32 or IS25WP032"

config ESP32S3_SPIRAM_TYPE_ESPPSRAM64
	bool "ESP-PSRAM64, LY68L6400 or APS6408"

endchoice # ESP32S3_SPIRAM_TYPE

config ESP32S3_SPIRAM_SIZE
	int
	default -1 if ESP32S3_SPIRAM_TYPE_AUTO
	default 2097152 if ESP32S3_SPIRAM_TYPE_ESPPSRAM16
	default 4194304 if ESP32S3_SPIRAM_TYPE_ESPPSRAM32
	default 8388608 if ESP32S3_SPIRAM_TYPE_ESPPSRAM64
	default 16777216 if ESP32S3_SPIRAM_TYPE_ESPPSRAM128
	default 33554432 if ESP32S3_SPIRAM_TYPE_ESPPSRAM256
	default 0

config ESP32S3_SPIRAM_FETCH_INSTRUCTIONS
	bool "Cache fetch instructions from SPI RAM"
	default n
	---help---
		If enabled, instruction in flash will be copied into SPIRAM.
		If ESP32S3_SPIRAM_RODATA is also enabled, you can run the instruction
		when erasing or programming the flash.

config ESP32S3_SPIRAM_RODATA
	bool "Cache load read only data from SPI RAM"
	default n
	---help---
		If enabled, rodata in flash will be copied into SPIRAM.
		If ESP32S3_SPIRAM_FETCH_INSTRUCTIONS is also enabled,
		you can run the instruction when erasing or programming the
		flash.

choice ESP32S3_SPIRAM_SPEED
	prompt "Set RAM clock speed"
	default ESP32S3_SPIRAM_SPEED_40M
	---help---
		Select the speed for the SPI RAM chip.

config ESP32S3_SPIRAM_SPEED_40M
	bool "40MHz clock speed"

config ESP32S3_SPIRAM_SPEED_80M
	bool "80MHz clock speed"

config ESP32S3_SPIRAM_SPEED_120M
	bool "120MHz clock speed"

endchoice # ESP32S3_SPIRAM_SPEED

config ESP32S3_SPIRAM_SPEED
	int
	default 120 if ESP32S3_SPIRAM_SPEED_120M
	default 80 if ESP32S3_SPIRAM_SPEED_80M
	default 40 if ESP32S3_SPIRAM_SPEED_40M

config ESP32S3_SPIRAM_BOOT_INIT
	bool "Initialize SPI RAM during startup"
	depends on ESP32S3_SPIRAM
	default y
	---help---
		If this is enabled, the SPI RAM will be enabled during initial
		boot. Unless you have specific requirements, you'll want to leave
		this enabled so memory allocated during boot-up can also be
		placed in SPI RAM.

config ESP32S3_SPIRAM_IGNORE_NOTFOUND
	bool "Ignore PSRAM when not found"
	default n
	depends on ESP32S3_SPIRAM_BOOT_INIT && !BOOT_SDRAM_DATA
	---help---
		Normally, if psram initialization is enabled during compile time
		but not found at runtime, it is seen as an error making the CPU
		panic. If this is enabled, booting will complete but no PSRAM
		will be available.

endmenu # SPI RAM Configuration

config ESP32S3_GPIO_IRQ
	bool "GPIO pin interrupts"
	default n
	---help---
		Enable support for interrupting GPIO pins.

config ESP32S3_RTCIO_IRQ
	bool "RTC IO interrupts"
	default n
	---help---
		Enable support for RTC peripherals interrupts.


menu "SPI configuration"
	depends on ESP32S3_SPI

config ESP32S3_SPI_SWCS
	bool "SPI software CS"
	default n
	---help---
		Use SPI software CS.

config ESP32S3_SPI_UDCS
	bool "User defined CS"
	default n
	depends on ESP32S3_SPI_SWCS
	---help---
		Use user-defined CS.

if ESP32S3_SPI2

config ESP32S3_SPI2_DMA
	bool "SPI2 use GDMA"
	default n
	depends on ESP32S3_DMA
	---help---
		Enable support for transfers using the GDMA engine.

config ESP32S3_SPI2_DMADESC_NUM
	int "SPI2 Master GDMA maximum number of descriptors"
	default 2
	depends on ESP32S3_SPI2_DMA
	---help---
		Configure the maximum number of out-link/in-link descriptors to
		be chained for a GDMA transfer.

config ESP32S3_SPI2_DMATHRESHOLD
	int "SPI2 Master GDMA threshold"
	default 64
	depends on ESP32S3_SPI2_DMA
	---help---
		When SPI GDMA is enabled, GDMA transfers whose size are below the
		defined threshold will be performed by polling logic.

config ESP32S3_SPI2_CSPIN
	int "SPI2 CS Pin"
	default 10
	range 0 48

config ESP32S3_SPI2_CLKPIN
	int "SPI2 CLK Pin"
	default 12
	range 0 48

config ESP32S3_SPI2_MOSIPIN
	int "SPI2 MOSI Pin"
	default 11
	range 0 48

config ESP32S3_SPI2_MISOPIN
	int "SPI2 MISO Pin"
	default 13
	range 0 48

endif # ESP32S3_SPI2

if ESP32S3_SPI3

config ESP32S3_SPI3_CSPIN
	int "SPI3 CS Pin"
	default 10
	range 0 48

config ESP32S3_SPI3_CLKPIN
	int "SPI3 CLK Pin"
	default 6
	range 0 48

config ESP32S3_SPI3_MOSIPIN
	int "SPI3 MOSI Pin"
	default 7
	range 0 48

config ESP32S3_SPI3_MISOPIN
	int "SPI3 MISO Pin"
	default 2
	range 0 48

endif # ESP32S3_SPI3

endmenu # SPI configuration

menu "UART Configuration"
	depends on ESP32S3_UART

if ESP32S3_UART0

config ESP32S3_UART0_TXPIN
	int "UART0 Tx Pin"
	default 43
	range 0 48

config ESP32S3_UART0_RXPIN
	int "UART0 Rx Pin"
	default 44
	range 0 48

config ESP32S3_UART0_RTSPIN
	int "UART0 RTS Pin"
	depends on SERIAL_IFLOWCONTROL
	default 15
	range 0 48

config ESP32S3_UART0_CTSPIN
	int "UART0 CTS Pin"
	depends on SERIAL_OFLOWCONTROL
	default 16
	range 0 48

endif # ESP32S3_UART0

if ESP32S3_UART1

config ESP32S3_UART1_TXPIN
	int "UART1 Tx Pin"
	default 17
	range 0 48

config ESP32S3_UART1_RXPIN
	int "UART1 Rx Pin"
	default 18
	range 0 48

config ESP32S3_UART1_RTSPIN
	int "UART1 RTS Pin"
	depends on SERIAL_IFLOWCONTROL
	default 19
	range 0 48

config ESP32S3_UART1_CTSPIN
	int "UART1 CTS Pin"
	depends on SERIAL_OFLOWCONTROL
	default 20
	range 0 48

endif # ESP32S3_UART1

if ESP32S3_UART2

config ESP32S3_UART2_TXPIN
	int "UART2 Tx Pin"
	default 17
	range 0 48

config ESP32S3_UART2_RXPIN
	int "UART2 Rx Pin"
	default 16
	range 0 48

config ESP32S3_UART2_RTSPIN
	int "UART2 RTS Pin"
	depends on SERIAL_IFLOWCONTROL
	default 35
	range 0 48

config ESP32S3_UART2_CTSPIN
	int "UART2 CTS Pin"
	depends on SERIAL_OFLOWCONTROL
	default 36
	range 0 48

endif # ESP32S3_UART2

endmenu # UART Configuration

menu "I2C Configuration"
	depends on ESP32S3_I2C

if ESP32S3_I2C0

config ESP32S3_I2C0_SCLPIN
	int "I2C0 SCL Pin"
	default 2
	range 0 48

config ESP32S3_I2C0_SDAPIN
	int "I2C0 SDA Pin"
	default 1
	range 0 48

endif # ESP32S3_I2C0

if ESP32S3_I2C1

config ESP32S3_I2C1_SCLPIN
	int "I2C1 SCL Pin"
	default 5
	range 0 48

config ESP32S3_I2C1_SDAPIN
	int "I2C1 SDA Pin"
	default 4
	range 0 48

endif # ESP32S3_I2C1

config ESP32S3_I2CTIMEOSEC
	int "Timeout seconds"
	default 0

config ESP32S3_I2CTIMEOMS
	int "Timeout milliseconds"
	default 500

endmenu # I2C Configuration

menu "Wi-Fi Configuration"
	depends on ESP32S3_WIFI

menu "ESP WPA-Supplicant"

config WPA_WAPI_PSK
	bool "Enable WAPI PSK support"
	default n
	---help---
		Select this option to enable WAPI-PSK
		which is a Chinese National Standard Encryption for Wireless LANs (GB 15629.11-2003).

config WPA_SUITE_B_192
	bool "Enable NSA suite B support with 192-bit key"
	default n
	select ESP_WIFI_GCMP_SUPPORT
	select ESP_WIFI_GMAC_SUPPORT
	---help---
		Select this option to enable 192-bit NSA suite-B.
		This is necessary to support WPA3 192-bit security.

config ESP_WPA_DEBUG_PRINT
	bool "Print debug messages from Espressif's WPA Supplicant"
	default n
	---help---
		Select this option to print logging information from WPA supplicant,
		this includes handshake information and key hex dumps depending
		on the project logging level.

		Enabling this could increase the build size ~60kb
		depending on the project logging level.

endmenu # ESP WPA-Supplicant

choice
	prompt "ESP32S3 Wi-Fi mode"
	default ESP32S3_WIFI_STATION

config ESP32S3_WIFI_STATION
	bool "Station mode"

config ESP32S3_WIFI_SOFTAP
	bool "SoftAP mode"

config ESP32S3_WIFI_STATION_SOFTAP
	bool "Station + SoftAP"

endchoice # ESP32S3 Wi-Fi mode

config ESP32S3_WIFI_STATIC_RXBUF_NUM
	int "Wi-Fi static RX buffer number"
	default 10

config ESP32S3_WIFI_DYNAMIC_RXBUF_NUM
	int "Wi-Fi dynamic RX buffer number"
	default 32

config ESP32S3_WIFI_DYNAMIC_TXBUF_NUM
	int "Wi-Fi dynamic TX buffer number"
	default 32

config ESP32S3_WIFI_TX_AMPDU
	bool "Wi-Fi TX AMPDU"
	default y

config ESP32S3_WIFI_RX_AMPDU
	bool "Wi-Fi RX AMPDU"
	default y

config ESP32S3_WIFI_RXBA_AMPDU_WZ
	int "Wi-Fi RX BA AMPDU windown size"
	default 6

config ESP_WIFI_GCMP_SUPPORT
    bool "WiFi GCMP Support(GCMP128 and GCMP256)"
    default n
    ---help---
        Select this option to enable GCMP support. GCMP support is compulsory for WiFi Suite-B support.

config ESP_WIFI_GMAC_SUPPORT
    bool "WiFi GMAC Support(GMAC128 and GMAC256)"
    default n
    ---help---
        Select this option to enable GMAC support. GMAC support is compulsory for WiFi 192-bit certification.

config ESP32S3_WIFI_CONNECT_TIMEOUT
	int "Connect timeout in second"
	default 10
	---help---
		Max waiting time of connecting to AP.

config ESP32S3_WIFI_SCAN_RESULT_SIZE
	int "Scan result buffer"
	default 4096
	---help---
		Maximum scan result buffer size.

config ESP32S3_WIFI_SAVE_PARAM
	bool "Save Wi-Fi Parameters"
	default n
	depends on ESP32S3_SPIFLASH
	---help---
		If you enable this option, Wi-Fi adapter parameters will be saved
		into the file system instead of computing them each time.

		These parameters mainly contains:
			- SSID
			- Password
			- BSSID
			- PMK(compute when connecting)
			- Author mode
			- MAC address
			- Wi-Fi hardware configuration parameters

config ESP32S3_WIFI_FS_MOUNTPT
	string "Wi-Fi parameters mount point"
	default "/mnt/esp/wifi"
	depends on ESP32S3_WIFI_SAVE_PARAM
	---help---
		Mount point of Wi-Fi storage file system.

config ESP32S3_WIFI_MTD_ENCRYPT
	bool "Encrypt Wi-Fi MTD partition"
	default y
	depends on ESP32S3_SECURE_FLASH_ENC_ENABLED

config ESP32S3_WIFI_MTD_OFFSET
	hex "Wi-Fi MTD partition offset"
	default 0x280000 if !ESP32S3_HAVE_OTA_PARTITION
	default 0x350000 if ESP32S3_HAVE_OTA_PARTITION
	depends on ESP32S3_WIFI_SAVE_PARAM
	---help---
		This is the base address of the Wi-Fi MTD partition.

config ESP32S3_WIFI_MTD_SIZE
	hex "Wi-Fi MTD partition size"
	default 0xb0000
	depends on ESP32S3_WIFI_SAVE_PARAM
	---help---
		This is the size of the Wi-Fi MTD partition.

config ESP32S3_WIFI_STA_DISCONNECT_PM
	bool "Power Management for station when disconnected"
	default n
	---help---
		Select this option to enable power management for station when disconnected.
		Chip will do modem-sleep when RF module is not in use anymore.

config EXAMPLE_WIFI_LISTEN_INTERVAL
	int "Wi-Fi listen interval"
	default 3
	---help---
		Interval for station to listen to beacon from AP. The unit of listen interval is one beacon interval.
		For example, if beacon interval is 100 ms and listen interval is 3, the interval for station to listen
		to beacon is 300 ms.

endmenu # ESP32S3_WIFI

menu "Timer/Counter Configuration"
	depends on ESP32S3_TIMER

config ESP32S3_ONESHOT
	bool "One-shot wrapper"
	default n
	---help---
		Enable a wrapper around the low level timer/counter functions to
		support one-shot timer.

config ESP32S3_FREERUN
	bool "Free-running wrapper"
	default n
	---help---
		Enable a wrapper around the low level timer/counter functions to
		support a free-running timer.

endmenu # Timer/Counter Configuration

menu "Real-Time Timer Configuration"
	depends on ESP32S3_RT_TIMER

config ESP32S3_RT_TIMER_TASK_NAME
	string "Real-Time Timer task name"
	default "rt_timer"

config ESP32S3_RT_TIMER_TASK_PRIORITY
	int "Real-Time Timer task priority"
	default 223
	---help---
		Priority level of the RT Timer task.
		Must be lower than the SCHED_HPWORKPRIORITY.

config ESP32S3_RT_TIMER_TASK_STACK_SIZE
	int "Real-Time Timer task stack size"
	default 2048

endmenu # Real-Time Timer Configuration

config ESP32S3_TICKLESS
	bool "Enable Tickless OS"
	default n
	select ARCH_HAVE_TICKLESS
	select SCHED_TICKLESS

config ESP32S3_SPIFLASH
	bool "SPI Flash MTD Partition"
	default n

menu "SPI Flash configuration"

choice ESP32S3_FLASH_MODE
	prompt "SPI Flash mode"
	default ESP32S3_FLASH_MODE_DIO
	---help---
		These options control how many I/O pins are used for communication
		with the attached SPI Flash chip.
		The option selected here is then used by esptool when flashing.

	config ESP32S3_FLASH_MODE_DIO
		bool "Dual IO (DIO)"

	config ESP32S3_FLASH_MODE_DOUT
		bool "Dual Output (DOUT)"

	config ESP32S3_FLASH_MODE_QIO
		bool "Quad IO (QIO)"

	config ESP32S3_FLASH_MODE_QOUT
		bool "Quad Output (QOUT)"

endchoice # ESP32S3_FLASH_MODE

choice ESP32S3_FLASH_FREQ
	prompt "SPI Flash frequency"
	default ESP32S3_FLASH_FREQ_40M
	---help---
		SPI Flash frequency

	config ESP32S3_FLASH_FREQ_120M
		bool "120 MHz"

	config ESP32S3_FLASH_FREQ_80M
		bool "80 MHz"

	config ESP32S3_FLASH_FREQ_40M
		bool "40 MHz"

	config ESP32S3_FLASH_FREQ_20M
		bool "20 MHz"

endchoice # ESP32S3_FLASH_FREQ

config ESP32S3_HAVE_OTA_PARTITION
	bool
	default n

if ESP32S3_HAVE_OTA_PARTITION

comment "Application Image OTA Update support"

config ESP32S3_OTA_PRIMARY_SLOT_OFFSET
	hex "Application image primary slot offset"
	default 0x10000

config ESP32S3_OTA_PRIMARY_SLOT_DEVPATH
	string "Application image primary slot device path"
	default "/dev/ota0"

config ESP32S3_OTA_SECONDARY_SLOT_OFFSET
	hex "Application image secondary slot offset"
	default 0x110000

config ESP32S3_OTA_SECONDARY_SLOT_DEVPATH
	string "Application image secondary slot device path"
	default "/dev/ota1"

config ESP32S3_OTA_SLOT_SIZE
	hex "Application image slot size (in bytes)"
	default 0x100000

config ESP32S3_OTA_SCRATCH_OFFSET
	hex "Scratch partition offset"
	default 0x210000

config ESP32S3_OTA_SCRATCH_SIZE
	hex "Scratch partition size"
	default 0x40000

config ESP32S3_OTA_SCRATCH_DEVPATH
	string "Scratch partition device path"
	default "/dev/otascratch"

endif

if ESP32S3_SPIFLASH

comment "General storage MTD configuration"

config ESP32S3_MTD
	bool "MTD driver"
	default y
	select MTD
	select MTD_BYTE_WRITE
	select MTD_PARTITION
	---help---
		Initialize an MTD driver for the ESP32-S3 SPI Flash, which will
		add an entry at /dev for application access from userspace.

config ESP32S3_SPIFLASH_MTD_BLKSIZE
	int "Storage MTD block size"
	default 256
	depends on ESP32S3_MTD

config ESP32S3_STORAGE_MTD_DEBUG
	bool "Storage MTD Debug"
	default n
	depends on ESP32S3_MTD && DEBUG_FS_INFO
	---help---
		If this option is enabled, Storage MTD driver read and write functions
		will output input parameters and return values (if applicable).

endif # ESP32S3_SPIFLASH

endmenu # SPI Flash configuration

menu "LEDC Configuration"
	depends on ESP32S3_LEDC

menuconfig ESP32S3_LEDC_TIM0
	bool "Timer 0"
	default n

if ESP32S3_LEDC_TIM0

config ESP32S3_LEDC_TIM0_CHANNELS
	int "Number of Timer 0 channels"
	default 2

endif # ESP32S3_LEDC_TIM0

menuconfig ESP32S3_LEDC_TIM1
	bool "Timer 1"
	default n

if ESP32S3_LEDC_TIM1

config ESP32S3_LEDC_TIM1_CHANNELS
	int "Number of Timer 1 channels"
	default 2

endif # ESP32S3_LEDC_TIM1

menuconfig ESP32S3_LEDC_TIM2
	bool "Timer 2"
	default n

if ESP32S3_LEDC_TIM2

config ESP32S3_LEDC_TIM2_CHANNELS
	int "Number of Timer 2 channels"
	default 2

endif # ESP32S3_LEDC_TIM2

menuconfig ESP32S3_LEDC_TIM3
	bool "Timer 3"
	default n

if ESP32S3_LEDC_TIM3

config ESP32S3_LEDC_TIM3_CHANNELS
	int "Number of Timer 3 channels"
	default 2

endif # ESP32S3_LEDC_TIM2

config ESP32S3_LEDC_CHANNEL0_PIN
	int "Channel 0 pin"
	default 2

config ESP32S3_LEDC_CHANNEL1_PIN
	int "Channel 1 pin"
	default 3

config ESP32S3_LEDC_CHANNEL2_PIN
	int "Channel 2 pin"
	default 4

config ESP32S3_LEDC_CHANNEL3_PIN
	int "Channel 3 pin"
	default 5

config ESP32S3_LEDC_CHANNEL4_PIN
	int "Channel 4 pin"
	default 6

config ESP32S3_LEDC_CHANNEL5_PIN
	int "Channel 5 pin"
	default 7

config ESP32S3_LEDC_CHANNEL6_PIN
	int "Channel 6 pin"
	default 8

config ESP32S3_LEDC_CHANNEL7_PIN
	int "Channel 7 pin"
	default 9

endmenu # LEDC configuration

menu "Application Image Configuration"

choice
	prompt "Application Image Format"
	default ESP32S3_APP_FORMAT_LEGACY
	---help---
		Depending on the chosen 2nd stage bootloader, the application may
		be required to be perform a specific startup routine. Furthermore,
		the image binary must be formatted according to the definition from
		the 2nd stage bootloader.

config ESP32S3_APP_FORMAT_LEGACY
	bool "Legacy format"
	---help---
		This is the legacy application image format, as supported by the ESP-IDF
		2nd stage bootloader.

config ESP32S3_APP_FORMAT_MCUBOOT
	bool "MCUboot-bootable format"
	select ESP32S3_HAVE_OTA_PARTITION
	---help---
		The Espressif port of MCUboot supports the loading of unsegmented firmware
		images.

endchoice # Application Image Format

choice
	prompt "Source for bootloader binaries"
	default ESP32S3_BOOTLOADER_DOWNLOAD_PREBUILT
	---help---
		Select the action to be taken by the build system for the
		"make bootloader" target.

config ESP32S3_BOOTLOADER_DOWNLOAD_PREBUILT
	bool "Download prebuilt binaries"
	---help---
		The build system will download the prebuilt binaries from
		https://github.com/espressif/esp-nuttx-bootloader according to the chosen
		Application Image Format (ESP32S3_APP_FORMAT_LEGACY or ESP32S3_APP_FORMAT_MCUBOOT)

config ESP32S3_BOOTLOADER_BUILD_FROM_SOURCE
	bool "Build binaries from source"
	---help---
		The build system will build all the required binaries from source. It will clone
		the https://github.com/espressif/esp-nuttx-bootloader repository and build a
		custom bootloader according to the chosen Application Image Format
		(ESP32S3_APP_FORMAT_LEGACY or ESP32S3_APP_FORMAT_MCUBOOT) and partition information.

endchoice

choice
	prompt "Target slot for image flashing"
	default ESP32S3_ESPTOOL_TARGET_PRIMARY
	depends on ESP32S3_HAVE_OTA_PARTITION
	---help---
		Slot to which ESPTOOL will flash the generated binary image.

config ESP32S3_ESPTOOL_TARGET_PRIMARY
	bool "Application image primary slot"
	---help---
		This assumes that the generated image is already pre-validated.
		This is the recommended option for the initial stages of the
		application firmware image development.

config ESP32S3_ESPTOOL_TARGET_SECONDARY
	bool "Application image secondary slot"
	---help---
		The application needs to confirm the generated image as valid,
		otherwise the bootloader may consider it invalid and perform the
		rollback of the update after a reset.
		This is the choice most suitable for the development and verification
		of a secure firmware update workflow.

endchoice

config ESP32S3_APP_MCUBOOT_HEADER_SIZE
	int "Application image header size (in bytes)"
	default 32
	depends on ESP32S3_APP_FORMAT_MCUBOOT

config ESP32S3_PARTITION_TABLE_OFFSET
	hex "Partition Table offset"
	default 0x8000
	depends on ESP32S3_APP_FORMAT_LEGACY

if BUILD_PROTECTED

config ESP32S3_USER_IMAGE_OFFSET
	hex "User image offset"
	default 0x90000
	---help---
		Offset in SPI Flash for flashing the User application firmware image.

endif

endmenu # Application Image Configuration

endif # ARCH_CHIP_ESP32S3
