diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 9f0c5106cc..02b0c411e7 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -4,6 +4,22 @@ if(${idf_target} STREQUAL "linux") return() # This component is not supported by the POSIX/Linux simulator endif() +if( NOT CONFIG_ESP_WIFI_ENABLED + AND NOT CONFIG_ESP_HOST_WIFI_ENABLED + AND NOT CMAKE_BUILD_EARLY_EXPANSION ) + # No local wifi: provide only netif bindings + set(srcs + "src/wifi_default.c" + "src/wifi_netif.c" + "src/wifi_default_ap.c") + + # This component provides "esp_wifi" "wifi_apps/nan_app" headers if WiFi not enabled + # (implementation supported optionally in a managed component esp_wifi_remote) + idf_component_register(SRCS "${srcs}" + INCLUDE_DIRS "include" "wifi_apps/nan_app/include") + return() +endif() + if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED) if(CONFIG_APP_NO_BLOBS) @@ -42,19 +58,10 @@ if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED) if(CONFIG_ESP_WIFI_ENABLE_ROAMING_APP) list(APPEND srcs "wifi_apps/roaming_app/src/roaming_app.c") endif() - set(local_include_dirs include/local) -else() - # No local wifi: provide only netif bindings - set(srcs - "src/wifi_default.c" - "src/wifi_netif.c" - "src/wifi_default_ap.c") - set(local_include_dirs) - endif() idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "include" "wifi_apps/include" "wifi_apps/nan_app/include" ${local_include_dirs} + INCLUDE_DIRS "include" "include/local" "wifi_apps/include" "wifi_apps/nan_app/include" REQUIRES esp_event esp_phy esp_netif PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash diff --git a/components/esp_wifi/Kconfig b/components/esp_wifi/Kconfig index 09adabf747..ee53be255a 100644 --- a/components/esp_wifi/Kconfig +++ b/components/esp_wifi/Kconfig @@ -1,7 +1,6 @@ menu "Wi-Fi" - # TODO: Disable WIFI support on ESP32-H2 (WIFI-5796) - # visible if SOC_WIFI_SUPPORTED + visible if (SOC_WIFI_SUPPORTED || SOC_WIRELESS_HOST_SUPPORTED) config ESP_WIFI_ENABLED bool diff --git a/components/esp_wifi/include/esp_now.h b/components/esp_wifi/include/esp_now.h index 60b5cd9ee4..e0261375bb 100644 --- a/components/esp_wifi/include/esp_now.h +++ b/components/esp_wifi/include/esp_now.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -93,15 +93,8 @@ typedef struct esp_now_recv_info { /** * @brief ESPNOW rate config - * */ -typedef struct esp_now_rate_config { - wifi_phy_mode_t phymode; /**< ESPNOW phymode of specified interface */ - wifi_phy_rate_t rate; /**< ESPNOW rate of specified interface */ - bool ersu; /**< ESPNOW using ERSU to send frame, ERSU is a transmission mode related to 802.11 ax. - ERSU is always used in long distance transmission, and its frame has lower rate compared with SU mode */ - bool dcm; /**< ESPNOW using dcm rate to send frame */ -} esp_now_rate_config_t; +typedef wifi_tx_rate_config_t esp_now_rate_config_t; /** * @brief Callback function of receiving ESPNOW data diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index 286036e40a..fa9c40e868 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -1529,6 +1529,7 @@ esp_err_t esp_wifi_get_country_code(char *country); * @brief Config 80211 tx rate of specified interface * * @attention 1. This API should be called after esp_wifi_init() and before esp_wifi_start(). + * @attention 2. Can not set 80211 tx rate under 11A/11AC/11AX protocol, you can use esp_wifi_config_80211_tx instead. * * @param ifx Interface to be configured. * @param rate Phy rate to be configured. @@ -1539,6 +1540,21 @@ esp_err_t esp_wifi_get_country_code(char *country); */ esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); +/** + * @brief Config 80211 tx rate and phymode of specified interface + * + * @attention 1. This API should be called after esp_wifi_init() and before esp_wifi_start(). + + * + * @param ifx Interface to be configured. + * @param config rate_config to be configured. + * + * @return + * - ESP_OK: succeed + * - others: failed + */ +esp_err_t esp_wifi_config_80211_tx(wifi_interface_t ifx, wifi_tx_rate_config_t *config); + /** * @brief Disable PMF configuration for specified interface * diff --git a/components/esp_wifi/include/esp_wifi_ap_get_sta_list.h b/components/esp_wifi/include/esp_wifi_ap_get_sta_list.h index 812c4ea04d..fc539184eb 100644 --- a/components/esp_wifi/include/esp_wifi_ap_get_sta_list.h +++ b/components/esp_wifi/include/esp_wifi_ap_get_sta_list.h @@ -17,7 +17,7 @@ extern "C" { // Number of maximum wifi connection may be undefined if we have no native wifi support on this target // and at the same time there's no native interface injected by the wifi_remote component. // In this case, we just let the header compilable, since no wifi API could be used (let's make a sanity check) -#if !CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_ESP_WIFI_REMOTE_ENABLED +#if !CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_ESP_WIFI_REMOTE_ENABLED && !CONFIG_ESP_HOST_WIFI_ENABLED #define ESP_WIFI_MAX_CONN_NUM (15) typedef struct wifi_sta_list_t wifi_sta_list_t; #else diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index d57ee0d4df..e2472a57dc 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -1213,6 +1213,17 @@ typedef enum { WIFI_BAND_2G_5G = 3, /* Band is 2,4G + 5G */ } wifi_band_t; +/** + * @brief Argument structure for wifi_tx_rate_config + */ +typedef struct { + wifi_phy_mode_t phymode; /**< Phymode of specified interface */ + wifi_phy_rate_t rate; /**< Rate of specified interface */ + bool ersu; /**< Using ERSU to send frame, ERSU is a transmission mode related to 802.11 ax. + ERSU is always used in long distance transmission, and its frame has lower rate compared with SU mode */ + bool dcm; /**< Using dcm rate to send frame */ +} wifi_tx_rate_config_t; + #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 19143aa249..4ecb60fcbb 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 19143aa24991ff1624d8098508d039e89edc4172 +Subproject commit 4ecb60fcbb3ce42e207df15e114c66c22f43e6b6 diff --git a/components/wifi_provisioning/CMakeLists.txt b/components/wifi_provisioning/CMakeLists.txt index 96cfdd5665..a52aa26f3d 100644 --- a/components/wifi_provisioning/CMakeLists.txt +++ b/components/wifi_provisioning/CMakeLists.txt @@ -4,6 +4,15 @@ if(${target} STREQUAL "linux") return() # This component is not supported by the POSIX/Linux simulator endif() +if( NOT CONFIG_ESP_WIFI_ENABLED + AND NOT CONFIG_ESP_HOST_WIFI_ENABLED + AND NOT CMAKE_BUILD_EARLY_EXPANSION ) + # This component provides only "esp_provisioning" headers if WiFi not enabled + # (implementation supported optionally in a managed component esp_wifi_remote) + idf_component_register(INCLUDE_DIRS include) + return() +endif() + set(srcs "src/wifi_config.c" "src/wifi_scan.c" "src/wifi_ctrl.c" diff --git a/components/wifi_provisioning/Kconfig b/components/wifi_provisioning/Kconfig index d5a7d7aa36..d7f657d69a 100644 --- a/components/wifi_provisioning/Kconfig +++ b/components/wifi_provisioning/Kconfig @@ -1,5 +1,5 @@ menu "Wi-Fi Provisioning Manager" - + visible if (SOC_WIFI_SUPPORTED || SOC_WIRELESS_HOST_SUPPORTED) config WIFI_PROV_SCAN_MAX_ENTRIES int "Max Wi-Fi Scan Result Entries" default 16 diff --git a/components/wpa_supplicant/CMakeLists.txt b/components/wpa_supplicant/CMakeLists.txt index ec704fa60e..3d18f97af5 100644 --- a/components/wpa_supplicant/CMakeLists.txt +++ b/components/wpa_supplicant/CMakeLists.txt @@ -6,7 +6,9 @@ else() set(linker_fragments linker.lf) endif() -if(NOT CONFIG_ESP_WIFI_ENABLED AND NOT CONFIG_ESP_HOST_WIFI_ENABLED AND NOT CMAKE_BUILD_EARLY_EXPANSION) +if( NOT CONFIG_ESP_WIFI_ENABLED + AND NOT CONFIG_ESP_HOST_WIFI_ENABLED + AND NOT CMAKE_BUILD_EARLY_EXPANSION ) # This component provides only "esp_supplicant" headers if WiFi not enabled # (implementation supported optionally in a managed component esp_wifi_remote) idf_component_register(INCLUDE_DIRS esp_supplicant/include) diff --git a/examples/common_components/protocol_examples_common/Kconfig.projbuild b/examples/common_components/protocol_examples_common/Kconfig.projbuild index 8310d62ac1..25fb188d7d 100644 --- a/examples/common_components/protocol_examples_common/Kconfig.projbuild +++ b/examples/common_components/protocol_examples_common/Kconfig.projbuild @@ -4,7 +4,7 @@ menu "Example Connection Configuration" config EXAMPLE_CONNECT_WIFI bool "connect using WiFi interface" - depends on !IDF_TARGET_LINUX && (SOC_WIFI_SUPPORTED || ESP_WIFI_REMOTE_ENABLED) + depends on !IDF_TARGET_LINUX && (SOC_WIFI_SUPPORTED || ESP_WIFI_REMOTE_ENABLED || ESP_HOST_WIFI_ENABLED) default y if SOC_WIFI_SUPPORTED help Protocol examples can use Wi-Fi, Ethernet and/or Thread to connect to the network. diff --git a/examples/system/console/advanced/components/cmd_wifi/CMakeLists.txt b/examples/system/console/advanced/components/cmd_wifi/CMakeLists.txt index ca51905567..fd42b546b6 100644 --- a/examples/system/console/advanced/components/cmd_wifi/CMakeLists.txt +++ b/examples/system/console/advanced/components/cmd_wifi/CMakeLists.txt @@ -1,3 +1,9 @@ -idf_component_register(SRCS "cmd_wifi.c" +if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED) + set(srcs "cmd_wifi.c") +else() + set(srcs) +endif() + +idf_component_register(SRCS "${srcs}" INCLUDE_DIRS . REQUIRES console esp_wifi) diff --git a/examples/system/console/advanced/components/cmd_wifi/cmd_wifi.c b/examples/system/console/advanced/components/cmd_wifi/cmd_wifi.c index 8f286ddb5f..58a39106b3 100644 --- a/examples/system/console/advanced/components/cmd_wifi/cmd_wifi.c +++ b/examples/system/console/advanced/components/cmd_wifi/cmd_wifi.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -24,11 +24,6 @@ #include "esp_event.h" #include "cmd_wifi.h" -/** - * This component will be supported using esp_wifi_remote - */ -#if CONFIG_SOC_WIFI_SUPPORTED - #define JOIN_TIMEOUT_MS (10000) static EventGroupHandle_t wifi_event_group; @@ -139,5 +134,3 @@ void register_wifi(void) ESP_ERROR_CHECK( esp_console_cmd_register(&join_cmd) ); } - -#endif // CONFIG_SOC_WIFI_SUPPORTED diff --git a/examples/system/console/advanced/main/console_example_main.c b/examples/system/console/advanced/main/console_example_main.c index 6b63324b7c..042efb56d2 100644 --- a/examples/system/console/advanced/main/console_example_main.c +++ b/examples/system/console/advanced/main/console_example_main.c @@ -174,7 +174,7 @@ void app_main(void) #if SOC_DEEP_SLEEP_SUPPORTED register_system_deep_sleep(); #endif -#if SOC_WIFI_SUPPORTED +#if (CONFIG_ESP_WIFI_ENABLED || CONFIG_ESP_HOST_WIFI_ENABLED) register_wifi(); #endif register_nvs(); diff --git a/examples/system/console/basic/main/console_example_main.c b/examples/system/console/basic/main/console_example_main.c index c0bacf0b1d..3ab666bff5 100644 --- a/examples/system/console/basic/main/console_example_main.c +++ b/examples/system/console/basic/main/console_example_main.c @@ -97,7 +97,7 @@ void app_main(void) #if SOC_DEEP_SLEEP_SUPPORTED register_system_deep_sleep(); #endif -#if SOC_WIFI_SUPPORTED +#if (CONFIG_ESP_WIFI_ENABLED || CONFIG_ESP_HOST_WIFI_ENABLED) register_wifi(); #endif register_nvs();