Merge branch 'feature/add_channel_bit_definition' into 'master'

feat(wifi):wifi add channel bit definition

Closes FCW-280 and FCW-281

See merge request espressif/esp-idf!32916
This commit is contained in:
Yin Qing Zhao 2024-09-19 19:51:06 +08:00
commit ca331a2521
10 changed files with 105 additions and 31 deletions

View File

@ -35,18 +35,18 @@ ic_ebuf_alloc = 0x40000b4c;
ic_reset_extra_softap_rx_ba = 0x40000b50; ic_reset_extra_softap_rx_ba = 0x40000b50;
ieee80211_align_eb = 0x40000b54; ieee80211_align_eb = 0x40000b54;
ieee80211_ampdu_reorder = 0x40000b58; ieee80211_ampdu_reorder = 0x40000b58;
ieee80211_ampdu_start_age_timer = 0x40000b5c; /*ieee80211_ampdu_start_age_timer = 0x40000b5c;*/
ieee80211_encap_esfbuf = 0x40000b60; /*ieee80211_encap_esfbuf = 0x40000b60;*/
ieee80211_is_tx_allowed = 0x40000b64; ieee80211_is_tx_allowed = 0x40000b64;
ieee80211_output_pending_eb = 0x40000b68; /*ieee80211_output_pending_eb = 0x40000b68;*/
ieee80211_output_process = 0x40000b6c; /*ieee80211_output_process = 0x40000b6c;*/
/*ieee80211_set_tx_desc = 0x40000b70;*/ /*ieee80211_set_tx_desc = 0x40000b70;*/
ieee80211_classify = 0x40000b74; ieee80211_classify = 0x40000b74;
ieee80211_copy_eb_header = 0x40000b78; ieee80211_copy_eb_header = 0x40000b78;
ieee80211_recycle_cache_eb = 0x40000b7c; ieee80211_recycle_cache_eb = 0x40000b7c;
ieee80211_search_node = 0x40000b80; ieee80211_search_node = 0x40000b80;
ieee80211_crypto_encap = 0x40000b84; /*ieee80211_crypto_encap = 0x40000b84;*/
ieee80211_crypto_decap = 0x40000b88; /*ieee80211_crypto_decap = 0x40000b88;*/
ieee80211_decap = 0x40000b8c; ieee80211_decap = 0x40000b8c;
ieee80211_set_tx_pti = 0x40000b90; ieee80211_set_tx_pti = 0x40000b90;
ieee80211_gettid = 0x40000b94; ieee80211_gettid = 0x40000b94;
@ -61,12 +61,12 @@ ieee80211_find_ie = 0x40000bb4;
ieee80211_find_ext_ie = 0x40000bb8; ieee80211_find_ext_ie = 0x40000bb8;
ieee80211_merge_mbssid_profile = 0x40000bbc; ieee80211_merge_mbssid_profile = 0x40000bbc;
ieee80211_encap_esfbuf_htc = 0x40000bc0; ieee80211_encap_esfbuf_htc = 0x40000bc0;
wifi_get_macaddr = 0x40000bc4; /*wifi_get_macaddr = 0x40000bc4;*/
wifi_rf_phy_disable = 0x40000bc8; /*wifi_rf_phy_disable = 0x40000bc8;*/
wifi_rf_phy_enable = 0x40000bcc; /*wifi_rf_phy_enable = 0x40000bcc;*/
wifi_is_started = 0x40000bd0; /*wifi_is_started = 0x40000bd0;*/
/*sta_input = 0x40000bd4;*/ /*sta_input = 0x40000bd4;*/
sta_rx_eapol = 0x40000bd8; /*sta_rx_eapol = 0x40000bd8;*/
sta_reset_beacon_timeout = 0x40000bdc; sta_reset_beacon_timeout = 0x40000bdc;
sta_get_beacon_timeout = 0x40000be0; sta_get_beacon_timeout = 0x40000be0;
ampdu_process_multicast_address_qos_frame = 0x40000be4; ampdu_process_multicast_address_qos_frame = 0x40000be4;

View File

