Bluetooth: controller: Remove use of lll_stop
Remove use of lll_stop and lll_is_stop and rely on "initiated" flag in lll_conn struct instead. Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
This commit is contained in:
parent
5ce5dc055e
commit
18f5fb99c1
@ -154,7 +154,6 @@ struct ull_hdr {
|
||||
|
||||
struct lll_hdr {
|
||||
void *parent;
|
||||
uint8_t is_stop:1;
|
||||
};
|
||||
|
||||
struct lll_prepare_param {
|
||||
@ -370,17 +369,6 @@ static inline void lll_hdr_init(void *lll, void *parent)
|
||||
struct lll_hdr *hdr = lll;
|
||||
|
||||
hdr->parent = parent;
|
||||
hdr->is_stop = 0U;
|
||||
}
|
||||
|
||||
static inline int lll_stop(void *lll)
|
||||
{
|
||||
struct lll_hdr *hdr = lll;
|
||||
int ret = !!hdr->is_stop;
|
||||
|
||||
hdr->is_stop = 1U;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lll_init(void);
|
||||
|
||||
@ -740,10 +740,11 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||
|
||||
lll = p->param;
|
||||
|
||||
#if defined(CONFIG_BT_PERIPHERAL)
|
||||
/* Check if stopped (on connection establishment race between LLL and
|
||||
* ULL.
|
||||
*/
|
||||
if (unlikely(lll_is_stop(lll))) {
|
||||
if (unlikely(lll->conn && lll->conn->initiated)) {
|
||||
int err;
|
||||
|
||||
err = lll_hfclock_off();
|
||||
@ -754,6 +755,7 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||
DEBUG_RADIO_CLOSE_A(0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_PERIPHERAL */
|
||||
|
||||
radio_reset();
|
||||
|
||||
@ -1335,7 +1337,6 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
||||
!lll->conn->initiated) {
|
||||
struct node_rx_ftr *ftr;
|
||||
struct node_rx_pdu *rx;
|
||||
int ret;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
|
||||
rx = ull_pdu_rx_alloc_peek(4);
|
||||
@ -1364,9 +1365,6 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
||||
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
||||
|
||||
/* Stop further LLL radio events */
|
||||
ret = lll_stop(lll);
|
||||
LL_ASSERT(!ret);
|
||||
|
||||
lll->conn->initiated = 1;
|
||||
|
||||
rx = ull_pdu_rx_alloc();
|
||||
|
||||
@ -659,7 +659,6 @@ static void isr_tx_connect_rsp(void *param)
|
||||
struct node_rx_pdu *rx;
|
||||
struct lll_adv *lll;
|
||||
bool is_done;
|
||||
int ret;
|
||||
|
||||
rx = param;
|
||||
ftr = &(rx->hdr.rx_ftr);
|
||||
@ -687,9 +686,6 @@ static void isr_tx_connect_rsp(void *param)
|
||||
|
||||
if (is_done) {
|
||||
/* Stop further LLL radio events */
|
||||
ret = lll_stop(lll);
|
||||
LL_ASSERT(!ret);
|
||||
|
||||
lll->conn->initiated = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -14,12 +14,6 @@ int lll_is_abort_cb(void *next, int prio, void *curr,
|
||||
lll_prepare_cb_t *resume_cb, int *resume_prio);
|
||||
void lll_abort_cb(struct lll_prepare_param *prepare_param, void *param);
|
||||
|
||||
static inline int lll_is_stop(void *lll)
|
||||
{
|
||||
struct lll_hdr *hdr = lll;
|
||||
|
||||
return !!hdr->is_stop;
|
||||
}
|
||||
uint32_t lll_evt_offset_get(struct evt_hdr *evt);
|
||||
uint32_t lll_preempt_calc(struct evt_hdr *evt, uint8_t ticker_id,
|
||||
uint32_t ticks_at_event);
|
||||
|
||||
@ -134,10 +134,11 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||
|
||||
lll = p->param;
|
||||
|
||||
#if defined(CONFIG_BT_CENTRAL)
|
||||
/* Check if stopped (on connection establishment race between LLL and
|
||||
* ULL.
|
||||
*/
|
||||
if (unlikely(lll_is_stop(lll))) {
|
||||
if (unlikely(lll->conn && lll->conn->initiated)) {
|
||||
int err;
|
||||
|
||||
err = lll_hfclock_off();
|
||||
@ -148,6 +149,7 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||
DEBUG_RADIO_CLOSE_O(0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_CENTRAL */
|
||||
|
||||
/* Initialize scanning state */
|
||||
lll->state = 0U;
|
||||
@ -355,6 +357,9 @@ static int is_abort_cb(void *next, int prio, void *curr,
|
||||
|
||||
static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
|
||||
{
|
||||
#if defined(CONFIG_BT_CENTRAL)
|
||||
struct lll_scan *lll = param;
|
||||
#endif /* CONFIG_BT_CENTRAL */
|
||||
int err;
|
||||
|
||||
/* NOTE: This is not a prepare being cancelled */
|
||||
@ -363,10 +368,14 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
|
||||
* After event has been cleanly aborted, clean up resources
|
||||
* and dispatch event done.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) && lll_is_stop(param)) {
|
||||
if (0) {
|
||||
#if defined(CONFIG_BT_CENTRAL)
|
||||
} else if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) &&
|
||||
lll->conn && lll->conn->initiated) {
|
||||
while (!radio_has_disabled()) {
|
||||
cpu_sleep();
|
||||
}
|
||||
#endif /* CONFIG_BT_CENTRAL */
|
||||
} else {
|
||||
radio_isr_set(isr_abort, param);
|
||||
radio_disable();
|
||||
@ -782,7 +791,6 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
bt_addr_t *lrpa;
|
||||
#endif /* CONFIG_BT_CTLR_PRIVACY */
|
||||
int ret;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
|
||||
rx = ull_pdu_rx_alloc_peek(4);
|
||||
@ -922,9 +930,6 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
|
||||
*/
|
||||
|
||||
/* Stop further LLL radio events */
|
||||
ret = lll_stop(lll);
|
||||
LL_ASSERT(!ret);
|
||||
|
||||
lll->conn->initiated = 1;
|
||||
|
||||
rx = ull_pdu_rx_alloc();
|
||||
|
||||
@ -326,10 +326,11 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
|
||||
|
||||
DEBUG_RADIO_START_A(1);
|
||||
|
||||
#if defined(CONFIG_BT_PERIPHERAL)
|
||||
/* Check if stopped (on connection establishment race between LLL and
|
||||
* ULL.
|
||||
*/
|
||||
if (lll_is_stop(lll)) {
|
||||
if (lll->conn && lll->conn->initiated) {
|
||||
int err;
|
||||
|
||||
err = lll_clk_off();
|
||||
@ -340,6 +341,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
|
||||
DEBUG_RADIO_START_A(0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_PERIPHERAL */
|
||||
|
||||
radio_reset();
|
||||
/* TODO: other Tx Power settings */
|
||||
@ -900,7 +902,6 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
||||
!lll->conn->initiated) {
|
||||
struct node_rx_ftr *ftr;
|
||||
struct node_rx_pdu *rx;
|
||||
int ret;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
|
||||
rx = ull_pdu_rx_alloc_peek(4);
|
||||
@ -928,9 +929,6 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
||||
/* Stop further LLL radio events */
|
||||
ret = lll_stop(lll);
|
||||
LL_ASSERT(!ret);
|
||||
|
||||
lll->conn->initiated = 1;
|
||||
|
||||
rx = ull_pdu_rx_alloc();
|
||||
|
||||
@ -14,13 +14,6 @@ int lll_is_abort_cb(void *next, int prio, void *curr,
|
||||
lll_prepare_cb_t *resume_cb, int *resume_prio);
|
||||
void lll_abort_cb(struct lll_prepare_param *prepare_param, void *param);
|
||||
|
||||
static inline int lll_is_stop(void *lll)
|
||||
{
|
||||
struct lll_hdr *hdr = lll;
|
||||
|
||||
return !!hdr->is_stop;
|
||||
}
|
||||
|
||||
int lll_clk_on(void);
|
||||
int lll_clk_on_wait(void);
|
||||
int lll_clk_off(void);
|
||||
|
||||
@ -128,10 +128,11 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
|
||||
|
||||
DEBUG_RADIO_START_O(1);
|
||||
|
||||
#if defined(CONFIG_BT_CENTRAL)
|
||||
/* Check if stopped (on connection establishment race between LLL and
|
||||
* ULL.
|
||||
*/
|
||||
if (lll_is_stop(lll)) {
|
||||
if (lll->conn && lll->conn->initiated) {
|
||||
int err;
|
||||
|
||||
err = lll_clk_off();
|
||||
@ -142,6 +143,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
|
||||
DEBUG_RADIO_START_O(0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_CENTRAL */
|
||||
|
||||
radio_reset();
|
||||
/* TODO: other Tx Power settings */
|
||||
@ -686,7 +688,6 @@ static inline uint32_t isr_rx_pdu(struct lll_scan *lll, uint8_t devmatch_ok,
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
bt_addr_t *lrpa;
|
||||
#endif /* CONFIG_BT_CTLR_PRIVACY */
|
||||
int ret;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
|
||||
rx = ull_pdu_rx_alloc_peek(4);
|
||||
@ -826,9 +827,6 @@ static inline uint32_t isr_rx_pdu(struct lll_scan *lll, uint8_t devmatch_ok,
|
||||
*/
|
||||
|
||||
/* Stop further LLL radio events */
|
||||
ret = lll_stop(lll);
|
||||
LL_ASSERT(!ret);
|
||||
|
||||
lll->conn->initiated = 1;
|
||||
|
||||
rx = ull_pdu_rx_alloc();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user