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

Commit fd0a3a5f authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge changes I1aa0ab27,Ice003a60

* changes:
  hci: Add Broadcast Isochronous Sets related commands
  hci: Add additional iso related commands
parents a2834841 4c043dc5
Loading
Loading
Loading
Loading
+137 −0
Original line number Diff line number Diff line
@@ -820,6 +820,18 @@ void btsnd_hcic_ble_ext_create_conn(uint8_t init_filter_policy,
  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_read_iso_tx_sync(
    uint16_t iso_handle, base::OnceCallback<void(uint8_t*, uint16_t)> cb) {
  const int params_len = 2;
  uint8_t param[params_len];
  uint8_t* pp = param;

  UINT16_TO_STREAM(pp, iso_handle);

  btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_LE_READ_ISO_TX_SYNC, param,
                            params_len, std::move(cb));
}

void btsnd_hcic_set_cig_params(
    uint8_t cig_id, uint32_t sdu_itv_mtos, uint32_t sdu_itv_stom, uint8_t sca,
    uint8_t packing, uint8_t framing, uint16_t max_trans_lat_stom,
@@ -885,6 +897,35 @@ void btsnd_hcic_remove_cig(uint8_t cig_id,
                            std::move(cb));
}

void btsnd_hcic_accept_cis_req(uint16_t conn_handle) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);

  const int param_len = 2;
  p->len = HCIC_PREAMBLE_SIZE + param_len;
  p->offset = 0;

  UINT16_TO_STREAM(pp, HCI_LE_ACCEPT_CIS_REQ);
  UINT8_TO_STREAM(pp, param_len);

  UINT16_TO_STREAM(pp, conn_handle);

  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_rej_cis_req(uint16_t conn_handle, uint8_t reason,
                            base::OnceCallback<void(uint8_t*, uint16_t)> cb) {
  const int params_len = 3;
  uint8_t param[params_len];
  uint8_t* pp = param;

  UINT16_TO_STREAM(pp, conn_handle);
  UINT8_TO_STREAM(pp, reason);

  btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_LE_REJ_CIS_REQ, param, params_len,
                            std::move(cb));
}

void btsnd_hcic_req_peer_sca(uint16_t conn_handle) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);
@@ -900,6 +941,102 @@ void btsnd_hcic_req_peer_sca(uint16_t conn_handle) {
  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_create_big(uint8_t big_handle, uint8_t adv_handle,
                           uint8_t num_bis, uint32_t sdu_itv,
                           uint16_t max_sdu_size, uint16_t transport_latency,
                           uint8_t rtn, uint8_t phy, uint8_t packing,
                           uint8_t framing, uint8_t enc,
                           std::array<uint8_t, 16> bcst_code) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);

  const int param_len = 31;
  p->len = HCIC_PREAMBLE_SIZE + param_len;
  p->offset = 0;

  UINT16_TO_STREAM(pp, HCI_LE_CREATE_BIG);
  UINT8_TO_STREAM(pp, param_len);

  UINT8_TO_STREAM(pp, big_handle);
  UINT8_TO_STREAM(pp, adv_handle);
  UINT8_TO_STREAM(pp, num_bis);
  UINT24_TO_STREAM(pp, sdu_itv);
  UINT16_TO_STREAM(pp, max_sdu_size);
  UINT16_TO_STREAM(pp, transport_latency);
  UINT8_TO_STREAM(pp, rtn);
  UINT8_TO_STREAM(pp, phy);
  UINT8_TO_STREAM(pp, packing);
  UINT8_TO_STREAM(pp, framing);
  UINT8_TO_STREAM(pp, enc);

  uint8_t* buf_ptr = bcst_code.data();
  ARRAY_TO_STREAM(pp, buf_ptr, 16);

  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_term_big(uint8_t big_handle, uint8_t reason) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);

  const int param_len = 2;
  p->len = HCIC_PREAMBLE_SIZE + param_len;
  p->offset = 0;

  UINT16_TO_STREAM(pp, HCI_LE_TERM_BIG);
  UINT8_TO_STREAM(pp, param_len);

  UINT8_TO_STREAM(pp, big_handle);
  UINT8_TO_STREAM(pp, reason);

  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_big_create_sync(uint8_t big_handle, uint16_t sync_handle,
                                uint8_t enc, std::array<uint8_t, 16> bcst_code,
                                uint8_t mse, uint16_t big_sync_timeout,
                                std::vector<uint8_t> bis) {
  BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
  uint8_t* pp = (uint8_t*)(p + 1);
  uint8_t num_bis = bis.size();

  const int param_len = 24 + num_bis;
  p->len = HCIC_PREAMBLE_SIZE + param_len;
  p->offset = 0;

  UINT16_TO_STREAM(pp, HCI_LE_BIG_CREATE_SYNC);
  UINT8_TO_STREAM(pp, param_len);

  UINT8_TO_STREAM(pp, big_handle);
  UINT16_TO_STREAM(pp, sync_handle);
  UINT8_TO_STREAM(pp, enc);

  uint8_t* buf_ptr = bcst_code.data();
  ARRAY_TO_STREAM(pp, buf_ptr, 16);

  UINT8_TO_STREAM(pp, mse);
  UINT16_TO_STREAM(pp, big_sync_timeout);
  UINT8_TO_STREAM(pp, num_bis);

  for (int i = 0; i < num_bis; i++) {
    UINT8_TO_STREAM(pp, bis[i]);
  }

  btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}

