hcimsgs.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 1999-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. #ifndef HCIMSGS_H
  19. #define HCIMSGS_H
  20. #include "bt_target.h"
  21. #include "hcidefs.h"
  22. #include "bt_types.h"
  23. void bte_main_hci_send(BT_HDR *p_msg, UINT16 event);
  24. void bte_main_lpm_allow_bt_device_sleep(void);
  25. /* Message by message.... */
  26. BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration,
  27. UINT8 response_cnt);
  28. #define HCIC_PARAM_SIZE_INQUIRY 5
  29. #define HCIC_INQ_INQ_LAP_OFF 0
  30. #define HCIC_INQ_DUR_OFF 3
  31. #define HCIC_INQ_RSP_CNT_OFF 4
  32. /* Inquiry */
  33. /* Inquiry Cancel */
  34. BOOLEAN btsnd_hcic_inq_cancel(void);
  35. #define HCIC_PARAM_SIZE_INQ_CANCEL 0
  36. /* Periodic Inquiry Mode */
  37. BOOLEAN btsnd_hcic_per_inq_mode(UINT16 max_period, UINT16 min_period,
  38. const LAP inq_lap, UINT8 duration,
  39. UINT8 response_cnt);
  40. #define HCIC_PARAM_SIZE_PER_INQ_MODE 9
  41. #define HCI_PER_INQ_MAX_INTRVL_OFF 0
  42. #define HCI_PER_INQ_MIN_INTRVL_OFF 2
  43. #define HCI_PER_INQ_INQ_LAP_OFF 4
  44. #define HCI_PER_INQ_DURATION_OFF 7
  45. #define HCI_PER_INQ_RSP_CNT_OFF 8
  46. /* Periodic Inquiry Mode */
  47. /* Exit Periodic Inquiry Mode */
  48. BOOLEAN btsnd_hcic_exit_per_inq(void);
  49. #define HCIC_PARAM_SIZE_EXIT_PER_INQ 0
  50. /* Create Connection */
  51. BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types,
  52. UINT8 page_scan_rep_mode,
  53. UINT8 page_scan_mode,
  54. UINT16 clock_offset,
  55. UINT8 allow_switch);
  56. #define HCIC_PARAM_SIZE_CREATE_CONN 13
  57. #define HCIC_CR_CONN_BD_ADDR_OFF 0
  58. #define HCIC_CR_CONN_PKT_TYPES_OFF 6
  59. #define HCIC_CR_CONN_REP_MODE_OFF 8
  60. #define HCIC_CR_CONN_PAGE_SCAN_MODE_OFF 9
  61. #define HCIC_CR_CONN_CLK_OFF_OFF 10
  62. #define HCIC_CR_CONN_ALLOW_SWITCH_OFF 12
  63. /* Create Connection */
  64. /* Disconnect */
  65. BOOLEAN btsnd_hcic_disconnect(UINT16 handle, UINT8 reason);
  66. #define HCIC_PARAM_SIZE_DISCONNECT 3
  67. #define HCI_DISC_HANDLE_OFF 0
  68. #define HCI_DISC_REASON_OFF 2
  69. /* Disconnect */
  70. #if BTM_SCO_INCLUDED == TRUE
  71. /* Add SCO Connection */
  72. BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types);
  73. #endif /* BTM_SCO_INCLUDED */
  74. #define HCIC_PARAM_SIZE_ADD_SCO_CONN 4
  75. #define HCI_ADD_SCO_HANDLE_OFF 0
  76. #define HCI_ADD_SCO_PACKET_TYPES_OFF 2
  77. /* Add SCO Connection */
  78. /* Create Connection Cancel */
  79. BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest);
  80. #define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL 6
  81. #define HCIC_CR_CONN_CANCEL_BD_ADDR_OFF 0
  82. /* Create Connection Cancel */
  83. /* Accept Connection Request */
  84. BOOLEAN btsnd_hcic_accept_conn (BD_ADDR bd_addr, UINT8 role);
  85. #define HCIC_PARAM_SIZE_ACCEPT_CONN 7
  86. #define HCI_ACC_CONN_BD_ADDR_OFF 0
  87. #define HCI_ACC_CONN_ROLE_OFF 6
  88. /* Accept Connection Request */
  89. /* Reject Connection Request */
  90. BOOLEAN btsnd_hcic_reject_conn (BD_ADDR bd_addr, UINT8 reason);
  91. #define HCIC_PARAM_SIZE_REJECT_CONN 7
  92. #define HCI_REJ_CONN_BD_ADDR_OFF 0
  93. #define HCI_REJ_CONN_REASON_OFF 6
  94. /* Reject Connection Request */
  95. /* Link Key Request Reply */
  96. BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr,
  97. LINK_KEY link_key);
  98. #define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY 22
  99. #define HCI_LINK_KEY_REPLY_BD_ADDR_OFF 0
  100. #define HCI_LINK_KEY_REPLY_LINK_KEY_OFF 6
  101. /* Link Key Request Reply */
  102. /* Link Key Request Neg Reply */
  103. BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr);
  104. #define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY 6
  105. #define HCI_LINK_KEY_NEG_REP_BD_ADR_OFF 0
  106. /* Link Key Request Neg Reply */
  107. /* PIN Code Request Reply */
  108. BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr,
  109. UINT8 pin_code_len,
  110. PIN_CODE pin_code);
  111. #define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY 23
  112. #define HCI_PIN_CODE_REPLY_BD_ADDR_OFF 0
  113. #define HCI_PIN_CODE_REPLY_PIN_LEN_OFF 6
  114. #define HCI_PIN_CODE_REPLY_PIN_CODE_OFF 7
  115. /* PIN Code Request Reply */
  116. /* Link Key Request Neg Reply */
  117. BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr);
  118. #define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY 6
  119. #define HCI_PIN_CODE_NEG_REP_BD_ADR_OFF 0
  120. /* Link Key Request Neg Reply */
  121. /* Change Connection Type */
  122. BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types);
  123. #define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE 4
  124. #define HCI_CHNG_PKT_TYPE_HANDLE_OFF 0
  125. #define HCI_CHNG_PKT_TYPE_PKT_TYPE_OFF 2
  126. /* Change Connection Type */
  127. #define HCIC_PARAM_SIZE_CMD_HANDLE 2
  128. #define HCI_CMD_HANDLE_HANDLE_OFF 0
  129. BOOLEAN btsnd_hcic_auth_request (UINT16 handle); /* Authentication Request */
  130. /* Set Connection Encryption */
  131. BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable);
  132. #define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT 3
  133. #define HCI_SET_ENCRYPT_HANDLE_OFF 0
  134. #define HCI_SET_ENCRYPT_ENABLE_OFF 2
  135. /* Set Connection Encryption */
  136. /* Remote Name Request */
  137. BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr,
  138. UINT8 page_scan_rep_mode,
  139. UINT8 page_scan_mode,
  140. UINT16 clock_offset);
  141. #define HCIC_PARAM_SIZE_RMT_NAME_REQ 10
  142. #define HCI_RMT_NAME_BD_ADDR_OFF 0
  143. #define HCI_RMT_NAME_REP_MODE_OFF 6
  144. #define HCI_RMT_NAME_PAGE_SCAN_MODE_OFF 7
  145. #define HCI_RMT_NAME_CLK_OFF_OFF 8
  146. /* Remote Name Request */
  147. /* Remote Name Request Cancel */
  148. BOOLEAN btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr);
  149. #define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL 6
  150. #define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF 0
  151. /* Remote Name Request Cancel */
  152. BOOLEAN btsnd_hcic_rmt_features_req(UINT16 handle); /* Remote Features Request */
  153. /* Remote Extended Features */
  154. BOOLEAN btsnd_hcic_rmt_ext_features(UINT16 handle, UINT8 page_num);
  155. #define HCIC_PARAM_SIZE_RMT_EXT_FEATURES 3
  156. #define HCI_RMT_EXT_FEATURES_HANDLE_OFF 0
  157. #define HCI_RMT_EXT_FEATURES_PAGE_NUM_OFF 2
  158. /* Remote Extended Features */
  159. BOOLEAN btsnd_hcic_rmt_ver_req(UINT16 handle); /* Remote Version Info Request */
  160. BOOLEAN btsnd_hcic_read_rmt_clk_offset(UINT16 handle); /* Remote Clock Offset */
  161. BOOLEAN btsnd_hcic_read_lmp_handle(UINT16 handle); /* Remote LMP Handle */
  162. BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle,
  163. UINT32 tx_bw, UINT32 rx_bw,
  164. UINT16 max_latency, UINT16 voice,
  165. UINT8 retrans_effort,
  166. UINT16 packet_types);
  167. #define HCIC_PARAM_SIZE_SETUP_ESCO 17
  168. #define HCI_SETUP_ESCO_HANDLE_OFF 0
  169. #define HCI_SETUP_ESCO_TX_BW_OFF 2
  170. #define HCI_SETUP_ESCO_RX_BW_OFF 6
  171. #define HCI_SETUP_ESCO_MAX_LAT_OFF 10
  172. #define HCI_SETUP_ESCO_VOICE_OFF 12
  173. #define HCI_SETUP_ESCO_RETRAN_EFF_OFF 14
  174. #define HCI_SETUP_ESCO_PKT_TYPES_OFF 15
  175. BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr,
  176. UINT32 tx_bw, UINT32 rx_bw,
  177. UINT16 max_latency,
  178. UINT16 content_fmt,
  179. UINT8 retrans_effort,
  180. UINT16 packet_types);
  181. #define HCIC_PARAM_SIZE_ACCEPT_ESCO 21
  182. #define HCI_ACCEPT_ESCO_BDADDR_OFF 0
  183. #define HCI_ACCEPT_ESCO_TX_BW_OFF 6
  184. #define HCI_ACCEPT_ESCO_RX_BW_OFF 10
  185. #define HCI_ACCEPT_ESCO_MAX_LAT_OFF 14
  186. #define HCI_ACCEPT_ESCO_VOICE_OFF 16
  187. #define HCI_ACCEPT_ESCO_RETRAN_EFF_OFF 18
  188. #define HCI_ACCEPT_ESCO_PKT_TYPES_OFF 19
  189. BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason);
  190. #define HCIC_PARAM_SIZE_REJECT_ESCO 7
  191. #define HCI_REJECT_ESCO_BDADDR_OFF 0
  192. #define HCI_REJECT_ESCO_REASON_OFF 6
  193. /* Hold Mode */
  194. BOOLEAN btsnd_hcic_hold_mode(UINT16 handle, UINT16 max_hold_period,
  195. UINT16 min_hold_period);
  196. #define HCIC_PARAM_SIZE_HOLD_MODE 6
  197. #define HCI_HOLD_MODE_HANDLE_OFF 0
  198. #define HCI_HOLD_MODE_MAX_PER_OFF 2
  199. #define HCI_HOLD_MODE_MIN_PER_OFF 4
  200. /* Hold Mode */
  201. /* Sniff Mode */
  202. BOOLEAN btsnd_hcic_sniff_mode(UINT16 handle,
  203. UINT16 max_sniff_period,
  204. UINT16 min_sniff_period,
  205. UINT16 sniff_attempt,
  206. UINT16 sniff_timeout);
  207. #define HCIC_PARAM_SIZE_SNIFF_MODE 10
  208. #define HCI_SNIFF_MODE_HANDLE_OFF 0
  209. #define HCI_SNIFF_MODE_MAX_PER_OFF 2
  210. #define HCI_SNIFF_MODE_MIN_PER_OFF 4
  211. #define HCI_SNIFF_MODE_ATTEMPT_OFF 6
  212. #define HCI_SNIFF_MODE_TIMEOUT_OFF 8
  213. /* Sniff Mode */
  214. BOOLEAN btsnd_hcic_exit_sniff_mode(UINT16 handle); /* Exit Sniff Mode */
  215. /* Park Mode */
  216. BOOLEAN btsnd_hcic_park_mode (UINT16 handle,
  217. UINT16 beacon_max_interval,
  218. UINT16 beacon_min_interval);
  219. #define HCIC_PARAM_SIZE_PARK_MODE 6
  220. #define HCI_PARK_MODE_HANDLE_OFF 0
  221. #define HCI_PARK_MODE_MAX_PER_OFF 2
  222. #define HCI_PARK_MODE_MIN_PER_OFF 4
  223. /* Park Mode */
  224. BOOLEAN btsnd_hcic_exit_park_mode(UINT16 handle); /* Exit Park Mode */
  225. /* QoS Setup */
  226. BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags,
  227. UINT8 service_type,
  228. UINT32 token_rate, UINT32 peak,
  229. UINT32 latency, UINT32 delay_var);
  230. #define HCIC_PARAM_SIZE_QOS_SETUP 20
  231. #define HCI_QOS_HANDLE_OFF 0
  232. #define HCI_QOS_FLAGS_OFF 2
  233. #define HCI_QOS_SERVICE_TYPE_OFF 3
  234. #define HCI_QOS_TOKEN_RATE_OFF 4
  235. #define HCI_QOS_PEAK_BANDWIDTH_OFF 8
  236. #define HCI_QOS_LATENCY_OFF 12
  237. #define HCI_QOS_DELAY_VAR_OFF 16
  238. /* QoS Setup */
  239. /* Switch Role Request */
  240. BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role);
  241. #define HCIC_PARAM_SIZE_SWITCH_ROLE 7
  242. #define HCI_SWITCH_BD_ADDR_OFF 0
  243. #define HCI_SWITCH_ROLE_OFF 6
  244. /* Switch Role Request */
  245. /* Write Policy Settings */
  246. BOOLEAN btsnd_hcic_write_policy_set(UINT16 handle, UINT16 settings);
  247. #define HCIC_PARAM_SIZE_WRITE_POLICY_SET 4
  248. #define HCI_WRITE_POLICY_HANDLE_OFF 0
  249. #define HCI_WRITE_POLICY_SETTINGS_OFF 2
  250. /* Write Policy Settings */
  251. /* Write Default Policy Settings */
  252. BOOLEAN btsnd_hcic_write_def_policy_set(UINT16 settings);
  253. #define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET 2
  254. #define HCI_WRITE_DEF_POLICY_SETTINGS_OFF 0
  255. /* Write Default Policy Settings */
  256. /******************************************
  257. ** Lisbon Features
  258. *******************************************/
  259. #if BTM_SSR_INCLUDED == TRUE
  260. /* Sniff Subrating */
  261. BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat,
  262. UINT16 min_remote_lat,
  263. UINT16 min_local_lat);
  264. #define HCIC_PARAM_SIZE_SNIFF_SUB_RATE 8
  265. #define HCI_SNIFF_SUB_RATE_HANDLE_OFF 0
  266. #define HCI_SNIFF_SUB_RATE_MAX_LAT_OFF 2
  267. #define HCI_SNIFF_SUB_RATE_MIN_REM_LAT_OFF 4
  268. #define HCI_SNIFF_SUB_RATE_MIN_LOC_LAT_OFF 6
  269. /* Sniff Subrating */
  270. #else /* BTM_SSR_INCLUDED == FALSE */
  271. #define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) FALSE
  272. #endif /* BTM_SSR_INCLUDED */
  273. /* Extended Inquiry Response */
  274. void btsnd_hcic_write_ext_inquiry_response(void *buffer, UINT8 fec_req);
  275. #define HCIC_PARAM_SIZE_EXT_INQ_RESP 241
  276. #define HCIC_EXT_INQ_RESP_FEC_OFF 0
  277. #define HCIC_EXT_INQ_RESP_RESPONSE 1
  278. /* IO Capabilities Response */
  279. BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability,
  280. UINT8 oob_present, UINT8 auth_req);
  281. #define HCIC_PARAM_SIZE_IO_CAP_RESP 9
  282. #define HCI_IO_CAP_BD_ADDR_OFF 0
  283. #define HCI_IO_CAPABILITY_OFF 6
  284. #define HCI_IO_CAP_OOB_DATA_OFF 7
  285. #define HCI_IO_CAP_AUTH_REQ_OFF 8
  286. /* IO Capabilities Req Neg Reply */
  287. BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code);
  288. #define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7
  289. #define HCI_IO_CAP_NR_BD_ADDR_OFF 0
  290. #define HCI_IO_CAP_NR_ERR_CODE 6
  291. /* Read Local OOB Data */
  292. BOOLEAN btsnd_hcic_read_local_oob_data (void);
  293. #define HCIC_PARAM_SIZE_R_LOCAL_OOB 0
  294. BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes);
  295. #define HCIC_PARAM_SIZE_UCONF_REPLY 6
  296. #define HCI_USER_CONF_BD_ADDR_OFF 0
  297. BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value);
  298. #define HCIC_PARAM_SIZE_U_PKEY_REPLY 10
  299. #define HCI_USER_PASSKEY_BD_ADDR_OFF 0
  300. #define HCI_USER_PASSKEY_VALUE_OFF 6
  301. BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr);
  302. #define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6
  303. #define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0
  304. /* Remote OOB Data Request Reply */
  305. BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c,
  306. UINT8 *p_r);
  307. #define HCIC_PARAM_SIZE_REM_OOB_REPLY 38
  308. #define HCI_REM_OOB_DATA_BD_ADDR_OFF 0
  309. #define HCI_REM_OOB_DATA_C_OFF 6
  310. #define HCI_REM_OOB_DATA_R_OFF 22
  311. /* Remote OOB Data Request Negative Reply */
  312. BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr);
  313. #define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY 6
  314. #define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF 0
  315. /* Read Tx Power Level */
  316. BOOLEAN btsnd_hcic_read_inq_tx_power (void);
  317. #define HCIC_PARAM_SIZE_R_TX_POWER 0
  318. /* Read Default Erroneous Data Reporting */
  319. BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void);
  320. #define HCIC_PARAM_SIZE_R_ERR_DATA_RPT 0
  321. #if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
  322. BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type);
  323. #define HCIC_PARAM_SIZE_ENHANCED_FLUSH 3
  324. #endif
  325. BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif);
  326. #define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF 7
  327. #define HCI_SEND_KEYPRESS_NOTIF_BD_ADDR_OFF 0
  328. #define HCI_SEND_KEYPRESS_NOTIF_NOTIF_OFF 6
  329. /**** end of Simple Pairing Commands ****/
  330. /* Store Current Settings */
  331. #define MAX_FILT_COND (sizeof (BD_ADDR) + 1)
  332. BOOLEAN btsnd_hcic_set_event_filter(UINT8 filt_type,
  333. UINT8 filt_cond_type,
  334. UINT8 *filt_cond,
  335. UINT8 filt_cond_len);
  336. #define HCIC_PARAM_SIZE_SET_EVT_FILTER 9
  337. #define HCI_FILT_COND_FILT_TYPE_OFF 0
  338. #define HCI_FILT_COND_COND_TYPE_OFF 1
  339. #define HCI_FILT_COND_FILT_OFF 2
  340. /* Set Event Filter */
  341. /* Delete Stored Key */
  342. BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag);
  343. #define HCIC_PARAM_SIZE_DELETE_STORED_KEY 7
  344. #define HCI_DELETE_KEY_BD_ADDR_OFF 0
  345. #define HCI_DELETE_KEY_ALL_FLAG_OFF 6
  346. /* Delete Stored Key */
  347. /* Change Local Name */
  348. BOOLEAN btsnd_hcic_change_name(BD_NAME name);
  349. #define HCIC_PARAM_SIZE_CHANGE_NAME BD_NAME_LEN
  350. #define HCI_CHANGE_NAME_NAME_OFF 0
  351. /* Change Local Name */
  352. #define HCIC_PARAM_SIZE_READ_CMD 0
  353. #define HCIC_PARAM_SIZE_WRITE_PARAM1 1
  354. #define HCIC_WRITE_PARAM1_PARAM_OFF 0
  355. #define HCIC_PARAM_SIZE_WRITE_PARAM2 2
  356. #define HCIC_WRITE_PARAM2_PARAM_OFF 0
  357. #define HCIC_PARAM_SIZE_WRITE_PARAM3 3
  358. #define HCIC_WRITE_PARAM3_PARAM_OFF 0
  359. #define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10
  360. BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */
  361. BOOLEAN btsnd_hcic_write_auto_accept(UINT8 flag); /* Write Auto Accept */
  362. BOOLEAN btsnd_hcic_read_name (void); /* Read Local Name */
  363. BOOLEAN btsnd_hcic_write_page_tout(UINT16 timeout); /* Write Page Timout */
  364. BOOLEAN btsnd_hcic_write_scan_enable(UINT8 flag); /* Write Scan Enable */
  365. BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval,
  366. UINT16 window); /* Write Page Scan Activity */
  367. #define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG 4
  368. #define HCI_SCAN_CFG_INTERVAL_OFF 0
  369. #define HCI_SCAN_CFG_WINDOW_OFF 2
  370. /* Write Page Scan Activity */
  371. /* Write Inquiry Scan Activity */
  372. BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window);
  373. #define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG 4
  374. #define HCI_SCAN_CFG_INTERVAL_OFF 0
  375. #define HCI_SCAN_CFG_WINDOW_OFF 2
  376. /* Write Inquiry Scan Activity */
  377. BOOLEAN btsnd_hcic_write_auth_enable(UINT8 flag); /* Write Authentication Enable */
  378. BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev); /* Write Class of Device */
  379. BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags); /* Write Voice Settings */
  380. /* Host Controller to Host flow control */
  381. #define HCI_HOST_FLOW_CTRL_OFF 0
  382. #define HCI_HOST_FLOW_CTRL_ACL_ON 1
  383. #define HCI_HOST_FLOW_CTRL_SCO_ON 2
  384. #define HCI_HOST_FLOW_CTRL_BOTH_ON 3
  385. BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
  386. UINT16 timeout); /* Write Retransmit Timout */
  387. #define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4
  388. #define HCI_FLUSH_TOUT_HANDLE_OFF 0
  389. #define HCI_FLUSH_TOUT_TOUT_OFF 2
  390. BOOLEAN btsnd_hcic_read_tx_power(UINT16 handle, UINT8 type); /* Read Tx Power */
  391. #define HCIC_PARAM_SIZE_READ_TX_POWER 3
  392. #define HCI_READ_TX_POWER_HANDLE_OFF 0
  393. #define HCI_READ_TX_POWER_TYPE_OFF 2
  394. /* Read transmit power level parameter */
  395. #define HCI_READ_CURRENT 0x00
  396. #define HCI_READ_MAXIMUM 0x01
  397. BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles,
  398. UINT16 *handle,
  399. UINT16 *num_pkts); /* Set Host Buffer Size */
  400. #define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE sizeof(btmsg_hcic_num_pkts_done_t)
  401. #define MAX_DATA_HANDLES 10
  402. #define HCI_PKTS_DONE_NUM_HANDLES_OFF 0
  403. #define HCI_PKTS_DONE_HANDLE_OFF 1
  404. #define HCI_PKTS_DONE_NUM_PKTS_OFF 3
  405. /* Write Link Supervision Timeout */
  406. BOOLEAN btsnd_hcic_write_link_super_tout(UINT8 local_controller_id, UINT16 handle, UINT16 timeout);
  407. #define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT 4
  408. #define HCI_LINK_SUPER_TOUT_HANDLE_OFF 0
  409. #define HCI_LINK_SUPER_TOUT_TOUT_OFF 2
  410. /* Write Link Supervision Timeout */
  411. BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac,
  412. LAP *const iac_lap); /* Write Current IAC LAP */
  413. #define MAX_IAC_LAPS 0x40
  414. #define HCI_WRITE_IAC_LAP_NUM_OFF 0
  415. #define HCI_WRITE_IAC_LAP_LAP_OFF 1
  416. /* Write Current IAC LAP */
  417. BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle); /* Get Link Quality */
  418. BOOLEAN btsnd_hcic_read_rssi (UINT16 handle); /* Read RSSI */
  419. BOOLEAN btsnd_hcic_enable_test_mode (void); /* Enable Device Under Test Mode */
  420. BOOLEAN btsnd_hcic_write_pagescan_type(UINT8 type); /* Write Page Scan Type */
  421. BOOLEAN btsnd_hcic_write_inqscan_type(UINT8 type); /* Write Inquiry Scan Type */
  422. BOOLEAN btsnd_hcic_write_inquiry_mode(UINT8 type); /* Write Inquiry Mode */
  423. #define HCI_DATA_HANDLE_MASK 0x0FFF
  424. #define HCID_GET_HANDLE_EVENT(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset) + \
  425. (*((UINT8 *)((p) + 1) + p->offset + 1) << 8)))
  426. #define HCID_GET_HANDLE(u16) (UINT16)((u16) & HCI_DATA_HANDLE_MASK)
  427. #define HCI_DATA_EVENT_MASK 3
  428. #define HCI_DATA_EVENT_OFFSET 12
  429. #define HCID_GET_EVENT(u16) (UINT8)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
  430. #define HCI_DATA_BCAST_MASK 3
  431. #define HCI_DATA_BCAST_OFFSET 10
  432. #define HCID_GET_BCAST(u16) (UINT8)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
  433. #define HCID_GET_ACL_LEN(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset + 2) + \
  434. (*((UINT8 *)((p) + 1) + p->offset + 3) << 8)))
  435. #define HCID_HEADER_SIZE 4
  436. #define HCID_GET_SCO_LEN(p) (*((UINT8 *)((p) + 1) + p->offset + 2))
  437. void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode,
  438. UINT8 len, UINT8 *p_data,
  439. void *p_cmd_cplt_cback);
  440. #if (BLE_INCLUDED == TRUE)
  441. /********************************************************************************
  442. ** BLE Commands
  443. ** Note: "local_controller_id" is for transport, not counted in HCI message size
  444. *********************************************************************************/
  445. #define HCIC_BLE_RAND_DI_SIZE 8
  446. #define HCIC_BLE_ENCRYT_KEY_SIZE 16
  447. #define HCIC_BLE_IRK_SIZE 16
  448. #define HCIC_PARAM_SIZE_SET_USED_FEAT_CMD 8
  449. #define HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD 6
  450. #define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS 15
  451. #define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP 31
  452. #define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE 1
  453. #define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM 7
  454. #define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE 2
  455. #define HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN 25
  456. #define HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL 0
  457. #define HCIC_PARAM_SIZE_CLEAR_WHITE_LIST 0
  458. #define HCIC_PARAM_SIZE_ADD_WHITE_LIST 7
  459. #define HCIC_PARAM_SIZE_REMOVE_WHITE_LIST 7
  460. #define HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS 14
  461. #define HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS 5
  462. #define HCIC_PARAM_SIZE_READ_CHNL_MAP 2
  463. #define HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT 2
  464. #define HCIC_PARAM_SIZE_BLE_ENCRYPT 32
  465. #define HCIC_PARAM_SIZE_BLE_RAND 0
  466. #define HCIC_PARAM_SIZE_WRITE_LE_HOST_SUPPORTED 2
  467. #define HCIC_BLE_RAND_DI_SIZE 8
  468. #define HCIC_BLE_ENCRYT_KEY_SIZE 16
  469. #define HCIC_PARAM_SIZE_BLE_START_ENC (4 + HCIC_BLE_RAND_DI_SIZE + HCIC_BLE_ENCRYT_KEY_SIZE)
  470. #define HCIC_PARAM_SIZE_LTK_REQ_REPLY (2 + HCIC_BLE_ENCRYT_KEY_SIZE)
  471. #define HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY 2
  472. #define HCIC_BLE_CHNL_MAP_SIZE 5
  473. #define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA 31
  474. #define HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST (7 + HCIC_BLE_IRK_SIZE * 2)
  475. #define HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST 7
  476. #define HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST 0
  477. #define HCIC_PARAM_SIZE_BLE_READ_RESOLVING_LIST_SIZE 0
  478. #define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER 7
  479. #define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_LOCAL 7
  480. #define HCIC_PARAM_SIZE_BLE_SET_ADDR_RESOLUTION_ENABLE 1
  481. #define HCIC_PARAM_SIZE_BLE_SET_RAND_PRIV_ADDR_TIMOUT 2
  482. #define HCIC_PARAM_SIZE_BLE_SET_DATA_LENGTH 6
  483. #define HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM 11
  484. /* ULP HCI command */
  485. BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
  486. BOOLEAN btsnd_hcic_ble_read_buffer_size (void);
  487. BOOLEAN btsnd_hcic_ble_read_local_spt_feat (void);
  488. BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8]);
  489. BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
  490. BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
  491. UINT8 adv_type, UINT8 addr_type_own,
  492. UINT8 addr_type_dir, BD_ADDR direct_bda,
  493. UINT8 channel_map, UINT8 adv_filter_policy);
  494. BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void);
  495. BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data);
  496. BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp);
  497. BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable);
  498. BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
  499. UINT16 scan_int, UINT16 scan_win,
  500. UINT8 addr_type, UINT8 scan_filter_policy);
  501. BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate);
  502. BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win,
  503. UINT8 init_filter_policy, UINT8 addr_type_peer, BD_ADDR bda_peer, UINT8 addr_type_own,
  504. UINT16 conn_int_min, UINT16 conn_int_max, UINT16 conn_latency, UINT16 conn_timeout,
  505. UINT16 min_ce_len, UINT16 max_ce_len);
  506. BOOLEAN btsnd_hcic_ble_create_conn_cancel (void);
  507. BOOLEAN btsnd_hcic_ble_read_white_list_size (void);
  508. BOOLEAN btsnd_hcic_ble_clear_white_list (void);
  509. BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda);
  510. BOOLEAN btsnd_hcic_ble_remove_from_white_list (UINT8 addr_type, BD_ADDR bda);
  511. BOOLEAN btsnd_hcic_ble_upd_ll_conn_params (UINT16 handle, UINT16 conn_int_min, UINT16 conn_int_max,
  512. UINT16 conn_latency, UINT16 conn_timeout, UINT16 min_len, UINT16 max_len);
  513. BOOLEAN btsnd_hcic_ble_set_host_chnl_class (UINT8 chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
  514. BOOLEAN btsnd_hcic_ble_read_chnl_map (UINT16 handle);
  515. BOOLEAN btsnd_hcic_ble_read_remote_feat ( UINT16 handle);
  516. BOOLEAN btsnd_hcic_ble_encrypt (UINT8 *key, UINT8 key_len, UINT8 *plain_text, UINT8 pt_len, void *p_cmd_cplt_cback);
  517. BOOLEAN btsnd_hcic_ble_rand (void *p_cmd_cplt_cback);
  518. BOOLEAN btsnd_hcic_ble_start_enc ( UINT16 handle,
  519. UINT8 rand[HCIC_BLE_RAND_DI_SIZE],
  520. UINT16 ediv, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
  521. BOOLEAN btsnd_hcic_ble_ltk_req_reply (UINT16 handle, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
  522. BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle);
  523. BOOLEAN btsnd_hcic_ble_read_supported_states (void);
  524. BOOLEAN btsnd_hcic_ble_write_host_supported (UINT8 le_host_spt, UINT8 simul_le_host_spt);
  525. BOOLEAN btsnd_hcic_ble_read_host_supported (void);
  526. BOOLEAN btsnd_hcic_ble_receiver_test(UINT8 rx_freq);
  527. BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len,
  528. UINT8 payload);
  529. BOOLEAN btsnd_hcic_ble_test_end(void);
  530. #if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
  531. #define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY 14
  532. BOOLEAN btsnd_hcic_ble_rc_param_req_reply(UINT16 handle,
  533. UINT16 conn_int_min, UINT16 conn_int_max,
  534. UINT16 conn_latency, UINT16 conn_timeout,
  535. UINT16 min_ce_len, UINT16 max_ce_len);
  536. #define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY 3
  537. BOOLEAN btsnd_hcic_ble_rc_param_req_neg_reply(UINT16 handle, UINT8 reason);
  538. #endif /* BLE_LLT_INCLUDED */
  539. BOOLEAN btsnd_hcic_ble_set_data_length(UINT16 conn_handle, UINT16 tx_octets,
  540. UINT16 tx_time);
  541. BOOLEAN btsnd_hcic_ble_add_device_resolving_list (UINT8 addr_type_peer,
  542. BD_ADDR bda_peer,
  543. UINT8 irk_peer[HCIC_BLE_IRK_SIZE],
  544. UINT8 irk_local[HCIC_BLE_IRK_SIZE]);
  545. BOOLEAN btsnd_hcic_ble_rm_device_resolving_list (UINT8 addr_type_peer,
  546. BD_ADDR bda_peer);
  547. BOOLEAN btsnd_hcic_ble_clear_resolving_list (void);
  548. BOOLEAN btsnd_hcic_ble_read_resolvable_addr_peer (UINT8 addr_type_peer,
  549. BD_ADDR bda_peer);
  550. BOOLEAN btsnd_hcic_ble_read_resolvable_addr_local (UINT8 addr_type_peer,
  551. BD_ADDR bda_peer);
  552. BOOLEAN btsnd_hcic_ble_set_addr_resolution_enable (UINT8 addr_resolution_enable);
  553. BOOLEAN btsnd_hcic_ble_set_rand_priv_addr_timeout (UINT16 rpa_timout);
  554. #endif /* BLE_INCLUDED */
  555. BOOLEAN btsnd_hcic_read_authenticated_payload_tout(UINT16 handle);
  556. BOOLEAN btsnd_hcic_write_authenticated_payload_tout(UINT16 handle,
  557. UINT16 timeout);
  558. #define HCIC_PARAM_SIZE_WRITE_AUTHENT_PAYLOAD_TOUT 4
  559. #define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_HANDLE_OFF 0
  560. #define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_TOUT_OFF 2
  561. #endif