@ -657,28 +657,28 @@ menu "Wi-Fi"
config ESP_WIFI_ENABLE_DUMP_HESIGB config ESP_WIFI_ENABLE_DUMP_HESIGB
bool "Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs" bool "Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs"
depends on SOC_WIFI_HE_SUPPORT_5G depends on SOC_WIFI_SUPPORT_5G
default "n" default "n"
help help
Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs. Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs.
config ESP_WIFI_ENABLE_DUMP_MU_CFO config ESP_WIFI_ENABLE_DUMP_MU_CFO
bool "Enable Wi-Fi dump MU CFO" bool "Enable Wi-Fi dump MU CFO"
depends on SOC_WIFI_HE_SUPPORT_5G depends on SOC_WIFI_SUPPORT_5G
default "n" default "n"
help help
Enable Wi-Fi dump MU CFO. Enable Wi-Fi dump MU CFO.
config ESP_WIFI_ENABLE_DUMP_CTRL_NDPA config ESP_WIFI_ENABLE_DUMP_CTRL_NDPA
bool "Enable Wi-Fi dump NDPA frames" bool "Enable Wi-Fi dump NDPA frames"
depends on SOC_WIFI_HE_SUPPORT_5G depends on SOC_WIFI_SUPPORT_5G
default "n" default "n"
help help
Enable Wi-Fi dump NDPA frames. Enable Wi-Fi dump NDPA frames.
config ESP_WIFI_ENABLE_DUMP_CTRL_BFRP config ESP_WIFI_ENABLE_DUMP_CTRL_BFRP
bool "Enable Wi-Fi dump BFRP frames" bool "Enable Wi-Fi dump BFRP frames"
depends on SOC_WIFI_HE_SUPPORT_5G depends on SOC_WIFI_SUPPORT_5G
default "n" default "n"
help help
Enable Wi-Fi dump BFRP frames. Enable Wi-Fi dump BFRP frames.

View File

