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 <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2024-12-29 15:49:04 +01:00 committed by Benjamin Cabé
parent 980cc216a8
commit b6ce1a6ae0

View file

@ -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;
@ -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);
@ -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 */
@ -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,
@ -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 */
@ -838,9 +844,18 @@ isr_rx_next_subevent:
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;
@ -853,12 +868,6 @@ isr_rx_next_subevent:
&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;
@ -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 */
@ -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();