mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-30 04:21:00 +02:00
Update IDF to e5b2c1c (#865)
* Update BLE Library * Fix SD driver * Update toolchain * Update IDF to e5b2c1c
This commit is contained in:
@ -64,14 +64,14 @@ void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const cha
|
||||
*/
|
||||
#ifdef NDEBUG
|
||||
#define ESP_ERROR_CHECK(x) do { \
|
||||
esp_err_t rc = (x); \
|
||||
(void) sizeof(rc); \
|
||||
esp_err_t __err_rc = (x); \
|
||||
(void) sizeof(__err_rc); \
|
||||
} while(0);
|
||||
#else
|
||||
#define ESP_ERROR_CHECK(x) do { \
|
||||
esp_err_t rc = (x); \
|
||||
if (rc != ESP_OK) { \
|
||||
_esp_error_check_failed(rc, __FILE__, __LINE__, \
|
||||
esp_err_t __err_rc = (x); \
|
||||
if (__err_rc != ESP_OK) { \
|
||||
_esp_error_check_failed(__err_rc, __FILE__, __LINE__, \
|
||||
__ASSERT_FUNC, #x); \
|
||||
} \
|
||||
} while(0);
|
||||
|
@ -45,7 +45,7 @@ typedef enum {
|
||||
SYSTEM_EVENT_AP_STACONNECTED, /**< a station connected to ESP32 soft-AP */
|
||||
SYSTEM_EVENT_AP_STADISCONNECTED, /**< a station disconnected from ESP32 soft-AP */
|
||||
SYSTEM_EVENT_AP_PROBEREQRECVED, /**< Receive probe request packet in soft-AP interface */
|
||||
SYSTEM_EVENT_AP_STA_GOT_IP6, /**< ESP32 station or ap interface v6IP addr is preferred */
|
||||
SYSTEM_EVENT_GOT_IP6, /**< ESP32 station or ap or ethernet interface v6IP addr is preferred */
|
||||
SYSTEM_EVENT_ETH_START, /**< ESP32 ethernet start */
|
||||
SYSTEM_EVENT_ETH_STOP, /**< ESP32 ethernet stop */
|
||||
SYSTEM_EVENT_ETH_CONNECTED, /**< ESP32 ethernet phy link up */
|
||||
@ -54,6 +54,11 @@ typedef enum {
|
||||
SYSTEM_EVENT_MAX
|
||||
} system_event_id_t;
|
||||
|
||||
/* add this macro define for compatible with old IDF version */
|
||||
#ifndef SYSTEM_EVENT_AP_STA_GOT_IP6
|
||||
#define SYSTEM_EVENT_AP_STA_GOT_IP6 SYSTEM_EVENT_GOT_IP6
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
WPS_FAIL_REASON_NORMAL = 0, /**< ESP32 WPS normal fail reason */
|
||||
WPS_FAIL_REASON_RECV_M2D, /**< ESP32 WPS receive M2D frame */
|
||||
@ -95,8 +100,9 @@ typedef struct {
|
||||
} system_event_sta_wps_er_pin_t;
|
||||
|
||||
typedef struct {
|
||||
tcpip_adapter_if_t if_index;
|
||||
tcpip_adapter_ip6_info_t ip6_info;
|
||||
} system_event_ap_sta_got_ip6_t;
|
||||
} system_event_got_ip6_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t mac[6]; /**< MAC address of the station connected to ESP32 soft-AP */
|
||||
@ -124,7 +130,7 @@ typedef union {
|
||||
system_event_ap_staconnected_t sta_connected; /**< a station connected to ESP32 soft-AP */
|
||||
system_event_ap_stadisconnected_t sta_disconnected; /**< a station disconnected to ESP32 soft-AP */
|
||||
system_event_ap_probe_req_rx_t ap_probereqrecved; /**< ESP32 soft-AP receive probe request packet */
|
||||
system_event_ap_sta_got_ip6_t got_ip6; /**< ESP32 station or ap ipv6 addr state change to preferred */
|
||||
system_event_got_ip6_t got_ip6; /**< ESP32 station or ap or ethernet ipv6 addr state change to preferred */
|
||||
} system_event_info_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -89,6 +89,13 @@ esp_err_t esp_register_freertos_tick_hook_for_cpu(esp_freertos_tick_cb_t new_tic
|
||||
*/
|
||||
esp_err_t esp_register_freertos_tick_hook(esp_freertos_tick_cb_t new_tick_cb);
|
||||
|
||||
/**
|
||||
* @brief Unregister an idle callback from the idle hook of the specified core
|
||||
*
|
||||
* @param[in] old_idle_cb Callback to be unregistered
|
||||
* @param[in] cpuid id of the core
|
||||
*/
|
||||
void esp_deregister_freertos_idle_hook_for_cpu(esp_freertos_idle_cb_t old_idle_cb, UBaseType_t cpuid);
|
||||
|
||||
/**
|
||||
* @brief Unregister an idle callback. If the idle callback is registered to
|
||||
@ -99,6 +106,13 @@ esp_err_t esp_register_freertos_tick_hook(esp_freertos_tick_cb_t new_tick_cb);
|
||||
*/
|
||||
void esp_deregister_freertos_idle_hook(esp_freertos_idle_cb_t old_idle_cb);
|
||||
|
||||
/**
|
||||
* @brief Unregister a tick callback from the tick hook of the specified core
|
||||
*
|
||||
* @param[in] old_tick_cb Callback to be unregistered
|
||||
* @param[in] cpuid id of the core
|
||||
*/
|
||||
void esp_deregister_freertos_tick_hook_for_cpu(esp_freertos_tick_cb_t old_tick_cb, UBaseType_t cpuid);
|
||||
|
||||
/**
|
||||
* @brief Unregister a tick callback. If the tick callback is registered to the
|
||||
|
@ -48,6 +48,7 @@ extern "C" {
|
||||
#define ESP_ERR_ESPNOW_NOT_FOUND (ESP_ERR_ESPNOW_BASE + 4) /*!< ESPNOW peer is not found */
|
||||
#define ESP_ERR_ESPNOW_INTERNAL (ESP_ERR_ESPNOW_BASE + 5) /*!< Internal error */
|
||||
#define ESP_ERR_ESPNOW_EXIST (ESP_ERR_ESPNOW_BASE + 6) /*!< ESPNOW peer has existed */
|
||||
#define ESP_ERR_ESPNOW_IF (ESP_ERR_ESPNOW_BASE + 7) /*!< Interface error */
|
||||
|
||||
#define ESP_NOW_ETH_ALEN 6 /*!< Length of ESPNOW peer MAC address */
|
||||
#define ESP_NOW_KEY_LEN 16 /*!< Length of ESPNOW peer local master key */
|
||||
@ -191,6 +192,7 @@ esp_err_t esp_now_unregister_send_cb(void);
|
||||
* - ESP_ERR_ESPNOW_INTERNAL : internal error
|
||||
* - ESP_ERR_ESPNOW_NO_MEM : out of memory
|
||||
* - ESP_ERR_ESPNOW_NOT_FOUND : peer is not found
|
||||
* - ESP_ERR_ESPNOW_IF : current WiFi interface doesn't match that of peer
|
||||
*/
|
||||
esp_err_t esp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len);
|
||||
|
||||
|
@ -35,21 +35,23 @@
|
||||
/* controller */
|
||||
#define ESP_TASK_BT_CONTROLLER_PRIO (ESP_TASK_PRIO_MAX - 2)
|
||||
#ifdef CONFIG_NEWLIB_NANO_FORMAT
|
||||
#define BT_TASK_EXTRA_STACK_SIZE (0)
|
||||
#define TASK_EXTRA_STACK_SIZE (0)
|
||||
#else
|
||||
#define BT_TASK_EXTRA_STACK_SIZE (512)
|
||||
#define TASK_EXTRA_STACK_SIZE (512)
|
||||
#endif
|
||||
#define ESP_TASK_BT_CONTROLLER_STACK (3584 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
|
||||
#define BT_TASK_EXTRA_STACK_SIZE TASK_EXTRA_STACK_SIZE
|
||||
#define ESP_TASK_BT_CONTROLLER_STACK (3584 + TASK_EXTRA_STACK_SIZE)
|
||||
|
||||
|
||||
/* idf task */
|
||||
#define ESP_TASK_TIMER_PRIO (ESP_TASK_PRIO_MAX - 3)
|
||||
#define ESP_TASK_TIMER_STACK CONFIG_TIMER_TASK_STACK_SIZE
|
||||
#define ESP_TASK_TIMER_STACK (CONFIG_TIMER_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
#define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5)
|
||||
#define ESP_TASKD_EVENT_STACK CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE
|
||||
#define ESP_TASKD_EVENT_STACK (CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
#define ESP_TASK_TCPIP_PRIO (ESP_TASK_PRIO_MAX - 7)
|
||||
#define ESP_TASK_TCPIP_STACK CONFIG_TCPIP_TASK_STACK_SIZE
|
||||
#define ESP_TASK_TCPIP_STACK (CONFIG_TCPIP_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
#define ESP_TASK_MAIN_PRIO (ESP_TASK_PRIO_MIN + 1)
|
||||
#define ESP_TASK_MAIN_STACK CONFIG_MAIN_TASK_STACK_SIZE
|
||||
#define ESP_TASK_MAIN_STACK (CONFIG_MAIN_TASK_STACK_SIZE + TASK_EXTRA_STACK_SIZE)
|
||||
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@
|
||||
// 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
|
||||
@ -12,63 +12,152 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __ESP_TASK_WDT_H
|
||||
#define __ESP_TASK_WDT_H
|
||||
#pragma once
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup Watchdog_APIs Watchdog APIs
|
||||
* @brief Watchdog APIs
|
||||
*/
|
||||
|
||||
/** @addtogroup Watchdog_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
This routine enables a more general-purpose task watchdog: tasks can individually
|
||||
feed the watchdog and the watchdog will bark if one or more tasks haven't fed the
|
||||
watchdog within the specified time. Optionally, the idle tasks can also configured
|
||||
to feed the watchdog in a similar fashion, to detect CPU starvation.
|
||||
|
||||
This uses the TIMERG0 WDT.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize the task watchdog. This is called in the init code, if the
|
||||
* task watchdog is enabled in menuconfig.
|
||||
* @brief Initialize the Task Watchdog Timer (TWDT)
|
||||
*
|
||||
*/
|
||||
void esp_task_wdt_init();
|
||||
|
||||
/**
|
||||
* @brief Feed the watchdog. After the first feeding session, the watchdog will expect the calling
|
||||
* task to keep feeding the watchdog until task_wdt_delete() is called.
|
||||
* This function configures and initializes the TWDT. If the TWDT is already
|
||||
* initialized when this function is called, this function will update the
|
||||
* TWDT's timeout period and panic configurations instead. After initializing
|
||||
* the TWDT, any task can elect to be watched by the TWDT by subscribing to it
|
||||
* using esp_task_wdt_add().
|
||||
*
|
||||
*/
|
||||
|
||||
void esp_task_wdt_feed();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Delete the watchdog for the current task.
|
||||
* @param[in] timeout Timeout period of TWDT in seconds
|
||||
* @param[in] panic Flag that controls whether the panic handler will be
|
||||
* executed when the TWDT times out
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Initialization was successful
|
||||
* - ESP_ERR_NO_MEM: Initialization failed due to lack of memory
|
||||
*
|
||||
* @note esp_task_wdt_init() must only be called after the scheduler
|
||||
* started
|
||||
*/
|
||||
void esp_task_wdt_delete();
|
||||
esp_err_t esp_task_wdt_init(uint32_t timeout, bool panic);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @brief Deinitialize the Task Watchdog Timer (TWDT)
|
||||
*
|
||||
* This function will deinitialize the TWDT. Calling this function whilst tasks
|
||||
* are still subscribed to the TWDT, or when the TWDT is already deinitialized,
|
||||
* will result in an error code being returned.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: TWDT successfully deinitialized
|
||||
* - ESP_ERR_INVALID_STATE: Error, tasks are still subscribed to the TWDT
|
||||
* - ESP_ERR_NOT_FOUND: Error, TWDT has already been deinitialized
|
||||
*/
|
||||
esp_err_t esp_task_wdt_deinit();
|
||||
|
||||
/**
|
||||
* @brief Subscribe a task to the Task Watchdog Timer (TWDT)
|
||||
*
|
||||
* This function subscribes a task to the TWDT. Each subscribed task must
|
||||
* periodically call esp_task_wdt_reset() to prevent the TWDT from elapsing its
|
||||
* timeout period. Failure to do so will result in a TWDT timeout. If the task
|
||||
* being subscribed is one of the Idle Tasks, this function will automatically
|
||||
* enable esp_task_wdt_reset() to called from the Idle Hook of the Idle Task.
|
||||
* Calling this function whilst the TWDT is uninitialized or attempting to
|
||||
* subscribe an already subscribed task will result in an error code being
|
||||
* returned.
|
||||
*
|
||||
* @param[in] handle Handle of the task. Input NULL to subscribe the current
|
||||
* running task to the TWDT
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Successfully subscribed the task to the TWDT
|
||||
* - ESP_ERR_INVALID_ARG: Error, the task is already subscribed
|
||||
* - ESP_ERR_NO_MEM: Error, could not subscribe the task due to lack of
|
||||
* memory
|
||||
* - ESP_ERR_INVALID_STATE: Error, the TWDT has not been initialized yet
|
||||
*/
|
||||
esp_err_t esp_task_wdt_add(TaskHandle_t handle);
|
||||
|
||||
/**
|
||||
* @brief Reset the Task Watchdog Timer (TWDT) on behalf of the currently
|
||||
* running task
|
||||
*
|
||||
* This function will reset the TWDT on behalf of the currently running task.
|
||||
* Each subscribed task must periodically call this function to prevent the
|
||||
* TWDT from timing out. If one or more subscribed tasks fail to reset the
|
||||
* TWDT on their own behalf, a TWDT timeout will occur. If the IDLE tasks have
|
||||
* been subscribed to the TWDT, they will automatically call this function from
|
||||
* their idle hooks. Calling this function from a task that has not subscribed
|
||||
* to the TWDT, or when the TWDT is uninitialized will result in an error code
|
||||
* being returned.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Successfully reset the TWDT on behalf of the currently
|
||||
* running task
|
||||
* - ESP_ERR_NOT_FOUND: Error, the current running task has not subscribed
|
||||
* to the TWDT
|
||||
* - ESP_ERR_INVALID_STATE: Error, the TWDT has not been initialized yet
|
||||
*/
|
||||
esp_err_t esp_task_wdt_reset();
|
||||
|
||||
/**
|
||||
* @brief Unsubscribes a task from the Task Watchdog Timer (TWDT)
|
||||
*
|
||||
* This function will unsubscribe a task from the TWDT. After being
|
||||
* unsubscribed, the task should no longer call esp_task_wdt_reset(). If the
|
||||
* task is an IDLE task, this function will automatically disable the calling
|
||||
* of esp_task_wdt_reset() from the Idle Hook. Calling this function whilst the
|
||||
* TWDT is uninitialized or attempting to unsubscribe an already unsubscribed
|
||||
* task from the TWDT will result in an error code being returned.
|
||||
*
|
||||
* @param[in] handle Handle of the task. Input NULL to unsubscribe the
|
||||
* current running task.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Successfully unsubscribed the task from the TWDT
|
||||
* - ESP_ERR_INVALID_ARG: Error, the task is already unsubscribed
|
||||
* - ESP_ERR_INVALID_STATE: Error, the TWDT has not been initialized yet
|
||||
*/
|
||||
esp_err_t esp_task_wdt_delete(TaskHandle_t handle);
|
||||
|
||||
/**
|
||||
* @brief Query whether a task is subscribed to the Task Watchdog Timer (TWDT)
|
||||
*
|
||||
* This function will query whether a task is currently subscribed to the TWDT,
|
||||
* or whether the TWDT is initialized.
|
||||
*
|
||||
* @param[in] handle Handle of the task. Input NULL to query the current
|
||||
* running task.
|
||||
*
|
||||
* @return:
|
||||
* - ESP_OK: The task is currently subscribed to the TWDT
|
||||
* - ESP_ERR_NOT_FOUND: The task is currently not subscribed to the TWDT
|
||||
* - ESP_ERR_INVALID_STATE: The TWDT is not initialized, therefore no tasks
|
||||
* can be subscribed
|
||||
*/
|
||||
esp_err_t esp_task_wdt_status(TaskHandle_t handle);
|
||||
|
||||
/**
|
||||
* @brief Reset the TWDT on behalf of the current running task, or
|
||||
* subscribe the TWDT to if it has not done so already
|
||||
*
|
||||
* @warning This function is deprecated, use esp_task_wdt_add() and
|
||||
* esp_task_wdt_reset() instead
|
||||
*
|
||||
* This function is similar to esp_task_wdt_reset() and will reset the TWDT on
|
||||
* behalf of the current running task. However if this task has not subscribed
|
||||
* to the TWDT, this function will automatically subscribe the task. Therefore,
|
||||
* an unsubscribed task will subscribe to the TWDT on its first call to this
|
||||
* function, then proceed to reset the TWDT on subsequent calls of this
|
||||
* function.
|
||||
*/
|
||||
void esp_task_wdt_feed() __attribute__ ((deprecated));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -91,6 +91,8 @@ extern "C" {
|
||||
#define ESP_ERR_WIFI_PASSWORD (ESP_ERR_WIFI_BASE + 11) /*!< Password is invalid */
|
||||
#define ESP_ERR_WIFI_TIMEOUT (ESP_ERR_WIFI_BASE + 12) /*!< Timeout error */
|
||||
#define ESP_ERR_WIFI_WAKE_FAIL (ESP_ERR_WIFI_BASE + 13) /*!< WiFi is in sleep state(RF closed) and wakeup fail */
|
||||
#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 */
|
||||
|
||||
/**
|
||||
* @brief WiFi stack configuration parameters passed to esp_wifi_init call.
|
||||
@ -103,7 +105,8 @@ typedef struct {
|
||||
int tx_buf_type; /**< WiFi TX buffer type */
|
||||
int static_tx_buf_num; /**< WiFi static TX buffer number */
|
||||
int dynamic_tx_buf_num; /**< WiFi dynamic TX buffer number */
|
||||
int ampdu_enable; /**< WiFi AMPDU feature enable flag */
|
||||
int ampdu_rx_enable; /**< WiFi AMPDU RX feature enable flag */
|
||||
int ampdu_tx_enable; /**< WiFi AMPDU TX feature enable flag */
|
||||
int nvs_enable; /**< WiFi NVS flash enable flag */
|
||||
int nano_enable; /**< Nano option for printf/scan family enable flag */
|
||||
int tx_ba_win; /**< WiFi Block Ack TX window size */
|
||||
@ -123,10 +126,16 @@ typedef struct {
|
||||
#define WIFI_DYNAMIC_TX_BUFFER_NUM 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP32_WIFI_AMPDU_ENABLED
|
||||
#define WIFI_AMPDU_ENABLED 1
|
||||
#if CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED
|
||||
#define WIFI_AMPDU_RX_ENABLED 1
|
||||
#else
|
||||
#define WIFI_AMPDU_ENABLED 0
|
||||
#define WIFI_AMPDU_RX_ENABLED 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED
|
||||
#define WIFI_AMPDU_TX_ENABLED 1
|
||||
#else
|
||||
#define WIFI_AMPDU_TX_ENABLED 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP32_WIFI_NVS_ENABLED
|
||||
@ -145,12 +154,16 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
|
||||
|
||||
#define WIFI_INIT_CONFIG_MAGIC 0x1F2F3F4F
|
||||
|
||||
#ifdef CONFIG_ESP32_WIFI_AMPDU_ENABLED
|
||||
#ifdef CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED
|
||||
#define WIFI_DEFAULT_TX_BA_WIN CONFIG_ESP32_WIFI_TX_BA_WIN
|
||||
#else
|
||||
#define WIFI_DEFAULT_TX_BA_WIN 0 /* unused if ampdu_tx_enable == false */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED
|
||||
#define WIFI_DEFAULT_RX_BA_WIN CONFIG_ESP32_WIFI_RX_BA_WIN
|
||||
#else
|
||||
#define WIFI_DEFAULT_TX_BA_WIN 0 /* unused if ampdu_enable == false */
|
||||
#define WIFI_DEFAULT_RX_BA_WIN 0
|
||||
#define WIFI_DEFAULT_RX_BA_WIN 0 /* unused if ampdu_rx_enable == false */
|
||||
#endif
|
||||
|
||||
#define WIFI_INIT_CONFIG_DEFAULT() { \
|
||||
@ -161,7 +174,8 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
|
||||
.tx_buf_type = CONFIG_ESP32_WIFI_TX_BUFFER_TYPE,\
|
||||
.static_tx_buf_num = WIFI_STATIC_TX_BUFFER_NUM,\
|
||||
.dynamic_tx_buf_num = WIFI_DYNAMIC_TX_BUFFER_NUM,\
|
||||
.ampdu_enable = WIFI_AMPDU_ENABLED,\
|
||||
.ampdu_rx_enable = WIFI_AMPDU_RX_ENABLED,\
|
||||
.ampdu_tx_enable = WIFI_AMPDU_TX_ENABLED,\
|
||||
.nvs_enable = WIFI_NVS_ENABLED,\
|
||||
.nano_enable = WIFI_NANO_FORMAT_ENABLED,\
|
||||
.tx_ba_win = WIFI_DEFAULT_TX_BA_WIN,\
|
||||
@ -392,7 +406,8 @@ esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_re
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - others: fail
|
||||
* - ESP_ERR_WIFI_CONN: The station interface don't initialized
|
||||
* - ESP_ERR_WIFI_NOT_CONNECT: The station is in disconnect status
|
||||
*/
|
||||
esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);
|
||||
|
||||
@ -520,11 +535,12 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
|
||||
* @brief configure country info
|
||||
*
|
||||
* @attention 1. The default country is {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}
|
||||
* @attention 2. When the country policy is WIFI_COUNTRY_POLICY_AUTO, use the country info of AP to which
|
||||
* the station is connected. E.g. if the configured country info is {.cc="USA", .schan=1, .nchan=11},
|
||||
* the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14},
|
||||
* then our country info is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected
|
||||
* from the AP, the country info back to {.cc="USA", .schan=1, .nchan=11} again.
|
||||
* @attention 2. When the country policy is WIFI_COUNTRY_POLICY_AUTO, the country info of the AP to which
|
||||
* the station is connected is used. E.g. if the configured country info is {.cc="USA", .schan=1, .nchan=11}
|
||||
* and the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14}
|
||||
* then the country info that will be used is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected
|
||||
* from the AP the country info is set back back to the country info of the station automatically,
|
||||
* {.cc="USA", .schan=1, .nchan=11} in the example.
|
||||
* @attention 3. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, always use the configured country info.
|
||||
* @attention 4. When the country info is changed because of configuration or because the station connects to a different
|
||||
* external AP, the country IE in probe response/beacon of the soft-AP is changed also.
|
||||
@ -637,11 +653,11 @@ esp_err_t esp_wifi_set_promiscuous(bool en);
|
||||
esp_err_t esp_wifi_get_promiscuous(bool *en);
|
||||
|
||||
/**
|
||||
* @brief Enable the promiscuous filter.
|
||||
* @brief Enable the promiscuous mode packet type filter.
|
||||
*
|
||||
* @attention 1. The default filter is to filter all packets except WIFI_PKT_MISC
|
||||
* @note The default filter is to filter all packets except WIFI_PKT_MISC
|
||||
*
|
||||
* @param filter the packet type filtered by promisucous
|
||||
* @param filter the packet type filtered in promiscuous mode.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
@ -669,7 +685,7 @@ esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
|
||||
* @attention 3. ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as
|
||||
* the channel of the ESP32 station.
|
||||
*
|
||||
* @param ifx interface
|
||||
* @param interface interface
|
||||
* @param conf station or soft-AP configuration
|
||||
*
|
||||
* @return
|
||||
@ -682,12 +698,12 @@ esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
|
||||
* - ESP_ERR_WIFI_NVS: WiFi internal NVS error
|
||||
* - others: refer to the erro code in esp_err.h
|
||||
*/
|
||||
esp_err_t esp_wifi_set_config(wifi_interface_t ifx, const wifi_config_t *conf);
|
||||
esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);
|
||||
|
||||
/**
|
||||
* @brief Get configuration of specified interface
|
||||
*
|
||||
* @param ifx interface
|
||||
* @param interface interface
|
||||
* @param[out] conf station or soft-AP configuration
|
||||
*
|
||||
* @return
|
||||
@ -696,7 +712,7 @@ esp_err_t esp_wifi_set_config(wifi_interface_t ifx, const wifi_config_t *conf);
|
||||
* - ESP_ERR_WIFI_ARG: invalid argument
|
||||
* - ESP_ERR_WIFI_IF: invalid interface
|
||||
*/
|
||||
esp_err_t esp_wifi_get_config(wifi_interface_t ifx, wifi_config_t *conf);
|
||||
esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
|
||||
|
||||
/**
|
||||
* @brief Get STAs associated with soft-AP
|
||||
|
@ -16,15 +16,21 @@
|
||||
#ifndef __ESP_WIFI_CRYPTO_TYPES_H__
|
||||
#define __ESP_WIFI_CRYPTO_TYPES_H__
|
||||
|
||||
/* This is an internal API header for configuring the implementation used for WiFi cryptographic
|
||||
operations.
|
||||
|
||||
During normal operation, you don't need to use any of these types or functions in this header.
|
||||
See esp_wifi.h & esp_wifi_types.h instead.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This enumation is about alorigthm will be set when do crypt hash
|
||||
* operation.When do wpa2 connecting, after invoke crypto_hash_xxx of
|
||||
* fast_crypto_hash_xxx API, it will do relation crypt operation according
|
||||
* to the enumation.
|
||||
* Enumeration for hash operations.
|
||||
* When WPA2 is connecting, this enum is used to
|
||||
* request a hash algorithm via crypto_hash_xxx functions.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_CRYPTO_HASH_ALG_MD5, ESP_CRYPTO_HASH_ALG_SHA1,
|
||||
@ -33,10 +39,9 @@ typedef enum {
|
||||
}esp_crypto_hash_alg_t;
|
||||
|
||||
/*
|
||||
* This enumation is about alorigthm will be set when do crypt cipher
|
||||
* operation.When do wpa2 connecting, after invoke crypto_cipher_xxx of
|
||||
* fast_crypto_cipher_xxx API, it will do relation crypt operation according
|
||||
* to the enumation.
|
||||
* Enumeration for block cipher operations.
|
||||
* When WPA2 is connecting, this enum is used to request a block
|
||||
* cipher algorithm via crypto_cipher_xxx functions.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_CRYPTO_CIPHER_NULL, ESP_CRYPTO_CIPHER_ALG_AES, ESP_CRYPTO_CIPHER_ALG_3DES,
|
||||
@ -293,7 +298,7 @@ typedef struct {
|
||||
esp_crypto_cipher_deinit_t crypto_cipher_deinit; /**< function used to free context when use TLSV1 */
|
||||
esp_sha256_vector_t sha256_vector; /**< function used to do X.509v3 certificate parsing and processing */
|
||||
esp_crypto_mod_exp_t crypto_mod_exp; /**< function used to do key exchange when use TLSV1 */
|
||||
}wpa2_crypto_funcs_t;
|
||||
} wpa2_crypto_funcs_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ typedef enum {
|
||||
WIFI_COUNTRY_POLICY_MANUAL, /**< Country policy is manual, always use the configured country info */
|
||||
} wifi_country_policy_t;
|
||||
|
||||
/** @brief Structure describing WiFi country-based regional restrictions. */
|
||||
typedef struct {
|
||||
char cc[3]; /**< country code string */
|
||||
uint8_t schan; /**< start channel */
|
||||
@ -61,7 +62,7 @@ typedef enum {
|
||||
WIFI_AUTH_MAX
|
||||
} wifi_auth_mode_t;
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
WIFI_REASON_UNSPECIFIED = 1,
|
||||
WIFI_REASON_AUTH_EXPIRE = 2,
|
||||
WIFI_REASON_AUTH_LEAVE = 3,
|
||||
@ -91,7 +92,7 @@ enum {
|
||||
WIFI_REASON_AUTH_FAIL = 202,
|
||||
WIFI_REASON_ASSOC_FAIL = 203,
|
||||
WIFI_REASON_HANDSHAKE_TIMEOUT = 204,
|
||||
};
|
||||
} wifi_err_reason_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_SECOND_CHAN_NONE = 0, /**< the channel width is HT20 */
|
||||
@ -104,18 +105,21 @@ typedef enum {
|
||||
WIFI_SCAN_TYPE_PASSIVE, /**< passive scan */
|
||||
} wifi_scan_type_t;
|
||||
|
||||
/** @brief Range of active scan times per channel */
|
||||
typedef struct {
|
||||
uint32_t min; /**< minimum active scan time per channel, units: millisecond */
|
||||
uint32_t max; /**< maximum active scan time per channel, units: millisecond, values above 1500ms may
|
||||
cause station to disconnect from AP and are not recommended. */
|
||||
} wifi_active_scan_time_t;
|
||||
|
||||
/** @brief Aggregate of active & passive scan time per channel */
|
||||
typedef union {
|
||||
wifi_active_scan_time_t active; /**< active scan time per channel */
|
||||
wifi_active_scan_time_t active; /**< active scan time per channel, units: millisecond. */
|
||||
uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may
|
||||
cause station to disconnect from AP and are not recommended. */
|
||||
} wifi_scan_time_t;
|
||||
|
||||
/** @brief Parameters for an SSID scan. */
|
||||
typedef struct {
|
||||
uint8_t *ssid; /**< SSID of AP */
|
||||
uint8_t *bssid; /**< MAC address of AP */
|
||||
@ -135,6 +139,7 @@ typedef enum {
|
||||
WIFI_CIPHER_TYPE_UNKNOWN, /**< the cipher type is unknown */
|
||||
} wifi_cipher_type_t;
|
||||
|
||||
/** @brief Description of an WiFi AP */
|
||||
typedef struct {
|
||||
uint8_t bssid[6]; /**< MAC address of AP */
|
||||
uint8_t ssid[33]; /**< SSID of AP */
|
||||
@ -162,9 +167,10 @@ typedef enum {
|
||||
WIFI_CONNECT_AP_BY_SECURITY, /**< Sort match AP in scan list by security mode */
|
||||
}wifi_sort_method_t;
|
||||
|
||||
/** @brief Structure describing parameters for a WiFi fast scan */
|
||||
typedef struct {
|
||||
int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */
|
||||
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode */
|
||||
int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */
|
||||
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode */
|
||||
}wifi_fast_scan_threshold_t;
|
||||
|
||||
typedef enum {
|
||||
@ -182,6 +188,7 @@ typedef enum {
|
||||
WIFI_BW_HT40, /* Bandwidth is HT40 */
|
||||
} wifi_bandwidth_t;
|
||||
|
||||
/** @brief Soft-AP configuration settings for the ESP32 */
|
||||
typedef struct {
|
||||
uint8_t ssid[32]; /**< SSID of ESP32 soft-AP */
|
||||
uint8_t password[64]; /**< Password of ESP32 soft-AP */
|
||||
@ -193,6 +200,7 @@ typedef struct {
|
||||
uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */
|
||||
} wifi_ap_config_t;
|
||||
|
||||
/** @brief STA configuration settings for the ESP32 */
|
||||
typedef struct {
|
||||
uint8_t ssid[32]; /**< SSID of target AP*/
|
||||
uint8_t password[64]; /**< password of target AP*/
|
||||
@ -204,20 +212,28 @@ typedef struct {
|
||||
wifi_fast_scan_threshold_t threshold; /**< When scan_method is set to WIFI_FAST_SCAN, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used. */
|
||||
} wifi_sta_config_t;
|
||||
|
||||
/** @brief Configuration data for ESP32 AP or STA.
|
||||
*
|
||||
* The usage of this union (for ap or sta configuration) is determined by the accompanying
|
||||
* interface argument passed to esp_wifi_set_config() or esp_wifi_get_config()
|
||||
*
|
||||
*/
|
||||
typedef union {
|
||||
wifi_ap_config_t ap; /**< configuration of AP */
|
||||
wifi_sta_config_t sta; /**< configuration of STA */
|
||||
} wifi_config_t;
|
||||
|
||||
/** @brief Description of STA associated with AP */
|
||||
typedef struct {
|
||||
uint8_t mac[6]; /**< mac address of sta that associated with ESP32 soft-AP */
|
||||
uint8_t mac[6]; /**< mac address */
|
||||
} wifi_sta_info_t;
|
||||
|
||||
#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32 soft-AP */
|
||||
|
||||
/** @brief List of stations associated with the ESP32 Soft-AP */
|
||||
typedef struct {
|
||||
wifi_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< station list */
|
||||
int num; /**< number of station that associated with ESP32 soft-AP */
|
||||
int num; /**< number of stations in the list (other entries are invalid) */
|
||||
} wifi_sta_list_t;
|
||||
|
||||
typedef enum {
|
||||
@ -263,6 +279,7 @@ typedef struct {
|
||||
uint8_t payload[0]; /**< Payload. Length is equal to value in 'length' field, minus 4. */
|
||||
} vendor_ie_data_t;
|
||||
|
||||
/** @brief Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers */
|
||||
typedef struct {
|
||||
signed rssi:8; /**< signal intensity of packet */
|
||||
unsigned rate:5; /**< data rate */
|
||||
@ -277,7 +294,7 @@ typedef struct {
|
||||
unsigned :1; /**< reserve */
|
||||
unsigned aggregation:1; /**< Aggregation */
|
||||
unsigned stbc:2; /**< STBC */
|
||||
unsigned fec_coding:1; /**< if is 11n packet, shows if is LDPC packet or not */
|
||||
unsigned fec_coding:1; /**< Flag is set for 11n packets which are LDPC */
|
||||
unsigned sgi:1; /**< SGI */
|
||||
unsigned noise_floor:8; /**< noise floor */
|
||||
unsigned ampdu_cnt:8; /**< ampdu cnt */
|
||||
@ -286,24 +303,28 @@ typedef struct {
|
||||
unsigned timestamp:32; /**< timestamp */
|
||||
unsigned :32; /**< reserve */
|
||||
unsigned :32; /**< reserve */
|
||||
unsigned sig_len:12; /**< It is really lenth of packet */
|
||||
unsigned sig_len:12; /**< length of packet */
|
||||
unsigned :12; /**< reserve */
|
||||
unsigned rx_state:8; /**< rx state */
|
||||
} wifi_pkt_rx_ctrl_t;
|
||||
|
||||
/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback.
|
||||
*/
|
||||
typedef struct {
|
||||
wifi_pkt_rx_ctrl_t rx_ctrl;
|
||||
uint8_t payload[0]; /**< ieee80211 packet buff, The length of payload is described by sig_len */
|
||||
wifi_pkt_rx_ctrl_t rx_ctrl; /**< metadata header */
|
||||
uint8_t payload[0]; /**< Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback. */
|
||||
} wifi_promiscuous_pkt_t;
|
||||
|
||||
/**
|
||||
* @brief Promiscuous frame type
|
||||
* @brief Promiscuous frame type
|
||||
*
|
||||
* Passed to promiscuous mode RX callback to indicate the type of parameter in the buffer.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
WIFI_PKT_MGMT, /**< management type, receive packet buf is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_DATA, /**< data type, receive packet buf is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_MISC, /**< other type, such as MIMO etc, receive packet buf is wifi_promiscuous_pkt_t but the payload is NULL!!! */
|
||||
WIFI_PKT_MGMT, /**< Management frame, indicates 'buf' argument is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_DATA, /**< Data frame, indiciates 'buf' argument is wifi_promiscuous_pkt_t */
|
||||
WIFI_PKT_MISC, /**< Other type, such as MIMO etc. 'buf' argument is wifi_promiscuous_pkt_t but the payload is zero length. */
|
||||
} wifi_promiscuous_pkt_type_t;
|
||||
|
||||
|
||||
@ -314,8 +335,9 @@ typedef enum {
|
||||
#define WIFI_PROMIS_FILTER_MASK_DATA_MPDU (1<<3) /**< filter the MPDU which is a kind of WIFI_PKT_DATA */
|
||||
#define WIFI_PROMIS_FILTER_MASK_DATA_AMPDU (1<<4) /**< filter the AMPDU which is a kind of WIFI_PKT_DATA */
|
||||
|
||||
/** @brief Mask for filtering different packet types in promiscuous mode. */
|
||||
typedef struct {
|
||||
uint32_t filter_mask;
|
||||
uint32_t filter_mask; /**< OR of one or more filter values WIFI_PROMIS_FILTER_* */
|
||||
} wifi_promiscuous_filter_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user