Skip to content

Commit

Permalink
Merge branch 'bugfix/modify_wifi_country_struct' into 'master'
Browse files Browse the repository at this point in the history
esp32: make wifi_country_t in idf consistent with VNC

See merge request espressif/esp-idf!5463
  • Loading branch information
jack0c committed Jul 15, 2019
2 parents 6ae352c + 8f2d13d commit fdab15d
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 54 deletions.
25 changes: 25 additions & 0 deletions components/esp_wifi/include/esp_private/esp_wifi_private.h
Original file line number Diff line number Diff line change
@@ -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 changes: 25 additions & 0 deletions components/esp_wifi/include/esp_private/esp_wifi_types_private.h
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions components/esp_wifi/include/esp_private/wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "esp_event.h"
#include "esp_wifi.h"
#include "esp_smartconfig.h"
#include "wifi_types.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -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
*
Expand Down
54 changes: 54 additions & 0 deletions components/esp_wifi/include/esp_private/wifi_types.h
Original file line number Diff line number Diff line change
@@ -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
31 changes: 15 additions & 16 deletions components/esp_wifi/include/esp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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
*
Expand All @@ -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.
*
Expand Down
35 changes: 1 addition & 34 deletions components/esp_wifi/include/esp_wifi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/esp_wifi/lib_esp32
10 changes: 10 additions & 0 deletions components/esp_wifi/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 8 additions & 0 deletions components/esp_wifi/test/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
26 changes: 23 additions & 3 deletions components/esp_wifi/test/test_header_files_md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand All @@ -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...");
Expand All @@ -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...");
}

0 comments on commit fdab15d

Please sign in to comment.