Skip to content

Commit 69acda1

Browse files
feat(ble/bluedroid): reduce bluedrois host bin size and disable BLE_HOST_BG_CONNECT_EN
1 parent d2d4d15 commit 69acda1

File tree

32 files changed

+314
-108
lines changed

32 files changed

+314
-108
lines changed

components/bt/host/bluedroid/bta/include/bta/bta_api.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,13 +1640,15 @@ typedef struct {
16401640
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT
16411641
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT
16421642
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT
1643+
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
1644+
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
16431645
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT
16441646
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT
16451647
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT
16461648
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT
16471649
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT
16481650
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT
1649-
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
1651+
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
16501652
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
16511653
#define BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT
16521654
#define BTA_DM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT

components/bt/host/bluedroid/btc/core/btc_dm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ static void btc_dm_link_up_evt(tBTA_DM_LINK_UP *p_link_up)
334334
}
335335
}
336336

337+
#if (SMP_INCLUDED == TRUE)
337338
static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
338339
{
339340
/* Save link key, if not temporary */
@@ -493,6 +494,7 @@ static void btc_dm_pin_req_evt(tBTA_DM_PIN_REQ *p_pin_req)
493494
}
494495
#endif /// BTC_GAP_BT_INCLUDED == TRUE
495496
}
497+
#endif // #if (SMP_INCLUDED == TRUE)
496498

497499
#if (CLASSIC_BT_INCLUDED == TRUE)
498500
static void btc_dm_sp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_cfm_req)
@@ -814,6 +816,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
814816
btc_disable_bluetooth_evt();
815817
break;
816818
}
819+
#if (SMP_INCLUDED == TRUE)
817820
case BTA_DM_PIN_REQ_EVT:
818821
BTC_TRACE_DEBUG("BTA_DM_PIN_REQ_EVT");
819822
btc_dm_pin_req_evt(&p_data->pin_req);
@@ -827,6 +830,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
827830
case BTA_DM_BOND_CANCEL_CMPL_EVT:
828831
BTC_TRACE_DEBUG("BTA_DM_BOND_CANCEL_CMPL_EVT");
829832
break;
833+
#endif // #if (SMP_INCLUDED == TRUE)
830834
#if (CLASSIC_BT_INCLUDED == TRUE)
831835
case BTA_DM_SP_CFM_REQ_EVT:
832836
btc_dm_sp_cfm_req_evt(&p_data->cfm_req);

components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,8 @@ void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
10421042
param.period_adv_stop.instance = params->per_adv_stop.instance;
10431043
break;
10441044
}
1045+
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
1046+
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
10451047
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT: {
10461048
msg.act = ESP_GAP_BLE_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT;
10471049
param.period_adv_create_sync.status = btc_btm_status_to_esp_status(params->per_adv_sync_create.status);
@@ -1072,7 +1074,7 @@ void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
10721074
param.period_adv_clear_dev.status = btc_btm_status_to_esp_status(params->per_adv_clear_dev.status);
10731075
break;
10741076
}
1075-
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
1077+
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
10761078

