Update IDF to f586f5e (#1296)

* Update BLE lib

* Update IDF to f586f5e

* Restructure Bluetooth Serial includes

* Update esptool and gen_esp32part

* Add partition scheme selection for menuconfig

* Add partition scheme selection for Arduino IDE

* Fix BLE example

* Second attempt BLE fix

* Add exceptions to PIO
This commit is contained in:
Me No Dev
2018-04-07 09:45:18 +03:00
committed by GitHub
parent 1cf42702dd
commit 69f72eca84
168 changed files with 6279 additions and 666 deletions

View File

@ -251,5 +251,6 @@ extern UINT8 A2D_BitsSet(UINT8 num);
**
*******************************************************************************/
extern void A2D_Init(void);
extern void A2D_Deinit(void);
#endif ///A2D_INCLUDED
#endif /* A2D_API_H */

View File

@ -21,6 +21,7 @@
#include <stddef.h>
#include <stdlib.h>
#include "esp_heap_caps.h"
#include "sdkconfig.h"
typedef void *(*alloc_fn)(size_t size);
@ -48,11 +49,13 @@ void osi_mem_dbg_record(void *p, int size, const char *func, int line);
void osi_mem_dbg_clean(void *p, const char *func, int line);
void osi_mem_dbg_show(void);
#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
#define osi_malloc(size) \
({ \
void *p; \
\
p = malloc((size)); \
p = heap_caps_malloc_prefer(size, 2, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
})
@ -60,12 +63,64 @@ void osi_mem_dbg_show(void);
#define osi_calloc(size) \
({ \
void *p; \
\
p = heap_caps_calloc_prefer(1, size, 2, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
})
#else
#define osi_malloc(size) \
({ \
void *p; \
p = malloc((size)); \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
})
#define osi_calloc(size) \
({ \
void *p; \
p = calloc(1, (size)); \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
})
#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
#if 0
#define osi_malloc(size) \
do { \
void *p; \
\
#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST \
p = heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
#else \
p = malloc((size)); \
#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */ \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
}while(0)
#define osi_calloc(size) \
do { \
void *p; \
\
#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST \
p = heap_caps_calloc_prefer(1, size, 2, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
#else \
p = calloc(1, (size)); \
#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */ \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
} while(0)
#endif
#define osi_free(ptr) \
do { \
void *tmp_point = (void *)(ptr); \
@ -75,10 +130,24 @@ do { \
#else
#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
#define osi_malloc(size) heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
#define osi_calloc(size) heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
#else
#define osi_malloc(size) malloc((size))
#define osi_calloc(size) calloc(1, (size))
#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
#define osi_free(p) free((p))
#endif /* CONFIG_BLUEDROID_MEM_DEBUG */
#define FREE_AND_RESET(a) \
do { \
if (a) { \
osi_free(a); \
a = NULL; \
} \
}while (0)
#endif /* _ALLOCATOR_H_ */

View File

@ -554,6 +554,19 @@ extern UINT8 AVRC_SetTraceLevel (UINT8 new_level);
*******************************************************************************/
extern void AVRC_Init(void);
/*******************************************************************************
**
** Function AVRC_Deinit
**
** Description This function is called at stack shotdown to free the
** control block (if using dynamic memory), and deinitializes the
** control block and tracing level.
**
** Returns void
**
*******************************************************************************/
extern void AVRC_Deinit(void);
/*******************************************************************************
**
** Function AVRC_ParsCommand

View File

@ -16,7 +16,7 @@
#define __BLUFI_INT_H__
#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
#define BTC_BLUFI_SUB_VER 0x01 //Version + Subversion
#define BTC_BLUFI_SUB_VER 0x02 //Version + Subversion
#define BTC_BLUFI_VERSION ((BTC_BLUFI_GREAT_VER<<8)|BTC_BLUFI_SUB_VER) //Version + Subversion
/* service engine control block */
@ -114,6 +114,8 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_REP 0x0f
#define BLUFI_TYPE_DATA_SUBTYPE_REPLY_VERSION 0x10
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_LIST 0x11
#define BLUFI_TYPE_DATA_SUBTYPE_ERROR_INFO 0x12
#define BLUFI_TYPE_DATA_SUBTYPE_CUSTOM_DATA 0x13
#define BLUFI_TYPE_IS_CTRL(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_CTRL)
#define BLUFI_TYPE_IS_DATA(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_DATA)
@ -142,6 +144,7 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
#define BLUFI_TYPE_IS_DATA_SERVER_CERT(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SERVER_CERT)
#define BLUFI_TYPE_IS_DATA_CLIENT_PRIV_KEY(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_CLIENT_PRIV_KEY)
#define BLUFI_TYPE_IS_DATA_SERVER_PRIV_KEY(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SERVER_PRIV_KEY)
#define BLUFI_TYPE_IS_DATA_ERROR_INFO(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_ERROR_INFO)
// packet frame control
#define BLUFI_FC_ENC_MASK 0x01

View File

@ -499,6 +499,8 @@ typedef struct {
#define BLE_ADDR_RANDOM 0x01
#define BLE_ADDR_PUBLIC_ID 0x02
#define BLE_ADDR_RANDOM_ID 0x03
#define BLE_ADDR_TYPE_MAX BLE_ADDR_RANDOM_ID
#define BLE_ADDR_UNKNOWN_TYPE 0XFF
typedef UINT8 tBLE_ADDR_TYPE;
#define BLE_ADDR_TYPE_MASK (BLE_ADDR_RANDOM | BLE_ADDR_PUBLIC)

View File

@ -409,6 +409,8 @@ typedef tBTM_ADD_WHITELIST_CBACK tBTA_ADD_WHITELIST_CBACK;
typedef tBTM_SET_PKT_DATA_LENGTH_CBACK tBTA_SET_PKT_DATA_LENGTH_CBACK;
typedef tBTM_SET_RAND_ADDR_CBACK tBTA_SET_RAND_ADDR_CBACK;
typedef tBTM_SET_LOCAL_PRIVACY_CBACK tBTA_SET_LOCAL_PRIVACY_CBACK;
typedef tBTM_CMPL_CB tBTA_CMPL_CB;
@ -2060,7 +2062,7 @@ extern void BTA_DmBleScan(BOOLEAN start, UINT32 duration,
extern void BTA_DmBleStopAdvertising(void);
extern void BTA_DmSetRandAddress(BD_ADDR rand_addr);
extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback);
#endif

View File

@ -0,0 +1,66 @@
/******************************************************************************
*
* Copyright (C) 2008-2012 Broadcom Corporation
*
* 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.
*
******************************************************************************/
/******************************************************************************
*
* This is the private interface file for the BTA audio/video registration
* module.
*
******************************************************************************/
#ifndef BTA_AR_INT_H
#define BTA_AR_INT_H
#include "bta_av_api.h"
#if (BTA_AR_INCLUDED == TRUE)
#ifndef BTA_AR_DEBUG
#define BTA_AR_DEBUG FALSE
#endif
#define BTA_AR_AV_MASK 0x01
#define BTA_AR_AVK_MASK 0x02
/* data associated with BTA_AR */
typedef struct {
tAVDT_CTRL_CBACK *p_av_conn_cback; /* av connection callback function */
tAVDT_CTRL_CBACK *p_avk_conn_cback; /* avk connection callback function */
UINT8 avdt_registered;
UINT8 avct_registered;
UINT32 sdp_tg_handle;
UINT32 sdp_ct_handle;
UINT16 ct_categories[2];
UINT8 tg_registered;
tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the connection. */
} tBTA_AR_CB;
/*****************************************************************************
** Global data
*****************************************************************************/
/* control block declaration */
#if BTA_DYNAMIC_MEMORY == FALSE
extern tBTA_AR_CB bta_ar_cb;
#else
extern tBTA_AR_CB *bta_ar_cb_ptr;
#define bta_ar_cb (*bta_ar_cb_ptr)
#endif
#endif ///BTA_AR_INCLUDED == TRUE
#endif /* BTA_AR_INT_H */

View File

@ -0,0 +1,708 @@
/******************************************************************************
*
* Copyright (C) 2004-2012 Broadcom Corporation
*
* 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.
*
******************************************************************************/
/******************************************************************************
*
* This is the private interface file for the BTA advanced audio/video.
*
******************************************************************************/
#ifndef BTA_AV_INT_H
#define BTA_AV_INT_H
#include "bta_sys.h"
#include "bta_api.h"
#include "bta_av_api.h"
#include "avdt_api.h"
#include "bta_av_co.h"
#include "list.h"
#if (BTA_AV_INCLUDED == TRUE)
#define BTA_AV_DEBUG TRUE
/*****************************************************************************
** Constants
*****************************************************************************/
enum {
/* these events are handled by the AV main state machine */
BTA_AV_API_DISABLE_EVT = BTA_SYS_EVT_START(BTA_ID_AV),
BTA_AV_API_REMOTE_CMD_EVT,
BTA_AV_API_VENDOR_CMD_EVT,
BTA_AV_API_VENDOR_RSP_EVT,
BTA_AV_API_META_RSP_EVT,
BTA_AV_API_RC_CLOSE_EVT,
BTA_AV_AVRC_OPEN_EVT,
BTA_AV_AVRC_MSG_EVT,
BTA_AV_AVRC_NONE_EVT,
/* these events are handled by the AV stream state machine */
BTA_AV_API_OPEN_EVT,
BTA_AV_API_CLOSE_EVT,
BTA_AV_AP_START_EVT, /* the following 2 events must be in the same order as the *API_*EVT */
BTA_AV_AP_STOP_EVT,
BTA_AV_API_RECONFIG_EVT,
BTA_AV_API_PROTECT_REQ_EVT,
BTA_AV_API_PROTECT_RSP_EVT,
BTA_AV_API_RC_OPEN_EVT,
BTA_AV_SRC_DATA_READY_EVT,
BTA_AV_CI_SETCONFIG_OK_EVT,
BTA_AV_CI_SETCONFIG_FAIL_EVT,
BTA_AV_SDP_DISC_OK_EVT,
BTA_AV_SDP_DISC_FAIL_EVT,
BTA_AV_STR_DISC_OK_EVT,
BTA_AV_STR_DISC_FAIL_EVT,
BTA_AV_STR_GETCAP_OK_EVT,
BTA_AV_STR_GETCAP_FAIL_EVT,
BTA_AV_STR_OPEN_OK_EVT,
BTA_AV_STR_OPEN_FAIL_EVT,
BTA_AV_STR_START_OK_EVT,
BTA_AV_STR_START_FAIL_EVT,
BTA_AV_STR_CLOSE_EVT,
BTA_AV_STR_CONFIG_IND_EVT,
BTA_AV_STR_SECURITY_IND_EVT,
BTA_AV_STR_SECURITY_CFM_EVT,
BTA_AV_STR_WRITE_CFM_EVT,
BTA_AV_STR_SUSPEND_CFM_EVT,
BTA_AV_STR_RECONFIG_CFM_EVT,
BTA_AV_AVRC_TIMER_EVT,
BTA_AV_AVDT_CONNECT_EVT,
BTA_AV_AVDT_DISCONNECT_EVT,
BTA_AV_ROLE_CHANGE_EVT,
BTA_AV_AVDT_DELAY_RPT_EVT,
BTA_AV_ACP_CONNECT_EVT,
/* these events are handled outside of the state machine */
BTA_AV_API_ENABLE_EVT,
BTA_AV_API_REGISTER_EVT,
BTA_AV_API_DEREGISTER_EVT,
BTA_AV_API_DISCONNECT_EVT,
BTA_AV_CI_SRC_DATA_READY_EVT,
BTA_AV_SIG_CHG_EVT,
BTA_AV_SIG_TIMER_EVT,
BTA_AV_SDP_AVRC_DISC_EVT,
BTA_AV_AVRC_CLOSE_EVT,
BTA_AV_CONN_CHG_EVT,
BTA_AV_DEREG_COMP_EVT,
#if (BTA_AV_SINK_INCLUDED == TRUE)
BTA_AV_API_SINK_ENABLE_EVT,
#endif
#if (AVDT_REPORTING == TRUE)
BTA_AV_AVDT_RPT_CONN_EVT,
#endif
BTA_AV_API_START_EVT, /* the following 2 events must be in the same order as the *AP_*EVT */
BTA_AV_API_STOP_EVT
};
/* events for AV control block state machine */
#define BTA_AV_FIRST_SM_EVT BTA_AV_API_DISABLE_EVT
#define BTA_AV_LAST_SM_EVT BTA_AV_AVRC_NONE_EVT
/* events for AV stream control block state machine */
#define BTA_AV_FIRST_SSM_EVT BTA_AV_API_OPEN_EVT
/* events that do not go through state machine */
#define BTA_AV_FIRST_NSM_EVT BTA_AV_API_ENABLE_EVT
#define BTA_AV_LAST_NSM_EVT BTA_AV_API_STOP_EVT
/* API events passed to both SSMs (by bta_av_api_to_ssm) */
#define BTA_AV_FIRST_A2S_API_EVT BTA_AV_API_START_EVT
#define BTA_AV_FIRST_A2S_SSM_EVT BTA_AV_AP_START_EVT
#define BTA_AV_LAST_EVT BTA_AV_API_STOP_EVT
/* maximum number of SEPS in stream discovery results */
#define BTA_AV_NUM_SEPS 32
/* initialization value for AVRC handle */
#define BTA_AV_RC_HANDLE_NONE 0xFF
/* size of database for service discovery */
#define BTA_AV_DISC_BUF_SIZE 1000
/* offset of media type in codec info byte array */
#define BTA_AV_MEDIA_TYPE_IDX 1
/* maximum length of AVDTP security data */
#define BTA_AV_SECURITY_MAX_LEN 400
/* check number of buffers queued at L2CAP when this amount of buffers are queued to L2CAP */
#define BTA_AV_QUEUE_DATA_CHK_NUM L2CAP_HIGH_PRI_MIN_XMIT_QUOTA
/* the number of ACL links with AVDT */
#define BTA_AV_NUM_LINKS AVDT_NUM_LINKS
#define BTA_AV_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
#define BTA_AV_BE_STREAM_TO_CO_ID(u32, p) {u32 = (((UINT32)(*((p) + 2))) + (((UINT32)(*((p) + 1))) << 8) + (((UINT32)(*(p))) << 16)); (p) += 3;}
/* these bits are defined for bta_av_cb.multi_av */
#define BTA_AV_MULTI_AV_SUPPORTED 0x01
#define BTA_AV_MULTI_AV_IN_USE 0x02
/*****************************************************************************
** Data types
*****************************************************************************/
#if 0
/* function types for call-out functions */
typedef BOOLEAN (*tBTA_AV_CO_INIT) (UINT8 *p_codec_type, UINT8 *p_codec_info,
UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, UINT8 num_seps,
UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local);
typedef UINT8 (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
UINT8 *p_num_protect, UINT8 *p_protect_info);
typedef void (*tBTA_AV_CO_SETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
UINT8 num_protect, UINT8 *p_protect_info,
UINT8 t_local_sep, UINT8 avdt_handle);
typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
UINT16 mtu);
typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
typedef void *(*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
UINT32 *p_len, UINT32 *p_timestamp);
typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
/* the call-out functions for one stream */
typedef struct {
tBTA_AV_CO_INIT init;
tBTA_AV_CO_DISC_RES disc_res;
tBTA_AV_CO_GETCFG getcfg;
tBTA_AV_CO_SETCFG setcfg;
tBTA_AV_CO_OPEN open;
tBTA_AV_CO_CLOSE close;
tBTA_AV_CO_START start;
tBTA_AV_CO_STOP stop;
tBTA_AV_CO_DATAPATH data;
tBTA_AV_CO_DELAY delay;
} tBTA_AV_CO_FUNCTS;
#endif
/* data type for BTA_AV_API_ENABLE_EVT */
typedef struct {
BT_HDR hdr;
tBTA_AV_CBACK *p_cback;
tBTA_AV_FEAT features;
tBTA_SEC sec_mask;
} tBTA_AV_API_ENABLE;
/* data type for BTA_AV_API_REG_EVT */
typedef struct {
BT_HDR hdr;
char p_service_name[BTA_SERVICE_NAME_LEN + 1];
UINT8 app_id;
tBTA_AV_DATA_CBACK *p_app_data_cback;
tBTA_AV_CO_FUNCTS *bta_av_cos;
} tBTA_AV_API_REG;
enum {
BTA_AV_RS_NONE, /* straight API call */
BTA_AV_RS_OK, /* the role switch result - successful */
BTA_AV_RS_FAIL, /* the role switch result - failed */
BTA_AV_RS_DONE /* the role switch is done - continue */
};
typedef UINT8 tBTA_AV_RS_RES;
/* data type for BTA_AV_API_OPEN_EVT */
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
BOOLEAN use_rc;
tBTA_SEC sec_mask;
tBTA_AV_RS_RES switch_res;
UINT16 uuid; /* uuid of initiator */
} tBTA_AV_API_OPEN;
/* data type for BTA_AV_API_STOP_EVT */
typedef struct {
BT_HDR hdr;
BOOLEAN suspend;
BOOLEAN flush;
} tBTA_AV_API_STOP;
/* data type for BTA_AV_API_DISCONNECT_EVT */
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
} tBTA_AV_API_DISCNT;
/* data type for BTA_AV_API_PROTECT_REQ_EVT */
typedef struct {
BT_HDR hdr;
UINT8 *p_data;
UINT16 len;
} tBTA_AV_API_PROTECT_REQ;
/* data type for BTA_AV_API_PROTECT_RSP_EVT */
typedef struct {
BT_HDR hdr;
UINT8 *p_data;
UINT16 len;
UINT8 error_code;
} tBTA_AV_API_PROTECT_RSP;
/* data type for BTA_AV_API_REMOTE_CMD_EVT */
typedef struct {
BT_HDR hdr;
tAVRC_MSG_PASS msg;
UINT8 label;
} tBTA_AV_API_REMOTE_CMD;
/* data type for BTA_AV_API_VENDOR_CMD_EVT and RSP */
typedef struct {
BT_HDR hdr;
tAVRC_MSG_VENDOR msg;
UINT8 label;
} tBTA_AV_API_VENDOR;
/* data type for BTA_AV_API_RC_OPEN_EVT */
typedef struct {
BT_HDR hdr;
} tBTA_AV_API_OPEN_RC;
/* data type for BTA_AV_API_RC_CLOSE_EVT */
typedef struct {
BT_HDR hdr;
} tBTA_AV_API_CLOSE_RC;
/* data type for BTA_AV_API_META_RSP_EVT */
typedef struct {
BT_HDR hdr;
BOOLEAN is_rsp;
UINT8 label;
tBTA_AV_CODE rsp_code;
BT_HDR *p_pkt;
} tBTA_AV_API_META_RSP;
/* data type for BTA_AV_API_RECONFIG_EVT */
typedef struct {
BT_HDR hdr;
UINT8 codec_info[AVDT_CODEC_SIZE]; /* codec configuration */
UINT8 *p_protect_info;
UINT8 num_protect;
BOOLEAN suspend;
UINT8 sep_info_idx;
} tBTA_AV_API_RCFG;
/* data type for BTA_AV_CI_SETCONFIG_OK_EVT and BTA_AV_CI_SETCONFIG_FAIL_EVT */
typedef struct {
BT_HDR hdr;
tBTA_AV_HNDL hndl;
UINT8 err_code;
UINT8 category;
UINT8 num_seid;
UINT8 *p_seid;
BOOLEAN recfg_needed;
UINT8 avdt_handle; /* local sep type for which this stream will be set up */
} tBTA_AV_CI_SETCONFIG;
/* data type for all stream events from AVDTP */
typedef struct {
BT_HDR hdr;
tAVDT_CFG cfg; /* configuration/capabilities parameters */
tAVDT_CTRL msg; /* AVDTP callback message parameters */
BD_ADDR bd_addr; /* bd address */
UINT8 handle;
UINT8 avdt_event;
BOOLEAN initiator; /* TRUE, if local device initiates the SUSPEND */
} tBTA_AV_STR_MSG;
/* data type for BTA_AV_AVRC_MSG_EVT */
typedef struct {
BT_HDR hdr;
tAVRC_MSG msg;
UINT8 handle;
UINT8 label;
UINT8 opcode;
} tBTA_AV_RC_MSG;
/* data type for BTA_AV_AVRC_OPEN_EVT, BTA_AV_AVRC_CLOSE_EVT */
typedef struct {
BT_HDR hdr;
BD_ADDR peer_addr;
UINT8 handle;
} tBTA_AV_RC_CONN_CHG;
/* data type for BTA_AV_CONN_CHG_EVT */
typedef struct {
BT_HDR hdr;
BD_ADDR peer_addr;
BOOLEAN is_up;
} tBTA_AV_CONN_CHG;
/* data type for BTA_AV_ROLE_CHANGE_EVT */
typedef struct {
BT_HDR hdr;
UINT8 new_role;
UINT8 hci_status;
} tBTA_AV_ROLE_RES;
/* data type for BTA_AV_SDP_DISC_OK_EVT */
typedef struct {
BT_HDR hdr;
UINT16 avdt_version; /* AVDTP protocol version */
} tBTA_AV_SDP_RES;
/* type for SEP control block */
typedef struct {
UINT8 av_handle; /* AVDTP handle */
tBTA_AV_CODEC codec_type; /* codec type */
UINT8 tsep; /* SEP type of local SEP */
tBTA_AV_DATA_CBACK *p_app_data_cback; /* Application callback for media packets */
} tBTA_AV_SEP;
/* initiator/acceptor role for adaption */
#define BTA_AV_ROLE_AD_INT 0x00 /* initiator */
#define BTA_AV_ROLE_AD_ACP 0x01 /* acceptor */
/* initiator/acceptor signaling roles */
#define BTA_AV_ROLE_START_ACP 0x00
#define BTA_AV_ROLE_START_INT 0x10 /* do not change this value */
#define BTA_AV_ROLE_SUSPEND 0x20 /* suspending on start */
#define BTA_AV_ROLE_SUSPEND_OPT 0x40 /* Suspend on Start option is set */
/* union of all event datatypes */
typedef union {
BT_HDR hdr;
tBTA_AV_API_ENABLE api_enable;
tBTA_AV_API_REG api_reg;
tBTA_AV_API_OPEN api_open;
tBTA_AV_API_STOP api_stop;
tBTA_AV_API_DISCNT api_discnt;
tBTA_AV_API_PROTECT_REQ api_protect_req;
tBTA_AV_API_PROTECT_RSP api_protect_rsp;
tBTA_AV_API_REMOTE_CMD api_remote_cmd;
tBTA_AV_API_VENDOR api_vendor;
tBTA_AV_API_RCFG api_reconfig;
tBTA_AV_CI_SETCONFIG ci_setconfig;
tBTA_AV_STR_MSG str_msg;
tBTA_AV_RC_MSG rc_msg;
tBTA_AV_RC_CONN_CHG rc_conn_chg;
tBTA_AV_CONN_CHG conn_chg;
tBTA_AV_ROLE_RES role_res;
tBTA_AV_SDP_RES sdp_res;
tBTA_AV_API_META_RSP api_meta_rsp;
} tBTA_AV_DATA;
typedef void (tBTA_AV_VDP_DATA_ACT)(void *p_scb);
typedef struct {
tBTA_AV_VDP_DATA_ACT *p_act;
UINT8 *p_frame;
UINT16 buf_size;
UINT32 len;
UINT32 offset;
UINT32 timestamp;
} tBTA_AV_VF_INFO;
typedef union {
tBTA_AV_VF_INFO vdp; /* used for video channels only */
tBTA_AV_API_OPEN open; /* used only before open and role switch
is needed on another AV channel */
} tBTA_AV_Q_INFO;
#define BTA_AV_Q_TAG_OPEN 0x01 /* after API_OPEN, before STR_OPENED */
#define BTA_AV_Q_TAG_START 0x02 /* before start sending media packets */
#define BTA_AV_Q_TAG_STREAM 0x03 /* during streaming */
#define BTA_AV_WAIT_ACP_CAPS_ON 0x01 /* retriving the peer capabilities */
#define BTA_AV_WAIT_ACP_CAPS_STARTED 0x02 /* started while retriving peer capabilities */
#define BTA_AV_WAIT_ROLE_SW_RES_OPEN 0x04 /* waiting for role switch result after API_OPEN, before STR_OPENED */
#define BTA_AV_WAIT_ROLE_SW_RES_START 0x08 /* waiting for role switch result before streaming */
#define BTA_AV_WAIT_ROLE_SW_STARTED 0x10 /* started while waiting for role switch result */
#define BTA_AV_WAIT_ROLE_SW_RETRY 0x20 /* set when retry on timeout */
#define BTA_AV_WAIT_CHECK_RC 0x40 /* set when the timer is used by role switch */
#define BTA_AV_WAIT_ROLE_SW_FAILED 0x80 /* role switch failed */
#define BTA_AV_WAIT_ROLE_SW_BITS (BTA_AV_WAIT_ROLE_SW_RES_OPEN|BTA_AV_WAIT_ROLE_SW_RES_START|BTA_AV_WAIT_ROLE_SW_STARTED|BTA_AV_WAIT_ROLE_SW_RETRY)
/* Bitmap for collision, coll_mask */
#define BTA_AV_COLL_INC_TMR 0x01 /* Timer is running for incoming L2C connection */
#define BTA_AV_COLL_API_CALLED 0x02 /* API open was called while incoming timer is running */
/* type for AV stream control block */
typedef struct {
const tBTA_AV_ACT *p_act_tbl; /* the action table for stream state machine */
const tBTA_AV_CO_FUNCTS *p_cos; /* the associated callout functions */
tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
tBTA_AV_SEP seps[BTA_AV_MAX_SEPS];
tAVDT_CFG *p_cap; /* buffer used for get capabilities */
list_t *a2d_list; /* used for audio channels only */
tBTA_AV_Q_INFO q_info;
tAVDT_SEP_INFO sep_info[BTA_AV_NUM_SEPS]; /* stream discovery results */
tAVDT_CFG cfg; /* local SEP configuration */
TIMER_LIST_ENT timer; /* delay timer for AVRC CT */
BD_ADDR peer_addr; /* peer BD address */
UINT16 l2c_cid; /* L2CAP channel ID */
UINT16 stream_mtu; /* MTU of stream */
UINT16 avdt_version; /* the avdt version of peer device */
tBTA_SEC sec_mask; /* security mask */
tBTA_AV_CODEC codec_type; /* codec type */
UINT8 media_type; /* Media type */
BOOLEAN cong; /* TRUE if AVDTP congested */
tBTA_AV_STATUS open_status; /* open failure status */
tBTA_AV_CHNL chnl; /* the channel: audio/video */
tBTA_AV_HNDL hndl; /* the handle: ((hdi + 1)|chnl) */
UINT16 cur_psc_mask; /* Protocol service capabilities mask for current connection */
UINT8 avdt_handle; /* AVDTP handle */
UINT8 hdi; /* the index to SCB[] */
UINT8 num_seps; /* number of seps returned by stream discovery */
UINT8 num_disc_snks; /* number of discovered snks */
UINT8 num_disc_srcs; /* number of discovered srcs */
UINT8 sep_info_idx; /* current index into sep_info */
UINT8 sep_idx; /* current index into local seps[] */
UINT8 rcfg_idx; /* reconfig requested index into sep_info */
UINT8 state; /* state machine state */
UINT8 avdt_label; /* AVDTP label */
UINT8 app_id; /* application id */
UINT8 num_recfg; /* number of reconfigure sent */
UINT8 role;
UINT8 l2c_bufs; /* the number of buffers queued to L2CAP */
UINT8 rc_handle; /* connected AVRCP handle */
BOOLEAN use_rc; /* TRUE if AVRCP is allowed */
BOOLEAN started; /* TRUE if stream started */
UINT8 co_started; /* non-zero, if stream started from call-out perspective */
BOOLEAN recfg_sup; /* TRUE if the first attempt to reconfigure the stream was successfull, else False if command fails */
BOOLEAN suspend_sup; /* TRUE if Suspend stream is supported, else FALSE if suspend command fails */
BOOLEAN deregistring; /* TRUE if deregistering */
BOOLEAN sco_suspend; /* TRUE if SUSPEND is issued automatically for SCO */
UINT8 coll_mask; /* Mask to check incoming and outgoing collision */
tBTA_AV_API_OPEN open_api; /* Saved OPEN api message */
UINT8 wait; /* set 0x1, when getting Caps as ACP, set 0x2, when started */
UINT8 q_tag; /* identify the associated q_info union member */
BOOLEAN no_rtp_hdr; /* TRUE if add no RTP header*/
UINT8 disc_rsn; /* disconenction reason */
UINT16 uuid_int; /*intended UUID of Initiator to connect to */
} tBTA_AV_SCB;
#define BTA_AV_RC_ROLE_MASK 0x10
#define BTA_AV_RC_ROLE_INT 0x00
#define BTA_AV_RC_ROLE_ACP 0x10
#define BTA_AV_RC_CONN_MASK 0x20
/* type for AV RCP control block */
/* index to this control block is the rc handle */
typedef struct {
UINT8 status;
UINT8 handle;
UINT8 shdl; /* stream handle (hdi + 1) */
UINT8 lidx; /* (index+1) to LCB */
tBTA_AV_FEAT peer_features; /* peer features mask */
} tBTA_AV_RCB;
#define BTA_AV_NUM_RCB (BTA_AV_NUM_STRS + 2)
enum {
BTA_AV_LCB_FREE,
BTA_AV_LCB_FIND
};
/* type for AV ACL Link control block */
typedef struct {
BD_ADDR addr; /* peer BD address */
UINT8 conn_msk; /* handle mask of connected stream handle */
UINT8 lidx; /* index + 1 */
} tBTA_AV_LCB;
/* type for stream state machine action functions */
typedef void (*tBTA_AV_SACT)(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
/* type for AV control block */
typedef struct {
tBTA_AV_SCB *p_scb[BTA_AV_NUM_STRS]; /* stream control block */
tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
tBTA_AV_CBACK *p_cback; /* application callback function */
tBTA_AV_RCB rcb[BTA_AV_NUM_RCB]; /* RCB control block */
tBTA_AV_LCB lcb[BTA_AV_NUM_LINKS + 1]; /* link control block */
TIMER_LIST_ENT sig_tmr; /* link timer */
TIMER_LIST_ENT acp_sig_tmr; /* timer to monitor signalling when accepting */
UINT32 sdp_a2d_handle; /* SDP record handle for audio src */
#if (BTA_AV_SINK_INCLUDED == TRUE)
UINT32 sdp_a2d_snk_handle; /* SDP record handle for audio snk */
#endif
UINT32 sdp_vdp_handle; /* SDP record handle for video src */
tBTA_AV_FEAT features; /* features mask */
tBTA_SEC sec_mask; /* security mask */
tBTA_AV_HNDL handle; /* the handle for SDP activity */
BOOLEAN disabling; /* TRUE if api disabled called */
UINT8 disc; /* (hdi+1) or (rc_handle|BTA_AV_CHNL_MSK) if p_disc_db is in use */
UINT8 state; /* state machine state */
UINT8 conn_rc; /* handle mask of connected RCP channels */
UINT8 conn_audio; /* handle mask of connected audio channels */
UINT8 conn_video; /* handle mask of connected video channels */
UINT8 conn_lcb; /* index mask of used LCBs */
UINT8 audio_open_cnt; /* number of connected audio channels */
UINT8 reg_audio; /* handle mask of registered audio channels */
UINT8 reg_video; /* handle mask of registered video channels */
UINT8 rc_acp_handle;
UINT8 rc_acp_idx; /* (index + 1) to RCB */
UINT8 rs_idx; /* (index + 1) to SCB for the one waiting for RS on open */
BOOLEAN sco_occupied; /* TRUE if SCO is being used or call is in progress */
UINT8 audio_streams; /* handle mask of streaming audio channels */
UINT8 video_streams; /* handle mask of streaming video channels */
} tBTA_AV_CB;
/*****************************************************************************
** Global data
*****************************************************************************/
/* control block declaration */
#if BTA_DYNAMIC_MEMORY == FALSE
extern tBTA_AV_CB bta_av_cb;
#else
extern tBTA_AV_CB *bta_av_cb_ptr;
#define bta_av_cb (*bta_av_cb_ptr)
#endif
/* config struct */
extern tBTA_AV_CFG *p_bta_av_cfg;
/* rc id config struct */
extern UINT16 *p_bta_av_rc_id;
extern UINT16 *p_bta_av_rc_id_ac;
extern const tBTA_AV_SACT bta_av_a2d_action[];
// extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos;
extern const tBTA_AV_SACT bta_av_vdp_action[];
extern tAVDT_CTRL_CBACK *const bta_av_dt_cback[];
extern void bta_av_stream_data_cback(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp, UINT8 m_pt);
/*****************************************************************************
** Function prototypes
*****************************************************************************/
/* utility functions */
extern tBTA_AV_SCB *bta_av_hndl_to_scb(UINT16 handle);
extern BOOLEAN bta_av_chk_start(tBTA_AV_SCB *p_scb);
extern void bta_av_restore_switch (void);
extern UINT16 bta_av_chk_mtu(tBTA_AV_SCB *p_scb, UINT16 mtu);
extern void bta_av_conn_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p_data);
extern UINT8 bta_av_rc_create(tBTA_AV_CB *p_cb, UINT8 role, UINT8 shdl, UINT8 lidx);
extern void bta_av_stream_chg(tBTA_AV_SCB *p_scb, BOOLEAN started);
extern BOOLEAN bta_av_is_scb_opening (tBTA_AV_SCB *p_scb);
extern BOOLEAN bta_av_is_scb_incoming (tBTA_AV_SCB *p_scb);
extern void bta_av_set_scb_sst_init (tBTA_AV_SCB *p_scb);
extern BOOLEAN bta_av_is_scb_init (tBTA_AV_SCB *p_scb);
extern void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb);
extern tBTA_AV_LCB *bta_av_find_lcb(BD_ADDR addr, UINT8 op);
/* main functions */
extern void bta_av_api_deregister(tBTA_AV_DATA *p_data);
extern void bta_av_dup_audio_buf(tBTA_AV_SCB *p_scb, BT_HDR *p_buf);
extern void bta_av_sm_execute(tBTA_AV_CB *p_cb, UINT16 event, tBTA_AV_DATA *p_data);
extern void bta_av_ssm_execute(tBTA_AV_SCB *p_scb, UINT16 event, tBTA_AV_DATA *p_data);
extern BOOLEAN bta_av_hdl_event(BT_HDR *p_msg);
#if (defined(BTA_AV_DEBUG) && BTA_AV_DEBUG == TRUE)
extern char *bta_av_evt_code(UINT16 evt_code);
#endif
extern BOOLEAN bta_av_switch_if_needed(tBTA_AV_SCB *p_scb);
extern BOOLEAN bta_av_link_role_ok(tBTA_AV_SCB *p_scb, UINT8 bits);
extern BOOLEAN bta_av_is_rcfg_sst(tBTA_AV_SCB *p_scb);
/* nsm action functions */
extern void bta_av_api_disconnect(tBTA_AV_DATA *p_data);
extern void bta_av_sig_chg(tBTA_AV_DATA *p_data);
extern void bta_av_sig_timer(tBTA_AV_DATA *p_data);
extern void bta_av_rc_disc_done(tBTA_AV_DATA *p_data);
extern void bta_av_rc_closed(tBTA_AV_DATA *p_data);
extern void bta_av_rc_disc(UINT8 disc);
extern void bta_av_conn_chg(tBTA_AV_DATA *p_data);
extern void bta_av_dereg_comp(tBTA_AV_DATA *p_data);
/* sm action functions */
extern void bta_av_disable (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_opened (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_remote_cmd (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_vendor_cmd (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_vendor_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_msg (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_close (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_meta_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_free_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern void bta_av_rc_free_msg (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
extern tBTA_AV_RCB *bta_av_get_rcb_by_shdl(UINT8 shdl);
extern void bta_av_del_rc(tBTA_AV_RCB *p_rcb);
/* ssm action functions */
extern void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_cleanup (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_free_sdb (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_config_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_disconnect_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_security_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_security_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_str_opened (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_security_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_security_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_do_close (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_connect_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_sdp_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_disc_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_disc_res_as_acp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_open_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_setconfig_rej (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_discover_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_conn_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_do_start (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_str_stopped (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_reconfig (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_start_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_start_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_str_closed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_clr_cong (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_suspend_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rcfg_str_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rcfg_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rcfg_connect (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rcfg_discntd (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_suspend_cont (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rcfg_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rcfg_open (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_security_rej (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_open_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_chk_2nd_start (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_save_caps (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rej_conn (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_rej_conn (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_set_use_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_cco_close (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_switch_role (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_role_res (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_delay_co (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_open_at_inc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
/* ssm action functions - vdp specific */
extern void bta_av_do_disc_vdp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_vdp_str_opened (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
extern void bta_av_reg_vdp (tAVDT_CS *p_cs, char *p_service_name, void *p_data);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_INT_H */

File diff suppressed because it is too large Load Diff

View File

@ -181,13 +181,15 @@ typedef UINT8 tBTA_GATT_STATUS;
#define BTA_GATTC_ADV_VSC_EVT 34 /* ADV VSC event */
#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_READ_MULTIPLE_EVT 37 /* GATTC Read mutiple event */
#define BTA_GATTC_QUEUE_FULL_EVT 38 /* GATTC queue full event */
typedef UINT8 tBTA_GATTC_EVT;
typedef tGATT_IF tBTA_GATTC_IF;
typedef UINT8 tBTA_ADDR_TYPE;
typedef struct {
UINT16 unit; /* as UUIUD defined by SIG */
UINT16 descr; /* as UUID as defined by SIG */
@ -387,27 +389,30 @@ typedef struct {
BD_ADDR remote_bda;
} tBTA_GATTC_DISCONNECT;
typedef struct {
UINT16 conn_id;
BD_ADDR remote_bda;
} tBTA_GATTC_SERVICE_CHANGE;
typedef union {
tBTA_GATT_STATUS status;
tBTA_GATTC_SEARCH_CMPL search_cmpl; /* discovery complete */
tBTA_GATTC_SRVC_RES srvc_res; /* discovery result */
tBTA_GATTC_REG reg_oper; /* registration data */
tBTA_GATTC_SEARCH_CMPL search_cmpl; /* discovery complete */
tBTA_GATTC_SRVC_RES srvc_res; /* discovery result */
tBTA_GATTC_REG reg_oper; /* registration data */
tBTA_GATTC_OPEN open;
tBTA_GATTC_CONNECT connect;
tBTA_GATTC_CLOSE close;
tBTA_GATTC_DISCONNECT disconnect;
tBTA_GATTC_READ read; /* read attribute/descriptor data */
tBTA_GATTC_WRITE write; /* write complete data */
tBTA_GATTC_EXEC_CMPL exec_cmpl; /* execute complete */
tBTA_GATTC_NOTIFY notify; /* notification/indication event data */
tBTA_GATTC_READ read; /* read attribute/descriptor data */
tBTA_GATTC_WRITE write; /* write complete data */
tBTA_GATTC_EXEC_CMPL exec_cmpl; /* execute complete */
tBTA_GATTC_NOTIFY notify; /* notification/indication event data */
tBTA_GATTC_ENC_CMPL_CB enc_cmpl;
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_SERVICE_CHANGE srvc_chg; /* service change event */
} tBTA_GATTC;
/* GATTC enable callback function */
@ -737,13 +742,14 @@ extern void BTA_GATTC_AppDeregister (tBTA_GATTC_IF client_if);
**
** Parameters client_if: server interface.
** remote_bda: remote device BD address.
** remote_addr_type: remote device BD address type.
** is_direct: direct connection or background auto connection
**
** Returns void
**
*******************************************************************************/
extern void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda,
BOOLEAN is_direct, tBTA_GATT_TRANSPORT transport);
extern void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_TYPE remote_addr_type,
BOOLEAN is_direct, tBTA_GATT_TRANSPORT transport);
/*******************************************************************************
**

View File

@ -30,6 +30,7 @@
#include "bta_gattc_ci.h"
#include "bta_gattc_co.h"
#include "fixed_queue.h"
#include "mutex.h"
/*****************************************************************************
** Constants and data types
@ -115,6 +116,7 @@ typedef tBTA_GATTC_INT_START_IF tBTA_GATTC_INT_DEREG;
typedef struct {
BT_HDR hdr;
BD_ADDR remote_bda;
tBTA_ADDR_TYPE remote_addr_type;
tBTA_GATTC_IF client_if;
BOOLEAN is_direct;
tBTA_TRANSPORT transport;
@ -191,6 +193,7 @@ typedef struct {
UINT8 role;
tBT_TRANSPORT transport;
tGATT_DISCONN_REASON reason;
BOOLEAN already_connect;
} tBTA_GATTC_INT_CONN;
typedef struct {
@ -324,7 +327,7 @@ typedef struct {
UINT16 reason;
} tBTA_GATTC_CLCB;
/* back ground connection tracking information */
/* background connection tracking information */
#if GATT_MAX_APPS <= 8
typedef UINT8 tBTA_GATTC_CIF_MASK ;
#elif GATT_MAX_APPS <= 16
@ -357,8 +360,8 @@ enum {
};
typedef struct {
UINT8 state;
UINT8 state;
osi_mutex_t write_ccc_mutex;
tBTA_GATTC_CONN conn_track[BTA_GATTC_CONN_MAX];
tBTA_GATTC_BG_TCK bg_track[BTA_GATTC_KNOWN_SR_MAX];
tBTA_GATTC_RCB cl_rcb[BTA_GATTC_CL_MAX];
@ -514,5 +517,6 @@ extern BOOLEAN bta_gattc_conn_dealloc(BD_ADDR remote_bda);
extern bool bta_gattc_cache_load(tBTA_GATTC_CLCB *p_clcb);
extern void bta_gattc_cache_reset(BD_ADDR server_bda);
extern void bta_gattc_deinit(void);
#endif /* BTA_GATTC_INT_H */

View File

@ -249,7 +249,7 @@ extern UINT8 bta_gatts_find_app_rcb_idx_by_app_if(tBTA_GATTS_CB *p_cb, tBTA_GATT
extern UINT8 bta_gatts_alloc_srvc_cb(tBTA_GATTS_CB *p_cb, UINT8 rcb_idx);
extern tBTA_GATTS_SRVC_CB *bta_gatts_find_srvc_cb_by_srvc_id(tBTA_GATTS_CB *p_cb, UINT16 service_id);
extern tBTA_GATTS_SRVC_CB *bta_gatts_find_srvc_cb_by_attr_id(tBTA_GATTS_CB *p_cb, UINT16 attr_id);
extern void bta_gatts_deinit(void);
#endif /* BTA_GATTS_INT_H */

View File

@ -0,0 +1,401 @@
/******************************************************************************
*
* Copyright (C) 2005-2012 Broadcom Corporation
*
* 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.
*
******************************************************************************/
/******************************************************************************
*
* This file contains BTA HID Host internal definitions
*
******************************************************************************/
#ifndef BTA_HH_INT_H
#define BTA_HH_INT_H
#include "bta_sys.h"
#include "utl.h"
#include "bta_hh_api.h"
//#if BTA_HH_LE_INCLUDED == TRUE
#include "bta_gatt_api.h"
//#endif
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
/* can be moved to bta_api.h */
#define BTA_HH_MAX_RPT_CHARS 8
#if (BTA_GATT_INCLUDED == FALSE || BLE_INCLUDED == FALSE)
#undef BTA_HH_LE_INCLUDED
#define BTA_HH_LE_INCLUDED FALSE
#endif
/* state machine events, these events are handled by the state machine */
enum {
BTA_HH_API_OPEN_EVT = BTA_SYS_EVT_START(BTA_ID_HH),
BTA_HH_API_CLOSE_EVT,
BTA_HH_INT_OPEN_EVT,
BTA_HH_INT_CLOSE_EVT,
BTA_HH_INT_DATA_EVT,
BTA_HH_INT_CTRL_DATA,
BTA_HH_INT_HANDSK_EVT,
BTA_HH_SDP_CMPL_EVT,
BTA_HH_API_WRITE_DEV_EVT,
BTA_HH_API_GET_DSCP_EVT,
BTA_HH_API_MAINT_DEV_EVT,
BTA_HH_OPEN_CMPL_EVT,
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
BTA_HH_GATT_CLOSE_EVT,
BTA_HH_GATT_OPEN_EVT,
BTA_HH_START_ENC_EVT,
BTA_HH_ENC_CMPL_EVT,
BTA_HH_GATT_READ_CHAR_CMPL_EVT,
BTA_HH_GATT_WRITE_CHAR_CMPL_EVT,
BTA_HH_GATT_READ_DESCR_CMPL_EVT,
BTA_HH_GATT_WRITE_DESCR_CMPL_EVT,
BTA_HH_API_SCPP_UPDATE_EVT,
BTA_HH_GATT_ENC_CMPL_EVT,
#endif
/* not handled by execute state machine */
BTA_HH_API_ENABLE_EVT,
BTA_HH_API_DISABLE_EVT,
BTA_HH_DISC_CMPL_EVT
};
typedef UINT16 tBTA_HH_INT_EVT; /* HID host internal events */
#define BTA_HH_INVALID_EVT (BTA_HH_DISC_CMPL_EVT + 1)
/* event used to map between BTE event and BTA event */
#define BTA_HH_FST_TRANS_CB_EVT BTA_HH_GET_RPT_EVT
#define BTA_HH_FST_BTE_TRANS_EVT HID_TRANS_GET_REPORT
/* sub event code used for device maintainence API call */
#define BTA_HH_ADD_DEV 0
#define BTA_HH_REMOVE_DEV 1
/* state machine states */
enum {
BTA_HH_NULL_ST,
BTA_HH_IDLE_ST,
BTA_HH_W4_CONN_ST,
BTA_HH_CONN_ST
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
, BTA_HH_W4_SEC
#endif
, BTA_HH_INVALID_ST /* Used to check invalid states before executing SM function */
};
typedef UINT8 tBTA_HH_STATE;
/* data structure used to send a command/data to HID device */
typedef struct {
BT_HDR hdr;
UINT8 t_type;
UINT8 param;
UINT8 rpt_id;
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
UINT8 srvc_id;
#endif
UINT16 data;
BT_HDR *p_data;
} tBTA_HH_CMD_DATA;
/* data type for BTA_HH_API_ENABLE_EVT */
typedef struct {
BT_HDR hdr;
UINT8 sec_mask;
UINT8 service_name[BTA_SERVICE_NAME_LEN + 1];
tBTA_HH_CBACK *p_cback;
} tBTA_HH_API_ENABLE;
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
UINT8 sec_mask;
tBTA_HH_PROTO_MODE mode;
} tBTA_HH_API_CONN;
/* internal event data from BTE HID callback */
typedef struct {
BT_HDR hdr;
BD_ADDR addr;
UINT32 data;
BT_HDR *p_data;
} tBTA_HH_CBACK_DATA;
typedef struct {
BT_HDR hdr;
BD_ADDR bda;
UINT16 attr_mask;
UINT16 sub_event;
UINT8 sub_class;
UINT8 app_id;
tBTA_HH_DEV_DSCP_INFO dscp_info;
} tBTA_HH_MAINT_DEV;
#if BTA_HH_LE_INCLUDED == TRUE
typedef struct {
BT_HDR hdr;
UINT16 conn_id;
tBTA_GATT_REASON reason; /* disconnect reason code, not useful when connect event is reported */
} tBTA_HH_LE_CLOSE;
typedef struct {
BT_HDR hdr;
UINT16 scan_int;
UINT16 scan_win;
} tBTA_HH_SCPP_UPDATE;
#endif
/* union of all event data types */
typedef union {
BT_HDR hdr;
tBTA_HH_API_ENABLE api_enable;
tBTA_HH_API_CONN api_conn;
tBTA_HH_CMD_DATA api_sndcmd;
tBTA_HH_CBACK_DATA hid_cback;
tBTA_HH_STATUS status;
tBTA_HH_MAINT_DEV api_maintdev;
#if BTA_HH_LE_INCLUDED == TRUE
tBTA_HH_LE_CLOSE le_close;
tBTA_GATTC_OPEN le_open;
tBTA_HH_SCPP_UPDATE le_scpp_update;
tBTA_GATTC_ENC_CMPL_CB le_enc_cmpl;
#endif
} tBTA_HH_DATA;
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
typedef struct {
UINT8 index;
BOOLEAN in_use;
UINT8 inst_id; /* share service instance ID and report instance ID, as
hi 4 for service instance ID, low 4 as charatceristic instance ID */
tBTA_HH_RPT_TYPE rpt_type;
UINT16 uuid;
UINT8 prop;
UINT8 rpt_id;
BOOLEAN client_cfg_exist;
UINT16 client_cfg_value;
} tBTA_HH_LE_RPT;
#ifndef BTA_HH_LE_RPT_MAX
#define BTA_HH_LE_RPT_MAX 20
#endif
typedef struct {
BOOLEAN in_use;
tBTA_HH_LE_RPT report[BTA_HH_LE_RPT_MAX];
#define BTA_HH_LE_PROTO_MODE_BIT 0x01
#define BTA_HH_LE_CP_BIT 0x02
UINT8 option_char; /* control point char exisit or not */
BOOLEAN expl_incl_srvc;
UINT8 incl_srvc_inst; /* assuming only one included service : battery service */
UINT8 cur_expl_char_idx; /* currently discovering service index */
UINT8 *rpt_map;
UINT16 ext_rpt_ref;
tBTA_HH_DEV_DESCR descriptor;
} tBTA_HH_LE_HID_SRVC;
#ifndef BTA_HH_LE_HID_SRVC_MAX
#define BTA_HH_LE_HID_SRVC_MAX 1
#endif
/* convert a HID handle to the LE CB index */
#define BTA_HH_GET_LE_CB_IDX(x) (((x) >> 4) - 1)
/* convert a GATT connection ID to HID device handle, it is the hi 4 bits of a UINT8 */
#define BTA_HH_GET_LE_DEV_HDL(x) (UINT8)(((x) + 1) << 4)
/* check to see if th edevice handle is a LE device handle */
#define BTA_HH_IS_LE_DEV_HDL(x) ((x) & 0xf0)
#define BTA_HH_IS_LE_DEV_HDL_VALID(x) (((x)>>4) <= BTA_HH_LE_MAX_KNOWN)
#endif
/* device control block */
typedef struct {
tBTA_HH_DEV_DSCP_INFO dscp_info; /* report descriptor and DI information */
BD_ADDR addr; /* BD-Addr of the HID device */
UINT16 attr_mask; /* attribute mask */
UINT16 w4_evt; /* W4_handshake event name */
UINT8 index; /* index number referenced to handle index */
UINT8 sub_class; /* Cod sub class */
UINT8 sec_mask; /* security mask */
UINT8 app_id; /* application ID for this connection */
UINT8 hid_handle; /* device handle : low 4 bits for regular HID: HID_HOST_MAX_DEVICES can not exceed 15;
high 4 bits for LE HID: GATT_MAX_PHY_CHANNEL can not exceed 15 */
BOOLEAN vp; /* virtually unplug flag */
BOOLEAN in_use; /* control block currently in use */
BOOLEAN incoming_conn; /* is incoming connection? */
UINT8 incoming_hid_handle; /* temporary handle for incoming connection? */
BOOLEAN opened; /* TRUE if device successfully opened HID connection */
tBTA_HH_PROTO_MODE mode; /* protocol mode */
tBTA_HH_STATE state; /* CB state */
#if (BTA_HH_LE_INCLUDED == TRUE)
#define BTA_HH_LE_DISC_NONE 0x00
#define BTA_HH_LE_DISC_HIDS 0x01
#define BTA_HH_LE_DISC_DIS 0x02
#define BTA_HH_LE_DISC_SCPS 0x04
UINT8 disc_active;
tBTA_HH_STATUS status;
tBTA_GATT_REASON reason;
BOOLEAN is_le_device;
tBTA_HH_LE_HID_SRVC hid_srvc[BTA_HH_LE_HID_SRVC_MAX];
UINT16 conn_id;
BOOLEAN in_bg_conn;
UINT8 total_srvc;
UINT8 clt_cfg_idx;
UINT8 cur_srvc_index; /* currently discovering service index */
BOOLEAN scps_supported;
#define BTA_HH_LE_SCPS_NOTIFY_NONE 0
#define BTA_HH_LE_SCPS_NOTIFY_SPT 0x01
#define BTA_HH_LE_SCPS_NOTIFY_ENB 0x02
UINT8 scps_notify; /* scan refresh supported/notification enabled */
#endif
BOOLEAN security_pending;
} tBTA_HH_DEV_CB;
/* key board parsing control block */
typedef struct {
BOOLEAN mod_key[4]; /* ctrl, shift(upper), Alt, GUI */
BOOLEAN num_lock;
BOOLEAN caps_lock;
UINT8 last_report[BTA_HH_MAX_RPT_CHARS];
} tBTA_HH_KB_CB;
/******************************************************************************
** Main Control Block
*******************************************************************************/
typedef struct {
tBTA_HH_KB_CB kb_cb; /* key board control block,
suppose BTA will connect
to only one keyboard at
the same time */
tBTA_HH_DEV_CB kdev[BTA_HH_MAX_DEVICE]; /* device control block */
tBTA_HH_DEV_CB *p_cur; /* current device control
block idx, used in sdp */
UINT8 cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index
map to dev handle */
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
UINT8 le_cb_index[BTA_HH_MAX_DEVICE]; /* maintain a CB index map to LE dev handle */
tBTA_GATTC_IF gatt_if;
#endif
tBTA_HH_CBACK *p_cback; /* Application callbacks */
tSDP_DISCOVERY_DB *p_disc_db;
UINT8 trace_level; /* tracing level */
UINT8 cnt_num; /* connected device number */
BOOLEAN w4_disable; /* w4 disable flag */
}
tBTA_HH_CB;
#if BTA_DYNAMIC_MEMORY == FALSE
extern tBTA_HH_CB bta_hh_cb;
#else
extern tBTA_HH_CB *bta_hh_cb_ptr;
#define bta_hh_cb (*bta_hh_cb_ptr)
#endif
/* from bta_hh_cfg.c */
extern tBTA_HH_CFG *p_bta_hh_cfg;
/*****************************************************************************
** Function prototypes
*****************************************************************************/
extern BOOLEAN bta_hh_hdl_event(BT_HDR *p_msg);
extern void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event,
tBTA_HH_DATA *p_data);
/* action functions */
extern void bta_hh_api_disc_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_close_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_data_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_get_dscp_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_open_failure(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
/* utility functions */
extern UINT8 bta_hh_find_cb(BD_ADDR bda);
extern void bta_hh_parse_keybd_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
UINT8 *p_report, UINT16 report_len);
extern void bta_hh_parse_mice_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
UINT8 *p_report, UINT16 report_len);
extern BOOLEAN bta_hh_tod_spt(tBTA_HH_DEV_CB *p_cb, UINT8 sub_class);
extern void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB *p_cb);
extern void bta_hh_add_device_to_list(tBTA_HH_DEV_CB *p_cb, UINT8 handle,
UINT16 attr_mask,
tHID_DEV_DSCP_INFO *p_dscp_info,
UINT8 sub_class, UINT16 max_latency, UINT16 min_tout, UINT8 app_id);
extern void bta_hh_update_di_info(tBTA_HH_DEV_CB *p_cb, UINT16 vendor_id, UINT16 product_id,
UINT16 version, UINT8 flag);
extern void bta_hh_cleanup_disable(tBTA_HH_STATUS status);
extern UINT8 bta_hh_dev_handle_to_cb_idx(UINT8 dev_handle);
/* action functions used outside state machine */
extern void bta_hh_api_enable(tBTA_HH_DATA *p_data);
extern void bta_hh_api_disable(void);
extern void bta_hh_disc_cmpl(void);
extern tBTA_HH_STATUS bta_hh_read_ssr_param(BD_ADDR bd_addr, UINT16 *p_max_ssr_lat, UINT16 *p_min_ssr_tout);
/* functions for LE HID */
extern void bta_hh_le_enable(void);
extern BOOLEAN bta_hh_le_is_hh_gatt_if(tBTA_GATTC_IF client_if);
extern void bta_hh_le_deregister(void);
extern BOOLEAN bta_hh_is_le_device(tBTA_HH_DEV_CB *p_cb, BD_ADDR remote_bda);
extern void bta_hh_le_open_conn(tBTA_HH_DEV_CB *p_cb, BD_ADDR remote_bda);
extern void bta_hh_le_api_disc_act(tBTA_HH_DEV_CB *p_cb);
extern void bta_hh_le_get_dscp_act(tBTA_HH_DEV_CB *p_cb);
extern void bta_hh_le_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern UINT8 bta_hh_le_add_device(tBTA_HH_DEV_CB *p_cb, tBTA_HH_MAINT_DEV *p_dev_info);
extern void bta_hh_le_remove_dev_bg_conn(tBTA_HH_DEV_CB *p_cb);
extern void bta_hh_le_open_fail(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_gatt_open(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_gatt_close(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_start_security(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_start_srvc_discovery(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_w4_le_read_char_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_read_char_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_w4_le_read_descr_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_read_descr_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_w4_le_write_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_write_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_write_char_descr_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_start_security(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_security_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_update_scpp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_notify_enc_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_ci_load_rpt (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
#if BTA_HH_DEBUG
extern void bta_hh_trace_dev_db(void);
#endif
#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#endif

View File

@ -0,0 +1,429 @@
/******************************************************************************
*
* Copyright (C) 2006-2012 Broadcom Corporation
*
* 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.
*
******************************************************************************/
/******************************************************************************
*
* This is the private interface file for the BTA Java I/F
*
******************************************************************************/
#ifndef BTA_JV_INT_H
#define BTA_JV_INT_H
#include "bta_sys.h"
#include "bta_api.h"
#include "bta_jv_api.h"
#include "rfcdefs.h"
#include "port_api.h"
#include "sdp_api.h"
#include "bt_target.h"
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
enum {
/* these events are handled by the state machine */
BTA_JV_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_JV),
BTA_JV_API_DISABLE_EVT,
BTA_JV_API_GET_CHANNEL_EVT,
BTA_JV_API_FREE_SCN_EVT,
BTA_JV_API_START_DISCOVERY_EVT,
BTA_JV_API_CREATE_RECORD_EVT,
BTA_JV_API_DELETE_RECORD_EVT,
BTA_JV_API_L2CAP_CONNECT_EVT,
BTA_JV_API_L2CAP_CLOSE_EVT,
BTA_JV_API_L2CAP_START_SERVER_EVT,
BTA_JV_API_L2CAP_STOP_SERVER_EVT,
BTA_JV_API_L2CAP_READ_EVT,
BTA_JV_API_L2CAP_WRITE_EVT,
BTA_JV_API_RFCOMM_CONNECT_EVT,
BTA_JV_API_RFCOMM_CLOSE_EVT,
BTA_JV_API_RFCOMM_START_SERVER_EVT,
BTA_JV_API_RFCOMM_STOP_SERVER_EVT,
BTA_JV_API_RFCOMM_READ_EVT,
BTA_JV_API_RFCOMM_WRITE_EVT,
BTA_JV_API_SET_PM_PROFILE_EVT,
BTA_JV_API_PM_STATE_CHANGE_EVT,
BTA_JV_API_L2CAP_CONNECT_LE_EVT,
BTA_JV_API_L2CAP_START_SERVER_LE_EVT,
BTA_JV_API_L2CAP_STOP_SERVER_LE_EVT,
BTA_JV_API_L2CAP_WRITE_FIXED_EVT,
BTA_JV_API_L2CAP_CLOSE_FIXED_EVT,
BTA_JV_MAX_INT_EVT
};
#ifndef BTA_JV_RFC_EV_MASK
#define BTA_JV_RFC_EV_MASK (PORT_EV_RXCHAR | PORT_EV_TXEMPTY | PORT_EV_FC | PORT_EV_FCS)
#endif
/* data type for BTA_JV_API_ENABLE_EVT */
typedef struct {
BT_HDR hdr;
tBTA_JV_DM_CBACK *p_cback;
} tBTA_JV_API_ENABLE;
/* data type for BTA_JV_API_START_DISCOVERY_EVT */
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
UINT16 num_uuid;
tSDP_UUID uuid_list[BTA_JV_MAX_UUIDS];
UINT16 num_attr;
UINT16 attr_list[BTA_JV_MAX_ATTRS];
void *user_data; /* piggyback caller's private data*/
} tBTA_JV_API_START_DISCOVERY;
enum {
BTA_JV_PM_FREE_ST = 0, /* empty PM slot */
BTA_JV_PM_IDLE_ST,
BTA_JV_PM_BUSY_ST
};
/* BTA JV PM control block */
typedef struct {
UINT32 handle; /* The connection handle */
UINT8 state; /* state: see above enum */
tBTA_JV_PM_ID app_id; /* JV app specific id indicating power table to use */
BD_ADDR peer_bd_addr; /* Peer BD address */
} tBTA_JV_PM_CB;
enum {
BTA_JV_ST_NONE = 0,
BTA_JV_ST_CL_OPENING,
BTA_JV_ST_CL_OPEN,
BTA_JV_ST_CL_CLOSING,
BTA_JV_ST_SR_LISTEN,
BTA_JV_ST_SR_OPEN,
BTA_JV_ST_SR_CLOSING
} ;
typedef UINT8 tBTA_JV_STATE;
#define BTA_JV_ST_CL_MAX BTA_JV_ST_CL_CLOSING
/* JV L2CAP control block */
typedef struct {
tBTA_JV_L2CAP_CBACK *p_cback; /* the callback function */
UINT16 psm; /* the psm used for this server connection */
tBTA_JV_STATE state; /* the state of this control block */
tBTA_SERVICE_ID sec_id; /* service id */
UINT32 handle; /* the handle reported to java app (same as gap handle) */
BOOLEAN cong; /* TRUE, if congested */
tBTA_JV_PM_CB *p_pm_cb; /* ptr to pm control block, NULL: unused */
void *user_data; /* user data for callback from higher layers */
} tBTA_JV_L2C_CB;
#define BTA_JV_RFC_HDL_MASK 0xFF
#define BTA_JV_RFCOMM_MASK 0x80
#define BTA_JV_ALL_APP_ID 0xFF
#define BTA_JV_RFC_HDL_TO_SIDX(r) (((r)&0xFF00) >> 8)
#define BTA_JV_RFC_H_S_TO_HDL(h, s) ((h)|(s<<8))
/* port control block */
typedef struct {
UINT32 handle; /* the rfcomm session handle at jv */
UINT16 port_handle;/* port handle */
tBTA_JV_STATE state; /* the state of this control block */
UINT8 max_sess; /* max sessions */
void *user_data; /* piggyback caller's private data*/
BOOLEAN cong; /* TRUE, if congested */
tBTA_JV_PM_CB *p_pm_cb; /* ptr to pm control block, NULL: unused */
} tBTA_JV_PCB;
/* JV RFCOMM control block */
typedef struct {
tBTA_JV_RFCOMM_CBACK *p_cback; /* the callback function */
UINT16 rfc_hdl[BTA_JV_MAX_RFC_SR_SESSION];
tBTA_SERVICE_ID sec_id; /* service id */
UINT8 handle; /* index: the handle reported to java app */
UINT8 scn; /* the scn of the server */
UINT8 max_sess; /* max sessions */
int curr_sess; /* current sessions count*/
} tBTA_JV_RFC_CB;
/* data type for BTA_JV_API_L2CAP_CONNECT_EVT & BTA_JV_API_L2CAP_CONNECT_LE_EVT */
typedef struct {
BT_HDR hdr;
tBTA_SEC sec_mask;
tBTA_JV_ROLE role;
union {
UINT16 remote_psm;
UINT16 remote_chan;
};
UINT16 rx_mtu;
BD_ADDR peer_bd_addr;
INT32 has_cfg;
tL2CAP_CFG_INFO cfg;
INT32 has_ertm_info;
tL2CAP_ERTM_INFO ertm_info;
tBTA_JV_L2CAP_CBACK *p_cback;
void *user_data;
} tBTA_JV_API_L2CAP_CONNECT;
/* data type for BTA_JV_API_L2CAP_SERVER_EVT */
typedef struct {
BT_HDR hdr;
tBTA_SEC sec_mask;
tBTA_JV_ROLE role;
union {
UINT16 local_psm;
UINT16 local_chan;
};
UINT16 rx_mtu;
INT32 has_cfg;
tL2CAP_CFG_INFO cfg;
INT32 has_ertm_info;
tL2CAP_ERTM_INFO ertm_info;
tBTA_JV_L2CAP_CBACK *p_cback;
void *user_data;
} tBTA_JV_API_L2CAP_SERVER;
/* data type for BTA_JV_API_L2CAP_CLOSE_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
tBTA_JV_L2C_CB *p_cb;
} tBTA_JV_API_L2CAP_CLOSE;
/* data type for BTA_JV_API_L2CAP_READ_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
UINT32 req_id;
tBTA_JV_L2CAP_CBACK *p_cback;
UINT8 *p_data;
UINT16 len;
void *user_data;
} tBTA_JV_API_L2CAP_READ;
/* data type for BTA_JV_API_L2CAP_WRITE_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
UINT32 req_id;
tBTA_JV_L2C_CB *p_cb;
UINT8 *p_data;
UINT16 len;
void *user_data;
} tBTA_JV_API_L2CAP_WRITE;
/* data type for BTA_JV_API_L2CAP_WRITE_FIXED_EVT */
typedef struct {
BT_HDR hdr;
UINT16 channel;
BD_ADDR addr;
UINT32 req_id;
tBTA_JV_L2CAP_CBACK *p_cback;
UINT8 *p_data;
UINT16 len;
void *user_data;
} tBTA_JV_API_L2CAP_WRITE_FIXED;
/* data type for BTA_JV_API_RFCOMM_CONNECT_EVT */
typedef struct {
BT_HDR hdr;
tBTA_SEC sec_mask;
tBTA_JV_ROLE role;
UINT8 remote_scn;
BD_ADDR peer_bd_addr;
tBTA_JV_RFCOMM_CBACK *p_cback;
void *user_data;
} tBTA_JV_API_RFCOMM_CONNECT;
/* data type for BTA_JV_API_RFCOMM_SERVER_EVT */
typedef struct {
BT_HDR hdr;
tBTA_SEC sec_mask;
tBTA_JV_ROLE role;
UINT8 local_scn;
UINT8 max_session;
UINT32 handle;
tBTA_JV_RFCOMM_CBACK *p_cback;
void *user_data;
} tBTA_JV_API_RFCOMM_SERVER;
/* data type for BTA_JV_API_RFCOMM_READ_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
UINT32 req_id;
UINT8 *p_data;
UINT16 len;
tBTA_JV_RFC_CB *p_cb;
tBTA_JV_PCB *p_pcb;
} tBTA_JV_API_RFCOMM_READ;
/* data type for BTA_JV_API_SET_PM_PROFILE_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
tBTA_JV_PM_ID app_id;
tBTA_JV_CONN_STATE init_st;
} tBTA_JV_API_SET_PM_PROFILE;
/* data type for BTA_JV_API_PM_STATE_CHANGE_EVT */
typedef struct {
BT_HDR hdr;
tBTA_JV_PM_CB *p_cb;
tBTA_JV_CONN_STATE state;
} tBTA_JV_API_PM_STATE_CHANGE;
/* data type for BTA_JV_API_RFCOMM_WRITE_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
UINT32 req_id;
UINT8 *p_data;
int len;
tBTA_JV_RFC_CB *p_cb;
tBTA_JV_PCB *p_pcb;
} tBTA_JV_API_RFCOMM_WRITE;
/* data type for BTA_JV_API_RFCOMM_CLOSE_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
tBTA_JV_RFC_CB *p_cb;
tBTA_JV_PCB *p_pcb;
void *user_data;
} tBTA_JV_API_RFCOMM_CLOSE;
/* data type for BTA_JV_API_CREATE_RECORD_EVT */
typedef struct {
BT_HDR hdr;
#define ESP_SDP_SERVER_NAME_MAX (32)
char name[ESP_SDP_SERVER_NAME_MAX + 1];
INT32 channel;
void *user_data;
} tBTA_JV_API_CREATE_RECORD;
/* data type for BTA_JV_API_ADD_ATTRIBUTE_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
UINT16 attr_id;
UINT8 *p_value;
INT32 value_size;
} tBTA_JV_API_ADD_ATTRIBUTE;
/* data type for BTA_JV_API_FREE_SCN_EVT */
typedef struct {
BT_HDR hdr;
INT32 type; /* One of BTA_JV_CONN_TYPE_ */
UINT16 scn;
} tBTA_JV_API_FREE_CHANNEL;
/* data type for BTA_JV_API_ALLOC_CHANNEL_EVT */
typedef struct {
BT_HDR hdr;
INT32 type; /* One of BTA_JV_CONN_TYPE_ */
INT32 channel; /* optionally request a specific channel */
void *user_data;
} tBTA_JV_API_ALLOC_CHANNEL;
/* union of all data types */
typedef union {
/* GKI event buffer header */
BT_HDR hdr;
tBTA_JV_API_ENABLE enable;
tBTA_JV_API_START_DISCOVERY start_discovery;
tBTA_JV_API_ALLOC_CHANNEL alloc_channel;
tBTA_JV_API_FREE_CHANNEL free_channel;
tBTA_JV_API_CREATE_RECORD create_record;
tBTA_JV_API_ADD_ATTRIBUTE add_attr;
tBTA_JV_API_L2CAP_CONNECT l2cap_connect;
tBTA_JV_API_L2CAP_READ l2cap_read;
tBTA_JV_API_L2CAP_WRITE l2cap_write;
tBTA_JV_API_L2CAP_CLOSE l2cap_close;
tBTA_JV_API_L2CAP_SERVER l2cap_server;
tBTA_JV_API_RFCOMM_CONNECT rfcomm_connect;
tBTA_JV_API_RFCOMM_READ rfcomm_read;
tBTA_JV_API_RFCOMM_WRITE rfcomm_write;
tBTA_JV_API_SET_PM_PROFILE set_pm;
tBTA_JV_API_PM_STATE_CHANGE change_pm_state;
tBTA_JV_API_RFCOMM_CLOSE rfcomm_close;
tBTA_JV_API_RFCOMM_SERVER rfcomm_server;
tBTA_JV_API_L2CAP_WRITE_FIXED l2cap_write_fixed;
} tBTA_JV_MSG;
/* JV control block */
typedef struct {
/* the SDP handle reported to JV user is the (index + 1) to sdp_handle[].
* if sdp_handle[i]==0, it's not used.
* otherwise sdp_handle[i] is the stack SDP handle. */
UINT32 sdp_handle[BTA_JV_MAX_SDP_REC]; /* SDP records created */
UINT8 *p_sel_raw_data;/* the raw data of last service select */
tBTA_JV_DM_CBACK *p_dm_cback;
tBTA_JV_L2C_CB l2c_cb[BTA_JV_MAX_L2C_CONN]; /* index is GAP handle (index) */
tBTA_JV_RFC_CB rfc_cb[BTA_JV_MAX_RFC_CONN];
tBTA_JV_PCB port_cb[MAX_RFC_PORTS]; /* index of this array is
the port_handle, */
UINT8 sec_id[BTA_JV_NUM_SERVICE_ID]; /* service ID */
BOOLEAN scn[BTA_JV_MAX_SCN]; /* SCN allocated by java */
UINT16 free_psm_list[BTA_JV_MAX_L2C_CONN]; /* PSMs freed by java
(can be reused) */
UINT8 sdp_active; /* see BTA_JV_SDP_ACT_* */
tSDP_UUID uuid; /* current uuid of sdp discovery*/
tBTA_JV_PM_CB pm_cb[BTA_JV_PM_MAX_NUM]; /* PM on a per JV handle bases */
} tBTA_JV_CB;
enum {
BTA_JV_SDP_ACT_NONE = 0,
BTA_JV_SDP_ACT_YES, /* waiting for SDP result */
BTA_JV_SDP_ACT_CANCEL /* waiting for cancel complete */
};
/* JV control block */
#if BTA_DYNAMIC_MEMORY == FALSE
extern tBTA_JV_CB bta_jv_cb;
#else
extern tBTA_JV_CB *bta_jv_cb_ptr;
#define bta_jv_cb (*bta_jv_cb_ptr)
#endif
/* config struct */
extern tBTA_JV_CFG *p_bta_jv_cfg;
extern BOOLEAN bta_jv_sm_execute(BT_HDR *p_msg);
extern void bta_jv_enable (tBTA_JV_MSG *p_data);
extern void bta_jv_disable (tBTA_JV_MSG *p_data);
extern void bta_jv_get_channel_id (tBTA_JV_MSG *p_data);
extern void bta_jv_free_scn (tBTA_JV_MSG *p_data);
extern void bta_jv_start_discovery (tBTA_JV_MSG *p_data);
extern void bta_jv_create_record (tBTA_JV_MSG *p_data);
extern void bta_jv_delete_record (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_connect (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_close (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_start_server (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_stop_server (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_read (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_write (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_connect (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_close (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_start_server (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_stop_server (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_read (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_write (tBTA_JV_MSG *p_data);
extern void bta_jv_set_pm_profile (tBTA_JV_MSG *p_data);
extern void bta_jv_change_pm_state(tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_connect_le (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_start_server_le (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_stop_server_le (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_write_fixed (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_close_fixed (tBTA_JV_MSG *p_data);
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
#endif /* BTA_JV_INT_H */

View File

@ -0,0 +1,112 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright (C) 2003-2012 Broadcom Corporation
*
* 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.
*
******************************************************************************/
/******************************************************************************
*
* This is the private interface file for the BTA SDP I/F
*
******************************************************************************/
#ifndef BTA_SDP_INT_H
#define BTA_SDP_INT_H
#include "bta_sys.h"
#include "bta_api.h"
#include "bta_sdp_api.h"
#if (SDP_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
enum {
/* these events are handled by the state machine */
BTA_SDP_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_SDP),
BTA_SDP_API_SEARCH_EVT,
BTA_SDP_API_CREATE_RECORD_USER_EVT,
BTA_SDP_API_REMOVE_RECORD_USER_EVT,
BTA_SDP_MAX_INT_EVT
};
enum {
BTA_SDP_ACTIVE_NONE = 0,
BTA_SDP_ACTIVE_YES /* waiting for SDP result */
};
/* data type for BTA_SDP_API_ENABLE_EVT */
typedef struct {
BT_HDR hdr;
tBTA_SDP_DM_CBACK *p_cback;
} tBTA_SDP_API_ENABLE;
/* data type for BTA_SDP_API_SEARCH_EVT */
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
tSDP_UUID uuid;
} tBTA_SDP_API_SEARCH;
/* data type for BTA_SDP_API_SEARCH_EVT */
typedef struct {
BT_HDR hdr;
void *user_data;
} tBTA_SDP_API_RECORD_USER;
/* union of all data types */
typedef union {
/* event buffer header */
BT_HDR hdr;
tBTA_SDP_API_ENABLE enable;
tBTA_SDP_API_SEARCH get_search;
tBTA_SDP_API_RECORD_USER record;
} tBTA_SDP_MSG;
/* SDP control block */
typedef struct {
UINT8 sdp_active; /* see BTA_SDP_SDP_ACT_* */
BD_ADDR remote_addr;
tBTA_SDP_DM_CBACK *p_dm_cback;
} tBTA_SDP_CB;
/* SDP control block */
#if BTA_DYNAMIC_MEMORY == FALSE
extern tBTA_SDP_CB bta_sdp_cb;
#else
extern tBTA_SDP_CB *bta_sdp_cb_ptr;
#define bta_sdp_cb (*bta_sdp_cb_ptr)
#endif
/* config struct */
extern tBTA_SDP_CFG *p_bta_sdp_cfg;
extern BOOLEAN bta_sdp_sm_execute(BT_HDR *p_msg);
extern void bta_sdp_enable (tBTA_SDP_MSG *p_data);
extern void bta_sdp_search (tBTA_SDP_MSG *p_data);
extern void bta_sdp_create_record(tBTA_SDP_MSG *p_data);
extern void bta_sdp_remove_record(tBTA_SDP_MSG *p_data);
#endif ///SDP_INCLUDED == TRUE
#endif /* BTA_SDP_INT_H */

View File

@ -224,6 +224,7 @@ extern UINT16 bta_sys_get_sys_features(void);
extern void bta_sys_sendmsg(void *p_msg);
extern void bta_sys_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout_ms);
extern void bta_sys_stop_timer(TIMER_LIST_ENT *p_tle);
extern void bta_sys_free_timer(TIMER_LIST_ENT *p_tle);
extern void bta_sys_disable(tBTA_SYS_HW_MODULE module);
extern UINT32 bta_sys_get_remaining_ticks(TIMER_LIST_ENT *p_target_tle);

View File

@ -24,6 +24,8 @@ typedef enum {
BTC_BLUFI_ACT_DEINIT,
BTC_BLUFI_ACT_SEND_CFG_REPORT,
BTC_BLUFI_ACT_SEND_WIFI_LIST,
BTC_BLUFI_ACT_SEND_ERR_INFO,
BTC_BLUFI_ACT_SEND_CUSTOM_DATA,
} btc_blufi_act_t;
typedef union {
@ -41,6 +43,19 @@ typedef union {
uint16_t apCount;
esp_blufi_ap_record_t *list;
} wifi_list;
/*
BTC_BLUFI_ACT_SEND_ERR_INFO
*/
struct blufi_error_infor {
esp_blufi_error_state_t state;
} blufi_err_infor;
/*
BTC_BLUFI_ACT_SEND_CUSTOM_DATA
*/
struct blufi_custom_data {
uint8_t *data;
uint32_t data_len;
} custom_data;
} btc_blufi_args_t;
void btc_blufi_cb_handler(btc_msg_t *msg);

View File

@ -160,5 +160,6 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg);
void btc_gap_ble_cb_deep_free(btc_msg_t *msg);
void btc_gap_ble_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_gap_callback_init(void);
void btc_gap_ble_deinit(void);
#endif /* __BTC_GAP_BLE_H__ */

View File

@ -0,0 +1,37 @@
// 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 __BTC_GATT_COMMON_H__
#define __BTC_GATT_COMMON_H__
#include "future.h"
#include "bt_types.h"
#include "bta_api.h"
#include "btc_main.h"
#include "btc_task.h"
typedef enum {
BTC_GATT_ACT_SET_LOCAL_MTU = 0,
} btc_gatt_com_act_t;
/* btc_ble_gattc_args_t */
typedef union {
//BTC_GATT_ACT_SET_LOCAL_MTU,
struct set_mtu_arg {
uint16_t mtu;
} set_mtu;
} btc_ble_gatt_com_args_t;
void btc_gatt_com_call_handler(btc_msg_t *msg);
#endif /* __BTC_GATT_COMMON_H__ */

View File

@ -54,6 +54,7 @@ typedef union {
struct open_arg {
esp_gatt_if_t gattc_if;
esp_bd_addr_t remote_bda;
esp_ble_addr_type_t remote_addr_type;
bool is_direct;
} open;
//BTC_GATTC_ACT_CLOSE,

View File

@ -26,7 +26,6 @@ typedef enum {
BTC_MAIN_ACT_DEINIT,
BTC_MAIN_ACT_ENABLE,
BTC_MAIN_ACT_DISABLE,
BTC_GATT_ACT_SET_LOCAL_MTU,
} btc_main_act_t;
typedef enum {
@ -61,13 +60,5 @@ bt_status_t btc_init_bluetooth(future_t *future);
void btc_deinit_bluetooth(future_t *future);
#endif
/* btc_ble_gattc_args_t */
typedef union {
//BTC_GATT_ACT_SET_LOCAL_MTU,
struct set_mtu_arg {
uint16_t mtu;
} set_mtu;
} btc_ble_main_args_t;
void btc_main_call_handler(btc_msg_t *msg);
#endif /* __BTC_BT_MAIN_H__ */

View File

@ -41,6 +41,7 @@ typedef enum {
#if (GATTC_INCLUDED == TRUE)
BTC_PID_GATTC,
#endif ///GATTC_INCLUDED == TRUE
BTC_PID_GATT_COMMON,
BTC_PID_GAP_BLE,
BTC_PID_BLE_HID,
BTC_PID_SPPLIKE,

View File

@ -72,6 +72,8 @@ enum {
BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED,/* 22 controller setting data length is unsupported*/
BTM_SET_PRIVACY_SUCCESS, /* 23 enable/disable local privacy success */
BTM_SET_PRIVACY_FAIL, /* 24 enable/disable local privacy failed*/
BTM_SET_STATIC_RAND_ADDR_FAIL, /* 25 Command failed */
BTM_INVALID_STATIC_RAND_ADDR, /* 26 invalid static rand addr */
};
typedef uint8_t tBTM_STATUS;
@ -182,6 +184,8 @@ typedef void (tBTM_UPDATE_CONN_PARAM_CBACK) (UINT8 status, BD_ADDR bd_addr, tBTM
typedef void (tBTM_SET_PKT_DATA_LENGTH_CBACK) (UINT8 status, tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS *data_length_params);
typedef void (tBTM_SET_RAND_ADDR_CBACK) (UINT8 status);
typedef void (tBTM_ADD_WHITELIST_CBACK) (UINT8 status, tBTM_WL_OPERATION wl_opration);
typedef void (tBTM_SET_LOCAL_PRIVACY_CBACK) (UINT8 status);

View File

@ -982,7 +982,7 @@ tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask,
tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len);
BOOLEAN BTM_BleSetRandAddress(BD_ADDR rand_addr);
tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr);
/*******************************************************************************
@ -1541,6 +1541,19 @@ void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK *p_vsc_cback);
//extern
UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length);
/*******************************************************************************
**
** Function BTM_BleGetCurrentAddress
**
** Description This function is called to get local used BLE address.
**
** Parameters: None.
**
** Returns success or fail
**
*******************************************************************************/
BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type);
/*******************************************************************************
**
** Function BTM__BLEReadDiscoverability

View File

@ -104,6 +104,7 @@ typedef UINT8 tBTM_BLE_SEC_REQ_ACT;
#define BTM_VSC_CHIP_CAPABILITY_M_VERSION 95
typedef enum {
BTM_BLE_IDLE,
BTM_BLE_SCANNING,
BTM_BLE_SCAN_PENDING,
BTM_BLE_STOP_SCAN,
@ -150,6 +151,7 @@ typedef struct {
tBTM_START_ADV_CMPL_CBACK *p_adv_cb;
tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cb;
tBLE_ADDR_TYPE adv_addr_type;
BOOLEAN adv_callback_twice;
UINT8 evt_type;
UINT8 adv_mode;
tBLE_BD_ADDR direct_bda;

View File

@ -486,6 +486,11 @@ typedef struct {
tBTM_LE_KEY_TYPE key_type; /* bit mask of valid key types in record */
tBTM_SEC_BLE_KEYS keys; /* LE device security info in slave rode */
#endif
#if (BLE_PRIVACY_SPT == TRUE)
tBLE_ADDR_TYPE current_addr_type; /* current adv addr type*/
BD_ADDR current_addr; /* current adv addr*/
bool current_addr_valid; /* current addr info is valid or not*/
#endif
} tBTM_SEC_BLE;

View File

@ -246,6 +246,7 @@ void btu_uipc_rx_cback(BT_HDR *p_msg);
#if defined(QUICK_TIMER_TICKS_PER_SEC) && (QUICK_TIMER_TICKS_PER_SEC > 0)
void btu_start_quick_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
void btu_stop_quick_timer (TIMER_LIST_ENT *p_tle);
void btu_free_quick_timer (TIMER_LIST_ENT *p_tle);
void btu_process_quick_timer_evt (void);
#endif

View File

@ -19,7 +19,40 @@
#define DYN_MEM_H
#include "sdkconfig.h"
#if CONFIG_CLASSIC_BT_ENABLED
#if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY
#define BTU_DYNAMIC_MEMORY TRUE
#define BTM_DYNAMIC_MEMORY TRUE
#define L2C_DYNAMIC_MEMORY TRUE
#define GATT_DYNAMIC_MEMORY TRUE
#define SMP_DYNAMIC_MEMORY TRUE
#define BTA_DYNAMIC_MEMORY TRUE
#define SDP_DYNAMIC_MEMORY TRUE
#define RFC_DYNAMIC_MEMORY TRUE
#define TCS_DYNAMIC_MEMORY TRUE
#define BNEP_DYNAMIC_MEMORY TRUE
#define AVDT_DYNAMIC_MEMORY TRUE
#define AVCT_DYNAMIC_MEMORY TRUE
#define MCA_DYNAMIC_MEMORY TRUE
#define A2D_DYNAMIC_MEMORY TRUE
#define VDP_DYNAMIC_MEMORY TRUE
#define AVRC_DYNAMIC_MEMORY TRUE
#define BIP_DYNAMIC_MEMORY TRUE
#define BPP_DYNAMIC_MEMORY TRUE
#define CTP_DYNAMIC_MEMORY TRUE
#define FTP_DYNAMIC_MEMORY TRUE
#define HCRP_DYNAMIC_MEMORY TRUE
#define HFP_DYNAMIC_MEMORY TRUE
#define HID_DYNAMIC_MEMORY TRUE
#define HSP2_DYNAMIC_MEMORY TRUE
#define ICP_DYNAMIC_MEMORY TRUE
#define OPP_DYNAMIC_MEMORY TRUE
#define PAN_DYNAMIC_MEMORY TRUE
#define SPP_DYNAMIC_MEMORY TRUE
#define SLIP_DYNAMIC_MEMORY TRUE
#define LLCP_DYNAMIC_MEMORY TRUE
#define BTC_SBC_DEC_DYNAMIC_MEMORY TRUE
#else /* #if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY */
#define SDP_DYNAMIC_MEMORY FALSE
#define RFC_DYNAMIC_MEMORY FALSE
@ -45,35 +78,9 @@
#define SPP_DYNAMIC_MEMORY FALSE
#define SLIP_DYNAMIC_MEMORY FALSE
#define LLCP_DYNAMIC_MEMORY FALSE
#define BTC_SBC_DEC_DYNAMIC_MEMORY FALSE
#else /* #if CONFIG_CLASSIC_BT_ENABLED */
#define SDP_DYNAMIC_MEMORY TRUE
#define RFC_DYNAMIC_MEMORY TRUE
#define TCS_DYNAMIC_MEMORY TRUE
#define BNEP_DYNAMIC_MEMORY TRUE
#define AVDT_DYNAMIC_MEMORY TRUE
#define AVCT_DYNAMIC_MEMORY TRUE
#define MCA_DYNAMIC_MEMORY TRUE
#define A2D_DYNAMIC_MEMORY TRUE
#define VDP_DYNAMIC_MEMORY TRUE
#define AVRC_DYNAMIC_MEMORY TRUE
#define BIP_DYNAMIC_MEMORY TRUE
#define BPP_DYNAMIC_MEMORY TRUE
#define CTP_DYNAMIC_MEMORY TRUE
#define FTP_DYNAMIC_MEMORY TRUE
#define HCRP_DYNAMIC_MEMORY TRUE
#define HFP_DYNAMIC_MEMORY TRUE
#define HID_DYNAMIC_MEMORY TRUE
#define HSP2_DYNAMIC_MEMORY TRUE
#define ICP_DYNAMIC_MEMORY TRUE
#define OPP_DYNAMIC_MEMORY TRUE
#define PAN_DYNAMIC_MEMORY TRUE
#define SPP_DYNAMIC_MEMORY TRUE
#define SLIP_DYNAMIC_MEMORY TRUE
#define LLCP_DYNAMIC_MEMORY TRUE
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
#endif /* #if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY */
/****************************************************************************
** Define memory usage for each CORE component (if not defined in bdroid_buildcfg.h)
** The default for each component is to use static memory allocations.

View File

@ -176,7 +176,8 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback);
/**
* @brief Register A2DP sink data output function; For now the output is PCM data stream decoded
* from SBC format. This function should be called only after esp_bluedroid_enable()
* completes successfully, used only by A2DP sink.
* completes successfully, used only by A2DP sink. The callback is invoked in the context
* of A2DP sink task whose stack size is configurable through menuconfig
*
* @param[in] callback: A2DP sink data callback function
*
@ -291,7 +292,8 @@ esp_err_t esp_a2d_source_deinit(void);
/**
* @brief Register A2DP source data input function; For now the input is PCM data stream.
* This function should be called only after esp_bluedroid_enable() completes
* successfully
* successfully. The callback is invoked in the context of A2DP source task whose
* stack size is configurable through menuconfig
*
* @param[in] callback: A2DP source data callback function
*

View File

@ -51,6 +51,8 @@ typedef enum {
ESP_BLUFI_EVENT_RECV_SERVER_PRIV_KEY, /*<! When Phone send Server Private key to ESP32, this event happen */
ESP_BLUFI_EVENT_RECV_SLAVE_DISCONNECT_BLE, /*<! When Phone send Disconnect key to ESP32, this event happen */
ESP_BLUFI_EVENT_GET_WIFI_LIST, /*<! When Phone send get wifi list command to ESP32, this event happen */
ESP_BLUFI_EVENT_REPORT_ERROR, /*<! When Blufi report error, this event happen */
ESP_BLUFI_EVENT_RECV_CUSTOM_DATA, /*<! When Phone send custom data to ESP32, this event happen */
} esp_blufi_cb_event_t;
/// BLUFI config status
@ -71,6 +73,18 @@ typedef enum {
ESP_BLUFI_DEINIT_FAILED,
} esp_blufi_deinit_state_t;
typedef enum {
ESP_BLUFI_SEQUENCE_ERROR = 0,
ESP_BLUFI_CHECKSUM_ERROR,
ESP_BLUFI_DECRYPT_ERROR,
ESP_BLUFI_ENCRYPT_ERROR,
ESP_BLUFI_INIT_SECURITY_ERROR,
ESP_BLUFI_DH_MALLOC_ERROR,
ESP_BLUFI_DH_PARAM_ERROR,
ESP_BLUFI_READ_PARAM_ERROR,
ESP_BLUFI_MAKE_PUBLIC_ERROR,
} esp_blufi_error_state_t;
/**
* @brief BLUFI extra information structure
*/
@ -254,7 +268,21 @@ typedef union {
uint8_t *pkey; /*!< Client Private Key point, if Client certificate not contain Key */
int pkey_len; /*!< Client Private key length */
} server_pkey; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_SERVER_PRIV_KEY */
/**
* @brief
* ESP_BLUFI_EVENT_REPORT_ERROR
*/
struct blufi_get_error_evt_param {
esp_blufi_error_state_t state; /*!< Blufi error state */
} report_error; /*!< Blufi callback param of ESP_BLUFI_EVENT_REPORT_ERROR */
/**
* @brief
* ESP_BLUFI_EVENT_RECV_CUSTOM_DATA
*/
struct blufi_recv_custom_data_evt_param {
uint8_t *data; /*!< Custom data */
uint32_t data_len; /*!< Custom data Length */
} custom_data; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_CUSTOM_DATA */
} esp_blufi_cb_param_t;
/**
@ -386,6 +414,26 @@ uint16_t esp_blufi_get_version(void);
*
*/
esp_err_t esp_blufi_close(esp_gatt_if_t gatts_if, uint16_t conn_id);
/**
*
* @brief This function is called to send blufi error information
* @param state : error state
*
* @return ESP_OK - success, other - failed
*
*/
esp_err_t esp_blufi_send_error_info(esp_blufi_error_state_t state);
/**
*
* @brief This function is called to custom data
* @param data : custom data value
* @param data_len : the length of custom data
*
* @return ESP_OK - success, other - failed
*
*/
esp_err_t esp_blufi_send_custom_data(uint8_t *data, uint32_t data_len);
#ifdef __cplusplus
}
#endif

View File

@ -830,7 +830,18 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
*/
esp_err_t esp_ble_gap_set_device_name(const char *name);
/**
* @brief This function is called to get local used address and adress type.
* uint8_t *esp_bt_dev_get_address(void) get the public address
*
* @param[in] local_used_addr - current local used ble address (six bytes)
* @param[in] addr_type - ble address type
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_gap_get_local_used_addr(esp_bd_addr_t local_used_addr, uint8_t * addr_type);
/**
* @brief This function is called to get ADV data for a specific type.
*

View File

@ -63,7 +63,7 @@ typedef enum {
ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39, /*!< When unregister for notification of a service completes, the event comes */
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_READ_MULTIPLE_EVT = 42, /*!< When the ble characteristic or descriptor multiple complete, the event comes */
ESP_GATTC_QUEUE_FULL_EVT = 43, /*!< When the gattc command queue full, the event comes */
} esp_gattc_cb_event_t;
@ -283,6 +283,7 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if);
*
* @param[in] gattc_if: Gatt client access interface.
* @param[in] remote_bda: remote device bluetooth device address.
* @param[in] remote_addr_type: remote device bluetooth device the address type.
* @param[in] is_direct: direct connection or background auto connection
*
* @return
@ -290,7 +291,7 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if);
* - other: failed
*
*/
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, bool is_direct);
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct);
/**

View File

@ -162,7 +162,7 @@ typedef union {
esp_gatt_status_t status; /*!< Operation status */
uint16_t attr_handle; /*!< Descriptor attribute handle */
uint16_t service_handle; /*!< Service attribute handle */
esp_bt_uuid_t char_uuid; /*!< Characteristic uuid */
esp_bt_uuid_t descr_uuid; /*!< Characteristic descriptor uuid */
} add_char_descr; /*!< Gatt server callback param of ESP_GATTS_ADD_CHAR_DESCR_EVT */
/**

View File

@ -1097,13 +1097,14 @@ extern void GATT_StartIf (tGATT_IF gatt_if);
**
** Parameters gatt_if: applicaiton interface
** bd_addr: peer device address.
** bd_addr_type: peer device address type.
** is_direct: is a direct conenection or a background auto connection
** transport : Physical transport for GATT connection (BR/EDR or LE)
**
** Returns TRUE if connection started; FALSE if connection start failure.
**
*******************************************************************************/
extern BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr,
extern BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type,
BOOLEAN is_direct, tBT_TRANSPORT transport);

View File

@ -572,8 +572,8 @@ extern void gatt_free(void);
/* from gatt_main.c */
extern BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb);
extern BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBT_TRANSPORT transport);
extern BOOLEAN gatt_connect (BD_ADDR rem_bda, tGATT_TCB *p_tcb, tBT_TRANSPORT transport);
extern BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type, tBT_TRANSPORT transport);
extern BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p_tcb, tBT_TRANSPORT transport);
extern void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf);
extern void gatt_update_app_use_link_flag ( tGATT_IF gatt_if, tGATT_TCB *p_tcb, BOOLEAN is_add, BOOLEAN check_acl_link);
@ -682,6 +682,7 @@ extern void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN
extern void gatt_sr_update_prep_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first);
extern BOOLEAN gatt_find_app_hold_link(tGATT_TCB *p_tcb, UINT8 start_idx, UINT8 *p_found_idx, tGATT_IF *p_gatt_if);
extern BOOLEAN gatt_find_specific_app_in_hold_link(tGATT_TCB *p_tcb, tGATT_IF p_gatt_if);
extern UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb);
extern UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda);
extern tGATT_TCB *gatt_find_tcb_by_cid(UINT16 lcid);

View File

@ -792,6 +792,9 @@
#define HCI_ERR_MAX_ERR 0x43
//ESP vendor error code
#define HCI_ERR_ESP_VENDOR_FAIL 0xE0
#define HCI_HINT_TO_RECREATE_AMP_PHYS_LINK 0xFF
/*

View File

@ -1079,11 +1079,12 @@ extern BOOLEAN L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_R
**
** Parameters: Fixed CID
** BD Address of remote
** BD Address type
**
** Return value: TRUE if connection started
**
*******************************************************************************/
extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr);
extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_type);
/*******************************************************************************
**

View File

@ -422,6 +422,7 @@ typedef struct t_l2c_linkcb {
tBT_TRANSPORT transport;
#if (BLE_INCLUDED == TRUE)
tBLE_ADDR_TYPE open_addr_type; /* be set by open API */
tBLE_ADDR_TYPE ble_addr_type;
UINT16 tx_data_len; /* tx data length used in data length extension */
fixed_queue_t *le_sec_pending_q; /* LE coc channels waiting for security check completion */
@ -767,7 +768,7 @@ extern BOOLEAN l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg
extern UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
extern void l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb);
extern void l2c_fcr_stop_timer (tL2C_CCB *p_ccb);
extern void l2c_fcr_free_timer (tL2C_CCB *p_ccb);
/* Functions provided by l2c_ble.c
************************************
*/

View File

@ -296,8 +296,10 @@ tRFC_MCB *rfc_alloc_multiplexer_channel (BD_ADDR bd_addr, BOOLEAN is_initiator)
extern void rfc_release_multiplexer_channel (tRFC_MCB *p_rfc_mcb);
extern void rfc_timer_start (tRFC_MCB *p_rfc_mcb, UINT16 timeout);
extern void rfc_timer_stop (tRFC_MCB *p_rfc_mcb);
extern void rfc_timer_free (tRFC_MCB *p_rfc_mcb);
extern void rfc_port_timer_start (tPORT *p_port, UINT16 tout);
extern void rfc_port_timer_stop (tPORT *p_port);
extern void rfc_port_timer_free (tPORT *p_port);
BOOLEAN rfc_check_uih_fcs (UINT8 dlci, UINT8 received_fcs);
BOOLEAN rfc_check_fcs (UINT16 len, UINT8 *p, UINT8 received_fcs);

View File

@ -237,6 +237,7 @@ extern tSDP_CB *sdp_cb_ptr;
/* Functions provided by sdp_main.c */
extern void sdp_init (void);
extern void sdp_deinit (void);
extern void sdp_disconnect (tCONN_CB *p_ccb, UINT16 reason);
#if (defined(SDP_DEBUG) && SDP_DEBUG == TRUE)

View File

@ -303,6 +303,18 @@ extern "C"
*******************************************************************************/
extern void SMP_Init(void);
/*******************************************************************************
**
** Function SMP_Free
**
** Description This function de initializes the SMP unit.
**
** Returns void
**
*******************************************************************************/
extern void SMP_Free(void);
/*******************************************************************************
**
** Function SMP_SetTraceLevel

View File

@ -83,13 +83,21 @@ typedef enum {
#define BTC_TASK_PRIO (configMAX_PRIORITIES - 6)
#define BTC_TASK_QUEUE_LEN 60
#define BTC_MEDIA_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
#define BTC_MEDIA_TASK_STACK_SIZE (2048 + 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 (3)
#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 BTC_A2DP_SINK_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
#define BTC_A2DP_SINK_TASK_STACK_SIZE (CONFIG_A2DP_SINK_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_A2DP_SINK_TASK_NAME "BtA2dSinkT"
#define BTC_A2DP_SINK_TASK_PRIO (configMAX_PRIORITIES - 3)
#define BTC_A2DP_SINK_DATA_QUEUE_LEN (3)
#define BTC_A2DP_SINK_CTRL_QUEUE_LEN (5)
#define BTC_A2DP_SINK_TASK_QUEUE_SET_LEN (BTC_A2DP_SINK_DATA_QUEUE_LEN + BTC_A2DP_SINK_CTRL_QUEUE_LEN)
#define BTC_A2DP_SOURCE_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
#define BTC_A2DP_SOURCE_TASK_STACK_SIZE (CONFIG_A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_A2DP_SOURCE_TASK_NAME "BtA2dSourceT"
#define BTC_A2DP_SOURCE_TASK_PRIO (configMAX_PRIORITIES - 3)
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (3)
#define BTC_A2DP_SOURCE_CTRL_QUEUE_LEN (5)
#define BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN (BTC_A2DP_SOURCE_DATA_QUEUE_LEN + BTC_A2DP_SOURCE_CTRL_QUEUE_LEN)
#define TASK_POST_NON_BLOCKING (0)
#define TASK_POST_BLOCKING (portMAX_DELAY)

View File

@ -84,7 +84,7 @@ typedef enum {
/**
* @brief BLE tx power type
* ESP_BLE_PWR_TYPE_CONN_HDL0-8: 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 connection 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.

View File

@ -19,12 +19,14 @@
#define CONFIG_ESPTOOLPY_FLASHSIZE_4MB 1
#define CONFIG_IPC_TASK_STACK_SIZE 1024
#define CONFIG_FATFS_PER_FILE_CACHE 1
#define CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY 1
#define CONFIG_ESPTOOLPY_FLASHFREQ "40m"
#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1
#define CONFIG_UDP_RECVMBOX_SIZE 6
#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0
#define CONFIG_MBEDTLS_AES_C 1
#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1
#define CONFIG_A2DP_SINK_TASK_STACK_SIZE 2048
#define CONFIG_MBEDTLS_GCM_C 1
#define CONFIG_ESPTOOLPY_FLASHSIZE "4MB"
#define CONFIG_SPIFFS_CACHE_WR 1
@ -44,6 +46,7 @@
#define CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM 10
#define CONFIG_MBEDTLS_SSL_ALPN 1
#define CONFIG_MBEDTLS_PEM_WRITE_C 1
#define CONFIG_BT_SPP_ENABLED 1
#define CONFIG_BT_RESERVE_DRAM 0x10000
#define CONFIG_CXX_EXCEPTIONS 1
#define CONFIG_FATFS_FS_LOCK 0
@ -64,6 +67,7 @@
#define CONFIG_LWIP_MAX_UDP_PCBS 16
#define CONFIG_ESPTOOLPY_BAUD 921600
#define CONFIG_INT_WDT_CHECK_CPU1 1
#define CONFIG_ADC_CAL_LUT_ENABLE 1
#define CONFIG_FLASHMODE_DIO 1
#define CONFIG_ESPTOOLPY_AFTER_RESET 1
#define CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED 1
@ -98,12 +102,14 @@
#define CONFIG_LWIP_MAX_ACTIVE_TCP 16
#define CONFIG_TASK_WDT_TIMEOUT_S 5
#define CONFIG_INT_WDT_TIMEOUT_MS 300
#define CONFIG_ESP32_RTC_XTAL_BOOTSTRAP_CYCLES 100
#define CONFIG_ESPTOOLPY_FLASHMODE "dio"
#define CONFIG_BTC_TASK_STACK_SIZE 8192
#define CONFIG_BLUEDROID_ENABLED 1
#define CONFIG_NEWLIB_STDIN_LINE_ENDING_CR 1
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA 1
#define CONFIG_ESPTOOLPY_BEFORE "default_reset"
#define CONFIG_ADC2_DISABLE_DAC 1
#define CONFIG_LOG_DEFAULT_LEVEL 1
#define CONFIG_TIMER_QUEUE_LENGTH 10
#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1
@ -133,11 +139,12 @@
#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1
#define CONFIG_LWIP_SO_REUSE_RXTOALL 1
#define CONFIG_PARTITION_TABLE_SINGLE_APP 1
#define CONFIG_ESP32_WIFI_RX_BA_WIN 6
#define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1
#define CONFIG_SPIFFS_USE_MTIME 1
#define CONFIG_SW_COEXIST_PREFERENCE_VALUE 2
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1
#define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000
#define CONFIG_BROWNOUT_DET_LVL 0
#define CONFIG_MBEDTLS_PEM_PARSE_C 1
@ -154,6 +161,7 @@
#define CONFIG_MBEDTLS_HARDWARE_AES 1
#define CONFIG_FREERTOS_HZ 1000
#define CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE 1
#define CONFIG_ADC_CAL_EFUSE_TP_ENABLE 1
#define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1
#define CONFIG_BROWNOUT_DET 1
#define CONFIG_ESP32_XTAL_FREQ 0
@ -164,6 +172,7 @@
#define CONFIG_SMP_ENABLE 1
#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1
#define CONFIG_SPIFFS_MAX_PARTITIONS 3
#define CONFIG_ESP_ERR_TO_NAME_LOOKUP 1
#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0 1
#define CONFIG_MBEDTLS_SSL_RENEGOTIATION 1
#define CONFIG_ESPTOOLPY_BEFORE_RESET 1
@ -172,6 +181,7 @@
#define CONFIG_SPIFFS_OBJ_NAME_LEN 32
#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5
#define CONFIG_LOG_BOOTLOADER_LEVEL_NONE 1
#define CONFIG_PARTITION_TABLE_MD5 1
#define CONFIG_TCPIP_RECVMBOX_SIZE 32
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_240 1
#define CONFIG_ESP32_XTAL_FREQ_AUTO 1
@ -187,6 +197,7 @@
#define CONFIG_MBEDTLS_TLS_CLIENT 1
#define CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI 1
#define CONFIG_BT_ENABLED 1
#define CONFIG_SW_COEXIST_PREFERENCE_BALANCE 1
#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1
#define CONFIG_MONITOR_BAUD 115200
#define CONFIG_FREERTOS_CORETIMER_0 1
@ -196,16 +207,18 @@
#define CONFIG_TCP_QUEUE_OOSEQ 1
#define CONFIG_GATTS_ENABLE 1
#define CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE 0
#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1
#define CONFIG_MBEDTLS_TLS_SERVER 1
#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1
#define CONFIG_FREERTOS_ISR_STACKSIZE 1536
#define CONFIG_CLASSIC_BT_ENABLED 1
#define CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK 1
#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_A2DP_SINK_ENABLE 1
#define CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED 1
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA 1
#define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32
@ -213,11 +226,11 @@
#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_A2DP_ENABLE 1
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
#define CONFIG_SPIFFS_PAGE_SIZE 256
#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
@ -228,3 +241,4 @@
#define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS 1
#define CONFIG_BLUEDROID_PINNED_TO_CORE 0
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR 1
#define CONFIG_FATFS_API_ENCODING_ANSI_OEM 1

View File

@ -13,6 +13,11 @@
// limitations under the License.
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
#include <stddef.h>
#include "esp_err.h"
@ -181,3 +186,7 @@ const char *esp_console_get_hint(const char *buf, int *color, int *bold);
* - ESP_ERR_INVALID_STATE, if esp_console_init wasn't called
*/
esp_err_t esp_console_register_help_command();
#ifdef __cplusplus
}
#endif

View File

@ -147,11 +147,15 @@ esp_err_t adc1_config_width(adc_bits_width_t width_bit);
esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit);
/**
* @brief Configure the ADC1 channel, including setting attenuation.
* @brief Set the attenuation of a particular channel on ADC1, and configure its
* associated GPIO pin mux.
*
* @note This function also configures the input GPIO pin mux to
* connect it to the ADC1 channel. It must be called before calling
* adc1_get_raw() for this channel.
* @note For any given channel, this function must be called before the first time
* adc1_get_raw() is called for that channel.
*
* @note This function can be called multiple times to configure multiple
* ADC channels simultaneously. adc1_get_raw() can then be called for any configured
* 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.
@ -168,6 +172,15 @@ esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit);
*
* @note At 11dB attenuation the maximum voltage is limited by VDD_A, not the full scale voltage.
*
* Due to ADC characteristics, most accurate results are obtained within the following approximate voltage ranges:
*
* - 0dB attenuaton (ADC_ATTEN_DB_0) between 100 and 950mV
* - 2.5dB attenuation (ADC_ATTEN_DB_2_5) between 100 and 1250mV
* - 6dB attenuation (ADC_ATTEN_DB_6) between 150 to 1750mV
* - 11dB attenuation (ADC_ATTEN_DB_11) between 150 to 2450mV
*
* For maximum accuracy, use the ADC calibration APIs and measure voltages within these recommended ranges.
*
* @param channel ADC1 channel to configure
* @param atten Attenuation level
*
@ -178,13 +191,14 @@ esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit);
esp_err_t adc1_config_channel_atten(adc1_channel_t channel, adc_atten_t atten);
/**
* @brief Take an ADC1 reading on a single channel
* @brief Take an ADC1 reading from a single channel.
*
* @note Call adc1_config_width() before the first time this
* function is called.
*
* @note For a given channel, adc1_config_channel_atten(channel)
* must be called before the first time this function is called.
* @note For any given channel, adc1_config_channel_atten(channel)
* must be called before the first time this function is called. Configuring
* a new channel does not prevent a previously configured channel from being read.
*
* @param channel ADC1 channel to read
*
@ -204,12 +218,13 @@ int adc1_get_voltage(adc1_channel_t channel) __attribute__((deprecated));
/** @endcond */
/**
* @brief Power on SAR ADC
* @brief Enable ADC power
*/
void adc_power_on();
/**
* @brief Power off SAR ADC
* This function will force power down for ADC
*/
void adc_power_off();

View File

@ -73,41 +73,41 @@ extern "C" {
#define GPIO_SEL_38 ((uint64_t)(((uint64_t)1)<<38)) /*!< Pin 38 selected */
#define GPIO_SEL_39 ((uint64_t)(((uint64_t)1)<<39)) /*!< Pin 39 selected */
#define GPIO_PIN_REG_0 PERIPHS_IO_MUX_GPIO0_U
#define GPIO_PIN_REG_1 PERIPHS_IO_MUX_U0TXD_U
#define GPIO_PIN_REG_2 PERIPHS_IO_MUX_GPIO2_U
#define GPIO_PIN_REG_3 PERIPHS_IO_MUX_U0RXD_U
#define GPIO_PIN_REG_4 PERIPHS_IO_MUX_GPIO4_U
#define GPIO_PIN_REG_5 PERIPHS_IO_MUX_GPIO5_U
#define GPIO_PIN_REG_6 PERIPHS_IO_MUX_SD_CLK_U
#define GPIO_PIN_REG_7 PERIPHS_IO_MUX_SD_DATA0_U
#define GPIO_PIN_REG_8 PERIPHS_IO_MUX_SD_DATA1_U
#define GPIO_PIN_REG_9 PERIPHS_IO_MUX_SD_DATA2_U
#define GPIO_PIN_REG_10 PERIPHS_IO_MUX_SD_DATA3_U
#define GPIO_PIN_REG_11 PERIPHS_IO_MUX_SD_CMD_U
#define GPIO_PIN_REG_12 PERIPHS_IO_MUX_MTDI_U
#define GPIO_PIN_REG_13 PERIPHS_IO_MUX_MTCK_U
#define GPIO_PIN_REG_14 PERIPHS_IO_MUX_MTMS_U
#define GPIO_PIN_REG_15 PERIPHS_IO_MUX_MTDO_U
#define GPIO_PIN_REG_16 PERIPHS_IO_MUX_GPIO16_U
#define GPIO_PIN_REG_17 PERIPHS_IO_MUX_GPIO17_U
#define GPIO_PIN_REG_18 PERIPHS_IO_MUX_GPIO18_U
#define GPIO_PIN_REG_19 PERIPHS_IO_MUX_GPIO19_U
#define GPIO_PIN_REG_20 PERIPHS_IO_MUX_GPIO20_U
#define GPIO_PIN_REG_21 PERIPHS_IO_MUX_GPIO21_U
#define GPIO_PIN_REG_22 PERIPHS_IO_MUX_GPIO22_U
#define GPIO_PIN_REG_23 PERIPHS_IO_MUX_GPIO23_U
#define GPIO_PIN_REG_25 PERIPHS_IO_MUX_GPIO25_U
#define GPIO_PIN_REG_26 PERIPHS_IO_MUX_GPIO26_U
#define GPIO_PIN_REG_27 PERIPHS_IO_MUX_GPIO27_U
#define GPIO_PIN_REG_32 PERIPHS_IO_MUX_GPIO32_U
#define GPIO_PIN_REG_33 PERIPHS_IO_MUX_GPIO33_U
#define GPIO_PIN_REG_34 PERIPHS_IO_MUX_GPIO34_U
#define GPIO_PIN_REG_35 PERIPHS_IO_MUX_GPIO35_U
#define GPIO_PIN_REG_36 PERIPHS_IO_MUX_GPIO36_U
#define GPIO_PIN_REG_37 PERIPHS_IO_MUX_GPIO37_U
#define GPIO_PIN_REG_38 PERIPHS_IO_MUX_GPIO38_U
#define GPIO_PIN_REG_39 PERIPHS_IO_MUX_GPIO39_U
#define GPIO_PIN_REG_0 IO_MUX_GPIO0_REG
#define GPIO_PIN_REG_1 IO_MUX_GPIO1_REG
#define GPIO_PIN_REG_2 IO_MUX_GPIO2_REG
#define GPIO_PIN_REG_3 IO_MUX_GPIO3_REG
#define GPIO_PIN_REG_4 IO_MUX_GPIO4_REG
#define GPIO_PIN_REG_5 IO_MUX_GPIO5_REG
#define GPIO_PIN_REG_6 IO_MUX_GPIO6_REG
#define GPIO_PIN_REG_7 IO_MUX_GPIO7_REG
#define GPIO_PIN_REG_8 IO_MUX_GPIO8_REG
#define GPIO_PIN_REG_9 IO_MUX_GPIO9_REG
#define GPIO_PIN_REG_10 IO_MUX_GPIO10_REG
#define GPIO_PIN_REG_11 IO_MUX_GPIO11_REG
#define GPIO_PIN_REG_12 IO_MUX_GPIO12_REG
#define GPIO_PIN_REG_13 IO_MUX_GPIO13_REG
#define GPIO_PIN_REG_14 IO_MUX_GPIO14_REG
#define GPIO_PIN_REG_15 IO_MUX_GPIO15_REG
#define GPIO_PIN_REG_16 IO_MUX_GPIO16_REG
#define GPIO_PIN_REG_17 IO_MUX_GPIO17_REG
#define GPIO_PIN_REG_18 IO_MUX_GPIO18_REG
#define GPIO_PIN_REG_19 IO_MUX_GPIO19_REG
#define GPIO_PIN_REG_20 IO_MUX_GPIO20_REG
#define GPIO_PIN_REG_21 IO_MUX_GPIO21_REG
#define GPIO_PIN_REG_22 IO_MUX_GPIO22_REG
#define GPIO_PIN_REG_23 IO_MUX_GPIO23_REG
#define GPIO_PIN_REG_25 IO_MUX_GPIO25_REG
#define GPIO_PIN_REG_26 IO_MUX_GPIO26_REG
#define GPIO_PIN_REG_27 IO_MUX_GPIO27_REG
#define GPIO_PIN_REG_32 IO_MUX_GPIO32_REG
#define GPIO_PIN_REG_33 IO_MUX_GPIO33_REG
#define GPIO_PIN_REG_34 IO_MUX_GPIO34_REG
#define GPIO_PIN_REG_35 IO_MUX_GPIO35_REG
#define GPIO_PIN_REG_36 IO_MUX_GPIO36_REG
#define GPIO_PIN_REG_37 IO_MUX_GPIO37_REG
#define GPIO_PIN_REG_38 IO_MUX_GPIO38_REG
#define GPIO_PIN_REG_39 IO_MUX_GPIO39_REG
#define GPIO_APP_CPU_INTR_ENA (BIT(0))
#define GPIO_APP_CPU_NMI_INTR_ENA (BIT(1))
@ -302,6 +302,8 @@ esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level);
/**
* @brief GPIO get input level
*
* @warning If the pad is not configured for input (or input and output) the returned value is always 0.
*
* @param gpio_num GPIO number. If you want to get the logic level of e.g. pin GPIO16, gpio_num should be GPIO_NUM_16 (16);
*
* @return

124
tools/sdk/include/driver/driver/i2s.h Normal file → Executable file
View File

@ -138,7 +138,8 @@ typedef struct {
int 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 */
int dma_buf_count; /*!< I2S DMA Buffer Count */
int dma_buf_len; /*!< I2S DMA Buffer Length */
int use_apll; /*!< I2S using APLL as main I2S clock, enable it to get accurate clock */
bool use_apll; /*!< I2S using APLL as main I2S clock, enable it to get accurate clock */
int fixed_mclk; /*!< I2S using fixed MCLK output. If use_apll = true and fixed_mclk > 0, then the clock output for i2s is fixed and equal to the fixed_mclk value.*/
} i2s_config_t;
/**
@ -207,8 +208,9 @@ typedef intr_handle_t i2s_isr_handle_t;
* if you don't want this to happen and you want to initialize only one of the DAC channels, you can call i2s_set_dac_mode instead.
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_FAIL IO error
*/
esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin);
@ -222,7 +224,7 @@ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin);
* be used as RTC DAC function at the same time.
*
* @return
* - ESP_OK Success
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
@ -241,8 +243,9 @@ esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
* This function must be called before any I2S driver read/write operations.
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_NO_MEM Out of memory
*/
esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config, int queue_size, void* i2s_queue);
@ -252,8 +255,8 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config,
* @param i2s_num I2S_NUM_0, I2S_NUM_1
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num);
@ -276,10 +279,41 @@ esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num);
* Format of the data in source buffer is determined by the I2S
* configuration (see i2s_config_t).
*
* @return Number of bytes written, or ESP_FAIL (-1) for parameter error. If a timeout occurred, bytes written will be less than total size.
* @return
* - Number of bytes written, if timeout occurred, bytes written will be less than the size passed.
* - ESP_FAIL Parameter error.
*/
int i2s_write_bytes(i2s_port_t i2s_num, const char *src, size_t size, TickType_t ticks_to_wait);
/**
* @brief Write data to I2S DMA transmit buffer while expanding the number of bits per sample. For example, expanding 16-bit PCM to 32-bit PCM.
*
* @param i2s_num I2S_NUM_0, I2S_NUM_1
*
* @param src Source address to write from
*
* @param size Size of data in bytes
*
* @param src_bits Source audio bit
*
* @param aim_bits Bit wanted, no more than 32, and must be greater than src_bits
*
* @param ticks_to_wait TX buffer wait timeout in RTOS ticks. If this
* many ticks pass without space becoming available in the DMA
* transmit buffer, then the function will return (note that if the
* data is written to the DMA buffer in pieces, the overall operation
* may still take longer than this timeout.) Pass portMAX_DELAY for no
* timeout.
*
* Format of the data in source buffer is determined by the I2S
* configuration (see i2s_config_t).
*
* @return
* - Number of bytes written, if timeout occurred, bytes written will be less than the size passed.
* - ESP_FAIL Parameter error.
*/
int i2s_write_expand(i2s_port_t i2s_num, const char *src, int size, int src_bits, int aim_bits, TickType_t ticks_to_wait);
/**
* @brief Read data from I2S DMA receive buffer
*
@ -293,8 +327,12 @@ int i2s_write_bytes(i2s_port_t i2s_num, const char *src, size_t size, TickType_t
*
* Format of the data in source buffer is determined by the I2S
* configuration (see i2s_config_t).
* @note If the built-in ADC mode is enabled, we should call i2s_adc_start and i2s_adc_stop around the whole reading process,
* to prevent the data getting corrupted.
*
* @return Number of bytes read, or ESP_FAIL (-1) for parameter error. If a timeout occurred, bytes read will be less than total size.
* @return
* - Number of bytes read, if timeout occurred, bytes written will be less than the size passed.
* - ESP_FAIL Parameter error.
*/
int i2s_read_bytes(i2s_port_t i2s_num, char* dest, size_t size, TickType_t ticks_to_wait);
@ -309,7 +347,9 @@ int i2s_read_bytes(i2s_port_t i2s_num, char* dest, size_t size, TickType_t ticks
*
* @param ticks_to_wait Push timeout in RTOS ticks. If space is not available in the DMA TX buffer within this period, no data is written and function returns 0.
*
* @return Number of bytes successfully pushed to DMA buffer, or ESP_FAIL (-1) for parameter error. Will be either zero or the size of configured sample buffer.
* @return
* - Number of bytes successfully pushed to DMA buffer, will be either zero or the size of configured sample buffer.
* - ESP_FAIL Parameter error.
*/
int i2s_push_sample(i2s_port_t i2s_num, const char *sample, TickType_t ticks_to_wait);
@ -324,8 +364,9 @@ int i2s_push_sample(i2s_port_t i2s_num, const char *sample, TickType_t ticks_to_
*
* @param ticks_to_wait Pop timeout in RTOS ticks. If a sample is not available in the DMA buffer within this period, no data is read and function returns zero.
*
* @return Number of bytes successfully read from DMA buffer, or ESP_FAIL (-1) for parameter error. Byte count will be either zero or the size of the configured sample buffer.
* @return
* - Number of bytes successfully read from DMA buffer, will be either zero or the size of configured sample buffer.
* - ESP_FAIL Parameter error.
*/
int i2s_pop_sample(i2s_port_t i2s_num, char *sample, TickType_t ticks_to_wait);
@ -342,8 +383,10 @@ int i2s_pop_sample(i2s_port_t i2s_num, char *sample, TickType_t ticks_to_wait);
* @param rate I2S sample rate (ex: 8000, 44100...)
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_FAIL I2s is not initialized
* - ESP_ERR_NO_MEM Out of memory
*/
esp_err_t i2s_set_sample_rates(i2s_port_t i2s_num, uint32_t rate);
@ -355,8 +398,8 @@ esp_err_t i2s_set_sample_rates(i2s_port_t i2s_num, uint32_t rate);
* @param i2s_num I2S_NUM_0, I2S_NUM_1
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t i2s_stop(i2s_port_t i2s_num);
@ -369,8 +412,8 @@ esp_err_t i2s_stop(i2s_port_t i2s_num);
* @param i2s_num I2S_NUM_0, I2S_NUM_1
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t i2s_start(i2s_port_t i2s_num);
@ -382,14 +425,14 @@ esp_err_t i2s_start(i2s_port_t i2s_num);
* @param i2s_num I2S_NUM_0, I2S_NUM_1
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t i2s_zero_dma_buffer(i2s_port_t i2s_num);
/**
* @brief Set clock & bit width used for I2S RX and TX.
*
*
* Similar to i2s_set_sample_rates(), but also sets bit width.
*
* @param i2s_num I2S_NUM_0, I2S_NUM_1
@ -399,10 +442,12 @@ esp_err_t i2s_zero_dma_buffer(i2s_port_t i2s_num);
* @param bits I2S bit width (I2S_BITS_PER_SAMPLE_16BIT, I2S_BITS_PER_SAMPLE_24BIT, I2S_BITS_PER_SAMPLE_32BIT)
*
* @param ch I2S channel, (I2S_CHANNEL_MONO, I2S_CHANNEL_STEREO)
*
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_FAIL Not initialized
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_NO_MEM Out of memory
*/
esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t bits, i2s_channel_t ch);
@ -412,11 +457,36 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b
* @param adc_unit SAR ADC unit index
* @param adc_channel ADC channel index
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t i2s_set_adc_mode(adc_unit_t adc_unit, adc1_channel_t adc_channel);
/**
* @brief Start to use I2S built-in ADC mode
* @note This function would acquire the lock of ADC to prevent the data getting corrupted
* during the I2S peripheral is being used to do fully continuous ADC sampling.
*
* @param i2s_num i2s port index
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_INVALID_STATE driver state error
* - ESP_FAIL Internal driver error
*/
esp_err_t i2s_adc_enable(i2s_port_t i2s_num);
/**
* @brief Stop to use I2S built-in ADC mode
* @param i2s_num i2s port index
* @note This function would release the lock of ADC so that other tasks can use ADC.
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_INVALID_STATE driver state error
*/
esp_err_t i2s_adc_disable(i2s_port_t i2s_num);
#ifdef __cplusplus
}
#endif

View File

@ -224,6 +224,24 @@ esp_err_t rtc_gpio_hold_en(gpio_num_t gpio_num);
*/
esp_err_t rtc_gpio_hold_dis(gpio_num_t gpio_num);
/**
* @brief Helper function to disconnect internal circuits from an RTC IO
* This function disables input, output, pullup, pulldown, and enables
* hold feature for an RTC IO.
* Use this function if an RTC IO needs to be disconnected from internal
* circuits in deep sleep, to minimize leakage current.
*
* In particular, for ESP32-WROVER module, call
* rtc_gpio_isolate(GPIO_NUM_12) before entering deep sleep, to reduce
* deep sleep current.
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12).
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_ARG if GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_isolate(gpio_num_t gpio_num);
/**
* @brief Disable force hold signal for all RTC IOs
*

View File

@ -86,7 +86,13 @@
/* SPI mode R1 response type bits */
#define SD_SPI_R1_IDLE_STATE (1<<0)
#define SD_SPI_R1_ERASE_RST (1<<1)
#define SD_SPI_R1_ILLEGAL_CMD (1<<2)
#define SD_SPI_R1_CMD_CRC_ERR (1<<3)
#define SD_SPI_R1_ERASE_SEQ_ERR (1<<4)
#define SD_SPI_R1_ADDR_ERR (1<<5)
#define SD_SPI_R1_PARAM_ERR (1<<6)
#define SD_SPI_R1_NO_RESPONSE (1<<7)
/* 48-bit response decoding (32 bits w/o CRC) */
#define MMC_R1(resp) ((resp)[0])

View File

@ -39,6 +39,7 @@ extern "C" {
.io_voltage = 3.3f, \
.init = &sdmmc_host_init, \
.set_bus_width = &sdmmc_host_set_bus_width, \
.get_bus_width = &sdmmc_host_get_slot_width, \
.set_card_clk = &sdmmc_host_set_card_clk, \
.do_transaction = &sdmmc_host_do_transaction, \
.deinit = &sdmmc_host_deinit, \
@ -115,6 +116,14 @@ esp_err_t sdmmc_host_init_slot(int slot, const sdmmc_slot_config_t* slot_config)
*/
esp_err_t sdmmc_host_set_bus_width(int slot, size_t width);
/**
* @brief Get bus width configured in ``sdmmc_host_init_slot`` to be used for data transfer
*
* @param slot slot number (SDMMC_HOST_SLOT_0 or SDMMC_HOST_SLOT_1)
* @return configured bus width of the specified slot.
*/
size_t sdmmc_host_get_slot_width(int slot);
/**
* @brief Set card clock frequency
*

View File

@ -125,6 +125,7 @@ typedef struct {
float io_voltage; /*!< I/O voltage used by the controller (voltage switching is not supported) */
esp_err_t (*init)(void); /*!< Host function to initialize the driver */
esp_err_t (*set_bus_width)(int slot, size_t width); /*!< host function to set bus width */
size_t (*get_bus_width)(int slot); /*!< host function to get bus width */
esp_err_t (*set_card_clk)(int slot, uint32_t freq_khz); /*!< host function to set card clock frequency */
esp_err_t (*do_transaction)(int slot, sdmmc_command_t* cmdinfo); /*!< host function to do a transaction */
esp_err_t (*deinit)(void); /*!< host function to deinitialize the driver */

View File

@ -30,11 +30,17 @@ extern "C"
#define SPI_DEVICE_TXBIT_LSBFIRST (1<<0) ///< Transmit command/address/data LSB first instead of the default MSB first
#define SPI_DEVICE_RXBIT_LSBFIRST (1<<1) ///< Receive data LSB first instead of the default MSB first
#define SPI_DEVICE_BIT_LSBFIRST (SPI_DEVICE_TXBIT_LSBFIRST|SPI_DEVICE_RXBIT_LSBFIRST); ///< Transmit and receive LSB first
#define SPI_DEVICE_BIT_LSBFIRST (SPI_DEVICE_TXBIT_LSBFIRST|SPI_DEVICE_RXBIT_LSBFIRST) ///< Transmit and receive LSB first
#define SPI_DEVICE_3WIRE (1<<2) ///< Use MOSI (=spid) for both sending and receiving data
#define SPI_DEVICE_POSITIVE_CS (1<<3) ///< Make CS positive during a transaction instead of negative
#define SPI_DEVICE_HALFDUPLEX (1<<4) ///< Transmit data before receiving it, instead of simultaneously
#define SPI_DEVICE_CLK_AS_CS (1<<5) ///< Output clock on CS line if CS is active
/** There are timing issue when reading at high frequency (the frequency is related to whether native pins are used, valid time after slave sees the clock).
* In half-duplex mode, the driver automatically inserts dummy bits before reading phase to fix the timing issue. Set this flag to disable this feature.
* However in full-duplex mode, dummy bits are not allowed to use and no way to prevent reading data from being corrupted.
* Set this flag to confirm that you're going to work with output only, or read without dummy bits at your own risk.
*/
#define SPI_DEVICE_NO_DUMMY (1<<6)
typedef struct spi_transaction_t spi_transaction_t;
@ -62,11 +68,11 @@ typedef struct {
#define SPI_TRANS_MODE_DIO (1<<0) ///< Transmit/receive data in 2-bit mode
#define SPI_TRANS_MODE_QIO (1<<1) ///< Transmit/receive data in 4-bit mode
#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``.
#define SPI_TRANS_MODE_DIOQIO_ADDR (1<<4) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
#define SPI_TRANS_VARIABLE_CMD (1<<5) ///< 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<<6) ///< 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.
@ -160,7 +166,7 @@ esp_err_t spi_bus_free(spi_host_device_t host);
* - ESP_ERR_NO_MEM if out of memory
* - ESP_OK on success
*/
esp_err_t spi_bus_add_device(spi_host_device_t host, spi_device_interface_config_t *dev_config, spi_device_handle_t *handle);
esp_err_t spi_bus_add_device(spi_host_device_t host, const spi_device_interface_config_t *dev_config, spi_device_handle_t *handle);
/**

View File

@ -30,7 +30,7 @@ extern "C"
#define SPI_SLAVE_TXBIT_LSBFIRST (1<<0) ///< Transmit command/address/data LSB first instead of the default MSB first
#define SPI_SLAVE_RXBIT_LSBFIRST (1<<1) ///< Receive data LSB first instead of the default MSB first
#define SPI_SLAVE_BIT_LSBFIRST (SPI_TXBIT_LSBFIRST|SPI_RXBIT_LSBFIRST); ///< Transmit and receive LSB first
#define SPI_SLAVE_BIT_LSBFIRST (SPI_SLAVE_TXBIT_LSBFIRST|SPI_SLAVE_RXBIT_LSBFIRST) ///< Transmit and receive LSB first
typedef struct spi_slave_transaction_t spi_slave_transaction_t;
@ -163,4 +163,4 @@ esp_err_t spi_slave_transmit(spi_host_device_t host, spi_slave_transaction_t *tr
}
#endif
#endif
#endif

View File

@ -238,7 +238,7 @@ esp_err_t timer_set_alarm_value(timer_group_t group_num, timer_idx_t timer_num,
esp_err_t timer_get_alarm_value(timer_group_t group_num, timer_idx_t timer_num, uint64_t* alarm_value);
/**
* @brief Get timer alarm value.
* @brief Enable or disable generation of timer alarm events.
*
* @param group_num Timer group, 0 for TIMERG0 or 1 for TIMERG1
* @param timer_num Timer index, 0 for hw_timer[0] & 1 for hw_timer[1]

View File

@ -618,8 +618,10 @@ int uart_write_bytes_with_break(uart_port_t uart_num, const char* src, size_t si
int uart_read_bytes(uart_port_t uart_num, uint8_t* buf, uint32_t length, TickType_t ticks_to_wait);
/**
* @brief UART ring buffer flush. This will discard all data in the UART RX buffer.
*
* @brief Alias of uart_flush_input.
* UART ring buffer flush. This will discard all data in the UART RX buffer.
* @note Instead of waiting the data sent out, this function will clear UART rx buffer.
* In order to send all the data in tx FIFO, we can use uart_wait_tx_done function.
* @param uart_num UART_NUM_0, UART_NUM_1 or UART_NUM_2
*
* @return
@ -629,8 +631,18 @@ int uart_read_bytes(uart_port_t uart_num, uint8_t* buf, uint32_t length, TickTyp
esp_err_t uart_flush(uart_port_t uart_num);
/**
* @brief UART get RX ring buffer cached data length
* @brief Clear input buffer, discard all the data is in the ring-buffer.
* @note In order to send all the data in tx FIFO, we can use uart_wait_tx_done function.
* @param uart_num UART_NUM_0, UART_NUM_1 or UART_NUM_2
*
* @return
* - ESP_OK Success
* - ESP_FAIL Parameter error
*/
esp_err_t uart_flush_input(uart_port_t uart_num);
/**
* @brief UART get RX ring buffer cached data length
* @param uart_num UART port number.
* @param size Pointer of size_t to accept cached data length
*
@ -671,6 +683,39 @@ esp_err_t uart_disable_pattern_det_intr(uart_port_t uart_num);
*/
esp_err_t uart_enable_pattern_det_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle);
/**
* @brief Return the nearest detected pattern position in buffer.
* The positions of the detected pattern are saved in a queue,
* this function will dequeue the first pattern position and move the pointer to next pattern position.
* @note If the RX buffer is full and flow control is not enabled,
* the detected pattern may not be found in the rx buffer due to overflow.
*
* The following APIs will modify the pattern position info:
* uart_flush_input, uart_read_bytes, uart_driver_delete, uart_pop_pattern_pos
* It is the application's responsibility to ensure atomic access to the pattern queue and the rx data buffer
* when using pattern detect feature.
*
* @param uart_num UART port number
* @return
* - (-1) No pattern found for current index or parameter error
* - others the pattern position in rx buffer.
*/
int uart_pattern_pop_pos(uart_port_t uart_num);
/**
* @brief Allocate a new memory with the given length to save record the detected pattern position in rx buffer.
* @param uart_num UART port number
* @param queue_length Max queue length for the detected pattern.
* If the queue length is not large enough, some pattern positions might be lost.
* Set this value to the maximum number of patterns that could be saved in data buffer at the same time.
* @return
* - ESP_ERR_NO_MEM No enough memory
* - ESP_ERR_INVALID_STATE Driver not installed
* - ESP_FAIL Parameter error
* - ESP_OK Success
*/
esp_err_t uart_pattern_queue_reset(uart_port_t uart_num, int queue_length);
#ifdef __cplusplus
}
#endif

View File

@ -26,6 +26,12 @@
// Forces data into DRAM instead of flash
#define DRAM_ATTR __attribute__((section(".dram1")))
// Forces data to be 4 bytes aligned
#define WORD_ALIGNED_ATTR __attribute__((aligned(4)))
// Forces data to be placed to DMA-capable places
#define DMA_ATTR WORD_ALIGNED_ATTR DRAM_ATTR
// Forces a string into DRAM instead of flash
// Use as ets_printf(DRAM_STR("Hello world!\n"));
#define DRAM_STR(str) (__extension__({static const DRAM_ATTR char __c[] = (str); (const char *)&__c;}))

View File

@ -1,4 +1,4 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
// Copyright 2015-2018 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.
@ -12,40 +12,48 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_COEXIST_H__
#define __ESP_COEXIST_H__
#include <stdbool.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Init software coexist
*
* @return Init ok or failed.
* @brief coex prefer value
*/
esp_err_t coex_init(void);
typedef enum {
ESP_COEX_PREFER_WIFI = 0, /*!< Prefer to WiFi, WiFi will have more opportunity to use RF */
ESP_COEX_PREFER_BT, /*!< Prefer to bluetooth, bluetooth will have more opportunity to use RF */
ESP_COEX_PREFER_BALANCE, /*!< Do balance of WiFi and bluetooth */
ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */
} esp_coex_prefer_t;
/**
* @brief De-init software coexist
* @brief Get software coexist version string
*
* @return : version string
*/
void coex_deinit(void);
const char *esp_coex_version_get(void);
/**
* @brief Get software coexist enable or not
* @brief Set coexist preference of performance
* For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt)
* more smooth while wifi is runnning something.
* If prefer to wifi, it will do similar things as prefer to bluetooth.
* Default, it prefer to balance.
*
* @return software coexist enable status.
* @param prefer : the prefer enumeration value
* @return : ESP_OK - success, other - failed
*/
bool coexist_get_enable(void);
/**
* @brief Set software coexist enable or not
*
* @param enable software coexist or disable it
*
* @return Void.
*/
void coexist_set_enable(bool enable);
esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer);
#ifdef __cplusplus
}
#endif
#endif /* __ESP_COEXIST_H__ */

View File

@ -41,6 +41,40 @@ typedef int32_t esp_err_t;
#define ESP_ERR_INVALID_MAC 0x10B
#define ESP_ERR_WIFI_BASE 0x3000 /*!< Starting number of WiFi error codes */
#define ESP_ERR_MESH_BASE 0x4000 /*!< Starting number of MESH error codes */
/**
* @brief Returns string for esp_err_t error codes
*
* This function finds the error code in a pre-generated lookup-table and
* returns its string representation.
*
* The function is generated by the Python script
* tools/gen_esp_err_to_name.py which should be run each time an esp_err_t
* error is modified, created or removed from the IDF project.
*
* @param code esp_err_t error code
* @return string error message
*/
const char *esp_err_to_name(esp_err_t code);
/**
* @brief Returns string for esp_err_t and system error codes
*
* This function finds the error code in a pre-generated lookup-table of
* esp_err_t errors and returns its string representation. If the error code
* is not found then it is attempted to be found among system errors.
*
* The function is generated by the Python script
* tools/gen_esp_err_to_name.py which should be run each time an esp_err_t
* error is modified, created or removed from the IDF project.
*
* @param code esp_err_t error code
* @param[out] buf buffer where the error message should be written
* @param buflen Size of buffer buf. At most buflen bytes are written into the buf buffer (including the terminating null byte).
* @return buf containing the string error message
*/
const char *esp_err_to_name_r(esp_err_t code, char *buf, size_t buflen);
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression) __attribute__((noreturn));

View File

@ -23,6 +23,7 @@ extern "C"
#define ESP_PARTITION_TABLE_ADDR 0x8000
#define ESP_PARTITION_MAGIC 0x50AA
#define ESP_PARTITION_MAGIC_MD5 0xEBEB
/* OTA selection structure (two copies in the OTA data partition.)
Size of 32 bytes is friendly to flash encryption */

View File

@ -1,4 +1,4 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
// Copyright 2015-2018 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.
@ -29,7 +29,7 @@ interrupts for too long, or code within interrupt handlers taking too long.
It does this by setting up a watchdog which gets fed from the FreeRTOS
task switch interrupt. When this watchdog times out, initially it will call
a high-level interrupt routine that will panic FreeRTOS in order to allow
for forensic examination of the state of the CPU. When this interrupt
for forensic examination of the state of the both CPUs. When this interrupt
handler is not called and the watchdog times out a second time, it will
reset the SoC.
@ -38,12 +38,22 @@ This uses the TIMERG1 WDT.
/**
* @brief Initialize the interrupt watchdog. This is called in the init code if
* the interrupt watchdog is enabled in menuconfig.
* @brief Initialize the non-CPU-specific parts of interrupt watchdog.
* This is called in the init code if the interrupt watchdog
* is enabled in menuconfig.
*
*/
void esp_int_wdt_init();
/**
* @brief Enable the interrupt watchdog on the current CPU. This is called
* in the init code by both CPUs if the interrupt watchdog is enabled
* in menuconfig.
*
*/
void esp_int_wdt_cpu_init();
/**
* @}
@ -54,4 +64,4 @@ void esp_int_wdt_init();
}
#endif
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
// Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_MESH_INTERNAL_H__
#define __ESP_MESH_INTERNAL_H__
#include "esp_err.h"
#include "esp_wifi.h"
#include "esp_wifi_types.h"
#include "esp_wifi_internal.h"
#include "esp_wifi_crypto_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************
* Constants
*******************************************************/
/*******************************************************
* Structures
*******************************************************/
typedef struct {
int scan; /**< minimum scan times before being a root, default:10 */
int vote; /**< max vote times in self-healing, default:10000 */
int fail; /**< parent selection fail times, if the scan times reach this value,
will disconnect with associated children and join self-healing. default:60 */
int monitor_ie; /**< acceptable times of parent ie change before update self ie, default:3 */
} mesh_attempts_t;
typedef struct {
int duration_ms; /* parent weak RSSI monitor duration, if the RSSI continues to be weak during this duration_ms,
will switch to a better parent */
int cnx_rssi; /* RSSI threshold for keeping a good connection with parent */
int select_rssi; /* RSSI threshold for parent selection, should be a value greater than switch_rssi */
int switch_rssi; /* RSSI threshold for action to reselect a better parent */
int backoff_rssi; /* RSSI threshold for connecting to the root */
} mesh_switch_parent_t;
/*******************************************************
* Function Definitions
*******************************************************/
/**
* @brief set mesh softAP beacon interval
*
* @param interval beacon interval(ms) (100ms ~ 60000ms)
*
* @return
* - ESP_OK
* - ESP_FAIL
* - ESP_ERR_WIFI_ARG
*/
esp_err_t esp_mesh_set_beacon_interval(int interval_ms);
/**
* @brief get mesh softAP beacon interval
*
* @param interval beacon interval(ms)
*
* @return
* - ESP_OK
*/
esp_err_t esp_mesh_get_beacon_interval(int *interval_ms);
/**
* @brief set attempts for mesh self-organized networking
*
* @param attempts
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_mesh_set_attempts(mesh_attempts_t *attempts);
/**
* @brief get attempts for mesh self-organized networking
*
* @param attempts
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_mesh_get_attempts(mesh_attempts_t *attempts);
/**
* @brief set parameters for parent switch
*
* @param paras parameters for parent switch
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_mesh_set_switch_parent_paras(mesh_switch_parent_t *paras);
/**
* @brief get parameters for parent switch
*
* @param paras parameters for parent switch
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_mesh_get_switch_parent_paras(mesh_switch_parent_t *paras);
/**
* @brief print the number of txQ waiting
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_mesh_print_txQ_waiting(void);
/**
* @brief print the number of rxQ waiting
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_mesh_print_rxQ_waiting(void);
/**
* @brief set passive scan time
*
* @param interval_ms passive scan time(ms)
*
* @return
* - ESP_OK
* - ESP_FAIL
* - ESP_ERR_ARGUMENT
*/
esp_err_t esp_mesh_set_passive_scan_time(int time_ms);
/**
* @brief get passive scan time
*
* @return interval_ms passive scan time(ms)
*/
int esp_mesh_get_passive_scan_time(void);
#ifdef __cplusplus
}
#endif
#endif /* __ESP_MESH_INTERNAL_H__ */

View File

@ -40,15 +40,15 @@ extern "C" {
* @{
*/
#define ESP_ERR_ESPNOW_BASE (ESP_ERR_WIFI_BASE + 101) /*!< ESPNOW error number base. */
#define ESP_ERR_ESPNOW_NOT_INIT (ESP_ERR_ESPNOW_BASE) /*!< ESPNOW is not initialized. */
#define ESP_ERR_ESPNOW_ARG (ESP_ERR_ESPNOW_BASE + 1) /*!< Invalid argument */
#define ESP_ERR_ESPNOW_NO_MEM (ESP_ERR_ESPNOW_BASE + 2) /*!< Out of memory */
#define ESP_ERR_ESPNOW_FULL (ESP_ERR_ESPNOW_BASE + 3) /*!< ESPNOW peer list is full */
#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_ERR_ESPNOW_BASE (ESP_ERR_WIFI_BASE + 100) /*!< ESPNOW error number base. */
#define ESP_ERR_ESPNOW_NOT_INIT (ESP_ERR_ESPNOW_BASE + 1) /*!< ESPNOW is not initialized. */
#define ESP_ERR_ESPNOW_ARG (ESP_ERR_ESPNOW_BASE + 2) /*!< Invalid argument */
#define ESP_ERR_ESPNOW_NO_MEM (ESP_ERR_ESPNOW_BASE + 3) /*!< Out of memory */
#define ESP_ERR_ESPNOW_FULL (ESP_ERR_ESPNOW_BASE + 4) /*!< ESPNOW peer list is full */
#define ESP_ERR_ESPNOW_NOT_FOUND (ESP_ERR_ESPNOW_BASE + 5) /*!< ESPNOW peer is not found */
#define ESP_ERR_ESPNOW_INTERNAL (ESP_ERR_ESPNOW_BASE + 6) /*!< Internal error */
#define ESP_ERR_ESPNOW_EXIST (ESP_ERR_ESPNOW_BASE + 7) /*!< ESPNOW peer has existed */
#define ESP_ERR_ESPNOW_IF (ESP_ERR_ESPNOW_BASE + 8) /*!< 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 */

View File

@ -46,6 +46,43 @@ typedef enum {
PHY_RF_CAL_FULL = 0x00000002 /*!< Do full RF calibration. Produces best results, but also consumes a lot of time and current. Suggested to be used once. */
} esp_phy_calibration_mode_t;
/**
* @brief Modules for modem sleep
*/
typedef enum{
MODEM_BLE_MODULE, //!< BLE controller used
MODEM_CLASSIC_BT_MODULE, //!< Classic BT controller used
MODEM_WIFI_STATION_MODULE, //!< Wi-Fi Station used
MODEM_WIFI_SOFTAP_MODULE, //!< Wi-Fi SoftAP used
MODEM_WIFI_SNIFFER_MODULE, //!< Wi-Fi Sniffer used
MODEM_USER_MODULE, //!< User used
MODEM_MODULE_COUNT //!< Number of items
}modem_sleep_module_t;
/**
* @brief Module WIFI mask for medem sleep
*/
#define MODEM_BT_MASK ((1<<MODEM_BLE_MODULE) | \
(1<<MODEM_CLASSIC_BT_MODULE))
/**
* @brief Module WIFI mask for medem sleep
*/
#define MODEM_WIFI_MASK ((1<<MODEM_WIFI_STATION_MODULE) | \
(1<<MODEM_WIFI_SOFTAP_MODULE) | \
(1<<MODEM_WIFI_SNIFFER_MODULE))
/**
* @brief Modules needing to call phy_rf_init
*/
typedef enum{
PHY_BT_MODULE, //!< Bluetooth used
PHY_WIFI_MODULE, //!< Wi-Fi used
PHY_MODEM_MODULE, //!< Modem sleep used
PHY_MODULE_COUNT //!< Number of items
}phy_rf_module_t;
/**
* @brief Get PHY init data
*
@ -130,8 +167,8 @@ esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_da
* @return ESP_OK on success.
* @return ESP_FAIL on fail.
*/
esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data,
esp_phy_calibration_mode_t mode, esp_phy_calibration_data_t* calibration_data);
esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data,esp_phy_calibration_mode_t mode,
esp_phy_calibration_data_t* calibration_data, phy_rf_module_t module);
/**
* @brief De-initialize PHY and RF module
@ -142,12 +179,32 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data,
*
* @return ESP_OK on success.
*/
esp_err_t esp_phy_rf_deinit(void);
esp_err_t esp_phy_rf_deinit(phy_rf_module_t module);
/**
* @brief Load calibration data from NVS and initialize PHY and RF module
*/
void esp_phy_load_cal_and_init(void);
void esp_phy_load_cal_and_init(phy_rf_module_t module);
/**
* @brief Module requires to enter modem sleep
*/
esp_err_t esp_modem_sleep_enter(modem_sleep_module_t module);
/**
* @brief Module requires to exit modem sleep
*/
esp_err_t esp_modem_sleep_exit(modem_sleep_module_t module);
/**
* @brief Register module to make it be able to require to enter/exit modem sleep
*/
esp_err_t esp_modem_sleep_register(modem_sleep_module_t module);
/**
* @brief De-register module from modem sleep list
*/
esp_err_t esp_modem_sleep_deregister(modem_sleep_module_t module);
#ifdef __cplusplus
}

View File

@ -54,14 +54,34 @@ typedef enum {
* @brief Sleep wakeup cause
*/
typedef enum {
ESP_SLEEP_WAKEUP_UNDEFINED, //! In case of deep sleep, reset was not caused by exit from deep sleep
ESP_SLEEP_WAKEUP_EXT0, //! Wakeup caused by external signal using RTC_IO
ESP_SLEEP_WAKEUP_EXT1, //! Wakeup caused by external signal using RTC_CNTL
ESP_SLEEP_WAKEUP_TIMER, //! Wakeup caused by timer
ESP_SLEEP_WAKEUP_TOUCHPAD, //! Wakeup caused by touchpad
ESP_SLEEP_WAKEUP_ULP, //! Wakeup caused by ULP program
} esp_sleep_wakeup_cause_t;
ESP_SLEEP_WAKEUP_UNDEFINED, //!< In case of deep sleep, reset was not caused by exit from deep sleep
ESP_SLEEP_WAKEUP_EXT0, //!< Wakeup caused by external signal using RTC_IO
ESP_SLEEP_WAKEUP_EXT1, //!< Wakeup caused by external signal using RTC_CNTL
ESP_SLEEP_WAKEUP_TIMER, //!< Wakeup caused by timer
ESP_SLEEP_WAKEUP_TOUCHPAD, //!< Wakeup caused by touchpad
ESP_SLEEP_WAKEUP_ULP, //!< Wakeup caused by ULP program
} esp_sleep_source_t;
/* Leave this type define for compatibility */
typedef esp_sleep_source_t esp_sleep_wakeup_cause_t;
/**
* @brief Disable wakeup source
*
* This function is used to deactivate wake up trigger for source
* defined as parameter of the function.
*
* @note This function does not modify wake up configuration in RTC.
* It will be performed in esp_sleep_start function.
*
* See docs/sleep-modes.rst for details.
*
* @param source - number of source to disable of type esp_sleep_source_t
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_STATE if trigger was not active
*/
esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source);
/**
* @brief Enable wakeup by ULP coprocessor

View File

@ -72,12 +72,6 @@
extern "C" {
#endif
#define ESP_ERR_WIFI_OK ESP_OK /*!< No error */
#define ESP_ERR_WIFI_FAIL ESP_FAIL /*!< General fail code */
#define ESP_ERR_WIFI_NO_MEM ESP_ERR_NO_MEM /*!< Out of memory */
#define ESP_ERR_WIFI_ARG ESP_ERR_INVALID_ARG /*!< Invalid argument */
#define ESP_ERR_WIFI_NOT_SUPPORT ESP_ERR_NOT_SUPPORTED /*!< Indicates that API is not supported yet */
#define ESP_ERR_WIFI_NOT_INIT (ESP_ERR_WIFI_BASE + 1) /*!< WiFi driver was not installed by esp_wifi_init */
#define ESP_ERR_WIFI_NOT_STARTED (ESP_ERR_WIFI_BASE + 2) /*!< WiFi driver was not started by esp_wifi_start */
#define ESP_ERR_WIFI_NOT_STOPPED (ESP_ERR_WIFI_BASE + 3) /*!< WiFi driver was not stopped by esp_wifi_stop */
@ -199,7 +193,7 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NO_MEM: out of memory
* - ESP_ERR_NO_MEM: out of memory
* - others: refer to error code esp_err.h
*/
esp_err_t esp_wifi_init(const wifi_init_config_t *config);
@ -225,7 +219,7 @@ esp_err_t esp_wifi_deinit(void);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - others: refer to error code in esp_err.h
*/
esp_err_t esp_wifi_set_mode(wifi_mode_t mode);
@ -238,7 +232,7 @@ esp_err_t esp_wifi_set_mode(wifi_mode_t mode);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
@ -251,10 +245,10 @@ esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_WIFI_NO_MEM: out of memory
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_NO_MEM: out of memory
* - ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
* - ESP_ERR_WIFI_FAIL: other WiFi internal errors
* - ESP_FAIL: other WiFi internal errors
*/
esp_err_t esp_wifi_start(void);
@ -307,7 +301,7 @@ esp_err_t esp_wifi_connect(void);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi was not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
* - ESP_ERR_WIFI_FAIL: other WiFi internal errors
* - ESP_FAIL: other WiFi internal errors
*/
esp_err_t esp_wifi_disconnect(void);
@ -330,7 +324,7 @@ esp_err_t esp_wifi_clear_fast_connect(void);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
*/
esp_err_t esp_wifi_deauth_sta(uint16_t aid);
@ -378,7 +372,7 @@ esp_err_t esp_wifi_scan_stop(void);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
@ -393,8 +387,8 @@ esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_WIFI_NO_MEM: out of memory
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_NO_MEM: out of memory
*/
esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);
@ -418,7 +412,7 @@ esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);
*
* @param type power save type
*
* @return ESP_ERR_WIFI_NOT_SUPPORT: not supported yet
* @return ESP_ERR_NOT_SUPPORTED: not supported yet
*/
esp_err_t esp_wifi_set_ps(wifi_ps_type_t type);
@ -429,7 +423,7 @@ esp_err_t esp_wifi_set_ps(wifi_ps_type_t type);
*
* @param[out] type: store current power save type
*
* @return ESP_ERR_WIFI_NOT_SUPPORT: not supported yet
* @return ESP_ERR_NOT_SUPPORTED: not supported yet
*/
esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
@ -460,7 +454,7 @@ esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_IF: invalid interface
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
@ -478,7 +472,7 @@ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_IF: invalid interface
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
@ -495,7 +489,7 @@ esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_IF: invalid interface
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
@ -512,7 +506,7 @@ esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_IF: invalid interface
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
@ -527,7 +521,7 @@ esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
@ -553,7 +547,7 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_set_country(const wifi_country_t *country);
@ -565,7 +559,7 @@ esp_err_t esp_wifi_set_country(const wifi_country_t *country);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_country(wifi_country_t *country);
@ -584,7 +578,7 @@ esp_err_t esp_wifi_get_country(wifi_country_t *country);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_WIFI_IF: invalid interface
* - ESP_ERR_WIFI_MAC: invalid mac address
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
@ -601,7 +595,7 @@ esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_WIFI_IF: invalid interface
*/
esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);
@ -648,7 +642,7 @@ esp_err_t esp_wifi_set_promiscuous(bool en);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_promiscuous(bool *en);
@ -673,7 +667,7 @@ esp_err_t esp_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filte
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
@ -691,7 +685,7 @@ esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_WIFI_IF: invalid interface
* - ESP_ERR_WIFI_MODE: invalid mode
* - ESP_ERR_WIFI_PASSWORD: invalid password
@ -709,7 +703,7 @@ esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_WIFI_IF: invalid interface
*/
esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
@ -724,7 +718,7 @@ esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
* - ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
*/
@ -741,7 +735,7 @@ esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_set_storage(wifi_storage_t storage);
@ -767,7 +761,7 @@ esp_err_t esp_wifi_set_auto_connect(bool en);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_auto_connect(bool *en);
@ -783,9 +777,9 @@ esp_err_t esp_wifi_get_auto_connect(bool *en);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init()
* - ESP_ERR_WIFI_ARG: Invalid argument, including if first byte of vnd_ie is not WIFI_VENDOR_IE_ELEMENT_ID (0xDD)
* - ESP_ERR_INVALID_ARG: Invalid argument, including if first byte of vnd_ie is not WIFI_VENDOR_IE_ELEMENT_ID (0xDD)
* or second byte is an invalid length.
* - ESP_ERR_WIFI_NO_MEM: Out of memory
* - ESP_ERR_NO_MEM: Out of memory
*/
esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie);
@ -871,7 +865,7 @@ esp_err_t esp_wifi_set_max_tx_power(int8_t power);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_max_tx_power(int8_t *power);

View File

@ -296,10 +296,20 @@ typedef struct {
esp_crypto_cipher_encrypt_t crypto_cipher_encrypt; /**< function used to encrypt cipher when use TLSV1 */
esp_crypto_cipher_decrypt_t crypto_cipher_decrypt; /**< function used to decrypt cipher when use TLSV1 */
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 */
esp_sha256_vector_t sha256_vector; /**< function used to do X.509v3 certificate parsing and processing */
} wpa2_crypto_funcs_t;
/**
* @brief The crypto callback function structure used in mesh vendor IE encryption. The
* structure can be set as software crypto or the crypto optimized by ESP32
* hardware.
*/
typedef struct{
esp_aes_128_encrypt_t aes_128_encrypt; /**< function used in mesh vendor IE encryption */
esp_aes_128_decrypt_t aes_128_decrypt; /**< function used in mesh vendor IE decryption */
} mesh_crypto_funcs_t;
#ifdef __cplusplus
}
#endif

View File

@ -55,7 +55,7 @@ extern "C" {
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NO_MEM: out of memory
* - ESP_ERR_NO_MEM: out of memory
* - others: refer to error code esp_err.h
*/
esp_err_t esp_wifi_init_internal(const wifi_init_config_t *config);

View File

@ -174,8 +174,9 @@ typedef struct {
}wifi_fast_scan_threshold_t;
typedef enum {
WIFI_PS_NONE, /**< No power save */
WIFI_PS_MODEM, /**< Modem power save */
WIFI_PS_NONE, /**< No power save */
WIFI_PS_MIN_MODEM, /**< Minimum modem power save. In this mode, station wakes up to receive beacon every DTIM period */
WIFI_PS_MAX_MODEM, /**< Maximum modem power save. In this mode, station wakes up to receive beacon every listen interval */
} wifi_ps_type_t;
#define WIFI_PROTOCOL_11B 1
@ -208,6 +209,7 @@ typedef struct {
bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8_t bssid[6]; /**< MAC address of target AP*/
uint8_t channel; /**< channel of target AP. Set to 1~13 to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.*/
uint16_t listen_interval; /**< Listen interval for ESP32 station to receive beacon in maximum power save mode, units: beacon interval */
wifi_sort_method_t sort_method; /**< sort the connect AP in the list by rssi or security mode */
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;

View File

@ -39,8 +39,8 @@ typedef struct {
* @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method.
*
* @return
* - ESP_ERR_WIFI_OK: succeed.
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
* - ESP_OK: succeed.
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
*/
esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t *config);
@ -51,7 +51,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t *config);
* @attention 2. wpa2 enterprise authentication can only support TLS, PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method.
*
* @return
* - ESP_ERR_WIFI_OK: succeed.
* - ESP_OK: succeed.
*/
esp_err_t esp_wifi_sta_wpa2_ent_disable(void);
@ -64,9 +64,9 @@ esp_err_t esp_wifi_sta_wpa2_ent_disable(void);
* @param len: length of identity, limited to 1~127
*
* @return
* - ESP_ERR_WIFI_OK: succeed
* - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128)
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
* - ESP_OK: succeed
* - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128)
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
*/
esp_err_t esp_wifi_sta_wpa2_ent_set_identity(const unsigned char *identity, int len);
@ -84,9 +84,9 @@ void esp_wifi_sta_wpa2_ent_clear_identity(void);
* @param len: length of username, limited to 1~127
*
* @return
* - ESP_ERR_WIFI_OK: succeed
* - ESP_ERR_WIFI_ARG: fail(len <= 0 or len >= 128)
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
* - ESP_OK: succeed
* - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128)
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
*/
esp_err_t esp_wifi_sta_wpa2_ent_set_username(const unsigned char *username, int len);
@ -104,9 +104,9 @@ void esp_wifi_sta_wpa2_ent_clear_username(void);
* @param len: length of password(len > 0)
*
* @return
* - ESP_ERR_WIFI_OK: succeed
* - ESP_ERR_WIFI_ARG: fail(len <= 0)
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
* - ESP_OK: succeed
* - ESP_ERR_INVALID_ARG: fail(len <= 0)
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
*/
esp_err_t esp_wifi_sta_wpa2_ent_set_password(const unsigned char *password, int len);
@ -125,9 +125,9 @@ void esp_wifi_sta_wpa2_ent_clear_password(void);
* @param len: length of password
*
* @return
* - ESP_ERR_WIFI_OK: succeed
* - ESP_ERR_WIFI_ARG: fail(len <= 0)
* - ESP_ERR_WIFI_NO_MEM: fail(internal memory malloc fail)
* - ESP_OK: succeed
* - ESP_ERR_INVALID_ARG: fail(len <= 0)
* - ESP_ERR_NO_MEM: fail(internal memory malloc fail)
*/
esp_err_t esp_wifi_sta_wpa2_ent_set_new_password(const unsigned char *password, int len);
@ -147,7 +147,7 @@ void esp_wifi_sta_wpa2_ent_clear_new_password(void);
* @param len: length of ca_cert
*
* @return
* - ESP_ERR_WIFI_OK: succeed
* - ESP_OK: succeed
*/
esp_err_t esp_wifi_sta_wpa2_ent_set_ca_cert(const unsigned char *ca_cert, int len);
@ -170,7 +170,7 @@ void esp_wifi_sta_wpa2_ent_clear_ca_cert(void);
* @param private_key_password_len: length of private key password;
*
* @return
* - ESP_ERR_WIFI_OK: succeed
* - ESP_OK: succeed
*/
esp_err_t esp_wifi_sta_wpa2_ent_set_cert_key(const unsigned char *client_cert, int client_cert_len, const unsigned char *private_key, int private_key_len, const unsigned char *private_key_passwd, int private_key_passwd_len);

View File

@ -77,7 +77,7 @@ typedef struct {
* - ESP_OK : succeed
* - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
* - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
* - ESP_ERR_WIFI_FAIL : wps initialization fails
* - ESP_FAIL : wps initialization fails
*/
esp_err_t esp_wifi_wps_enable(const esp_wps_config_t *config);
@ -106,7 +106,7 @@ esp_err_t esp_wifi_wps_disable(void);
* - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid
* - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
* - ESP_ERR_WIFI_WPS_SM : wps state machine is not initialized
* - ESP_ERR_WIFI_FAIL : wps initialization fails
* - ESP_FAIL : wps initialization fails
*/
esp_err_t esp_wifi_wps_start(int timeout_ms);

View File

@ -20,131 +20,130 @@ extern "C" {
#endif
#include <stdint.h>
#include "esp_err.h"
#include "driver/adc.h"
/** @cond */
#define ADC_CAL_GAIN_SCALE 16
#define ADC_CAL_OFFSET_SCALE 10
#define ADC_CAL_IDEAL_V_REF 1100 //In mV
#define ADC_CAL_LOW_V_REF 1000
#define ADC_CAL_HIGH_V_REF 1200
#define ADC_CAL_MIN 0
#define ADC_CAL_MAX 4095
/** @endcond */
/**
* @brief Type of calibration value used in characterization
*/
typedef enum {
ESP_ADC_CAL_VAL_EFUSE_VREF = 0, /**< Characterization based on reference voltage stored in eFuse*/
ESP_ADC_CAL_VAL_EFUSE_TP = 1, /**< Characterization based on Two Point values stored in eFuse*/
ESP_ADC_CAL_VAL_DEFAULT_VREF = 2, /**< Characterization based on default reference voltage*/
} esp_adc_cal_value_t;
/**
* @brief Structure storing Lookup Table
* @brief Structure storing characteristics of an ADC
*
* The Lookup Tables (LUT) of a given attenuation contains 33 equally spaced
* points. The Gain and Offset curves are used to find the appopriate gain and
* offset factor given a reference voltage v_ref.
*
* @note A seperate LUT is provided for each attenuation and are defined in
* esp_adc_cal_lookup_tables.c
* @note Call esp_adc_cal_characterize() to initialize the structure
*/
typedef struct {
uint32_t gain_m; /**<Gradient of Gain Curve */
uint32_t gain_c; /**<Offset of Gain Curve */
uint32_t offset_m; /**<Gradient of Offset Curve */
uint32_t offset_c; /**<Offset of Offset Curve */
uint32_t bit_shift; /**<Bit shift used find corresponding LUT points
given an ADC reading*/
uint32_t voltage[]; /**<Array of voltages in mV representing the
ADC-Voltage curve */
} esp_adc_cal_lookup_table_t;
/**
* @brief Structure storing ADC characteristics of given v_ref
*
* The ADC Characteristics structure stores the gain and offset factors of an
* ESP32 module's ADC. These factors are calculated using the reference voltage,
* and the Gain and Offset curves provided in the lookup tables.
*
* @note Call esp_adc_cal_get_characteristics() to initialize the structure
*
*/
typedef struct {
uint32_t v_ref; /**<Reference Voltage of current ESP32 Module in mV*/
uint32_t gain; /**<Scaling factor used to correct LUT voltages to
current v_ref. Bit shifted by << ADC_CAL_GAIN_SCALE
for uint32 arithmetic */
uint32_t offset; /**<Offset in mV used to correct LUT Voltages to current v_ref */
uint32_t ideal_offset; /**<Offset in mV at the ideal reference voltage */
adc_bits_width_t bit_width; /**<Bit width of ADC e.g. ADC_WIDTH_BIT_12 */
const esp_adc_cal_lookup_table_t *table; /**<Pointer to LUT */
adc_unit_t adc_num; /**< ADC number*/
adc_atten_t atten; /**< ADC attenuation*/
adc_bits_width_t bit_width; /**< ADC bit width */
uint32_t coeff_a; /**< Gradient of ADC-Voltage curve*/
uint32_t coeff_b; /**< Offset of ADC-Voltage curve*/
uint32_t vref; /**< Vref used by lookup table*/
const uint32_t *low_curve; /**< Pointer to low Vref curve of lookup table (NULL if unused)*/
const uint32_t *high_curve; /**< Pointer to high Vref curve of lookup table (NULL if unused)*/
} esp_adc_cal_characteristics_t;
extern const esp_adc_cal_lookup_table_t esp_adc_cal_table_atten_0; /**<LUT for atten0 */
extern const esp_adc_cal_lookup_table_t esp_adc_cal_table_atten_1; /**<LUT for atten1 */
extern const esp_adc_cal_lookup_table_t esp_adc_cal_table_atten_2; /**<LUT for atten2 */
extern const esp_adc_cal_lookup_table_t esp_adc_cal_table_atten_3; /**<LUT for atten3 */
/**
* @brief Checks if ADC calibration values are burned into eFuse
*
* This function checks if ADC reference voltage or Two Point values have been
* burned to the eFuse of the current ESP32
*
* @param value_type Type of calibration value (ESP_ADC_CAL_VAL_EFUSE_VREF or ESP_ADC_CAL_VAL_EFUSE_TP)
*
* @return
* - ESP_OK: The calibration mode is supported in eFuse
* - ESP_ERR_NOT_SUPPORTED: Error, eFuse values are not burned
* - ESP_ERR_INVALID_ARG: Error, invalid argument (ESP_ADC_CAL_VAL_DEFAULT_VREF)
*/
esp_err_t esp_adc_cal_check_efuse(esp_adc_cal_value_t value_type);
/**
* @brief Calculate characteristics of ADC
* @brief Characterize an ADC at a particular attenuation
*
* This function will calculate the gain and offset factors based on the
* reference voltage parameter and the Gain and Offset curve provided in the LUT.
* This function will characterize the ADC at a particular attenuation and generate
* the ADC-Voltage curve in the form of [y = coeff_a * x + coeff_b].
* Characterization can be based on Two Point values, eFuse Vref, or default Vref
* and the calibration values will be prioritized in that order.
*
* @note reference voltage of the ADCs can be routed to GPIO using
* adc2_vref_to_gpio() from the ADC driver
* @note Two Point values and eFuse Vref can be enabled/disabled using menuconfig.
*
* @note The LUT members have been bit shifted by ADC_CAL_GAIN_SCALE or
* ADC_CAL_OFFSET_SCALE to make them uint32_t compatible. This bit shifting will
* accounted for in this function
* @param[in] adc_num ADC to characterize (ADC_UNIT_1 or ADC_UNIT_2)
* @param[in] atten Attenuation to characterize
* @param[in] bit_width Bit width configuration of ADC
* @param[in] default_vref Default ADC reference voltage in mV (used if eFuse values is not available)
* @param[out] chars Pointer to empty structure used to store ADC characteristics
*
* @param[in] v_ref true reference voltage of the ADC in mV (1000 to 1200mV). Nominal
* value for reference voltage is 1100mV.
* @param[in] atten attenuation setting used to select the corresponding lookup table
* @param[in] bit_width bit width of ADC
* @param[out] chars pointer to structure used to store ADC characteristics of module
* @return
* - ESP_ADC_CAL_VAL_EFUSE_VREF: eFuse Vref used for characterization
* - ESP_ADC_CAL_VAL_EFUSE_TP: Two Point value used for characterization (only in Linear Mode)
* - ESP_ADC_CAL_VAL_DEFAULT_VREF: Default Vref used for characterization
*/
void esp_adc_cal_get_characteristics(uint32_t v_ref,
adc_atten_t atten,
adc_bits_width_t bit_width,
esp_adc_cal_characteristics_t *chars);
esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
adc_atten_t atten,
adc_bits_width_t bit_width,
uint32_t default_vref,
esp_adc_cal_characteristics_t *chars);
/**
* @brief Convert raw ADC reading to voltage in mV
* @brief Convert an ADC reading to voltage in mV
*
* This function converts a raw ADC reading to a voltage in mV. This conversion
* is based on the ADC's characteristics. The raw ADC reading is referenced
* against the LUT (pointed to inside characteristics struct) to obtain a voltage.
* Gain and offset factors are then applied to the voltage in order to obtain
* the final result.
* This function converts an ADC reading to a voltage in mV based on the ADC's
* characteristics.
*
* @param[in] adc ADC reading (different bit widths will be handled)
* @param[in] chars pointer to structure containing ADC characteristics of
* the module. Structure also contains pointer to the
* corresponding LUT
* @note Characteristics structure must be initialized before this function
* is called (call esp_adc_cal_characterize())
*
* @return Calculated voltage in mV
* @param[in] adc_reading ADC reading
* @param[in] chars Pointer to initialized structure containing ADC characteristics
*
* @note characteristics structure must be initialized using
* esp_adc_cal_get_characteristics() before this function is used
* @return Voltage in mV
*/
uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc,
const esp_adc_cal_characteristics_t *chars);
uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_characteristics_t *chars);
/**
* @brief Reads ADC1 and returns voltage in mV
* @brief Reads an ADC and converts the reading to a voltage in mV
*
* This function reads the ADC1 using adc1_get_raw() to obtain a raw ADC
* reading. The reading is then converted into a voltage value using
* esp_adc_cal_raw_to_voltage().
* This function reads an ADC then converts the raw reading to a voltage in mV
* based on the characteristics provided. The ADC that is read is also
* determined by the characteristics.
*
* @param[in] channel Channel of ADC1 to measure
* @param[in] chars Pointer to ADC characteristics struct
* @note The Characteristics structure must be initialized before this
* function is called (call esp_adc_cal_characterize())
*
* @return voltage Calculated voltage in mV
* @param[in] channel ADC Channel to read
* @param[in] chars Pointer to initialized ADC characteristics structure
* @param[out] voltage Pointer to store converted voltage
*
* @note ADC must be initialized using adc1_config_width() and
* adc1_config_channel_atten() before this function is used
*
* @note characteristics structure must be initialized using
* esp_adc_cal_get_characteristics() before this function is used
* @return
* - ESP_OK: ADC read and converted to mV
* - ESP_ERR_TIMEOUT: Error, timed out attempting to read ADC
* - ESP_ERR_INVALID_ARG: Error due to invalid arguments
*/
uint32_t adc1_to_voltage(adc1_channel_t channel, const esp_adc_cal_characteristics_t *chars);
esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel, const esp_adc_cal_characteristics_t *chars, uint32_t *voltage);
/* -------------------------- Deprecated API ------------------------------- */
/** @cond */ //Doxygen command to hide deprecated function from API Reference
/**
* @deprecated ADC1 characterization function. Deprecated in order to accommodate
* ADC2 and eFuse functionality. Use esp_adc_cal_characterize() instead
*/
void esp_adc_cal_get_characteristics(uint32_t vref, adc_atten_t atten, adc_bits_width_t bit_width, esp_adc_cal_characteristics_t *chars) __attribute__((deprecated));
/*
* @deprecated This function reads ADC1 and returns the corrected voltage. This
* has been deprecated in order to accommodate ADC2 support. Use the
* new function esp_adc_cal_get_voltage() instead.
*/
uint32_t adc1_to_voltage(adc1_channel_t channel, const esp_adc_cal_characteristics_t *chars) __attribute__((deprecated));
/** @endcond */
#ifdef __cplusplus
}

View File

@ -88,8 +88,26 @@ esp_err_t esp_vfs_fat_unregister_path(const char* base_path);
* @brief Configuration arguments for esp_vfs_fat_sdmmc_mount and esp_vfs_fat_spiflash_mount functions
*/
typedef struct {
bool format_if_mount_failed; ///< If FAT partition can not be mounted, and this parameter is true, create partition table and format the filesystem
/**
* If FAT partition can not be mounted, and this parameter is true,
* create partition table and format the filesystem.
*/
bool format_if_mount_failed;
int max_files; ///< Max number of open files
/**
* If format_if_mount_failed is set, and mount fails, format the card
* with given allocation unit size. Must be a power of 2, between sector
* size and 128 * sector size.
* For SD cards, sector size is always 512 bytes. For wear_levelling,
* sector size is determined by CONFIG_WL_SECTOR_SIZE option.
*
* Using larger allocation unit size will result in higher read/write
* performance and higher overhead when storing small files.
*
* Setting this field to 0 will result in allocation unit set to the
* sector size.
*/
size_t allocation_unit_size;
} esp_vfs_fat_mount_config_t;
// Compatibility definition

View File

@ -129,7 +129,13 @@
/ ff_memfree() in ffsystem.c, need to be added to the project. */
#define FF_LFN_UNICODE 0
#ifdef CONFIG_FATFS_API_ENCODING_UTF_8
#define FF_LFN_UNICODE 2
#elif defined(CONFIG_FATFS_API_ENCODING_UTF_16)
#define FF_LFN_UNICODE 1
#else /* CONFIG_FATFS_API_ENCODING_ANSI_OEM */
#define FF_LFN_UNICODE 0
#endif
/* This option switches the character encoding on the API when LFN is enabled.
/
/ 0: ANSI/OEM in current CP (TCHAR = char)
@ -148,7 +154,7 @@
/ on character encoding. When LFN is not enabled, these options have no effect. */
#define FF_STRF_ENCODE 3
#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

View File

@ -0,0 +1,30 @@
// Copyright 2018 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
#include "esp_vfs_fat.h"
#include <sys/param.h>
#include <stddef.h>
static inline size_t esp_vfs_fat_get_allocation_unit_size(
size_t sector_size, size_t requested_size)
{
size_t alloc_unit_size = requested_size;
const size_t max_sectors_per_cylinder = 128;
const size_t max_size = sector_size * max_sectors_per_cylinder;
alloc_unit_size = MAX(alloc_unit_size, sector_size);
alloc_unit_size = MIN(alloc_unit_size, max_size);
return alloc_unit_size;
}

View File

@ -183,6 +183,12 @@ void vPortSetStackWatchpoint( void* pxStackStart );
*/
BaseType_t xPortInIsrContext();
/*
* This function will be called in High prio ISRs. Returns true if the current core was in ISR context
* before calling into high prio ISR context.
*/
BaseType_t xPortInterruptedFromISRContext();
/*
* The structures and methods of manipulating the MPU are contained within the
* port layer.
@ -213,5 +219,7 @@ uint32_t xPortGetTickRateHz(void);
}
#endif
void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set);
#endif /* PORTABLE_H */

View File

@ -380,6 +380,9 @@ is used in assert() statements. */
* @return pdPASS if the task was successfully created and added to a ready
* list, otherwise an error code defined in the file projdefs.h
*
* @note If program uses thread local variables (ones specified with "__thread" keyword)
* then storage for them will be allocated on the task's stack.
*
* Example usage:
* @code{c}
* // Task to be created.
@ -530,6 +533,9 @@ is used in assert() statements. */
* are NULL then the task will not be created and
* errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY is returned.
*
* @note If program uses thread local variables (ones specified with "__thread" keyword)
* then storage for them will be allocated on the task's stack.
*
* Example usage:
* @code{c}
*

View File

@ -0,0 +1,98 @@
// Copyright 2018 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
#ifdef CONFIG_HEAP_TASK_TRACKING
#ifdef __cplusplus
extern "C" {
#endif
// This macro controls how much space is provided for partitioning the per-task
// heap allocation info according to one or more sets of heap capabilities.
#define NUM_HEAP_TASK_CAPS 4
/** @brief Structure to collect per-task heap allocation totals partitioned by selected caps */
typedef struct {
TaskHandle_t task; ///< Task to which these totals belong
size_t size[NUM_HEAP_TASK_CAPS]; ///< Total allocations partitioned by selected caps
size_t count[NUM_HEAP_TASK_CAPS]; ///< Number of blocks partitioned by selected caps
} heap_task_totals_t;
/** @brief Structure providing details about a block allocated by a task */
typedef struct {
TaskHandle_t task; ///< Task that allocated the block
void *address; ///< User address of allocated block
uint32_t size; ///< Size of the allocated block
} heap_task_block_t;
/** @brief Structure to provide parameters to heap_caps_get_per_task_info
*
* The 'caps' and 'mask' arrays allow partitioning the per-task heap allocation
* totals by selected sets of heap region capabilities so that totals for
* multiple regions can be accumulated in one scan. The capabilities flags for
* each region ANDed with mask[i] are compared to caps[i] in order; the
* allocations in that region are added to totals->size[i] and totals->count[i]
* for the first i that matches. To collect the totals without any
* partitioning, set mask[0] and caps[0] both to zero. The allocation totals
* are returned in the 'totals' array of heap_task_totals_t structs. To allow
* easily comparing the totals array between consecutive calls, that array can
* be left populated from one call to the next so the order of tasks is the
* same even if some tasks have freed their blocks or have been deleted. The
* number of blocks prepopulated is given by num_totals, which is updated upon
* return. If there are more tasks with allocations than the capacity of the
* totals array (given by max_totals), information for the excess tasks will be
* not be collected. The totals array pointer can be NULL if the totals are
* not desired.
*
* The 'tasks' array holds a list of handles for tasks whose block details are
* to be returned in the 'blocks' array of heap_task_block_t structs. If the
* tasks array pointer is NULL, block details for all tasks will be returned up
* to the capacity of the buffer array, given by max_blocks. The function
* return value tells the number of blocks filled into the array. The blocks
* array pointer can be NULL if block details are not desired, or max_blocks
* can be set to zero.
*/
typedef struct {
int32_t caps[NUM_HEAP_TASK_CAPS]; ///< Array of caps for partitioning task totals
int32_t mask[NUM_HEAP_TASK_CAPS]; ///< Array of masks under which caps must match
TaskHandle_t *tasks; ///< Array of tasks whose block info is returned
size_t num_tasks; ///< Length of tasks array
heap_task_totals_t *totals; ///< Array of structs to collect task totals
size_t *num_totals; ///< Number of task structs currently in array
size_t max_totals; ///< Capacity of array of task totals structs
heap_task_block_t *blocks; ///< Array of task block details structs
size_t max_blocks; ///< Capacity of array of task block info structs
} heap_task_info_params_t;
/**
* @brief Return per-task heap allocation totals and lists of blocks.
*
* For each task that has allocated memory from the heap, return totals for
* allocations within regions matching one or more sets of capabilities.
*
* Optionally also return an array of structs providing details about each
* block allocated by one or more requested tasks, or by all tasks.
*
* @param params Structure to hold all the parameters for the function
* (@see heap_task_info_params_t).
* @return Number of block detail structs returned (@see heap_task_block_t).
*/
extern size_t heap_caps_get_per_task_info(heap_task_info_params_t *params);
#ifdef __cplusplus
}
#endif
#endif // CONFIG_HEAP_TASK_TRACKING

View File

@ -30,8 +30,8 @@ extern "C"
/* project version */
#define CJSON_VERSION_MAJOR 1
#define CJSON_VERSION_MINOR 6
#define CJSON_VERSION_PATCH 0
#define CJSON_VERSION_MINOR 7
#define CJSON_VERSION_PATCH 1
#include <stddef.h>
@ -165,6 +165,9 @@ CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *st
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
/* Check if the item is a string and return its valuestring */
CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item);
/* These functions check the type of an item */
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
@ -189,6 +192,14 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
/* Create a string where valuestring references a string so
* it will not be freed by cJSON_Delete */
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
/* Create an object/arrray that only references it's elements so
* they will not be freed by cJSON_Delete */
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
/* These utilities create an Array of count items. */
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
@ -234,14 +245,17 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons
CJSON_PUBLIC(void) cJSON_Minify(char *json);
/* Macros for creating things quickly. */
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
#define cJSON_AddRawToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateRaw(s))
/* Helper functions for creating and adding items to an object at the same time.
* They return the added item or NULL on failure. */
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))

