Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport v3.5-branch] Bluetooth: Controller: Fix missing ext adv terminate event #64317

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@

static int init_reset(void);
static int prepare_cb(struct lll_prepare_param *p);
#if !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO)
static void isr_early_abort(void *param);
#endif /* !CONFIG_BT_TICKER_EXT_EXPIRE_INFO */
static void isr_done(void *param);
#if defined(CONFIG_BT_CTLR_ADV_AUX_PDU_BACK2BACK)
static void isr_tx_chain(void *param);
Expand Down Expand Up @@ -188,7 +191,7 @@ static int prepare_cb(struct lll_prepare_param *p)

/* Abort if no aux_ptr filled */
if (unlikely(!pri_hdr->aux_ptr || !PDU_ADV_AUX_PTR_OFFSET_GET(aux_ptr))) {
radio_isr_set(lll_isr_early_abort, lll);
radio_isr_set(isr_early_abort, lll);
radio_disable();

return 0;
Expand Down Expand Up @@ -325,7 +328,7 @@ static int prepare_cb(struct lll_prepare_param *p)
if (overhead) {
LL_ASSERT_OVERHEAD(overhead);

radio_isr_set(lll_isr_abort, lll);
radio_isr_set(isr_done, lll);
radio_disable();

return -ECANCELED;
Expand All @@ -347,6 +350,33 @@ static int prepare_cb(struct lll_prepare_param *p)
return 0;
}

#if !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO)
static void isr_race(void *param)
{
radio_status_reset();
}

static void isr_early_abort(void *param)
{
struct event_done_extra *extra;
int err;

/* Generate auxiliary radio event done */
extra = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_ADV_AUX);
LL_ASSERT(extra);

radio_isr_set(isr_race, param);
if (!radio_is_idle()) {
radio_disable();
}

err = lll_hfclock_off();
LL_ASSERT(err >= 0);

lll_done(NULL);
}
#endif /* !CONFIG_BT_TICKER_EXT_EXPIRE_INFO */

static void isr_done(void *param)
{
struct event_done_extra *extra;
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/controller/ll_sw/ull_scan_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
window_widening_us = SCA_DRIFT_500_PPM_US(aux_offset_us);
}

lll_aux->window_size_us += (EVENT_TICKER_RES_MARGIN_US +
((EVENT_JITTER_US + window_widening_us) << 1));
lll_aux->window_size_us += ((EVENT_TICKER_RES_MARGIN_US + EVENT_JITTER_US +
window_widening_us) << 1);

ready_delay_us = lll_radio_rx_ready_delay_get(lll_aux->phy,
PHY_FLAGS_S8);
Expand Down