10771079
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
10781080
case BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT: {
@@ -1889,6 +1891,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
18891891
break;
18901892
}
18911893
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
1894+
#if (BLE_50_EXTEND_ADV_EN == TRUE)
18921895
case BTC_GAP_BLE_EXT_ADV_START: {
18931896
esp_ble_gap_ext_adv_t *value = ((btc_ble_5_gap_args_t *)msg->arg)->ext_adv_start.ext_adv;
18941897
if (value) {
@@ -1903,6 +1906,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
19031906
}
19041907
break;
19051908
}
1909+
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
19061910
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
19071911
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT: {
19081912
uint8_t *p_param_buf = ((btc_ble_gap_args_t *)msg->arg)->vendor_cmd_send.p_param_buf;

components/bt/host/bluedroid/common/include/common/bt_target.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,10 @@
14031403
#define BLE_HOST_BATCH_SCAN_EN FALSE
14041404
#endif
14051405

1406+
#ifndef BLE_HOST_BG_CONNECT_EN
1407+
#define BLE_HOST_BG_CONNECT_EN FALSE
1408+
#endif
1409+
14061410
#ifndef LOCAL_BLE_CONTROLLER_ID
14071411
#define LOCAL_BLE_CONTROLLER_ID (1)
14081412
#endif

components/bt/host/bluedroid/device/controller.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ typedef struct {
8383
bool simple_pairing_supported;
8484
bool secure_connections_supported;
8585
#if (BLE_50_FEATURE_SUPPORT == TRUE)
86+
#if (BLE_50_EXTEND_ADV_EN == TRUE)
8687
uint16_t ble_ext_adv_data_max_len;
88+
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
8789
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
8890
} controller_local_param_t;
8991

@@ -119,11 +121,13 @@ static void start_up(void)
119121
response = AWAIT_COMMAND(controller_param.packet_factory->make_set_c2h_flow_control(HCI_HOST_FLOW_CTRL_ACL_ON));
120122
controller_param.packet_parser->parse_generic_command_complete(response);
121123
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
124+
#if (BLE_42_SCAN_EN == TRUE)
122125
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
123126
// Enable adv flow control
124127
response = AWAIT_COMMAND(controller_param.packet_factory->make_set_adv_report_flow_control(HCI_HOST_FLOW_CTRL_ADV_REPORT_ON, (uint16_t)BLE_ADV_REPORT_FLOW_CONTROL_NUM, (uint16_t)BLE_ADV_REPORT_DISCARD_THRSHOLD));
125128
controller_param.packet_parser->parse_generic_command_complete(response);
126129
#endif
130+
#endif // #if (BLE_42_SCAN_EN == TRUE)
127131
// Tell the controller about our buffer sizes and buffer counts next
128132
// TODO(zachoverflow): factor this out. eww l2cap contamination. And why just a hardcoded 10?
129133
response = AWAIT_COMMAND(
@@ -265,16 +269,20 @@ static void start_up(void)
265269
&controller_param.ble_resolving_list_max_size);
266270
}
267271
#if BLE_50_FEATURE_SUPPORT == TRUE
272+
#if (BLE_50_EXTEND_ADV_EN == TRUE)
268273
controller_param.ble_ext_adv_data_max_len = BLE_EXT_ADV_DATA_LEN_MAX;
274+
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
269275
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
270276

271277
#if (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
278+
#if (BLE_50_EXTEND_ADV_EN == TRUE)
272279
if (HCI_LE_EXT_ADV_SUPPORTED(controller_param.features_ble.as_array)) {
273280
response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len());
274281
controller_param.packet_parser->parse_ble_read_adv_max_len_response(
275282
response,
276283
&controller_param.ble_ext_adv_data_max_len);
277284
}
285+
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
278286
#endif // (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
279287

