浏览代码

WiFi: Modify the wifi_country struct in VNC to keep it consistent with IDF.

    1, Modfy wifi_country struct
    2, Add md5 check esp_wifi_types.h
    3, Add md5 check esp_wifi.h
xiehang 6 年之前
父节点
当前提交
8f2d13d9db

+ 25 - 0
components/esp_wifi/include/esp_private/esp_wifi_private.h

@@ -0,0 +1,25 @@
+// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef _ESP_WIFI_PRIVATE_H
+#define _ESP_WIFI_PRIVATE_H
+
+#include "freertos/FreeRTOS.h"
+#include "freertos/queue.h"
+#include "sys/queue.h"
+#include "sdkconfig.h"
+#include "esp_wifi_crypto_types.h"
+#include "esp_private/wifi_os_adapter.h"
+
+
+#endif /* _ESP_WIFI_PRIVATE_H */

+ 25 - 0
components/esp_wifi/include/esp_private/esp_wifi_types_private.h

@@ -0,0 +1,25 @@
+// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef _ESP_WIFI_TYPES_PRIVATE_H
+#define _ESP_WIFI_TYPES_PRIVATE_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "sys/queue.h"
+#include "esp_err.h"
+#include "esp_interface.h"
+#include "esp_event_base.h"
+
+#endif

+ 23 - 0
components/esp_wifi/include/esp_private/wifi.h

@@ -37,6 +37,7 @@
 #include "esp_event.h"
 #include "esp_wifi.h"
 #include "esp_smartconfig.h"
+#include "wifi_types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -232,6 +233,28 @@ esp_err_t esp_wifi_internal_osi_funcs_md5_check(const char *md5);
   */
 esp_err_t esp_wifi_internal_crypto_funcs_md5_check(const char *md5);
 
+/**
+  * @brief     Check the MD5 values of the esp_wifi_types.h in IDF and WiFi library
+  *
+  * @attention 1. It is used for internal CI version check
+  *
+  * @return
+  *     - ESP_OK : succeed
+  *     - ESP_WIFI_INVALID_ARG : MD5 check fail
+  */
+esp_err_t esp_wifi_internal_wifi_type_md5_check(const char *md5);
+
+/**
+  * @brief     Check the MD5 values of the esp_wifi.h in IDF and WiFi library
+  *
+  * @attention 1. It is used for internal CI version check
+  *
+  * @return
+  *     - ESP_OK : succeed
+  *     - ESP_WIFI_INVALID_ARG : MD5 check fail
+  */
+esp_err_t esp_wifi_internal_esp_wifi_md5_check(const char *md5);
+
 /**
   * @brief     Check the git commit id of WiFi library
   *

+ 54 - 0
components/esp_wifi/include/esp_private/wifi_types.h

@@ -0,0 +1,54 @@
+// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef _WIFI_TYPES_H
+#define _WIFI_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+  * @brief WiFi ioctl command type
+  *
+  */
+typedef enum {
+    WIFI_IOCTL_SET_STA_HT2040_COEX = 1, /**< Set the configuration of STA's HT2040 coexist management */
+    WIFI_IOCTL_GET_STA_HT2040_COEX,     /**< Get the configuration of STA's HT2040 coexist management */
+    WIFI_IOCTL_MAX,
+} wifi_ioctl_cmd_t;
+
+/**
+ * @brief Configuration for STA's HT2040 coexist management
+ *
+ */
+typedef struct {
+    int enable;                         /**< Indicate whether STA's HT2040 coexist management is enabled or not */
+} wifi_ht2040_coex_t;
+
+/**
+  * @brief Configuration for WiFi ioctl
+  *
+  */
+typedef struct {
+    union {
+        wifi_ht2040_coex_t ht2040_coex; /**< Configuration of STA's HT2040 coexist management */
+    } data;                             /**< Configuration of ioctl command */
+} wifi_ioctl_config_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 15 - 16
components/esp_wifi/include/esp_wifi.h

@@ -59,15 +59,10 @@
 
 #include <stdint.h>
 #include <stdbool.h>
-#include "freertos/FreeRTOS.h"
-#include "freertos/queue.h"
-#include "sys/queue.h"
-#include "sdkconfig.h"
 #include "esp_err.h"
 #include "esp_wifi_types.h"
-#include "esp_wifi_crypto_types.h"
 #include "esp_event.h"
-#include "esp_private/wifi_os_adapter.h"
+#include "esp_private/esp_wifi_private.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -89,6 +84,10 @@ extern "C" {
 #define ESP_ERR_WIFI_WOULD_BLOCK (ESP_ERR_WIFI_BASE + 14)  /*!< The caller would block */
 #define ESP_ERR_WIFI_NOT_CONNECT (ESP_ERR_WIFI_BASE + 15)  /*!< Station still in disconnect status */
 