View File

@ -120,8 +120,12 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
* @param level level of the log
*
*/
#define ESP_LOG_BUFFER_HEX_LEVEL( tag, buffer, buff_len, level ) do {\
if ( LOG_LOCAL_LEVEL >= level ) esp_log_buffer_hex_internal( tag, buffer, buff_len, level ); } while(0)
#define ESP_LOG_BUFFER_HEX_LEVEL( tag, buffer, buff_len, level ) \
do {\
if ( LOG_LOCAL_LEVEL >= (level) ) { \
esp_log_buffer_hex_internal( tag, buffer, buff_len, level ); \
} \
} while(0)
/**
* @brief Log a buffer of characters at specified level, separated into 16 bytes each line. Buffer should contain only printable characters.
@ -135,8 +139,12 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
* @param level level of the log
*
*/
#define ESP_LOG_BUFFER_CHAR_LEVEL( tag, buffer, buff_len, level ) do {\
if ( LOG_LOCAL_LEVEL >= level ) esp_log_buffer_char_internal( tag, buffer, buff_len, level ); } while(0)
#define ESP_LOG_BUFFER_CHAR_LEVEL( tag, buffer, buff_len, level ) \
do {\
if ( LOG_LOCAL_LEVEL >= (level) ) { \
esp_log_buffer_char_internal( tag, buffer, buff_len, level ); \
} \
} while(0)
/**
* @brief Dump a buffer to the log at specified level.
@ -157,11 +165,13 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
*
* @param level level of the log
*/
#define ESP_LOG_BUFFER_HEXDUMP( tag, buffer, buff_len, level ) do {\
if ( LOG_LOCAL_LEVEL >= level ) esp_log_buffer_hexdump_internal( tag, buffer, buff_len, level); } while(0)
#define ESP_LOG_BUFFER_HEXDUMP( tag, buffer, buff_len, level ) \
do { \
if ( LOG_LOCAL_LEVEL >= (level) ) { \
esp_log_buffer_hexdump_internal( tag, buffer, buff_len, level); \
} \
} while(0)
#if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO)
/**
* @brief Log a buffer of hex bytes at Info level
*
@ -174,7 +184,12 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
* @see ``esp_log_buffer_hex_level``
*
*/
#define ESP_LOG_BUFFER_HEX(tag, buffer, buff_len) ESP_LOG_BUFFER_HEX_LEVEL( tag, buffer, buff_len, ESP_LOG_INFO )
#define ESP_LOG_BUFFER_HEX(tag, buffer, buff_len) \
do { \
if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { \
ESP_LOG_BUFFER_HEX_LEVEL( tag, buffer, buff_len, ESP_LOG_INFO ); \
}\
} while(0)
/**
* @brief Log a buffer of characters at Info level. Buffer should contain only printable characters.
@ -188,12 +203,13 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
* @see ``esp_log_buffer_char_level``
*
*/
#define ESP_LOG_BUFFER_CHAR(tag, buffer, buff_len) ESP_LOG_BUFFER_CHAR_LEVEL( tag, buffer, buff_len, ESP_LOG_INFO )
#define ESP_LOG_BUFFER_CHAR(tag, buffer, buff_len) \
do { \
if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { \
ESP_LOG_BUFFER_CHAR_LEVEL( tag, buffer, buff_len, ESP_LOG_INFO ); \
}\
} while(0)
#else
#define ESP_LOG_BUFFER_HEX(tag, buffer, buff_len) {}
#define ESP_LOG_BUFFER_CHAR(tag, buffer, buff_len) {}
#endif
//to be back compatible
#define esp_log_buffer_hex ESP_LOG_BUFFER_HEX

