@@ -526,6 +526,7 @@ static void isr_rx(void *param)
526
526
uint16_t data_chan_id ;
527
527
uint8_t data_chan_use ;
528
528
uint8_t crc_init [3 ];
529
+ uint8_t stream_curr ;
529
530
uint8_t rssi_ready ;
530
531
uint32_t start_us ;
531
532
uint8_t new_burst ;
@@ -553,6 +554,9 @@ static void isr_rx(void *param)
553
554
/* BIS index */
554
555
bis_idx = lll -> bis_curr - 1U ;
555
556
557
+ /* Current stream */
558
+ stream_curr = lll -> stream_curr ;
559
+
556
560
goto isr_rx_done ;
557
561
}
558
562
@@ -587,6 +591,9 @@ static void isr_rx(void *param)
587
591
/* BIS index */
588
592
bis_idx = lll -> bis_curr - 1U ;
589
593
594
+ /* Current stream */
595
+ stream_curr = lll -> stream_curr ;
596
+
590
597
/* Check CRC and generate ISO Data PDU */
591
598
if (crc_ok ) {
592
599
struct lll_sync_iso_stream * sync_stream ;
@@ -648,14 +655,14 @@ static void isr_rx(void *param)
648
655
}
649
656
650
657
/* Get reference to stream context */
651
- stream_handle = lll -> stream_handle [lll -> stream_curr ];
658
+ stream_handle = lll -> stream_handle [stream_curr ];
652
659
sync_stream = ull_sync_iso_lll_stream_get (stream_handle );
653
660
654
661
/* Store the received PDU if selected stream and not already
655
662
* received (say in previous event as pre-transmitted PDU.
656
663
*/
657
664
if ((lll -> bis_curr == sync_stream -> bis_index ) && pdu -> len &&
658
- !lll -> payload [bis_idx ][payload_index ]) {
665
+ !lll -> payload [stream_curr ][payload_index ]) {
659
666
uint16_t handle ;
660
667
661
668
if (IS_ENABLED (CONFIG_BT_CTLR_BROADCAST_ISO_ENC ) &&
@@ -679,7 +686,7 @@ static void isr_rx(void *param)
679
686
handle = LL_BIS_SYNC_HANDLE_FROM_IDX (stream_handle );
680
687
isr_rx_iso_data_valid (lll , handle , node_rx );
681
688
682
- lll -> payload [bis_idx ][payload_index ] = node_rx ;
689
+ lll -> payload [stream_curr ][payload_index ] = node_rx ;
683
690
}
684
691
}
685
692
@@ -724,7 +731,7 @@ static void isr_rx(void *param)
724
731
}
725
732
726
733
/* Check if (bn_curr)th Rx PDU has been received */
727
- if (!lll -> payload [bis_idx ][payload_index ]) {
734
+ if (!lll -> payload [stream_curr ][payload_index ]) {
728
735
/* Receive the (bn_curr)th Rx PDU of bis_curr */
729
736
bis = lll -> bis_curr ;
730
737
@@ -767,7 +774,7 @@ static void isr_rx(void *param)
767
774
/* Check if (irc_curr)th bn = 1 Rx PDU has been
768
775
* received.
769
776
*/
770
- if (!lll -> payload [bis_idx ][payload_index ]) {
777
+ if (!lll -> payload [stream_curr ][payload_index ]) {
771
778
/* Receive the (irc_curr)th bn = 1 Rx PDU of
772
779
* bis_curr.
773
780
*/
@@ -816,14 +823,13 @@ static void isr_rx(void *param)
816
823
817
824
/* Next BIS */
818
825
if (lll -> bis_curr < lll -> num_bis ) {
819
- const uint8_t stream_curr = lll -> stream_curr + 1U ;
820
826
struct lll_sync_iso_stream * sync_stream ;
821
827
uint16_t stream_handle ;
822
828
823
829
/* Next selected stream */
824
- if (stream_curr < lll -> stream_count ) {
825
- lll -> stream_curr = stream_curr ;
826
- stream_handle = lll -> stream_handle [lll -> stream_curr ];
830
+ if (( lll -> stream_curr + 1U ) < lll -> stream_count ) {
831
+ stream_curr = ++ lll -> stream_curr ;
832
+ stream_handle = lll -> stream_handle [stream_curr ];
827
833
sync_stream = ull_sync_iso_lll_stream_get (stream_handle );
828
834
if (sync_stream -> bis_index <= lll -> num_bis ) {
829
835
uint32_t payload_offset ;
@@ -859,7 +865,7 @@ static void isr_rx(void *param)
859
865
/* Check if (irc_curr)th bn = 1 Rx PDU has been
860
866
* received.
861
867
*/
862
- if (!lll -> payload [bis_idx_new ][payload_index ]) {
868
+ if (!lll -> payload [stream_curr ][payload_index ]) {
863
869
/* bn = 1 Rx PDU not received */
864
870
skipped = (bis_idx_new - bis_idx ) *
865
871
((lll -> bn * lll -> irc ) +
@@ -1165,14 +1171,16 @@ static void isr_rx_done(void *param)
1165
1171
/* Catchup with ISO event latencies */
1166
1172
latency_event = lll -> latency_event ;
1167
1173
do {
1168
- lll -> stream_curr = 0U ;
1174
+ uint8_t stream_curr ;
1175
+
1176
+ stream_curr = 0U ;
1169
1177
for (bis_idx = 0U ; bis_idx < lll -> num_bis ; bis_idx ++ ) {
1170
1178
struct lll_sync_iso_stream * stream ;
1171
- uint8_t payload_tail ;
1172
- uint8_t stream_curr ;
1179
+ uint8_t stream_curr_inc ;
1173
1180
uint16_t stream_handle ;
1181
+ uint8_t payload_tail ;
1174
1182
1175
- stream_handle = lll -> stream_handle [lll -> stream_curr ];
1183
+ stream_handle = lll -> stream_handle [stream_curr ];
1176
1184
stream = ull_sync_iso_lll_stream_get (stream_handle );
1177
1185
/* Skip BIS indices not synchronized. bis_index is 0x01 to 0x1F,
1178
1186
* where as bis_idx is 0 indexed.
@@ -1184,9 +1192,9 @@ static void isr_rx_done(void *param)
1184
1192
payload_tail = lll -> payload_tail ;
1185
1193
bn = lll -> bn ;
1186
1194
while (bn -- ) {
1187
- if (lll -> payload [bis_idx ][payload_tail ]) {
1188
- node_rx = lll -> payload [bis_idx ][payload_tail ];
1189
- lll -> payload [bis_idx ][payload_tail ] = NULL ;
1195
+ if (lll -> payload [stream_curr ][payload_tail ]) {
1196
+ node_rx = lll -> payload [stream_curr ][payload_tail ];
1197
+ lll -> payload [stream_curr ][payload_tail ] = NULL ;
1190
1198
1191
1199
iso_rx_put (node_rx -> hdr .link , node_rx );
1192
1200
} else {
@@ -1221,9 +1229,9 @@ static void isr_rx_done(void *param)
1221
1229
payload_tail = payload_index ;
1222
1230
}
1223
1231
1224
- stream_curr = lll -> stream_curr + 1U ;
1225
- if (stream_curr < lll -> stream_count ) {
1226
- lll -> stream_curr = stream_curr ;
1232
+ stream_curr_inc = stream_curr + 1U ;
1233
+ if (stream_curr_inc < lll -> stream_count ) {
1234
+ stream_curr = stream_curr_inc ;
1227
1235
}
1228
1236
}
1229
1237
lll -> payload_tail = payload_index ;
0 commit comments