hci_vs.h 10 KB

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