View File

@ -39,6 +39,7 @@
#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
#include <stddef.h> /* for size_t */
#include <string.h> /* for FD_ZERO */
#include "lwip/ip_addr.h"
#include "lwip/err.h"

View File

@ -727,6 +727,12 @@
#define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__)
#define ESP_PING 1
#if CONFIG_LWIP_IRAM_OPTIMIZATION
#define ESP_IRAM_ATTR IRAM_ATTR
#else
#define ESP_IRAM_ATTR
#endif
#define TCP_WND_DEFAULT CONFIG_TCP_WND_DEFAULT
#define TCP_SND_BUF_DEFAULT CONFIG_TCP_SND_BUF_DEFAULT

View File

@ -29,7 +29,6 @@ typedef void X509_STORE;
typedef void RSA;
typedef void STACK;
typedef void BIO;
#define ossl_inline inline
@ -84,6 +83,9 @@ typedef struct pkey_method_st PKEY_METHOD;
struct ssl_alpn_st;
typedef struct ssl_alpn_st SSL_ALPN;
struct bio_st;
typedef struct bio_st BIO;
struct stack_st {
char **data;
@ -106,6 +108,8 @@ struct x509_st {
void *x509_pm;
const X509_METHOD *method;
int ref_counter;
};
struct cert_st {
@ -147,6 +151,11 @@ struct X509_VERIFY_PARAM_st {
};
struct bio_st {
const unsigned char * data;
int dlen;
};
typedef enum { ALPN_INIT, ALPN_ENABLE, ALPN_DISABLE, ALPN_ERROR } ALPN_STATUS;
struct ssl_alpn_st {
ALPN_STATUS alpn_status;

View File

@ -101,6 +101,73 @@ int SSL_add_client_CA(SSL *ssl, X509 *x);
*/
int SSL_use_certificate_ASN1(SSL *ssl, int len, const unsigned char *d);
/**
* @brief set SSL context client CA certification
*
* @param store - pointer to X509_STORE
* @param x - pointer to X509 certification point
*
* @return result
* 0 : failed
* 1 : OK
*/
int X509_STORE_add_cert(X509_STORE *store, X509 *x);
/**
* @brief load data in BIO
*
* Normally BIO_write should append data but that doesn't happen here, and
* 'data' cannot be freed after the function is called, it should remain valid
* until BIO object is in use.
*
* @param b - pointer to BIO
* @param data - pointer to data
* @param dlen - data bytes
*
* @return result
* 0 : failed
* 1 : OK
*/
int BIO_write(BIO *b, const void *data, int dlen);
/**
* @brief load a character certification context into system context.
*
* If '*cert' is pointed to the certification, then load certification
* into it, or create a new X509 certification object.
*
* @param bp - pointer to BIO
* @param buffer - pointer to the certification context memory
* @param cb - pointer to a callback which queries pass phrase used
for encrypted PEM structure
* @param u - pointer to arbitary data passed by application to callback
*
* @return X509 certification object point
*/
X509 * PEM_read_bio_X509(BIO *bp, X509 **x, void *cb, void *u);
/**
* @brief create a BIO object
*
* @param method - pointer to BIO_METHOD
*
* @return pointer to BIO object
*/
BIO *BIO_new(void * method);
/**
* @brief get the memory BIO method function
*/
void *BIO_s_mem();
/**
* @brief free a BIO object
*
* @param x - pointer to BIO object
*/
void BIO_free(BIO *b);
#ifdef __cplusplus
}
#endif

View File

@ -79,21 +79,33 @@
#define EFUSE_RD_WIFI_MAC_CRC_HIGH_S 0
#define EFUSE_BLK0_RDATA3_REG (DR_REG_EFUSE_BASE + 0x00c)
/* EFUSE_RD_CHIP_VER_REV1 : R/W ;bitpos:[16] ;default: 1'b0 ; */
/* EFUSE_RD_CHIP_VER_REV1 : R/W ;bitpos:[15] ;default: 1'b0 ; */
/*description: bit is set to 1 for rev1 silicon*/
#define EFUSE_RD_CHIP_VER_REV1 (BIT(15))
#define EFUSE_RD_CHIP_VER_REV1_M ((EFUSE_RD_CHIP_VER_REV1_V)<<(EFUSE_RD_CHIP_VER_REV1_S))
#define EFUSE_RD_CHIP_VER_REV1_V 0x1
#define EFUSE_RD_CHIP_VER_REV1_S 15
/* EFUSE_RD_CHIP_VER_RESERVE : R/W ;bitpos:[15:12] ;default: 3'b0 ; */
/*description: */
#define EFUSE_RD_CHIP_VER_RESERVE 0x00000007
#define EFUSE_RD_CHIP_VER_RESERVE_M ((EFUSE_RD_CHIP_VER_RESERVE_V)<<(EFUSE_RD_CHIP_VER_RESERVE_S))
#define EFUSE_RD_CHIP_VER_RESERVE_V 0x7
#define EFUSE_RD_CHIP_VER_RESERVE_S 12
/* EFUSE_RD_CHIP_VER : R/W ;bitpos:[11:9] ;default: 3'b0 ; */
/* EFUSE_RD_BLK3_PART_RESERVE : R/W ; bitpos:[14] ; default: 1'b0; */
/*description: If set, this bit indicates that BLOCK3[143:96] is reserved for internal use*/
#define EFUSE_RD_BLK3_PART_RESERVE (BIT(14))
#define EFUSE_RD_BLK3_PART_RESERVE_M ((EFUSE_RD_BLK3_PART_RESERVE_V)<<(EFUSE_RD_BLK3_PART_RESERVE_S))
#define EFUSE_RD_BLK3_PART_RESERVE_V 0x1
#define EFUSE_RD_BLK3_PART_RESERVE_S 14
/* EFUSE_RD_CHIP_CPU_FREQ_RATED : R/W ;bitpos:[13] ;default: 1'b0 ; */
/*description: If set, the ESP32's maximum CPU frequency has been rated*/
#define EFUSE_RD_CHIP_CPU_FREQ_RATED (BIT(13))
#define EFUSE_RD_CHIP_CPU_FREQ_RATED_M ((EFUSE_RD_CHIP_CPU_FREQ_RATED_V)<<(EFUSE_RD_CHIP_CPU_FREQ_RATED_S))
#define EFUSE_RD_CHIP_CPU_FREQ_RATED_V 0x1
#define EFUSE_RD_CHIP_CPU_FREQ_RATED_S 13
/* EFUSE_RD_CHIP_CPU_FREQ_LOW : R/W ;bitpos:[12] ;default: 1'b0 ; */
/*description: If set alongside EFUSE_RD_CHIP_CPU_FREQ_RATED, the ESP32's max CPU frequency is rated for 160MHz. 240MHz otherwise*/
#define EFUSE_RD_CHIP_CPU_FREQ_LOW (BIT(12))
#define EFUSE_RD_CHIP_CPU_FREQ_LOW_M ((EFUSE_RD_CHIP_CPU_FREQ_LOW_V)<<(EFUSE_RD_CHIP_CPU_FREQ_LOW_S))
#define EFUSE_RD_CHIP_CPU_FREQ_LOW_V 0x1
#define EFUSE_RD_CHIP_CPU_FREQ_LOW_S 12
/* EFUSE_RD_CHIP_VER_PKG : R/W ;bitpos:[11:9] ;default: 3'b0 ; */
/*description: chip package */
#define EFUSE_RD_CHIP_VER 0x00000007
#define EFUSE_RD_CHIP_VER_PKG 0x00000007
#define EFUSE_RD_CHIP_VER_PKG_M ((EFUSE_RD_CHIP_VER_PKG_V)<<(EFUSE_RD_CHIP_VER_PKG_S))
#define EFUSE_RD_CHIP_VER_PKG_V 0x7
#define EFUSE_RD_CHIP_VER_PKG_S 9
@ -152,6 +164,15 @@
#define EFUSE_RD_XPD_SDIO_REG_M (BIT(14))
#define EFUSE_RD_XPD_SDIO_REG_V 0x1
#define EFUSE_RD_XPD_SDIO_REG_S 14
/* EFUSE_RD_ADC_VREF : R/W ;bitpos:[12:8] ;default: 5'b0 ; */
/*description: True ADC reference voltage */
#define EFUSE_RD_ADC_VREF 0x0000001F
#define EFUSE_RD_ADC_VREF_M ((EFUSE_RD_ADC_VREF_V)<<(EFUSE_RD_ADC_VREF_S))
#define EFUSE_RD_ADC_VREF_V 0x1F
#define EFUSE_RD_ADC_VREF_S 8
/* Note: EFUSE_ADC_VREF and SDIO_DREFH/M/L share the same address space. Newer
* versions of ESP32 come with EFUSE_ADC_VREF already burned, therefore
* SDIO_DREFH/M/L is only available in older versions of ESP32 */
/* EFUSE_RD_SDIO_DREFL : RO ;bitpos:[13:12] ;default: 2'b0 ; */
/*description: */
#define EFUSE_RD_SDIO_DREFL 0x00000003
@ -314,24 +335,41 @@
#define EFUSE_WIFI_MAC_CRC_HIGH_S 0
#define EFUSE_BLK0_WDATA3_REG (DR_REG_EFUSE_BASE + 0x028)
/* EFUSE_CHIP_VER_REV1 : R/W ;bitpos:[16] ;default: 1'b0 ; */
/* EFUSE_CHIP_VER_REV1 : R/W ;bitpos:[15] ;default: 1'b0 ; */
/*description: */
#define EFUSE_CHIP_VER_REV1 (BIT(15))
#define EFUSE_CHIP_VER_REV1_M ((EFUSE_CHIP_VER_REV1_V)<<(EFUSE_CHIP_VER_REV1_S))
#define EFUSE_CHIP_VER_REV1_V 0x1
#define EFUSE_CHIP_VER_REV1_S 15
/* EFUSE_CHIP_VER_RESERVE : R/W ;bitpos:[15:12] ;default: 3'b0 ; */
/*description: */
#define EFUSE_CHIP_VER_RESERVE 0x00000007
#define EFUSE_CHIP_VER_RESERVE_M ((EFUSE_CHIP_VER_RESERVE_V)<<(EFUSE_CHIP_VER_RESERVE_S))
#define EFUSE_CHIP_VER_RESERVE_V 0x7
#define EFUSE_CHIP_VER_RESERVE_S 12
/* EFUSE_CHIP_VER : R/W ;bitpos:[11:9] ;default: 3'b0 ; */
/* EFUSE_BLK3_PART_RESERVE : R/W ; bitpos:[14] ; default: 1'b0; */
/*description: If set, this bit indicates that BLOCK3[143:96] is reserved for internal use*/
#define EFUSE_BLK3_PART_RESERVE (BIT(14))
#define EFUSE_BLK3_PART_RESERVE_M ((EFUSE_BLK3_PART_RESERVE_V)<<(EFUSE_BLK3_PART_RESERVE_S))
#define EFUSE_BLK3_PART_RESERVE_V 0x1
#define EFUSE_BLK3_PART_RESERVE_S 14
/* EFUSE_CHIP_CPU_FREQ_RATED : R/W ;bitpos:[13] ;default: 1'b0 ; */
/*description: If set, the ESP32's maximum CPU frequency has been rated*/
#define EFUSE_CHIP_CPU_FREQ_RATED (BIT(13))
#define EFUSE_CHIP_CPU_FREQ_RATED_M ((EFUSE_CHIP_CPU_FREQ_RATED_V)<<(EFUSE_CHIP_CPU_FREQ_RATED_S))
#define EFUSE_CHIP_CPU_FREQ_RATED_V 0x1
#define EFUSE_CHIP_CPU_FREQ_RATED_S 13
/* EFUSE_CHIP_CPU_FREQ_LOW : R/W ;bitpos:[12] ;default: 1'b0 ; */
/*description: If set alongside EFUSE_CHIP_CPU_FREQ_RATED, the ESP32's max CPU frequency is rated for 160MHz. 240MHz otherwise*/
#define EFUSE_CHIP_CPU_FREQ_LOW (BIT(12))
#define EFUSE_CHIP_CPU_FREQ_LOW_M ((EFUSE_CHIP_CPU_FREQ_LOW_V)<<(EFUSE_CHIP_CPU_FREQ_LOW_S))
#define EFUSE_CHIP_CPU_FREQ_LOW_V 0x1
#define EFUSE_CHIP_CPU_FREQ_LOW_S 12
/* EFUSE_CHIP_VER_PKG : R/W ;bitpos:[11:9] ;default: 3'b0 ; */
/*description: */
#define EFUSE_CHIP_VER_PKG 0x00000007
#define EFUSE_CHIP_VER_PKG_M ((EFUSE_CHIP_VER_PKG_V)<<(EFUSE_CHIP_VER_PKG_S))
#define EFUSE_CHIP_VER_PKG_V 0x7
#define EFUSE_CHIP_VER_PKG_S 9
#define EFUSE_CHIP_VER_PKG_ESP32D0WDQ6 0
#define EFUSE_CHIP_VER_PKG_ESP32D0WDQ5 1
#define EFUSE_CHIP_VER_PKG_ESP32D2WDQ5 2
#define EFUSE_CHIP_VER_PKG_ESP32PICOD2 4
#define EFUSE_CHIP_VER_PKG_ESP32PICOD4 5
/* EFUSE_SPI_PAD_CONFIG_HD : R/W ;bitpos:[8:4] ;default: 5'b0 ; */
/*description: program for SPI_pad_config_hd*/
#define EFUSE_SPI_PAD_CONFIG_HD 0x0000001F
@ -382,6 +420,15 @@
#define EFUSE_XPD_SDIO_REG_M (BIT(14))
#define EFUSE_XPD_SDIO_REG_V 0x1
#define EFUSE_XPD_SDIO_REG_S 14
/* EFUSE_ADC_VREF : R/W ;bitpos:[12:8] ;default: 5'b0 ; */
/*description: True ADC reference voltage */
#define EFUSE_ADC_VREF 0x0000001F
#define EFUSE_ADC_VREF_M ((EFUSE_ADC_VREF_V)<<(EFUSE_ADC_VREF_S))
#define EFUSE_ADC_VREF_V 0x1F
#define EFUSE_ADC_VREF_S 8
/* Note: EFUSE_ADC_VREF and SDIO_DREFH/M/L share the same address space. Newer
* versions of ESP32 come with EFUSE_ADC_VREF already burned, therefore
* SDIO_DREFH/M/L is only available in older versions of ESP32 */
/* EFUSE_SDIO_DREFL : R/W ;bitpos:[13:12] ;default: 2'b0 ; */
/*description: */
#define EFUSE_SDIO_DREFL 0x00000003
@ -659,6 +706,8 @@
#define EFUSE_BLK3_DOUT2_V 0xFFFFFFFF
#define EFUSE_BLK3_DOUT2_S 0
/* Note: Newer ESP32s utilize BLK3_DATA3 and parts of BLK3_DATA4 for calibration
* purposes. This usage is indicated by the EFUSE_RD_BLK3_PART_RESERVE bit.*/
#define EFUSE_BLK3_RDATA3_REG (DR_REG_EFUSE_BASE + 0x084)
/* EFUSE_BLK3_DOUT3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */
/*description: read for BLOCK3*/
@ -666,6 +715,30 @@
#define EFUSE_BLK3_DOUT3_M ((EFUSE_BLK3_DOUT3_V)<<(EFUSE_BLK3_DOUT3_S))
#define EFUSE_BLK3_DOUT3_V 0xFFFFFFFF
#define EFUSE_BLK3_DOUT3_S 0
/* EFUSE_RD_ADC2_TP_HIGH : R/W ;bitpos:[31:23] ;default: 9'b0 ; */
/*description: ADC2 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_RD_ADC2_TP_HIGH 0x1FF
#define EFUSE_RD_ADC2_TP_HIGH_M ((EFUSE_RD_ADC2_TP_HIGH_V)<<(EFUSE_RD_ADC2_TP_HIGH_S))
#define EFUSE_RD_ADC2_TP_HIGH_V 0x1FF
#define EFUSE_RD_ADC2_TP_HIGH_S 23
/* EFUSE_RD_ADC2_TP_LOW : R/W ;bitpos:[22:16] ;default: 7'b0 ; */
/*description: ADC2 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_RD_ADC2_TP_LOW 0x7F
#define EFUSE_RD_ADC2_TP_LOW_M ((EFUSE_RD_ADC2_TP_LOW_V)<<(EFUSE_RD_ADC2_TP_LOW_S))
#define EFUSE_RD_ADC2_TP_LOW_V 0x7F
#define EFUSE_RD_ADC2_TP_LOW_S 16
/* EFUSE_RD_ADC1_TP_HIGH : R/W ;bitpos:[15:7] ;default: 9'b0 ; */
/*description: ADC1 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_RD_ADC1_TP_HIGH 0x1FF
#define EFUSE_RD_ADC1_TP_HIGH_M ((EFUSE_RD_ADC1_TP_HIGH_V)<<(EFUSE_RD_ADC1_TP_HIGH_S))
#define EFUSE_RD_ADC1_TP_HIGH_V 0x1FF
#define EFUSE_RD_ADC1_TP_HIGH_S 7
/* EFUSE_RD_ADC1_TP_LOW : R/W ;bitpos:[6:0] ;default: 7'b0 ; */
/*description: ADC1 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_RD_ADC1_TP_LOW 0x7F
#define EFUSE_RD_ADC1_TP_LOW_M ((EFUSE_RD_ADC1_TP_LOW_V)<<(EFUSE_RD_ADC1_TP_LOW_S))
#define EFUSE_RD_ADC1_TP_LOW_V 0x7F
#define EFUSE_RD_ADC1_TP_LOW_S 0
#define EFUSE_BLK3_RDATA4_REG (DR_REG_EFUSE_BASE + 0x088)
/* EFUSE_BLK3_DOUT4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */
@ -674,6 +747,12 @@
#define EFUSE_BLK3_DOUT4_M ((EFUSE_BLK3_DOUT4_V)<<(EFUSE_BLK3_DOUT4_S))
#define EFUSE_BLK3_DOUT4_V 0xFFFFFFFF
#define EFUSE_BLK3_DOUT4_S 0
/* EFUSE_RD_CAL_RESERVED: R/W ; bitpos:[0:15] ; default : 16'h0 ; */
/*description: Reserved for future calibration use. Indicated by EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_RD_CAL_RESERVED 0x0000FFFF
#define EFUSE_RD_CAL_RESERVED_M ((EFUSE_RD_CAL_RESERVED_V)<<(EFUSE_RD_CAL_RESERVED_S))
#define EFUSE_RD_CAL_RESERVED_V 0xFFFF
#define EFUSE_RD_CAL_RESERVED_S 0
#define EFUSE_BLK3_RDATA5_REG (DR_REG_EFUSE_BASE + 0x08c)
/* EFUSE_BLK3_DOUT5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */
@ -851,6 +930,8 @@
#define EFUSE_BLK3_DIN2_V 0xFFFFFFFF
#define EFUSE_BLK3_DIN2_S 0
/* Note: Newer ESP32s utilize BLK3_DATA3 and parts of BLK3_DATA4 for calibration
* purposes. This usage is indicated by the EFUSE_RD_BLK3_PART_RESERVE bit.*/
#define EFUSE_BLK3_WDATA3_REG (DR_REG_EFUSE_BASE + 0x0e4)
/* EFUSE_BLK3_DIN3 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */
/*description: program for BLOCK3*/
@ -858,6 +939,30 @@
#define EFUSE_BLK3_DIN3_M ((EFUSE_BLK3_DIN3_V)<<(EFUSE_BLK3_DIN3_S))
#define EFUSE_BLK3_DIN3_V 0xFFFFFFFF
#define EFUSE_BLK3_DIN3_S 0
/* EFUSE_ADC2_TP_HIGH : R/W ;bitpos:[31:23] ;default: 9'b0 ; */
/*description: ADC2 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_ADC2_TP_HIGH 0x1FF
#define EFUSE_ADC2_TP_HIGH_M ((EFUSE_ADC2_TP_HIGH_V)<<(EFUSE_ADC2_TP_HIGH_S))
#define EFUSE_ADC2_TP_HIGH_V 0x1FF
#define EFUSE_ADC2_TP_HIGH_S 23
/* EFUSE_ADC2_TP_LOW : R/W ;bitpos:[22:16] ;default: 7'b0 ; */
/*description: ADC2 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_ADC2_TP_LOW 0x7F
#define EFUSE_ADC2_TP_LOW_M ((EFUSE_ADC2_TP_LOW_V)<<(EFUSE_ADC2_TP_LOW_S))
#define EFUSE_ADC2_TP_LOW_V 0x7F
#define EFUSE_ADC2_TP_LOW_S 16
/* EFUSE_ADC1_TP_HIGH : R/W ;bitpos:[15:7] ;default: 9'b0 ; */
/*description: ADC1 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_ADC1_TP_HIGH 0x1FF
#define EFUSE_ADC1_TP_HIGH_M ((EFUSE_ADC1_TP_HIGH_V)<<(EFUSE_ADC1_TP_HIGH_S))
#define EFUSE_ADC1_TP_HIGH_V 0x1FF
#define EFUSE_ADC1_TP_HIGH_S 7
/* EFUSE_ADC1_TP_LOW : R/W ;bitpos:[6:0] ;default: 7'b0 ; */
/*description: ADC1 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE */
#define EFUSE_ADC1_TP_LOW 0x7F
#define EFUSE_ADC1_TP_LOW_M ((EFUSE_ADC1_TP_LOW_V)<<(EFUSE_ADC1_TP_LOW_S))
#define EFUSE_ADC1_TP_LOW_V 0x7F
#define EFUSE_ADC1_TP_LOW_S 0
#define EFUSE_BLK3_WDATA4_REG (DR_REG_EFUSE_BASE + 0x0e8)
/* EFUSE_BLK3_DIN4 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */
@ -866,6 +971,12 @@
#define EFUSE_BLK3_DIN4_M ((EFUSE_BLK3_DIN4_V)<<(EFUSE_BLK3_DIN4_S))
#define EFUSE_BLK3_DIN4_V 0xFFFFFFFF
#define EFUSE_BLK3_DIN4_S 0
/* EFUSE_CAL_RESERVED: R/W ; bitpos:[0:15] ; default : 16'h0 ; */
/*description: Reserved for future calibration use. Indicated by EFUSE_BLK3_PART_RESERVE */
#define EFUSE_CAL_RESERVED 0x0000FFFF
#define EFUSE_CAL_RESERVED_M ((EFUSE_CAL_RESERVED_V)<<(EFUSE_CAL_RESERVED_S))
#define EFUSE_CAL_RESERVED_V 0xFFFF
#define EFUSE_CAL_RESERVED_S 0
#define EFUSE_BLK3_WDATA5_REG (DR_REG_EFUSE_BASE + 0x0ec)
/* EFUSE_BLK3_DIN5 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */

View File

@ -124,18 +124,21 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define CLK_OUT1_S 0
#define PERIPHS_IO_MUX_GPIO0_U (DR_REG_IO_MUX_BASE +0x44)
#define IO_MUX_GPIO0_REG PERIPHS_IO_MUX_GPIO0_U
#define FUNC_GPIO0_EMAC_TX_CLK 5
#define FUNC_GPIO0_GPIO0 2
#define FUNC_GPIO0_CLK_OUT1 1
#define FUNC_GPIO0_GPIO0_0 0
#define PERIPHS_IO_MUX_U0TXD_U (DR_REG_IO_MUX_BASE +0x88)
#define IO_MUX_GPIO1_REG PERIPHS_IO_MUX_U0TXD_U
#define FUNC_U0TXD_EMAC_RXD2 5
#define FUNC_U0TXD_GPIO1 2
#define FUNC_U0TXD_CLK_OUT3 1
#define FUNC_U0TXD_U0TXD 0
#define PERIPHS_IO_MUX_GPIO2_U (DR_REG_IO_MUX_BASE +0x40)
#define IO_MUX_GPIO2_REG PERIPHS_IO_MUX_GPIO2_U
#define FUNC_GPIO2_SD_DATA0 4
#define FUNC_GPIO2_HS2_DATA0 3
#define FUNC_GPIO2_GPIO2 2
@ -143,11 +146,13 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_GPIO2_GPIO2_0 0
#define PERIPHS_IO_MUX_U0RXD_U (DR_REG_IO_MUX_BASE +0x84)
#define IO_MUX_GPIO3_REG PERIPHS_IO_MUX_U0RXD_U
#define FUNC_U0RXD_GPIO3 2
#define FUNC_U0RXD_CLK_OUT2 1
#define FUNC_U0RXD_U0RXD 0
#define PERIPHS_IO_MUX_GPIO4_U (DR_REG_IO_MUX_BASE +0x48)
#define IO_MUX_GPIO4_REG PERIPHS_IO_MUX_GPIO4_U
#define FUNC_GPIO4_EMAC_TX_ER 5
#define FUNC_GPIO4_SD_DATA1 4
#define FUNC_GPIO4_HS2_DATA1 3
@ -156,6 +161,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_GPIO4_GPIO4_0 0
#define PERIPHS_IO_MUX_GPIO5_U (DR_REG_IO_MUX_BASE +0x6c)
#define IO_MUX_GPIO5_REG PERIPHS_IO_MUX_GPIO5_U
#define FUNC_GPIO5_EMAC_RX_CLK 5
#define FUNC_GPIO5_HS1_DATA6 3
#define FUNC_GPIO5_GPIO5 2
@ -163,6 +169,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_GPIO5_GPIO5_0 0
#define PERIPHS_IO_MUX_SD_CLK_U (DR_REG_IO_MUX_BASE +0x60)
#define IO_MUX_GPIO6_REG PERIPHS_IO_MUX_SD_CLK_U
#define FUNC_SD_CLK_U1CTS 4
#define FUNC_SD_CLK_HS1_CLK 3
#define FUNC_SD_CLK_GPIO6 2
@ -170,6 +177,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_SD_CLK_SD_CLK 0
#define PERIPHS_IO_MUX_SD_DATA0_U (DR_REG_IO_MUX_BASE +0x64)
#define IO_MUX_GPIO7_REG PERIPHS_IO_MUX_SD_DATA0_U
#define FUNC_SD_DATA0_U2RTS 4
#define FUNC_SD_DATA0_HS1_DATA0 3
#define FUNC_SD_DATA0_GPIO7 2
@ -177,6 +185,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_SD_DATA0_SD_DATA0 0
#define PERIPHS_IO_MUX_SD_DATA1_U (DR_REG_IO_MUX_BASE +0x68)
#define IO_MUX_GPIO8_REG PERIPHS_IO_MUX_SD_DATA1_U
#define FUNC_SD_DATA1_U2CTS 4
#define FUNC_SD_DATA1_HS1_DATA1 3
#define FUNC_SD_DATA1_GPIO8 2
@ -184,6 +193,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_SD_DATA1_SD_DATA1 0
#define PERIPHS_IO_MUX_SD_DATA2_U (DR_REG_IO_MUX_BASE +0x54)
#define IO_MUX_GPIO9_REG PERIPHS_IO_MUX_SD_DATA2_U
#define FUNC_SD_DATA2_U1RXD 4
#define FUNC_SD_DATA2_HS1_DATA2 3
#define FUNC_SD_DATA2_GPIO9 2
@ -191,6 +201,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_SD_DATA2_SD_DATA2 0
#define PERIPHS_IO_MUX_SD_DATA3_U (DR_REG_IO_MUX_BASE +0x58)
#define IO_MUX_GPIO10_REG PERIPHS_IO_MUX_SD_DATA3_U
#define FUNC_SD_DATA3_U1TXD 4
#define FUNC_SD_DATA3_HS1_DATA3 3
#define FUNC_SD_DATA3_GPIO10 2
@ -198,6 +209,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_SD_DATA3_SD_DATA3 0
#define PERIPHS_IO_MUX_SD_CMD_U (DR_REG_IO_MUX_BASE +0x5c)
#define IO_MUX_GPIO11_REG PERIPHS_IO_MUX_SD_CMD_U
#define FUNC_SD_CMD_U1RTS 4
#define FUNC_SD_CMD_HS1_CMD 3
#define FUNC_SD_CMD_GPIO11 2
@ -205,6 +217,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_SD_CMD_SD_CMD 0
#define PERIPHS_IO_MUX_MTDI_U (DR_REG_IO_MUX_BASE +0x34)
#define IO_MUX_GPIO12_REG PERIPHS_IO_MUX_MTDI_U
#define FUNC_MTDI_EMAC_TXD3 5
#define FUNC_MTDI_SD_DATA2 4
#define FUNC_MTDI_HS2_DATA2 3
@ -213,6 +226,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_MTDI_MTDI 0
#define PERIPHS_IO_MUX_MTCK_U (DR_REG_IO_MUX_BASE +0x38)
#define IO_MUX_GPIO13_REG PERIPHS_IO_MUX_MTCK_U
#define FUNC_MTCK_EMAC_RX_ER 5
#define FUNC_MTCK_SD_DATA3 4
#define FUNC_MTCK_HS2_DATA3 3
@ -221,6 +235,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_MTCK_MTCK 0
#define PERIPHS_IO_MUX_MTMS_U (DR_REG_IO_MUX_BASE +0x30)
#define IO_MUX_GPIO14_REG PERIPHS_IO_MUX_MTMS_U
#define FUNC_MTMS_EMAC_TXD2 5
#define FUNC_MTMS_SD_CLK 4
#define FUNC_MTMS_HS2_CLK 3
@ -229,6 +244,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_MTMS_MTMS 0
#define PERIPHS_IO_MUX_MTDO_U (DR_REG_IO_MUX_BASE +0x3c)
#define IO_MUX_GPIO15_REG PERIPHS_IO_MUX_MTDO_U
#define FUNC_MTDO_EMAC_RXD3 5
#define FUNC_MTDO_SD_CMD 4
#define FUNC_MTDO_HS2_CMD 3
@ -237,6 +253,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_MTDO_MTDO 0
#define PERIPHS_IO_MUX_GPIO16_U (DR_REG_IO_MUX_BASE +0x4c)
#define IO_MUX_GPIO16_REG PERIPHS_IO_MUX_GPIO16_U
#define FUNC_GPIO16_EMAC_CLK_OUT 5
#define FUNC_GPIO16_U2RXD 4
#define FUNC_GPIO16_HS1_DATA4 3
@ -244,6 +261,7 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_GPIO16_GPIO16_0 0
#define PERIPHS_IO_MUX_GPIO17_U (DR_REG_IO_MUX_BASE +0x50)
#define IO_MUX_GPIO17_REG PERIPHS_IO_MUX_GPIO17_U
#define FUNC_GPIO17_EMAC_CLK_OUT_180 5
#define FUNC_GPIO17_U2TXD 4
#define FUNC_GPIO17_HS1_DATA5 3
@ -251,12 +269,14 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_GPIO17_GPIO17_0 0
#define PERIPHS_IO_MUX_GPIO18_U (DR_REG_IO_MUX_BASE +0x70)
#define IO_MUX_GPIO18_REG PERIPHS_IO_MUX_GPIO18_U
#define FUNC_GPIO18_HS1_DATA7 3
#define FUNC_GPIO18_GPIO18 2
#define FUNC_GPIO18_VSPICLK 1
#define FUNC_GPIO18_GPIO18_0 0
#define PERIPHS_IO_MUX_GPIO19_U (DR_REG_IO_MUX_BASE +0x74)
#define IO_MUX_GPIO19_REG PERIPHS_IO_MUX_GPIO19_U
#define FUNC_GPIO19_EMAC_TXD0 5
#define FUNC_GPIO19_U0CTS 3
#define FUNC_GPIO19_GPIO19 2
@ -264,16 +284,19 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_GPIO19_GPIO19_0 0
#define PERIPHS_IO_MUX_GPIO20_U (DR_REG_IO_MUX_BASE +0x78)
#define IO_MUX_GPIO20_REG PERIPHS_IO_MUX_GPIO20_U
#define FUNC_GPIO20_GPIO20 2
#define FUNC_GPIO20_GPIO20_0 0
#define PERIPHS_IO_MUX_GPIO21_U (DR_REG_IO_MUX_BASE +0x7c)
#define IO_MUX_GPIO21_REG PERIPHS_IO_MUX_GPIO21_U
#define FUNC_GPIO21_EMAC_TX_EN 5
#define FUNC_GPIO21_GPIO21 2
#define FUNC_GPIO21_VSPIHD 1
#define FUNC_GPIO21_GPIO21_0 0
#define PERIPHS_IO_MUX_GPIO22_U (DR_REG_IO_MUX_BASE +0x80)
#define IO_MUX_GPIO22_REG PERIPHS_IO_MUX_GPIO22_U
#define FUNC_GPIO22_EMAC_TXD1 5
#define FUNC_GPIO22_U0RTS 3
#define FUNC_GPIO22_GPIO22 2
@ -281,59 +304,72 @@ static inline void __attribute__ ((deprecated)) PIN_PULLDWN_EN(uint32_t PIN_NAME
#define FUNC_GPIO22_GPIO22_0 0
#define PERIPHS_IO_MUX_GPIO23_U (DR_REG_IO_MUX_BASE +0x8c)
#define IO_MUX_GPIO23_REG PERIPHS_IO_MUX_GPIO23_U
#define FUNC_GPIO23_HS1_STROBE 3
#define FUNC_GPIO23_GPIO23 2
#define FUNC_GPIO23_VSPID 1
#define FUNC_GPIO23_GPIO23_0 0
#define PERIPHS_IO_MUX_GPIO24_U (DR_REG_IO_MUX_BASE +0x90)
#define IO_MUX_GPIO24_REG PERIPHS_IO_MUX_GPIO24_U
#define FUNC_GPIO24_GPIO24 2
#define FUNC_GPIO24_GPIO24_0 0
#define PERIPHS_IO_MUX_GPIO25_U (DR_REG_IO_MUX_BASE +0x24)
#define IO_MUX_GPIO25_REG PERIPHS_IO_MUX_GPIO25_U
#define FUNC_GPIO25_EMAC_RXD0 5
#define FUNC_GPIO25_GPIO25 2
#define FUNC_GPIO25_GPIO25_0 0
#define PERIPHS_IO_MUX_GPIO26_U (DR_REG_IO_MUX_BASE +0x28)
#define IO_MUX_GPIO26_REG PERIPHS_IO_MUX_GPIO26_U
#define FUNC_GPIO26_EMAC_RXD1 5
#define FUNC_GPIO26_GPIO26 2
#define FUNC_GPIO26_GPIO26_0 0
#define PERIPHS_IO_MUX_GPIO27_U (DR_REG_IO_MUX_BASE +0x2c)
#define IO_MUX_GPIO27_REG PERIPHS_IO_MUX_GPIO27_U
#define FUNC_GPIO27_EMAC_RX_DV 5
#define FUNC_GPIO27_GPIO27 2
#define FUNC_GPIO27_GPIO27_0 0
#define PERIPHS_IO_MUX_GPIO32_U (DR_REG_IO_MUX_BASE +0x1c)
#define IO_MUX_GPIO32_REG PERIPHS_IO_MUX_GPIO32_U
#define FUNC_GPIO32_GPIO32 2
#define FUNC_GPIO32_GPIO32_0 0
#define PERIPHS_IO_MUX_GPIO33_U (DR_REG_IO_MUX_BASE +0x20)
#define IO_MUX_GPIO33_REG PERIPHS_IO_MUX_GPIO33_U
#define FUNC_GPIO33_GPIO33 2
#define FUNC_GPIO33_GPIO33_0 0
#define PERIPHS_IO_MUX_GPIO34_U (DR_REG_IO_MUX_BASE +0x14)
#define IO_MUX_GPIO34_REG PERIPHS_IO_MUX_GPIO34_U
#define FUNC_GPIO34_GPIO34 2
#define FUNC_GPIO34_GPIO34_0 0
#define PERIPHS_IO_MUX_GPIO35_U (DR_REG_IO_MUX_BASE +0x18)
#define IO_MUX_GPIO35_REG PERIPHS_IO_MUX_GPIO35_U
#define FUNC_GPIO35_GPIO35 2
#define FUNC_GPIO35_GPIO35_0 0
#define PERIPHS_IO_MUX_GPIO36_U (DR_REG_IO_MUX_BASE +0x04)
#define IO_MUX_GPIO36_REG PERIPHS_IO_MUX_GPIO36_U
#define FUNC_GPIO36_GPIO36 2
#define FUNC_GPIO36_GPIO36_0 0
#define PERIPHS_IO_MUX_GPIO37_U (DR_REG_IO_MUX_BASE +0x08)
#define IO_MUX_GPIO37_REG PERIPHS_IO_MUX_GPIO37_U
#define FUNC_GPIO37_GPIO37 2
#define FUNC_GPIO37_GPIO37_0 0
#define PERIPHS_IO_MUX_GPIO38_U (DR_REG_IO_MUX_BASE +0x0c)
#define IO_MUX_GPIO38_REG PERIPHS_IO_MUX_GPIO38_U
#define FUNC_GPIO38_GPIO38 2
#define FUNC_GPIO38_GPIO38_0 0
#define PERIPHS_IO_MUX_GPIO39_U (DR_REG_IO_MUX_BASE +0x10)
#define IO_MUX_GPIO39_REG PERIPHS_IO_MUX_GPIO39_U
#define FUNC_GPIO39_GPIO39 2
#define FUNC_GPIO39_GPIO39_0 0

View File

@ -185,8 +185,11 @@ bool rtc_clk_32k_enabled();
* must be called one the 32k XTAL oscillator has started up. This function
* will initially disable the 32k XTAL oscillator, so it should not be called
* when the system is using 32k XTAL as RTC_SLOW_CLK.
*
* @param cycle Number of 32kHz cycles to bootstrap external crystal.
* If 0, no square wave will be used to bootstrap crystal oscillation.
*/
void rtc_clk_32k_bootstrap();
void rtc_clk_32k_bootstrap(uint32_t cycle);
/**
* @brief Enable or disable 8 MHz internal oscillator
@ -604,7 +607,6 @@ rtc_vddsdio_config_t rtc_vddsdio_get_config();
*/
void rtc_vddsdio_set_config(rtc_vddsdio_config_t config);
#ifdef __cplusplus
}
#endif

View File

@ -96,6 +96,7 @@
#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_SW_M (BIT1)
#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

View File

@ -26,7 +26,7 @@ typedef volatile struct {
uint32_t sar1_sample_bit: 2;
uint32_t sar1_clk_gated: 1;
uint32_t sar1_sample_num: 8;
uint32_t sar1_dig_force: 1;
uint32_t sar1_dig_force: 1; /*1: ADC1 is controlled by the digital controller 0: RTC controller*/
uint32_t sar1_data_inv: 1;
uint32_t reserved29: 3;
};
@ -162,9 +162,9 @@ typedef volatile struct {
uint32_t meas1_data_sar: 16;
uint32_t meas1_done_sar: 1;
uint32_t meas1_start_sar: 1;
uint32_t meas1_start_force: 1;
uint32_t meas1_start_force: 1; /*1: ADC1 is controlled by the digital or RTC controller 0: Ulp coprocessor*/
uint32_t sar1_en_pad: 12;
uint32_t sar1_en_pad_force: 1;
uint32_t sar1_en_pad_force: 1; /*1: Data ports are controlled by the digital or RTC controller 0: Ulp coprocessor*/
};
uint32_t val;
} sar_meas_start1;
@ -174,8 +174,8 @@ typedef volatile struct {
uint32_t touch_xpd_wait: 8;
uint32_t touch_out_sel: 1;
uint32_t touch_out_1en: 1;
uint32_t xpd_hall_force: 1;
uint32_t hall_phase_force: 1;
uint32_t xpd_hall_force: 1; /*1: Power of hall sensor is controlled by the digital or RTC controller 0: Ulp coprocessor*/
uint32_t hall_phase_force: 1; /*1: Phase of hall sensor is controlled by the digital or RTC controller 0: Ulp coprocessor*/
uint32_t reserved28: 4;
};
uint32_t val;
@ -224,8 +224,8 @@ typedef volatile struct {
uint32_t sar2_sample_bit: 2;
uint32_t sar2_clk_gated: 1;
uint32_t sar2_sample_num: 8;
uint32_t sar2_pwdet_force: 1;
uint32_t sar2_dig_force: 1;
uint32_t sar2_pwdet_force: 1; /*1: ADC2 is controlled by PWDET 0: digital or RTC controller*/
uint32_t sar2_dig_force: 1; /*1: ADC2 is controlled by the digital controller 0: RTC controller*/
uint32_t sar2_data_inv: 1;
uint32_t reserved30: 2;
};
@ -236,9 +236,9 @@ typedef volatile struct {
uint32_t meas2_data_sar: 16;
uint32_t meas2_done_sar: 1;
uint32_t meas2_start_sar: 1;
uint32_t meas2_start_force: 1;
uint32_t meas2_start_force: 1; /*1: ADC2 is controlled by the digital or RTC controller 0: Ulp coprocessor*/
uint32_t sar2_en_pad: 12;
uint32_t sar2_en_pad_force: 1;
uint32_t sar2_en_pad_force: 1; /*1: Data ports are controlled by the digital or RTC controller 0: Ulp coprocessor*/
};
uint32_t val;
} sar_meas_start2;

