Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03f8c675 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

L2cap: Clean up more dependency on btm_int

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I3fdac96c5a5210b736a41e0d3112812c8e56b2d6
parent f2d5e850
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -1619,17 +1619,17 @@ tBTM_STATUS btm_set_packet_types(tACL_CONN* p, uint16_t pkt_types) {


/*******************************************************************************
/*******************************************************************************
 *
 *
 * Function         btm_get_max_packet_size
 * Function         BTM_GetMaxPacketSize
 *
 *
 * Returns          Returns maximum packet size that can be used for current
 * Returns          Returns maximum packet size that can be used for current
 *                  connection, 0 if connection is not established
 *                  connection, 0 if connection is not established
 *
 *
 ******************************************************************************/
 ******************************************************************************/
uint16_t btm_get_max_packet_size(const RawAddress& addr) {
uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) {
  tACL_CONN* p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
  tACL_CONN* p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
  uint16_t pkt_types = 0;
  uint16_t pkt_types = 0;
  uint16_t pkt_size = 0;
  uint16_t pkt_size = 0;
  BTM_TRACE_DEBUG("btm_get_max_packet_size");
  BTM_TRACE_DEBUG("BTM_GetMaxPacketSize");
  if (p != NULL) {
  if (p != NULL) {
    pkt_types = p->pkt_types_mask;
    pkt_types = p->pkt_types_mask;
  } else {
  } else {
+0 −2
Original line number Original line Diff line number Diff line
@@ -126,8 +126,6 @@ extern void btm_establish_continue(tACL_CONN* p_acl_cb);


extern void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p,
extern void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p,
                                              uint16_t* p_pkt_type);
                                              uint16_t* p_pkt_type);
/* Read maximum data packet that can be sent over current connection */
extern uint16_t btm_get_max_packet_size(const RawAddress& addr);
extern tACL_CONN* btm_bda_to_acl(const RawAddress& bda,
extern tACL_CONN* btm_bda_to_acl(const RawAddress& bda,
                                 tBT_TRANSPORT transport);
                                 tBT_TRANSPORT transport);
extern bool btm_acl_notif_conn_collision(const RawAddress& bda);
extern bool btm_acl_notif_conn_collision(const RawAddress& bda);
+5 −0
Original line number Original line Diff line number Diff line
@@ -4717,6 +4717,11 @@ void btm_sec_update_clock_offset(uint16_t handle, uint16_t clock_offset) {
  p_inq_info->results.clock_offset = clock_offset | BTM_CLOCK_OFFSET_VALID;
  p_inq_info->results.clock_offset = clock_offset | BTM_CLOCK_OFFSET_VALID;
}
}


uint16_t BTM_GetClockOffset(const RawAddress& remote_bda) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(remote_bda);
  return (p_dev_rec) ? p_dev_rec->clock_offset : 0;
}

/******************************************************************
/******************************************************************
 * S T A T I C     F U N C T I O N S
 * S T A T I C     F U N C T I O N S
 ******************************************************************/
 ******************************************************************/
+5 −0
Original line number Original line Diff line number Diff line
@@ -1377,4 +1377,9 @@ extern void BTM_SecClrTempAuthService(const RawAddress& bda);


extern bool BTM_IsScoActiveByBdaddr(const RawAddress& remote_bda);
extern bool BTM_IsScoActiveByBdaddr(const RawAddress& remote_bda);


extern uint16_t BTM_GetClockOffset(const RawAddress& remote_bda);

/* Read maximum data packet that can be sent over current connection */
extern uint16_t BTM_GetMaxPacketSize(const RawAddress& addr);

#endif /* BTM_API_H */
#endif /* BTM_API_H */
+2 −4
Original line number Original line Diff line number Diff line
@@ -2194,7 +2194,6 @@ void l2cu_create_conn_after_switch(tL2C_LCB* p_lcb) {
  uint8_t page_scan_mode;
  uint8_t page_scan_mode;
  uint16_t clock_offset;
  uint16_t clock_offset;
  uint16_t num_acl = BTM_GetNumAclLinks();
  uint16_t num_acl = BTM_GetNumAclLinks();
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(p_lcb->remote_bd_addr);
  uint8_t no_hi_prio_chs = l2cu_get_num_hi_priority();
  uint8_t no_hi_prio_chs = l2cu_get_num_hi_priority();
  const controller_t* controller = controller_get_interface();
  const controller_t* controller = controller_get_interface();


@@ -2224,8 +2223,7 @@ void l2cu_create_conn_after_switch(tL2C_LCB* p_lcb) {
    /* No info known. Use default settings */
    /* No info known. Use default settings */
    page_scan_rep_mode = HCI_PAGE_SCAN_REP_MODE_R1;
    page_scan_rep_mode = HCI_PAGE_SCAN_REP_MODE_R1;
    page_scan_mode = HCI_MANDATARY_PAGE_SCAN_MODE;
    page_scan_mode = HCI_MANDATARY_PAGE_SCAN_MODE;

    clock_offset = BTM_GetClockOffset(p_lcb->remote_bd_addr);
    clock_offset = (p_dev_rec) ? p_dev_rec->clock_offset : 0;
  }
  }


  btsnd_hcic_create_conn(
  btsnd_hcic_create_conn(
@@ -2454,7 +2452,7 @@ void l2cu_adjust_out_mps(tL2C_CCB* p_ccb) {
  uint16_t packet_size;
  uint16_t packet_size;


  /* on the tx side MTU is selected based on packet size of the controller */
  /* on the tx side MTU is selected based on packet size of the controller */
  packet_size = btm_get_max_packet_size(p_ccb->p_lcb->remote_bd_addr);
  packet_size = BTM_GetMaxPacketSize(p_ccb->p_lcb->remote_bd_addr);


  if (packet_size <= (L2CAP_PKT_OVERHEAD + L2CAP_FCR_OVERHEAD +
  if (packet_size <= (L2CAP_PKT_OVERHEAD + L2CAP_FCR_OVERHEAD +
                      L2CAP_SDU_LEN_OVERHEAD + L2CAP_FCS_LEN)) {
                      L2CAP_SDU_LEN_OVERHEAD + L2CAP_FCS_LEN)) {
Loading