1 /* hci.h - Bluetooth Host Control Interface types */
2 
3 /*
4  * Copyright (c) 2015-2016 Intel Corporation
5  * Copyright (c) 2023 Nordic Semiconductor ASA
6  *
7  * SPDX-License-Identifier: Apache-2.0
8  */
9 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_HCI_TYPES_H_
10 #define ZEPHYR_INCLUDE_BLUETOOTH_HCI_TYPES_H_
11 
12 #include <stdbool.h>
13 #include <stdint.h>
14 #include <string.h>
15 
16 #include <zephyr/toolchain.h>
17 #include <zephyr/types.h>
18 #include <zephyr/sys/util.h>
19 #include <zephyr/bluetooth/addr.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /* Bluetooth spec v5.4 Vol 4, Part A Table 2.1: HCI packet indicators
26  * The following definitions are intended for use with the UART Transport Layer and
27  * may be reused with other transport layers if desired.
28  */
29 #define BT_HCI_H4_NONE                  0x00    /* None of the known packet types */
30 #define BT_HCI_H4_CMD                   0x01    /* HCI Command packet */
31 #define BT_HCI_H4_ACL                   0x02    /* HCI ACL Data packet */
32 #define BT_HCI_H4_SCO                   0x03    /* HCI Synchronous Data packet */
33 #define BT_HCI_H4_EVT                   0x04    /* HCI Event packet */
34 #define BT_HCI_H4_ISO                   0x05    /* HCI ISO Data packet */
35 
36 /* Special own address types for LL privacy (used in adv & scan parameters) */
37 #define BT_HCI_OWN_ADDR_RPA_OR_PUBLIC   0x02
38 #define BT_HCI_OWN_ADDR_RPA_OR_RANDOM   0x03
39 #define BT_HCI_OWN_ADDR_RPA_MASK        0x02
40 
41 #define BT_HCI_PEER_ADDR_RPA_UNRESOLVED 0xfe
42 #define BT_HCI_PEER_ADDR_ANONYMOUS      0xff
43 
44 #define BT_ENC_KEY_SIZE_MIN             0x07
45 #define BT_ENC_KEY_SIZE_MAX             0x10
46 
47 #define BT_HCI_ADV_HANDLE_INVALID       0xff
48 #define BT_HCI_SYNC_HANDLE_INVALID      0xffff
49 #define BT_HCI_PAWR_SUBEVENT_MAX        128
50 
51 /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.3 HCI Synchronous Data Packets */
52 struct bt_hci_sco_hdr {
53 	uint16_t handle; /* 12 bit handle, 2 bit Packet Status Flag, 1 bit RFU */
54 	uint8_t  len;
55 } __packed;
56 #define BT_HCI_SCO_HDR_SIZE             3
57 
58 /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.4 HCI Event Packet */
59 struct bt_hci_evt_hdr {
60 	uint8_t  evt;
61 	uint8_t  len;
62 } __packed;
63 #define BT_HCI_EVT_HDR_SIZE             2
64 
65 #define BT_ACL_START_NO_FLUSH           0x00
66 #define BT_ACL_CONT                     0x01
67 #define BT_ACL_START                    0x02
68 #define BT_ACL_COMPLETE                 0x03
69 
70 #define BT_ACL_POINT_TO_POINT           0x00
71 #define BT_ACL_BROADCAST                0x01
72 
73 #define BT_ACL_HANDLE_MASK              BIT_MASK(12)
74 
75 #define bt_acl_handle(h)                ((h) & BT_ACL_HANDLE_MASK)
76 #define bt_acl_flags(h)                 ((h) >> 12)
77 #define bt_acl_flags_pb(f)              ((f) & BIT_MASK(2))
78 #define bt_acl_flags_bc(f)              ((f) >> 2)
79 #define bt_acl_handle_pack(h, f)        ((h) | ((f) << 12))
80 
81 /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.2 ACL Data Packets */
82 struct bt_hci_acl_hdr {
83 	uint16_t handle;
84 	uint16_t len;
85 } __packed;
86 #define BT_HCI_ACL_HDR_SIZE             4
87 
88 #define BT_ISO_START                    0x00
89 #define BT_ISO_CONT                     0x01
90 #define BT_ISO_SINGLE                   0x02
91 #define BT_ISO_END                      0x03
92 
93 #define bt_iso_handle(h)                ((h) & 0x0fff)
94 #define bt_iso_flags(h)                 ((h) >> 12)
95 #define bt_iso_flags_pb(f)              ((f) & 0x0003)
96 #define bt_iso_flags_ts(f)              (((f) >> 2) & 0x0001)
97 #define bt_iso_pack_flags(pb, ts) \
98 	(((pb) & 0x0003) | (((ts) & 0x0001) << 2))
99 #define bt_iso_handle_pack(h, pb, ts) \
100 	((h) | (bt_iso_pack_flags(pb, ts) << 12))
101 #define bt_iso_hdr_len(h)                ((h) & BIT_MASK(14))
102 
103 #define BT_ISO_DATA_VALID                0x00
104 #define BT_ISO_DATA_INVALID              0x01
105 #define BT_ISO_DATA_NOP                  0x02
106 
107 #define bt_iso_pkt_len(h)                ((h) & BIT_MASK(12))
108 #define bt_iso_pkt_flags(h)              ((h) >> 14)
109 #define bt_iso_pkt_len_pack(h, f)        (((h) & BIT_MASK(12)) | ((f) << 14))
110 
111 struct bt_hci_iso_sdu_hdr {
112 	uint16_t sn;
113 	uint16_t slen; /* 12 bit len, 2 bit RFU, 2 bit packet status */
114 } __packed;
115 #define BT_HCI_ISO_SDU_HDR_SIZE          4
116 
117 struct bt_hci_iso_sdu_ts_hdr {
118 	uint32_t ts;
119 	struct bt_hci_iso_sdu_hdr sdu;
120 } __packed;
121 #define BT_HCI_ISO_SDU_TS_HDR_SIZE       8
122 
123 /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.5 HCI ISO Data Packets */
124 struct bt_hci_iso_hdr {
125 	uint16_t handle; /* 12 bit handle, 2 bit PB flags, 1 bit TS_Flag, 1 bit RFU */
126 	uint16_t len; /* 14 bits, 2 bits RFU */
127 } __packed;
128 #define BT_HCI_ISO_HDR_SIZE             4
129 
130 /* Bluetooth spec v5.4 Vol 4, Part E - 5.4.1 HCI Command Packet */
131 struct bt_hci_cmd_hdr {
132 	uint16_t opcode;
133 	uint8_t  param_len;
134 } __packed;
135 #define BT_HCI_CMD_HDR_SIZE             3
136 
137 /* Supported Commands */
138 #define BT_CMD_TEST(cmd, octet, bit)            (cmd[octet] & BIT(bit))
139 #define BT_CMD_LE_STATES(cmd)                   BT_CMD_TEST(cmd, 28, 3)
140 
141 #define BT_FEAT_TEST(feat, page, octet, bit)    (feat[page][octet] & BIT(bit))
142 
143 #define BT_FEAT_BREDR(feat)                     !BT_FEAT_TEST(feat, 0, 4, 5)
144 #define BT_FEAT_LE(feat)                        BT_FEAT_TEST(feat, 0, 4, 6)
145 #define BT_FEAT_EXT_FEATURES(feat)              BT_FEAT_TEST(feat, 0, 7, 7)
146 #define BT_FEAT_HOST_SSP(feat)                  BT_FEAT_TEST(feat, 1, 0, 0)
147 #define BT_FEAT_SC(feat)                        BT_FEAT_TEST(feat, 2, 1, 0)
148 
149 #define BT_FEAT_LMP_SCO_CAPABLE(feat)           BT_FEAT_TEST(feat, 0, 1, 3)
150 #define BT_FEAT_LMP_ESCO_CAPABLE(feat)          BT_FEAT_TEST(feat, 0, 3, 7)
151 #define BT_FEAT_HV2_PKT(feat)                   BT_FEAT_TEST(feat, 0, 1, 4)
152 #define BT_FEAT_HV3_PKT(feat)                   BT_FEAT_TEST(feat, 0, 1, 5)
153 #define BT_FEAT_EV4_PKT(feat)                   BT_FEAT_TEST(feat, 0, 4, 0)
154 #define BT_FEAT_EV5_PKT(feat)                   BT_FEAT_TEST(feat, 0, 4, 1)
155 #define BT_FEAT_2EV3_PKT(feat)                  BT_FEAT_TEST(feat, 0, 5, 5)
156 #define BT_FEAT_3EV3_PKT(feat)                  BT_FEAT_TEST(feat, 0, 5, 6)
157 #define BT_FEAT_3SLOT_PKT(feat)                 BT_FEAT_TEST(feat, 0, 5, 7)
158 
159 /* LE features */
160 #define BT_LE_FEAT_BIT_ENC                      0
161 #define BT_LE_FEAT_BIT_CONN_PARAM_REQ           1
162 #define BT_LE_FEAT_BIT_EXT_REJ_IND              2
163 #define BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG       3
164 #define BT_LE_FEAT_BIT_PING                     4
165 #define BT_LE_FEAT_BIT_DLE                      5
166 #define BT_LE_FEAT_BIT_PRIVACY                  6
167 #define BT_LE_FEAT_BIT_EXT_SCAN                 7
168 #define BT_LE_FEAT_BIT_PHY_2M                   8
169 #define BT_LE_FEAT_BIT_SMI_TX                   9
170 #define BT_LE_FEAT_BIT_SMI_RX                   10
171 #define BT_LE_FEAT_BIT_PHY_CODED                11
172 #define BT_LE_FEAT_BIT_EXT_ADV                  12
173 #define BT_LE_FEAT_BIT_PER_ADV                  13
174 #define BT_LE_FEAT_BIT_CHAN_SEL_ALGO_2          14
175 #define BT_LE_FEAT_BIT_PWR_CLASS_1              15
176 #define BT_LE_FEAT_BIT_MIN_USED_CHAN_PROC       16
177 #define BT_LE_FEAT_BIT_CONN_CTE_REQ             17
178 #define BT_LE_FEAT_BIT_CONN_CTE_RESP            18
179 #define BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_TX    19
180 #define BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_RX    20
181 #define BT_LE_FEAT_BIT_ANT_SWITCH_TX_AOD        21
182 #define BT_LE_FEAT_BIT_ANT_SWITCH_RX_AOA        22
183 #define BT_LE_FEAT_BIT_RX_CTE                   23
184 #define BT_LE_FEAT_BIT_PAST_SEND                24
185 #define BT_LE_FEAT_BIT_PAST_RECV                25
186 #define BT_LE_FEAT_BIT_SCA_UPDATE               26
187 #define BT_LE_FEAT_BIT_REMOTE_PUB_KEY_VALIDATE  27
188 #define BT_LE_FEAT_BIT_CIS_CENTRAL              28
189 #define BT_LE_FEAT_BIT_CIS_PERIPHERAL           29
190 #define BT_LE_FEAT_BIT_ISO_BROADCASTER          30
191 #define BT_LE_FEAT_BIT_SYNC_RECEIVER            31
192 #define BT_LE_FEAT_BIT_ISO_CHANNELS             32
193 #define BT_LE_FEAT_BIT_PWR_CTRL_REQ             33
194 #define BT_LE_FEAT_BIT_PWR_CHG_IND              34
195 #define BT_LE_FEAT_BIT_PATH_LOSS_MONITOR        35
196 #define BT_LE_FEAT_BIT_PER_ADV_ADI_SUPP         36
197 #define BT_LE_FEAT_BIT_CONN_SUBRATING           37
198 #define BT_LE_FEAT_BIT_CONN_SUBRATING_HOST_SUPP 38
199 #define BT_LE_FEAT_BIT_CHANNEL_CLASSIFICATION   39
200 
201 #define BT_LE_FEAT_BIT_PAWR_ADVERTISER          43
202 #define BT_LE_FEAT_BIT_PAWR_SCANNER             44
203 
204 #define BT_LE_FEAT_TEST(feat, n)                (feat[(n) >> 3] & \
205 						 BIT((n) & 7))
206 
207 #define BT_FEAT_LE_ENCR(feat)                     BT_LE_FEAT_TEST(feat, \
208 						  BT_LE_FEAT_BIT_ENC)
209 #define BT_FEAT_LE_CONN_PARAM_REQ_PROC(feat)      BT_LE_FEAT_TEST(feat, \
210 						  BT_LE_FEAT_BIT_CONN_PARAM_REQ)
211 #define BT_FEAT_LE_PER_INIT_FEAT_XCHG(feat)       BT_LE_FEAT_TEST(feat, \
212 						  BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG)
213 #define BT_FEAT_LE_DLE(feat)                      BT_LE_FEAT_TEST(feat, \
214 						  BT_LE_FEAT_BIT_DLE)
215 #define BT_FEAT_LE_PHY_2M(feat)                   BT_LE_FEAT_TEST(feat, \
216 						  BT_LE_FEAT_BIT_PHY_2M)
217 #define BT_FEAT_LE_PHY_CODED(feat)                BT_LE_FEAT_TEST(feat, \
218 						  BT_LE_FEAT_BIT_PHY_CODED)
219 #define BT_FEAT_LE_PRIVACY(feat)                  BT_LE_FEAT_TEST(feat, \
220 						  BT_LE_FEAT_BIT_PRIVACY)
221 #define BT_FEAT_LE_EXT_ADV(feat)                  BT_LE_FEAT_TEST(feat, \
222 						  BT_LE_FEAT_BIT_EXT_ADV)
223 #define BT_FEAT_LE_EXT_PER_ADV(feat)              BT_LE_FEAT_TEST(feat, \
224 						  BT_LE_FEAT_BIT_PER_ADV)
225 #define BT_FEAT_LE_CONNECTION_CTE_REQ(feat)       BT_LE_FEAT_TEST(feat, \
226 						  BT_LE_FEAT_BIT_CONN_CTE_REQ)
227 #define BT_FEAT_LE_CONNECTION_CTE_RESP(feat)      BT_LE_FEAT_TEST(feat, \
228 						  BT_LE_FEAT_BIT_CONN_CTE_RESP)
229 #define BT_FEAT_LE_CONNECTIONLESS_CTE_TX(feat)    BT_LE_FEAT_TEST(feat, \
230 						  BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_TX)
231 #define BT_FEAT_LE_CONNECTIONLESS_CTE_RX(feat)    BT_LE_FEAT_TEST(feat, \
232 						  BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_RX)
233 #define BT_FEAT_LE_ANT_SWITCH_TX_AOD(feat)        BT_LE_FEAT_TEST(feat, \
234 						  BT_LE_FEAT_BIT_ANT_SWITCH_TX_AOD)
235 #define BT_FEAT_LE_ANT_SWITCH_RX_AOA(feat)        BT_LE_FEAT_TEST(feat, \
236 						  BT_LE_FEAT_BIT_ANT_SWITCH_RX_AOA)
237 #define BT_FEAT_LE_RX_CTE(feat)                   BT_LE_FEAT_TEST(feat, \
238 						  BT_LE_FEAT_BIT_RX_CTE)
239 #define BT_FEAT_LE_PAST_SEND(feat)                BT_LE_FEAT_TEST(feat, \
240 						  BT_LE_FEAT_BIT_PAST_SEND)
241 #define BT_FEAT_LE_PAST_RECV(feat)                BT_LE_FEAT_TEST(feat, \
242 						  BT_LE_FEAT_BIT_PAST_RECV)
243 #define BT_FEAT_LE_CIS_CENTRAL(feat)              BT_LE_FEAT_TEST(feat, \
244 						  BT_LE_FEAT_BIT_CIS_CENTRAL)
245 #define BT_FEAT_LE_CIS_PERIPHERAL(feat)           BT_LE_FEAT_TEST(feat, \
246 						  BT_LE_FEAT_BIT_CIS_PERIPHERAL)
247 #define BT_FEAT_LE_ISO_BROADCASTER(feat)          BT_LE_FEAT_TEST(feat, \
248 						  BT_LE_FEAT_BIT_ISO_BROADCASTER)
249 #define BT_FEAT_LE_SYNC_RECEIVER(feat)            BT_LE_FEAT_TEST(feat, \
250 						  BT_LE_FEAT_BIT_SYNC_RECEIVER)
251 #define BT_FEAT_LE_ISO_CHANNELS(feat)             BT_LE_FEAT_TEST(feat, \
252 						  BT_LE_FEAT_BIT_ISO_CHANNELS)
253 #define BT_FEAT_LE_PWR_CTRL_REQ(feat)             BT_LE_FEAT_TEST(feat, \
254 						  BT_LE_FEAT_BIT_PWR_CTRL_REQ)
255 #define BT_FEAT_LE_PWR_CHG_IND(feat)              BT_LE_FEAT_TEST(feat, \
256 						  BT_LE_FEAT_BIT_PWR_CHG_IND)
257 #define BT_FEAT_LE_PATH_LOSS_MONITOR(feat)        BT_LE_FEAT_TEST(feat, \
258 						  BT_LE_FEAT_BIT_PATH_LOSS_MONITOR)
259 #define BT_FEAT_LE_PER_ADV_ADI_SUPP(feat)         BT_LE_FEAT_TEST(feat, \
260 						  BT_LE_FEAT_BIT_PER_ADV_ADI_SUPP)
261 #define BT_FEAT_LE_CONN_SUBRATING(feat)           BT_LE_FEAT_TEST(feat, \
262 						  BT_LE_FEAT_BIT_CONN_SUBRATING)
263 #define BT_FEAT_LE_CONN_SUBRATING_HOST_SUPP(feat) BT_LE_FEAT_TEST(feat, \
264 						  BT_LE_FEAT_BIT_CONN_SUBRATING_HOST_SUPP)
265 #define BT_FEAT_LE_CHANNEL_CLASSIFICATION(feat)   BT_LE_FEAT_TEST(feat, \
266 						  BT_LE_FEAT_BIT_CHANNEL_CLASSIFICATION)
267 #define BT_FEAT_LE_PAWR_ADVERTISER(feat)	  BT_LE_FEAT_TEST(feat, \
268 						  BT_LE_FEAT_BIT_PAWR_ADVERTISER)
269 #define BT_FEAT_LE_PAWR_SCANNER(feat)             BT_LE_FEAT_TEST(feat, \
270 						  BT_LE_FEAT_BIT_PAWR_SCANNER)
271 
272 #define BT_FEAT_LE_CIS(feat)            (BT_FEAT_LE_CIS_CENTRAL(feat) | \
273 					BT_FEAT_LE_CIS_PERIPHERAL(feat))
274 #define BT_FEAT_LE_BIS(feat)            (BT_FEAT_LE_ISO_BROADCASTER(feat) | \
275 					BT_FEAT_LE_SYNC_RECEIVER(feat))
276 #define BT_FEAT_LE_ISO(feat)            (BT_FEAT_LE_CIS(feat) | \
277 					BT_FEAT_LE_BIS(feat))
278 
279 /* LE States. See Core_v5.4, Vol 4, Part E, Section 7.8.27 */
280 #define BT_LE_STATES_PER_CONN_ADV(states)     (states & BIT64_MASK(38))
281 
282 #if defined(CONFIG_BT_SCAN_AND_INITIATE_IN_PARALLEL)
283 /* Both passive and active scanner can be run in parallel with initiator. */
284 #define BT_LE_STATES_SCAN_INIT(states) ((states) & BIT64_MASK(22) && \
285 					(states) & BIT64_MASK(23))
286 
287 #else
288 #define BT_LE_STATES_SCAN_INIT(states)  0
289 #endif
290 
291 /* Bonding/authentication types */
292 #define BT_HCI_NO_BONDING                       0x00
293 #define BT_HCI_NO_BONDING_MITM                  0x01
294 #define BT_HCI_DEDICATED_BONDING                0x02
295 #define BT_HCI_DEDICATED_BONDING_MITM           0x03
296 #define BT_HCI_GENERAL_BONDING                  0x04
297 #define BT_HCI_GENERAL_BONDING_MITM             0x05
298 
299 /*
300  * MITM protection is enabled in SSP authentication requirements octet when
301  * LSB bit is set.
302  */
303 #define BT_MITM                                 0x01
304 
305 /* I/O capabilities */
306 #define BT_IO_DISPLAY_ONLY                      0x00
307 #define BT_IO_DISPLAY_YESNO                     0x01
308 #define BT_IO_KEYBOARD_ONLY                     0x02
309 #define BT_IO_NO_INPUT_OUTPUT                   0x03
310 
311 /* SCO packet types */
312 #define HCI_PKT_TYPE_HV1                        0x0020
313 #define HCI_PKT_TYPE_HV2                        0x0040
314 #define HCI_PKT_TYPE_HV3                        0x0080
315 
316 /* eSCO packet types */
317 #define HCI_PKT_TYPE_SCO_HV1                    0x0001
318 #define HCI_PKT_TYPE_SCO_HV2                    0x0002
319 #define HCI_PKT_TYPE_SCO_HV3                    0x0004
320 #define HCI_PKT_TYPE_ESCO_EV3                   0x0008
321 #define HCI_PKT_TYPE_ESCO_EV4                   0x0010
322 #define HCI_PKT_TYPE_ESCO_EV5                   0x0020
323 #define HCI_PKT_TYPE_ESCO_2EV3                  0x0040
324 #define HCI_PKT_TYPE_ESCO_3EV3                  0x0080
325 #define HCI_PKT_TYPE_ESCO_2EV5                  0x0100
326 #define HCI_PKT_TYPE_ESCO_3EV5                  0x0200
327 
328 
329 #define ESCO_PKT_MASK                           (HCI_PKT_TYPE_SCO_HV1 | \
330 						 HCI_PKT_TYPE_SCO_HV2 | \
331 						 HCI_PKT_TYPE_SCO_HV3 | \
332 						 HCI_PKT_TYPE_ESCO_EV3 | \
333 						 HCI_PKT_TYPE_ESCO_EV4 | \
334 						 HCI_PKT_TYPE_ESCO_EV5)
335 #define SCO_PKT_MASK                            (HCI_PKT_TYPE_SCO_HV1 | \
336 						 HCI_PKT_TYPE_SCO_HV2 | \
337 						 HCI_PKT_TYPE_SCO_HV3)
338 #define EDR_ESCO_PKT_MASK                       (HCI_PKT_TYPE_ESCO_2EV3 | \
339 						 HCI_PKT_TYPE_ESCO_3EV3 | \
340 						 HCI_PKT_TYPE_ESCO_2EV5 | \
341 						 HCI_PKT_TYPE_ESCO_3EV5)
342 
343 /* HCI BR/EDR link types */
344 #define BT_HCI_SCO                              0x00
345 #define BT_HCI_ACL                              0x01
346 #define BT_HCI_ESCO                             0x02
347 
348 /* OpCode Group Fields */
349 #define BT_OGF_LINK_CTRL                        0x01
350 #define BT_OGF_BASEBAND                         0x03
351 #define BT_OGF_INFO                             0x04
352 #define BT_OGF_STATUS                           0x05
353 #define BT_OGF_LE                               0x08
354 #define BT_OGF_VS                               0x3f
355 
356 /* Construct OpCode from OGF and OCF */
357 #define BT_OP(ogf, ocf)                         ((ocf) | ((ogf) << 10))
358 
359 /* Invalid opcode */
360 #define BT_OP_NOP				0x0000
361 
362 /* Obtain OGF from OpCode */
363 #define BT_OGF(opcode)                          (((opcode) >> 10) & BIT_MASK(6))
364 /* Obtain OCF from OpCode */
365 #define BT_OCF(opcode)                          ((opcode) & BIT_MASK(10))
366 
367 #define BT_HCI_OP_INQUIRY                       BT_OP(BT_OGF_LINK_CTRL, 0x0001) /* 0x0401 */
368 struct bt_hci_op_inquiry {
369 	uint8_t lap[3];
370 	uint8_t length;
371 	uint8_t num_rsp;
372 } __packed;
373 
374 #define BT_HCI_OP_INQUIRY_CANCEL                BT_OP(BT_OGF_LINK_CTRL, 0x0002) /* 0x0402 */
375 
376 #define BT_HCI_OP_CONNECT                       BT_OP(BT_OGF_LINK_CTRL, 0x0005) /* 0x0405 */
377 struct bt_hci_cp_connect {
378 	bt_addr_t bdaddr;
379 	uint16_t  packet_type;
380 	uint8_t   pscan_rep_mode;
381 	uint8_t   reserved;
382 	uint16_t  clock_offset;
383 	uint8_t   allow_role_switch;
384 } __packed;
385 
386 #define BT_HCI_OP_DISCONNECT                    BT_OP(BT_OGF_LINK_CTRL, 0x0006) /* 0x0406 */
387 struct bt_hci_cp_disconnect {
388 	uint16_t handle;
389 	uint8_t  reason;
390 } __packed;
391 
392 #define BT_HCI_OP_CONNECT_CANCEL                BT_OP(BT_OGF_LINK_CTRL, 0x0008) /* 0x0408 */
393 struct bt_hci_cp_connect_cancel {
394 	bt_addr_t bdaddr;
395 } __packed;
396 struct bt_hci_rp_connect_cancel {
397 	uint8_t   status;
398 	bt_addr_t bdaddr;
399 } __packed;
400 
401 #define BT_HCI_OP_ACCEPT_CONN_REQ               BT_OP(BT_OGF_LINK_CTRL, 0x0009) /* 0x0409 */
402 struct bt_hci_cp_accept_conn_req {
403 	bt_addr_t bdaddr;
404 	uint8_t   role;
405 } __packed;
406 
407 #define BT_HCI_OP_SETUP_SYNC_CONN               BT_OP(BT_OGF_LINK_CTRL, 0x0028) /* 0x0428 */
408 struct bt_hci_cp_setup_sync_conn {
409 	uint16_t  handle;
410 	uint32_t  tx_bandwidth;
411 	uint32_t  rx_bandwidth;
412 	uint16_t  max_latency;
413 	uint16_t  content_format;
414 	uint8_t   retrans_effort;
415 	uint16_t  pkt_type;
416 } __packed;
417 
418 #define BT_HCI_OP_ACCEPT_SYNC_CONN_REQ          BT_OP(BT_OGF_LINK_CTRL, 0x0029) /* 0x0429 */
419 struct bt_hci_cp_accept_sync_conn_req {
420 	bt_addr_t bdaddr;
421 	uint32_t  tx_bandwidth;
422 	uint32_t  rx_bandwidth;
423 	uint16_t  max_latency;
424 	uint16_t  content_format;
425 	uint8_t   retrans_effort;
426 	uint16_t  pkt_type;
427 } __packed;
428 
429 #define BT_HCI_OP_REJECT_CONN_REQ               BT_OP(BT_OGF_LINK_CTRL, 0x000a) /* 0x040a */
430 struct bt_hci_cp_reject_conn_req {
431 	bt_addr_t bdaddr;
432 	uint8_t   reason;
433 } __packed;
434 
435 #define BT_HCI_OP_LINK_KEY_REPLY                BT_OP(BT_OGF_LINK_CTRL, 0x000b) /* 0x040b */
436 struct bt_hci_cp_link_key_reply {
437 	bt_addr_t bdaddr;
438 	uint8_t   link_key[16];
439 } __packed;
440 
441 #define BT_HCI_OP_LINK_KEY_NEG_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x000c) /* 0x040c */
442 struct bt_hci_cp_link_key_neg_reply {
443 	bt_addr_t bdaddr;
444 } __packed;
445 
446 #define BT_HCI_OP_PIN_CODE_REPLY                BT_OP(BT_OGF_LINK_CTRL, 0x000d) /* 0x040d */
447 struct bt_hci_cp_pin_code_reply {
448 	bt_addr_t bdaddr;
449 	uint8_t   pin_len;
450 	uint8_t   pin_code[16];
451 } __packed;
452 struct bt_hci_rp_pin_code_reply {
453 	uint8_t      status;
454 	bt_addr_t bdaddr;
455 } __packed;
456 
457 #define BT_HCI_OP_PIN_CODE_NEG_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x000e) /* 0x040e */
458 struct bt_hci_cp_pin_code_neg_reply {
459 	bt_addr_t bdaddr;
460 } __packed;
461 struct bt_hci_rp_pin_code_neg_reply {
462 	uint8_t   status;
463 	bt_addr_t bdaddr;
464 } __packed;
465 
466 #define BT_HCI_OP_AUTH_REQUESTED                BT_OP(BT_OGF_LINK_CTRL, 0x0011) /* 0x0411 */
467 struct bt_hci_cp_auth_requested {
468 	uint16_t handle;
469 } __packed;
470 
471 #define BT_HCI_OP_SET_CONN_ENCRYPT              BT_OP(BT_OGF_LINK_CTRL, 0x0013) /* 0x0413 */
472 struct bt_hci_cp_set_conn_encrypt {
473 	uint16_t handle;
474 	uint8_t  encrypt;
475 } __packed;
476 
477 #define BT_HCI_OP_REMOTE_NAME_REQUEST           BT_OP(BT_OGF_LINK_CTRL, 0x0019) /* 0x0419 */
478 struct bt_hci_cp_remote_name_request {
479 	bt_addr_t bdaddr;
480 	uint8_t   pscan_rep_mode;
481 	uint8_t   reserved;
482 	uint16_t  clock_offset;
483 } __packed;
484 
485 #define BT_HCI_OP_REMOTE_NAME_CANCEL            BT_OP(BT_OGF_LINK_CTRL, 0x001a) /* 0x041a */
486 struct bt_hci_cp_remote_name_cancel {
487 	bt_addr_t bdaddr;
488 } __packed;
489 struct bt_hci_rp_remote_name_cancel {
490 	uint8_t   status;
491 	bt_addr_t bdaddr;
492 } __packed;
493 
494 #define BT_HCI_OP_READ_REMOTE_FEATURES          BT_OP(BT_OGF_LINK_CTRL, 0x001b) /* 0x041b */
495 struct bt_hci_cp_read_remote_features {
496 	uint16_t handle;
497 } __packed;
498 
499 #define BT_HCI_OP_READ_REMOTE_EXT_FEATURES      BT_OP(BT_OGF_LINK_CTRL, 0x001c) /* 0x041c */
500 struct bt_hci_cp_read_remote_ext_features {
501 	uint16_t handle;
502 	uint8_t  page;
503 } __packed;
504 
505 #define BT_HCI_OP_READ_REMOTE_VERSION_INFO      BT_OP(BT_OGF_LINK_CTRL, 0x001d) /* 0x041d */
506 struct bt_hci_cp_read_remote_version_info {
507 	uint16_t handle;
508 } __packed;
509 
510 #define BT_HCI_OP_IO_CAPABILITY_REPLY           BT_OP(BT_OGF_LINK_CTRL, 0x002b) /* 0x042b */
511 struct bt_hci_cp_io_capability_reply {
512 	bt_addr_t bdaddr;
513 	uint8_t   capability;
514 	uint8_t   oob_data;
515 	uint8_t   authentication;
516 } __packed;
517 
518 #define BT_HCI_OP_USER_CONFIRM_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x002c) /* 0x042c */
519 #define BT_HCI_OP_USER_CONFIRM_NEG_REPLY        BT_OP(BT_OGF_LINK_CTRL, 0x002d) /* 0x042d */
520 struct bt_hci_cp_user_confirm_reply {
521 	bt_addr_t bdaddr;
522 } __packed;
523 struct bt_hci_rp_user_confirm_reply {
524 	uint8_t   status;
525 	bt_addr_t bdaddr;
526 } __packed;
527 
528 #define BT_HCI_OP_USER_PASSKEY_REPLY            BT_OP(BT_OGF_LINK_CTRL, 0x002e) /* 0x042e */
529 struct bt_hci_cp_user_passkey_reply {
530 	bt_addr_t bdaddr;
531 	uint32_t  passkey;
532 } __packed;
533 
534 #define BT_HCI_OP_USER_PASSKEY_NEG_REPLY        BT_OP(BT_OGF_LINK_CTRL, 0x002f) /* 0x042f */
535 struct bt_hci_cp_user_passkey_neg_reply {
536 	bt_addr_t bdaddr;
537 } __packed;
538 
539 #define BT_HCI_OP_IO_CAPABILITY_NEG_REPLY       BT_OP(BT_OGF_LINK_CTRL, 0x0034) /* 0x0434 */
540 struct bt_hci_cp_io_capability_neg_reply {
541 	bt_addr_t bdaddr;
542 	uint8_t   reason;
543 } __packed;
544 
545 #define BT_HCI_OP_SET_EVENT_MASK                BT_OP(BT_OGF_BASEBAND, 0x0001) /* 0x0c01 */
546 struct bt_hci_cp_set_event_mask {
547 	uint8_t  events[8];
548 } __packed;
549 
550 #define BT_HCI_OP_RESET                         BT_OP(BT_OGF_BASEBAND, 0x0003) /* 0x0c03 */
551 
552 #define BT_HCI_OP_WRITE_LOCAL_NAME              BT_OP(BT_OGF_BASEBAND, 0x0013) /* 0x0c13 */
553 struct bt_hci_write_local_name {
554 	uint8_t local_name[248];
555 } __packed;
556 
557 #define BT_HCI_OP_READ_CONN_ACCEPT_TIMEOUT      BT_OP(BT_OGF_BASEBAND, 0x0015) /* 0x0c15 */
558 struct bt_hci_rp_read_conn_accept_timeout {
559 	uint8_t  status;
560 	uint16_t conn_accept_timeout;
561 } __packed;
562 
563 #define BT_HCI_OP_WRITE_CONN_ACCEPT_TIMEOUT     BT_OP(BT_OGF_BASEBAND, 0x0016) /* 0x0c16 */
564 struct bt_hci_cp_write_conn_accept_timeout {
565 	uint16_t conn_accept_timeout;
566 } __packed;
567 
568 struct bt_hci_rp_write_conn_accept_timeout {
569 	uint8_t  status;
570 } __packed;
571 
572 #define BT_HCI_OP_WRITE_PAGE_TIMEOUT            BT_OP(BT_OGF_BASEBAND, 0x0018) /* 0x0c18 */
573 
574 #define BT_HCI_OP_WRITE_SCAN_ENABLE             BT_OP(BT_OGF_BASEBAND, 0x001a) /* 0x0c1a */
575 #define BT_BREDR_SCAN_DISABLED                  0x00
576 #define BT_BREDR_SCAN_INQUIRY                   0x01
577 #define BT_BREDR_SCAN_PAGE                      0x02
578 
579 #define BT_COD(major_service, major_device, minor_device)                         \
580 	(((uint32_t)major_service << 13) | ((uint32_t)major_device << 8) |            \
581 	 ((uint32_t)minor_device << 2))
582 #define BT_COD_VALID(cod) ((0 == (cod[0] & (BIT(0) | BIT(1)))) ? true : false)
583 #define BT_COD_MAJOR_SERVICE_CLASSES(cod)                                         \
584 	((((uint32_t)cod[2] & 0xFF) >> 5) | (((uint32_t)cod[1] & 0xD0) >> 5))
585 #define BT_COD_MAJOR_DEVICE_CLASS(cod) ((((uint32_t)cod[1]) & 0x1FUL))
586 #define BT_COD_MINOR_DEVICE_CLASS(cod) (((((uint32_t)cod[0]) & 0xFF) >> 2))
587 
588 #define BT_COD_MAJOR_MISC           0x00
589 #define BT_COD_MAJOR_COMPUTER       0x01
590 #define BT_COD_MAJOR_PHONE          0x02
591 #define BT_COD_MAJOR_LAN_NETWORK_AP 0x03
592 #define BT_COD_MAJOR_AUDIO_VIDEO    0x04
593 #define BT_COD_MAJOR_PERIPHERAL     0x05
594 #define BT_COD_MAJOR_IMAGING        0x06
595 #define BT_COD_MAJOR_WEARABLE       0x07
596 #define BT_COD_MAJOR_TOY            0x08
597 #define BT_COD_MAJOR_HEALTH         0x09
598 #define BT_COD_MAJOR_UNCATEGORIZED  0x1F
599 
600 /* Minor Device Class field - Computer Major Class */
601 #define BT_COD_MAJOR_COMPUTER_MINOR_UNCATEGORIZED         0x00
602 #define BT_COD_MAJOR_COMPUTER_MINOR_DESKTOP               0x01
603 #define BT_COD_MAJOR_COMPUTER_MINOR_SERVER_CLASS_COMPUTER 0x02
604 #define BT_COD_MAJOR_COMPUTER_MINOR_LAPTOP                0x03
605 #define BT_COD_MAJOR_COMPUTER_MINOR_HANDHELD_PC_PDA       0x04
606 #define BT_COD_MAJOR_COMPUTER_MINOR_PALM_SIZE_PC_PDA      0x05
607 #define BT_COD_MAJOR_COMPUTER_MINOR_WEARABLE_COMPUTER     0x06
608 #define BT_COD_MAJOR_COMPUTER_MINOR_TABLET                0x07
609 
610 /* Minor Device Class field - Phone Major Class */
611 #define BT_COD_MAJOR_PHONE_MINOR_UNCATEGORIZED             0x00
612 #define BT_COD_MAJOR_PHONE_MINOR_CELLULAR                  0x01
613 #define BT_COD_MAJOR_PHONE_MINOR_CORDLESS                  0x02
614 #define BT_COD_MAJOR_PHONE_MINOR_SMARTPHONE                0x03
615 #define BT_COD_MAJOR_PHONE_MINOR_WIRED_MODEM_VOICE_GATEWAY 0x04
616 #define BT_COD_MAJOR_PHONE_MINOR_ISDN                      0x05
617 
618 /* Minor Device Class field - Audio/Video Major Class */
619 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_UNCATEGORIZED             0x00
620 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_WEARABLE_HEADSET          0x01
621 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_HANDS_FREE                0x02
622 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_RFU                       0x03
623 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_MICROPHONE                0x04
624 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_LOUDSPEAKER               0x05
625 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_HEADPHONES                0x06
626 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_PORTABLE_AUDIO            0x07
627 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_CAR_AUDIO                 0x08
628 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_SET_TOP_BOX               0x09
629 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_HIFI_AUDIO                0x0A
630 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VCR                       0x0B
631 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_CAMERA              0x0C
632 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_CAMCORDER                 0x0D
633 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_MONITOR             0x0E
634 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_DISPLAY_LOUDSPEAKER 0x0F
635 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_VIDEO_CONFERENCING        0x10
636 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_RFU2                      0x11
637 #define BT_COD_MAJOR_AUDIO_VIDEO_MINOR_GAME_TOY                  0x12
638 
639 #define BT_HCI_OP_WRITE_CLASS_OF_DEVICE         BT_OP(BT_OGF_BASEBAND, 0x0024) /* 0x0c24 */
640 struct bt_hci_cp_write_class_of_device {
641 	uint8_t  class_of_device[3];
642 } __packed;
643 
644 #define BT_TX_POWER_LEVEL_CURRENT               0x00
645 #define BT_TX_POWER_LEVEL_MAX                   0x01
646 #define BT_HCI_OP_READ_TX_POWER_LEVEL           BT_OP(BT_OGF_BASEBAND, 0x002d) /* 0x0c2d */
647 struct bt_hci_cp_read_tx_power_level {
648 	uint16_t handle;
649 	uint8_t  type;
650 } __packed;
651 
652 struct bt_hci_rp_read_tx_power_level {
653 	uint8_t  status;
654 	uint16_t handle;
655 	int8_t   tx_power_level;
656 } __packed;
657 
658 #define BT_HCI_LE_TX_POWER_PHY_1M               0x01
659 #define BT_HCI_LE_TX_POWER_PHY_2M               0x02
660 #define BT_HCI_LE_TX_POWER_PHY_CODED_S8         0x03
661 #define BT_HCI_LE_TX_POWER_PHY_CODED_S2         0x04
662 #define BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL    BT_OP(BT_OGF_LE, 0x0076) /* 0x2076 */
663 struct bt_hci_cp_le_read_tx_power_level {
664 	uint16_t handle;
665 	uint8_t  phy;
666 } __packed;
667 
668 struct bt_hci_rp_le_read_tx_power_level {
669 	uint8_t  status;
670 	uint16_t handle;
671 	uint8_t  phy;
672 	int8_t   current_tx_power_level;
673 	int8_t   max_tx_power_level;
674 } __packed;
675 
676 #define BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL	BT_OP(BT_OGF_LE, 0x0077) /* 0x2077 */
677 
678 #define BT_HCI_LE_TX_POWER_REPORT_DISABLE       0x00
679 #define BT_HCI_LE_TX_POWER_REPORT_ENABLE        0x01
680 #define BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE BT_OP(BT_OGF_LE, 0x007A) /* 0x207A */
681 struct bt_hci_cp_le_set_tx_power_report_enable {
682 	uint16_t handle;
683 	uint8_t  local_enable;
684 	uint8_t  remote_enable;
685 } __packed;
686 
687 struct bt_hci_cp_le_set_path_loss_reporting_parameters {
688 	uint16_t handle;
689 	uint8_t  high_threshold;
690 	uint8_t  high_hysteresis;
691 	uint8_t  low_threshold;
692 	uint8_t  low_hysteresis;
693 	uint16_t min_time_spent;
694 } __packed;
695 
696 struct bt_hci_cp_le_set_path_loss_reporting_enable {
697 	uint16_t handle;
698 	uint8_t  enable;
699 } __packed;
700 
701 #define BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_PARAMETERS BT_OP(BT_OGF_LE, 0x0078) /* 0x2078 */
702 
703 #define BT_HCI_LE_PATH_LOSS_REPORTING_DISABLE       0x00
704 #define BT_HCI_LE_PATH_LOSS_REPORTING_ENABLE        0x01
705 #define BT_HCI_OP_LE_SET_PATH_LOSS_REPORTING_ENABLE BT_OP(BT_OGF_LE, 0x0079) /* 0x2079 */
706 
707 #define BT_HCI_CTL_TO_HOST_FLOW_DISABLE         0x00
708 #define BT_HCI_CTL_TO_HOST_FLOW_ENABLE          0x01
709 #define BT_HCI_OP_SET_CTL_TO_HOST_FLOW          BT_OP(BT_OGF_BASEBAND, 0x0031) /* 0x0c31 */
710 struct bt_hci_cp_set_ctl_to_host_flow {
711 	uint8_t  flow_enable;
712 } __packed;
713 
714 #define BT_HCI_OP_HOST_BUFFER_SIZE              BT_OP(BT_OGF_BASEBAND, 0x0033) /* 0x0c33 */
715 struct bt_hci_cp_host_buffer_size {
716 	uint16_t acl_mtu;
717 	uint8_t  sco_mtu;
718 	uint16_t acl_pkts;
719 	uint16_t sco_pkts;
720 } __packed;
721 
722 struct bt_hci_handle_count {
723 	uint16_t handle;
724 	uint16_t count;
725 } __packed;
726 
727 #define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS    BT_OP(BT_OGF_BASEBAND, 0x0035) /* 0x0c35 */
728 struct bt_hci_cp_host_num_completed_packets {
729 	uint8_t  num_handles;
730 	struct bt_hci_handle_count h[0];
731 } __packed;
732 
733 #define BT_HCI_OP_WRITE_INQUIRY_MODE            BT_OP(BT_OGF_BASEBAND, 0x0045) /* 0x0c45 */
734 struct bt_hci_cp_write_inquiry_mode {
735 	uint8_t  mode;
736 } __packed;
737 
738 #define BT_HCI_OP_WRITE_SSP_MODE                BT_OP(BT_OGF_BASEBAND, 0x0056) /* 0x0c56 */
739 struct bt_hci_cp_write_ssp_mode {
740 	uint8_t mode;
741 } __packed;
742 
743 #define BT_HCI_OP_SET_EVENT_MASK_PAGE_2         BT_OP(BT_OGF_BASEBAND, 0x0063) /* 0x0c63 */
744 struct bt_hci_cp_set_event_mask_page_2 {
745 	uint8_t  events_page_2[8];
746 } __packed;
747 
748 #define BT_HCI_OP_LE_WRITE_LE_HOST_SUPP         BT_OP(BT_OGF_BASEBAND, 0x006d) /* 0x0c6d */
749 struct bt_hci_cp_write_le_host_supp {
750 	uint8_t  le;
751 	uint8_t  simul;
752 } __packed;
753 
754 #define BT_HCI_OP_WRITE_SC_HOST_SUPP            BT_OP(BT_OGF_BASEBAND, 0x007a) /* 0x0c7a */
755 struct bt_hci_cp_write_sc_host_supp {
756 	uint8_t  sc_support;
757 } __packed;
758 
759 #define BT_HCI_OP_READ_AUTH_PAYLOAD_TIMEOUT     BT_OP(BT_OGF_BASEBAND, 0x007b) /* 0x0c7b */
760 struct bt_hci_cp_read_auth_payload_timeout {
761 	uint16_t handle;
762 } __packed;
763 
764 struct bt_hci_rp_read_auth_payload_timeout {
765 	uint8_t  status;
766 	uint16_t handle;
767 	uint16_t auth_payload_timeout;
768 } __packed;
769 
770 #define BT_HCI_OP_WRITE_AUTH_PAYLOAD_TIMEOUT    BT_OP(BT_OGF_BASEBAND, 0x007c) /* 0x0c7c */
771 struct bt_hci_cp_write_auth_payload_timeout {
772 	uint16_t handle;
773 	uint16_t auth_payload_timeout;
774 } __packed;
775 
776 struct bt_hci_rp_write_auth_payload_timeout {
777 	uint8_t  status;
778 	uint16_t handle;
779 } __packed;
780 
781 #define BT_HCI_OP_CONFIGURE_DATA_PATH           BT_OP(BT_OGF_BASEBAND, 0x0083) /* 0x0c83 */
782 struct bt_hci_cp_configure_data_path {
783 	uint8_t  data_path_dir;
784 	uint8_t  data_path_id;
785 	uint8_t  vs_config_len;
786 	uint8_t  vs_config[0];
787 } __packed;
788 
789 struct bt_hci_rp_configure_data_path {
790 	uint8_t  status;
791 } __packed;
792 
793 /* HCI version from Assigned Numbers */
794 #define BT_HCI_VERSION_1_0B                     0
795 #define BT_HCI_VERSION_1_1                      1
796 #define BT_HCI_VERSION_1_2                      2
797 #define BT_HCI_VERSION_2_0                      3
798 #define BT_HCI_VERSION_2_1                      4
799 #define BT_HCI_VERSION_3_0                      5
800 #define BT_HCI_VERSION_4_0                      6
801 #define BT_HCI_VERSION_4_1                      7
802 #define BT_HCI_VERSION_4_2                      8
803 #define BT_HCI_VERSION_5_0                      9
804 #define BT_HCI_VERSION_5_1                      10
805 #define BT_HCI_VERSION_5_2                      11
806 #define BT_HCI_VERSION_5_3                      12
807 #define BT_HCI_VERSION_5_4                      13
808 
809 #define BT_HCI_OP_READ_LOCAL_VERSION_INFO       BT_OP(BT_OGF_INFO, 0x0001) /* 0x1001 */
810 struct bt_hci_rp_read_local_version_info {
811 	uint8_t  status;
812 	uint8_t  hci_version;
813 	uint16_t hci_revision;
814 	uint8_t  lmp_version;
815 	uint16_t manufacturer;
816 	uint16_t lmp_subversion;
817 } __packed;
818 
819 #define BT_HCI_OP_READ_SUPPORTED_COMMANDS       BT_OP(BT_OGF_INFO, 0x0002) /* 0x1002 */
820 struct bt_hci_rp_read_supported_commands {
821 	uint8_t  status;
822 	uint8_t  commands[64];
823 } __packed;
824 
825 #define BT_HCI_OP_READ_LOCAL_EXT_FEATURES       BT_OP(BT_OGF_INFO, 0x0004) /* 0x1004 */
826 struct bt_hci_cp_read_local_ext_features {
827 	uint8_t page;
828 };
829 struct bt_hci_rp_read_local_ext_features {
830 	uint8_t  status;
831 	uint8_t  page;
832 	uint8_t  max_page;
833 	uint8_t  ext_features[8];
834 } __packed;
835 
836 #define BT_HCI_OP_READ_LOCAL_FEATURES           BT_OP(BT_OGF_INFO, 0x0003) /* 0x1003 */
837 struct bt_hci_rp_read_local_features {
838 	uint8_t  status;
839 	uint8_t  features[8];
840 } __packed;
841 
842 #define BT_HCI_OP_READ_BUFFER_SIZE              BT_OP(BT_OGF_INFO, 0x0005) /* 0x1005 */
843 struct bt_hci_rp_read_buffer_size {
844 	uint8_t  status;
845 	uint16_t acl_max_len;
846 	uint8_t  sco_max_len;
847 	uint16_t acl_max_num;
848 	uint16_t sco_max_num;
849 } __packed;
850 
851 #define BT_HCI_OP_READ_BD_ADDR                  BT_OP(BT_OGF_INFO, 0x0009) /* 0x1009 */
852 struct bt_hci_rp_read_bd_addr {
853 	uint8_t   status;
854 	bt_addr_t bdaddr;
855 } __packed;
856 
857 /* logic transport type bits as returned when reading supported codecs */
858 #define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_ACL BIT(0)
859 #define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_SCO BIT(1)
860 #define BT_HCI_CODEC_TRANSPORT_MASK_LE_CIS    BIT(2)
861 #define BT_HCI_CODEC_TRANSPORT_MASK_LE_BIS    BIT(3)
862 
863 /* logic transport types for reading codec capabilities and controller delays */
864 #define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_ACL 0x00
865 #define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_SCO 0x01
866 #define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_CIS    0x02
867 #define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_BIS    0x03
868 
869 /* audio datapath directions */
870 #define BT_HCI_DATAPATH_DIR_HOST_TO_CTLR 0x00
871 #define BT_HCI_DATAPATH_DIR_CTLR_TO_HOST 0x01
872 
873 /* audio datapath IDs */
874 #define BT_HCI_DATAPATH_ID_HCI      0x00
875 #define BT_HCI_DATAPATH_ID_VS       0x01
876 #define BT_HCI_DATAPATH_ID_VS_END   0xfe
877 
878 /* coding format assigned numbers, used for codec IDs */
879 #define BT_HCI_CODING_FORMAT_ULAW_LOG    0x00
880 #define BT_HCI_CODING_FORMAT_ALAW_LOG    0x01
881 #define BT_HCI_CODING_FORMAT_CVSD        0x02
882 #define BT_HCI_CODING_FORMAT_TRANSPARENT 0x03
883 #define BT_HCI_CODING_FORMAT_LINEAR_PCM  0x04
884 #define BT_HCI_CODING_FORMAT_MSBC        0x05
885 #define BT_HCI_CODING_FORMAT_LC3         0x06
886 #define BT_HCI_CODING_FORMAT_G729A       0x07
887 #define BT_HCI_CODING_FORMAT_VS          0xFF
888 
889 
890 #define BT_HCI_OP_READ_CODECS                   BT_OP(BT_OGF_INFO, 0x000b) /* 0x100b */
891 struct bt_hci_std_codec_info {
892 	uint8_t codec_id;
893 } __packed;
894 struct bt_hci_std_codecs {
895 	uint8_t num_codecs;
896 	struct bt_hci_std_codec_info codec_info[0];
897 } __packed;
898 struct bt_hci_vs_codec_info {
899 	uint16_t company_id;
900 	uint16_t codec_id;
901 } __packed;
902 struct bt_hci_vs_codecs {
903 	uint8_t num_codecs;
904 	struct bt_hci_vs_codec_info codec_info[0];
905 } __packed;
906 struct bt_hci_rp_read_codecs {
907 	uint8_t status;
908 	/* other fields filled in dynamically */
909 	uint8_t codecs[0];
910 } __packed;
911 
912 #define BT_HCI_OP_READ_CODECS_V2                BT_OP(BT_OGF_INFO, 0x000d) /* 0x100d */
913 struct bt_hci_std_codec_info_v2 {
914 	uint8_t codec_id;
915 	uint8_t transports; /* bitmap */
916 } __packed;
917 struct bt_hci_std_codecs_v2 {
918 	uint8_t num_codecs;
919 	struct bt_hci_std_codec_info_v2 codec_info[0];
920 } __packed;
921 struct bt_hci_vs_codec_info_v2 {
922 	uint16_t company_id;
923 	uint16_t codec_id;
924 	uint8_t transports; /* bitmap */
925 } __packed;
926 struct bt_hci_vs_codecs_v2 {
927 	uint8_t num_codecs;
928 	struct bt_hci_vs_codec_info_v2 codec_info[0];
929 } __packed;
930 struct bt_hci_rp_read_codecs_v2 {
931 	uint8_t status;
932 	/* other fields filled in dynamically */
933 	uint8_t codecs[0];
934 } __packed;
935 
936 struct bt_hci_cp_codec_id {
937 	uint8_t coding_format;
938 	uint16_t company_id;
939 	uint16_t vs_codec_id;
940 } __packed;
941 
942 #define BT_HCI_OP_READ_CODEC_CAPABILITIES       BT_OP(BT_OGF_INFO, 0x000e) /* 0x100e */
943 struct bt_hci_cp_read_codec_capabilities {
944 	struct bt_hci_cp_codec_id codec_id;
945 	uint8_t transport;
946 	uint8_t direction;
947 } __packed;
948 struct bt_hci_codec_capability_info {
949 	uint8_t length;
950 	uint8_t data[0];
951 } __packed;
952 struct bt_hci_rp_read_codec_capabilities {
953 	uint8_t status;
954 	uint8_t num_capabilities;
955 	/* other fields filled in dynamically */
956 	uint8_t capabilities[0];
957 } __packed;
958 
959 #define BT_HCI_OP_READ_CTLR_DELAY               BT_OP(BT_OGF_INFO, 0x000f) /* 0x100f */
960 struct bt_hci_cp_read_ctlr_delay {
961 	struct bt_hci_cp_codec_id codec_id;
962 	uint8_t transport;
963 	uint8_t direction;
964 	uint8_t codec_config_len;
965 	uint8_t codec_config[0];
966 } __packed;
967 struct bt_hci_rp_read_ctlr_delay {
968 	uint8_t status;
969 	uint8_t min_ctlr_delay[3];
970 	uint8_t max_ctlr_delay[3];
971 } __packed;
972 
973 #define BT_HCI_OP_READ_RSSI                     BT_OP(BT_OGF_STATUS, 0x0005) /* 0x1405 */
974 struct bt_hci_cp_read_rssi {
975 	uint16_t handle;
976 } __packed;
977 struct bt_hci_rp_read_rssi {
978 	uint8_t  status;
979 	uint16_t handle;
980 	int8_t   rssi;
981 } __packed;
982 
983 #define BT_HCI_ENCRYPTION_KEY_SIZE_MIN          7
984 #define BT_HCI_ENCRYPTION_KEY_SIZE_MAX          16
985 
986 #define BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE      BT_OP(BT_OGF_STATUS, 0x0008) /* 0x1408 */
987 struct bt_hci_cp_read_encryption_key_size {
988 	uint16_t handle;
989 } __packed;
990 struct bt_hci_rp_read_encryption_key_size {
991 	uint8_t  status;
992 	uint16_t handle;
993 	uint8_t  key_size;
994 } __packed;
995 
996 /* BLE */
997 
998 #define BT_HCI_OP_LE_SET_EVENT_MASK             BT_OP(BT_OGF_LE, 0x0001) /* 0x2001 */
999 struct bt_hci_cp_le_set_event_mask {
1000 	uint8_t events[8];
1001 } __packed;
1002 
1003 #define BT_HCI_OP_LE_READ_BUFFER_SIZE           BT_OP(BT_OGF_LE, 0x0002) /* 0x2002 */
1004 struct bt_hci_rp_le_read_buffer_size {
1005 	uint8_t  status;
1006 	uint16_t le_max_len;
1007 	uint8_t  le_max_num;
1008 } __packed;
1009 
1010 #define BT_HCI_OP_LE_READ_LOCAL_FEATURES        BT_OP(BT_OGF_LE, 0x0003) /* 0x2003 */
1011 struct bt_hci_rp_le_read_local_features {
1012 	uint8_t  status;
1013 	uint8_t  features[8];
1014 } __packed;
1015 
1016 #define BT_HCI_OP_LE_SET_RANDOM_ADDRESS         BT_OP(BT_OGF_LE, 0x0005) /* 0x2005 */
1017 struct bt_hci_cp_le_set_random_address {
1018 	bt_addr_t bdaddr;
1019 } __packed;
1020 
1021 #define BT_HCI_ADV_IND                          0x00
1022 #define BT_HCI_ADV_DIRECT_IND                   0x01
1023 #define BT_HCI_ADV_SCAN_IND                     0x02
1024 #define BT_HCI_ADV_NONCONN_IND                  0x03
1025 #define BT_HCI_ADV_DIRECT_IND_LOW_DUTY          0x04
1026 #define BT_HCI_ADV_SCAN_RSP                     0x04
1027 
1028 #define BT_LE_ADV_INTERVAL_MIN                  0x0020
1029 #define BT_LE_ADV_INTERVAL_MAX                  0x4000
1030 #define BT_LE_ADV_INTERVAL_DEFAULT              0x0800
1031 
1032 #define BT_LE_ADV_CHAN_MAP_CHAN_37              0x01
1033 #define BT_LE_ADV_CHAN_MAP_CHAN_38              0x02
1034 #define BT_LE_ADV_CHAN_MAP_CHAN_39              0x04
1035 #define BT_LE_ADV_CHAN_MAP_ALL                  0x07
1036 
1037 #define BT_LE_ADV_FP_NO_FILTER                  0x00
1038 #define BT_LE_ADV_FP_FILTER_SCAN_REQ            0x01
1039 #define BT_LE_ADV_FP_FILTER_CONN_IND            0x02
1040 #define BT_LE_ADV_FP_FILTER_BOTH                0x03
1041 
1042 #define BT_HCI_OP_LE_SET_ADV_PARAM              BT_OP(BT_OGF_LE, 0x0006) /* 0x2006 */
1043 struct bt_hci_cp_le_set_adv_param {
1044 	uint16_t     min_interval;
1045 	uint16_t     max_interval;
1046 	uint8_t      type;
1047 	uint8_t      own_addr_type;
1048 	bt_addr_le_t direct_addr;
1049 	uint8_t      channel_map;
1050 	uint8_t      filter_policy;
1051 } __packed;
1052 
1053 #define BT_HCI_OP_LE_READ_ADV_CHAN_TX_POWER     BT_OP(BT_OGF_LE, 0x0007) /* 0x2007 */
1054 struct bt_hci_rp_le_read_chan_tx_power {
1055 	uint8_t status;
1056 	int8_t  tx_power_level;
1057 } __packed;
1058 
1059 #define BT_HCI_OP_LE_SET_ADV_DATA               BT_OP(BT_OGF_LE, 0x0008) /* 0x2008 */
1060 struct bt_hci_cp_le_set_adv_data {
1061 	uint8_t  len;
1062 	uint8_t  data[31];
1063 } __packed;
1064 
1065 #define BT_HCI_OP_LE_SET_SCAN_RSP_DATA          BT_OP(BT_OGF_LE, 0x0009) /* 0x2009 */
1066 struct bt_hci_cp_le_set_scan_rsp_data {
1067 	uint8_t  len;
1068 	uint8_t  data[31];
1069 } __packed;
1070 
1071 #define BT_HCI_LE_ADV_DISABLE                   0x00
1072 #define BT_HCI_LE_ADV_ENABLE                    0x01
1073 
1074 #define BT_HCI_OP_LE_SET_ADV_ENABLE             BT_OP(BT_OGF_LE, 0x000a) /* 0x200a */
1075 struct bt_hci_cp_le_set_adv_enable {
1076 	uint8_t  enable;
1077 } __packed;
1078 
1079 /* Scan types */
1080 #define BT_HCI_OP_LE_SET_SCAN_PARAM             BT_OP(BT_OGF_LE, 0x000b) /* 0x200b */
1081 #define BT_HCI_LE_SCAN_PASSIVE                  0x00
1082 #define BT_HCI_LE_SCAN_ACTIVE                   0x01
1083 
1084 #define BT_HCI_LE_SCAN_FP_BASIC_NO_FILTER       0x00
1085 #define BT_HCI_LE_SCAN_FP_BASIC_FILTER          0x01
1086 #define BT_HCI_LE_SCAN_FP_EXT_NO_FILTER         0x02
1087 #define BT_HCI_LE_SCAN_FP_EXT_FILTER            0x03
1088 
1089 struct bt_hci_cp_le_set_scan_param {
1090 	uint8_t  scan_type;
1091 	uint16_t interval;
1092 	uint16_t window;
1093 	uint8_t  addr_type;
1094 	uint8_t  filter_policy;
1095 } __packed;
1096 
1097 #define BT_HCI_OP_LE_SET_SCAN_ENABLE            BT_OP(BT_OGF_LE, 0x000c) /* 0x200c */
1098 
1099 #define BT_HCI_LE_SCAN_DISABLE                  0x00
1100 #define BT_HCI_LE_SCAN_ENABLE                   0x01
1101 
1102 #define BT_HCI_LE_SCAN_FILTER_DUP_DISABLE       0x00
1103 #define BT_HCI_LE_SCAN_FILTER_DUP_ENABLE        0x01
1104 
1105 struct bt_hci_cp_le_set_scan_enable {
1106 	uint8_t  enable;
1107 	uint8_t  filter_dup;
1108 } __packed;
1109 
1110 #define BT_HCI_OP_LE_CREATE_CONN                BT_OP(BT_OGF_LE, 0x000d) /* 0x200d */
1111 
1112 #define BT_HCI_LE_CREATE_CONN_FP_NO_FILTER      0x00
1113 #define BT_HCI_LE_CREATE_CONN_FP_FILTER         0x01
1114 
1115 struct bt_hci_cp_le_create_conn {
1116 	uint16_t     scan_interval;
1117 	uint16_t     scan_window;
1118 	uint8_t      filter_policy;
1119 	bt_addr_le_t peer_addr;
1120 	uint8_t      own_addr_type;
1121 	uint16_t     conn_interval_min;
1122 	uint16_t     conn_interval_max;
1123 	uint16_t     conn_latency;
1124 	uint16_t     supervision_timeout;
1125 	uint16_t     min_ce_len;
1126 	uint16_t     max_ce_len;
1127 } __packed;
1128 
1129 #define BT_HCI_OP_LE_CREATE_CONN_CANCEL         BT_OP(BT_OGF_LE, 0x000e) /* 0x200e */
1130 
1131 #define BT_HCI_OP_LE_READ_FAL_SIZE               BT_OP(BT_OGF_LE, 0x000f) /* 0x200f */
1132 struct bt_hci_rp_le_read_fal_size {
1133 	uint8_t  status;
1134 	uint8_t  fal_size;
1135 } __packed;
1136 
1137 #define BT_HCI_OP_LE_CLEAR_FAL                   BT_OP(BT_OGF_LE, 0x0010) /* 0x2010 */
1138 
1139 #define BT_HCI_OP_LE_ADD_DEV_TO_FAL              BT_OP(BT_OGF_LE, 0x0011) /* 0x2011 */
1140 struct bt_hci_cp_le_add_dev_to_fal {
1141 	bt_addr_le_t  addr;
1142 } __packed;
1143 
1144 #define BT_HCI_OP_LE_REM_DEV_FROM_FAL            BT_OP(BT_OGF_LE, 0x0012) /* 0x2012 */
1145 struct bt_hci_cp_le_rem_dev_from_fal {
1146 	bt_addr_le_t  addr;
1147 } __packed;
1148 
1149 #define BT_HCI_OP_LE_CONN_UPDATE                BT_OP(BT_OGF_LE, 0x0013) /* 0x2013 */
1150 struct hci_cp_le_conn_update {
1151 	uint16_t handle;
1152 	uint16_t conn_interval_min;
1153 	uint16_t conn_interval_max;
1154 	uint16_t conn_latency;
1155 	uint16_t supervision_timeout;
1156 	uint16_t min_ce_len;
1157 	uint16_t max_ce_len;
1158 } __packed;
1159 
1160 #define BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF      BT_OP(BT_OGF_LE, 0x0014) /* 0x2014 */
1161 struct bt_hci_cp_le_set_host_chan_classif {
1162 	uint8_t  ch_map[5];
1163 } __packed;
1164 
1165 #define BT_HCI_OP_LE_READ_CHAN_MAP              BT_OP(BT_OGF_LE, 0x0015) /* 0x2015 */
1166 struct bt_hci_cp_le_read_chan_map {
1167 	uint16_t handle;
1168 } __packed;
1169 struct bt_hci_rp_le_read_chan_map {
1170 	uint8_t  status;
1171 	uint16_t handle;
1172 	uint8_t  ch_map[5];
1173 } __packed;
1174 
1175 #define BT_HCI_OP_LE_READ_REMOTE_FEATURES       BT_OP(BT_OGF_LE, 0x0016) /* 0x2016 */
1176 struct bt_hci_cp_le_read_remote_features {
1177 	uint16_t  handle;
1178 } __packed;
1179 
1180 #define BT_HCI_OP_LE_ENCRYPT                    BT_OP(BT_OGF_LE, 0x0017) /* 0x2017 */
1181 struct bt_hci_cp_le_encrypt {
1182 	uint8_t  key[16];
1183 	uint8_t  plaintext[16];
1184 } __packed;
1185 struct bt_hci_rp_le_encrypt {
1186 	uint8_t  status;
1187 	uint8_t  enc_data[16];
1188 } __packed;
1189 
1190 #define BT_HCI_OP_LE_RAND                       BT_OP(BT_OGF_LE, 0x0018) /* 0x2018 */
1191 struct bt_hci_rp_le_rand {
1192 	uint8_t  status;
1193 	uint8_t  rand[8];
1194 } __packed;
1195 
1196 #define BT_HCI_OP_LE_START_ENCRYPTION           BT_OP(BT_OGF_LE, 0x0019) /* 0x2019 */
1197 struct bt_hci_cp_le_start_encryption {
1198 	uint16_t handle;
1199 	uint64_t rand;
1200 	uint16_t ediv;
1201 	uint8_t  ltk[16];
1202 } __packed;
1203 
1204 #define BT_HCI_OP_LE_LTK_REQ_REPLY              BT_OP(BT_OGF_LE, 0x001a) /* 0x201a */
1205 struct bt_hci_cp_le_ltk_req_reply {
1206 	uint16_t handle;
1207 	uint8_t  ltk[16];
1208 } __packed;
1209 struct bt_hci_rp_le_ltk_req_reply {
1210 	uint8_t  status;
1211 	uint16_t handle;
1212 } __packed;
1213 
1214 #define BT_HCI_OP_LE_LTK_REQ_NEG_REPLY          BT_OP(BT_OGF_LE, 0x001b) /* 0x201b */
1215 struct bt_hci_cp_le_ltk_req_neg_reply {
1216 	uint16_t handle;
1217 } __packed;
1218 struct bt_hci_rp_le_ltk_req_neg_reply {
1219 	uint8_t  status;
1220 	uint16_t handle;
1221 } __packed;
1222 
1223 #define BT_HCI_OP_LE_READ_SUPP_STATES           BT_OP(BT_OGF_LE, 0x001c) /* 0x201c */
1224 struct bt_hci_rp_le_read_supp_states {
1225 	uint8_t  status;
1226 	uint8_t  le_states[8];
1227 } __packed;
1228 
1229 #define BT_HCI_OP_LE_RX_TEST                    BT_OP(BT_OGF_LE, 0x001d) /* 0x201d */
1230 struct bt_hci_cp_le_rx_test {
1231 	uint8_t  rx_ch;
1232 } __packed;
1233 
1234 #define BT_HCI_TEST_PKT_PAYLOAD_PRBS9           0x00
1235 #define BT_HCI_TEST_PKT_PAYLOAD_11110000        0x01
1236 #define BT_HCI_TEST_PKT_PAYLOAD_10101010        0x02
1237 #define BT_HCI_TEST_PKT_PAYLOAD_PRBS15          0x03
1238 #define BT_HCI_TEST_PKT_PAYLOAD_11111111        0x04
1239 #define BT_HCI_TEST_PKT_PAYLOAD_00000000        0x05
1240 #define BT_HCI_TEST_PKT_PAYLOAD_00001111        0x06
1241 #define BT_HCI_TEST_PKT_PAYLOAD_01010101        0x07
1242 
1243 #define BT_HCI_OP_LE_TX_TEST                    BT_OP(BT_OGF_LE, 0x001e) /* 0x201e */
1244 struct bt_hci_cp_le_tx_test {
1245 	uint8_t  tx_ch;
1246 	uint8_t  test_data_len;
1247 	uint8_t  pkt_payload;
1248 } __packed;
1249 
1250 #define BT_HCI_OP_LE_TEST_END                   BT_OP(BT_OGF_LE, 0x001f) /* 0x201f */
1251 struct bt_hci_rp_le_test_end {
1252 	uint8_t  status;
1253 	uint16_t rx_pkt_count;
1254 } __packed;
1255 
1256 #define BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY       BT_OP(BT_OGF_LE, 0x0020) /* 0x2020 */
1257 struct bt_hci_cp_le_conn_param_req_reply {
1258 	uint16_t handle;
1259 	uint16_t interval_min;
1260 	uint16_t interval_max;
1261 	uint16_t latency;
1262 	uint16_t timeout;
1263 	uint16_t min_ce_len;
1264 	uint16_t max_ce_len;
1265 } __packed;
1266 struct bt_hci_rp_le_conn_param_req_reply {
1267 	uint8_t  status;
1268 	uint16_t handle;
1269 } __packed;
1270 
1271 #define BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY   BT_OP(BT_OGF_LE, 0x0021) /* 0x2021 */
1272 struct bt_hci_cp_le_conn_param_req_neg_reply {
1273 	uint16_t handle;
1274 	uint8_t  reason;
1275 } __packed;
1276 struct bt_hci_rp_le_conn_param_req_neg_reply {
1277 	uint8_t  status;
1278 	uint16_t handle;
1279 } __packed;
1280 
1281 #define BT_HCI_OP_LE_SET_DATA_LEN               BT_OP(BT_OGF_LE, 0x0022) /* 0x2022 */
1282 struct bt_hci_cp_le_set_data_len {
1283 	uint16_t handle;
1284 	uint16_t tx_octets;
1285 	uint16_t tx_time;
1286 } __packed;
1287 struct bt_hci_rp_le_set_data_len {
1288 	uint8_t  status;
1289 	uint16_t handle;
1290 } __packed;
1291 
1292 #define BT_HCI_OP_LE_READ_DEFAULT_DATA_LEN      BT_OP(BT_OGF_LE, 0x0023) /* 0x2023 */
1293 struct bt_hci_rp_le_read_default_data_len {
1294 	uint8_t  status;
1295 	uint16_t max_tx_octets;
1296 	uint16_t max_tx_time;
1297 } __packed;
1298 
1299 #define BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN     BT_OP(BT_OGF_LE, 0x0024) /* 0x2024 */
1300 struct bt_hci_cp_le_write_default_data_len {
1301 	uint16_t max_tx_octets;
1302 	uint16_t max_tx_time;
1303 } __packed;
1304 
1305 #define BT_HCI_OP_LE_P256_PUBLIC_KEY            BT_OP(BT_OGF_LE, 0x0025) /* 0x2025 */
1306 
1307 #define BT_HCI_OP_LE_GENERATE_DHKEY             BT_OP(BT_OGF_LE, 0x0026) /* 0x2026 */
1308 struct bt_hci_cp_le_generate_dhkey {
1309 	uint8_t key[64];
1310 } __packed;
1311 
1312 
1313 #define BT_HCI_OP_LE_GENERATE_DHKEY_V2          BT_OP(BT_OGF_LE, 0x005e) /* 0x205e */
1314 
1315 #define BT_HCI_LE_KEY_TYPE_GENERATED            0x00
1316 #define BT_HCI_LE_KEY_TYPE_DEBUG                0x01
1317 
1318 struct bt_hci_cp_le_generate_dhkey_v2 {
1319 	uint8_t key[64];
1320 	uint8_t key_type;
1321 } __packed;
1322 
1323 
1324 #define BT_HCI_OP_LE_ADD_DEV_TO_RL              BT_OP(BT_OGF_LE, 0x0027) /* 0x2027 */
1325 struct bt_hci_cp_le_add_dev_to_rl {
1326 	bt_addr_le_t  peer_id_addr;
1327 	uint8_t       peer_irk[16];
1328 	uint8_t       local_irk[16];
1329 } __packed;
1330 
1331 #define BT_HCI_OP_LE_REM_DEV_FROM_RL            BT_OP(BT_OGF_LE, 0x0028) /* 0x2028 */
1332 struct bt_hci_cp_le_rem_dev_from_rl {
1333 	bt_addr_le_t  peer_id_addr;
1334 } __packed;
1335 
1336 #define BT_HCI_OP_LE_CLEAR_RL                   BT_OP(BT_OGF_LE, 0x0029) /* 0x2029 */
1337 
1338 #define BT_HCI_OP_LE_READ_RL_SIZE               BT_OP(BT_OGF_LE, 0x002a) /* 0x202a */
1339 struct bt_hci_rp_le_read_rl_size {
1340 	uint8_t  status;
1341 	uint8_t  rl_size;
1342 } __packed;
1343 
1344 #define BT_HCI_OP_LE_READ_PEER_RPA              BT_OP(BT_OGF_LE, 0x002b) /* 0x202b */
1345 struct bt_hci_cp_le_read_peer_rpa {
1346 	bt_addr_le_t  peer_id_addr;
1347 } __packed;
1348 struct bt_hci_rp_le_read_peer_rpa {
1349 	uint8_t    status;
1350 	bt_addr_t  peer_rpa;
1351 } __packed;
1352 
1353 #define BT_HCI_OP_LE_READ_LOCAL_RPA             BT_OP(BT_OGF_LE, 0x002c) /* 0x202c */
1354 struct bt_hci_cp_le_read_local_rpa {
1355 	bt_addr_le_t  peer_id_addr;
1356 } __packed;
1357 struct bt_hci_rp_le_read_local_rpa {
1358 	uint8_t    status;
1359 	bt_addr_t  local_rpa;
1360 } __packed;
1361 
1362 #define BT_HCI_ADDR_RES_DISABLE                 0x00
1363 #define BT_HCI_ADDR_RES_ENABLE                  0x01
1364 
1365 #define BT_HCI_OP_LE_SET_ADDR_RES_ENABLE        BT_OP(BT_OGF_LE, 0x002d) /* 0x202d */
1366 struct bt_hci_cp_le_set_addr_res_enable {
1367 	uint8_t  enable;
1368 } __packed;
1369 
1370 #define BT_HCI_OP_LE_SET_RPA_TIMEOUT            BT_OP(BT_OGF_LE, 0x002e) /* 0x202e */
1371 struct bt_hci_cp_le_set_rpa_timeout {
1372 	uint16_t rpa_timeout;
1373 } __packed;
1374 
1375 /* All limits according to BT Core spec 5.4 [Vol 4, Part E, 7.8.46] */
1376 #define BT_HCI_LE_MAX_TX_OCTETS_MIN             0x001B
1377 #define BT_HCI_LE_MAX_TX_OCTETS_MAX             0x00FB
1378 #define BT_HCI_LE_MAX_RX_OCTETS_MIN             0x001B
1379 #define BT_HCI_LE_MAX_RX_OCTETS_MAX             0x00FB
1380 
1381 #define BT_HCI_LE_MAX_TX_TIME_MIN               0x0148
1382 #define BT_HCI_LE_MAX_TX_TIME_MAX               0x4290
1383 #define BT_HCI_LE_MAX_RX_TIME_MIN               0x0148
1384 #define BT_HCI_LE_MAX_RX_TIME_MAX               0x4290
1385 
1386 #define BT_HCI_OP_LE_READ_MAX_DATA_LEN          BT_OP(BT_OGF_LE, 0x002f) /* 0x202f */
1387 struct bt_hci_rp_le_read_max_data_len {
1388 	uint8_t  status;
1389 	uint16_t max_tx_octets;
1390 	uint16_t max_tx_time;
1391 	uint16_t max_rx_octets;
1392 	uint16_t max_rx_time;
1393 } __packed;
1394 
1395 #define BT_HCI_LE_PHY_1M                        0x01
1396 #define BT_HCI_LE_PHY_2M                        0x02
1397 #define BT_HCI_LE_PHY_CODED                     0x03
1398 
1399 #define BT_HCI_OP_LE_READ_PHY                   BT_OP(BT_OGF_LE, 0x0030) /* 0x2030 */
1400 struct bt_hci_cp_le_read_phy {
1401 	uint16_t handle;
1402 } __packed;
1403 struct bt_hci_rp_le_read_phy {
1404 	uint8_t  status;
1405 	uint16_t handle;
1406 	uint8_t  tx_phy;
1407 	uint8_t  rx_phy;
1408 } __packed;
1409 
1410 #define BT_HCI_LE_PHY_TX_ANY                    BIT(0)
1411 #define BT_HCI_LE_PHY_RX_ANY                    BIT(1)
1412 
1413 #define BT_HCI_LE_PHY_PREFER_1M                 BIT(0)
1414 #define BT_HCI_LE_PHY_PREFER_2M                 BIT(1)
1415 #define BT_HCI_LE_PHY_PREFER_CODED              BIT(2)
1416 
1417 #define BT_HCI_OP_LE_SET_DEFAULT_PHY            BT_OP(BT_OGF_LE, 0x0031) /* 0x2031 */
1418 struct bt_hci_cp_le_set_default_phy {
1419 	uint8_t all_phys;
1420 	uint8_t tx_phys;
1421 	uint8_t rx_phys;
1422 } __packed;
1423 
1424 #define BT_HCI_LE_PHY_CODED_ANY                 0x00
1425 #define BT_HCI_LE_PHY_CODED_S2                  0x01
1426 #define BT_HCI_LE_PHY_CODED_S8                  0x02
1427 
1428 #define BT_HCI_OP_LE_SET_PHY                    BT_OP(BT_OGF_LE, 0x0032) /* 0x2032 */
1429 struct bt_hci_cp_le_set_phy {
1430 	uint16_t  handle;
1431 	uint8_t   all_phys;
1432 	uint8_t   tx_phys;
1433 	uint8_t   rx_phys;
1434 	uint16_t  phy_opts;
1435 } __packed;
1436 
1437 #define BT_HCI_LE_MOD_INDEX_STANDARD            0x00
1438 #define BT_HCI_LE_MOD_INDEX_STABLE              0x01
1439 
1440 #define BT_HCI_LE_RX_PHY_1M                     0x01
1441 #define BT_HCI_LE_RX_PHY_2M                     0x02
1442 #define BT_HCI_LE_RX_PHY_CODED                  0x03
1443 
1444 #define BT_HCI_OP_LE_ENH_RX_TEST                BT_OP(BT_OGF_LE, 0x0033) /* 0x2033 */
1445 struct bt_hci_cp_le_enh_rx_test {
1446 	uint8_t  rx_ch;
1447 	uint8_t  phy;
1448 	uint8_t  mod_index;
1449 } __packed;
1450 
1451 #define BT_HCI_LE_TX_PHY_1M                     0x01
1452 #define BT_HCI_LE_TX_PHY_2M                     0x02
1453 #define BT_HCI_LE_TX_PHY_CODED_S8               0x03
1454 #define BT_HCI_LE_TX_PHY_CODED_S2               0x04
1455 
1456 #define BT_HCI_OP_LE_ENH_TX_TEST                BT_OP(BT_OGF_LE, 0x0034) /* 0x2034 */
1457 struct bt_hci_cp_le_enh_tx_test {
1458 	uint8_t  tx_ch;
1459 	uint8_t  test_data_len;
1460 	uint8_t  pkt_payload;
1461 	uint8_t  phy;
1462 } __packed;
1463 
1464 #define BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR    BT_OP(BT_OGF_LE, 0x0035) /* 0x2035 */
1465 struct bt_hci_cp_le_set_adv_set_random_addr {
1466 	uint8_t   handle;
1467 	bt_addr_t bdaddr;
1468 } __packed;
1469 
1470 #define BT_HCI_LE_ADV_PROP_CONN                 BIT(0)
1471 #define BT_HCI_LE_ADV_PROP_SCAN                 BIT(1)
1472 #define BT_HCI_LE_ADV_PROP_DIRECT               BIT(2)
1473 #define BT_HCI_LE_ADV_PROP_HI_DC_CONN           BIT(3)
1474 #define BT_HCI_LE_ADV_PROP_LEGACY               BIT(4)
1475 #define BT_HCI_LE_ADV_PROP_ANON                 BIT(5)
1476 #define BT_HCI_LE_ADV_PROP_TX_POWER             BIT(6)
1477 
1478 #define BT_HCI_LE_PRIM_ADV_INTERVAL_MIN         0x000020
1479 #define BT_HCI_LE_PRIM_ADV_INTERVAL_MAX         0xFFFFFF
1480 
1481 #define BT_HCI_LE_ADV_SCAN_REQ_ENABLE  1
1482 #define BT_HCI_LE_ADV_SCAN_REQ_DISABLE 0
1483 
1484 #define BT_HCI_LE_ADV_TX_POWER_NO_PREF 0x7F
1485 
1486 #define BT_HCI_LE_ADV_HANDLE_MAX       0xEF
1487 
1488 #define BT_HCI_LE_EXT_ADV_SID_INVALID  0xFF
1489 
1490 #define BT_HCI_OP_LE_SET_EXT_ADV_PARAM          BT_OP(BT_OGF_LE, 0x0036) /* 0x2036 */
1491 struct bt_hci_cp_le_set_ext_adv_param {
1492 	uint8_t      handle;
1493 	uint16_t     props;
1494 	uint8_t      prim_min_interval[3];
1495 	uint8_t      prim_max_interval[3];
1496 	uint8_t      prim_channel_map;
1497 	uint8_t      own_addr_type;
1498 	bt_addr_le_t peer_addr;
1499 	uint8_t      filter_policy;
1500 	int8_t       tx_power;
1501 	uint8_t      prim_adv_phy;
1502 	uint8_t      sec_adv_max_skip;
1503 	uint8_t      sec_adv_phy;
1504 	uint8_t      sid;
1505 	uint8_t      scan_req_notify_enable;
1506 } __packed;
1507 struct bt_hci_rp_le_set_ext_adv_param {
1508 	uint8_t status;
1509 	int8_t  tx_power;
1510 } __packed;
1511 
1512 #define BT_HCI_LE_EXT_ADV_OP_INTERM_FRAG        0x00
1513 #define BT_HCI_LE_EXT_ADV_OP_FIRST_FRAG         0x01
1514 #define BT_HCI_LE_EXT_ADV_OP_LAST_FRAG          0x02
1515 #define BT_HCI_LE_EXT_ADV_OP_COMPLETE_DATA      0x03
1516 #define BT_HCI_LE_EXT_ADV_OP_UNCHANGED_DATA     0x04
1517 
1518 #define BT_HCI_LE_EXT_ADV_FRAG_ENABLED          0x00
1519 #define BT_HCI_LE_EXT_ADV_FRAG_DISABLED         0x01
1520 
1521 #define BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN          251
1522 
1523 #define BT_HCI_OP_LE_SET_EXT_ADV_DATA           BT_OP(BT_OGF_LE, 0x0037) /* 0x2037 */
1524 struct bt_hci_cp_le_set_ext_adv_data {
1525 	uint8_t  handle;
1526 	uint8_t  op;
1527 	uint8_t  frag_pref;
1528 	uint8_t  len;
1529 	uint8_t  data[0];
1530 } __packed;
1531 
1532 #define BT_HCI_OP_LE_SET_EXT_SCAN_RSP_DATA      BT_OP(BT_OGF_LE, 0x0038) /* 0x2038 */
1533 struct bt_hci_cp_le_set_ext_scan_rsp_data {
1534 	uint8_t  handle;
1535 	uint8_t  op;
1536 	uint8_t  frag_pref;
1537 	uint8_t  len;
1538 	uint8_t  data[0];
1539 } __packed;
1540 
1541 #define BT_HCI_OP_LE_SET_EXT_ADV_ENABLE         BT_OP(BT_OGF_LE, 0x0039) /* 0x2039 */
1542 struct bt_hci_ext_adv_set {
1543 	uint8_t  handle;
1544 	uint16_t duration;
1545 	uint8_t  max_ext_adv_evts;
1546 } __packed;
1547 
1548 struct bt_hci_cp_le_set_ext_adv_enable {
1549 	uint8_t  enable;
1550 	uint8_t  set_num;
1551 	struct bt_hci_ext_adv_set s[0];
1552 } __packed;
1553 
1554 #define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN      BT_OP(BT_OGF_LE, 0x003a) /* 0x203a */
1555 struct bt_hci_rp_le_read_max_adv_data_len {
1556 	uint8_t  status;
1557 	uint16_t max_adv_data_len;
1558 } __packed;
1559 
1560 #define BT_HCI_OP_LE_READ_NUM_ADV_SETS          BT_OP(BT_OGF_LE, 0x003b) /* 0x203b */
1561 struct bt_hci_rp_le_read_num_adv_sets {
1562 	uint8_t  status;
1563 	uint8_t  num_sets;
1564 } __packed;
1565 
1566 #define BT_HCI_OP_LE_REMOVE_ADV_SET             BT_OP(BT_OGF_LE, 0x003c) /* 0x203c */
1567 struct bt_hci_cp_le_remove_adv_set {
1568 	uint8_t  handle;
1569 } __packed;
1570 
1571 #define BT_HCI_OP_CLEAR_ADV_SETS                BT_OP(BT_OGF_LE, 0x003d) /* 0x203d */
1572 
1573 #define BT_HCI_LE_PER_ADV_INTERVAL_MIN          0x0006
1574 #define BT_HCI_LE_PER_ADV_INTERVAL_MAX          0xFFFF
1575 
1576 #define BT_HCI_OP_LE_SET_PER_ADV_PARAM          BT_OP(BT_OGF_LE, 0x003e) /* 0x203e */
1577 struct bt_hci_cp_le_set_per_adv_param {
1578 	uint8_t  handle;
1579 	uint16_t min_interval;
1580 	uint16_t max_interval;
1581 	uint16_t props;
1582 } __packed;
1583 
1584 #define BT_HCI_LE_PER_ADV_OP_INTERM_FRAG        0x00
1585 #define BT_HCI_LE_PER_ADV_OP_FIRST_FRAG         0x01
1586 #define BT_HCI_LE_PER_ADV_OP_LAST_FRAG          0x02
1587 #define BT_HCI_LE_PER_ADV_OP_COMPLETE_DATA      0x03
1588 
1589 #define BT_HCI_LE_PER_ADV_FRAG_MAX_LEN          252
1590 
1591 #define BT_HCI_OP_LE_SET_PER_ADV_DATA           BT_OP(BT_OGF_LE, 0x003f) /* 0x203f */
1592 struct bt_hci_cp_le_set_per_adv_data {
1593 	uint8_t  handle;
1594 	uint8_t  op;
1595 	uint8_t  len;
1596 	uint8_t  data[0];
1597 } __packed;
1598 
1599 #define BT_HCI_LE_SET_PER_ADV_ENABLE_ENABLE     BIT(0)
1600 #define BT_HCI_LE_SET_PER_ADV_ENABLE_ADI        BIT(1)
1601 
1602 #define BT_HCI_OP_LE_SET_PER_ADV_ENABLE         BT_OP(BT_OGF_LE, 0x0040) /* 0x2040 */
1603 struct bt_hci_cp_le_set_per_adv_enable {
1604 	uint8_t  enable;
1605 	uint8_t  handle;
1606 } __packed;
1607 
1608 #define BT_HCI_OP_LE_SET_EXT_SCAN_PARAM         BT_OP(BT_OGF_LE, 0x0041) /* 0x2041 */
1609 struct bt_hci_ext_scan_phy {
1610 	uint8_t  type;
1611 	uint16_t interval;
1612 	uint16_t window;
1613 } __packed;
1614 
1615 #define BT_HCI_LE_EXT_SCAN_PHY_1M               BIT(0)
1616 #define BT_HCI_LE_EXT_SCAN_PHY_2M               BIT(1)
1617 #define BT_HCI_LE_EXT_SCAN_PHY_CODED            BIT(2)
1618 
1619 struct bt_hci_cp_le_set_ext_scan_param {
1620 	uint8_t  own_addr_type;
1621 	uint8_t  filter_policy;
1622 	uint8_t  phys;
1623 	struct bt_hci_ext_scan_phy p[0];
1624 } __packed;
1625 
1626 /* Extends BT_HCI_LE_SCAN_FILTER_DUP */
1627 #define BT_HCI_LE_EXT_SCAN_FILTER_DUP_ENABLE_RESET  0x02
1628 
1629 #define BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE        BT_OP(BT_OGF_LE, 0x0042) /* 0x2042 */
1630 struct bt_hci_cp_le_set_ext_scan_enable {
1631 	uint8_t  enable;
1632 	uint8_t  filter_dup;
1633 	uint16_t duration;
1634 	uint16_t period;
1635 } __packed;
1636 
1637 #define BT_HCI_OP_LE_EXT_CREATE_CONN            BT_OP(BT_OGF_LE, 0x0043) /* 0x2043 */
1638 #define BT_HCI_OP_LE_EXT_CREATE_CONN_V2         BT_OP(BT_OGF_LE, 0x0085) /* 0x2085 */
1639 struct bt_hci_ext_conn_phy {
1640 	uint16_t scan_interval;
1641 	uint16_t scan_window;
1642 	uint16_t conn_interval_min;
1643 	uint16_t conn_interval_max;
1644 	uint16_t conn_latency;
1645 	uint16_t supervision_timeout;
1646 	uint16_t min_ce_len;
1647 	uint16_t max_ce_len;
1648 } __packed;
1649 
1650 struct bt_hci_cp_le_ext_create_conn {
1651 	uint8_t      filter_policy;
1652 	uint8_t      own_addr_type;
1653 	bt_addr_le_t peer_addr;
1654 	uint8_t      phys;
1655 	struct bt_hci_ext_conn_phy p[0];
1656 } __packed;
1657 
1658 struct bt_hci_cp_le_ext_create_conn_v2 {
1659 	uint8_t      adv_handle;
1660 	uint8_t      subevent;
1661 	uint8_t      filter_policy;
1662 	uint8_t      own_addr_type;
1663 	bt_addr_le_t peer_addr;
1664 	uint8_t      phys;
1665 	struct bt_hci_ext_conn_phy p[0];
1666 } __packed;
1667 
1668 #define BT_HCI_OP_LE_SET_PER_ADV_SUBEVENT_DATA  BT_OP(BT_OGF_LE, 0x0082) /* 0x2082 */
1669 struct bt_hci_cp_le_set_pawr_subevent_data_element {
1670 	uint8_t subevent;
1671 	uint8_t response_slot_start;
1672 	uint8_t response_slot_count;
1673 	uint8_t subevent_data_length;
1674 	uint8_t subevent_data[0];
1675 } __packed;
1676 
1677 struct bt_hci_cp_le_set_pawr_subevent_data {
1678 	uint8_t adv_handle;
1679 	uint8_t num_subevents;
1680 	struct bt_hci_cp_le_set_pawr_subevent_data_element subevents[0];
1681 } __packed;
1682 
1683 
1684 #define BT_HCI_OP_LE_SET_PER_ADV_RESPONSE_DATA  BT_OP(BT_OGF_LE, 0x0083) /* 0x2083 */
1685 struct bt_hci_cp_le_set_pawr_response_data {
1686 	uint16_t sync_handle;
1687 	uint16_t request_event;
1688 	uint8_t request_subevent;
1689 	uint8_t response_subevent;
1690 	uint8_t response_slot;
1691 	uint8_t response_data_length;
1692 	uint8_t response_data[0];
1693 } __packed;
1694 
1695 #define BT_HCI_OP_LE_SET_PER_ADV_SYNC_SUBEVENT  BT_OP(BT_OGF_LE, 0x0084) /* 0x2084 */
1696 struct bt_hci_cp_le_set_pawr_sync_subevent {
1697 	uint16_t sync_handle;
1698 	uint16_t periodic_adv_properties;
1699 	uint8_t num_subevents;
1700 	uint8_t subevents[0];
1701 } __packed;
1702 
1703 
1704 #define BT_HCI_OP_LE_SET_PER_ADV_PARAM_V2       BT_OP(BT_OGF_LE, 0x0086) /* 0x2086 */
1705 struct bt_hci_cp_le_set_per_adv_param_v2 {
1706 	uint8_t  handle;
1707 	uint16_t min_interval;
1708 	uint16_t max_interval;
1709 	uint16_t props;
1710 	uint8_t num_subevents;
1711 	uint8_t subevent_interval;
1712 	uint8_t response_slot_delay;
1713 	uint8_t response_slot_spacing;
1714 	uint8_t num_response_slots;
1715 } __packed;
1716 
1717 
1718 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST               BIT(0)
1719 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED       BIT(1)
1720 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE       BIT(2)
1721 
1722 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_FILTERING     0
1723 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOA           BIT(0)
1724 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_1US       BIT(1)
1725 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_2US       BIT(2)
1726 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_CTE           BIT(3)
1727 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ONLY_CTE         BIT(4)
1728 /* Constants to check correctness of CTE type */
1729 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS 5
1730 #define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_INVALID_VALUE \
1731 	(~BIT_MASK(BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS))
1732 
1733 #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC        BT_OP(BT_OGF_LE, 0x0044) /* 0x2044 */
1734 struct bt_hci_cp_le_per_adv_create_sync {
1735 	uint8_t options;
1736 	uint8_t      sid;
1737 	bt_addr_le_t addr;
1738 	uint16_t     skip;
1739 	uint16_t     sync_timeout;
1740 	uint8_t      cte_type;
1741 } __packed;
1742 
1743 #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL BT_OP(BT_OGF_LE, 0x0045) /* 0x2045 */
1744 
1745 #define BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC     BT_OP(BT_OGF_LE, 0x0046) /* 0x2046 */
1746 struct bt_hci_cp_le_per_adv_terminate_sync {
1747 	uint16_t handle;
1748 } __packed;
1749 
1750 #define BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST    BT_OP(BT_OGF_LE, 0x0047) /* 0x2047 */
1751 struct bt_hci_cp_le_add_dev_to_per_adv_list {
1752 	bt_addr_le_t addr;
1753 	uint8_t      sid;
1754 } __packed;
1755 
1756 #define BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST  BT_OP(BT_OGF_LE, 0x0048) /* 0x2048 */
1757 struct bt_hci_cp_le_rem_dev_from_per_adv_list {
1758 	bt_addr_le_t addr;
1759 	uint8_t      sid;
1760 } __packed;
1761 
1762 #define BT_HCI_OP_LE_CLEAR_PER_ADV_LIST         BT_OP(BT_OGF_LE, 0x0049) /* 0x2049 */
1763 
1764 #define BT_HCI_OP_LE_READ_PER_ADV_LIST_SIZE     BT_OP(BT_OGF_LE, 0x004a) /* 0x204a */
1765 struct bt_hci_rp_le_read_per_adv_list_size {
1766 	uint8_t  status;
1767 	uint8_t  list_size;
1768 } __packed;
1769 
1770 #define BT_HCI_OP_LE_READ_TX_POWER              BT_OP(BT_OGF_LE, 0x004b) /* 0x204b */
1771 struct bt_hci_rp_le_read_tx_power {
1772 	uint8_t status;
1773 	int8_t  min_tx_power;
1774 	int8_t  max_tx_power;
1775 } __packed;
1776 
1777 #define BT_HCI_OP_LE_READ_RF_PATH_COMP          BT_OP(BT_OGF_LE, 0x004c) /* 0x204c */
1778 struct bt_hci_rp_le_read_rf_path_comp {
1779 	uint8_t status;
1780 	int16_t tx_path_comp;
1781 	int16_t rx_path_comp;
1782 } __packed;
1783 
1784 #define BT_HCI_OP_LE_WRITE_RF_PATH_COMP         BT_OP(BT_OGF_LE, 0x004d) /* 0x204d */
1785 struct bt_hci_cp_le_write_rf_path_comp {
1786 	int16_t  tx_path_comp;
1787 	int16_t  rx_path_comp;
1788 } __packed;
1789 
1790 #define BT_HCI_LE_PRIVACY_MODE_NETWORK          0x00
1791 #define BT_HCI_LE_PRIVACY_MODE_DEVICE           0x01
1792 
1793 #define BT_HCI_OP_LE_SET_PRIVACY_MODE           BT_OP(BT_OGF_LE, 0x004e) /* 0x204e */
1794 struct bt_hci_cp_le_set_privacy_mode {
1795 	bt_addr_le_t id_addr;
1796 	uint8_t         mode;
1797 } __packed;
1798 
1799 #define BT_HCI_LE_TEST_CTE_DISABLED             0x00
1800 #define BT_HCI_LE_TEST_CTE_TYPE_ANY             0x00
1801 #define BT_HCI_LE_TEST_SLOT_DURATION_ANY        0x00
1802 #define BT_HCI_LE_TEST_SWITCH_PATTERN_LEN_ANY   0x00
1803 
1804 #define BT_HCI_OP_LE_RX_TEST_V3                 BT_OP(BT_OGF_LE, 0x004f) /* 0x204f */
1805 struct bt_hci_cp_le_rx_test_v3 {
1806 	uint8_t  rx_ch;
1807 	uint8_t  phy;
1808 	uint8_t  mod_index;
1809 	uint8_t  expected_cte_len;
1810 	uint8_t  expected_cte_type;
1811 	uint8_t  slot_durations;
1812 	uint8_t  switch_pattern_len;
1813 	uint8_t  ant_ids[0];
1814 } __packed;
1815 
1816 #define BT_HCI_OP_LE_TX_TEST_V3                 BT_OP(BT_OGF_LE, 0x0050) /* 0x2050 */
1817 
1818 struct bt_hci_cp_le_tx_test_v3 {
1819 	uint8_t  tx_ch;
1820 	uint8_t  test_data_len;
1821 	uint8_t  pkt_payload;
1822 	uint8_t  phy;
1823 	uint8_t  cte_len;
1824 	uint8_t  cte_type;
1825 	uint8_t  switch_pattern_len;
1826 	uint8_t  ant_ids[0];
1827 } __packed;
1828 
1829 /* Min and max Constant Tone Extension length in 8us units */
1830 #define BT_HCI_LE_CTE_LEN_MIN                  0x2
1831 #define BT_HCI_LE_CTE_LEN_MAX                  0x14
1832 
1833 #define BT_HCI_LE_AOA_CTE                      0x0
1834 #define BT_HCI_LE_AOD_CTE_1US                  0x1
1835 #define BT_HCI_LE_AOD_CTE_2US                  0x2
1836 #define BT_HCI_LE_NO_CTE                       0xFF
1837 
1838 #define BT_HCI_LE_CTE_COUNT_MIN                0x1
1839 #define BT_HCI_LE_CTE_COUNT_MAX                0x10
1840 
1841 #define BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS      BT_OP(BT_OGF_LE, 0x0051) /* 0x2051 */
1842 struct bt_hci_cp_le_set_cl_cte_tx_params {
1843 	uint8_t handle;
1844 	uint8_t cte_len;
1845 	uint8_t cte_type;
1846 	uint8_t cte_count;
1847 	uint8_t switch_pattern_len;
1848 	uint8_t ant_ids[0];
1849 } __packed;
1850 
1851 #define BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE      BT_OP(BT_OGF_LE, 0x0052) /* 0x2052 */
1852 struct bt_hci_cp_le_set_cl_cte_tx_enable {
1853 	uint8_t handle;
1854 	uint8_t cte_enable;
1855 } __packed;
1856 
1857 #define BT_HCI_LE_ANTENNA_SWITCHING_SLOT_1US   0x1
1858 #define BT_HCI_LE_ANTENNA_SWITCHING_SLOT_2US   0x2
1859 
1860 #define BT_HCI_LE_SAMPLE_CTE_ALL               0x0
1861 #define BT_HCI_LE_SAMPLE_CTE_COUNT_MIN         0x1
1862 #define BT_HCI_LE_SAMPLE_CTE_COUNT_MAX         0x10
1863 
1864 #define BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE BT_OP(BT_OGF_LE, 0x0053) /* 0x2053 */
1865 struct bt_hci_cp_le_set_cl_cte_sampling_enable {
1866 	uint16_t sync_handle;
1867 	uint8_t  sampling_enable;
1868 	uint8_t  slot_durations;
1869 	uint8_t  max_sampled_cte;
1870 	uint8_t  switch_pattern_len;
1871 	uint8_t  ant_ids[0];
1872 } __packed;
1873 
1874 struct bt_hci_rp_le_set_cl_cte_sampling_enable {
1875 	uint8_t  status;
1876 	uint16_t sync_handle;
1877 } __packed;
1878 
1879 #define BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS BT_OP(BT_OGF_LE, 0x0054) /* 0x2054 */
1880 struct bt_hci_cp_le_set_conn_cte_rx_params {
1881 	uint16_t handle;
1882 	uint8_t  sampling_enable;
1883 	uint8_t  slot_durations;
1884 	uint8_t  switch_pattern_len;
1885 	uint8_t  ant_ids[0];
1886 } __packed;
1887 
1888 struct bt_hci_rp_le_set_conn_cte_rx_params {
1889 	uint8_t  status;
1890 	uint16_t handle;
1891 } __packed;
1892 
1893 #define BT_HCI_LE_AOA_CTE_RSP                   BIT(0)
1894 #define BT_HCI_LE_AOD_CTE_RSP_1US               BIT(1)
1895 #define BT_HCI_LE_AOD_CTE_RSP_2US               BIT(2)
1896 
1897 #define BT_HCI_LE_SWITCH_PATTERN_LEN_MIN        0x2
1898 #define BT_HCI_LE_SWITCH_PATTERN_LEN_MAX        0x4B
1899 
1900 #define BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS     BT_OP(BT_OGF_LE, 0x0055) /* 0x2055 */
1901 struct bt_hci_cp_le_set_conn_cte_tx_params {
1902 	uint16_t handle;
1903 	uint8_t  cte_types;
1904 	uint8_t  switch_pattern_len;
1905 	uint8_t  ant_ids[0];
1906 } __packed;
1907 
1908 struct bt_hci_rp_le_set_conn_cte_tx_params {
1909 	uint8_t  status;
1910 	uint16_t handle;
1911 } __packed;
1912 
1913 /* Interval between consecutive CTE request procedure starts in number of connection events. */
1914 #define BT_HCI_REQUEST_CTE_ONCE                0x0
1915 #define BT_HCI_REQUEST_CTE_INTERVAL_MIN        0x1
1916 #define BT_HCI_REQUEST_CTE_INTERVAL_MAX        0xFFFF
1917 
1918 #define BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE       BT_OP(BT_OGF_LE, 0x0056) /* 0x2056 */
1919 struct bt_hci_cp_le_conn_cte_req_enable {
1920 	uint16_t handle;
1921 	uint8_t  enable;
1922 	uint16_t cte_request_interval;
1923 	uint8_t  requested_cte_length;
1924 	uint8_t  requested_cte_type;
1925 } __packed;
1926 
1927 struct bt_hci_rp_le_conn_cte_req_enable {
1928 	uint8_t  status;
1929 	uint16_t handle;
1930 } __packed;
1931 
1932 #define BT_HCI_OP_LE_CONN_CTE_RSP_ENABLE       BT_OP(BT_OGF_LE, 0x0057) /* 0x2057 */
1933 struct bt_hci_cp_le_conn_cte_rsp_enable {
1934 	uint16_t handle;
1935 	uint8_t  enable;
1936 } __packed;
1937 
1938 struct bt_hci_rp_le_conn_cte_rsp_enable {
1939 	uint8_t  status;
1940 	uint16_t handle;
1941 } __packed;
1942 
1943 #define BT_HCI_LE_1US_AOD_TX                    BIT(0)
1944 #define BT_HCI_LE_1US_AOD_RX                    BIT(1)
1945 #define BT_HCI_LE_1US_AOA_RX                    BIT(2)
1946 
1947 #define BT_HCI_LE_NUM_ANT_MIN                   0x1
1948 #define BT_HCI_LE_NUM_ANT_MAX                   0x4B
1949 
1950 #define BT_HCI_LE_MAX_SWITCH_PATTERN_LEN_MIN    0x2
1951 #define BT_HCI_LE_MAX_SWITCH_PATTERN_LEN_MAX    0x4B
1952 
1953 #define BT_HCI_LE_MAX_CTE_LEN_MIN               0x2
1954 #define BT_HCI_LE_MAX_CTE_LEN_MAX               0x14
1955 
1956 #define BT_HCI_OP_LE_READ_ANT_INFO              BT_OP(BT_OGF_LE, 0x0058) /* 0x2058 */
1957 struct bt_hci_rp_le_read_ant_info {
1958 	uint8_t status;
1959 	uint8_t switch_sample_rates;
1960 	uint8_t num_ant;
1961 	uint8_t max_switch_pattern_len;
1962 	uint8_t max_cte_len;
1963 };
1964 
1965 #define BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE           BIT(0)
1966 #define BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_FILTER_DUPLICATE BIT(1)
1967 
1968 #define BT_HCI_OP_LE_SET_PER_ADV_RECV_ENABLE     BT_OP(BT_OGF_LE, 0x0059) /* 0x2059 */
1969 struct bt_hci_cp_le_set_per_adv_recv_enable {
1970 	uint16_t handle;
1971 	uint8_t  enable;
1972 } __packed;
1973 
1974 #define BT_HCI_OP_LE_PER_ADV_SYNC_TRANSFER      BT_OP(BT_OGF_LE, 0x005a) /* 0x205a */
1975 struct bt_hci_cp_le_per_adv_sync_transfer {
1976 	uint16_t conn_handle;
1977 	uint16_t service_data;
1978 	uint16_t sync_handle;
1979 } __packed;
1980 
1981 struct bt_hci_rp_le_per_adv_sync_transfer {
1982 	uint8_t  status;
1983 	uint16_t conn_handle;
1984 } __packed;
1985 
1986 #define BT_HCI_OP_LE_PER_ADV_SET_INFO_TRANSFER  BT_OP(BT_OGF_LE, 0x005b) /* 0x205b */
1987 struct bt_hci_cp_le_per_adv_set_info_transfer {
1988 	uint16_t conn_handle;
1989 	uint16_t service_data;
1990 	uint8_t  adv_handle;
1991 } __packed;
1992 
1993 struct bt_hci_rp_le_per_adv_set_info_transfer {
1994 	uint8_t  status;
1995 	uint16_t conn_handle;
1996 } __packed;
1997 
1998 #define BT_HCI_LE_PAST_MODE_NO_SYNC                0x00
1999 #define BT_HCI_LE_PAST_MODE_NO_REPORTS             0x01
2000 #define BT_HCI_LE_PAST_MODE_SYNC                   0x02
2001 #define BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES 0x03
2002 
2003 #define BT_HCI_LE_PAST_CTE_TYPE_NO_AOA           BIT(0)
2004 #define BT_HCI_LE_PAST_CTE_TYPE_NO_AOD_1US       BIT(1)
2005 #define BT_HCI_LE_PAST_CTE_TYPE_NO_AOD_2US       BIT(2)
2006 #define BT_HCI_LE_PAST_CTE_TYPE_NO_CTE           BIT(3)
2007 #define BT_HCI_LE_PAST_CTE_TYPE_ONLY_CTE         BIT(4)
2008 
2009 #define BT_HCI_OP_LE_PAST_PARAM                 BT_OP(BT_OGF_LE, 0x005c) /* 0x205c */
2010 struct bt_hci_cp_le_past_param {
2011 	uint16_t conn_handle;
2012 	uint8_t  mode;
2013 	uint16_t skip;
2014 	uint16_t timeout;
2015 	uint8_t  cte_type;
2016 } __packed;
2017 
2018 struct bt_hci_rp_le_past_param {
2019 	uint8_t  status;
2020 	uint16_t conn_handle;
2021 } __packed;
2022 
2023 #define BT_HCI_OP_LE_DEFAULT_PAST_PARAM         BT_OP(BT_OGF_LE, 0x005d) /* 0x205d */
2024 struct bt_hci_cp_le_default_past_param {
2025 	uint8_t  mode;
2026 	uint16_t skip;
2027 	uint16_t timeout;
2028 	uint8_t  cte_type;
2029 } __packed;
2030 
2031 struct bt_hci_rp_le_default_past_param {
2032 	uint8_t  status;
2033 } __packed;
2034 
2035 #define BT_HCI_OP_LE_READ_BUFFER_SIZE_V2        BT_OP(BT_OGF_LE, 0x0060) /* 0x2060 */
2036 struct bt_hci_rp_le_read_buffer_size_v2 {
2037 	uint8_t  status;
2038 	uint16_t acl_max_len;
2039 	uint8_t  acl_max_num;
2040 	uint16_t iso_max_len;
2041 	uint8_t  iso_max_num;
2042 } __packed;
2043 
2044 #define BT_HCI_OP_LE_READ_ISO_TX_SYNC           BT_OP(BT_OGF_LE, 0x0061) /* 0x2061 */
2045 struct bt_hci_cp_le_read_iso_tx_sync {
2046 	uint16_t handle;
2047 } __packed;
2048 
2049 struct bt_hci_rp_le_read_iso_tx_sync {
2050 	uint8_t  status;
2051 	uint16_t handle;
2052 	uint16_t seq;
2053 	uint32_t timestamp;
2054 	uint8_t  offset[3];
2055 } __packed;
2056 
2057 #define BT_HCI_ISO_CIG_ID_MAX                   0xFE
2058 #define BT_HCI_ISO_CIS_COUNT_MAX                0x1F
2059 #define BT_HCI_ISO_SDU_INTERVAL_MIN             0x0000FF
2060 #define BT_HCI_ISO_SDU_INTERVAL_MAX             0x0FFFFF
2061 #define BT_HCI_ISO_WORST_CASE_SCA_VALID_MASK    0x07
2062 #define BT_HCI_ISO_PACKING_VALID_MASK           0x01
2063 #define BT_HCI_ISO_FRAMING_VALID_MASK           0x01
2064 #define BT_HCI_ISO_MAX_TRANSPORT_LATENCY_MIN    0x0005
2065 #define BT_HCI_ISO_MAX_TRANSPORT_LATENCY_MAX    0x0FA0
2066 #define BT_HCI_ISO_CIS_ID_VALID_MAX             0xEF
2067 #define BT_HCI_ISO_MAX_SDU_VALID_MASK           0x0FFF
2068 #define BT_HCI_ISO_PHY_VALID_MASK               0x07
2069 #define BT_HCI_ISO_INTERVAL_MIN                 0x0004
2070 #define BT_HCI_ISO_INTERVAL_MAX                 0x0C80
2071 
2072 #define BT_HCI_OP_LE_SET_CIG_PARAMS             BT_OP(BT_OGF_LE, 0x0062) /* 0x2062 */
2073 struct bt_hci_cis_params {
2074 	uint8_t  cis_id;
2075 	uint16_t c_sdu;
2076 	uint16_t p_sdu;
2077 	uint8_t  c_phy;
2078 	uint8_t  p_phy;
2079 	uint8_t  c_rtn;
2080 	uint8_t  p_rtn;
2081 } __packed;
2082 
2083 struct bt_hci_cp_le_set_cig_params {
2084 	uint8_t  cig_id;
2085 	uint8_t  c_interval[3];
2086 	uint8_t  p_interval[3];
2087 	uint8_t  sca;
2088 	uint8_t  packing;
2089 	uint8_t  framing;
2090 	uint16_t c_latency;
2091 	uint16_t p_latency;
2092 	uint8_t  num_cis;
2093 	struct bt_hci_cis_params cis[0];
2094 } __packed;
2095 
2096 struct bt_hci_rp_le_set_cig_params {
2097 	uint8_t  status;
2098 	uint8_t  cig_id;
2099 	uint8_t  num_handles;
2100 	uint16_t handle[0];
2101 } __packed;
2102 
2103 #define BT_HCI_OP_LE_SET_CIG_PARAMS_TEST        BT_OP(BT_OGF_LE, 0x0063) /* 0x2063 */
2104 struct bt_hci_cis_params_test {
2105 	uint8_t  cis_id;
2106 	uint8_t  nse;
2107 	uint16_t c_sdu;
2108 	uint16_t p_sdu;
2109 	uint16_t c_pdu;
2110 	uint16_t p_pdu;
2111 	uint8_t  c_phy;
2112 	uint8_t  p_phy;
2113 	uint8_t  c_bn;
2114 	uint8_t  p_bn;
2115 } __packed;
2116 
2117 struct bt_hci_cp_le_set_cig_params_test {
2118 	uint8_t  cig_id;
2119 	uint8_t  c_interval[3];
2120 	uint8_t  p_interval[3];
2121 	uint8_t  c_ft;
2122 	uint8_t  p_ft;
2123 	uint16_t iso_interval;
2124 	uint8_t  sca;
2125 	uint8_t  packing;
2126 	uint8_t  framing;
2127 	uint8_t  num_cis;
2128 	struct bt_hci_cis_params_test cis[0];
2129 } __packed;
2130 
2131 struct bt_hci_rp_le_set_cig_params_test {
2132 	uint8_t  status;
2133 	uint8_t  cig_id;
2134 	uint8_t  num_handles;
2135 	uint16_t handle[0];
2136 } __packed;
2137 
2138 #define BT_HCI_OP_LE_CREATE_CIS                 BT_OP(BT_OGF_LE, 0x0064) /* 0x2064 */
2139 struct bt_hci_cis {
2140 	uint16_t  cis_handle;
2141 	uint16_t  acl_handle;
2142 } __packed;
2143 
2144 struct bt_hci_cp_le_create_cis {
2145 	uint8_t  num_cis;
2146 	struct bt_hci_cis cis[0];
2147 } __packed;
2148 
2149 #define BT_HCI_OP_LE_REMOVE_CIG                 BT_OP(BT_OGF_LE, 0x0065) /* 0x2065 */
2150 struct bt_hci_cp_le_remove_cig {
2151 	uint8_t  cig_id;
2152 } __packed;
2153 
2154 struct bt_hci_rp_le_remove_cig {
2155 	uint8_t  status;
2156 	uint8_t  cig_id;
2157 } __packed;
2158 
2159 #define BT_HCI_OP_LE_ACCEPT_CIS                 BT_OP(BT_OGF_LE, 0x0066) /* 0x2066 */
2160 struct bt_hci_cp_le_accept_cis {
2161 	uint16_t handle;
2162 } __packed;
2163 
2164 #define BT_HCI_OP_LE_REJECT_CIS                 BT_OP(BT_OGF_LE, 0x0067) /* 0x2067 */
2165 struct bt_hci_cp_le_reject_cis {
2166 	uint16_t handle;
2167 	uint8_t  reason;
2168 } __packed;
2169 
2170 struct bt_hci_rp_le_reject_cis {
2171 	uint8_t  status;
2172 	uint16_t handle;
2173 } __packed;
2174 
2175 #define BT_HCI_OP_LE_CREATE_BIG                 BT_OP(BT_OGF_LE, 0x0068) /* 0x2068 */
2176 struct bt_hci_cp_le_create_big {
2177 	uint8_t  big_handle;
2178 	uint8_t  adv_handle;
2179 	uint8_t  num_bis;
2180 	uint8_t  sdu_interval[3];
2181 	uint16_t max_sdu;
2182 	uint16_t max_latency;
2183 	uint8_t  rtn;
2184 	uint8_t  phy;
2185 	uint8_t  packing;
2186 	uint8_t  framing;
2187 	uint8_t  encryption;
2188 	uint8_t  bcode[16];
2189 } __packed;
2190 
2191 #define BT_HCI_OP_LE_CREATE_BIG_TEST            BT_OP(BT_OGF_LE, 0x0069) /* 0x2069 */
2192 struct bt_hci_cp_le_create_big_test {
2193 	uint8_t  big_handle;
2194 	uint8_t  adv_handle;
2195 	uint8_t  num_bis;
2196 	uint8_t  sdu_interval[3];
2197 	uint16_t iso_interval;
2198 	uint8_t  nse;
2199 	uint16_t max_sdu;
2200 	uint16_t max_pdu;
2201 	uint8_t  phy;
2202 	uint8_t  packing;
2203 	uint8_t  framing;
2204 	uint8_t  bn;
2205 	uint8_t  irc;
2206 	uint8_t  pto;
2207 	uint8_t  encryption;
2208 	uint8_t  bcode[16];
2209 } __packed;
2210 
2211 #define BT_HCI_OP_LE_TERMINATE_BIG              BT_OP(BT_OGF_LE, 0x006a) /* 0x206a */
2212 struct bt_hci_cp_le_terminate_big {
2213 	uint8_t  big_handle;
2214 	uint8_t  reason;
2215 } __packed;
2216 
2217 #define BT_HCI_OP_LE_BIG_CREATE_SYNC            BT_OP(BT_OGF_LE, 0x006b) /* 0x206b */
2218 struct bt_hci_cp_le_big_create_sync {
2219 	uint8_t  big_handle;
2220 	uint16_t sync_handle;
2221 	uint8_t  encryption;
2222 	uint8_t  bcode[16];
2223 	uint8_t  mse;
2224 	uint16_t sync_timeout;
2225 	uint8_t  num_bis;
2226 	uint8_t  bis[0];
2227 } __packed;
2228 
2229 #define BT_HCI_OP_LE_BIG_TERMINATE_SYNC         BT_OP(BT_OGF_LE, 0x006c) /* 0x206c */
2230 struct bt_hci_cp_le_big_terminate_sync {
2231 	uint8_t  big_handle;
2232 } __packed;
2233 
2234 struct bt_hci_rp_le_big_terminate_sync {
2235 	uint8_t  status;
2236 	uint8_t  big_handle;
2237 } __packed;
2238 
2239 #define BT_HCI_OP_LE_REQ_PEER_SC                BT_OP(BT_OGF_LE, 0x006d) /* 0x206d */
2240 struct bt_hci_cp_le_req_peer_sca {
2241 	uint16_t handle;
2242 } __packed;
2243 
2244 #define BT_HCI_OP_LE_SETUP_ISO_PATH             BT_OP(BT_OGF_LE, 0x006e) /* 0x206e */
2245 struct bt_hci_cp_le_setup_iso_path {
2246 	uint16_t handle;
2247 	uint8_t  path_dir;
2248 	uint8_t  path_id;
2249 	struct bt_hci_cp_codec_id codec_id;
2250 	uint8_t  controller_delay[3];
2251 	uint8_t  codec_config_len;
2252 	uint8_t  codec_config[0];
2253 } __packed;
2254 
2255 struct bt_hci_rp_le_setup_iso_path {
2256 	uint8_t  status;
2257 	uint16_t handle;
2258 } __packed;
2259 
2260 #define BT_HCI_OP_LE_REMOVE_ISO_PATH            BT_OP(BT_OGF_LE, 0x006f) /* 0x206f */
2261 struct bt_hci_cp_le_remove_iso_path {
2262 	uint16_t handle;
2263 	uint8_t  path_dir;
2264 } __packed;
2265 
2266 struct bt_hci_rp_le_remove_iso_path {
2267 	uint8_t  status;
2268 	uint16_t handle;
2269 } __packed;
2270 
2271 #define BT_HCI_ISO_TEST_ZERO_SIZE_SDU     0
2272 #define BT_HCI_ISO_TEST_VARIABLE_SIZE_SDU 1
2273 #define BT_HCI_ISO_TEST_MAX_SIZE_SDU      2
2274 
2275 #define BT_HCI_OP_LE_ISO_TRANSMIT_TEST          BT_OP(BT_OGF_LE, 0x0070) /* 0x2070 */
2276 struct bt_hci_cp_le_iso_transmit_test {
2277 	uint16_t handle;
2278 	uint8_t  payload_type;
2279 } __packed;
2280 
2281 struct bt_hci_rp_le_iso_transmit_test {
2282 	uint8_t  status;
2283 	uint16_t handle;
2284 } __packed;
2285 
2286 #define BT_HCI_OP_LE_ISO_RECEIVE_TEST           BT_OP(BT_OGF_LE, 0x0071) /* 0x2071 */
2287 struct bt_hci_cp_le_iso_receive_test {
2288 	uint16_t handle;
2289 	uint8_t  payload_type;
2290 } __packed;
2291 
2292 struct bt_hci_rp_le_iso_receive_test {
2293 	uint8_t  status;
2294 	uint16_t handle;
2295 } __packed;
2296 
2297 #define BT_HCI_OP_LE_ISO_READ_TEST_COUNTERS     BT_OP(BT_OGF_LE, 0x0072) /* 0x2072 */
2298 struct bt_hci_cp_le_read_test_counters {
2299 	uint16_t handle;
2300 } __packed;
2301 
2302 struct bt_hci_rp_le_read_test_counters {
2303 	uint8_t  status;
2304 	uint16_t handle;
2305 	uint32_t received_cnt;
2306 	uint32_t missed_cnt;
2307 	uint32_t failed_cnt;
2308 } __packed;
2309 
2310 #define BT_HCI_OP_LE_ISO_TEST_END               BT_OP(BT_OGF_LE, 0x0073) /* 0x2073 */
2311 struct bt_hci_cp_le_iso_test_end {
2312 	uint16_t handle;
2313 } __packed;
2314 
2315 struct bt_hci_rp_le_iso_test_end {
2316 	uint8_t  status;
2317 	uint16_t handle;
2318 	uint32_t received_cnt;
2319 	uint32_t missed_cnt;
2320 	uint32_t failed_cnt;
2321 } __packed;
2322 
2323 #define BT_HCI_OP_LE_SET_HOST_FEATURE           BT_OP(BT_OGF_LE, 0x0074) /* 0x2074 */
2324 struct bt_hci_cp_le_set_host_feature {
2325 	uint8_t  bit_number;
2326 	uint8_t  bit_value;
2327 } __packed;
2328 
2329 struct bt_hci_rp_le_set_host_feature {
2330 	uint8_t  status;
2331 } __packed;
2332 
2333 #define BT_HCI_OP_LE_READ_ISO_LINK_QUALITY      BT_OP(BT_OGF_LE, 0x0075) /* 0x2075 */
2334 struct bt_hci_cp_le_read_iso_link_quality {
2335 	uint16_t handle;
2336 } __packed;
2337 
2338 struct bt_hci_rp_le_read_iso_link_quality {
2339 	uint8_t  status;
2340 	uint16_t handle;
2341 	uint32_t tx_unacked_packets;
2342 	uint32_t tx_flushed_packets;
2343 	uint32_t tx_last_subevent_packets;
2344 	uint32_t retransmitted_packets;
2345 	uint32_t crc_error_packets;
2346 	uint32_t rx_unreceived_packets;
2347 	uint32_t duplicate_packets;
2348 } __packed;
2349 
2350 #define BT_HCI_OP_LE_TX_TEST_V4                 BT_OP(BT_OGF_LE, 0x007B) /* 0x207B */
2351 
2352 struct bt_hci_cp_le_tx_test_v4 {
2353 	uint8_t  tx_ch;
2354 	uint8_t  test_data_len;
2355 	uint8_t  pkt_payload;
2356 	uint8_t  phy;
2357 	uint8_t  cte_len;
2358 	uint8_t  cte_type;
2359 	uint8_t  switch_pattern_len;
2360 	uint8_t  ant_ids[0];
2361 } __packed;
2362 
2363 #define BT_HCI_TX_TEST_POWER_MIN -0x7F
2364 #define BT_HCI_TX_TEST_POWER_MAX 0x14
2365 
2366 #define BT_HCI_TX_TEST_POWER_MIN_SET 0x7E
2367 #define BT_HCI_TX_TEST_POWER_MAX_SET 0x7F
2368 
2369 /* Helper structure for Tx power parameter in the HCI Tx Test v4 command.
2370  * Previous parameter of this command is variable size so having separated structure
2371  * for this parameter helps in command parameters unpacking.
2372  */
2373 struct bt_hci_cp_le_tx_test_v4_tx_power {
2374 	int8_t tx_power;
2375 } __packed;
2376 
2377 /* Event definitions */
2378 
2379 #define BT_HCI_EVT_UNKNOWN                      0x00
2380 #define BT_HCI_EVT_VENDOR                       0xff
2381 
2382 #define BT_HCI_EVT_INQUIRY_COMPLETE             0x01
2383 struct bt_hci_evt_inquiry_complete {
2384 	uint8_t status;
2385 } __packed;
2386 
2387 #define BT_HCI_EVT_CONN_COMPLETE                0x03
2388 struct bt_hci_evt_conn_complete {
2389 	uint8_t   status;
2390 	uint16_t  handle;
2391 	bt_addr_t bdaddr;
2392 	uint8_t   link_type;
2393 	uint8_t   encr_enabled;
2394 } __packed;
2395 
2396 #define BT_HCI_EVT_CONN_REQUEST                 0x04
2397 struct bt_hci_evt_conn_request {
2398 	bt_addr_t bdaddr;
2399 	uint8_t   dev_class[3];
2400 	uint8_t   link_type;
2401 } __packed;
2402 
2403 #define BT_HCI_EVT_DISCONN_COMPLETE             0x05
2404 struct bt_hci_evt_disconn_complete {
2405 	uint8_t  status;
2406 	uint16_t handle;
2407 	uint8_t  reason;
2408 } __packed;
2409 
2410 #define BT_HCI_EVT_AUTH_COMPLETE                0x06
2411 struct bt_hci_evt_auth_complete {
2412 	uint8_t  status;
2413 	uint16_t handle;
2414 } __packed;
2415 
2416 #define BT_HCI_EVT_REMOTE_NAME_REQ_COMPLETE     0x07
2417 struct bt_hci_evt_remote_name_req_complete {
2418 	uint8_t   status;
2419 	bt_addr_t bdaddr;
2420 	uint8_t   name[248];
2421 } __packed;
2422 
2423 #define BT_HCI_EVT_ENCRYPT_CHANGE               0x08
2424 struct bt_hci_evt_encrypt_change {
2425 	uint8_t  status;
2426 	uint16_t handle;
2427 	uint8_t  encrypt;
2428 } __packed;
2429 
2430 #define BT_HCI_EVT_REMOTE_FEATURES              0x0b
2431 struct bt_hci_evt_remote_features {
2432 	uint8_t  status;
2433 	uint16_t handle;
2434 	uint8_t  features[8];
2435 } __packed;
2436 
2437 #define BT_HCI_EVT_REMOTE_VERSION_INFO          0x0c
2438 struct bt_hci_evt_remote_version_info {
2439 	uint8_t  status;
2440 	uint16_t handle;
2441 	uint8_t  version;
2442 	uint16_t manufacturer;
2443 	uint16_t subversion;
2444 } __packed;
2445 
2446 #define BT_HCI_EVT_CMD_COMPLETE                 0x0e
2447 struct bt_hci_evt_cmd_complete {
2448 	uint8_t  ncmd;
2449 	uint16_t opcode;
2450 } __packed;
2451 
2452 struct bt_hci_evt_cc_status {
2453 	uint8_t  status;
2454 } __packed;
2455 
2456 #define BT_HCI_EVT_CMD_STATUS                   0x0f
2457 struct bt_hci_evt_cmd_status {
2458 	uint8_t  status;
2459 	uint8_t  ncmd;
2460 	uint16_t opcode;
2461 } __packed;
2462 
2463 #define BT_HCI_EVT_HARDWARE_ERROR               0x10
2464 struct bt_hci_evt_hardware_error {
2465 	uint8_t  hardware_code;
2466 } __packed;
2467 
2468 #define BT_HCI_EVT_ROLE_CHANGE                  0x12
2469 struct bt_hci_evt_role_change {
2470 	uint8_t   status;
2471 	bt_addr_t bdaddr;
2472 	uint8_t   role;
2473 } __packed;
2474 
2475 #define BT_HCI_EVT_NUM_COMPLETED_PACKETS        0x13
2476 struct bt_hci_evt_num_completed_packets {
2477 	uint8_t  num_handles;
2478 	struct bt_hci_handle_count h[0];
2479 } __packed;
2480 
2481 #define BT_HCI_EVT_PIN_CODE_REQ                 0x16
2482 struct bt_hci_evt_pin_code_req {
2483 	bt_addr_t bdaddr;
2484 } __packed;
2485 
2486 #define BT_HCI_EVT_LINK_KEY_REQ                 0x17
2487 struct bt_hci_evt_link_key_req {
2488 	bt_addr_t bdaddr;
2489 } __packed;
2490 
2491 /* Link Key types */
2492 #define BT_LK_COMBINATION                       0x00
2493 #define BT_LK_LOCAL_UNIT                        0x01
2494 #define BT_LK_REMOTE_UNIT                       0x02
2495 #define BT_LK_DEBUG_COMBINATION                 0x03
2496 #define BT_LK_UNAUTH_COMBINATION_P192           0x04
2497 #define BT_LK_AUTH_COMBINATION_P192             0x05
2498 #define BT_LK_CHANGED_COMBINATION               0x06
2499 #define BT_LK_UNAUTH_COMBINATION_P256           0x07
2500 #define BT_LK_AUTH_COMBINATION_P256             0x08
2501 
2502 #define BT_HCI_EVT_LINK_KEY_NOTIFY              0x18
2503 struct bt_hci_evt_link_key_notify {
2504 	bt_addr_t bdaddr;
2505 	uint8_t   link_key[16];
2506 	uint8_t   key_type;
2507 } __packed;
2508 
2509 /* Overflow link types */
2510 #define BT_OVERFLOW_LINK_SYNCH                  0x00
2511 #define BT_OVERFLOW_LINK_ACL                    0x01
2512 #define BT_OVERFLOW_LINK_ISO                    0x02
2513 
2514 #define BT_HCI_EVT_DATA_BUF_OVERFLOW            0x1a
2515 struct bt_hci_evt_data_buf_overflow {
2516 	uint8_t  link_type;
2517 } __packed;
2518 
2519 #define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI     0x22
2520 struct bt_hci_evt_inquiry_result_with_rssi {
2521 	bt_addr_t addr;
2522 	uint8_t   pscan_rep_mode;
2523 	uint8_t   reserved;
2524 	uint8_t   cod[3];
2525 	uint16_t  clock_offset;
2526 	int8_t    rssi;
2527 } __packed;
2528 
2529 #define BT_HCI_EVT_REMOTE_EXT_FEATURES          0x23
2530 struct bt_hci_evt_remote_ext_features {
2531 	uint8_t  status;
2532 	uint16_t handle;
2533 	uint8_t  page;
2534 	uint8_t  max_page;
2535 	uint8_t  features[8];
2536 } __packed;
2537 
2538 #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED_V2 0x24
2539 struct bt_hci_evt_le_per_adv_sync_established_v2 {
2540 	uint8_t status;
2541 	uint16_t handle;
2542 	uint8_t sid;
2543 	bt_addr_le_t adv_addr;
2544 	uint8_t phy;
2545 	uint16_t interval;
2546 	uint8_t clock_accuracy;
2547 	uint8_t num_subevents;
2548 	uint8_t subevent_interval;
2549 	uint8_t response_slot_delay;
2550 	uint8_t response_slot_spacing;
2551 } __packed;
2552 
2553 #define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT_V2 0x25
2554 struct bt_hci_evt_le_per_advertising_report_v2 {
2555 	uint16_t handle;
2556 	int8_t tx_power;
2557 	int8_t rssi;
2558 	uint8_t cte_type;
2559 	uint16_t periodic_event_counter;
2560 	uint8_t subevent;
2561 	uint8_t data_status;
2562 	uint8_t length;
2563 	uint8_t data[0];
2564 } __packed;
2565 
2566 #define BT_HCI_EVT_LE_PAST_RECEIVED_V2 0x26
2567 struct bt_hci_evt_le_past_received_v2 {
2568 	uint8_t status;
2569 	uint16_t conn_handle;
2570 	uint16_t service_data;
2571 	uint16_t sync_handle;
2572 	uint8_t adv_sid;
2573 	bt_addr_le_t addr;
2574 	uint8_t phy;
2575 	uint16_t interval;
2576 	uint8_t clock_accuracy;
2577 	uint8_t num_subevents;
2578 	uint8_t subevent_interval;
2579 	uint8_t response_slot_delay;
2580 	uint8_t response_slot_spacing;
2581 } __packed;
2582 
2583 #define BT_HCI_EVT_LE_PER_ADV_SUBEVENT_DATA_REQUEST 0x27
2584 struct bt_hci_evt_le_per_adv_subevent_data_request {
2585 	uint8_t adv_handle;
2586 	uint8_t subevent_start;
2587 	uint8_t subevent_data_count;
2588 } __packed;
2589 
2590 #define BT_HCI_EVT_LE_PER_ADV_RESPONSE_REPORT 0x28
2591 
2592 struct bt_hci_evt_le_per_adv_response {
2593 	int8_t tx_power;
2594 	int8_t rssi;
2595 	uint8_t cte_type;
2596 	uint8_t response_slot;
2597 	uint8_t data_status;
2598 	uint8_t data_length;
2599 	uint8_t data[0];
2600 } __packed;
2601 
2602 struct bt_hci_evt_le_per_adv_response_report {
2603 	uint8_t adv_handle;
2604 	uint8_t subevent;
2605 	uint8_t tx_status;
2606 	uint8_t num_responses;
2607 	struct bt_hci_evt_le_per_adv_response responses[0];
2608 } __packed;
2609 
2610 #define BT_HCI_EVT_LE_ENH_CONN_COMPLETE_V2 0x29
2611 struct bt_hci_evt_le_enh_conn_complete_v2 {
2612 	uint8_t      status;
2613 	uint16_t     handle;
2614 	uint8_t      role;
2615 	bt_addr_le_t peer_addr;
2616 	bt_addr_t    local_rpa;
2617 	bt_addr_t    peer_rpa;
2618 	uint16_t     interval;
2619 	uint16_t     latency;
2620 	uint16_t     supv_timeout;
2621 	uint8_t      clock_accuracy;
2622 	uint8_t adv_handle;
2623 	uint16_t sync_handle;
2624 } __packed;
2625 
2626 #define BT_HCI_EVT_SYNC_CONN_COMPLETE           0x2c
2627 struct bt_hci_evt_sync_conn_complete {
2628 	uint8_t    status;
2629 	uint16_t   handle;
2630 	bt_addr_t  bdaddr;
2631 	uint8_t    link_type;
2632 	uint8_t    tx_interval;
2633 	uint8_t    retansmission_window;
2634 	uint16_t   rx_pkt_length;
2635 	uint16_t   tx_pkt_length;
2636 	uint8_t    air_mode;
2637 } __packed;
2638 
2639 #define BT_HCI_EVT_EXTENDED_INQUIRY_RESULT      0x2f
2640 struct bt_hci_evt_extended_inquiry_result {
2641 	uint8_t    num_reports;
2642 	bt_addr_t  addr;
2643 	uint8_t    pscan_rep_mode;
2644 	uint8_t    reserved;
2645 	uint8_t    cod[3];
2646 	uint16_t   clock_offset;
2647 	int8_t     rssi;
2648 	uint8_t    eir[240];
2649 } __packed;
2650 
2651 #define BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE 0x30
2652 struct bt_hci_evt_encrypt_key_refresh_complete {
2653 	uint8_t  status;
2654 	uint16_t handle;
2655 } __packed;
2656 
2657 #define BT_HCI_EVT_IO_CAPA_REQ                  0x31
2658 struct bt_hci_evt_io_capa_req {
2659 	bt_addr_t bdaddr;
2660 } __packed;
2661 
2662 #define BT_HCI_EVT_IO_CAPA_RESP                 0x32
2663 struct bt_hci_evt_io_capa_resp {
2664 	bt_addr_t bdaddr;
2665 	uint8_t   capability;
2666 	uint8_t   oob_data;
2667 	uint8_t   authentication;
2668 } __packed;
2669 
2670 #define BT_HCI_EVT_USER_CONFIRM_REQ             0x33
2671 struct bt_hci_evt_user_confirm_req {
2672 	bt_addr_t bdaddr;
2673 	uint32_t  passkey;
2674 } __packed;
2675 
2676 #define BT_HCI_EVT_USER_PASSKEY_REQ             0x34
2677 struct bt_hci_evt_user_passkey_req {
2678 	bt_addr_t bdaddr;
2679 } __packed;
2680 
2681 #define BT_HCI_EVT_SSP_COMPLETE                 0x36
2682 struct bt_hci_evt_ssp_complete {
2683 	uint8_t   status;
2684 	bt_addr_t bdaddr;
2685 } __packed;
2686 
2687 #define BT_HCI_EVT_USER_PASSKEY_NOTIFY          0x3b
2688 struct bt_hci_evt_user_passkey_notify {
2689 	bt_addr_t bdaddr;
2690 	uint32_t  passkey;
2691 } __packed;
2692 
2693 #define BT_HCI_EVT_LE_META_EVENT                0x3e
2694 struct bt_hci_evt_le_meta_event {
2695 	uint8_t  subevent;
2696 } __packed;
2697 
2698 #define BT_HCI_EVT_AUTH_PAYLOAD_TIMEOUT_EXP     0x57
2699 struct bt_hci_evt_auth_payload_timeout_exp {
2700 	uint16_t handle;
2701 } __packed;
2702 
2703 #define BT_HCI_ROLE_CENTRAL                     0x00
2704 #define BT_HCI_ROLE_PERIPHERAL                  0x01
2705 
2706 #define BT_HCI_EVT_LE_CONN_COMPLETE             0x01
2707 struct bt_hci_evt_le_conn_complete {
2708 	uint8_t      status;
2709 	uint16_t     handle;
2710 	uint8_t      role;
2711 	bt_addr_le_t peer_addr;
2712 	uint16_t     interval;
2713 	uint16_t     latency;
2714 	uint16_t     supv_timeout;
2715 	uint8_t      clock_accuracy;
2716 } __packed;
2717 
2718 #define BT_HCI_LE_RSSI_NOT_AVAILABLE            0x7F
2719 
2720 #define BT_HCI_EVT_LE_ADVERTISING_REPORT        0x02
2721 struct bt_hci_evt_le_advertising_info {
2722 	uint8_t      evt_type;
2723 	bt_addr_le_t addr;
2724 	uint8_t      length;
2725 	uint8_t      data[0];
2726 } __packed;
2727 struct bt_hci_evt_le_advertising_report {
2728 	uint8_t num_reports;
2729 	struct bt_hci_evt_le_advertising_info adv_info[0];
2730 } __packed;
2731 
2732 #define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE      0x03
2733 struct bt_hci_evt_le_conn_update_complete {
2734 	uint8_t  status;
2735 	uint16_t handle;
2736 	uint16_t interval;
2737 	uint16_t latency;
2738 	uint16_t supv_timeout;
2739 } __packed;
2740 
2741 #define BT_HCI_EVT_LE_REMOTE_FEAT_COMPLETE      0x04
2742 struct bt_hci_evt_le_remote_feat_complete {
2743 	uint8_t  status;
2744 	uint16_t handle;
2745 	uint8_t  features[8];
2746 } __packed;
2747 
2748 #define BT_HCI_EVT_LE_LTK_REQUEST               0x05
2749 struct bt_hci_evt_le_ltk_request {
2750 	uint16_t handle;
2751 	uint64_t rand;
2752 	uint16_t ediv;
2753 } __packed;
2754 
2755 #define BT_HCI_EVT_LE_CONN_PARAM_REQ            0x06
2756 struct bt_hci_evt_le_conn_param_req {
2757 	uint16_t handle;
2758 	uint16_t interval_min;
2759 	uint16_t interval_max;
2760 	uint16_t latency;
2761 	uint16_t timeout;
2762 } __packed;
2763 
2764 #define BT_HCI_EVT_LE_DATA_LEN_CHANGE           0x07
2765 struct bt_hci_evt_le_data_len_change {
2766 	uint16_t handle;
2767 	uint16_t max_tx_octets;
2768 	uint16_t max_tx_time;
2769 	uint16_t max_rx_octets;
2770 	uint16_t max_rx_time;
2771 } __packed;
2772 
2773 #define BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE  0x08
2774 struct bt_hci_evt_le_p256_public_key_complete {
2775 	uint8_t status;
2776 	uint8_t key[64];
2777 } __packed;
2778 
2779 #define BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE   0x09
2780 struct bt_hci_evt_le_generate_dhkey_complete {
2781 	uint8_t status;
2782 	uint8_t dhkey[32];
2783 } __packed;
2784 
2785 #define BT_HCI_EVT_LE_ENH_CONN_COMPLETE         0x0a
2786 struct bt_hci_evt_le_enh_conn_complete {
2787 	uint8_t      status;
2788 	uint16_t     handle;
2789 	uint8_t      role;
2790 	bt_addr_le_t peer_addr;
2791 	bt_addr_t    local_rpa;
2792 	bt_addr_t    peer_rpa;
2793 	uint16_t     interval;
2794 	uint16_t     latency;
2795 	uint16_t     supv_timeout;
2796 	uint8_t      clock_accuracy;
2797 } __packed;
2798 
2799 #define BT_HCI_EVT_LE_DIRECT_ADV_REPORT         0x0b
2800 struct bt_hci_evt_le_direct_adv_info {
2801 	uint8_t      evt_type;
2802 	bt_addr_le_t addr;
2803 	bt_addr_le_t dir_addr;
2804 	int8_t       rssi;
2805 } __packed;
2806 struct bt_hci_evt_le_direct_adv_report {
2807 	uint8_t num_reports;
2808 	struct bt_hci_evt_le_direct_adv_info direct_adv_info[0];
2809 } __packed;
2810 
2811 #define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE       0x0c
2812 struct bt_hci_evt_le_phy_update_complete {
2813 	uint8_t  status;
2814 	uint16_t handle;
2815 	uint8_t  tx_phy;
2816 	uint8_t  rx_phy;
2817 } __packed;
2818 
2819 #define BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT    0x0d
2820 
2821 #define BT_HCI_LE_ADV_EVT_TYPE_CONN                 BIT(0)
2822 #define BT_HCI_LE_ADV_EVT_TYPE_SCAN                 BIT(1)
2823 #define BT_HCI_LE_ADV_EVT_TYPE_DIRECT               BIT(2)
2824 #define BT_HCI_LE_ADV_EVT_TYPE_SCAN_RSP             BIT(3)
2825 #define BT_HCI_LE_ADV_EVT_TYPE_LEGACY               BIT(4)
2826 
2827 #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS(ev_type) (((ev_type) >> 5) & 0x03)
2828 #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_COMPLETE   0
2829 #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_PARTIAL    1
2830 #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_INCOMPLETE 2
2831 #define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_RX_FAILED  0xFF
2832 
2833 struct bt_hci_evt_le_ext_advertising_info {
2834 	uint16_t     evt_type;
2835 	bt_addr_le_t addr;
2836 	uint8_t      prim_phy;
2837 	uint8_t      sec_phy;
2838 	uint8_t      sid;
2839 	int8_t       tx_power;
2840 	int8_t       rssi;
2841 	uint16_t     interval;
2842 	bt_addr_le_t direct_addr;
2843 	uint8_t      length;
2844 	uint8_t      data[0];
2845 } __packed;
2846 struct bt_hci_evt_le_ext_advertising_report {
2847 	uint8_t num_reports;
2848 	struct bt_hci_evt_le_ext_advertising_info adv_info[0];
2849 } __packed;
2850 
2851 #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED  0x0e
2852 struct bt_hci_evt_le_per_adv_sync_established {
2853 	uint8_t      status;
2854 	uint16_t     handle;
2855 	uint8_t      sid;
2856 	bt_addr_le_t adv_addr;
2857 	uint8_t      phy;
2858 	uint16_t     interval;
2859 	uint8_t      clock_accuracy;
2860 } __packed;
2861 
2862 #define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT    0x0f
2863 struct bt_hci_evt_le_per_advertising_report {
2864 	uint16_t handle;
2865 	int8_t   tx_power;
2866 	int8_t   rssi;
2867 	uint8_t  cte_type;
2868 	uint8_t  data_status;
2869 	uint8_t  length;
2870 	uint8_t  data[0];
2871 } __packed;
2872 
2873 #define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST         0x10
2874 struct bt_hci_evt_le_per_adv_sync_lost {
2875 	uint16_t handle;
2876 } __packed;
2877 
2878 #define BT_HCI_EVT_LE_SCAN_TIMEOUT              0x11
2879 
2880 #define BT_HCI_EVT_LE_ADV_SET_TERMINATED        0x12
2881 struct bt_hci_evt_le_adv_set_terminated {
2882 	uint8_t  status;
2883 	uint8_t  adv_handle;
2884 	uint16_t conn_handle;
2885 	uint8_t  num_completed_ext_adv_evts;
2886 } __packed;
2887 
2888 #define BT_HCI_EVT_LE_SCAN_REQ_RECEIVED         0x13
2889 struct bt_hci_evt_le_scan_req_received {
2890 	uint8_t      handle;
2891 	bt_addr_le_t addr;
2892 } __packed;
2893 
2894 #define BT_HCI_LE_CHAN_SEL_ALGO_1               0x00
2895 #define BT_HCI_LE_CHAN_SEL_ALGO_2               0x01
2896 
2897 #define BT_HCI_EVT_LE_CHAN_SEL_ALGO             0x14
2898 struct bt_hci_evt_le_chan_sel_algo {
2899 	uint16_t handle;
2900 	uint8_t  chan_sel_algo;
2901 } __packed;
2902 
2903 #define BT_HCI_LE_CTE_CRC_OK                    0x0
2904 #define BT_HCI_LE_CTE_CRC_ERR_CTE_BASED_TIME    0x1
2905 #define BT_HCI_LE_CTE_CRC_ERR_CTE_BASED_OTHER   0x2
2906 #define BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES    0xFF
2907 
2908 #define B_HCI_LE_CTE_REPORT_SAMPLE_COUNT_MIN    0x9
2909 #define B_HCI_LE_CTE_REPORT_SAMPLE_COUNT_MAX    0x52
2910 
2911 #define BT_HCI_LE_CTE_REPORT_NO_VALID_SAMPLE    0x80
2912 
2913 #define BT_HCI_EVT_LE_CONNECTIONLESS_IQ_REPORT  0x15
2914 struct bt_hci_le_iq_sample {
2915 	int8_t i;
2916 	int8_t q;
2917 };
2918 
2919 struct bt_hci_evt_le_connectionless_iq_report {
2920 	uint16_t sync_handle;
2921 	uint8_t  chan_idx;
2922 	int16_t  rssi;
2923 	uint8_t  rssi_ant_id;
2924 	uint8_t  cte_type;
2925 	uint8_t  slot_durations;
2926 	uint8_t  packet_status;
2927 	uint16_t per_evt_counter;
2928 	uint8_t  sample_count;
2929 	struct bt_hci_le_iq_sample sample[0];
2930 } __packed;
2931 
2932 #define BT_HCI_EVT_LE_CONNECTION_IQ_REPORT      0x16
2933 struct bt_hci_evt_le_connection_iq_report {
2934 	uint16_t conn_handle;
2935 	uint8_t  rx_phy;
2936 	uint8_t  data_chan_idx;
2937 	int16_t  rssi;
2938 	uint8_t  rssi_ant_id;
2939 	uint8_t  cte_type;
2940 	uint8_t  slot_durations;
2941 	uint8_t  packet_status;
2942 	uint16_t conn_evt_counter;
2943 	uint8_t  sample_count;
2944 	struct bt_hci_le_iq_sample sample[0];
2945 } __packed;
2946 
2947 #define BT_HCI_CTE_REQ_STATUS_RSP_WITHOUT_CTE  0x0
2948 
2949 #define BT_HCI_EVT_LE_CTE_REQUEST_FAILED       0x17
2950 struct bt_hci_evt_le_cte_req_failed {
2951 	/* According to BT 5.3 Core Spec the status field may have following
2952 	 * values:
2953 	 * - BT_HCI_CTE_REQ_STATUS_RSP_WITHOUT_CTE when received LL_CTE_RSP_PDU without CTE.
2954 	 * - Other Controller error code for peer rejected request.
2955 	 */
2956 	uint8_t  status;
2957 	uint16_t conn_handle;
2958 } __packed;
2959 
2960 #define BT_HCI_EVT_LE_PAST_RECEIVED                0x18
2961 struct bt_hci_evt_le_past_received {
2962 	uint8_t      status;
2963 	uint16_t     conn_handle;
2964 	uint16_t     service_data;
2965 	uint16_t     sync_handle;
2966 	uint8_t      adv_sid;
2967 	bt_addr_le_t addr;
2968 	uint8_t      phy;
2969 	uint16_t     interval;
2970 	uint8_t      clock_accuracy;
2971 } __packed;
2972 
2973 #define BT_HCI_EVT_LE_CIS_ESTABLISHED           0x19
2974 struct bt_hci_evt_le_cis_established {
2975 	uint8_t  status;
2976 	uint16_t conn_handle;
2977 	uint8_t  cig_sync_delay[3];
2978 	uint8_t  cis_sync_delay[3];
2979 	uint8_t  c_latency[3];
2980 	uint8_t  p_latency[3];
2981 	uint8_t  c_phy;
2982 	uint8_t  p_phy;
2983 	uint8_t  nse;
2984 	uint8_t  c_bn;
2985 	uint8_t  p_bn;
2986 	uint8_t  c_ft;
2987 	uint8_t  p_ft;
2988 	uint16_t c_max_pdu;
2989 	uint16_t p_max_pdu;
2990 	uint16_t interval;
2991 } __packed;
2992 
2993 #define BT_HCI_EVT_LE_CIS_REQ                   0x1a
2994 struct bt_hci_evt_le_cis_req {
2995 	uint16_t acl_handle;
2996 	uint16_t cis_handle;
2997 	uint8_t  cig_id;
2998 	uint8_t  cis_id;
2999 } __packed;
3000 
3001 #define BT_HCI_EVT_LE_BIG_COMPLETE              0x1b
3002 struct bt_hci_evt_le_big_complete {
3003 	uint8_t  status;
3004 	uint8_t  big_handle;
3005 	uint8_t  sync_delay[3];
3006 	uint8_t  latency[3];
3007 	uint8_t  phy;
3008 	uint8_t  nse;
3009 	uint8_t  bn;
3010 	uint8_t  pto;
3011 	uint8_t  irc;
3012 	uint16_t max_pdu;
3013 	uint16_t iso_interval;
3014 	uint8_t  num_bis;
3015 	uint16_t handle[0];
3016 } __packed;
3017 
3018 #define BT_HCI_EVT_LE_BIG_TERMINATE             0x1c
3019 struct bt_hci_evt_le_big_terminate {
3020 	uint8_t  big_handle;
3021 	uint8_t  reason;
3022 } __packed;
3023 
3024 #define BT_HCI_EVT_LE_BIG_SYNC_ESTABLISHED      0x1d
3025 struct bt_hci_evt_le_big_sync_established {
3026 	uint8_t  status;
3027 	uint8_t  big_handle;
3028 	uint8_t  latency[3];
3029 	uint8_t  nse;
3030 	uint8_t  bn;
3031 	uint8_t  pto;
3032 	uint8_t  irc;
3033 	uint16_t max_pdu;
3034 	uint16_t iso_interval;
3035 	uint8_t  num_bis;
3036 	uint16_t handle[0];
3037 } __packed;
3038 
3039 #define BT_HCI_EVT_LE_BIG_SYNC_LOST             0x1e
3040 struct bt_hci_evt_le_big_sync_lost {
3041 	uint8_t  big_handle;
3042 	uint8_t  reason;
3043 } __packed;
3044 
3045 #define BT_HCI_EVT_LE_REQ_PEER_SCA_COMPLETE     0x1f
3046 struct bt_hci_evt_le_req_peer_sca_complete {
3047 	uint8_t  status;
3048 	uint16_t handle;
3049 	uint8_t  sca;
3050 } __packed;
3051 
3052 #define	BT_HCI_LE_ZONE_ENTERED_LOW      0x0
3053 #define	BT_HCI_LE_ZONE_ENTERED_MIDDLE   0x1
3054 #define	BT_HCI_LE_ZONE_ENTERED_HIGH     0x2
3055 #define	BT_HCI_LE_PATH_LOSS_UNAVAILABLE 0xFF
3056 
3057 #define BT_HCI_EVT_LE_PATH_LOSS_THRESHOLD                   0x20
3058 struct bt_hci_evt_le_path_loss_threshold {
3059 	uint16_t handle;
3060 	uint8_t  current_path_loss;
3061 	uint8_t  zone_entered;
3062 } __packed;
3063 
3064 /** Reason for Transmit power reporting.
3065  */
3066 /* Local Transmit power changed. */
3067 #define	BT_HCI_LE_TX_POWER_REPORT_REASON_LOCAL_CHANGED         0x00
3068 /* Remote Transmit power changed. */
3069 #define	BT_HCI_LE_TX_POWER_REPORT_REASON_REMOTE_CHANGED        0x01
3070 /* HCI_LE_Read_Remote_Transmit_Power_Level command completed. */
3071 #define	BT_HCI_LE_TX_POWER_REPORT_REASON_READ_REMOTE_COMPLETED 0x02
3072 
3073 #define BT_HCI_EVT_LE_TRANSMIT_POWER_REPORT     0x21
3074 struct bt_hci_evt_le_transmit_power_report {
3075 	uint8_t	 status;
3076 	uint16_t handle;
3077 	uint8_t  reason;
3078 	uint8_t  phy;
3079 	int8_t   tx_power_level;
3080 	uint8_t  tx_power_level_flag;
3081 	int8_t   delta;
3082 } __packed;
3083 
3084 #define BT_HCI_EVT_LE_BIGINFO_ADV_REPORT        0x22
3085 struct bt_hci_evt_le_biginfo_adv_report {
3086 	uint16_t sync_handle;
3087 	uint8_t  num_bis;
3088 	uint8_t  nse;
3089 	uint16_t iso_interval;
3090 	uint8_t  bn;
3091 	uint8_t  pto;
3092 	uint8_t  irc;
3093 	uint16_t max_pdu;
3094 	uint8_t  sdu_interval[3];
3095 	uint16_t max_sdu;
3096 	uint8_t  phy;
3097 	uint8_t  framing;
3098 	uint8_t  encryption;
3099 } __packed;
3100 
3101 /* Event mask bits */
3102 
3103 #define BT_EVT_BIT(n) (1ULL << (n))
3104 
3105 #define BT_EVT_MASK_INQUIRY_COMPLETE             BT_EVT_BIT(0)
3106 #define BT_EVT_MASK_CONN_COMPLETE                BT_EVT_BIT(2)
3107 #define BT_EVT_MASK_CONN_REQUEST                 BT_EVT_BIT(3)
3108 #define BT_EVT_MASK_DISCONN_COMPLETE             BT_EVT_BIT(4)
3109 #define BT_EVT_MASK_AUTH_COMPLETE                BT_EVT_BIT(5)
3110 #define BT_EVT_MASK_REMOTE_NAME_REQ_COMPLETE     BT_EVT_BIT(6)
3111 #define BT_EVT_MASK_ENCRYPT_CHANGE               BT_EVT_BIT(7)
3112 #define BT_EVT_MASK_REMOTE_FEATURES              BT_EVT_BIT(10)
3113 #define BT_EVT_MASK_REMOTE_VERSION_INFO          BT_EVT_BIT(11)
3114 #define BT_EVT_MASK_HARDWARE_ERROR               BT_EVT_BIT(15)
3115 #define BT_EVT_MASK_ROLE_CHANGE                  BT_EVT_BIT(17)
3116 #define BT_EVT_MASK_PIN_CODE_REQ                 BT_EVT_BIT(21)
3117 #define BT_EVT_MASK_LINK_KEY_REQ                 BT_EVT_BIT(22)
3118 #define BT_EVT_MASK_LINK_KEY_NOTIFY              BT_EVT_BIT(23)
3119 #define BT_EVT_MASK_DATA_BUFFER_OVERFLOW         BT_EVT_BIT(25)
3120 #define BT_EVT_MASK_INQUIRY_RESULT_WITH_RSSI     BT_EVT_BIT(33)
3121 #define BT_EVT_MASK_REMOTE_EXT_FEATURES          BT_EVT_BIT(34)
3122 #define BT_EVT_MASK_SYNC_CONN_COMPLETE           BT_EVT_BIT(43)
3123 #define BT_EVT_MASK_EXTENDED_INQUIRY_RESULT      BT_EVT_BIT(46)
3124 #define BT_EVT_MASK_ENCRYPT_KEY_REFRESH_COMPLETE BT_EVT_BIT(47)
3125 #define BT_EVT_MASK_IO_CAPA_REQ                  BT_EVT_BIT(48)
3126 #define BT_EVT_MASK_IO_CAPA_RESP                 BT_EVT_BIT(49)
3127 #define BT_EVT_MASK_USER_CONFIRM_REQ             BT_EVT_BIT(50)
3128 #define BT_EVT_MASK_USER_PASSKEY_REQ             BT_EVT_BIT(51)
3129 #define BT_EVT_MASK_SSP_COMPLETE                 BT_EVT_BIT(53)
3130 #define BT_EVT_MASK_USER_PASSKEY_NOTIFY          BT_EVT_BIT(58)
3131 #define BT_EVT_MASK_LE_META_EVENT                BT_EVT_BIT(61)
3132 
3133 /* Page 2 */
3134 #define BT_EVT_MASK_NUM_COMPLETE_DATA_BLOCKS     BT_EVT_BIT(8)
3135 #define BT_EVT_MASK_TRIGG_CLOCK_CAPTURE          BT_EVT_BIT(14)
3136 #define BT_EVT_MASK_SYNCH_TRAIN_COMPLETE         BT_EVT_BIT(15)
3137 #define BT_EVT_MASK_SYNCH_TRAIN_RX               BT_EVT_BIT(16)
3138 #define BT_EVT_MASK_CL_PER_BC_RX                 BT_EVT_BIT(17)
3139 #define BT_EVT_MASK_CL_PER_BC_TIMEOUT            BT_EVT_BIT(18)
3140 #define BT_EVT_MASK_TRUNC_PAGE_COMPLETE          BT_EVT_BIT(19)
3141 #define BT_EVT_MASK_PER_PAGE_RSP_TIMEOUT         BT_EVT_BIT(20)
3142 #define BT_EVT_MASK_CL_PER_BC_CH_MAP_CHANGE      BT_EVT_BIT(21)
3143 #define BT_EVT_MASK_INQUIRY_RSP_NOT              BT_EVT_BIT(22)
3144 #define BT_EVT_MASK_AUTH_PAYLOAD_TIMEOUT_EXP     BT_EVT_BIT(23)
3145 #define BT_EVT_MASK_SAM_STATUS_CHANGE            BT_EVT_BIT(24)
3146 
3147 #define BT_EVT_MASK_LE_CONN_COMPLETE             BT_EVT_BIT(0)
3148 #define BT_EVT_MASK_LE_ADVERTISING_REPORT        BT_EVT_BIT(1)
3149 #define BT_EVT_MASK_LE_CONN_UPDATE_COMPLETE      BT_EVT_BIT(2)
3150 #define BT_EVT_MASK_LE_REMOTE_FEAT_COMPLETE      BT_EVT_BIT(3)
3151 #define BT_EVT_MASK_LE_LTK_REQUEST               BT_EVT_BIT(4)
3152 #define BT_EVT_MASK_LE_CONN_PARAM_REQ            BT_EVT_BIT(5)
3153 #define BT_EVT_MASK_LE_DATA_LEN_CHANGE           BT_EVT_BIT(6)
3154 #define BT_EVT_MASK_LE_P256_PUBLIC_KEY_COMPLETE  BT_EVT_BIT(7)
3155 #define BT_EVT_MASK_LE_GENERATE_DHKEY_COMPLETE   BT_EVT_BIT(8)
3156 #define BT_EVT_MASK_LE_ENH_CONN_COMPLETE         BT_EVT_BIT(9)
3157 #define BT_EVT_MASK_LE_DIRECT_ADV_REPORT         BT_EVT_BIT(10)
3158 #define BT_EVT_MASK_LE_PHY_UPDATE_COMPLETE       BT_EVT_BIT(11)
3159 #define BT_EVT_MASK_LE_EXT_ADVERTISING_REPORT    BT_EVT_BIT(12)
3160 #define BT_EVT_MASK_LE_PER_ADV_SYNC_ESTABLISHED  BT_EVT_BIT(13)
3161 #define BT_EVT_MASK_LE_PER_ADVERTISING_REPORT    BT_EVT_BIT(14)
3162 #define BT_EVT_MASK_LE_PER_ADV_SYNC_LOST         BT_EVT_BIT(15)
3163 #define BT_EVT_MASK_LE_SCAN_TIMEOUT              BT_EVT_BIT(16)
3164 #define BT_EVT_MASK_LE_ADV_SET_TERMINATED        BT_EVT_BIT(17)
3165 #define BT_EVT_MASK_LE_SCAN_REQ_RECEIVED         BT_EVT_BIT(18)
3166 #define BT_EVT_MASK_LE_CHAN_SEL_ALGO             BT_EVT_BIT(19)
3167 #define BT_EVT_MASK_LE_CONNECTIONLESS_IQ_REPORT  BT_EVT_BIT(20)
3168 #define BT_EVT_MASK_LE_CONNECTION_IQ_REPORT      BT_EVT_BIT(21)
3169 #define BT_EVT_MASK_LE_CTE_REQUEST_FAILED        BT_EVT_BIT(22)
3170 #define BT_EVT_MASK_LE_PAST_RECEIVED             BT_EVT_BIT(23)
3171 #define BT_EVT_MASK_LE_CIS_ESTABLISHED           BT_EVT_BIT(24)
3172 #define BT_EVT_MASK_LE_CIS_REQ                   BT_EVT_BIT(25)
3173 #define BT_EVT_MASK_LE_BIG_COMPLETE              BT_EVT_BIT(26)
3174 #define BT_EVT_MASK_LE_BIG_TERMINATED            BT_EVT_BIT(27)
3175 #define BT_EVT_MASK_LE_BIG_SYNC_ESTABLISHED      BT_EVT_BIT(28)
3176 #define BT_EVT_MASK_LE_BIG_SYNC_LOST             BT_EVT_BIT(29)
3177 #define BT_EVT_MASK_LE_REQ_PEER_SCA_COMPLETE     BT_EVT_BIT(30)
3178 #define BT_EVT_MASK_LE_PATH_LOSS_THRESHOLD       BT_EVT_BIT(31)
3179 #define BT_EVT_MASK_LE_TRANSMIT_POWER_REPORTING  BT_EVT_BIT(32)
3180 #define BT_EVT_MASK_LE_BIGINFO_ADV_REPORT        BT_EVT_BIT(33)
3181 
3182 #define BT_EVT_MASK_LE_PER_ADV_SYNC_ESTABLISHED_V2 BT_EVT_BIT(35)
3183 #define BT_EVT_MASK_LE_PER_ADVERTISING_REPORT_V2   BT_EVT_BIT(36)
3184 #define BT_EVT_MASK_LE_PAST_RECEIVED_V2            BT_EVT_BIT(37)
3185 #define BT_EVT_MASK_LE_PER_ADV_SUBEVENT_DATA_REQ   BT_EVT_BIT(38)
3186 #define BT_EVT_MASK_LE_PER_ADV_RESPONSE_REPORT     BT_EVT_BIT(39)
3187 #define BT_EVT_MASK_LE_ENH_CONN_COMPLETE_V2        BT_EVT_BIT(40)
3188 
3189 /** HCI Error Codes, BT Core Spec v5.4 [Vol 1, Part F]. */
3190 #define BT_HCI_ERR_SUCCESS                      0x00
3191 #define BT_HCI_ERR_UNKNOWN_CMD                  0x01
3192 #define BT_HCI_ERR_UNKNOWN_CONN_ID              0x02
3193 #define BT_HCI_ERR_HW_FAILURE                   0x03
3194 #define BT_HCI_ERR_PAGE_TIMEOUT                 0x04
3195 #define BT_HCI_ERR_AUTH_FAIL                    0x05
3196 #define BT_HCI_ERR_PIN_OR_KEY_MISSING           0x06
3197 #define BT_HCI_ERR_MEM_CAPACITY_EXCEEDED        0x07
3198 #define BT_HCI_ERR_CONN_TIMEOUT                 0x08
3199 #define BT_HCI_ERR_CONN_LIMIT_EXCEEDED          0x09
3200 #define BT_HCI_ERR_SYNC_CONN_LIMIT_EXCEEDED     0x0a
3201 #define BT_HCI_ERR_CONN_ALREADY_EXISTS          0x0b
3202 #define BT_HCI_ERR_CMD_DISALLOWED               0x0c
3203 #define BT_HCI_ERR_INSUFFICIENT_RESOURCES       0x0d
3204 #define BT_HCI_ERR_INSUFFICIENT_SECURITY        0x0e
3205 #define BT_HCI_ERR_BD_ADDR_UNACCEPTABLE         0x0f
3206 #define BT_HCI_ERR_CONN_ACCEPT_TIMEOUT          0x10
3207 #define BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL     0x11
3208 #define BT_HCI_ERR_INVALID_PARAM                0x12
3209 #define BT_HCI_ERR_REMOTE_USER_TERM_CONN        0x13
3210 #define BT_HCI_ERR_REMOTE_LOW_RESOURCES         0x14
3211 #define BT_HCI_ERR_REMOTE_POWER_OFF             0x15
3212 #define BT_HCI_ERR_LOCALHOST_TERM_CONN          0x16
3213 #define BT_HCI_ERR_REPEATED_ATTEMPTS            0x17
3214 #define BT_HCI_ERR_PAIRING_NOT_ALLOWED          0x18
3215 #define BT_HCI_ERR_UNKNOWN_LMP_PDU              0x19
3216 #define BT_HCI_ERR_UNSUPP_REMOTE_FEATURE        0x1a
3217 #define BT_HCI_ERR_SCO_OFFSET_REJECTED          0x1b
3218 #define BT_HCI_ERR_SCO_INTERVAL_REJECTED        0x1c
3219 #define BT_HCI_ERR_SCO_AIR_MODE_REJECTED        0x1d
3220 #define BT_HCI_ERR_INVALID_LL_PARAM             0x1e
3221 #define BT_HCI_ERR_UNSPECIFIED                  0x1f
3222 #define BT_HCI_ERR_UNSUPP_LL_PARAM_VAL          0x20
3223 #define BT_HCI_ERR_ROLE_CHANGE_NOT_ALLOWED      0x21
3224 #define BT_HCI_ERR_LL_RESP_TIMEOUT              0x22
3225 #define BT_HCI_ERR_LL_PROC_COLLISION            0x23
3226 #define BT_HCI_ERR_LMP_PDU_NOT_ALLOWED          0x24
3227 #define BT_HCI_ERR_ENC_MODE_NOT_ACCEPTABLE      0x25
3228 #define BT_HCI_ERR_LINK_KEY_CANNOT_BE_CHANGED   0x26
3229 #define BT_HCI_ERR_REQUESTED_QOS_NOT_SUPPORTED  0x27
3230 #define BT_HCI_ERR_INSTANT_PASSED               0x28
3231 #define BT_HCI_ERR_PAIRING_NOT_SUPPORTED        0x29
3232 #define BT_HCI_ERR_DIFF_TRANS_COLLISION         0x2a
3233 #define BT_HCI_ERR_QOS_UNACCEPTABLE_PARAM       0x2c
3234 #define BT_HCI_ERR_QOS_REJECTED                 0x2d
3235 #define BT_HCI_ERR_CHAN_ASSESS_NOT_SUPPORTED    0x2e
3236 #define BT_HCI_ERR_INSUFF_SECURITY              0x2f
3237 #define BT_HCI_ERR_PARAM_OUT_OF_MANDATORY_RANGE 0x30
3238 #define BT_HCI_ERR_ROLE_SWITCH_PENDING          0x32
3239 #define BT_HCI_ERR_RESERVED_SLOT_VIOLATION      0x34
3240 #define BT_HCI_ERR_ROLE_SWITCH_FAILED           0x35
3241 #define BT_HCI_ERR_EXT_INQ_RESP_TOO_LARGE       0x36
3242 #define BT_HCI_ERR_SIMPLE_PAIR_NOT_SUPP_BY_HOST 0x37
3243 #define BT_HCI_ERR_HOST_BUSY_PAIRING            0x38
3244 #define BT_HCI_ERR_CONN_REJECTED_DUE_TO_NO_CHAN 0x39
3245 #define BT_HCI_ERR_CONTROLLER_BUSY              0x3a
3246 #define BT_HCI_ERR_UNACCEPT_CONN_PARAM          0x3b
3247 #define BT_HCI_ERR_ADV_TIMEOUT                  0x3c
3248 #define BT_HCI_ERR_TERM_DUE_TO_MIC_FAIL         0x3d
3249 #define BT_HCI_ERR_CONN_FAIL_TO_ESTAB           0x3e
3250 #define BT_HCI_ERR_MAC_CONN_FAILED              0x3f
3251 #define BT_HCI_ERR_CLOCK_ADJUST_REJECTED        0x40
3252 #define BT_HCI_ERR_SUBMAP_NOT_DEFINED           0x41
3253 #define BT_HCI_ERR_UNKNOWN_ADV_IDENTIFIER       0x42
3254 #define BT_HCI_ERR_LIMIT_REACHED                0x43
3255 #define BT_HCI_ERR_OP_CANCELLED_BY_HOST         0x44
3256 #define BT_HCI_ERR_PACKET_TOO_LONG              0x45
3257 #define BT_HCI_ERR_TOO_LATE                     0x46
3258 #define BT_HCI_ERR_TOO_EARLY                    0x47
3259 
3260 #ifdef __cplusplus
3261 }
3262 #endif
3263 
3264 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_HCI_TYPES_H_ */
3265