ソースを参照

esp_wifi: espnow support using 11ax rate to send frame

xuxiao 2 年 前
コミット
0848938868

+ 1 - 1
components/esp_rom/esp32c2/ld/esp32c2.rom.ld

@@ -1929,7 +1929,7 @@ wep_encap = 0x40002024;
 wep_decap = 0x40002028;
 dbg_hmac_rxtx_statis_dump = 0x4000202c;
 dbg_hmac_statis_dump = 0x40002030;
-ieee80211_send_action_vendor_spec = 0x40002034;
+/* ieee80211_send_action_vendor_spec = 0x40002034; */
 ieee80211_vnd_lora_ie_size = 0x40002048;
 ieee80211_vnd_ie_size = 0x4000204c;
 ieee80211_add_ssid = 0x40002050;

+ 8 - 8
components/esp_rom/esp32c6/ld/esp32c6.rom.pp.ld

@@ -50,11 +50,11 @@ lmacReachShortLimit = 0x40000c48;
 lmacRecycleMPDU = 0x40000c4c;
 lmacRxDone = 0x40000c50;
 //lmacSetTxFrame = 0x40000c54;
-lmacTxDone = 0x40000c58;
+//lmacTxDone = 0x40000c58;
 lmacTxFrame = 0x40000c5c;
 mac_tx_set_duration = 0x40000c60;
 //mac_tx_set_plcp0 = 0x40000c64;
-mac_tx_set_plcp1 = 0x40000c68;
+//mac_tx_set_plcp1 = 0x40000c68;
 mac_tx_set_plcp2 = 0x40000c6c;
 pm_check_state = 0x40000c70;
 /* pm_disable_dream_timer = 0x40000c74; */
@@ -92,7 +92,7 @@ ppEnqueueRxq = 0x40000cf0;
 ppEnqueueTxDone = 0x40000cf4;
 ppGetTxframe = 0x40000cf8;
 //ppMapTxQueue = 0x40000cfc;
-ppProcTxSecFrame = 0x40000d00;
+//ppProcTxSecFrame = 0x40000d00;
 ppProcessRxPktHdr = 0x40000d04;
 //ppProcessTxQ = 0x40000d08;
 ppRecordBarRRC = 0x40000d0c;
@@ -171,7 +171,7 @@ ppDisableQueue = 0x40000e2c;
 pm_allow_tx = 0x40000e30;
 //wdev_is_data_in_rxlist = 0x40000e34;
 ppProcTxCallback = 0x40000e38;
-mac_tx_set_hesig = 0x40000e3c;
+//mac_tx_set_hesig = 0x40000e3c;
 ppCalPreFecPaddingFactor = 0x40000e40;
 mac_tx_set_tb = 0x40000e44;
 mac_tx_set_mplen = 0x40000e48;
@@ -294,8 +294,8 @@ tsf_hal_set_tsf_time_deviation = 0x40001018;
 tsf_hal_set_tsf_time_deviation_sync_disable = 0x4000101c;
 tsf_hal_set_tsf_time_deviation_sync_enable = 0x40001020;
 tsf_hal_unmap_tbtt_target_to_rx_frame = 0x40001024;
-ppSelectTxFormat = 0x40001028;
-ppCertSetRate = 0x4000102c;
+//ppSelectTxFormat = 0x40001028;
+//ppCertSetRate = 0x4000102c;
 //ppHEAMPDU2Normal = 0x40001030;
 ppCalTxHEAMPDULength = 0x40001034;
 ppCalTxHESMPDULength = 0x40001038;
@@ -435,8 +435,8 @@ s_mplen_vi_bitmap = 0x4087fdac;
 s_mplen_bk_bitmap = 0x4087fda8;
 esp_wifi_cert_tx_mcs = 0x4087fcfc;
 esp_wifi_cert_tx_bcc = 0x4087fcf8;
-esp_wifi_cert_tx_ltf = 0x4087fcf4;
-esp_wifi_cert_tx_gi = 0x4087fcf0;
+//esp_wifi_cert_tx_ltf = 0x4087fcf4;
+//esp_wifi_cert_tx_gi = 0x4087fcf0;
 esp_wifi_cert_tx_nss = 0x4087fcec;
 esp_test_tx_statistics_aci_bitmap = 0x4087fda4;
 esp_test_tx_statistics = 0x4087fd94;

+ 29 - 0
components/esp_wifi/include/esp_now.h

@@ -89,6 +89,16 @@ typedef struct esp_now_recv_info {
     wifi_pkt_rx_ctrl_t * rx_ctrl;            /**< Rx control info of ESPNOW packet */
 } esp_now_recv_info_t;
 
