mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-02 21:41:01 +02:00
Update IDF to e5b2c1c (#865)
* Update BLE Library * Fix SD driver * Update toolchain * Update IDF to e5b2c1c
This commit is contained in:
@ -20,20 +20,21 @@
|
||||
#define _ALARM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/timers.h>
|
||||
#include "esp_timer.h"
|
||||
|
||||
typedef uint32_t period_ms_t;
|
||||
typedef void (*osi_alarm_callback_t)(void *data);
|
||||
typedef struct alarm_t osi_alarm_t;
|
||||
typedef uint64_t period_ms_t;
|
||||
typedef esp_timer_cb_t osi_alarm_callback_t;
|
||||
|
||||
typedef enum {
|
||||
OSI_ALARM_ERR_PASS = 0,
|
||||
OSI_ALARM_ERR_FAIL = -1,
|
||||
OSI_ALARM_ERR_INVALID_ARG = -2,
|
||||
OSI_ALARM_ERR_INVALID_STATE = -3,
|
||||
} osi_alarm_err_t;
|
||||
|
||||
#define ALARM_CBS_NUM 30
|
||||
#define ALARM_ID_BASE 1000
|
||||
typedef struct alarm_t {
|
||||
/* timer id point to here */
|
||||
TimerHandle_t alarm_hdl;
|
||||
osi_alarm_callback_t cb;
|
||||
void *cb_data;
|
||||
} osi_alarm_t;
|
||||
|
||||
int osi_alarm_create_mux(void);
|
||||
int osi_alarm_delete_mux(void);
|
||||
@ -42,27 +43,25 @@ void osi_alarm_deinit(void);
|
||||
|
||||
// Creates a new alarm object. The returned object must be freed by calling
|
||||
// |alarm_free|. Returns NULL on failure.
|
||||
osi_alarm_t *osi_alarm_new(char *alarm_name, osi_alarm_callback_t callback, void *data, period_ms_t timer_expire);
|
||||
osi_alarm_t *osi_alarm_new(const char *alarm_name, osi_alarm_callback_t callback, void *data, period_ms_t timer_expire);
|
||||
|
||||
// Frees an alarm object created by |alarm_new|. |alarm| may be NULL. If the
|
||||
// alarm is pending, it will be cancelled. It is not safe to call |alarm_free|
|
||||
// from inside the callback of |alarm|.
|
||||
int osi_alarm_free(osi_alarm_t *alarm);
|
||||
void osi_alarm_free(osi_alarm_t *alarm);
|
||||
|
||||
// Sets an alarm to fire |cb| after the given |deadline|. Note that |deadline| is the
|
||||
// number of milliseconds relative to the current time. |data| is a context variable
|
||||
// for the callback and may be NULL. |cb| will be called back in the context of an
|
||||
// unspecified thread (i.e. it will not be called back in the same thread as the caller).
|
||||
// |alarm| and |cb| may not be NULL.
|
||||
int osi_alarm_set(osi_alarm_t *alarm, period_ms_t timeout);
|
||||
osi_alarm_err_t osi_alarm_set(osi_alarm_t *alarm, period_ms_t timeout);
|
||||
|
||||
// This function cancels the |alarm| if it was previously set. When this call
|
||||
// returns, the caller has a guarantee that the callback is not in progress and
|
||||
// will not be called if it hasn't already been called. This function is idempotent.
|
||||
// |alarm| may not be NULL.
|
||||
int osi_alarm_cancel(osi_alarm_t *alarm);
|
||||
|
||||
period_ms_t osi_alarm_now(void);
|
||||
osi_alarm_err_t osi_alarm_cancel(osi_alarm_t *alarm);
|
||||
|
||||
// Figure out how much time until next expiration.
|
||||
// Returns 0 if not armed. |alarm| may not be NULL.
|
||||
@ -72,10 +71,6 @@ period_ms_t osi_alarm_get_remaining_ms(const osi_alarm_t *alarm);
|
||||
// Alarm-related state cleanup
|
||||
//void alarm_cleanup(void);
|
||||
|
||||
// Compute time difference (t1-t2) considering tick counter wrap
|
||||
// t1 and t2 should be no greater than the time of MAX ticks
|
||||
period_ms_t osi_alarm_time_diff(period_ms_t t1, period_ms_t t2);
|
||||
|
||||
uint32_t osi_time_get_os_boottime_ms(void);
|
||||
|
||||
#endif /*_ALARM_H_*/
|
||||
|
@ -681,11 +681,15 @@
|
||||
/* The maximum number of simultaneous channels that L2CAP can support. Up to 16*/
|
||||
#ifndef MAX_L2CAP_CHANNELS
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#define MAX_L2CAP_CHANNELS 8
|
||||
#define MAX_L2CAP_CHANNELS 16
|
||||
#else
|
||||
#if (SMP_INCLUDED == FALSE)
|
||||
#define MAX_L2CAP_CHANNELS MAX_ACL_CONNECTIONS //This is used in the BLE client when start connected with the peer device
|
||||
#else
|
||||
#define MAX_L2CAP_CHANNELS (MAX_ACL_CONNECTIONS * 2) //This is used in the BLE client when start connected with the peer device and in SMP
|
||||
#endif ///SMP_INCLUDED == FALSE
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif
|
||||
#endif ///MAX_L2CAP_CHANNELS
|
||||
|
||||
/* The maximum number of simultaneous applications that can register with L2CAP. */
|
||||
#ifndef MAX_L2CAP_CLIENTS
|
||||
|
@ -182,6 +182,7 @@ typedef UINT8 tBTA_GATT_STATUS;
|
||||
#define BTA_GATTC_CONNECT_EVT 35 /* GATTC CONNECT event */
|
||||
#define BTA_GATTC_DISCONNECT_EVT 36 /* GATTC DISCONNECT event */
|
||||
#define BTA_GATTC_READ_MUTIPLE_EVT 37 /* GATTC Read mutiple event */
|
||||
#define BTA_GATTC_QUEUE_FULL_EVT 38 /* GATTC queue full event */
|
||||
|
||||
typedef UINT8 tBTA_GATTC_EVT;
|
||||
|
||||
@ -298,6 +299,7 @@ typedef struct {
|
||||
UINT16 conn_id;
|
||||
tBTA_GATT_STATUS status;
|
||||
UINT16 handle;
|
||||
UINT16 offset;
|
||||
}tBTA_GATTC_WRITE;
|
||||
|
||||
typedef struct {
|
||||
@ -354,6 +356,12 @@ typedef struct {
|
||||
BOOLEAN congested; /* congestion indicator */
|
||||
} tBTA_GATTC_CONGEST;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
UINT16 conn_id;
|
||||
BOOLEAN is_full;
|
||||
} tBTA_GATTC_QUEUE_FULL;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTC_IF client_if;
|
||||
@ -367,14 +375,13 @@ typedef struct {
|
||||
} tBTA_GATTC_ENC_CMPL_CB;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
UINT16 conn_id;
|
||||
tBTA_GATTC_IF client_if;
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_GATTC_CONNECT;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tGATT_DISCONN_REASON reason;
|
||||
UINT16 conn_id;
|
||||
tBTA_GATTC_IF client_if;
|
||||
BD_ADDR remote_bda;
|
||||
@ -400,6 +407,7 @@ typedef union {
|
||||
BD_ADDR remote_bda; /* service change event */
|
||||
tBTA_GATTC_CFG_MTU cfg_mtu; /* configure MTU operation */
|
||||
tBTA_GATTC_CONGEST congest;
|
||||
tBTA_GATTC_QUEUE_FULL queue_full;
|
||||
} tBTA_GATTC;
|
||||
|
||||
/* GATTC enable callback function */
|
||||
@ -523,6 +531,8 @@ typedef struct {
|
||||
UINT32 trans_id;
|
||||
UINT16 conn_id;
|
||||
tBTA_GATTS_REQ_DATA *p_data;
|
||||
UINT16 data_len;
|
||||
UINT8 *value;
|
||||
} tBTA_GATTS_REQ;
|
||||
|
||||
typedef struct {
|
||||
|
@ -310,7 +310,8 @@ typedef struct {
|
||||
tBTA_GATTC_RCB *p_rcb; /* pointer to the registration CB */
|
||||
tBTA_GATTC_SERV *p_srcb; /* server cache CB */
|
||||
tBTA_GATTC_DATA *p_q_cmd; /* command in queue waiting for execution */
|
||||
|
||||
list_t *p_cmd_list; /* The list to store the command to be sent */
|
||||
BOOLEAN is_full; /* The gattc command queue is full or not */
|
||||
#define BTA_GATTC_NO_SCHEDULE 0
|
||||
#define BTA_GATTC_DISC_WAITING 0x01
|
||||
#define BTA_GATTC_REQ_WAITING 0x10
|
||||
@ -425,6 +426,7 @@ extern void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_q_cmd(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_free_command_data(tBTA_GATTC_CLCB *p_clcb);
|
||||
extern void bta_gattc_search(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_confirm(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
@ -438,9 +440,8 @@ extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *
|
||||
extern void bta_gattc_cancel_bk_conn(tBTA_GATTC_API_CANCEL_OPEN *p_data);
|
||||
extern void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
BD_ADDR remote_bda, UINT16 conn_id, tBTA_TRANSPORT transport, UINT16 mtu);
|
||||
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_send_disconnect_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_send_disconnect_cback( tBTA_GATTC_RCB *p_clreg, tGATT_DISCONN_REASON reason,
|
||||
BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
@ -179,10 +179,20 @@ typedef enum {
|
||||
|
||||
/* relate to BTA_DM_BLE_SEC_xxx in bta_api.h */
|
||||
typedef enum {
|
||||
ESP_BLE_SEC_NONE = 0, /* relate to BTA_DM_BLE_SEC_NONE in bta_api.h */
|
||||
ESP_BLE_SEC_ENCRYPT, /* relate to BTA_DM_BLE_SEC_ENCRYPT in bta_api.h */
|
||||
ESP_BLE_SEC_ENCRYPT_NO_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_NO_MITM in bta_api.h */
|
||||
ESP_BLE_SEC_ENCRYPT_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_MITM in bta_api.h */
|
||||
ESP_BLE_SEC_ENCRYPT = 1, /* relate to BTA_DM_BLE_SEC_ENCRYPT in bta_api.h. If the device has already
|
||||
bonded, the stack will used LTK to encrypt with the remote device directly.
|
||||
Else if the device hasn't bonded, the stack will used the default authentication request
|
||||
used the esp_ble_gap_set_security_param function set by the user. */
|
||||
ESP_BLE_SEC_ENCRYPT_NO_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_NO_MITM in bta_api.h. If the device has already
|
||||
bonded, the stack will check the LTK Whether the authentication request has been met, if met, used the LTK
|
||||
to encrypt with the remote device directly, else Re-pair with the remote device.
|
||||
Else if the device hasn't bonded, the stack will used NO MITM authentication request in the current link instead of
|
||||
used the authreq in the esp_ble_gap_set_security_param function set by the user. */
|
||||
ESP_BLE_SEC_ENCRYPT_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_MITM in bta_api.h. If the device has already
|
||||
bonded, the stack will check the LTK Whether the authentication request has been met, if met, used the LTK
|
||||
to encrypt with the remote device directly, else Re-pair with the remote device.
|
||||
Else if the device hasn't bonded, the stack will used MITM authentication request in the current link instead of
|
||||
used the authreq in the esp_ble_gap_set_security_param function set by the user. */
|
||||
}esp_ble_sec_act_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -64,6 +64,7 @@ typedef enum {
|
||||
ESP_GATTC_CONNECT_EVT = 40, /*!< When the ble physical connection is set up, the event comes */
|
||||
ESP_GATTC_DISCONNECT_EVT = 41, /*!< When the ble physical connection disconnected, the event comes */
|
||||
ESP_GATTC_READ_MUTIPLE_EVT = 42, /*!< When the ble characteristic or descriptor mutiple complete, the event comes */
|
||||
ESP_GATTC_QUEUE_FULL_EVT = 43, /*!< When the gattc command queue full, the event comes */
|
||||
} esp_gattc_cb_event_t;
|
||||
|
||||
|
||||
@ -145,6 +146,7 @@ typedef union {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint16_t handle; /*!< The Characteristic or descriptor handle */
|
||||
uint16_t offset; /*!< The prepare write offset, this value is valid only when prepare write */
|
||||
} write; /*!< Gatt client callback param of ESP_GATTC_WRITE_DESCR_EVT */
|
||||
|
||||
/**
|
||||
@ -201,7 +203,6 @@ typedef union {
|
||||
* @brief ESP_GATTC_CONNECT_EVT
|
||||
*/
|
||||
struct gattc_connect_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
} connect; /*!< Gatt client callback param of ESP_GATTC_CONNECT_EVT */
|
||||
@ -210,11 +211,20 @@ typedef union {
|
||||
* @brief ESP_GATTC_DISCONNECT_EVT
|
||||
*/
|
||||
struct gattc_disconnect_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
esp_gatt_conn_reason_t reason; /*!< disconnection reason */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
} disconnect; /*!< Gatt client callback param of ESP_GATTC_DISCONNECT_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_QUEUE_FULL_EVT
|
||||
*/
|
||||
struct gattc_queue_full_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
bool is_full; /*!< The gattc command queue is full or not */
|
||||
} queue_full; /*!< Gatt client callback param of ESP_GATTC_QUEUE_FULL_EVT */
|
||||
|
||||
} esp_ble_gattc_cb_param_t; /*!< GATT client callback parameter union type */
|
||||
|
||||
/**
|
||||
|
@ -119,6 +119,8 @@ typedef union {
|
||||
struct gatts_conf_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint16_t len; /*!< The indication or notification value length, len is valid when send notification or indication failed */
|
||||
uint8_t *value; /*!< The indication or notification value , value is valid when send notification or indication failed */
|
||||
} conf; /*!< Gatt server callback param of ESP_GATTS_CONF_EVT (confirm) */
|
||||
|
||||
/**
|
||||
@ -193,7 +195,6 @@ typedef union {
|
||||
struct gatts_connect_evt_param {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
bool is_connected; /*!< Indicate it is connected or not */
|
||||
} connect; /*!< Gatt server callback param of ESP_GATTS_CONNECT_EVT */
|
||||
|
||||
/**
|
||||
@ -202,7 +203,7 @@ typedef union {
|
||||
struct gatts_disconnect_evt_param {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
bool is_connected; /*!< Indicate it is connected or not */
|
||||
esp_gatt_conn_reason_t reason; /*!< Indicate the reason of disconnection */
|
||||
} disconnect; /*!< Gatt server callback param of ESP_GATTS_DISCONNECT_EVT */
|
||||
|
||||
/**
|
||||
|
@ -80,6 +80,7 @@ typedef UINT8 tGATT_SEC_ACTION;
|
||||
#define GATT_WAIT_FOR_RSP_TOUT 30
|
||||
#define GATT_WAIT_FOR_DISC_RSP_TOUT 5
|
||||
#define GATT_REQ_RETRY_LIMIT 2
|
||||
#define GATT_WAIT_FOR_IND_ACK_TOUT 5
|
||||
|
||||
/* characteristic descriptor type */
|
||||
#define GATT_DESCR_EXT_DSCPTOR 1 /* Characteristic Extended Properties */
|
||||
|
@ -1469,7 +1469,8 @@ typedef struct {
|
||||
|
||||
#define HCI_FEATURE_SWITCH_MASK 0x20
|
||||
#define HCI_FEATURE_SWITCH_OFF 0
|
||||
#define HCI_SWITCH_SUPPORTED(x) ((x)[HCI_FEATURE_SWITCH_OFF] & HCI_FEATURE_SWITCH_MASK)
|
||||
// temporarily disable ROLE_SWITCH since there is an issue to be fixed
|
||||
#define HCI_SWITCH_SUPPORTED(x) (0 & ((x)[HCI_FEATURE_SWITCH_OFF] & HCI_FEATURE_SWITCH_MASK))
|
||||
|
||||
#define HCI_FEATURE_HOLD_MODE_MASK 0x40
|
||||
#define HCI_FEATURE_HOLD_MODE_OFF 0
|
||||
|
@ -57,26 +57,39 @@ typedef enum {
|
||||
SIG_BTU_NUM,
|
||||
} SIG_BTU_t;
|
||||
|
||||
#define TASK_PINNED_TO_CORE (CONFIG_BLUEDROID_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BLUEDROID_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
|
||||
#define HCI_HOST_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define HCI_HOST_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define HCI_HOST_TASK_PRIO (configMAX_PRIORITIES - 3)
|
||||
#define HCI_HOST_TASK_NAME "hciHostT"
|
||||
#define HCI_HOST_QUEUE_NUM 40
|
||||
#define HCI_HOST_QUEUE_LEN 40
|
||||
|
||||
#define HCI_H4_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define HCI_H4_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define HCI_H4_TASK_PRIO (configMAX_PRIORITIES - 4)
|
||||
#define HCI_H4_TASK_NAME "hciH4T"
|
||||
#define HCI_H4_QUEUE_NUM 60
|
||||
#define HCI_H4_QUEUE_LEN 60
|
||||
|
||||
#define BTU_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define BTU_TASK_STACK_SIZE (4096 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define BTU_TASK_PRIO (configMAX_PRIORITIES - 5)
|
||||
#define BTU_TASK_NAME "btuT"
|
||||
#define BTU_QUEUE_NUM 50
|
||||
#define BTU_QUEUE_LEN 50
|
||||
|
||||
#define BTC_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define BTC_TASK_STACK_SIZE (CONFIG_BTC_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) //by menuconfig
|
||||
#define BTC_TASK_NAME "btcT"
|
||||
#define BTC_TASK_PRIO (configMAX_PRIORITIES - 6)
|
||||
#define BTC_TASK_QUEUE_NUM 60
|
||||
#define BTC_TASK_QUEUE_LEN 60
|
||||
|
||||
#define BTC_MEDIA_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define BTC_MEDIA_TASK_STACK_SIZE (CONFIG_BTC_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define BTC_MEDIA_TASK_NAME "BtcMediaT"
|
||||
#define BTC_MEDIA_TASK_PRIO (configMAX_PRIORITIES - 3)
|
||||
#define BTC_MEDIA_DATA_QUEUE_LEN (1)
|
||||
#define BTC_MEDIA_CTRL_QUEUE_LEN (5)
|
||||
#define BTC_MEDIA_TASK_QUEUE_SET_LEN (BTC_MEDIA_DATA_QUEUE_LEN + BTC_MEDIA_CTRL_QUEUE_LEN)
|
||||
|
||||
#define TASK_POST_NON_BLOCKING (0)
|
||||
#define TASK_POST_BLOCKING (portMAX_DELAY)
|
||||
|
@ -84,7 +84,7 @@ typedef enum {
|
||||
|
||||
/**
|
||||
* @brief BLE tx power type
|
||||
* ESP_BLE_PWR_TYPE_CONN_HDL0-9: for each connection, and only be set after connetion completed.
|
||||
* ESP_BLE_PWR_TYPE_CONN_HDL0-8: for each connection, and only be set after connetion completed.
|
||||
* when disconnect, the correspond TX power is not effected.
|
||||
* ESP_BLE_PWR_TYPE_ADV : for advertising/scan response.
|
||||
* ESP_BLE_PWR_TYPE_SCAN : for scan.
|
||||
@ -102,7 +102,7 @@ typedef enum {
|
||||
ESP_BLE_PWR_TYPE_CONN_HDL6 = 6, /*!< For connection handle 6 */
|
||||
ESP_BLE_PWR_TYPE_CONN_HDL7 = 7, /*!< For connection handle 7 */
|
||||
ESP_BLE_PWR_TYPE_CONN_HDL8 = 8, /*!< For connection handle 8 */
|
||||
ESP_BLE_PWR_TYPE_ADV = 9, /*!< For advertising */
|
||||
ESP_BLE_PWR_TYPE_ADV = 9, /*!< For advertising */
|
||||
ESP_BLE_PWR_TYPE_SCAN = 10, /*!< For scan */
|
||||
ESP_BLE_PWR_TYPE_DEFAULT = 11, /*!< For default, if not set other, it will use default value */
|
||||
ESP_BLE_PWR_TYPE_NUM = 12, /*!< TYPE numbers */
|
||||
|
@ -9,17 +9,20 @@
|
||||
#define CONFIG_TRACEMEM_RESERVE_DRAM 0x0
|
||||
#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16
|
||||
#define CONFIG_BLE_SMP_ENABLE 1
|
||||
#define CONFIG_STACK_CHECK 1
|
||||
#define CONFIG_TCP_RECVMBOX_SIZE 6
|
||||
#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1
|
||||
#define CONFIG_STACK_CHECK_NORM 1
|
||||
#define CONFIG_TCP_WND_DEFAULT 5744
|
||||
#define CONFIG_SW_COEXIST_ENABLE 1
|
||||
#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1
|
||||
#define CONFIG_ESPTOOLPY_FLASHSIZE_4MB 1
|
||||
#define CONFIG_IPC_TASK_STACK_SIZE 1024
|
||||
#define CONFIG_FATFS_PER_FILE_CACHE 1
|
||||
#define CONFIG_ESPTOOLPY_FLASHFREQ "40m"
|
||||
#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1
|
||||
#define CONFIG_UDP_RECVMBOX_SIZE 6
|
||||
#define CONFIG_TASK_WDT_CHECK_IDLE_TASK 1
|
||||
#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0
|
||||
#define CONFIG_MBEDTLS_AES_C 1
|
||||
#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1
|
||||
#define CONFIG_MBEDTLS_GCM_C 1
|
||||
@ -34,6 +37,7 @@
|
||||
#define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1
|
||||
#define CONFIG_MBEDTLS_ECDSA_C 1
|
||||
#define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1
|
||||
#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0
|
||||
#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1
|
||||
#define CONFIG_MBEDTLS_ECDH_C 1
|
||||
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE 1
|
||||
@ -41,6 +45,7 @@
|
||||
#define CONFIG_MBEDTLS_SSL_ALPN 1
|
||||
#define CONFIG_MBEDTLS_PEM_WRITE_C 1
|
||||
#define CONFIG_BT_RESERVE_DRAM 0x10000
|
||||
#define CONFIG_FATFS_FS_LOCK 0
|
||||
#define CONFIG_IP_LOST_TIMER_INTERVAL 120
|
||||
#define CONFIG_ESP32_PANIC_PRINT_REBOOT 1
|
||||
#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1
|
||||
@ -54,6 +59,7 @@
|
||||
#define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1
|
||||
#define CONFIG_FATFS_CODEPAGE 850
|
||||
#define CONFIG_ULP_COPROC_RESERVE_MEM 512
|
||||
#define CONFIG_LWIP_MAX_UDP_PCBS 16
|
||||
#define CONFIG_ESPTOOLPY_BAUD 921600
|
||||
#define CONFIG_INT_WDT_CHECK_CPU1 1
|
||||
#define CONFIG_FLASHMODE_DIO 1
|
||||
@ -64,7 +70,6 @@
|
||||
#define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024
|
||||
#define CONFIG_MBEDTLS_RC4_DISABLED 1
|
||||
#define CONFIG_FATFS_LFN_STACK 1
|
||||
#define CONFIG_ESP32_WIFI_AMPDU_ENABLED 1
|
||||
#define CONFIG_CONSOLE_UART_NUM 0
|
||||
#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1
|
||||
#define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1
|
||||
@ -78,14 +83,15 @@
|
||||
#define CONFIG_LOG_DEFAULT_LEVEL_ERROR 1
|
||||
#define CONFIG_TIMER_TASK_STACK_SIZE 4096
|
||||
#define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1
|
||||
#define CONFIG_BTDM_CONTROLLER_RUN_CPU 0
|
||||
#define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1
|
||||
#define CONFIG_SPIFFS_USE_MAGIC 1
|
||||
#define CONFIG_TCPIP_TASK_STACK_SIZE 2560
|
||||
#define CONFIG_BLUEDROID_PINNED_TO_CORE_0 1
|
||||
#define CONFIG_FATFS_CODEPAGE_850 1
|
||||
#define CONFIG_TASK_WDT 1
|
||||
#define CONFIG_MAIN_TASK_STACK_SIZE 4096
|
||||
#define CONFIG_SPIFFS_PAGE_CHECK 1
|
||||
#define CONFIG_LWIP_MAX_ACTIVE_TCP 16
|
||||
#define CONFIG_TASK_WDT_TIMEOUT_S 5
|
||||
#define CONFIG_INT_WDT_TIMEOUT_MS 300
|
||||
#define CONFIG_ESPTOOLPY_FLASHMODE "dio"
|
||||
@ -97,6 +103,7 @@
|
||||
#define CONFIG_LOG_DEFAULT_LEVEL 1
|
||||
#define CONFIG_TIMER_QUEUE_LENGTH 10
|
||||
#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1
|
||||
#define CONFIG_FATFS_TIMEOUT_MS 10000
|
||||
#define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 0
|
||||
#define CONFIG_MBEDTLS_CCM_C 1
|
||||
#define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20
|
||||
@ -148,9 +155,11 @@
|
||||
#define CONFIG_MONITOR_BAUD_115200B 1
|
||||
#define CONFIG_LOG_BOOTLOADER_LEVEL 0
|
||||
#define CONFIG_MBEDTLS_TLS_ENABLED 1
|
||||
#define CONFIG_LWIP_MAX_RAW_PCBS 16
|
||||
#define CONFIG_SMP_ENABLE 1
|
||||
#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1
|
||||
#define CONFIG_SPIFFS_MAX_PARTITIONS 3
|
||||
#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1
|
||||
#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1
|
||||
#define CONFIG_ESPTOOLPY_BEFORE_RESET 1
|
||||
#define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200
|
||||
@ -165,10 +174,12 @@
|
||||
#define CONFIG_ESPTOOLPY_AFTER "hard_reset"
|
||||
#define CONFIG_LWIP_SO_REUSE 1
|
||||
#define CONFIG_DMA_TX_BUF_NUM 10
|
||||
#define CONFIG_LWIP_MAX_LISTENING_TCP 16
|
||||
#define CONFIG_FREERTOS_INTERRUPT_BACKTRACE 1
|
||||
#define CONFIG_WL_SECTOR_SIZE 4096
|
||||
#define CONFIG_TIMER_TASK_PRIORITY 1
|
||||
#define CONFIG_MBEDTLS_TLS_CLIENT 1
|
||||
#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1
|
||||
#define CONFIG_BT_ENABLED 1
|
||||
#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1
|
||||
#define CONFIG_MONITOR_BAUD 115200
|
||||
@ -185,6 +196,8 @@
|
||||
#define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1
|
||||
#define CONFIG_WL_SECTOR_SIZE_4096 1
|
||||
#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1
|
||||
#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1
|
||||
#define CONFIG_BOOTLOADER_VDDSDIO_BOOST 1
|
||||
#define CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED 1
|
||||
#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1
|
||||
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1
|
||||
@ -193,14 +206,18 @@
|
||||
#define CONFIG_FATFS_MAX_LFN 255
|
||||
#define CONFIG_ESP32_WIFI_TX_BUFFER_TYPE 1
|
||||
#define CONFIG_ESPTOOLPY_BAUD_921600B 1
|
||||
#define CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED 1
|
||||
#define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8
|
||||
#define CONFIG_APP_OFFSET 0x10000
|
||||
#define CONFIG_MEMMAP_SMP 1
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1
|
||||
#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1
|
||||
#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 2048
|
||||
#define CONFIG_LWIP_SO_RCVBUF 1
|
||||
#define CONFIG_MONITOR_BAUD_OTHER_VAL 115200
|
||||
#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF 1
|
||||
#define CONFIG_ESPTOOLPY_PORT "/dev/cu.usbserial-DO00EAB0"
|
||||
#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1
|
||||
#define CONFIG_BLUEDROID_PINNED_TO_CORE 0
|
||||
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR 1
|
||||
|
@ -112,6 +112,19 @@ typedef enum {
|
||||
ADC_I2S_DATA_SRC_MAX,
|
||||
} adc_i2s_source_t;
|
||||
|
||||
/**
|
||||
* @brief Get the gpio number of a specific ADC1 channel.
|
||||
*
|
||||
* @param channel Channel to get the gpio number
|
||||
*
|
||||
* @param gpio_num output buffer to hold the gpio number
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK if success
|
||||
* - ESP_ERR_INVALID_ARG if channal not valid
|
||||
*/
|
||||
esp_err_t adc1_pad_get_io_num(adc1_channel_t channel, gpio_num_t *gpio_num);
|
||||
|
||||
/**
|
||||
* @brief Configure ADC1 capture width, meanwhile enable output invert for ADC1.
|
||||
* The configuration is for all channels of ADC1
|
||||
@ -273,6 +286,70 @@ void adc1_ulp_enable();
|
||||
*/
|
||||
int hall_sensor_read();
|
||||
|
||||
/**
|
||||
* @brief Get the gpio number of a specific ADC2 channel.
|
||||
*
|
||||
* @param channel Channel to get the gpio number
|
||||
*
|
||||
* @param gpio_num output buffer to hold the gpio number
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK if success
|
||||
* - ESP_ERR_INVALID_ARG if channal not valid
|
||||
*/
|
||||
esp_err_t adc2_pad_get_io_num(adc2_channel_t channel, gpio_num_t *gpio_num);
|
||||
|
||||
/**
|
||||
* @brief Configure the ADC2 channel, including setting attenuation.
|
||||
*
|
||||
* @note This function also configures the input GPIO pin mux to
|
||||
* connect it to the ADC2 channel. It must be called before calling
|
||||
* ``adc2_get_raw()`` for this channel.
|
||||
*
|
||||
* The default ADC full-scale voltage is 1.1V. To read higher voltages (up to the pin maximum voltage,
|
||||
* usually 3.3V) requires setting >0dB signal attenuation for that ADC channel.
|
||||
*
|
||||
* When VDD_A is 3.3V:
|
||||
*
|
||||
* - 0dB attenuaton (ADC_ATTEN_0db) gives full-scale voltage 1.1V
|
||||
* - 2.5dB attenuation (ADC_ATTEN_2_5db) gives full-scale voltage 1.5V
|
||||
* - 6dB attenuation (ADC_ATTEN_6db) gives full-scale voltage 2.2V
|
||||
* - 11dB attenuation (ADC_ATTEN_11db) gives full-scale voltage 3.9V (see note below)
|
||||
*
|
||||
* @note The full-scale voltage is the voltage corresponding to a maximum reading
|
||||
* (depending on ADC2 configured bit width, this value is: 4095 for 12-bits, 2047
|
||||
* for 11-bits, 1023 for 10-bits, 511 for 9 bits.)
|
||||
*
|
||||
* @note At 11dB attenuation the maximum voltage is limited by VDD_A, not the full scale voltage.
|
||||
*
|
||||
* @param channel ADC2 channel to configure
|
||||
* @param atten Attenuation level
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten);
|
||||
|
||||
/**
|
||||
* @brief Take an ADC2 reading on a single channel
|
||||
*
|
||||
* @note For a given channel, ``adc2_config_channel_atten()``
|
||||
* must be called before the first time this function is called. If Wi-Fi is started via ``esp_wifi_start()``, this
|
||||
* function will always fail with ``ESP_ERR_TIMEOUT``.
|
||||
*
|
||||
* @param channel ADC2 channel to read
|
||||
*
|
||||
* @param width_bit Bit capture width for ADC2
|
||||
*
|
||||
* @param raw_out the variable to hold the output data.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK if success
|
||||
* - ESP_ERR_TIMEOUT the WIFI is started, using the ADC2
|
||||
*/
|
||||
esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int* raw_out);
|
||||
|
||||
/**
|
||||
* @brief Output ADC2 reference voltage to gpio 25 or 26 or 27
|
||||
*
|
||||
|
52
tools/sdk/include/driver/driver/adc2_wifi_internal.h
Normal file
52
tools/sdk/include/driver/driver/adc2_wifi_internal.h
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright 2015-2016 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 _DRIVER_ADC2_INTERNAL_H_
|
||||
#define _DRIVER_ADC2_INTERNAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* @brief For WIFI module to claim the usage of ADC2.
|
||||
*
|
||||
* Other tasks will be forbidden to use ADC2 between ``adc2_wifi_acquire`` and ``adc2_wifi_release``.
|
||||
* The WIFI module may have to wait for a short time for the current conversion (if exist) to finish.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
* - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
|
||||
*/
|
||||
esp_err_t adc2_wifi_acquire();
|
||||
|
||||
|
||||
/**
|
||||
* @brief For WIFI module to let other tasks use the ADC2 when WIFI is not work.
|
||||
*
|
||||
* Other tasks will be forbidden to use ADC2 between ``adc2_wifi_acquire`` and ``adc2_wifi_release``.
|
||||
* Call this function to release the occupation of ADC2 by WIFI.
|
||||
*
|
||||
* @return always return ESP_OK.
|
||||
*/
|
||||
esp_err_t adc2_wifi_release();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_DRIVER_ADC2_INTERNAL_H_*/
|
||||
|
@ -29,6 +29,19 @@ typedef enum {
|
||||
DAC_CHANNEL_MAX,
|
||||
} dac_channel_t;
|
||||
|
||||
/**
|
||||
* @brief Get the gpio number of a specific DAC channel.
|
||||
*
|
||||
* @param channel Channel to get the gpio number
|
||||
*
|
||||
* @param gpio_num output buffer to hold the gpio number
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK if success
|
||||
* - ESP_ERR_INVALID_ARG if channal not valid
|
||||
*/
|
||||
esp_err_t dac_pad_get_io_num(dac_channel_t channel, gpio_num_t *gpio_num);
|
||||
|
||||
/** @cond */
|
||||
/**
|
||||
* @brief Set DAC output voltage.
|
||||
|
@ -115,10 +115,12 @@ extern "C" {
|
||||
#define GPIO_PRO_CPU_NMI_INTR_ENA (BIT(3))
|
||||
#define GPIO_SDIO_EXT_INTR_ENA (BIT(4))
|
||||
|
||||
#define GPIO_MODE_DEF_DISABLE (0)
|
||||
#define GPIO_MODE_DEF_INPUT (BIT0)
|
||||
#define GPIO_MODE_DEF_OUTPUT (BIT1)
|
||||
#define GPIO_MODE_DEF_OD (BIT2)
|
||||
|
||||
|
||||
#define GPIO_PIN_COUNT 40
|
||||
/** @endcond */
|
||||
|
||||
@ -184,6 +186,7 @@ typedef enum {
|
||||
} gpio_int_type_t;
|
||||
|
||||
typedef enum {
|
||||
GPIO_MODE_DISABLE = GPIO_MODE_DEF_DISABLE, /*!< GPIO mode : disable input and output */
|
||||
GPIO_MODE_INPUT = GPIO_MODE_DEF_INPUT, /*!< GPIO mode : input only */
|
||||
GPIO_MODE_OUTPUT = GPIO_MODE_DEF_OUTPUT, /*!< GPIO mode : output only mode */
|
||||
GPIO_MODE_OUTPUT_OD = ((GPIO_MODE_DEF_OUTPUT)|(GPIO_MODE_DEF_OD)), /*!< GPIO mode : output only with open-drain mode */
|
||||
|
@ -49,6 +49,10 @@ typedef enum {
|
||||
PERIPH_SDIO_SLAVE_MODULE,
|
||||
PERIPH_CAN_MODULE,
|
||||
PERIPH_EMAC_MODULE,
|
||||
PERIPH_RNG_MODULE,
|
||||
PERIPH_WIFI_MODULE,
|
||||
PERIPH_BT_MODULE,
|
||||
PERIPH_WIFI_BT_COMMON_MODULE,
|
||||
} periph_module_t;
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,7 @@ extern "C" {
|
||||
.set_card_clk = &sdmmc_host_set_card_clk, \
|
||||
.do_transaction = &sdmmc_host_do_transaction, \
|
||||
.deinit = &sdmmc_host_deinit, \
|
||||
.command_timeout_ms = 0, \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,6 +43,7 @@ extern "C" {
|
||||
.set_card_clk = &sdspi_host_set_card_clk, \
|
||||
.do_transaction = &sdspi_host_do_transaction, \
|
||||
.deinit = &sdspi_host_deinit, \
|
||||
.command_timeout_ms = 0, \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,8 +44,8 @@ typedef void(*transaction_cb_t)(spi_transaction_t *trans);
|
||||
* @brief This is a configuration for a SPI slave device that is connected to one of the SPI buses.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t command_bits; ///< Amount of bits in command phase (0-16)
|
||||
uint8_t address_bits; ///< Amount of bits in address phase (0-64)
|
||||
uint8_t command_bits; ///< Default amount of bits in command phase (0-16), used when ``SPI_TRANS_VARIABLE_CMD`` is not used, otherwise ignored.
|
||||
uint8_t address_bits; ///< Default amount of bits in address phase (0-64), used when ``SPI_TRANS_VARIABLE_ADDR`` is not used, otherwise ignored.
|
||||
uint8_t dummy_bits; ///< Amount of dummy bits to insert between address and data phase
|
||||
uint8_t mode; ///< SPI mode (0-3)
|
||||
uint8_t duty_cycle_pos; ///< Duty cycle of positive clock, in 1/256th increments (128 = 50%/50% duty). Setting this to 0 (=not setting it) is equivalent to setting this to 128.
|
||||
@ -65,6 +65,8 @@ typedef struct {
|
||||
#define SPI_TRANS_MODE_DIOQIO_ADDR (1<<4) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
|
||||
#define SPI_TRANS_USE_RXDATA (1<<2) ///< Receive into rx_data member of spi_transaction_t instead into memory at rx_buffer.
|
||||
#define SPI_TRANS_USE_TXDATA (1<<3) ///< Transmit tx_data member of spi_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
|
||||
#define SPI_TRANS_VARIABLE_CMD (1<<4) ///< Use the ``command_bits`` in ``spi_transaction_ext_t`` rather than default value in ``spi_device_interface_config_t``.
|
||||
#define SPI_TRANS_VARIABLE_ADDR (1<<5) ///< Use the ``address_bits`` in ``spi_transaction_ext_t`` rather than default value in ``spi_device_interface_config_t``.
|
||||
|
||||
/**
|
||||
* This structure describes one SPI transaction. The descriptor should not be modified until the transaction finishes.
|
||||
@ -90,6 +92,16 @@ struct spi_transaction_t {
|
||||
};
|
||||
} ; //the rx data should start from a 32-bit aligned address to get around dma issue.
|
||||
|
||||
/**
|
||||
* This struct is for SPI transactions which may change their address and command length.
|
||||
* Please do set the flags in base to ``SPI_TRANS_VARIABLE_CMD_ADR`` to use the bit length here.
|
||||
*/
|
||||
typedef struct {
|
||||
struct spi_transaction_t base; ///< Transaction data, so that pointer to spi_transaction_t can be converted into spi_transaction_ext_t
|
||||
uint8_t command_bits; ///< The command length in this transaction, in bits.
|
||||
uint8_t address_bits; ///< The address length in this transaction, in bits.
|
||||
} spi_transaction_ext_t ;
|
||||
|
||||
|
||||
typedef struct spi_device_t* spi_device_handle_t; ///< Handle for a device on a SPI bus
|
||||
|
||||
@ -170,8 +182,10 @@ esp_err_t spi_bus_remove_device(spi_device_handle_t handle);
|
||||
* @param trans_desc Description of transaction to execute
|
||||
* @param ticks_to_wait Ticks to wait until there's room in the queue; use portMAX_DELAY to
|
||||
* never time out.
|
||||
* @return
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||
* - ESP_ERR_TIMEOUT if there was no room in the queue before ticks_to_wait expired
|
||||
* - ESP_ERR_NO_MEM if allocating DMA-capable temporary buffer failed
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *trans_desc, TickType_t ticks_to_wait);
|
||||
@ -193,6 +207,7 @@ esp_err_t spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *
|
||||
out.
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||
* - ESP_ERR_TIMEOUT if there was no completed transaction before ticks_to_wait expired
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t spi_device_get_trans_result(spi_device_handle_t handle, spi_transaction_t **trans_desc, TickType_t ticks_to_wait);
|
||||
|
@ -26,7 +26,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define TIMER_BASE_CLK (APB_CLK_FREQ)
|
||||
#define TIMER_BASE_CLK (APB_CLK_FREQ) /*!< Frequency of the clock on the input of the timer groups */
|
||||
|
||||
/**
|
||||
* @brief Selects a Timer-Group out of 2 available groups
|
||||
*/
|
||||
@ -90,15 +91,15 @@ typedef enum {
|
||||
} timer_autoreload_t;
|
||||
|
||||
/**
|
||||
* @brief timer configure struct
|
||||
* @brief Data structure with timer's configuration settings
|
||||
*/
|
||||
typedef struct {
|
||||
bool alarm_en; /*!< Timer alarm enable */
|
||||
bool counter_en; /*!< Counter enable */
|
||||
bool alarm_en; /*!< Timer alarm enable */
|
||||
bool counter_en; /*!< Counter enable */
|
||||
timer_intr_mode_t intr_type; /*!< Interrupt mode */
|
||||
timer_count_dir_t counter_dir; /*!< Counter direction */
|
||||
bool auto_reload; /*!< Timer auto-reload */
|
||||
uint16_t divider; /*!< Counter clock divider*/
|
||||
bool auto_reload; /*!< Timer auto-reload */
|
||||
uint32_t divider; /*!< Counter clock divider. The divider's range is from from 2 to 65536. */
|
||||
} timer_config_t;
|
||||
|
||||
|
||||
@ -202,13 +203,13 @@ esp_err_t timer_set_auto_reload(timer_group_t group_num, timer_idx_t timer_num,
|
||||
*
|
||||
* @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1
|
||||
* @param timer_num Timer index, 0 for hw_timer[0] & 1 for hw_timer[1]
|
||||
* @param divider Timer clock divider value.
|
||||
* @param divider Timer clock divider value. The divider's range is from from 2 to 65536.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t timer_set_divider(timer_group_t group_num, timer_idx_t timer_num, uint16_t divider);
|
||||
esp_err_t timer_set_divider(timer_group_t group_num, timer_idx_t timer_num, uint32_t divider);
|
||||
|
||||
/**
|
||||
* @brief Set timer alarm value.
|
||||
@ -249,27 +250,23 @@ esp_err_t timer_get_alarm_value(timer_group_t group_num, timer_idx_t timer_num,
|
||||
*/
|
||||
esp_err_t timer_set_alarm(timer_group_t group_num, timer_idx_t timer_num, timer_alarm_t alarm_en);
|
||||
|
||||
|
||||
/**
|
||||
* @brief register Timer interrupt handler, the handler is an ISR.
|
||||
* The handler will be attached to the same CPU core that this function is running on.
|
||||
* @brief Register Timer interrupt handler, the handler is an ISR.
|
||||
* The handler will be attached to the same CPU core that this function is running on.
|
||||
*
|
||||
* @param group_num Timer group number
|
||||
* @param timer_num Timer index of timer group
|
||||
* @param fn Interrupt handler function.
|
||||
* @note
|
||||
* In case the this is called with the INIRAM flag, code inside the handler function can
|
||||
* only call functions in IRAM, so it cannot call other timer APIs.
|
||||
* Use direct register access to access timers from inside the ISR in this case.
|
||||
*
|
||||
* @param arg Parameter for handler function
|
||||
* @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred)
|
||||
* ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info.
|
||||
* @param handle Pointer to return handle. If non-NULL, a handle for the interrupt will
|
||||
* be returned here.
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Function pointer error.
|
||||
* @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred)
|
||||
* ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info.
|
||||
* @param handle Pointer to return handle. If non-NULL, a handle for the interrupt will
|
||||
* be returned here.
|
||||
*
|
||||
* @note If the intr_alloc_flags value ESP_INTR_FLAG_IRAM is set,
|
||||
* the handler function must be declared with IRAM_ATTR attribute
|
||||
* and can only call functions in IRAM or ROM. It cannot call other timer APIs.
|
||||
* Use direct register access to configure timers from inside the ISR in this case.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
|
@ -460,6 +460,19 @@ esp_err_t uart_set_rts(uart_port_t uart_num, int level);
|
||||
*/
|
||||
esp_err_t uart_set_dtr(uart_port_t uart_num, int level);
|
||||
|
||||
/**
|
||||
* @brief Set UART idle interval after tx FIFO is empty
|
||||
*
|
||||
* @param uart_num UART_NUM_0, UART_NUM_1 or UART_NUM_2
|
||||
* @param idle_num idle interval after tx FIFO is empty(unit: the time it takes to send one bit
|
||||
* under current baudrate)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_FAIL Parameter error
|
||||
*/
|
||||
esp_err_t uart_set_tx_idle_num(uart_port_t uart_num, uint16_t idle_num);
|
||||
|
||||
/**
|
||||
* @brief Set UART configuration parameters.
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -28,6 +28,13 @@ typedef enum {
|
||||
ETH_MODE_MII,
|
||||
} eth_mode_t;
|
||||
|
||||
typedef enum {
|
||||
ETH_CLOCK_GPIO0_IN = 0,
|
||||
ETH_CLOCK_GPIO0_OUT = 1,
|
||||
ETH_CLOCK_GPIO16_OUT = 2,
|
||||
ETH_CLOCK_GPIO17_OUT = 3
|
||||
} eth_clock_mode_t;
|
||||
|
||||
typedef enum {
|
||||
ETH_SPEED_MODE_10M = 0,
|
||||
ETH_SPEED_MODE_100M,
|
||||
@ -90,8 +97,9 @@ typedef void (*eth_phy_power_enable_func)(bool enable);
|
||||
typedef struct {
|
||||
eth_phy_base_t phy_addr; /*!< phy base addr (0~31) */
|
||||
eth_mode_t mac_mode; /*!< mac mode only support RMII now */
|
||||
eth_tcpip_input_func tcpip_input; /*!< tcpip input func */
|
||||
eth_phy_func phy_init; /*!< phy init func */
|
||||
eth_clock_mode_t clock_mode; /*!< external/internal clock mode selecton */
|
||||
eth_tcpip_input_func tcpip_input; /*!< tcpip input func */
|
||||
eth_phy_func phy_init; /*!< phy init func */
|
||||
eth_phy_check_link_func phy_check_link; /*!< phy check link func */
|
||||
eth_phy_check_init_func phy_check_init; /*!< phy check init func */
|
||||
eth_phy_get_speed_mode_func phy_get_speed_mode; /*!< phy check init func */
|
||||
@ -247,4 +255,3 @@ void esp_eth_free_rx_buf(void *buf);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*----------------------------------------------------------------------------/
|
||||
/ FatFs - Generic FAT file system module R0.12b /
|
||||
/ FatFs - Generic FAT Filesystem module R0.13a /
|
||||
/-----------------------------------------------------------------------------/
|
||||
/
|
||||
/ Copyright (C) 2016, ChaN, all right reserved.
|
||||
/ Copyright (C) 2017, ChaN, all right reserved.
|
||||
/
|
||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
||||
/ source and binary forms, with or without modification, are permitted provided
|
||||
@ -15,11 +15,12 @@
|
||||
/ and any warranties related to this software are DISCLAIMED.
|
||||
/ The copyright owner or contributors be NOT LIABLE for any damages caused
|
||||
/ by use of this software.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef _FATFS
|
||||
#define _FATFS 68020 /* Revision ID */
|
||||
#ifndef FF_DEFINED
|
||||
#define FF_DEFINED 89352 /* Revision ID */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -28,7 +29,7 @@ extern "C" {
|
||||
#include "integer.h" /* Basic integer types */
|
||||
#include "ffconf.h" /* FatFs configuration options */
|
||||
|
||||
#if _FATFS != _FFCONF
|
||||
#if FF_DEFINED != FFCONF_DEF
|
||||
#error Wrong configuration file (ffconf.h).
|
||||
#endif
|
||||
|
||||
@ -39,50 +40,44 @@ extern "C" {
|
||||
|
||||
/* Definitions of volume management */
|
||||
|
||||
#if _MULTI_PARTITION /* Multiple partition configuration */
|
||||
#if FF_MULTI_PARTITION /* Multiple partition configuration */
|
||||
typedef struct {
|
||||
BYTE pd; /* Physical drive number */
|
||||
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
||||
} PARTITION;
|
||||
extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
|
||||
#define LD2PD(vol) (VolToPart[vol].pd) /* Get physical drive number */
|
||||
#define LD2PT(vol) (VolToPart[vol].pt) /* Get partition index */
|
||||
|
||||
#else /* Single partition configuration */
|
||||
#define LD2PD(vol) (BYTE)(vol) /* Each logical drive is bound to the same physical drive number */
|
||||
#define LD2PT(vol) 0 /* Find first valid partition or in SFD */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Type of path name strings on FatFs API */
|
||||
|
||||
#if _LFN_UNICODE /* Unicode (UTF-16) string */
|
||||
#if _USE_LFN == 0
|
||||
#error _LFN_UNICODE must be 0 at non-LFN cfg.
|
||||
#endif
|
||||
#ifndef _INC_TCHAR
|
||||
#define _INC_TCHAR
|
||||
|
||||
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
|
||||
typedef WCHAR TCHAR;
|
||||
#define _T(x) L ## x
|
||||
#define _TEXT(x) L ## x
|
||||
#endif
|
||||
#else /* ANSI/OEM string */
|
||||
#ifndef _INC_TCHAR
|
||||
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
|
||||
typedef char TCHAR;
|
||||
#define _T(x) u8 ## x
|
||||
#define _TEXT(x) u8 ## x
|
||||
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 2)
|
||||
#error Wrong FF_LFN_UNICODE setting
|
||||
#else /* ANSI/OEM code in SBCS/DBCS */
|
||||
typedef char TCHAR;
|
||||
#define _T(x) x
|
||||
#define _TEXT(x) x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Type of file size variables */
|
||||
|
||||
#if _FS_EXFAT
|
||||
#if _USE_LFN == 0
|
||||
#error LFN must be enabled when enable exFAT
|
||||
#endif
|
||||
#if FF_FS_EXFAT
|
||||
typedef QWORD FSIZE_t;
|
||||
#else
|
||||
typedef DWORD FSIZE_t;
|
||||
@ -90,36 +85,36 @@ typedef DWORD FSIZE_t;
|
||||
|
||||
|
||||
|
||||
/* File system object structure (FATFS) */
|
||||
/* Filesystem object structure (FATFS) */
|
||||
|
||||
typedef struct {
|
||||
BYTE fs_type; /* File system type (0:N/A) */
|
||||
BYTE drv; /* Physical drive number */
|
||||
BYTE fs_type; /* Filesystem type (0:N/A) */
|
||||
BYTE pdrv; /* Physical drive number */
|
||||
BYTE n_fats; /* Number of FATs (1 or 2) */
|
||||
BYTE wflag; /* win[] flag (b0:dirty) */
|
||||
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
|
||||
WORD id; /* File system mount ID */
|
||||
WORD id; /* Volume mount ID */
|
||||
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||
WORD csize; /* Cluster size [sectors] */
|
||||
#if _MAX_SS != _MIN_SS
|
||||
#if FF_MAX_SS != FF_MIN_SS
|
||||
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
|
||||
#endif
|
||||
#if _USE_LFN != 0
|
||||
#if FF_USE_LFN
|
||||
WCHAR* lfnbuf; /* LFN working buffer */
|
||||
#endif
|
||||
#if _FS_EXFAT
|
||||
BYTE* dirbuf; /* Directory entry block scratchpad buffer */
|
||||
#if FF_FS_EXFAT
|
||||
BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */
|
||||
#endif
|
||||
#if _FS_REENTRANT
|
||||
_SYNC_t sobj; /* Identifier of sync object */
|
||||
#if FF_FS_REENTRANT
|
||||
FF_SYNC_t sobj; /* Identifier of sync object */
|
||||
#endif
|
||||
#if !_FS_READONLY
|
||||
#if !FF_FS_READONLY
|
||||
DWORD last_clst; /* Last allocated cluster */
|
||||
DWORD free_clst; /* Number of free clusters */
|
||||
#endif
|
||||
#if _FS_RPATH != 0
|
||||
#if FF_FS_RPATH
|
||||
DWORD cdir; /* Current directory start cluster (0:root) */
|
||||
#if _FS_EXFAT
|
||||
#if FF_FS_EXFAT
|
||||
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
|
||||
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
|
||||
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
|
||||
@ -132,51 +127,52 @@ typedef struct {
|
||||
DWORD dirbase; /* Root directory base sector/cluster */
|
||||
DWORD database; /* Data base sector */
|
||||
DWORD winsect; /* Current sector appearing in the win[] */
|
||||
BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
|
||||
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
|
||||
} FATFS;
|
||||
|
||||
|
||||
|
||||
/* Object ID and allocation information (_FDID) */
|
||||
/* Object ID and allocation information (FFOBJID) */
|
||||
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the owner file system object */
|
||||
WORD id; /* Owner file system mount ID */
|
||||
BYTE attr; /* Object attribute */
|
||||
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous (no data on FAT), =3:got flagmented, b2:sub-directory stretched) */
|
||||
DWORD sclust; /* Object start cluster (0:no cluster or root directory) */
|
||||
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
|
||||
#if _FS_EXFAT
|
||||
DWORD n_cont; /* Size of coutiguous part, clusters - 1 (valid when stat == 3) */
|
||||
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
|
||||
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
|
||||
DWORD c_ofs; /* Offset in the containing directory (valid when sclust != 0) */
|
||||
FATFS* fs; /* Pointer to the hosting volume of this object */
|
||||
WORD id; /* Hosting volume mount ID */
|
||||
BYTE attr; /* Object attribute */
|
||||
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:flagmented in this session, b2:sub-directory stretched) */
|
||||
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
|
||||
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
|
||||
#if FF_FS_EXFAT
|
||||
DWORD n_cont; /* Size of first fragment - 1 (valid when stat == 3) */
|
||||
DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */
|
||||
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
|
||||
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
|
||||
DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */
|
||||
#endif
|
||||
#if _FS_LOCK != 0
|
||||
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
|
||||
#if FF_FS_LOCK
|
||||
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
|
||||
#endif
|
||||
} _FDID;
|
||||
} FFOBJID;
|
||||
|
||||
|
||||
|
||||
/* File object structure (FIL) */
|
||||
|
||||
typedef struct {
|
||||
_FDID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
|
||||
FFOBJID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE err; /* Abort flag (error code) */
|
||||
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */
|
||||
DWORD clust; /* Current cluster of fpter (invalid when fprt is 0) */
|
||||
DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */
|
||||
DWORD sect; /* Sector number appearing in buf[] (0:invalid) */
|
||||
#if !_FS_READONLY
|
||||
DWORD dir_sect; /* Sector number containing the directory entry */
|
||||
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */
|
||||
#if !FF_FS_READONLY
|
||||
DWORD dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
|
||||
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */
|
||||
#endif
|
||||
#if _USE_FASTSEEK
|
||||
#if FF_USE_FASTSEEK
|
||||
DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */
|
||||
#endif
|
||||
#if !_FS_TINY
|
||||
BYTE buf[_MAX_SS]; /* File private data read/write window */
|
||||
#if !FF_FS_TINY
|
||||
BYTE buf[FF_MAX_SS]; /* File private data read/write window */
|
||||
#endif
|
||||
} FIL;
|
||||
|
||||
@ -185,16 +181,16 @@ typedef struct {
|
||||
/* Directory object structure (FF_DIR) */
|
||||
|
||||
typedef struct {
|
||||
_FDID obj; /* Object identifier */
|
||||
FFOBJID obj; /* Object identifier */
|
||||
DWORD dptr; /* Current read/write offset */
|
||||
DWORD clust; /* Current cluster */
|
||||
DWORD sect; /* Current sector */
|
||||
DWORD sect; /* Current sector (0:Read operation has terminated) */
|
||||
BYTE* dir; /* Pointer to the directory item in the win[] */
|
||||
BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */
|
||||
#if _USE_LFN != 0
|
||||
#if FF_USE_LFN
|
||||
DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */
|
||||
#endif
|
||||
#if _USE_FIND
|
||||
#if FF_USE_FIND
|
||||
const TCHAR* pat; /* Pointer to the name matching pattern */
|
||||
#endif
|
||||
} FF_DIR;
|
||||
@ -208,11 +204,11 @@ typedef struct {
|
||||
WORD fdate; /* Modified date */
|
||||
WORD ftime; /* Modified time */
|
||||
BYTE fattrib; /* File attribute */
|
||||
#if _USE_LFN != 0
|
||||
TCHAR altname[13]; /* Altenative file name */
|
||||
TCHAR fname[_MAX_LFN + 1]; /* Primary file name */
|
||||
#if FF_USE_LFN
|
||||
TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */
|
||||
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
|
||||
#else
|
||||
TCHAR fname[13]; /* File name */
|
||||
TCHAR fname[12 + 1]; /* File name */
|
||||
#endif
|
||||
} FILINFO;
|
||||
|
||||
@ -239,7 +235,7 @@ typedef enum {
|
||||
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
|
||||
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
|
||||
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
|
||||
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_LOCK */
|
||||
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */
|
||||
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
|
||||
} FRESULT;
|
||||
|
||||
@ -277,6 +273,7 @@ FRESULT f_expand (FIL* fp, FSIZE_t szf, BYTE opt); /* Allocate a contiguous
|
||||
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_mkfs (const TCHAR* path, BYTE opt, DWORD au, void* work, UINT len); /* Create a FAT volume */
|
||||
FRESULT f_fdisk (BYTE pdrv, const DWORD* szt, void* work); /* Divide a physical drive into some partitions */
|
||||
FRESULT f_setcp (WORD cp); /* Set current code page */
|
||||
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
|
||||
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
||||
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||
@ -288,6 +285,8 @@ TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the fil
|
||||
#define f_size(fp) ((fp)->obj.objsize)
|
||||
#define f_rewind(fp) f_lseek((fp), 0)
|
||||
#define f_rewinddir(dp) f_readdir((dp), 0)
|
||||
#define f_rmdir(path) f_unlink(path)
|
||||
#define f_unmount(path) f_mount(0, path, 0)
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
@ -300,26 +299,27 @@ TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the fil
|
||||
/* Additional user defined functions */
|
||||
|
||||
/* RTC function */
|
||||
#if !_FS_READONLY && !_FS_NORTC
|
||||
#if !FF_FS_READONLY && !FF_FS_NORTC
|
||||
DWORD get_fattime (void);
|
||||
#endif
|
||||
|
||||
/* Unicode support functions */
|
||||
#if _USE_LFN != 0 /* Unicode - OEM code conversion */
|
||||
WCHAR ff_convert (WCHAR chr, UINT dir); /* OEM-Unicode bidirectional conversion */
|
||||
WCHAR ff_wtoupper (WCHAR chr); /* Unicode upper-case conversion */
|
||||
#if _USE_LFN == 3 /* Memory functions */
|
||||
/* LFN support functions */
|
||||
#if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */
|
||||
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
|
||||
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
|
||||
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
|
||||
#endif
|
||||
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
|
||||
void* ff_memalloc (UINT msize); /* Allocate memory block */
|
||||
void ff_memfree (void* mblock); /* Free memory block */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Sync functions */
|
||||
#if _FS_REENTRANT
|
||||
int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj); /* Create a sync object */
|
||||
int ff_req_grant (_SYNC_t sobj); /* Lock sync object */
|
||||
void ff_rel_grant (_SYNC_t sobj); /* Unlock sync object */
|
||||
int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
|
||||
#if FF_FS_REENTRANT
|
||||
int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj); /* Create a sync object */
|
||||
int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */
|
||||
void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */
|
||||
int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
|
||||
#endif
|
||||
|
||||
|
||||
@ -366,4 +366,4 @@ int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FATFS */
|
||||
#endif /* FF_DEFINED */
|
||||
|
@ -1,68 +1,68 @@
|
||||
#include <sys/param.h>
|
||||
#include "sdkconfig.h"
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module configuration file
|
||||
/ FatFs - Configuration file
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _FFCONF 68020 /* Revision ID */
|
||||
#define FFCONF_DEF 89352 /* Revision ID */
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Function Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _FS_READONLY 0
|
||||
#define FF_FS_READONLY 0
|
||||
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
||||
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
||||
/ and optional writing functions as well. */
|
||||
|
||||
|
||||
#define _FS_MINIMIZE 0
|
||||
#define FF_FS_MINIMIZE 0
|
||||
/* This option defines minimization level to remove some basic API functions.
|
||||
/
|
||||
/ 0: All basic functions are enabled.
|
||||
/ 0: Basic functions are fully enabled.
|
||||
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
|
||||
/ are removed.
|
||||
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
|
||||
/ 3: f_lseek() function is removed in addition to 2. */
|
||||
|
||||
|
||||
#define _USE_STRFUNC 0
|
||||
/* This option switches string functions, f_gets(), f_putc(), f_puts() and
|
||||
/ f_printf().
|
||||
#define FF_USE_STRFUNC 0
|
||||
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
|
||||
/
|
||||
/ 0: Disable string functions.
|
||||
/ 1: Enable without LF-CRLF conversion.
|
||||
/ 2: Enable with LF-CRLF conversion. */
|
||||
|
||||
|
||||
#define _USE_FIND 0
|
||||
#define FF_USE_FIND 0
|
||||
/* This option switches filtered directory read functions, f_findfirst() and
|
||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||
|
||||
|
||||
#define _USE_MKFS 1
|
||||
#define FF_USE_MKFS 1
|
||||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_FASTSEEK 0
|
||||
#define FF_USE_FASTSEEK 0
|
||||
/* This option switches fast seek function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_EXPAND 0
|
||||
#define FF_USE_EXPAND 0
|
||||
/* This option switches f_expand function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_CHMOD 0
|
||||
#define FF_USE_CHMOD 0
|
||||
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
|
||||
/ (0:Disable or 1:Enable) Also _FS_READONLY needs to be 0 to enable this option. */
|
||||
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
|
||||
|
||||
|
||||
#define _USE_LABEL 0
|
||||
#define FF_USE_LABEL 0
|
||||
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
||||
/ (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_FORWARD 0
|
||||
#define FF_USE_FORWARD 0
|
||||
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
@ -70,11 +70,10 @@
|
||||
/ Locale and Namespace Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _CODE_PAGE CONFIG_FATFS_CODEPAGE
|
||||
#define FF_CODE_PAGE CONFIG_FATFS_CODEPAGE
|
||||
/* This option specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect setting of the code page can cause a file open failure.
|
||||
/ Incorrect code page setting can cause a file open failure.
|
||||
/
|
||||
/ 1 - ASCII (No extended character. Non-LFN cfg. only)
|
||||
/ 437 - U.S.
|
||||
/ 720 - Arabic
|
||||
/ 737 - Greek
|
||||
@ -96,55 +95,74 @@
|
||||
/ 936 - Simplified Chinese (DBCS)
|
||||
/ 949 - Korean (DBCS)
|
||||
/ 950 - Traditional Chinese (DBCS)
|
||||
/ 0 - Include all code pages above and configured by f_setcp()
|
||||
*/
|
||||
|
||||
|
||||
#if defined(CONFIG_FATFS_LFN_STACK)
|
||||
#define _USE_LFN 2
|
||||
#define FF_USE_LFN 2
|
||||
#elif defined(CONFIG_FATFS_LFN_HEAP)
|
||||
#define _USE_LFN 3
|
||||
#define FF_USE_LFN 3
|
||||
#else /* CONFIG_FATFS_LFN_NONE */
|
||||
#define _USE_LFN 0
|
||||
#define FF_USE_LFN 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FATFS_MAX_LFN
|
||||
#define _MAX_LFN CONFIG_FATFS_MAX_LFN
|
||||
#define FF_MAX_LFN CONFIG_FATFS_MAX_LFN
|
||||
#endif
|
||||
/* The _USE_LFN switches the support of long file name (LFN).
|
||||
|
||||
/* The FF_USE_LFN switches the support for LFN (long file name).
|
||||
/
|
||||
/ 0: Disable support of LFN. _MAX_LFN has no effect.
|
||||
/ 0: Disable LFN. FF_MAX_LFN has no effect.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
||||
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
||||
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
||||
/
|
||||
/ To enable the LFN, Unicode handling functions (option/unicode.c) must be added
|
||||
/ to the project. The working buffer occupies (_MAX_LFN + 1) * 2 bytes and
|
||||
/ additional 608 bytes at exFAT enabled. _MAX_LFN can be in range from 12 to 255.
|
||||
/ It should be set 255 to support full featured LFN operations.
|
||||
/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
|
||||
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
|
||||
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
|
||||
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
|
||||
/ be in range of 12 to 255. It is recommended to be set 255 to fully support LFN
|
||||
/ specification.
|
||||
/ When use stack for the working buffer, take care on stack overflow. When use heap
|
||||
/ memory for the working buffer, memory management functions, ff_memalloc() and
|
||||
/ ff_memfree(), must be added to the project. */
|
||||
/ ff_memfree() in ffsystem.c, need to be added to the project. */
|
||||
|
||||
|
||||
#define _LFN_UNICODE 0
|
||||
/* This option switches character encoding on the API. (0:ANSI/OEM or 1:UTF-16)
|
||||
/ To use Unicode string for the path name, enable LFN and set _LFN_UNICODE = 1.
|
||||
/ This option also affects behavior of string I/O functions. */
|
||||
|
||||
|
||||
#define _STRF_ENCODE 3
|
||||
/* When _LFN_UNICODE == 1, this option selects the character encoding ON THE FILE to
|
||||
/ be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
|
||||
#define FF_LFN_UNICODE 0
|
||||
/* This option switches the character encoding on the API when LFN is enabled.
|
||||
/
|
||||
/ 0: ANSI/OEM
|
||||
/ 1: UTF-16LE
|
||||
/ 2: UTF-16BE
|
||||
/ 3: UTF-8
|
||||
/ 0: ANSI/OEM in current CP (TCHAR = char)
|
||||
/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
|
||||
/ 2: Unicode in UTF-8 (TCHAR = char)
|
||||
/
|
||||
/ This option has no effect when _LFN_UNICODE == 0. */
|
||||
/ Also behavior of string I/O functions will be affected by this option.
|
||||
/ When LFN is not enabled, this option has no effect. */
|
||||
|
||||
|
||||
#define _FS_RPATH 0
|
||||
/* This option configures support of relative path.
|
||||
#define FF_LFN_BUF 255
|
||||
#define FF_SFN_BUF 12
|
||||
/* This set of options defines size of file name members in the FILINFO structure
|
||||
/ which is used to read out directory items. These values should be suffcient for
|
||||
/ the file names to read. The maximum possible length of the read file name depends
|
||||
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
||||
|
||||
|
||||
#define FF_STRF_ENCODE 3
|
||||
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
|
||||
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
|
||||
/ This option selects assumption of character encoding ON THE FILE to be
|
||||
/ read/written via those functions.
|
||||
/
|
||||
/ 0: ANSI/OEM in current CP
|
||||
/ 1: Unicode in UTF-16LE
|
||||
/ 2: Unicode in UTF-16BE
|
||||
/ 3: Unicode in UTF-8
|
||||
*/
|
||||
|
||||
|
||||
#define FF_FS_RPATH 0
|
||||
/* This option configures support for relative path.
|
||||
/
|
||||
/ 0: Disable relative path and remove related functions.
|
||||
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
|
||||
@ -156,45 +174,49 @@
|
||||
/ Drive/Volume Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _VOLUMES 2
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
#define FF_VOLUMES 2
|
||||
/* Number of volumes (logical drives) to be used. (1-10) */
|
||||
|
||||
|
||||
#define _STR_VOLUME_ID 0
|
||||
#define _VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
|
||||
/* _STR_VOLUME_ID switches string support of volume ID.
|
||||
/ When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
|
||||
/ number in the path name. _VOLUME_STRS defines the drive ID strings for each
|
||||
/ logical drives. Number of items must be equal to _VOLUMES. Valid characters for
|
||||
#define FF_STR_VOLUME_ID 0
|
||||
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
|
||||
/* FF_STR_VOLUME_ID switches string support for volume ID.
|
||||
/ When FF_STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
|
||||
/ number in the path name. FF_VOLUME_STRS defines the drive ID strings for each
|
||||
/ logical drives. Number of items must be equal to FF_VOLUMES. Valid characters for
|
||||
/ the drive ID strings are: A-Z and 0-9. */
|
||||
|
||||
|
||||
#define _MULTI_PARTITION 1
|
||||
/* This option switches support of multi-partition on a physical drive.
|
||||
#define FF_MULTI_PARTITION 1
|
||||
/* This option switches support for multiple volumes on the physical drive.
|
||||
/ By default (0), each logical drive number is bound to the same physical drive
|
||||
/ number and only an FAT volume found on the physical drive will be mounted.
|
||||
/ When multi-partition is enabled (1), each logical drive number can be bound to
|
||||
/ When this function is enabled (1), each logical drive number can be bound to
|
||||
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
|
||||
/ funciton will be available. */
|
||||
|
||||
/* SD card sector size */
|
||||
#define FF_SS_SDCARD 512
|
||||
/* wear_levelling library sector size */
|
||||
#define FF_SS_WL CONFIG_WL_SECTOR_SIZE
|
||||
|
||||
#define _MIN_SS 512
|
||||
#define _MAX_SS 4096
|
||||
/* These options configure the range of sector size to be supported. (512, 1024,
|
||||
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
|
||||
#define FF_MIN_SS MIN(FF_SS_SDCARD, FF_SS_WL)
|
||||
#define FF_MAX_SS MAX(FF_SS_SDCARD, FF_SS_WL)
|
||||
/* This set of options configures the range of sector size to be supported. (512,
|
||||
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||
/ type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
|
||||
/ to variable sector size and GET_SECTOR_SIZE command must be implemented to the
|
||||
/ disk_ioctl() function. */
|
||||
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
|
||||
/ for variable sector size mode and disk_ioctl() function needs to implement
|
||||
/ GET_SECTOR_SIZE command. */
|
||||
|
||||
|
||||
#define _USE_TRIM 0
|
||||
/* This option switches support of ATA-TRIM. (0:Disable or 1:Enable)
|
||||
#define FF_USE_TRIM 0
|
||||
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
|
||||
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
|
||||
/ disk_ioctl() function. */
|
||||
|
||||
|
||||
#define _FS_NOFSINFO 0
|
||||
#define FF_FS_NOFSINFO 0
|
||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||
/ option, and f_getfree() function at first time after volume mount will force
|
||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||
@ -211,36 +233,36 @@
|
||||
/ System Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _FS_TINY 0
|
||||
#define FF_FS_TINY (!CONFIG_FATFS_PER_FILE_CACHE)
|
||||
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||
/ At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes.
|
||||
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
|
||||
/ Instead of private sector buffer eliminated from the file object, common sector
|
||||
/ buffer in the file system object (FATFS) is used for the file data transfer. */
|
||||
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
||||
|
||||
|
||||
#define _FS_EXFAT 0
|
||||
/* This option switches support of exFAT file system. (0:Disable or 1:Enable)
|
||||
/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1)
|
||||
/ Note that enabling exFAT discards C89 compatibility. */
|
||||
#define FF_FS_EXFAT 0
|
||||
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
||||
/ When enable exFAT, also LFN needs to be enabled.
|
||||
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
||||
|
||||
|
||||
#define _FS_NORTC 0
|
||||
#define _NORTC_MON 1
|
||||
#define _NORTC_MDAY 1
|
||||
#define _NORTC_YEAR 2016
|
||||
/* The option _FS_NORTC switches timestamp functiton. If the system does not have
|
||||
/ any RTC function or valid timestamp is not needed, set _FS_NORTC = 1 to disable
|
||||
#define FF_FS_NORTC 0
|
||||
#define FF_NORTC_MON 1
|
||||
#define FF_NORTC_MDAY 1
|
||||
#define FF_NORTC_YEAR 2017
|
||||
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
|
||||
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
|
||||
/ the timestamp function. All objects modified by FatFs will have a fixed timestamp
|
||||
/ defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR in local time.
|
||||
/ To enable timestamp function (_FS_NORTC = 0), get_fattime() function need to be
|
||||
/ added to the project to get current time form real-time clock. _NORTC_MON,
|
||||
/ _NORTC_MDAY and _NORTC_YEAR have no effect.
|
||||
/ These options have no effect at read-only configuration (_FS_READONLY = 1). */
|
||||
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
|
||||
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
|
||||
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
|
||||
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
|
||||
/ These options have no effect at read-only configuration (FF_FS_READONLY = 1). */
|
||||
|
||||
|
||||
#define _FS_LOCK 0
|
||||
/* The option _FS_LOCK switches file lock function to control duplicated file open
|
||||
/ and illegal operation to open objects. This option must be 0 when _FS_READONLY
|
||||
#define FF_FS_LOCK CONFIG_FATFS_FS_LOCK
|
||||
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
|
||||
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
|
||||
/ is 1.
|
||||
/
|
||||
/ 0: Disable file lock function. To avoid volume corruption, application program
|
||||
@ -250,24 +272,24 @@
|
||||
/ lock control is independent of re-entrancy. */
|
||||
|
||||
|
||||
#define _FS_REENTRANT 1
|
||||
#define _FS_TIMEOUT 1000
|
||||
#define _SYNC_t SemaphoreHandle_t
|
||||
/* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||
#define FF_FS_REENTRANT 1
|
||||
#define FF_FS_TIMEOUT (CONFIG_FATFS_TIMEOUT_MS / portTICK_PERIOD_MS)
|
||||
#define FF_SYNC_t SemaphoreHandle_t
|
||||
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
||||
/ to the same volume is under control of this function.
|
||||
/
|
||||
/ 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
|
||||
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
|
||||
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
||||
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
|
||||
/ function, must be added to the project. Samples are available in
|
||||
/ option/syscall.c.
|
||||
/
|
||||
/ The _FS_TIMEOUT defines timeout period in unit of time tick.
|
||||
/ The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
|
||||
/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
|
||||
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
|
||||
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
|
||||
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
|
||||
/ included somewhere in the scope of ff.h. */
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -2,8 +2,8 @@
|
||||
/* Integer type definitions for FatFs module */
|
||||
/*-------------------------------------------*/
|
||||
|
||||
#ifndef _FF_INTEGER
|
||||
#define _FF_INTEGER
|
||||
#ifndef FF_INTEGER
|
||||
#define FF_INTEGER
|
||||
|
||||
#ifdef _WIN32 /* FatFs development platform */
|
||||
|
||||
@ -30,7 +30,7 @@ typedef unsigned short WCHAR;
|
||||
typedef long LONG;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
/* This type MUST be 64-bit (Remove this for C89 compatibility) */
|
||||
/* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
|
||||
typedef unsigned long long QWORD;
|
||||
|
||||
#endif
|
||||
|
@ -219,7 +219,7 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
||||
#define configBENCHMARK 0 /* Provided by Xtensa port patch */
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 0
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configQUEUE_REGISTRY_SIZE CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE
|
||||
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
@ -253,6 +253,7 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_pcTaskGetTaskName 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_pxTaskGetStackStart 1
|
||||
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
|
||||
|
@ -80,6 +80,7 @@ extern "C" {
|
||||
#include <xtensa/config/system.h> /* required for XSHAL_CLIB */
|
||||
#include <xtensa/xtruntime.h>
|
||||
#include "esp_crosscore_int.h"
|
||||
#include "esp_timer.h" /* required for FreeRTOS run time stats */
|
||||
|
||||
|
||||
#include <esp_heap_caps.h>
|
||||
@ -126,8 +127,20 @@ typedef unsigned portBASE_TYPE UBaseType_t;
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_attr.h"
|
||||
|
||||
/* "mux" data structure (spinlock) */
|
||||
typedef struct {
|
||||
/* owner field values:
|
||||
* 0 - Uninitialized (invalid)
|
||||
* portMUX_FREE_VAL - Mux is free, can be locked by either CPU
|
||||
* CORE_ID_PRO / CORE_ID_APP - Mux is locked to the particular core
|
||||
*
|
||||
* Any value other than portMUX_FREE_VAL, CORE_ID_PRO, CORE_ID_APP indicates corruption
|
||||
*/
|
||||
uint32_t owner;
|
||||
/* count field:
|
||||
* If mux is unlocked, count should be zero.
|
||||
* If mux is locked, count is non-zero & represents the number of recursive locks on the mux.
|
||||
*/
|
||||
uint32_t count;
|
||||
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
||||
const char *lastLockedFn;
|
||||
@ -135,22 +148,13 @@ typedef struct {
|
||||
#endif
|
||||
} portMUX_TYPE;
|
||||
|
||||
/*
|
||||
* Kernel mux values can be:
|
||||
* 0 - Uninitialized
|
||||
* (0-portNUM_PROCESSORS)|(recCnt<<8)|0xB33F0000 - taken by core (val), recurse count is (recCnt)
|
||||
* 0xB33FFFFF - free
|
||||
*
|
||||
* The magic number in the top 16 bits is there so we can detect uninitialized and corrupted muxes.
|
||||
*/
|
||||
|
||||
#define portMUX_FREE_VAL 0xB33FFFFF
|
||||
|
||||
/* Special constants for vPortCPUAcquireMutexTimeout() */
|
||||
#define portMUX_NO_TIMEOUT (-1) /* When passed for 'timeout_cycles', spin forever if necessary */
|
||||
#define portMUX_TRY_LOCK 0 /* Try to acquire the spinlock a single time only */
|
||||
|
||||
//Keep this in sync with the portMUX_TYPE struct definition please.
|
||||
// Keep this in sync with the portMUX_TYPE struct definition please.
|
||||
#ifndef CONFIG_FREERTOS_PORTMUX_DEBUG
|
||||
#define portMUX_INITIALIZER_UNLOCKED { \
|
||||
.owner = portMUX_FREE_VAL, \
|
||||
@ -165,10 +169,6 @@ typedef struct {
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Critical section management. NW-TODO: replace XTOS_SET_INTLEVEL with more efficient version, if any? */
|
||||
// These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level.
|
||||
#define portDISABLE_INTERRUPTS() do { XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); } while (0)
|
||||
#define portENABLE_INTERRUPTS() do { portbenchmarkINTERRUPT_RESTORE(0); XTOS_SET_INTLEVEL(0); } while (0)
|
||||
|
||||
#define portASSERT_IF_IN_ISR() vPortAssertIfInISR()
|
||||
void vPortAssertIfInISR();
|
||||
@ -176,9 +176,11 @@ void vPortAssertIfInISR();
|
||||
#define portCRITICAL_NESTING_IN_TCB 1
|
||||
|
||||
/*
|
||||
Modifications to portENTER_CRITICAL:
|
||||
Modifications to portENTER_CRITICAL.
|
||||
|
||||
The original portENTER_CRITICAL only disabled the ISRs. This is enough for single-CPU operation: by
|
||||
For an introduction, see "Critical Sections & Disabling Interrupts" in docs/api-guides/freertos-smp.rst
|
||||
|
||||
The original portENTER_CRITICAL only disabled the ISRs. This is enough for single-CPU operation: by
|
||||
disabling the interrupts, there is no task switch so no other tasks can meddle in the data, and because
|
||||
interrupts are disabled, ISRs can't corrupt data structures either.
|
||||
|
||||
@ -192,7 +194,7 @@ CPU from meddling with the data, it does not stop interrupts on the other cores
|
||||
data. For this, we also use a spinlock in the routines called by the ISR, but these spinlocks
|
||||
do not disable the interrupts (because they already are).
|
||||
|
||||
This all assumes that interrupts are either entirely disabled or enabled. Interrupr priority levels
|
||||
This all assumes that interrupts are either entirely disabled or enabled. Interrupt priority levels
|
||||
will break this scheme.
|
||||
|
||||
Remark: For the ESP32, portENTER_CRITICAL and portENTER_CRITICAL_ISR both alias vTaskEnterCritical, meaning
|
||||
@ -234,11 +236,21 @@ void vPortCPUReleaseMutex(portMUX_TYPE *mux);
|
||||
#define portEXIT_CRITICAL_ISR(mux) vTaskExitCritical(mux)
|
||||
#endif
|
||||
|
||||
// Cleaner and preferred solution allows nested interrupts disabling and restoring via local registers or stack.
|
||||
// Critical section management. NW-TODO: replace XTOS_SET_INTLEVEL with more efficient version, if any?
|
||||
// These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level.
|
||||
//
|
||||
// Only applies to one CPU. See notes above & below for reasons not to use these.
|
||||
#define portDISABLE_INTERRUPTS() do { XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); } while (0)
|
||||
#define portENABLE_INTERRUPTS() do { portbenchmarkINTERRUPT_RESTORE(0); XTOS_SET_INTLEVEL(0); } while (0)
|
||||
|
||||
// Cleaner solution allows nested interrupts disabling and restoring via local registers or stack.
|
||||
// They can be called from interrupts too.
|
||||
// WARNING: This ONLY disables interrupt on the current CPU, meaning they cannot be used as a replacement for the vTaskExitCritical spinlock
|
||||
// on a multicore system. Only use if disabling interrupts on the current CPU only is indeed what you want.
|
||||
static inline unsigned portENTER_CRITICAL_NESTED() { unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); return state; }
|
||||
// WARNING: Only applies to current CPU. See notes above.
|
||||
static inline unsigned portENTER_CRITICAL_NESTED() {
|
||||
unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);
|
||||
portbenchmarkINTERRUPT_DISABLE();
|
||||
return state;
|
||||
}
|
||||
#define portEXIT_CRITICAL_NESTED(state) do { portbenchmarkINTERRUPT_RESTORE(state); XTOS_RESTORE_JUST_INTLEVEL(state); } while (0)
|
||||
|
||||
// These FreeRTOS versions are similar to the nested versions above
|
||||
@ -260,12 +272,12 @@ static inline unsigned portENTER_CRITICAL_NESTED() { unsigned state = XTOS_SET_I
|
||||
|
||||
/*
|
||||
* Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare
|
||||
* *mux to compare, and if it's the same, will set *mux to set. It will return the old value
|
||||
* of *addr in *set.
|
||||
* *addr to 'compare'. If *addr == compare, *addr is set to *set. *set is updated with the previous
|
||||
* value of *addr (either 'compare' or some other value.)
|
||||
*
|
||||
* Warning: From the ISA docs: in some (unspecified) cases, the s32c1i instruction may return the
|
||||
* *bitwise inverse* of the old mem if the mem wasn't written. This doesn't seem to happen on the
|
||||
* ESP32, though. (Would show up directly if it did because the magic wouldn't match.)
|
||||
* ESP32 (portMUX assertions would fail).
|
||||
*/
|
||||
static inline void uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) {
|
||||
__asm__ __volatile__ (
|
||||
@ -288,6 +300,15 @@ static inline void uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, u
|
||||
|
||||
/* Fine resolution time */
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount()
|
||||
//ccount or esp_timer are initialized elsewhere
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
/* Coarse resolution time (us) */
|
||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) x = (uint32_t)esp_timer_get_time()
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Kernel utilities. */
|
||||
void vPortYield( void );
|
||||
|
@ -1106,7 +1106,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
// Now the buffer is empty we can switch context if necessary.
|
||||
if( xHigherPriorityTaskWoken )
|
||||
{
|
||||
taskYIELD ();
|
||||
portYIELD_FROM_ISR ();
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
@ -1177,7 +1177,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
// Now the buffer is empty we can switch context if necessary.
|
||||
if( xHigherPriorityTaskWoken )
|
||||
{
|
||||
taskYIELD ();
|
||||
portYIELD_FROM_ISR ();
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
@ -1627,6 +1627,23 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION
|
||||
void vQueueUnregisterQueue( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @note This function has been back ported from FreeRTOS v9.0.0
|
||||
*
|
||||
* The queue registry is provided as a means for kernel aware debuggers to
|
||||
* locate queues, semaphores and mutexes. Call pcQueueGetName() to look
|
||||
* up and return the name of a queue in the queue registry from the queue's
|
||||
* handle.
|
||||
*
|
||||
* @param xQueue The handle of the queue the name of which will be returned.
|
||||
* @return If the queue is in the registry then a pointer to the name of the
|
||||
* queue is returned. If the queue is not in the registry then NULL is
|
||||
* returned.
|
||||
*/
|
||||
#if( configQUEUE_REGISTRY_SIZE > 0 )
|
||||
const char *pcQueueGetName( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic version of the function used to creaet a queue using dynamic memory
|
||||
* allocation. This is called by other functions and macros that create other
|
||||
|
@ -1,6 +1,14 @@
|
||||
#ifndef FREERTOS_RINGBUF_H
|
||||
#define FREERTOS_RINGBUF_H
|
||||
|
||||
#ifndef INC_FREERTOS_H
|
||||
#error "include FreeRTOS.h" must appear in source files before "include ringbuf.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
Header definitions for a FreeRTOS ringbuffer object
|
||||
|
||||
@ -36,6 +44,8 @@ maximum size is (buffer_size/2)-8 bytes. The bytebuf can fill the entire buffer
|
||||
no overhead.
|
||||
*/
|
||||
|
||||
#include <freertos/queue.h>
|
||||
|
||||
//An opaque handle for a ringbuff object.
|
||||
typedef void * RingbufHandle_t;
|
||||
|
||||
@ -110,6 +120,8 @@ BaseType_t xRingbufferSendFromISR(RingbufHandle_t ringbuf, void *data, size_t da
|
||||
/**
|
||||
* @brief Retrieve an item from the ring buffer
|
||||
*
|
||||
* @note A call to vRingbufferReturnItem() is required after this to free up the data received.
|
||||
*
|
||||
* @param ringbuf - Ring buffer to retrieve the item from
|
||||
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
|
||||
* @param xTicksToWait - Ticks to wait for items in the ringbuffer.
|
||||
@ -123,6 +135,8 @@ void *xRingbufferReceive(RingbufHandle_t ringbuf, size_t *item_size, TickType_t
|
||||
/**
|
||||
* @brief Retrieve an item from the ring buffer from an ISR
|
||||
*
|
||||
* @note A call to vRingbufferReturnItemFromISR() is required after this to free up the data received
|
||||
*
|
||||
* @param ringbuf - Ring buffer to retrieve the item from
|
||||
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
|
||||
*
|
||||
@ -135,6 +149,8 @@ void *xRingbufferReceiveFromISR(RingbufHandle_t ringbuf, size_t *item_size);
|
||||
/**
|
||||
* @brief Retrieve bytes from a ByteBuf type of ring buffer, specifying the maximum amount of bytes
|
||||
* to return
|
||||
|
||||
* @note A call to vRingbufferReturnItem() is required after this to free up the data received.
|
||||
*
|
||||
* @param ringbuf - Ring buffer to retrieve the item from
|
||||
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
|
||||
@ -150,6 +166,8 @@ void *xRingbufferReceiveUpTo(RingbufHandle_t ringbuf, size_t *item_size, TickTyp
|
||||
* @brief Retrieve bytes from a ByteBuf type of ring buffer, specifying the maximum amount of bytes
|
||||
* to return. Call this from an ISR.
|
||||
*
|
||||
* @note A call to vRingbufferReturnItemFromISR() is required after this to free up the data received
|
||||
*
|
||||
* @param ringbuf - Ring buffer to retrieve the item from
|
||||
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
|
||||
*
|
||||
@ -242,5 +260,9 @@ BaseType_t xRingbufferRemoveFromQueueSetWrite(RingbufHandle_t ringbuf, QueueSetH
|
||||
*/
|
||||
void xRingbufferPrintInfo(RingbufHandle_t ringbuf);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERTOS_RINGBUF_H */
|
||||
|
||||
|
@ -1382,6 +1382,15 @@ BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter )
|
||||
*/
|
||||
TaskHandle_t xTaskGetIdleTaskHandle( void );
|
||||
|
||||
/**
|
||||
* xTaskGetIdleTaskHandleForCPU() is only available if
|
||||
* INCLUDE_xTaskGetIdleTaskHandle is set to 1 in FreeRTOSConfig.h.
|
||||
*
|
||||
* Simply returns the idle task handle of a given cpu. It is not valid to call
|
||||
* xTaskGetIdleTaskHandleForCPU() before the scheduler has been started.
|
||||
*/
|
||||
TaskHandle_t xTaskGetIdleTaskHandleForCPU( UBaseType_t cpuid );
|
||||
|
||||
/**
|
||||
* configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for
|
||||
* uxTaskGetSystemState() to be available.
|
||||
|
@ -315,7 +315,7 @@ STRUCT_END(XtSolFrame)
|
||||
/*
|
||||
Macro to get the current core ID. Only uses the reg given as an argument.
|
||||
Reading PRID on the ESP32 gives us 0xCDCD on the PRO processor (0)
|
||||
and 0xABAB on the APP CPU (1). We distinguish between the two by simply checking
|
||||
and 0xABAB on the APP CPU (1). We can distinguish between the two by checking
|
||||
bit 13: it's 1 on the APP and 0 on the PRO processor.
|
||||
*/
|
||||
#ifdef __ASSEMBLER__
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include <stdlib.h>
|
||||
#include "multi_heap.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Flags to indicate the capabilities of the various memory systems
|
||||
*/
|
||||
@ -40,7 +44,7 @@
|
||||
*
|
||||
* Equivalent semantics to libc malloc(), for capability-aware memory.
|
||||
*
|
||||
* In IDF, ``malloc(p)`` is equivalent to ``heaps_caps_malloc(p, MALLOC_CAP_8BIT)``.
|
||||
* In IDF, ``malloc(p)`` is equivalent to ``heap_caps_malloc(p, MALLOC_CAP_8BIT)``.
|
||||
*
|
||||
* @param size Size, in bytes, of the amount of memory to allocate
|
||||
* @param caps Bitwise OR of MALLOC_CAP_* flags indicating the type
|
||||
@ -63,7 +67,7 @@ void *heap_caps_malloc(size_t size, uint32_t caps);
|
||||
void heap_caps_free( void *ptr);
|
||||
|
||||
/**
|
||||
* @brief Reallocate memory previously allocated via heaps_caps_malloc() or heaps_caps_realloc().
|
||||
* @brief Reallocate memory previously allocated via heap_caps_malloc() or heaps_caps_realloc().
|
||||
*
|
||||
* Equivalent semantics to libc realloc(), for capability-aware memory.
|
||||
*
|
||||
@ -306,3 +310,6 @@ void heap_caps_dump(uint32_t caps);
|
||||
*/
|
||||
void heap_caps_dump_all();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include "esp_heap_caps.h"
|
||||
#include "soc/soc_memory_layout.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initialize the capability-aware heap allocator.
|
||||
*
|
||||
@ -82,5 +86,6 @@ esp_err_t heap_caps_add_region(intptr_t start, intptr_t end);
|
||||
esp_err_t heap_caps_add_region_with_caps(const uint32_t caps[], intptr_t start, intptr_t end);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include <stdint.h>
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_HEAP_TRACING) && !defined(HEAP_TRACE_SRCFILE)
|
||||
#warning "esp_heap_trace.h is included but heap tracing is disabled in menuconfig, functions are no-ops"
|
||||
#endif
|
||||
@ -134,3 +138,7 @@ esp_err_t heap_trace_get(size_t index, heap_trace_record_t *record);
|
||||
*
|
||||
*/
|
||||
void heap_trace_dump(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -55,11 +55,14 @@ void esp_log_level_set(const char* tag, esp_log_level_t level);
|
||||
* @brief Set function used to output log entries
|
||||
*
|
||||
* By default, log output goes to UART0. This function can be used to redirect log
|
||||
* output to some other destination, such as file or network.
|
||||
* output to some other destination, such as file or network. Returns the original
|
||||
* log handler, which may be necessary to return output to the previous destination.
|
||||
*
|
||||
* @param func Function used for output. Must have same signature as vprintf.
|
||||
* @param func new Function used for output. Must have same signature as vprintf.
|
||||
*
|
||||
* @return func old Function used for output.
|
||||
*/
|
||||
void esp_log_set_vprintf(vprintf_like_t func);
|
||||
vprintf_like_t esp_log_set_vprintf(vprintf_like_t func);
|
||||
|
||||
/**
|
||||
* @brief Function which returns timestamp to be used in log output
|
||||
|
@ -333,6 +333,7 @@ struct netif {
|
||||
|
||||
#if ESP_LWIP
|
||||
void (*l2_buffer_free_notify)(void *user_buf); /* Allows LWIP to notify driver when a L2-supplied pbuf can be freed */
|
||||
ip_addr_t last_ip_addr; /* Store last non-zero ip address */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "esp_task.h"
|
||||
#include "esp_system.h"
|
||||
#include "sdkconfig.h"
|
||||
@ -111,26 +112,26 @@
|
||||
* MEMP_NUM_RAW_PCB: Number of raw connection PCBs
|
||||
* (requires the LWIP_RAW option)
|
||||
*/
|
||||
#define MEMP_NUM_RAW_PCB 16
|
||||
#define MEMP_NUM_RAW_PCB CONFIG_LWIP_MAX_RAW_PCBS
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
|
||||
* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_PCB 16
|
||||
#define MEMP_NUM_TCP_PCB CONFIG_LWIP_MAX_ACTIVE_TCP
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 16
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN CONFIG_LWIP_MAX_LISTENING_TCP
|
||||
|
||||
/**
|
||||
* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
* per active UDP "connection".
|
||||
* (requires the LWIP_UDP option)
|
||||
*/
|
||||
#define MEMP_NUM_UDP_PCB 16
|
||||
#define MEMP_NUM_UDP_PCB CONFIG_LWIP_MAX_UDP_PCBS
|
||||
|
||||
/*
|
||||
--------------------------------
|
||||
|
@ -28,7 +28,7 @@
|
||||
new, free, \
|
||||
handshake, shutdown, clear, \
|
||||
read, send, pending, \
|
||||
set_fd, get_fd, \
|
||||
set_fd, set_hostname, get_fd, \
|
||||
set_bufflen, \
|
||||
get_verify_result, \
|
||||
get_state) \
|
||||
@ -42,6 +42,7 @@
|
||||
send, \
|
||||
pending, \
|
||||
set_fd, \
|
||||
set_hostname, \
|
||||
get_fd, \
|
||||
set_bufflen, \
|
||||
get_verify_result, \
|
||||
|
@ -81,6 +81,9 @@ typedef struct x509_method_st X509_METHOD;
|
||||
struct pkey_method_st;
|
||||
typedef struct pkey_method_st PKEY_METHOD;
|
||||
|
||||
struct ssl_alpn_st;
|
||||
typedef struct ssl_alpn_st SSL_ALPN;
|
||||
|
||||
struct stack_st {
|
||||
|
||||
char **data;
|
||||
@ -144,6 +147,16 @@ struct X509_VERIFY_PARAM_st {
|
||||
|
||||
};
|
||||
|
||||
typedef enum { ALPN_INIT, ALPN_ENABLE, ALPN_DISABLE, ALPN_ERROR } ALPN_STATUS;
|
||||
struct ssl_alpn_st {
|
||||
ALPN_STATUS alpn_status;
|
||||
/* This is dynamically allocated */
|
||||
char *alpn_string;
|
||||
/* This only points to the members in the string */
|
||||
#define ALPN_LIST_MAX 10
|
||||
const char *alpn_list[ALPN_LIST_MAX];
|
||||
};
|
||||
|
||||
struct ssl_ctx_st
|
||||
{
|
||||
int version;
|
||||
@ -152,9 +165,7 @@ struct ssl_ctx_st
|
||||
|
||||
unsigned long options;
|
||||
|
||||
#if 0
|
||||
struct alpn_protocols alpn_protocol;
|
||||
#endif
|
||||
SSL_ALPN ssl_alpn;
|
||||
|
||||
const SSL_METHOD *method;
|
||||
|
||||
@ -248,6 +259,8 @@ struct ssl_method_func_st {
|
||||
|
||||
void (*ssl_set_fd)(SSL *ssl, int fd, int mode);
|
||||
|
||||
void (*ssl_set_hostname)(SSL *ssl, const char *hostname);
|
||||
|
||||
int (*ssl_get_fd)(const SSL *ssl, int mode);
|
||||
|
||||
void (*ssl_set_bufflen)(SSL *ssl, int len);
|
||||
@ -277,6 +290,7 @@ struct pkey_method_st {
|
||||
int (*pkey_load)(EVP_PKEY *pkey, const unsigned char *buf, int len);
|
||||
};
|
||||
|
||||
|
||||
typedef int (*next_proto_cb)(SSL *ssl, unsigned char **out,
|
||||
unsigned char *outlen, const unsigned char *in,
|
||||
unsigned int inlen, void *arg);
|
||||
|
@ -26,6 +26,14 @@
|
||||
{
|
||||
*/
|
||||
|
||||
#define SSL_CB_ALERT 0x4000
|
||||
|
||||
#define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT (1 << 0)
|
||||
#define X509_CHECK_FLAG_NO_WILDCARDS (1 << 1)
|
||||
#define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS (1 << 2)
|
||||
#define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS (1 << 3)
|
||||
#define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS (1 << 4)
|
||||
|
||||
/**
|
||||
* @brief create a SSL context
|
||||
*
|
||||
@ -145,6 +153,18 @@ int SSL_shutdown(SSL *ssl);
|
||||
*/
|
||||
int SSL_set_fd(SSL *ssl, int fd);
|
||||
|
||||
/**
|
||||
* @brief Set the hostname for SNI
|
||||
*
|
||||
* @param ssl - the SSL context point
|
||||
* @param hostname - pointer to the hostname
|
||||
*
|
||||
* @return result
|
||||
* 1 : OK
|
||||
* 0 : failed
|
||||
*/
|
||||
int SSL_set_tlsext_host_name(SSL* ssl, const char *hostname);
|
||||
|
||||
/**
|
||||
* @brief These functions load the private key into the SSL_CTX or SSL object
|
||||
*
|
||||
@ -1511,6 +1531,53 @@ long SSL_get_timeout(const SSL *ssl);
|
||||
*/
|
||||
int SSL_get_verify_mode(const SSL *ssl);
|
||||
|
||||
/**
|
||||
* @brief get SSL verify parameters
|
||||
*
|
||||
* @param ssl - SSL point
|
||||
*
|
||||
* @return verify parameters
|
||||
*/
|
||||
X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);
|
||||
|
||||
/**
|
||||
* @brief set expected hostname the peer cert CN should have
|
||||
*
|
||||
* @param param - verify parameters from SSL_get0_param()
|
||||
*
|
||||
* @param name - the expected hostname
|
||||
*
|
||||
* @param namelen - the length of the hostname, or 0 if NUL terminated
|
||||
*
|
||||
* @return verify parameters
|
||||
*/
|
||||
int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
|
||||
const char *name, size_t namelen);
|
||||
|
||||
/**
|
||||
* @brief set parameters for X509 host verify action
|
||||
*
|
||||
* @param param -verify parameters from SSL_get0_param()
|
||||
*
|
||||
* @param flags - bitfield of X509_CHECK_FLAG_... parameters to set
|
||||
*
|
||||
* @return 1 for success, 0 for failure
|
||||
*/
|
||||
int X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
|
||||
unsigned long flags);
|
||||
|
||||
/**
|
||||
* @brief clear parameters for X509 host verify action
|
||||
*
|
||||
* @param param -verify parameters from SSL_get0_param()
|
||||
*
|
||||
* @param flags - bitfield of X509_CHECK_FLAG_... parameters to clear
|
||||
*
|
||||
* @return 1 for success, 0 for failure
|
||||
*/
|
||||
int X509_VERIFY_PARAM_clear_hostflags(X509_VERIFY_PARAM *param,
|
||||
unsigned long flags);
|
||||
|
||||
/**
|
||||
* @brief get SSL write only IO handle
|
||||
*
|
||||
|
@ -39,6 +39,8 @@ int ssl_pm_pending(const SSL *ssl);
|
||||
void ssl_pm_set_fd(SSL *ssl, int fd, int mode);
|
||||
int ssl_pm_get_fd(const SSL *ssl, int mode);
|
||||
|
||||
void ssl_pm_set_hostname(SSL *ssl, const char *hostname);
|
||||
|
||||
OSSL_HANDSHAKE_STATE ssl_pm_get_state(const SSL *ssl);
|
||||
|
||||
void ssl_pm_set_bufflen(SSL *ssl, int len);
|
||||
|
@ -85,6 +85,13 @@ void esp_cpu_stall(int cpu_id);
|
||||
*/
|
||||
void esp_cpu_unstall(int cpu_id);
|
||||
|
||||
/**
|
||||
* @brief Reset CPU using RTC controller
|
||||
* @param cpu_id ID of the CPU to reset (0 = PRO, 1 = APP)
|
||||
*/
|
||||
void esp_cpu_reset(int cpu_id);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns true if a JTAG debugger is attached to CPU
|
||||
* OCD (on chip debug) port.
|
||||
|
@ -1043,16 +1043,19 @@
|
||||
#define DPORT_WIFI_CLK_EN_V 0xFFFFFFFF
|
||||
#define DPORT_WIFI_CLK_EN_S 0
|
||||
|
||||
/* Mask for all Wifi clock bits - 0, 1, 2, 3, 6, 7, 8, 9, 10, 15 */
|
||||
#define DPORT_WIFI_CLK_WIFI_EN 0x000007cf
|
||||
/* Mask for all Wifi clock bits - 1, 2, 10 */
|
||||
#define DPORT_WIFI_CLK_WIFI_EN 0x00000406
|
||||
#define DPORT_WIFI_CLK_WIFI_EN_M ((DPORT_WIFI_CLK_WIFI_EN_V)<<(DPORT_WIFI_CLK_WIFI_EN_S))
|
||||
#define DPORT_WIFI_CLK_WIFI_EN_V 0x1FF
|
||||
#define DPORT_WIFI_CLK_WIFI_EN_V 0x406
|
||||
#define DPORT_WIFI_CLK_WIFI_EN_S 0
|
||||
/* Mask for all Bluetooth clock bits - 11, 16, 17 */
|
||||
#define DPORT_WIFI_CLK_BT_EN 0x61
|
||||
#define DPORT_WIFI_CLK_BT_EN_M ((DPORT_WIFI_CLK_BT_EN_V)<<(DPORT_WIFI_CLK_BT_EN_S))
|
||||
#define DPORT_WIFI_CLK_BT_EN_V 0x61
|
||||
#define DPORT_WIFI_CLK_BT_EN_S 11
|
||||
/* Mask for clock bits used by both WIFI and Bluetooth, bit 0, 3, 6, 7, 8, 9 */
|
||||
#define DPORT_WIFI_CLK_WIFI_BT_COMMON_M 0x000003c9
|
||||
|
||||
/* Remaining single bit clock masks */
|
||||
#define DPORT_WIFI_CLK_SDIOSLAVE_EN BIT(4)
|
||||
#define DPORT_WIFI_CLK_UNUSED_BIT5 BIT(5)
|
||||
|
@ -100,6 +100,8 @@
|
||||
#define EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ6 0
|
||||
#define EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ5 1
|
||||
#define EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 2
|
||||
#define EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 4
|
||||
#define EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 5
|
||||
/* EFUSE_RD_SPI_PAD_CONFIG_HD : RO ;bitpos:[8:4] ;default: 5'b0 ; */
|
||||
/*description: read for SPI_pad_config_hd*/
|
||||
#define EFUSE_RD_SPI_PAD_CONFIG_HD 0x0000001F
|
||||
|
@ -129,8 +129,7 @@
|
||||
|
||||
#define GPIO_STRAP_REG (DR_REG_GPIO_BASE + 0x0038)
|
||||
/* GPIO_STRAPPING : RO ;bitpos:[15:0] ;default: ; */
|
||||
/*description: GPIO strapping results: {2'd0 boot_sel_dig[7:1] vsdio_boot_sel
|
||||
boot_sel_chip[5:0]}. Boot_sel_dig[7:1]: {U0RXD SD_CLK SD_CMD SD_DATA0 SD_DATA1 SD_DATA2 SD_DATA3}. vsdio_boot_sel: MTDI. boot_sel_chip[5:0]: {GPIO0 U0TXD GPIO2 GPIO4 MTDO GPIO5}*/
|
||||
/*description: {10'b0, MTDI, GPIO0, GPIO2, GPIO4, MTDO, GPIO5} */
|
||||
#define GPIO_STRAPPING 0x0000FFFF
|
||||
#define GPIO_STRAPPING_M ((GPIO_STRAPPING_V)<<(GPIO_STRAPPING_S))
|
||||
#define GPIO_STRAPPING_V 0xFFFF
|
||||
|
@ -72,7 +72,6 @@
|
||||
#define MCU_SEL_M (MCU_SEL_V << MCU_SEL_S)
|
||||
#define MCU_SEL_V 0x7
|
||||
#define MCU_SEL_S 12
|
||||
#define MCU_SEL_V 0x7
|
||||
|
||||
#define PIN_INPUT_ENABLE(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME,FUN_IE)
|
||||
#define PIN_INPUT_DISABLE(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME,FUN_IE)
|
||||
|
@ -400,6 +400,15 @@ uint64_t rtc_time_slowclk_to_us(uint64_t rtc_cycles, uint32_t period);
|
||||
*/
|
||||
uint64_t rtc_time_get();
|
||||
|
||||
/**
|
||||
* @brief Busy loop until next RTC_SLOW_CLK cycle
|
||||
*
|
||||
* This function returns not earlier than the next RTC_SLOW_CLK clock cycle.
|
||||
* In some cases (e.g. when RTC_SLOW_CLK cycle is very close), it may return
|
||||
* one RTC_SLOW_CLK cycle later.
|
||||
*/
|
||||
void rtc_clk_wait_for_slow_cycle();
|
||||
|
||||
/**
|
||||
* @brief sleep configuration for rtc_sleep_init function
|
||||
*/
|
||||
@ -554,6 +563,36 @@ typedef struct {
|
||||
*/
|
||||
void rtc_init(rtc_config_t cfg);
|
||||
|
||||
/**
|
||||
* Structure describing vddsdio configuration
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t force : 1; //!< If 1, use configuration from RTC registers; if 0, use EFUSE/bootstrapping pins.
|
||||
uint32_t enable : 1; //!< Enable VDDSDIO regulator
|
||||
uint32_t tieh : 1; //!< Select VDDSDIO voltage: 1 — 1.8V, 0 — 3.3V
|
||||
uint32_t drefh : 2; //!< Tuning parameter for VDDSDIO regulator
|
||||
uint32_t drefm : 2; //!< Tuning parameter for VDDSDIO regulator
|
||||
uint32_t drefl : 2; //!< Tuning parameter for VDDSDIO regulator
|
||||
} rtc_vddsdio_config_t;
|
||||
|
||||
/**
|
||||
* Get current VDDSDIO configuration
|
||||
* If VDDSDIO configuration is overridden by RTC, get values from RTC
|
||||
* Otherwise, if VDDSDIO is configured by EFUSE, get values from EFUSE
|
||||
* Otherwise, use default values and the level of MTDI bootstrapping pin.
|
||||
* @return currently used VDDSDIO configuration
|
||||
*/
|
||||
rtc_vddsdio_config_t rtc_vddsdio_get_config();
|
||||
|
||||
/**
|
||||
* Set new VDDSDIO configuration using RTC registers.
|
||||
* If config.force == 1, this overrides configuration done using bootstrapping
|
||||
* pins and EFUSE.
|
||||
*
|
||||
* @param config new VDDSDIO configuration
|
||||
*/
|
||||
void rtc_vddsdio_set_config(rtc_vddsdio_config_t config);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -96,12 +96,18 @@
|
||||
#define SENS_FORCE_XPD_SAR_M ((SENS_FORCE_XPD_SAR_V)<<(SENS_FORCE_XPD_SAR_S))
|
||||
#define SENS_FORCE_XPD_SAR_V 0x3
|
||||
#define SENS_FORCE_XPD_SAR_S 18
|
||||
#define SENS_FORCE_XPD_SAR_FSM 0 // Use FSM to control power down
|
||||
#define SENS_FORCE_XPD_SAR_PD 2 // Force power down
|
||||
#define SENS_FORCE_XPD_SAR_PU 3 // Force power up
|
||||
/* SENS_FORCE_XPD_AMP : R/W ;bitpos:[17:16] ;default: 2'd0 ; */
|
||||
/*description: */
|
||||
#define SENS_FORCE_XPD_AMP 0x00000003
|
||||
#define SENS_FORCE_XPD_AMP_M ((SENS_FORCE_XPD_AMP_V)<<(SENS_FORCE_XPD_AMP_S))
|
||||
#define SENS_FORCE_XPD_AMP_V 0x3
|
||||
#define SENS_FORCE_XPD_AMP_S 16
|
||||
#define SENS_FORCE_XPD_AMP_FSM 0 // Use FSM to control power down
|
||||
#define SENS_FORCE_XPD_AMP_PD 2 // Force power down
|
||||
#define SENS_FORCE_XPD_AMP_PU 3 // Force power up
|
||||
/* SENS_SAR_AMP_WAIT3 : R/W ;bitpos:[15:0] ;default: 16'd10 ; */
|
||||
/*description: */
|
||||
#define SENS_SAR_AMP_WAIT3 0x0000FFFF
|
||||
@ -958,24 +964,36 @@
|
||||
#define SENS_AMP_SHORT_REF_GND_FORCE_M ((SENS_AMP_SHORT_REF_GND_FORCE_V)<<(SENS_AMP_SHORT_REF_GND_FORCE_S))
|
||||
#define SENS_AMP_SHORT_REF_GND_FORCE_V 0x3
|
||||
#define SENS_AMP_SHORT_REF_GND_FORCE_S 17
|
||||
#define SENS_AMP_SHORT_REF_GND_FORCE_FSM 0 // Use FSM to control power down
|
||||
#define SENS_AMP_SHORT_REF_GND_FORCE_PD 2 // Force power down
|
||||
#define SENS_AMP_SHORT_REF_GND_FORCE_PU 3 // Force power up
|
||||
/* SENS_AMP_SHORT_REF_FORCE : R/W ;bitpos:[16:15] ;default: 2'b0 ; */
|
||||
/*description: */
|
||||
#define SENS_AMP_SHORT_REF_FORCE 0x00000003
|
||||
#define SENS_AMP_SHORT_REF_FORCE_M ((SENS_AMP_SHORT_REF_FORCE_V)<<(SENS_AMP_SHORT_REF_FORCE_S))
|
||||
#define SENS_AMP_SHORT_REF_FORCE_V 0x3
|
||||
#define SENS_AMP_SHORT_REF_FORCE_S 15
|
||||
#define SENS_AMP_SHORT_REF_FORCE_FSM 0 // Use FSM to control power down
|
||||
#define SENS_AMP_SHORT_REF_FORCE_PD 2 // Force power down
|
||||
#define SENS_AMP_SHORT_REF_FORCE_PU 3 // Force power up
|
||||
/* SENS_AMP_RST_FB_FORCE : R/W ;bitpos:[14:13] ;default: 2'b0 ; */
|
||||
/*description: */
|
||||
#define SENS_AMP_RST_FB_FORCE 0x00000003
|
||||
#define SENS_AMP_RST_FB_FORCE_M ((SENS_AMP_RST_FB_FORCE_V)<<(SENS_AMP_RST_FB_FORCE_S))
|
||||
#define SENS_AMP_RST_FB_FORCE_V 0x3
|
||||
#define SENS_AMP_RST_FB_FORCE_S 13
|
||||
#define SENS_AMP_RST_FB_FORCE_FSM 0 // Use FSM to control power down
|
||||
#define SENS_AMP_RST_FB_FORCE_PD 2 // Force power down
|
||||
#define SENS_AMP_RST_FB_FORCE_PU 3 // Force power up
|
||||
/* SENS_SAR2_RSTB_FORCE : R/W ;bitpos:[12:11] ;default: 2'b0 ; */
|
||||
/*description: */
|
||||
#define SENS_SAR2_RSTB_FORCE 0x00000003
|
||||
#define SENS_SAR2_RSTB_FORCE_M ((SENS_SAR2_RSTB_FORCE_V)<<(SENS_SAR2_RSTB_FORCE_S))
|
||||
#define SENS_SAR2_RSTB_FORCE_V 0x3
|
||||
#define SENS_SAR2_RSTB_FORCE_S 11
|
||||
#define SENS_SAR2_RSTB_FORCE_FSM 0 // Use FSM to control power down
|
||||
#define SENS_SAR2_RSTB_FORCE_PD 2 // Force power down
|
||||
#define SENS_SAR2_RSTB_FORCE_PU 3 // Force power up
|
||||
/* SENS_SAR_RSTB_FSM_IDLE : R/W ;bitpos:[10] ;default: 1'b0 ; */
|
||||
/*description: */
|
||||
#define SENS_SAR_RSTB_FSM_IDLE (BIT(10))
|
||||
|
@ -289,11 +289,15 @@ typedef void (*spi_flash_op_unlock_func_t)(void);
|
||||
* is invoked before the call to one of ROM function above.
|
||||
* - 'end' function should restore state of flash cache and non-IRAM interrupts and
|
||||
* is invoked after the call to one of ROM function above.
|
||||
* These two functions are not recursive.
|
||||
* 2) Functions which synchronizes access to internal data used by flash API.
|
||||
* This functions are mostly intended to synchronize access to flash API internal data
|
||||
* in multithreaded environment and use OS primitives:
|
||||
* - 'op_lock' locks access to flash API internal data.
|
||||
* - 'op_unlock' unlocks access to flash API internal data.
|
||||
* These two functions are recursive and can be used around the outside of multiple calls to
|
||||
* 'start' & 'end', in order to create atomic multi-part flash operations.
|
||||
*
|
||||
* Different versions of the guarding functions should be used depending on the context of
|
||||
* execution (with or without functional OS). In normal conditions when flash API is called
|
||||
* from task the functions use OS primitives. When there is no OS at all or when
|
||||
@ -304,10 +308,10 @@ typedef void (*spi_flash_op_unlock_func_t)(void);
|
||||
* For example structure can be placed in DRAM and functions in IRAM sections.
|
||||
*/
|
||||
typedef struct {
|
||||
spi_flash_guard_start_func_t start; /**< critical section start func */
|
||||
spi_flash_guard_end_func_t end; /**< critical section end func */
|
||||
spi_flash_op_lock_func_t op_lock; /**< flash access API lock func */
|
||||
spi_flash_op_unlock_func_t op_unlock; /**< flash access API unlock func */
|
||||
spi_flash_guard_start_func_t start; /**< critical section start function. */
|
||||
spi_flash_guard_end_func_t end; /**< critical section end function. */
|
||||
spi_flash_op_lock_func_t op_lock; /**< flash access API lock function.*/
|
||||
spi_flash_op_unlock_func_t op_unlock; /**< flash access API unlock function.*/
|
||||
} spi_flash_guard_funcs_t;
|
||||
|
||||
/**
|
||||
@ -320,6 +324,15 @@ typedef struct {
|
||||
*/
|
||||
void spi_flash_guard_set(const spi_flash_guard_funcs_t* funcs);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the guard functions used for flash access
|
||||
*
|
||||
* @return The guard functions that were set via spi_flash_guard_set(). These functions
|
||||
* can be called if implementing custom low-level SPI flash operations.
|
||||
*/
|
||||
const spi_flash_guard_funcs_t *spi_flash_guard_get();
|
||||
|
||||
/**
|
||||
* @brief Default OS-aware flash access guard functions
|
||||
*/
|
||||
|
18
tools/sdk/include/vfs/sys/ioctl.h
Normal file
18
tools/sdk/include/vfs/sys/ioctl.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2015-2017 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
int ioctl(int fd, int request, ...);
|
||||
|
Reference in New Issue
Block a user