@ -677,7 +677,7 @@ esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
* @brief Set protocol type of specified interface * @brief Set protocol type of specified interface
* The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N). * The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N).
* if CONFIG_SOC_WIFI_HE_SUPPORT and band mode is 2.4G, the default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AX). * if CONFIG_SOC_WIFI_HE_SUPPORT and band mode is 2.4G, the default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AX).
* if CONFIG_SOC_WIFI_HE_SUPPORT_5G and band mode is 5G, the default protocol is (WIFI_PROTOCOL_11A|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AC|WIFI_PROTOCOL_11AX). * if CONFIG_SOC_WIFI_SUPPORT_5G and band mode is 5G, the default protocol is (WIFI_PROTOCOL_11A|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AC|WIFI_PROTOCOL_11AX).
* *
* @attention 1. When WiFi band mode is 2.4G only, support 802.11b or 802.11bg or 802.11bgn or 802.11bgnax or LR mode * @attention 1. When WiFi band mode is 2.4G only, support 802.11b or 802.11bg or 802.11bgn or 802.11bgnax or LR mode
* @attention 2. When WiFi band mode is 5G only, support 802.11a or 802.11an or 802.11anac or 802.11anacax * @attention 2. When WiFi band mode is 5G only, support 802.11a or 802.11an or 802.11anac or 802.11anacax
@ -1653,8 +1653,8 @@ esp_err_t esp_wifi_get_band(wifi_band_t* band);
* @attention 1. When the WiFi band mode is set to 2.4G only, it operates exclusively on the 2.4GHz channels. * @attention 1. When the WiFi band mode is set to 2.4G only, it operates exclusively on the 2.4GHz channels.
* @attention 2. When the WiFi band mode is set to 5G only, it operates exclusively on the 5GHz channels. * @attention 2. When the WiFi band mode is set to 5G only, it operates exclusively on the 5GHz channels.
* @attention 3. When the WiFi band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO), it can operate on both the 2.4GHz and 5GHz channels. * @attention 3. When the WiFi band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO), it can operate on both the 2.4GHz and 5GHz channels.
* @attention 4. WiFi band mode can be set to 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO) if CONFIG_SOC_WIFI_HE_SUPPORT_5G is supported. * @attention 4. WiFi band mode can be set to 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO) if CONFIG_SOC_WIFI_SUPPORT_5G is supported.
* @attention 5. If CONFIG_SOC_WIFI_HE_SUPPORT_5G is not supported, the API will return ESP_ERR_INVALID_ARG when the band mode is set to either 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO). * @attention 5. If CONFIG_SOC_WIFI_SUPPORT_5G is not supported, the API will return ESP_ERR_INVALID_ARG when the band mode is set to either 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO).
* @attention 6. When a WiFi band mode change triggers a band change, if no channel is set for the current band, a default channel will be assigned: channel 1 for 2.4G band and channel 36 for 5G band. * @attention 6. When a WiFi band mode change triggers a band change, if no channel is set for the current band, a default channel will be assigned: channel 1 for 2.4G band and channel 36 for 5G band.
* *
* @param[in] band_mode store the band mode of WiFi * @param[in] band_mode store the band mode of WiFi
@ -1717,7 +1717,7 @@ esp_err_t esp_wifi_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protoco
/** /**
* @brief Get the current protocol of the specified interface and specified band * @brief Get the current protocol of the specified interface and specified band
* *
* @attention 1. The 5G protocol can only be read when CONFIG_SOC_WIFI_HE_SUPPORT_5G is enabled. * @attention 1. The 5G protocol can only be read when CONFIG_SOC_WIFI_SUPPORT_5G is enabled.
* @attention 2. When the WiFi band mode is set to 2.4G only, it will not get 5G protocol * @attention 2. When the WiFi band mode is set to 2.4G only, it will not get 5G protocol
* @attention 3. When the WiFi band mode is set to 5G only, it will not get 2.4G protocol * @attention 3. When the WiFi band mode is set to 5G only, it will not get 2.4G protocol
* *
@ -1756,7 +1756,7 @@ esp_err_t esp_wifi_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t* bw);
/** /**
* @brief Get the bandwidth of specified interface and specified band * @brief Get the bandwidth of specified interface and specified band
* *
* @attention 1. The 5G bandwidth can only be read when CONFIG_SOC_WIFI_HE_SUPPORT_5G is enabled. * @attention 1. The 5G bandwidth can only be read when CONFIG_SOC_WIFI_SUPPORT_5G is enabled.
* @attention 2. When the WiFi band mode is set to 2.4G only, it will not get 5G bandwidth * @attention 2. When the WiFi band mode is set to 2.4G only, it will not get 5G bandwidth
* @attention 3. When the WiFi band mode is set to 5G only, it will not get 2.4G bandwidth * @attention 3. When the WiFi band mode is set to 5G only, it will not get 2.4G bandwidth
* *

View File

@ -49,10 +49,16 @@ typedef enum {
/** @brief Structure describing WiFi country-based regional restrictions. */ /** @brief Structure describing WiFi country-based regional restrictions. */
typedef struct { typedef struct {
char cc[3]; /**< country code string */ char cc[3]; /**< country code string */
uint8_t schan; /**< start channel */ uint8_t schan; /**< start channel of the allowed 2.4GHz WiFi channels */
uint8_t nchan; /**< total channel number */ uint8_t nchan; /**< total channel number of the allowed 2.4GHz WiFi channels */
int8_t max_tx_power; /**< This field is used for getting WiFi maximum transmitting power, call esp_wifi_set_max_tx_power to set the maximum transmitting power. */ int8_t max_tx_power; /**< This field is used for getting WiFi maximum transmitting power, call esp_wifi_set_max_tx_power to set the maximum transmitting power. */
wifi_country_policy_t policy; /**< country policy */ wifi_country_policy_t policy; /**< country policy */
#if SOC_WIFI_SUPPORT_5G
uint32_t wifi_5g_channel_mask; /**< A bitmask representing the allowed 5GHz WiFi channels.
Each bit in the mask corresponds to a specific channel as wifi_5g_channel_bit_t shown.
Bitmask set to 0 indicates 5GHz channels are allowed according to local regulatory rules.
Please note that configured bitmask takes effect only when policy is manual. */
#endif
} wifi_country_t; } wifi_country_t;
/* Strength of authmodes */ /* Strength of authmodes */
@ -178,8 +184,8 @@ typedef struct {
} wifi_scan_time_t; } wifi_scan_time_t;
typedef struct { typedef struct {
uint16_t ghz_2_channels; /**< Represents 2.4 GHz channels */ uint16_t ghz_2_channels; /**< Represents 2.4 GHz channels, that bits can be set as wifi_2g_channel_bit_t shown. */
uint32_t ghz_5_channels; /**< Represents 5 GHz channels */ uint32_t ghz_5_channels; /**< Represents 5 GHz channels, that bits can be set as wifi_5g_channel_bit_t shown. */
} wifi_scan_channel_bitmap_t; } wifi_scan_channel_bitmap_t;
/** @brief Parameters for an SSID scan. */ /** @brief Parameters for an SSID scan. */
@ -191,7 +197,9 @@ typedef struct {
wifi_scan_type_t scan_type; /**< scan type, active or passive */ wifi_scan_type_t scan_type; /**< scan type, active or passive */
wifi_scan_time_t scan_time; /**< scan time per channel */ wifi_scan_time_t scan_time; /**< scan time per channel */
uint8_t home_chan_dwell_time; /**< time spent at home channel between scanning consecutive channels. */ uint8_t home_chan_dwell_time; /**< time spent at home channel between scanning consecutive channels. */
wifi_scan_channel_bitmap_t channel_bitmap; /**< Channel bitmap for setting specific channels to be scanned. For 2.4ghz channels set ghz_2_channels from BIT(1) to BIT(14) from LSB to MSB order to indicate channels to be scanned. Currently scanning in 5ghz channels is not supported. Please note that the 'channel' parameter above needs to be set to 0 to allow scanning by bitmap. */ wifi_scan_channel_bitmap_t channel_bitmap; /**< Channel bitmap for setting specific channels to be scanned.
Please note that the 'channel' parameter above needs to be set to 0 to allow scanning by bitmap.
Also, note that only allowed channels configured by wifi_country_t can be scaned. */
} wifi_scan_config_t; } wifi_scan_config_t;
/** @brief Parameters default scan configurations. */ /** @brief Parameters default scan configurations. */
@ -305,6 +313,72 @@ typedef enum {
WIFI_BAND_MODE_AUTO = 3, /* WiFi band mode is 2.4G + 5G */ WIFI_BAND_MODE_AUTO = 3, /* WiFi band mode is 2.4G + 5G */
} wifi_band_mode_t; } wifi_band_mode_t;
#ifndef BIT
#define BIT(nr) (1 << (nr))
#endif
#define CHANNEL_TO_BIT_NUMBER(channel) ((channel >= 1 && channel <= 14) ? (channel) : \
((channel >= 36 && channel <= 64 && (channel - 36) % 4 == 0) ? ((channel - 36) / 4 + 1) : \
((channel >= 100 && channel <= 144 && (channel - 100) % 4 == 0) ? ((channel - 100) / 4 + 9) : \
((channel >= 149 && channel <= 177 && (channel - 149) % 4 == 0) ? ((channel - 149) / 4 + 21) : 0))))
#define BIT_NUMBER_TO_CHANNEL(bit_number, band) ((band == WIFI_BAND_2G) ? (bit_number) : \
((bit_number >= 1 && bit_number <= 8) ? ((bit_number - 1) * 4 + 36) : \
((bit_number >= 9 && bit_number <= 20) ? ((bit_number - 9) * 4 + 100) : \
((bit_number >= 21 && bit_number <= 28) ? ((bit_number - 21) * 4 + 149) : 0))))
#define CHANNEL_TO_BIT(channel) (BIT(CHANNEL_TO_BIT_NUMBER(channel)))
/** Argument structure for 2.4G channels */
typedef enum {
WIFI_CHANNEL_1 = BIT(1), /**< wifi channel 1 */
WIFI_CHANNEL_2 = BIT(2), /**< wifi channel 2 */
WIFI_CHANNEL_3 = BIT(3), /**< wifi channel 3 */
WIFI_CHANNEL_4 = BIT(4), /**< wifi channel 4 */
WIFI_CHANNEL_5 = BIT(5), /**< wifi channel 5 */
WIFI_CHANNEL_6 = BIT(6), /**< wifi channel 6 */
WIFI_CHANNEL_7 = BIT(7), /**< wifi channel 7 */
WIFI_CHANNEL_8 = BIT(8), /**< wifi channel 8 */
WIFI_CHANNEL_9 = BIT(9), /**< wifi channel 9 */
WIFI_CHANNEL_10 = BIT(10), /**< wifi channel 10 */
WIFI_CHANNEL_11 = BIT(11), /**< wifi channel 11 */
WIFI_CHANNEL_12 = BIT(12), /**< wifi channel 12 */
WIFI_CHANNEL_13 = BIT(13), /**< wifi channel 13 */
WIFI_CHANNEL_14 = BIT(14), /**< wifi channel 14 */
} wifi_2g_channel_bit_t;
/** Argument structure for 5G channels */
typedef enum {
WIFI_CHANNEL_36 = BIT(1), /**< wifi channel 36 */
WIFI_CHANNEL_40 = BIT(2), /**< wifi channel 40 */
WIFI_CHANNEL_44 = BIT(3), /**< wifi channel 44 */
WIFI_CHANNEL_48 = BIT(4), /**< wifi channel 48 */
WIFI_CHANNEL_52 = BIT(5), /**< wifi channel 52 */
WIFI_CHANNEL_56 = BIT(6), /**< wifi channel 56 */
WIFI_CHANNEL_60 = BIT(7), /**< wifi channel 60 */
WIFI_CHANNEL_64 = BIT(8), /**< wifi channel 64 */
WIFI_CHANNEL_100 = BIT(9), /**< wifi channel 100 */
WIFI_CHANNEL_104 = BIT(10), /**< wifi channel 104 */
WIFI_CHANNEL_108 = BIT(11), /**< wifi channel 108 */
WIFI_CHANNEL_112 = BIT(12), /**< wifi channel 112 */
WIFI_CHANNEL_116 = BIT(13), /**< wifi channel 116 */
WIFI_CHANNEL_120 = BIT(14), /**< wifi channel 120 */
WIFI_CHANNEL_124 = BIT(15), /**< wifi channel 124 */
WIFI_CHANNEL_128 = BIT(16), /**< wifi channel 128 */
WIFI_CHANNEL_132 = BIT(17), /**< wifi channel 132 */
WIFI_CHANNEL_136 = BIT(18), /**< wifi channel 136 */
WIFI_CHANNEL_140 = BIT(19), /**< wifi channel 140 */
WIFI_CHANNEL_144 = BIT(20), /**< wifi channel 144 */
WIFI_CHANNEL_149 = BIT(21), /**< wifi channel 149 */
WIFI_CHANNEL_153 = BIT(22), /**< wifi channel 153 */
WIFI_CHANNEL_157 = BIT(23), /**< wifi channel 157 */
WIFI_CHANNEL_161 = BIT(24), /**< wifi channel 161 */
WIFI_CHANNEL_165 = BIT(25), /**< wifi channel 165 */
WIFI_CHANNEL_169 = BIT(26), /**< wifi channel 169 */
WIFI_CHANNEL_173 = BIT(27), /**< wifi channel 173 */
WIFI_CHANNEL_177 = BIT(28), /**< wifi channel 177 */
} wifi_5g_channel_bit_t;
#define WIFI_PROTOCOL_11B 0x1 #define WIFI_PROTOCOL_11B 0x1
#define WIFI_PROTOCOL_11G 0x2 #define WIFI_PROTOCOL_11G 0x2
#define WIFI_PROTOCOL_11N 0x4 #define WIFI_PROTOCOL_11N 0x4