+/**
+ * @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 send frame*/
+} esp_now_rate_config_t;
+
 /**
   * @brief     Callback function of receiving ESPNOW data
   * @param     esp_now_info received ESPNOW packet information
@@ -242,7 +252,10 @@ esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer);
 /**
   * @brief      Config ESPNOW rate of specified interface
   *
+  * @deprecated please use esp_now_set_peer_rate_config() instead.
+  *
   * @attention  1. This API should be called after esp_wifi_start().
+  * @attention  2. This API only work when not use Wi-Fi 6 and esp_now_set_peer_rate_config() not called.
   *
   * @param      ifx  Interface to be configured.
   * @param      rate Phy rate to be configured.
@@ -253,6 +266,22 @@ esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer);
   */
 esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate);
 
+/**
+  * @brief      Set ESPNOW rate config for each peer
+  *
+  * @attention  1. This API should be called after esp_wifi_start() and esp_now_init().
+  *
+  * @param      peer_addr  peer MAC address
+  * @param      config rate config to be configured.
+  *
+  * @return
+  *          - ESP_OK : succeed
+  *          - ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized
+  *          - ESP_ERR_ESPNOW_ARG : invalid argument
+  *          - ESP_ERR_ESPNOW_INTERNAL : internal error
+  */
+esp_err_t esp_now_set_peer_rate_config(const uint8_t *peer_addr, esp_now_rate_config_t *config);
+
 /**
   * @brief     Get a peer whose MAC address matches peer_addr from peer list
   *

+ 51 - 21
components/esp_wifi/include/esp_wifi_types.h

@@ -779,36 +779,66 @@ typedef enum {
     WIFI_PHY_RATE_36M       = 0x0D, /**< 36 Mbps */
     WIFI_PHY_RATE_18M       = 0x0E, /**< 18 Mbps */
     WIFI_PHY_RATE_9M        = 0x0F, /**< 9 Mbps */
-    WIFI_PHY_RATE_MCS0_LGI  = 0x10, /**< MCS0 with long GI, 6.5 Mbps for 20MHz, 13.5 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS1_LGI  = 0x11, /**< MCS1 with long GI, 13 Mbps for 20MHz, 27 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS2_LGI  = 0x12, /**< MCS2 with long GI, 19.5 Mbps for 20MHz, 40.5 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS3_LGI  = 0x13, /**< MCS3 with long GI, 26 Mbps for 20MHz, 54 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS4_LGI  = 0x14, /**< MCS4 with long GI, 39 Mbps for 20MHz, 81 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS5_LGI  = 0x15, /**< MCS5 with long GI, 52 Mbps for 20MHz, 108 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS6_LGI  = 0x16, /**< MCS6 with long GI, 58.5 Mbps for 20MHz, 121.5 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS7_LGI  = 0x17, /**< MCS7 with long GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz */
+    /**< rate table and guard interval information for each MCS rate*/
+    /*
+     -----------------------------------------------------------------------------------------------------------
+            MCS RATE             |          HT20           |          HT40           |          HE20           |
+     WIFI_PHY_RATE_MCS0_LGI      |     6.5 Mbps (800ns)    |    13.5 Mbps (800ns)    |     8.1 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS1_LGI      |      13 Mbps (800ns)    |      27 Mbps (800ns)    |    16.3 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS2_LGI      |    19.5 Mbps (800ns)    |    40.5 Mbps (800ns)    |    24.4 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS3_LGI      |      26 Mbps (800ns)    |      54 Mbps (800ns)    |    32.5 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS4_LGI      |      39 Mbps (800ns)    |      81 Mbps (800ns)    |    48.8 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS5_LGI      |      52 Mbps (800ns)    |     108 Mbps (800ns)    |      65 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS6_LGI      |    58.5 Mbps (800ns)    |   121.5 Mbps (800ns)    |    73.1 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS7_LGI      |      65 Mbps (800ns)    |     135 Mbps (800ns)    |    81.3 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS8_LGI      |          -----          |          -----          |    97.5 Mbps (1600ns)   |
+     WIFI_PHY_RATE_MCS9_LGI      |          -----          |          -----          |   108.3 Mbps (1600ns)   |
+     -----------------------------------------------------------------------------------------------------------
+    */
+    WIFI_PHY_RATE_MCS0_LGI  = 0x10, /**< MCS0 with long GI */
+    WIFI_PHY_RATE_MCS1_LGI  = 0x11, /**< MCS1 with long GI */
+    WIFI_PHY_RATE_MCS2_LGI  = 0x12, /**< MCS2 with long GI */
+    WIFI_PHY_RATE_MCS3_LGI  = 0x13, /**< MCS3 with long GI */
+    WIFI_PHY_RATE_MCS4_LGI  = 0x14, /**< MCS4 with long GI */
+    WIFI_PHY_RATE_MCS5_LGI  = 0x15, /**< MCS5 with long GI */
+    WIFI_PHY_RATE_MCS6_LGI  = 0x16, /**< MCS6 with long GI */
+    WIFI_PHY_RATE_MCS7_LGI  = 0x17, /**< MCS7 with long GI */
 #if CONFIG_SOC_WIFI_HE_SUPPORT
