mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-17 23:39:58 +00:00
nimble/host: Fix missing NPL usage
Seems like we never tried to build ported NimBLE with some of features enabled thus there were still some OS calls left.
This commit is contained in:
@@ -3528,7 +3528,7 @@ ble_gap_ext_connect(uint8_t own_addr_type, const ble_addr_t *peer_addr,
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
uint32_t duration_ticks;
|
||||
ble_npl_time_t duration_ticks;
|
||||
int rc;
|
||||
|
||||
STATS_INC(ble_gap_stats, initiate);
|
||||
@@ -3584,7 +3584,7 @@ ble_gap_ext_connect(uint8_t own_addr_type, const ble_addr_t *peer_addr,
|
||||
}
|
||||
|
||||
if (duration_ms != BLE_HS_FOREVER) {
|
||||
rc = os_time_ms_to_ticks(duration_ms, &duration_ticks);
|
||||
rc = ble_npl_time_ms_to_ticks(duration_ms, &duration_ticks);
|
||||
if (rc != 0) {
|
||||
/* Duration too great. */
|
||||
rc = BLE_HS_EINVAL;
|
||||
|
||||
@@ -117,14 +117,18 @@ ble_hs_evq_set(struct ble_npl_eventq *evq)
|
||||
int
|
||||
ble_hs_locked_by_cur_task(void)
|
||||
{
|
||||
#if MYNEWT
|
||||
struct os_task *owner;
|
||||
|
||||
if (!os_started()) {
|
||||
if (!ble_npl_os_started()) {
|
||||
return ble_hs_dbg_mutex_locked;
|
||||
}
|
||||
|
||||
owner = ble_hs_mutex.mu.mu_owner;
|
||||
return owner != NULL && owner == os_sched_get_current_task();
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -147,7 +151,7 @@ ble_hs_lock_nested(void)
|
||||
int rc;
|
||||
|
||||
#if MYNEWT_VAL(BLE_HS_DEBUG)
|
||||
if (!os_started()) {
|
||||
if (!ble_npl_os_started()) {
|
||||
ble_hs_dbg_mutex_locked = 1;
|
||||
return;
|
||||
}
|
||||
@@ -166,7 +170,7 @@ ble_hs_unlock_nested(void)
|
||||
int rc;
|
||||
|
||||
#if MYNEWT_VAL(BLE_HS_DEBUG)
|
||||
if (!os_started()) {
|
||||
if (!ble_npl_os_started()) {
|
||||
ble_hs_dbg_mutex_locked = 0;
|
||||
return;
|
||||
}
|
||||
@@ -184,7 +188,7 @@ ble_hs_lock(void)
|
||||
{
|
||||
BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task());
|
||||
#if MYNEWT_VAL(BLE_HS_DEBUG)
|
||||
if (!os_started()) {
|
||||
if (!ble_npl_os_started()) {
|
||||
BLE_HS_DBG_ASSERT(!ble_hs_dbg_mutex_locked);
|
||||
}
|
||||
#endif
|
||||
@@ -199,7 +203,7 @@ void
|
||||
ble_hs_unlock(void)
|
||||
{
|
||||
#if MYNEWT_VAL(BLE_HS_DEBUG)
|
||||
if (!os_started()) {
|
||||
if (!ble_npl_os_started()) {
|
||||
BLE_HS_DBG_ASSERT(ble_hs_dbg_mutex_locked);
|
||||
}
|
||||
#endif
|
||||
@@ -517,7 +521,7 @@ void
|
||||
ble_hs_notifications_sched(void)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_HS_REQUIRE_OS)
|
||||
if (!os_started()) {
|
||||
if (!ble_npl_os_started()) {
|
||||
ble_gatts_tx_notifications();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#if MYNEWT_VAL(BLE_HS_FLOW_CTRL)
|
||||
|
||||
#define BLE_HS_FLOW_ITVL_TICKS \
|
||||
(MYNEWT_VAL(BLE_HS_FLOW_CTRL_ITVL) * OS_TICKS_PER_SEC / 1000)
|
||||
ble_npl_time_ms_to_ticks32(MYNEWT_VAL(BLE_HS_FLOW_CTRL_ITVL))
|
||||
|
||||
/**
|
||||
* The number of freed buffers since the most-recent
|
||||
@@ -34,13 +34,11 @@
|
||||
static uint16_t ble_hs_flow_num_completed_pkts;
|
||||
|
||||
/** Periodically sends number-of-completed-packets events. */
|
||||
static struct os_callout ble_hs_flow_timer;
|
||||
static struct ble_npl_callout ble_hs_flow_timer;
|
||||
|
||||
static os_event_fn ble_hs_flow_event_cb;
|
||||
static ble_npl_event_fn ble_hs_flow_event_cb;
|
||||
|
||||
static struct os_event ble_hs_flow_ev = {
|
||||
.ev_cb = ble_hs_flow_event_cb,
|
||||
};
|
||||
static struct ble_npl_event ble_hs_flow_ev;
|
||||
|
||||
static int
|
||||
ble_hs_flow_tx_num_comp_pkts(void)
|
||||
@@ -95,7 +93,7 @@ ble_hs_flow_tx_num_comp_pkts(void)
|
||||
}
|
||||
|
||||
static void
|
||||
ble_hs_flow_event_cb(struct os_event *ev)
|
||||
ble_hs_flow_event_cb(struct ble_npl_event *ev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -135,10 +133,10 @@ ble_hs_flow_inc_completed_pkts(struct ble_hs_conn *conn)
|
||||
*/
|
||||
num_free = MYNEWT_VAL(BLE_ACL_BUF_COUNT) - ble_hs_flow_num_completed_pkts;
|
||||
if (num_free <= MYNEWT_VAL(BLE_HS_FLOW_CTRL_THRESH)) {
|
||||
os_eventq_put(ble_hs_evq_get(), &ble_hs_flow_ev);
|
||||
os_callout_stop(&ble_hs_flow_timer);
|
||||
ble_npl_eventq_put(ble_hs_evq_get(), &ble_hs_flow_ev);
|
||||
ble_npl_callout_stop(&ble_hs_flow_timer);
|
||||
} else if (ble_hs_flow_num_completed_pkts == 1) {
|
||||
rc = os_callout_reset(&ble_hs_flow_timer, BLE_HS_FLOW_ITVL_TICKS);
|
||||
rc = ble_npl_callout_reset(&ble_hs_flow_timer, BLE_HS_FLOW_ITVL_TICKS);
|
||||
BLE_HS_DBG_ASSERT_EVAL(rc == 0);
|
||||
}
|
||||
}
|
||||
@@ -229,9 +227,11 @@ ble_hs_flow_startup(void)
|
||||
struct hci_host_buf_size buf_size_cmd;
|
||||
int rc;
|
||||
|
||||
ble_npl_event_init(&ble_hs_flow_ev, ble_hs_flow_event_cb, NULL);
|
||||
|
||||
/* Assume failure. */
|
||||
ble_hci_trans_set_acl_free_cb(NULL, NULL);
|
||||
os_callout_stop(&ble_hs_flow_timer);
|
||||
ble_npl_callout_stop(&ble_hs_flow_timer);
|
||||
|
||||
rc = ble_hs_hci_cmd_tx_set_ctlr_to_host_fc(BLE_HCI_CTLR_TO_HOST_FC_ACL);
|
||||
if (rc != 0) {
|
||||
@@ -251,8 +251,8 @@ ble_hs_flow_startup(void)
|
||||
/* Flow control successfully enabled. */
|
||||
ble_hs_flow_num_completed_pkts = 0;
|
||||
ble_hci_trans_set_acl_free_cb(ble_hs_flow_acl_free, NULL);
|
||||
os_callout_init(&ble_hs_flow_timer, ble_hs_evq_get(),
|
||||
ble_hs_flow_event_cb, NULL);
|
||||
ble_npl_callout_init(&ble_hs_flow_timer, ble_hs_evq_get(),
|
||||
ble_hs_flow_event_cb, NULL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user