mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(ble/bluedroid): optimize bluedroid host and fix GAP, memory, status and BTM API issues
- return HCI_ERR_MEMORY_FULL on cmd buffer alloc failure - remove legacy adv/scan semaphores and mutex - Use the same legacy gap callback instead of each independent legacy gap event callback
This commit is contained in:
@@ -171,23 +171,13 @@ typedef void (tBTM_VSC_CMPL_CB) (tBTM_VSC_CMPL *p1);
|
||||
** Parameters are the BD Address of remote and the Dev Class of remote.
|
||||
** If the app returns none zero, the connection or inquiry result will be dropped.
|
||||
*/
|
||||
typedef UINT8 (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
|
||||
|
||||
typedef void (tBTM_UPDATE_CONN_PARAM_CBACK) (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDATE_CONN_PRAMS *update_conn_params);
|
||||
|
||||
typedef void (tBTM_SET_PKT_DATA_LENGTH_CBACK) (UINT8 status, tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS *data_length_params);
|
||||
// typedef UINT8 (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
|
||||
|
||||
typedef void (tBTM_DTM_CMD_CMPL_CBACK) (void *p1);
|
||||
|
||||
typedef void (tBTM_SET_RAND_ADDR_CBACK) (UINT8 status);
|
||||
|
||||
typedef void (tBTM_UPDATE_WHITELIST_CBACK) (UINT8 status, tBTM_WL_OPERATION wl_opration);
|
||||
|
||||
typedef void (tBTM_SET_LOCAL_PRIVACY_CBACK) (UINT8 status);
|
||||
|
||||
typedef void (tBTM_SET_RPA_TIMEOUT_CMPL_CBACK) (UINT8 status);
|
||||
|
||||
typedef void (tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK) (UINT8 status);
|
||||
// typedef void (tBTM_UPDATE_WHITELIST_CBACK) (UINT8 status, tBTM_WL_OPERATION wl_opration);
|
||||
|
||||
typedef void (tBTM_BLE_VENDOR_HCI_EVT_CBACK) (UINT8 subevt_code, UINT8 param_len, UINT8 *params);
|
||||
/*******************************
|
||||
@@ -3167,7 +3157,7 @@ tBTM_STATUS BTM_WriteBredrTxPwrLvl(tBTM_TX_PWR_LVL_TYPE type, INT8 tx_power, tBT
|
||||
** Returns BTM_CMD_STARTED if successfully initiated or error code
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_ReadChannelMap(BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb);
|
||||
tBTM_STATUS BTM_ReadChannelMap(BD_ADDR remote_bda);
|
||||
|
||||
void BTM_BleGetWhiteListSize(uint16_t *length);
|
||||
|
||||
@@ -4480,7 +4470,7 @@ tBTM_STATUS BTM_SetAfhChannels (AFH_CHANNELS channels, tBTM_CMPL_CB *p_afh_chann
|
||||
** Returns status of the operation
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_BleSetChannels (BLE_CHANNELS channels, tBTM_CMPL_CB *p_ble_channels_cmpl_cback);
|
||||
tBTM_STATUS BTM_BleSetChannels (BLE_CHANNELS channels);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
||||
@@ -867,17 +867,8 @@ typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, BOOLEAN match);
|
||||
typedef void (tBTM_BLE_RANDOM_SET_CBACK) (BD_ADDR random_bda);
|
||||
|
||||
typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, UINT8 adv_evt);
|
||||
typedef void (*tBLE_SCAN_PARAM_SETUP_CBACK)(tGATT_IF client_if, tBTM_STATUS status);
|
||||
|
||||
typedef void (tBTM_START_ADV_CMPL_CBACK) (UINT8 status);
|
||||
typedef void (tBTM_START_STOP_ADV_CMPL_CBACK) (UINT8 status);
|
||||
|
||||
typedef void (tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTM_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info);
|
||||
typedef void (tBTM_CLEAR_ADV_CMPL_CBACK) (UINT8 status);
|
||||
typedef void (tBTM_SET_PRIVACY_MODE_CMPL_CBACK) (tBTM_STATUS status);
|
||||
typedef void (tBTM_SET_CSA_SUPPORT_CMPL_CBACK) (tBTM_STATUS status);
|
||||
typedef void (tBTM_SET_VENDOR_EVT_MASK_CBACK) (tBTM_STATUS status);
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#define BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT 1
|
||||
#define BTM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT 2
|
||||
@@ -1939,19 +1930,6 @@ extern "C" {
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleRegiseterConnParamCallback
|
||||
**
|
||||
** Description register connection parameters update callback func
|
||||
**
|
||||
** Parameters: update_conn_param_cb
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
|
||||
void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb);
|
||||
void BTM_BleRegisterVendorHciEventCallback(tBTM_BLE_VENDOR_HCI_EVT_CBACK *vendor_hci_evt_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -1996,7 +1974,7 @@ BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key,
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleSetAdvParamsAll
|
||||
** Function BTM_BleStartAdvWithParams
|
||||
**
|
||||
** Description This function is called to set all of the advertising parameters.
|
||||
**
|
||||
@@ -2005,9 +1983,9 @@ BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key,
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_BleSetAdvParamsAll(UINT16 adv_int_min, UINT16 adv_int_max, UINT8 adv_type,
|
||||
tBTM_STATUS BTM_BleStartAdvWithParams(UINT16 adv_int_min, UINT16 adv_int_max, UINT8 adv_type,
|
||||
tBLE_ADDR_TYPE own_bda_type, tBLE_BD_ADDR *p_dir_bda,
|
||||
tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP afp, tBTM_START_ADV_CMPL_CBACK *adv_cb);
|
||||
tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP afp);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2078,8 +2056,7 @@ void BTM_BleClearRandAddress(void);
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window,
|
||||
tBLE_SCAN_MODE scan_mode, UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBTM_BLE_SFP scan_filter_policy,
|
||||
tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback);
|
||||
tBLE_SCAN_MODE scan_mode, UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBTM_BLE_SFP scan_filter_policy);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -2111,22 +2088,6 @@ tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask,
|
||||
//extern
|
||||
tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleObserve
|
||||
**
|
||||
** Description This procedure keep the device listening for advertising
|
||||
** events from a broadcast device.
|
||||
**
|
||||
** Parameters start: start or stop observe.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration,
|
||||
tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleScan
|
||||
@@ -2571,17 +2532,17 @@ BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda,
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleBroadcast
|
||||
** Function BTM_BleAdvStop
|
||||
**
|
||||
** Description This function is to start or stop broadcasting.
|
||||
** Description This function is to stop broadcasting.
|
||||
**
|
||||
** Parameters start: start or stop broadcasting.
|
||||
** Parameters void
|
||||
**
|
||||
** Returns status.
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cback);
|
||||
tBTM_STATUS BTM_BleAdvStop(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2596,7 +2557,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_st
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable, tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cabck);
|
||||
BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2712,7 +2673,7 @@ void BTM_BleTurnOnPrivacyOnRemote(BD_ADDR bd_addr,
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda, tBLE_ADDR_TYPE addr_type, tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb);
|
||||
BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda, tBLE_ADDR_TYPE addr_type);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2723,7 +2684,7 @@ BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda, tBLE_AD
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleClearWhitelist(tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb);
|
||||
void BTM_BleClearWhitelist(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2915,13 +2876,13 @@ tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length);
|
||||
** Parameters: subcode: add, remove or clean duplicate scan exceptional list.
|
||||
** type: device info type
|
||||
** device_info: device information
|
||||
** update_exceptional_list_cmp_cb: complete callback
|
||||
**
|
||||
**
|
||||
** Returns status
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info, tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb);
|
||||
tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2956,7 +2917,7 @@ BOOLEAN BTM_Ble_Authorization(BD_ADDR bd_addr, BOOLEAN authorize);
|
||||
** Parameter p_clear_adv_cback - Command complete callback
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleClearAdv(tBTM_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback);
|
||||
BOOLEAN BTM_BleClearAdv(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2968,7 +2929,7 @@ BOOLEAN BTM_BleClearAdv(tBTM_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback);
|
||||
** Parameter rpa_timeout - The timeout value for RPA, typically in seconds.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout, tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback);
|
||||
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2981,15 +2942,14 @@ BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout, tBTM_SET_RPA_TIMEOUT_CMPL_CBA
|
||||
** Parameters addr - The address of the device to be added to the resolving list.
|
||||
** addr_type - The address type of the device (public or random).
|
||||
** irk - The Identity Resolving Key (IRK) of the device.
|
||||
** p_add_dev_to_resolving_list_callback - Callback function to be called when the operation is completed.
|
||||
**
|
||||
**
|
||||
** Returns TRUE if the operation was successful, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleAddDevToResolvingList(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
uint8_t irk[],
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback);
|
||||
uint8_t irk[]);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -3007,8 +2967,7 @@ BOOLEAN BTM_BleAddDevToResolvingList(BD_ADDR addr,
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleSetPrivacyMode(UINT8 addr_type,
|
||||
BD_ADDR bd_addr,
|
||||
UINT8 privacy_mode,
|
||||
tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_callback);
|
||||
UINT8 privacy_mode);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -3022,7 +2981,7 @@ BOOLEAN BTM_BleSetPrivacyMode(UINT8 addr_type,
|
||||
** Returns TRUE if the operation was successful, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleSetCsaSupport (UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback);
|
||||
BOOLEAN BTM_BleSetCsaSupport (UINT8 csa_select);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -3036,7 +2995,7 @@ BOOLEAN BTM_BleSetCsaSupport (UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK
|
||||
** Returns TRUE if the operation was successful, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleSetVendorEventMask(UINT32 evt_mask, tBTM_SET_VENDOR_EVT_MASK_CBACK *p_callback);
|
||||
BOOLEAN BTM_BleSetVendorEventMask(UINT32 evt_mask);
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -280,9 +280,7 @@ void btu_check_bt_sleep (void);
|
||||
*/
|
||||
void btu_hcif_process_event (UINT8 controller_id, BT_HDR *p_buf);
|
||||
void btu_hcif_send_cmd (UINT8 controller_id, BT_HDR *p_msg);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
UINT8 btu_hcif_send_cmd_sync (UINT8 controller_id, BT_HDR *p_buf);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void btu_hcif_send_host_rdy_for_data(void);
|
||||
void btu_hcif_cmd_timeout (UINT8 controller_id);
|
||||
|
||||
|
||||
@@ -799,7 +799,9 @@ void btsnd_hcic_vendor_spec_cmd (BT_HDR *buffer, UINT16 opcode,
|
||||
#define HCIC_PARAM_SIZE_READ_TRANS_POWER 0
|
||||
#define HCIC_PARAM_SIZE_READ_RF_PATH_COMPENSATION 0
|
||||
#define HCIC_PARAM_SIZE_WRITE_RF_PATH_COMPENSATION 4
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if ((BLE_50_FEATURE_SUPPORT == TRUE) || (BLE_42_FEATURE_SUPPORT == TRUE))
|
||||
BlE_SYNC *btsnd_hcic_ble_get_sync_info(void);
|
||||
void btsnd_hcic_ble_sync_sem_init(void);
|
||||
void btsnd_hcic_ble_sync_sem_deinit(void);
|
||||
@@ -807,7 +809,7 @@ void btsnd_hcic_ble_sync_sem_deinit(void);
|
||||
uint8_t btsnd_hcic_ble_get_status(void);
|
||||
|
||||
void btsnd_hci_ble_set_status(UINT8 hci_status);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#endif // ((BLE_50_FEATURE_SUPPORT == TRUE) || (BLE_42_FEATURE_SUPPORT == TRUE))
|
||||
|
||||
/* ULP HCI command */
|
||||
BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
|
||||
@@ -820,25 +822,24 @@ BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8]);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
|
||||
UINT8 btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
|
||||
UINT8 adv_type, UINT8 addr_type_own,
|
||||
UINT8 addr_type_dir, BD_ADDR direct_bda,
|
||||
UINT8 channel_map, UINT8 adv_filter_policy);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data);
|
||||
UINT8 btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp);
|
||||
UINT8 btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable);
|
||||
UINT8 btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
|
||||
UINT8 btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
|
||||
UINT16 scan_int, UINT16 scan_win,
|
||||
UINT8 addr_type, UINT8 scan_filter_policy);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate);
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate);
|
||||
BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win,
|
||||
UINT8 init_filter_policy, UINT8 addr_type_peer, BD_ADDR bda_peer, UINT8 addr_type_own,
|
||||
UINT16 conn_int_min, UINT16 conn_int_max, UINT16 conn_latency, UINT16 conn_timeout,
|
||||
|
||||
Reference in New Issue
Block a user