Skip to content

Commit 34b95fe

Browse files
wopu-otaescolar
authored andcommitted
Bluetooth: controller: split: Call LLL reset functions from ll_reset
Call LLL reset functions when calling ll_reset to avoid carrying LLL state across HCI resets. Respective functions already exist in LLL but had not been called from anywhere. Signed-off-by: Wolfgang Puffitsch <[email protected]>
1 parent ccfccae commit 34b95fe

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

subsys/bluetooth/controller/ll_sw/lll.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ static inline int lll_is_stop(void *lll)
292292
}
293293

294294
int lll_init(void);
295+
int lll_reset(void);
295296
int lll_prepare(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb,
296297
lll_prepare_cb_t prepare_cb, int prio,
297298
struct lll_prepare_param *prepare_param);

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ static void *mark_update;
223223
static void *mark_disable;
224224

225225
static inline int init_reset(void);
226+
static void perform_lll_reset(void *param);
226227
static inline void *mark_set(void **m, void *param);
227228
static inline void *mark_unset(void **m, void *param);
228229
static inline void *mark_get(void *m);
@@ -402,6 +403,19 @@ void ll_reset(void)
402403
MFIFO_INIT(ll_pdu_rx_free);
403404
#endif /* CONFIG_BT_CONN */
404405

406+
/* Reset LLL via mayfly */
407+
{
408+
u32_t retval;
409+
static memq_link_t link;
410+
static struct mayfly mfy = {0, 0, &link, NULL,
411+
perform_lll_reset};
412+
413+
mfy.param = NULL;
414+
retval = mayfly_enqueue(TICKER_USER_ID_THREAD,
415+
TICKER_USER_ID_LLL, 0, &mfy);
416+
LL_ASSERT(!retval);
417+
}
418+
405419
/* Common to init and reset */
406420
err = init_reset();
407421
LL_ASSERT(!err);
@@ -1163,6 +1177,33 @@ static inline int init_reset(void)
11631177
return 0;
11641178
}
11651179

1180+
static void perform_lll_reset(void *param)
1181+
{
1182+
int err;
1183+
1184+
/* Reset LLL */
1185+
err = lll_reset();
1186+
LL_ASSERT(!err);
1187+
1188+
#if defined(CONFIG_BT_BROADCASTER)
1189+
/* Reset adv state */
1190+
err = lll_adv_reset();
1191+
LL_ASSERT(!err);
1192+
#endif /* CONFIG_BT_BROADCASTER */
1193+
1194+
#if defined(CONFIG_BT_OBSERVER)
1195+
/* Reset scan state */
1196+
err = lll_scan_reset();
1197+
LL_ASSERT(!err);
1198+
#endif /* CONFIG_BT_OBSERVER */
1199+
1200+
#if defined(CONFIG_BT_CONN)
1201+
/* Reset conn role */
1202+
err = lll_conn_reset();
1203+
LL_ASSERT(!err);
1204+
#endif /* CONFIG_BT_CONN */
1205+
}
1206+
11661207
static inline void *mark_set(void **m, void *param)
11671208
{
11681209
if (!*m) {

0 commit comments

Comments
 (0)