Bluetooth: ISO/BAP: Refactor BIS bitfield
Refactors teh BIS bitfield values used for ISO and BAP. Previously BIT(1) meant BIS index 1, which was a Zephyr choice in the early days of ISO, as the BT Core spec did not use a bitfield for BIS indexes. Later the BASS specification came along and defined that BIT(0) meant BIS index 1, which meant that we had to shift BIS bitfields between BAP and ISO. This commit refactors the ISO layer to use BIT(0) for Index 1 now, which means that there is no longer a need for conversion between the BAP and ISO layers, and that we can use a value range defined by a BT Core spec (BASS). Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
539f3a1600
commit
8be6db67fc
21 changed files with 48 additions and 57 deletions
|
@ -452,7 +452,7 @@ static void test_bass_mod_source(void)
|
|||
mod_src_param.pa_sync = true;
|
||||
mod_src_param.subgroups = &subgroup;
|
||||
mod_src_param.pa_interval = g_broadcaster_info.interval;
|
||||
subgroup.bis_sync = BIT(1) | BIT(2); /* Indexes 1 and 2 */
|
||||
subgroup.bis_sync = BT_ISO_BIS_INDEX_BIT(1) | BT_ISO_BIS_INDEX_BIT(2); /* Indexes 1 and 2 */
|
||||
subgroup.metadata_len = 0;
|
||||
|
||||
err = bt_bap_broadcast_assistant_mod_src(default_conn, &mod_src_param);
|
||||
|
@ -482,7 +482,7 @@ static void test_bass_mod_source_long_meta(void)
|
|||
mod_src_param.pa_sync = true;
|
||||
mod_src_param.subgroups = &subgroup;
|
||||
mod_src_param.pa_interval = g_broadcaster_info.interval;
|
||||
subgroup.bis_sync = BIT(1) | BIT(2);
|
||||
subgroup.bis_sync = BT_ISO_BIS_INDEX_BIT(1) | BT_ISO_BIS_INDEX_BIT(2);
|
||||
|
||||
subgroup.metadata_len = sizeof(metadata);
|
||||
memcpy(subgroup.metadata, metadata, sizeof(metadata));
|
||||
|
|
|
@ -804,7 +804,7 @@ static void test_broadcast_sync_inval(void)
|
|||
return;
|
||||
}
|
||||
|
||||
bis_index = BIT(0);
|
||||
bis_index = BT_ISO_BIS_INDEX_BIT(BT_ISO_BIS_INDEX_MAX + 1);
|
||||
err = bt_bap_broadcast_sink_sync(g_sink, bis_index, streams, NULL);
|
||||
if (err == 0) {
|
||||
FAIL("bt_bap_broadcast_sink_sync did not fail with invalid BIS indexes: 0x%08X\n",
|
||||
|
@ -821,7 +821,7 @@ static void test_broadcast_sync_inval(void)
|
|||
memcpy(tmp_streams, streams, sizeof(streams));
|
||||
bis_index = 0U;
|
||||
for (size_t i = 0U; i < ARRAY_SIZE(tmp_streams); i++) {
|
||||
bis_index |= BIT(i + BT_ISO_BIS_INDEX_MIN);
|
||||
bis_index |= BT_ISO_BIS_INDEX_BIT(i);
|
||||
}
|
||||
|
||||
err = bt_bap_broadcast_sink_sync(g_sink, bis_index, tmp_streams, NULL);
|
||||
|
@ -833,7 +833,7 @@ static void test_broadcast_sync_inval(void)
|
|||
|
||||
bis_index = 0U;
|
||||
for (size_t i = 0U; i < CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT + 1; i++) {
|
||||
bis_index |= BIT(i + BT_ISO_BIS_INDEX_MIN);
|
||||
bis_index |= BT_ISO_BIS_INDEX_BIT(i);
|
||||
}
|
||||
|
||||
err = bt_bap_broadcast_sink_sync(g_sink, bis_index, tmp_streams, NULL);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <zephyr/bluetooth/bluetooth.h>
|
||||
#include <zephyr/bluetooth/byteorder.h>
|
||||
#include <zephyr/bluetooth/gap.h>
|
||||
#include <zephyr/bluetooth/iso.h>
|
||||
#include <zephyr/bluetooth/uuid.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/net/buf.h>
|
||||
|
@ -650,7 +651,7 @@ static int sync_broadcast(struct sync_state *state)
|
|||
|
||||
/* We don't actually need to sync to the BIG/BISes */
|
||||
err = bt_bap_scan_delegator_set_bis_sync_state(state->src_id,
|
||||
(uint32_t []){ BIT(1) });
|
||||
(uint32_t[]){BT_ISO_BIS_INDEX_BIT(1)});
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ static void sync_big(struct bt_le_per_adv_sync *sync, uint8_t cnt, struct bt_iso
|
|||
struct bt_iso_chan *bis_channels[CONFIG_BT_ISO_MAX_CHAN];
|
||||
struct bt_iso_big_sync_param param = {
|
||||
.sync_timeout = interval_to_sync_timeout(broadcaster_info.interval),
|
||||
.bis_bitfield = BIT_MASK(cnt) << 1U, /* BIS indexes start from 1, thus shift by 1 */
|
||||
.bis_bitfield = BIT_MASK(cnt),
|
||||
.bis_channels = bis_channels,
|
||||
.mse = BT_ISO_SYNC_MSE_MIN,
|
||||
.encryption = false,
|
||||
|
|
|
@ -907,7 +907,7 @@ static void test_iso_recv_main(void)
|
|||
bis_iso_qos.rx = &iso_rx_qos;
|
||||
big_param.bis_channels = bis_channels;
|
||||
big_param.num_bis = BIS_ISO_CHAN_COUNT;
|
||||
big_param.bis_bitfield = BIT(1); /* BIS 1 selected */
|
||||
big_param.bis_bitfield = BT_ISO_BIS_INDEX_BIT(1); /* BIS 1 selected */
|
||||
big_param.mse = 1;
|
||||
big_param.sync_timeout = 100; /* 1000 ms */
|
||||
big_param.encryption = false;
|
||||
|
@ -1124,7 +1124,7 @@ static void test_iso_recv_vs_dp_main(void)
|
|||
bis_iso_qos.rx = &iso_rx_qos;
|
||||
big_param.bis_channels = bis_channels;
|
||||
big_param.num_bis = BIS_ISO_CHAN_COUNT;
|
||||
big_param.bis_bitfield = BIT(1); /* BIS 1 selected */
|
||||
big_param.bis_bitfield = BT_ISO_BIS_INDEX_BIT(1); /* BIS 1 selected */
|
||||
big_param.mse = 1;
|
||||
big_param.sync_timeout = 100; /* 1000 ms */
|
||||
big_param.encryption = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue