Bluetooth: Controller: Fix missing Broadcast ISO HCI reset

Fix missing Broadcast ISO implementation for HCI reset.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2024-02-27 12:57:38 +01:00 committed by Carles Cufí
parent ddce23b447
commit a1e8af0936
3 changed files with 88 additions and 15 deletions

View file

@ -764,6 +764,12 @@ void ll_reset(void)
*/
#if defined(CONFIG_BT_BROADCASTER)
#if defined(CONFIG_BT_CTLR_ADV_ISO)
/* Reset adv iso sets */
err = ull_adv_iso_reset();
LL_ASSERT(!err);
#endif /* CONFIG_BT_CTLR_ADV_ISO */
/* Reset adv state */
err = ull_adv_reset();
LL_ASSERT(!err);
@ -772,7 +778,7 @@ void ll_reset(void)
#if defined(CONFIG_BT_OBSERVER)
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
/* Reset periodic sync sets */
/* Reset sync iso sets */
err = ull_sync_iso_reset();
LL_ASSERT(!err);
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
@ -787,16 +793,6 @@ void ll_reset(void)
LL_ASSERT(!err);
#endif /* CONFIG_BT_OBSERVER */
#if defined(CONFIG_BT_CTLR_CONN_ISO)
err = ull_conn_iso_reset();
LL_ASSERT(!err);
#endif /* CONFIG_BT_CTLR_CONN_ISO */
#if defined(CONFIG_BT_CTLR_ISO)
err = ull_iso_reset();
LL_ASSERT(!err);
#endif /* CONFIG_BT_CTLR_ISO */
#if defined(CONFIG_BT_CTLR_PERIPHERAL_ISO)
err = ull_peripheral_iso_reset();
LL_ASSERT(!err);
@ -807,11 +803,15 @@ void ll_reset(void)
LL_ASSERT(!err);
#endif /* CONFIG_BT_CTLR_CENTRAL_ISO */
#if defined(CONFIG_BT_CTLR_ADV_ISO)
/* Reset periodic sync sets */
err = ull_adv_iso_reset();
#if defined(CONFIG_BT_CTLR_CONN_ISO)
err = ull_conn_iso_reset();
LL_ASSERT(!err);
#endif /* CONFIG_BT_CTLR_ADV_ISO */
#endif /* CONFIG_BT_CTLR_CONN_ISO */
#if defined(CONFIG_BT_CTLR_ISO)
err = ull_iso_reset();
LL_ASSERT(!err);
#endif /* CONFIG_BT_CTLR_ISO */
#if defined(CONFIG_BT_CONN)
/* Reset conn role */

View file

@ -1344,11 +1344,18 @@ uint8_t ll_adv_aux_set_remove(uint8_t handle)
if (lll->sync) {
struct ll_adv_sync_set *sync;
#if defined(CONFIG_BT_CTLR_ADV_ISO)
if (lll->sync->iso) {
return BT_HCI_ERR_CMD_DISALLOWED;
}
#endif /* CONFIG_BT_CTLR_ADV_ISO */
sync = HDR_LLL2ULL(lll->sync);
if (sync->is_enabled) {
return BT_HCI_ERR_CMD_DISALLOWED;
}
lll->sync = NULL;
ull_adv_sync_release(sync);

View file

@ -769,8 +769,74 @@ int ull_adv_iso_init(void)
int ull_adv_iso_reset(void)
{
uint8_t handle;
int err;
handle = CONFIG_BT_CTLR_ADV_ISO_SET;
while (handle--) {
struct lll_adv_sync *adv_sync_lll;
struct lll_adv_iso *adv_iso_lll;
struct ll_adv_iso_set *adv_iso;
volatile uint32_t ret_cb;
struct lll_adv *adv_lll;
uint32_t ret;
void *mark;
adv_iso = &ll_adv_iso[handle];
adv_iso_lll = &adv_iso->lll;
adv_lll = adv_iso_lll->adv;
if (!adv_lll) {
continue;
}
mark = ull_disable_mark(adv_iso);
LL_ASSERT(mark == adv_iso);
/* Stop event scheduling */
ret_cb = TICKER_STATUS_BUSY;
ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_THREAD,
TICKER_ID_ADV_ISO_BASE + adv_iso_lll->handle,
ull_ticker_status_give, (void *)&ret_cb);
ret = ull_ticker_status_take(ret, &ret_cb);
if (ret) {
mark = ull_disable_unmark(adv_iso);
LL_ASSERT(mark == adv_iso);
/* Assert as there shall be a ticker instance active */
LL_ASSERT(false);
return BT_HCI_ERR_CMD_DISALLOWED;
}
/* Abort any events in LLL pipeline */
err = ull_disable(adv_iso_lll);
LL_ASSERT(!err || (err == -EALREADY));
mark = ull_disable_unmark(adv_iso);
LL_ASSERT(mark == adv_iso);
/* Reset associated streams */
while (adv_iso_lll->num_bis--) {
struct lll_adv_iso_stream *stream;
uint16_t stream_handle;
stream_handle = adv_iso_lll->stream_handle[adv_iso_lll->num_bis];
stream = ull_adv_iso_stream_get(stream_handle);
if (stream) {
stream->link_tx_free = NULL;
}
}
/* Remove Periodic Advertising association */
adv_sync_lll = adv_lll->sync;
if (adv_sync_lll) {
adv_sync_lll->iso = NULL;
}
/* Remove Extended Advertising association */
adv_iso_lll->adv = NULL;
}
err = init_reset();
if (err) {
return err;