Bluetooth: Controller: Fix PA setup for ISO Broadcast

Fix missing PA setup for ISO Broadcast subevent transmits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2024-06-17 12:26:08 +02:00 committed by Carles Cufí
commit d5da582e00
2 changed files with 45 additions and 8 deletions

View file

@ -88,6 +88,10 @@ struct lll_adv_iso {
#endif /* CONFIG_BT_TICKER_EXT_EXPIRE_INFO */ #endif /* CONFIG_BT_TICKER_EXT_EXPIRE_INFO */
uint16_t stream_handle[BT_CTLR_ADV_ISO_STREAM_MAX]; uint16_t stream_handle[BT_CTLR_ADV_ISO_STREAM_MAX];
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
uint16_t pa_iss_us;
#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */
}; };
struct lll_adv_sync { struct lll_adv_sync {

View file

@ -408,7 +408,7 @@ static int prepare_cb_common(struct lll_prepare_param *p)
remainder = p->remainder; remainder = p->remainder;
start_us = radio_tmr_start(1U, ticks_at_start, remainder); start_us = radio_tmr_start(1U, ticks_at_start, remainder);
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR) || IS_ENABLED(HAL_RADIO_GPIO_HAVE_PA_PIN)) {
/* setup capture of PDU end timestamp */ /* setup capture of PDU end timestamp */
radio_tmr_end_capture(); radio_tmr_end_capture();
} }
@ -417,7 +417,8 @@ static int prepare_cb_common(struct lll_prepare_param *p)
radio_gpio_pa_setup(); radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(start_us + radio_gpio_pa_lna_enable(start_us +
radio_tx_ready_delay_get(phy, PHY_FLAGS_S8) - radio_tx_ready_delay_get(lll->phy,
lll->phy_flags) -
HAL_RADIO_GPIO_PA_OFFSET); HAL_RADIO_GPIO_PA_OFFSET);
#else /* !HAL_RADIO_GPIO_HAVE_PA_PIN */ #else /* !HAL_RADIO_GPIO_HAVE_PA_PIN */
ARG_UNUSED(start_us); ARG_UNUSED(start_us);
@ -471,6 +472,10 @@ static void isr_tx_common(void *param,
uint8_t crc_init[3]; uint8_t crc_init[3];
uint8_t bis; uint8_t bis;
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
uint16_t pa_iss_us = 0U;
#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) {
lll_prof_latency_capture(); lll_prof_latency_capture();
} }
@ -747,20 +752,48 @@ static void isr_tx_common(void *param,
lll->phy, lll->phy_flags); lll->phy, lll->phy_flags);
radio_isr_set(isr_tx, lll); radio_isr_set(isr_tx, lll);
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
/* local variable used later to store iss_us next subevent PA
* setup.
*/
pa_iss_us = iss_us;
#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */
} }
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { /* assert if radio packet ptr is not set and radio started tx */
/* setup capture of PDU end timestamp */
radio_tmr_end_capture();
}
/* assert if radio packet ptr is not set and radio started rx */
LL_ASSERT(!radio_is_ready()); LL_ASSERT(!radio_is_ready());
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) {
lll_prof_cputime_capture(); lll_prof_cputime_capture();
} }
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR) || IS_ENABLED(HAL_RADIO_GPIO_HAVE_PA_PIN)) {
/* setup capture of PDU end timestamp */
radio_tmr_end_capture();
}
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) {
/* PA/LNA enable is overwriting packet end used in ISR
* profiling, hence back it up for later use.
*/
lll_prof_radio_end_backup();
}
radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
lll->pa_iss_us -
(EVENT_CLOCK_JITTER_US << 1U) -
radio_tx_chain_delay_get(lll->phy,
lll->phy_flags) -
HAL_RADIO_GPIO_PA_OFFSET);
/* Remember to use it for the next subevent PA setup */
lll->pa_iss_us = pa_iss_us;
#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */
/* Calculate ahead the next subevent channel index */ /* Calculate ahead the next subevent channel index */
const uint16_t event_counter = (lll->payload_count / lll->bn) - 1U; const uint16_t event_counter = (lll->payload_count / lll->bn) - 1U;