wifi: esp32: move kconfig to driver area

Make sure all kconfig related to Wi-Fi is
in its driver area.
This commit also removes esp_timer_init() call
from Wi-Fi driver.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
This commit is contained in:
Sylvio Alves 2024-09-29 17:42:15 -03:00 committed by Mahesh Mahadevan
commit b5c53d6ac4
3 changed files with 93 additions and 54 deletions

View file

@ -175,6 +175,39 @@ config ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM
than WiFi layer can transmit. In these cases, we may run out of TX than WiFi layer can transmit. In these cases, we may run out of TX
buffers. buffers.
choice ESP32_WIFI_MGMT_RX_BUFFER
prompt "Type of WiFi RX MGMT buffers"
default ESP32_WIFI_STATIC_RX_MGMT_BUFFER
help
Select type of WiFi RX MGMT buffers:
If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released
when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes.
If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is
received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver.
config ESP32_WIFI_STATIC_RX_MGMT_BUFFER
bool "Static"
config ESP32_WIFI_DYNAMIC_RX_MGMT_BUFFER
bool "Dynamic"
endchoice
config ESP32_WIFI_DYNAMIC_RX_MGMT_BUF
int
default 0 if ESP32_WIFI_STATIC_RX_MGMT_BUFFER
default 1 if ESP32_WIFI_DYNAMIC_RX_MGMT_BUFFER
config ESP32_WIFI_RX_MGMT_BUF_NUM_DEF
int "Max number of WiFi RX MGMT buffers"
range 1 10
default 5
help
Set the number of WiFi RX_MGMT buffers.
For Management buffers, the number of dynamic and static management buffers is the same.
In order to prevent memory fragmentation, the management buffer type should be set to static first.
config ESP32_WIFI_CSI_ENABLED config ESP32_WIFI_CSI_ENABLED
bool "WiFi CSI(Channel State Information)" bool "WiFi CSI(Channel State Information)"
default n default n
@ -234,6 +267,13 @@ config ESP32_WIFI_AMSDU_TX_ENABLED
help help
Select this option to enable AMSDU TX feature Select this option to enable AMSDU TX feature
config ESP32_WIFI_MGMT_SBUF_NUM
int "WiFi mgmt short buffer number"
range 6 32
default 32
help
Set the number of WiFi management short buffer.
config ESP32_WIFI_IRAM_OPT config ESP32_WIFI_IRAM_OPT
bool "WiFi IRAM speed optimization" bool "WiFi IRAM speed optimization"
default n if (BT && ESP_SPIRAM && SOC_SERIES_ESP32) default n if (BT && ESP_SPIRAM && SOC_SERIES_ESP32)
@ -251,10 +291,62 @@ config ESP32_WIFI_RX_IRAM_OPT
When this option is disabled, more than 17Kbytes of IRAM memory will be saved When this option is disabled, more than 17Kbytes of IRAM memory will be saved
but Wi-Fi performance will be reduced. but Wi-Fi performance will be reduced.
config ESP32_WIFI_MAX_THREAD_PRIORITY
int "Maximum work queue thread priority"
default 7
help
Maximum priority of thread used for processing driver work queue items.
config ESP32_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME
int "Minimum active time"
range 8 60
default 50
help
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station enters the active state,
it will work for at least ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME. If a data packet is received or sent
during this period, the time will be refreshed. If the time is up, but the station still has packets
to receive or send, the time will also be refreshed. unit: milliseconds.
config ESP32_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME
int "Maximum keep alive time"
range 10 60
default 10
help
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. If no packet has been
sent within ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME, a null data packet will be sent
to maintain the connection with the AP. unit: seconds.
config ESP32_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME
int "Minimum wait broadcast data time"
range 10 30
default 15
help
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station knows through the beacon
that AP will send broadcast packet, it will wait for ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME
before entering the sleep process. If a broadcast packet is received with more data bits, the time
will refreshed. unit: milliseconds.
choice ESP_WIFI_HEAP
prompt "Wifi adapter heap in use"
default ESP_WIFI_HEAP_RUNTIME
config ESP_WIFI_HEAP_RUNTIME
bool "Wifi adapter use ESP runtime heap"
depends on ESP_HEAP_RUNTIME
config ESP_WIFI_HEAP_SPIRAM
bool "Wifi adapter use SPIRAM heap"
depends on ESP_SPIRAM
config ESP_WIFI_HEAP_SYSTEM
bool "Wifi adapter use system heap"
endchoice # ESP_WIFI_HEAP
config ESP32_WIFI_FTM_ENABLE config ESP32_WIFI_FTM_ENABLE
bool "WiFi FTM" bool "WiFi FTM"
default n default n
depends on SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 depends on SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 || SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3
help help
Enable feature Fine Timing Measurement for calculating WiFi Round-Trip-Time (RTT). Enable feature Fine Timing Measurement for calculating WiFi Round-Trip-Time (RTT).

View file

@ -871,7 +871,6 @@ static int esp32_wifi_dev_init(const struct device *dev)
adc2_init_code_calibration(); adc2_init_code_calibration();
#endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */ #endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */
esp_timer_init();
wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT(); wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT();
esp_err_t ret = esp_wifi_init(&config); esp_err_t ret = esp_wifi_init(&config);
@ -883,7 +882,6 @@ static int esp32_wifi_dev_init(const struct device *dev)
LOG_ERR("Unable to initialize the Wi-Fi: %d", ret); LOG_ERR("Unable to initialize the Wi-Fi: %d", ret);
return -EIO; return -EIO;
} }
if (IS_ENABLED(CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4)) { if (IS_ENABLED(CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4)) {
net_mgmt_init_event_callback(&esp32_dhcp_cb, wifi_event_handler, DHCPV4_MASK); net_mgmt_init_event_callback(&esp32_dhcp_cb, wifi_event_handler, DHCPV4_MASK);
net_mgmt_add_event_callback(&esp32_dhcp_cb); net_mgmt_add_event_callback(&esp32_dhcp_cb);

View file

@ -1,51 +0,0 @@
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_ESPRESSIF_ESP32
menu "ESP32 Wi-Fi config"
config ESP_WIFI_MAX_THREAD_PRIORITY
int "Maximum work queue thread priority"
default 7
help
Maximum priority of thread used for processing driver work queue items.
config ESP32_WIFI_TIMER_TASK_PRIO
int "Wi-Fi timer task priority"
default 2
range 0 ESP_WIFI_MAX_THREAD_PRIORITY
config ESP32_PHY_MAX_WIFI_TX_POWER
int "Max Wi-Fi/BLE TX power (dBm)"
range 10 20
default 20
help
Set maximum transmit power for Wi-Fi radio. Actual transmit power for high
data rates may be lower than this setting.
config ESP32_PHY_MAX_TX_POWER
int
default ESP32_PHY_MAX_WIFI_TX_POWER
choice ESP_WIFI_HEAP
prompt "Wifi adapter heap in use"
default ESP_WIFI_HEAP_RUNTIME
config ESP_WIFI_HEAP_RUNTIME
bool "Wifi adapter use ESP runtime heap"
depends on ESP_HEAP_RUNTIME
config ESP_WIFI_HEAP_SPIRAM
bool "Wifi adapter use SPIRAM heap"
depends on ESP_SPIRAM
config ESP_WIFI_HEAP_SYSTEM
bool "Wifi adapter use system heap"
endchoice # ESP_WIFI_HEAP
endmenu # ESP32 Wi-Fi config
endif # SOC_FAMILY_ESPRESSIF_ESP32