1 /* 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 <bluetooth/hci.h> 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 #define BT_VS_CMD_BIT_VERSION 0 19 #define BT_VS_CMD_BIT_SUP_CMD 1 20 #define BT_VS_CMD_BIT_SUP_FEAT 2 21 #define BT_VS_CMD_BIT_SET_EVT_MASK 3 22 #define BT_VS_CMD_BIT_RESET 4 23 #define BT_VS_CMD_BIT_WRITE_BDADDR 5 24 #define BT_VS_CMD_BIT_SET_TRACE_ENABLE 6 25 #define BT_VS_CMD_BIT_READ_BUILD_INFO 7 26 #define BT_VS_CMD_BIT_READ_STATIC_ADDRS 8 27 #define BT_VS_CMD_BIT_READ_KEY_ROOTS 9 28 #define BT_VS_CMD_BIT_READ_CHIP_TEMP 10 29 #define BT_VS_CMD_BIT_READ_HOST_STACK_CMD 11 30 #define BT_VS_CMD_BIT_SET_SCAN_REP_ENABLE 12 31 #define BT_VS_CMD_BIT_WRITE_TX_POWER 13 32 #define BT_VS_CMD_BIT_READ_TX_POWER 14 33 34 #define BT_VS_CMD_SUP_FEAT(cmd) BT_LE_FEAT_TEST(cmd, \ 35 BT_VS_CMD_BIT_SUP_FEAT) 36 #define BT_VS_CMD_READ_STATIC_ADDRS(cmd) BT_LE_FEAT_TEST(cmd, \ 37 BT_VS_CMD_BIT_READ_STATIC_ADDRS) 38 #define BT_VS_CMD_READ_KEY_ROOTS(cmd) BT_LE_FEAT_TEST(cmd, \ 39 BT_VS_CMD_BIT_READ_KEY_ROOTS) 40 41 #define BT_HCI_VS_HW_PLAT_INTEL 0x0001 42 #define BT_HCI_VS_HW_PLAT_NORDIC 0x0002 43 #define BT_HCI_VS_HW_PLAT_NXP 0x0003 44 45 #define BT_HCI_VS_HW_VAR_NORDIC_NRF51X 0x0001 46 #define BT_HCI_VS_HW_VAR_NORDIC_NRF52X 0x0002 47 #define BT_HCI_VS_HW_VAR_NORDIC_NRF53X 0x0003 48 49 #define BT_HCI_VS_FW_VAR_STANDARD_CTLR 0x0001 50 #define BT_HCI_VS_FW_VAR_VS_CTLR 0x0002 51 #define BT_HCI_VS_FW_VAR_FW_LOADER 0x0003 52 #define BT_HCI_VS_FW_VAR_RESCUE_IMG 0x0004 53 #define BT_HCI_OP_VS_READ_VERSION_INFO BT_OP(BT_OGF_VS, 0x0001) 54 struct bt_hci_rp_vs_read_version_info { 55 u8_t status; 56 u16_t hw_platform; 57 u16_t hw_variant; 58 u8_t fw_variant; 59 u8_t fw_version; 60 u16_t fw_revision; 61 bt_u32_t fw_build; 62 } __packed; 63 64 #define BT_HCI_OP_VS_READ_SUPPORTED_COMMANDS BT_OP(BT_OGF_VS, 0x0002) 65 struct bt_hci_rp_vs_read_supported_commands { 66 u8_t status; 67 u8_t commands[64]; 68 } __packed; 69 70 #define BT_HCI_OP_VS_READ_SUPPORTED_FEATURES BT_OP(BT_OGF_VS, 0x0003) 71 struct bt_hci_rp_vs_read_supported_features { 72 u8_t status; 73 u8_t features[8]; 74 } __packed; 75 76 #define BT_HCI_OP_VS_SET_EVENT_MASK BT_OP(BT_OGF_VS, 0x0004) 77 struct bt_hci_cp_vs_set_event_mask { 78 u8_t event_mask[8]; 79 } __packed; 80 81 #define BT_HCI_VS_RESET_SOFT 0x00 82 #define BT_HCI_VS_RESET_HARD 0x01 83 #define BT_HCI_OP_VS_RESET BT_OP(BT_OGF_VS, 0x0005) 84 struct bt_hci_cp_vs_reset { 85 u8_t type; 86 } __packed; 87 88 #define BT_HCI_OP_VS_WRITE_BD_ADDR BT_OP(BT_OGF_VS, 0x0006) 89 struct bt_hci_cp_vs_write_bd_addr { 90 bt_addr_t bdaddr; 91 } __packed; 92 93 #define BT_HCI_VS_TRACE_DISABLED 0x00 94 #define BT_HCI_VS_TRACE_ENABLED 0x01 95 96 #define BT_HCI_VS_TRACE_HCI_EVTS 0x00 97 #define BT_HCI_VS_TRACE_VDC 0x01 98 #define BT_HCI_OP_VS_SET_TRACE_ENABLE BT_OP(BT_OGF_VS, 0x0007) 99 struct bt_hci_cp_vs_set_trace_enable { 100 u8_t enable; 101 u8_t type; 102 } __packed; 103 104 #define BT_HCI_OP_VS_READ_BUILD_INFO BT_OP(BT_OGF_VS, 0x0008) 105 struct bt_hci_rp_vs_read_build_info { 106 u8_t status; 107 u8_t info[0]; 108 } __packed; 109 110 struct bt_hci_vs_static_addr { 111 bt_addr_t bdaddr; 112 u8_t ir[16]; 113 } __packed; 114 115 #define BT_HCI_OP_VS_READ_STATIC_ADDRS BT_OP(BT_OGF_VS, 0x0009) 116 struct bt_hci_rp_vs_read_static_addrs { 117 u8_t status; 118 u8_t num_addrs; 119 struct bt_hci_vs_static_addr a[0]; 120 } __packed; 121 122 #define BT_HCI_OP_VS_READ_KEY_HIERARCHY_ROOTS BT_OP(BT_OGF_VS, 0x000a) 123 struct bt_hci_rp_vs_read_key_hierarchy_roots { 124 u8_t status; 125 u8_t ir[16]; 126 u8_t er[16]; 127 } __packed; 128 129 #define BT_HCI_OP_VS_READ_CHIP_TEMP BT_OP(BT_OGF_VS, 0x000b) 130 struct bt_hci_rp_vs_read_chip_temp { 131 u8_t status; 132 s8_t temps; 133 } __packed; 134 135 struct bt_hci_vs_cmd { 136 u16_t vendor_id; 137 u16_t opcode_base; 138 } __packed; 139 140 #define BT_HCI_VS_VID_ANDROID 0x0001 141 #define BT_HCI_VS_VID_MICROSOFT 0x0002 142 #define BT_HCI_OP_VS_READ_HOST_STACK_CMDS BT_OP(BT_OGF_VS, 0x000c) 143 struct bt_hci_rp_vs_read_host_stack_cmds { 144 u8_t status; 145 u8_t num_cmds; 146 struct bt_hci_vs_cmd c[0]; 147 } __packed; 148 149 #define BT_HCI_VS_SCAN_REQ_REPORTS_DISABLED 0x00 150 #define BT_HCI_VS_SCAN_REQ_REPORTS_ENABLED 0x01 151 #define BT_HCI_OP_VS_SET_SCAN_REQ_REPORTS BT_OP(BT_OGF_VS, 0x000d) 152 struct bt_hci_cp_vs_set_scan_req_reports { 153 u8_t enable; 154 } __packed; 155 156 #define BT_HCI_VS_LL_HANDLE_TYPE_ADV 0x00 157 #define BT_HCI_VS_LL_HANDLE_TYPE_SCAN 0x01 158 #define BT_HCI_VS_LL_HANDLE_TYPE_CONN 0x02 159 #define BT_HCI_VS_LL_TX_POWER_LEVEL_NO_PREF 0x7F 160 #define BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL BT_OP(BT_OGF_VS, 0x000e) 161 struct bt_hci_cp_vs_write_tx_power_level { 162 u8_t handle_type; 163 u16_t handle; 164 s8_t tx_power_level; 165 } __packed; 166 167 struct bt_hci_rp_vs_write_tx_power_level { 168 u8_t status; 169 u8_t handle_type; 170 u16_t handle; 171 s8_t selected_tx_power; 172 } __packed; 173 174 #define BT_HCI_OP_VS_READ_TX_POWER_LEVEL BT_OP(BT_OGF_VS, 0x000f) 175 struct bt_hci_cp_vs_read_tx_power_level { 176 u8_t handle_type; 177 u16_t handle; 178 } __packed; 179 180 struct bt_hci_rp_vs_read_tx_power_level { 181 u8_t status; 182 u8_t handle_type; 183 u16_t handle; 184 s8_t tx_power_level; 185 } __packed; 186 187 #define BT_HCI_OP_VS_READ_USB_TRANSPORT_MODE BT_OP(BT_OGF_VS, 0x0010) 188 189 struct bt_hci_rp_vs_read_usb_transport_mode { 190 u8_t status; 191 u8_t num_supported_modes; 192 u8_t supported_mode[0]; 193 } __packed; 194 195 #define BT_HCI_VS_USB_H2_MODE 0x00 196 #define BT_HCI_VS_USB_H4_MODE 0x01 197 198 #define BT_HCI_OP_VS_SET_USB_TRANSPORT_MODE BT_OP(BT_OGF_VS, 0x0011) 199 200 struct bt_hci_cp_vs_set_usb_transport_mode { 201 u8_t mode; 202 } __packed; 203 204 /* Events */ 205 206 struct bt_hci_evt_vs { 207 u8_t subevent; 208 } __packed; 209 210 #define BT_HCI_EVT_VS_FATAL_ERROR 0x02 211 struct bt_hci_evt_vs_fatal_error { 212 u64_t pc; 213 u8_t err_info[0]; 214 } __packed; 215 216 #define BT_HCI_VS_TRACE_LMP_TX 0x01 217 #define BT_HCI_VS_TRACE_LMP_RX 0x02 218 #define BT_HCI_VS_TRACE_LLCP_TX 0x03 219 #define BT_HCI_VS_TRACE_LLCP_RX 0x04 220 #define BT_HCI_VS_TRACE_LE_CONN_IND 0x05 221 #define BT_HCI_EVT_VS_TRACE_INFO 0x03 222 struct bt_hci_evt_vs_trace_info { 223 u8_t type; 224 u8_t data[0]; 225 } __packed; 226 227 #define BT_HCI_EVT_VS_SCAN_REQ_RX 0x04 228 struct bt_hci_evt_vs_scan_req_rx { 229 bt_addr_le_t addr; 230 s8_t rssi; 231 } __packed; 232 233 /* Event mask bits */ 234 235 #define BT_EVT_MASK_VS_FATAL_ERROR BT_EVT_BIT(1) 236 #define BT_EVT_MASK_VS_TRACE_INFO BT_EVT_BIT(2) 237 #define BT_EVT_MASK_VS_SCAN_REQ_RX BT_EVT_BIT(3) 238 239 /* Mesh HCI commands */ 240 #define BT_HCI_MESH_REVISION 0x01 241 242 #define BT_HCI_OP_VS_MESH BT_OP(BT_OGF_VS, 0x0042) 243 #define BT_HCI_MESH_EVT_PREFIX 0xF0 244 245 struct bt_hci_cp_mesh { 246 u8_t opcode; 247 } __packed; 248 249 #define BT_HCI_OC_MESH_GET_OPTS 0x00 250 struct bt_hci_rp_mesh_get_opts { 251 u8_t status; 252 u8_t opcode; 253 u8_t revision; 254 u8_t ch_map; 255 s8_t min_tx_power; 256 s8_t max_tx_power; 257 u8_t max_scan_filter; 258 u8_t max_filter_pattern; 259 u8_t max_adv_slot; 260 u8_t max_tx_window; 261 u8_t evt_prefix_len; 262 u8_t evt_prefix; 263 } __packed; 264 265 #define BT_HCI_MESH_PATTERN_LEN_MAX 0x0f 266 267 #define BT_HCI_OC_MESH_SET_SCAN_FILTER 0x01 268 struct bt_hci_mesh_pattern { 269 u8_t pattern_len; 270 u8_t pattern[0]; 271 } __packed; 272 273 struct bt_hci_cp_mesh_set_scan_filter { 274 u8_t scan_filter; 275 u8_t filter_dup; 276 u8_t num_patterns; 277 struct bt_hci_mesh_pattern patterns[0]; 278 } __packed; 279 struct bt_hci_rp_mesh_set_scan_filter { 280 u8_t status; 281 u8_t opcode; 282 u8_t scan_filter; 283 } __packed; 284 285 #define BT_HCI_OC_MESH_ADVERTISE 0x02 286 struct bt_hci_cp_mesh_advertise { 287 u8_t adv_slot; 288 u8_t own_addr_type; 289 bt_addr_t random_addr; 290 u8_t ch_map; 291 s8_t tx_power; 292 u8_t min_tx_delay; 293 u8_t max_tx_delay; 294 u8_t retx_count; 295 u8_t retx_interval; 296 u8_t scan_delay; 297 u16_t scan_duration; 298 u8_t scan_filter; 299 u8_t data_len; 300 u8_t data[31]; 301 } __packed; 302 struct bt_hci_rp_mesh_advertise { 303 u8_t status; 304 u8_t opcode; 305 u8_t adv_slot; 306 } __packed; 307 308 #define BT_HCI_OC_MESH_ADVERTISE_TIMED 0x03 309 struct bt_hci_cp_mesh_advertise_timed { 310 u8_t adv_slot; 311 u8_t own_addr_type; 312 bt_addr_t random_addr; 313 u8_t ch_map; 314 s8_t tx_power; 315 u8_t retx_count; 316 u8_t retx_interval; 317 bt_u32_t instant; 318 u16_t tx_delay; 319 u16_t tx_window; 320 u8_t data_len; 321 u8_t data[31]; 322 } __packed; 323 struct bt_hci_rp_mesh_advertise_timed { 324 u8_t status; 325 u8_t opcode; 326 u8_t adv_slot; 327 } __packed; 328 329 #define BT_HCI_OC_MESH_ADVERTISE_CANCEL 0x04 330 struct bt_hci_cp_mesh_advertise_cancel { 331 u8_t adv_slot; 332 } __packed; 333 struct bt_hci_rp_mesh_advertise_cancel { 334 u8_t status; 335 u8_t opcode; 336 u8_t adv_slot; 337 } __packed; 338 339 #define BT_HCI_OC_MESH_SET_SCANNING 0x05 340 struct bt_hci_cp_mesh_set_scanning { 341 u8_t enable; 342 u8_t ch_map; 343 u8_t scan_filter; 344 } __packed; 345 struct bt_hci_rp_mesh_set_scanning { 346 u8_t status; 347 u8_t opcode; 348 } __packed; 349 350 /* Events */ 351 struct bt_hci_evt_mesh { 352 u8_t prefix; 353 u8_t subevent; 354 } __packed; 355 356 #define BT_HCI_EVT_MESH_ADV_COMPLETE 0x00 357 struct bt_hci_evt_mesh_adv_complete { 358 u8_t adv_slot; 359 } __packed; 360 361 #define BT_HCI_EVT_MESH_SCANNING_REPORT 0x01 362 struct bt_hci_evt_mesh_scan_report { 363 bt_addr_le_t addr; 364 u8_t chan; 365 s8_t rssi; 366 bt_u32_t instant; 367 u8_t data_len; 368 u8_t data[0]; 369 } __packed; 370 struct bt_hci_evt_mesh_scanning_report { 371 u8_t num_reports; 372 struct bt_hci_evt_mesh_scan_report reports[0]; 373 } __packed; 374 375 #ifdef __cplusplus 376 } 377 #endif 378 379 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_HCI_VS_H_ */ 380