-    WIFI_PHY_RATE_MCS8_LGI,         /**< MCS8 */
-    WIFI_PHY_RATE_MCS9_LGI,         /**< MCS9 */
+    WIFI_PHY_RATE_MCS8_LGI,         /**< MCS8 with long GI */
+    WIFI_PHY_RATE_MCS9_LGI,         /**< MCS9 with long GI */
 #endif
-    WIFI_PHY_RATE_MCS0_SGI,         /**< MCS0 with short GI, 7.2 Mbps for 20MHz, 15 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS1_SGI,         /**< MCS1 with short GI, 14.4 Mbps for 20MHz, 30 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS2_SGI,         /**< MCS2 with short GI, 21.7 Mbps for 20MHz, 45 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS3_SGI,         /**< MCS3 with short GI, 28.9 Mbps for 20MHz, 60 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS4_SGI,         /**< MCS4 with short GI, 43.3 Mbps for 20MHz, 90 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS5_SGI,         /**< MCS5 with short GI, 57.8 Mbps for 20MHz, 120 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS6_SGI,         /**< MCS6 with short GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz */
-    WIFI_PHY_RATE_MCS7_SGI,         /**< MCS7 with short GI, 72.2 Mbps for 20MHz, 150 Mbps for 40MHz */
+    /*
+     -----------------------------------------------------------------------------------------------------------
+            MCS RATE             |          HT20           |          HT40           |          HE20           |
+     WIFI_PHY_RATE_MCS0_SGI      |     7.2 Mbps (400ns)    |      15 Mbps (400ns)    |      8.6 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS1_SGI      |    14.4 Mbps (400ns)    |      30 Mbps (400ns)    |     17.2 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS2_SGI      |    21.7 Mbps (400ns)    |      45 Mbps (400ns)    |     25.8 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS3_SGI      |    28.9 Mbps (400ns)    |      60 Mbps (400ns)    |     34.4 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS4_SGI      |    43.3 Mbps (400ns)    |      90 Mbps (400ns)    |     51.6 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS5_SGI      |    57.8 Mbps (400ns)    |     120 Mbps (400ns)    |     68.8 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS6_SGI      |      65 Mbps (400ns)    |     135 Mbps (400ns)    |     77.4 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS7_SGI      |    72.2 Mbps (400ns)    |     150 Mbps (400ns)    |       86 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS8_SGI      |          -----          |          -----          |    103.2 Mbps (800ns)   |
+     WIFI_PHY_RATE_MCS9_SGI      |          -----          |          -----          |    114.7 Mbps (800ns)   |
+     -----------------------------------------------------------------------------------------------------------
+    */
+    WIFI_PHY_RATE_MCS0_SGI,         /**< MCS0 with short GI */
+    WIFI_PHY_RATE_MCS1_SGI,         /**< MCS1 with short GI */
+    WIFI_PHY_RATE_MCS2_SGI,         /**< MCS2 with short GI */
+    WIFI_PHY_RATE_MCS3_SGI,         /**< MCS3 with short GI */
+    WIFI_PHY_RATE_MCS4_SGI,         /**< MCS4 with short GI */
+    WIFI_PHY_RATE_MCS5_SGI,         /**< MCS5 with short GI */
+    WIFI_PHY_RATE_MCS6_SGI,         /**< MCS6 with short GI */
+    WIFI_PHY_RATE_MCS7_SGI,         /**< MCS7 with short GI */
 #if CONFIG_SOC_WIFI_HE_SUPPORT
-    WIFI_PHY_RATE_MCS8_SGI,         /**< MCS8 */
-    WIFI_PHY_RATE_MCS9_SGI,         /**< MCS9 */
+    WIFI_PHY_RATE_MCS8_SGI,         /**< MCS8 with short GI */
+    WIFI_PHY_RATE_MCS9_SGI,         /**< MCS9 with short GI */
 #endif
     WIFI_PHY_RATE_LORA_250K = 0x29, /**< 250 Kbps */
     WIFI_PHY_RATE_LORA_500K = 0x2A, /**< 500 Kbps */
     WIFI_PHY_RATE_MAX,
 } wifi_phy_rate_t;
 
-
 /** WiFi event declarations */
 typedef enum {
     WIFI_EVENT_WIFI_READY = 0,           /**< WiFi ready */

+ 1 - 1
components/esp_wifi/lib

@@ -1 +1 @@
-Subproject commit 160111ebacd684be91b629dcfade9e1a07e9e131
+Subproject commit 522229f2ce39d6347f0de511a2edb627f4873bd2