Home | History | Annotate | Download | only in l2cap

Lines Matching defs:p_lcb

54     tL2C_LCB    *p_lcb = &l2cb.lcb_pool[0];
56 for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++)
58 if (!p_lcb->in_use)
60 memset (p_lcb, 0, sizeof (tL2C_LCB));
62 memcpy (p_lcb->remote_bd_addr, p_bd_addr, BD_ADDR_LEN);
64 p_lcb->in_use = TRUE;
65 p_lcb->link_state = LST_DISCONNECTED;
66 p_lcb->handle = HCI_INVALID_HANDLE;
67 p_lcb->link_flush_tout = 0xFFFF;
68 p_lcb->timer_entry.param = (TIMER_PARAM_TYPE)p_lcb;
69 p_lcb->info_timer_entry.param = (TIMER_PARAM_TYPE)p_lcb;
70 p_lcb->idle_timeout = l2cb.idle_timeout;
71 p_lcb->id = 1; /* spec does not allow '0' */
72 p_lcb->is_bonding = is_bonding;
74 p_lcb->transport = transport;
87 return (p_lcb);
107 tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr (p_bd_addr, BT_TRANSPORT_BR_EDR);
109 if (p_lcb)
114 p_lcb->is_bonding = is_bonding;
128 void l2cu_release_lcb (tL2C_LCB *p_lcb)
132 p_lcb->in_use = FALSE;
133 p_lcb->is_bonding = FALSE;
136 btu_stop_timer (&p_lcb->timer_entry);
137 btu_stop_timer (&p_lcb->info_timer_entry);
140 if (p_lcb->p_hcit_rcv_acl)
142 GKI_freebuf(p_lcb->p_hcit_rcv_acl);
143 p_lcb->p_hcit_rcv_acl = NULL;
148 if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
151 btm_remove_sco_links(p_lcb->remote_bd_addr);
154 if (p_lcb->sent_not_acked > 0)
157 if (p_lcb->transport == BT_TRANSPORT_LE)
159 l2cb.controller_le_xmit_window += p_lcb->sent_not_acked;
168 l2cb.controller_xmit_window += p_lcb->sent_not_acked;
186 if (p_lcb->p_fixed_ccbs[xx])
188 l2cu_release_ccb (p_lcb->p_fixed_ccbs[xx]);
189 p_lcb->p_fixed_ccbs[xx] = NULL;
190 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
192 else if ( (p_lcb->peer_chnl_mask[0] & (1 << (xx + L2CAP_FIRST_FIXED_CHNL)))
194 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
200 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_lcb->ccb_queue.p_first_ccb)
206 if ((p_lcb->link_state == LST_CONNECTED) || (p_lcb->link_state == LST_DISCONNECTING))
208 btm_acl_removed (p_lcb->remote_bd_addr, p_lcb->transport);
210 btm_acl_removed (p_lcb->remote_bd_addr, BT_TRANSPORT_BR_EDR);
213 while (p_lcb->link_xmit_data_q.p_first)
214 GKI_freebuf (GKI_dequeue (&p_lcb->link_xmit_data_q));
218 l2c_ucd_delete_sec_pending_q(p_lcb);
223 if (p_lcb->transport == BT_TRANSPORT_LE)
240 if (p_lcb->p_echo_rsp_cb)
242 tL2CA_ECHO_RSP_CB *p_cb = p_lcb->p_echo_rsp_cb;
245 p_lcb->p_echo_rsp_cb = NULL;
265 tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
267 for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++)
269 if ((p_lcb->in_use) &&
271 p_lcb->transport == transport &&
273 (!memcmp (p_lcb->remote_bd_addr, p_bd_addr, BD_ADDR_LEN)))
275 return (p_lcb);
312 BOOLEAN l2c_is_cmd_rejected (UINT8 cmd_code, UINT8 id, tL2C_LCB *p_lcb)
324 l2cu_send_peer_cmd_reject (p_lcb, L2CAP_CMD_REJ_MTU_EXCEEDED, id, L2CAP_DEFAULT_MTU, 0);
342 BT_HDR *l2cu_build_header (tL2C_LCB *p_lcb, UINT16 len, UINT8 cmd, UINT8 id)
359 if (p_lcb->transport == BT_TRANSPORT_LE)
361 UINT16_TO_STREAM (p, (p_lcb->handle | (L2CAP_PKT_START_NON_FLUSHABLE << L2CAP_PKT_TYPE_SHIFT)));
367 UINT16_TO_STREAM (p, p_lcb->handle | l2cb.non_flushable_pbf);
369 UINT16_TO_STREAM (p, (p_lcb->handle | (L2CAP_PKT_START << L2CAP_PKT_TYPE_SHIFT)));
377 if (p_lcb->transport == BT_TRANSPORT_LE)
405 void l2cu_adj_id (tL2C_LCB *p_lcb, UINT8 adj_mask)
407 if ((adj_mask & L2CAP_ADJ_ZERO_ID) && !p_lcb->id)
409 p_lcb->id++;
423 void l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id,
438 if ((p_buf = l2cu_build_header (p_lcb, (UINT16) (L2CAP_CMD_REJECT_LEN + param_len), L2CAP_CMD_REJECT, rem_id)) == NULL )
455 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
475 p_ccb->p_lcb->id++;
476 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID);
478 p_ccb->local_id = p_ccb->p_lcb->id;
480 if ((p_buf = l2cu_build_header (p_ccb->p_lcb, L2CAP_CONN_REQ_LEN, L2CAP_CMD_CONN_REQ,
493 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf);
521 if ((p_buf=l2cu_build_header(p_ccb->p_lcb, L2CAP_CONN_RSP_LEN, L2CAP_CMD_CONN_RSP, p_ccb->remote_id)) == NULL)
535 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf);
550 void l2cu_reject_connection (tL2C_LCB *p_lcb, UINT16 remote_cid, UINT8 rem_id, UINT16 result)
555 if ((p_buf = l2cu_build_header(p_lcb, L2CAP_CONN_RSP_LEN, L2CAP_CMD_CONN_RSP, rem_id)) == NULL )
568 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
588 p_ccb->p_lcb->id++;
589 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID);
591 p_ccb->local_id = p_ccb->p_lcb->id;
606 if ((p_buf = l2cu_build_header (p_ccb->p_lcb, (UINT16) (L2CAP_CONFIG_REQ_LEN + cfg_len),
675 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf);
706 if ((p_buf = l2cu_build_header (p_ccb->p_lcb, (UINT16)(L2CAP_CONFIG_RSP_LEN + cfg_len),
768 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf);
814 UINT16_TO_STREAM (p, (p_ccb->p_lcb->handle | (L2CAP_PKT_START_NON_FLUSHABLE << L2CAP_PKT_TYPE_SHIFT)));
819 UINT16_TO_STREAM (p, (p_ccb->p_lcb->handle | (L2CAP_PKT_START << L2CAP_PKT_TYPE_SHIFT)));
897 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf);
916 p_ccb->p_lcb->id++;
917 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID);
919 p_ccb->local_id = p_ccb->p_lcb->id;
921 if ((p_buf = l2cu_build_header(p_ccb->p_lcb, L2CAP_DISC_REQ_LEN, L2CAP_CMD_DISC_REQ, p_ccb->local_id)) == NULL)
941 l2c_link_check_send_pkts (p_ccb->p_lcb, p_ccb, p_buf2);
945 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf);
963 void l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid,
969 if ((p_buf=l2cu_build_header(p_lcb, L2CAP_DISC_RSP_LEN, L2CAP_CMD_DISC_RSP, remote_id)) == NULL)
980 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
995 void l2cu_send_peer_echo_req (tL2C_LCB *p_lcb, UINT8 *p_data, UINT16 data_len)
1000 p_lcb->id++;
1001 l2cu_adj_id(p_lcb, L2CAP_ADJ_ZERO_ID); /* check for wrap to '0' */
1003 if ((p_buf = l2cu_build_header(p_lcb, (UINT16) (L2CAP_ECHO_REQ_LEN + data_len), L2CAP_CMD_ECHO_REQ, p_lcb->id)) == NULL)
1016 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
1030 void l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len)
1036 if (!id || id == p_lcb->cur_echo_id)
1043 p_lcb->cur_echo_id = id;
1060 if ((p_buf = l2cu_build_header (p_lcb, (UINT16)(L2CAP_ECHO_RSP_LEN + data_len), L2CAP_CMD_ECHO_RSP, id)) == NULL)
1074 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
1086 void l2cu_send_peer_info_req (tL2C_LCB *p_lcb, UINT16 info_type)
1092 p_lcb->id++;
1093 l2cu_adj_id(p_lcb, L2CAP_ADJ_ID);
1095 if ((p_buf = l2cu_build_header(p_lcb, 2, L2CAP_CMD_INFO_REQ, p_lcb->id)) == NULL)
1108 p_lcb->w4_info_rsp = TRUE;
1109 btu_start_timer (&p_lcb->info_timer_entry, BTU_TTYPE_L2CAP_INFO, L2CAP_WAIT_INFO_RSP_TOUT);
1111 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
1125 void l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 info_type)
1155 if ((p_buf = l2cu_build_header(p_lcb, len, L2CAP_CMD_INFO_RSP, remote_id)) == NULL)
1178 if (p_lcb->transport == BT_TRANSPORT_LE)
1227 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
1247 if (p_ccb->p_lcb != NULL)
1248 p_q = &p_ccb->p_lcb->ccb_queue;
1252 L2CAP_TRACE_ERROR ("l2cu_enqueue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: 0x%08x",
1253 p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb);
1304 if (p_ccb->p_lcb != NULL)
1307 if (p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb == 0 )
1310 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = p_ccb;
1312 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = p_ccb;
1314 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].quota = L2CAP_GET_PRIORITY_QUOTA(p_ccb->ccb_priority);
1317 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb++;
1340 if (p_ccb->p_lcb != NULL)
1341 p_q = &p_ccb->p_lcb->ccb_queue;
1345 L2CAP_TRACE_ERROR ("l2cu_dequeue_ccb CID: 0x%04x ERROR in_use: %u p_lcb: 0x%08x p_q: 0x%08x p_q->p_first_ccb: 0x%08x",
1346 p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb, p_q, p_q ? p_q->p_first_ccb : 0);
1352 if (p_ccb->p_lcb != NULL)
1355 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb--;
1358 if (p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb == 0 )
1360 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = NULL;
1361 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = NULL;
1366 if ( p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb == p_ccb )
1368 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = p_ccb->p_next_ccb;
1371 if ( p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb == p_ccb )
1374 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb
1375 = p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb;
1436 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb = 0;
1437 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = NULL;
1438 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = NULL;
1442 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = p_ccb;
1443 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = p_ccb;
1444 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].quota = L2CAP_GET_PRIORITY_QUOTA(p_ccb->ccb_priority);
1445 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb = 1;
1462 tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid)
1515 p_ccb->p_lcb = p_lcb;
1521 if (p_lcb)
1618 tL2C_LCB *p_lcb = l2cu_find_lcb_by_handle(handle);
1620 if (!p_lcb)
1623 p_lcb->is_bonding = FALSE;
1626 if (p_lcb->ccb_queue.p_first_ccb != NULL)
1630 if ( (p_lcb->link_state == LST_CONNECTED) || (p_lcb->link_state == LST_CONNECTING) || (p_lcb->link_state == LST_DISCONNECTING) )
1632 if (p_lcb->idle_timeout == 0)
1634 if (btsnd_hcic_disconnect (p_lcb->handle, HCI_ERR_PEER_USER))
1636 p_lcb->link_state = LST_DISCONNECTING;
1648 btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, timeout);
1669 tL2C_LCB *p_lcb = p_ccb->p_lcb;
1683 btm_sec_clr_temp_auth_service (p_lcb->remote_bd_addr);
1694 if ( (p_lcb) &&
1705 p_ccb->p_lcb = NULL;
1728 if ((p_lcb) && p_lcb->in_use && (p_lcb->link_state == LST_CONNECTED))
1730 if (!p_lcb->ccb_queue.p_first_ccb)
1732 l2cu_no_dynamic_ccbs (p_lcb);
1752 tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, UINT16 remote_cid)
1757 if (!p_lcb)
1763 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb)
2070 tL2C_LCB *p_lcb;
2100 if (p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_NO_CRC)
2131 p_lcb = p_ccb->p_lcb;
2133 if (p_cfg->flush_to < p_lcb->link_flush_tout)
2135 p_lcb->link_flush_tout = p_cfg->flush_to;
2142 btsnd_hcic_write_auto_flush_tout (p_lcb->handle, hci_flush_to);
2186 tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
2188 for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++)
2190 if ((p_lcb->in_use) && (p_lcb->handle != HCI_INVALID_HANDLE))
2192 l2c_link_hci_disc_comp (p_lcb->handle, (UINT8) -1);
2213 BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport)
2226 BTM_ReadDevInfo(p_lcb->remote_bd_addr, &dev_type, &addr_type);
2233 p_lcb->ble_addr_type = addr_type;
2234 p_lcb->transport = BT_TRANSPORT_LE;
2236 return (l2cble_create_conn(p_lcb));
2244 if (p_lcb_cur == p_lcb)
2269 p_lcb->link_state = LST_CONNECTING_WAIT_SWITCH;
2270 p_lcb->link_role = HCI_ROLE_MASTER;
2274 btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, L2CAP_LINK_ROLE_SWITCH_TOUT);
2281 p_lcb->link_state = LST_CONNECTING;
2283 return (l2cu_create_conn_after_switch (p_lcb));
2299 tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
2301 for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++)
2303 if ((p_lcb->in_use) && (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH))
2323 BOOLEAN l2cu_create_conn_after_switch (tL2C_LCB *p_lcb)
2332 tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_lcb->remote_bd_addr);
2338 l2cb.disallow_switch, num_acl, no_hi_prio_chs, p_lcb->is_bonding);
2342 if ( ((!l2cb.disallow_switch && (num_acl < 3)) || (p_lcb->is_bonding && (no_hi_prio_chs==0)))
2348 p_lcb->link_state = LST_CONNECTING;
2352 if ( (clock_offset = tcs_wug_get_clk_offset( p_lcb->remote_bd_addr )) != 0 )
2362 if ((p_inq_info = BTM_InqDbRead(p_lcb->remote_bd_addr)) != NULL)
2380 if (!btsnd_hcic_create_conn (p_lcb->remote_bd_addr,
2391 l2cu_release_lcb (p_lcb);
2399 btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK,
2419 tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
2421 for (i = 0; i < MAX_L2CAP_LINKS; i++, p_lcb++)
2423 if ((p_lcb->in_use) && (p_lcb->link_state == state))
2425 return (p_lcb);
2448 tL2C_LCB *p_lcb;
2453 p_lcb = &l2cb.lcb_pool[0];
2455 for (i = 0; i < MAX_L2CAP_LINKS; i++, p_lcb++)
2457 if (p_lcb->in_use)
2460 if ((!p_lcb->ccb_queue.p_first_ccb) || (p_lcb->link_state == LST_DISCONNECTING))
2466 else if (p_lcb->ccb_queue.p_first_ccb == p_lcb->ccb_queue.p_last_ccb)
2468 p_ccb = p_lcb->ccb_queue.p_first_ccb;
2498 tL2C_LCB *p_lcb;
2506 if ((p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR)) == NULL)
2515 if ((!reset_after_rs && (priority != p_lcb->acl_priority)) ||
2517 ( reset_after_rs && p_lcb->acl_priority == L2CAP_PRIORITY_HIGH))
2523 UINT16_TO_STREAM (pp, p_lcb->handle);
2529 if (p_lcb->acl_priority != priority)
2531 p_lcb->acl_priority = priority;
2570 tL2C_LCB *p_lcb;
2580 p_lcb = l2cu_find_lcb_by_bd_addr (p_bda, BT_TRANSPORT_BR_EDR);
2583 if (p_lcb)
2586 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_next_ccb)
2600 for (xx = 0, p_lcb = &l2cb.lcb_pool[0]; xx < MAX_L2CAP_LINKS; xx++, p_lcb++)
2602 if (p_lcb->in_use)
2605 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_next_ccb)
2646 packet_size = btm_get_max_packet_size (p_ccb->p_lcb->remote_bd_addr);
2686 BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr)
2692 if (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] != NULL)
2698 btu_stop_timer(&p_lcb->timer_entry);
2725 p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = p_ccb;
2726 p_ccb->p_lcb = p_lcb;
2729 if (p_lcb->link_state == LST_CONNECTED)
2749 void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb)
2752 UINT16 timeout = p_lcb->idle_timeout;
2759 if ( (p_lcb->p_fixed_ccbs[xx] != NULL) && (p_lcb->p_fixed_ccbs[xx]->fixed_chnl_idle_tout > timeout) )
2760 timeout = p_lcb->p_fixed_ccbs[xx]->fixed_chnl_idle_tout;
2765 if (p_lcb->is_bonding)
2772 rc = btm_sec_disconnect (p_lcb->handle, HCI_ERR_PEER_USER);
2775 l2cu_process_fixed_disc_cback(p_lcb);
2776 p_lcb->link_state = LST_DISCONNECTING;
2781 l2cu_process_fixed_disc_cback(p_lcb);
2783 p_lcb->link_state = LST_DISCONNECTING;
2786 else if ( (p_lcb->is_bonding)
2787 && (btsnd_hcic_disconnect (p_lcb->handle, HCI_ERR_PEER_USER)) )
2789 l2cu_process_fixed_disc_cback(p_lcb);
2790 p_lcb->link_state = LST_DISCONNECTING;
2803 btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, timeout);
2807 btu_stop_timer(&p_lcb->timer_entry);
2821 void l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb)
2826 if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
2827 p_lcb->peer_chnl_mask[0] &= ~(L2CAP_FIXED_CHNL_ATT_BIT| \
2837 if (p_lcb->transport == BT_TRANSPORT_BR_EDR &&
2844 if (p_lcb->peer_chnl_mask[0] & (1 << (xx + L2CAP_FIRST_FIXED_CHNL)))
2846 if (p_lcb->p_fixed_ccbs[xx])
2847 p_lcb->p_fixed_ccbs[xx]->chnl_state = CST_OPEN;
2849 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, TRUE, 0, p_lcb->transport);
2851 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, TRUE, 0, BT_TRANSPORT_BR_EDR);
2857 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
2859 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
2862 if (p_lcb->p_fixed_ccbs[xx])
2864 l2cu_release_ccb (p_lcb->p_fixed_ccbs[xx]);
2865 p_lcb->p_fixed_ccbs[xx] = NULL;
2884 void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb)
2891 if (p_lcb->p_fixed_ccbs[xx])
2893 if (p_lcb->p_fixed_ccbs[xx] != p_lcb->p_pending_ccb)
2895 l2cu_release_ccb (p_lcb->p_fixed_ccbs[xx]);
2896 p_lcb->p_fixed_ccbs[xx] = NULL;
2898 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
2900 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
2904 else if ( (p_lcb->peer_chnl_mask[0] & (1 << (xx + L2CAP_FIRST_FIXED_CHNL)))
2907 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
2909 (*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(p_lcbp_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
2926 void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout)
2932 p_lcb->id++;
2933 l2cu_adj_id (p_lcb, L2CAP_ADJ_ID);
2935 if ((p_buf = l2cu_build_header (p_lcb, L2CAP_CMD_BLE_UPD_REQ_LEN, L2CAP_CMD_BLE_UPDATE_REQ, p_lcb->id)) == NULL )
2949 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
2962 void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id)
2967 if ((p_buf = l2cu_build_header (p_lcb, L2CAP_CMD_BLE_UPD_RSP_LEN, L2CAP_CMD_BLE_UPDATE_RSP, rem_id)) == NULL )
2978 l2c_link_check_send_pkts (p_lcb, NULL, p_buf);
3001 tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
3003 for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++)
3005 if ((p_lcb->in_use) && (p_lcb->handle == handle))
3007 return (p_lcb);
3026 tL2C_CCB *l2cu_find_ccb_by_cid (tL2C_LCB *p_lcb, UINT16 local_cid)
3049 else if (p_lcb && p_lcb != p_ccb->p_lcb)
3063 &&(p_lcb == p_ccb->p_lcb))
3088 static tL2C_CCB *l2cu_get_next_channel_in_rr(tL2C_LCB *p_lcb)
3099 for ( j = 0; (j < p_lcb->rr_serv[p_lcb->rr_pri].num_ccb)&&(!p_serve_ccb); j++)
3102 p_ccb = p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb;
3106 L2CAP_TRACE_ERROR("p_serve_ccb is NULL, rr_pri=%d", p_lcb->rr_pri);
3119 p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb = p_lcb->rr_serv[p_lcb->rr_pri].p_first_ccb;
3124 p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb = p_ccb->p_next_ccb;
3159 p_lcb->rr_serv[p_lcb->rr_pri].quota--;
3163 if ((p_lcb->rr_serv[p_lcb->rr_pri].quota == 0)||(!p_serve_ccb))
3166 p_lcb->rr_pri = (p_lcb->rr_pri + 1) % L2CAP_NUM_CHNL_PRIORITY;
3168 p_lcb->rr_serv[p_lcb->rr_pri].quota = L2CAP_GET_PRIORITY_QUOTA(p_lcb->rr_pri);
3176 p_lcb->rr_serv[p_serve_ccb->ccb_priority].quota,
3195 static tL2C_CCB *l2cu_get_next_channel(tL2C_LCB *p_lcb)
3201 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb)
3241 BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb)
3252 if ((p_ccb = p_lcb->p_fixed_ccbs[xx]) == NULL)
3303 p_ccb = l2cu_get_next_channel_in_rr( p_lcb );
3305 p_ccb = l2cu_get_next_channel( p_lcb );
3355 if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE)
3357 UINT16_TO_STREAM (p, p_ccb->p_lcb->handle | (L2CAP_PKT_START_NON_FLUSHABLE << L2CAP_PKT_TYPE_SHIFT));
3376 UINT16_TO_STREAM (p, p_ccb->p_lcb->handle | (L2CAP_PKT_START << L2CAP_PKT_TYPE_SHIFT));
3380 UINT16_TO_STREAM (p, p_ccb->p_lcb->handle | l2cb.non_flushable_pbf);
3383 UINT16_TO_STREAM (p, p_ccb->p_lcb->handle | (L2CAP_PKT_START << L2CAP_PKT_TYPE_SHIFT));
3416 p_lcb->ucd_out_sec_pending_q.count;
3448 p_ccb->p_lcb->ucd_out_sec_pending_q.count,
3450 p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb( p_ccb->p_lcb->remote_bd_addr, FALSE );
3460 if (p_ccb->p_lcb->p_fixed_ccbs[xx] == p_ccb)
3463 (* l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb)(p_ccb->p_lcb->remote_bd_addr, FALSE);
3490 p_ccb->p_lcb->ucd_out_sec_pending_q.count,
3492 p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb( p_ccb->p_lcb->remote_bd_addr, TRUE );
3502 if (p_ccb->p_lcb->p_fixed_ccbs[xx] == p_ccb)
3505 (* l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb)(p_ccb->p_lcb->remote_bd_addr, TRUE);