mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(ble/bluedroid): Align config, controller indent and init error paths
- bt_target: remove/align obsolete macros with Kconfig
- device/controller: fix start_up() Secure Connections indent,
get_ble_resolving_list_max_size return type
- controller.h: align type/interface declarations with implementation
- bte_init: remove unused/redundant code
- bte_main: return -1 on osi_init failure, null check in bte_main_hci_send
(cherry picked from commit b83647f5ea)
Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
@@ -688,10 +688,6 @@
|
|||||||
#define BTA_DM_QOS_INCLUDED FALSE
|
#define BTA_DM_QOS_INCLUDED FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BTA_PAN_INCLUDED
|
|
||||||
#define BTA_PAN_INCLUDED FALSE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BTA_HD_INCLUDED
|
#ifndef BTA_HD_INCLUDED
|
||||||
#define BTA_HD_INCLUDED FALSE
|
#define BTA_HD_INCLUDED FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -223,13 +223,13 @@ static void start_up(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((bluedroid_config_get()->get_sc_enabled())) {
|
if ((bluedroid_config_get()->get_sc_enabled())) {
|
||||||
controller_param.secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(controller_param.features_classic[2].as_array);
|
controller_param.secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(controller_param.features_classic[2].as_array);
|
||||||
if (controller_param.secure_connections_supported) {
|
if (controller_param.secure_connections_supported) {
|
||||||
response = AWAIT_COMMAND(controller_param.packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED));
|
response = AWAIT_COMMAND(controller_param.packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED));
|
||||||
controller_param.packet_parser->parse_generic_command_complete(response);
|
controller_param.packet_parser->parse_generic_command_complete(response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if (BLE_INCLUDED == TRUE)
|
#if (BLE_INCLUDED == TRUE)
|
||||||
#if (CLASSIC_BT_INCLUDED)
|
#if (CLASSIC_BT_INCLUDED)
|
||||||
@@ -546,7 +546,7 @@ static uint8_t get_ble_resolving_list_max_size(void)
|
|||||||
return controller_param.ble_resolving_list_max_size;
|
return controller_param.ble_resolving_list_max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_ble_resolving_list_max_size(int resolving_list_max_size)
|
static void set_ble_resolving_list_max_size(uint8_t resolving_list_max_size)
|
||||||
{
|
{
|
||||||
assert(controller_param.readable);
|
assert(controller_param.readable);
|
||||||
assert(controller_param.ble_supported);
|
assert(controller_param.ble_supported);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ typedef struct controller_t {
|
|||||||
uint8_t (*get_ble_white_list_size)(void);
|
uint8_t (*get_ble_white_list_size)(void);
|
||||||
|
|
||||||
uint8_t (*get_ble_resolving_list_max_size)(void);
|
uint8_t (*get_ble_resolving_list_max_size)(void);
|
||||||
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
|
void (*set_ble_resolving_list_max_size)(uint8_t resolving_list_max_size);
|
||||||
|
|
||||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||||
|
|||||||
@@ -152,10 +152,6 @@
|
|||||||
#include "bta_gatts_int.h"
|
#include "bta_gatts_int.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BTA_PAN_INCLUDED==TRUE
|
|
||||||
#include "bta_pan_int.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BTA_PBA_CLIENT_INCLUDED == TRUE
|
#if BTA_PBA_CLIENT_INCLUDED == TRUE
|
||||||
#include "bta_pba_client_int.h"
|
#include "bta_pba_client_int.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -481,9 +477,6 @@ bt_status_t BTE_InitStack(void)
|
|||||||
}
|
}
|
||||||
memset((void *)bta_jv_cb_ptr, 0, sizeof(tBTA_JV_CB));
|
memset((void *)bta_jv_cb_ptr, 0, sizeof(tBTA_JV_CB));
|
||||||
#endif //JV
|
#endif //JV
|
||||||
#if BTA_HS_INCLUDED == TRUE
|
|
||||||
memset((void *)bta_hs_cb_ptr, 0, sizeof(tBTA_HS_CB));
|
|
||||||
#endif
|
|
||||||
#if BTA_SDP_INCLUDED == TRUE
|
#if BTA_SDP_INCLUDED == TRUE
|
||||||
if ((bta_sdp_cb_ptr = (tBTA_SDP_CB *)osi_malloc(sizeof(tBTA_SDP_CB))) == NULL) {
|
if ((bta_sdp_cb_ptr = (tBTA_SDP_CB *)osi_malloc(sizeof(tBTA_SDP_CB))) == NULL) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
@@ -525,9 +518,6 @@ bt_status_t BTE_InitStack(void)
|
|||||||
}
|
}
|
||||||
memset((void *)bta_hd_cb_ptr, 0, sizeof(tBTA_HD_CB));
|
memset((void *)bta_hd_cb_ptr, 0, sizeof(tBTA_HD_CB));
|
||||||
#endif
|
#endif
|
||||||
#if BTA_HL_INCLUDED==TRUE
|
|
||||||
memset((void *)bta_hl_cb_ptr, 0, sizeof(tBTA_HL_CB));
|
|
||||||
#endif
|
|
||||||
#if GATTC_INCLUDED==TRUE
|
#if GATTC_INCLUDED==TRUE
|
||||||
if ((bta_gattc_cb_ptr = (tBTA_GATTC_CB *)osi_malloc(sizeof(tBTA_GATTC_CB))) == NULL) {
|
if ((bta_gattc_cb_ptr = (tBTA_GATTC_CB *)osi_malloc(sizeof(tBTA_GATTC_CB))) == NULL) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
@@ -540,9 +530,6 @@ bt_status_t BTE_InitStack(void)
|
|||||||
}
|
}
|
||||||
memset((void *)bta_gatts_cb_ptr, 0, sizeof(tBTA_GATTS_CB));
|
memset((void *)bta_gatts_cb_ptr, 0, sizeof(tBTA_GATTS_CB));
|
||||||
#endif
|
#endif
|
||||||
#if BTA_PAN_INCLUDED==TRUE
|
|
||||||
memset((void *)bta_pan_cb_ptr, 0, sizeof(tBTA_PAN_CB));
|
|
||||||
#endif
|
|
||||||
#if BTA_PBA_CLIENT_INCLUDED == TRUE
|
#if BTA_PBA_CLIENT_INCLUDED == TRUE
|
||||||
if ((bta_pba_client_cb_ptr = (tBTA_PBA_CLIENT_CB *)osi_malloc(sizeof(tBTA_PBA_CLIENT_CB))) == NULL) {
|
if ((bta_pba_client_cb_ptr = (tBTA_PBA_CLIENT_CB *)osi_malloc(sizeof(tBTA_PBA_CLIENT_CB))) == NULL) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|||||||
@@ -86,7 +86,10 @@ int bte_main_boot_entry(bluedroid_init_done_cb_t cb)
|
|||||||
|
|
||||||
bluedroid_init_done_cb = cb;
|
bluedroid_init_done_cb = cb;
|
||||||
|
|
||||||
osi_init();
|
if (osi_init() != 0) {
|
||||||
|
APPL_TRACE_ERROR("%s failed to initialize OS layer.\n", __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
//Enable HCI
|
//Enable HCI
|
||||||
bte_main_enable();
|
bte_main_enable();
|
||||||
@@ -235,6 +238,11 @@ void bte_main_lpm_wake_bt_device(void)
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void bte_main_hci_send (BT_HDR *p_msg, UINT16 event)
|
void bte_main_hci_send (BT_HDR *p_msg, UINT16 event)
|
||||||
{
|
{
|
||||||
|
if (!p_msg) {
|
||||||
|
APPL_TRACE_ERROR("%s null message\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UINT16 sub_event = event & BT_SUB_EVT_MASK; /* local controller ID */
|
UINT16 sub_event = event & BT_SUB_EVT_MASK; /* local controller ID */
|
||||||
|
|
||||||
p_msg->event = event;
|
p_msg->event = event;
|
||||||
|
|||||||
Reference in New Issue
Block a user