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