File tree Expand file tree Collapse file tree 2 files changed +42
-4
lines changed
subsys/bluetooth/controller/ll_sw/nordic/lll Expand file tree Collapse file tree 2 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ static int prepare_cb(struct lll_prepare_param *p)
155
155
uint16_t lazy ;
156
156
uint32_t ret ;
157
157
uint8_t phy ;
158
+ int err = 0 ;
158
159
159
160
DEBUG_RADIO_START_M (1 );
160
161
@@ -385,10 +386,11 @@ static int prepare_cb(struct lll_prepare_param *p)
385
386
if (overhead ) {
386
387
LL_ASSERT_MSG (false, "%s: Actual EVENT_OVERHEAD_START_US = %u" ,
387
388
__func__ , HAL_TICKER_TICKS_TO_US (overhead ));
388
- radio_isr_set (lll_isr_abort , cig_lll );
389
+
390
+ radio_isr_set (isr_done , cis_lll );
389
391
radio_disable ();
390
392
391
- return - ECANCELED ;
393
+ err = - ECANCELED ;
392
394
}
393
395
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
394
396
@@ -409,10 +411,30 @@ static int prepare_cb(struct lll_prepare_param *p)
409
411
/* sn and nesn are 1-bit, only Least Significant bit is needed */
410
412
cis_lll -> sn += cis_lll -> tx .bn * cis_lazy ;
411
413
cis_lll -> nesn += cis_lll -> rx .bn * cis_lazy ;
414
+
415
+ /* Adjust sn and nesn for canceled events */
416
+ if (err ) {
417
+ /* Adjust sn when flushing Tx */
418
+ /* FIXME: When Flush Timeout is implemented */
419
+ if (cis_lll -> tx .bn_curr <= cis_lll -> tx .bn ) {
420
+ lll_flush_tx (cis_lll );
421
+ }
422
+
423
+ /* Adjust nesn when flushing Rx */
424
+ /* FIXME: When Flush Timeout is implemented */
425
+ if (cis_lll -> rx .bn_curr <= cis_lll -> rx .bn ) {
426
+ lll_flush_rx (cis_lll );
427
+ }
428
+ }
412
429
}
413
430
}
414
431
} while (cis_lll );
415
432
433
+ /* Return if prepare callback cancelled */
434
+ if (err ) {
435
+ return err ;
436
+ }
437
+
416
438
/* Prepare is done */
417
439
ret = lll_prepare_done (cig_lll );
418
440
LL_ASSERT (!ret );
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ static int prepare_cb(struct lll_prepare_param *p)
173
173
uint16_t lazy ;
174
174
uint32_t ret ;
175
175
uint8_t phy ;
176
+ int err = 0 ;
176
177
177
178
DEBUG_RADIO_START_S (1 );
178
179
@@ -360,10 +361,11 @@ static int prepare_cb(struct lll_prepare_param *p)
360
361
if (overhead ) {
361
362
LL_ASSERT_MSG (false, "%s: Actual EVENT_OVERHEAD_START_US = %u" ,
362
363
__func__ , HAL_TICKER_TICKS_TO_US (overhead ));
363
- radio_isr_set (lll_isr_abort , cig_lll );
364
+
365
+ radio_isr_set (isr_done , cis_lll );
364
366
radio_disable ();
365
367
366
- return - ECANCELED ;
368
+ err = - ECANCELED ;
367
369
}
368
370
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
369
371
@@ -399,9 +401,23 @@ static int prepare_cb(struct lll_prepare_param *p)
399
401
/* sn and nesn are 1-bit, only Least Significant bit is needed */
400
402
cis_lll -> sn += cis_lll -> tx .bn * lazy ;
401
403
cis_lll -> nesn += cis_lll -> rx .bn * lazy ;
404
+
405
+ /* Adjust sn and nesn for canceled events */
406
+ if (err ) {
407
+ /* Adjust nesn when flushing Rx */
408
+ /* FIXME: When Flush Timeout is implemented */
409
+ if (cis_lll -> rx .bn_curr <= cis_lll -> rx .bn ) {
410
+ lll_flush_rx (cis_lll );
411
+ }
412
+ }
402
413
}
403
414
};
404
415
416
+ /* Return if prepare callback cancelled */
417
+ if (err ) {
418
+ return err ;
419
+ }
420
+
405
421
/* Prepare is done */
406
422
ret = lll_prepare_done (cig_lll );
407
423
LL_ASSERT (!ret );
You can’t perform that action at this time.
0 commit comments