Skip to content

Commit

Permalink
Bluetooth: Controller: Single timer use ISO Central nRF54L support
Browse files Browse the repository at this point in the history
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 <vich@nordicsemi.no>
  • Loading branch information
cvinayak authored and kartben committed Jan 18, 2025
1 parent 980cc21 commit b6ce1a6
Showing 1 changed file with 40 additions and 18 deletions.
58 changes: 40 additions & 18 deletions subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ static void isr_tx(void *param)
if (se_curr < cis_lll->nse) {
const struct lll_conn *evt_conn_lll;
uint16_t data_chan_id;

#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
uint32_t subevent_us;
uint32_t start_us;

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

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

/* Get reference to ACL context */
evt_conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
Expand All @@ -574,9 +577,7 @@ static void isr_tx(void *param)
uint64_t payload_count;
uint16_t event_counter;
uint16_t data_chan_id;
uint32_t subevent_us;
uint16_t cis_handle;
uint32_t start_us;
memq_link_t *link;

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

/* Get reference to ACL context */
next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle);
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
uint32_t subevent_us;
uint32_t start_us;

subevent_us = radio_tmr_ready_restore();
subevent_us += next_cis_lll->offset - cis_offset_first;

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

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

/* Get reference to ACL context */
next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle);

/* Calculate the radio channel to use for ISO event */
data_chan_id = lll_chan_id(next_cis_lll->access_addr);
next_cis_chan = lll_chan_iso_event(event_counter, data_chan_id,
Expand All @@ -604,12 +616,6 @@ static void isr_tx(void *param)
&next_cis_chan_prn_s,
&next_cis_chan_remap_idx);

subevent_us = radio_tmr_ready_restore();
subevent_us += next_cis_lll->offset - cis_offset_first;

start_us = radio_tmr_start_us(1U, subevent_us);
LL_ASSERT(start_us == (subevent_us + 1U));

cis_lll = next_cis_lll;

/* Tx Ack stale ISO Data */
Expand Down Expand Up @@ -838,9 +844,18 @@ static void isr_rx(void *param)
uint64_t payload_count;
uint16_t event_counter;
uint16_t data_chan_id;
memq_link_t *link;

#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
uint32_t subevent_us;
uint32_t start_us;
memq_link_t *link;

subevent_us = radio_tmr_ready_restore();
subevent_us += next_cis_lll->offset - cis_offset_first;

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

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

subevent_us = radio_tmr_ready_restore();
subevent_us += next_cis_lll->offset - cis_offset_first;

start_us = radio_tmr_start_us(1U, subevent_us);
LL_ASSERT(start_us == (subevent_us + 1U));

old_cis_lll = cis_lll;
cis_lll = next_cis_lll;

Expand Down Expand Up @@ -935,7 +944,6 @@ static void isr_prepare_subevent(void *param)
struct pdu_cis *pdu_tx;
uint64_t payload_count;
uint8_t payload_index;
uint32_t subevent_us;
uint32_t start_us;

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

#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || \
defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
uint32_t subevent_us;

subevent_us = radio_tmr_ready_restore();
subevent_us += cis_lll->offset - cis_offset_first +
(cis_lll->sub_interval * se_curr);

#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
start_us = radio_tmr_start_us(1U, subevent_us);
LL_ASSERT(start_us == (subevent_us + 1U));

#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
/* Compensate for the 1 us added by radio_tmr_start_us() */
start_us = subevent_us + 1U;
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */

#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN ||
* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER
*/

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

0 comments on commit b6ce1a6

Please sign in to comment.