void btsnd_hcic_big_term_sync(uint8_t big_handle,
                              base::OnceCallback<void(uint8_t*, uint16_t)> cb) {
  const int params_len = 1;
  uint8_t param[params_len];
  uint8_t* pp = param;

  UINT8_TO_STREAM(pp, big_handle);

  btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_LE_BIG_TERM_SYNC, param, params_len,
                            std::move(cb));
}

void btsnd_hcic_setup_iso_data_path(
    uint16_t iso_handle, uint8_t data_path_dir, uint8_t data_path_id,
    uint8_t codec_id_format, uint16_t codec_id_company,
+27 −0
Original line number Diff line number Diff line
@@ -888,6 +888,9 @@ extern void btsnd_hcic_read_authenticated_payload_tout(uint16_t handle);
extern void btsnd_hcic_write_authenticated_payload_tout(uint16_t handle,
                                                        uint16_t timeout);

extern void btsnd_hcic_read_iso_tx_sync(
    uint16_t iso_handle, base::OnceCallback<void(uint8_t*, uint16_t)> cb);

struct EXT_CIS_CFG {
  uint8_t cis_id;
  uint16_t max_sdu_size_mtos;
@@ -928,8 +931,32 @@ extern void btsnd_hcic_create_cis(uint8_t num_cis,
extern void btsnd_hcic_remove_cig(
    uint8_t cig_id, base::OnceCallback<void(uint8_t*, uint16_t)> cb);

extern void btsnd_hcic_accept_cis_req(uint16_t conn_handle);

extern void btsnd_hcic_rej_cis_req(
    uint16_t conn_handle, uint8_t reason,
    base::OnceCallback<void(uint8_t*, uint16_t)> cb);

extern void btsnd_hcic_req_peer_sca(uint16_t conn_handle);

extern void btsnd_hcic_create_big(uint8_t big_handle, uint8_t adv_handle,
                                  uint8_t num_bis, uint32_t sdu_itv,
                                  uint16_t max_sdu_size, uint16_t max_trans_lat,
                                  uint8_t rtn, uint8_t phy, uint8_t packing,
                                  uint8_t framing, uint8_t enc,
                                  std::array<uint8_t, 16> bcst_code);

extern void btsnd_hcic_term_big(uint8_t big_handle, uint8_t reason);

extern void btsnd_hcic_big_create_sync(uint8_t big_handle, uint16_t sync_handle,
                                       uint8_t enc,
                                       std::array<uint8_t, 16> bcst_code,
                                       uint8_t mse, uint16_t big_sync_timeout,
                                       std::vector<uint8_t> bis);

extern void btsnd_hcic_big_term_sync(
    uint8_t big_handle, base::OnceCallback<void(uint8_t*, uint16_t)> cb);

extern void btsnd_hcic_setup_iso_data_path(
    uint16_t iso_handle, uint8_t data_path_dir, uint8_t data_path_id,
    uint8_t codec_id_format, uint16_t codec_id_company,