From 9a51ece3fd1c4ff519c475d0655428bcbb520891 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 17 Nov 2022 07:34:35 +0530 Subject: [PATCH] Bluetooth: Controller: Fix BIS subevent channel indices From Bluetooth Core Specification v5.3 Vol 6 Part B Section 4.4.6.8 Channel indices, The subevent number se_n shall be set to the values 1 to NSE, in order, for the subevents on a given BIS - the same values shall be used for all the BISes in a BIG - and to 1 for the control subevent. Hence, fix implementation to reset back to se_n to 1 when next BIS PDUs are transmitted in the subevents. Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/lll/lll_adv_iso.c | 26 +++++++++++----- .../ll_sw/nordic/lll/lll_sync_iso.c | 31 +++++++------------ 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c index 936b9a9e3f9..bdc650e2451 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c @@ -503,6 +503,7 @@ static void isr_tx_common(void *param, /* control subevent to use bis = 0 and se_n = 1 */ bis = 0U; data_chan_use = lll->ctrl_chan_use; + } else { struct lll_adv_iso_stream *stream; uint16_t stream_handle; @@ -618,14 +619,25 @@ static void isr_tx_common(void *param, pdu->payload[3] = lll->bis_curr; #endif /* TEST_WITH_DUMMY_PDU */ - /* Calculate the radio channel to use for ISO event */ - data_chan_use = - lll_chan_iso_subevent(data_chan_id, - lll->data_chan_map, - lll->data_chan_count, - &lll->data_chan_prn_s, - &lll->data_chan_remap_idx); + if ((lll->bn_curr == 1U) && (lll->irc_curr == 1U)) { + const uint16_t event_counter = + (lll->payload_count / lll->bn) - 1U; + /* Calculate the radio channel to use for next BIS */ + data_chan_use = lll_chan_iso_event(event_counter, + data_chan_id, + lll->data_chan_map, + lll->data_chan_count, + &lll->data_chan_prn_s, + &lll->data_chan_remap_idx); + } else { + /* Calculate the radio channel to use for subevent */ + data_chan_use = lll_chan_iso_subevent(data_chan_id, + lll->data_chan_map, + lll->data_chan_count, + &lll->data_chan_prn_s, + &lll->data_chan_remap_idx); + } } pdu->rfu = 0U; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 4dd905647e6..785906b398e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -603,23 +603,6 @@ isr_rx_find_subevent: struct lll_sync_iso_stream *stream; uint16_t handle; - if (skipped) { - /* Calculate the Access Address for the current BIS */ - util_bis_aa_le32(lll->bis_curr, lll->seed_access_addr, - access_addr); - data_chan_id = lll_chan_id(access_addr); - - /* Skip channel indices for the previous BIS stream */ - do { - /* Calculate the radio channel to use for ISO event */ - (void)lll_chan_iso_subevent(data_chan_id, - lll->data_chan_map, - lll->data_chan_count, - &lll->data_chan_prn_s, - &lll->data_chan_remap_idx); - } while (--skipped); - } - handle = lll->stream_handle[lll->stream_curr]; stream = ull_sync_iso_lll_stream_get(handle); if (lll->bis_curr == stream->bis_index) { @@ -800,9 +783,19 @@ isr_rx_next_subevent: radio_crc_configure(PDU_CRC_POLYNOMIAL, sys_get_le24(crc_init)); /* Set the channel to use */ - if (bis) { + if (bis && (lll->bn_curr == 1U) && (lll->irc_curr == 1U)) { + const uint16_t event_counter = (lll->payload_count / lll->bn) - + 1U; + + /* Calculate the radio channel to use for next BIS */ + data_chan_use = lll_chan_iso_event(event_counter, data_chan_id, + lll->data_chan_map, + lll->data_chan_count, + &lll->data_chan_prn_s, + &lll->data_chan_remap_idx); + } else if (bis) { do { - /* Calculate the radio channel to use for ISO event */ + /* Calculate the radio channel to use for subevent */ data_chan_use = lll_chan_iso_subevent(data_chan_id, lll->data_chan_map, lll->data_chan_count,