Update bt fork to be based on v5.3
This commit is contained in:
@@ -36,13 +36,14 @@
|
||||
#include "stack/hcimsgs.h"
|
||||
|
||||
#if ((BT_CONTROLLER_INCLUDED == TRUE) && SOC_ESP_NIMBLE_CONTROLLER)
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "ble_hci_trans.h"
|
||||
#endif
|
||||
|
||||
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
|
||||
#include "l2c_int.h"
|
||||
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
|
||||
#include "stack/hcimsgs.h"
|
||||
#include "hci_log/bt_hci_log.h"
|
||||
|
||||
#define HCI_BLE_EVENT 0x3e
|
||||
#define PACKET_TYPE_TO_INBOUND_INDEX(type) ((type) - 2)
|
||||
@@ -441,7 +442,7 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
|
||||
uint8_t len = 0;
|
||||
STREAM_TO_UINT8(len, stream);
|
||||
#endif
|
||||
HCI_TRACE_ERROR("Workround stream corrupted during LE SCAN: pkt_len=%d ble_event_len=%d\n",
|
||||
HCI_TRACE_ERROR("Workaround stream corrupted during LE SCAN: pkt_len=%d ble_event_len=%d\n",
|
||||
packet->len, len);
|
||||
osi_free(packet);
|
||||
return;
|
||||
@@ -540,6 +541,26 @@ static void host_send_pkt_available_cb(void)
|
||||
hci_downstream_data_post(OSI_THREAD_MAX_TIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
void bt_record_hci_data(uint8_t *data, uint16_t len)
|
||||
{
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
if ((data[0] == DATA_TYPE_EVENT) && (data[1] == HCI_BLE_EVENT) && ((data[3] == HCI_BLE_ADV_PKT_RPT_EVT) || (data[3] == HCI_BLE_DIRECT_ADV_EVT)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
|| (data[3] == HCI_BLE_ADV_DISCARD_REPORT_EVT)
|
||||
#endif // (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|| (data[3] == HCI_BLE_EXT_ADV_REPORT_EVT) || (data[3] == HCI_BLE_PERIOD_ADV_REPORT_EVT)
|
||||
#endif // (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
)) {
|
||||
bt_hci_log_record_hci_adv(HCI_LOG_DATA_TYPE_ADV, &data[2], len - 2);
|
||||
} else {
|
||||
uint8_t data_type = ((data[0] == 2) ? HCI_LOG_DATA_TYPE_C2H_ACL : data[0]);
|
||||
bt_hci_log_record_hci_data(data_type, &data[1], len - 1);
|
||||
}
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
}
|
||||
|
||||
static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
{
|
||||
//Target has packet to host, malloc new buffer for packet
|
||||
@@ -551,13 +572,15 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_record_hci_data(data, len);
|
||||
|
||||
bool is_adv_rpt = host_recv_adv_packet(data);
|
||||
|
||||
if (!is_adv_rpt) {
|
||||
pkt_size = BT_HDR_SIZE + len;
|
||||
pkt = (BT_HDR *) osi_calloc(pkt_size);
|
||||
if (!pkt) {
|
||||
HCI_TRACE_ERROR("%s couldn't aquire memory for inbound data buffer.\n", __func__);
|
||||
HCI_TRACE_ERROR("%s couldn't acquire memory for inbound data buffer.\n", __func__);
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,10 @@ void hci_shut_down(void)
|
||||
|
||||
bool hci_downstream_data_post(uint32_t timeout)
|
||||
{
|
||||
if (hci_host_env.downstream_data_ready == NULL) {
|
||||
HCI_TRACE_WARNING("%s downstream_data_ready event not created", __func__);
|
||||
return false;
|
||||
}
|
||||
return osi_thread_post_event(hci_host_env.downstream_data_ready, timeout);
|
||||
}
|
||||
|
||||
@@ -263,7 +267,7 @@ static void transmit_command(
|
||||
// in case the upper layer didn't already
|
||||
command->event = MSG_STACK_TO_HC_HCI_CMD;
|
||||
|
||||
HCI_TRACE_DEBUG("HCI Enqueue Comamnd opcode=0x%x\n", metadata->opcode);
|
||||
HCI_TRACE_DEBUG("HCI Enqueue Command opcode=0x%x\n", metadata->opcode);
|
||||
BTTRC_DUMP_BUFFER(NULL, command->data + command->offset, command->len);
|
||||
|
||||
fixed_pkt_queue_enqueue(hci_host_env.command_queue, linked_pkt, FIXED_PKT_QUEUE_MAX_TIMEOUT);
|
||||
|
||||
Reference in New Issue
Block a user