Lines Matching defs:p_lcb

53 static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
75 if (p_lcb->p_rx_msg != NULL)
77 GKI_freebuf(p_lcb->p_rx_msg);
78 p_lcb->p_rx_msg = NULL;
87 if (p_lcb->p_rx_msg != NULL)
89 GKI_freebuf(p_lcb->p_rx_msg);
96 p_lcb->p_rx_msg = (BT_HDR*)GKI_getbuf(GKI_MAX_BUF_SIZE);
97 if (p_lcb->p_rx_msg == NULL)
104 memcpy (p_lcb->p_rx_msg, p_buf,
110 p = (UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset;
116 p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len;
119 p_lcb->p_rx_msg->len -= 1;
127 if (p_lcb->p_rx_msg == NULL)
136 buf_len = GKI_get_buf_size(p_lcb->p_rx_msg) - sizeof(BT_HDR);
143 if ((p_lcb->p_rx_msg->offset + p_buf->len) > buf_len)
146 GKI_freebuf(p_lcb->p_rx_msg);
147 p_lcb->p_rx_msg = NULL;
155 memcpy((UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset,
160 p_lcb->p_rx_msg->offset -= p_lcb->p_rx_msg->len;
161 p_lcb->p_rx_msg->len += p_buf->len;
162 p_ret = p_lcb->p_rx_msg;
163 p_lcb->p_rx_msg = NULL;
167 p_lcb->p_rx_msg->offset += p_buf->len;
168 p_lcb->p_rx_msg->len += p_buf->len;
189 void avct_lcb_chnl_open(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
194 BTM_SetOutService(p_lcb->peer_addr, BTM_SEC_SERVICE_AVCTP, 0);
196 p_lcb->ch_state = AVCT_CH_CONN;
197 if ((p_lcb->ch_lcid = L2CA_ConnectReq(AVCT_PSM, p_lcb->peer_addr)) == 0)
200 avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, (tAVCT_LCB_EVT *) &result);
214 void avct_lcb_unbind_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
216 UNUSED(p_lcb);
234 void avct_lcb_open_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
246 if (p_ccb->p_lcb == p_lcb)
249 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH);
251 0, p_lcb->peer_addr);
254 else if ((p_ccb->p_lcb == NULL) && (p_ccb->cc.role == AVCT_ACP) &&
255 (avct_lcb_has_pid(p_lcb, p_ccb->cc.pid) == NULL))
259 p_ccb->p_lcb = p_lcb;
260 L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH);
262 0, p_lcb->peer_addr);
270 avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
285 void avct_lcb_open_fail(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
292 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
295 p_data->result, p_lcb->peer_addr);
311 void avct_lcb_close_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
319 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
324 0, p_lcb->peer_addr);
328 p_ccb->p_lcb = NULL;
330 0, p_lcb->peer_addr);
347 void avct_lcb_close_cfm(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
355 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
370 avct_ccb_dealloc(p_ccb, event, p_data->result, p_lcb->peer_addr);
374 p_ccb->p_lcb = NULL;
376 p_data->result, p_lcb->peer_addr);
392 void avct_lcb_bind_conn(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
394 p_data->p_ccb->p_lcb = p_lcb;
396 AVCT_CONNECT_CFM_EVT, 0, p_lcb->peer_addr);
411 void avct_lcb_chk_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
415 avct_close_bcb(p_lcb, p_data);
417 if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb))
421 avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
426 avct_lcb_unbind_disc(p_lcb, p_data);
440 void avct_lcb_chnl_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
444 L2CA_DisconnectReq(p_lcb->ch_lcid);
458 void avct_lcb_bind_fail(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
460 UNUSED(p_lcb);
475 void avct_lcb_cong_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
484 p_lcb->cong = p_data->cong;
485 if (p_lcb->cong == FALSE && GKI_getfirst(&p_lcb->tx_q))
487 while ( !p_lcb->cong && (p_buf = (BT_HDR *)GKI_dequeue(&p_lcb->tx_q)) != NULL)
489 if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED)
491 p_lcb->cong = TRUE;
499 if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
501 (*p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_ccb), event, 0, p_lcb->peer_addr);
516 void avct_lcb_discard_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
518 UNUSED(p_lcb);
535 void avct_lcb_send_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
544 UINT16 buf_size = p_lcb->peer_mtu + L2CAP_MIN_OFFSET + BT_HDR_SIZE;
551 if (curr_msg_len <= (p_lcb->peer_mtu - AVCT_HDR_LEN_SINGLE))
558 temp = (curr_msg_len + AVCT_HDR_LEN_START - p_lcb->peer_mtu);
559 nosp = temp / (p_lcb->peer_mtu - 1) + 1;
560 if ( (temp % (p_lcb->peer_mtu - 1)) != 0)
571 if (p_data->ul_msg.p_buf->len > (p_lcb->peer_mtu - hdr_len))
584 p_buf->len = p_lcb->peer_mtu - hdr_len;
615 if (p_lcb->cong == TRUE)
617 GKI_enqueue (&p_lcb->tx_q, p_buf);
623 if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED)
625 p_lcb->cong = TRUE;
630 if (curr_msg_len > (p_lcb->peer_mtu - AVCT_HDR_LEN_END))
639 AVCT_TRACE_DEBUG ("avct_lcb_send_msg tx_q_count:%d", GKI_queue_length(&p_lcb->tx_q));
653 void avct_lcb_free_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
655 UNUSED(p_lcb);
672 void avct_lcb_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
686 if ((p_data->p_buf = avct_lcb_msg_asmbl(p_lcb, p_data->p_buf)) == NULL)
707 if ((p_ccb = avct_lcb_has_pid(p_lcb, pid)) != NULL)
730 L2CA_DataWrite(p_lcb->ch_lcid, p_buf);