bluetooth: controller: Perform synchronized LLL reset via mayfly
Use semaphore to synchronize lll_reset completion with HCI thread for returning (command complete) only when all is done. Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
parent
ed61065f2c
commit
087706498e
1 changed files with 9 additions and 1 deletions
|
@ -406,14 +406,20 @@ void ll_reset(void)
|
|||
/* Reset LLL via mayfly */
|
||||
{
|
||||
u32_t retval;
|
||||
struct k_sem sem;
|
||||
static memq_link_t link;
|
||||
static struct mayfly mfy = {0, 0, &link, NULL,
|
||||
perform_lll_reset};
|
||||
|
||||
mfy.param = NULL;
|
||||
k_sem_init(&sem, 0, 1);
|
||||
mfy.param = &sem;
|
||||
retval = mayfly_enqueue(TICKER_USER_ID_THREAD,
|
||||
TICKER_USER_ID_LLL, 0, &mfy);
|
||||
LL_ASSERT(!retval);
|
||||
/* LLL reset must complete before returning - wait for
|
||||
* reset completion in LLL mayfly thread
|
||||
*/
|
||||
k_sem_take(&sem, K_FOREVER);
|
||||
}
|
||||
|
||||
/* Common to init and reset */
|
||||
|
@ -1202,6 +1208,8 @@ static void perform_lll_reset(void *param)
|
|||
err = lll_conn_reset();
|
||||
LL_ASSERT(!err);
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
||||
k_sem_give(param);
|
||||
}
|
||||
|
||||
static inline void *mark_set(void **m, void *param)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue