mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-29 20:17:22 +00:00
nimble/ll: only let ble_ll.c add/remove to ll_evq
- change all ble_npl_eventq_put(&g_ble_ll_data.ll_evq, ..) -> ble_ll_event_add(..) - change all ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, ..) -> ble_ll_event_remove(..) - rename ble_ll_event_send -> ble_ll_event_add (matches more with remove)
This commit is contained in:
committed by
Szymon Janc
parent
04ca1f9684
commit
1e63bdb310
@@ -559,8 +559,11 @@ void ble_ll_state_set(uint8_t ll_state);
|
||||
/* Get the link layer state */
|
||||
uint8_t ble_ll_state_get(void);
|
||||
|
||||
/* Send an event to LL task */
|
||||
void ble_ll_event_send(struct ble_npl_event *ev);
|
||||
/* Add an event to LL task */
|
||||
void ble_ll_event_add(struct ble_npl_event *ev);
|
||||
|
||||
/* Remove an event from LL task */
|
||||
void ble_ll_event_remove(struct ble_npl_event *ev);
|
||||
|
||||
/* Hand received pdu's to LL task */
|
||||
void ble_ll_rx_pdu_in(struct os_mbuf *rxpdu);
|
||||
|
||||
@@ -1042,7 +1042,7 @@ ble_ll_rx_pdu_in(struct os_mbuf *rxpdu)
|
||||
|
||||
pkthdr = OS_MBUF_PKTHDR(rxpdu);
|
||||
STAILQ_INSERT_TAIL(&g_ble_ll_data.ll_rx_pkt_q, pkthdr, omp_next);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_data.ll_rx_pkt_ev);
|
||||
ble_ll_event_add(&g_ble_ll_data.ll_rx_pkt_ev);
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL) || MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
@@ -1061,7 +1061,7 @@ ble_ll_acl_data_in(struct os_mbuf *txpkt)
|
||||
OS_ENTER_CRITICAL(sr);
|
||||
STAILQ_INSERT_TAIL(&g_ble_ll_data.ll_tx_pkt_q, pkthdr, omp_next);
|
||||
OS_EXIT_CRITICAL(sr);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_data.ll_tx_pkt_ev);
|
||||
ble_ll_event_add(&g_ble_ll_data.ll_tx_pkt_ev);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1074,7 +1074,7 @@ ble_ll_acl_data_in(struct os_mbuf *txpkt)
|
||||
void
|
||||
ble_ll_data_buffer_overflow(void)
|
||||
{
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_data.ll_dbuf_overflow_ev);
|
||||
ble_ll_event_add(&g_ble_ll_data.ll_dbuf_overflow_ev);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1442,16 +1442,29 @@ ble_ll_state_get(void)
|
||||
/**
|
||||
* ble ll event send
|
||||
*
|
||||
* Send an event to the Link Layer task
|
||||
* Add an event to the Link Layer task
|
||||
*
|
||||
* @param ev Event to add to the Link Layer event queue.
|
||||
*/
|
||||
void
|
||||
ble_ll_event_send(struct ble_npl_event *ev)
|
||||
ble_ll_event_add(struct ble_npl_event *ev)
|
||||
{
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* ble ll event remove
|
||||
*
|
||||
* Remove an event from the Link Layer task
|
||||
*
|
||||
* @param ev Event to remove from the Link Layer event queue.
|
||||
*/
|
||||
void
|
||||
ble_ll_event_remove(struct ble_npl_event *ev)
|
||||
{
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the features supported by the link layer
|
||||
*
|
||||
|
||||
@@ -1032,14 +1032,14 @@ ble_ll_adv_tx_done(void *arg)
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (ble_ll_adv_active_chanset_is_pri(advsm)) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_txdone_ev);
|
||||
} else if (ble_ll_adv_active_chanset_is_sec(advsm)) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_sec_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_sec_txdone_ev);
|
||||
} else {
|
||||
BLE_LL_ASSERT(0);
|
||||
}
|
||||
#else
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_txdone_ev);
|
||||
#endif
|
||||
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
@@ -1068,7 +1068,7 @@ ble_ll_adv_event_rmvd_from_sched(struct ble_ll_adv_sm *advsm)
|
||||
void
|
||||
ble_ll_adv_periodic_rmvd_from_sched(struct ble_ll_adv_sm *advsm)
|
||||
{
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_periodic_txdone_ev);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1693,18 +1693,17 @@ ble_ll_adv_halt(void)
|
||||
if (advsm->flags & BLE_LL_ADV_SM_FLAG_PERIODIC_SYNC_SENDING) {
|
||||
ble_ll_adv_flags_clear(advsm,
|
||||
BLE_LL_ADV_SM_FLAG_PERIODIC_SYNC_SENDING);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq,
|
||||
&advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
g_ble_ll_cur_adv_sm = NULL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_txdone_ev);
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (!(advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY)) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_sec_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_sec_txdone_ev);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1938,9 +1937,9 @@ ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
|
||||
#endif
|
||||
OS_EXIT_CRITICAL(sr);
|
||||
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
|
||||
ble_ll_event_remove(&advsm->adv_txdone_ev);
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_sec_txdone_ev);
|
||||
ble_ll_event_remove(&advsm->adv_sec_txdone_ev);
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
@@ -2122,7 +2121,7 @@ ble_ll_adv_sync_tx_done(struct ble_ll_adv_sm *advsm)
|
||||
BLE_LL_ASSERT(advsm->flags & BLE_LL_ADV_SM_FLAG_PERIODIC_SYNC_SENDING);
|
||||
BLE_LL_ASSERT(!ble_ll_adv_active_chanset_is_sec(advsm));
|
||||
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_periodic_txdone_ev);
|
||||
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
ble_ll_adv_flags_clear(advsm, BLE_LL_ADV_SM_FLAG_PERIODIC_SYNC_SENDING);
|
||||
@@ -2339,8 +2338,7 @@ ble_ll_adv_periodic_schedule_first(struct ble_ll_adv_sm *advsm,
|
||||
rc = ble_ll_sched_periodic_adv(sch, first_pdu);
|
||||
if (rc) {
|
||||
STATS_INC(ble_ll_stats, periodic_adv_drop_event);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq,
|
||||
&advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_periodic_txdone_ev);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2432,8 +2430,7 @@ ble_ll_adv_periodic_schedule_next(struct ble_ll_adv_sm *advsm)
|
||||
advsm->periodic_adv_itvl_ticks)) {
|
||||
STATS_INC(ble_ll_stats, periodic_chain_drop_event);
|
||||
ble_ll_sched_rmv_elem(&sync->sch);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq,
|
||||
&advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_periodic_txdone_ev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2503,7 +2500,7 @@ ble_ll_adv_periodic_done(struct ble_ll_adv_sm *advsm)
|
||||
|
||||
/* Remove anything else scheduled for periodic */
|
||||
ble_ll_sched_rmv_elem(&sync->sch);
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_event_remove(&advsm->adv_periodic_txdone_ev);
|
||||
|
||||
/* If we have next SYNC scheduled, try to schedule another one */
|
||||
if (sync_next->sch.enqueued) {
|
||||
@@ -2612,8 +2609,7 @@ ble_ll_adv_sm_stop_periodic(struct ble_ll_adv_sm *advsm)
|
||||
|
||||
ble_ll_adv_flags_clear(advsm, BLE_LL_ADV_SM_FLAG_PERIODIC_SYNC_SENDING);
|
||||
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq,
|
||||
&advsm->adv_periodic_txdone_ev);
|
||||
ble_ll_event_remove(&advsm->adv_periodic_txdone_ev);
|
||||
|
||||
ble_ll_adv_update_periodic_data(advsm);
|
||||
}
|
||||
@@ -4591,12 +4587,12 @@ ble_ll_adv_drop_event(struct ble_ll_adv_sm *advsm)
|
||||
ble_ll_sched_rmv_elem(&advsm->aux[0].sch);
|
||||
ble_ll_sched_rmv_elem(&advsm->aux[1].sch);
|
||||
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_sec_txdone_ev);
|
||||
ble_ll_event_remove(&advsm->adv_sec_txdone_ev);
|
||||
advsm->aux_active = 0;
|
||||
#endif
|
||||
|
||||
advsm->adv_chan = ble_ll_adv_final_chan(advsm);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_txdone_ev);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4675,7 +4671,7 @@ ble_ll_adv_done(struct ble_ll_adv_sm *advsm)
|
||||
/* Remove the element from the schedule if it is still there. */
|
||||
ble_ll_sched_rmv_elem(&advsm->adv_sch);
|
||||
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
|
||||
ble_ll_event_remove(&advsm->adv_txdone_ev);
|
||||
|
||||
/*
|
||||
* Check if we have ended our advertising event. If our last advertising
|
||||
@@ -4815,7 +4811,7 @@ ble_ll_adv_done(struct ble_ll_adv_sm *advsm)
|
||||
rc = ble_ll_sched_adv_resched_pdu(&advsm->adv_sch);
|
||||
if (rc) {
|
||||
STATS_INC(ble_ll_stats, adv_resched_pdu_fail);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
|
||||
ble_ll_event_add(&advsm->adv_txdone_ev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4859,7 +4855,7 @@ ble_ll_adv_sec_done(struct ble_ll_adv_sm *advsm)
|
||||
|
||||
/* Remove anything else scheduled for secondary channel */
|
||||
ble_ll_sched_rmv_elem(&aux->sch);
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_sec_txdone_ev);
|
||||
ble_ll_event_remove(&advsm->adv_sec_txdone_ev);
|
||||
|
||||
/* Stop advertising due to transmitting connection response */
|
||||
if (advsm->flags & BLE_LL_ADV_SM_FLAG_CONN_RSP_TXD) {
|
||||
|
||||
@@ -374,7 +374,7 @@ ble_ll_conn_cth_flow_process_cmd(const uint8_t *cmdbuf)
|
||||
cp = (const void *)cmd->data;
|
||||
|
||||
if (cmd->length != sizeof(cp->handles) + cp->handles * sizeof(cp->h[0])) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_conn_cth_flow_error_ev);
|
||||
ble_ll_event_add(&g_ble_ll_conn_cth_flow_error_ev);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ ble_ll_conn_current_sm_over(struct ble_ll_conn_sm *connsm)
|
||||
* need to post to the LL the connection event end event
|
||||
*/
|
||||
if (connsm) {
|
||||
ble_ll_event_send(&connsm->conn_ev_end);
|
||||
ble_ll_event_add(&connsm->conn_ev_end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1550,7 +1550,7 @@ ble_ll_conn_event_start_cb(struct ble_ll_sched_item *sch)
|
||||
}
|
||||
|
||||
if (rc == BLE_LL_SCHED_STATE_DONE) {
|
||||
ble_ll_event_send(&connsm->conn_ev_end);
|
||||
ble_ll_event_add(&connsm->conn_ev_end);
|
||||
ble_phy_disable();
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
g_ble_ll_conn_cur_sm = NULL;
|
||||
@@ -2114,7 +2114,7 @@ ble_ll_conn_end(struct ble_ll_conn_sm *connsm, uint8_t ble_err)
|
||||
}
|
||||
|
||||
/* Make sure events off queue */
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &connsm->conn_ev_end);
|
||||
ble_ll_event_remove(&connsm->conn_ev_end);
|
||||
|
||||
/* Connection state machine is now idle */
|
||||
connsm->conn_state = BLE_LL_CONN_STATE_IDLE;
|
||||
@@ -2781,7 +2781,7 @@ ble_ll_conn_event_end(struct ble_npl_event *ev)
|
||||
}
|
||||
|
||||
/* Remove any connection end events that might be enqueued */
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &connsm->conn_ev_end);
|
||||
ble_ll_event_remove(&connsm->conn_ev_end);
|
||||
|
||||
/*
|
||||
* If we have received a packet, we can set the current transmit window
|
||||
@@ -3028,7 +3028,7 @@ ble_ll_conn_event_halt(void)
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
if (g_ble_ll_conn_cur_sm) {
|
||||
g_ble_ll_conn_cur_sm->csmflags.cfbit.pkt_rxd = 0;
|
||||
ble_ll_event_send(&g_ble_ll_conn_cur_sm->conn_ev_end);
|
||||
ble_ll_event_add(&g_ble_ll_conn_cur_sm->conn_ev_end);
|
||||
g_ble_ll_conn_cur_sm = NULL;
|
||||
}
|
||||
}
|
||||
@@ -3226,7 +3226,7 @@ ble_ll_conn_rx_isr_start(struct ble_mbuf_hdr *rxhdr, uint32_t aa)
|
||||
if (aa != connsm->access_addr) {
|
||||
STATS_INC(ble_ll_conn_stats, rx_data_pdu_bad_aa);
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
ble_ll_event_send(&connsm->conn_ev_end);
|
||||
ble_ll_event_add(&connsm->conn_ev_end);
|
||||
g_ble_ll_conn_cur_sm = NULL;
|
||||
return -1;
|
||||
}
|
||||
@@ -3654,8 +3654,7 @@ ble_ll_conn_rx_isr_end(uint8_t *rxbuf, struct ble_mbuf_hdr *rxhdr)
|
||||
#endif
|
||||
++connsm->completed_pkts;
|
||||
if (connsm->completed_pkts > 2) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq,
|
||||
&g_ble_ll_data.ll_comp_pkt_ev);
|
||||
ble_ll_event_add(&g_ble_ll_data.ll_comp_pkt_ev);
|
||||
}
|
||||
}
|
||||
os_mbuf_free_chain(txpdu);
|
||||
|
||||
@@ -199,7 +199,7 @@ static int ble_ll_dtm_rx_start(void);
|
||||
static void
|
||||
ble_ll_dtm_ev_rx_restart_cb(struct ble_npl_event *evt) {
|
||||
if (ble_ll_dtm_rx_start() != 0) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_dtm_ctx.evt);
|
||||
ble_ll_event_add(&g_ble_ll_dtm_ctx.evt);
|
||||
STATS_INC(ble_ll_dtm_stats, rx_failed);
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ ble_ll_dtm_tx_done(void *arg)
|
||||
g_ble_ll_dtm_ctx.num_of_packets++;
|
||||
|
||||
/* Reschedule event in LL context */
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &ctx->evt);
|
||||
ble_ll_event_add(&ctx->evt);
|
||||
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
}
|
||||
@@ -263,7 +263,7 @@ ble_ll_dtm_tx_sched_cb(struct ble_ll_sched_item *sch)
|
||||
|
||||
resched:
|
||||
/* Reschedule from LL task if late for this PDU */
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &ctx->evt);
|
||||
ble_ll_event_add(&ctx->evt);
|
||||
|
||||
STATS_INC(ble_ll_dtm_stats, tx_failed);
|
||||
|
||||
@@ -416,7 +416,7 @@ static int
|
||||
ble_ll_dtm_rx_sched_cb(struct ble_ll_sched_item *sch)
|
||||
{
|
||||
if (ble_ll_dtm_rx_start() != 0) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_dtm_ctx.evt);
|
||||
ble_ll_event_add(&g_ble_ll_dtm_ctx.evt);
|
||||
STATS_INC(ble_ll_dtm_stats, rx_failed);
|
||||
return BLE_LL_SCHED_STATE_DONE;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ ble_ll_dtm_ctx_free(struct dtm_ctx * ctx)
|
||||
}
|
||||
|
||||
ble_ll_sched_rmv_elem(&ctx->sch);
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &g_ble_ll_dtm_ctx.evt);
|
||||
ble_ll_event_remove(&g_ble_ll_dtm_ctx.evt);
|
||||
|
||||
ble_phy_disable();
|
||||
ble_phy_disable_dtm();
|
||||
@@ -665,7 +665,7 @@ ble_ll_dtm_rx_pkt_in(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *hdr)
|
||||
}
|
||||
|
||||
if (ble_ll_dtm_rx_start() != 0) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_dtm_ctx.evt);
|
||||
ble_ll_event_add(&g_ble_ll_dtm_ctx.evt);
|
||||
STATS_INC(ble_ll_dtm_stats, rx_failed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1813,7 +1813,7 @@ ble_ll_hci_cmd_rx(uint8_t *cmdbuf, void *arg)
|
||||
|
||||
/* Fill out the event and post to Link Layer */
|
||||
ble_npl_event_set_arg(ev, cmdbuf);
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, ev);
|
||||
ble_ll_event_add(ev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ ble_ll_rfmgmt_reset(void)
|
||||
rfmgmt->timer_scheduled_at = 0;
|
||||
ble_ll_tmr_stop(&rfmgmt->timer);
|
||||
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &rfmgmt->release_ev);
|
||||
ble_ll_event_remove(&rfmgmt->release_ev);
|
||||
|
||||
ble_ll_rfmgmt_disable();
|
||||
|
||||
@@ -290,10 +290,10 @@ ble_ll_rfmgmt_release(void)
|
||||
|
||||
OS_ENTER_CRITICAL(sr);
|
||||
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &rfmgmt->release_ev);
|
||||
ble_ll_event_remove(&rfmgmt->release_ev);
|
||||
|
||||
if (g_ble_ll_rfmgmt_data.state != RFMGMT_STATE_OFF) {
|
||||
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &rfmgmt->release_ev);
|
||||
ble_ll_event_add(&rfmgmt->release_ev);
|
||||
}
|
||||
|
||||
OS_EXIT_CRITICAL(sr);
|
||||
|
||||
@@ -1674,7 +1674,7 @@ ble_ll_scan_chk_resume(void)
|
||||
OS_ENTER_CRITICAL(sr);
|
||||
if (scansm->restart_timer_needed) {
|
||||
scansm->restart_timer_needed = 0;
|
||||
ble_ll_event_send(&scansm->scan_sched_ev);
|
||||
ble_ll_event_add(&scansm->scan_sched_ev);
|
||||
STATS_INC(ble_ll_stats, scan_timer_restarted);
|
||||
OS_EXIT_CRITICAL(sr);
|
||||
return;
|
||||
@@ -1704,13 +1704,13 @@ ble_ll_scan_timer_cb(void *arg)
|
||||
struct ble_ll_scan_sm *scansm;
|
||||
|
||||
scansm = (struct ble_ll_scan_sm *)arg;
|
||||
ble_ll_event_send(&scansm->scan_sched_ev);
|
||||
ble_ll_event_add(&scansm->scan_sched_ev);
|
||||
}
|
||||
|
||||
void
|
||||
ble_ll_scan_interrupted(struct ble_ll_scan_sm *scansm)
|
||||
{
|
||||
ble_ll_event_send(&scansm->scan_interrupted_ev);
|
||||
ble_ll_event_add(&scansm->scan_interrupted_ev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -677,7 +677,7 @@ ble_ll_scan_aux_break(struct ble_ll_scan_aux_data *aux)
|
||||
#endif
|
||||
|
||||
ble_npl_event_init(&aux->break_ev, ble_ll_scan_aux_break_ev, aux);
|
||||
ble_ll_event_send(&aux->break_ev);
|
||||
ble_ll_event_add(&aux->break_ev);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -144,7 +144,7 @@ ble_ll_sched_preempt(struct ble_ll_sched_item *sch,
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL) || MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
case BLE_LL_SCHED_TYPE_CONN:
|
||||
connsm = (struct ble_ll_conn_sm *)entry->cb_arg;
|
||||
ble_ll_event_send(&connsm->conn_ev_end);
|
||||
ble_ll_event_add(&connsm->conn_ev_end);
|
||||
break;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_BROADCASTER)
|
||||
|
||||
@@ -197,7 +197,7 @@ ble_ll_sync_sm_clear(struct ble_ll_sync_sm *sm)
|
||||
if (sm->flags & (BLE_LL_SYNC_SM_FLAG_ESTABLISHING |
|
||||
BLE_LL_SYNC_SM_FLAG_ESTABLISHED)) {
|
||||
ble_ll_sched_rmv_elem(&sm->sch);
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &sm->sync_ev_end);
|
||||
ble_ll_event_remove(&sm->sync_ev_end);
|
||||
}
|
||||
|
||||
if (sm->next_report) {
|
||||
@@ -481,7 +481,7 @@ ble_ll_sync_event_start_cb(struct ble_ll_sched_item *sch)
|
||||
rc = ble_phy_rx_set_start_time(start, sch->remainder);
|
||||
if (rc && rc != BLE_PHY_ERR_RX_LATE) {
|
||||
STATS_INC(ble_ll_stats, sync_event_failed);
|
||||
ble_ll_event_send(&sm->sync_ev_end);
|
||||
ble_ll_event_add(&sm->sync_ev_end);
|
||||
ble_ll_sync_current_sm_over();
|
||||
rc = BLE_LL_SCHED_STATE_DONE;
|
||||
} else {
|
||||
@@ -534,7 +534,7 @@ ble_ll_sync_rx_isr_start(uint8_t pdu_type, struct ble_mbuf_hdr *rxhdr)
|
||||
|
||||
/* this also handles chains as those have same PDU type */
|
||||
if (pdu_type != BLE_ADV_PDU_TYPE_AUX_SYNC_IND) {
|
||||
ble_ll_event_send(&g_ble_ll_sync_sm_current->sync_ev_end);
|
||||
ble_ll_event_add(&g_ble_ll_sync_sm_current->sync_ev_end);
|
||||
ble_ll_sync_current_sm_over();
|
||||
STATS_INC(ble_ll_stats, sched_invalid_pdu);
|
||||
return -1;
|
||||
@@ -786,7 +786,7 @@ ble_ll_sync_rx_isr_end(uint8_t *rxbuf, struct ble_mbuf_hdr *rxhdr)
|
||||
ble_ll_rx_pdu_in(rxpdu);
|
||||
} else {
|
||||
STATS_INC(ble_ll_stats, sync_rx_buf_err);
|
||||
ble_ll_event_send(&g_ble_ll_sync_sm_current->sync_ev_end);
|
||||
ble_ll_event_add(&g_ble_ll_sync_sm_current->sync_ev_end);
|
||||
}
|
||||
|
||||
/* PHY is disabled here */
|
||||
@@ -809,7 +809,7 @@ ble_ll_sync_wfr_timer_exp(void)
|
||||
STATS_INC(ble_ll_stats, sync_missed_err);
|
||||
|
||||
ble_ll_sync_current_sm_over();
|
||||
ble_ll_event_send(&sm->sync_ev_end);
|
||||
ble_ll_event_add(&sm->sync_ev_end);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -826,7 +826,7 @@ ble_ll_sync_halt(void)
|
||||
ble_ll_sync_current_sm_over();
|
||||
|
||||
if (sm) {
|
||||
ble_ll_event_send(&sm->sync_ev_end);
|
||||
ble_ll_event_add(&sm->sync_ev_end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1130,7 +1130,7 @@ ble_ll_sync_rx_pkt_in(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *hdr)
|
||||
}
|
||||
|
||||
end_event:
|
||||
ble_ll_event_send(&sm->sync_ev_end);
|
||||
ble_ll_event_add(&sm->sync_ev_end);
|
||||
ble_ll_rfmgmt_release();
|
||||
}
|
||||
|
||||
@@ -1234,7 +1234,7 @@ ble_ll_sync_event_end(struct ble_npl_event *ev)
|
||||
ble_ll_scan_chk_resume();
|
||||
|
||||
/* Remove any end events that might be enqueued */
|
||||
ble_npl_eventq_remove(&g_ble_ll_data.ll_evq, &sm->sync_ev_end);
|
||||
ble_ll_event_remove(&sm->sync_ev_end);
|
||||
|
||||
/* don't schedule next event if sync is not established nor establishing
|
||||
* at this point SM is no longer valid
|
||||
@@ -2227,7 +2227,7 @@ done:
|
||||
void
|
||||
ble_ll_sync_rmvd_from_sched(struct ble_ll_sync_sm *sm)
|
||||
{
|
||||
ble_ll_event_send(&sm->sync_ev_end);
|
||||
ble_ll_event_add(&sm->sync_ev_end);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user