@@ -67,6 +67,7 @@ static void ticker_stop_op_cb(uint32_t status, void *param);
6767static void sync_iso_disable (void * param );
6868static void disabled_cb (void * param );
6969static void lll_flush (void * param );
70+ static void stop_ticker (struct ll_sync_iso_set * sync_iso , ticker_op_func fp_op_func );
7071
7172static memq_link_t link_lll_prepare ;
7273static struct mayfly mfy_lll_prepare = {0U , 0U , & link_lll_prepare , NULL , NULL };
@@ -741,18 +742,10 @@ void ull_sync_iso_done(struct node_rx_event_done *done)
741742
742743 /* Check for establishmet failure */
743744 if (done -> extra .estab_failed ) {
744- uint8_t handle ;
745- uint32_t ret ;
746-
747745 /* Stop Sync ISO Ticker directly. Establishment failure has been
748746 * notified.
749747 */
750- handle = sync_iso_handle_get (sync_iso );
751- ret = ticker_stop (TICKER_INSTANCE_ID_CTLR , TICKER_USER_ID_ULL_HIGH ,
752- (TICKER_ID_SCAN_SYNC_ISO_BASE +
753- sync_iso_handle_to_index (handle )), NULL , NULL );
754- LL_ASSERT ((ret == TICKER_STATUS_SUCCESS ) ||
755- (ret == TICKER_STATUS_BUSY ));
748+ stop_ticker (sync_iso , NULL );
756749 return ;
757750 }
758751
@@ -835,8 +828,6 @@ void ull_sync_iso_done_terminate(struct node_rx_event_done *done)
835828 struct ll_sync_iso_set * sync_iso ;
836829 struct lll_sync_iso * lll ;
837830 struct node_rx_pdu * rx ;
838- uint8_t handle ;
839- uint32_t ret ;
840831
841832 /* Get reference to ULL context */
842833 sync_iso = CONTAINER_OF (done -> param , struct ll_sync_iso_set , ull );
@@ -850,13 +841,7 @@ void ull_sync_iso_done_terminate(struct node_rx_event_done *done)
850841 * ((uint8_t * )rx -> pdu ) = lll -> term_reason ;
851842
852843 /* Stop Sync ISO Ticker */
853- handle = sync_iso_handle_get (sync_iso );
854- ret = ticker_stop (TICKER_INSTANCE_ID_CTLR , TICKER_USER_ID_ULL_HIGH ,
855- (TICKER_ID_SCAN_SYNC_ISO_BASE +
856- sync_iso_handle_to_index (handle )),
857- ticker_stop_op_cb , (void * )sync_iso );
858- LL_ASSERT ((ret == TICKER_STATUS_SUCCESS ) ||
859- (ret == TICKER_STATUS_BUSY ));
844+ stop_ticker (sync_iso , ticker_stop_op_cb );
860845}
861846
862847static void disable (uint8_t sync_idx )
@@ -866,6 +851,11 @@ static void disable(uint8_t sync_idx)
866851
867852 sync_iso = & ll_sync_iso [sync_idx ];
868853
854+ /* Stop any active resume ticker */
855+ (void )ticker_stop (TICKER_INSTANCE_ID_CTLR , TICKER_USER_ID_ULL_HIGH ,
856+ TICKER_ID_SCAN_SYNC_ISO_RESUME_BASE + sync_idx ,
857+ NULL , NULL );
858+
869859 err = ull_ticker_stop_with_mark (TICKER_ID_SCAN_SYNC_ISO_BASE +
870860 sync_idx , sync_iso , & sync_iso -> lll );
871861 LL_ASSERT_INFO2 (err == 0 || err == - EALREADY , sync_idx , err );
@@ -935,8 +925,6 @@ static uint16_t sync_iso_stream_handle_get(struct lll_sync_iso_stream *stream)
935925static void timeout_cleanup (struct ll_sync_iso_set * sync_iso )
936926{
937927 struct node_rx_pdu * rx ;
938- uint8_t handle ;
939- uint32_t ret ;
940928
941929 /* Populate the Sync Lost which will be enqueued in disabled_cb */
942930 rx = (void * )& sync_iso -> node_rx_lost ;
@@ -952,13 +940,7 @@ static void timeout_cleanup(struct ll_sync_iso_set *sync_iso)
952940 }
953941
954942 /* Stop Sync ISO Ticker */
955- handle = sync_iso_handle_get (sync_iso );
956- ret = ticker_stop (TICKER_INSTANCE_ID_CTLR , TICKER_USER_ID_ULL_HIGH ,
957- (TICKER_ID_SCAN_SYNC_ISO_BASE +
958- sync_iso_handle_to_index (handle )),
959- ticker_stop_op_cb , (void * )sync_iso );
960- LL_ASSERT ((ret == TICKER_STATUS_SUCCESS ) ||
961- (ret == TICKER_STATUS_BUSY ));
943+ stop_ticker (sync_iso , ticker_stop_op_cb );
962944}
963945
964946static void ticker_cb (uint32_t ticks_at_expire , uint32_t ticks_drift ,
@@ -1107,3 +1089,24 @@ static void disabled_cb(void *param)
11071089 TICKER_USER_ID_LLL , 0U , & mfy );
11081090 LL_ASSERT (!ret );
11091091}
1092+
1093+ static void stop_ticker (struct ll_sync_iso_set * sync_iso , ticker_op_func fp_op_func )
1094+ {
1095+
1096+ uint8_t handle ;
1097+ uint32_t ret ;
1098+
1099+ handle = sync_iso_handle_get (sync_iso );
1100+
1101+ (void )ticker_stop (TICKER_INSTANCE_ID_CTLR , TICKER_USER_ID_ULL_HIGH ,
1102+ TICKER_ID_SCAN_SYNC_ISO_RESUME_BASE +
1103+ sync_iso_handle_to_index (handle ), NULL , NULL );
1104+
1105+ ret = ticker_stop (TICKER_INSTANCE_ID_CTLR , TICKER_USER_ID_ULL_HIGH ,
1106+ TICKER_ID_SCAN_SYNC_ISO_BASE +
1107+ sync_iso_handle_to_index (handle ),
1108+ fp_op_func , fp_op_func ? (void * )sync_iso : NULL );
1109+
1110+ LL_ASSERT ((ret == TICKER_STATUS_SUCCESS ) ||
1111+ (ret == TICKER_STATUS_BUSY ));
1112+ }
0 commit comments