Skip to content

Commit

Permalink
xtensa/esp32s3: use common Espressif wireless source
Browse files Browse the repository at this point in the history
Update the wireless symbols from ESP32S3_* to ESPRESSIF_* for using common layer.
Remove ESP32S3 specific WiFi files and edit build system to use common layer.
  • Loading branch information
fdcavalcanti committed Feb 13, 2025
1 parent 05ec313 commit 0a8f349
Show file tree
Hide file tree
Showing 41 changed files with 279 additions and 5,054 deletions.
50 changes: 49 additions & 1 deletion arch/xtensa/src/common/espressif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,10 @@ config ESPRESSIF_WIRELESS
select ESP32S2_RNG if ARCH_CHIP_ESP32S2
select ESP32S2_RT_TIMER if ARCH_CHIP_ESP32S2
select ESP32S2_TIMER0 if ARCH_CHIP_ESP32S2
depends on ARCH_CHIP_ESP32S2
select ESP32S3_RNG if ARCH_CHIP_ESP32S3
select ESP32S3_RT_TIMER if ARCH_CHIP_ESP32S3
select ESP32S3_TIMER0 if ARCH_CHIP_ESP32S3
depends on ARCH_CHIP_ESP32S2 || ARCH_CHIP_ESP32S3
---help---
Enable Wireless support

Expand All @@ -524,6 +527,32 @@ config ESPRESSIF_WIFI
---help---
Enable Wi-Fi support

config ESPRESSIF_BLE
bool "BLE"
depends on ARCH_CHIP_ESP32S3
default n
select ESPRESSIF_WIRELESS
---help---
Enable BLE support.

config ESP_COEX_SW_COEXIST_ENABLE
bool "Software WiFi/Bluetooth/IEEE 802.15.4 coexistence"
depends on (ESPRESSIF_WIFI && ESPRESSIF_BLE)
default y
---help---
If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware.
Recommended for heavy traffic scenarios. Both coexistence configuration options are
automatically managed, no user intervention is required.
If only Bluetooth is used, it is recommended to disable this option to reduce binary file
size.

menuconfig ESPRESSIF_WIFI_BT_COEXIST
bool "Wi-Fi and BT coexist"
default y if ESPRESSIF_WIFI && ESPRESSIF_BLE
default n
depends on ESPRESSIF_WIFI && ESPRESSIF_BLE
select ESPRESSIF_WIFI_STA_DISCONNECT_PM

menu "Wi-Fi Configuration"
depends on ESPRESSIF_WIFI

Expand Down Expand Up @@ -692,3 +721,22 @@ config ESPRESSIF_WIFI_LISTEN_INTERVAL
to beacon is 300 ms.

endmenu # ESPRESSIF_WIFI

menu "BLE Configuration"
depends on ESPRESSIF_BLE

config ESPRESSIF_BLE_TASK_STACK_SIZE
int "Controller task stack size"
default 4096

config ESPRESSIF_BLE_TASK_PRIORITY
int "Controller task priority"
default 253

config ESPRESSIF_BLE_INTERRUPT_SAVE_STATUS
int "Number of interrupt save status"
default 3
---help---
Number of interrupt save status variables to keep track. Increase it if any related bug is found.

endmenu # BLE Configuration
11 changes: 11 additions & 0 deletions arch/xtensa/src/common/espressif/Wireless.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,24 @@
#
############################################################################

ifeq ($(CONFIG_ARCH_CHIP_ESP32S3),y)
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)bt$(DELIM)include$(DELIM)esp32c3$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_coex$(DELIM)include
endif
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)$(CHIP_SERIES)$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)include$(DELIM)esp_wifi

ifeq ($(CONFIG_ARCH_CHIP_ESP32S3),y)
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)bt$(DELIM)controller$(DELIM)lib_esp32c3_family$(DELIM)$(CHIP_SERIES)
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_coex$(DELIM)lib$(DELIM)$(CHIP_SERIES)
endif
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)lib$(DELIM)$(CHIP_SERIES)
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_wifi$(DELIM)lib$(DELIM)$(CHIP_SERIES)

ifeq ($(CONFIG_ARCH_CHIP_ESP32S3),y)
EXTRA_LIBS += -lcoexist
endif
EXTRA_LIBS += -lphy

ifeq ($(CONFIG_ESPRESSIF_WIFI),y)
Expand Down
3 changes: 3 additions & 0 deletions arch/xtensa/src/common/espressif/esp_wifi_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#ifdef CONFIG_ARCH_CHIP_ESP32S2
#include "esp32s2_wifi_adapter.h"
#endif
#ifdef CONFIG_ARCH_CHIP_ESP32S3
#include "esp32s3_wifi_adapter.h"
#endif

#include "esp_wifi_utils.h"
#include "esp_wireless.h"
Expand Down
3 changes: 3 additions & 0 deletions arch/xtensa/src/common/espressif/esp_wlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#ifdef CONFIG_ARCH_CHIP_ESP32S2
# include "esp32s2_wifi_adapter.h"
#endif
#ifdef CONFIG_ARCH_CHIP_ESP32S3
# include "esp32s3_wifi_adapter.h"
#endif

#ifndef __ASSEMBLY__