+#define ESP_ERR_WIFI_POST        (ESP_ERR_WIFI_BASE + 18)  /*!< Failed to post the event to WiFi task */
+#define ESP_ERR_WIFI_INIT_STATE  (ESP_ERR_WIFI_BASE + 19)  /*!< Invalod WiFi state when init/deinit is called */
+#define ESP_ERR_WIFI_STOP_STATE  (ESP_ERR_WIFI_BASE + 20)  /*!< Returned when WiFi is stopping */
+
 /**
  * @brief WiFi stack configuration parameters passed to esp_wifi_init call.
  */
@@ -840,6 +839,16 @@ esp_err_t esp_wifi_set_auto_connect(bool en) __attribute__ ((deprecated));
   */
 esp_err_t esp_wifi_get_auto_connect(bool *en) __attribute__ ((deprecated));
 
+/**
+  * @brief     Function signature for received Vendor-Specific Information Element callback.
+  * @param     ctx Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.
+  * @param     type Information element type, based on frame type received.
+  * @param     sa Source 802.11 address.
+  * @param     vnd_ie Pointer to the vendor specific element data received.
+  * @param     rssi Received signal strength indication.
+  */
+typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const vendor_ie_data_t *vnd_ie, int rssi);
+
 /**
   * @brief     Set 802.11 Vendor-Specific Information Element
   *
@@ -858,16 +867,6 @@ esp_err_t esp_wifi_get_auto_connect(bool *en) __attribute__ ((deprecated));
   */
 esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie);
 
-/**
-  * @brief     Function signature for received Vendor-Specific Information Element callback.
-  * @param     ctx Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.
-  * @param     type Information element type, based on frame type received.
-  * @param     sa Source 802.11 address.
-  * @param     vnd_ie Pointer to the vendor specific element data received.
-  * @param     rssi Received signal strength indication.
-  */
-typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const vendor_ie_data_t *vnd_ie, int rssi);
-
 /**
   * @brief     Register Vendor-Specific Information Element monitoring callback.
   *

+ 1 - 34
components/esp_wifi/include/esp_wifi_types.h

@@ -16,12 +16,7 @@
 #ifndef __ESP_WIFI_TYPES_H__
 #define __ESP_WIFI_TYPES_H__
 
-#include <stdint.h>
-#include <stdbool.h>
-#include "sys/queue.h"
-#include "esp_err.h"
-#include "esp_interface.h"
-#include "esp_event_base.h"
+#include "esp_private/esp_wifi_types_private.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -583,34 +578,6 @@ typedef struct {
     uint8_t mac[6];           /**< MAC address of the station which send probe request */
 } wifi_event_ap_probe_req_rx_t;
 
-/**
-  * @brief WiFi ioctl command type
-  *
-  */
-typedef enum {
-    WIFI_IOCTL_SET_STA_HT2040_COEX = 1, /**< Set the configuration of STA's HT2040 coexist management */
-    WIFI_IOCTL_GET_STA_HT2040_COEX,     /**< Get the configuration of STA's HT2040 coexist management */
-    WIFI_IOCTL_MAX,
-} wifi_ioctl_cmd_t;
-
-/**
- * @brief Configuration for STA's HT2040 coexist management
- *
- */
-typedef struct {
-    int enable;                         /**< Indicate whether STA's HT2040 coexist management is enabled or not */
-} wifi_ht2040_coex_t;
-
-/**
-  * @brief Configuration for WiFi ioctl
-  *
-  */
-typedef struct {
-    union {
-        wifi_ht2040_coex_t ht2040_coex; /**< Configuration of STA's HT2040 coexist management */
-    } data;                             /**< Configuration of ioctl command */
-} wifi_ioctl_config_t;
-
 #ifdef __cplusplus
 }
 #endif

+ 1 - 1
components/esp_wifi/lib_esp32

@@ -1 +1 @@
-Subproject commit 11d6683dc3ad699f2e8b022f01c49774d5e337cd
+Subproject commit 15c50f392523d4dab32a0a5ab3cec7fd611ea471

+ 10 - 0
components/esp_wifi/test/CMakeLists.txt

@@ -16,6 +16,16 @@ string(SUBSTRING "${WIFI_CRYPTO_MD5}" 0 7 WIFI_CRYPTO_MD5)
 file(MD5 ${esp_wifi_dir}/include/esp_coexist_adapter.h COEX_ADAPTER_MD5)
 string(SUBSTRING "${COEX_ADAPTER_MD5}" 0 7 COEX_ADAPTER_MD5)
 
