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

Commit 748d1dd3 authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge "Use GD for Iso data sizes" into main

parents cf9388b1 0ab7cbcc
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -26,21 +26,8 @@ void controller::SetMockControllerInterface(
  controller_interface = interface;
}

uint16_t get_iso_data_size(void) {
  LOG_ASSERT(controller_interface) << "Mock controller not set!";
  return controller_interface->GetIsoDataSize();
}

uint8_t get_iso_buffer_count(void) {
  LOG_ASSERT(controller_interface) << "Mock controller not set!";
  return controller_interface->GetIsoBufferCount();
}

const controller_t* controller_get_interface() {
  static controller_t* controller_instance = new controller_t();

  controller_instance->get_iso_data_size = &get_iso_data_size;
  controller_instance->get_iso_buffer_count = &get_iso_buffer_count;

  return controller_instance;
}
+0 −8
Original line number Diff line number Diff line
@@ -36,9 +36,6 @@ typedef struct controller_t {

  const uint8_t* (*get_ble_supported_states)(void);

  uint16_t (*get_iso_data_size)(void);
  uint16_t (*get_iso_packet_size)(void);

  uint16_t (*get_ble_default_data_packet_length)(void);
  uint16_t (*get_ble_maximum_tx_data_length)(void);
  uint16_t (*get_ble_maximum_tx_time)(void);
@@ -46,11 +43,6 @@ typedef struct controller_t {
  uint8_t (*get_ble_number_of_supported_advertising_sets)(void);
  uint8_t (*get_ble_periodic_advertiser_list_size)(void);

  // Get the number of acl packets the controller can buffer.
  uint16_t (*get_acl_buffer_count_classic)(void);
  uint8_t (*get_acl_buffer_count_ble)(void);
  uint8_t (*get_iso_buffer_count)(void);

  uint8_t (*get_ble_acceptlist_size)(void);

  uint8_t (*get_ble_resolving_list_max_size)(void);
+2 −27
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@ constexpr int kMaxSupportedCodecs = 8; // MAX_LOCAL_SUPPORTED_CODECS_SIZE

constexpr uint8_t kPhyLe1M = 0x01;

constexpr int kHciDataPreambleSize = 4;  // #define HCI_DATA_PREAMBLE_SIZE 4

// Module lifecycle functions
static future_t* start_up(void);
static future_t* shut_down(void);
@@ -117,14 +115,6 @@ static const uint8_t* get_ble_supported_states(void) {
#define FORWARD_GETTER(type, legacy, gd) \
  static type legacy(void) { return gd; }

FORWARD_GETTER(
    uint16_t, get_iso_buffer_length,
    GetController()->GetControllerIsoBufferSize().le_data_packet_length_)

static uint16_t get_iso_packet_size(void) {
  return get_iso_buffer_length() + kHciDataPreambleSize;
}

FORWARD_GETTER(uint16_t, get_le_suggested_default_data_length,
               GetController()->GetLeSuggestedDefaultDataLength())

@@ -146,14 +136,7 @@ FORWARD_GETTER(uint8_t, get_le_supported_advertising_sets,
               GetController()->GetLeNumberOfSupportedAdverisingSets())
FORWARD_GETTER(uint8_t, get_le_periodic_advertiser_list_size,
               GetController()->GetLePeriodicAdvertiserListSize())
FORWARD_GETTER(uint16_t, get_acl_buffers,
               GetController()->GetNumAclPacketBuffers())
FORWARD_GETTER(uint8_t, get_le_buffers,
               GetController()->GetLeBufferSize().total_num_le_packets_)
FORWARD_GETTER(
    uint8_t, get_iso_buffers,
    GetController()->GetControllerIsoBufferSize().total_num_le_packets_)
FORWARD_GETTER(uint8_t, get_le_accept_list_size,
FORWARD_GETTER(uint8_t, get_le_connect_list_size,
               GetController()->GetLeFilterAcceptListSize())

static void set_ble_resolving_list_max_size(int /* resolving_list_max_size */) {
@@ -226,10 +209,6 @@ static const controller_t interface = {

    .get_ble_supported_states = get_ble_supported_states,

    .get_iso_data_size = get_iso_buffer_length,

    .get_iso_packet_size = get_iso_packet_size,

    .get_ble_default_data_packet_length = get_le_suggested_default_data_length,
    .get_ble_maximum_tx_data_length = get_le_maximum_tx_data_length,
    .get_ble_maximum_tx_time = get_le_maximum_tx_time,
@@ -240,11 +219,7 @@ static const controller_t interface = {
    .get_ble_periodic_advertiser_list_size =
        get_le_periodic_advertiser_list_size,

    .get_acl_buffer_count_classic = get_acl_buffers,
    .get_acl_buffer_count_ble = get_le_buffers,
    .get_iso_buffer_count = get_iso_buffers,

    .get_ble_acceptlist_size = get_le_accept_list_size,
    .get_ble_acceptlist_size = get_le_connect_list_size,

    .get_ble_resolving_list_max_size = get_le_resolving_list_size,
    .set_ble_resolving_list_max_size = set_ble_resolving_list_max_size,
+8 −2
Original line number Diff line number Diff line
@@ -29,9 +29,11 @@
#include "btm_iso_api.h"
#include "common/time_util.h"
#include "device/include/controller.h"
#include "hci/controller_interface.h"
#include "hci/include/hci_layer.h"
#include "internal_include/bt_trace.h"
#include "internal_include/stack_config.h"
#include "main/shim/entry.h"
#include "main/shim/hci_layer.h"
#include "os/log.h"
#include "osi/include/allocator.h"
@@ -92,8 +94,12 @@ typedef iso_base iso_bis;

struct iso_impl {
  iso_impl() {
    iso_credits_ = controller_get_interface()->get_iso_buffer_count();
    iso_buffer_size_ = controller_get_interface()->get_iso_data_size();
    iso_credits_ = shim::GetController()
                       ->GetControllerIsoBufferSize()
                       .total_num_le_packets_;
    iso_buffer_size_ = shim::GetController()
                           ->GetControllerIsoBufferSize()
                           .le_data_packet_length_;
    log::info("{} created, iso credits: {}, buffer size: {}.", fmt::ptr(this),
              iso_credits_.load(), iso_buffer_size_);
  }
+5 −1
Original line number Diff line number Diff line
@@ -117,8 +117,12 @@ class FakeBtStack {
    GetInterfaceToProfiles()->profileSpecific_HACK->GetHearingAidDeviceCount =
        []() { return 1; };

    test::mock::device_controller::iso_data_size = 512;
    test::mock::device_controller::ble_suggested_default_data_length = 512;
    bluetooth::hci::LeBufferSize iso_size;
    iso_size.le_data_packet_length_ = 512;
    iso_size.total_num_le_packets_ = 6;
    ON_CALL(controller_, GetControllerIsoBufferSize)
        .WillByDefault(Return(iso_size));
    bluetooth::hci::LeBufferSize le_size;
    le_size.le_data_packet_length_ = 512;
    le_size.total_num_le_packets_ = 6;
Loading