1 /****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 /****************************************************************************** 20 * 21 * This file contains L2CAP internal definitions 22 * 23 ******************************************************************************/ 24 #ifndef L2C_INT_H 25 #define L2C_INT_H 26 27 #include <stdbool.h> 28 #include "stack/btm_api.h" 29 #include "stack/l2c_api.h" 30 #include "stack/l2cdefs.h" 31 #include "osi/list.h" 32 #include "osi/fixed_queue.h" 33 34 #define L2CAP_MIN_MTU 48 /* Minimum acceptable MTU is 48 bytes */ 35 36 /* LE credit based L2CAP connection parameters */ 37 #define L2CAP_LE_MIN_MTU 23 38 #define L2CAP_LE_MIN_MPS 23 39 #define L2CAP_LE_MAX_MPS 65533 40 #define L2CAP_LE_MIN_CREDIT 0 41 #define L2CAP_LE_MAX_CREDIT 65535 42 #define L2CAP_LE_DEFAULT_MTU 512 43 #define L2CAP_LE_DEFAULT_MPS 23 44 #define L2CAP_LE_DEFAULT_CREDIT 1 45 46 47 /* Timeouts. Since L2CAP works off a 1-second list, all are in seconds. 48 */ 49 #define L2CAP_LINK_ROLE_SWITCH_TOUT 10 /* 10 seconds */ 50 #define L2CAP_LINK_CONNECT_TOUT 60 /* 30 seconds */ 51 #define L2CAP_LINK_CONNECT_TOUT_EXT 120 /* 120 seconds */ 52 #define L2CAP_ECHO_RSP_TOUT 30 /* 30 seconds */ 53 #define L2CAP_LINK_FLOW_CONTROL_TOUT 2 /* 2 seconds */ 54 #define L2CAP_LINK_DISCONNECT_TOUT 45 /* 45 seconds */ 55 56 #ifndef L2CAP_CHNL_CONNECT_TOUT /* BTIF needs to override for internal project needs */ 57 #define L2CAP_CHNL_CONNECT_TOUT 60 /* 60 seconds */ 58 #endif 59 60 #define L2CAP_CHNL_CONNECT_TOUT_EXT 120 /* 120 seconds */ 61 #define L2CAP_CHNL_CFG_TIMEOUT 30 /* 30 seconds */ 62 #define L2CAP_CHNL_DISCONNECT_TOUT 10 /* 10 seconds */ 63 #define L2CAP_DELAY_CHECK_SM4 2 /* 2 seconds */ 64 #define L2CAP_WAIT_INFO_RSP_TOUT 3 /* 3 seconds */ 65 #define L2CAP_WAIT_UNPARK_TOUT 2 /* 2 seconds */ 66 #define L2CAP_LINK_INFO_RESP_TOUT 2 /* 2 seconds */ 67 #define L2CAP_UPDATE_CONN_PARAM_TOUT 6 /* 6 seconds */ 68 #define L2CAP_BLE_LINK_CONNECT_TOUT BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT // configed in menuconfig 69 #define L2CAP_BLE_CONN_PARAM_UPD_TOUT 30 /* 30 seconds */ 70 71 /* quick timer uses millisecond unit */ 72 #define L2CAP_DEFAULT_RETRANS_TOUT 2000 /* 2000 milliseconds */ 73 #define L2CAP_DEFAULT_MONITOR_TOUT 12000 /* 12000 milliseconds */ 74 #define L2CAP_FCR_ACK_TOUT 200 /* 200 milliseconds */ 75 76 #define L2CAP_CACHE_ATT_ACL_NUM 10 77 78 /* Define the possible L2CAP channel states. The names of 79 ** the states may seem a bit strange, but they are taken from 80 ** the Bluetooth specification. 81 */ 82 typedef enum { 83 CST_CLOSED, /* Channel is in clodes state */ 84 CST_ORIG_W4_SEC_COMP, /* Originator waits security clearence */ 85 CST_TERM_W4_SEC_COMP, /* Acceptor waits security clearence */ 86 CST_W4_L2CAP_CONNECT_RSP, /* Waiting for peer conenct response */ 87 CST_W4_L2CA_CONNECT_RSP, /* Waiting for upper layer connect rsp */ 88 CST_CONFIG, /* Negotiating configuration */ 89 CST_OPEN, /* Data transfer state */ 90 CST_W4_L2CAP_DISCONNECT_RSP, /* Waiting for peer disconnect rsp */ 91 CST_W4_L2CA_DISCONNECT_RSP /* Waiting for upper layer disc rsp */ 92 } tL2C_CHNL_STATE; 93 94 /* Define the possible L2CAP link states 95 */ 96 typedef enum { 97 LST_DISCONNECTED, 98 LST_CONNECT_HOLDING, 99 LST_CONNECTING_WAIT_SWITCH, 100 LST_CONNECTING, 101 LST_CONNECTED, 102 LST_DISCONNECTING 103 } tL2C_LINK_STATE; 104 105 106 107 /* Define input events to the L2CAP link and channel state machines. The names 108 ** of the events may seem a bit strange, but they are taken from 109 ** the Bluetooth specification. 110 */ 111 #define L2CEVT_LP_CONNECT_CFM 0 /* Lower layer connect confirm */ 112 #define L2CEVT_LP_CONNECT_CFM_NEG 1 /* Lower layer connect confirm (failed) */ 113 #define L2CEVT_LP_CONNECT_IND 2 /* Lower layer connect indication */ 114 #define L2CEVT_LP_DISCONNECT_IND 3 /* Lower layer disconnect indication */ 115 #define L2CEVT_LP_QOS_CFM 4 /* Lower layer QOS confirmation */ 116 #define L2CEVT_LP_QOS_CFM_NEG 5 /* Lower layer QOS confirmation (failed)*/ 117 #define L2CEVT_LP_QOS_VIOLATION_IND 6 /* Lower layer QOS violation indication */ 118 119 #define L2CEVT_SEC_COMP 7 /* Security cleared successfully */ 120 #define L2CEVT_SEC_COMP_NEG 8 /* Security procedure failed */ 121 122 #define L2CEVT_L2CAP_CONNECT_REQ 10 /* Peer connection request */ 123 #define L2CEVT_L2CAP_CONNECT_RSP 11 /* Peer connection response */ 124 #define L2CEVT_L2CAP_CONNECT_RSP_PND 12 /* Peer connection response pending */ 125 #define L2CEVT_L2CAP_CONNECT_RSP_NEG 13 /* Peer connection response (failed) */ 126 #define L2CEVT_L2CAP_CONFIG_REQ 14 /* Peer configuration request */ 127 #define L2CEVT_L2CAP_CONFIG_RSP 15 /* Peer configuration response */ 128 #define L2CEVT_L2CAP_CONFIG_RSP_NEG 16 /* Peer configuration response (failed) */ 129 #define L2CEVT_L2CAP_DISCONNECT_REQ 17 /* Peer disconnect request */ 130 #define L2CEVT_L2CAP_DISCONNECT_RSP 18 /* Peer disconnect response */ 131 #define L2CEVT_L2CAP_INFO_RSP 19 /* Peer information response */ 132 #define L2CEVT_L2CAP_DATA 20 /* Peer data */ 133 134 #define L2CEVT_L2CA_CONNECT_REQ 21 /* Upper layer connect request */ 135 #define L2CEVT_L2CA_CONNECT_RSP 22 /* Upper layer connect response */ 136 #define L2CEVT_L2CA_CONNECT_RSP_NEG 23 /* Upper layer connect response (failed)*/ 137 #define L2CEVT_L2CA_CONFIG_REQ 24 /* Upper layer config request */ 138 #define L2CEVT_L2CA_CONFIG_RSP 25 /* Upper layer config response */ 139 #define L2CEVT_L2CA_CONFIG_RSP_NEG 26 /* Upper layer config response (failed) */ 140 #define L2CEVT_L2CA_DISCONNECT_REQ 27 /* Upper layer disconnect request */ 141 #define L2CEVT_L2CA_DISCONNECT_RSP 28 /* Upper layer disconnect response */ 142 #define L2CEVT_L2CA_DATA_READ 29 /* Upper layer data read */ 143 #define L2CEVT_L2CA_DATA_WRITE 30 /* Upper layer data write */ 144 #define L2CEVT_L2CA_FLUSH_REQ 31 /* Upper layer flush */ 145 146 #define L2CEVT_TIMEOUT 32 /* Timeout */ 147 #define L2CEVT_SEC_RE_SEND_CMD 33 /* btm_sec has enough info to proceed */ 148 149 #define L2CEVT_ACK_TIMEOUT 34 /* RR delay timeout */ 150 151 152 /* Bitmask to skip over Broadcom feature reserved (ID) to avoid sending two 153 successive ID values, '0' id only or both */ 154 #define L2CAP_ADJ_BRCM_ID 0x1 155 #define L2CAP_ADJ_ZERO_ID 0x2 156 #define L2CAP_ADJ_ID 0x3 157 158 /* Return values for l2cu_process_peer_cfg_req() */ 159 #define L2CAP_PEER_CFG_UNACCEPTABLE 0 160 #define L2CAP_PEER_CFG_OK 1 161 #define L2CAP_PEER_CFG_DISCONNECT 2 162 163 /* eL2CAP option constants */ 164 #define L2CAP_MIN_RETRANS_TOUT 2000 /* Min retransmission timeout if no flush timeout or PBF */ 165 #define L2CAP_MIN_MONITOR_TOUT 12000 /* Min monitor timeout if no flush timeout or PBF */ 166 167 #define L2CAP_MAX_FCR_CFG_TRIES 2 /* Config attempts before disconnecting */ 168 169 #ifndef MIN 170 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) 171 #endif 172 typedef uint8_t tL2C_BLE_FIXED_CHNLS_MASK; 173 174 typedef struct { 175 UINT8 next_tx_seq; /* Next sequence number to be Tx'ed */ 176 UINT8 last_rx_ack; /* Last sequence number ack'ed by the peer */ 177 UINT8 next_seq_expected; /* Next peer sequence number expected */ 178 UINT8 last_ack_sent; /* Last peer sequence number ack'ed */ 179 UINT8 num_tries; /* Number of retries to send a packet */ 180 UINT8 max_held_acks; /* Max acks we can hold before sending */ 181 182 BOOLEAN remote_busy; /* TRUE if peer has flowed us off */ 183 BOOLEAN local_busy; /* TRUE if we have flowed off the peer */ 184 185 BOOLEAN rej_sent; /* Reject was sent */ 186 BOOLEAN srej_sent; /* Selective Reject was sent */ 187 BOOLEAN wait_ack; /* Transmitter is waiting ack (poll sent) */ 188 BOOLEAN rej_after_srej; /* Send a REJ when SREJ clears */ 189 190 BOOLEAN send_f_rsp; /* We need to send an F-bit response */ 191 192 UINT16 rx_sdu_len; /* Length of the SDU being received */ 193 BT_HDR *p_rx_sdu; /* Buffer holding the SDU being received */ 194 fixed_queue_t *waiting_for_ack_q; /* Buffers sent and waiting for peer to ack */ 195 fixed_queue_t *srej_rcv_hold_q; /* Buffers rcvd but held pending SREJ rsp */ 196 fixed_queue_t *retrans_q; /* Buffers being retransmitted */ 197 198 TIMER_LIST_ENT ack_timer; /* Timer delaying RR */ 199 TIMER_LIST_ENT mon_retrans_timer; /* Timer Monitor or Retransmission */ 200 201 #if (L2CAP_ERTM_STATS == TRUE) 202 UINT32 connect_tick_count; /* Time channel was established */ 203 UINT32 ertm_pkt_counts[2]; /* Packets sent and received */ 204 UINT32 ertm_byte_counts[2]; /* Bytes sent and received */ 205 UINT32 s_frames_sent[4]; /* S-frames sent (RR, REJ, RNR, SREJ) */ 206 UINT32 s_frames_rcvd[4]; /* S-frames rcvd (RR, REJ, RNR, SREJ) */ 207 UINT32 xmit_window_closed; /* # of times the xmit window was closed */ 208 UINT32 controller_idle; /* # of times less than 2 packets in controller */ 209 /* when the xmit window was closed */ 210 UINT32 pkts_retransmitted; /* # of packets that were retransmitted */ 211 UINT32 retrans_touts; /* # of retransmission timouts */ 212 UINT32 xmit_ack_touts; /* # of xmit ack timouts */ 213 214 #define L2CAP_ERTM_STATS_NUM_AVG 10 215 #define L2CAP_ERTM_STATS_AVG_NUM_SAMPLES 100 216 UINT32 ack_delay_avg_count; 217 UINT32 ack_delay_avg_index; 218 UINT32 throughput_start; 219 UINT32 throughput[L2CAP_ERTM_STATS_NUM_AVG]; 220 UINT32 ack_delay_avg[L2CAP_ERTM_STATS_NUM_AVG]; 221 UINT32 ack_delay_min[L2CAP_ERTM_STATS_NUM_AVG]; 222 UINT32 ack_delay_max[L2CAP_ERTM_STATS_NUM_AVG]; 223 UINT32 ack_q_count_avg[L2CAP_ERTM_STATS_NUM_AVG]; 224 UINT32 ack_q_count_min[L2CAP_ERTM_STATS_NUM_AVG]; 225 UINT32 ack_q_count_max[L2CAP_ERTM_STATS_NUM_AVG]; 226 #endif 227 } tL2C_FCRB; 228 229 230 /* Define a registration control block. Every application (e.g. RFCOMM, SDP, 231 ** TCS etc) that registers with L2CAP is assigned one of these. 232 */ 233 #if (L2CAP_UCD_INCLUDED == TRUE) 234 #define L2C_UCD_RCB_ID 0x00 235 #define L2C_UCD_STATE_UNUSED 0x00 236 #define L2C_UCD_STATE_W4_DATA 0x01 237 #define L2C_UCD_STATE_W4_RECEPTION 0x02 238 #define L2C_UCD_STATE_W4_MTU 0x04 239 240 typedef struct { 241 UINT8 state; 242 tL2CAP_UCD_CB_INFO cb_info; 243 } tL2C_UCD_REG; 244 #endif 245 246 typedef struct { 247 BOOLEAN in_use; 248 UINT16 psm; 249 UINT16 real_psm; /* This may be a dummy RCB for an o/b connection but */ 250 /* this is the real PSM that we need to connect to */ 251 #if (L2CAP_UCD_INCLUDED == TRUE) 252 tL2C_UCD_REG ucd; 253 #endif 254 255 tL2CAP_APPL_INFO api; 256 } tL2C_RCB; 257 258 typedef void (tL2CAP_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT transport, 259 void *p_ref_data, tBTM_STATUS result); 260 261 typedef struct 262 { 263 UINT16 psm; 264 tBT_TRANSPORT transport; 265 BOOLEAN is_originator; 266 tL2CAP_SEC_CBACK *p_callback; 267 void *p_ref_data; 268 }tL2CAP_SEC_DATA; 269 270 #ifndef L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 271 #define L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 10 272 #endif 273 /* Define a channel control block (CCB). There may be many channel control blocks 274 ** between the same two Bluetooth devices (i.e. on the same link). 275 ** Each CCB has unique local and remote CIDs. All channel control blocks on 276 ** the same physical link and are chained together. 277 */ 278 typedef struct t_l2c_ccb { 279 BOOLEAN in_use; /* TRUE when in use, FALSE when not */ 280 tL2C_CHNL_STATE chnl_state; /* Channel state */ 281 tL2CAP_LE_CFG_INFO local_conn_cfg; /* Our config for ble conn oriented channel */ 282 tL2CAP_LE_CFG_INFO peer_conn_cfg; /* Peer device config ble conn oriented channel */ 283 284 struct t_l2c_ccb *p_next_ccb; /* Next CCB in the chain */ 285 struct t_l2c_ccb *p_prev_ccb; /* Previous CCB in the chain */ 286 struct t_l2c_linkcb *p_lcb; /* Link this CCB is assigned to */ 287 288 UINT16 local_cid; /* Local CID */ 289 UINT16 remote_cid; /* Remote CID */ 290 291 TIMER_LIST_ENT timer_entry; /* CCB Timer List Entry */ 292 293 tL2C_RCB *p_rcb; /* Registration CB for this Channel */ 294 bool should_free_rcb; /* True if RCB was allocated on the heap */ 295 296 #define IB_CFG_DONE 0x01 297 #define OB_CFG_DONE 0x02 298 #define RECONFIG_FLAG 0x04 /* True after initial configuration */ 299 #define CFG_DONE_MASK (IB_CFG_DONE | OB_CFG_DONE) 300 301 UINT8 config_done; /* Configuration flag word */ 302 UINT8 local_id; /* Transaction ID for local trans */ 303 UINT8 remote_id; /* Transaction ID for local */ 304 305 #define CCB_FLAG_NO_RETRY 0x01 /* no more retry */ 306 #define CCB_FLAG_SENT_PENDING 0x02 /* already sent pending response */ 307 UINT8 flags; 308 309 tL2CAP_CFG_INFO our_cfg; /* Our saved configuration options */ 310 tL2CAP_CH_CFG_BITS peer_cfg_bits; /* Store what peer wants to configure */ 311 tL2CAP_CFG_INFO peer_cfg; /* Peer's saved configuration options */ 312 313 fixed_queue_t *xmit_hold_q; /* Transmit data hold queue */ 314 BOOLEAN cong_sent; /* Set when congested status sent */ 315 UINT16 buff_quota; /* Buffer quota before sending congestion */ 316 317 tL2CAP_CHNL_PRIORITY ccb_priority; /* Channel priority */ 318 tL2CAP_CHNL_DATA_RATE tx_data_rate; /* Channel Tx data rate */ 319 tL2CAP_CHNL_DATA_RATE rx_data_rate; /* Channel Rx data rate */ 320 321 /* Fields used for eL2CAP */ 322 tL2CAP_ERTM_INFO ertm_info; 323 tL2C_FCRB fcrb; 324 UINT16 tx_mps; /* TX MPS adjusted based on current controller */ 325 UINT16 max_rx_mtu; 326 UINT8 fcr_cfg_tries; /* Max number of negotiation attempts */ 327 BOOLEAN peer_cfg_already_rejected; /* If mode rejected once, set to TRUE */ 328 BOOLEAN out_cfg_fcr_present; /* TRUE if cfg response shoulkd include fcr options */ 329 330 #define L2CAP_CFG_FCS_OUR 0x01 /* Our desired config FCS option */ 331 #define L2CAP_CFG_FCS_PEER 0x02 /* Peer's desired config FCS option */ 332 #define L2CAP_BYPASS_FCS (L2CAP_CFG_FCS_OUR | L2CAP_CFG_FCS_PEER) 333 UINT8 bypass_fcs; 334 335 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE) 336 BOOLEAN is_flushable; /* TRUE if channel is flushable */ 337 #endif 338 339 #if (L2CAP_NUM_FIXED_CHNLS > 0) || (L2CAP_UCD_INCLUDED == TRUE) 340 UINT16 fixed_chnl_idle_tout; /* Idle timeout to use for the fixed channel */ 341 #endif 342 UINT16 tx_data_len; 343 } tL2C_CCB; 344 345 /*********************************************************************** 346 ** Define a queue of linked CCBs. 347 */ 348 typedef struct { 349 tL2C_CCB *p_first_ccb; /* The first channel in this queue */ 350 tL2C_CCB *p_last_ccb; /* The last channel in this queue */ 351 } tL2C_CCB_Q; 352 353 #if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) 354 355 /* Round-Robin service for the same priority channels */ 356 #define L2CAP_NUM_CHNL_PRIORITY 3 /* Total number of priority group (high, medium, low)*/ 357 #define L2CAP_CHNL_PRIORITY_WEIGHT 5 /* weight per priority for burst transmission quota */ 358 #define L2CAP_GET_PRIORITY_QUOTA(pri) ((L2CAP_NUM_CHNL_PRIORITY - (pri)) * L2CAP_CHNL_PRIORITY_WEIGHT) 359 360 /* CCBs within the same LCB are served in round robin with priority */ 361 /* It will make sure that low priority channel (for example, HF signaling on RFCOMM) */ 362 /* can be sent to headset even if higher priority channel (for example, AV media channel) */ 363 /* is congested. */ 364 365 typedef struct { 366 tL2C_CCB *p_serve_ccb; /* current serving ccb within priority group */ 367 tL2C_CCB *p_first_ccb; /* first ccb of priority group */ 368 UINT8 num_ccb; /* number of channels in priority group */ 369 UINT8 quota; /* burst transmission quota */ 370 } tL2C_RR_SERV; 371 372 #endif /* (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) */ 373 374 375 /* Define a link control block. There is one link control block between 376 ** this device and any other device (i.e. BD ADDR). 377 */ 378 typedef struct t_l2c_linkcb { 379 BOOLEAN in_use; /* TRUE when in use, FALSE when not */ 380 tL2C_LINK_STATE link_state; 381 BOOLEAN is_aux; /* This variable used for BLE 5.0 or higher version when do auxiliary connection */ 382 TIMER_LIST_ENT timer_entry; /* Timer list entry for timeout evt */ 383 UINT16 handle; /* The handle used with LM */ 384 UINT16 completed_packets; /* The number of conpleted packets */ 385 386 tL2C_CCB_Q ccb_queue; /* Queue of CCBs on this LCB */ 387 388 tL2C_CCB *p_pending_ccb; /* ccb of waiting channel during link disconnect */ 389 TIMER_LIST_ENT info_timer_entry; /* Timer entry for info resp timeout evt */ 390 TIMER_LIST_ENT upda_con_timer; /* Timer entry for update connection parametr */ 391 BD_ADDR remote_bd_addr; /* The BD address of the remote */ 392 393 UINT8 link_role; /* Master or slave */ 394 UINT8 id; 395 UINT8 cur_echo_id; /* Current id value for echo request */ 396 tL2CA_ECHO_RSP_CB *p_echo_rsp_cb; /* Echo response callback */ 397 UINT16 idle_timeout; /* Idle timeout */ 398 BOOLEAN is_bonding; /* True - link active only for bonding */ 399 400 UINT16 link_flush_tout; /* Flush timeout used */ 401 402 UINT16 link_xmit_quota; /* Num outstanding pkts allowed */ 403 UINT16 sent_not_acked; /* Num packets sent but not acked */ 404 405 BOOLEAN partial_segment_being_sent; /* Set TRUE when a partial segment */ 406 /* is being sent. */ 407 BOOLEAN w4_info_rsp; /* TRUE when info request is active */ 408 UINT8 info_rx_bits; /* set 1 if received info type */ 409 UINT32 peer_ext_fea; /* Peer's extended features mask */ 410 list_t *link_xmit_data_q; /* Link transmit data buffer queue */ 411 412 UINT8 peer_chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE]; 413 #if (L2CAP_UCD_INCLUDED == TRUE) 414 UINT16 ucd_mtu; /* peer MTU on UCD */ 415 fixed_queue_t *ucd_out_sec_pending_q; /* Security pending outgoing UCD packet */ 416 fixed_queue_t *ucd_in_sec_pending_q; /* Security pending incoming UCD packet */ 417 #endif 418 419 BT_HDR *p_hcit_rcv_acl; /* Current HCIT ACL buf being rcvd */ 420 UINT16 idle_timeout_sv; /* Save current Idle timeout */ 421 UINT8 acl_priority; /* L2C_PRIORITY_NORMAL or L2C_PRIORITY_HIGH */ 422 tL2CA_NOCP_CB *p_nocp_cb; /* Num Cmpl pkts callback */ 423 424 #if (L2CAP_NUM_FIXED_CHNLS > 0) 425 tL2C_CCB *p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS]; 426 UINT16 disc_reason; 427 #endif 428 429 tBT_TRANSPORT transport; 430 #if (BLE_INCLUDED == TRUE) 431 tBLE_ADDR_TYPE open_addr_type; /* be set by open API */ 432 tBLE_ADDR_TYPE ble_addr_type; 433 UINT16 tx_data_len; /* tx data length used in data length extension */ 434 fixed_queue_t *le_sec_pending_q; /* LE coc channels waiting for security check completion */ 435 UINT8 sec_act; 436 #define L2C_BLE_CONN_UPDATE_DISABLE 0x1 /* disable update connection parameters */ 437 #define L2C_BLE_NEW_CONN_PARAM 0x2 /* new connection parameter to be set */ 438 #define L2C_BLE_UPDATE_PENDING 0x4 /* waiting for connection update finished */ 439 #define L2C_BLE_NOT_DEFAULT_PARAM 0x8 /* not using default connection parameters */ 440 #define L2C_BLE_UPDATE_PARAM_FULL 0x10 /* update connection parameters full, can not update */ 441 UINT8 conn_update_mask; 442 /* cache connection parameters that wait to update */ 443 UINT16 waiting_update_conn_min_interval; 444 UINT16 waiting_update_conn_max_interval; 445 UINT16 waiting_update_conn_latency; 446 UINT16 waiting_update_conn_timeout; 447 /* cache parameters that is being updated */ 448 UINT16 updating_conn_min_interval; 449 UINT16 updating_conn_max_interval; 450 bool updating_param_flag; 451 /* current connection parameters that current connection is using */ 452 UINT16 current_used_conn_interval; 453 UINT16 current_used_conn_latency; 454 UINT16 current_used_conn_timeout; 455 /* connection parameters update order: 456 waiting_update_conn_xx -> updating_conn_xx -> current_used_conn_xx 457 */ 458 /* create connection retry count*/ 459 UINT8 retry_create_con; 460 UINT32 start_time_s; 461 #endif 462 463 #if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) 464 /* each priority group is limited burst transmission */ 465 /* round robin service for the same priority channels */ 466 tL2C_RR_SERV rr_serv[L2CAP_NUM_CHNL_PRIORITY]; 467 UINT8 rr_pri; /* current serving priority group */ 468 #endif 469 470 } tL2C_LCB; 471 472 473 /* Define the L2CAP control structure 474 */ 475 typedef struct { 476 UINT8 l2cap_trace_level; 477 UINT16 controller_xmit_window; /* Total ACL window for all links */ 478 479 UINT16 round_robin_quota; /* Round-robin link quota */ 480 UINT16 round_robin_unacked; /* Round-robin unacked */ 481 BOOLEAN check_round_robin; /* Do a round robin check */ 482 483 BOOLEAN is_cong_cback_context; 484 485 list_t *p_lcb_pool; /* Link Control Block pool */ 486 list_t *p_ccb_pool; /* Channel Control Block pool */ 487 tL2C_RCB rcb_pool[MAX_L2CAP_CLIENTS]; /* Registration info pool */ 488 489 490 UINT8 desire_role; /* desire to be master/slave when accepting a connection */ 491 BOOLEAN disallow_switch; /* FALSE, to allow switch at create conn */ 492 UINT16 num_lm_acl_bufs; /* # of ACL buffers on controller */ 493 UINT16 idle_timeout; /* Idle timeout */ 494 495 list_t *rcv_pending_q; /* Recv pending queue */ 496 TIMER_LIST_ENT rcv_hold_tle; /* Timer list entry for rcv hold */ 497 498 tL2C_LCB *p_cur_hcit_lcb; /* Current HCI Transport buffer */ 499 UINT16 num_links_active; /* Number of links active */ 500 501 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE) 502 UINT16 non_flushable_pbf; /* L2CAP_PKT_START_NON_FLUSHABLE if controller supports */ 503 /* Otherwise, L2CAP_PKT_START */ 504 BOOLEAN is_flush_active; /* TRUE if an HCI_Enhanced_Flush has been sent */ 505 #endif 506 507 #if L2CAP_CONFORMANCE_TESTING == TRUE 508 UINT32 test_info_resp; /* Conformance testing needs a dynamic response */ 509 #endif 510 511 #if (L2CAP_NUM_FIXED_CHNLS > 0) 512 tL2CAP_FIXED_CHNL_REG fixed_reg[L2CAP_NUM_FIXED_CHNLS]; /* Reg info for fixed channels */ 513 #endif 514 515 #if (BLE_INCLUDED == TRUE) 516 UINT16 num_ble_links_active; /* Number of LE links active */ 517 BOOLEAN is_ble_connecting; 518 BD_ADDR ble_connecting_bda; 519 UINT16 controller_le_xmit_window; /* Total ACL window for all links */ 520 tL2C_BLE_FIXED_CHNLS_MASK l2c_ble_fixed_chnls_mask; // LE fixed channels mask 521 UINT16 num_lm_ble_bufs; /* # of ACL buffers on controller */ 522 UINT16 ble_round_robin_quota; /* Round-robin link quota */ 523 UINT16 ble_round_robin_unacked; /* Round-robin unacked */ 524 BOOLEAN ble_check_round_robin; /* Do a round robin check */ 525 tL2C_RCB ble_rcb_pool[BLE_MAX_L2CAP_CLIENTS]; /* Registration info pool */ 526 #endif 527 528 tL2CA_ECHO_DATA_CB *p_echo_data_cb; /* Echo data callback */ 529 530 #if (defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) && (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE)) 531 UINT16 high_pri_min_xmit_quota; /* Minimum number of ACL credit for high priority link */ 532 #endif /* (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE) */ 533 534 UINT16 dyn_psm; 535 } tL2C_CB; 536 537 538 539 /* Define a structure that contains the information about a connection. 540 ** This structure is used to pass between functions, and not all the 541 ** fields will always be filled in. 542 */ 543 typedef struct { 544 BD_ADDR bd_addr; /* Remote BD address */ 545 UINT8 status; /* Connection status */ 546 UINT16 psm; /* PSM of the connection */ 547 UINT16 l2cap_result; /* L2CAP result */ 548 UINT16 l2cap_status; /* L2CAP status */ 549 UINT16 remote_cid; /* Remote CID */ 550 } tL2C_CONN_INFO; 551 552 553 typedef void (tL2C_FCR_MGMT_EVT_HDLR) (UINT8, tL2C_CCB *); 554 555 /* The offset in a buffer that L2CAP will use when building commands. 556 */ 557 #define L2CAP_SEND_CMD_OFFSET 0 558 559 560 /* Number of ACL buffers to use for high priority channel 561 */ 562 #if (!defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) || (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == FALSE)) 563 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A (L2CAP_HIGH_PRI_MIN_XMIT_QUOTA) 564 #else 565 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A (l2cb.high_pri_min_xmit_quota) 566 #endif 567 568 #ifdef __cplusplus 569 extern "C" { 570 #endif 571 572 573 /* L2CAP global data 574 ************************************ 575 */ 576 #if (!defined L2C_DYNAMIC_MEMORY) || (L2C_DYNAMIC_MEMORY == FALSE) 577 extern tL2C_CB l2cb; 578 #else 579 extern tL2C_CB *l2c_cb_ptr; 580 #define l2cb (*l2c_cb_ptr) 581 #endif 582 583 584 /* Functions provided by l2c_main.c 585 ************************************ 586 */ 587 void l2c_init(void); 588 void l2c_free(void); 589 590 extern void l2c_process_timeout (TIMER_LIST_ENT *p_tle); 591 extern UINT8 l2c_data_write (UINT16 cid, BT_HDR *p_data, UINT16 flag); 592 extern void l2c_rcv_acl_data (BT_HDR *p_msg); 593 extern void l2c_process_held_packets (BOOLEAN timed_out); 594 595 /* Functions provided by l2c_utils.c 596 ************************************ 597 */ 598 extern tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, BOOLEAN is_bonding, tBT_TRANSPORT transport); 599 extern BOOLEAN l2cu_start_post_bond_timer (UINT16 handle); 600 extern void l2cu_release_lcb (tL2C_LCB *p_lcb); 601 extern tL2C_LCB *l2cu_find_lcb_by_bd_addr (BD_ADDR p_bd_addr, tBT_TRANSPORT transport); 602 extern tL2C_LCB *l2cu_find_lcb_by_handle (UINT16 handle); 603 extern uint8_t l2cu_plcb_active_count(void); 604 extern void l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, BOOLEAN is_bonding); 605 606 extern UINT8 l2cu_get_conn_role (tL2C_LCB *p_this_lcb); 607 extern BOOLEAN l2cu_set_acl_priority (BD_ADDR bd_addr, UINT8 priority, BOOLEAN reset_after_rs); 608 609 extern void l2cu_enqueue_ccb (tL2C_CCB *p_ccb); 610 extern void l2cu_dequeue_ccb (tL2C_CCB *p_ccb); 611 extern void l2cu_change_pri_ccb (tL2C_CCB *p_ccb, tL2CAP_CHNL_PRIORITY priority); 612 613 extern tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid); 614 extern void l2cu_release_ccb (tL2C_CCB *p_ccb); 615 extern tL2C_CCB *l2cu_find_ccb_by_cid (tL2C_LCB *p_lcb, UINT16 local_cid); 616 extern tL2C_CCB *l2cu_find_free_ccb(void); 617 extern tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, UINT16 remote_cid); 618 extern void l2cu_adj_id (tL2C_LCB *p_lcb, UINT8 adj_mask); 619 extern BOOLEAN l2c_is_cmd_rejected (UINT8 cmd_code, UINT8 id, tL2C_LCB *p_lcb); 620 621 extern void l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, UINT16 reason, 622 UINT8 rem_id, UINT16 p1, UINT16 p2); 623 extern void l2cu_send_peer_connect_req (tL2C_CCB *p_ccb); 624 extern void l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, UINT16 result, UINT16 status); 625 extern void l2cu_send_peer_config_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 626 extern void l2cu_send_peer_config_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 627 extern void l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, UINT8 *p_data, UINT16 data_len, UINT16 rej_len); 628 extern void l2cu_send_peer_disc_req (tL2C_CCB *p_ccb); 629 extern void l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid, UINT16 remote_cid); 630 extern void l2cu_send_peer_echo_req (tL2C_LCB *p_lcb, UINT8 *p_data, UINT16 data_len); 631 extern void l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len); 632 extern void l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT16 info_type); 633 extern void l2cu_reject_connection (tL2C_LCB *p_lcb, UINT16 remote_cid, UINT8 rem_id, UINT16 result); 634 extern void l2cu_send_peer_info_req (tL2C_LCB *p_lcb, UINT16 info_type); 635 extern void l2cu_set_acl_hci_header (BT_HDR *p_buf, tL2C_CCB *p_ccb); 636 extern void l2cu_check_channel_congestion (tL2C_CCB *p_ccb); 637 extern void l2cu_disconnect_chnl (tL2C_CCB *p_ccb); 638 639 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE) 640 extern void l2cu_set_non_flushable_pbf(BOOLEAN); 641 #endif 642 643 #if (BLE_INCLUDED == TRUE) 644 extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout); 645 extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id); 646 #endif 647 648 extern BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr); 649 extern void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb); 650 extern void l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb); 651 652 /* Functions provided by l2c_ucd.c 653 ************************************ 654 */ 655 #if (L2CAP_UCD_INCLUDED == TRUE) 656 void l2c_ucd_delete_sec_pending_q(tL2C_LCB *p_lcb); 657 void l2c_ucd_enqueue_pending_out_sec_q(tL2C_CCB *p_ccb, void *p_data); 658 BOOLEAN l2c_ucd_check_pending_info_req(tL2C_CCB *p_ccb); 659 BOOLEAN l2c_ucd_check_pending_out_sec_q(tL2C_CCB *p_ccb); 660 void l2c_ucd_send_pending_out_sec_q(tL2C_CCB *p_ccb); 661 void l2c_ucd_discard_pending_out_sec_q(tL2C_CCB *p_ccb); 662 BOOLEAN l2c_ucd_check_pending_in_sec_q(tL2C_CCB *p_ccb); 663 void l2c_ucd_send_pending_in_sec_q(tL2C_CCB *p_ccb); 664 void l2c_ucd_discard_pending_in_sec_q(tL2C_CCB *p_ccb); 665 BOOLEAN l2c_ucd_check_rx_pkts(tL2C_LCB *p_lcb, BT_HDR *p_msg); 666 BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data); 667 #endif 668 669 #if (BLE_INCLUDED == TRUE) 670 extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout); 671 extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id); 672 extern void l2cu_reject_ble_connection (tL2C_LCB *p_lcb, UINT8 rem_id, UINT16 result); 673 extern void l2cu_send_peer_ble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result); 674 extern void l2cu_send_peer_ble_credit_based_conn_req (tL2C_CCB *p_ccb); 675 extern void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value); 676 extern void l2cu_send_peer_ble_credit_based_disconn_req(tL2C_CCB *p_ccb); 677 678 #endif 679 680 #if (C2H_FLOW_CONTROL_INCLUDED == TRUE) 681 extern UINT8 l2cu_find_completed_packets(UINT16 *handles, UINT16 *num_packets); 682 #endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE 683 684 extern BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr); 685 extern void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb); 686 extern void l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb); 687 688 689 /* Functions provided for Broadcom Aware 690 **************************************** 691 */ 692 extern BOOLEAN l2cu_check_feature_req (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len); 693 extern void l2cu_check_feature_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len); 694 extern void l2cu_send_feature_req (tL2C_CCB *p_ccb); 695 696 extern tL2C_RCB *l2cu_allocate_rcb (UINT16 psm); 697 extern tL2C_RCB *l2cu_find_rcb_by_psm (UINT16 psm); 698 extern void l2cu_release_rcb (tL2C_RCB *p_rcb); 699 extern tL2C_RCB *l2cu_allocate_ble_rcb (UINT16 psm); 700 extern tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm); 701 702 703 extern UINT8 l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 704 extern void l2cu_process_peer_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 705 extern void l2cu_process_our_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 706 extern void l2cu_process_our_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 707 708 extern void l2cu_device_reset (void); 709 extern tL2C_LCB *l2cu_find_lcb_by_state (tL2C_LINK_STATE state); 710 extern BOOLEAN l2cu_lcb_disconnecting (void); 711 712 extern BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport); 713 extern BOOLEAN l2cu_create_conn_after_switch (tL2C_LCB *p_lcb); 714 extern BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb); 715 extern void l2cu_resubmit_pending_sec_req (BD_ADDR p_bda); 716 extern void l2cu_initialize_amp_ccb (tL2C_LCB *p_lcb); 717 extern void l2cu_adjust_out_mps (tL2C_CCB *p_ccb); 718 719 /* Functions provided by l2c_link.c 720 ************************************ 721 */ 722 extern BOOLEAN l2c_link_hci_conn_req (BD_ADDR bd_addr); 723 extern BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda); 724 extern BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason); 725 extern BOOLEAN l2c_link_hci_qos_violation (UINT16 handle); 726 extern void l2c_link_timeout (tL2C_LCB *p_lcb); 727 extern void l2c_info_timeout (tL2C_LCB *p_lcb); 728 extern void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf); 729 extern void l2c_link_adjust_allocation (void); 730 extern void l2c_link_process_num_completed_pkts (UINT8 *p); 731 extern void l2c_link_process_num_completed_blocks (UINT8 controller_id, UINT8 *p, UINT16 evt_len); 732 extern void l2c_link_processs_num_bufs (UINT16 num_lm_acl_bufs); 733 extern UINT8 l2c_link_pkts_rcvd (UINT16 *num_pkts, UINT16 *handles); 734 extern void l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hci_status); 735 extern void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data, UINT8 status); 736 extern void l2c_link_segments_xmitted (BT_HDR *p_msg); 737 extern void l2c_pin_code_request (BD_ADDR bd_addr); 738 extern void l2c_link_adjust_chnl_allocation (void); 739 740 #if (BLE_INCLUDED == TRUE) 741 extern void l2c_link_processs_ble_num_bufs (UINT16 num_lm_acl_bufs); 742 #endif 743 744 #if L2CAP_WAKE_PARKED_LINK == TRUE 745 extern BOOLEAN l2c_link_check_power_mode ( tL2C_LCB *p_lcb ); 746 #define L2C_LINK_CHECK_POWER_MODE(x) l2c_link_check_power_mode ((x)) 747 #else // L2CAP_WAKE_PARKED_LINK 748 #define L2C_LINK_CHECK_POWER_MODE(x) (FALSE) 749 #endif // L2CAP_WAKE_PARKED_LINK 750 751 #if L2CAP_CONFORMANCE_TESTING == TRUE 752 /* Used only for conformance testing */ 753 extern void l2cu_set_info_rsp_mask (UINT32 mask); 754 #endif 755 756 /* Functions provided by l2c_csm.c 757 ************************************ 758 */ 759 extern void l2c_csm_execute (tL2C_CCB *p_ccb, UINT16 event, void *p_data); 760 761 extern void l2c_enqueue_peer_data (tL2C_CCB *p_ccb, BT_HDR *p_buf); 762 763 764 /* Functions provided by l2c_fcr.c 765 ************************************ 766 */ 767 extern void l2c_fcr_cleanup (tL2C_CCB *p_ccb); 768 extern void l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf); 769 extern void l2c_fcr_proc_tout (tL2C_CCB *p_ccb); 770 extern void l2c_fcr_proc_ack_tout (tL2C_CCB *p_ccb); 771 extern void l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, UINT16 function_code, UINT16 pf_bit); 772 extern BT_HDR *l2c_fcr_clone_buf (BT_HDR *p_buf, UINT16 new_offset, UINT16 no_of_bytes); 773 extern BOOLEAN l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb); 774 extern BT_HDR *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length); 775 extern void l2c_fcr_start_timer (tL2C_CCB *p_ccb); 776 777 /* Configuration negotiation */ 778 extern UINT8 l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb); 779 extern BOOLEAN l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 780 extern void l2c_fcr_adj_our_rsp_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_peer_cfg); 781 extern BOOLEAN l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 782 extern UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); 783 extern void l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb); 784 extern void l2c_fcr_stop_timer (tL2C_CCB *p_ccb); 785 extern void l2c_fcr_free_timer (tL2C_CCB *p_ccb); 786 /* Functions provided by l2c_ble.c 787 ************************************ 788 */ 789 #if (BLE_INCLUDED == TRUE) 790 extern BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb); 791 extern void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len); 792 extern void l2cble_conn_comp (UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type, 793 UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout); 794 extern BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb); 795 extern void l2cble_notify_le_connection (BD_ADDR bda); 796 extern void l2c_ble_link_adjust_allocation (void); 797 extern void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_interval, 798 UINT16 conn_latency, UINT16 conn_timeout); 799 extern void l2cble_get_conn_param_format_err_from_contoller(UINT8 status, UINT16 handle); 800 801 extern void l2cble_credit_based_conn_req (tL2C_CCB *p_ccb); 802 extern void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result); 803 extern void l2cble_send_peer_disc_req(tL2C_CCB *p_ccb); 804 extern void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value); 805 extern BOOLEAN l2ble_sec_access_req(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator, tL2CAP_SEC_CBACK *p_callback, void *p_ref_data); 806 807 808 #if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE) 809 extern void l2cble_process_rc_param_request_evt(UINT16 handle, UINT16 int_min, UINT16 int_max, 810 UINT16 latency, UINT16 timeout); 811 #endif 812 813 extern void l2cble_update_data_length(tL2C_LCB *p_lcb); 814 extern void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, UINT16 fix_cid, 815 UINT16 tx_mtu); 816 extern void l2c_send_update_conn_params_cb(tL2C_LCB *p_lcb, UINT8 status); 817 extern void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len, 818 UINT16 rx_data_len); 819 extern UINT32 CalConnectParamTimeout(tL2C_LCB *p_lcb); 820 821 #endif 822 extern void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb); 823 824 #ifdef __cplusplus 825 } 826 #endif 827 828 #endif 829