fix(esp_wifi): Support for esp_wifi_remote

This commit is contained in:
David Cermak 2023-11-24 16:28:05 +01:00
parent c0b3af2292
commit 344cb342b8
11 changed files with 69 additions and 20 deletions

View File

@ -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()

View File

@ -6,6 +6,9 @@
#pragma once
#include "sdkconfig.h"
#if CONFIG_SOC_WIFI_HE_SUPPORT
#include <stdint.h>
#include <stdbool.h>
#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

View File

@ -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

View File

@ -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
*/

View File

@ -8,6 +8,9 @@
#ifndef __ESP_WIFI_TYPES_H__
#define __ESP_WIFI_TYPES_H__
#include <stdbool.h>
#include <stddef.h>
#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;
/**

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;