NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
hcimsgs.h
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
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* Message by message.... */
32
33#define HCIC_GET_UINT8(p, off) (UINT8)(*((UINT8 *)((p) + 1) + p->offset + 3 + (off)))
34
35#define HCIC_GET_UINT16(p, off) (UINT16)((*((UINT8 *)((p) + 1) + p->offset + 3 + (off)) + \
36 (*((UINT8 *)((p) + 1) + p->offset + 3 + (off) + 1) << 8)))
37
38#define HCIC_GET_UINT32(p, off) (UINT32)((*((UINT8 *)((p) + 1) + p->offset + 3 + (off)) + \
39 (*((UINT8 *)((p) + 1) + p->offset + 3 + (off) + 1) << 8) + \
40 (*((UINT8 *)((p) + 1) + p->offset + 3 + (off) + 2) << 16) + \
41 (*((UINT8 *)((p) + 1) + p->offset + 3 + (off) + 3) << 24)))
42
43#define HCIC_GET_ARRAY(p, off, x, len) \
44{ \
45 UINT8 *qq = ((UINT8 *)((p) + 1) + p->offset + 3 + (off)); UINT8 *rr = (UINT8 *)x; \
46 int ii; for (ii = 0; ii < len; ii++) *rr++ = *qq++; \
47}
48
49#define HCIC_GET_ARRAY16(p, off, x) \
50{ \
51 UINT8 *qq = ((UINT8 *)((p) + 1) + p->offset + 3 + (off)); UINT8 *rr = (UINT8 *)x + 15; \
52 int ii; for (ii = 0; ii < 16; ii++) *rr-- = *qq++; \
53}
54
55#define HCIC_GET_BDADDR(p, off, x) \
56{ \
57 UINT8 *qq = ((UINT8 *)((p) + 1) + p->offset + 3 + (off)); UINT8 *rr = (UINT8 *)x + BD_ADDR_LEN - 1; \
58 int ii; for (ii = 0; ii < BD_ADDR_LEN; ii++) *rr-- = *qq++; \
59}
60
61#define HCIC_GET_DEVCLASS(p, off, x) \
62{ \
63 UINT8 *qq = ((UINT8 *)((p) + 1) + p->offset + 3 + (off)); UINT8 *rr = (UINT8 *)x + DEV_CLASS_LEN - 1; \
64 int ii; for (ii = 0; ii < DEV_CLASS_LEN; ii++) *rr-- = *qq++; \
65}
66
67#define HCIC_GET_LAP(p, off, x) \
68{ \
69 UINT8 *qq = ((UINT8 *)((p) + 1) + p->offset + 3 + (off)); UINT8 *rr = (UINT8 *)x + LAP_LEN - 1; \
70 int ii; for (ii = 0; ii < LAP_LEN; ii++) *rr-- = *qq++; \
71}
72
73#define HCIC_GET_POINTER(p, off) ((UINT8 *)((p) + 1) + p->offset + 3 + (off))
74
75
76HCI_API extern BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration,
77 UINT8 response_cnt);
78
79#define HCIC_PARAM_SIZE_INQUIRY 5
80
81
82#define HCIC_INQ_INQ_LAP_OFF 0
83#define HCIC_INQ_DUR_OFF 3
84#define HCIC_INQ_RSP_CNT_OFF 4
85 /* Inquiry */
86
87 /* Inquiry Cancel */
88HCI_API extern BOOLEAN btsnd_hcic_inq_cancel(void);
89
90#define HCIC_PARAM_SIZE_INQ_CANCEL 0
91
92 /* Periodic Inquiry Mode */
93HCI_API extern BOOLEAN btsnd_hcic_per_inq_mode(UINT16 max_period, UINT16 min_period,
94 const LAP inq_lap, UINT8 duration,
95 UINT8 response_cnt);
96
97#define HCIC_PARAM_SIZE_PER_INQ_MODE 9
98
99#define HCI_PER_INQ_MAX_INTRVL_OFF 0
100#define HCI_PER_INQ_MIN_INTRVL_OFF 2
101#define HCI_PER_INQ_INQ_LAP_OFF 4
102#define HCI_PER_INQ_DURATION_OFF 7
103#define HCI_PER_INQ_RSP_CNT_OFF 8
104 /* Periodic Inquiry Mode */
105
106 /* Exit Periodic Inquiry Mode */
107HCI_API extern BOOLEAN btsnd_hcic_exit_per_inq(void);
108
109#define HCIC_PARAM_SIZE_EXIT_PER_INQ 0
110 /* Create Connection */
111HCI_API extern BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types,
112 UINT8 page_scan_rep_mode,
113 UINT8 page_scan_mode,
114 UINT16 clock_offset,
115 UINT8 allow_switch);
116
117#define HCIC_PARAM_SIZE_CREATE_CONN 13
118
119#define HCIC_CR_CONN_BD_ADDR_OFF 0
120#define HCIC_CR_CONN_PKT_TYPES_OFF 6
121#define HCIC_CR_CONN_REP_MODE_OFF 8
122#define HCIC_CR_CONN_PAGE_SCAN_MODE_OFF 9
123#define HCIC_CR_CONN_CLK_OFF_OFF 10
124#define HCIC_CR_CONN_ALLOW_SWITCH_OFF 12
125 /* Create Connection */
126
127 /* Disconnect */
128HCI_API extern BOOLEAN btsnd_hcic_disconnect(UINT16 handle, UINT8 reason);
129
130#define HCIC_PARAM_SIZE_DISCONNECT 3
131
132#define HCI_DISC_HANDLE_OFF 0
133#define HCI_DISC_REASON_OFF 2
134 /* Disconnect */
135
136#if BTM_SCO_INCLUDED == TRUE
137 /* Add SCO Connection */
138HCI_API extern BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types);
139#endif /* BTM_SCO_INCLUDED */
140
141#define HCIC_PARAM_SIZE_ADD_SCO_CONN 4
142
143#define HCI_ADD_SCO_HANDLE_OFF 0
144#define HCI_ADD_SCO_PACKET_TYPES_OFF 2
145 /* Add SCO Connection */
146
147 /* Create Connection Cancel */
148HCI_API extern BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest);
149
150#define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL 6
151
152#define HCIC_CR_CONN_CANCEL_BD_ADDR_OFF 0
153 /* Create Connection Cancel */
154
155 /* Accept Connection Request */
156HCI_API extern BOOLEAN btsnd_hcic_accept_conn (BD_ADDR bd_addr, UINT8 role);
157
158#define HCIC_PARAM_SIZE_ACCEPT_CONN 7
159
160#define HCI_ACC_CONN_BD_ADDR_OFF 0
161#define HCI_ACC_CONN_ROLE_OFF 6
162 /* Accept Connection Request */
163
164 /* Reject Connection Request */
165HCI_API extern BOOLEAN btsnd_hcic_reject_conn (BD_ADDR bd_addr, UINT8 reason);
166
167#define HCIC_PARAM_SIZE_REJECT_CONN 7
168
169#define HCI_REJ_CONN_BD_ADDR_OFF 0
170#define HCI_REJ_CONN_REASON_OFF 6
171 /* Reject Connection Request */
172
173 /* Link Key Request Reply */
174HCI_API extern BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr,
175 LINK_KEY link_key);
176
177#define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY 22
178
179#define HCI_LINK_KEY_REPLY_BD_ADDR_OFF 0
180#define HCI_LINK_KEY_REPLY_LINK_KEY_OFF 6
181 /* Link Key Request Reply */
182
183 /* Link Key Request Neg Reply */
184HCI_API extern BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr);
185
186#define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY 6
187
188#define HCI_LINK_KEY_NEG_REP_BD_ADR_OFF 0
189 /* Link Key Request Neg Reply */
190
191 /* PIN Code Request Reply */
192HCI_API extern BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr,
193 UINT8 pin_code_len,
194 PIN_CODE pin_code);
195
196#define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY 23
197
198#define HCI_PIN_CODE_REPLY_BD_ADDR_OFF 0
199#define HCI_PIN_CODE_REPLY_PIN_LEN_OFF 6
200#define HCI_PIN_CODE_REPLY_PIN_CODE_OFF 7
201 /* PIN Code Request Reply */
202
203 /* Link Key Request Neg Reply */
204HCI_API extern BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr);
205
206#define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY 6
207
208#define HCI_PIN_CODE_NEG_REP_BD_ADR_OFF 0
209 /* Link Key Request Neg Reply */
210
211 /* Change Connection Type */
212HCI_API extern BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types);
213
214#define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE 4
215
216#define HCI_CHNG_PKT_TYPE_HANDLE_OFF 0
217#define HCI_CHNG_PKT_TYPE_PKT_TYPE_OFF 2
218 /* Change Connection Type */
219
220#define HCIC_PARAM_SIZE_CMD_HANDLE 2
221
222#define HCI_CMD_HANDLE_HANDLE_OFF 0
223
224HCI_API extern BOOLEAN btsnd_hcic_auth_request (UINT16 handle); /* Authentication Request */
225
226 /* Set Connection Encryption */
227HCI_API extern BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable);
228#define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT 3
229
230
231#define HCI_SET_ENCRYPT_HANDLE_OFF 0
232#define HCI_SET_ENCRYPT_ENABLE_OFF 2
233 /* Set Connection Encryption */
234
235HCI_API extern BOOLEAN btsnd_hcic_change_link_key (UINT16 handle); /* Change Connection Link Key */
236
237 /* Master Link Key */
238HCI_API extern BOOLEAN btsnd_hcic_master_link_key (BOOLEAN key_flag);
239
240#define HCIC_PARAM_SIZE_MASTER_LINK_KEY 1
241
242#define HCI_MASTER_KEY_FLAG_OFF 0
243 /* Master Link Key */
244
245 /* Remote Name Request */
246HCI_API extern BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr,
247 UINT8 page_scan_rep_mode,
248 UINT8 page_scan_mode,
249 UINT16 clock_offset);
250
251#define HCIC_PARAM_SIZE_RMT_NAME_REQ 10
252
253#define HCI_RMT_NAME_BD_ADDR_OFF 0
254#define HCI_RMT_NAME_REP_MODE_OFF 6
255#define HCI_RMT_NAME_PAGE_SCAN_MODE_OFF 7
256#define HCI_RMT_NAME_CLK_OFF_OFF 8
257 /* Remote Name Request */
258
259 /* Remote Name Request Cancel */
260HCI_API extern BOOLEAN btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr);
261
262#define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL 6
263
264#define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF 0
265 /* Remote Name Request Cancel */
266
267HCI_API extern BOOLEAN btsnd_hcic_rmt_features_req(UINT16 handle); /* Remote Features Request */
268
269 /* Remote Extended Features */
270HCI_API extern BOOLEAN btsnd_hcic_rmt_ext_features(UINT16 handle, UINT8 page_num);
271
272#define HCIC_PARAM_SIZE_RMT_EXT_FEATURES 3
273
274#define HCI_RMT_EXT_FEATURES_HANDLE_OFF 0
275#define HCI_RMT_EXT_FEATURES_PAGE_NUM_OFF 2
276 /* Remote Extended Features */
277
278
279 /* Local Extended Features */
280HCI_API extern BOOLEAN btsnd_hcic_read_local_ext_features (UINT8 page_num);
281
282#define HCIC_PARAM_SIZE_LOCAL_EXT_FEATURES 1
283
284#define HCI_LOCAL_EXT_FEATURES_PAGE_NUM_OFF 0
285 /* Local Extended Features */
286
287
288HCI_API extern BOOLEAN btsnd_hcic_rmt_ver_req(UINT16 handle); /* Remote Version Info Request */
289HCI_API extern BOOLEAN btsnd_hcic_read_rmt_clk_offset(UINT16 handle); /* Remote Clock Offset */
290HCI_API extern BOOLEAN btsnd_hcic_read_lmp_handle(UINT16 handle); /* Remote LMP Handle */
291
292HCI_API extern BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle,
293 UINT32 tx_bw, UINT32 rx_bw,
294 UINT16 max_latency, UINT16 voice,
295 UINT8 retrans_effort,
296 UINT16 packet_types);
297#define HCIC_PARAM_SIZE_SETUP_ESCO 17
298
299#define HCI_SETUP_ESCO_HANDLE_OFF 0
300#define HCI_SETUP_ESCO_TX_BW_OFF 2
301#define HCI_SETUP_ESCO_RX_BW_OFF 6
302#define HCI_SETUP_ESCO_MAX_LAT_OFF 10
303#define HCI_SETUP_ESCO_VOICE_OFF 12
304#define HCI_SETUP_ESCO_RETRAN_EFF_OFF 14
305#define HCI_SETUP_ESCO_PKT_TYPES_OFF 15
306
307
308HCI_API extern BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr,
309 UINT32 tx_bw, UINT32 rx_bw,
310 UINT16 max_latency,
311 UINT16 content_fmt,
312 UINT8 retrans_effort,
313 UINT16 packet_types);
314#define HCIC_PARAM_SIZE_ACCEPT_ESCO 21
315
316#define HCI_ACCEPT_ESCO_BDADDR_OFF 0
317#define HCI_ACCEPT_ESCO_TX_BW_OFF 6
318#define HCI_ACCEPT_ESCO_RX_BW_OFF 10
319#define HCI_ACCEPT_ESCO_MAX_LAT_OFF 14
320#define HCI_ACCEPT_ESCO_VOICE_OFF 16
321#define HCI_ACCEPT_ESCO_RETRAN_EFF_OFF 18
322#define HCI_ACCEPT_ESCO_PKT_TYPES_OFF 19
323
324
325HCI_API extern BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason);
326#define HCIC_PARAM_SIZE_REJECT_ESCO 7
327
328#define HCI_REJECT_ESCO_BDADDR_OFF 0
329#define HCI_REJECT_ESCO_REASON_OFF 6
330
331/* Hold Mode */
332HCI_API extern BOOLEAN btsnd_hcic_hold_mode(UINT16 handle, UINT16 max_hold_period,
333 UINT16 min_hold_period);
334
335#define HCIC_PARAM_SIZE_HOLD_MODE 6
336
337#define HCI_HOLD_MODE_HANDLE_OFF 0
338#define HCI_HOLD_MODE_MAX_PER_OFF 2
339#define HCI_HOLD_MODE_MIN_PER_OFF 4
340 /* Hold Mode */
341
342 /* Sniff Mode */
343HCI_API extern BOOLEAN btsnd_hcic_sniff_mode(UINT16 handle,
344 UINT16 max_sniff_period,
345 UINT16 min_sniff_period,
346 UINT16 sniff_attempt,
347 UINT16 sniff_timeout);
348
349#define HCIC_PARAM_SIZE_SNIFF_MODE 10
350
351
352#define HCI_SNIFF_MODE_HANDLE_OFF 0
353#define HCI_SNIFF_MODE_MAX_PER_OFF 2
354#define HCI_SNIFF_MODE_MIN_PER_OFF 4
355#define HCI_SNIFF_MODE_ATTEMPT_OFF 6
356#define HCI_SNIFF_MODE_TIMEOUT_OFF 8
357 /* Sniff Mode */
358
359HCI_API extern BOOLEAN btsnd_hcic_exit_sniff_mode(UINT16 handle); /* Exit Sniff Mode */
360
361 /* Park Mode */
362HCI_API extern BOOLEAN btsnd_hcic_park_mode (UINT16 handle,
363 UINT16 beacon_max_interval,
364 UINT16 beacon_min_interval);
365
366#define HCIC_PARAM_SIZE_PARK_MODE 6
367
368#define HCI_PARK_MODE_HANDLE_OFF 0
369#define HCI_PARK_MODE_MAX_PER_OFF 2
370#define HCI_PARK_MODE_MIN_PER_OFF 4
371 /* Park Mode */
372
373HCI_API extern BOOLEAN btsnd_hcic_exit_park_mode(UINT16 handle); /* Exit Park Mode */
374
375 /* QoS Setup */
376HCI_API extern BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags,
377 UINT8 service_type,
378 UINT32 token_rate, UINT32 peak,
379 UINT32 latency, UINT32 delay_var);
380
381#define HCIC_PARAM_SIZE_QOS_SETUP 20
382
383#define HCI_QOS_HANDLE_OFF 0
384#define HCI_QOS_FLAGS_OFF 2
385#define HCI_QOS_SERVICE_TYPE_OFF 3
386#define HCI_QOS_TOKEN_RATE_OFF 4
387#define HCI_QOS_PEAK_BANDWIDTH_OFF 8
388#define HCI_QOS_LATENCY_OFF 12
389#define HCI_QOS_DELAY_VAR_OFF 16
390 /* QoS Setup */
391
392HCI_API extern BOOLEAN btsnd_hcic_role_discovery (UINT16 handle); /* Role Discovery */
393
394 /* Switch Role Request */
395HCI_API extern BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role);
396
397#define HCIC_PARAM_SIZE_SWITCH_ROLE 7
398
399#define HCI_SWITCH_BD_ADDR_OFF 0
400#define HCI_SWITCH_ROLE_OFF 6
401 /* Switch Role Request */
402
403HCI_API extern BOOLEAN btsnd_hcic_read_policy_set(UINT16 handle); /* Read Policy Settings */
404
405 /* Write Policy Settings */
406HCI_API extern BOOLEAN btsnd_hcic_write_policy_set(UINT16 handle, UINT16 settings);
407
408#define HCIC_PARAM_SIZE_WRITE_POLICY_SET 4
409
410#define HCI_WRITE_POLICY_HANDLE_OFF 0
411#define HCI_WRITE_POLICY_SETTINGS_OFF 2
412 /* Write Policy Settings */
413
414 /* Read Default Policy Settings */
415HCI_API extern BOOLEAN btsnd_hcic_read_def_policy_set(void);
416
417#define HCIC_PARAM_SIZE_READ_DEF_POLICY_SET 0
418 /* Read Default Policy Settings */
419
420 /* Write Default Policy Settings */
421HCI_API extern BOOLEAN btsnd_hcic_write_def_policy_set(UINT16 settings);
422
423#define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET 2
424
425#define HCI_WRITE_DEF_POLICY_SETTINGS_OFF 0
426 /* Write Default Policy Settings */
427
428 /* Flow Specification */
429HCI_API extern BOOLEAN btsnd_hcic_flow_specification(UINT16 handle, UINT8 flags,
430 UINT8 flow_direct,
431 UINT8 service_type,
432 UINT32 token_rate,
433 UINT32 token_bucket_size,
434 UINT32 peak, UINT32 latency);
435
436#define HCIC_PARAM_SIZE_FLOW_SPEC 21
437
438#define HCI_FLOW_SPEC_HANDLE_OFF 0
439#define HCI_FLOW_SPEC_FLAGS_OFF 2
440#define HCI_FLOW_SPEC_FLOW_DIRECT_OFF 3
441#define HCI_FLOW_SPEC_SERVICE_TYPE_OFF 4
442#define HCI_FLOW_SPEC_TOKEN_RATE_OFF 5
443#define HCI_FLOW_SPEC_TOKEN_BUCKET_SIZE_OFF 9
444#define HCI_FLOW_SPEC_PEAK_BANDWIDTH_OFF 13
445#define HCI_FLOW_SPEC_LATENCY_OFF 17
446 /* Flow Specification */
447
448/******************************************
449** Lisbon Features
450*******************************************/
451#if BTM_SSR_INCLUDED == TRUE
452 /* Sniff Subrating */
453HCI_API extern BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat,
454 UINT16 min_remote_lat,
455 UINT16 min_local_lat);
456
457#define HCIC_PARAM_SIZE_SNIFF_SUB_RATE 8
458
459#define HCI_SNIFF_SUB_RATE_HANDLE_OFF 0
460#define HCI_SNIFF_SUB_RATE_MAX_LAT_OFF 2
461#define HCI_SNIFF_SUB_RATE_MIN_REM_LAT_OFF 4
462#define HCI_SNIFF_SUB_RATE_MIN_LOC_LAT_OFF 6
463 /* Sniff Subrating */
464
465#else /* BTM_SSR_INCLUDED == FALSE */
466
467#define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) FALSE
468
469#endif /* BTM_SSR_INCLUDED */
470
471 /* Extended Inquiry Response */
472#if (BTM_EIR_SERVER_INCLUDED == TRUE)
473HCI_API extern void btsnd_hcic_write_ext_inquiry_response(void *buffer, UINT8 fec_req);
474
475#define HCIC_PARAM_SIZE_EXT_INQ_RESP 241
476
477#define HCIC_EXT_INQ_RESP_FEC_OFF 0
478#define HCIC_EXT_INQ_RESP_RESPONSE 1
479
480HCI_API extern BOOLEAN btsnd_hcic_read_ext_inquiry_response(void); /* Read Extended Inquiry Response */
481#else
482#define btsnd_hcic_write_ext_inquiry_response(buffer, fec_req)
483#define btsnd_hcic_read_ext_inquiry_response() FALSE
484#endif
485 /* Write Simple Pairing Mode */
486/**** Simple Pairing Commands ****/
487HCI_API extern BOOLEAN btsnd_hcic_write_simple_pairing_mode(UINT8 mode);
488
489#define HCIC_PARAM_SIZE_W_SIMP_PAIR 1
490
491#define HCIC_WRITE_SP_MODE_OFF 0
492
493
494HCI_API extern BOOLEAN btsnd_hcic_read_simple_pairing_mode (void);
495
496#define HCIC_PARAM_SIZE_R_SIMP_PAIR 0
497
498 /* Write Simple Pairing Debug Mode */
499HCI_API extern BOOLEAN btsnd_hcic_write_simp_pair_debug_mode(UINT8 debug_mode);
500
501#define HCIC_PARAM_SIZE_SIMP_PAIR_DBUG 1
502
503#define HCIC_WRITE_SP_DBUG_MODE_OFF 0
504
505 /* IO Capabilities Response */
506HCI_API extern BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability,
507 UINT8 oob_present, UINT8 auth_req);
508
509#define HCIC_PARAM_SIZE_IO_CAP_RESP 9
510
511#define HCI_IO_CAP_BD_ADDR_OFF 0
512#define HCI_IO_CAPABILITY_OFF 6
513#define HCI_IO_CAP_OOB_DATA_OFF 7
514#define HCI_IO_CAP_AUTH_REQ_OFF 8
515
516 /* IO Capabilities Req Neg Reply */
517HCI_API extern BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code);
518
519#define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7
520
521#define HCI_IO_CAP_NR_BD_ADDR_OFF 0
522#define HCI_IO_CAP_NR_ERR_CODE 6
523
524 /* Read Local OOB Data */
525HCI_API extern BOOLEAN btsnd_hcic_read_local_oob_data (void);
526
527#define HCIC_PARAM_SIZE_R_LOCAL_OOB 0
528
529
530HCI_API extern BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes);
531
532#define HCIC_PARAM_SIZE_UCONF_REPLY 6
533
534#define HCI_USER_CONF_BD_ADDR_OFF 0
535
536
537HCI_API extern BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value);
538
539#define HCIC_PARAM_SIZE_U_PKEY_REPLY 10
540
541#define HCI_USER_PASSKEY_BD_ADDR_OFF 0
542#define HCI_USER_PASSKEY_VALUE_OFF 6
543
544
545HCI_API extern BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr);
546
547#define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6
548
549#define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0
550
551 /* Remote OOB Data Request Reply */
552HCI_API extern BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c,
553 UINT8 *p_r);
554
555#define HCIC_PARAM_SIZE_REM_OOB_REPLY 38
556
557#define HCI_REM_OOB_DATA_BD_ADDR_OFF 0
558#define HCI_REM_OOB_DATA_C_OFF 6
559#define HCI_REM_OOB_DATA_R_OFF 22
560
561 /* Remote OOB Data Request Negative Reply */
562HCI_API extern BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr);
563
564#define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY 6
565
566#define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF 0
567
568 /* Read Tx Power Level */
569HCI_API extern BOOLEAN btsnd_hcic_read_inq_tx_power (void);
570
571#define HCIC_PARAM_SIZE_R_TX_POWER 0
572
573 /* Write Tx Power Level */
574HCI_API extern BOOLEAN btsnd_hcic_write_inq_tx_power (INT8 level);
575
576#define HCIC_PARAM_SIZE_W_TX_POWER 1
577
578#define HCIC_WRITE_TX_POWER_LEVEL_OFF 0
579 /* Read Default Erroneous Data Reporting */
580HCI_API extern BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void);
581
582#define HCIC_PARAM_SIZE_R_ERR_DATA_RPT 0
583
584 /* Write Default Erroneous Data Reporting */
585HCI_API extern BOOLEAN btsnd_hcic_write_default_erroneous_data_rpt (UINT8 level);
586
587#define HCIC_PARAM_SIZE_W_ERR_DATA_RPT 1
588
589#define HCIC_WRITE_ERR_DATA_RPT_OFF 0
590
591
592#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
593HCI_API extern BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type);
594
595#define HCIC_PARAM_SIZE_ENHANCED_FLUSH 3
596#endif
597
598
599HCI_API extern BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif);
600
601#define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF 7
602
603#define HCI_SEND_KEYPRESS_NOTIF_BD_ADDR_OFF 0
604#define HCI_SEND_KEYPRESS_NOTIF_NOTIF_OFF 6
605
606
607HCI_API extern BOOLEAN btsnd_hcic_refresh_encryption_key(UINT16 handle); /* Refresh Encryption Key */
608
609/**** end of Simple Pairing Commands ****/
610
611
612HCI_API extern BOOLEAN btsnd_hcic_set_event_mask(UINT8 local_controller_id, BT_EVENT_MASK evt_mask);
613
614#define HCIC_PARAM_SIZE_SET_EVENT_MASK 8
615#define HCI_EVENT_MASK_MASK_OFF 0
616 /* Set Event Mask */
617
618 /* Reset */
619HCI_API extern BOOLEAN btsnd_hcic_set_event_mask_page_2 (UINT8 local_controller_id,
620 BT_EVENT_MASK event_mask);
621
622#define HCIC_PARAM_SIZE_SET_EVENT_MASK_PAGE_2 8
623#define HCI_EVENT_MASK_MASK_OFF 0
624 /* Set Event Mask Page 2 */
625
626 /* Reset */
627HCI_API extern BOOLEAN btsnd_hcic_reset(UINT8 local_controller_id);
628
629#define HCIC_PARAM_SIZE_RESET 0
630 /* Reset */
631
632 /* Store Current Settings */
633#define MAX_FILT_COND (sizeof (BD_ADDR) + 1)
634
635HCI_API extern BOOLEAN btsnd_hcic_set_event_filter(UINT8 filt_type,
636 UINT8 filt_cond_type,
637 UINT8 *filt_cond,
638 UINT8 filt_cond_len);
639
640#define HCIC_PARAM_SIZE_SET_EVT_FILTER 9
641
642#define HCI_FILT_COND_FILT_TYPE_OFF 0
643#define HCI_FILT_COND_COND_TYPE_OFF 1
644#define HCI_FILT_COND_FILT_OFF 2
645 /* Set Event Filter */
646
647HCI_API extern BOOLEAN btsnd_hcic_flush(UINT8 local_controller_id, UINT16 handle); /* Flush */
648
649 /* Create New Unit Type */
650HCI_API extern BOOLEAN btsnd_hcic_new_unit_key(void);
651
652#define HCIC_PARAM_SIZE_NEW_UNIT_KEY 0
653 /* Create New Unit Type */
654
655 /* Read Stored Key */
656HCI_API extern BOOLEAN btsnd_hcic_read_stored_key (BD_ADDR bd_addr,
657 BOOLEAN read_all_flag);
658
659#define HCIC_PARAM_SIZE_READ_STORED_KEY 7
660
661#define HCI_READ_KEY_BD_ADDR_OFF 0
662#define HCI_READ_KEY_ALL_FLAG_OFF 6
663 /* Read Stored Key */
664
665#define MAX_WRITE_KEYS 10
666 /* Write Stored Key */
667HCI_API extern BOOLEAN btsnd_hcic_write_stored_key (UINT8 num_keys, BD_ADDR *bd_addr,
668 LINK_KEY *link_key);
669
670#define HCIC_PARAM_SIZE_WRITE_STORED_KEY sizeof(btmsg_hcic_write_stored_key_t)
671
672#define HCI_WRITE_KEY_NUM_KEYS_OFF 0
673#define HCI_WRITE_KEY_BD_ADDR_OFF 1
674#define HCI_WRITE_KEY_KEY_OFF 7
675/* only 0x0b keys cab be sent in one HCI command */
676#define HCI_MAX_NUM_OF_LINK_KEYS_PER_CMMD 0x0b
677 /* Write Stored Key */
678
679 /* Delete Stored Key */
680HCI_API extern BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag);
681
682#define HCIC_PARAM_SIZE_DELETE_STORED_KEY 7
683
684#define HCI_DELETE_KEY_BD_ADDR_OFF 0
685#define HCI_DELETE_KEY_ALL_FLAG_OFF 6
686 /* Delete Stored Key */
687
688 /* Change Local Name */
689HCI_API extern BOOLEAN btsnd_hcic_change_name(BD_NAME name);
690
691#define HCIC_PARAM_SIZE_CHANGE_NAME BD_NAME_LEN
692
693#define HCI_CHANGE_NAME_NAME_OFF 0
694 /* Change Local Name */
695
696
697#define HCIC_PARAM_SIZE_READ_CMD 0
698
699#define HCIC_PARAM_SIZE_WRITE_PARAM1 1
700
701#define HCIC_WRITE_PARAM1_PARAM_OFF 0
702
703#define HCIC_PARAM_SIZE_WRITE_PARAM2 2
704
705#define HCIC_WRITE_PARAM2_PARAM_OFF 0
706
707#define HCIC_PARAM_SIZE_WRITE_PARAM3 3
708
709#define HCIC_WRITE_PARAM3_PARAM_OFF 0
710
711#define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10
712
713HCI_API extern BOOLEAN btsnd_hcic_read_pin_type(void); /* Read PIN Type */
714HCI_API extern BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */
715HCI_API extern BOOLEAN btsnd_hcic_read_auto_accept(void); /* Read Auto Accept */
716HCI_API extern BOOLEAN btsnd_hcic_write_auto_accept(UINT8 flag); /* Write Auto Accept */
717HCI_API extern BOOLEAN btsnd_hcic_read_name (void); /* Read Local Name */
718HCI_API extern BOOLEAN btsnd_hcic_read_conn_acc_tout(UINT8 local_controller_id); /* Read Connection Accept Timout */
719HCI_API extern BOOLEAN btsnd_hcic_write_conn_acc_tout(UINT8 local_controller_id, UINT16 tout); /* Write Connection Accept Timout */
720HCI_API extern BOOLEAN btsnd_hcic_read_page_tout(void); /* Read Page Timout */
721HCI_API extern BOOLEAN btsnd_hcic_write_page_tout(UINT16 timeout); /* Write Page Timout */
722HCI_API extern BOOLEAN btsnd_hcic_read_scan_enable(void); /* Read Scan Enable */
723HCI_API extern BOOLEAN btsnd_hcic_write_scan_enable(UINT8 flag); /* Write Scan Enable */
724HCI_API extern BOOLEAN btsnd_hcic_read_pagescan_cfg(void); /* Read Page Scan Activity */
725
726HCI_API extern BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval,
727 UINT16 window); /* Write Page Scan Activity */
728
729#define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG 4
730
731#define HCI_SCAN_CFG_INTERVAL_OFF 0
732#define HCI_SCAN_CFG_WINDOW_OFF 2
733 /* Write Page Scan Activity */
734
735HCI_API extern BOOLEAN btsnd_hcic_read_inqscan_cfg(void); /* Read Inquiry Scan Activity */
736
737 /* Write Inquiry Scan Activity */
738HCI_API extern BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window);
739
740#define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG 4
741
742#define HCI_SCAN_CFG_INTERVAL_OFF 0
743#define HCI_SCAN_CFG_WINDOW_OFF 2
744 /* Write Inquiry Scan Activity */
745
746HCI_API extern BOOLEAN btsnd_hcic_read_auth_enable(void); /* Read Authentication Enable */
747HCI_API extern BOOLEAN btsnd_hcic_write_auth_enable(UINT8 flag); /* Write Authentication Enable */
748HCI_API extern BOOLEAN btsnd_hcic_read_encr_mode (void); /* Read encryption mode */
749HCI_API extern BOOLEAN btsnd_hcic_write_encr_mode (UINT8 mode); /* Write encryption mode */
750HCI_API extern BOOLEAN btsnd_hcic_read_dev_class(void); /* Read Class of Device */
751HCI_API extern BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev); /* Write Class of Device */
752HCI_API extern BOOLEAN btsnd_hcic_read_voice_settings(void); /* Read Voice Settings */
753HCI_API extern BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags); /* Write Voice Settings */
754
755/* Host Controller to Host flow control */
756#define HCI_HOST_FLOW_CTRL_OFF 0
757#define HCI_HOST_FLOW_CTRL_ACL_ON 1
758#define HCI_HOST_FLOW_CTRL_SCO_ON 2
759#define HCI_HOST_FLOW_CTRL_BOTH_ON 3
760
761HCI_API extern BOOLEAN btsnd_hcic_set_host_flow_ctrl (UINT8 value); /* Enable/disable flow control toward host */
762
763
764HCI_API extern BOOLEAN btsnd_hcic_read_auto_flush_tout(UINT16 handle); /* Read Retransmit Timout */
765
766HCI_API extern BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
767 UINT16 timeout); /* Write Retransmit Timout */
768
769#define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4
770
771#define HCI_FLUSH_TOUT_HANDLE_OFF 0
772#define HCI_FLUSH_TOUT_TOUT_OFF 2
773
774HCI_API extern BOOLEAN btsnd_hcic_read_num_bcast_xmit(void); /* Read Num Broadcast Retransmits */
775HCI_API extern BOOLEAN btsnd_hcic_write_num_bcast_xmit(UINT8 num); /* Write Num Broadcast Retransmits */
776HCI_API extern BOOLEAN btsnd_hcic_read_hold_mode_act(void); /* Read Hold Mode Activity */
777HCI_API extern BOOLEAN btsnd_hcic_write_hold_mode_act(UINT8 flags); /* Write Hold Mode Activity */
778
779HCI_API extern BOOLEAN btsnd_hcic_read_tx_power(UINT16 handle, UINT8 type); /* Read Tx Power */
780
781#define HCIC_PARAM_SIZE_READ_TX_POWER 3
782
783#define HCI_READ_TX_POWER_HANDLE_OFF 0
784#define HCI_READ_TX_POWER_TYPE_OFF 2
785
786/* Read transmit power level parameter */
787#define HCI_READ_CURRENT 0x00
788#define HCI_READ_MAXIMUM 0x01
789
790HCI_API extern BOOLEAN btsnd_hcic_read_sco_flow_enable(void); /* Read Authentication Enable */
791HCI_API extern BOOLEAN btsnd_hcic_write_sco_flow_enable(UINT8 flag); /* Write Authentication Enable */
792
793 /* Set Host Buffer Size */
794HCI_API extern BOOLEAN btsnd_hcic_set_host_buf_size (UINT16 acl_len,
795 UINT8 sco_len,
796 UINT16 acl_num,
797 UINT16 sco_num);
798
799#define HCIC_PARAM_SIZE_SET_HOST_BUF_SIZE 7
800
801#define HCI_HOST_BUF_SIZE_ACL_LEN_OFF 0
802#define HCI_HOST_BUF_SIZE_SCO_LEN_OFF 2
803#define HCI_HOST_BUF_SIZE_ACL_NUM_OFF 3
804#define HCI_HOST_BUF_SIZE_SCO_NUM_OFF 5
805
806
807HCI_API extern BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles,
808 UINT16 *handle,
809 UINT16 *num_pkts); /* Set Host Buffer Size */
810
811#define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE sizeof(btmsg_hcic_num_pkts_done_t)
812
813#define MAX_DATA_HANDLES 10
814
815#define HCI_PKTS_DONE_NUM_HANDLES_OFF 0
816#define HCI_PKTS_DONE_HANDLE_OFF 1
817#define HCI_PKTS_DONE_NUM_PKTS_OFF 3
818
819HCI_API extern BOOLEAN btsnd_hcic_read_link_super_tout(UINT8 local_controller_id, UINT16 handle); /* Read Link Supervision Timeout */
820
821 /* Write Link Supervision Timeout */
822HCI_API extern BOOLEAN btsnd_hcic_write_link_super_tout(UINT8 local_controller_id, UINT16 handle, UINT16 timeout);
823
824#define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT 4
825
826#define HCI_LINK_SUPER_TOUT_HANDLE_OFF 0
827#define HCI_LINK_SUPER_TOUT_TOUT_OFF 2
828 /* Write Link Supervision Timeout */
829
830HCI_API extern BOOLEAN btsnd_hcic_read_max_iac (void); /* Read Num Supported IAC */
831HCI_API extern BOOLEAN btsnd_hcic_read_cur_iac_lap (void); /* Read Current IAC LAP */
832
833HCI_API extern BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac,
834 LAP * const iac_lap); /* Write Current IAC LAP */
835
836#define MAX_IAC_LAPS 0x40
837
838#define HCI_WRITE_IAC_LAP_NUM_OFF 0
839#define HCI_WRITE_IAC_LAP_LAP_OFF 1
840 /* Write Current IAC LAP */
841
842 /* Read Clock */
843HCI_API extern BOOLEAN btsnd_hcic_read_clock (UINT16 handle, UINT8 which_clock);
844
845#define HCIC_PARAM_SIZE_READ_CLOCK 3
846
847#define HCI_READ_CLOCK_HANDLE_OFF 0
848#define HCI_READ_CLOCK_WHICH_CLOCK 2
849 /* Read Clock */
850
851#ifdef TESTER_ENABLE
852
853#define HCIC_PARAM_SIZE_ENTER_TEST_MODE 2
854
855#define HCI_ENTER_TEST_HANDLE_OFF 0
856
857#define HCIC_PARAM_SIZE_TEST_CNTRL 10
858#define HCI_TEST_CNTRL_HANDLE_OFF 0
859#define HCI_TEST_CNTRL_SCENARIO_OFF 2
860#define HCI_TEST_CNTRL_HOPPINGMODE_OFF 3
861#define HCI_TEST_CNTRL_TX_FREQ_OFF 4
862#define HCI_TEST_CNTRL_RX_FREQ_OFF 5
863#define HCI_TEST_CNTRL_PWR_CNTRL_MODE_OFF 6
864#define HCI_TEST_CNTRL_POLL_PERIOD_OFF 7
865#define HCI_TEST_CNTRL_PKT_TYPE_OFF 8
866#define HCI_TEST_CNTRL_LENGTH_OFF 9
867
868#endif
869
870HCI_API extern BOOLEAN btsnd_hcic_read_page_scan_per (void); /* Read Page Scan Period Mode */
871HCI_API extern BOOLEAN btsnd_hcic_write_page_scan_per (UINT8 mode); /* Write Page Scan Period Mode */
872HCI_API extern BOOLEAN btsnd_hcic_read_page_scan_mode (void); /* Read Page Scan Mode */
873HCI_API extern BOOLEAN btsnd_hcic_write_page_scan_mode (UINT8 mode); /* Write Page Scan Mode */
874HCI_API extern BOOLEAN btsnd_hcic_read_local_ver (UINT8 local_controller_id); /* Read Local Version Info */
875HCI_API extern BOOLEAN btsnd_hcic_read_local_supported_cmds (UINT8 local_controller_id); /* Read Local Supported Commands */
876HCI_API extern BOOLEAN btsnd_hcic_read_local_features (void); /* Read Local Supported Features */
877HCI_API extern BOOLEAN btsnd_hcic_read_buffer_size (void); /* Read Local buffer sizes */
878HCI_API extern BOOLEAN btsnd_hcic_read_country_code (void); /* Read Country Code */
879HCI_API extern BOOLEAN btsnd_hcic_read_bd_addr (void); /* Read Local BD_ADDR */
880HCI_API extern BOOLEAN btsnd_hcic_read_fail_contact_count (UINT8 local_controller_id, UINT16 handle); /* Read Failed Contact Counter */
881HCI_API extern BOOLEAN btsnd_hcic_reset_fail_contact_count (UINT8 local_controller_id, UINT16 handle);/* Reset Failed Contact Counter */
882HCI_API extern BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle); /* Get Link Quality */
883HCI_API extern BOOLEAN btsnd_hcic_read_rssi (UINT16 handle); /* Read RSSI */
884HCI_API extern BOOLEAN btsnd_hcic_read_loopback_mode (void); /* Read Loopback Mode */
885HCI_API extern BOOLEAN btsnd_hcic_write_loopback_mode (UINT8 mode); /* Write Loopback Mode */
886HCI_API extern BOOLEAN btsnd_hcic_enable_test_mode (void); /* Enable Device Under Test Mode */
887HCI_API extern BOOLEAN btsnd_hcic_write_pagescan_type(UINT8 type); /* Write Page Scan Type */
888HCI_API extern BOOLEAN btsnd_hcic_read_pagescan_type(void); /* Read Page Scan Type */
889HCI_API extern BOOLEAN btsnd_hcic_write_inqscan_type(UINT8 type); /* Write Inquiry Scan Type */
890HCI_API extern BOOLEAN btsnd_hcic_read_inqscan_type(void); /* Read Inquiry Scan Type */
891HCI_API extern BOOLEAN btsnd_hcic_write_inquiry_mode(UINT8 type); /* Write Inquiry Mode */
892HCI_API extern BOOLEAN btsnd_hcic_read_inquiry_mode(void); /* Read Inquiry Mode */
893HCI_API extern BOOLEAN btsnd_hcic_set_afh_channels (UINT8 first, UINT8 last);
894HCI_API extern BOOLEAN btsnd_hcic_write_afh_channel_assessment_mode (UINT8 mode);
895HCI_API extern BOOLEAN btsnd_hcic_set_afh_host_channel_class (UINT8 *p_afhchannelmap);
896HCI_API extern BOOLEAN btsnd_hcic_read_afh_channel_assessment_mode(void);
897HCI_API extern BOOLEAN btsnd_hcic_read_afh_channel_map (UINT16 handle);
898HCI_API extern BOOLEAN btsnd_hcic_nop(void); /* NOP */
899
900 /* Send HCI Data */
901HCI_API extern void btsnd_hcic_data (BT_HDR *p_buf, UINT16 len, UINT16 handle, UINT8 boundary, UINT8 broadcast);
902
903#define HCI_DATA_HANDLE_MASK 0x0FFF
904
905#define HCID_GET_HANDLE_EVENT(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset) + \
906 (*((UINT8 *)((p) + 1) + p->offset + 1) << 8)))
907
908#define HCID_GET_HANDLE(u16) (UINT16)((u16) & HCI_DATA_HANDLE_MASK)
909
910#define HCI_DATA_EVENT_MASK 3
911#define HCI_DATA_EVENT_OFFSET 12
912#define HCID_GET_EVENT(u16) (UINT8)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
913
914#define HCI_DATA_BCAST_MASK 3
915#define HCI_DATA_BCAST_OFFSET 10
916#define HCID_GET_BCAST(u16) (UINT8)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
917
918#define HCID_GET_ACL_LEN(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset + 2) + \
919 (*((UINT8 *)((p) + 1) + p->offset + 3) << 8)))
920
921#define HCID_HEADER_SIZE 4
922 /* Send HCI Data */
923
924#define HCID_GET_SCO_LEN(p) (*((UINT8 *)((p) + 1) + p->offset + 2))
925
926HCI_API extern void btsnd_hcic_vendor_spec_cmd (
927 void *buffer, UINT16 opcode,
928 UINT8 len, UINT8 *p_data,
929 void *p_cmd_cplt_cback);
930
931
932/*********************************************************************************
933** **
934** H C I E V E N T S **
935** **
936*********************************************************************************/
937
938/* Inquiry Complete Event */
939HCI_API extern void btsnd_hcie_inq_comp(void *buffer, UINT8 status);
940
941#define HCIE_PARAM_SIZE_INQ_COMP 1
942
943/* Inquiry Response Event */
944HCI_API extern void btsnd_hcie_inq_res(void *buffer, UINT8 num_resp, UINT8 **bd_addr,
945 UINT8 *page_scan_rep_mode, UINT8 *page_scan_per_mode,
946 UINT8 *page_scan_mode, UINT8 **dev_class,
947 UINT16 *clock_offset);
948
949/* Connection Complete Event */
950HCI_API extern void btsnd_hcie_connection_comp(void *buffer, UINT8 status, UINT16 handle,
951 BD_ADDR bd_addr, UINT8 link_type, UINT8 encr_mode);
952
953#define HCIE_PARAM_SIZE_CONNECTION_COMP 11
954
955
956#define HCI_LINK_TYPE_SCO 0x00
957#define HCI_LINK_TYPE_ACL 0x01
958
959#define HCI_ENCRYPT_MODE_DISABLED 0x00
960#define HCI_ENCRYPT_MODE_POINT_TO_POINT 0x01
961#define HCI_ENCRYPT_MODE_ALL 0x02
962
963
964/* Connection Request Event */
965HCI_API extern void btsnd_hcie_connection_req(void *buffer, BD_ADDR bd_addr, DEV_CLASS dev_class, UINT8 link_type);
966
967#define HCIE_PARAM_SIZE_CONNECTION_REQ 10
968
969#define HCI_LINK_TYPE_SCO 0x00
970#define HCI_LINK_TYPE_ACL 0x01
971
972
973/* Disonnection Complete Event */
974HCI_API extern void btsnd_hcie_disc_comp(void *buffer, UINT8 status, UINT16 handle, UINT8 reason);
975
976#define HCIE_PARAM_SIZE_DISC_COMP 4
977
978
979/* Authentication Complete Event */
980HCI_API extern void btsnd_hcie_auth_comp (void *buffer, UINT8 status, UINT16 handle);
981
982#define HCIE_PARAM_SIZE_AUTH_COMP 3
983
984
985/* Remote Name Request Complete Event */
986HCI_API extern void btsnd_hcie_rmt_name_req_comp(void *buffer, UINT8 status, BD_ADDR bd_addr, BD_NAME name);
987
988#define HCIE_PARAM_SIZE_RMT_NAME_REQ_COMP (1 + BD_ADDR_LEN + BD_NAME_LEN)
989
990
991/* Encryption Change Event */
992HCI_API extern void btsnd_hcie_encryption_change (void *buffer, UINT8 status, UINT16 handle, BOOLEAN enable);
993
994#define HCIE_PARAM_SIZE_ENCR_CHANGE 4
995
996
997/* Connection Link Key Change Event */
998HCI_API extern void btsnd_hcie_conn_link_key_change (void *buffer, UINT8 status, UINT16 handle);
999
1000#define HCIE_PARAM_SIZE_LINK_KEY_CHANGE 3
1001
1002
1003/* Encryption Key Refresh Complete Event */
1004HCI_API extern void btsnd_hcie_encrypt_key_refresh (void *buffer, UINT8 status, UINT16 handle);
1005
1006#define HCIE_PARAM_SIZE_ENCRYPT_KEY_REFRESH 3
1007
1008
1009/* Master Link Key Complete Event */
1010HCI_API extern void btsnd_hcie_master_link_key (void *buffer, UINT8 status, UINT16 handle, UINT8 flag);
1011
1012#define HCIE_PARAM_SIZE_MASTER_LINK_KEY 4
1013
1014
1015/* Read Remote Supported Features Complete Event */
1016HCI_API extern void btsnd_hcie_read_rmt_features (void *buffer, UINT8 status, UINT16 handle, UINT8 *features);
1017
1018#define LMP_FEATURES_SIZE 8
1019#define HCIE_PARAM_SIZE_READ_RMT_FEATURES 11
1020
1021
1022/* Read Remote Extended Features Complete Event */
1023HCI_API extern void btsnd_hcie_read_rmt_ext_features (void *buffer, UINT8 status, UINT16 handle, UINT8 page_num,
1024 UINT8 max_page_num, UINT8 *features);
1025
1026#define EXT_LMP_FEATURES_SIZE 8
1027#define HCIE_PARAM_SIZE_READ_RMT_EXT_FEATURES 13
1028
1029
1030/* Read Remote Version Complete Event */
1031HCI_API extern void btsnd_hcie_read_rmt_version (void *buffer, UINT8 status, UINT16 handle, UINT8 version,
1032 UINT16 comp_name, UINT16 sub_version);
1033
1034#define HCIE_PARAM_SIZE_READ_RMT_VERSION 8
1035
1036
1037/* QOS setup complete */
1038HCI_API extern void btsnd_hcie_qos_setup_compl (void *buffer, UINT8 status, UINT16 handle, UINT8 flags,
1039 UINT8 service_type, UINT32 token_rate, UINT32 peak,
1040 UINT32 latency, UINT32 delay_var);
1041
1042#define HCIE_PARAM_SIZE_QOS_SETUP_COMP 21
1043
1044
1045/* Flow Specification complete */
1046HCI_API extern void btsnd_hcie_flow_spec_compl (void *buffer, UINT8 status, UINT16 handle, UINT8 flags,
1047 UINT8 flow_direction, UINT8 service_type, UINT32 token_rate, UINT32 token_bucket_size,
1048 UINT32 peak, UINT32 latency);
1049
1050#define HCIE_PARAM_SIZE_FLOW_SPEC_COMP 22
1051
1052
1053/* Command Complete Event */
1054HCI_API extern void btsnd_hcie_cmd_comp(void *buffer, UINT8 max_host_cmds, UINT16 opcode, UINT8 status);
1055
1056#define HCIE_PARAM_SIZE_CMD_COMP 4
1057
1058
1059/* Command Complete with pre-filled in parameters */
1060HCI_API extern void btsnd_hcie_cmd_comp_params (void *buffer, UINT8 max_host_cmds, UINT16 cmd_opcode, UINT8 status);
1061
1062#define HCI_CMD_COMPL_PARAM_OFFSET 4
1063
1064
1065/* Command Complete Event with 1-byte param */
1066HCI_API extern void btsnd_hcie_cmd_comp_param1(void *buffer, UINT8 max_host_cmds, UINT16 opcode,
1067 UINT8 status, UINT8 param1);
1068
1069#define HCIE_PARAM_SIZE_CMD_COMP_PARAM1 5
1070
1071/* Command Complete Event with 2-byte param */
1072HCI_API extern void btsnd_hcie_cmd_comp_param2(void *buffer, UINT8 max_host_cmds, UINT16 opcode,
1073 UINT8 status, UINT16 param2);
1074
1075#define HCIE_PARAM_SIZE_CMD_COMP_PARAM2 6
1076
1077
1078/* Command Complete Event with BD-addr as param */
1079HCI_API extern void btsnd_hcie_cmd_comp_bd_addr(void *buffer, UINT8 max_host_cmds, UINT16 opcode,
1080 UINT8 status, BD_ADDR bd_addr);
1081
1082#define HCIE_PARAM_SIZE_CMD_COMP_BD_ADDR 10
1083
1084
1085/* Command Pending Event */
1086HCI_API extern void btsnd_hcie_cmd_status (void *buffer, UINT8 status, UINT8 max_host_cmds, UINT16 opcode);
1087
1088#define HCIE_PARAM_SIZE_CMD_STATUS 4
1089
1090
1091/* HW failure Event */
1092HCI_API extern void btsnd_hcie_hw_failure (void *buffer, UINT8 code);
1093
1094#define HCIE_PARAM_SIZE_HW_FAILURE 1
1095
1096
1097/* Flush Occured Event */
1098HCI_API extern void btsnd_hcie_flush_occured (void *buffer, UINT16 handle);
1099
1100#define HCIE_PARAM_SIZE_FLUSH_OCCURED 2
1101
1102
1103/* Role Changed Event */
1104HCI_API extern void btsnd_hcie_role_change (void *buffer, UINT8 status, BD_ADDR bd_addr, UINT8 role);
1105
1106#define HCIE_PARAM_SIZE_ROLE_CHANGE 8
1107
1108
1109/* Ready for Data Packets Event */
1110HCI_API extern void btsnd_hcie_num_compl_pkts (void *buffer, UINT8 num_handles, UINT16 *p_handle, UINT16 *num_pkts);
1111
1112#define MAX_DATA_HANDLES 10
1113
1114
1115/* Mode Change Event */
1116HCI_API extern void btsnd_hcie_mode_change (void *buffer, UINT8 status, UINT16 handle,
1117 UINT8 mode, UINT16 interval);
1118
1119#define HCIE_PARAM_SIZE_MODE_CHANGE 6
1120#define MAX_DATA_HANDLES 10
1121
1122
1123
1124/* Return Link Keys Event */
1125HCI_API extern void btsnd_hcie_return_link_keys (void *buffer, UINT8 num_keys, BD_ADDR *bd_addr, LINK_KEY *link_key);
1126
1127/* This should not be more than 0x0b */
1128#define MAX_LINK_KEYS 10
1129
1130
1131
1132/* PIN Code Request Event */
1133HCI_API extern void btsnd_hcie_pin_code_req (void *buffer, BD_ADDR bd_addr);
1134
1135#define HCIE_PARAM_SIZE_PIN_CODE_REQ 6
1136
1137
1138
1139/* Link Key Request Event */
1140HCI_API extern void btsnd_hcie_link_key_req (void *buffer, BD_ADDR bd_addr);
1141
1142#define HCIE_PARAM_SIZE_LINK_KEY_REQ 6
1143
1144
1145
1146/* Link Key Notification Event */
1147HCI_API extern void btsnd_hcie_link_key_notify (void *buffer, BD_ADDR bd_addr, LINK_KEY link_key, UINT8 key_type);
1148
1149#define HCIE_PARAM_SIZE_LINK_KEY_NOTIFY 23
1150
1151
1152
1153/* Loopback Command Event */
1154HCI_API extern void btsnd_hcie_loopback_command (void *buffer, UINT8 data_len, UINT8 *data);
1155
1156#define HCIE_PARAM_SIZE_LOOPBACK_COMMAND sizeof(btmsg_hcie_loopback_cmd_t)
1157
1158
1159
1160/* Data Buffer Overflow Event */
1161HCI_API extern void btsnd_hcie_data_buf_overflow (void *buffer, UINT8 link_type);
1162
1163#define HCIE_PARAM_SIZE_DATA_BUF_OVERFLOW 1
1164
1165
1166
1167/* Max Slots Change Event */
1168HCI_API extern void btsnd_hcie_max_slots_change(void *buffer, UINT16 handle, UINT8 max_slots);
1169
1170#define HCIE_PARAM_SIZE_MAX_SLOTS_CHANGE 3
1171
1172
1173/* Read Clock Offset Complet Event */
1174HCI_API extern void btsnd_hcie_read_clock_off_comp(void *buffer, UINT8 status, UINT16 handle,
1175 UINT16 clock_offset);
1176
1177#define HCIE_PARAM_SIZE_READ_CLOCK_OFF_COMP 5
1178
1179
1180
1181/* Connection Packet Type Change Event */
1182HCI_API extern void btsnd_hcie_pkt_type_change (void *buffer, UINT8 status, UINT16 handle, UINT16 pkt_type);
1183
1184#define HCIE_PARAM_SIZE_PKT_TYPE_CHANGE 5
1185
1186
1187
1188/* QOS violation Event */
1189HCI_API extern void btsnd_hcie_qos_violation (void *buffer, UINT16 handle);
1190
1191#define HCIE_PARAM_SIZE_QOS_VIOLATION 2
1192
1193
1194
1195/* Page Scan Mode Change Event */
1196HCI_API extern void btsnd_hcie_pagescan_mode_chng (void *buffer, BD_ADDR bd_addr, UINT8 mode);
1197
1198#define HCIE_PARAM_SIZE_PAGE_SCAN_MODE_CHNG 7
1199
1200
1201/* Page Scan Repetition Mode Change Event */
1202HCI_API extern void btsnd_hcie_pagescan_rep_mode_chng (void *buffer, BD_ADDR bd_addr, UINT8 mode);
1203
1204#define HCIE_PARAM_SIZE_PAGE_SCAN_REP_MODE_CHNG 7
1205
1206
1207/* Sniff Sub Rate Event */
1208HCI_API extern void btsnd_hcie_sniff_sub_rate(void *buffer, UINT8 status, UINT16 handle, UINT16 max_tx_lat, UINT16 max_rx_lat,
1209 UINT16 min_remote_timeout, UINT16 min_local_timeout);
1210
1211#define HCIE_PARAM_SIZE_SNIFF_SUB_RATE 11
1212
1213
1214
1215/* Extended Inquiry Result Event */
1216HCI_API extern void btsnd_hcie_ext_inquiry_result(void *buffer, UINT8 num_resp, UINT8 **bd_addr,
1217 UINT8 *page_scan_rep_mode, UINT8 *reserved,
1218 UINT8 **dev_class, UINT16 *clock_offset, UINT8 *rssi, UINT8 *p_data);
1219
1220
1221#if (BLE_INCLUDED == TRUE)
1222/********************************************************************************
1223** BLE Commands
1224** Note: "local_controller_id" is for transport, not counted in HCI message size
1225*********************************************************************************/
1226#define HCIC_PARAM_SIZE_SET_USED_FEAT_CMD 8
1227#define HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD 6
1228#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS 15
1229#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP 31
1230#define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE 1
1231#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM 7
1232#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE 2
1233#define HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN 25
1234#define HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL 0
1235#define HCIC_PARAM_SIZE_CLEAR_WHITE_LIST 0
1236#define HCIC_PARAM_SIZE_ADD_WHITE_LIST 7
1237#define HCIC_PARAM_SIZE_REMOVE_WHITE_LIST 7
1238#define HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS 14
1239#define HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS 5
1240#define HCIC_PARAM_SIZE_READ_CHNL_MAP 2
1241#define HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT 2
1242#define HCIC_PARAM_SIZE_BLE_ENCRYPT 32
1243#define HCIC_PARAM_SIZE_BLE_RAND 0
1244
1245#define HCIC_BLE_RAND_DI_SIZE 8
1246#define HCIC_BLE_ENCRYT_KEY_SIZE 16
1247#define HCIC_PARAM_SIZE_BLE_START_ENC (4 + HCIC_BLE_RAND_DI_SIZE + HCIC_BLE_ENCRYT_KEY_SIZE)
1248#define HCIC_PARAM_SIZE_LTK_REQ_REPLY (2 + HCIC_BLE_ENCRYT_KEY_SIZE)
1249#define HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY 2
1250#define HCIC_BLE_CHNL_MAP_SIZE 5
1251#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA 31
1252
1253/* ULP HCI command */
1254HCI_API extern BOOLEAN btsnd_hcic_ble_reset(void);
1255
1256HCI_API extern BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
1257
1258HCI_API extern BOOLEAN btsnd_hcic_ble_read_buffer_size (void);
1259
1260HCI_API extern BOOLEAN btsnd_hcic_ble_read_local_spt_feat (void);
1261
1262HCI_API extern BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8]);
1263
1264HCI_API extern BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
1265
1266HCI_API extern BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
1267 UINT8 adv_type, UINT8 addr_type_own,
1268 UINT8 addr_type_dir, BD_ADDR direct_bda,
1269 UINT8 channel_map, UINT8 adv_filter_policy);
1270
1271HCI_API extern BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void);
1272
1273HCI_API extern BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data);
1274
1275HCI_API extern BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp);
1276
1277HCI_API extern BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable);
1278
1279HCI_API extern BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
1280 UINT16 scan_int, UINT16 scan_win,
1281 UINT8 addr_type, UINT8 scan_filter_policy);
1282
1283HCI_API extern BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate);
1284
1285HCI_API extern BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win,
1286 UINT8 init_filter_policy, UINT8 addr_type_peer, BD_ADDR bda_peer, UINT8 addr_type_own,
1287 UINT16 conn_int_min, UINT16 conn_int_max, UINT16 conn_latency, UINT16 conn_timeout,
1288 UINT16 min_ce_len, UINT16 max_ce_len);
1289
1290HCI_API extern BOOLEAN btsnd_hcic_ble_create_conn_cancel (void);
1291
1292HCI_API extern BOOLEAN btsnd_hcic_ble_read_white_list_size (void);
1293
1294HCI_API extern BOOLEAN btsnd_hcic_ble_clear_white_list (void);
1295
1296HCI_API extern BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda);
1297
1298HCI_API extern BOOLEAN btsnd_hcic_ble_remove_from_white_list (UINT8 addr_type, BD_ADDR bda);
1299
1300HCI_API extern BOOLEAN btsnd_hcic_ble_upd_ll_conn_params (UINT16 handle, UINT16 conn_int_min, UINT16 conn_int_max,
1301 UINT16 conn_latency, UINT16 conn_timeout, UINT16 min_len, UINT16 max_len);
1302
1303HCI_API extern BOOLEAN btsnd_hcic_ble_set_host_chnl_class (UINT8 chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
1304
1305HCI_API extern BOOLEAN btsnd_hcic_ble_read_chnl_map (UINT16 handle);
1306
1307HCI_API extern BOOLEAN btsnd_hcic_ble_read_remote_feat ( UINT16 handle);
1308
1309HCI_API extern BOOLEAN btsnd_hcic_ble_encrypt (UINT8* key, UINT8 key_len, UINT8* plain_text, UINT8 pt_len, void *p_cmd_cplt_cback);
1310
1311HCI_API extern BOOLEAN btsnd_hcic_ble_rand (void *p_cmd_cplt_cback);
1312
1313HCI_API extern BOOLEAN btsnd_hcic_ble_start_enc ( UINT16 handle,
1314 UINT8 rand[HCIC_BLE_RAND_DI_SIZE],
1315 UINT16 ediv, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
1316
1317HCI_API extern BOOLEAN btsnd_hcic_ble_ltk_req_reply (UINT16 handle, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
1318
1319HCI_API extern BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle);
1320
1321HCI_API extern BOOLEAN btsnd_hcic_ble_read_supported_states (void);
1322
1323
1324#endif /* BLE_INCLUDED */
1325
1326#ifdef __cplusplus
1327}
1328#endif
1329
1330#endif
1331