Expand Down
225 changes: 2 additions & 223 deletions arch/xtensa/src/esp32s3/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -655,31 +655,6 @@ config ESP32S3_UART2
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_BLE
bool "BLE"
default n
select ESP32S3_WIRELESS
---help---
Enable BLE support

config ESP32S3_I2C0
bool "I2C 0"
default n
Expand Down Expand Up @@ -822,13 +797,6 @@ config ESP32S3_AES_ACCELERATOR

endmenu # ESP32-S3 Peripheral Selection

menuconfig ESP32S3_WIFI_BT_COEXIST
bool "Wi-Fi and BT coexist"
default y if ESP32S3_WIFI && ESP32S3_BLE
default n
depends on ESP32S3_WIFI && ESP32S3_BLE
select ESP32S3_WIFI_STA_DISCONNECT_PM

menu "Interrupt Configuration"

config ESP32S3_IRAM_ISR_DEBUG
Expand Down Expand Up @@ -1494,180 +1462,10 @@ config ESP32S3_TWAI_REGDEBUG

endmenu #ESP32S3_TWAI

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 ESP_WIFI_ENABLE_SAE_PK
bool "Enable SAE-PK"
default y
---help---
Select this option to enable SAE-PK

config ESP_WIFI_ENABLE_WPA3_OWE_STA
bool "Enable OWE STA"
default y
---help---
Select this option to allow the device to establish OWE connection with eligible AP's.
PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be
explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide for details.

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 ESP32S3_WLAN_PKTBUF_NUM
int "WLAN netcard packet buffer number per netcard"
default 16

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_STA_DISCONNECT_PM
bool "Power Management for station when disconnected"
default y
---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.

choice ESP32S3_POWER_SAVE_MODE
prompt "Wi-Fi Power save mode"
default ESP32S3_POWER_SAVE_MIN_MODEM if ESP32S3_WIFI_BT_COEXIST
default ESP32S3_POWER_SAVE_NONE
---help---
Wi-Fi supports the Modem-sleep mode which refers to the legacy power-saving mode in the IEEE 802.11 protocol.
Modem-sleep mode works in station-only mode and the station must connect to the AP first. If the Modem-sleep
mode is enabled, station will switch between active and sleep state periodically. In sleep state, RF, PHY and
BB are turned off in order to reduce power consumption. Station can keep connection with AP in modem-sleep mode.

Modem-sleep mode includes minimum and maximum power-saving modes.

In minimum power-saving mode, station wakes
up every DTIM to receive beacon. Broadcast data will not be lost because it is transmitted after DTIM.
However, it cannot save much more power if DTIM is short for DTIM is determined by AP.

In maximum power-saving mode, station wakes up in every listen interval to receive beacon. This listen interval
can be set to be longer than the AP DTIM period. Broadcast data may be lost because station may be in sleep
state at DTIM time. If listen interval is longer, more power is saved, but broadcast data is more easy to lose.
Listen interval can be configured by setting ESP32S3_WIFI_LISTEN_INTERVAL.

ESP32S3_POWER_SAVE_NONE disables Modem-sleep mode entirely. Disabling it increases power consumption, but
minimizes the delay in receiving Wi-Fi data in real time. When Modem-sleep mode is enabled, the delay in
receiving Wi-Fi data may be the same as the DTIM cycle (minimum power-saving mode) or the listening interval
(maximum power-saving mode). Setting ESP32S3_POWER_SAVE_NONE is suitable when high throughput is required.

config ESP32S3_POWER_SAVE_NONE
bool "No power save"

config ESP32S3_POWER_SAVE_MIN_MODEM
bool "Minimum modem power saving."

config ESP32S3_POWER_SAVE_MAX_MODEM
bool "Maximum modem power saving"

endchoice # ESP32S3_POWER_SAVE_MODE

config ESP32S3_WIFI_LISTEN_INTERVAL
int "Wi-Fi listen interval"
depends on ESP32S3_POWER_SAVE_MAX_MODEM
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

config ESP32S3_OPENETH
bool "Opencores Ethernet MAC"
default n
depends on !ESP32S3_WIFI
depends on !ESPRESSIF_WIFI
select NET
select SCHED_WORKQUEUE
---help---
Expand All @@ -1685,29 +1483,10 @@ config ESP32S3_OPENETH_DMA_RX_BUFFER_NUM

endif # ESP32S3_OPENETH

menu "BLE Configuration"
depends on ESP32S3_BLE

config ESP32S3_BLE_TASK_STACK_SIZE
int "Controller task stack size"
default 4096

config ESP32S3_BLE_TASK_PRIORITY
int "Controller task priority"
default 253

config ESP32S3_BLE_INTERRUPT_SAVE_STATUS
int "Number of interrupt save status"
default 3
---help---
Number of interrupt save status variables to keep track. Increase it if any related bug is found.

endmenu # BLE Configuration

choice ESP32S3_UNIVERSAL_MAC_ADDRESSES
bool "Number of universally administered (by IEEE) MAC address"
default ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR
depends on ESP32S3_WIFI || ESP32S3_BLE
depends on ESPRESSIF_WIFI || ESPRESSIF_BLE
---help---
Configure the number of universally administered (by IEEE) MAC addresses.
During initialization, MAC addresses for each network interface are generated or derived from a
Expand Down
Loading

0 comments on commit 0a8f349

Please sign in to comment.