Skip to content

Commit b6ce1a6

Browse files
cvinayakkartben
authored andcommitted
Bluetooth: Controller: Single timer use ISO Central nRF54L support
Update ISO Central for single timer use support required for nRF54L Series SoCs. As the timer is reset on every radio end, use the radio_tmr_hcto_configure_abs() function to set the header complete timeout correctly when using single timer for s/w switching. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 980cc21 commit b6ce1a6

File tree

1 file changed

+40
-18
lines changed

1 file changed

+40
-18
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,8 @@ static void isr_tx(void *param)
546546
if (se_curr < cis_lll->nse) {
547547
const struct lll_conn *evt_conn_lll;
548548
uint16_t data_chan_id;
549+
550+
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
549551
uint32_t subevent_us;
550552
uint32_t start_us;
551553

@@ -555,6 +557,7 @@ static void isr_tx(void *param)
555557

556558
start_us = radio_tmr_start_us(1U, subevent_us);
557559
LL_ASSERT(start_us == (subevent_us + 1U));
560+
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
558561

559562
/* Get reference to ACL context */
560563
evt_conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
@@ -574,9 +577,7 @@ static void isr_tx(void *param)
574577
uint64_t payload_count;
575578
uint16_t event_counter;
576579
uint16_t data_chan_id;
577-
uint32_t subevent_us;
578580
uint16_t cis_handle;
579-
uint32_t start_us;
580581
memq_link_t *link;
581582

582583
/* Calculate channel for next CIS */
@@ -590,12 +591,23 @@ static void isr_tx(void *param)
590591
return;
591592
}
592593

593-
/* Get reference to ACL context */
594-
next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle);
594+
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
595+
uint32_t subevent_us;
596+
uint32_t start_us;
597+
598+
subevent_us = radio_tmr_ready_restore();
599+
subevent_us += next_cis_lll->offset - cis_offset_first;
600+
601+
start_us = radio_tmr_start_us(1U, subevent_us);
602+
LL_ASSERT(start_us == (subevent_us + 1U));
603+
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
595604

596605
/* Event counter value, 0-15 bit of cisEventCounter */
597606
event_counter = next_cis_lll->event_count;
598607

608+
/* Get reference to ACL context */
609+
next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle);
610+
599611
/* Calculate the radio channel to use for ISO event */
600612
data_chan_id = lll_chan_id(next_cis_lll->access_addr);
601613
next_cis_chan = lll_chan_iso_event(event_counter, data_chan_id,
@@ -604,12 +616,6 @@ static void isr_tx(void *param)
604616
&next_cis_chan_prn_s,
605617
&next_cis_chan_remap_idx);
606618

607-
subevent_us = radio_tmr_ready_restore();
608-
subevent_us += next_cis_lll->offset - cis_offset_first;
609-
610-
start_us = radio_tmr_start_us(1U, subevent_us);
611-
LL_ASSERT(start_us == (subevent_us + 1U));
612-
613619
cis_lll = next_cis_lll;
614620

615621
/* Tx Ack stale ISO Data */
@@ -838,9 +844,18 @@ static void isr_rx(void *param)
838844
uint64_t payload_count;
839845
uint16_t event_counter;
840846
uint16_t data_chan_id;
847+
memq_link_t *link;
848+
849+
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
841850
uint32_t subevent_us;
842851
uint32_t start_us;
843-
memq_link_t *link;
852+
853+
subevent_us = radio_tmr_ready_restore();
854+
subevent_us += next_cis_lll->offset - cis_offset_first;
855+
856+
start_us = radio_tmr_start_us(1U, subevent_us);
857+
LL_ASSERT(start_us == (subevent_us + 1U));
858+
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
844859

845860
/* Event counter value, 0-15 bit of cisEventCounter */
846861
event_counter = next_cis_lll->event_count;
@@ -853,12 +868,6 @@ static void isr_rx(void *param)
853868
&next_cis_chan_prn_s,
854869
&next_cis_chan_remap_idx);
855870

856-
subevent_us = radio_tmr_ready_restore();
857-
subevent_us += next_cis_lll->offset - cis_offset_first;
858-
859-
start_us = radio_tmr_start_us(1U, subevent_us);
860-
LL_ASSERT(start_us == (subevent_us + 1U));
861-
862871
old_cis_lll = cis_lll;
863872
cis_lll = next_cis_lll;
864873

@@ -935,7 +944,6 @@ static void isr_prepare_subevent(void *param)
935944
struct pdu_cis *pdu_tx;
936945
uint64_t payload_count;
937946
uint8_t payload_index;
938-
uint32_t subevent_us;
939947
uint32_t start_us;
940948

941949
/* Get reference to CIS LLL context */
@@ -1052,12 +1060,26 @@ static void isr_prepare_subevent(void *param)
10521060
radio_switch_complete_and_rx(0U);
10531061
#endif /* !CONFIG_BT_CTLR_PHY */
10541062

1063+
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || \
1064+
defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
1065+
uint32_t subevent_us;
1066+
10551067
subevent_us = radio_tmr_ready_restore();
10561068
subevent_us += cis_lll->offset - cis_offset_first +
10571069
(cis_lll->sub_interval * se_curr);
10581070

1071+
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
1072+
start_us = radio_tmr_start_us(1U, subevent_us);
1073+
LL_ASSERT(start_us == (subevent_us + 1U));
1074+
1075+
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
10591076
/* Compensate for the 1 us added by radio_tmr_start_us() */
10601077
start_us = subevent_us + 1U;
1078+
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
1079+
1080+
#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN ||
1081+
* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER
1082+
*/
10611083

10621084
/* capture end of Tx-ed PDU, used to calculate HCTO. */
10631085
radio_tmr_end_capture();

0 commit comments

Comments
 (0)