NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
ble_hs_hci_priv.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef H_BLE_HS_HCI_PRIV_
21#define H_BLE_HS_HCI_PRIV_
22
23#include "nimble/nimble/include/nimble/hci_common.h"
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28struct ble_hs_conn;
29struct os_mbuf;
30
31#define BLE_HS_HCI_LE_FEAT_ENCRYPTION (0x00000001)
32#define BLE_HS_HCI_LE_FEAT_CONN_PARAM_REQUEST (0x00000002)
33#define BLE_HS_HCI_LE_FEAT_EXT_REJECT (0x00000004)
34#define BLE_HS_HCI_LE_FEAT_SLAVE_FEAT_EXCHANGE (0x00000008)
35#define BLE_HS_HCI_LE_FEAT_PING (0x00000010)
36#define BLE_HS_HCI_LE_FEAT_DATA_PACKET_LENGTH_EXT (0x00000020)
37#define BLE_HS_HCI_LE_FEAT_LL_PRIVACY (0x00000040)
38#define BLE_HS_HCI_LE_FEAT_EXT_SCANNER_FILTER_POLICIES (0x00000080)
39#define BLE_HS_HCI_LE_FEAT_2M_PHY (0x00000100)
40#define BLE_HS_HCI_LE_FEAT_STABLE_MOD_INDEX_TX (0x00000200)
41#define BLE_HS_HCI_LE_FEAT_STABLE_MOD_INDEX_RX (0x00000400)
42#define BLE_HS_HCI_LE_FEAT_CODED_PHY (0x00000800)
43#define BLE_HS_HCI_LE_FEAT_EXT_ADV (0x00001000)
44#define BLE_HS_HCI_LE_FEAT_PERIODIC_ADV (0x00002000)
45#define BLE_HS_HCI_LE_FEAT_CSA2 (0x00004000)
46#define BLE_HS_HCI_LE_FEAT_POWER_CLASS_1 (0x00008000)
47#define BLE_HS_HCI_LE_FEAT_MIN_NUM_USED_CHAN (0x00010000)
48
49struct ble_hs_hci_ack {
50 int bha_status; /* A BLE_HS_E<...> error; NOT a naked HCI code. */
51 const uint8_t *bha_params;
52 int bha_params_len;
53 uint16_t bha_opcode;
54 uint8_t bha_hci_handle;
55};
56
57#if MYNEWT_VAL(BLE_EXT_ADV)
58struct ble_hs_hci_ext_scan_param {
59 uint8_t scan_type;
60 uint16_t scan_itvl;
61 uint16_t scan_window;
62};
63
64struct ble_hs_hci_ext_conn_params {
65 uint16_t scan_itvl;
66 uint16_t scan_window;
67 uint16_t conn_itvl;
68 uint16_t conn_windows;
69};
70
71#if MYNEWT_VAL(BLE_PERIODIC_ADV)
72/* Periodic Advertising Parameters */
73struct hci_periodic_adv_params
74{
75 uint16_t min_interval;
76 uint16_t max_interval;
77 uint16_t properties;
78};
79#endif
80#endif
81
82extern uint16_t ble_hs_hci_avail_pkts;
83
84/* This function is not waiting for command status/complete HCI events */
85int ble_hs_hci_cmd_tx_no_rsp(uint16_t opcode, const void *cmd, uint8_t cmd_len);
86int ble_hs_hci_cmd_tx(uint16_t opcode, const void *cmd, uint8_t cmd_len,
87 void *rsp, uint8_t rsp_len);
88void ble_hs_hci_init(void);
89void ble_hs_hci_deinit(void);
90
91void ble_hs_hci_set_le_supported_feat(uint32_t feat);
92uint32_t ble_hs_hci_get_le_supported_feat(void);
93void ble_hs_hci_set_hci_version(uint8_t hci_version);
94uint8_t ble_hs_hci_get_hci_version(void);
95
96#if MYNEWT_VAL(BLE_HS_PHONY_HCI_ACKS)
97typedef int ble_hs_hci_phony_ack_fn(uint8_t *ack, int ack_buf_len);
98void ble_hs_hci_set_phony_ack_cb(ble_hs_hci_phony_ack_fn *cb);
99#endif
100
101int ble_hs_hci_util_read_adv_tx_pwr(int8_t *out_pwr);
102int ble_hs_hci_util_rand(void *dst, int len);
103int ble_hs_hci_util_read_rssi(uint16_t conn_handle, int8_t *out_rssi);
104int ble_hs_hci_util_set_random_addr(const uint8_t *addr);
105int ble_hs_hci_util_data_hdr_strip(struct os_mbuf *om,
106 struct hci_data_hdr *out_hdr);
107int ble_hs_hci_evt_process(struct ble_hci_ev *ev);
108
109int ble_hs_hci_cmd_send_buf(uint16_t opcode, const void *buf, uint8_t buf_len);
110int ble_hs_hci_set_buf_sz(uint16_t pktlen, uint16_t max_pkts);
111void ble_hs_hci_add_avail_pkts(uint16_t delta);
112
113uint16_t ble_hs_hci_util_handle_pb_bc_join(uint16_t handle, uint8_t pb,
114 uint8_t bc);
115
116int ble_hs_hci_acl_tx_now(struct ble_hs_conn *conn, struct os_mbuf **om);
117int ble_hs_hci_acl_tx(struct ble_hs_conn *conn, struct os_mbuf **om);
118
119int ble_hs_hci_frag_num_mbufs(void);
120int ble_hs_hci_frag_num_mbufs_free(void);
121
122int ble_hs_hci_util_set_data_addr_change(uint8_t adv_handle, uint8_t change_reason);
123
124int ble_hs_hci_dtm_tx_start(uint8_t tx_chan, uint8_t test_data_len, uint8_t payload);
125int ble_hs_hci_dtm_rx_start(uint8_t rx_chan);
126int ble_hs_hci_dtm_enh_rx_start(uint8_t rx_chan, uint8_t index, uint8_t phy);
127int ble_hs_hci_dtm_enh_tx_start(uint8_t tx_chan, uint8_t test_data_len,
128 uint8_t payload, uint8_t phy);
129int ble_hs_hci_dtm_stop(void);
130
131#ifdef __cplusplus
132}
133#endif
134
135#endif
Definition os_mbuf.h:86