280288
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(controller_param.features_ble.as_array)) {
@@ -508,13 +516,15 @@ static void set_ble_resolving_list_max_size(int resolving_list_max_size)
508516
controller_param.ble_resolving_list_max_size = resolving_list_max_size;
509517
}
510518
#if (BLE_50_FEATURE_SUPPORT == TRUE)
519+
#if (BLE_50_EXTEND_ADV_EN == TRUE)
511520
static uint16_t ble_get_ext_adv_data_max_len(void)
512521
{
513522
assert(controller_param.readable);
514523
assert(controller_param.ble_supported);
515524

516525
return controller_param.ble_ext_adv_data_max_len;
517526
}
527+
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
518528
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
519529
#if (BTM_SCO_HCI_INCLUDED == TRUE)
520530
static uint8_t get_sco_data_size(void)
@@ -574,7 +584,9 @@ static const controller_t interface = {
574584
get_ble_resolving_list_max_size,
575585
set_ble_resolving_list_max_size,
576586
#if (BLE_50_FEATURE_SUPPORT == TRUE)
587+
#if (BLE_50_EXTEND_ADV_EN == TRUE)
577588
ble_get_ext_adv_data_max_len,
589+
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
578590
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
579591
#if (BTM_SCO_HCI_INCLUDED == TRUE)
580592
get_sco_data_size,

components/bt/host/bluedroid/device/include/device/controller.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ typedef struct controller_t {
8181
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
8282

8383
#if (BLE_50_FEATURE_SUPPORT == TRUE)
84+
#if (BLE_50_EXTEND_ADV_EN == TRUE)
8485
uint16_t (*ble_get_ext_adv_data_max_len)(void);
86+
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
8587
#endif // BLE_50_FEATURE_SUPPORT
8688

8789
#if (BTM_SCO_HCI_INCLUDED == TRUE)

components/bt/host/bluedroid/hci/hci_hal_h4.c

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static const uint16_t outbound_event_types[] = {
6868

6969
typedef struct {
7070
fixed_queue_t *rx_q;
71+
#if (BLE_42_SCAN_EN == TRUE)
7172
struct pkt_queue *adv_rpt_q;
7273
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
7374
osi_mutex_t adv_flow_lock;
@@ -77,6 +78,7 @@ typedef struct {
7778
pkt_linked_item_t *adv_fc_cmd_buf;
7879
bool cmd_buf_in_use;
7980
#endif
81+
#endif // #if (BLE_42_SCAN_EN == TRUE)
8082
hci_hal_callbacks_t *callbacks;
8183
osi_thread_t *hci_h4_thread;
8284
struct osi_event *upstream_data_ready;
@@ -90,23 +92,26 @@ static const esp_bluedroid_hci_driver_callbacks_t hci_host_cb;
9092
static void host_send_pkt_available_cb(void);
9193
static int host_recv_pkt_cb(uint8_t *data, uint16_t len);
9294
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet);
95+
#if (BLE_42_SCAN_EN == TRUE)
9396
static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt);
97+
#endif // #if (BLE_42_SCAN_EN == TRUE)
9498
static void hci_upstream_data_handler(void *arg);
9599
static bool hci_upstream_data_post(uint32_t timeout);
96100

101+
#if (BLE_42_SCAN_EN == TRUE)
97102
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
98103
static void hci_adv_flow_monitor(void *context);
99104
static void hci_adv_flow_cmd_free_cb(pkt_linked_item_t *linked_pkt);
100105
#endif
101-
106+
#endif // #if (BLE_42_SCAN_EN == TRUE)
102107
static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thread_t *task_thread)
103108
{
104109
assert(upper_callbacks != NULL);
105110
assert(task_thread != NULL);
106111

107112
hci_hal_env.hci_h4_thread = task_thread;
108113
hci_hal_env.callbacks = (hci_hal_callbacks_t *)upper_callbacks;
109-
114+
#if (BLE_42_SCAN_EN == TRUE)
110115
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
111116
hci_hal_env.adv_fc_cmd_buf = osi_calloc(HCI_CMD_LINKED_BUF_SIZE(HCIC_PARAM_SIZE_BLE_UPDATE_ADV_FLOW_CONTROL));
112117
assert(hci_hal_env.adv_fc_cmd_buf != NULL);
@@ -119,13 +124,13 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
119124
hci_hal_env.adv_flow_monitor = osi_alarm_new("adv_fc_mon", hci_adv_flow_monitor, NULL, HCI_ADV_FLOW_MONITOR_PERIOD_MS);
120125
assert (hci_hal_env.adv_flow_monitor != NULL);
121126
#endif
122-
127+
#endif // #if (BLE_42_SCAN_EN == TRUE)
123128
hci_hal_env.rx_q = fixed_queue_new(QUEUE_SIZE_MAX);
124129
assert(hci_hal_env.rx_q != NULL);
125-
130+
#if (BLE_42_SCAN_EN == TRUE)
126131
hci_hal_env.adv_rpt_q = pkt_queue_create();
127132
assert(hci_hal_env.adv_rpt_q != NULL);
128-
133+
#endif // #if (BLE_42_SCAN_EN == TRUE)
129134
struct osi_event *event = osi_event_create(hci_upstream_data_handler, NULL);
130135
assert(event != NULL);
131136
hci_hal_env.upstream_data_ready = event;
@@ -137,19 +142,23 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
137142
static void hci_hal_env_deinit(void)
138143
{
139144
fixed_queue_t *rx_q = hci_hal_env.rx_q;
145+
#if (BLE_42_SCAN_EN == TRUE)
140146
struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q;
147+
#endif // #if (BLE_42_SCAN_EN == TRUE)
141148
struct osi_event *upstream_data_ready = hci_hal_env.upstream_data_ready;
142149

143150
hci_hal_env.rx_q = NULL;
151+
#if (BLE_42_SCAN_EN == TRUE)
144152
hci_hal_env.adv_rpt_q = NULL;
153+
#endif // #if (BLE_42_SCAN_EN == TRUE)
145154
hci_hal_env.upstream_data_ready = NULL;
146155

147156
fixed_queue_free(rx_q, osi_free_func);
148-
157+
#if (BLE_42_SCAN_EN == TRUE)
149158
pkt_queue_destroy(adv_rpt_q, NULL);
150-
159+
#endif // #if (BLE_42_SCAN_EN == TRUE)
151160
osi_event_delete(upstream_data_ready);
152-
161+
#if (BLE_42_SCAN_EN == TRUE)
153162
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
154163
hci_hal_env.cmd_buf_in_use = true;
155164
osi_alarm_cancel(hci_hal_env.adv_flow_monitor);
@@ -159,7 +168,7 @@ static void hci_hal_env_deinit(void)
159168
osi_free(hci_hal_env.adv_fc_cmd_buf);
160169
hci_hal_env.adv_fc_cmd_buf = NULL;
161170
#endif
162-
171+
#endif // #if (BLE_42_SCAN_EN == TRUE)
163172
hci_hal_env.hci_h4_thread = NULL;
164173

165174
memset(&hci_hal_env, 0, sizeof(hci_hal_env_t));
@@ -222,7 +231,9 @@ static uint16_t transmit_data(serial_data_type_t type,
222231
static void hci_upstream_data_handler(void *arg)
223232
{
224233
fixed_queue_t *rx_q = hci_hal_env.rx_q;
234+
#if (BLE_42_SCAN_EN == TRUE)
225235
struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q;
236+
#endif // #if (BLE_42_SCAN_EN == TRUE)
226237
size_t pkts_to_process;
227238

228239
do {
@@ -234,7 +245,7 @@ static void hci_upstream_data_handler(void *arg)
234245
}
235246
}
236247
} while (0);
237-
248+
#if (BLE_42_SCAN_EN == TRUE)
238249
do {
239250
pkts_to_process = pkt_queue_length(adv_rpt_q);
240251
for (size_t i = 0; i < pkts_to_process; i++) {
@@ -244,8 +255,12 @@ static void hci_upstream_data_handler(void *arg)
244255
}
245256
}
246257
} while (0);
247-
248-
if (!fixed_queue_is_empty(rx_q) || pkt_queue_length(adv_rpt_q) > 0) {
258+
#endif // #if (BLE_42_SCAN_EN == TRUE)
259+
if (!fixed_queue_is_empty(rx_q)
260+
#if (BLE_42_SCAN_EN == TRUE)
261+
|| pkt_queue_length(adv_rpt_q) > 0
262+
#endif // #if (BLE_42_SCAN_EN == TRUE)
263+
) {
249264
hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT);
250265
}
251266
}
@@ -286,6 +301,7 @@ bool host_recv_adv_packet(uint8_t *packet)
286301
return false;
287302
}
288303

304+
#if (BLE_42_SCAN_EN == TRUE)
289305
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
290306
static void hci_adv_flow_monitor(void *context)
291307
{
@@ -411,6 +427,7 @@ int hci_adv_credits_force_release(uint16_t num)
411427
return credits_released;
412428
}
413429
#endif
430+
#endif // #if (BLE_42_SCAN_EN == TRUE)
414431

415432
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
416433
{
@@ -472,7 +489,7 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
472489
packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)];
473490
hci_hal_env.callbacks->packet_ready(packet);
474491
}
475-
492+
#if (BLE_42_SCAN_EN == TRUE)
476493
static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt)
477494
{
478495
uint8_t type;
@@ -519,6 +536,7 @@ static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt)
519536
hci_adv_credits_prep_to_release(1);
520537
#endif
521538
}
539+
#endif // #if (BLE_42_SCAN_EN == TRUE)
522540