@ -1 +1 @@
Subproject commit efa80057b04ade8b1412a0dedcb5572d6ccd1fcc Subproject commit 6b249f7335ed8e341c111a51b4d368d1825ac3c6

View File

@ -1387,7 +1387,7 @@ config SOC_WIFI_HE_SUPPORT
bool bool
default y default y
config SOC_WIFI_HE_SUPPORT_5G config SOC_WIFI_SUPPORT_5G
bool bool
default y default y

View File

@ -594,7 +594,7 @@
#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */ #define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */
#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */ #define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */
#define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */ #define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */
#define SOC_WIFI_HE_SUPPORT_5G (1) /*!< Support Wi-Fi 6 in 5G */ #define SOC_WIFI_SUPPORT_5G (1) /*!< Support 5G */
#define SOC_WIFI_MAC_VERSION_NUM (3) /*!< Wi-Fi MAC version num is 3 */ #define SOC_WIFI_MAC_VERSION_NUM (3) /*!< Wi-Fi MAC version num is 3 */
/*---------------------------------- Bluetooth CAPS ----------------------------------*/ /*---------------------------------- Bluetooth CAPS ----------------------------------*/

View File

@ -67,7 +67,7 @@ menu "Example Configuration"
config EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT config EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT
int "fast scan rssi 5g adjustment" int "fast scan rssi 5g adjustment"
depends on EXAMPLE_FAST_SCAN_THRESHOLD && SOC_WIFI_HE_SUPPORT_5G depends on EXAMPLE_FAST_SCAN_THRESHOLD && SOC_WIFI_SUPPORT_5G
range 0 128 range 0 128
default 10 default 10
help help

View File

@ -61,7 +61,7 @@
#else #else
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN #define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
#endif #endif
#if CONFIG_SOC_WIFI_HE_SUPPORT_5G #if CONFIG_SOC_WIFI_SUPPORT_5G
#define DEFAULT_RSSI_5G_ADJUSTMENT CONFIG_EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT #define DEFAULT_RSSI_5G_ADJUSTMENT CONFIG_EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT
#else #else
#define DEFAULT_RSSI_5G_ADJUSTMENT 0 #define DEFAULT_RSSI_5G_ADJUSTMENT 0

View File

@ -4,7 +4,7 @@ dependencies:
espressif/iperf-cmd: espressif/iperf-cmd:
version: "~0.1.1" version: "~0.1.1"
esp-qa/wifi-cmd: esp-qa/wifi-cmd:
version: "~0.1.0" version: "~0.1.8"
esp-qa/ping-cmd: esp-qa/ping-cmd:
version: "~0.0.1" version: "~0.0.1"
espressif/esp-extconn: espressif/esp-extconn: