Lines Matching refs:p_lcb
51 static BT_HDR* avct_lcb_msg_asmbl(tAVCT_LCB* p_lcb, BT_HDR* p_buf) { in avct_lcb_msg_asmbl() argument
75 if (p_lcb->p_rx_msg != NULL) in avct_lcb_msg_asmbl()
78 osi_free_and_reset((void**)&p_lcb->p_rx_msg); in avct_lcb_msg_asmbl()
85 if (p_lcb->p_rx_msg != NULL) in avct_lcb_msg_asmbl()
88 osi_free(p_lcb->p_rx_msg); in avct_lcb_msg_asmbl()
95 p_lcb->p_rx_msg = (BT_HDR*)osi_malloc(BT_DEFAULT_BUFFER_SIZE); in avct_lcb_msg_asmbl()
96 memcpy(p_lcb->p_rx_msg, p_buf, sizeof(BT_HDR) + p_buf->offset + p_buf->len); in avct_lcb_msg_asmbl()
102 p = (uint8_t*)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset; in avct_lcb_msg_asmbl()
108 p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len; in avct_lcb_msg_asmbl()
111 p_lcb->p_rx_msg->len -= 1; in avct_lcb_msg_asmbl()
118 if (p_lcb->p_rx_msg == NULL) { in avct_lcb_msg_asmbl()
135 if ((p_lcb->p_rx_msg->offset + p_buf->len) > buf_len) { in avct_lcb_msg_asmbl()
138 osi_free_and_reset((void**)&p_lcb->p_rx_msg); in avct_lcb_msg_asmbl()
143 memcpy((uint8_t*)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset, in avct_lcb_msg_asmbl()
147 p_lcb->p_rx_msg->offset -= p_lcb->p_rx_msg->len; in avct_lcb_msg_asmbl()
148 p_lcb->p_rx_msg->len += p_buf->len; in avct_lcb_msg_asmbl()
149 p_ret = p_lcb->p_rx_msg; in avct_lcb_msg_asmbl()
150 p_lcb->p_rx_msg = NULL; in avct_lcb_msg_asmbl()
152 p_lcb->p_rx_msg->offset += p_buf->len; in avct_lcb_msg_asmbl()
153 p_lcb->p_rx_msg->len += p_buf->len; in avct_lcb_msg_asmbl()
173 void avct_lcb_chnl_open(tAVCT_LCB* p_lcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) { in avct_lcb_chnl_open() argument
176 BTM_SetOutService(p_lcb->peer_addr, BTM_SEC_SERVICE_AVCTP, 0); in avct_lcb_chnl_open()
178 p_lcb->ch_state = AVCT_CH_CONN; in avct_lcb_chnl_open()
179 p_lcb->ch_lcid = L2CA_ConnectReq(AVCT_PSM, p_lcb->peer_addr); in avct_lcb_chnl_open()
180 if (p_lcb->ch_lcid == 0) { in avct_lcb_chnl_open()
184 avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, &avct_lcb_evt); in avct_lcb_chnl_open()
198 void avct_lcb_unbind_disc(UNUSED_ATTR tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_unbind_disc() argument
215 void avct_lcb_open_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_open_ind() argument
224 if (p_ccb->p_lcb == p_lcb) { in avct_lcb_open_ind()
226 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH); in avct_lcb_open_ind()
228 &p_lcb->peer_addr); in avct_lcb_open_ind()
231 else if ((p_ccb->p_lcb == NULL) && (p_ccb->cc.role == AVCT_ACP) && in avct_lcb_open_ind()
232 (avct_lcb_has_pid(p_lcb, p_ccb->cc.pid) == NULL)) { in avct_lcb_open_ind()
235 p_ccb->p_lcb = p_lcb; in avct_lcb_open_ind()
236 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH); in avct_lcb_open_ind()
238 &p_lcb->peer_addr); in avct_lcb_open_ind()
245 avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data); in avct_lcb_open_ind()
260 void avct_lcb_open_fail(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_open_fail() argument
265 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_open_fail()
267 &p_lcb->peer_addr); in avct_lcb_open_fail()
283 void avct_lcb_close_ind(tAVCT_LCB* p_lcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) { in avct_lcb_close_ind() argument
288 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_close_ind()
290 avct_ccb_dealloc(p_ccb, AVCT_DISCONNECT_IND_EVT, 0, &p_lcb->peer_addr); in avct_lcb_close_ind()
292 p_ccb->p_lcb = NULL; in avct_lcb_close_ind()
295 &p_lcb->peer_addr); in avct_lcb_close_ind()
312 void avct_lcb_close_cfm(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_close_cfm() argument
318 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_close_cfm()
328 avct_ccb_dealloc(p_ccb, event, p_data->result, &p_lcb->peer_addr); in avct_lcb_close_cfm()
330 p_ccb->p_lcb = NULL; in avct_lcb_close_cfm()
332 &p_lcb->peer_addr); in avct_lcb_close_cfm()
348 void avct_lcb_bind_conn(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_bind_conn() argument
349 p_data->p_ccb->p_lcb = p_lcb; in avct_lcb_bind_conn()
351 AVCT_CONNECT_CFM_EVT, 0, &p_lcb->peer_addr); in avct_lcb_bind_conn()
366 void avct_lcb_chk_disc(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_chk_disc() argument
369 avct_close_bcb(p_lcb, p_data); in avct_lcb_chk_disc()
370 if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb)) { in avct_lcb_chk_disc()
373 avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data); in avct_lcb_chk_disc()
376 avct_lcb_unbind_disc(p_lcb, p_data); in avct_lcb_chk_disc()
390 void avct_lcb_chnl_disc(tAVCT_LCB* p_lcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) { in avct_lcb_chnl_disc() argument
391 L2CA_DisconnectReq(p_lcb->ch_lcid); in avct_lcb_chnl_disc()
405 void avct_lcb_bind_fail(UNUSED_ATTR tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_bind_fail() argument
419 void avct_lcb_cong_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_cong_ind() argument
427 p_lcb->cong = p_data->cong; in avct_lcb_cong_ind()
428 if (!p_lcb->cong && !fixed_queue_is_empty(p_lcb->tx_q)) { in avct_lcb_cong_ind()
429 while (!p_lcb->cong && in avct_lcb_cong_ind()
430 (p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_lcb->tx_q)) != NULL) { in avct_lcb_cong_ind()
431 if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) { in avct_lcb_cong_ind()
432 p_lcb->cong = true; in avct_lcb_cong_ind()
439 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_cong_ind()
441 &p_lcb->peer_addr); in avct_lcb_cong_ind()
456 void avct_lcb_discard_msg(UNUSED_ATTR tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_discard_msg() argument
471 void avct_lcb_send_msg(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_send_msg() argument
478 uint16_t buf_size = p_lcb->peer_mtu + L2CAP_MIN_OFFSET + BT_HDR_SIZE; in avct_lcb_send_msg()
484 if (curr_msg_len <= (p_lcb->peer_mtu - AVCT_HDR_LEN_SINGLE)) { in avct_lcb_send_msg()
488 temp = (curr_msg_len + AVCT_HDR_LEN_START - p_lcb->peer_mtu); in avct_lcb_send_msg()
489 nosp = temp / (p_lcb->peer_mtu - 1) + 1; in avct_lcb_send_msg()
490 if ((temp % (p_lcb->peer_mtu - 1)) != 0) nosp++; in avct_lcb_send_msg()
501 if (p_data->ul_msg.p_buf->len > (p_lcb->peer_mtu - hdr_len)) { in avct_lcb_send_msg()
507 p_buf->len = p_lcb->peer_mtu - hdr_len; in avct_lcb_send_msg()
537 if (p_lcb->cong) { in avct_lcb_send_msg()
538 fixed_queue_enqueue(p_lcb->tx_q, p_buf); in avct_lcb_send_msg()
543 if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) { in avct_lcb_send_msg()
544 p_lcb->cong = true; in avct_lcb_send_msg()
549 if (curr_msg_len > (p_lcb->peer_mtu - AVCT_HDR_LEN_END)) { in avct_lcb_send_msg()
556 fixed_queue_length(p_lcb->tx_q)); in avct_lcb_send_msg()
570 void avct_lcb_free_msg_ind(UNUSED_ATTR tAVCT_LCB* p_lcb, in avct_lcb_free_msg_ind() argument
587 void avct_lcb_msg_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_msg_ind() argument
600 p_data->p_buf = avct_lcb_msg_asmbl(p_lcb, p_data->p_buf); in avct_lcb_msg_ind()
619 p_ccb = avct_lcb_has_pid(p_lcb, pid); in avct_lcb_msg_ind()
641 L2CA_DataWrite(p_lcb->ch_lcid, p_buf); in avct_lcb_msg_ind()