523541
static void host_send_pkt_available_cb(void)
524542
{
@@ -551,7 +569,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
551569
{
552570
//Target has packet to host, malloc new buffer for packet
553571
BT_HDR *pkt = NULL;
572+
#if (BLE_42_SCAN_EN == TRUE)
554573
pkt_linked_item_t *linked_pkt = NULL;
574+
#endif // #if (BLE_42_SCAN_EN == TRUE)
555575
size_t pkt_size;
556576

557577
if (hci_hal_env.rx_q == NULL) {
@@ -576,6 +596,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
576596
memcpy(pkt->data, data, len);
577597
fixed_queue_enqueue(hci_hal_env.rx_q, pkt, FIXED_QUEUE_MAX_TIMEOUT);
578598
} else {
599+
#if (BLE_42_SCAN_EN == TRUE)
579600
#if !BLE_ADV_REPORT_FLOW_CONTROL
580601
// drop the packets if pkt_queue length goes beyond upper limit
581602
if (pkt_queue_length(hci_hal_env.adv_rpt_q) > HCI_HAL_BLE_ADV_RPT_QUEUE_LEN_MAX) {
@@ -604,6 +625,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
604625
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
605626
hci_adv_credits_consumed(1);
606627
#endif
628+
#else
629+
assert(0);
630+
#endif // #if (BLE_42_SCAN_EN == TRUE)
607631
}
608632

609633
hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT);

components/bt/host/bluedroid/hci/hci_layer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,11 @@ static void dispatch_adv_report(pkt_linked_item_t *linked_pkt)
537537
//Tell Up-layer received packet.
538538
if (btu_task_post(SIG_BTU_HCI_ADV_RPT_MSG, linked_pkt, OSI_THREAD_MAX_TIMEOUT) == false) {
539539
osi_free(linked_pkt);
540+
#if (BLE_42_SCAN_EN == TRUE)
540541
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
541542
hci_adv_credits_try_release(1);
542543
#endif
544+
#endif // #if (BLE_42_SCAN_EN == TRUE)
543545
}
544546
}
545547
// Misc internal functions

0 commit comments

Comments
 (0)