Lines Matching refs:p_ccb
50 static void avdt_ccb_clear_ccb(AvdtpCcb* p_ccb) { in avdt_ccb_clear_ccb() argument
54 p_ccb->cong = false; in avdt_ccb_clear_ccb()
55 p_ccb->ret_count = 0; in avdt_ccb_clear_ccb()
58 osi_free_and_reset((void**)&p_ccb->p_curr_msg); in avdt_ccb_clear_ccb()
61 osi_free_and_reset((void**)&p_ccb->p_rx_msg); in avdt_ccb_clear_ccb()
64 while ((p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->rsp_q)) != NULL) in avdt_ccb_clear_ccb()
79 void avdt_ccb_chan_open(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chan_open() argument
80 avdt_ad_open_req(AVDT_CHAN_SIG, p_ccb, NULL, AVDT_INT); in avdt_ccb_chan_open()
94 void avdt_ccb_chan_close(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chan_close() argument
96 avdt_ad_close_req(AVDT_CHAN_SIG, p_ccb, NULL); in avdt_ccb_chan_close()
110 void avdt_ccb_chk_close(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chk_close() argument
112 AvdtpScb* p_scb = &(p_ccb->scb[0]); in avdt_ccb_chk_close()
116 if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb)) { in avdt_ccb_chk_close()
123 alarm_cancel(p_ccb->ret_ccb_timer); in avdt_ccb_chk_close()
124 alarm_cancel(p_ccb->rsp_ccb_timer); in avdt_ccb_chk_close()
126 alarm_set_on_mloop(p_ccb->idle_ccb_timer, interval_ms, in avdt_ccb_chk_close()
127 avdt_ccb_idle_ccb_timer_timeout, p_ccb); in avdt_ccb_chk_close()
144 void avdt_ccb_hdl_discover_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_discover_cmd() argument
146 AvdtpScb* p_scb = &(p_ccb->scb[0]); in avdt_ccb_hdl_discover_cmd()
148 AVDT_TRACE_DEBUG("%s: p_ccb index=%d", __func__, avdt_ccb_to_idx(p_ccb)); in avdt_ccb_hdl_discover_cmd()
169 avdt_ccb_event(p_ccb, AVDT_CCB_API_DISCOVER_RSP_EVT, p_data); in avdt_ccb_hdl_discover_cmd()
184 void avdt_ccb_hdl_discover_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_discover_rsp() argument
186 p_ccb->proc_busy = false; in avdt_ccb_hdl_discover_rsp()
189 (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_DISCOVER_CFM_EVT, in avdt_ccb_hdl_discover_rsp()
191 p_ccb->BtaAvScbIndex()); in avdt_ccb_hdl_discover_rsp()
207 void avdt_ccb_hdl_getcap_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_getcap_cmd() argument
215 avdt_msg_send_rej(p_ccb, AVDT_SIG_START, &p_data->msg); in avdt_ccb_hdl_getcap_cmd()
221 avdt_ccb_event(p_ccb, AVDT_CCB_API_GETCAP_RSP_EVT, p_data); in avdt_ccb_hdl_getcap_cmd()
236 void avdt_ccb_hdl_getcap_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_getcap_rsp() argument
238 p_ccb->proc_busy = false; in avdt_ccb_hdl_getcap_rsp()
241 (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_GETCAP_CFM_EVT, in avdt_ccb_hdl_getcap_rsp()
243 p_ccb->BtaAvScbIndex()); in avdt_ccb_hdl_getcap_rsp()
259 void avdt_ccb_hdl_start_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_start_cmd() argument
264 avdt_scb_verify(p_ccb, AVDT_VERIFY_START, p_data->msg.multi.seid_list, in avdt_ccb_hdl_start_cmd()
268 avdt_ccb_event(p_ccb, AVDT_CCB_API_START_RSP_EVT, p_data); in avdt_ccb_hdl_start_cmd()
273 avdt_msg_send_rej(p_ccb, AVDT_SIG_START, &p_data->msg); in avdt_ccb_hdl_start_cmd()
290 void avdt_ccb_hdl_start_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_start_rsp() argument
301 p = (uint8_t*)(p_ccb->p_curr_cmd + 1); in avdt_ccb_hdl_start_rsp()
304 for (i = 0; i < p_ccb->p_curr_cmd->len; i++) { in avdt_ccb_hdl_start_rsp()
326 void avdt_ccb_hdl_suspend_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_suspend_cmd() argument
331 if ((seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_SUSPEND, in avdt_ccb_hdl_suspend_cmd()
336 avdt_ccb_event(p_ccb, AVDT_CCB_API_SUSPEND_RSP_EVT, p_data); in avdt_ccb_hdl_suspend_cmd()
341 avdt_msg_send_rej(p_ccb, AVDT_SIG_SUSPEND, &p_data->msg); in avdt_ccb_hdl_suspend_cmd()
360 void avdt_ccb_hdl_suspend_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_suspend_rsp() argument
371 p = (uint8_t*)(p_ccb->p_curr_cmd + 1); in avdt_ccb_hdl_suspend_rsp()
374 for (i = 0; i < p_ccb->p_curr_cmd->len; i++) { in avdt_ccb_hdl_suspend_rsp()
395 void avdt_ccb_snd_discover_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_discover_cmd() argument
397 p_ccb->p_proc_data = p_data->discover.p_sep_info; in avdt_ccb_snd_discover_cmd()
398 p_ccb->proc_cback = p_data->discover.p_cback; in avdt_ccb_snd_discover_cmd()
399 p_ccb->proc_param = p_data->discover.num_seps; in avdt_ccb_snd_discover_cmd()
402 p_ccb->proc_busy = true; in avdt_ccb_snd_discover_cmd()
405 avdt_msg_send_cmd(p_ccb, NULL, AVDT_SIG_DISCOVER, NULL); in avdt_ccb_snd_discover_cmd()
420 void avdt_ccb_snd_discover_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_discover_rsp() argument
422 avdt_msg_send_rsp(p_ccb, AVDT_SIG_DISCOVER, &p_data->msg); in avdt_ccb_snd_discover_rsp()
438 void avdt_ccb_snd_getcap_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_getcap_cmd() argument
442 p_ccb->p_proc_data = p_data->getcap.p_cfg; in avdt_ccb_snd_getcap_cmd()
443 p_ccb->proc_cback = p_data->getcap.p_cback; in avdt_ccb_snd_getcap_cmd()
446 p_ccb->proc_busy = true; in avdt_ccb_snd_getcap_cmd()
452 avdt_msg_send_cmd(p_ccb, NULL, sig_id, (tAVDT_MSG*)&p_data->getcap.single); in avdt_ccb_snd_getcap_cmd()
467 void avdt_ccb_snd_getcap_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_getcap_rsp() argument
474 avdt_msg_send_rsp(p_ccb, sig_id, &p_data->msg); in avdt_ccb_snd_getcap_rsp()
490 void avdt_ccb_snd_start_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_start_cmd() argument
503 avdt_scb_verify(p_ccb, AVDT_VERIFY_OPEN, p_data->msg.multi.seid_list, in avdt_ccb_snd_start_cmd()
512 avdt_msg_send_cmd(p_ccb, seid_list, AVDT_SIG_START, &p_data->msg); in avdt_ccb_snd_start_cmd()
540 void avdt_ccb_snd_start_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_start_rsp() argument
545 avdt_msg_send_rsp(p_ccb, AVDT_SIG_START, &p_data->msg); in avdt_ccb_snd_start_rsp()
570 void avdt_ccb_snd_suspend_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_suspend_cmd() argument
581 avdt_scb_verify(p_ccb, AVDT_VERIFY_STREAMING, p_data->msg.multi.seid_list, in avdt_ccb_snd_suspend_cmd()
588 avdt_msg_send_cmd(p_ccb, seid_list, AVDT_SIG_SUSPEND, &p_data->msg); in avdt_ccb_snd_suspend_cmd()
615 void avdt_ccb_snd_suspend_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_suspend_rsp() argument
620 avdt_msg_send_rsp(p_ccb, AVDT_SIG_SUSPEND, &p_data->msg); in avdt_ccb_snd_suspend_rsp()
645 void avdt_ccb_clear_cmds(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_clear_cmds() argument
647 AvdtpScb* p_scb = &(p_ccb->scb[0]); in avdt_ccb_clear_cmds()
651 avdt_ccb_clear_ccb(p_ccb); in avdt_ccb_clear_cmds()
661 avdt_ccb_cmd_fail(p_ccb, &avdt_ccb_evt); in avdt_ccb_clear_cmds()
664 p_ccb->p_curr_cmd = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->cmd_q); in avdt_ccb_clear_cmds()
666 } while (p_ccb->p_curr_cmd != NULL); in avdt_ccb_clear_cmds()
670 if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb)) { in avdt_ccb_clear_cmds()
688 void avdt_ccb_cmd_fail(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_cmd_fail() argument
693 if (p_ccb->p_curr_cmd != NULL) { in avdt_ccb_cmd_fail()
697 msg.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb); in avdt_ccb_cmd_fail()
700 evt = avdt_msg_rej_2_evt[p_ccb->p_curr_cmd->event - 1]; in avdt_ccb_cmd_fail()
705 avdt_ccb_event(p_ccb, (uint8_t)(evt & ~AVDT_CCB_MKR), &avdt_ccb_evt); in avdt_ccb_cmd_fail()
708 p_scb = avdt_scb_by_hdl(*((uint8_t*)(p_ccb->p_curr_cmd + 1))); in avdt_ccb_cmd_fail()
716 osi_free_and_reset((void**)&p_ccb->p_curr_cmd); in avdt_ccb_cmd_fail()
731 void avdt_ccb_free_cmd(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_free_cmd() argument
732 osi_free_and_reset((void**)&p_ccb->p_curr_cmd); in avdt_ccb_free_cmd()
746 void avdt_ccb_cong_state(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_cong_state() argument
747 p_ccb->cong = p_data->llcong; in avdt_ccb_cong_state()
763 void avdt_ccb_ret_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_ret_cmd() argument
764 p_ccb->ret_count++; in avdt_ccb_ret_cmd()
765 if (p_ccb->ret_count == AVDT_RET_MAX) { in avdt_ccb_ret_cmd()
767 p_ccb->ret_count = 0; in avdt_ccb_ret_cmd()
770 avdt_ccb_cmd_fail(p_ccb, &avdt_ccb_evt); in avdt_ccb_ret_cmd()
773 avdt_ccb_snd_cmd(p_ccb, p_data); in avdt_ccb_ret_cmd()
776 if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && in avdt_ccb_ret_cmd()
777 (p_ccb->p_curr_cmd != NULL)) { in avdt_ccb_ret_cmd()
780 memcpy(p_msg, p_ccb->p_curr_cmd, in avdt_ccb_ret_cmd()
781 (sizeof(BT_HDR) + p_ccb->p_curr_cmd->offset + in avdt_ccb_ret_cmd()
782 p_ccb->p_curr_cmd->len)); in avdt_ccb_ret_cmd()
783 avdt_msg_send(p_ccb, p_msg); in avdt_ccb_ret_cmd()
787 alarm_cancel(p_ccb->idle_ccb_timer); in avdt_ccb_ret_cmd()
788 alarm_cancel(p_ccb->rsp_ccb_timer); in avdt_ccb_ret_cmd()
790 alarm_set_on_mloop(p_ccb->ret_ccb_timer, interval_ms, in avdt_ccb_ret_cmd()
791 avdt_ccb_ret_ccb_timer_timeout, p_ccb); in avdt_ccb_ret_cmd()
806 void avdt_ccb_snd_cmd(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_cmd() argument
812 if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && in avdt_ccb_snd_cmd()
813 (p_ccb->p_curr_cmd == NULL)) { in avdt_ccb_snd_cmd()
814 p_msg = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->cmd_q); in avdt_ccb_snd_cmd()
817 p_ccb->p_curr_cmd = (BT_HDR*)osi_malloc(AVDT_CMD_BUF_SIZE); in avdt_ccb_snd_cmd()
818 memcpy(p_ccb->p_curr_cmd, p_msg, in avdt_ccb_snd_cmd()
820 avdt_msg_send(p_ccb, p_msg); in avdt_ccb_snd_cmd()
835 void avdt_ccb_snd_msg(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_msg() argument
839 if (!p_ccb->cong) { in avdt_ccb_snd_msg()
841 if (p_ccb->p_curr_msg != NULL) { in avdt_ccb_snd_msg()
842 avdt_msg_send(p_ccb, NULL); in avdt_ccb_snd_msg()
845 else if (!fixed_queue_is_empty(p_ccb->rsp_q)) { in avdt_ccb_snd_msg()
846 while ((p_msg = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->rsp_q)) != NULL) { in avdt_ccb_snd_msg()
847 if (avdt_msg_send(p_ccb, p_msg)) { in avdt_ccb_snd_msg()
855 avdt_ccb_snd_cmd(p_ccb, NULL); in avdt_ccb_snd_msg()
871 void avdt_ccb_set_reconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_set_reconn() argument
872 p_ccb->reconn = true; in avdt_ccb_set_reconn()
885 void avdt_ccb_clr_reconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_clr_reconn() argument
886 p_ccb->reconn = false; in avdt_ccb_clr_reconn()
901 void avdt_ccb_chk_reconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chk_reconn() argument
902 if (p_ccb->reconn) { in avdt_ccb_chk_reconn()
903 p_ccb->reconn = false; in avdt_ccb_chk_reconn()
906 avdt_ccb_clear_ccb(p_ccb); in avdt_ccb_chk_reconn()
912 avdt_ccb_cmd_fail(p_ccb, &avdt_ccb_evt); in avdt_ccb_chk_reconn()
915 avdt_ccb_event(p_ccb, AVDT_CCB_UL_OPEN_EVT, NULL); in avdt_ccb_chk_reconn()
917 avdt_ccb_ll_closed(p_ccb, NULL); in avdt_ccb_chk_reconn()
932 void avdt_ccb_chk_timer(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chk_timer() argument
933 alarm_cancel(p_ccb->idle_ccb_timer); in avdt_ccb_chk_timer()
946 void avdt_ccb_set_conn(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_set_conn() argument
948 p_ccb->p_conn_cback = p_data->connect.p_cback; in avdt_ccb_set_conn()
961 void avdt_ccb_set_disconn(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_set_disconn() argument
968 p_ccb->p_conn_cback = p_data->disconnect.p_cback; in avdt_ccb_set_disconn()
981 void avdt_ccb_do_disconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_do_disconn() argument
983 avdt_ccb_clear_cmds(p_ccb, NULL); in avdt_ccb_do_disconn()
986 avdt_ccb_chan_close(p_ccb, NULL); in avdt_ccb_do_disconn()
999 void avdt_ccb_ll_closed(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_ll_closed() argument
1003 AVDT_TRACE_DEBUG("%s peer %s", __func__, p_ccb->peer_addr.ToString().c_str()); in avdt_ccb_ll_closed()
1006 avdt_ccb_clear_cmds(p_ccb, NULL); in avdt_ccb_ll_closed()
1009 p_cback = p_ccb->p_conn_cback; in avdt_ccb_ll_closed()
1011 RawAddress bd_addr = p_ccb->peer_addr; in avdt_ccb_ll_closed()
1012 uint8_t bta_av_scb_index = p_ccb->BtaAvScbIndex(); in avdt_ccb_ll_closed()
1015 avdt_ccb_dealloc(p_ccb, NULL); in avdt_ccb_ll_closed()
1035 void avdt_ccb_ll_opened(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_ll_opened() argument
1039 p_ccb->peer_addr.ToString().c_str(), p_ccb->BtaAvScbIndex(), in avdt_ccb_ll_opened()
1040 p_ccb); in avdt_ccb_ll_opened()
1041 p_ccb->ll_opened = true; in avdt_ccb_ll_opened()
1043 if (!p_ccb->p_conn_cback) p_ccb->p_conn_cback = avdtp_cb.p_conn_cback; in avdt_ccb_ll_opened()
1046 if (p_ccb->p_conn_cback) { in avdt_ccb_ll_opened()
1049 (*p_ccb->p_conn_cback)(0, p_ccb->peer_addr, AVDT_CONNECT_IND_EVT, in avdt_ccb_ll_opened()
1050 &avdt_ctrl, p_ccb->BtaAvScbIndex()); in avdt_ccb_ll_opened()