Line data Source code
1 0 : /* hci_vs.h - Bluetooth Host Control Interface Vendor Specific definitions */ 2 : 3 : /* 4 : * Copyright (c) 2017-2018 Nordic Semiconductor ASA 5 : * Copyright (c) 2015-2016 Intel Corporation 6 : * 7 : * SPDX-License-Identifier: Apache-2.0 8 : */ 9 : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_HCI_VS_H_ 10 : #define ZEPHYR_INCLUDE_BLUETOOTH_HCI_VS_H_ 11 : 12 : #include <stdint.h> 13 : 14 : #include <zephyr/bluetooth/hci.h> 15 : 16 : #ifdef __cplusplus 17 : extern "C" { 18 : #endif 19 : 20 0 : #define BT_VS_CMD_BIT_VERSION 0 21 0 : #define BT_VS_CMD_BIT_SUP_CMD 1 22 0 : #define BT_VS_CMD_BIT_SUP_FEAT 2 23 0 : #define BT_VS_CMD_BIT_SET_EVT_MASK 3 24 0 : #define BT_VS_CMD_BIT_RESET 4 25 0 : #define BT_VS_CMD_BIT_WRITE_BDADDR 5 26 0 : #define BT_VS_CMD_BIT_SET_TRACE_ENABLE 6 27 0 : #define BT_VS_CMD_BIT_READ_BUILD_INFO 7 28 0 : #define BT_VS_CMD_BIT_READ_STATIC_ADDRS 8 29 0 : #define BT_VS_CMD_BIT_READ_KEY_ROOTS 9 30 0 : #define BT_VS_CMD_BIT_READ_CHIP_TEMP 10 31 0 : #define BT_VS_CMD_BIT_READ_HOST_STACK_CMD 11 32 0 : #define BT_VS_CMD_BIT_SET_SCAN_REP_ENABLE 12 33 0 : #define BT_VS_CMD_BIT_WRITE_TX_POWER 13 34 0 : #define BT_VS_CMD_BIT_READ_TX_POWER 14 35 : 36 0 : #define BT_VS_CMD_SUP_FEAT(cmd) BT_LE_FEAT_TEST(cmd, \ 37 : BT_VS_CMD_BIT_SUP_FEAT) 38 0 : #define BT_VS_CMD_READ_STATIC_ADDRS(cmd) BT_LE_FEAT_TEST(cmd, \ 39 : BT_VS_CMD_BIT_READ_STATIC_ADDRS) 40 0 : #define BT_VS_CMD_READ_KEY_ROOTS(cmd) BT_LE_FEAT_TEST(cmd, \ 41 : BT_VS_CMD_BIT_READ_KEY_ROOTS) 42 : 43 0 : #define BT_HCI_VS_HW_PLAT_INTEL 0x0001 44 0 : #define BT_HCI_VS_HW_PLAT_NORDIC 0x0002 45 0 : #define BT_HCI_VS_HW_PLAT_NXP 0x0003 46 : 47 0 : #define BT_HCI_VS_HW_VAR_NORDIC_NRF51X 0x0001 48 0 : #define BT_HCI_VS_HW_VAR_NORDIC_NRF52X 0x0002 49 0 : #define BT_HCI_VS_HW_VAR_NORDIC_NRF53X 0x0003 50 0 : #define BT_HCI_VS_HW_VAR_NORDIC_NRF54HX 0x0004 51 0 : #define BT_HCI_VS_HW_VAR_NORDIC_NRF54LX 0x0005 52 : 53 0 : #define BT_HCI_VS_FW_VAR_STANDARD_CTLR 0x0001 54 0 : #define BT_HCI_VS_FW_VAR_VS_CTLR 0x0002 55 0 : #define BT_HCI_VS_FW_VAR_FW_LOADER 0x0003 56 0 : #define BT_HCI_VS_FW_VAR_RESCUE_IMG 0x0004 57 0 : #define BT_HCI_OP_VS_READ_VERSION_INFO BT_OP(BT_OGF_VS, 0x0001) 58 0 : struct bt_hci_rp_vs_read_version_info { 59 0 : uint8_t status; 60 0 : uint16_t hw_platform; 61 0 : uint16_t hw_variant; 62 0 : uint8_t fw_variant; 63 0 : uint8_t fw_version; 64 0 : uint16_t fw_revision; 65 0 : uint32_t fw_build; 66 : } __packed; 67 : 68 0 : #define BT_HCI_OP_VS_READ_SUPPORTED_COMMANDS BT_OP(BT_OGF_VS, 0x0002) 69 0 : struct bt_hci_rp_vs_read_supported_commands { 70 0 : uint8_t status; 71 0 : uint8_t commands[64]; 72 : } __packed; 73 : 74 0 : #define BT_HCI_OP_VS_READ_SUPPORTED_FEATURES BT_OP(BT_OGF_VS, 0x0003) 75 0 : struct bt_hci_rp_vs_read_supported_features { 76 0 : uint8_t status; 77 0 : uint8_t features[8]; 78 : } __packed; 79 : 80 0 : #define BT_HCI_OP_VS_SET_EVENT_MASK BT_OP(BT_OGF_VS, 0x0004) 81 0 : struct bt_hci_cp_vs_set_event_mask { 82 0 : uint8_t event_mask[8]; 83 : } __packed; 84 : 85 0 : #define BT_HCI_VS_RESET_SOFT 0x00 86 0 : #define BT_HCI_VS_RESET_HARD 0x01 87 0 : #define BT_HCI_OP_VS_RESET BT_OP(BT_OGF_VS, 0x0005) 88 0 : struct bt_hci_cp_vs_reset { 89 0 : uint8_t type; 90 : } __packed; 91 : 92 0 : #define BT_HCI_OP_VS_WRITE_BD_ADDR BT_OP(BT_OGF_VS, 0x0006) 93 0 : struct bt_hci_cp_vs_write_bd_addr { 94 0 : bt_addr_t bdaddr; 95 : } __packed; 96 : 97 0 : #define BT_HCI_VS_TRACE_DISABLED 0x00 98 0 : #define BT_HCI_VS_TRACE_ENABLED 0x01 99 : 100 0 : #define BT_HCI_VS_TRACE_HCI_EVTS 0x00 101 0 : #define BT_HCI_VS_TRACE_VDC 0x01 102 0 : #define BT_HCI_OP_VS_SET_TRACE_ENABLE BT_OP(BT_OGF_VS, 0x0007) 103 0 : struct bt_hci_cp_vs_set_trace_enable { 104 0 : uint8_t enable; 105 0 : uint8_t type; 106 : } __packed; 107 : 108 0 : #define BT_HCI_OP_VS_READ_BUILD_INFO BT_OP(BT_OGF_VS, 0x0008) 109 0 : struct bt_hci_rp_vs_read_build_info { 110 0 : uint8_t status; 111 0 : uint8_t info[0]; 112 : } __packed; 113 : 114 0 : struct bt_hci_vs_static_addr { 115 0 : bt_addr_t bdaddr; 116 0 : uint8_t ir[16]; 117 : } __packed; 118 : 119 0 : #define BT_HCI_OP_VS_READ_STATIC_ADDRS BT_OP(BT_OGF_VS, 0x0009) 120 0 : struct bt_hci_rp_vs_read_static_addrs { 121 0 : uint8_t status; 122 0 : uint8_t num_addrs; 123 0 : struct bt_hci_vs_static_addr a[0]; 124 : } __packed; 125 : 126 0 : #define BT_HCI_OP_VS_READ_KEY_HIERARCHY_ROOTS BT_OP(BT_OGF_VS, 0x000a) 127 0 : struct bt_hci_rp_vs_read_key_hierarchy_roots { 128 0 : uint8_t status; 129 0 : uint8_t ir[16]; 130 0 : uint8_t er[16]; 131 : } __packed; 132 : 133 0 : #define BT_HCI_OP_VS_READ_CHIP_TEMP BT_OP(BT_OGF_VS, 0x000b) 134 0 : struct bt_hci_rp_vs_read_chip_temp { 135 0 : uint8_t status; 136 0 : int8_t temps; 137 : } __packed; 138 : 139 0 : struct bt_hci_vs_cmd { 140 0 : uint16_t vendor_id; 141 0 : uint16_t opcode_base; 142 : } __packed; 143 : 144 0 : #define BT_HCI_VS_VID_ANDROID 0x0001 145 0 : #define BT_HCI_VS_VID_MICROSOFT 0x0002 146 0 : #define BT_HCI_OP_VS_READ_HOST_STACK_CMDS BT_OP(BT_OGF_VS, 0x000c) 147 0 : struct bt_hci_rp_vs_read_host_stack_cmds { 148 0 : uint8_t status; 149 0 : uint8_t num_cmds; 150 0 : struct bt_hci_vs_cmd c[0]; 151 : } __packed; 152 : 153 0 : #define BT_HCI_VS_SCAN_REQ_REPORTS_DISABLED 0x00 154 0 : #define BT_HCI_VS_SCAN_REQ_REPORTS_ENABLED 0x01 155 0 : #define BT_HCI_OP_VS_SET_SCAN_REQ_REPORTS BT_OP(BT_OGF_VS, 0x000d) 156 0 : struct bt_hci_cp_vs_set_scan_req_reports { 157 0 : uint8_t enable; 158 : } __packed; 159 : 160 0 : #define BT_HCI_VS_LL_HANDLE_TYPE_ADV 0x00 161 0 : #define BT_HCI_VS_LL_HANDLE_TYPE_SCAN 0x01 162 0 : #define BT_HCI_VS_LL_HANDLE_TYPE_CONN 0x02 163 0 : #define BT_HCI_VS_LL_TX_POWER_LEVEL_NO_PREF 0x7F 164 0 : #define BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL BT_OP(BT_OGF_VS, 0x000e) 165 0 : struct bt_hci_cp_vs_write_tx_power_level { 166 0 : uint8_t handle_type; 167 0 : uint16_t handle; 168 0 : int8_t tx_power_level; 169 : } __packed; 170 : 171 0 : struct bt_hci_rp_vs_write_tx_power_level { 172 0 : uint8_t status; 173 0 : uint8_t handle_type; 174 0 : uint16_t handle; 175 0 : int8_t selected_tx_power; 176 : } __packed; 177 : 178 0 : #define BT_HCI_OP_VS_READ_TX_POWER_LEVEL BT_OP(BT_OGF_VS, 0x000f) 179 0 : struct bt_hci_cp_vs_read_tx_power_level { 180 0 : uint8_t handle_type; 181 0 : uint16_t handle; 182 : } __packed; 183 : 184 0 : struct bt_hci_rp_vs_read_tx_power_level { 185 0 : uint8_t status; 186 0 : uint8_t handle_type; 187 0 : uint16_t handle; 188 0 : int8_t tx_power_level; 189 : } __packed; 190 : 191 0 : #define BT_HCI_OP_VS_READ_USB_TRANSPORT_MODE BT_OP(BT_OGF_VS, 0x0010) 192 : 193 0 : struct bt_hci_rp_vs_read_usb_transport_mode { 194 0 : uint8_t status; 195 0 : uint8_t num_supported_modes; 196 0 : uint8_t supported_mode[0]; 197 : } __packed; 198 : 199 0 : #define BT_HCI_VS_USB_H2_MODE 0x00 200 0 : #define BT_HCI_VS_USB_H4_MODE 0x01 201 : 202 0 : #define BT_HCI_OP_VS_SET_USB_TRANSPORT_MODE BT_OP(BT_OGF_VS, 0x0011) 203 : 204 0 : struct bt_hci_cp_vs_set_usb_transport_mode { 205 0 : uint8_t mode; 206 : } __packed; 207 : 208 0 : #define BT_HCI_OP_VS_SET_MIN_NUM_USED_CHANS BT_OP(BT_OGF_VS, 0x0012) 209 : 210 0 : struct bt_hci_cp_vs_set_min_num_used_chans { 211 0 : uint16_t handle; 212 0 : uint8_t phys; 213 0 : uint8_t min_used_chans; 214 : } __packed; 215 : 216 : /* Events */ 217 : 218 0 : struct bt_hci_evt_vs { 219 0 : uint8_t subevent; 220 : } __packed; 221 : 222 0 : #define BT_HCI_EVT_VS_FATAL_ERROR 0x02 223 : 224 0 : #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME 0x01 225 0 : #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_CTRL_ASSERT 0x02 226 0 : #define BT_HCI_EVT_VS_ERROR_DATA_TYPE_TRACE 0x03 227 0 : struct bt_hci_vs_fata_error_cpu_data_cortex_m { 228 0 : uint32_t a1; 229 0 : uint32_t a2; 230 0 : uint32_t a3; 231 0 : uint32_t a4; 232 0 : uint32_t ip; 233 0 : uint32_t lr; 234 0 : uint32_t xpsr; 235 : } __packed; 236 0 : #define BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M 0x01 237 0 : struct bt_hci_vs_fatal_error_stack_frame { 238 0 : uint32_t reason; 239 0 : uint8_t cpu_type; 240 0 : uint8_t cpu_data[0]; 241 : } __packed; 242 : 243 0 : struct bt_hci_evt_vs_fatal_error_trace_data { 244 0 : uint64_t pc; 245 0 : uint8_t err_info[0]; 246 : } __packed; 247 : 248 0 : struct bt_hci_evt_vs_fatal_error { 249 0 : uint8_t type; 250 0 : uint8_t data[0]; 251 : } __packed; 252 : 253 0 : #define BT_HCI_VS_TRACE_LMP_TX 0x01 254 0 : #define BT_HCI_VS_TRACE_LMP_RX 0x02 255 0 : #define BT_HCI_VS_TRACE_LLCP_TX 0x03 256 0 : #define BT_HCI_VS_TRACE_LLCP_RX 0x04 257 0 : #define BT_HCI_VS_TRACE_LE_CONN_IND 0x05 258 0 : #define BT_HCI_EVT_VS_TRACE_INFO 0x03 259 0 : struct bt_hci_evt_vs_trace_info { 260 0 : uint8_t type; 261 0 : uint8_t data[0]; 262 : } __packed; 263 : 264 0 : #define BT_HCI_EVT_VS_SCAN_REQ_RX 0x04 265 0 : struct bt_hci_evt_vs_scan_req_rx { 266 0 : bt_addr_le_t addr; 267 0 : int8_t rssi; 268 : } __packed; 269 : 270 0 : struct bt_hci_le_iq_sample16 { 271 0 : int16_t i; 272 0 : int16_t q; 273 : } __packed; 274 : 275 0 : #define BT_HCI_EVT_VS_LE_CONNECTIONLESS_IQ_REPORT 0x5 276 0 : #define BT_HCI_VS_LE_CTE_REPORT_NO_VALID_SAMPLE 0x8000 277 0 : struct bt_hci_evt_vs_le_connectionless_iq_report { 278 0 : uint16_t sync_handle; 279 0 : uint8_t chan_idx; 280 0 : int16_t rssi; 281 0 : uint8_t rssi_ant_id; 282 0 : uint8_t cte_type; 283 0 : uint8_t slot_durations; 284 0 : uint8_t packet_status; 285 0 : uint16_t per_evt_counter; 286 0 : uint8_t sample_count; 287 0 : struct bt_hci_le_iq_sample16 sample[0]; 288 : } __packed; 289 : 290 0 : #define BT_HCI_EVT_VS_LE_CONNECTION_IQ_REPORT 0x6 291 0 : struct bt_hci_evt_vs_le_connection_iq_report { 292 0 : uint16_t conn_handle; 293 0 : uint8_t rx_phy; 294 0 : uint8_t data_chan_idx; 295 0 : int16_t rssi; 296 0 : uint8_t rssi_ant_id; 297 0 : uint8_t cte_type; 298 0 : uint8_t slot_durations; 299 0 : uint8_t packet_status; 300 0 : uint16_t conn_evt_counter; 301 0 : uint8_t sample_count; 302 0 : struct bt_hci_le_iq_sample16 sample[0]; 303 : } __packed; 304 : 305 : /* Event mask bits */ 306 : 307 0 : #define BT_EVT_MASK_VS_FATAL_ERROR BT_EVT_BIT(1) 308 0 : #define BT_EVT_MASK_VS_TRACE_INFO BT_EVT_BIT(2) 309 0 : #define BT_EVT_MASK_VS_SCAN_REQ_RX BT_EVT_BIT(3) 310 0 : #define BT_EVT_MASK_VS_LE_CONNECTIONLESS_IQ_REPORT BT_EVT_BIT(4) 311 0 : #define BT_EVT_MASK_VS_LE_CONNECTION_IQ_REPORT BT_EVT_BIT(5) 312 : 313 0 : #define DEFAULT_VS_EVT_MASK \ 314 : BT_EVT_MASK_VS_FATAL_ERROR | BT_EVT_MASK_VS_TRACE_INFO | BT_EVT_MASK_VS_SCAN_REQ_RX | \ 315 : BT_EVT_MASK_VS_LE_CONNECTIONLESS_IQ_REPORT | \ 316 : BT_EVT_MASK_VS_LE_CONNECTION_IQ_REPORT 317 : 318 : /* Mesh HCI commands */ 319 0 : #define BT_HCI_MESH_REVISION 0x01 320 : 321 0 : #define BT_HCI_OP_VS_MESH BT_OP(BT_OGF_VS, 0x0042) 322 0 : #define BT_HCI_MESH_EVT_PREFIX 0xF0 323 : 324 0 : struct bt_hci_cp_mesh { 325 0 : uint8_t opcode; 326 : } __packed; 327 : 328 0 : #define BT_HCI_OC_MESH_GET_OPTS 0x00 329 0 : struct bt_hci_rp_mesh_get_opts { 330 0 : uint8_t status; 331 0 : uint8_t opcode; 332 0 : uint8_t revision; 333 0 : uint8_t ch_map; 334 0 : int8_t min_tx_power; 335 0 : int8_t max_tx_power; 336 0 : uint8_t max_scan_filter; 337 0 : uint8_t max_filter_pattern; 338 0 : uint8_t max_adv_slot; 339 0 : uint8_t max_tx_window; 340 0 : uint8_t evt_prefix_len; 341 0 : uint8_t evt_prefix; 342 : } __packed; 343 : 344 0 : #define BT_HCI_MESH_PATTERN_LEN_MAX 0x0f 345 : 346 0 : #define BT_HCI_OC_MESH_SET_SCAN_FILTER 0x01 347 0 : struct bt_hci_mesh_pattern { 348 0 : uint8_t pattern_len; 349 0 : uint8_t pattern[0]; 350 : } __packed; 351 : 352 0 : struct bt_hci_cp_mesh_set_scan_filter { 353 0 : uint8_t scan_filter; 354 0 : uint8_t filter_dup; 355 0 : uint8_t num_patterns; 356 0 : struct bt_hci_mesh_pattern patterns[0]; 357 : } __packed; 358 0 : struct bt_hci_rp_mesh_set_scan_filter { 359 0 : uint8_t status; 360 0 : uint8_t opcode; 361 0 : uint8_t scan_filter; 362 : } __packed; 363 : 364 0 : #define BT_HCI_OC_MESH_ADVERTISE 0x02 365 0 : struct bt_hci_cp_mesh_advertise { 366 0 : uint8_t adv_slot; 367 0 : uint8_t own_addr_type; 368 0 : bt_addr_t random_addr; 369 0 : uint8_t ch_map; 370 0 : int8_t tx_power; 371 0 : uint8_t min_tx_delay; 372 0 : uint8_t max_tx_delay; 373 0 : uint8_t retx_count; 374 0 : uint8_t retx_interval; 375 0 : uint8_t scan_delay; 376 0 : uint16_t scan_duration; 377 0 : uint8_t scan_filter; 378 0 : uint8_t data_len; 379 0 : uint8_t data[31]; 380 : } __packed; 381 0 : struct bt_hci_rp_mesh_advertise { 382 0 : uint8_t status; 383 0 : uint8_t opcode; 384 0 : uint8_t adv_slot; 385 : } __packed; 386 : 387 0 : #define BT_HCI_OC_MESH_ADVERTISE_TIMED 0x03 388 0 : struct bt_hci_cp_mesh_advertise_timed { 389 0 : uint8_t adv_slot; 390 0 : uint8_t own_addr_type; 391 0 : bt_addr_t random_addr; 392 0 : uint8_t ch_map; 393 0 : int8_t tx_power; 394 0 : uint8_t retx_count; 395 0 : uint8_t retx_interval; 396 0 : uint32_t instant; 397 0 : uint16_t tx_delay; 398 0 : uint16_t tx_window; 399 0 : uint8_t data_len; 400 0 : uint8_t data[31]; 401 : } __packed; 402 0 : struct bt_hci_rp_mesh_advertise_timed { 403 0 : uint8_t status; 404 0 : uint8_t opcode; 405 0 : uint8_t adv_slot; 406 : } __packed; 407 : 408 0 : #define BT_HCI_OC_MESH_ADVERTISE_CANCEL 0x04 409 0 : struct bt_hci_cp_mesh_advertise_cancel { 410 0 : uint8_t adv_slot; 411 : } __packed; 412 0 : struct bt_hci_rp_mesh_advertise_cancel { 413 0 : uint8_t status; 414 0 : uint8_t opcode; 415 0 : uint8_t adv_slot; 416 : } __packed; 417 : 418 0 : #define BT_HCI_OC_MESH_SET_SCANNING 0x05 419 0 : struct bt_hci_cp_mesh_set_scanning { 420 0 : uint8_t enable; 421 0 : uint8_t ch_map; 422 0 : uint8_t scan_filter; 423 : } __packed; 424 0 : struct bt_hci_rp_mesh_set_scanning { 425 0 : uint8_t status; 426 0 : uint8_t opcode; 427 : } __packed; 428 : 429 : /* Events */ 430 0 : struct bt_hci_evt_mesh { 431 0 : uint8_t prefix; 432 0 : uint8_t subevent; 433 : } __packed; 434 : 435 0 : #define BT_HCI_EVT_MESH_ADV_COMPLETE 0x00 436 0 : struct bt_hci_evt_mesh_adv_complete { 437 0 : uint8_t adv_slot; 438 : } __packed; 439 : 440 0 : #define BT_HCI_EVT_MESH_SCANNING_REPORT 0x01 441 0 : struct bt_hci_evt_mesh_scan_report { 442 0 : bt_addr_le_t addr; 443 0 : uint8_t chan; 444 0 : int8_t rssi; 445 0 : uint32_t instant; 446 0 : uint8_t data_len; 447 0 : uint8_t data[0]; 448 : } __packed; 449 0 : struct bt_hci_evt_mesh_scanning_report { 450 0 : uint8_t num_reports; 451 0 : struct bt_hci_evt_mesh_scan_report reports[0]; 452 : } __packed; 453 : 454 0 : struct net_buf *hci_vs_err_stack_frame(unsigned int reason, const struct arch_esf *esf); 455 0 : struct net_buf *hci_vs_err_trace(const char *file, uint32_t line, uint64_t pc); 456 0 : struct net_buf *hci_vs_err_assert(const char *file, uint32_t line); 457 : 458 : #ifdef __cplusplus 459 : } 460 : #endif 461 : 462 : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_HCI_VS_H_ */