Bluetooth: Controller: Add common ULL ticker stop with mark function
The same code block for marking an object with ull_disable_mark, stopping the ticker and then unmarking the object appeared multiple places; often with a regression bug where instead of unmarking it in case of error, it would be "remarked". This commit fixes the bug, and moves the functionality to a common function. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
071db25f66
commit
6b72bed967
7 changed files with 74 additions and 102 deletions
|
@ -1675,30 +1675,16 @@ static void ticker_op_stop_cb(uint32_t status, void *param)
|
|||
|
||||
static inline void disable(uint16_t handle)
|
||||
{
|
||||
uint32_t volatile ret_cb;
|
||||
struct ll_conn *conn;
|
||||
void *mark;
|
||||
uint32_t ret;
|
||||
int err;
|
||||
|
||||
conn = ll_conn_get(handle);
|
||||
|
||||
mark = ull_disable_mark(conn);
|
||||
LL_ASSERT(mark == conn);
|
||||
|
||||
ret_cb = TICKER_STATUS_BUSY;
|
||||
ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_THREAD,
|
||||
TICKER_ID_CONN_BASE + handle,
|
||||
ull_ticker_status_give, (void *)&ret_cb);
|
||||
ret = ull_ticker_status_take(ret, &ret_cb);
|
||||
if (!ret) {
|
||||
ret = ull_disable(&conn->lll);
|
||||
LL_ASSERT(!ret);
|
||||
}
|
||||
err = ull_ticker_stop_with_mark(TICKER_ID_CONN_BASE + handle,
|
||||
conn, &conn->lll);
|
||||
LL_ASSERT(err == 0 || err == -EALREADY);
|
||||
|
||||
conn->lll.link_tx_free = NULL;
|
||||
|
||||
mark = ull_disable_unmark(conn);
|
||||
LL_ASSERT(mark == conn);
|
||||
}
|
||||
|
||||
static void conn_cleanup(struct ll_conn *conn, uint8_t reason)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue