Bluetooth: ISO: Update includes for ISO files
Updates the includes for ISO file so that it conforms to IWYU (include what you use). Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
08996a63b0
commit
79fa6b3f54
3 changed files with 124 additions and 192 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2020 Intel Corporation
|
||||
* Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2021-2024 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -23,10 +23,16 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#include <zephyr/sys/atomic.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <zephyr/bluetooth/addr.h>
|
||||
#include <zephyr/bluetooth/bluetooth.h>
|
||||
#include <zephyr/bluetooth/buf.h>
|
||||
#include <zephyr/bluetooth/conn.h>
|
||||
#include <zephyr/bluetooth/hci.h>
|
||||
#include <zephyr/net_buf.h>
|
||||
#include <zephyr/sys/atomic.h>
|
||||
#include <zephyr/sys/slist.h>
|
||||
#include <zephyr/sys/util_macro.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
#include <zephyr/bluetooth/hci_types.h>
|
||||
#include <zephyr/bluetooth/iso.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/net_buf.h>
|
||||
#include <zephyr/sys/__assert.h>
|
||||
#include <zephyr/sys/atomic.h>
|
||||
#include <zephyr/sys/byteorder.h>
|
||||
#include <zephyr/sys/check.h>
|
||||
#include <zephyr/sys/slist.h>
|
||||
|
@ -32,16 +34,13 @@
|
|||
#include <zephyr/sys_clock.h>
|
||||
#include <zephyr/toolchain.h>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "host/buf_view.h"
|
||||
#include "host/hci_core.h"
|
||||
#include "host/conn_internal.h"
|
||||
#include "iso_internal.h"
|
||||
|
||||
#include "common/assert.h"
|
||||
|
||||
#define LOG_LEVEL CONFIG_BT_ISO_LOG_LEVEL
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_iso);
|
||||
LOG_MODULE_REGISTER(bt_iso, CONFIG_BT_ISO_LOG_LEVEL);
|
||||
|
||||
#if defined(CONFIG_BT_DEBUG_ISO_DATA)
|
||||
#define BT_ISO_DATA_DBG(fmt, ...) LOG_DBG(fmt, ##__VA_ARGS__)
|
||||
|
@ -53,8 +52,7 @@ LOG_MODULE_REGISTER(bt_iso);
|
|||
|
||||
#if defined(CONFIG_BT_ISO_RX)
|
||||
NET_BUF_POOL_FIXED_DEFINE(iso_rx_pool, CONFIG_BT_ISO_RX_BUF_COUNT,
|
||||
BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_RX_MTU),
|
||||
sizeof(struct iso_data), NULL);
|
||||
BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_RX_MTU), sizeof(struct iso_data), NULL);
|
||||
|
||||
static struct bt_iso_recv_info iso_info_data[CONFIG_BT_ISO_RX_BUF_COUNT];
|
||||
#define iso_info(buf) (&iso_info_data[net_buf_id(buf)])
|
||||
|
@ -75,8 +73,7 @@ struct bt_iso_cig cigs[CONFIG_BT_ISO_MAX_CIG];
|
|||
|
||||
static struct bt_iso_cig *get_cig(const struct bt_iso_chan *iso_chan);
|
||||
static void bt_iso_remove_data_path(struct bt_conn *iso);
|
||||
static int hci_le_create_cis(const struct bt_iso_connect_param *param,
|
||||
size_t count);
|
||||
static int hci_le_create_cis(const struct bt_iso_connect_param *param, size_t count);
|
||||
|
||||
#endif /* CONFIG_BT_ISO_CENTRAL */
|
||||
|
||||
|
@ -131,8 +128,7 @@ void hci_iso(struct net_buf *buf)
|
|||
iso(buf)->handle = bt_iso_handle(handle);
|
||||
iso(buf)->index = BT_CONN_INDEX_INVALID;
|
||||
|
||||
BT_ISO_DATA_DBG("handle %u len %u flags %u",
|
||||
iso(buf)->handle, len, flags);
|
||||
BT_ISO_DATA_DBG("handle %u len %u flags %u", iso(buf)->handle, len, flags);
|
||||
|
||||
if (buf->len != len) {
|
||||
LOG_ERR("ISO data length mismatch (%u != %u)", buf->len, len);
|
||||
|
@ -154,15 +150,13 @@ void hci_iso(struct net_buf *buf)
|
|||
}
|
||||
|
||||
/* Pull data from the ISO layer */
|
||||
static struct net_buf *iso_data_pull(struct bt_conn *conn,
|
||||
size_t amount,
|
||||
size_t *length);
|
||||
static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t *length);
|
||||
|
||||
/* Returns true if the ISO layer has data to send on this conn */
|
||||
static bool iso_has_data(struct bt_conn *conn);
|
||||
|
||||
static void iso_get_and_clear_cb(struct bt_conn *conn, struct net_buf *buf,
|
||||
bt_conn_tx_cb_t *cb, void **ud)
|
||||
static void iso_get_and_clear_cb(struct bt_conn *conn, struct net_buf *buf, bt_conn_tx_cb_t *cb,
|
||||
void **ud)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_BT_ISO_TX)) {
|
||||
*cb = bt_iso_sent_cb;
|
||||
|
@ -190,13 +184,11 @@ static struct bt_conn *iso_new(void)
|
|||
}
|
||||
|
||||
#if defined(CONFIG_NET_BUF_LOG)
|
||||
struct net_buf *bt_iso_create_pdu_timeout_debug(struct net_buf_pool *pool,
|
||||
size_t reserve,
|
||||
k_timeout_t timeout,
|
||||
const char *func, int line)
|
||||
struct net_buf *bt_iso_create_pdu_timeout_debug(struct net_buf_pool *pool, size_t reserve,
|
||||
k_timeout_t timeout, const char *func, int line)
|
||||
#else
|
||||
struct net_buf *bt_iso_create_pdu_timeout(struct net_buf_pool *pool,
|
||||
size_t reserve, k_timeout_t timeout)
|
||||
struct net_buf *bt_iso_create_pdu_timeout(struct net_buf_pool *pool, size_t reserve,
|
||||
k_timeout_t timeout)
|
||||
#endif
|
||||
{
|
||||
if (!pool) {
|
||||
|
@ -206,8 +198,7 @@ struct net_buf *bt_iso_create_pdu_timeout(struct net_buf_pool *pool,
|
|||
reserve += sizeof(struct bt_hci_iso_sdu_hdr);
|
||||
|
||||
#if defined(CONFIG_NET_BUF_LOG)
|
||||
return bt_conn_create_pdu_timeout_debug(pool, reserve, timeout, func,
|
||||
line);
|
||||
return bt_conn_create_pdu_timeout_debug(pool, reserve, timeout, func, line);
|
||||
#else
|
||||
return bt_conn_create_pdu_timeout(pool, reserve, timeout);
|
||||
#endif
|
||||
|
@ -222,8 +213,7 @@ static int hci_le_setup_iso_data_path(const struct bt_conn *iso, uint8_t dir,
|
|||
uint8_t *cc;
|
||||
int err;
|
||||
|
||||
__ASSERT(dir == BT_HCI_DATAPATH_DIR_HOST_TO_CTLR ||
|
||||
dir == BT_HCI_DATAPATH_DIR_CTLR_TO_HOST,
|
||||
__ASSERT(dir == BT_HCI_DATAPATH_DIR_HOST_TO_CTLR || dir == BT_HCI_DATAPATH_DIR_CTLR_TO_HOST,
|
||||
"invalid ISO data path dir: %u", dir);
|
||||
|
||||
if ((path->cc == NULL && path->cc_len != 0)) {
|
||||
|
@ -278,9 +268,9 @@ static void bt_iso_chan_add(struct bt_conn *iso, struct bt_iso_chan *chan)
|
|||
static int bt_iso_setup_data_path(struct bt_iso_chan *chan)
|
||||
{
|
||||
int err;
|
||||
struct bt_iso_chan_path default_hci_path = { .pid = BT_ISO_DATA_PATH_HCI,
|
||||
.format = BT_HCI_CODING_FORMAT_TRANSPARENT,
|
||||
.cc_len = 0x00 };
|
||||
struct bt_iso_chan_path default_hci_path = {.pid = BT_ISO_DATA_PATH_HCI,
|
||||
.format = BT_HCI_CODING_FORMAT_TRANSPARENT,
|
||||
.cc_len = 0x00};
|
||||
struct bt_iso_chan_path *out_path = NULL;
|
||||
struct bt_iso_chan_path *in_path = NULL;
|
||||
struct bt_iso_chan_io_qos *tx_qos;
|
||||
|
@ -318,9 +308,8 @@ static int bt_iso_setup_data_path(struct bt_iso_chan *chan)
|
|||
}
|
||||
}
|
||||
|
||||
__ASSERT(in_path || out_path,
|
||||
"At least one path shall be shell: in %p out %p",
|
||||
in_path, out_path);
|
||||
__ASSERT(in_path || out_path, "At least one path shall be shell: in %p out %p", in_path,
|
||||
out_path);
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_ISO_BROADCASTER) &&
|
||||
iso->iso.info.type == BT_ISO_CHAN_TYPE_BROADCASTER && in_path) {
|
||||
|
@ -332,8 +321,7 @@ static int bt_iso_setup_data_path(struct bt_iso_chan *chan)
|
|||
|
||||
return err;
|
||||
} else if (IS_ENABLED(CONFIG_BT_ISO_SYNC_RECEIVER) &&
|
||||
iso->iso.info.type == BT_ISO_CHAN_TYPE_SYNC_RECEIVER &&
|
||||
out_path) {
|
||||
iso->iso.info.type == BT_ISO_CHAN_TYPE_SYNC_RECEIVER && out_path) {
|
||||
dir = BT_HCI_DATAPATH_DIR_CTLR_TO_HOST;
|
||||
err = hci_le_setup_iso_data_path(iso, dir, out_path);
|
||||
if (err != 0) {
|
||||
|
@ -365,8 +353,7 @@ static int bt_iso_setup_data_path(struct bt_iso_chan *chan)
|
|||
|
||||
return 0;
|
||||
} else {
|
||||
__ASSERT(false, "Invalid iso.info.type: %u",
|
||||
iso->iso.info.type);
|
||||
__ASSERT(false, "Invalid iso.info.type: %u", iso->iso.info.type);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -407,12 +394,10 @@ void bt_iso_connected(struct bt_conn *iso)
|
|||
#endif /* CONFIG_BT_ISO_BROADCAST */
|
||||
|
||||
} else if (IS_ENABLED(CONFIG_BT_ISO_UNICAST) &&
|
||||
iso->iso.info.type == BT_ISO_CHAN_TYPE_CONNECTED) {
|
||||
bt_conn_disconnect(iso,
|
||||
BT_HCI_ERR_REMOTE_USER_TERM_CONN);
|
||||
iso->iso.info.type == BT_ISO_CHAN_TYPE_CONNECTED) {
|
||||
bt_conn_disconnect(iso, BT_HCI_ERR_REMOTE_USER_TERM_CONN);
|
||||
} else {
|
||||
__ASSERT(false, "Invalid iso.info.type: %u",
|
||||
iso->iso.info.type);
|
||||
__ASSERT(false, "Invalid iso.info.type: %u", iso->iso.info.type);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -518,8 +503,7 @@ const char *bt_iso_chan_state_str(uint8_t state)
|
|||
}
|
||||
}
|
||||
|
||||
void bt_iso_chan_set_state_debug(struct bt_iso_chan *chan,
|
||||
enum bt_iso_state state,
|
||||
void bt_iso_chan_set_state_debug(struct bt_iso_chan *chan, enum bt_iso_state state,
|
||||
const char *func, int line)
|
||||
{
|
||||
LOG_DBG("chan %p iso %p %s -> %s", chan, chan->iso, bt_iso_chan_state_str(chan->state),
|
||||
|
@ -562,8 +546,7 @@ void bt_iso_chan_set_state(struct bt_iso_chan *chan, enum bt_iso_state state)
|
|||
}
|
||||
#endif /* CONFIG_BT_ISO_LOG_LEVEL_DBG */
|
||||
|
||||
int bt_iso_chan_get_info(const struct bt_iso_chan *chan,
|
||||
struct bt_iso_info *info)
|
||||
int bt_iso_chan_get_info(const struct bt_iso_chan *chan, struct bt_iso_info *info)
|
||||
{
|
||||
CHECKIF(chan == NULL) {
|
||||
LOG_DBG("chan is NULL");
|
||||
|
@ -608,8 +591,8 @@ void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags)
|
|||
pb = bt_iso_flags_pb(flags);
|
||||
ts = bt_iso_flags_ts(flags);
|
||||
|
||||
BT_ISO_DATA_DBG("handle %u len %u flags 0x%02x pb 0x%02x ts 0x%02x",
|
||||
iso->handle, buf->len, flags, pb, ts);
|
||||
BT_ISO_DATA_DBG("handle %u len %u flags 0x%02x pb 0x%02x ts 0x%02x", iso->handle, buf->len,
|
||||
flags, pb, ts);
|
||||
|
||||
/* When the PB_Flag does not equal BT_ISO_START or BT_ISO_SINGLE,
|
||||
* the fields Time_Stamp, Packet_Sequence_Number, Packet_Status_Flag
|
||||
|
@ -654,8 +637,8 @@ void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags)
|
|||
}
|
||||
|
||||
BT_ISO_DATA_DBG("%s, len %u total %u flags 0x%02x timestamp %u",
|
||||
pb == BT_ISO_START ? "Start" : "Single",
|
||||
buf->len, len, flags, iso_info(buf)->ts);
|
||||
pb == BT_ISO_START ? "Start" : "Single", buf->len, len, flags,
|
||||
iso_info(buf)->ts);
|
||||
|
||||
if (iso->rx) {
|
||||
LOG_ERR("Unexpected ISO %s fragment",
|
||||
|
@ -687,8 +670,7 @@ void bt_iso_recv(struct bt_conn *iso, struct net_buf *buf, uint8_t flags)
|
|||
return;
|
||||
}
|
||||
|
||||
BT_ISO_DATA_DBG("Cont, len %u rx_len %u",
|
||||
buf->len, iso->rx_len);
|
||||
BT_ISO_DATA_DBG("Cont, len %u rx_len %u", buf->len, iso->rx_len);
|
||||
|
||||
if (buf->len > net_buf_tailroom(iso->rx)) {
|
||||
LOG_ERR("Not enough buffer space for ISO data");
|
||||
|
@ -750,12 +732,10 @@ static bool iso_has_data(struct bt_conn *conn)
|
|||
return !k_fifo_is_empty(&conn->iso.txq);
|
||||
#else /* !CONFIG_BT_ISO_TX */
|
||||
return false;
|
||||
#endif /* CONFIG_BT_ISO_TX */
|
||||
#endif /* CONFIG_BT_ISO_TX */
|
||||
}
|
||||
|
||||
static struct net_buf *iso_data_pull(struct bt_conn *conn,
|
||||
size_t amount,
|
||||
size_t *length)
|
||||
static struct net_buf *iso_data_pull(struct bt_conn *conn, size_t amount, size_t *length)
|
||||
{
|
||||
#if defined(CONFIG_BT_ISO_TX)
|
||||
BT_ISO_DATA_DBG("conn %p amount %d", conn, amount);
|
||||
|
@ -836,10 +816,8 @@ static uint16_t iso_chan_max_data_len(const struct bt_iso_chan *chan)
|
|||
int conn_iso_send(struct bt_conn *conn, struct net_buf *buf, enum bt_iso_timestamp has_ts)
|
||||
{
|
||||
if (buf->user_data_size < CONFIG_BT_CONN_TX_USER_DATA_SIZE) {
|
||||
LOG_ERR("not enough room in user_data %d < %d pool %u",
|
||||
buf->user_data_size,
|
||||
CONFIG_BT_CONN_TX_USER_DATA_SIZE,
|
||||
buf->pool_id);
|
||||
LOG_ERR("not enough room in user_data %d < %d pool %u", buf->user_data_size,
|
||||
CONFIG_BT_CONN_TX_USER_DATA_SIZE, buf->pool_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -955,8 +933,8 @@ int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_ISO_CENTRAL) || defined(CONFIG_BT_ISO_BROADCASTER)
|
||||
static bool valid_chan_io_qos(const struct bt_iso_chan_io_qos *io_qos,
|
||||
bool is_tx, bool is_broadcast, bool advanced)
|
||||
static bool valid_chan_io_qos(const struct bt_iso_chan_io_qos *io_qos, bool is_tx,
|
||||
bool is_broadcast, bool advanced)
|
||||
{
|
||||
const size_t max_mtu = (is_tx ? CONFIG_BT_ISO_TX_MTU : CONFIG_BT_ISO_RX_MTU);
|
||||
const size_t max_sdu = MIN(max_mtu, BT_ISO_MAX_SDU);
|
||||
|
@ -973,8 +951,7 @@ static bool valid_chan_io_qos(const struct bt_iso_chan_io_qos *io_qos,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_ISO_BROADCASTER) &&
|
||||
is_broadcast &&
|
||||
if (IS_ENABLED(CONFIG_BT_ISO_BROADCASTER) && is_broadcast &&
|
||||
io_qos->rtn > BT_ISO_BROADCAST_RTN_MAX) {
|
||||
LOG_DBG("Invalid RTN %u", io_qos->phy);
|
||||
|
||||
|
@ -984,26 +961,20 @@ static bool valid_chan_io_qos(const struct bt_iso_chan_io_qos *io_qos,
|
|||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
if (advanced) {
|
||||
if (IS_ENABLED(CONFIG_BT_ISO_BROADCASTER) && is_broadcast) {
|
||||
if (!IN_RANGE(io_qos->max_pdu,
|
||||
BT_ISO_BROADCAST_PDU_MIN,
|
||||
BT_ISO_PDU_MAX)) {
|
||||
if (!IN_RANGE(io_qos->max_pdu, BT_ISO_BROADCAST_PDU_MIN, BT_ISO_PDU_MAX)) {
|
||||
LOG_DBG("Invalid broadcast PDU %u", io_qos->max_pdu);
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (IS_ENABLED(CONFIG_BT_ISO_CENTRAL)) {
|
||||
if (!IN_RANGE(io_qos->max_pdu,
|
||||
BT_ISO_CONNECTED_PDU_MIN,
|
||||
BT_ISO_PDU_MAX)) {
|
||||
if (!IN_RANGE(io_qos->max_pdu, BT_ISO_CONNECTED_PDU_MIN, BT_ISO_PDU_MAX)) {
|
||||
LOG_DBG("Invalid unicast PDU %u", io_qos->max_pdu);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IN_RANGE(io_qos->burst_number,
|
||||
BT_ISO_BN_MIN,
|
||||
BT_ISO_BN_MAX)) {
|
||||
if (!IN_RANGE(io_qos->burst_number, BT_ISO_BN_MIN, BT_ISO_BN_MAX)) {
|
||||
LOG_DBG("Invalid BN %u", io_qos->burst_number);
|
||||
|
||||
return false;
|
||||
|
@ -1088,8 +1059,7 @@ int bt_iso_chan_disconnect(struct bt_iso_chan *chan)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (chan->iso->iso.acl == NULL ||
|
||||
chan->state == BT_ISO_STATE_DISCONNECTED) {
|
||||
if (chan->iso->iso.acl == NULL || chan->state == BT_ISO_STATE_DISCONNECTED) {
|
||||
LOG_DBG("Channel is not connected");
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
@ -1099,8 +1069,7 @@ int bt_iso_chan_disconnect(struct bt_iso_chan *chan)
|
|||
bt_iso_chan_set_state(chan, BT_ISO_STATE_DISCONNECTED);
|
||||
|
||||
if (chan->ops->disconnected) {
|
||||
chan->ops->disconnected(chan,
|
||||
BT_HCI_ERR_LOCALHOST_TERM_CONN);
|
||||
chan->ops->disconnected(chan, BT_HCI_ERR_LOCALHOST_TERM_CONN);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1230,11 +1199,9 @@ void hci_le_cis_established(struct net_buf *buf)
|
|||
/* Verify if device can send */
|
||||
iso_conn->info.can_send = false;
|
||||
if (tx != NULL) {
|
||||
if (iso->role == BT_HCI_ROLE_PERIPHERAL &&
|
||||
evt->p_bn > 0) {
|
||||
if (iso->role == BT_HCI_ROLE_PERIPHERAL && evt->p_bn > 0) {
|
||||
iso_conn->info.can_send = true;
|
||||
} else if (iso->role == BT_HCI_ROLE_CENTRAL &&
|
||||
evt->c_bn > 0) {
|
||||
} else if (iso->role == BT_HCI_ROLE_CENTRAL && evt->c_bn > 0) {
|
||||
iso_conn->info.can_send = true;
|
||||
}
|
||||
}
|
||||
|
@ -1242,11 +1209,9 @@ void hci_le_cis_established(struct net_buf *buf)
|
|||
/* Verify if device can recv */
|
||||
iso_conn->info.can_recv = false;
|
||||
if (rx != NULL) {
|
||||
if (iso->role == BT_HCI_ROLE_PERIPHERAL &&
|
||||
evt->c_bn > 0) {
|
||||
if (iso->role == BT_HCI_ROLE_PERIPHERAL && evt->c_bn > 0) {
|
||||
iso_conn->info.can_recv = true;
|
||||
} else if (iso->role == BT_HCI_ROLE_CENTRAL &&
|
||||
evt->p_bn > 0) {
|
||||
} else if (iso->role == BT_HCI_ROLE_CENTRAL && evt->p_bn > 0) {
|
||||
iso_conn->info.can_recv = true;
|
||||
}
|
||||
}
|
||||
|
@ -1466,8 +1431,7 @@ void hci_le_cis_req(struct net_buf *buf)
|
|||
|
||||
if (!iso) {
|
||||
LOG_ERR("Could not create and add ISO to ACL %u", acl_handle);
|
||||
hci_le_reject_cis(cis_handle,
|
||||
BT_HCI_ERR_INSUFFICIENT_RESOURCES);
|
||||
hci_le_reject_cis(cis_handle, BT_HCI_ERR_INSUFFICIENT_RESOURCES);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1481,8 +1445,7 @@ void hci_le_cis_req(struct net_buf *buf)
|
|||
LOG_DBG("App rejected ISO %d", err);
|
||||
bt_iso_cleanup_acl(iso);
|
||||
bt_conn_unref(iso);
|
||||
hci_le_reject_cis(cis_handle,
|
||||
BT_HCI_ERR_INSUFFICIENT_RESOURCES);
|
||||
hci_le_reject_cis(cis_handle, BT_HCI_ERR_INSUFFICIENT_RESOURCES);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1494,8 +1457,7 @@ void hci_le_cis_req(struct net_buf *buf)
|
|||
if (err) {
|
||||
bt_iso_cleanup_acl(iso);
|
||||
bt_conn_unref(iso);
|
||||
hci_le_reject_cis(cis_handle,
|
||||
BT_HCI_ERR_INSUFFICIENT_RESOURCES);
|
||||
hci_le_reject_cis(cis_handle, BT_HCI_ERR_INSUFFICIENT_RESOURCES);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1556,10 +1518,8 @@ static void bt_iso_remove_data_path(struct bt_conn *iso)
|
|||
/* TODO: Removing the ISO data path is never used for broadcast:
|
||||
* Remove the following broadcast implementation?
|
||||
*/
|
||||
if ((IS_ENABLED(CONFIG_BT_ISO_BROADCASTER) &&
|
||||
type == BT_ISO_CHAN_TYPE_BROADCASTER) ||
|
||||
(IS_ENABLED(CONFIG_BT_ISO_SYNC_RECEIVER) &&
|
||||
type == BT_ISO_CHAN_TYPE_SYNC_RECEIVER)) {
|
||||
if ((IS_ENABLED(CONFIG_BT_ISO_BROADCASTER) && type == BT_ISO_CHAN_TYPE_BROADCASTER) ||
|
||||
(IS_ENABLED(CONFIG_BT_ISO_SYNC_RECEIVER) && type == BT_ISO_CHAN_TYPE_SYNC_RECEIVER)) {
|
||||
struct bt_iso_chan *chan;
|
||||
struct bt_iso_chan_io_qos *tx_qos;
|
||||
uint8_t dir;
|
||||
|
@ -1579,8 +1539,7 @@ static void bt_iso_remove_data_path(struct bt_conn *iso)
|
|||
}
|
||||
|
||||
(void)hci_le_remove_iso_data_path(iso, dir);
|
||||
} else if (IS_ENABLED(CONFIG_BT_ISO_UNICAST) &&
|
||||
type == BT_ISO_CHAN_TYPE_CONNECTED) {
|
||||
} else if (IS_ENABLED(CONFIG_BT_ISO_UNICAST) && type == BT_ISO_CHAN_TYPE_CONNECTED) {
|
||||
/* Remove both directions for CIS*/
|
||||
|
||||
/* TODO: Check which has been setup first to avoid removing
|
||||
|
@ -1596,8 +1555,7 @@ static void bt_iso_remove_data_path(struct bt_conn *iso)
|
|||
static bool valid_chan_qos(const struct bt_iso_chan_qos *qos, bool advanced)
|
||||
{
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
if (advanced &&
|
||||
!IN_RANGE(qos->num_subevents, BT_ISO_NSE_MIN, BT_ISO_NSE_MAX)) {
|
||||
if (advanced && !IN_RANGE(qos->num_subevents, BT_ISO_NSE_MIN, BT_ISO_NSE_MAX)) {
|
||||
LOG_DBG("Invalid NSE: %u", qos->num_subevents);
|
||||
|
||||
return false;
|
||||
|
@ -1676,10 +1634,8 @@ static struct net_buf *hci_le_set_cig_params(const struct bt_iso_cig *cig,
|
|||
LOG_DBG("id %u, latency C to P %u, latency P to C %u, "
|
||||
"interval C to P %u, interval P to C %u, "
|
||||
"sca %u, packing %u, framing %u, num_cis %u",
|
||||
cig->id, param->c_to_p_latency, param->p_to_c_latency,
|
||||
param->c_to_p_interval, param->p_to_c_interval,
|
||||
param->sca, param->packing,
|
||||
param->framing, param->num_cis);
|
||||
cig->id, param->c_to_p_latency, param->p_to_c_latency, param->c_to_p_interval,
|
||||
param->p_to_c_interval, param->sca, param->packing, param->framing, param->num_cis);
|
||||
|
||||
/* Program the cis parameters */
|
||||
for (i = 0; i < param->num_cis; i++) {
|
||||
|
@ -1768,8 +1724,8 @@ static struct net_buf *hci_le_set_cig_test_params(const struct bt_iso_cig *cig,
|
|||
LOG_DBG("id %u, SDU interval C to P %u, SDU interval P to C %u, c_ft %u, p_ft %u, "
|
||||
"iso_interval %u, sca %u, packing %u, framing %u, num_cis %u",
|
||||
cig->id, param->c_to_p_interval, param->p_to_c_interval, param->c_to_p_ft,
|
||||
param->p_to_c_ft, param->iso_interval, param->sca, param->packing,
|
||||
param->framing, param->num_cis);
|
||||
param->p_to_c_ft, param->iso_interval, param->sca, param->packing, param->framing,
|
||||
param->num_cis);
|
||||
|
||||
/* Program the cis parameters */
|
||||
for (uint8_t i = 0U; i < param->num_cis; i++) {
|
||||
|
@ -1815,10 +1771,9 @@ static struct net_buf *hci_le_set_cig_test_params(const struct bt_iso_cig *cig,
|
|||
|
||||
LOG_DBG("[%d]: id %u, nse %u c_sdu %u, p_sdu %u, c_pdu %u, "
|
||||
"p_pdu %u, c_phy %u, p_phy %u, c_bn %u, p_bn %u",
|
||||
i, cis_param->cis_id, cis_param->nse, cis_param->c_sdu,
|
||||
cis_param->p_sdu, cis_param->c_pdu, cis_param->p_pdu,
|
||||
cis_param->c_phy, cis_param->p_phy, cis_param->c_bn,
|
||||
cis_param->p_bn);
|
||||
i, cis_param->cis_id, cis_param->nse, cis_param->c_sdu, cis_param->p_sdu,
|
||||
cis_param->c_pdu, cis_param->p_pdu, cis_param->c_phy, cis_param->p_phy,
|
||||
cis_param->c_bn, cis_param->p_bn);
|
||||
}
|
||||
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_CIG_PARAMS_TEST, buf, &rsp);
|
||||
|
@ -1831,9 +1786,7 @@ static struct net_buf *hci_le_set_cig_test_params(const struct bt_iso_cig *cig,
|
|||
|
||||
static bool is_advanced_cig_param(const struct bt_iso_cig_param *param)
|
||||
{
|
||||
if (param->c_to_p_ft != 0U ||
|
||||
param->p_to_c_ft != 0U ||
|
||||
param->iso_interval != 0U) {
|
||||
if (param->c_to_p_ft != 0U || param->p_to_c_ft != 0U || param->iso_interval != 0U) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1847,15 +1800,13 @@ static bool is_advanced_cig_param(const struct bt_iso_cig_param *param)
|
|||
}
|
||||
|
||||
if (qos->tx != NULL) {
|
||||
if (qos->tx->max_pdu > 0U ||
|
||||
qos->tx->burst_number > 0U) {
|
||||
if (qos->tx->max_pdu > 0U || qos->tx->burst_number > 0U) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos->rx != NULL) {
|
||||
if (qos->rx->max_pdu > 0U ||
|
||||
qos->rx->burst_number > 0U) {
|
||||
if (qos->rx->max_pdu > 0U || qos->rx->burst_number > 0U) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1871,8 +1822,8 @@ static struct bt_iso_cig *get_cig(const struct bt_iso_chan *iso_chan)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
__ASSERT(iso_chan->iso->iso.cig_id < ARRAY_SIZE(cigs),
|
||||
"Invalid cig_id %u", iso_chan->iso->iso.cig_id);
|
||||
__ASSERT(iso_chan->iso->iso.cig_id < ARRAY_SIZE(cigs), "Invalid cig_id %u",
|
||||
iso_chan->iso->iso.cig_id);
|
||||
|
||||
return &cigs[iso_chan->iso->iso.cig_id];
|
||||
}
|
||||
|
@ -1895,8 +1846,7 @@ static struct bt_iso_cig *get_free_cig(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static bool cis_is_in_cig(const struct bt_iso_cig *cig,
|
||||
const struct bt_iso_chan *cis)
|
||||
static bool cis_is_in_cig(const struct bt_iso_cig *cig, const struct bt_iso_chan *cis)
|
||||
{
|
||||
if (cig == NULL || cis == NULL || cis->iso == NULL) {
|
||||
return false;
|
||||
|
@ -1905,8 +1855,7 @@ static bool cis_is_in_cig(const struct bt_iso_cig *cig,
|
|||
return cig->id == cis->iso->iso.cig_id;
|
||||
}
|
||||
|
||||
static int cig_init_cis(struct bt_iso_cig *cig,
|
||||
const struct bt_iso_cig_param *param)
|
||||
static int cig_init_cis(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param)
|
||||
{
|
||||
for (uint8_t i = 0; i < param->num_cis; i++) {
|
||||
struct bt_iso_chan *cis = param->cis_channels[i];
|
||||
|
@ -1999,8 +1948,7 @@ static bool valid_cig_param(const struct bt_iso_cig_param *param, bool advanced,
|
|||
}
|
||||
}
|
||||
|
||||
if (param->framing != BT_ISO_FRAMING_UNFRAMED &&
|
||||
param->framing != BT_ISO_FRAMING_FRAMED) {
|
||||
if (param->framing != BT_ISO_FRAMING_UNFRAMED && param->framing != BT_ISO_FRAMING_FRAMED) {
|
||||
LOG_DBG("Invalid framing parameter: %u", param->framing);
|
||||
return false;
|
||||
}
|
||||
|
@ -2047,21 +1995,18 @@ static bool valid_cig_param(const struct bt_iso_cig_param *param, bool advanced,
|
|||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
if (advanced) {
|
||||
if (!IN_RANGE(param->c_to_p_ft, BT_ISO_FT_MIN, BT_ISO_FT_MAX)) {
|
||||
LOG_DBG("Invalid Central to Peripheral FT %u",
|
||||
param->c_to_p_ft);
|
||||
LOG_DBG("Invalid Central to Peripheral FT %u", param->c_to_p_ft);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IN_RANGE(param->p_to_c_ft, BT_ISO_FT_MIN, BT_ISO_FT_MAX)) {
|
||||
LOG_DBG("Invalid Peripheral to Central FT %u",
|
||||
param->p_to_c_ft);
|
||||
LOG_DBG("Invalid Peripheral to Central FT %u", param->p_to_c_ft);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IN_RANGE(param->iso_interval,
|
||||
BT_ISO_ISO_INTERVAL_MIN,
|
||||
if (!IN_RANGE(param->iso_interval, BT_ISO_ISO_INTERVAL_MIN,
|
||||
BT_ISO_ISO_INTERVAL_MAX)) {
|
||||
LOG_DBG("Invalid ISO interval %u", param->iso_interval);
|
||||
|
||||
|
@ -2073,8 +2018,7 @@ static bool valid_cig_param(const struct bt_iso_cig_param *param, bool advanced,
|
|||
return true;
|
||||
}
|
||||
|
||||
int bt_iso_cig_create(const struct bt_iso_cig_param *param,
|
||||
struct bt_iso_cig **out_cig)
|
||||
int bt_iso_cig_create(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig)
|
||||
{
|
||||
int err;
|
||||
struct net_buf *rsp;
|
||||
|
@ -2146,8 +2090,7 @@ int bt_iso_cig_create(const struct bt_iso_cig_param *param,
|
|||
|
||||
cig_rsp = (void *)rsp->data;
|
||||
|
||||
if (rsp->len < sizeof(cig_rsp) ||
|
||||
cig_rsp->num_handles != param->num_cis) {
|
||||
if (rsp->len < sizeof(cig_rsp) || cig_rsp->num_handles != param->num_cis) {
|
||||
LOG_WRN("Unexpected response to hci_le_set_cig_params");
|
||||
err = -EIO;
|
||||
net_buf_unref(rsp);
|
||||
|
@ -2179,8 +2122,7 @@ static void restore_cig(struct bt_iso_cig *cig, uint8_t existing_num_cis)
|
|||
* of CIS that was previously added before
|
||||
* bt_iso_cig_reconfigure was called
|
||||
*/
|
||||
if (cis->iso != NULL &&
|
||||
cis->iso->iso.cis_id >= existing_num_cis) {
|
||||
if (cis->iso != NULL && cis->iso->iso.cis_id >= existing_num_cis) {
|
||||
bt_conn_unref(cis->iso);
|
||||
cis->iso = NULL;
|
||||
|
||||
|
@ -2190,9 +2132,7 @@ static void restore_cig(struct bt_iso_cig *cig, uint8_t existing_num_cis)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int bt_iso_cig_reconfigure(struct bt_iso_cig *cig,
|
||||
const struct bt_iso_cig_param *param)
|
||||
int bt_iso_cig_reconfigure(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param)
|
||||
{
|
||||
struct bt_hci_rp_le_set_cig_params *cig_rsp;
|
||||
uint8_t existing_num_cis;
|
||||
|
@ -2286,8 +2226,7 @@ int bt_iso_cig_terminate(struct bt_iso_cig *cig)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (cig->state != BT_ISO_CIG_STATE_INACTIVE &&
|
||||
cig->state != BT_ISO_CIG_STATE_CONFIGURED) {
|
||||
if (cig->state != BT_ISO_CIG_STATE_INACTIVE && cig->state != BT_ISO_CIG_STATE_CONFIGURED) {
|
||||
LOG_DBG("Invalid CIG state: %u", cig->state);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -2313,8 +2252,7 @@ void bt_iso_security_changed(struct bt_conn *acl, uint8_t hci_status)
|
|||
* insufficient, so we only need to handle central here.
|
||||
* BT_ISO_STATE_ENCRYPT_PENDING is only set by the central.
|
||||
*/
|
||||
if (!IS_ENABLED(CONFIG_BT_CENTRAL) ||
|
||||
acl->role != BT_CONN_ROLE_CENTRAL) {
|
||||
if (!IS_ENABLED(CONFIG_BT_CENTRAL) || acl->role != BT_CONN_ROLE_CENTRAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2344,15 +2282,14 @@ void bt_iso_security_changed(struct bt_conn *acl, uint8_t hci_status)
|
|||
param[param_count].iso_chan = iso_chan;
|
||||
param_count++;
|
||||
} else {
|
||||
LOG_DBG("Failed to encrypt ACL %p for ISO %p: %u %s",
|
||||
acl, iso, hci_status, bt_hci_err_to_str(hci_status));
|
||||
LOG_DBG("Failed to encrypt ACL %p for ISO %p: %u %s", acl, iso, hci_status,
|
||||
bt_hci_err_to_str(hci_status));
|
||||
|
||||
/* We utilize the disconnected callback to make the
|
||||
* upper layers aware of the error
|
||||
*/
|
||||
if (iso_chan->ops->disconnected) {
|
||||
iso_chan->ops->disconnected(iso_chan,
|
||||
hci_status);
|
||||
iso_chan->ops->disconnected(iso_chan, hci_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2375,8 +2312,7 @@ void bt_iso_security_changed(struct bt_conn *acl, uint8_t hci_status)
|
|||
* upper layers aware of the error
|
||||
*/
|
||||
if (iso_chan->ops->disconnected) {
|
||||
iso_chan->ops->disconnected(iso_chan,
|
||||
hci_status);
|
||||
iso_chan->ops->disconnected(iso_chan, hci_status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2396,15 +2332,13 @@ void bt_iso_security_changed(struct bt_conn *acl, uint8_t hci_status)
|
|||
}
|
||||
}
|
||||
|
||||
static int hci_le_create_cis(const struct bt_iso_connect_param *param,
|
||||
size_t count)
|
||||
static int hci_le_create_cis(const struct bt_iso_connect_param *param, size_t count)
|
||||
{
|
||||
struct bt_hci_cis *cis;
|
||||
struct bt_hci_cp_le_create_cis *req;
|
||||
struct net_buf *buf;
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CIS,
|
||||
sizeof(*req) + sizeof(*cis) * count);
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CIS, sizeof(*req) + sizeof(*cis) * count);
|
||||
if (!buf) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
@ -2443,8 +2377,7 @@ static int hci_le_create_cis(const struct bt_iso_connect_param *param,
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_SMP)
|
||||
static int iso_chan_connect_security(const struct bt_iso_connect_param *param,
|
||||
size_t count)
|
||||
static int iso_chan_connect_security(const struct bt_iso_connect_param *param, size_t count)
|
||||
{
|
||||
/* conn_idx_handled is an array of booleans for which conn indexes
|
||||
* already have been used to call bt_conn_set_security.
|
||||
|
@ -2463,8 +2396,7 @@ static int iso_chan_connect_security(const struct bt_iso_connect_param *param,
|
|||
if (!conn_idx_handled[conn_idx]) {
|
||||
int err;
|
||||
|
||||
err = bt_conn_set_security(acl,
|
||||
iso_chan->required_sec_level);
|
||||
err = bt_conn_set_security(acl, iso_chan->required_sec_level);
|
||||
if (err != 0) {
|
||||
LOG_DBG("[%zu]: Failed to set security: %d", i, err);
|
||||
|
||||
|
@ -2498,8 +2430,7 @@ static bool iso_chans_connecting(void)
|
|||
const struct bt_conn *iso = &iso_conns[i];
|
||||
const struct bt_iso_chan *iso_chan;
|
||||
|
||||
if (iso == NULL ||
|
||||
iso->iso.info.type != BT_ISO_CHAN_TYPE_CONNECTED) {
|
||||
if (iso == NULL || iso->iso.info.type != BT_ISO_CHAN_TYPE_CONNECTED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2676,9 +2607,7 @@ static void big_disconnect(struct bt_iso_big *big, uint8_t reason)
|
|||
}
|
||||
}
|
||||
|
||||
static int big_init_bis(struct bt_iso_big *big,
|
||||
struct bt_iso_chan **bis_channels,
|
||||
uint8_t num_bis,
|
||||
static int big_init_bis(struct bt_iso_big *big, struct bt_iso_chan **bis_channels, uint8_t num_bis,
|
||||
bool broadcaster)
|
||||
{
|
||||
for (uint8_t i = 0; i < num_bis; i++) {
|
||||
|
@ -2694,8 +2623,8 @@ static int big_init_bis(struct bt_iso_big *big,
|
|||
iso_conn = &bis->iso->iso;
|
||||
|
||||
iso_conn->big_handle = big->handle;
|
||||
iso_conn->info.type = broadcaster ? BT_ISO_CHAN_TYPE_BROADCASTER
|
||||
: BT_ISO_CHAN_TYPE_SYNC_RECEIVER;
|
||||
iso_conn->info.type =
|
||||
broadcaster ? BT_ISO_CHAN_TYPE_BROADCASTER : BT_ISO_CHAN_TYPE_SYNC_RECEIVER;
|
||||
iso_conn->bis_id = bt_conn_index(bis->iso);
|
||||
|
||||
bt_iso_chan_add(bis->iso, bis);
|
||||
|
@ -2762,8 +2691,7 @@ static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big,
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
static int hci_le_create_big_test(const struct bt_le_ext_adv *padv,
|
||||
struct bt_iso_big *big,
|
||||
static int hci_le_create_big_test(const struct bt_le_ext_adv *padv, struct bt_iso_big *big,
|
||||
const struct bt_iso_big_create_param *param)
|
||||
{
|
||||
struct bt_hci_cp_le_create_big_test *req;
|
||||
|
@ -2811,9 +2739,8 @@ static int hci_le_create_big_test(const struct bt_le_ext_adv *padv,
|
|||
"ISO interval %u, NSE %u, SDU %u, PDU %u, PHY %u, packing %u, "
|
||||
"framing %u, BN %u, IRC %u, PTO %u, encryption %u",
|
||||
req->big_handle, req->adv_handle, req->num_bis, param->interval,
|
||||
param->iso_interval, req->nse, req->max_sdu, req->max_pdu,
|
||||
req->phy, req->packing, req->framing, req->bn, req->irc,
|
||||
req->pto, req->encryption);
|
||||
param->iso_interval, req->nse, req->max_sdu, req->max_pdu, req->phy, req->packing,
|
||||
req->framing, req->bn, req->irc, req->pto, req->encryption);
|
||||
|
||||
bt_hci_cmd_state_set_init(buf, &state, big->flags, BT_BIG_PENDING, true);
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_CREATE_BIG_TEST, buf, NULL);
|
||||
|
@ -2830,8 +2757,7 @@ static int hci_le_create_big_test(const struct bt_le_ext_adv *padv,
|
|||
|
||||
static bool is_advanced_big_param(const struct bt_iso_big_create_param *param)
|
||||
{
|
||||
if (param->irc != 0U ||
|
||||
param->iso_interval != 0U) {
|
||||
if (param->irc != 0U || param->iso_interval != 0U) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2855,8 +2781,7 @@ static bool is_advanced_big_param(const struct bt_iso_big_create_param *param)
|
|||
}
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
|
||||
static bool valid_big_param(const struct bt_iso_big_create_param *param,
|
||||
bool advanced)
|
||||
static bool valid_big_param(const struct bt_iso_big_create_param *param, bool advanced)
|
||||
{
|
||||
CHECKIF(!param->bis_channels) {
|
||||
LOG_DBG("NULL BIS channels");
|
||||
|
@ -2892,8 +2817,7 @@ static bool valid_big_param(const struct bt_iso_big_create_param *param,
|
|||
}
|
||||
|
||||
CHECKIF(bis->qos->tx == NULL ||
|
||||
!valid_chan_io_qos(bis->qos->tx, true, true,
|
||||
advanced)) {
|
||||
!valid_chan_io_qos(bis->qos->tx, true, true, advanced)) {
|
||||
LOG_DBG("bis_channels[%u]: Invalid QOS", i);
|
||||
|
||||
return false;
|
||||
|
@ -2922,18 +2846,13 @@ static bool valid_big_param(const struct bt_iso_big_create_param *param,
|
|||
return false;
|
||||
}
|
||||
|
||||
CHECKIF(!IN_RANGE(param->interval,
|
||||
BT_ISO_SDU_INTERVAL_MIN,
|
||||
BT_ISO_SDU_INTERVAL_MAX)) {
|
||||
CHECKIF(!IN_RANGE(param->interval, BT_ISO_SDU_INTERVAL_MIN, BT_ISO_SDU_INTERVAL_MAX)) {
|
||||
LOG_DBG("Invalid interval: %u", param->interval);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECKIF(!advanced &&
|
||||
!IN_RANGE(param->latency,
|
||||
BT_ISO_LATENCY_MIN,
|
||||
BT_ISO_LATENCY_MAX)) {
|
||||
CHECKIF(!advanced && !IN_RANGE(param->latency, BT_ISO_LATENCY_MIN, BT_ISO_LATENCY_MAX)) {
|
||||
LOG_DBG("Invalid latency: %u", param->latency);
|
||||
|
||||
return false;
|
||||
|
@ -2953,9 +2872,8 @@ static bool valid_big_param(const struct bt_iso_big_create_param *param,
|
|||
return false;
|
||||
}
|
||||
|
||||
CHECKIF(!IN_RANGE(param->iso_interval,
|
||||
BT_ISO_ISO_INTERVAL_MIN,
|
||||
BT_ISO_ISO_INTERVAL_MAX)) {
|
||||
CHECKIF(!IN_RANGE(param->iso_interval, BT_ISO_ISO_INTERVAL_MIN,
|
||||
BT_ISO_ISO_INTERVAL_MAX)) {
|
||||
LOG_DBG("Invalid ISO interval %u", param->iso_interval);
|
||||
|
||||
return false;
|
||||
|
@ -3064,8 +2982,8 @@ void hci_le_big_complete(struct net_buf *buf)
|
|||
big = lookup_big_by_handle(evt->big_handle);
|
||||
atomic_clear_bit(big->flags, BT_BIG_PENDING);
|
||||
|
||||
LOG_DBG("BIG[%u] %p completed, status 0x%02x %s",
|
||||
big->handle, big, evt->status, bt_hci_err_to_str(evt->status));
|
||||
LOG_DBG("BIG[%u] %p completed, status 0x%02x %s", big->handle, big, evt->status,
|
||||
bt_hci_err_to_str(evt->status));
|
||||
|
||||
if (evt->status || evt->num_bis != big->num_bis) {
|
||||
if (evt->status == BT_HCI_ERR_SUCCESS && evt->num_bis != big->num_bis) {
|
||||
|
@ -3239,8 +3157,8 @@ void hci_le_big_sync_established(struct net_buf *buf)
|
|||
big = lookup_big_by_handle(evt->big_handle);
|
||||
atomic_clear_bit(big->flags, BT_BIG_SYNCING);
|
||||
|
||||
LOG_DBG("BIG[%u] %p sync established, status 0x%02x %s",
|
||||
big->handle, big, evt->status, bt_hci_err_to_str(evt->status));
|
||||
LOG_DBG("BIG[%u] %p sync established, status 0x%02x %s", big->handle, big, evt->status,
|
||||
bt_hci_err_to_str(evt->status));
|
||||
|
||||
if (evt->status || evt->num_bis != big->num_bis) {
|
||||
if (evt->status == BT_HCI_ERR_SUCCESS && evt->num_bis != big->num_bis) {
|
||||
|
@ -3413,7 +3331,6 @@ int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_para
|
|||
return err;
|
||||
}
|
||||
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) {
|
||||
bt_iso_chan_set_state(bis, BT_ISO_STATE_CONNECTING);
|
||||
}
|
||||
|
|
|
@ -4,12 +4,21 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2020 Intel Corporation
|
||||
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2021-2024 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <zephyr/bluetooth/conn.h>
|
||||
#include <zephyr/bluetooth/buf.h>
|
||||
#include <zephyr/bluetooth/iso.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/net_buf.h>
|
||||
#include <zephyr/sys/atomic.h>
|
||||
#include <zephyr/sys/slist.h>
|
||||
#include <zephyr/sys_clock.h>
|
||||
|
||||
struct iso_data {
|
||||
/* Extend the bt_buf user data */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue