25#include "ble_att_cmd_priv.h"
26#include "ble_att_priv.h"
27#include "ble_gap_priv.h"
28#include "ble_gatt_priv.h"
29#include "ble_hs_hci_priv.h"
30#include "ble_hs_atomic_priv.h"
31#include "ble_hs_conn_priv.h"
32#include "ble_hs_mbuf_priv.h"
33#include "ble_hs_startup_priv.h"
34#include "ble_l2cap_priv.h"
35#include "ble_l2cap_sig_priv.h"
36#include "ble_l2cap_coc_priv.h"
37#include "ble_sm_priv.h"
38#include "ble_hs_adv_priv.h"
39#include "ble_hs_flow_priv.h"
40#include "ble_hs_pvcy_priv.h"
41#include "ble_hs_id_priv.h"
42#include "ble_hs_periodic_sync_priv.h"
43#include "ble_uuid_priv.h"
44#include "nimble/nimble/host/include/host/ble_hs.h"
45#include "nimble/nimble/include/nimble/nimble_opt.h"
46#include "nimble/porting/nimble/include/stats/stats.h"
47#if MYNEWT_VAL(BLE_GATT_CACHING)
48#include "ble_gattc_cache_priv.h"
60#define BLE_HS_SYNC_STATE_BAD 0
61#define BLE_HS_SYNC_STATE_BRINGUP 1
62#define BLE_HS_SYNC_STATE_GOOD 2
64#define BLE_HS_ENABLED_STATE_OFF 0
65#define BLE_HS_ENABLED_STATE_STOPPING 1
66#define BLE_HS_ENABLED_STATE_ON 2
69#define BLE_HS_MAX_CONNECTIONS MYNEWT_VAL(BLE_MAX_CONNECTIONS)
71#define BLE_HS_MAX_CONNECTIONS 0
74#if !MYNEWT_VAL(BLE_ATT_SVR_QUEUED_WRITE)
75#define BLE_HS_ATT_SVR_QUEUED_WRITE_TMO 0
77#define BLE_HS_ATT_SVR_QUEUED_WRITE_TMO \
78 MYNEWT_VAL(BLE_ATT_SVR_QUEUED_WRITE_TMO)
81STATS_SECT_START(ble_hs_stats)
82 STATS_SECT_ENTRY(conn_create)
83 STATS_SECT_ENTRY(conn_delete)
84 STATS_SECT_ENTRY(hci_cmd)
85 STATS_SECT_ENTRY(hci_event)
86 STATS_SECT_ENTRY(hci_invalid_ack)
87 STATS_SECT_ENTRY(hci_unknown_event)
88 STATS_SECT_ENTRY(hci_timeout)
89 STATS_SECT_ENTRY(reset)
90 STATS_SECT_ENTRY(sync)
91 STATS_SECT_ENTRY(pvcy_add_entry)
92 STATS_SECT_ENTRY(pvcy_add_entry_fail)
94extern STATS_SECT_DECL(ble_hs_stats) ble_hs_stats;
97extern uint8_t ble_hs_sync_state;
98extern uint8_t ble_hs_enabled_state;
100extern const uint8_t ble_hs_misc_null_addr[6];
102extern uint16_t ble_hs_max_attrs;
103extern uint16_t ble_hs_max_services;
104extern uint16_t ble_hs_max_client_configs;
106void ble_hs_process_rx_data_queue(
void);
107int ble_hs_tx_data(
struct os_mbuf *om);
108void ble_hs_wakeup_tx(
void);
109void ble_hs_enqueue_hci_event(uint8_t *hci_evt);
110void ble_hs_event_enqueue(
struct os_event *ev);
112int ble_hs_hci_rx_evt(uint8_t *hci_ev,
void *arg);
113int ble_hs_hci_evt_acl_process(
struct os_mbuf *om);
115int ble_hs_misc_conn_chan_find(uint16_t conn_handle, uint16_t cid,
116 struct ble_hs_conn **out_conn,
117 struct ble_l2cap_chan **out_chan);
118int ble_hs_misc_conn_chan_find_reqd(uint16_t conn_handle, uint16_t cid,
119 struct ble_hs_conn **out_conn,
120 struct ble_l2cap_chan **out_chan);
121uint8_t ble_hs_misc_own_addr_type_to_id(uint8_t addr_type);
122uint8_t ble_hs_misc_peer_addr_type_to_id(uint8_t addr_type);
123int ble_hs_misc_restore_irks(
void);
125int ble_hs_locked_by_cur_task(
void);
126int ble_hs_is_parent_task(
void);
127void ble_hs_lock_nested(
void);
128void ble_hs_unlock_nested(
void);
129void ble_hs_lock(
void);
130void ble_hs_unlock(
void);
131void ble_hs_hw_error(uint8_t hw_code);
132void ble_hs_timer_resched(
void);
133void ble_hs_notifications_sched(
void);
134struct ble_npl_eventq *ble_hs_evq_get(
void);
135void ble_hs_stop_init(
void);
136void ble_hs_stop_deinit(
void);
140 struct ble_npl_event ev;
143int ble_mqueue_init(
struct ble_mqueue *mq, ble_npl_event_fn *ev_fn,
void *ev_arg);
144struct os_mbuf *ble_mqueue_get(
struct ble_mqueue *mq);
145int ble_mqueue_put(
struct ble_mqueue *mq,
struct ble_npl_eventq *evq,
struct os_mbuf *om);
147void ble_gap_npl_sync_lost(
struct ble_npl_event *ev);
149#if MYNEWT_VAL(BLE_HS_DEBUG)
150 #define BLE_HS_DBG_ASSERT(x) assert(x)
151 #define BLE_HS_DBG_ASSERT_EVAL(x) assert(x)
153 #define BLE_HS_DBG_ASSERT(x)
154 #define BLE_HS_DBG_ASSERT_EVAL(x) ((void)(x))
Definition os_mempool.h:57