View File

@ -308,7 +308,6 @@
#define SOC_MEM_INTERNAL_LOW 0x3FF90000
#define SOC_MEM_INTERNAL_HIGH 0x400C2000
//Interrupt hardware source table
//This table is decided by hardware, don't touch this.
#define ETS_WIFI_MAC_INTR_SOURCE 0/**< interrupt of WiFi MAC, level*/

View File

@ -89,3 +89,8 @@ inline static bool IRAM_ATTR esp_ptr_internal(const void *p) {
r |= ((intptr_t)p >= SOC_RTC_DATA_LOW && (intptr_t)p < SOC_RTC_DATA_HIGH);
return r;
}
inline static bool IRAM_ATTR esp_ptr_external_ram(const void *p) {
return ((intptr_t)p >= SOC_EXTRAM_DATA_LOW && (intptr_t)p < SOC_EXTRAM_DATA_HIGH);
}

View File

@ -77,12 +77,16 @@ esp_err_t spi_flash_erase_range(size_t start_address, size_t size);
/**
* @brief Write data to Flash.
*
* @note If source address is in DROM, this function will return
* ESP_ERR_INVALID_ARG.
* @note For fastest write performance, write a 4 byte aligned size at a
* 4 byte aligned offset in flash from a source buffer in DRAM. Varying any of
* these parameters will still work, but will be slower due to buffering.
*
* @param dest_addr destination address in Flash. Must be a multiple of 4 bytes.
* @param src pointer to the source buffer.
* @param size length of data, in bytes. Must be a multiple of 4 bytes.
* @note Writing more than 8KB at a time will be split into multiple
* write operations to avoid disrupting other tasks in the system.
*
* @param dest_addr Destination address in Flash.
* @param src Pointer to the source buffer.
* @param size Length of data, in bytes.
*
* @return esp_err_t
*/
@ -103,9 +107,9 @@ esp_err_t spi_flash_write(size_t dest_addr, const void *src, size_t size);
* absolute best performance, both dest_addr and size arguments should
* be multiples of 32 bytes.
*
* @param dest_addr destination address in Flash. Must be a multiple of 16 bytes.
* @param src pointer to the source buffer.
* @param size length of data, in bytes. Must be a multiple of 16 bytes.
* @param dest_addr Destination address in Flash. Must be a multiple of 16 bytes.
* @param src Pointer to the source buffer.
* @param size Length of data, in bytes. Must be a multiple of 16 bytes.
*
* @return esp_err_t
*/
@ -114,10 +118,22 @@ esp_err_t spi_flash_write_encrypted(size_t dest_addr, const void *src, size_t si
/**
* @brief Read data from Flash.
*
* @note For fastest read performance, all parameters should be
* 4 byte aligned. If source address and read size are not 4 byte
* aligned, read may be split into multiple flash operations. If
* destination buffer is not 4 byte aligned, a temporary buffer will
* be allocated on the stack.
*
* @note Reading more than 16KB of data at a time will be split
* into multiple reads to avoid disruption to other tasks in the
* system. Consider using spi_flash_mmap() to read large amounts
* of data.
*
* @param src_addr source address of the data in Flash.
* @param dest pointer to the destination buffer
* @param size length of data
*
*
* @return esp_err_t
*/
esp_err_t spi_flash_read(size_t src_addr, void *dest, size_t size);
@ -155,19 +171,20 @@ typedef uint32_t spi_flash_mmap_handle_t;
/**
* @brief Map region of flash memory into data or instruction address space
*
* This function allocates sufficient number of 64k MMU pages and configures
* them to map request region of flash memory into data address space or into
* instruction address space. It may reuse MMU pages which already provide
* required mapping. As with any allocator, there is possibility of fragmentation
* of address space if mmap/munmap are heavily used. To troubleshoot issues with
* page allocation, use spi_flash_mmap_dump function.
* This function allocates sufficient number of 64kB MMU pages and configures
* them to map the requested region of flash memory into the address space.
* It may reuse MMU pages which already provide the required mapping.
*
* As with any allocator, if mmap/munmap are heavily used then the address space
* may become fragmented. To troubleshoot issues with page allocation, use
* spi_flash_mmap_dump() function.
*
* @param src_addr Physical address in flash where requested region starts.
* This address *must* be aligned to 64kB boundary
* (SPI_FLASH_MMU_PAGE_SIZE).
* @param size Size of region which has to be mapped. This size will be rounded
* up to a 64k boundary.
* @param memory Memory space where the region should be mapped
* (SPI_FLASH_MMU_PAGE_SIZE)
* @param size Size of region to be mapped. This size will be rounded
* up to a 64kB boundary
* @param memory Address space where the region should be mapped (data or instruction)
* @param out_ptr Output, pointer to the mapped memory region
* @param out_handle Output, handle which should be used for spi_flash_munmap call
*
@ -179,17 +196,16 @@ esp_err_t spi_flash_mmap(size_t src_addr, size_t size, spi_flash_mmap_memory_t m
/**
* @brief Map sequences of pages of flash memory into data or instruction address space
*
* This function allocates sufficient number of 64k MMU pages and configures
* them to map the indicated pages of flash memory contiguously into data address
* space or into instruction address space. In this respect, it works in a similar
* way as spi_flash_mmap but it allows mapping a (maybe non-contiguous) set of pages
* into a contiguous region of memory.
* This function allocates sufficient number of 64kB MMU pages and configures
* them to map the indicated pages of flash memory contiguously into address space.
* In this respect, it works in a similar way as spi_flash_mmap() but it allows mapping
* a (maybe non-contiguous) set of pages into a contiguous region of memory.
*
* @param pages An array of numbers indicating the 64K pages in flash to be mapped
* contiguously into memory. These indicate the indexes of the 64K pages,
* @param pages An array of numbers indicating the 64kB pages in flash to be mapped
* contiguously into memory. These indicate the indexes of the 64kB pages,
* not the byte-size addresses as used in other functions.
* @param pagecount Size of the pages array
* @param memory Memory space where the region should be mapped
* @param pagecount Number of entries in the pages array
* @param memory Address space where the region should be mapped (instruction or data)
* @param out_ptr Output, pointer to the mapped memory region
* @param out_handle Output, handle which should be used for spi_flash_munmap call
*
@ -220,13 +236,28 @@ void spi_flash_munmap(spi_flash_mmap_handle_t handle);
*/
void spi_flash_mmap_dump();
/**
* @brief get free pages number which can be mmap
*
* This function will return free page number of the mmu table which can mmap,
* when you want to call spi_flash_mmap to mmap an ranger of flash data to Dcache or Icache
* memmory region, maybe the size of MMU table will exceed,so if you are not sure the
* size need mmap is ok, can call the interface and watch how many MMU table page can be
* mmaped.
*
* @param memory memmory type of MMU table free page
*
* @return number of free pages which can be mmaped
*/
uint32_t spi_flash_mmap_get_free_pages(spi_flash_mmap_memory_t memory);
#define SPI_FLASH_CACHE2PHYS_FAIL UINT32_MAX /*<! Result from spi_flash_cache2phys() if flash cache address is invalid */
/**
* @brief Given a memory address where flash is mapped, return the corresponding physical flash offset.
*
* Cache address does not have have been assigned via spi_flash_mmap(), any address in flash map space can be looked up.
* Cache address does not have have been assigned via spi_flash_mmap(), any address in memory mapped flash space can be looked up.
*
* @param cached Pointer to flashed cached memory.
*
@ -248,7 +279,7 @@ size_t spi_flash_cache2phys(const void *cached);
* phys_offs is not 4-byte aligned, then reading from the returned pointer will result in a crash.
*
* @param phys_offs Physical offset in flash memory to look up.
* @param memory Memory type to look up a flash cache address mapping for (IROM or DROM)
* @param memory Address space type to look up a flash cache address mapping for (instruction or data)
*
* @return
* - NULL if the physical address is invalid or not mapped to flash cache of the specified memory type.
@ -264,6 +295,7 @@ bool spi_flash_cache_enabled();
/**
* @brief SPI flash critical section enter function.
*
*/
typedef void (*spi_flash_guard_start_func_t)(void);
/**

View File

@ -153,12 +153,15 @@ extern void spiffs_api_unlock(struct spiffs_t *fs);
// changes the on-disk format, so the change is not backward-compatible.
//
// Do note: the meta length must never exceed
// logical_page_size - (SPIFFS_OBJ_NAME_LEN + 64)
// logical_page_size - (SPIFFS_OBJ_NAME_LEN + SPIFFS_PAGE_EXTRA_SIZE)
//
// This is derived from following:
// logical_page_size - (SPIFFS_OBJ_NAME_LEN + sizeof(spiffs_page_header) +
// spiffs_object_ix_header fields + at least some LUT entries)
#define SPIFFS_OBJ_META_LEN (CONFIG_SPIFFS_META_LENGTH)
#define SPIFFS_PAGE_EXTRA_SIZE (64)
_Static_assert(SPIFFS_OBJ_META_LEN + SPIFFS_OBJ_NAME_LEN + SPIFFS_PAGE_EXTRA_SIZE
<= CONFIG_SPIFFS_PAGE_SIZE, "SPIFFS_OBJ_META_LEN or SPIFFS_OBJ_NAME_LEN too long");
// Size of buffer allocated on stack used when copying data.
// Lower value generates more read/writes. No meaning having it bigger

View File

@ -97,13 +97,13 @@ typedef struct {
#define ESP_ERR_TCPIP_ADAPTER_BASE 0x5000 // TODO: move base address to esp_err.h
#define ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS ESP_ERR_TCPIP_ADAPTER_BASE + 0x00
#define ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY ESP_ERR_TCPIP_ADAPTER_BASE + 0x01
#define ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED ESP_ERR_TCPIP_ADAPTER_BASE + 0x02
#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED ESP_ERR_TCPIP_ADAPTER_BASE + 0x03
#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED ESP_ERR_TCPIP_ADAPTER_BASE + 0x04
#define ESP_ERR_TCPIP_ADAPTER_NO_MEM ESP_ERR_TCPIP_ADAPTER_BASE + 0x05
#define ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED ESP_ERR_TCPIP_ADAPTER_BASE + 0x06
#define ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS ESP_ERR_TCPIP_ADAPTER_BASE + 0x01
#define ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY ESP_ERR_TCPIP_ADAPTER_BASE + 0x02
#define ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED ESP_ERR_TCPIP_ADAPTER_BASE + 0x03
#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STARTED ESP_ERR_TCPIP_ADAPTER_BASE + 0x04
#define ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED ESP_ERR_TCPIP_ADAPTER_BASE + 0x05
#define ESP_ERR_TCPIP_ADAPTER_NO_MEM ESP_ERR_TCPIP_ADAPTER_BASE + 0x06
#define ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED ESP_ERR_TCPIP_ADAPTER_BASE + 0x07
/* TODO: add Ethernet interface */
typedef enum {
@ -184,10 +184,10 @@ typedef struct tcpip_adapter_dns_param_s {
msg.data = (void*)(_data);\
msg.api_fn = (_fn);\
if (TCPIP_ADAPTER_IPC_REMOTE == tcpip_adapter_ipc_check(&msg)) {\
ESP_LOGD(TAG, "check: remote, if=%d fn=%p\n", (_if), (_fn));\
ESP_LOGV(TAG, "check: remote, if=%d fn=%p\n", (_if), (_fn));\
return msg.ret;\
} else {\
ESP_LOGD(TAG, "check: local, if=%d fn=%p\n", (_if), (_fn));\
ESP_LOGV(TAG, "check: local, if=%d fn=%p\n", (_if), (_fn));\
}\
}while(0)