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
19 #ifndef HCIMSGS_H
20 #define HCIMSGS_H
21
22 #include <stddef.h>
23 #include "common/bt_target.h"
24 #include "stack/hcidefs.h"
25 #include "stack/bt_types.h"
26 #include "osi/pkt_queue.h"
27 #include "osi/allocator.h"
28
29 #define HCI_CMD_BUF_TYPE_METADATA (0xa56e)
30
31 #define HCI_CMD_MSG_F_SRC_NOACK (0x01)
32
33 typedef void (*hci_cmd_cmpl_cb)(BT_HDR *response, void *context);
34 typedef void (*hci_cmd_stat_cb)(uint8_t status, BT_HDR *command, void *context);
35 typedef void (*hci_cmd_free_cb)(pkt_linked_item_t *linked_pkt);
36
37 typedef struct {
38 uint8_t flags_src;
39 uint8_t flags_vnd; // used for downstream layer
40 uint16_t opcode;
41 hci_cmd_cmpl_cb command_complete_cb;
42 hci_cmd_stat_cb command_status_cb;
43 void *context;
44 void *complete_future;
45 hci_cmd_free_cb command_free_cb;
46 BT_HDR command;
47 } hci_cmd_metadata_t;
48
49 #define HCI_CMD_METADATA_HDR_SIZE (sizeof(hci_cmd_metadata_t))
50
51 #define HCI_CMD_LINKED_BUF_SIZE(paramlen) (BT_PKT_LINKED_HDR_SIZE + HCI_CMD_METADATA_HDR_SIZE + HCIC_PREAMBLE_SIZE + (paramlen))
52
53 #define HCI_GET_CMD_METAMSG(cmd_ptr) (hci_cmd_metadata_t *)((void *)(cmd_ptr) - offsetof(hci_cmd_metadata_t, command))
54 #define HCI_GET_CMD_LINKED_STRUCT(metadata_ptr) (pkt_linked_item_t *)((void *)(metadata_ptr) - offsetof(pkt_linked_item_t, data))
55
hci_get_cmd_buf(size_t param_len)56 static inline BT_HDR *hci_get_cmd_buf(size_t param_len)
57 {
58 pkt_linked_item_t *linked_pkt = osi_calloc(HCI_CMD_LINKED_BUF_SIZE(param_len));
59 if (linked_pkt == NULL) {
60 return NULL;
61 }
62 hci_cmd_metadata_t *metadata = (hci_cmd_metadata_t *)linked_pkt->data;
63 BT_HDR *command = &metadata->command;
64
65 command->layer_specific = HCI_CMD_BUF_TYPE_METADATA;
66 command->len = HCIC_PREAMBLE_SIZE + param_len;
67 command->offset = 0;
68
69 return command;
70 }
71
hci_free_cmd_buf(BT_HDR * buf)72 static inline void hci_free_cmd_buf(BT_HDR *buf)
73 {
74 assert(buf->layer_specific == HCI_CMD_BUF_TYPE_METADATA);
75 hci_cmd_metadata_t *metadata = HCI_GET_CMD_METAMSG(buf);
76 pkt_linked_item_t *linked_pkt = HCI_GET_CMD_LINKED_STRUCT(metadata);
77 osi_free(linked_pkt);
78 }
79
80 #define HCI_GET_CMD_BUF(param_len) hci_get_cmd_buf(param_len)
81 #define HCI_FREE_CMD_BUF(buf) hci_free_cmd_buf(buf)
82
83 void bte_main_hci_send(BT_HDR *p_msg, UINT16 event);
84 void bte_main_lpm_allow_bt_device_sleep(void);
85
86 /* Message by message.... */
87
88 BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration,
89 UINT8 response_cnt);
90
91 #define HCIC_PARAM_SIZE_INQUIRY 5
92
93
94 #define HCIC_INQ_INQ_LAP_OFF 0
95 #define HCIC_INQ_DUR_OFF 3
96 #define HCIC_INQ_RSP_CNT_OFF 4
97 /* Inquiry */
98
99 /* Inquiry Cancel */
100 BOOLEAN btsnd_hcic_inq_cancel(void);
101
102 #define HCIC_PARAM_SIZE_INQ_CANCEL 0
103
104 /* Periodic Inquiry Mode */
105 BOOLEAN btsnd_hcic_per_inq_mode(UINT16 max_period, UINT16 min_period,
106 const LAP inq_lap, UINT8 duration,
107 UINT8 response_cnt);
108
109 #define HCIC_PARAM_SIZE_PER_INQ_MODE 9
110
111 #define HCI_PER_INQ_MAX_INTRVL_OFF 0
112 #define HCI_PER_INQ_MIN_INTRVL_OFF 2
113 #define HCI_PER_INQ_INQ_LAP_OFF 4
114 #define HCI_PER_INQ_DURATION_OFF 7
115 #define HCI_PER_INQ_RSP_CNT_OFF 8
116 /* Periodic Inquiry Mode */
117
118 /* Exit Periodic Inquiry Mode */
119 BOOLEAN btsnd_hcic_exit_per_inq(void);
120
121 #define HCIC_PARAM_SIZE_EXIT_PER_INQ 0
122 /* Create Connection */
123 BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types,
124 UINT8 page_scan_rep_mode,
125 UINT8 page_scan_mode,
126 UINT16 clock_offset,
127 UINT8 allow_switch);
128
129 #define HCIC_PARAM_SIZE_CREATE_CONN 13
130
131 #define HCIC_CR_CONN_BD_ADDR_OFF 0
132 #define HCIC_CR_CONN_PKT_TYPES_OFF 6
133 #define HCIC_CR_CONN_REP_MODE_OFF 8
134 #define HCIC_CR_CONN_PAGE_SCAN_MODE_OFF 9
135 #define HCIC_CR_CONN_CLK_OFF_OFF 10
136 #define HCIC_CR_CONN_ALLOW_SWITCH_OFF 12
137 /* Create Connection */
138
139 /* Disconnect */
140 BOOLEAN btsnd_hcic_disconnect(UINT16 handle, UINT8 reason);
141
142 #define HCIC_PARAM_SIZE_DISCONNECT 3
143
144 #define HCI_DISC_HANDLE_OFF 0
145 #define HCI_DISC_REASON_OFF 2
146 /* Disconnect */
147
148 #if BTM_SCO_INCLUDED == TRUE
149 /* Add SCO Connection */
150 BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types);
151 #endif /* BTM_SCO_INCLUDED */
152
153 #define HCIC_PARAM_SIZE_ADD_SCO_CONN 4
154
155 #define HCI_ADD_SCO_HANDLE_OFF 0
156 #define HCI_ADD_SCO_PACKET_TYPES_OFF 2
157 /* Add SCO Connection */
158
159 /* Create Connection Cancel */
160 BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest);
161
162 #define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL 6
163
164 #define HCIC_CR_CONN_CANCEL_BD_ADDR_OFF 0
165 /* Create Connection Cancel */
166
167 /* Accept Connection Request */
168 BOOLEAN btsnd_hcic_accept_conn (BD_ADDR bd_addr, UINT8 role);
169
170 #define HCIC_PARAM_SIZE_ACCEPT_CONN 7
171
172 #define HCI_ACC_CONN_BD_ADDR_OFF 0
173 #define HCI_ACC_CONN_ROLE_OFF 6
174 /* Accept Connection Request */
175
176 /* Reject Connection Request */
177 BOOLEAN btsnd_hcic_reject_conn (BD_ADDR bd_addr, UINT8 reason);
178
179 #define HCIC_PARAM_SIZE_REJECT_CONN 7
180
181 #define HCI_REJ_CONN_BD_ADDR_OFF 0
182 #define HCI_REJ_CONN_REASON_OFF 6
183 /* Reject Connection Request */
184
185 /* Link Key Request Reply */
186 BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr,
187 LINK_KEY link_key);
188
189 #define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY 22
190
191 #define HCI_LINK_KEY_REPLY_BD_ADDR_OFF 0
192 #define HCI_LINK_KEY_REPLY_LINK_KEY_OFF 6
193 /* Link Key Request Reply */
194
195 /* Link Key Request Neg Reply */
196 BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr);
197
198 #define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY 6
199
200 #define HCI_LINK_KEY_NEG_REP_BD_ADR_OFF 0
201 /* Link Key Request Neg Reply */
202
203 /* PIN Code Request Reply */
204 BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr,
205 UINT8 pin_code_len,
206 PIN_CODE pin_code);
207
208 #define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY 23
209
210 #define HCI_PIN_CODE_REPLY_BD_ADDR_OFF 0
211 #define HCI_PIN_CODE_REPLY_PIN_LEN_OFF 6
212 #define HCI_PIN_CODE_REPLY_PIN_CODE_OFF 7
213 /* PIN Code Request Reply */
214
215 /* Link Key Request Neg Reply */
216 BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr);
217
218 #define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY 6
219
220 #define HCI_PIN_CODE_NEG_REP_BD_ADR_OFF 0
221 /* Link Key Request Neg Reply */
222
223 /* Change Connection Type */
224 BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types);
225
226 #define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE 4
227
228 #define HCI_CHNG_PKT_TYPE_HANDLE_OFF 0
229 #define HCI_CHNG_PKT_TYPE_PKT_TYPE_OFF 2
230 /* Change Connection Type */
231
232 #define HCIC_PARAM_SIZE_CMD_HANDLE 2
233
234 #define HCI_CMD_HANDLE_HANDLE_OFF 0
235
236 BOOLEAN btsnd_hcic_auth_request (UINT16 handle); /* Authentication Request */
237
238 /* Set Connection Encryption */
239 BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable);
240 #define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT 3
241
242
243 #define HCI_SET_ENCRYPT_HANDLE_OFF 0
244 #define HCI_SET_ENCRYPT_ENABLE_OFF 2
245 /* Set Connection Encryption */
246
247 /* Remote Name Request */
248 BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr,
249 UINT8 page_scan_rep_mode,
250 UINT8 page_scan_mode,
251 UINT16 clock_offset);
252
253 #define HCIC_PARAM_SIZE_RMT_NAME_REQ 10
254
255 #define HCI_RMT_NAME_BD_ADDR_OFF 0
256 #define HCI_RMT_NAME_REP_MODE_OFF 6
257 #define HCI_RMT_NAME_PAGE_SCAN_MODE_OFF 7
258 #define HCI_RMT_NAME_CLK_OFF_OFF 8
259 /* Remote Name Request */
260
261 /* Remote Name Request Cancel */
262 BOOLEAN btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr);
263
264 #define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL 6
265
266 #define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF 0
267 /* Remote Name Request Cancel */
268
269 BOOLEAN btsnd_hcic_rmt_features_req(UINT16 handle); /* Remote Features Request */
270
271 /* Remote Extended Features */
272 BOOLEAN btsnd_hcic_rmt_ext_features(UINT16 handle, UINT8 page_num);
273
274 #define HCIC_PARAM_SIZE_RMT_EXT_FEATURES 3
275
276 #define HCI_RMT_EXT_FEATURES_HANDLE_OFF 0
277 #define HCI_RMT_EXT_FEATURES_PAGE_NUM_OFF 2
278 /* Remote Extended Features */
279
280
281 BOOLEAN btsnd_hcic_rmt_ver_req(UINT16 handle); /* Remote Version Info Request */
282 BOOLEAN btsnd_hcic_read_rmt_clk_offset(UINT16 handle); /* Remote Clock Offset */
283 BOOLEAN btsnd_hcic_read_lmp_handle(UINT16 handle); /* Remote LMP Handle */
284
285 BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle,
286 UINT32 tx_bw, UINT32 rx_bw,
287 UINT16 max_latency, UINT16 voice,
288 UINT8 retrans_effort,
289 UINT16 packet_types);
290 #define HCIC_PARAM_SIZE_SETUP_ESCO 17
291
292 #define HCI_SETUP_ESCO_HANDLE_OFF 0
293 #define HCI_SETUP_ESCO_TX_BW_OFF 2
294 #define HCI_SETUP_ESCO_RX_BW_OFF 6
295 #define HCI_SETUP_ESCO_MAX_LAT_OFF 10
296 #define HCI_SETUP_ESCO_VOICE_OFF 12
297 #define HCI_SETUP_ESCO_RETRAN_EFF_OFF 14
298 #define HCI_SETUP_ESCO_PKT_TYPES_OFF 15
299
300
301 BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr,
302 UINT32 tx_bw, UINT32 rx_bw,
303 UINT16 max_latency,
304 UINT16 content_fmt,
305 UINT8 retrans_effort,
306 UINT16 packet_types);
307 #define HCIC_PARAM_SIZE_ACCEPT_ESCO 21
308
309 #define HCI_ACCEPT_ESCO_BDADDR_OFF 0
310 #define HCI_ACCEPT_ESCO_TX_BW_OFF 6
311 #define HCI_ACCEPT_ESCO_RX_BW_OFF 10
312 #define HCI_ACCEPT_ESCO_MAX_LAT_OFF 14
313 #define HCI_ACCEPT_ESCO_VOICE_OFF 16
314 #define HCI_ACCEPT_ESCO_RETRAN_EFF_OFF 18
315 #define HCI_ACCEPT_ESCO_PKT_TYPES_OFF 19
316
317
318 BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason);
319 #define HCIC_PARAM_SIZE_REJECT_ESCO 7
320
321 #define HCI_REJECT_ESCO_BDADDR_OFF 0
322 #define HCI_REJECT_ESCO_REASON_OFF 6
323
324 /* Hold Mode */
325 BOOLEAN btsnd_hcic_hold_mode(UINT16 handle, UINT16 max_hold_period,
326 UINT16 min_hold_period);
327
328 #define HCIC_PARAM_SIZE_HOLD_MODE 6
329
330 #define HCI_HOLD_MODE_HANDLE_OFF 0
331 #define HCI_HOLD_MODE_MAX_PER_OFF 2
332 #define HCI_HOLD_MODE_MIN_PER_OFF 4
333 /* Hold Mode */
334
335 /**
336 * Sniff Mode
337 * sniff_attempt should no more than 0xFF
338 */
339 BOOLEAN btsnd_hcic_sniff_mode(UINT16 handle,
340 UINT16 max_sniff_period,
341 UINT16 min_sniff_period,
342 UINT16 sniff_attempt,
343 UINT16 sniff_timeout);
344
345 #define HCIC_PARAM_SIZE_SNIFF_MODE 10
346
347
348 #define HCI_SNIFF_MODE_HANDLE_OFF 0
349 #define HCI_SNIFF_MODE_MAX_PER_OFF 2
350 #define HCI_SNIFF_MODE_MIN_PER_OFF 4
351 #define HCI_SNIFF_MODE_ATTEMPT_OFF 6
352 #define HCI_SNIFF_MODE_TIMEOUT_OFF 8
353 /* Sniff Mode */
354
355 BOOLEAN btsnd_hcic_exit_sniff_mode(UINT16 handle); /* Exit Sniff Mode */
356
357 /* Park Mode */
358 BOOLEAN btsnd_hcic_park_mode (UINT16 handle,
359 UINT16 beacon_max_interval,
360 UINT16 beacon_min_interval);
361
362 #define HCIC_PARAM_SIZE_PARK_MODE 6
363
364 #define HCI_PARK_MODE_HANDLE_OFF 0
365 #define HCI_PARK_MODE_MAX_PER_OFF 2
366 #define HCI_PARK_MODE_MIN_PER_OFF 4
367 /* Park Mode */
368
369 BOOLEAN btsnd_hcic_exit_park_mode(UINT16 handle); /* Exit Park Mode */
370
371 /* QoS Setup */
372 BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags,
373 UINT8 service_type,
374 UINT32 token_rate, UINT32 peak,
375 UINT32 latency, UINT32 delay_var);
376
377 #define HCIC_PARAM_SIZE_QOS_SETUP 20
378
379 #define HCI_QOS_HANDLE_OFF 0
380 #define HCI_QOS_FLAGS_OFF 2
381 #define HCI_QOS_SERVICE_TYPE_OFF 3
382 #define HCI_QOS_TOKEN_RATE_OFF 4
383 #define HCI_QOS_PEAK_BANDWIDTH_OFF 8
384 #define HCI_QOS_LATENCY_OFF 12
385 #define HCI_QOS_DELAY_VAR_OFF 16
386 /* QoS Setup */
387
388 /* Switch Role Request */
389 BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role);
390
391 #define HCIC_PARAM_SIZE_SWITCH_ROLE 7
392
393 #define HCI_SWITCH_BD_ADDR_OFF 0
394 #define HCI_SWITCH_ROLE_OFF 6
395 /* Switch Role Request */
396
397 /* Write Policy Settings */
398 BOOLEAN btsnd_hcic_write_policy_set(UINT16 handle, UINT16 settings);
399
400 #define HCIC_PARAM_SIZE_WRITE_POLICY_SET 4
401
402 #define HCI_WRITE_POLICY_HANDLE_OFF 0
403 #define HCI_WRITE_POLICY_SETTINGS_OFF 2
404 /* Write Policy Settings */
405
406 /* Write Default Policy Settings */
407 BOOLEAN btsnd_hcic_write_def_policy_set(UINT16 settings);
408
409 #define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET 2
410
411 #define HCI_WRITE_DEF_POLICY_SETTINGS_OFF 0
412 /* Write Default Policy Settings */
413
414 /******************************************
415 ** Lisbon Features
416 *******************************************/
417 #if BTM_SSR_INCLUDED == TRUE
418 /* Sniff Subrating */
419 BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat,
420 UINT16 min_remote_lat,
421 UINT16 min_local_lat);
422
423 #define HCIC_PARAM_SIZE_SNIFF_SUB_RATE 8
424
425 #define HCI_SNIFF_SUB_RATE_HANDLE_OFF 0
426 #define HCI_SNIFF_SUB_RATE_MAX_LAT_OFF 2
427 #define HCI_SNIFF_SUB_RATE_MIN_REM_LAT_OFF 4
428 #define HCI_SNIFF_SUB_RATE_MIN_LOC_LAT_OFF 6
429 /* Sniff Subrating */
430
431 #else /* BTM_SSR_INCLUDED == FALSE */
432
433 #define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) FALSE
434
435 #endif /* BTM_SSR_INCLUDED */
436
437 /* Extended Inquiry Response */
438 void btsnd_hcic_write_ext_inquiry_response(BT_HDR *buffer, UINT8 fec_req);
439
440 #define HCIC_PARAM_SIZE_EXT_INQ_RESP 241
441
442 #define HCIC_EXT_INQ_RESP_FEC_OFF 0
443 #define HCIC_EXT_INQ_RESP_RESPONSE 1
444 /* IO Capabilities Response */
445 BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability,
446 UINT8 oob_present, UINT8 auth_req);
447
448 #define HCIC_PARAM_SIZE_IO_CAP_RESP 9
449
450 #define HCI_IO_CAP_BD_ADDR_OFF 0
451 #define HCI_IO_CAPABILITY_OFF 6
452 #define HCI_IO_CAP_OOB_DATA_OFF 7
453 #define HCI_IO_CAP_AUTH_REQ_OFF 8
454
455 /* IO Capabilities Req Neg Reply */
456 BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code);
457
458 #define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7
459
460 #define HCI_IO_CAP_NR_BD_ADDR_OFF 0
461 #define HCI_IO_CAP_NR_ERR_CODE 6
462
463 /* Read Local OOB Data */
464 BOOLEAN btsnd_hcic_read_local_oob_data (void);
465
466 #define HCIC_PARAM_SIZE_R_LOCAL_OOB 0
467
468
469 BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes);
470
471 #define HCIC_PARAM_SIZE_UCONF_REPLY 6
472
473 #define HCI_USER_CONF_BD_ADDR_OFF 0
474
475
476 BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value);
477
478 #define HCIC_PARAM_SIZE_U_PKEY_REPLY 10
479
480 #define HCI_USER_PASSKEY_BD_ADDR_OFF 0
481 #define HCI_USER_PASSKEY_VALUE_OFF 6
482
483
484 BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr);
485
486 #define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6
487
488 #define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0
489
490 /* Remote OOB Data Request Reply */
491 BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c,
492 UINT8 *p_r);
493
494 #define HCIC_PARAM_SIZE_REM_OOB_REPLY 38
495
496 #define HCI_REM_OOB_DATA_BD_ADDR_OFF 0
497 #define HCI_REM_OOB_DATA_C_OFF 6
498 #define HCI_REM_OOB_DATA_R_OFF 22
499
500 /* Remote OOB Data Request Negative Reply */
501 BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr);
502
503 #define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY 6
504
505 #define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF 0
506
507 /* Read Tx Power Level */
508 BOOLEAN btsnd_hcic_read_inq_tx_power (void);
509
510 #define HCIC_PARAM_SIZE_R_TX_POWER 0
511
512 /* Read Default Erroneous Data Reporting */
513 BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void);
514
515 #define HCIC_PARAM_SIZE_R_ERR_DATA_RPT 0
516
517 #if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
518 BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type);
519
520 #define HCIC_PARAM_SIZE_ENHANCED_FLUSH 3
521 #endif
522
523
524 BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif);
525
526 #define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF 7
527
528 #define HCI_SEND_KEYPRESS_NOTIF_BD_ADDR_OFF 0
529 #define HCI_SEND_KEYPRESS_NOTIF_NOTIF_OFF 6
530
531 /**** end of Simple Pairing Commands ****/
532
533 /* Store Current Settings */
534 #define MAX_FILT_COND (sizeof (BD_ADDR) + 1)
535
536 BOOLEAN btsnd_hcic_set_event_filter(UINT8 filt_type,
537 UINT8 filt_cond_type,
538 UINT8 *filt_cond,
539 UINT8 filt_cond_len);
540
541 #define HCIC_PARAM_SIZE_SET_EVT_FILTER 9
542
543 #define HCI_FILT_COND_FILT_TYPE_OFF 0
544 #define HCI_FILT_COND_COND_TYPE_OFF 1
545 #define HCI_FILT_COND_FILT_OFF 2
546 /* Set Event Filter */
547
548 /* Delete Stored Key */
549 BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag);
550
551 #define HCIC_PARAM_SIZE_DELETE_STORED_KEY 7
552
553 #define HCI_DELETE_KEY_BD_ADDR_OFF 0
554 #define HCI_DELETE_KEY_ALL_FLAG_OFF 6
555 /* Delete Stored Key */
556
557 /* Change Local Name */
558 BOOLEAN btsnd_hcic_change_name (const UINT8 *name);
559
560 #define HCIC_PARAM_SIZE_CHANGE_NAME BD_NAME_LEN
561
562 #define HCI_CHANGE_NAME_NAME_OFF 0
563 /* Change Local Name */
564
565
566 #define HCIC_PARAM_SIZE_READ_CMD 0
567
568 #define HCIC_PARAM_SIZE_WRITE_PARAM1 1
569
570 #define HCIC_WRITE_PARAM1_PARAM_OFF 0
571
572 #define HCIC_PARAM_SIZE_WRITE_PARAM2 2
573
574 #define HCIC_WRITE_PARAM2_PARAM_OFF 0
575
576 #define HCIC_PARAM_SIZE_WRITE_PARAM3 3
577
578 #define HCIC_WRITE_PARAM3_PARAM_OFF 0
579
580 /* set AFH channels */
581 BOOLEAN btsnd_hcic_set_afh_channels (AFH_CHANNELS channels);
582 #define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10
583 BOOLEAN btsnd_hcic_ble_set_channels (BLE_CHANNELS channels);
584 #define HCIC_PARAM_SIZE_BLE_SET_CHANNELS 5
585
586 BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */
587 BOOLEAN btsnd_hcic_write_auto_accept(UINT8 flag); /* Write Auto Accept */
588 BOOLEAN btsnd_hcic_read_name (void); /* Read Local Name */
589 BOOLEAN btsnd_hcic_write_page_tout(UINT16 timeout); /* Write Page Timout */
590 BOOLEAN btsnd_hcic_write_scan_enable(UINT8 flag); /* Write Scan Enable */
591 BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval,
592 UINT16 window); /* Write Page Scan Activity */
593
594 #define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG 4
595
596 #define HCI_SCAN_CFG_INTERVAL_OFF 0
597 #define HCI_SCAN_CFG_WINDOW_OFF 2
598 /* Write Page Scan Activity */
599
600 /* Write Inquiry Scan Activity */
601 BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window);
602
603 #define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG 4
604
605 #define HCI_SCAN_CFG_INTERVAL_OFF 0
606 #define HCI_SCAN_CFG_WINDOW_OFF 2
607 /* Write Inquiry Scan Activity */
608
609 BOOLEAN btsnd_hcic_write_auth_enable(UINT8 flag); /* Write Authentication Enable */
610 BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev); /* Write Class of Device */
611 BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags); /* Write Voice Settings */
612
613 /* Host Controller to Host flow control */
614 #define HCI_HOST_FLOW_CTRL_OFF 0
615 #define HCI_HOST_FLOW_CTRL_ACL_ON 1
616 #define HCI_HOST_FLOW_CTRL_SCO_ON 2
617 #define HCI_HOST_FLOW_CTRL_BOTH_ON 3
618
619 #define HCI_HOST_FLOW_CTRL_ADV_REPORT_OFF 0
620 #define HCI_HOST_FLOW_CTRL_ADV_REPORT_ON 1
621
622
623 BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
624 UINT16 timeout); /* Write Retransmit Timout */
625
626 #define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4
627
628 #define HCI_FLUSH_TOUT_HANDLE_OFF 0
629 #define HCI_FLUSH_TOUT_TOUT_OFF 2
630
631 BOOLEAN btsnd_hcic_read_tx_power(UINT16 handle, UINT8 type); /* Read Tx Power */
632
633 #define HCIC_PARAM_SIZE_READ_TX_POWER 3
634
635 #define HCI_READ_TX_POWER_HANDLE_OFF 0
636 #define HCI_READ_TX_POWER_TYPE_OFF 2
637
638 /* Read transmit power level parameter */
639 #define HCI_READ_CURRENT 0x00
640 #define HCI_READ_MAXIMUM 0x01
641
642 BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles,
643 UINT16 *handle,
644 UINT16 *num_pkts); /* Set Host Buffer Size */
645
646 #define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE sizeof(btmsg_hcic_num_pkts_done_t)
647
648 #define MAX_DATA_HANDLES 10
649
650 #define HCI_PKTS_DONE_NUM_HANDLES_OFF 0
651 #define HCI_PKTS_DONE_HANDLE_OFF 1
652 #define HCI_PKTS_DONE_NUM_PKTS_OFF 3
653
654 /* Write Link Supervision Timeout */
655 BOOLEAN btsnd_hcic_write_link_super_tout(UINT8 local_controller_id, UINT16 handle, UINT16 timeout);
656
657 #define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT 4
658
659 #define HCI_LINK_SUPER_TOUT_HANDLE_OFF 0
660 #define HCI_LINK_SUPER_TOUT_TOUT_OFF 2
661 /* Write Link Supervision Timeout */
662
663 BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac,
664 LAP *const iac_lap); /* Write Current IAC LAP */
665
666 #define MAX_IAC_LAPS 0x40
667
668 #define HCI_WRITE_IAC_LAP_NUM_OFF 0
669 #define HCI_WRITE_IAC_LAP_LAP_OFF 1
670 /* Write Current IAC LAP */
671
672 BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle); /* Get Link Quality */
673 BOOLEAN btsnd_hcic_read_rssi (UINT16 handle); /* Read RSSI */
674 BOOLEAN btsnd_hcic_enable_test_mode (void); /* Enable Device Under Test Mode */
675 BOOLEAN btsnd_hcic_write_pagescan_type(UINT8 type); /* Write Page Scan Type */
676 BOOLEAN btsnd_hcic_write_inqscan_type(UINT8 type); /* Write Inquiry Scan Type */
677 BOOLEAN btsnd_hcic_write_inquiry_mode(UINT8 type); /* Write Inquiry Mode */
678
679 #define HCI_DATA_HANDLE_MASK 0x0FFF
680
681 #define HCID_GET_HANDLE_EVENT(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset) + \
682 (*((UINT8 *)((p) + 1) + p->offset + 1) << 8)))
683
684 #define HCID_GET_HANDLE(u16) (UINT16)((u16) & HCI_DATA_HANDLE_MASK)
685
686 #define HCI_DATA_EVENT_MASK 3
687 #define HCI_DATA_EVENT_OFFSET 12
688 #define HCID_GET_EVENT(u16) (UINT8)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
689
690 #define HCI_DATA_BCAST_MASK 3
691 #define HCI_DATA_BCAST_OFFSET 10
692 #define HCID_GET_BCAST(u16) (UINT8)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
693
694 #define HCID_GET_ACL_LEN(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset + 2) + \
695 (*((UINT8 *)((p) + 1) + p->offset + 3) << 8)))
696
697 #define HCID_HEADER_SIZE 4
698
699 #define HCID_GET_SCO_LEN(p) (*((UINT8 *)((p) + 1) + p->offset + 2))
700
701 void btsnd_hcic_vendor_spec_cmd (BT_HDR *buffer, UINT16 opcode,
702 UINT8 len, UINT8 *p_data,
703 void *p_cmd_cplt_cback);
704
705 #if (BLE_INCLUDED == TRUE)
706 /********************************************************************************
707 ** BLE Commands
708 ** Note: "local_controller_id" is for transport, not counted in HCI message size
709 *********************************************************************************/
710 #define HCIC_BLE_RAND_DI_SIZE 8
711 #define HCIC_BLE_ENCRYT_KEY_SIZE 16
712 #define HCIC_BLE_IRK_SIZE 16
713
714 #define HCIC_PARAM_SIZE_SET_USED_FEAT_CMD 8
715 #define HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD 6
716 #define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS 15
717 #if (BLE_50_FEATURE_SUPPORT == TRUE)
718 #define HCIC_PARAM_SIZE_BLE_WRITE_EXT_ADV_PARAMS 25
719 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
720 #define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP 31
721 #define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE 1
722 #define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM 7
723 #define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE 2
724 #define HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN 25
725 #define HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL 0
726 #define HCIC_PARAM_SIZE_CLEAR_WHITE_LIST 0
727 #define HCIC_PARAM_SIZE_ADD_WHITE_LIST 7
728 #define HCIC_PARAM_SIZE_REMOVE_WHITE_LIST 7
729 #define HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS 14
730 #define HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS 5
731 #define HCIC_PARAM_SIZE_READ_CHNL_MAP 2
732 #define HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT 2
733 #define HCIC_PARAM_SIZE_BLE_ENCRYPT 32
734 #define HCIC_PARAM_SIZE_BLE_RAND 0
735 #define HCIC_PARAM_SIZE_WRITE_LE_HOST_SUPPORTED 2
736
737 #define HCIC_BLE_RAND_DI_SIZE 8
738 #define HCIC_BLE_ENCRYT_KEY_SIZE 16
739 #define HCIC_PARAM_SIZE_BLE_START_ENC (4 + HCIC_BLE_RAND_DI_SIZE + HCIC_BLE_ENCRYT_KEY_SIZE)
740 #define HCIC_PARAM_SIZE_LTK_REQ_REPLY (2 + HCIC_BLE_ENCRYT_KEY_SIZE)
741 #define HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY 2
742 #define HCIC_BLE_CHNL_MAP_SIZE 5
743 #define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA 31
744
745 #define HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST (7 + HCIC_BLE_IRK_SIZE * 2)
746 #define HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST 7
747 #define HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST 0
748 #define HCIC_PARAM_SIZE_BLE_READ_RESOLVING_LIST_SIZE 0
749 #define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER 7
750 #define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_LOCAL 7
751 #define HCIC_PARAM_SIZE_BLE_SET_ADDR_RESOLUTION_ENABLE 1
752 #define HCIC_PARAM_SIZE_BLE_SET_RAND_PRIV_ADDR_TIMOUT 2
753 #define HCIC_PARAM_SIZE_BLE_SET_DATA_LENGTH 6
754 #define HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM 11
755 #define HCIC_PARAM_SIZE_BLE_UPDATE_ADV_FLOW_CONTROL 2
756 #if (BLE_50_FEATURE_SUPPORT == TRUE)
757 #define HCIC_PARAM_SIZE_BLE_READ_PHY 2
758 #define HCIC_PARAM_SIZE_BLE_SET_DEF_PHY 3
759 #define HCIC_PARAM_SIZE_BLE_SET_PHY 7
760 #define HCIC_PARAM_SIZE_ENH_RX_TEST 3
761 #define HCIC_PARAM_SIZE_ENH_TX_TEST 4
762 #define HCIC_PARAM_SIZE_EXT_RAND_ADDR 7
763 #define HCIC_PARAM_SIZE_EXT_ADV_SET_PARAMS 25
764 #define HCIC_PARAM_SIZE_EXT_ADV_WRITE_DATA 251
765 #define HCIC_PARAM_SIZE_READ_MAX_ADV_SIZE 0
766 #define HCIC_PARAM_SIZE_NUM_SUPPORT_ADV_SET 0
767 #define HCIC_PARAM_SIZE_REMOVE_ADV_SET 1
768 #define HCIC_PARAM_SIZE_CLEAR_ADV_SET 0
769 #define HCIC_PARAM_SIZE_SET_PERIODIC_ADV_PARAMS 7
770 #define HCIC_PARAM_SIZE_WRITE_PERIODIC_ADV_DATA 252
771 #define HCIC_PARAM_SIZE_PERIODIC_ADV_ENABLE 2
772 #define HCIC_PARAM_SIZE_SET_EXT_SCAN_PARAMS 3
773 #define HCIC_PARAM_SIZE_EXT_SCAN_ENABLE 6
774 #define HCIC_PARAM_SIZE_EXT_CONN_CREATE_BASE 10
775 #define HCIC_PARAM_SIZE_PERIODIC_ADV_CREATE_SYNC 12
776 #define HCIC_PARAM_SIZE_PERIODIC_ADV_CREATE_SYNC_CANCEL 0
777 #define HCIC_PARAM_SIZE_PERIODIC_ADV_TERM_SYNC 2
778 #define HCIC_PARAM_SIZE_ADD_DEV_TO_PERIODIC_ADV_LIST 8
779 #define HCIC_PARAM_SIZE_RM_DEV_FROM_PERIODIC_ADV_LIST 8
780 #define HCIC_PARAM_SIZE_CLEAR_PERIODIC_ADV_LIST 0
781 #define HCIC_PARAM_SIZE_READ_PERIODIC_ADV_LIST 0
782 #define HCIC_PARAM_SIZE_READ_TRANS_POWER 0
783 #define HCIC_PARAM_SIZE_READ_RF_PATH_COMPENSATION 0
784 #define HCIC_PARAM_SIZE_WRITE_RF_PATH_COMPENSATION 4
785
786 BlE_SYNC *btsnd_hcic_ble_get_sync_info(void);
787 void btsnd_hcic_ble_sync_sem_init(void);
788 void btsnd_hcic_ble_sync_sem_deinit(void);
789
790 uint8_t btsnd_hcic_ble_get_status(void);
791
792 void btsnd_hci_ble_set_status(UINT8 hci_status);
793 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
794
795 /* ULP HCI command */
796 BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
797
798 BOOLEAN btsnd_hcic_ble_read_buffer_size (void);
799
800 BOOLEAN btsnd_hcic_ble_read_local_spt_feat (void);
801
802 BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8]);
803
804 BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
805
806 BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
807 UINT8 adv_type, UINT8 addr_type_own,
808 UINT8 addr_type_dir, BD_ADDR direct_bda,
809 UINT8 channel_map, UINT8 adv_filter_policy);
810
811 BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void);
812
813 BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data);
814
815 BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp);
816
817 BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable);
818
819 BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
820 UINT16 scan_int, UINT16 scan_win,
821 UINT8 addr_type, UINT8 scan_filter_policy);
822
823 BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate);
824
825 BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win,
826 UINT8 init_filter_policy, UINT8 addr_type_peer, BD_ADDR bda_peer, UINT8 addr_type_own,
827 UINT16 conn_int_min, UINT16 conn_int_max, UINT16 conn_latency, UINT16 conn_timeout,
828 UINT16 min_ce_len, UINT16 max_ce_len);
829
830 BOOLEAN btsnd_hcic_ble_create_conn_cancel (void);
831
832 BOOLEAN btsnd_hcic_ble_read_white_list_size (void);
833
834 BOOLEAN btsnd_hcic_ble_clear_white_list (void);
835
836 BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda);
837
838 BOOLEAN btsnd_hcic_ble_remove_from_white_list (UINT8 addr_type, BD_ADDR bda);
839
840 BOOLEAN btsnd_hcic_ble_upd_ll_conn_params (UINT16 handle, UINT16 conn_int_min, UINT16 conn_int_max,
841 UINT16 conn_latency, UINT16 conn_timeout, UINT16 min_len, UINT16 max_len);
842
843 BOOLEAN btsnd_hcic_ble_set_host_chnl_class (UINT8 chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
844
845 BOOLEAN btsnd_hcic_ble_read_chnl_map (UINT16 handle);
846
847 BOOLEAN btsnd_hcic_ble_read_remote_feat ( UINT16 handle);
848
849 BOOLEAN btsnd_hcic_ble_encrypt (UINT8 *key, UINT8 key_len, UINT8 *plain_text, UINT8 pt_len, void *p_cmd_cplt_cback);
850
851 BOOLEAN btsnd_hcic_ble_rand (void *p_cmd_cplt_cback);
852
853 BOOLEAN btsnd_hcic_ble_start_enc ( UINT16 handle,
854 UINT8 rand[HCIC_BLE_RAND_DI_SIZE],
855 UINT16 ediv, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
856
857 BOOLEAN btsnd_hcic_ble_ltk_req_reply (UINT16 handle, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
858
859 BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle);
860
861 BOOLEAN btsnd_hcic_ble_read_supported_states (void);
862
863 BOOLEAN btsnd_hcic_ble_write_host_supported (UINT8 le_host_spt, UINT8 simul_le_host_spt);
864
865 BOOLEAN btsnd_hcic_ble_read_host_supported (void);
866
867 BOOLEAN btsnd_hcic_ble_receiver_test(UINT8 rx_freq);
868
869 BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len,
870 UINT8 payload);
871 BOOLEAN btsnd_hcic_ble_test_end(void);
872
873 #if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
874
875 #define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY 14
876 BOOLEAN btsnd_hcic_ble_rc_param_req_reply(UINT16 handle,
877 UINT16 conn_int_min, UINT16 conn_int_max,
878 UINT16 conn_latency, UINT16 conn_timeout,
879 UINT16 min_ce_len, UINT16 max_ce_len);
880
881 #define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY 3
882 BOOLEAN btsnd_hcic_ble_rc_param_req_neg_reply(UINT16 handle, UINT8 reason);
883
884 #endif /* BLE_LLT_INCLUDED */
885
886 BOOLEAN btsnd_hcic_ble_set_data_length(UINT16 conn_handle, UINT16 tx_octets,
887 UINT16 tx_time);
888
889 BOOLEAN btsnd_hcic_ble_add_device_resolving_list (UINT8 addr_type_peer,
890 BD_ADDR bda_peer,
891 UINT8 irk_peer[HCIC_BLE_IRK_SIZE],
892 UINT8 irk_local[HCIC_BLE_IRK_SIZE]);
893
894 BOOLEAN btsnd_hcic_ble_rm_device_resolving_list (UINT8 addr_type_peer,
895 BD_ADDR bda_peer);
896
897 BOOLEAN btsnd_hcic_ble_clear_resolving_list (void);
898
899 BOOLEAN btsnd_hcic_ble_read_resolvable_addr_peer (UINT8 addr_type_peer,
900 BD_ADDR bda_peer);
901
902 BOOLEAN btsnd_hcic_ble_read_resolvable_addr_local (UINT8 addr_type_peer,
903 BD_ADDR bda_peer);
904
905 BOOLEAN btsnd_hcic_ble_set_addr_resolution_enable (UINT8 addr_resolution_enable);
906
907 BOOLEAN btsnd_hcic_ble_set_rand_priv_addr_timeout (UINT16 rpa_timout);
908
909 #endif /* BLE_INCLUDED */
910 #if (BLE_50_FEATURE_SUPPORT == TRUE)
911 typedef struct {
912 UINT8 scan_type;
913 UINT16 scan_interval;
914 UINT16 scan_window;
915 } tHCI_EXT_SCAN_PARAMS;
916
917 typedef struct {
918 UINT16 scan_interval;
919 UINT16 scan_window;
920 UINT16 conn_interval_min;
921 UINT16 conn_interval_max;
922 UINT16 conn_latency;
923 UINT16 sup_timeout;
924 UINT16 min_ce_len;
925 UINT16 max_ce_len;
926 } tHCI_ExtConnParams;
927
928 typedef struct {
929 UINT8 filter_policy;
930 UINT8 own_addr_type;
931 UINT8 peer_addr_type;
932 BD_ADDR peer_addr;
933 UINT8 init_phy_mask;
934 tHCI_ExtConnParams params[3];
935 } tHCI_CreatExtConn;
936 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
937 BOOLEAN btsnd_hcic_read_authenticated_payload_tout(UINT16 handle);
938
939 BOOLEAN btsnd_hcic_write_authenticated_payload_tout(UINT16 handle,
940 UINT16 timeout);
941
942 BOOLEAN btsnd_hcic_ble_update_adv_report_flow_control (UINT16 num, BT_HDR *static_buf);
943 #if (BLE_50_FEATURE_SUPPORT == TRUE)
944 BOOLEAN btsnd_hcic_ble_read_phy(UINT16 conn_handle);
945
946 UINT8 btsnd_hcic_ble_set_prefered_default_phy(UINT8 all_phys,
947 UINT8 tx_phys,
948 UINT8 rx_phys);
949 BOOLEAN btsnd_hcic_ble_set_phy(UINT16 conn_handle,
950 UINT8 all_phys, UINT8 tx_phys,
951 UINT8 rx_phys, UINT16 phy_options);
952
953 UINT8 btsnd_hcic_ble_enhand_rx_test(UINT8 rx_channel, UINT8 phy,
954 UINT8 modulation_idx);
955
956 UINT8 btsnd_hcic_ble_enhand_tx_test(UINT8 tx_channel, UINT8 len,
957 UINT8 packect,
958 UINT8 phy);
959
960 UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr);
961
962 UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UINT32 interval_min,
963 UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type,
964 UINT8 peer_addr_type, BD_ADDR peer_addr,
965 UINT8 adv_filter_policy, INT8 adv_tx_power,
966 UINT8 primary_adv_phy, UINT8 secondary_adv_max_skip,
967 UINT8 secondary_adv_phy,
968 UINT8 adv_sid, UINT8 scan_req_ntf_enable);
969
970 UINT8 btsnd_hcic_ble_set_ext_adv_data(UINT8 adv_handle,
971 UINT8 operation, UINT8 fragment_prefrence,
972 UINT8 data_len, UINT8 *p_data);
973
974 UINT8 btsnd_hcic_ble_set_ext_adv_scan_rsp_data(UINT8 adv_handle,
975 UINT8 operation, UINT8 fragment_prefrence,
976 UINT8 data_len, UINT8 *p_data);
977
978 UINT8 btsnd_hcic_ble_ext_adv_enable(UINT8 enable, UINT8 num_of_sets, UINT8 *adv_handle,
979 UINT16 *duration, UINT8 *max_adv_evt);
980
981 UINT8 btsnd_hcic_ble_read_max_adv_len(void);
982
983 UINT8 btsnd_hcic_ble_read_num_support_adv_set(void);
984
985 UINT8 btsnd_hcic_ble_remove_adv_set(UINT8 adv_handle);
986
987 UINT8 btsnd_hcic_ble_clear_adv_set(void);
988
989 UINT8 btsnd_hcic_ble_set_periodic_adv_params(UINT8 adv_handle,
990 UINT16 interval_min,
991 UINT16 interval_max,
992 UINT8 propertics);
993
994 UINT8 btsnd_hcic_ble_set_periodic_adv_data(UINT8 adv_handle,
995 UINT8 operation,
996 UINT8 len,
997 UINT8 *p_data);
998
999 UINT8 btsnd_hcic_ble_periodic_adv_enable(UINT8 enable, UINT8 adv_handle);
1000
1001 UINT8 btsnd_hcic_ble_set_ext_scan_params(UINT8 own_addr_type, UINT8 filter_policy,
1002 UINT8 phy_mask, UINT8 phy_count,
1003 tHCI_EXT_SCAN_PARAMS *params);
1004
1005 UINT8 btsnd_hcic_ble_ext_scan_enable(UINT8 enable, UINT8 filter_dups,
1006 UINT16 duration, UINT16 period);
1007
1008
1009 BOOLEAN btsnd_hcic_ble_create_ext_conn(tHCI_CreatExtConn *p_conn);
1010
1011 BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 filter_policy, UINT8 adv_sid,
1012 UINT8 adv_addr_type, BD_ADDR adv_addr,
1013 UINT16 sync_timeout, UINT8 unused);
1014
1015 UINT8 btsnd_hcic_ble_periodic_adv_create_sync_cancel(void);
1016
1017
1018 UINT8 btsnd_hcic_ble_periodic_adv_term_sync(UINT16 sync_handle);
1019
1020 UINT8 btsnd_hcic_ble_add_dev_to_periodic_adv_list(UINT8 adv_addr_type, BD_ADDR adv_addr,
1021 UINT8 adv_sid);
1022 UINT8 btsnd_hcic_ble_rm_dev_from_periodic_adv_list(UINT8 adv_addr_type, BD_ADDR adv_addr,
1023 UINT8 adv_sid);
1024
1025 UINT8 btsnd_hcic_ble_clear_periodic_adv_list(void);
1026
1027 UINT8 btsnd_hcic_ble_read_periodic_adv_list_size(void);
1028
1029 UINT8 btsnd_hcic_ble_read_trans_power(void);
1030
1031 UINT8 btsnd_hcic_ble_read_rf_path_compensation(void);
1032
1033 UINT8 btsnd_hcic_ble_write_rf_path_compensation(UINT16 rf_tx_path, UINT16 rf_rx_path);
1034
1035 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
1036 #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
1037 UINT8 btsnd_hcic_ble_set_periodic_adv_recv_enable(UINT16 sync_handle, UINT8 enable);
1038
1039 UINT8 btsnd_hcic_ble_periodic_adv_sync_trans(UINT16 conn_handle, UINT16 service_data, UINT16 sync_handle);
1040
1041 UINT8 btsnd_hcic_ble_periodic_adv_set_info_trans(UINT16 conn_handle, UINT16 service_data, UINT8 adv_handle);
1042
1043 UINT8 btsnd_hcic_ble_set_periodic_adv_sync_trans_params(UINT16 conn_handle, UINT8 mode, UINT16 skip, UINT16 sync_timeout, UINT8 cte_type);
1044 #endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
1045 #define HCIC_PARAM_SIZE_WRITE_AUTHENT_PAYLOAD_TOUT 4
1046
1047 #define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_HANDLE_OFF 0
1048 #define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_TOUT_OFF 2
1049
1050 #endif
1051