mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
components/bt: Add debug for HCI timeout
This commit is contained in:
@@ -60,7 +60,7 @@
|
|||||||
static xTaskHandle xBtcTaskHandle = NULL;
|
static xTaskHandle xBtcTaskHandle = NULL;
|
||||||
static xQueueHandle xBtcQueue = 0;
|
static xQueueHandle xBtcQueue = 0;
|
||||||
|
|
||||||
void bt_abort_with_coredump_log(void);
|
void bt_abort_with_coredump_log(uint16_t error);
|
||||||
|
|
||||||
static btc_func_t profile_tab[BTC_PID_NUM] = {
|
static btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||||
[BTC_PID_MAIN_INIT] = {btc_main_call_handler, NULL },
|
[BTC_PID_MAIN_INIT] = {btc_main_call_handler, NULL },
|
||||||
@@ -156,7 +156,7 @@ static bt_status_t btc_task_post(btc_msg_t *msg, task_post_t timeout)
|
|||||||
BTC_TRACE_ERROR("Btc Post failed\n");
|
BTC_TRACE_ERROR("Btc Post failed\n");
|
||||||
#ifdef TASK_MONITOR_MODE
|
#ifdef TASK_MONITOR_MODE
|
||||||
ets_printf("!! Btc Post failed.Timeout Abort !!");
|
ets_printf("!! Btc Post failed.Timeout Abort !!");
|
||||||
bt_abort_with_coredump_log();
|
bt_abort_with_coredump_log(0);
|
||||||
#endif
|
#endif
|
||||||
return BT_STATUS_BUSY;
|
return BT_STATUS_BUSY;
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg
|
|||||||
#else
|
#else
|
||||||
return btc_task_post(&lmsg, TASK_POST_BLOCKING);
|
return btc_task_post(&lmsg, TASK_POST_BLOCKING);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (CONFIG_SPIRAM_USE_MALLOC && CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST)
|
#if (CONFIG_SPIRAM_USE_MALLOC && CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST)
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#include "osi/mutex.h"
|
#include "osi/mutex.h"
|
||||||
#include "osi/fixed_queue.h"
|
#include "osi/fixed_queue.h"
|
||||||
|
|
||||||
void bt_abort_with_coredump_log(void);
|
void bt_abort_with_coredump_log(uint16_t error);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_t opcode;
|
uint16_t opcode;
|
||||||
@@ -145,7 +145,7 @@ task_post_status_t hci_host_task_post(task_post_t timeout)
|
|||||||
if (xQueueSend(xHciHostQueue, &evt, timeout) != pdTRUE) {
|
if (xQueueSend(xHciHostQueue, &evt, timeout) != pdTRUE) {
|
||||||
#ifdef TASK_MONITOR_MODE
|
#ifdef TASK_MONITOR_MODE
|
||||||
ets_printf("!! HCI send fail.Timeout Abort !!");
|
ets_printf("!! HCI send fail.Timeout Abort !!");
|
||||||
bt_abort_with_coredump_log();
|
bt_abort_with_coredump_log(0);
|
||||||
#endif
|
#endif
|
||||||
HCI_TRACE_ERROR("xHciHostQueue failed\n");
|
HCI_TRACE_ERROR("xHciHostQueue failed\n");
|
||||||
return TASK_POST_FAIL;
|
return TASK_POST_FAIL;
|
||||||
@@ -277,7 +277,7 @@ static void transmit_command(
|
|||||||
BTTRC_DUMP_BUFFER(NULL, command->data + command->offset, command->len);
|
BTTRC_DUMP_BUFFER(NULL, command->data + command->offset, command->len);
|
||||||
|
|
||||||
fixed_queue_enqueue(hci_host_env.command_queue, wait_entry);
|
fixed_queue_enqueue(hci_host_env.command_queue, wait_entry);
|
||||||
|
|
||||||
#ifdef TASK_MONITOR_MODE
|
#ifdef TASK_MONITOR_MODE
|
||||||
hci_host_task_post(TASK_POST_BLOCKING_WITH_TO);
|
hci_host_task_post(TASK_POST_BLOCKING_WITH_TO);
|
||||||
#else
|
#else
|
||||||
@@ -336,7 +336,7 @@ static void event_command_ready(fixed_queue_t *queue)
|
|||||||
|
|
||||||
wait_entry = fixed_queue_dequeue(queue);
|
wait_entry = fixed_queue_dequeue(queue);
|
||||||
|
|
||||||
if(wait_entry->opcode == HCI_HOST_NUM_PACKETS_DONE
|
if(wait_entry->opcode == HCI_HOST_NUM_PACKETS_DONE
|
||||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||||
|| wait_entry->opcode == HCI_VENDOR_BLE_ADV_REPORT_FLOW_CONTROL
|
|| wait_entry->opcode == HCI_VENDOR_BLE_ADV_REPORT_FLOW_CONTROL
|
||||||
#endif
|
#endif
|
||||||
@@ -432,7 +432,7 @@ static void command_timed_out(void *context)
|
|||||||
// If it's caused by a software bug, fix it. If it's a hardware bug, fix it.
|
// If it's caused by a software bug, fix it. If it's a hardware bug, fix it.
|
||||||
{
|
{
|
||||||
HCI_TRACE_ERROR("%s hci layer timeout waiting for response to a command. opcode: 0x%x", __func__, wait_entry->opcode);
|
HCI_TRACE_ERROR("%s hci layer timeout waiting for response to a command. opcode: 0x%x", __func__, wait_entry->opcode);
|
||||||
abort();
|
bt_abort_with_coredump_log(wait_entry->opcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ extern void avdt_rcv_sync_info (BT_HDR *p_buf);
|
|||||||
#include "btm_ble_int.h"
|
#include "btm_ble_int.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void bt_abort_with_coredump_log(void);
|
void bt_abort_with_coredump_log(uint16_t error);
|
||||||
|
|
||||||
//#if (defined(BT_APP_DEMO) && BT_APP_DEMO == TRUE)
|
//#if (defined(BT_APP_DEMO) && BT_APP_DEMO == TRUE)
|
||||||
//#include "bt_app_common.h"
|
//#include "bt_app_common.h"
|
||||||
@@ -269,7 +269,7 @@ task_post_status_t btu_task_post(uint32_t sig, void *param, task_post_t timeout)
|
|||||||
|
|
||||||
#ifdef TASK_MONITOR_MODE
|
#ifdef TASK_MONITOR_MODE
|
||||||
ets_printf("!! Btu Post failed.Timeout Abort !!");
|
ets_printf("!! Btu Post failed.Timeout Abort !!");
|
||||||
bt_abort_with_coredump_log();
|
bt_abort_with_coredump_log(0);
|
||||||
#endif
|
#endif
|
||||||
return TASK_POST_FAIL;
|
return TASK_POST_FAIL;
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ static void btu_l2cap_alarm_cb(void *data)
|
|||||||
#else
|
#else
|
||||||
btu_task_post(SIG_BTU_L2CAP_ALARM, p_tle, TASK_POST_BLOCKING);
|
btu_task_post(SIG_BTU_L2CAP_ALARM, p_tle, TASK_POST_BLOCKING);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btu_start_quick_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_ticks)
|
void btu_start_quick_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_ticks)
|
||||||
|
@@ -1432,7 +1432,7 @@ extern uint32_t bt_isr_count_arry[16];
|
|||||||
static bool check_bt_is_alive()
|
static bool check_bt_is_alive()
|
||||||
{
|
{
|
||||||
static int stop_times = 0;
|
static int stop_times = 0;
|
||||||
static int64_t last_time = 0;
|
static int64_t last_time = 0;
|
||||||
static int last_clk_ts = -1;
|
static int last_clk_ts = -1;
|
||||||
int stop_timeout = (connection_LinkSuperTimeout*625+5000000);
|
int stop_timeout = (connection_LinkSuperTimeout*625+5000000);
|
||||||
stop_timeout = (stop_timeout > 20000000) ? stop_timeout : 20000000;
|
stop_timeout = (stop_timeout > 20000000) ? stop_timeout : 20000000;
|
||||||
@@ -1440,14 +1440,14 @@ static bool check_bt_is_alive()
|
|||||||
if(last_clk_ts == currect_clkint_ts) {
|
if(last_clk_ts == currect_clkint_ts) {
|
||||||
if(stop_times==0) {
|
if(stop_times==0) {
|
||||||
last_time = esp_timer_get_time();
|
last_time = esp_timer_get_time();
|
||||||
} else if(esp_timer_get_time() - last_time > stop_timeout) {
|
} else if(esp_timer_get_time() - last_time > stop_timeout) {
|
||||||
return BT_NOT_ALIVE;
|
return BT_NOT_ALIVE;
|
||||||
}
|
}
|
||||||
stop_times++;
|
stop_times++;
|
||||||
} else {
|
} else {
|
||||||
stop_times = 0;
|
stop_times = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_clk_ts = currect_clkint_ts;
|
last_clk_ts = currect_clkint_ts;
|
||||||
return BT_IS_ALIVE;
|
return BT_IS_ALIVE;
|
||||||
}
|
}
|
||||||
@@ -1461,7 +1461,7 @@ void esp_bt_check_need_restart()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_abort_with_coredump_log(void)
|
void bt_abort_with_coredump_log(uint16_t error)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__("ill\n");
|
__asm__ __volatile__("ill\n");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user