Cordio Stack and Cordio Profiles  r2p3-02rel0
hci_defs.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file hci_defs.h
4  *
5  * \brief HCI constants and definitions from the Bluetooth specification.
6  *
7  * Copyright (c) 2009-2018 ARM Ltd. All Rights Reserved.
8  * ARM Ltd. confidential and proprietary.
9  *
10  * IMPORTANT. Your use of this file is governed by a Software License Agreement
11  * ("Agreement") that must be accepted in order to download or otherwise receive a
12  * copy of this file. You may not use or copy this file for any purpose other than
13  * as described in the Agreement. If you do not agree to all of the terms of the
14  * Agreement do not use this file and delete all copies in your possession or control;
15  * if you do not have a copy of the Agreement, you must contact ARM Ltd. prior
16  * to any use, copying or further distribution of this software.
17  */
18 /*************************************************************************************************/
19 #ifndef HCI_DEFS_H
20 #define HCI_DEFS_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /*! \addtogroup STACK_HCI_API
27  * \{ */
28 
29 /** \name Packet definitions
30  *
31  */
32 /**@{*/
33 #define HCI_CMD_HDR_LEN 3 /*!< \brief Command packet header length */
34 #define HCI_ACL_HDR_LEN 4 /*!< \brief ACL packet header length */
35 #define HCI_EVT_HDR_LEN 2 /*!< \brief Event packet header length */
36 #define HCI_EVT_PARAM_MAX_LEN 255 /*!< \brief Maximum length of event packet parameters */
37 #define HCI_ACL_DEFAULT_LEN 27 /*!< \brief Default maximum ACL packet length */
38 #define HCI_PB_FLAG_MASK 0x3000 /*!< \brief ACL packet boundary flag mask */
39 #define HCI_PB_START_H2C 0x0000 /*!< \brief Packet boundary flag, start, host-to-controller */
40 #define HCI_PB_CONTINUE 0x1000 /*!< \brief Packet boundary flag, continue */
41 #define HCI_PB_START_C2H 0x2000 /*!< \brief Packet boundary flag, start, controller-to-host */
42 #define HCI_HANDLE_MASK 0x0FFF /*!< \brief Mask for handle bits in ACL packet */
43 #define HCI_HANDLE_NONE 0xFFFF /*!< \brief Value for invalid handle */
44 /**@}*/
45 
46 /** \name Packet types
47  *
48  */
49 #define HCI_CMD_TYPE 1 /*!< \brief HCI command packet */
50 #define HCI_ACL_TYPE 2 /*!< \brief HCI ACL data packet */
51 #define HCI_EVT_TYPE 4 /*!< \brief HCI event packet */
52 /**@}*/
53 
54 /** \name Error codes
55  *
56  */
57 /**@{*/
58 #define HCI_SUCCESS 0x00 /*!< \brief Success */
59 #define HCI_ERR_UNKNOWN_CMD 0x01 /*!< \brief Unknown HCI command */
60 #define HCI_ERR_UNKNOWN_HANDLE 0x02 /*!< \brief Unknown connection identifier */
61 #define HCI_ERR_HARDWARE_FAILURE 0x03 /*!< \brief Hardware failure */
62 #define HCI_ERR_PAGE_TIMEOUT 0x04 /*!< \brief Page timeout */
63 #define HCI_ERR_AUTH_FAILURE 0x05 /*!< \brief Authentication failure */
64 #define HCI_ERR_KEY_MISSING 0x06 /*!< \brief PIN or key missing */
65 #define HCI_ERR_MEMORY_EXCEEDED 0x07 /*!< \brief Memory capacity exceeded */
66 #define HCI_ERR_CONN_TIMEOUT 0x08 /*!< \brief Connection timeout */
67 #define HCI_ERR_CONN_LIMIT 0x09 /*!< \brief Connection limit exceeded */
68 #define HCI_ERR_SYNCH_CONN_LIMIT 0x0A /*!< \brief Synchronous connection limit exceeded */
69 #define HCI_ERR_ACL_CONN_EXISTS 0x0B /*!< \brief ACL connection already exists */
70 #define HCI_ERR_CMD_DISALLOWED 0x0C /*!< \brief Command disallowed */
71 #define HCI_ERR_REJ_RESOURCES 0x0D /*!< \brief Connection rejected limited resources */
72 #define HCI_ERR_REJ_SECURITY 0x0E /*!< \brief Connection rejected security reasons */
73 #define HCI_ERR_REJ_BD_ADDR 0x0F /*!< \brief Connection rejected unacceptable BD_ADDR */
74 #define HCI_ERR_ACCEPT_TIMEOUT 0x10 /*!< \brief Connection accept timeout exceeded */
75 #define HCI_ERR_UNSUP_FEAT 0x11 /*!< \brief Unsupported feature or parameter value */
76 #define HCI_ERR_INVALID_PARAM 0x12 /*!< \brief Invalid HCI command parameters */
77 #define HCI_ERR_REMOTE_TERMINATED 0x13 /*!< \brief Remote user terminated connection */
78 #define HCI_ERR_REMOTE_RESOURCES 0x14 /*!< \brief Remote device low resources */
79 #define HCI_ERR_REMOTE_POWER_OFF 0x15 /*!< \brief Remote device power off */
80 #define HCI_ERR_LOCAL_TERMINATED 0x16 /*!< \brief Connection terminated by local host */
81 #define HCI_ERR_REPEATED_ATTEMPTS 0x17 /*!< \brief Repeated attempts */
82 #define HCI_ERR_PAIRING_NOT_ALLOWED 0x18 /*!< \brief Pairing not allowed */
83 #define HCI_ERR_UNKNOWN_LMP_PDU 0x19 /*!< \brief Unknown LMP PDU */
84 #define HCI_ERR_UNSUP_REMOTE_FEAT 0x1A /*!< \brief Unsupported remote feature */
85 #define HCI_ERR_SCO_OFFSET 0x1B /*!< \brief SCO offset rejected */
86 #define HCI_ERR_SCO_INTERVAL 0x1C /*!< \brief SCO interval rejected */
87 #define HCI_ERR_SCO_MODE 0x1D /*!< \brief SCO air mode rejected */
88 #define HCI_ERR_LMP_PARAM 0x1E /*!< \brief Invalid LMP parameters */
89 #define HCI_ERR_UNSPECIFIED 0x1F /*!< \brief Unspecified error */
90 #define HCI_ERR_UNSUP_LMP_PARAM 0x20 /*!< \brief Unsupported LMP parameter value */
91 #define HCI_ERR_ROLE_CHANGE 0x21 /*!< \brief Role change not allowed */
92 #define HCI_ERR_LL_RESP_TIMEOUT 0x22 /*!< \brief LL response timeout */
93 #define HCI_ERR_LMP_COLLISION 0x23 /*!< \brief LMP error transaction collision */
94 #define HCI_ERR_LMP_PDU 0x24 /*!< \brief LMP pdu not allowed */
95 #define HCI_ERR_ENCRYPT_MODE 0x25 /*!< \brief Encryption mode not acceptable */
96 #define HCI_ERR_LINK_KEY 0x26 /*!< \brief Link key can not be changed */
97 #define HCI_ERR_UNSUP_QOS 0x27 /*!< \brief Requested qos not supported */
98 #define HCI_ERR_INSTANT_PASSED 0x28 /*!< \brief Instant passed */
99 #define HCI_ERR_UNSUP_UNIT_KEY 0x29 /*!< \brief Pairing with unit key not supported */
100 #define HCI_ERR_TRANSACT_COLLISION 0x2A /*!< \brief Different transaction collision */
101 #define HCI_ERR_CHANNEL_CLASS 0x2E /*!< \brief Channel classification not supported */
102 #define HCI_ERR_MEMORY 0x2F /*!< \brief Insufficient security */
103 #define HCI_ERR_PARAMETER_RANGE 0x30 /*!< \brief Parameter out of mandatory range */
104 #define HCI_ERR_ROLE_SWITCH_PEND 0x32 /*!< \brief Role switch pending */
105 #define HCI_ERR_RESERVED_SLOT 0x34 /*!< \brief Reserved slot violation */
106 #define HCI_ERR_ROLE_SWITCH 0x35 /*!< \brief Role switch failed */
107 #define HCI_ERR_INQ_TOO_LARGE 0x36 /*!< \brief Extended inquiry response too large */
108 #define HCI_ERR_UNSUP_SSP 0x37 /*!< \brief Secure simple pairing not supported by host */
109 #define HCI_ERR_HOST_BUSY_PAIRING 0x38 /*!< \brief Host busy - pairing */
110 #define HCI_ERR_NO_CHANNEL 0x39 /*!< \brief Connection rejected no suitable channel */
111 #define HCI_ERR_CONTROLLER_BUSY 0x3A /*!< \brief Controller busy */
112 #define HCI_ERR_CONN_INTERVAL 0x3B /*!< \brief Unacceptable connection interval */
113 #define HCI_ERR_ADV_TIMEOUT 0x3C /*!< \brief Advertising timeout */
114 #define HCI_ERR_MIC_FAILURE 0x3D /*!< \brief Connection terminated due to MIC failure */
115 #define HCI_ERR_CONN_FAIL 0x3E /*!< \brief Connection failed to be established */
116 #define HCI_ERR_MAC_CONN_FAIL 0x3F /*!< \brief MAC connection failed */
117 #define HCI_ERR_COARSE_CLK_ADJ_REJ 0x40 /*!< \brief Coarse clock adjustment rejected */
118 #define HCI_ERR_TYPE0_SUBMAP_NOT_DEF 0x41 /*!< \brief Type0 submap not defined */
119 #define HCI_ERR_UNKNOWN_ADV_ID 0x42 /*!< \brief Unknown advertising identifier */
120 #define HCI_ERR_LIMIT_REACHED 0x43 /*!< \brief Limit reached */
121 #define HCI_ERR_OP_CANCELLED_BY_HOST 0x44 /*!< \brief Operation cancelled by host */
122 /**@}*/
123 
124 /** \name Command groups
125  *
126  */
127 /**@{*/
128 #define HCI_OGF_NOP 0x00 /*!< \brief No operation */
129 #define HCI_OGF_LINK_CONTROL 0x01 /*!< \brief Link control */
130 #define HCI_OGF_LINK_POLICY 0x02 /*!< \brief Link policy */
131 #define HCI_OGF_CONTROLLER 0x03 /*!< \brief Controller and baseband */
132 #define HCI_OGF_INFORMATIONAL 0x04 /*!< \brief Informational parameters */
133 #define HCI_OGF_STATUS 0x05 /*!< \brief Status parameters */
134 #define HCI_OGF_TESTING 0x06 /*!< \brief Testing */
135 #define HCI_OGF_LE_CONTROLLER 0x08 /*!< \brief LE controller */
136 #define HCI_OGF_VENDOR_SPEC 0x3F /*!< \brief Vendor specific */
137 /**@}*/
138 
139 /** \name NOP command
140  *
141  */
142 /**@{*/
143 #define HCI_OCF_NOP 0x00
144 /**@}*/
145 
146 /** \name Link control commands
147  *
148  */
149 /**@{*/
150 #define HCI_OCF_DISCONNECT 0x06
151 #define HCI_OCF_READ_REMOTE_VER_INFO 0x1D
152 /**@}*/
153 
154 /*! \brief Link policy commands (none used for LE) */
155 
156 /** \name Controller and baseband commands
157  *
158  */
159 /**@{*/
160 #define HCI_OCF_SET_EVENT_MASK 0x01
161 #define HCI_OCF_RESET 0x03
162 #define HCI_OCF_READ_TX_PWR_LVL 0x2D
163 #define HCI_OCF_SET_CONTROLLER_TO_HOST_FC 0x31
164 #define HCI_OCF_HOST_BUFFER_SIZE 0x33
165 #define HCI_OCF_HOST_NUM_CMPL_PKTS 0x35
166 #define HCI_OCF_SET_EVENT_MASK_PAGE2 0x63
167 #define HCI_OCF_READ_AUTH_PAYLOAD_TO 0x7B
168 #define HCI_OCF_WRITE_AUTH_PAYLOAD_TO 0x7C
169 /**@}*/
170 
171 /** \name Informational commands
172  *
173  */
174 /**@{*/
175 #define HCI_OCF_READ_LOCAL_VER_INFO 0x01
176 #define HCI_OCF_READ_LOCAL_SUP_CMDS 0x02
177 #define HCI_OCF_READ_LOCAL_SUP_FEAT 0x03
178 #define HCI_OCF_READ_BUF_SIZE 0x05
179 #define HCI_OCF_READ_BD_ADDR 0x09
180 /**@}*/
181 
182 /** \name Status commands
183  *
184  */
185 /**@{*/
186 #define HCI_OCF_READ_RSSI 0x05
187 /**@}*/
188 
189 /** \name LE controller commands
190  *
191  */
192 /**@{*/
193 #define HCI_OCF_LE_SET_EVENT_MASK 0x01
194 #define HCI_OCF_LE_READ_BUF_SIZE 0x02
195 #define HCI_OCF_LE_READ_LOCAL_SUP_FEAT 0x03
196 #define HCI_OCF_LE_SET_RAND_ADDR 0x05
197 #define HCI_OCF_LE_SET_ADV_PARAM 0x06
198 #define HCI_OCF_LE_READ_ADV_TX_POWER 0x07
199 #define HCI_OCF_LE_SET_ADV_DATA 0x08
200 #define HCI_OCF_LE_SET_SCAN_RESP_DATA 0x09
201 #define HCI_OCF_LE_SET_ADV_ENABLE 0x0A
202 #define HCI_OCF_LE_SET_SCAN_PARAM 0x0B
203 #define HCI_OCF_LE_SET_SCAN_ENABLE 0x0C
204 #define HCI_OCF_LE_CREATE_CONN 0x0D
205 #define HCI_OCF_LE_CREATE_CONN_CANCEL 0x0E
206 #define HCI_OCF_LE_READ_WHITE_LIST_SIZE 0x0F
207 #define HCI_OCF_LE_CLEAR_WHITE_LIST 0x10
208 #define HCI_OCF_LE_ADD_DEV_WHITE_LIST 0x11
209 #define HCI_OCF_LE_REMOVE_DEV_WHITE_LIST 0x12
210 #define HCI_OCF_LE_CONN_UPDATE 0x13
211 #define HCI_OCF_LE_SET_HOST_CHAN_CLASS 0x14
212 #define HCI_OCF_LE_READ_CHAN_MAP 0x15
213 #define HCI_OCF_LE_READ_REMOTE_FEAT 0x16
214 #define HCI_OCF_LE_ENCRYPT 0x17
215 #define HCI_OCF_LE_RAND 0x18
216 #define HCI_OCF_LE_START_ENCRYPTION 0x19
217 #define HCI_OCF_LE_LTK_REQ_REPL 0x1A
218 #define HCI_OCF_LE_LTK_REQ_NEG_REPL 0x1B
219 #define HCI_OCF_LE_READ_SUP_STATES 0x1C
220 #define HCI_OCF_LE_RECEIVER_TEST 0x1D
221 #define HCI_OCF_LE_TRANSMITTER_TEST 0x1E
222 #define HCI_OCF_LE_TEST_END 0x1F
223 /*! \brief New in version 4.1 */
224 #define HCI_OCF_LE_REM_CONN_PARAM_REP 0x20
225 #define HCI_OCF_LE_REM_CONN_PARAM_NEG_REP 0x21
226 /*! \brief New in version 4.2 */
227 #define HCI_OCF_LE_SET_DATA_LEN 0x22
228 #define HCI_OCF_LE_READ_DEF_DATA_LEN 0x23
229 #define HCI_OCF_LE_WRITE_DEF_DATA_LEN 0x24
230 #define HCI_OCF_LE_READ_LOCAL_P256_PUB_KEY 0x25
231 #define HCI_OCF_LE_GENERATE_DHKEY 0x26
232 #define HCI_OCF_LE_ADD_DEV_RES_LIST 0x27
233 #define HCI_OCF_LE_REMOVE_DEV_RES_LIST 0x28
234 #define HCI_OCF_LE_CLEAR_RES_LIST 0x29
235 #define HCI_OCF_LE_READ_RES_LIST_SIZE 0x2A
236 #define HCI_OCF_LE_READ_PEER_RES_ADDR 0x2B
237 #define HCI_OCF_LE_READ_LOCAL_RES_ADDR 0x2C
238 #define HCI_OCF_LE_SET_ADDR_RES_ENABLE 0x2D
239 #define HCI_OCF_LE_SET_RES_PRIV_ADDR_TO 0x2E
240 #define HCI_OCF_LE_READ_MAX_DATA_LEN 0x2F
241 /*! \brief New in version 5.0 */
242 #define HCI_OCF_LE_READ_PHY 0x30
243 #define HCI_OCF_LE_SET_DEF_PHY 0x31
244 #define HCI_OCF_LE_SET_PHY 0x32
245 #define HCI_OCF_LE_ENHANCED_RECEIVER_TEST 0x33
246 #define HCI_OCF_LE_ENHANCED_TRANSMITTER_TEST 0x34
247 #define HCI_OCF_LE_SET_ADV_SET_RAND_ADDR 0x35
248 #define HCI_OCF_LE_SET_EXT_ADV_PARAM 0x36
249 #define HCI_OCF_LE_SET_EXT_ADV_DATA 0x37
250 #define HCI_OCF_LE_SET_EXT_SCAN_RESP_DATA 0x38
251 #define HCI_OCF_LE_SET_EXT_ADV_ENABLE 0x39
252 #define HCI_OCF_LE_READ_MAX_ADV_DATA_LEN 0x3A
253 #define HCI_OCF_LE_READ_NUM_SUP_ADV_SETS 0x3B
254 #define HCI_OCF_LE_REMOVE_ADV_SET 0x3C
255 #define HCI_OCF_LE_CLEAR_ADV_SETS 0x3D
256 #define HCI_OCF_LE_SET_PER_ADV_PARAM 0x3E
257 #define HCI_OCF_LE_SET_PER_ADV_DATA 0x3F
258 #define HCI_OCF_LE_SET_PER_ADV_ENABLE 0x40
259 #define HCI_OCF_LE_SET_EXT_SCAN_PARAM 0x41
260 #define HCI_OCF_LE_SET_EXT_SCAN_ENABLE 0x42
261 #define HCI_OCF_LE_EXT_CREATE_CONN 0x43
262 #define HCI_OCF_LE_PER_ADV_CREATE_SYNC 0x44
263 #define HCI_OCF_LE_PER_ADV_CREATE_SYNC_CANCEL 0x45
264 #define HCI_OCF_LE_PER_ADV_TERM_SYNC 0x46
265 #define HCI_OCF_LE_ADD_DEV_PER_ADV_LIST 0x47
266 #define HCI_OCF_LE_REMOVE_DEV_PER_ADV_LIST 0x48
267 #define HCI_OCF_LE_CLEAR_PER_ADV_LIST 0x49
268 #define HCI_OCF_LE_READ_PER_ADV_LIST_SIZE 0x4A
269 #define HCI_OCF_LE_READ_TX_POWER 0x4B
270 #define HCI_OCF_LE_READ_RF_PATH_COMP 0x4C
271 #define HCI_OCF_LE_WRITE_RF_PATH_COMP 0x4D
272 #define HCI_OCF_LE_SET_PRIVACY_MODE 0x4E
273 /**@}*/
274 
275 /** \name Opcode manipulation macros
276  *
277  */
278 /**@{*/
279 #define HCI_OPCODE(ogf, ocf) (((ogf) << 10) + (ocf))
280 #define HCI_OGF(opcode) ((opcode) >> 10)
281 #define HCI_OCF(opcode) ((opcode) & 0x03FF)
282 /**@}*/
283 
284 /** \name Command opcodes
285  *
286  */
287 /**@{*/
288 #define HCI_OPCODE_NOP HCI_OPCODE(HCI_OGF_NOP, HCI_OCF_NOP)
289 
290 #define HCI_OPCODE_DISCONNECT HCI_OPCODE(HCI_OGF_LINK_CONTROL, HCI_OCF_DISCONNECT)
291 #define HCI_OPCODE_READ_REMOTE_VER_INFO HCI_OPCODE(HCI_OGF_LINK_CONTROL, HCI_OCF_READ_REMOTE_VER_INFO)
292 
293 #define HCI_OPCODE_SET_EVENT_MASK HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_SET_EVENT_MASK)
294 #define HCI_OPCODE_RESET HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_RESET)
295 #define HCI_OPCODE_READ_TX_PWR_LVL HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_READ_TX_PWR_LVL)
296 #define HCI_OPCODE_SET_EVENT_MASK_PAGE2 HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_SET_EVENT_MASK_PAGE2)
297 #define HCI_OPCODE_READ_AUTH_PAYLOAD_TO HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_READ_AUTH_PAYLOAD_TO)
298 #define HCI_OPCODE_WRITE_AUTH_PAYLOAD_TO HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_WRITE_AUTH_PAYLOAD_TO)
299 
300 #define HCI_OPCODE_READ_LOCAL_VER_INFO HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_LOCAL_VER_INFO)
301 #define HCI_OPCODE_READ_LOCAL_SUP_CMDS HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_LOCAL_SUP_CMDS)
302 #define HCI_OPCODE_READ_LOCAL_SUP_FEAT HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_LOCAL_SUP_FEAT)
303 #define HCI_OPCODE_READ_BUF_SIZE HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_BUF_SIZE)
304 #define HCI_OPCODE_READ_BD_ADDR HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_BD_ADDR)
305 
306 #define HCI_OPCODE_READ_RSSI HCI_OPCODE(HCI_OGF_STATUS, HCI_OCF_READ_RSSI)
307 
308 #define HCI_OPCODE_LE_SET_EVENT_MASK HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EVENT_MASK)
309 #define HCI_OPCODE_LE_READ_BUF_SIZE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_BUF_SIZE)
310 #define HCI_OPCODE_LE_READ_LOCAL_SUP_FEAT HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_LOCAL_SUP_FEAT)
311 #define HCI_OPCODE_LE_SET_RAND_ADDR HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_RAND_ADDR)
312 #define HCI_OPCODE_LE_SET_ADV_PARAM HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADV_PARAM)
313 #define HCI_OPCODE_LE_READ_ADV_TX_POWER HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_ADV_TX_POWER)
314 #define HCI_OPCODE_LE_SET_ADV_DATA HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADV_DATA)
315 #define HCI_OPCODE_LE_SET_SCAN_RESP_DATA HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_SCAN_RESP_DATA)
316 #define HCI_OPCODE_LE_SET_ADV_ENABLE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADV_ENABLE)
317 #define HCI_OPCODE_LE_SET_SCAN_PARAM HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_SCAN_PARAM)
318 #define HCI_OPCODE_LE_SET_SCAN_ENABLE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_SCAN_ENABLE)
319 #define HCI_OPCODE_LE_CREATE_CONN HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CREATE_CONN)
320 #define HCI_OPCODE_LE_CREATE_CONN_CANCEL HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CREATE_CONN_CANCEL)
321 #define HCI_OPCODE_LE_READ_WHITE_LIST_SIZE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_WHITE_LIST_SIZE)
322 #define HCI_OPCODE_LE_CLEAR_WHITE_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CLEAR_WHITE_LIST)
323 #define HCI_OPCODE_LE_ADD_DEV_WHITE_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ADD_DEV_WHITE_LIST)
324 #define HCI_OPCODE_LE_REMOVE_DEV_WHITE_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_REMOVE_DEV_WHITE_LIST)
325 #define HCI_OPCODE_LE_CONN_UPDATE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CONN_UPDATE)
326 #define HCI_OPCODE_LE_SET_HOST_CHAN_CLASS HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_HOST_CHAN_CLASS)
327 #define HCI_OPCODE_LE_READ_CHAN_MAP HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_CHAN_MAP)
328 #define HCI_OPCODE_LE_READ_REMOTE_FEAT HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_REMOTE_FEAT)
329 #define HCI_OPCODE_LE_ENCRYPT HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ENCRYPT)
330 #define HCI_OPCODE_LE_RAND HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_RAND)
331 #define HCI_OPCODE_LE_START_ENCRYPTION HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_START_ENCRYPTION)
332 #define HCI_OPCODE_LE_LTK_REQ_REPL HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_LTK_REQ_REPL)
333 #define HCI_OPCODE_LE_LTK_REQ_NEG_REPL HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_LTK_REQ_NEG_REPL)
334 #define HCI_OPCODE_LE_READ_SUP_STATES HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_SUP_STATES)
335 #define HCI_OPCODE_LE_RECEIVER_TEST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_RECEIVER_TEST)
336 #define HCI_OPCODE_LE_TRANSMITTER_TEST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_TRANSMITTER_TEST)
337 #define HCI_OPCODE_LE_TEST_END HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_TEST_END)
338 /*! \brief New in version 4.1 */
339 #define HCI_OPCODE_LE_REM_CONN_PARAM_REP HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_REM_CONN_PARAM_REP)
340 #define HCI_OPCODE_LE_REM_CONN_PARAM_NEG_REP HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_REM_CONN_PARAM_NEG_REP)
341 /*! \brief New in version 4.2 */
342 #define HCI_OPCODE_LE_SET_DATA_LEN HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_DATA_LEN)
343 #define HCI_OPCODE_LE_READ_DEF_DATA_LEN HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_DEF_DATA_LEN)
344 #define HCI_OPCODE_LE_WRITE_DEF_DATA_LEN HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_WRITE_DEF_DATA_LEN)
345 #define HCI_OPCODE_LE_READ_LOCAL_P256_PUB_KEY HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_LOCAL_P256_PUB_KEY)
346 #define HCI_OPCODE_LE_GENERATE_DHKEY HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_GENERATE_DHKEY)
347 #define HCI_OPCODE_LE_ADD_DEV_RES_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ADD_DEV_RES_LIST)
348 #define HCI_OPCODE_LE_REMOVE_DEV_RES_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_REMOVE_DEV_RES_LIST)
349 #define HCI_OPCODE_LE_CLEAR_RES_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CLEAR_RES_LIST)
350 #define HCI_OPCODE_LE_READ_RES_LIST_SIZE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_RES_LIST_SIZE)
351 #define HCI_OPCODE_LE_READ_PEER_RES_ADDR HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_PEER_RES_ADDR)
352 #define HCI_OPCODE_LE_READ_LOCAL_RES_ADDR HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_LOCAL_RES_ADDR)
353 #define HCI_OPCODE_LE_SET_ADDR_RES_ENABLE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADDR_RES_ENABLE)
354 #define HCI_OPCODE_LE_SET_RES_PRIV_ADDR_TO HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_RES_PRIV_ADDR_TO)
355 #define HCI_OPCODE_LE_READ_MAX_DATA_LEN HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_MAX_DATA_LEN)
356 /*! \brief New in version 5.0 */
357 #define HCI_OPCODE_LE_READ_PHY HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_PHY)
358 #define HCI_OPCODE_LE_SET_DEF_PHY HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_DEF_PHY)
359 #define HCI_OPCODE_LE_SET_PHY HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_PHY)
360 #define HCI_OPCODE_LE_ENHANCED_RECEIVER_TEST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ENHANCED_RECEIVER_TEST)
361 #define HCI_OPCODE_LE_ENHANCED_TRANSMITTER_TEST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ENHANCED_TRANSMITTER_TEST)
362 #define HCI_OPCODE_LE_SET_ADV_SET_RAND_ADDR HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADV_SET_RAND_ADDR)
363 #define HCI_OPCODE_LE_SET_EXT_ADV_PARAM HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EXT_ADV_PARAM)
364 #define HCI_OPCODE_LE_SET_EXT_ADV_DATA HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EXT_ADV_DATA)
365 #define HCI_OPCODE_LE_SET_EXT_SCAN_RESP_DATA HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EXT_SCAN_RESP_DATA)
366 #define HCI_OPCODE_LE_SET_EXT_ADV_ENABLE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EXT_ADV_ENABLE)
367 #define HCI_OPCODE_LE_READ_MAX_ADV_DATA_LEN HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_MAX_ADV_DATA_LEN)
368 #define HCI_OPCODE_LE_READ_NUM_SUP_ADV_SETS HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_NUM_SUP_ADV_SETS)
369 #define HCI_OPCODE_LE_REMOVE_ADV_SET HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_REMOVE_ADV_SET)
370 #define HCI_OPCODE_LE_CLEAR_ADV_SETS HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CLEAR_ADV_SETS)
371 #define HCI_OPCODE_LE_SET_PER_ADV_PARAM HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_PER_ADV_PARAM)
372 #define HCI_OPCODE_LE_SET_PER_ADV_DATA HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_PER_ADV_DATA)
373 #define HCI_OPCODE_LE_SET_PER_ADV_ENABLE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_PER_ADV_ENABLE)
374 #define HCI_OPCODE_LE_SET_EXT_SCAN_PARAM HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EXT_SCAN_PARAM)
375 #define HCI_OPCODE_LE_SET_EXT_SCAN_ENABLE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EXT_SCAN_ENABLE)
376 #define HCI_OPCODE_LE_EXT_CREATE_CONN HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_EXT_CREATE_CONN)
377 #define HCI_OPCODE_LE_PER_ADV_CREATE_SYNC HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_PER_ADV_CREATE_SYNC)
378 #define HCI_OPCODE_LE_PER_ADV_CREATE_SYNC_CANCEL HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_PER_ADV_CREATE_SYNC_CANCEL)
379 #define HCI_OPCODE_LE_PER_ADV_TERMINATE_SYNC HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_PER_ADV_TERM_SYNC)
380 #define HCI_OPCODE_LE_ADD_DEV_PER_ADV_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ADD_DEV_PER_ADV_LIST)
381 #define HCI_OPCODE_LE_REMOVE_DEV_PER_ADV_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_REMOVE_DEV_PER_ADV_LIST)
382 #define HCI_OPCODE_LE_CLEAR_PER_ADV_LIST HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CLEAR_PER_ADV_LIST)
383 #define HCI_OPCODE_LE_READ_PER_ADV_LIST_SIZE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_PER_ADV_LIST_SIZE)
384 #define HCI_OPCODE_LE_READ_TX_POWER HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_TX_POWER)
385 #define HCI_OPCODE_LE_WRITE_RF_PATH_COMP HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_WRITE_RF_PATH_COMP)
386 #define HCI_OPCODE_LE_READ_RF_PATH_COMP HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_RF_PATH_COMP)
387 #define HCI_OPCODE_LE_SET_PRIVACY_MODE HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_PRIVACY_MODE)
388 /**@}*/
389 
390 /** \name ARM Vendor Specific
391  *
392  */
393 /**@{*/
394 #define HCI_OPCODE_LE_VS_ENABLE_READ_FEAT_ON_CONN ((uint16_t)(0xfff3))
395 /**@}*/
396 
397 /** \name Command parameter lengths
398  *
399  */
400 /**@{*/
401 #define HCI_LEN_NOP 0
402 
403 #define HCI_LEN_DISCONNECT 3
404 #define HCI_LEN_READ_REMOTE_VER_INFO 2
405 
406 #define HCI_LEN_SET_EVENT_MASK 8
407 #define HCI_LEN_SET_EVENT_MASK_PAGE2 8
408 #define HCI_LEN_RESET 0
409 #define HCI_LEN_READ_TX_PWR_LVL 3
410 #define HCI_LEN_SET_CONTROLLER_TO_HOST_FC 1
411 #define HCI_LEN_HOST_BUFFER_SIZE 8
412 #define HCI_LEN_HOST_NUM_CMPL_PKTS 1
413 
414 #define HCI_LEN_READ_LOCAL_VER_INFO 0
415 #define HCI_LEN_READ_LOCAL_SUP_CMDS 0
416 #define HCI_LEN_READ_LOCAL_SUP_FEAT 0
417 #define HCI_LEN_READ_BUF_SIZE 0
418 #define HCI_LEN_READ_BD_ADDR 0
419 
420 #define HCI_LEN_READ_RSSI 2
421 #define HCI_LEN_READ_AUTH_PAYLOAD_TO 2
422 #define HCI_LEN_WRITE_AUTH_PAYLOAD_TO 4
423 
424 #define HCI_LEN_LE_SET_EVENT_MASK 8
425 #define HCI_LEN_LE_READ_BUF_SIZE 0
426 #define HCI_LEN_LE_READ_LOCAL_SUP_FEAT 0
427 #define HCI_LEN_LE_SET_RAND_ADDR 6
428 #define HCI_LEN_LE_SET_ADV_PARAM 15
429 #define HCI_LEN_LE_READ_ADV_TX_POWER 0
430 #define HCI_LEN_LE_SET_ADV_DATA 32
431 #define HCI_LEN_LE_SET_SCAN_RESP_DATA 32
432 #define HCI_LEN_LE_SET_ADV_ENABLE 1
433 #define HCI_LEN_LE_SET_SCAN_PARAM 7
434 #define HCI_LEN_LE_SET_SCAN_ENABLE 2
435 #define HCI_LEN_LE_CREATE_CONN 25
436 #define HCI_LEN_LE_CREATE_CONN_CANCEL 0
437 #define HCI_LEN_LE_READ_WHITE_LIST_SIZE 0
438 #define HCI_LEN_LE_CLEAR_WHITE_LIST 0
439 #define HCI_LEN_LE_ADD_DEV_WHITE_LIST 7
440 #define HCI_LEN_LE_REMOVE_DEV_WHITE_LIST 7
441 #define HCI_LEN_LE_CONN_UPDATE 14
442 #define HCI_LEN_LE_SET_HOST_CHAN_CLASS 5
443 #define HCI_LEN_LE_READ_CHAN_MAP 2
444 #define HCI_LEN_LE_READ_REMOTE_FEAT 2
445 #define HCI_LEN_LE_ENCRYPT 32
446 #define HCI_LEN_LE_RAND 0
447 #define HCI_LEN_LE_START_ENCRYPTION 28
448 #define HCI_LEN_LE_LTK_REQ_REPL 18
449 #define HCI_LEN_LE_LTK_REQ_NEG_REPL 2
450 #define HCI_LEN_LE_READ_SUP_STATES 0
451 #define HCI_LEN_LE_RECEIVER_TEST 1
452 #define HCI_LEN_LE_TRANSMITTER_TEST 3
453 #define HCI_LEN_LE_TEST_END 0
454 /*! \brief New in version 4.1 */
455 #define HCI_LEN_LE_REM_CONN_PARAM_REP 14
456 #define HCI_LEN_LE_REM_CONN_PARAM_NEG_REP 3
457 /*! \brief New in version 4.2 */
458 #define HCI_LEN_LE_SET_DATA_LEN 6
459 #define HCI_LEN_LE_READ_DEF_DATA_LEN 0
460 #define HCI_LEN_LE_WRITE_DEF_DATA_LEN 4
461 #define HCI_LEN_LE_READ_LOCAL_P256_PUB_KEY 0
462 #define HCI_LEN_LE_GENERATE_DHKEY 64
463 #define HCI_LEN_LE_ADD_DEV_RES_LIST 39
464 #define HCI_LEN_LE_REMOVE_DEV_RES_LIST 7
465 #define HCI_LEN_LE_CLEAR_RES_LIST 0
466 #define HCI_LEN_LE_READ_RES_LIST_SIZE 0
467 #define HCI_LEN_LE_READ_PEER_RES_ADDR 7
468 #define HCI_LEN_LE_READ_LOCAL_RES_ADDR 7
469 #define HCI_LEN_LE_SET_ADDR_RES_ENABLE 1
470 #define HCI_LEN_LE_SET_RES_PRIV_ADDR_TO 2
471 #define HCI_LEN_LE_READ_MAX_DATA_LEN 0
472 /*! \brief New in version 5.0 */
473 #define HCI_LEN_LE_READ_PHY 2
474 #define HCI_LEN_LE_SET_DEF_PHY 3
475 #define HCI_LEN_LE_SET_PHY 7
476 #define HCI_LEN_LE_ENHANCED_RECEIVER_TEST 3
477 #define HCI_LEN_LE_ENHANCED_TRANSMITTER_TEST 4
478 #define HCI_LEN_LE_SET_ADV_SET_RAND_ADDR 7
479 #define HCI_LEN_LE_SET_EXT_ADV_PARAM 25
480 #define HCI_LEN_LE_SET_EXT_ADV_DATA(len) (4 + (len))
481 #define HCI_LEN_LE_SET_EXT_SCAN_RESP_DATA(len) (4 + (len))
482 #define HCI_LEN_LE_EXT_ADV_ENABLE(numSets) (2 + (4 * (numSets)))
483 #define HCI_LEN_LE_READ_MAX_ADV_DATA_LEN 0
484 #define HCI_LEN_LE_READ_NUM_OF_SUP_ADV_SETS 0
485 #define HCI_LEN_LE_REMOVE_ADV_SET 1
486 #define HCI_LEN_LE_CLEAR_ADV_SETS 0
487 #define HCI_LEN_LE_SET_PER_ADV_PARAM 7
488 #define HCI_LEN_LE_SET_PER_ADV_DATA(len) (3 + (len))
489 #define HCI_LEN_LE_SET_PER_ADV_ENABLE 2
490 #define HCI_LEN_LE_SET_EXT_SCAN_PARAM(numPhys) (3 + (5 * (numPhys)))
491 #define HCI_LEN_LE_SET_EXT_SCAN_ENABLE 6
492 #define HCI_LEN_LE_EXT_CREATE_CONN(numPhys) (10 + (16 * (numPhys)))
493 #define HCI_LEN_LE_PER_ADV_CREATE_SYNC 14
494 #define HCI_LEN_LE_PER_ADV_CREATE_SYNC_CANCEL 0
495 #define HCI_LEN_LE_PER_ADV_TERMINATE_SYNC 2
496 #define HCI_LEN_LE_ADD_DEV_PER_ADV_LIST 8
497 #define HCI_LEN_LE_REMOVE_DEV_PER_ADV_LIST 8
498 #define HCI_LEN_LE_CLEAR_PER_ADV_LIST 0
499 #define HCI_LEN_LE_READ_PER_ADV_LIST_SIZE 0
500 #define HCI_LEN_LE_READ_TX_POWER 0
501 #define HCI_LEN_LE_READ_RF_PATH_COMP 0
502 #define HCI_LEN_LE_WRITE_RF_PATH_COMP 4
503 #define HCI_LEN_LE_SET_PRIVACY_MODE 8
504 /**@}*/
505 
506 /** \name Events
507  *
508  */
509 /**@{*/
510 #define HCI_DISCONNECT_CMPL_EVT 0x05
511 #define HCI_ENC_CHANGE_EVT 0x08
512 #define HCI_READ_REMOTE_VER_INFO_CMPL_EVT 0x0C
513 #define HCI_CMD_CMPL_EVT 0x0E
514 #define HCI_CMD_STATUS_EVT 0x0F
515 #define HCI_HW_ERROR_EVT 0x10
516 #define HCI_NUM_CMPL_PKTS_EVT 0x13
517 #define HCI_DATA_BUF_OVERFLOW_EVT 0x1A
518 #define HCI_ENC_KEY_REFRESH_CMPL_EVT 0x30
519 #define HCI_LE_META_EVT 0x3E
520 #define HCI_AUTH_PAYLOAD_TIMEOUT_EVT 0x57
521 #define HCI_VENDOR_SPEC_EVT 0xFF
522 /**@}*/
523 
524 /** \name LE Subevents
525  *
526  */
527 /**@{*/
528 #define HCI_LE_CONN_CMPL_EVT 0x01
529 #define HCI_LE_ADV_REPORT_EVT 0x02
530 #define HCI_LE_CONN_UPDATE_CMPL_EVT 0x03
531 #define HCI_LE_READ_REMOTE_FEAT_CMPL_EVT 0x04
532 #define HCI_LE_LTK_REQ_EVT 0x05
533 /*! \brief New in version 4.1 */
534 #define HCI_LE_REM_CONN_PARAM_REQ_EVT 0x06
535 /*! \brief New in version 4.2 */
536 #define HCI_LE_DATA_LEN_CHANGE_EVT 0x07
537 #define HCI_LE_READ_LOCAL_P256_PUB_KEY_CMPL_EVT 0x08
538 #define HCI_LE_GENERATE_DHKEY_CMPL_EVT 0x09
539 #define HCI_LE_ENHANCED_CONN_CMPL_EVT 0x0A
540 #define HCI_LE_DIRECT_ADV_REPORT_EVT 0x0B
541 /*! \brief New in version 5.0 */
542 #define HCI_LE_PHY_UPDATE_CMPL_EVT 0x0C
543 #define HCI_LE_EXT_ADV_REPORT_EVT 0x0D
544 #define HCI_LE_PER_ADV_SYNC_EST_EVT 0x0E
545 #define HCI_LE_PER_ADV_REPORT_EVT 0x0F
546 #define HCI_LE_PER_ADV_SYNC_LOST_EVT 0x10
547 #define HCI_LE_SCAN_TIMEOUT_EVT 0x11
548 #define HCI_LE_ADV_SET_TERM_EVT 0x12
549 #define HCI_LE_SCAN_REQ_RCVD_EVT 0x13
550 #define HCI_LE_CH_SEL_ALGO_EVT 0x14
551 /**@}*/
552 
553 /** \name Event parameter lengths
554  *
555  */
556 /**@{*/
557 #define HCI_LEN_DISCONNECT_CMPL 4 /*!< \brief Disconnect event length. */
558 #define HCI_LEN_READ_REMOTE_VER_INFO_CMPL 8 /*!< \brief Read remove version info complete event length. */
559 #define HCI_LEN_CMD_CMPL 3 /*!< \brief Command complete event length. */
560 #define HCI_LEN_CMD_STATUS 4 /*!< \brief Command status event length. */
561 #define HCI_LEN_HW_ERR 1 /*!< \brief Hardware error event length. */
562 #define HCI_LEN_NUM_CMPL_PKTS 5 /*!< \brief Number of completed packets event length. */
563 #define HCI_LEN_ENC_CHANGE 4 /*!< \brief Encryption change event length. */
564 #define HCI_LEN_ENC_KEY_REFRESH_CMPL 3 /*!< \brief Encryption key refresh complete event length. */
565 #define HCI_LEN_LE_CONN_CMPL 19 /*!< \brief Connection complete event length. */
566 #define HCI_LEN_LE_ADV_RPT_MIN 12 /*!< \brief Advertising report event minimum length. */
567 #define HCI_LEN_LE_CONN_UPDATE_CMPL 10 /*!< \brief Connection update complete event length. */
568 #define HCI_LEN_LE_READ_REMOTE_FEAT_CMPL 12 /*!< \brief Read remote feature event length. */
569 #define HCI_LEN_LE_LTK_REQ 13 /*!< \brief LTK request event length. */
570 /*! \brief New in version 4.1 */
571 #define HCI_LEN_LE_REM_CONN_PARAM_REQ 11 /*!< \brief Remote connection parameter event length. */
572 #define HCI_LEN_LE_DATA_LEN_CHANGE 11 /*!< \brief Data length change event length. */
573 #define HCI_LEN_LE_READ_PUB_KEY_CMPL 66 /*!< \brief Read local P256 public key compete event length. */
574 #define HCI_LEN_LE_GEN_DHKEY_CMPL 34 /*!< \brief Generate DH key complete event length. */
575 #define HCI_LEN_LE_ENHANCED_CONN_CMPL 31 /*!< \brief Enhanced connection complete event length. */
576 #define HCI_LEN_LE_DIRECT_ADV_REPORT 18 /*!< \brief Direct advertising report event length. */
577 #define HCI_LEN_AUTH_PAYLOAD_TIMEOUT 2 /*!< \brief Authenticated payload timeout event length. */
578 /*! \brief New in version 5.0 */
579 #define HCI_LEN_LE_PHY_UPDATE_CMPL 6 /*!< \brief PHY update complete event length. */
580 #define HCI_LEN_LE_CH_SEL_ALGO 4 /*!< \brief Channel selection algorithm event length. */
581 #define HCI_LEN_LE_PHY_UPDATE_CMPL 6 /*!< \brief PHY update complete event length. */
582 #define HCI_LEN_LE_EXT_ADV_REPORT_MIN 26 /*!< \brief Extended advertising report minimum length. */
583 #define HCI_LEN_LE_PER_ADV_SYNC_EST 16 /*!< \brief Periodic advertising sync established event length. */
584 #define HCI_LEN_LE_PER_ADV_REPORT 8 /*!< \brief Periodic advertising report event length. */
585 #define HCI_LEN_LE_PER_ADV_SYNC_LOST 3 /*!< \brief Periodic advertising sync lost event length. */
586 #define HCI_LEN_LE_SCAN_TIMEOUT 1 /*!< \brief Scan timeout event length. */
587 #define HCI_LEN_LE_ADV_SET_TERM 6 /*!< \brief Advertising set terminated event length. */
588 #define HCI_LEN_LE_SCAN_REQ_RCVD 9 /*!< \brief Scan request received event length. */
589 /**@}*/
590 
591 /** \name Supported commands
592  *
593  */
594 /**@{*/
595 #define HCI_SUP_DISCONNECT 0x20 /*!< \brief Byte 0 */
596 #define HCI_SUP_READ_REMOTE_VER_INFO 0x80 /*!< \brief Byte 2 */
597 #define HCI_SUP_SET_EVENT_MASK 0x40 /*!< \brief Byte 5 */
598 #define HCI_SUP_RESET 0x80 /*!< \brief Byte 5 */
599 #define HCI_SUP_READ_TX_PWR_LVL 0x04 /*!< \brief Byte 10 */
600 #define HCI_SUP_READ_LOCAL_VER_INFO 0x08 /*!< \brief Byte 14 */
601 #define HCI_SUP_READ_LOCAL_SUP_FEAT 0x20 /*!< \brief Byte 14 */
602 #define HCI_SUP_READ_BD_ADDR 0x02 /*!< \brief Byte 15 */
603 #define HCI_SUP_READ_RSSI 0x20 /*!< \brief Byte 15 */
604 #define HCI_SUP_SET_EVENT_MASK_PAGE2 0x04 /*!< \brief Byte 22 */
605 #define HCI_SUP_LE_SET_EVENT_MASK 0x01 /*!< \brief Byte 25 */
606 #define HCI_SUP_LE_READ_BUF_SIZE 0x02 /*!< \brief Byte 25 */
607 #define HCI_SUP_LE_READ_LOCAL_SUP_FEAT 0x04 /*!< \brief Byte 25 */
608 #define HCI_SUP_LE_SET_RAND_ADDR 0x10 /*!< \brief Byte 25 */
609 #define HCI_SUP_LE_SET_ADV_PARAM 0x20 /*!< \brief Byte 25 */
610 #define HCI_SUP_LE_READ_ADV_TX_POWER 0x40 /*!< \brief Byte 25 */
611 #define HCI_SUP_LE_SET_ADV_DATA 0x80 /*!< \brief Byte 25 */
612 #define HCI_SUP_LE_SET_SCAN_RESP_DATA 0x01 /*!< \brief Byte 26 */
613 #define HCI_SUP_LE_SET_ADV_ENABLE 0x02 /*!< \brief Byte 26 */
614 #define HCI_SUP_LE_SET_SCAN_PARAM 0x04 /*!< \brief Byte 26 */
615 #define HCI_SUP_LE_SET_SCAN_ENABLE 0x08 /*!< \brief Byte 26 */
616 #define HCI_SUP_LE_CREATE_CONN 0x10 /*!< \brief Byte 26 */
617 #define HCI_SUP_LE_CREATE_CONN_CANCEL 0x20 /*!< \brief Byte 26 */
618 #define HCI_SUP_LE_READ_WHITE_LIST_SIZE 0x40 /*!< \brief Byte 26 */
619 #define HCI_SUP_LE_CLEAR_WHITE_LIST 0x80 /*!< \brief Byte 26 */
620 #define HCI_SUP_LE_ADD_DEV_WHITE_LIST 0x01 /*!< \brief Byte 27 */
621 #define HCI_SUP_LE_REMOVE_DEV_WHITE_LIST 0x02 /*!< \brief Byte 27 */
622 #define HCI_SUP_LE_CONN_UPDATE 0x04 /*!< \brief Byte 27 */
623 #define HCI_SUP_LE_SET_HOST_CHAN_CLASS 0x08 /*!< \brief Byte 27 */
624 #define HCI_SUP_LE_READ_CHAN_MAP 0x10 /*!< \brief Byte 27 */
625 #define HCI_SUP_LE_READ_REMOTE_FEAT 0x20 /*!< \brief Byte 27 */
626 #define HCI_SUP_LE_ENCRYPT 0x40 /*!< \brief Byte 27 */
627 #define HCI_SUP_LE_RAND 0x80 /*!< \brief Byte 27 */
628 #define HCI_SUP_LE_START_ENCRYPTION 0x01 /*!< \brief Byte 28 */
629 #define HCI_SUP_LE_LTK_REQ_REPL 0x02 /*!< \brief Byte 28 */
630 #define HCI_SUP_LE_LTK_REQ_NEG_REPL 0x04 /*!< \brief Byte 28 */
631 #define HCI_SUP_LE_READ_SUP_STATES 0x08 /*!< \brief Byte 28 */
632 #define HCI_SUP_LE_RECEIVER_TEST 0x10 /*!< \brief Byte 28 */
633 #define HCI_SUP_LE_TRANSMITTER_TEST 0x20 /*!< \brief Byte 28 */
634 #define HCI_SUP_LE_TEST_END 0x40 /*!< \brief Byte 28 */
635 #define HCI_SUP_READ_AUTH_PAYLOAD_TO 0x10 /*!< \brief Byte 32 */
636 #define HCI_SUP_WRITE_AUTH_PAYLOAD_TO 0x20 /*!< \brief Byte 32 */
637 /*! \brief New in version 4.1 */
638 #define HCI_SUP_LE_REM_CONN_PARAM_REQ_REPL 0x10 /*!< \brief Byte 33 */
639 #define HCI_SUP_LE_REM_CONN_PARAM_REQ_NEG_REPL 0x20 /*!< \brief Byte 33 */
640 /*! \brief New in version 4.2 */
641 #define HCI_SUP_LE_SET_DATA_LEN 0x40 /*!< \brief Byte 33 */
642 #define HCI_SUP_LE_READ_DEF_DATA_LEN 0x80 /*!< \brief Byte 33 */
643 #define HCI_SUP_LE_WRITE_DEF_DATA_LEN 0x01 /*!< \brief Byte 34 */
644 #define HCI_SUP_LE_READ_LOCAL_P256_PUB_KEY 0x02 /*!< \brief Byte 34 */
645 #define HCI_SUP_LE_GENERATE_DHKEY 0x04 /*!< \brief Byte 34 */
646 #define HCI_SUP_LE_ADD_DEV_RES_LIST_EVT 0x08 /*!< \brief Byte 34 */
647 #define HCI_SUP_LE_REMOVE_DEV_RES_LIST 0x10 /*!< \brief Byte 34 */
648 #define HCI_SUP_LE_CLEAR_RES_LIST 0x20 /*!< \brief Byte 34 */
649 #define HCI_SUP_LE_READ_RES_LIST_SIZE 0x40 /*!< \brief Byte 34 */
650 #define HCI_SUP_LE_READ_PEER_RES_ADDR 0x80 /*!< \brief Byte 34 */
651 #define HCI_SUP_LE_READ_LOCAL_RES_ADDR 0x01 /*!< \brief Byte 35 */
652 #define HCI_SUP_LE_SET_ADDR_RES_ENABLE 0x02 /*!< \brief Byte 35 */
653 #define HCI_SUP_LE_SET_RES_PRIV_ADDR_TO 0x04 /*!< \brief Byte 35 */
654 #define HCI_SUP_LE_READ_MAX_DATA_LEN 0x08 /*!< \brief Byte 35 */
655 /*! \brief New in version 5.0 */
656 #define HCI_SUP_LE_READ_PHY 0x10 /*!< \brief Byte 35 */
657 #define HCI_SUP_LE_SET_DEF_PHY 0x20 /*!< \brief Byte 35 */
658 #define HCI_SUP_LE_SET_PHY 0x40 /*!< \brief Byte 35 */
659 #define HCI_SUP_LE_ENHANCED_RECEIVER_TEST 0x80 /*!< \brief Byte 35 */
660 #define HCI_SUP_LE_ENHANCED_TRANSMITTER_TEST 0x01 /*!< \brief Byte 36 */
661 #define HCI_SUP_LE_SET_ADV_SET_RAND_ADDR 0x02 /*!< \brief Byte 36 */
662 #define HCI_SUP_LE_SET_EXT_ADV_PARAM 0x04 /*!< \brief Byte 36 */
663 #define HCI_SUP_LE_SET_EXT_ADV_DATA 0x08 /*!< \brief Byte 36 */
664 #define HCI_SUP_LE_SET_EXT_SCAN_RESP_DATA 0x10 /*!< \brief Byte 36 */
665 #define HCI_SUP_LE_SET_EXT_ADV_ENABLE 0x20 /*!< \brief Byte 36 */
666 #define HCI_SUP_LE_READ_MAX_ADV_DATA_LEN 0x40 /*!< \brief Byte 36 */
667 #define HCI_SUP_LE_READ_NUM_OF_SUP_ADV_SETS 0x80 /*!< \brief Byte 36 */
668 #define HCI_SUP_LE_REMOVE_ADV_SET 0x01 /*!< \brief Byte 37 */
669 #define HCI_SUP_LE_CLEAR_ADV_SETS 0x02 /*!< \brief Byte 37 */
670 #define HCI_SUP_LE_SET_PER_ADV_PARAM 0x04 /*!< \brief Byte 37 */
671 #define HCI_SUP_LE_SET_PER_ADV_DATA 0x08 /*!< \brief Byte 37 */
672 #define HCI_SUP_LE_SET_PER_ADV_ENABLE 0x10 /*!< \brief Byte 37 */
673 #define HCI_SUP_LE_SET_EXT_SCAN_PARAM 0x20 /*!< \brief Byte 37 */
674 #define HCI_SUP_LE_SET_EXT_SCAN_ENABLE 0x40 /*!< \brief Byte 37 */
675 #define HCI_SUP_LE_EXT_CREATE_CONN 0x80 /*!< \brief Byte 37 */
676 #define HCI_SUP_LE_PER_ADV_CREATE_SYNC 0x01 /*!< \brief Byte 38 */
677 #define HCI_SUP_LE_PER_ADV_CREATE_SYNC_CANCEL 0x02 /*!< \brief Byte 38 */
678 #define HCI_SUP_LE_PER_ADV_TERMINATE_SYNC 0x04 /*!< \brief Byte 38 */
679 #define HCI_SUP_LE_ADD_DEV_PER_ADV_LIST 0x08 /*!< \brief Byte 38 */
680 #define HCI_SUP_LE_REMOVE_DEV_PER_ADV_LIST 0x10 /*!< \brief Byte 38 */
681 #define HCI_SUP_LE_CLEAR_PER_ADV_LIST 0x20 /*!< \brief Byte 38 */
682 #define HCI_SUP_LE_READ_PER_ADV_LIST_SIZE 0x40 /*!< \brief Byte 38 */
683 #define HCI_SUP_LE_READ_TX_POWER 0x80 /*!< \brief Byte 38 */
684 #define HCI_SUP_LE_READ_RF_PATH_COMP 0x01 /*!< \brief Byte 39 */
685 #define HCI_SUP_LE_WRITE_RF_PATH_COMP 0x02 /*!< \brief Byte 39 */
686 #define HCI_SUP_LE_SET_PRIVACY_MODE 0x04 /*!< \brief Byte 39 */
687 #define HCI_SUP_LE_SET_MIN_NUM_OF_USED_CH 0x08 /*!< \brief Byte 39 */
688 /**@}*/
689 
690 /** \name Event mask
691  *
692  */
693 /**@{*/
694 #define HCI_EVT_MASK_DISCONNECT_CMPL 0x10 /*!< \brief Byte 0 */
695 #define HCI_EVT_MASK_ENC_CHANGE 0x80 /*!< \brief Byte 0 */
696 #define HCI_EVT_MASK_READ_REMOTE_VER_INFO_CMPL 0x08 /*!< \brief Byte 1 */
697 #define HCI_EVT_MASK_HW_ERROR 0x80 /*!< \brief Byte 1 */
698 #define HCI_EVT_MASK_DATA_BUF_OVERFLOW 0x02 /*!< \brief Byte 3 */
699 #define HCI_EVT_MASK_ENC_KEY_REFRESH_CMPL 0x80 /*!< \brief Byte 5 */
700 #define HCI_EVT_MASK_LE_META 0x20 /*!< \brief Byte 7 */
701 /**@}*/
702 
703 /** \name Event mask page 2
704  *
705  */
706 /**@{*/
707 #define HCI_EVT_MASK_AUTH_PAYLOAD_TIMEOUT 0x80 /*!< \brief Byte 2 */
708 /**@}*/
709 
710 /** \name LE event mask
711  *
712  */
713 /**@{*/
714 #define HCI_EVT_MASK_LE_CONN_CMPL_EVT 0x01 /*!< \brief Byte 0 */
715 #define HCI_EVT_MASK_LE_ADV_REPORT_EVT 0x02 /*!< \brief Byte 0 */
716 #define HCI_EVT_MASK_LE_CONN_UPDATE_CMPL_EVT 0x04 /*!< \brief Byte 0 */
717 #define HCI_EVT_MASK_LE_READ_REMOTE_FEAT_CMPL_EVT 0x08 /*!< \brief Byte 0 */
718 #define HCI_EVT_MASK_LE_LTK_REQ_EVT 0x10 /*!< \brief Byte 0 */
719 /*! \brief New in version 4.1 */
720 #define HCI_EVT_MASK_LE_REMOTE_CONN_PARAM_REQ_EVT 0x20 /*!< \brief Byte 0 */
721 /*! \brief New in version 4.2 */
722 #define HCI_EVT_MASK_LE_DATA_LEN_CHANGE_EVT 0x40 /*!< \brief Byte 0 */
723 #define HCI_EVT_MASK_LE_READ_LOCAL_P256_PUB_KEY_CMPL 0x80 /*!< \brief Byte 0 */
724 #define HCI_EVT_MASK_LE_GENERATE_DHKEY_CMPL 0x01 /*!< \brief Byte 1 */
725 #define HCI_EVT_MASK_LE_ENHANCED_CONN_CMPL_EVT 0x02 /*!< \brief Byte 1 */
726 #define HCI_EVT_MASK_LE_DIRECT_ADV_REPORT_EVT 0x04 /*!< \brief Byte 1 */
727 /*! \brief New in version 5.0 */
728 #define HCI_EVT_MASK_LE_PHY_UPDATE_CMPL_EVT 0x08 /*!< \brief Byte 1 */
729 #define HCI_EVT_MASK_LE_EXT_ADV_REPORT_EVT 0x10 /*!< \brief Byte 1 */
730 #define HCI_EVT_MASK_LE_PER_ADV_SYNC_EST_EVT 0x20 /*!< \brief Byte 1 */
731 #define HCI_EVT_MASK_LE_PER_ADV_REPORT_EVT 0x40 /*!< \brief Byte 1 */
732 #define HCI_EVT_MASK_LE_PER_ADV_SYNC_LOST_EVT 0x80 /*!< \brief Byte 1 */
733 #define HCI_EVT_MASK_LE_SCAN_TIMEOUT_EVT 0x01 /*!< \brief Byte 2 */
734 #define HCI_EVT_MASK_LE_ADV_SET_TERM_EVT 0x02 /*!< \brief Byte 2 */
735 #define HCI_EVT_MASK_LE_SCAN_REQ_RCVD_EVT 0x04 /*!< \brief Byte 2 */
736 #define HCI_EVT_MASK_LE_CH_SEL_ALGO_EVT 0x08 /*!< \brief Byte 2 */
737 /**@}*/
738 
739 /** \name LE supported features
740  *
741  */
742 /**@{*/
743 /*! \brief New in version 4.0 */
744 #define HCI_LE_SUP_FEAT_ENCRYPTION 0x0001 /*!< \brief Encryption supported */
745 /*! \brief New in version 4.1 */
746 #define HCI_LE_SUP_FEAT_CONN_PARAM_REQ_PROC 0x0002 /*!< \brief Connection Parameters Request Procedure supported */
747 #define HCI_LE_SUP_FEAT_EXT_REJECT_IND 0x0004 /*!< \brief Extended Reject Indication supported */
748 #define HCI_LE_SUP_FEAT_SLV_INIT_FEAT_EXCH 0x0008 /*!< \brief Slave-Initiated Features Exchange supported */
749 #define HCI_LE_SUP_FEAT_LE_PING 0x0010 /*!< \brief LE Ping supported */
750 /*! \brief New in version 4.2 */
751 #define HCI_LE_SUP_FEAT_DATA_LEN_EXT 0x0020 /*!< \brief Data Length Extension supported */
752 #define HCI_LE_SUP_FEAT_PRIVACY 0x0040 /*!< \brief LL Privacy supported */
753 #define HCI_LE_SUP_FEAT_EXT_SCAN_FILT_POLICY 0x0080 /*!< \brief Extended Scan Filter Policy supported */
754 /*! \brief New in version 5.0 */
755 #define HCI_LE_SUP_FEAT_LE_2M_PHY 0x0100 /*!< \brief LE 2M PHY supported */
756 #define HCI_LE_SUP_FEAT_STABLE_MOD_IDX_TRANSMITTER 0x0200 /*!< \brief Stable Modulation Index - Transmitter supported */
757 #define HCI_LE_SUP_FEAT_STABLE_MOD_IDX_RECEIVER 0x0400 /*!< \brief Stable Modulation Index - Receiver supported */
758 #define HCI_LE_SUP_FEAT_LE_CODED_PHY 0x0800 /*!< \brief LE Coded PHY supported */
759 #define HCI_LE_SUP_FEAT_LE_EXT_ADV 0x1000 /*!< \brief LE Extended Advertising supported */
760 #define HCI_LE_SUP_FEAT_LE_PER_ADV 0x2000 /*!< \brief LE Periodic Advertising supported */
761 #define HCI_LE_SUP_FEAT_CH_SEL_2 0x4000 /*!< \brief Channel Selection Algorithm #2 supported */
762 #define HCI_LE_SUP_FEAT_LE_POWER_CLASS_1 0x8000 /*!< \brief LE Power Class 1 supported */
763 /**@}*/
764 
765 /** \name Advertising command parameters
766  *
767  */
768 /**@{*/
769 #define HCI_ADV_MIN_INTERVAL 0x0020 /*!< \brief Minimum advertising interval */
770 #define HCI_ADV_MAX_INTERVAL 0x4000 /*!< \brief Maximum advertising interval */
771 #define HCI_ADV_DIRECTED_MAX_DURATION 0x0500 /*!< \brief Maximum high duty cycle connectable directed advertising duration */
772 #define HCI_ADV_TYPE_CONN_UNDIRECT 0x00 /*!< \brief Connectable undirected advertising */
773 #define HCI_ADV_TYPE_CONN_DIRECT 0x01 /*!< \brief Connectable directed high duty cycle advertising */
774 #define HCI_ADV_TYPE_DISC_UNDIRECT 0x02 /*!< \brief Discoverable undirected advertising */
775 #define HCI_ADV_TYPE_NONCONN_UNDIRECT 0x03 /*!< \brief Nonconnectable undirected advertising */
776 #define HCI_ADV_TYPE_CONN_DIRECT_LO_DUTY 0x04 /*!< \brief Connectable directed low duty cycle advertising */
777 #define HCI_ADV_CHAN_37 0x01 /*!< \brief Advertising channel 37 */
778 #define HCI_ADV_CHAN_38 0x02 /*!< \brief Advertising channel 38 */
779 #define HCI_ADV_CHAN_39 0x04 /*!< \brief Advertising channel 39 */
780 #define HCI_ADV_FILT_NONE 0x00 /*!< \brief No scan request or connection filtering */
781 #define HCI_ADV_FILT_SCAN 0x01 /*!< \brief White list filters scan requests */
782 #define HCI_ADV_FILT_CONN 0x02 /*!< \brief White list filters connections */
783 #define HCI_ADV_FILT_ALL 0x03 /*!< \brief White list filters scan req. and conn. */
784 /**@}*/
785 
786 /** \name Scan command parameters
787  *
788  */
789 /**@{*/
790 #define HCI_SCAN_TYPE_PASSIVE 0 /*!< \brief Passive scan */
791 #define HCI_SCAN_TYPE_ACTIVE 1 /*!< \brief Active scan */
792 #define HCI_SCAN_INTERVAL_MIN 0x0004 /*!< \brief Minimum scan interval */
793 #define HCI_SCAN_INTERVAL_MAX 0x4000 /*!< \brief Maximum scan interval */
794 #define HCI_SCAN_INTERVAL_DEFAULT 0x0010 /*!< \brief Default scan interval */
795 #define HCI_SCAN_WINDOW_MIN 0x0004 /*!< \brief Minimum scan window */
796 #define HCI_SCAN_WINDOW_MAX 0x4000 /*!< \brief Maximum scan window */
797 #define HCI_SCAN_WINDOW_DEFAULT 0x0010 /*!< \brief Default scan window */
798 /**@}*/
799 
800 /** \name Connection command parameters
801  *
802  */
803 /**@{*/
804 #define HCI_CONN_INTERVAL_MIN 0x0006 /*!< \brief Minimum connection interval */
805 #define HCI_CONN_INTERVAL_MAX 0x0C80 /*!< \brief Maximum connection interval */
806 #define HCI_CONN_LATENCY_MAX 0x01F3 /*!< \brief Maximum connection latency */
807 #define HCI_SUP_TIMEOUT_MIN 0x000A /*!< \brief Minimum supervision timeout */
808 #define HCI_SUP_TIMEOUT_MAX 0x0C80 /*!< \brief Maximum supervision timeout */
809 /**@}*/
810 
811 /** \name Connection event parameters
812  *
813  */
814 /**@{*/
815 #define HCI_ROLE_MASTER 0 /*!< \brief Role is master */
816 #define HCI_ROLE_SLAVE 1 /*!< \brief Role is slave */
817 #define HCI_CLOCK_500PPM 0x00 /*!< \brief 500 ppm clock accuracy */
818 #define HCI_CLOCK_250PPM 0x01 /*!< \brief 250 ppm clock accuracy */
819 #define HCI_CLOCK_150PPM 0x02 /*!< \brief 150 ppm clock accuracy */
820 #define HCI_CLOCK_100PPM 0x03 /*!< \brief 100 ppm clock accuracy */
821 #define HCI_CLOCK_75PPM 0x04 /*!< \brief 75 ppm clock accuracy */
822 #define HCI_CLOCK_50PPM 0x05 /*!< \brief 50 ppm clock accuracy */
823 #define HCI_CLOCK_30PPM 0x06 /*!< \brief 30 ppm clock accuracy */
824 #define HCI_CLOCK_20PPM 0x07 /*!< \brief 20 ppm clock accuracy */
825 /**@}*/
826 
827 /** \name Advertising report event parameters
828  *
829  */
830 /**@{*/
831 #define HCI_ADV_CONN_UNDIRECT 0x00 /*!< \brief Connectable undirected advertising */
832 #define HCI_ADV_CONN_DIRECT 0x01 /*!< \brief Connectable directed advertising */
833 #define HCI_ADV_DISC_UNDIRECT 0x02 /*!< \brief Discoverable undirected advertising */
834 #define HCI_ADV_NONCONN_UNDIRECT 0x03 /*!< \brief Non-connectable undirected advertising */
835 #define HCI_ADV_SCAN_RESPONSE 0x04 /*!< \brief Scan response */
836 /**@}*/
837 
838 /** \name Extended advertising data operations
839  *
840  */
841 /**@{*/
842 #define HCI_ADV_DATA_OP_FRAG_INTER 0x00 /*!< \brief Intermediate fragment */
843 #define HCI_ADV_DATA_OP_FRAG_FIRST 0x01 /*!< \brief First fragment */
844 #define HCI_ADV_DATA_OP_FRAG_LAST 0x02 /*!< \brief Last fragment */
845 #define HCI_ADV_DATA_OP_COMP_FRAG 0x03 /*!< \brief Complete extended advertising data */
846 #define HCI_ADV_DATA_OP_UNCHANGED_DATA 0x04 /*!< \brief Unchanged data (just update Advertising DID) */
847 /**@}*/
848 
849 /** \name Advertising data fragment preference
850  *
851  */
852 /**@{*/
853 #define HCI_ADV_DATA_FRAG_PREF_FRAG 0x00 /*!< \brief Controller may fragment all Host advertising data */
854 #define HCI_ADV_DATA_FRAG_PREF_NO_FRAG 0x01 /*!< \brief Controller should not fragment nor minimize fragmentation of Host advertising data */
855 /**@}*/
856 
857 /** \name Number of advertising sets
858  *
859  */
860 /**@{*/
861 #define HCI_ADV_NUM_SETS_ALL_DISABLE 0x00 /*!< \brief Disable all advertising sets */
862 /**@}*/
863 
864 /** \name Maximum number of scanning or initiating PHYs
865  *
866  */
867 /**@{*/
868 #define HCI_MAX_NUM_PHYS 3 /*!< \brief Maximum number of scanning or initiating PHYs */
869 /**@}*/
870 
871 /** \name Advertising PHY values
872  *
873  */
874 /**@{*/
875 #define HCI_ADV_PHY_LE_1M 0x01 /*!< \brief LE 1M PHY */
876 #define HCI_ADV_PHY_LE_2M 0x02 /*!< \brief LE 2M PHY */
877 #define HCI_ADV_PHY_LE_CODED 0x03 /*!< \brief LE Coded PHY */
878 /**@}*/
879 
880 /** \name Scanner PHY value bits
881  *
882  */
883 /**@{*/
884 #define HCI_SCAN_PHY_LE_1M_BIT (1<<0) /*!< \brief LE 1M PHY */
885 #define HCI_SCAN_PHY_LE_2M_BIT (1<<1) /*!< \brief LE 2M PHY */
886 #define HCI_SCAN_PHY_LE_CODED_BIT (1<<2) /*!< \brief LE Coded PHY */
887 /**@}*/
888 
889 /** \name Initiator PHY value bits
890  *
891  */
892 /**@{*/
893 #define HCI_INIT_PHY_LE_1M_BIT (1<<0) /*!< \brief LE 1M PHY */
894 #define HCI_INIT_PHY_LE_2M_BIT (1<<1) /*!< \brief LE 2M PHY */
895 #define HCI_INIT_PHY_LE_CODED_BIT (1<<2) /*!< \brief LE Coded PHY */
896 /**@}*/
897 
898 /** \name Advertising event properties type bits
899  *
900  */
901 /**@{*/
902 #define HCI_ADV_PROP_CONN_ADV_BIT (1<<0) /*!< \brief Connectable advertising bit */
903 #define HCI_ADV_PROP_SCAN_ADV_BIT (1<<1) /*!< \brief Scannable advertising bit */
904 #define HCI_ADV_PROP_DIRECT_ADV_BIT (1<<2) /*!< \brief Directed advertising bit */
905 #define HCI_ADV_PROP_CONN_DIRECT_ADV_BIT (1<<3) /*!< \brief High duty cycle connectable directed advertising bit */
906 #define HCI_ADV_PROP_USE_LEG_PDU_BIT (1<<4) /*!< \brief Use legacy advertising PDUs bit */
907 #define HCI_ADV_PROP_OMIT_ADV_ADDR_BIT (1<<5) /*!< \brief Omit advertiser's address from all PDUs (anonymous advertising) bit */
908 #define HCI_ADV_PROP_INC_TX_PWR_BIT (1<<6) /*!< \brief Include TxPower in extended header of advertising PDU bit */
909 /**@}*/
910 
911 /** \name Advertising event properties for legacy PDUs
912  *
913  */
914 /**@{*/
915 #define HCI_ADV_PROP_LEG_CONN_UNDIRECT 0x13 /*!< \brief Connectable and scannable undirected advertising (00010011b) */
916 #define HCI_ADV_PROP_LEG_CONN_DIRECT 0x1D /*!< \brief Connectable directed high duty cycle advertising (00011101b) */
917 #define HCI_ADV_PROP_LEG_SCAN_UNDIRECT 0x12 /*!< \brief Scannable undirected advertising (00010010b) */
918 #define HCI_ADV_PROP_LEG_NONCONN_UNDIRECT 0x10 /*!< \brief Non-connectable and non-scannable undirected advertising (00010000b) */
919 #define HCI_ADV_PROP_LEG_CONN_DIRECT_LO_DUTY 0x15 /*!< \brief Connectable directed low duty cycle advertising (00010101b) */
920 /**@}*/
921 
922 /** \name Extended advertising report event type bits
923  *
924  */
925 /**@{*/
926 #define HCI_ADV_RPT_CONN_ADV_BIT (1<<0) /*!< \brief Connectable advertising event bit */
927 #define HCI_ADV_RPT_SCAN_ADV_BIT (1<<1) /*!< \brief Scannable advertising event bit */
928 #define HCI_ADV_RPT_DIRECT_ADV_BIT (1<<2) /*!< \brief Directed advertising event bit */
929 #define HCI_ADV_RPT_SCAN_RSP_BIT (1<<3) /*!< \brief Scan response event bit */
930 #define HCI_ADV_RPT_LEG_ADV_BIT (1<<4) /*!< \brief Legacy advertising PDU event bit */
931 #define HCI_ADV_RPT_DATA_STATUS_BITS (3<<5) /*!< \brief Data status bits */
932 /**@}*/
933 
934 /** \name Advertising report event types for legacy PDUs
935  *
936  */
937 /**@{*/
938 #define HCI_ADV_RPT_LEG_CONN_UNDIRECT 0x13 /*!< \brief Connectable and scannable undirected advertising (0010011b) */
939 #define HCI_ADV_RPT_LEG_CONN_DIRECT 0x15 /*!< \brief Connectable directed advertising (0010101b) */
940 #define HCI_ADV_RPT_LEG_SCAN_UNDIRECT 0x12 /*!< \brief Scannable undirected advertising (0010010b) */
941 #define HCI_ADV_RPT_LEG_NONCONN_UNDIRECT 0x10 /*!< \brief Non-connectable and non-scannable undirected advertising (0010000b) */
942 #define HCI_ADV_RPT_LEG_CONN_UNDIRECT_SCAN_RSP 0x1B /*!< \brief Scan response to connectable and scannable undirected advertising (0011011b) */
943 #define HCI_ADV_RPT_LEG_SCAN_UNDIRECT_SCAN_RSP 0x1A /*!< \brief Scan response to scannable undirected advertising (0011010b) */
944 /**@}*/
945 
946 /** \name Advertising report data status
947  *
948  */
949 /**@{*/
950 #define HCI_ADV_RPT_DATA_CMPL 0x00 /*!< \brief Data complete */
951 #define HCI_ADV_RPT_DATA_INCMPL_MORE 0x01 /*!< \brief Data incomplete, more date to come */
952 #define HCI_ADV_RPT_DATA_INCMPL_TRUNC 0x02 /*!< \brief Data incomplete, data truncated, no more date to come */
953 /**@}*/
954 
955 /** \name Extended advertising report event primary PHY values
956  *
957  */
958 /**@{*/
959 #define HCI_ADV_RPT_PHY_PRIM_LE_1M 0x01 /*!< \brief Advertiser PHY is LE 1M */
960 #define HCI_ADV_RPT_PHY_PRIM_LE_CODED 0x03 /*!< \brief Advertiser PHY is LE Coded */
961 /**@}*/
962 
963 /** \name Extended advertising report event seconday PHY values
964  *
965  */
966 /**@{*/
967 #define HCI_ADV_RPT_PHY_SEC_NONE 0x00 /*!< \brief No packets on seconday advertising channel */
968 #define HCI_ADV_RPT_PHY_SEC_LE_1M 0x01 /*!< \brief Advertiser PHY is LE 1M */
969 #define HCI_ADV_RPT_PHY_SEC_LE_2M 0x02 /*!< \brief Advertiser PHY is LE 2M */
970 #define HCI_ADV_RPT_PHY_SEC_LE_CODED 0x03 /*!< \brief Advertiser PHY is LE Coded */
971 /**@}*/
972 
973 /** \name Channel selection algorithm used
974  *
975  */
976 /**@{*/
977 #define HCI_CH_SEL_ALGO_1 0x00 /*!< \brief LE channel selection algorithm #1 used */
978 #define HCI_CH_SEL_ALGO_2 0x01 /*!< \brief LE channel selection algorithm #2 used */
979 /**@}*/
980 
981 /** \name Minimum number of used channels
982  *
983  */
984 /**@{*/
985 #define HCI_MIN_NUM_OF_USED_CHAN 8 /*!< \brief Minimum number of used channels */
986 /**@}*/
987 
988 /** \name Misc command parameters
989  *
990  */
991 /**@{*/
992 #define HCI_READ_TX_PWR_CURRENT 0 /*!< \brief Read current tx power */
993 #define HCI_READ_TX_PWR_MAX 1 /*!< \brief Read maximum tx power */
994 #define HCI_TX_PWR_MIN -30 /*!< \brief Minimum tx power dBm */
995 #define HCI_TX_PWR_MAX 20 /*!< \brief Maximum tx power dBm */
996 #define HCI_TX_PWR_NO_PREFERENCE 127 /*!< \brief Tx power no preference */
997 #define HCI_VERSION 6 /*!< \brief HCI specification version */
998 #define HCI_RSSI_MIN -127 /*!< \brief Minimum RSSI dBm */
999 #define HCI_RSSI_MAX 20 /*!< \brief Maximum RSSI dBm */
1000 #define HCI_ADDR_TYPE_PUBLIC 0 /*!< \brief Public device address */
1001 #define HCI_ADDR_TYPE_RANDOM 1 /*!< \brief Random device address */
1002 #define HCI_ADDR_TYPE_PUBLIC_IDENTITY 2 /*!< \brief Public identity address */
1003 #define HCI_ADDR_TYPE_RANDOM_IDENTITY 3 /*!< \brief Random identity address */
1004 #define HCI_ADDR_TYPE_ANONYMOUS 0xFF /*!< \brief Anonymous device address */
1005 #define HCI_FILT_NONE 0 /*!< \brief Accept all advertising packets */
1006 #define HCI_FILT_WHITE_LIST 1 /*!< \brief Accept from While List only */
1007 #define HCI_FILT_RES_INIT 2 /*!< \brief Accept directed advertisements with RPAs */
1008 #define HCI_FILT_WHITE_LIST_RES_INIT 3 /*!< \brief Accept from White List or directed advertisements with RPAs */
1009 #define HCI_FILT_PER_ADV_PARAM 0 /*!< \brief Listen to advertiser specified by create sync command parameters */
1010 #define HCI_FILT_PER_ADV_LIST 1 /*!< \brief Listen to advertiser from Periodic Advertiser List only */
1011 #define HCI_ROLE_MASTER 0 /*!< \brief Role is master */
1012 #define HCI_ROLE_SLAVE 1 /*!< \brief Role is slave */
1013 #define HCI_PRIV_MODE_NETWORK 0x00 /*!< \brief Network privacy mode (default) */
1014 #define HCI_PRIV_MODE_DEVICE 0x01 /*!< \brief Device privacy mode */
1015 /**@}*/
1016 
1017 /** \name PHY types
1018  *
1019  */
1020 /**@{*/
1021 #define HCI_PHY_NONE 0x00 /*!< \brief No selected PHY */
1022 #define HCI_PHY_LE_1M_BIT (1<<0) /*!< \brief LE 1M PHY */
1023 #define HCI_PHY_LE_2M_BIT (1<<1) /*!< \brief LE 2M PHY */
1024 #define HCI_PHY_LE_CODED_BIT (1<<2) /*!< \brief LE Coded PHY */
1025 /**@}*/
1026 
1027 /** \name All PHYs preference
1028  *
1029  */
1030 /**@{*/
1031 #define HCI_ALL_PHY_ALL_PREFERENCES 0x00 /*!< \brief All PHY preferences */
1032 #define HCI_ALL_PHY_TX_PREFERENCE_BIT (1<<0) /*!< \brief Tx PHY preference */
1033 #define HCI_ALL_PHY_RX_PREFERENCE_BIT (1<<1) /*!< \brief Rx PHY preference */
1034 /**@}*/
1035 
1036 /** \name PHY options
1037  *
1038  */
1039 /**@{*/
1040 #define HCI_PHY_OPTIONS_NONE 0x00 /*!< \brief No preferences */
1041 #define HCI_PHY_OPTIONS_S2_PREFERRED 0x01 /*!< \brief S=2 coding preferred when transmitting on LE Coded PHY */
1042 #define HCI_PHY_OPTIONS_S8_PREFERRED 0x02 /*!< \brief S=8 coding preferred when transmitting on LE Coded PHY */
1043 /**@}*/
1044 
1045 /** \name Parameter lengths
1046  *
1047  */
1048 /**@{*/
1049 #define HCI_EVT_MASK_LEN 8 /*!< \brief Length of event mask byte array */
1050 #define HCI_EVT_MASK_PAGE_2_LEN 8 /*!< \brief Length of event mask page 2 byte array */
1051 #define HCI_LE_EVT_MASK_LEN 8 /*!< \brief Length of LE event mask byte array */
1052 #define HCI_FEAT_LEN 8 /*!< \brief Length of features byte array */
1053 #define HCI_ADV_DATA_LEN 31 /*!< \brief Length of advertising data */
1054 #define HCI_SCAN_DATA_LEN 31 /*!< \brief Length of scan response data */
1055 #define HCI_EXT_ADV_DATA_LEN 251 /*!< \brief Length of extended advertising data */
1056 #define HCI_PER_ADV_DATA_LEN 252 /*!< \brief Length of periodic advertising data */
1057 #define HCI_EXT_ADV_RPT_DATA_LEN 229 /*!< \brief Length of extended advertising report data */
1058 #define HCI_PER_ADV_RPT_DATA_LEN 248 /*!< \brief Length of periodic advertising report data */
1059 #define HCI_CHAN_MAP_LEN 5 /*!< \brief Length of channel map byte array */
1060 #define HCI_KEY_LEN 16 /*!< \brief Length of encryption key */
1061 #define HCI_ENCRYPT_DATA_LEN 16 /*!< \brief Length of data used in encryption */
1062 #define HCI_RAND_LEN 8 /*!< \brief Length of random number */
1063 #define HCI_LE_STATES_LEN 8 /*!< \brief Length of LE states byte array */
1064 #define HCI_P256_KEY_LEN 64 /*!< \brief Length of P256 key */
1065 #define HCI_DH_KEY_LEN 32 /*!< \brief Length of DH Key */
1066 
1067 #define HCI_EXT_ADV_RPT_DATA_LEN_OFFSET 23 /*!< \brief Length field offset of extended advertising report data */
1068 #define HCI_PER_ADV_RPT_DATA_LEN_OFFSET 6 /*!< \brief Length field offset of periodic advertising report data */
1069 /**@}*/
1070 
1071 /** \name Company ID
1072  *
1073  */
1074 /**@{*/
1075 #define HCI_ID_ARM 0x005F /*!< \brief ARM Ltd. company ID */
1076 /**@}*/
1077 
1078 /** \name Manufacturer location in Local version
1079  *
1080  */
1081 /**@{*/
1082 #define HCI_LOCAL_VER_MANUFACTURER_POS 4
1083 /**@}*/
1084 
1085 /* \} */ /* STACK_HCI_API */
1086 
1087 #ifdef __cplusplus
1088 };
1089 #endif
1090 
1091 #endif /* HCI_DEFS_H */