Lines Matching refs:p_lcb
54 static BT_HDR* avct_lcb_msg_asmbl(tAVCT_LCB* p_lcb, BT_HDR* p_buf) { in avct_lcb_msg_asmbl() argument
78 if (p_lcb->p_rx_msg != NULL) in avct_lcb_msg_asmbl()
81 osi_free_and_reset((void**)&p_lcb->p_rx_msg); in avct_lcb_msg_asmbl()
88 if (p_lcb->p_rx_msg != NULL) in avct_lcb_msg_asmbl()
91 osi_free(p_lcb->p_rx_msg); in avct_lcb_msg_asmbl()
98 p_lcb->p_rx_msg = (BT_HDR*)osi_malloc(BT_DEFAULT_BUFFER_SIZE); in avct_lcb_msg_asmbl()
99 memcpy(p_lcb->p_rx_msg, p_buf, sizeof(BT_HDR) + p_buf->offset + p_buf->len); in avct_lcb_msg_asmbl()
105 p = (uint8_t*)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset; in avct_lcb_msg_asmbl()
111 p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len; in avct_lcb_msg_asmbl()
114 p_lcb->p_rx_msg->len -= 1; in avct_lcb_msg_asmbl()
121 if (p_lcb->p_rx_msg == NULL) { in avct_lcb_msg_asmbl()
138 if ((p_lcb->p_rx_msg->offset + p_buf->len) > buf_len) { in avct_lcb_msg_asmbl()
141 osi_free_and_reset((void**)&p_lcb->p_rx_msg); in avct_lcb_msg_asmbl()
146 memcpy((uint8_t*)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset, in avct_lcb_msg_asmbl()
150 p_lcb->p_rx_msg->offset -= p_lcb->p_rx_msg->len; in avct_lcb_msg_asmbl()
151 p_lcb->p_rx_msg->len += p_buf->len; in avct_lcb_msg_asmbl()
152 p_ret = p_lcb->p_rx_msg; in avct_lcb_msg_asmbl()
153 p_lcb->p_rx_msg = NULL; in avct_lcb_msg_asmbl()
155 p_lcb->p_rx_msg->offset += p_buf->len; in avct_lcb_msg_asmbl()
156 p_lcb->p_rx_msg->len += p_buf->len; in avct_lcb_msg_asmbl()
176 void avct_lcb_chnl_open(tAVCT_LCB* p_lcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) { in avct_lcb_chnl_open() argument
179 p_lcb->ch_state = AVCT_CH_CONN; in avct_lcb_chnl_open()
180 p_lcb->ch_lcid = in avct_lcb_chnl_open()
181 L2CA_ConnectReq2(AVCT_PSM, p_lcb->peer_addr, BTA_SEC_AUTHENTICATE); in avct_lcb_chnl_open()
182 if (p_lcb->ch_lcid == 0) { in avct_lcb_chnl_open()
186 avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, &avct_lcb_evt); in avct_lcb_chnl_open()
200 void avct_lcb_unbind_disc(UNUSED_ATTR tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_unbind_disc() argument
217 void avct_lcb_open_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_open_ind() argument
226 if (p_ccb->p_lcb == p_lcb) { in avct_lcb_open_ind()
228 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH); in avct_lcb_open_ind()
230 &p_lcb->peer_addr); in avct_lcb_open_ind()
233 else if ((p_ccb->p_lcb == NULL) && (p_ccb->cc.role == AVCT_ACP) && in avct_lcb_open_ind()
234 (avct_lcb_has_pid(p_lcb, p_ccb->cc.pid) == NULL)) { in avct_lcb_open_ind()
237 p_ccb->p_lcb = p_lcb; in avct_lcb_open_ind()
238 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH); in avct_lcb_open_ind()
240 &p_lcb->peer_addr); in avct_lcb_open_ind()
247 avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data); in avct_lcb_open_ind()
262 void avct_lcb_open_fail(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_open_fail() argument
267 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_open_fail()
269 &p_lcb->peer_addr); in avct_lcb_open_fail()
285 void avct_lcb_close_ind(tAVCT_LCB* p_lcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) { in avct_lcb_close_ind() argument
290 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_close_ind()
292 avct_ccb_dealloc(p_ccb, AVCT_DISCONNECT_IND_EVT, 0, &p_lcb->peer_addr); in avct_lcb_close_ind()
294 p_ccb->p_lcb = NULL; in avct_lcb_close_ind()
297 &p_lcb->peer_addr); in avct_lcb_close_ind()
314 void avct_lcb_close_cfm(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_close_cfm() argument
320 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_close_cfm()
330 avct_ccb_dealloc(p_ccb, event, p_data->result, &p_lcb->peer_addr); in avct_lcb_close_cfm()
332 p_ccb->p_lcb = NULL; in avct_lcb_close_cfm()
334 &p_lcb->peer_addr); in avct_lcb_close_cfm()
350 void avct_lcb_bind_conn(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_bind_conn() argument
351 p_data->p_ccb->p_lcb = p_lcb; in avct_lcb_bind_conn()
353 AVCT_CONNECT_CFM_EVT, 0, &p_lcb->peer_addr); in avct_lcb_bind_conn()
367 void avct_lcb_chk_disc(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_chk_disc() argument
368 avct_close_bcb(p_lcb, p_data); in avct_lcb_chk_disc()
369 if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb)) { in avct_lcb_chk_disc()
372 avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data); in avct_lcb_chk_disc()
375 avct_lcb_unbind_disc(p_lcb, p_data); in avct_lcb_chk_disc()
389 void avct_lcb_chnl_disc(tAVCT_LCB* p_lcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) { in avct_lcb_chnl_disc() argument
390 avct_l2c_disconnect(p_lcb->ch_lcid, 0); in avct_lcb_chnl_disc()
404 void avct_lcb_bind_fail(UNUSED_ATTR tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_bind_fail() argument
418 void avct_lcb_cong_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_cong_ind() argument
426 p_lcb->cong = p_data->cong; in avct_lcb_cong_ind()
427 if (!p_lcb->cong && !fixed_queue_is_empty(p_lcb->tx_q)) { in avct_lcb_cong_ind()
428 while (!p_lcb->cong && in avct_lcb_cong_ind()
429 (p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_lcb->tx_q)) != NULL) { in avct_lcb_cong_ind()
430 if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) { in avct_lcb_cong_ind()
431 p_lcb->cong = true; in avct_lcb_cong_ind()
438 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) { in avct_lcb_cong_ind()
440 &p_lcb->peer_addr); in avct_lcb_cong_ind()
455 void avct_lcb_discard_msg(UNUSED_ATTR tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_discard_msg() argument
470 void avct_lcb_send_msg(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_send_msg() argument
477 uint16_t buf_size = p_lcb->peer_mtu + L2CAP_MIN_OFFSET + BT_HDR_SIZE; in avct_lcb_send_msg()
483 if (curr_msg_len <= (p_lcb->peer_mtu - AVCT_HDR_LEN_SINGLE)) { in avct_lcb_send_msg()
487 temp = (curr_msg_len + AVCT_HDR_LEN_START - p_lcb->peer_mtu); in avct_lcb_send_msg()
488 nosp = temp / (p_lcb->peer_mtu - 1) + 1; in avct_lcb_send_msg()
489 if ((temp % (p_lcb->peer_mtu - 1)) != 0) nosp++; in avct_lcb_send_msg()
500 if (p_data->ul_msg.p_buf->len > (p_lcb->peer_mtu - hdr_len)) { in avct_lcb_send_msg()
506 p_buf->len = p_lcb->peer_mtu - hdr_len; in avct_lcb_send_msg()
536 if (p_lcb->cong) { in avct_lcb_send_msg()
537 fixed_queue_enqueue(p_lcb->tx_q, p_buf); in avct_lcb_send_msg()
542 if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) { in avct_lcb_send_msg()
543 p_lcb->cong = true; in avct_lcb_send_msg()
548 if (curr_msg_len > (p_lcb->peer_mtu - AVCT_HDR_LEN_END)) { in avct_lcb_send_msg()
555 fixed_queue_length(p_lcb->tx_q)); in avct_lcb_send_msg()
569 void avct_lcb_free_msg_ind(UNUSED_ATTR tAVCT_LCB* p_lcb, in avct_lcb_free_msg_ind() argument
586 void avct_lcb_msg_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) { in avct_lcb_msg_ind() argument
599 p_data->p_buf = avct_lcb_msg_asmbl(p_lcb, p_data->p_buf); in avct_lcb_msg_ind()
618 p_ccb = avct_lcb_has_pid(p_lcb, pid); in avct_lcb_msg_ind()
640 L2CA_DataWrite(p_lcb->ch_lcid, p_buf); in avct_lcb_msg_ind()