/******************************************************************************
** Static functions
******************************************************************************/
+static void h5_data_ready_cb_signal_exit()
+{
+ pthread_mutex_lock(&rtk_h5.data_mutex);
+ pthread_cond_signal(&rtk_h5.data_cond);
+ pthread_mutex_unlock(&rtk_h5.data_mutex);
+}
static void data_ready_cb_thread()
{
sk_buff *skb;
while (h5_data_ready_running)
{
pthread_mutex_lock(&rtk_h5.data_mutex);
- while ((skb_queue_get_length(rtk_h5.recv_data) == 0))
+ while ((skb_queue_get_length(rtk_h5.recv_data) == 0) && h5_retransfer_running)
{
pthread_cond_wait(&rtk_h5.data_cond, &rtk_h5.data_mutex);
}
pthread_mutex_unlock(&rtk_h5.data_mutex);
+ if(!h5_retransfer_running)
+ break;
+
if((skb = skb_dequeue_head(rtk_h5.recv_data)) != NULL) {
rtk_h5.data_skb = skb;
}
h5_int_hal_callbacks->h5_data_ready_cb(pkt_type, total_length);
}
- H5LogMsg("data_ready_cb_thread exiting");
+ ALOGE("data_ready_cb_thread exiting");
pthread_exit(NULL);
}
}
- H5LogMsg("data_retransfer_thread exiting");
+ ALOGE("data_retransfer_thread exiting");
pthread_exit(NULL);
}
*******************************************************************************/
void hci_h5_cleanup(void)
{
- H5LogMsg("hci_h5_cleanup");
+ ALOGE("hci_h5_cleanup");
//uint8_t try_cnt=10;
int result;
rtk_h5.cleanuping = 1;
+ ms_delay(200);
//btsnoop_cleanup();
if (h5_retransfer_running)
{
h5_retransfer_running = 0;
+ h5_data_ready_cb_signal_exit();
+ if ((result = pthread_join(rtk_h5.thread_data_ready_cb, NULL)) < 0)
+ ALOGE("H5 thread_data_ready_cb pthread_join() FAILED result:%d", result);
+
h5_retransfer_signal_event(H5_EVENT_EXIT);
if ((result = pthread_join(rtk_h5.thread_data_retrans, NULL)) < 0)
ALOGE("H5 pthread_join() FAILED result:%d", result);
ms_delay(200);
+
+ pthread_mutex_destroy(&rtk_h5.data_mutex);
+ pthread_cond_destroy(&rtk_h5.data_cond);
+
pthread_mutex_destroy(&rtk_h5.mutex);
pthread_cond_destroy(&rtk_h5.cond);
if (vnd_userial.fd == -1)
return;
- if((rtkbt_transtype & RTKBT_TRANS_UART) && (rtkbt_transtype & RTKBT_TRANS_H5)) {
-#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
- /* de-assert bt_wake BEFORE closing port */
- ioctl(vnd_userial.fd, USERIAL_IOCTL_BT_WAKE_DEASSERT, NULL);
-#endif
- h5_int_interface->h5_int_cleanup();
- }
vnd_userial.thread_running = false;
sbc_finish(&sco_cb.sbc_enc);
sbc_finish(&sco_cb.sbc_dec);
#endif
+ if((rtkbt_transtype & RTKBT_TRANS_UART) && (rtkbt_transtype & RTKBT_TRANS_H5)) {
+#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
+ /* de-assert bt_wake BEFORE closing port */
+ ioctl(vnd_userial.fd, USERIAL_IOCTL_BT_WAKE_DEASSERT, NULL);
+#endif
+ h5_int_interface->h5_int_cleanup();
+
+ }
}
/*******************************************************************************