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

Commit 914348d7 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

L2cap: Separate the controller property API

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I0755f19bf32b8cf951be2a649d35de1a84afccaa
parent 93b3d4f2
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -25,12 +25,10 @@

#include <base/logging.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "bt_types.h"
#include "bt_utils.h"
#include "btcore/include/module.h"
#include "btm_int.h"
#include "btu.h"
@@ -38,11 +36,10 @@
#include "device/include/controller.h"
#include "hci_layer.h"
#include "hcimsgs.h"
#include "l2c_int.h"
#include "osi/include/osi.h"
#include "stack/gatt/connection_manager.h"
#include "stack/include/l2cap_controller_interface.h"

#include "gatt_int.h"
#include "main/shim/btm_api.h"
#include "main/shim/controller.h"
#include "main/shim/shim.h"
@@ -386,10 +383,7 @@ static void decode_controller_support() {
      BTM_SetInquiryMode(BTM_INQ_RESULT_WITH_RSSI);
  }

  if (controller->supports_non_flushable_pb())
    l2cu_set_non_flushable_pbf(true);
  else
    l2cu_set_non_flushable_pbf(false);
  l2cu_set_non_flushable_pbf(controller->supports_non_flushable_pb());
  BTM_EnableInterlacedPageScan();
  BTM_EnableInterlacedInquiryScan();
}
+30 −0
Original line number Diff line number Diff line
/*
 *  Copyright 2020 The Android Open Source Project
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

#pragma once

#include "bt_common.h"

// This header contains functions for Controller Module to invoke

extern void l2cu_set_non_flushable_pbf(bool is_supported);

extern void l2c_link_processs_num_bufs(uint16_t num_lm_acl_bufs);

extern void l2c_link_processs_ble_num_bufs(uint16_t num_lm_acl_bufs);

extern void l2cu_device_reset(void);
+2 −1
Original line number Diff line number Diff line
@@ -793,7 +793,8 @@ void l2c_link_processs_ble_num_bufs(uint16_t num_lm_ble_bufs) {
    l2cb.num_lm_acl_bufs -= L2C_DEF_NUM_BLE_BUF_SHARED;
  }

  l2cb.num_lm_ble_bufs = l2cb.controller_le_xmit_window = num_lm_ble_bufs;
  l2cb.num_lm_ble_bufs = num_lm_ble_bufs;
  l2cb.controller_le_xmit_window = num_lm_ble_bufs;
}

/*******************************************************************************
+1 −8
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "btm_ble_api.h"
#include "l2c_api.h"
#include "l2cap_acl_interface.h"
#include "l2cap_controller_interface.h"
#include "l2cap_hci_link_interface.h"
#include "l2cdefs.h"
#include "osi/include/alarm.h"
@@ -604,8 +605,6 @@ extern void l2cu_disconnect_chnl(tL2C_CCB* p_ccb);

extern void l2cu_tx_complete(tL2C_TX_COMPLETE_CB_INFO* p_cbi);

extern void l2cu_set_non_flushable_pbf(bool);

extern void l2cu_send_peer_ble_par_req(tL2C_LCB* p_lcb, uint16_t min_int,
                                       uint16_t max_int, uint16_t latency,
                                       uint16_t timeout);
@@ -647,7 +646,6 @@ extern void l2cu_process_peer_cfg_rsp(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg);
extern void l2cu_process_our_cfg_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg);
extern void l2cu_process_our_cfg_rsp(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg);

extern void l2cu_device_reset(void);
extern tL2C_LCB* l2cu_find_lcb_by_state(tL2C_LINK_STATE state);
extern bool l2cu_lcb_disconnecting(void);

@@ -658,7 +656,6 @@ extern bool l2cu_create_conn_after_switch(tL2C_LCB* p_lcb);
extern BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
                                            tL2C_TX_COMPLETE_CB_INFO* p_cbi);
extern void l2cu_resubmit_pending_sec_req(const RawAddress* p_bda);
extern void l2cu_initialize_amp_ccb(tL2C_LCB* p_lcb);
extern void l2cu_adjust_out_mps(tL2C_CCB* p_ccb);

/* Functions provided by l2c_link.cc
@@ -671,16 +668,12 @@ extern void l2c_link_check_send_pkts(tL2C_LCB* p_lcb, tL2C_CCB* p_ccb,
                                     BT_HDR* p_buf);
extern void l2c_link_adjust_allocation(void);

extern void l2c_link_processs_num_bufs(uint16_t num_lm_acl_bufs);

extern void l2c_link_sec_comp(const RawAddress* p_bda, tBT_TRANSPORT trasnport,
                              void* p_ref_data, uint8_t status);
extern void l2c_link_sec_comp2(const RawAddress& p_bda, tBT_TRANSPORT trasnport,
                               void* p_ref_data, uint8_t status);
extern void l2c_link_adjust_chnl_allocation(void);

extern void l2c_link_processs_ble_num_bufs(uint16_t num_lm_acl_bufs);

#if (L2CAP_WAKE_PARKED_LINK == TRUE)
extern bool l2c_link_check_power_mode(tL2C_LCB* p_lcb);
#define L2C_LINK_CHECK_POWER_MODE(x) l2c_link_check_power_mode((x))
+2 −1
Original line number Diff line number Diff line
@@ -803,7 +803,8 @@ void l2c_link_adjust_chnl_allocation(void) {
 *
 ******************************************************************************/
void l2c_link_processs_num_bufs(uint16_t num_lm_acl_bufs) {
  l2cb.num_lm_acl_bufs = l2cb.controller_xmit_window = num_lm_acl_bufs;
  l2cb.num_lm_acl_bufs = num_lm_acl_bufs;
  l2cb.controller_xmit_window = num_lm_acl_bufs;
}

/*******************************************************************************