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