diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 97ddaec4ea..61321761e1 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -84,9 +84,8 @@ else() idf_component_get_property(esp_wifi_remote esp_wifi_remote COMPONENT_LIB) target_link_libraries(${COMPONENT_LIB} PUBLIC ${esp_wifi_remote}) endif() - - if(CONFIG_SPIRAM) - idf_component_optional_requires(PRIVATE esp_psram) - endif() - +endif() + +if(CONFIG_SPIRAM) + idf_component_optional_requires(PRIVATE esp_psram) endif() diff --git a/components/esp_wifi/include/esp_private/esp_wifi_he_private.h b/components/esp_wifi/include/esp_private/esp_wifi_he_private.h index ffa191de19..9a3f81b63d 100644 --- a/components/esp_wifi/include/esp_private/esp_wifi_he_private.h +++ b/components/esp_wifi/include/esp_private/esp_wifi_he_private.h @@ -6,6 +6,9 @@ #pragma once +#include "sdkconfig.h" +#if CONFIG_SOC_WIFI_HE_SUPPORT + #include #include #include "esp_err.h" @@ -201,3 +204,5 @@ esp_err_t esp_wifi_sta_set_bss_color_collision_detection(int threshold, int dura #ifdef __cplusplus } #endif + +#endif // CONFIG_SOC_WIFI_HE_SUPPORT diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index 241c18fe52..66e9724e11 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -183,6 +183,7 @@ typedef struct { #endif extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; +extern wifi_osi_funcs_t g_wifi_osi_funcs; #define WIFI_INIT_CONFIG_MAGIC 0x1F2F3F4F 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 7a4d167b64..f3c43a4733 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 @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -13,6 +13,19 @@ extern "C" { #endif + +#ifndef ESP_WIFI_MAX_CONN_NUM +// 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 +#define ESP_WIFI_MAX_CONN_NUM (15) +typedef struct wifi_sta_list_t wifi_sta_list_t; +#else +#error WiFi header mismatch! Please make sure you use the correct version of WiFi API +#endif +#endif // ESP_WIFI_MAX_CONN_NUM + /** * @brief station list structure */ diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index e7b35ef41e..8fa0123881 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -8,6 +8,9 @@ #ifndef __ESP_WIFI_TYPES_H__ #define __ESP_WIFI_TYPES_H__ +#include +#include +#include "sdkconfig.h" #include "esp_event_base.h" #include "esp_interface.h" @@ -430,6 +433,15 @@ typedef struct { uint8_t payload[0]; /**< Payload. Length is equal to value in 'length' field, minus 4. */ } vendor_ie_data_t; +/** + * @brief Forward declare the Rx ctrl packet struct, as it is TARGET dependent and will be defined + * in the "native" wifi types (types tightly coupled to wifi-lib implementation) + */ +typedef struct wifi_pkt_rx_ctrl_t wifi_pkt_rx_ctrl_t; + +/** + * @brief Rx Control Packet alias used in wifi-lib implementation + */ typedef struct wifi_pkt_rx_ctrl_t esp_wifi_rxctrl_t; /** diff --git a/components/esp_wifi/include/local/esp_wifi_native.h b/components/esp_wifi/include/local/esp_wifi_native.h index 8edd780364..326597e4c7 100644 --- a/components/esp_wifi/include/local/esp_wifi_native.h +++ b/components/esp_wifi/include/local/esp_wifi_native.h @@ -7,10 +7,14 @@ #pragma once #include "sdkconfig.h" +#include "esp_wifi_types_generic.h" #if CONFIG_SOC_WIFI_HE_SUPPORT #include "esp_wifi_he_types.h" #endif +#ifdef __cplusplus +extern "C" { +#endif #if CONFIG_IDF_TARGET_ESP32C2 #define ESP_WIFI_MAX_CONN_NUM (4) /**< max number of stations which can connect to ESP32C2 soft-AP */ @@ -78,20 +82,11 @@ typedef struct wifi_pkt_rx_ctrl_t{ unsigned :12; /**< reserved */ unsigned rx_state:8; /**< state of the packet. 0: no error; others: error numbers which are not public */ } wifi_pkt_rx_ctrl_t; -#endif - -/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback. - */ -typedef struct { - wifi_pkt_rx_ctrl_t rx_ctrl; /**< metadata header */ - uint8_t payload[0]; /**< Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback. */ -} wifi_promiscuous_pkt_t; /** * @brief Channel state information(CSI) configuration type * */ -#if !CONFIG_SOC_WIFI_HE_SUPPORT typedef struct wifi_csi_config_t{ bool lltf_en; /**< enable to receive legacy long training field(lltf) data. Default enabled */ bool htltf_en; /**< enable to receive HT long training field(htltf) data. Default enabled */ @@ -106,6 +101,13 @@ typedef struct wifi_csi_config_t{ typedef wifi_pkt_rx_ctrl_t esp_wifi_rxctrl_t; +/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback. + */ +typedef struct { + wifi_pkt_rx_ctrl_t rx_ctrl; /**< metadata header */ + uint8_t payload[0]; /**< Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback. */ +} wifi_promiscuous_pkt_t; + /** * @brief CSI data type * @@ -121,3 +123,7 @@ typedef struct wifi_csi_info_t { uint8_t *payload; /**< payload of the wifi packet */ uint16_t payload_len; /**< payload len of the wifi packet */ } wifi_csi_info_t; + +#ifdef __cplusplus +} +#endif diff --git a/components/wpa_supplicant/CMakeLists.txt b/components/wpa_supplicant/CMakeLists.txt index ea6e78ef9f..9e7d1c042d 100644 --- a/components/wpa_supplicant/CMakeLists.txt +++ b/components/wpa_supplicant/CMakeLists.txt @@ -6,6 +6,13 @@ else() set(linker_fragments linker.lf) endif() +if(NOT CONFIG_ESP_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) + return() +endif() + set(srcs "port/os_xtensa.c" "port/eloop.c" "src/ap/ap_config.c" diff --git a/examples/protocols/.build-test-rules.yml b/examples/protocols/.build-test-rules.yml index 643365c9c8..43502efc2a 100644 --- a/examples/protocols/.build-test-rules.yml +++ b/examples/protocols/.build-test-rules.yml @@ -114,9 +114,9 @@ examples/protocols/https_mbedtls: examples/protocols/https_request: <<: *default_dependencies disable: - - if: IDF_TARGET == "esp32p4" + - if: IDF_TARGET in ["esp32h2", "esp32p4"] temporary: true - reason: not supported on p4 # TODO: IDF-8076 + reason: not supported on p4 and h2 # TODO: IDF-8076 (P4), IDF-9076 (H2) disable_test: - if: IDF_TARGET != "esp32" reason: only test on esp32 diff --git a/examples/protocols/https_request/README.md b/examples/protocols/https_request/README.md index 55b32b1669..3e2cc244c0 100644 --- a/examples/protocols/https_request/README.md +++ b/examples/protocols/https_request/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | # HTTPS Request Example 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 b8dbaea2c8..8f286ddb5f 100644 --- a/examples/system/console/advanced/components/cmd_wifi/cmd_wifi.c +++ b/examples/system/console/advanced/components/cmd_wifi/cmd_wifi.c @@ -24,6 +24,11 @@ #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; @@ -134,3 +139,5 @@ void register_wifi(void) ESP_ERROR_CHECK( esp_console_cmd_register(&join_cmd) ); } + +#endif // CONFIG_SOC_WIFI_SUPPORTED diff --git a/examples/wifi/iperf/main/cmd_wifi.c b/examples/wifi/iperf/main/cmd_wifi.c index c5c110b677..88b862d1fc 100644 --- a/examples/wifi/iperf/main/cmd_wifi.c +++ b/examples/wifi/iperf/main/cmd_wifi.c @@ -23,7 +23,6 @@ #include "iperf.h" #include "esp_coexist.h" #include "wifi_cmd.h" -#include "esp_wifi_he.h" typedef struct { struct arg_str *ip;