feat(wifi): Sync public header files between ESP-IDF and Wi-Fi driver

- Updated WiFi libraries based on the IDF changes
- Renamed esp_wifi_native.h to esp_wifi_types_native.h
- Reverted forward declarations of native wifi types and HE types
- Forward declare as opaque structs only if we don't have native types (csi and ctrl_packet types)
This commit is contained in:
Sarvesh Bodakhe 2024-01-23 16:08:14 +05:30 committed by David Cermak
parent 344cb342b8
commit 0154e81d87
8 changed files with 39 additions and 32 deletions

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -40,7 +40,7 @@ enum {
/**
* @brief Channel state information(CSI) configuration type
*/
typedef struct wifi_csi_config_t {
typedef struct {
uint32_t enable : 1; /**< enable to acquire CSI */
uint32_t acquire_csi_legacy : 1; /**< enable to acquire L-LTF when receiving a 11g PPDU */
uint32_t acquire_csi_ht20 : 1; /**< enable to acquire HT-LTF when receiving an HT20 PPDU */
@ -56,7 +56,7 @@ typedef struct wifi_csi_config_t {
uint32_t val_scale_cfg : 2; /**< value 0-3 */
uint32_t dump_ack_en : 1; /**< enable to dump 802.11 ACK frame, default disabled */
uint32_t reserved : 19; /**< reserved */
} wifi_csi_config_t;
} wifi_csi_acquire_config_t;
/**
* @brief HE variant HT Control field including UPH(UL power headroom) and OM(Operation mode)
@ -139,7 +139,7 @@ typedef enum {
/**
* @brief RxControl Info
*/
typedef struct wifi_pkt_rx_ctrl_t {
typedef struct {
signed rssi : 8; /**< the RSSI of the reception frame */
unsigned rate : 5; /**< if cur_bb_format is RX_BB_FORMAT_11B, it's the transmission rate. otherwise it's Rate field of L-SIG */
unsigned : 1; /**< reserved */
@ -201,7 +201,7 @@ typedef struct wifi_pkt_rx_ctrl_t {
unsigned : 2; /**< reserved */
unsigned rx_state : 8; /**< reception state, 0: successful, others: failure */
unsigned : 24; /**< reserved */
} __attribute__((packed)) wifi_pkt_rx_ctrl_t;
} __attribute__((packed)) esp_wifi_rxctrl_t;
/** Argument structure for WIFI_EVENT_TWT_SET_UP event */
typedef struct {

View File

@ -6,6 +6,24 @@
#pragma once
#include "esp_wifi_types_generic.h"
#if __has_include("esp_wifi_native.h")
#include "esp_wifi_native.h"
#if __has_include("esp_wifi_types_native.h")
#include "esp_wifi_types_native.h"
#else
#ifdef __cplusplus
extern "C" {
#endif
/*
* In case we have no native types, we can still provide opaque structs,
* so the most common APIs could work and others would compile.
* This could happen for chipsets with no wifi, yet without local esp_wifi_remote.
*/
typedef struct wifi_csi_config_t wifi_csi_config_t;
typedef struct wifi_pkt_rx_ctrl_t wifi_pkt_rx_ctrl_t;
#ifdef __cplusplus
}
#endif
#endif // __has_include("esp_wifi_types_native.h")

View File

@ -433,17 +433,6 @@ 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;
/**
* @brief Promiscuous frame type
*
@ -487,12 +476,6 @@ typedef struct {
#define WIFI_EVENT_MASK_NONE (0) /**< mask none of the WiFi events */
#define WIFI_EVENT_MASK_AP_PROBEREQRECVED (BIT(0)) /**< mask SYSTEM_EVENT_AP_PROBEREQRECVED event */
/**
* @brief Channel state information(CSI) configuration type
*
*/
typedef struct wifi_csi_config_t wifi_csi_config_t;
/**
* @brief CSI data type
*

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -30,9 +30,11 @@ typedef struct wifi_sta_list_t {
int num; /**< number of stations in the list (other entries are invalid) */
} wifi_sta_list_t;
#if !CONFIG_SOC_WIFI_HE_SUPPORT
#if CONFIG_SOC_WIFI_HE_SUPPORT
typedef esp_wifi_rxctrl_t wifi_pkt_rx_ctrl_t;
#else
/** @brief Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers */
typedef struct wifi_pkt_rx_ctrl_t{
typedef struct {
signed rssi:8; /**< Received Signal Strength Indicator(RSSI) of packet. unit: dBm */
unsigned rate:5; /**< PHY rate encoding of the packet. Only valid for non HT(11bg) packet */
unsigned :1; /**< reserved */
@ -82,12 +84,16 @@ 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 Channel state information(CSI) configuration type
*
*/
typedef struct wifi_csi_config_t{
#if CONFIG_SOC_WIFI_HE_SUPPORT
typedef wifi_csi_acquire_config_t wifi_csi_config_t;
#else
typedef struct {
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 */
bool stbc_htltf2_en; /**< enable to receive space time block code HT long training field(stbc-htltf2) data. Default enabled */
@ -99,7 +105,6 @@ typedef struct wifi_csi_config_t{
} wifi_csi_config_t;
#endif // !CONFIG_SOC_WIFI_HE_SUPPORT
typedef wifi_pkt_rx_ctrl_t esp_wifi_rxctrl_t;
/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback.
*/

@ -1 +1 @@
Subproject commit 4457ec627eeabfaf38fa1f3d986917dbdf0849a7
Subproject commit 51ec8e854ea9ae78ef66952afecd050020a7ac8e

View File

@ -73,7 +73,7 @@ check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_private/wifi_os_adapter.h
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_crypto_types.h g_wifi_crypto_funcs_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_types.h g_wifi_type_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_types_generic.h g_wifi_types_generic_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/local/esp_wifi_native.h g_wifi_types_native_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/local/esp_wifi_types_native.h g_wifi_types_native_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_he_types.h g_wifi_he_type_md5
check_md5 ${IDF_PATH}/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h g_wifi_supplicant_funcs_md5

View File

@ -5,7 +5,7 @@ message(STATUS "building ESP WIFI MOCKS")
idf_component_get_property(original_esp_wifi_dir esp_wifi COMPONENT_OVERRIDEN_DIR)
set(include_dirs
"${original_esp_wifi_dir}/include")
"${original_esp_wifi_dir}/include" "${original_esp_wifi_dir}/include/local")
idf_component_mock(INCLUDE_DIRS ${include_dirs}
REQUIRES esp_event esp_netif lwip

View File

@ -5,6 +5,7 @@
*/
#include "esp_wifi.h"
#include "esp_private/wifi_os_adapter.h"
/**
* The following global objects are defined when WiFi is mocked.