+# Calculate MD5 value of header file esp_wifi_types.h
+file(MD5 ${esp_wifi_dir}/include/esp_wifi_types.h WIFI_TYPE_MD5)
+string(SUBSTRING "${WIFI_TYPE_MD5}" 0 7 WIFI_TYPE_MD5)
+
+# Calculate MD5 value of header file esp_wifi.h
+file(MD5 ${esp_wifi_dir}/include/esp_wifi.h WIFI_ESP_WIFI_MD5)
+string(SUBSTRING "${WIFI_ESP_WIFI_MD5}" 0 7 WIFI_ESP_WIFI_MD5)
+
 add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\")
 add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\")
 add_definitions(-DCOEX_ADAPTER_MD5=\"${COEX_ADAPTER_MD5}\")
+add_definitions(-DWIFI_TYPE_MD5=\"${WIFI_TYPE_MD5}\")
+add_definitions(-DWIFI_ESP_WIFI_MD5=\"${WIFI_ESP_WIFI_MD5}\")

+ 8 - 0
components/esp_wifi/test/component.mk

@@ -17,3 +17,11 @@ CFLAGS+=-DWIFI_CRYPTO_MD5=$(WIFI_CRYPTO_MD5_VAL)
 # Calculate MD5 value of header file esp_coexist_adapter.h
 COEX_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_coexist_adapter.h | cut -c 1-7)\"
 CFLAGS+=-DCOEX_ADAPTER_MD5=$(COEX_ADAPTER_MD5_VAL)
+
+# Calculate MD5 value of header file esp_wifi_types.h
+WIFI_TYPE_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_wifi_types.h | cut -c 1-7)\"
+CFLAGS+=-DWIFI_TYPE_MD5=$(WIFI_TYPE_MD5_VAL)
+
+# Calculate MD5 value of header file esp_wifi.h
+WIFI_ESP_WIFI_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_wifi.h | cut -c 1-7)\"
+CFLAGS+=-DWIFI_ESP_WIFI_MD5=$(WIFI_ESP_WIFI_MD5_VAL)

+ 23 - 3
components/esp_wifi/test/test_header_files_md5.c

@@ -12,7 +12,7 @@ TEST_CASE("wifi os adapter MD5","[wifi]")
 {    
     const char *test_wifi_os_funcs_md5 = WIFI_OS_ADAPTER_MD5;
 
-    ESP_LOGI(TAG, "test wifi os adapter MD5...");
+    ESP_LOGI(TAG, "test esp_wifi_os_adapter.h MD5...");
     TEST_ESP_OK(esp_wifi_internal_osi_funcs_md5_check(test_wifi_os_funcs_md5));
 
     ESP_LOGI(TAG, "test passed...");
@@ -22,7 +22,7 @@ TEST_CASE("wifi crypto types MD5","[wifi]")
 {   
     const char *test_wifi_crypto_funcs_md5 = WIFI_CRYPTO_MD5;
 
-    ESP_LOGI(TAG, "test wifi crypto adapter MD5...");
+    ESP_LOGI(TAG, "test esp_wifi_crypto_types.h MD5...");
     TEST_ESP_OK(esp_wifi_internal_crypto_funcs_md5_check(test_wifi_crypto_funcs_md5));
 
     ESP_LOGI(TAG, "test passed...");
@@ -32,8 +32,28 @@ TEST_CASE("coexist adapter MD5","[coex]")
 {
     const char *test_coex_adapter_funcs_md5 = COEX_ADAPTER_MD5;
 
-    ESP_LOGI(TAG, "test coexist adapter MD5...");
+    ESP_LOGI(TAG, "test esp_coexist_adapter.h MD5...");
     TEST_ESP_OK(esp_coex_adapter_funcs_md5_check(test_coex_adapter_funcs_md5));
 
     ESP_LOGI(TAG, "test passed...");
 }
+
+TEST_CASE("wifi type MD5","[wifi]")
+{
+    const char *test_wifi_type_md5 = WIFI_TYPE_MD5;
+
+    ESP_LOGI(TAG, "test esp_wifi_types.h MD5...");
+    TEST_ESP_OK(esp_wifi_internal_wifi_type_md5_check(test_wifi_type_md5));
+
+    ESP_LOGI(TAG, "test passed...");
+}
+
+TEST_CASE("esp wifi MD5","[wifi]")
+{
+    const char *test_esp_wifi_md5 = WIFI_ESP_WIFI_MD5;
+
+    ESP_LOGI(TAG, "test esp_wifi.h MD5...");
+    TEST_ESP_OK(esp_wifi_internal_esp_wifi_md5_check(test_esp_wifi_md5));
+
+    ESP_LOGI(TAG, "test passed...");
+}