Skip to content

Commit bcc8190

Browse files
Thalleynashif
authored andcommitted
Bluetooth: ISO: Add ISO tx callback struct array
Add an array similar to the bt_conn (ACL/L2CAP) tx sent callback, and initialize it. This increases the number of bt_conn_tx available such that ISO does not take any of "L2CAP's" buffers, but also ensures that the sent callback is called for a broadcast iso only build. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 1f99a0c commit bcc8190

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ static struct bt_conn sco_conns[CONFIG_BT_MAX_SCO_CONN];
8787
#endif /* CONFIG_BT_BREDR */
8888
#endif /* CONFIG_BT_CONN */
8989

90+
#if defined(CONFIG_BT_ISO)
91+
/* Callback TX buffers for ISO */
92+
static struct bt_conn_tx iso_tx[CONFIG_BT_ISO_TX_BUF_COUNT];
93+
94+
int bt_conn_iso_init(void)
95+
{
96+
for (size_t i = 0; i < ARRAY_SIZE(iso_tx); i++) {
97+
k_fifo_put(&free_tx, &iso_tx[i]);
98+
}
99+
100+
return 0;
101+
}
102+
#endif /* CONFIG_BT_ISO */
103+
90104
struct k_sem *bt_conn_get_pkts(struct bt_conn *conn)
91105
{
92106
#if defined(CONFIG_BT_BREDR)

subsys/bluetooth/host/conn_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ struct bt_iso_create_param {
251251
struct bt_iso_chan **chans;
252252
};
253253

254+
int bt_conn_iso_init(void);
255+
254256
/* Add a new ISO connection */
255257
struct bt_conn *bt_conn_add_iso(struct bt_conn *acl);
256258

subsys/bluetooth/host/hci_core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,6 +3472,13 @@ static int bt_init(void)
34723472
}
34733473
}
34743474

3475+
if (IS_ENABLED(CONFIG_BT_ISO)) {
3476+
err = bt_conn_iso_init();
3477+
if (err) {
3478+
return err;
3479+
}
3480+
}
3481+
34753482
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
34763483
if (!bt_dev.id_count) {
34773484
BT_INFO("No ID address. App must call settings_load()");

0 commit comments

Comments
 (0)