hcimsgs.h revision 763abdfe7983c8388c1fd0ce6aa05a44df11eaca
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 "bt_target.h"
23#include "hcidefs.h"
24#include "bt_types.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30void bte_main_hci_send(BT_HDR *p_msg, uint16_t event);
31void bte_main_lpm_allow_bt_device_sleep(void);
32
33/* Message by message.... */
34
35extern void btsnd_hcic_inquiry(const LAP inq_lap, uint8_t duration,
36                                  uint8_t response_cnt);
37
38#define HCIC_PARAM_SIZE_INQUIRY 5
39
40
41#define HCIC_INQ_INQ_LAP_OFF    0
42#define HCIC_INQ_DUR_OFF        3
43#define HCIC_INQ_RSP_CNT_OFF    4
44                                                                    /* Inquiry */
45
46                                                                    /* Inquiry Cancel */
47extern void btsnd_hcic_inq_cancel(void);
48
49#define HCIC_PARAM_SIZE_INQ_CANCEL   0
50
51                                                                    /* Periodic Inquiry Mode */
52extern void btsnd_hcic_per_inq_mode(uint16_t max_period, uint16_t min_period,
53                                       const LAP inq_lap, uint8_t duration,
54                                       uint8_t response_cnt);
55
56#define HCIC_PARAM_SIZE_PER_INQ_MODE    9
57
58#define HCI_PER_INQ_MAX_INTRVL_OFF  0
59#define HCI_PER_INQ_MIN_INTRVL_OFF  2
60#define HCI_PER_INQ_INQ_LAP_OFF     4
61#define HCI_PER_INQ_DURATION_OFF    7
62#define HCI_PER_INQ_RSP_CNT_OFF     8
63                                                                    /* Periodic Inquiry Mode */
64
65                                                                    /* Exit Periodic Inquiry Mode */
66extern void btsnd_hcic_exit_per_inq(void);
67
68#define HCIC_PARAM_SIZE_EXIT_PER_INQ   0
69                                                                    /* Create Connection */
70extern void btsnd_hcic_create_conn(BD_ADDR dest, uint16_t packet_types,
71                                      uint8_t page_scan_rep_mode,
72                                      uint8_t page_scan_mode,
73                                      uint16_t clock_offset,
74                                      uint8_t allow_switch);
75
76#define HCIC_PARAM_SIZE_CREATE_CONN  13
77
78#define HCIC_CR_CONN_BD_ADDR_OFF        0
79#define HCIC_CR_CONN_PKT_TYPES_OFF      6
80#define HCIC_CR_CONN_REP_MODE_OFF       8
81#define HCIC_CR_CONN_PAGE_SCAN_MODE_OFF 9
82#define HCIC_CR_CONN_CLK_OFF_OFF        10
83#define HCIC_CR_CONN_ALLOW_SWITCH_OFF   12
84                                                                    /* Create Connection */
85
86                                                                    /* Disconnect */
87extern void btsnd_hcic_disconnect(uint16_t handle, uint8_t reason);
88
89#define HCIC_PARAM_SIZE_DISCONNECT 3
90
91#define HCI_DISC_HANDLE_OFF             0
92#define HCI_DISC_REASON_OFF             2
93                                                                    /* Disconnect */
94
95#if (BTM_SCO_INCLUDED == TRUE)
96                                                                    /* Add SCO Connection */
97extern void btsnd_hcic_add_SCO_conn (uint16_t handle, uint16_t packet_types);
98#endif /* BTM_SCO_INCLUDED */
99
100#define HCIC_PARAM_SIZE_ADD_SCO_CONN    4
101
102#define HCI_ADD_SCO_HANDLE_OFF          0
103#define HCI_ADD_SCO_PACKET_TYPES_OFF    2
104                                                                    /* Add SCO Connection */
105
106                                                                    /* Create Connection Cancel */
107extern void btsnd_hcic_create_conn_cancel(BD_ADDR dest);
108
109#define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL  6
110
111#define HCIC_CR_CONN_CANCEL_BD_ADDR_OFF     0
112                                                                    /* Create Connection Cancel */
113
114                                                                    /* Accept Connection Request */
115extern void btsnd_hcic_accept_conn (BD_ADDR bd_addr, uint8_t role);
116
117#define HCIC_PARAM_SIZE_ACCEPT_CONN     7
118
119#define HCI_ACC_CONN_BD_ADDR_OFF        0
120#define HCI_ACC_CONN_ROLE_OFF           6
121                                                                    /* Accept Connection Request */
122
123                                                                    /* Reject Connection Request */
124extern void btsnd_hcic_reject_conn (BD_ADDR bd_addr, uint8_t reason);
125
126#define HCIC_PARAM_SIZE_REJECT_CONN      7
127
128#define HCI_REJ_CONN_BD_ADDR_OFF        0
129#define HCI_REJ_CONN_REASON_OFF         6
130                                                                    /* Reject Connection Request */
131
132                                                                    /* Link Key Request Reply */
133extern void btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr,
134                                              LINK_KEY link_key);
135
136#define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY   22
137
138#define HCI_LINK_KEY_REPLY_BD_ADDR_OFF  0
139#define HCI_LINK_KEY_REPLY_LINK_KEY_OFF 6
140                                                                    /* Link Key Request Reply  */
141
142                                                                    /* Link Key Request Neg Reply */
143extern void btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr);
144
145#define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY   6
146
147#define HCI_LINK_KEY_NEG_REP_BD_ADR_OFF 0
148                                                                    /* Link Key Request Neg Reply  */
149
150                                                                    /* PIN Code Request Reply */
151extern void btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr,
152                                              uint8_t pin_code_len,
153                                              PIN_CODE pin_code);
154
155#define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY   23
156
157#define HCI_PIN_CODE_REPLY_BD_ADDR_OFF  0
158#define HCI_PIN_CODE_REPLY_PIN_LEN_OFF  6
159#define HCI_PIN_CODE_REPLY_PIN_CODE_OFF 7
160                                                                    /* PIN Code Request Reply  */
161
162                                                                    /* Link Key Request Neg Reply */
163extern void btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr);
164
165#define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY   6
166
167#define HCI_PIN_CODE_NEG_REP_BD_ADR_OFF 0
168                                                                    /* Link Key Request Neg Reply  */
169
170                                                                    /* Change Connection Type */
171extern void btsnd_hcic_change_conn_type (uint16_t handle, uint16_t packet_types);
172
173#define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE     4
174
175#define HCI_CHNG_PKT_TYPE_HANDLE_OFF    0
176#define HCI_CHNG_PKT_TYPE_PKT_TYPE_OFF  2
177                                                                    /* Change Connection Type */
178
179#define HCIC_PARAM_SIZE_CMD_HANDLE      2
180
181#define HCI_CMD_HANDLE_HANDLE_OFF       0
182
183extern void btsnd_hcic_auth_request (uint16_t handle);     /* Authentication Request */
184
185                                                                    /* Set Connection Encryption */
186extern void btsnd_hcic_set_conn_encrypt (uint16_t handle, bool    enable);
187#define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT     3
188
189
190#define HCI_SET_ENCRYPT_HANDLE_OFF      0
191#define HCI_SET_ENCRYPT_ENABLE_OFF      2
192                                                                    /* Set Connection Encryption */
193
194                                                                    /* Remote Name Request */
195extern void btsnd_hcic_rmt_name_req (BD_ADDR bd_addr,
196                                        uint8_t page_scan_rep_mode,
197                                        uint8_t page_scan_mode,
198                                        uint16_t clock_offset);
199
200#define HCIC_PARAM_SIZE_RMT_NAME_REQ   10
201
202#define HCI_RMT_NAME_BD_ADDR_OFF        0
203#define HCI_RMT_NAME_REP_MODE_OFF       6
204#define HCI_RMT_NAME_PAGE_SCAN_MODE_OFF 7
205#define HCI_RMT_NAME_CLK_OFF_OFF        8
206                                                                    /* Remote Name Request */
207
208                                                                    /* Remote Name Request Cancel */
209extern void btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr);
210
211#define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL   6
212
213#define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF       0
214                                                                    /* Remote Name Request Cancel */
215
216extern void btsnd_hcic_rmt_features_req(uint16_t handle);      /* Remote Features Request */
217
218                                                                    /* Remote Extended Features */
219extern void btsnd_hcic_rmt_ext_features(uint16_t handle, uint8_t page_num);
220
221#define HCIC_PARAM_SIZE_RMT_EXT_FEATURES   3
222
223#define HCI_RMT_EXT_FEATURES_HANDLE_OFF    0
224#define HCI_RMT_EXT_FEATURES_PAGE_NUM_OFF  2
225                                                                    /* Remote Extended Features */
226
227
228extern void btsnd_hcic_rmt_ver_req(uint16_t handle);           /* Remote Version Info Request */
229extern void btsnd_hcic_read_rmt_clk_offset(uint16_t handle);   /* Remote Clock Offset */
230extern void btsnd_hcic_read_lmp_handle(uint16_t handle);       /* Remote LMP Handle */
231
232extern void btsnd_hcic_setup_esco_conn (uint16_t handle,
233                                           uint32_t tx_bw, uint32_t rx_bw,
234                                           uint16_t max_latency, uint16_t voice,
235                                           uint8_t retrans_effort,
236                                           uint16_t packet_types);
237#define HCIC_PARAM_SIZE_SETUP_ESCO      17
238
239#define HCI_SETUP_ESCO_HANDLE_OFF       0
240#define HCI_SETUP_ESCO_TX_BW_OFF        2
241#define HCI_SETUP_ESCO_RX_BW_OFF        6
242#define HCI_SETUP_ESCO_MAX_LAT_OFF      10
243#define HCI_SETUP_ESCO_VOICE_OFF        12
244#define HCI_SETUP_ESCO_RETRAN_EFF_OFF   14
245#define HCI_SETUP_ESCO_PKT_TYPES_OFF    15
246
247
248extern void btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr,
249                                            uint32_t tx_bw, uint32_t rx_bw,
250                                            uint16_t max_latency,
251                                            uint16_t content_fmt,
252                                            uint8_t retrans_effort,
253                                            uint16_t packet_types);
254#define HCIC_PARAM_SIZE_ACCEPT_ESCO     21
255
256#define HCI_ACCEPT_ESCO_BDADDR_OFF      0
257#define HCI_ACCEPT_ESCO_TX_BW_OFF       6
258#define HCI_ACCEPT_ESCO_RX_BW_OFF       10
259#define HCI_ACCEPT_ESCO_MAX_LAT_OFF     14
260#define HCI_ACCEPT_ESCO_VOICE_OFF       16
261#define HCI_ACCEPT_ESCO_RETRAN_EFF_OFF  18
262#define HCI_ACCEPT_ESCO_PKT_TYPES_OFF   19
263
264
265extern void btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, uint8_t reason);
266#define HCIC_PARAM_SIZE_REJECT_ESCO     7
267
268#define HCI_REJECT_ESCO_BDADDR_OFF      0
269#define HCI_REJECT_ESCO_REASON_OFF      6
270
271/* Hold Mode */
272extern void btsnd_hcic_hold_mode(uint16_t handle, uint16_t max_hold_period,
273                                    uint16_t min_hold_period);
274
275#define HCIC_PARAM_SIZE_HOLD_MODE       6
276
277#define HCI_HOLD_MODE_HANDLE_OFF        0
278#define HCI_HOLD_MODE_MAX_PER_OFF       2
279#define HCI_HOLD_MODE_MIN_PER_OFF       4
280                                                                    /* Hold Mode */
281
282                                                                    /* Sniff Mode */
283extern void btsnd_hcic_sniff_mode(uint16_t handle,
284                                     uint16_t max_sniff_period,
285                                     uint16_t min_sniff_period,
286                                     uint16_t sniff_attempt,
287                                     uint16_t sniff_timeout);
288
289#define HCIC_PARAM_SIZE_SNIFF_MODE      10
290
291
292#define HCI_SNIFF_MODE_HANDLE_OFF       0
293#define HCI_SNIFF_MODE_MAX_PER_OFF      2
294#define HCI_SNIFF_MODE_MIN_PER_OFF      4
295#define HCI_SNIFF_MODE_ATTEMPT_OFF      6
296#define HCI_SNIFF_MODE_TIMEOUT_OFF      8
297                                                                    /* Sniff Mode */
298
299extern void btsnd_hcic_exit_sniff_mode(uint16_t handle);       /* Exit Sniff Mode */
300
301                                                                    /* Park Mode */
302extern void btsnd_hcic_park_mode (uint16_t handle,
303                                     uint16_t beacon_max_interval,
304                                     uint16_t beacon_min_interval);
305
306#define HCIC_PARAM_SIZE_PARK_MODE       6
307
308#define HCI_PARK_MODE_HANDLE_OFF        0
309#define HCI_PARK_MODE_MAX_PER_OFF       2
310#define HCI_PARK_MODE_MIN_PER_OFF       4
311                                                                    /* Park Mode */
312
313extern void btsnd_hcic_exit_park_mode(uint16_t handle);  /* Exit Park Mode */
314
315                                                                    /* QoS Setup */
316extern void btsnd_hcic_qos_setup (uint16_t handle, uint8_t flags,
317                                     uint8_t service_type,
318                                     uint32_t token_rate, uint32_t peak,
319                                     uint32_t latency, uint32_t delay_var);
320
321#define HCIC_PARAM_SIZE_QOS_SETUP       20
322
323#define HCI_QOS_HANDLE_OFF              0
324#define HCI_QOS_FLAGS_OFF               2
325#define HCI_QOS_SERVICE_TYPE_OFF        3
326#define HCI_QOS_TOKEN_RATE_OFF          4
327#define HCI_QOS_PEAK_BANDWIDTH_OFF      8
328#define HCI_QOS_LATENCY_OFF             12
329#define HCI_QOS_DELAY_VAR_OFF           16
330                                                                    /* QoS Setup */
331
332                                                                    /* Switch Role Request */
333extern void btsnd_hcic_switch_role (BD_ADDR bd_addr, uint8_t role);
334
335#define HCIC_PARAM_SIZE_SWITCH_ROLE  7
336
337#define HCI_SWITCH_BD_ADDR_OFF          0
338#define HCI_SWITCH_ROLE_OFF             6
339                                                                    /* Switch Role Request */
340
341                                                                    /* Write Policy Settings */
342extern void btsnd_hcic_write_policy_set(uint16_t handle, uint16_t settings);
343
344#define HCIC_PARAM_SIZE_WRITE_POLICY_SET     4
345
346#define HCI_WRITE_POLICY_HANDLE_OFF          0
347#define HCI_WRITE_POLICY_SETTINGS_OFF        2
348                                                                    /* Write Policy Settings */
349
350                                                                    /* Write Default Policy Settings */
351extern void btsnd_hcic_write_def_policy_set(uint16_t settings);
352
353#define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET     2
354
355#define HCI_WRITE_DEF_POLICY_SETTINGS_OFF        0
356                                                                    /* Write Default Policy Settings */
357
358/******************************************
359**    Lisbon Features
360*******************************************/
361#if (BTM_SSR_INCLUDED == TRUE)
362                                                                    /* Sniff Subrating */
363extern void btsnd_hcic_sniff_sub_rate(uint16_t handle, uint16_t max_lat,
364                                         uint16_t min_remote_lat,
365                                         uint16_t min_local_lat);
366
367#define HCIC_PARAM_SIZE_SNIFF_SUB_RATE             8
368
369#define HCI_SNIFF_SUB_RATE_HANDLE_OFF              0
370#define HCI_SNIFF_SUB_RATE_MAX_LAT_OFF             2
371#define HCI_SNIFF_SUB_RATE_MIN_REM_LAT_OFF         4
372#define HCI_SNIFF_SUB_RATE_MIN_LOC_LAT_OFF         6
373                                                                    /* Sniff Subrating */
374
375#else   /* BTM_SSR_INCLUDED == FALSE */
376
377#define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) false
378
379#endif  /* BTM_SSR_INCLUDED */
380
381                                                                    /* Extended Inquiry Response */
382extern void btsnd_hcic_write_ext_inquiry_response(void *buffer, uint8_t fec_req);
383
384#define HCIC_PARAM_SIZE_EXT_INQ_RESP        241
385
386#define HCIC_EXT_INQ_RESP_FEC_OFF     0
387#define HCIC_EXT_INQ_RESP_RESPONSE    1
388                                                                   /* IO Capabilities Response */
389extern void btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, uint8_t capability,
390                                            uint8_t oob_present, uint8_t auth_req);
391
392#define HCIC_PARAM_SIZE_IO_CAP_RESP     9
393
394#define HCI_IO_CAP_BD_ADDR_OFF          0
395#define HCI_IO_CAPABILITY_OFF           6
396#define HCI_IO_CAP_OOB_DATA_OFF         7
397#define HCI_IO_CAP_AUTH_REQ_OFF         8
398
399                                                                    /* IO Capabilities Req Neg Reply */
400extern void btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, uint8_t err_code);
401
402#define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7
403
404#define HCI_IO_CAP_NR_BD_ADDR_OFF        0
405#define HCI_IO_CAP_NR_ERR_CODE           6
406
407                                                         /* Read Local OOB Data */
408extern void btsnd_hcic_read_local_oob_data (void);
409
410#define HCIC_PARAM_SIZE_R_LOCAL_OOB     0
411
412
413extern void btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, bool    is_yes);
414
415#define HCIC_PARAM_SIZE_UCONF_REPLY     6
416
417#define HCI_USER_CONF_BD_ADDR_OFF       0
418
419
420extern void btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, uint32_t value);
421
422#define HCIC_PARAM_SIZE_U_PKEY_REPLY    10
423
424#define HCI_USER_PASSKEY_BD_ADDR_OFF    0
425#define HCI_USER_PASSKEY_VALUE_OFF      6
426
427
428extern void btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr);
429
430#define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6
431
432#define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0
433
434                                                            /* Remote OOB Data Request Reply */
435extern void btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, uint8_t *p_c,
436                                         uint8_t *p_r);
437
438#define HCIC_PARAM_SIZE_REM_OOB_REPLY   38
439
440#define HCI_REM_OOB_DATA_BD_ADDR_OFF    0
441#define HCI_REM_OOB_DATA_C_OFF          6
442#define HCI_REM_OOB_DATA_R_OFF          22
443
444                                                            /* Remote OOB Data Request Negative Reply */
445extern void btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr);
446
447#define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY   6
448
449#define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF    0
450
451                                                            /* Read Tx Power Level */
452extern void btsnd_hcic_read_inq_tx_power (void);
453
454#define HCIC_PARAM_SIZE_R_TX_POWER      0
455
456                                                            /* Read Default Erroneous Data Reporting */
457extern void btsnd_hcic_read_default_erroneous_data_rpt (void);
458
459#define HCIC_PARAM_SIZE_R_ERR_DATA_RPT      0
460
461#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
462extern void btsnd_hcic_enhanced_flush (uint16_t handle, uint8_t packet_type);
463
464#define HCIC_PARAM_SIZE_ENHANCED_FLUSH  3
465#endif
466
467
468extern void btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, uint8_t notif);
469
470#define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF    7
471
472#define HCI_SEND_KEYPRESS_NOTIF_BD_ADDR_OFF    0
473#define HCI_SEND_KEYPRESS_NOTIF_NOTIF_OFF      6
474
475/**** end of Simple Pairing Commands ****/
476
477                                                                    /* Store Current Settings */
478#define MAX_FILT_COND   (sizeof (BD_ADDR) + 1)
479
480extern void btsnd_hcic_set_event_filter(uint8_t filt_type,
481                                           uint8_t filt_cond_type,
482                                           uint8_t *filt_cond,
483                                           uint8_t filt_cond_len);
484
485#define HCIC_PARAM_SIZE_SET_EVT_FILTER  9
486
487#define HCI_FILT_COND_FILT_TYPE_OFF     0
488#define HCI_FILT_COND_COND_TYPE_OFF     1
489#define HCI_FILT_COND_FILT_OFF          2
490                                                                    /* Set Event Filter */
491
492                                                                /* Delete Stored Key */
493extern void btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, bool    delete_all_flag);
494
495#define HCIC_PARAM_SIZE_DELETE_STORED_KEY        7
496
497#define HCI_DELETE_KEY_BD_ADDR_OFF      0
498#define HCI_DELETE_KEY_ALL_FLAG_OFF     6
499                                                                /* Delete Stored Key */
500
501                                                                /* Change Local Name */
502extern void btsnd_hcic_change_name(BD_NAME name);
503
504#define HCIC_PARAM_SIZE_CHANGE_NAME     BD_NAME_LEN
505
506#define HCI_CHANGE_NAME_NAME_OFF        0
507                                                                /* Change Local Name */
508
509
510#define HCIC_PARAM_SIZE_READ_CMD     0
511
512#define HCIC_PARAM_SIZE_WRITE_PARAM1     1
513
514#define HCIC_WRITE_PARAM1_PARAM_OFF      0
515
516#define HCIC_PARAM_SIZE_WRITE_PARAM2     2
517
518#define HCIC_WRITE_PARAM2_PARAM_OFF      0
519
520#define HCIC_PARAM_SIZE_WRITE_PARAM3     3
521
522#define HCIC_WRITE_PARAM3_PARAM_OFF      0
523
524#define HCIC_PARAM_SIZE_SET_AFH_CHANNELS    10
525
526extern void btsnd_hcic_write_pin_type(uint8_t type);                   /* Write PIN Type */
527extern void btsnd_hcic_write_auto_accept(uint8_t flag);                /* Write Auto Accept */
528extern void btsnd_hcic_read_name (void);                             /* Read Local Name */
529extern void btsnd_hcic_write_page_tout(uint16_t timeout);              /* Write Page Timout */
530extern void btsnd_hcic_write_scan_enable(uint8_t flag);                /* Write Scan Enable */
531extern void btsnd_hcic_write_pagescan_cfg(uint16_t interval,
532                                             uint16_t window);            /* Write Page Scan Activity */
533
534#define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG  4
535
536#define HCI_SCAN_CFG_INTERVAL_OFF       0
537#define HCI_SCAN_CFG_WINDOW_OFF         2
538                                                                /* Write Page Scan Activity */
539
540                                                                /* Write Inquiry Scan Activity */
541extern void btsnd_hcic_write_inqscan_cfg(uint16_t interval, uint16_t window);
542
543#define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG    4
544
545#define HCI_SCAN_CFG_INTERVAL_OFF       0
546#define HCI_SCAN_CFG_WINDOW_OFF         2
547                                                                /* Write Inquiry Scan Activity */
548
549extern void btsnd_hcic_write_auth_enable(uint8_t flag);                 /* Write Authentication Enable */
550extern void btsnd_hcic_write_dev_class(DEV_CLASS dev);                /* Write Class of Device */
551extern void btsnd_hcic_write_voice_settings(uint16_t flags);            /* Write Voice Settings */
552
553/* Host Controller to Host flow control */
554#define HCI_HOST_FLOW_CTRL_OFF          0
555#define HCI_HOST_FLOW_CTRL_ACL_ON       1
556#define HCI_HOST_FLOW_CTRL_SCO_ON       2
557#define HCI_HOST_FLOW_CTRL_BOTH_ON      3
558
559extern void btsnd_hcic_write_auto_flush_tout(uint16_t handle,
560                                                uint16_t timeout);    /* Write Retransmit Timout */
561
562#define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT    4
563
564#define HCI_FLUSH_TOUT_HANDLE_OFF       0
565#define HCI_FLUSH_TOUT_TOUT_OFF         2
566
567extern void btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type);     /* Read Tx Power */
568
569#define HCIC_PARAM_SIZE_READ_TX_POWER    3
570
571#define HCI_READ_TX_POWER_HANDLE_OFF    0
572#define HCI_READ_TX_POWER_TYPE_OFF      2
573
574/* Read transmit power level parameter */
575#define HCI_READ_CURRENT                0x00
576#define HCI_READ_MAXIMUM                0x01
577
578extern void btsnd_hcic_host_num_xmitted_pkts (uint8_t num_handles,
579                                                 uint16_t *handle,
580                                                 uint16_t *num_pkts);         /* Set Host Buffer Size */
581
582#define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE    sizeof(btmsg_hcic_num_pkts_done_t)
583
584#define MAX_DATA_HANDLES        10
585
586#define HCI_PKTS_DONE_NUM_HANDLES_OFF   0
587#define HCI_PKTS_DONE_HANDLE_OFF        1
588#define HCI_PKTS_DONE_NUM_PKTS_OFF      3
589
590                                                                /* Write Link Supervision Timeout */
591extern void btsnd_hcic_write_link_super_tout(uint8_t local_controller_id, uint16_t handle, uint16_t timeout);
592
593#define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT        4
594
595#define HCI_LINK_SUPER_TOUT_HANDLE_OFF  0
596#define HCI_LINK_SUPER_TOUT_TOUT_OFF    2
597                                                                /* Write Link Supervision Timeout */
598
599extern void btsnd_hcic_write_cur_iac_lap (uint8_t num_cur_iac,
600                                             LAP * const iac_lap);  /* Write Current IAC LAP */
601
602#define MAX_IAC_LAPS    0x40
603
604#define HCI_WRITE_IAC_LAP_NUM_OFF       0
605#define HCI_WRITE_IAC_LAP_LAP_OFF       1
606                                                                /* Write Current IAC LAP */
607
608extern void btsnd_hcic_get_link_quality (uint16_t handle);            /* Get Link Quality */
609extern void btsnd_hcic_read_rssi (uint16_t handle);                   /* Read RSSI */
610extern void btsnd_hcic_enable_test_mode (void);                     /* Enable Device Under Test Mode */
611extern void btsnd_hcic_write_pagescan_type(uint8_t type);             /* Write Page Scan Type */
612extern void btsnd_hcic_write_inqscan_type(uint8_t type);              /* Write Inquiry Scan Type */
613extern void btsnd_hcic_write_inquiry_mode(uint8_t type);              /* Write Inquiry Mode */
614
615#define HCI_DATA_HANDLE_MASK 0x0FFF
616
617#define HCID_GET_HANDLE_EVENT(p)  (uint16_t)((*((uint8_t *)((p) + 1) + (p)->offset) + \
618                                           (*((uint8_t *)((p) + 1) + (p)->offset + 1) << 8)))
619
620#define HCID_GET_HANDLE(u16) (uint16_t)((u16) & HCI_DATA_HANDLE_MASK)
621
622#define HCI_DATA_EVENT_MASK   3
623#define HCI_DATA_EVENT_OFFSET 12
624#define HCID_GET_EVENT(u16)   (uint8_t)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
625
626#define HCI_DATA_BCAST_MASK   3
627#define HCI_DATA_BCAST_OFFSET 10
628#define HCID_GET_BCAST(u16)   (uint8_t)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
629
630#define HCID_GET_ACL_LEN(p)     (uint16_t)((*((uint8_t *)((p) + 1) + (p)->offset + 2) + \
631                                         (*((uint8_t *)((p) + 1) + (p)->offset + 3) << 8)))
632
633#define HCID_HEADER_SIZE      4
634
635#define HCID_GET_SCO_LEN(p)  (*((uint8_t *)((p) + 1) + (p)->offset + 2))
636
637extern void btsnd_hcic_vendor_spec_cmd (void *buffer, uint16_t opcode,
638                                        uint8_t len, uint8_t *p_data,
639                                        void *p_cmd_cplt_cback);
640
641#if (BLE_INCLUDED == TRUE)
642/********************************************************************************
643** BLE Commands
644**      Note: "local_controller_id" is for transport, not counted in HCI message size
645*********************************************************************************/
646#define HCIC_BLE_RAND_DI_SIZE                   8
647#define HCIC_BLE_ENCRYT_KEY_SIZE                16
648#define HCIC_BLE_IRK_SIZE                       16
649
650#define HCIC_PARAM_SIZE_SET_USED_FEAT_CMD       8
651#define HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD    6
652#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS    15
653#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP      31
654#define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE        1
655#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM    7
656#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE   2
657#define HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN      25
658#define HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL  0
659#define HCIC_PARAM_SIZE_CLEAR_WHITE_LIST        0
660#define HCIC_PARAM_SIZE_ADD_WHITE_LIST          7
661#define HCIC_PARAM_SIZE_REMOVE_WHITE_LIST       7
662#define HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS  14
663#define HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS     5
664#define HCIC_PARAM_SIZE_READ_CHNL_MAP         2
665#define HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT    2
666#define HCIC_PARAM_SIZE_BLE_ENCRYPT             32
667#define HCIC_PARAM_SIZE_BLE_RAND                0
668#define HCIC_PARAM_SIZE_WRITE_LE_HOST_SUPPORTED 2
669
670#define HCIC_BLE_RAND_DI_SIZE                   8
671#define HCIC_BLE_ENCRYT_KEY_SIZE                16
672#define HCIC_PARAM_SIZE_BLE_START_ENC           (4 + HCIC_BLE_RAND_DI_SIZE + HCIC_BLE_ENCRYT_KEY_SIZE)
673#define HCIC_PARAM_SIZE_LTK_REQ_REPLY           (2 + HCIC_BLE_ENCRYT_KEY_SIZE)
674#define HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY       2
675#define HCIC_BLE_CHNL_MAP_SIZE                  5
676#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA      31
677
678#define HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST      (7 + HCIC_BLE_IRK_SIZE * 2)
679#define HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST       7
680#define HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST        0
681#define HCIC_PARAM_SIZE_BLE_READ_RESOLVING_LIST_SIZE    0
682#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER   7
683#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_LOCAL  7
684#define HCIC_PARAM_SIZE_BLE_SET_ADDR_RESOLUTION_ENABLE  1
685#define HCIC_PARAM_SIZE_BLE_SET_RAND_PRIV_ADDR_TIMOUT   2
686#define HCIC_PARAM_SIZE_BLE_SET_DATA_LENGTH             6
687#define HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM  11
688
689/* ULP HCI command */
690extern void btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
691
692extern void btsnd_hcic_ble_read_buffer_size (void);
693
694extern void btsnd_hcic_ble_read_local_spt_feat (void);
695
696extern void btsnd_hcic_ble_set_local_used_feat (uint8_t feat_set[8]);
697
698extern void btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
699
700extern void btsnd_hcic_ble_write_adv_params (uint16_t adv_int_min, uint16_t adv_int_max,
701                                                uint8_t adv_type, uint8_t addr_type_own,
702                                                uint8_t addr_type_dir, BD_ADDR direct_bda,
703                                                uint8_t channel_map, uint8_t adv_filter_policy);
704
705extern void btsnd_hcic_ble_read_adv_chnl_tx_power (void);
706
707extern void btsnd_hcic_ble_set_adv_data (uint8_t data_len, uint8_t *p_data);
708
709extern void btsnd_hcic_ble_set_scan_rsp_data (uint8_t data_len, uint8_t *p_scan_rsp);
710
711extern void btsnd_hcic_ble_set_adv_enable (uint8_t adv_enable);
712
713extern void btsnd_hcic_ble_set_scan_params (uint8_t scan_type,
714                                               uint16_t scan_int, uint16_t scan_win,
715                                               uint8_t addr_type, uint8_t scan_filter_policy);
716
717extern void btsnd_hcic_ble_set_scan_enable (uint8_t scan_enable, uint8_t duplicate);
718
719extern void btsnd_hcic_ble_create_ll_conn (uint16_t scan_int, uint16_t scan_win,
720                                              uint8_t init_filter_policy, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t addr_type_own,
721                                              uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout,
722                                              uint16_t min_ce_len, uint16_t max_ce_len);
723
724extern void btsnd_hcic_ble_create_conn_cancel (void);
725
726extern void btsnd_hcic_ble_read_white_list_size (void);
727
728extern void btsnd_hcic_ble_clear_white_list (void);
729
730extern void btsnd_hcic_ble_add_white_list (uint8_t addr_type, BD_ADDR bda);
731
732extern void btsnd_hcic_ble_remove_from_white_list (uint8_t addr_type, BD_ADDR bda);
733
734extern void btsnd_hcic_ble_upd_ll_conn_params (uint16_t handle, uint16_t conn_int_min, uint16_t conn_int_max,
735                                                  uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_len, uint16_t max_len);
736
737extern void btsnd_hcic_ble_set_host_chnl_class (uint8_t chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
738
739extern void btsnd_hcic_ble_read_chnl_map (uint16_t handle);
740
741extern void btsnd_hcic_ble_read_remote_feat ( uint16_t handle);
742
743extern void btsnd_hcic_ble_encrypt (uint8_t* key, uint8_t key_len, uint8_t* plain_text, uint8_t pt_len, void *p_cmd_cplt_cback);
744
745extern void btsnd_hcic_ble_rand (void *p_cmd_cplt_cback);
746
747extern void btsnd_hcic_ble_start_enc ( uint16_t handle,
748                                          uint8_t rand[HCIC_BLE_RAND_DI_SIZE],
749                                          uint16_t ediv, uint8_t ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
750
751extern void btsnd_hcic_ble_ltk_req_reply (uint16_t handle, uint8_t ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
752
753extern void btsnd_hcic_ble_ltk_req_neg_reply (uint16_t handle);
754
755extern void btsnd_hcic_ble_read_supported_states (void);
756
757extern void btsnd_hcic_ble_write_host_supported (uint8_t le_host_spt, uint8_t simul_le_host_spt);
758
759extern void btsnd_hcic_ble_read_host_supported (void);
760
761extern void btsnd_hcic_ble_receiver_test(uint8_t rx_freq);
762
763extern void btsnd_hcic_ble_transmitter_test(uint8_t tx_freq, uint8_t test_data_len,
764                                               uint8_t payload);
765extern void btsnd_hcic_ble_test_end(void);
766
767#if (BLE_LLT_INCLUDED == TRUE)
768
769#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY           14
770extern void btsnd_hcic_ble_rc_param_req_reply(uint16_t handle,
771                                                 uint16_t conn_int_min, uint16_t conn_int_max,
772                                                 uint16_t conn_latency, uint16_t conn_timeout,
773                                                 uint16_t min_ce_len, uint16_t max_ce_len);
774
775#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY       3
776extern void btsnd_hcic_ble_rc_param_req_neg_reply(uint16_t handle, uint8_t reason);
777
778#endif /* BLE_LLT_INCLUDED */
779
780extern void btsnd_hcic_ble_set_data_length(uint16_t conn_handle, uint16_t tx_octets,
781                                                      uint16_t tx_time);
782
783extern void btsnd_hcic_ble_add_device_resolving_list (uint8_t addr_type_peer,
784                                                               BD_ADDR bda_peer,
785                                                               uint8_t irk_peer[HCIC_BLE_IRK_SIZE],
786                                                               uint8_t irk_local[HCIC_BLE_IRK_SIZE]);
787
788extern void btsnd_hcic_ble_rm_device_resolving_list (uint8_t addr_type_peer,
789                                                                BD_ADDR bda_peer);
790
791extern void btsnd_hcic_ble_clear_resolving_list (void);
792
793extern void btsnd_hcic_ble_read_resolvable_addr_peer (uint8_t addr_type_peer,
794                                                                 BD_ADDR bda_peer);
795
796extern void btsnd_hcic_ble_read_resolvable_addr_local (uint8_t addr_type_peer,
797                                                                 BD_ADDR bda_peer);
798
799extern void btsnd_hcic_ble_set_addr_resolution_enable (uint8_t addr_resolution_enable);
800
801extern void btsnd_hcic_ble_set_rand_priv_addr_timeout (uint16_t rpa_timout);
802
803#endif /* BLE_INCLUDED */
804
805extern void btsnd_hcic_read_authenticated_payload_tout(uint16_t handle);
806
807extern void btsnd_hcic_write_authenticated_payload_tout(uint16_t handle,
808                                                                   uint16_t timeout);
809
810#define HCIC_PARAM_SIZE_WRITE_AUTHENT_PAYLOAD_TOUT  4
811
812#define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_HANDLE_OFF  0
813#define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_TOUT_OFF    2
814
815#ifdef __cplusplus
816}
817#endif
818
819#endif
820