hci.h revision 1.40 1 /* $NetBSD: hci.h,v 1.40 2015/09/06 06:01:01 dholland Exp $ */
2
3 /*-
4 * Copyright (c) 2005 Iain Hibbert.
5 * Copyright (c) 2006 Itronix Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of Itronix Inc. may not be used to endorse
17 * or promote products derived from this software without specific
18 * prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32 /*-
33 * Copyright (c) 2001 Maksim Yevmenkin <m_evmenkin (at) yahoo.com>
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 *
57 * $Id: hci.h,v 1.40 2015/09/06 06:01:01 dholland Exp $
58 * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
59 */
60
61 /*
62 * This file contains everything that applications need to know from
63 * Host Controller Interface (HCI). Information taken from Bluetooth
64 * Core Specifications (v1.1, v2.0 and v2.1)
65 *
66 * This file can be included by both kernel and userland applications.
67 *
68 * NOTE: Here and after Bluetooth device is called a "unit". Bluetooth
69 * specification refers to both devices and units. They are the
70 * same thing (I think), so to be consistent word "unit" will be
71 * used.
72 */
73
74 #ifndef _NETBT_HCI_H_
75 #define _NETBT_HCI_H_
76
77 #include <netbt/bluetooth.h>
78
79 #include <sys/ioccom.h>
80
81 /**************************************************************************
82 **************************************************************************
83 ** Common defines and types (HCI)
84 **************************************************************************
85 **************************************************************************/
86
87 #define HCI_LAP_SIZE 3 /* unit LAP */
88 #define HCI_KEY_SIZE 16 /* link key */
89 #define HCI_PIN_SIZE 16 /* link PIN */
90 #define HCI_EVENT_MASK_SIZE 8 /* event mask */
91 #define HCI_CLASS_SIZE 3 /* unit class */
92 #define HCI_FEATURES_SIZE 8 /* LMP features */
93 #define HCI_UNIT_NAME_SIZE 248 /* unit name size */
94 #define HCI_DEVNAME_SIZE 16 /* same as dv_xname */
95 #define HCI_COMMANDS_SIZE 64 /* supported commands mask */
96
97 /* HCI specification */
98 #define HCI_SPEC_V10 0x00 /* v1.0b */
99 #define HCI_SPEC_V11 0x01 /* v1.1 */
100 #define HCI_SPEC_V12 0x02 /* v1.2 */
101 #define HCI_SPEC_V20 0x03 /* v2.0 + EDR */
102 #define HCI_SPEC_V21 0x04 /* v2.1 + EDR */
103 #define HCI_SPEC_V30 0x05 /* v3.0 + HS */
104 /* 0x06 - 0xFF - reserved for future use */
105
106 /* LMP features (and page 0 of extended features) */
107 /* ------------------- byte 0 --------------------*/
108 #define HCI_LMP_3SLOT 0x01
109 #define HCI_LMP_5SLOT 0x02
110 #define HCI_LMP_ENCRYPTION 0x04
111 #define HCI_LMP_SLOT_OFFSET 0x08
112 #define HCI_LMP_TIMIACCURACY 0x10
113 #define HCI_LMP_ROLE_SWITCH 0x20
114 #define HCI_LMP_HOLD_MODE 0x40
115 #define HCI_LMP_SNIFF_MODE 0x80
116 /* ------------------- byte 1 --------------------*/
117 #define HCI_LMP_PARK_MODE 0x01
118 #define HCI_LMP_RSSI 0x02
119 #define HCI_LMP_CHANNEL_QUALITY 0x04
120 #define HCI_LMP_SCO_LINK 0x08
121 #define HCI_LMP_HV2_PKT 0x10
122 #define HCI_LMP_HV3_PKT 0x20
123 #define HCI_LMP_ULAW_LOG 0x40
124 #define HCI_LMP_ALAW_LOG 0x80
125 /* ------------------- byte 2 --------------------*/
126 #define HCI_LMP_CVSD 0x01
127 #define HCI_LMP_PAGISCHEME 0x02
128 #define HCI_LMP_POWER_CONTROL 0x04
129 #define HCI_LMP_TRANSPARENT_SCO 0x08
130 #define HCI_LMP_FLOW_CONTROL_LAG0 0x10
131 #define HCI_LMP_FLOW_CONTROL_LAG1 0x20
132 #define HCI_LMP_FLOW_CONTROL_LAG2 0x40
133 #define HCI_LMP_BC_ENCRYPTION 0x80
134 /* ------------------- byte 3 --------------------*/
135 /* reserved 0x01 */
136 #define HCI_LMP_EDR_ACL_2MBPS 0x02
137 #define HCI_LMP_EDR_ACL_3MBPS 0x04
138 #define HCI_LMP_ENHANCED_ISCAN 0x08
139 #define HCI_LMP_INTERLACED_ISCAN 0x10
140 #define HCI_LMP_INTERLACED_PSCAN 0x20
141 #define HCI_LMP_RSSI_INQUIRY 0x40
142 #define HCI_LMP_EV3_PKT 0x80
143 /* ------------------- byte 4 --------------------*/
144 #define HCI_LMP_EV4_PKT 0x01
145 #define HCI_LMP_EV5_PKT 0x02
146 /* reserved 0x04 */
147 #define HCI_LMP_AFH_CAPABLE_SLAVE 0x08
148 #define HCI_LMP_AFH_CLASS_SLAVE 0x10
149 /* reserved 0x20 */
150 /* reserved 0x40 */
151 #define HCI_LMP_3SLOT_EDR_ACL 0x80
152 /* ------------------- byte 5 --------------------*/
153 #define HCI_LMP_5SLOT_EDR_ACL 0x01
154 #define HCI_LMP_SNIFF_SUBRATING 0x02
155 #define HCI_LMP_PAUSE_ENCRYPTION 0x04
156 #define HCI_LMP_AFH_CAPABLE_MASTER 0x08
157 #define HCI_LMP_AFH_CLASS_MASTER 0x10
158 #define HCI_LMP_EDR_eSCO_2MBPS 0x20
159 #define HCI_LMP_EDR_eSCO_3MBPS 0x40
160 #define HCI_LMP_3SLOT_EDR_eSCO 0x80
161 /* ------------------- byte 6 --------------------*/
162 #define HCI_LMP_EXTENDED_INQUIRY 0x01
163 /* reserved 0x02 */
164 /* reserved 0x04 */
165 #define HCI_LMP_SIMPLE_PAIRING 0x08
166 #define HCI_LMP_ENCAPSULATED_PDU 0x10
167 #define HCI_LMP_ERRDATA_REPORTING 0x20
168 #define HCI_LMP_NOFLUSH_PB_FLAG 0x40
169 /* reserved 0x80 */
170 /* ------------------- byte 7 --------------------*/
171 #define HCI_LMP_LINK_SUPERVISION_TO 0x01
172 #define HCI_LMP_INQ_RSP_TX_POWER 0x02
173 #define HCI_LMP_ENHANCED_POWER_CONTROL 0x04
174 #define HCI_LMP_EXTENDED_FEATURES 0x80
175
176 /* page 1 of extended features */
177 /* ------------------- byte 0 --------------------*/
178 #define HCI_LMP_SSP 0x01
179
180 /* Link types */
181 #define HCI_LINK_SCO 0x00 /* Voice */
182 #define HCI_LINK_ACL 0x01 /* Data */
183 #define HCI_LINK_eSCO 0x02 /* eSCO */
184 /* 0x03 - 0xFF - reserved for future use */
185
186 /*
187 * ACL/SCO packet type bits are set to enable the
188 * packet type, except for 2MBPS and 3MBPS when they
189 * are unset to enable the packet type.
190 */
191 /* ACL Packet types for "Create Connection" */
192 #define HCI_PKT_2MBPS_DH1 0x0002
193 #define HCI_PKT_3MBPS_DH1 0x0004
194 #define HCI_PKT_DM1 0x0008
195 #define HCI_PKT_DH1 0x0010
196 #define HCI_PKT_2MBPS_DH3 0x0100
197 #define HCI_PKT_3MBPS_DH3 0x0200
198 #define HCI_PKT_DM3 0x0400
199 #define HCI_PKT_DH3 0x0800
200 #define HCI_PKT_2MBPS_DH5 0x1000
201 #define HCI_PKT_3MBPS_DH5 0x2000
202 #define HCI_PKT_DM5 0x4000
203 #define HCI_PKT_DH5 0x8000
204
205 /* SCO Packet types for "Setup Synchronous Connection" */
206 #define HCI_PKT_HV1 0x0001
207 #define HCI_PKT_HV2 0x0002
208 #define HCI_PKT_HV3 0x0004
209 #define HCI_PKT_EV3 0x0008
210 #define HCI_PKT_EV4 0x0010
211 #define HCI_PKT_EV5 0x0020
212 #define HCI_PKT_2MBPS_EV3 0x0040
213 #define HCI_PKT_3MBPS_EV3 0x0080
214 #define HCI_PKT_2MBPS_EV5 0x0100
215 #define HCI_PKT_3MBPS_EV5 0x0200
216
217 /*
218 * Connection modes/Unit modes
219 *
220 * This is confusing. It means that one of the units change its mode
221 * for the specific connection. For example one connection was put on
222 * hold (but i could be wrong :)
223 */
224
225 /* Page scan modes (are deprecated) */
226 #define HCI_MANDATORY_PAGE_SCAN_MODE 0x00
227 #define HCI_OPTIONAL_PAGE_SCAN_MODE1 0x01
228 #define HCI_OPTIONAL_PAGE_SCAN_MODE2 0x02
229 #define HCI_OPTIONAL_PAGE_SCAN_MODE3 0x03
230 /* 0x04 - 0xFF - reserved for future use */
231
232 /* Page scan repetition modes */
233 #define HCI_SCAN_REP_MODE0 0x00
234 #define HCI_SCAN_REP_MODE1 0x01
235 #define HCI_SCAN_REP_MODE2 0x02
236 /* 0x03 - 0xFF - reserved for future use */
237
238 /* Page scan period modes */
239 #define HCI_PAGE_SCAN_PERIOD_MODE0 0x00
240 #define HCI_PAGE_SCAN_PERIOD_MODE1 0x01
241 #define HCI_PAGE_SCAN_PERIOD_MODE2 0x02
242 /* 0x03 - 0xFF - reserved for future use */
243
244 /* Scan enable */
245 #define HCI_NO_SCAN_ENABLE 0x00
246 #define HCI_INQUIRY_SCAN_ENABLE 0x01
247 #define HCI_PAGE_SCAN_ENABLE 0x02
248 /* 0x04 - 0xFF - reserved for future use */
249
250 /* Hold mode activities */
251 #define HCI_HOLD_MODE_NO_CHANGE 0x00
252 #define HCI_HOLD_MODE_SUSPEND_PAGE_SCAN 0x01
253 #define HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN 0x02
254 #define HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY 0x04
255 /* 0x08 - 0x80 - reserved for future use */
256
257 /* Connection roles */
258 #define HCI_ROLE_MASTER 0x00
259 #define HCI_ROLE_SLAVE 0x01
260 /* 0x02 - 0xFF - reserved for future use */
261
262 /* Key flags */
263 #define HCI_USE_SEMI_PERMANENT_LINK_KEYS 0x00
264 #define HCI_USE_TEMPORARY_LINK_KEY 0x01
265 /* 0x02 - 0xFF - reserved for future use */
266
267 /* Pin types */
268 #define HCI_PIN_TYPE_VARIABLE 0x00
269 #define HCI_PIN_TYPE_FIXED 0x01
270
271 /* Link key types */
272 #define HCI_LINK_KEY_TYPE_COMBINATION_KEY 0x00
273 #define HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY 0x01
274 #define HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY 0x02
275 /* 0x03 - 0xFF - reserved for future use */
276
277 /* Encryption modes */
278 #define HCI_ENCRYPTION_MODE_NONE 0x00
279 #define HCI_ENCRYPTION_MODE_P2P 0x01
280 #define HCI_ENCRYPTION_MODE_ALL 0x02
281 /* 0x03 - 0xFF - reserved for future use */
282
283 /* Quality of service types */
284 #define HCI_SERVICE_TYPE_NO_TRAFFIC 0x00
285 #define HCI_SERVICE_TYPE_BEST_EFFORT 0x01
286 #define HCI_SERVICE_TYPE_GUARANTEED 0x02
287 /* 0x03 - 0xFF - reserved for future use */
288
289 /* Link policy settings */
290 #define HCI_LINK_POLICY_DISABLE_ALL_LM_MODES 0x0000
291 #define HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001 /* Master/Slave switch */
292 #define HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002
293 #define HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004
294 #define HCI_LINK_POLICY_ENABLE_PARK_MODE 0x0008
295 /* 0x0010 - 0x8000 - reserved for future use */
296
297 /* Event masks */
298 #define HCI_EVMSK_ALL 0x00000000ffffffff
299 #define HCI_EVMSK_NONE 0x0000000000000000
300 #define HCI_EVMSK_INQUIRY_COMPL 0x0000000000000001
301 #define HCI_EVMSK_INQUIRY_RESULT 0x0000000000000002
302 #define HCI_EVMSK_CON_COMPL 0x0000000000000004
303 #define HCI_EVMSK_CON_REQ 0x0000000000000008
304 #define HCI_EVMSK_DISCON_COMPL 0x0000000000000010
305 #define HCI_EVMSK_AUTH_COMPL 0x0000000000000020
306 #define HCI_EVMSK_REMOTE_NAME_REQ_COMPL 0x0000000000000040
307 #define HCI_EVMSK_ENCRYPTION_CHANGE 0x0000000000000080
308 #define HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL 0x0000000000000100
309 #define HCI_EVMSK_MASTER_LINK_KEY_COMPL 0x0000000000000200
310 #define HCI_EVMSK_READ_REMOTE_FEATURES_COMPL 0x0000000000000400
311 #define HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL 0x0000000000000800
312 #define HCI_EVMSK_QOS_SETUP_COMPL 0x0000000000001000
313 #define HCI_EVMSK_COMMAND_COMPL 0x0000000000002000
314 #define HCI_EVMSK_COMMAND_STATUS 0x0000000000004000
315 #define HCI_EVMSK_HARDWARE_ERROR 0x0000000000008000
316 #define HCI_EVMSK_FLUSH_OCCUR 0x0000000000010000
317 #define HCI_EVMSK_ROLE_CHANGE 0x0000000000020000
318 #define HCI_EVMSK_NUM_COMPL_PKTS 0x0000000000040000
319 #define HCI_EVMSK_MODE_CHANGE 0x0000000000080000
320 #define HCI_EVMSK_RETURN_LINK_KEYS 0x0000000000100000
321 #define HCI_EVMSK_PIN_CODE_REQ 0x0000000000200000
322 #define HCI_EVMSK_LINK_KEY_REQ 0x0000000000400000
323 #define HCI_EVMSK_LINK_KEY_NOTIFICATION 0x0000000000800000
324 #define HCI_EVMSK_LOOPBACK_COMMAND 0x0000000001000000
325 #define HCI_EVMSK_DATA_BUFFER_OVERFLOW 0x0000000002000000
326 #define HCI_EVMSK_MAX_SLOT_CHANGE 0x0000000004000000
327 #define HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE 0x0000000008000000
328 #define HCI_EVMSK_CON_PKT_TYPE_CHANGED 0x0000000010000000
329 #define HCI_EVMSK_QOS_VIOLATION 0x0000000020000000
330 #define HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x0000000040000000
331 #define HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x0000000080000000
332 /* 0x0000000100000000 - 0x8000000000000000 - reserved for future use */
333
334 /* Filter types */
335 #define HCI_FILTER_TYPE_NONE 0x00
336 #define HCI_FILTER_TYPE_INQUIRY_RESULT 0x01
337 #define HCI_FILTER_TYPE_CON_SETUP 0x02
338 /* 0x03 - 0xFF - reserved for future use */
339
340 /* Filter condition types for HCI_FILTER_TYPE_INQUIRY_RESULT */
341 #define HCI_FILTER_COND_INQUIRY_NEW_UNIT 0x00
342 #define HCI_FILTER_COND_INQUIRY_UNIT_CLASS 0x01
343 #define HCI_FILTER_COND_INQUIRY_BDADDR 0x02
344 /* 0x03 - 0xFF - reserved for future use */
345
346 /* Filter condition types for HCI_FILTER_TYPE_CON_SETUP */
347 #define HCI_FILTER_COND_CON_ANY_UNIT 0x00
348 #define HCI_FILTER_COND_CON_UNIT_CLASS 0x01
349 #define HCI_FILTER_COND_CON_BDADDR 0x02
350 /* 0x03 - 0xFF - reserved for future use */
351
352 /* Xmit level types */
353 #define HCI_XMIT_LEVEL_CURRENT 0x00
354 #define HCI_XMIT_LEVEL_MAXIMUM 0x01
355 /* 0x02 - 0xFF - reserved for future use */
356
357 /* Host Controller to Host flow control */
358 #define HCI_HC2H_FLOW_CONTROL_NONE 0x00
359 #define HCI_HC2H_FLOW_CONTROL_ACL 0x01
360 #define HCI_HC2H_FLOW_CONTROL_SCO 0x02
361 #define HCI_HC2H_FLOW_CONTROL_BOTH 0x03
362 /* 0x04 - 0xFF - reserved future use */
363
364 /* Loopback modes */
365 #define HCI_LOOPBACK_NONE 0x00
366 #define HCI_LOOPBACK_LOCAL 0x01
367 #define HCI_LOOPBACK_REMOTE 0x02
368 /* 0x03 - 0xFF - reserved future use */
369
370 /**************************************************************************
371 **************************************************************************
372 ** Link level defines, headers and types
373 **************************************************************************
374 **************************************************************************/
375
376 /*
377 * Macro(s) to combine OpCode and extract OGF (OpCode Group Field)
378 * and OCF (OpCode Command Field) from OpCode.
379 */
380
381 #define HCI_OPCODE(gf,cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff))
382 #define HCI_OCF(op) ((op) & 0x3ff)
383 #define HCI_OGF(op) (((op) >> 10) & 0x3f)
384
385 /*
386 * Macro(s) to extract/combine connection handle, BC (Broadcast) and
387 * PB (Packet boundary) flags.
388 */
389
390 #define HCI_CON_HANDLE(h) ((h) & 0x0fff)
391 #define HCI_PB_FLAG(h) (((h) & 0x3000) >> 12)
392 #define HCI_BC_FLAG(h) (((h) & 0xc000) >> 14)
393 #define HCI_MK_CON_HANDLE(h, pb, bc) \
394 (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))
395
396 /* PB flag values */
397 /* 00 - reserved for future use */
398 #define HCI_PACKET_FRAGMENT 0x1
399 #define HCI_PACKET_START 0x2
400 /* 11 - reserved for future use */
401
402 /* BC flag values */
403 #define HCI_POINT2POINT 0x0 /* only Host controller to Host */
404 #define HCI_BROADCAST_ACTIVE 0x1 /* both directions */
405 #define HCI_BROADCAST_PICONET 0x2 /* both directions */
406 /* 11 - reserved for future use */
407
408 /* HCI command packet header */
409 typedef struct {
410 uint8_t type; /* MUST be 0x01 */
411 uint16_t opcode; /* OpCode */
412 uint8_t length; /* parameter(s) length in bytes */
413 } __packed hci_cmd_hdr_t;
414
415 #define HCI_CMD_PKT 0x01
416 #define HCI_CMD_PKT_SIZE (sizeof(hci_cmd_hdr_t) + 0xff)
417
418 /* ACL data packet header */
419 typedef struct {
420 uint8_t type; /* MUST be 0x02 */
421 uint16_t con_handle; /* connection handle + PB + BC flags */
422 uint16_t length; /* payload length in bytes */
423 } __packed hci_acldata_hdr_t;
424
425 #define HCI_ACL_DATA_PKT 0x02
426 #define HCI_ACL_PKT_SIZE (sizeof(hci_acldata_hdr_t) + 0xffff)
427
428 /* SCO data packet header */
429 typedef struct {
430 uint8_t type; /* MUST be 0x03 */
431 uint16_t con_handle; /* connection handle + reserved bits */
432 uint8_t length; /* payload length in bytes */
433 } __packed hci_scodata_hdr_t;
434
435 #define HCI_SCO_DATA_PKT 0x03
436 #define HCI_SCO_PKT_SIZE (sizeof(hci_scodata_hdr_t) + 0xff)
437
438 /* HCI event packet header */
439 typedef struct {
440 uint8_t type; /* MUST be 0x04 */
441 uint8_t event; /* event */
442 uint8_t length; /* parameter(s) length in bytes */
443 } __packed hci_event_hdr_t;
444
445 #define HCI_EVENT_PKT 0x04
446 #define HCI_EVENT_PKT_SIZE (sizeof(hci_event_hdr_t) + 0xff)
447
448 /* HCI status return parameter */
449 typedef struct {
450 uint8_t status; /* 0x00 - success */
451 } __packed hci_status_rp;
452
453 /**************************************************************************
454 **************************************************************************
455 ** OGF 0x01 Link control commands and return parameters
456 **************************************************************************
457 **************************************************************************/
458
459 #define HCI_OGF_LINK_CONTROL 0x01
460
461 #define HCI_OCF_INQUIRY 0x0001
462 #define HCI_CMD_INQUIRY 0x0401
463 typedef struct {
464 uint8_t lap[HCI_LAP_SIZE]; /* LAP */
465 uint8_t inquiry_length; /* (N x 1.28) sec */
466 uint8_t num_responses; /* Max. # of responses */
467 } __packed hci_inquiry_cp;
468 /* No return parameter(s) */
469
470 #define HCI_OCF_INQUIRY_CANCEL 0x0002
471 #define HCI_CMD_INQUIRY_CANCEL 0x0402
472 /* No command parameter(s) */
473 typedef hci_status_rp hci_inquiry_cancel_rp;
474
475 #define HCI_OCF_PERIODIC_INQUIRY 0x0003
476 #define HCI_CMD_PERIODIC_INQUIRY 0x0403
477 typedef struct {
478 uint16_t max_period_length; /* Max. and min. amount of time */
479 uint16_t min_period_length; /* between consecutive inquiries */
480 uint8_t lap[HCI_LAP_SIZE]; /* LAP */
481 uint8_t inquiry_length; /* (inquiry_length * 1.28) sec */
482 uint8_t num_responses; /* Max. # of responses */
483 } __packed hci_periodic_inquiry_cp;
484
485 typedef hci_status_rp hci_periodic_inquiry_rp;
486
487 #define HCI_OCF_EXIT_PERIODIC_INQUIRY 0x0004
488 #define HCI_CMD_EXIT_PERIODIC_INQUIRY 0x0404
489 /* No command parameter(s) */
490 typedef hci_status_rp hci_exit_periodic_inquiry_rp;
491
492 #define HCI_OCF_CREATE_CON 0x0005
493 #define HCI_CMD_CREATE_CON 0x0405
494 typedef struct {
495 bdaddr_t bdaddr; /* destination address */
496 uint16_t pkt_type; /* packet type */
497 uint8_t page_scan_rep_mode; /* page scan repetition mode */
498 uint8_t page_scan_mode; /* reserved - set to 0x00 */
499 uint16_t clock_offset; /* clock offset */
500 uint8_t accept_role_switch; /* accept role switch? 0x00 == No */
501 } __packed hci_create_con_cp;
502 /* No return parameter(s) */
503
504 #define HCI_OCF_DISCONNECT 0x0006
505 #define HCI_CMD_DISCONNECT 0x0406
506 typedef struct {
507 uint16_t con_handle; /* connection handle */
508 uint8_t reason; /* reason to disconnect */
509 } __packed hci_discon_cp;
510 /* No return parameter(s) */
511
512 /* Add SCO Connection is deprecated */
513 #define HCI_OCF_ADD_SCO_CON 0x0007
514 #define HCI_CMD_ADD_SCO_CON 0x0407
515 typedef struct {
516 uint16_t con_handle; /* connection handle */
517 uint16_t pkt_type; /* packet type */
518 } __packed hci_add_sco_con_cp;
519 /* No return parameter(s) */
520
521 #define HCI_OCF_CREATE_CON_CANCEL 0x0008
522 #define HCI_CMD_CREATE_CON_CANCEL 0x0408
523 typedef struct {
524 bdaddr_t bdaddr; /* destination address */
525 } __packed hci_create_con_cancel_cp;
526
527 typedef struct {
528 uint8_t status; /* 0x00 - success */
529 bdaddr_t bdaddr; /* destination address */
530 } __packed hci_create_con_cancel_rp;
531
532 #define HCI_OCF_ACCEPT_CON 0x0009
533 #define HCI_CMD_ACCEPT_CON 0x0409
534 typedef struct {
535 bdaddr_t bdaddr; /* address of unit to be connected */
536 uint8_t role; /* connection role */
537 } __packed hci_accept_con_cp;
538 /* No return parameter(s) */
539
540 #define HCI_OCF_REJECT_CON 0x000a
541 #define HCI_CMD_REJECT_CON 0x040A
542 typedef struct {
543 bdaddr_t bdaddr; /* remote address */
544 uint8_t reason; /* reason to reject */
545 } __packed hci_reject_con_cp;
546 /* No return parameter(s) */
547
548 #define HCI_OCF_LINK_KEY_REP 0x000b
549 #define HCI_CMD_LINK_KEY_REP 0x040B
550 typedef struct {
551 bdaddr_t bdaddr; /* remote address */
552 uint8_t key[HCI_KEY_SIZE]; /* key */
553 } __packed hci_link_key_rep_cp;
554
555 typedef struct {
556 uint8_t status; /* 0x00 - success */
557 bdaddr_t bdaddr; /* unit address */
558 } __packed hci_link_key_rep_rp;
559
560 #define HCI_OCF_LINK_KEY_NEG_REP 0x000c
561 #define HCI_CMD_LINK_KEY_NEG_REP 0x040C
562 typedef struct {
563 bdaddr_t bdaddr; /* remote address */
564 } __packed hci_link_key_neg_rep_cp;
565
566 typedef struct {
567 uint8_t status; /* 0x00 - success */
568 bdaddr_t bdaddr; /* unit address */
569 } __packed hci_link_key_neg_rep_rp;
570
571 #define HCI_OCF_PIN_CODE_REP 0x000d
572 #define HCI_CMD_PIN_CODE_REP 0x040D
573 typedef struct {
574 bdaddr_t bdaddr; /* remote address */
575 uint8_t pin_size; /* pin code length (in bytes) */
576 uint8_t pin[HCI_PIN_SIZE]; /* pin code */
577 } __packed hci_pin_code_rep_cp;
578
579 typedef struct {
580 uint8_t status; /* 0x00 - success */
581 bdaddr_t bdaddr; /* unit address */
582 } __packed hci_pin_code_rep_rp;
583
584 #define HCI_OCF_PIN_CODE_NEG_REP 0x000e
585 #define HCI_CMD_PIN_CODE_NEG_REP 0x040E
586 typedef struct {
587 bdaddr_t bdaddr; /* remote address */
588 } __packed hci_pin_code_neg_rep_cp;
589
590 typedef struct {
591 uint8_t status; /* 0x00 - success */
592 bdaddr_t bdaddr; /* unit address */
593 } __packed hci_pin_code_neg_rep_rp;
594
595 #define HCI_OCF_CHANGE_CON_PACKET_TYPE 0x000f
596 #define HCI_CMD_CHANGE_CON_PACKET_TYPE 0x040F
597 typedef struct {
598 uint16_t con_handle; /* connection handle */
599 uint16_t pkt_type; /* packet type */
600 } __packed hci_change_con_pkt_type_cp;
601 /* No return parameter(s) */
602
603 #define HCI_OCF_AUTH_REQ 0x0011
604 #define HCI_CMD_AUTH_REQ 0x0411
605 typedef struct {
606 uint16_t con_handle; /* connection handle */
607 } __packed hci_auth_req_cp;
608 /* No return parameter(s) */
609
610 #define HCI_OCF_SET_CON_ENCRYPTION 0x0013
611 #define HCI_CMD_SET_CON_ENCRYPTION 0x0413
612 typedef struct {
613 uint16_t con_handle; /* connection handle */
614 uint8_t encryption_enable; /* 0x00 - disable, 0x01 - enable */
615 } __packed hci_set_con_encryption_cp;
616 /* No return parameter(s) */
617
618 #define HCI_OCF_CHANGE_CON_LINK_KEY 0x0015
619 #define HCI_CMD_CHANGE_CON_LINK_KEY 0x0415
620 typedef struct {
621 uint16_t con_handle; /* connection handle */
622 } __packed hci_change_con_link_key_cp;
623 /* No return parameter(s) */
624
625 #define HCI_OCF_MASTER_LINK_KEY 0x0017
626 #define HCI_CMD_MASTER_LINK_KEY 0x0417
627 typedef struct {
628 uint8_t key_flag; /* key flag */
629 } __packed hci_master_link_key_cp;
630 /* No return parameter(s) */
631
632 #define HCI_OCF_REMOTE_NAME_REQ 0x0019
633 #define HCI_CMD_REMOTE_NAME_REQ 0x0419
634 typedef struct {
635 bdaddr_t bdaddr; /* remote address */
636 uint8_t page_scan_rep_mode; /* page scan repetition mode */
637 uint8_t page_scan_mode; /* page scan mode */
638 uint16_t clock_offset; /* clock offset */
639 } __packed hci_remote_name_req_cp;
640 /* No return parameter(s) */
641
642 #define HCI_OCF_REMOTE_NAME_REQ_CANCEL 0x001a
643 #define HCI_CMD_REMOTE_NAME_REQ_CANCEL 0x041A
644 typedef struct {
645 bdaddr_t bdaddr; /* remote address */
646 } __packed hci_remote_name_req_cancel_cp;
647
648 typedef struct {
649 uint8_t status; /* 0x00 - success */
650 bdaddr_t bdaddr; /* remote address */
651 } __packed hci_remote_name_req_cancel_rp;
652
653 #define HCI_OCF_READ_REMOTE_FEATURES 0x001b
654 #define HCI_CMD_READ_REMOTE_FEATURES 0x041B
655 typedef struct {
656 uint16_t con_handle; /* connection handle */
657 } __packed hci_read_remote_features_cp;
658 /* No return parameter(s) */
659
660 #define HCI_OCF_READ_REMOTE_EXTENDED_FEATURES 0x001c
661 #define HCI_CMD_READ_REMOTE_EXTENDED_FEATURES 0x041C
662 typedef struct {
663 uint16_t con_handle; /* connection handle */
664 uint8_t page; /* page number */
665 } __packed hci_read_remote_extended_features_cp;
666 /* No return parameter(s) */
667
668 #define HCI_OCF_READ_REMOTE_VER_INFO 0x001d
669 #define HCI_CMD_READ_REMOTE_VER_INFO 0x041D
670 typedef struct {
671 uint16_t con_handle; /* connection handle */
672 } __packed hci_read_remote_ver_info_cp;
673 /* No return parameter(s) */
674
675 #define HCI_OCF_READ_CLOCK_OFFSET 0x001f
676 #define HCI_CMD_READ_CLOCK_OFFSET 0x041F
677 typedef struct {
678 uint16_t con_handle; /* connection handle */
679 } __packed hci_read_clock_offset_cp;
680 /* No return parameter(s) */
681
682 #define HCI_OCF_READ_LMP_HANDLE 0x0020
683 #define HCI_CMD_READ_LMP_HANDLE 0x0420
684 typedef struct {
685 uint16_t con_handle; /* connection handle */
686 } __packed hci_read_lmp_handle_cp;
687
688 typedef struct {
689 uint8_t status; /* 0x00 - success */
690 uint16_t con_handle; /* connection handle */
691 uint8_t lmp_handle; /* LMP handle */
692 uint32_t reserved; /* reserved */
693 } __packed hci_read_lmp_handle_rp;
694
695 #define HCI_OCF_SETUP_SCO_CON 0x0028
696 #define HCI_CMD_SETUP_SCO_CON 0x0428
697 typedef struct {
698 uint16_t con_handle; /* connection handle */
699 uint32_t tx_bandwidth; /* transmit bandwidth */
700 uint32_t rx_bandwidth; /* receive bandwidth */
701 uint16_t latency; /* maximum latency */
702 uint16_t voice; /* voice setting */
703 uint8_t rt_effort; /* retransmission effort */
704 uint16_t pkt_type; /* packet types */
705 } __packed hci_setup_sco_con_cp;
706 /* No return parameter(s) */
707
708 #define HCI_OCF_ACCEPT_SCO_CON_REQ 0x0029
709 #define HCI_CMD_ACCEPT_SCO_CON_REQ 0x0429
710 typedef struct {
711 bdaddr_t bdaddr; /* remote address */
712 uint32_t tx_bandwidth; /* transmit bandwidth */
713 uint32_t rx_bandwidth; /* receive bandwidth */
714 uint16_t latency; /* maximum latency */
715 uint16_t content; /* voice setting */
716 uint8_t rt_effort; /* retransmission effort */
717 uint16_t pkt_type; /* packet types */
718 } __packed hci_accept_sco_con_req_cp;
719 /* No return parameter(s) */
720
721 #define HCI_OCF_REJECT_SCO_CON_REQ 0x002a
722 #define HCI_CMD_REJECT_SCO_CON_REQ 0x042a
723 typedef struct {
724 bdaddr_t bdaddr; /* remote address */
725 uint8_t reason; /* reject error code */
726 } __packed hci_reject_sco_con_req_cp;
727 /* No return parameter(s) */
728
729 #define HCI_OCF_IO_CAPABILITY_REP 0x002b
730 #define HCI_CMD_IO_CAPABILITY_REP 0x042a
731 typedef struct {
732 bdaddr_t bdaddr; /* remote address */
733 uint8_t io_cap; /* IO capability */
734 uint8_t oob_data; /* OOB data present */
735 uint8_t auth_req; /* auth requirements */
736 } __packed hci_io_capability_rep_cp;
737
738 typedef struct {
739 uint8_t status; /* 0x00 - success */
740 bdaddr_t bdaddr; /* remote address */
741 } __packed hci_io_capability_rep_rp;
742
743 #define HCI_OCF_USER_CONFIRM_REP 0x002c
744 #define HCI_CMD_USER_CONFIRM_REP 0x042c
745 typedef struct {
746 bdaddr_t bdaddr; /* remote address */
747 } __packed hci_user_confirm_rep_cp;
748
749 typedef struct {
750 uint8_t status; /* 0x00 - success */
751 bdaddr_t bdaddr; /* remote address */
752 } __packed hci_user_confirm_rep_rp;
753
754 #define HCI_OCF_USER_CONFIRM_NEG_REP 0x002d
755 #define HCI_CMD_USER_CONFIRM_NEG_REP 0x042d
756 typedef struct {
757 bdaddr_t bdaddr; /* remote address */
758 } __packed hci_user_confirm_neg_rep_cp;
759
760 typedef struct {
761 uint8_t status; /* 0x00 - success */
762 bdaddr_t bdaddr; /* remote address */
763 } __packed hci_user_confirm_neg_rep_rp;
764
765 #define HCI_OCF_USER_PASSKEY_REP 0x002e
766 #define HCI_CMD_USER_PASSKEY_REP 0x042e
767 typedef struct {
768 bdaddr_t bdaddr; /* remote address */
769 uint32_t value; /* 000000 - 999999 */
770 } __packed hci_user_passkey_rep_cp;
771
772 typedef struct {
773 uint8_t status; /* 0x00 - success */
774 bdaddr_t bdaddr; /* remote address */
775 } __packed hci_user_passkey_rep_rp;
776
777 #define HCI_OCF_USER_PASSKEY_NEG_REP 0x002f
778 #define HCI_CMD_USER_PASSKEY_NEG_REP 0x042f
779 typedef struct {
780 bdaddr_t bdaddr; /* remote address */
781 } __packed hci_user_passkey_neg_rep_cp;
782
783 typedef struct {
784 uint8_t status; /* 0x00 - success */
785 bdaddr_t bdaddr; /* remote address */
786 } __packed hci_user_passkey_neg_rep_rp;
787
788 #define HCI_OCF_OOB_DATA_REP 0x0030
789 #define HCI_CMD_OOB_DATA_REP 0x0430
790 typedef struct {
791 bdaddr_t bdaddr; /* remote address */
792 uint8_t c[16]; /* pairing hash */
793 uint8_t r[16]; /* pairing randomizer */
794 } __packed hci_user_oob_data_rep_cp;
795
796 typedef struct {
797 uint8_t status; /* 0x00 - success */
798 bdaddr_t bdaddr; /* remote address */
799 } __packed hci_user_oob_data_rep_rp;
800
801 #define HCI_OCF_OOB_DATA_NEG_REP 0x0033
802 #define HCI_CMD_OOB_DATA_NEG_REP 0x0433
803 typedef struct {
804 bdaddr_t bdaddr; /* remote address */
805 } __packed hci_user_oob_data_neg_rep_cp;
806
807 typedef struct {
808 uint8_t status; /* 0x00 - success */
809 bdaddr_t bdaddr; /* remote address */
810 } __packed hci_user_oob_data_neg_rep_rp;
811
812 #define HCI_OCF_IO_CAPABILITY_NEG_REP 0x0034
813 #define HCI_CMD_IO_CAPABILITY_NEG_REP 0x0434
814 typedef struct {
815 bdaddr_t bdaddr; /* remote address */
816 uint8_t reason; /* error code */
817 } __packed hci_io_capability_neg_rep_cp;
818
819 typedef struct {
820 uint8_t status; /* 0x00 - success */
821 bdaddr_t bdaddr; /* remote address */
822 } __packed hci_io_capability_neg_rep_rp;
823
824 /**************************************************************************
825 **************************************************************************
826 ** OGF 0x02 Link policy commands and return parameters
827 **************************************************************************
828 **************************************************************************/
829
830 #define HCI_OGF_LINK_POLICY 0x02
831
832 #define HCI_OCF_HOLD_MODE 0x0001
833 #define HCI_CMD_HOLD_MODE 0x0801
834 typedef struct {
835 uint16_t con_handle; /* connection handle */
836 uint16_t max_interval; /* (max_interval * 0.625) msec */
837 uint16_t min_interval; /* (max_interval * 0.625) msec */
838 } __packed hci_hold_mode_cp;
839 /* No return parameter(s) */
840
841 #define HCI_OCF_SNIFF_MODE 0x0003
842 #define HCI_CMD_SNIFF_MODE 0x0803
843 typedef struct {
844 uint16_t con_handle; /* connection handle */
845 uint16_t max_interval; /* (max_interval * 0.625) msec */
846 uint16_t min_interval; /* (max_interval * 0.625) msec */
847 uint16_t attempt; /* (2 * attempt - 1) * 0.625 msec */
848 uint16_t timeout; /* (2 * attempt - 1) * 0.625 msec */
849 } __packed hci_sniff_mode_cp;
850 /* No return parameter(s) */
851
852 #define HCI_OCF_EXIT_SNIFF_MODE 0x0004
853 #define HCI_CMD_EXIT_SNIFF_MODE 0x0804
854 typedef struct {
855 uint16_t con_handle; /* connection handle */
856 } __packed hci_exit_sniff_mode_cp;
857 /* No return parameter(s) */
858
859 #define HCI_OCF_PARK_MODE 0x0005
860 #define HCI_CMD_PARK_MODE 0x0805
861 typedef struct {
862 uint16_t con_handle; /* connection handle */
863 uint16_t max_interval; /* (max_interval * 0.625) msec */
864 uint16_t min_interval; /* (max_interval * 0.625) msec */
865 } __packed hci_park_mode_cp;
866 /* No return parameter(s) */
867
868 #define HCI_OCF_EXIT_PARK_MODE 0x0006
869 #define HCI_CMD_EXIT_PARK_MODE 0x0806
870 typedef struct {
871 uint16_t con_handle; /* connection handle */
872 } __packed hci_exit_park_mode_cp;
873 /* No return parameter(s) */
874
875 #define HCI_OCF_QOS_SETUP 0x0007
876 #define HCI_CMD_QOS_SETUP 0x0807
877 typedef struct {
878 uint16_t con_handle; /* connection handle */
879 uint8_t flags; /* reserved for future use */
880 uint8_t service_type; /* service type */
881 uint32_t token_rate; /* bytes per second */
882 uint32_t peak_bandwidth; /* bytes per second */
883 uint32_t latency; /* microseconds */
884 uint32_t delay_variation; /* microseconds */
885 } __packed hci_qos_setup_cp;
886 /* No return parameter(s) */
887
888 #define HCI_OCF_ROLE_DISCOVERY 0x0009
889 #define HCI_CMD_ROLE_DISCOVERY 0x0809
890 typedef struct {
891 uint16_t con_handle; /* connection handle */
892 } __packed hci_role_discovery_cp;
893
894 typedef struct {
895 uint8_t status; /* 0x00 - success */
896 uint16_t con_handle; /* connection handle */
897 uint8_t role; /* role for the connection handle */
898 } __packed hci_role_discovery_rp;
899
900 #define HCI_OCF_SWITCH_ROLE 0x000b
901 #define HCI_CMD_SWITCH_ROLE 0x080B
902 typedef struct {
903 bdaddr_t bdaddr; /* remote address */
904 uint8_t role; /* new local role */
905 } __packed hci_switch_role_cp;
906 /* No return parameter(s) */
907
908 #define HCI_OCF_READ_LINK_POLICY_SETTINGS 0x000c
909 #define HCI_CMD_READ_LINK_POLICY_SETTINGS 0x080C
910 typedef struct {
911 uint16_t con_handle; /* connection handle */
912 } __packed hci_read_link_policy_settings_cp;
913
914 typedef struct {
915 uint8_t status; /* 0x00 - success */
916 uint16_t con_handle; /* connection handle */
917 uint16_t settings; /* link policy settings */
918 } __packed hci_read_link_policy_settings_rp;
919
920 #define HCI_OCF_WRITE_LINK_POLICY_SETTINGS 0x000d
921 #define HCI_CMD_WRITE_LINK_POLICY_SETTINGS 0x080D
922 typedef struct {
923 uint16_t con_handle; /* connection handle */
924 uint16_t settings; /* link policy settings */
925 } __packed hci_write_link_policy_settings_cp;
926
927 typedef struct {
928 uint8_t status; /* 0x00 - success */
929 uint16_t con_handle; /* connection handle */
930 } __packed hci_write_link_policy_settings_rp;
931
932 #define HCI_OCF_READ_DEFAULT_LINK_POLICY_SETTINGS 0x000e
933 #define HCI_CMD_READ_DEFAULT_LINK_POLICY_SETTINGS 0x080E
934 /* No command parameter(s) */
935 typedef struct {
936 uint8_t status; /* 0x00 - success */
937 uint16_t settings; /* link policy settings */
938 } __packed hci_read_default_link_policy_settings_rp;
939
940 #define HCI_OCF_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x000f
941 #define HCI_CMD_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x080F
942 typedef struct {
943 uint16_t settings; /* link policy settings */
944 } __packed hci_write_default_link_policy_settings_cp;
945
946 typedef hci_status_rp hci_write_default_link_policy_settings_rp;
947
948 #define HCI_OCF_FLOW_SPECIFICATION 0x0010
949 #define HCI_CMD_FLOW_SPECIFICATION 0x0810
950 typedef struct {
951 uint16_t con_handle; /* connection handle */
952 uint8_t flags; /* reserved */
953 uint8_t flow_direction;
954 uint8_t service_type;
955 uint32_t token_rate;
956 uint32_t token_bucket;
957 uint32_t peak_bandwidth;
958 uint32_t latency;
959 } __packed hci_flow_specification_cp;
960 /* No return parameter(s) */
961
962 #define HCI_OCF_SNIFF_SUBRATING 0x0011
963 #define HCI_CMD_SNIFF_SUBRATING 0x0810
964 typedef struct {
965 uint16_t con_handle; /* connection handle */
966 uint16_t max_latency;
967 uint16_t max_timeout; /* max remote timeout */
968 uint16_t min_timeout; /* min local timeout */
969 } __packed hci_sniff_subrating_cp;
970
971 typedef struct {
972 uint8_t status; /* 0x00 - success */
973 uint16_t con_handle; /* connection handle */
974 } __packed hci_sniff_subrating_rp;
975
976 /**************************************************************************
977 **************************************************************************
978 ** OGF 0x03 Host Controller and Baseband commands and return parameters
979 **************************************************************************
980 **************************************************************************/
981
982 #define HCI_OGF_HC_BASEBAND 0x03
983
984 #define HCI_OCF_SET_EVENT_MASK 0x0001
985 #define HCI_CMD_SET_EVENT_MASK 0x0C01
986 typedef struct {
987 uint8_t event_mask[HCI_EVENT_MASK_SIZE]; /* event_mask */
988 } __packed hci_set_event_mask_cp;
989
990 typedef hci_status_rp hci_set_event_mask_rp;
991
992 #define HCI_OCF_RESET 0x0003
993 #define HCI_CMD_RESET 0x0C03
994 /* No command parameter(s) */
995 typedef hci_status_rp hci_reset_rp;
996
997 #define HCI_OCF_SET_EVENT_FILTER 0x0005
998 #define HCI_CMD_SET_EVENT_FILTER 0x0C05
999 typedef struct {
1000 uint8_t filter_type; /* filter type */
1001 uint8_t filter_condition_type; /* filter condition type */
1002 /* variable size condition
1003 uint8_t condition[]; -- conditions */
1004 } __packed hci_set_event_filter_cp;
1005
1006 typedef hci_status_rp hci_set_event_filter_rp;
1007
1008 #define HCI_OCF_FLUSH 0x0008
1009 #define HCI_CMD_FLUSH 0x0C08
1010 typedef struct {
1011 uint16_t con_handle; /* connection handle */
1012 } __packed hci_flush_cp;
1013
1014 typedef struct {
1015 uint8_t status; /* 0x00 - success */
1016 uint16_t con_handle; /* connection handle */
1017 } __packed hci_flush_rp;
1018
1019 #define HCI_OCF_READ_PIN_TYPE 0x0009
1020 #define HCI_CMD_READ_PIN_TYPE 0x0C09
1021 /* No command parameter(s) */
1022 typedef struct {
1023 uint8_t status; /* 0x00 - success */
1024 uint8_t pin_type; /* PIN type */
1025 } __packed hci_read_pin_type_rp;
1026
1027 #define HCI_OCF_WRITE_PIN_TYPE 0x000a
1028 #define HCI_CMD_WRITE_PIN_TYPE 0x0C0A
1029 typedef struct {
1030 uint8_t pin_type; /* PIN type */
1031 } __packed hci_write_pin_type_cp;
1032
1033 typedef hci_status_rp hci_write_pin_type_rp;
1034
1035 #define HCI_OCF_CREATE_NEW_UNIT_KEY 0x000b
1036 #define HCI_CMD_CREATE_NEW_UNIT_KEY 0x0C0B
1037 /* No command parameter(s) */
1038 typedef hci_status_rp hci_create_new_unit_key_rp;
1039
1040 #define HCI_OCF_READ_STORED_LINK_KEY 0x000d
1041 #define HCI_CMD_READ_STORED_LINK_KEY 0x0C0D
1042 typedef struct {
1043 bdaddr_t bdaddr; /* address */
1044 uint8_t read_all; /* read all keys? 0x01 - yes */
1045 } __packed hci_read_stored_link_key_cp;
1046
1047 typedef struct {
1048 uint8_t status; /* 0x00 - success */
1049 uint16_t max_num_keys; /* Max. number of keys */
1050 uint16_t num_keys_read; /* Number of stored keys */
1051 } __packed hci_read_stored_link_key_rp;
1052
1053 #define HCI_OCF_WRITE_STORED_LINK_KEY 0x0011
1054 #define HCI_CMD_WRITE_STORED_LINK_KEY 0x0C11
1055 typedef struct {
1056 uint8_t num_keys_write; /* # of keys to write */
1057 /* these are repeated "num_keys_write" times
1058 bdaddr_t bdaddr; --- remote address(es)
1059 uint8_t key[HCI_KEY_SIZE]; --- key(s) */
1060 } __packed hci_write_stored_link_key_cp;
1061
1062 typedef struct {
1063 uint8_t status; /* 0x00 - success */
1064 uint8_t num_keys_written; /* # of keys successfully written */
1065 } __packed hci_write_stored_link_key_rp;
1066
1067 #define HCI_OCF_DELETE_STORED_LINK_KEY 0x0012
1068 #define HCI_CMD_DELETE_STORED_LINK_KEY 0x0C12
1069 typedef struct {
1070 bdaddr_t bdaddr; /* address */
1071 uint8_t delete_all; /* delete all keys? 0x01 - yes */
1072 } __packed hci_delete_stored_link_key_cp;
1073
1074 typedef struct {
1075 uint8_t status; /* 0x00 - success */
1076 uint16_t num_keys_deleted; /* Number of keys deleted */
1077 } __packed hci_delete_stored_link_key_rp;
1078
1079 #define HCI_OCF_WRITE_LOCAL_NAME 0x0013
1080 #define HCI_CMD_WRITE_LOCAL_NAME 0x0C13
1081 typedef struct {
1082 char name[HCI_UNIT_NAME_SIZE]; /* new unit name */
1083 } __packed hci_write_local_name_cp;
1084
1085 typedef hci_status_rp hci_write_local_name_rp;
1086
1087 #define HCI_OCF_READ_LOCAL_NAME 0x0014
1088 #define HCI_CMD_READ_LOCAL_NAME 0x0C14
1089 /* No command parameter(s) */
1090 typedef struct {
1091 uint8_t status; /* 0x00 - success */
1092 char name[HCI_UNIT_NAME_SIZE]; /* unit name */
1093 } __packed hci_read_local_name_rp;
1094
1095 #define HCI_OCF_READ_CON_ACCEPT_TIMEOUT 0x0015
1096 #define HCI_CMD_READ_CON_ACCEPT_TIMEOUT 0x0C15
1097 /* No command parameter(s) */
1098 typedef struct {
1099 uint8_t status; /* 0x00 - success */
1100 uint16_t timeout; /* (timeout * 0.625) msec */
1101 } __packed hci_read_con_accept_timeout_rp;
1102
1103 #define HCI_OCF_WRITE_CON_ACCEPT_TIMEOUT 0x0016
1104 #define HCI_CMD_WRITE_CON_ACCEPT_TIMEOUT 0x0C16
1105 typedef struct {
1106 uint16_t timeout; /* (timeout * 0.625) msec */
1107 } __packed hci_write_con_accept_timeout_cp;
1108
1109 typedef hci_status_rp hci_write_con_accept_timeout_rp;
1110
1111 #define HCI_OCF_READ_PAGE_TIMEOUT 0x0017
1112 #define HCI_CMD_READ_PAGE_TIMEOUT 0x0C17
1113 /* No command parameter(s) */
1114 typedef struct {
1115 uint8_t status; /* 0x00 - success */
1116 uint16_t timeout; /* (timeout * 0.625) msec */
1117 } __packed hci_read_page_timeout_rp;
1118
1119 #define HCI_OCF_WRITE_PAGE_TIMEOUT 0x0018
1120 #define HCI_CMD_WRITE_PAGE_TIMEOUT 0x0C18
1121 typedef struct {
1122 uint16_t timeout; /* (timeout * 0.625) msec */
1123 } __packed hci_write_page_timeout_cp;
1124
1125 typedef hci_status_rp hci_write_page_timeout_rp;
1126
1127 #define HCI_OCF_READ_SCAN_ENABLE 0x0019
1128 #define HCI_CMD_READ_SCAN_ENABLE 0x0C19
1129 /* No command parameter(s) */
1130 typedef struct {
1131 uint8_t status; /* 0x00 - success */
1132 uint8_t scan_enable; /* Scan enable */
1133 } __packed hci_read_scan_enable_rp;
1134
1135 #define HCI_OCF_WRITE_SCAN_ENABLE 0x001a
1136 #define HCI_CMD_WRITE_SCAN_ENABLE 0x0C1A
1137 typedef struct {
1138 uint8_t scan_enable; /* Scan enable */
1139 } __packed hci_write_scan_enable_cp;
1140
1141 typedef hci_status_rp hci_write_scan_enable_rp;
1142
1143 #define HCI_OCF_READ_PAGE_SCAN_ACTIVITY 0x001b
1144 #define HCI_CMD_READ_PAGE_SCAN_ACTIVITY 0x0C1B
1145 /* No command parameter(s) */
1146 typedef struct {
1147 uint8_t status; /* 0x00 - success */
1148 uint16_t page_scan_interval; /* interval * 0.625 msec */
1149 uint16_t page_scan_window; /* window * 0.625 msec */
1150 } __packed hci_read_page_scan_activity_rp;
1151
1152 #define HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001c
1153 #define HCI_CMD_WRITE_PAGE_SCAN_ACTIVITY 0x0C1C
1154 typedef struct {
1155 uint16_t page_scan_interval; /* interval * 0.625 msec */
1156 uint16_t page_scan_window; /* window * 0.625 msec */
1157 } __packed hci_write_page_scan_activity_cp;
1158
1159 typedef hci_status_rp hci_write_page_scan_activity_rp;
1160
1161 #define HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY 0x001d
1162 #define HCI_CMD_READ_INQUIRY_SCAN_ACTIVITY 0x0C1D
1163 /* No command parameter(s) */
1164 typedef struct {
1165 uint8_t status; /* 0x00 - success */
1166 uint16_t inquiry_scan_interval; /* interval * 0.625 msec */
1167 uint16_t inquiry_scan_window; /* window * 0.625 msec */
1168 } __packed hci_read_inquiry_scan_activity_rp;
1169
1170 #define HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY 0x001e
1171 #define HCI_CMD_WRITE_INQUIRY_SCAN_ACTIVITY 0x0C1E
1172 typedef struct {
1173 uint16_t inquiry_scan_interval; /* interval * 0.625 msec */
1174 uint16_t inquiry_scan_window; /* window * 0.625 msec */
1175 } __packed hci_write_inquiry_scan_activity_cp;
1176
1177 typedef hci_status_rp hci_write_inquiry_scan_activity_rp;
1178
1179 #define HCI_OCF_READ_AUTH_ENABLE 0x001f
1180 #define HCI_CMD_READ_AUTH_ENABLE 0x0C1F
1181 /* No command parameter(s) */
1182 typedef struct {
1183 uint8_t status; /* 0x00 - success */
1184 uint8_t auth_enable; /* 0x01 - enabled */
1185 } __packed hci_read_auth_enable_rp;
1186
1187 #define HCI_OCF_WRITE_AUTH_ENABLE 0x0020
1188 #define HCI_CMD_WRITE_AUTH_ENABLE 0x0C20
1189 typedef struct {
1190 uint8_t auth_enable; /* 0x01 - enabled */
1191 } __packed hci_write_auth_enable_cp;
1192
1193 typedef hci_status_rp hci_write_auth_enable_rp;
1194
1195 /* Read Encryption Mode is deprecated */
1196 #define HCI_OCF_READ_ENCRYPTION_MODE 0x0021
1197 #define HCI_CMD_READ_ENCRYPTION_MODE 0x0C21
1198 /* No command parameter(s) */
1199 typedef struct {
1200 uint8_t status; /* 0x00 - success */
1201 uint8_t encryption_mode; /* encryption mode */
1202 } __packed hci_read_encryption_mode_rp;
1203
1204 /* Write Encryption Mode is deprecated */
1205 #define HCI_OCF_WRITE_ENCRYPTION_MODE 0x0022
1206 #define HCI_CMD_WRITE_ENCRYPTION_MODE 0x0C22
1207 typedef struct {
1208 uint8_t encryption_mode; /* encryption mode */
1209 } __packed hci_write_encryption_mode_cp;
1210
1211 typedef hci_status_rp hci_write_encryption_mode_rp;
1212
1213 #define HCI_OCF_READ_UNIT_CLASS 0x0023
1214 #define HCI_CMD_READ_UNIT_CLASS 0x0C23
1215 /* No command parameter(s) */
1216 typedef struct {
1217 uint8_t status; /* 0x00 - success */
1218 uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */
1219 } __packed hci_read_unit_class_rp;
1220
1221 #define HCI_OCF_WRITE_UNIT_CLASS 0x0024
1222 #define HCI_CMD_WRITE_UNIT_CLASS 0x0C24
1223 typedef struct {
1224 uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */
1225 } __packed hci_write_unit_class_cp;
1226
1227 typedef hci_status_rp hci_write_unit_class_rp;
1228
1229 #define HCI_OCF_READ_VOICE_SETTING 0x0025
1230 #define HCI_CMD_READ_VOICE_SETTING 0x0C25
1231 /* No command parameter(s) */
1232 typedef struct {
1233 uint8_t status; /* 0x00 - success */
1234 uint16_t settings; /* voice settings */
1235 } __packed hci_read_voice_setting_rp;
1236
1237 #define HCI_OCF_WRITE_VOICE_SETTING 0x0026
1238 #define HCI_CMD_WRITE_VOICE_SETTING 0x0C26
1239 typedef struct {
1240 uint16_t settings; /* voice settings */
1241 } __packed hci_write_voice_setting_cp;
1242
1243 typedef hci_status_rp hci_write_voice_setting_rp;
1244
1245 #define HCI_OCF_READ_AUTO_FLUSH_TIMEOUT 0x0027
1246 #define HCI_CMD_READ_AUTO_FLUSH_TIMEOUT 0x0C27
1247 typedef struct {
1248 uint16_t con_handle; /* connection handle */
1249 } __packed hci_read_auto_flush_timeout_cp;
1250
1251 typedef struct {
1252 uint8_t status; /* 0x00 - success */
1253 uint16_t con_handle; /* connection handle */
1254 uint16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */
1255 } __packed hci_read_auto_flush_timeout_rp;
1256
1257 #define HCI_OCF_WRITE_AUTO_FLUSH_TIMEOUT 0x0028
1258 #define HCI_CMD_WRITE_AUTO_FLUSH_TIMEOUT 0x0C28
1259 typedef struct {
1260 uint16_t con_handle; /* connection handle */
1261 uint16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */
1262 } __packed hci_write_auto_flush_timeout_cp;
1263
1264 typedef struct {
1265 uint8_t status; /* 0x00 - success */
1266 uint16_t con_handle; /* connection handle */
1267 } __packed hci_write_auto_flush_timeout_rp;
1268
1269 #define HCI_OCF_READ_NUM_BROADCAST_RETRANS 0x0029
1270 #define HCI_CMD_READ_NUM_BROADCAST_RETRANS 0x0C29
1271 /* No command parameter(s) */
1272 typedef struct {
1273 uint8_t status; /* 0x00 - success */
1274 uint8_t counter; /* number of broadcast retransmissions */
1275 } __packed hci_read_num_broadcast_retrans_rp;
1276
1277 #define HCI_OCF_WRITE_NUM_BROADCAST_RETRANS 0x002a
1278 #define HCI_CMD_WRITE_NUM_BROADCAST_RETRANS 0x0C2A
1279 typedef struct {
1280 uint8_t counter; /* number of broadcast retransmissions */
1281 } __packed hci_write_num_broadcast_retrans_cp;
1282
1283 typedef hci_status_rp hci_write_num_broadcast_retrans_rp;
1284
1285 #define HCI_OCF_READ_HOLD_MODE_ACTIVITY 0x002b
1286 #define HCI_CMD_READ_HOLD_MODE_ACTIVITY 0x0C2B
1287 /* No command parameter(s) */
1288 typedef struct {
1289 uint8_t status; /* 0x00 - success */
1290 uint8_t hold_mode_activity; /* Hold mode activities */
1291 } __packed hci_read_hold_mode_activity_rp;
1292
1293 #define HCI_OCF_WRITE_HOLD_MODE_ACTIVITY 0x002c
1294 #define HCI_CMD_WRITE_HOLD_MODE_ACTIVITY 0x0C2C
1295 typedef struct {
1296 uint8_t hold_mode_activity; /* Hold mode activities */
1297 } __packed hci_write_hold_mode_activity_cp;
1298
1299 typedef hci_status_rp hci_write_hold_mode_activity_rp;
1300
1301 #define HCI_OCF_READ_XMIT_LEVEL 0x002d
1302 #define HCI_CMD_READ_XMIT_LEVEL 0x0C2D
1303 typedef struct {
1304 uint16_t con_handle; /* connection handle */
1305 uint8_t type; /* Xmit level type */
1306 } __packed hci_read_xmit_level_cp;
1307
1308 typedef struct {
1309 uint8_t status; /* 0x00 - success */
1310 uint16_t con_handle; /* connection handle */
1311 char level; /* -30 <= level <= 30 dBm */
1312 } __packed hci_read_xmit_level_rp;
1313
1314 #define HCI_OCF_READ_SCO_FLOW_CONTROL 0x002e
1315 #define HCI_CMD_READ_SCO_FLOW_CONTROL 0x0C2E
1316 /* No command parameter(s) */
1317 typedef struct {
1318 uint8_t status; /* 0x00 - success */
1319 uint8_t flow_control; /* 0x00 - disabled */
1320 } __packed hci_read_sco_flow_control_rp;
1321
1322 #define HCI_OCF_WRITE_SCO_FLOW_CONTROL 0x002f
1323 #define HCI_CMD_WRITE_SCO_FLOW_CONTROL 0x0C2F
1324 typedef struct {
1325 uint8_t flow_control; /* 0x00 - disabled */
1326 } __packed hci_write_sco_flow_control_cp;
1327
1328 typedef hci_status_rp hci_write_sco_flow_control_rp;
1329
1330 #define HCI_OCF_HC2H_FLOW_CONTROL 0x0031
1331 #define HCI_CMD_HC2H_FLOW_CONTROL 0x0C31
1332 typedef struct {
1333 uint8_t hc2h_flow; /* Host Controller to Host flow control */
1334 } __packed hci_hc2h_flow_control_cp;
1335
1336 typedef hci_status_rp hci_h2hc_flow_control_rp;
1337
1338 #define HCI_OCF_HOST_BUFFER_SIZE 0x0033
1339 #define HCI_CMD_HOST_BUFFER_SIZE 0x0C33
1340 typedef struct {
1341 uint16_t max_acl_size; /* Max. size of ACL packet (bytes) */
1342 uint8_t max_sco_size; /* Max. size of SCO packet (bytes) */
1343 uint16_t num_acl_pkts; /* Max. number of ACL packets */
1344 uint16_t num_sco_pkts; /* Max. number of SCO packets */
1345 } __packed hci_host_buffer_size_cp;
1346
1347 typedef hci_status_rp hci_host_buffer_size_rp;
1348
1349 #define HCI_OCF_HOST_NUM_COMPL_PKTS 0x0035
1350 #define HCI_CMD_HOST_NUM_COMPL_PKTS 0x0C35
1351 typedef struct {
1352 uint8_t nu_con_handles; /* # of connection handles */
1353 /* these are repeated "num_con_handles" times
1354 uint16_t con_handle; --- connection handle(s)
1355 uint16_t compl_pkts; --- # of completed packets */
1356 } __packed hci_host_num_compl_pkts_cp;
1357 /* No return parameter(s) */
1358
1359 #define HCI_OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036
1360 #define HCI_CMD_READ_LINK_SUPERVISION_TIMEOUT 0x0C36
1361 typedef struct {
1362 uint16_t con_handle; /* connection handle */
1363 } __packed hci_read_link_supervision_timeout_cp;
1364
1365 typedef struct {
1366 uint8_t status; /* 0x00 - success */
1367 uint16_t con_handle; /* connection handle */
1368 uint16_t timeout; /* Link supervision timeout * 0.625 msec */
1369 } __packed hci_read_link_supervision_timeout_rp;
1370
1371 #define HCI_OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037
1372 #define HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT 0x0C37
1373 typedef struct {
1374 uint16_t con_handle; /* connection handle */
1375 uint16_t timeout; /* Link supervision timeout * 0.625 msec */
1376 } __packed hci_write_link_supervision_timeout_cp;
1377
1378 typedef struct {
1379 uint8_t status; /* 0x00 - success */
1380 uint16_t con_handle; /* connection handle */
1381 } __packed hci_write_link_supervision_timeout_rp;
1382
1383 #define HCI_OCF_READ_NUM_SUPPORTED_IAC 0x0038
1384 #define HCI_CMD_READ_NUM_SUPPORTED_IAC 0x0C38
1385 /* No command parameter(s) */
1386 typedef struct {
1387 uint8_t status; /* 0x00 - success */
1388 uint8_t num_iac; /* # of supported IAC during scan */
1389 } __packed hci_read_num_supported_iac_rp;
1390
1391 #define HCI_OCF_READ_IAC_LAP 0x0039
1392 #define HCI_CMD_READ_IAC_LAP 0x0C39
1393 /* No command parameter(s) */
1394 typedef struct {
1395 uint8_t status; /* 0x00 - success */
1396 uint8_t num_iac; /* # of IAC */
1397 /* these are repeated "num_iac" times
1398 uint8_t laps[HCI_LAP_SIZE]; --- LAPs */
1399 } __packed hci_read_iac_lap_rp;
1400
1401 #define HCI_OCF_WRITE_IAC_LAP 0x003a
1402 #define HCI_CMD_WRITE_IAC_LAP 0x0C3A
1403 typedef struct {
1404 uint8_t num_iac; /* # of IAC */
1405 /* these are repeated "num_iac" times
1406 uint8_t laps[HCI_LAP_SIZE]; --- LAPs */
1407 } __packed hci_write_iac_lap_cp;
1408
1409 typedef hci_status_rp hci_write_iac_lap_rp;
1410
1411 /* Read Page Scan Period Mode is deprecated */
1412 #define HCI_OCF_READ_PAGE_SCAN_PERIOD 0x003b
1413 #define HCI_CMD_READ_PAGE_SCAN_PERIOD 0x0C3B
1414 /* No command parameter(s) */
1415 typedef struct {
1416 uint8_t status; /* 0x00 - success */
1417 uint8_t page_scan_period_mode; /* Page scan period mode */
1418 } __packed hci_read_page_scan_period_rp;
1419
1420 /* Write Page Scan Period Mode is deprecated */
1421 #define HCI_OCF_WRITE_PAGE_SCAN_PERIOD 0x003c
1422 #define HCI_CMD_WRITE_PAGE_SCAN_PERIOD 0x0C3C
1423 typedef struct {
1424 uint8_t page_scan_period_mode; /* Page scan period mode */
1425 } __packed hci_write_page_scan_period_cp;
1426
1427 typedef hci_status_rp hci_write_page_scan_period_rp;
1428
1429 /* Read Page Scan Mode is deprecated */
1430 #define HCI_OCF_READ_PAGE_SCAN 0x003d
1431 #define HCI_CMD_READ_PAGE_SCAN 0x0C3D
1432 /* No command parameter(s) */
1433 typedef struct {
1434 uint8_t status; /* 0x00 - success */
1435 uint8_t page_scan_mode; /* Page scan mode */
1436 } __packed hci_read_page_scan_rp;
1437
1438 /* Write Page Scan Mode is deprecated */
1439 #define HCI_OCF_WRITE_PAGE_SCAN 0x003e
1440 #define HCI_CMD_WRITE_PAGE_SCAN 0x0C3E
1441 typedef struct {
1442 uint8_t page_scan_mode; /* Page scan mode */
1443 } __packed hci_write_page_scan_cp;
1444
1445 typedef hci_status_rp hci_write_page_scan_rp;
1446
1447 #define HCI_OCF_SET_AFH_CLASSIFICATION 0x003f
1448 #define HCI_CMD_SET_AFH_CLASSIFICATION 0x0C3F
1449 typedef struct {
1450 uint8_t classification[10];
1451 } __packed hci_set_afh_classification_cp;
1452
1453 typedef hci_status_rp hci_set_afh_classification_rp;
1454
1455 #define HCI_OCF_READ_INQUIRY_SCAN_TYPE 0x0042
1456 #define HCI_CMD_READ_INQUIRY_SCAN_TYPE 0x0C42
1457 /* No command parameter(s) */
1458
1459 typedef struct {
1460 uint8_t status; /* 0x00 - success */
1461 uint8_t type; /* inquiry scan type */
1462 } __packed hci_read_inquiry_scan_type_rp;
1463
1464 #define HCI_OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043
1465 #define HCI_CMD_WRITE_INQUIRY_SCAN_TYPE 0x0C43
1466 typedef struct {
1467 uint8_t type; /* inquiry scan type */
1468 } __packed hci_write_inquiry_scan_type_cp;
1469
1470 typedef hci_status_rp hci_write_inquiry_scan_type_rp;
1471
1472 #define HCI_OCF_READ_INQUIRY_MODE 0x0044
1473 #define HCI_CMD_READ_INQUIRY_MODE 0x0C44
1474 /* No command parameter(s) */
1475
1476 typedef struct {
1477 uint8_t status; /* 0x00 - success */
1478 uint8_t mode; /* inquiry mode */
1479 } __packed hci_read_inquiry_mode_rp;
1480
1481 #define HCI_OCF_WRITE_INQUIRY_MODE 0x0045
1482 #define HCI_CMD_WRITE_INQUIRY_MODE 0x0C45
1483 typedef struct {
1484 uint8_t mode; /* inquiry mode */
1485 } __packed hci_write_inquiry_mode_cp;
1486
1487 typedef hci_status_rp hci_write_inquiry_mode_rp;
1488
1489 #define HCI_OCF_READ_PAGE_SCAN_TYPE 0x0046
1490 #define HCI_CMD_READ_PAGE_SCAN_TYPE 0x0C46
1491 /* No command parameter(s) */
1492
1493 typedef struct {
1494 uint8_t status; /* 0x00 - success */
1495 uint8_t type; /* page scan type */
1496 } __packed hci_read_page_scan_type_rp;
1497
1498 #define HCI_OCF_WRITE_PAGE_SCAN_TYPE 0x0047
1499 #define HCI_CMD_WRITE_PAGE_SCAN_TYPE 0x0C47
1500 typedef struct {
1501 uint8_t type; /* page scan type */
1502 } __packed hci_write_page_scan_type_cp;
1503
1504 typedef hci_status_rp hci_write_page_scan_type_rp;
1505
1506 #define HCI_OCF_READ_AFH_ASSESSMENT 0x0048
1507 #define HCI_CMD_READ_AFH_ASSESSMENT 0x0C48
1508 /* No command parameter(s) */
1509
1510 typedef struct {
1511 uint8_t status; /* 0x00 - success */
1512 uint8_t mode; /* assessment mode */
1513 } __packed hci_read_afh_assessment_rp;
1514
1515 #define HCI_OCF_WRITE_AFH_ASSESSMENT 0x0049
1516 #define HCI_CMD_WRITE_AFH_ASSESSMENT 0x0C49
1517 typedef struct {
1518 uint8_t mode; /* assessment mode */
1519 } __packed hci_write_afh_assessment_cp;
1520
1521 typedef hci_status_rp hci_write_afh_assessment_rp;
1522
1523 #define HCI_OCF_READ_EXTENDED_INQUIRY_RSP 0x0051
1524 #define HCI_CMD_READ_EXTENDED_INQUIRY_RSP 0x0C51
1525 /* No command parameter(s) */
1526
1527 typedef struct {
1528 uint8_t status; /* 0x00 - success */
1529 uint8_t fec_required;
1530 uint8_t response[240];
1531 } __packed hci_read_extended_inquiry_rsp_rp;
1532
1533 #define HCI_OCF_WRITE_EXTENDED_INQUIRY_RSP 0x0052
1534 #define HCI_CMD_WRITE_EXTENDED_INQUIRY_RSP 0x0C52
1535 typedef struct {
1536 uint8_t fec_required;
1537 uint8_t response[240];
1538 } __packed hci_write_extended_inquiry_rsp_cp;
1539
1540 typedef hci_status_rp hci_write_extended_inquiry_rsp_rp;
1541
1542 #define HCI_OCF_REFRESH_ENCRYPTION_KEY 0x0053
1543 #define HCI_CMD_REFRESH_ENCRYPTION_KEY 0x0C53
1544 typedef struct {
1545 uint16_t con_handle; /* connection handle */
1546 } __packed hci_refresh_encryption_key_cp;
1547
1548 typedef hci_status_rp hci_refresh_encryption_key_rp;
1549
1550 #define HCI_OCF_READ_SIMPLE_PAIRING_MODE 0x0055
1551 #define HCI_CMD_READ_SIMPLE_PAIRING_MODE 0x0C55
1552 /* No command parameter(s) */
1553
1554 typedef struct {
1555 uint8_t status; /* 0x00 - success */
1556 uint8_t mode; /* simple pairing mode */
1557 } __packed hci_read_simple_pairing_mode_rp;
1558
1559 #define HCI_OCF_WRITE_SIMPLE_PAIRING_MODE 0x0056
1560 #define HCI_CMD_WRITE_SIMPLE_PAIRING_MODE 0x0C56
1561 typedef struct {
1562 uint8_t mode; /* simple pairing mode */
1563 } __packed hci_write_simple_pairing_mode_cp;
1564
1565 typedef hci_status_rp hci_write_simple_pairing_mode_rp;
1566
1567 #define HCI_OCF_READ_LOCAL_OOB_DATA 0x0057
1568 #define HCI_CMD_READ_LOCAL_OOB_DATA 0x0C57
1569 /* No command parameter(s) */
1570
1571 typedef struct {
1572 uint8_t status; /* 0x00 - success */
1573 uint8_t c[16]; /* pairing hash */
1574 uint8_t r[16]; /* pairing randomizer */
1575 } __packed hci_read_local_oob_data_rp;
1576
1577 #define HCI_OCF_READ_INQUIRY_RSP_XMIT_POWER 0x0058
1578 #define HCI_CMD_READ_INQUIRY_RSP_XMIT_POWER 0x0C58
1579 /* No command parameter(s) */
1580
1581 typedef struct {
1582 uint8_t status; /* 0x00 - success */
1583 int8_t power; /* TX power */
1584 } __packed hci_read_inquiry_rsp_xmit_power_rp;
1585
1586 #define HCI_OCF_WRITE_INQUIRY_RSP_XMIT_POWER 0x0059
1587 #define HCI_CMD_WRITE_INQUIRY_RSP_XMIT_POWER 0x0C59
1588 typedef struct {
1589 int8_t power; /* TX power */
1590 } __packed hci_write_inquiry_rsp_xmit_power_cp;
1591
1592 typedef hci_status_rp hci_write_inquiry_rsp_xmit_power_rp;
1593
1594 #define HCI_OCF_READ_DEFAULT_ERRDATA_REPORTING 0x005A
1595 #define HCI_CMD_READ_DEFAULT_ERRDATA_REPORTING 0x0C5A
1596 /* No command parameter(s) */
1597
1598 typedef struct {
1599 uint8_t status; /* 0x00 - success */
1600 uint8_t reporting; /* erroneous data reporting */
1601 } __packed hci_read_default_errdata_reporting_rp;
1602
1603 #define HCI_OCF_WRITE_DEFAULT_ERRDATA_REPORTING 0x005B
1604 #define HCI_CMD_WRITE_DEFAULT_ERRDATA_REPORTING 0x0C5B
1605 typedef struct {
1606 uint8_t reporting; /* erroneous data reporting */
1607 } __packed hci_write_default_errdata_reporting_cp;
1608
1609 typedef hci_status_rp hci_write_default_errdata_reporting_rp;
1610
1611 #define HCI_OCF_ENHANCED_FLUSH 0x005F
1612 #define HCI_CMD_ENHANCED_FLUSH 0x0C5F
1613 typedef struct {
1614 uint16_t con_handle; /* connection handle */
1615 uint8_t packet_type;
1616 } __packed hci_enhanced_flush_cp;
1617
1618 /* No response parameter(s) */
1619
1620 #define HCI_OCF_SEND_KEYPRESS_NOTIFICATION 0x0060
1621 #define HCI_CMD_SEND_KEYPRESS_NOTIFICATION 0x0C60
1622 typedef struct {
1623 bdaddr_t bdaddr; /* remote address */
1624 uint8_t type; /* notification type */
1625 } __packed hci_send_keypress_notification_cp;
1626
1627 typedef struct {
1628 uint8_t status; /* 0x00 - success */
1629 bdaddr_t bdaddr; /* remote address */
1630 } __packed hci_send_keypress_notification_rp;
1631
1632 /**************************************************************************
1633 **************************************************************************
1634 ** OGF 0x04 Informational commands and return parameters
1635 **************************************************************************
1636 **************************************************************************/
1637
1638 #define HCI_OGF_INFO 0x04
1639
1640 #define HCI_OCF_READ_LOCAL_VER 0x0001
1641 #define HCI_CMD_READ_LOCAL_VER 0x1001
1642 /* No command parameter(s) */
1643 typedef struct {
1644 uint8_t status; /* 0x00 - success */
1645 uint8_t hci_version; /* HCI version */
1646 uint16_t hci_revision; /* HCI revision */
1647 uint8_t lmp_version; /* LMP version */
1648 uint16_t manufacturer; /* Hardware manufacturer name */
1649 uint16_t lmp_subversion; /* LMP sub-version */
1650 } __packed hci_read_local_ver_rp;
1651
1652 #define HCI_OCF_READ_LOCAL_COMMANDS 0x0002
1653 #define HCI_CMD_READ_LOCAL_COMMANDS 0x1002
1654 /* No command parameter(s) */
1655 typedef struct {
1656 uint8_t status; /* 0x00 - success */
1657 uint8_t commands[HCI_COMMANDS_SIZE]; /* opcode bitmask */
1658 } __packed hci_read_local_commands_rp;
1659
1660 #define HCI_OCF_READ_LOCAL_FEATURES 0x0003
1661 #define HCI_CMD_READ_LOCAL_FEATURES 0x1003
1662 /* No command parameter(s) */
1663 typedef struct {
1664 uint8_t status; /* 0x00 - success */
1665 uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
1666 } __packed hci_read_local_features_rp;
1667
1668 #define HCI_OCF_READ_LOCAL_EXTENDED_FEATURES 0x0004
1669 #define HCI_CMD_READ_LOCAL_EXTENDED_FEATURES 0x1004
1670 typedef struct {
1671 uint8_t page; /* page number */
1672 } __packed hci_read_local_extended_features_cp;
1673
1674 typedef struct {
1675 uint8_t status; /* 0x00 - success */
1676 uint8_t page; /* page number */
1677 uint8_t max_page; /* maximum page number */
1678 uint8_t features[HCI_FEATURES_SIZE]; /* LMP features */
1679 } __packed hci_read_local_extended_features_rp;
1680
1681 #define HCI_OCF_READ_BUFFER_SIZE 0x0005
1682 #define HCI_CMD_READ_BUFFER_SIZE 0x1005
1683 /* No command parameter(s) */
1684 typedef struct {
1685 uint8_t status; /* 0x00 - success */
1686 uint16_t max_acl_size; /* Max. size of ACL packet (bytes) */
1687 uint8_t max_sco_size; /* Max. size of SCO packet (bytes) */
1688 uint16_t num_acl_pkts; /* Max. number of ACL packets */
1689 uint16_t num_sco_pkts; /* Max. number of SCO packets */
1690 } __packed hci_read_buffer_size_rp;
1691
1692 /* Read Country Code is deprecated */
1693 #define HCI_OCF_READ_COUNTRY_CODE 0x0007
1694 #define HCI_CMD_READ_COUNTRY_CODE 0x1007
1695 /* No command parameter(s) */
1696 typedef struct {
1697 uint8_t status; /* 0x00 - success */
1698 uint8_t country_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */
1699 } __packed hci_read_country_code_rp;
1700
1701 #define HCI_OCF_READ_BDADDR 0x0009
1702 #define HCI_CMD_READ_BDADDR 0x1009
1703 /* No command parameter(s) */
1704 typedef struct {
1705 uint8_t status; /* 0x00 - success */
1706 bdaddr_t bdaddr; /* unit address */
1707 } __packed hci_read_bdaddr_rp;
1708
1709 /**************************************************************************
1710 **************************************************************************
1711 ** OGF 0x05 Status commands and return parameters
1712 **************************************************************************
1713 **************************************************************************/
1714
1715 #define HCI_OGF_STATUS 0x05
1716
1717 #define HCI_OCF_READ_FAILED_CONTACT_CNTR 0x0001
1718 #define HCI_CMD_READ_FAILED_CONTACT_CNTR 0x1401
1719 typedef struct {
1720 uint16_t con_handle; /* connection handle */
1721 } __packed hci_read_failed_contact_cntr_cp;
1722
1723 typedef struct {
1724 uint8_t status; /* 0x00 - success */
1725 uint16_t con_handle; /* connection handle */
1726 uint16_t counter; /* number of consecutive failed contacts */
1727 } __packed hci_read_failed_contact_cntr_rp;
1728
1729 #define HCI_OCF_RESET_FAILED_CONTACT_CNTR 0x0002
1730 #define HCI_CMD_RESET_FAILED_CONTACT_CNTR 0x1402
1731 typedef struct {
1732 uint16_t con_handle; /* connection handle */
1733 } __packed hci_reset_failed_contact_cntr_cp;
1734
1735 typedef struct {
1736 uint8_t status; /* 0x00 - success */
1737 uint16_t con_handle; /* connection handle */
1738 } __packed hci_reset_failed_contact_cntr_rp;
1739
1740 #define HCI_OCF_READ_LINK_QUALITY 0x0003
1741 #define HCI_CMD_READ_LINK_QUALITY 0x1403
1742 typedef struct {
1743 uint16_t con_handle; /* connection handle */
1744 } __packed hci_read_link_quality_cp;
1745
1746 typedef struct {
1747 uint8_t status; /* 0x00 - success */
1748 uint16_t con_handle; /* connection handle */
1749 uint8_t quality; /* higher value means better quality */
1750 } __packed hci_read_link_quality_rp;
1751
1752 #define HCI_OCF_READ_RSSI 0x0005
1753 #define HCI_CMD_READ_RSSI 0x1405
1754 typedef struct {
1755 uint16_t con_handle; /* connection handle */
1756 } __packed hci_read_rssi_cp;
1757
1758 typedef struct {
1759 uint8_t status; /* 0x00 - success */
1760 uint16_t con_handle; /* connection handle */
1761 char rssi; /* -127 <= rssi <= 127 dB */
1762 } __packed hci_read_rssi_rp;
1763
1764 #define HCI_OCF_READ_AFH_CHANNEL_MAP 0x0006
1765 #define HCI_CMD_READ_AFH_CHANNEL_MAP 0x1406
1766 typedef struct {
1767 uint16_t con_handle; /* connection handle */
1768 } __packed hci_read_afh_channel_map_cp;
1769
1770 typedef struct {
1771 uint8_t status; /* 0x00 - success */
1772 uint16_t con_handle; /* connection handle */
1773 uint8_t mode; /* AFH mode */
1774 uint8_t map[10]; /* AFH Channel Map */
1775 } __packed hci_read_afh_channel_map_rp;
1776
1777 #define HCI_OCF_READ_CLOCK 0x0007
1778 #define HCI_CMD_READ_CLOCK 0x1407
1779 typedef struct {
1780 uint16_t con_handle; /* connection handle */
1781 uint8_t clock; /* which clock */
1782 } __packed hci_read_clock_cp;
1783
1784 typedef struct {
1785 uint8_t status; /* 0x00 - success */
1786 uint16_t con_handle; /* connection handle */
1787 uint32_t clock; /* clock value */
1788 uint16_t accuracy; /* clock accuracy */
1789 } __packed hci_read_clock_rp;
1790
1791
1792 /**************************************************************************
1793 **************************************************************************
1794 ** OGF 0x06 Testing commands and return parameters
1795 **************************************************************************
1796 **************************************************************************/
1797
1798 #define HCI_OGF_TESTING 0x06
1799
1800 #define HCI_OCF_READ_LOOPBACK_MODE 0x0001
1801 #define HCI_CMD_READ_LOOPBACK_MODE 0x1801
1802 /* No command parameter(s) */
1803 typedef struct {
1804 uint8_t status; /* 0x00 - success */
1805 uint8_t lbmode; /* loopback mode */
1806 } __packed hci_read_loopback_mode_rp;
1807
1808 #define HCI_OCF_WRITE_LOOPBACK_MODE 0x0002
1809 #define HCI_CMD_WRITE_LOOPBACK_MODE 0x1802
1810 typedef struct {
1811 uint8_t lbmode; /* loopback mode */
1812 } __packed hci_write_loopback_mode_cp;
1813
1814 typedef hci_status_rp hci_write_loopback_mode_rp;
1815
1816 #define HCI_OCF_ENABLE_UNIT_UNDER_TEST 0x0003
1817 #define HCI_CMD_ENABLE_UNIT_UNDER_TEST 0x1803
1818 /* No command parameter(s) */
1819 typedef hci_status_rp hci_enable_unit_under_test_rp;
1820
1821 #define HCI_OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x0004
1822 #define HCI_CMD_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x1804
1823 typedef struct {
1824 uint8_t mode; /* simple pairing debug mode */
1825 } __packed hci_write_simple_pairing_debug_mode_cp;
1826
1827 typedef hci_status_rp hci_write_simple_pairing_debug_mode_rp;
1828
1829 /**************************************************************************
1830 **************************************************************************
1831 ** OGF 0x3e Bluetooth Logo Testing
1832 ** OGF 0x3f Vendor Specific
1833 **************************************************************************
1834 **************************************************************************/
1835
1836 #define HCI_OGF_BT_LOGO 0x3e
1837 #define HCI_OGF_VENDOR 0x3f
1838
1839 /* Ericsson specific FC */
1840 #define HCI_CMD_ERICSSON_WRITE_PCM_SETTINGS 0xFC07
1841 #define HCI_CMD_ERICSSON_SET_UART_BAUD_RATE 0xFC09
1842 #define HCI_CMD_ERICSSON_SET_SCO_DATA_PATH 0xFC1D
1843
1844 /* Cambridge Silicon Radio specific FC */
1845 #define HCI_CMD_CSR_EXTN 0xFC00
1846
1847
1848 /**************************************************************************
1849 **************************************************************************
1850 ** Events and event parameters
1851 **************************************************************************
1852 **************************************************************************/
1853
1854 #define HCI_EVENT_INQUIRY_COMPL 0x01
1855 typedef struct {
1856 uint8_t status; /* 0x00 - success */
1857 } __packed hci_inquiry_compl_ep;
1858
1859 #define HCI_EVENT_INQUIRY_RESULT 0x02
1860 typedef struct {
1861 uint8_t num_responses; /* number of responses */
1862 /* hci_inquiry_response[num_responses] -- see below */
1863 } __packed hci_inquiry_result_ep;
1864
1865 typedef struct {
1866 bdaddr_t bdaddr; /* unit address */
1867 uint8_t page_scan_rep_mode; /* page scan rep. mode */
1868 uint8_t page_scan_period_mode; /* page scan period mode */
1869 uint8_t page_scan_mode; /* page scan mode */
1870 uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */
1871 uint16_t clock_offset; /* clock offset */
1872 } __packed hci_inquiry_response;
1873
1874 #define HCI_EVENT_CON_COMPL 0x03
1875 typedef struct {
1876 uint8_t status; /* 0x00 - success */
1877 uint16_t con_handle; /* Connection handle */
1878 bdaddr_t bdaddr; /* remote unit address */
1879 uint8_t link_type; /* Link type */
1880 uint8_t encryption_mode; /* Encryption mode */
1881 } __packed hci_con_compl_ep;
1882
1883 #define HCI_EVENT_CON_REQ 0x04
1884 typedef struct {
1885 bdaddr_t bdaddr; /* remote unit address */
1886 uint8_t uclass[HCI_CLASS_SIZE]; /* remote unit class */
1887 uint8_t link_type; /* link type */
1888 } __packed hci_con_req_ep;
1889
1890 #define HCI_EVENT_DISCON_COMPL 0x05
1891 typedef struct {
1892 uint8_t status; /* 0x00 - success */
1893 uint16_t con_handle; /* connection handle */
1894 uint8_t reason; /* reason to disconnect */
1895 } __packed hci_discon_compl_ep;
1896
1897 #define HCI_EVENT_AUTH_COMPL 0x06
1898 typedef struct {
1899 uint8_t status; /* 0x00 - success */
1900 uint16_t con_handle; /* connection handle */
1901 } __packed hci_auth_compl_ep;
1902
1903 #define HCI_EVENT_REMOTE_NAME_REQ_COMPL 0x07
1904 typedef struct {
1905 uint8_t status; /* 0x00 - success */
1906 bdaddr_t bdaddr; /* remote unit address */
1907 char name[HCI_UNIT_NAME_SIZE]; /* remote unit name */
1908 } __packed hci_remote_name_req_compl_ep;
1909
1910 #define HCI_EVENT_ENCRYPTION_CHANGE 0x08
1911 typedef struct {
1912 uint8_t status; /* 0x00 - success */
1913 uint16_t con_handle; /* Connection handle */
1914 uint8_t encryption_enable; /* 0x00 - disable */
1915 } __packed hci_encryption_change_ep;
1916
1917 #define HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL 0x09
1918 typedef struct {
1919 uint8_t status; /* 0x00 - success */
1920 uint16_t con_handle; /* Connection handle */
1921 } __packed hci_change_con_link_key_compl_ep;
1922
1923 #define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a
1924 typedef struct {
1925 uint8_t status; /* 0x00 - success */
1926 uint16_t con_handle; /* Connection handle */
1927 uint8_t key_flag; /* Key flag */
1928 } __packed hci_master_link_key_compl_ep;
1929
1930 #define HCI_EVENT_READ_REMOTE_FEATURES_COMPL 0x0b
1931 typedef struct {
1932 uint8_t status; /* 0x00 - success */
1933 uint16_t con_handle; /* Connection handle */
1934 uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
1935 } __packed hci_read_remote_features_compl_ep;
1936
1937 #define HCI_EVENT_READ_REMOTE_VER_INFO_COMPL 0x0c
1938 typedef struct {
1939 uint8_t status; /* 0x00 - success */
1940 uint16_t con_handle; /* Connection handle */
1941 uint8_t lmp_version; /* LMP version */
1942 uint16_t manufacturer; /* Hardware manufacturer name */
1943 uint16_t lmp_subversion; /* LMP sub-version */
1944 } __packed hci_read_remote_ver_info_compl_ep;
1945
1946 #define HCI_EVENT_QOS_SETUP_COMPL 0x0d
1947 typedef struct {
1948 uint8_t status; /* 0x00 - success */
1949 uint16_t con_handle; /* connection handle */
1950 uint8_t flags; /* reserved for future use */
1951 uint8_t service_type; /* service type */
1952 uint32_t token_rate; /* bytes per second */
1953 uint32_t peak_bandwidth; /* bytes per second */
1954 uint32_t latency; /* microseconds */
1955 uint32_t delay_variation; /* microseconds */
1956 } __packed hci_qos_setup_compl_ep;
1957
1958 #define HCI_EVENT_COMMAND_COMPL 0x0e
1959 typedef struct {
1960 uint8_t num_cmd_pkts; /* # of HCI command packets */
1961 uint16_t opcode; /* command OpCode */
1962 /* command return parameters (if any) */
1963 } __packed hci_command_compl_ep;
1964
1965 #define HCI_EVENT_COMMAND_STATUS 0x0f
1966 typedef struct {
1967 uint8_t status; /* 0x00 - pending */
1968 uint8_t num_cmd_pkts; /* # of HCI command packets */
1969 uint16_t opcode; /* command OpCode */
1970 } __packed hci_command_status_ep;
1971
1972 #define HCI_EVENT_HARDWARE_ERROR 0x10
1973 typedef struct {
1974 uint8_t hardware_code; /* hardware error code */
1975 } __packed hci_hardware_error_ep;
1976
1977 #define HCI_EVENT_FLUSH_OCCUR 0x11
1978 typedef struct {
1979 uint16_t con_handle; /* connection handle */
1980 } __packed hci_flush_occur_ep;
1981
1982 #define HCI_EVENT_ROLE_CHANGE 0x12
1983 typedef struct {
1984 uint8_t status; /* 0x00 - success */
1985 bdaddr_t bdaddr; /* address of remote unit */
1986 uint8_t role; /* new connection role */
1987 } __packed hci_role_change_ep;
1988
1989 #define HCI_EVENT_NUM_COMPL_PKTS 0x13
1990 typedef struct {
1991 uint8_t num_con_handles; /* # of connection handles */
1992 /* these are repeated "num_con_handles" times
1993 uint16_t con_handle; --- connection handle(s)
1994 uint16_t compl_pkts; --- # of completed packets */
1995 } __packed hci_num_compl_pkts_ep;
1996
1997 #define HCI_EVENT_MODE_CHANGE 0x14
1998 typedef struct {
1999 uint8_t status; /* 0x00 - success */
2000 uint16_t con_handle; /* connection handle */
2001 uint8_t unit_mode; /* remote unit mode */
2002 uint16_t interval; /* interval * 0.625 msec */
2003 } __packed hci_mode_change_ep;
2004
2005 #define HCI_EVENT_RETURN_LINK_KEYS 0x15
2006 typedef struct {
2007 uint8_t num_keys; /* # of keys */
2008 /* these are repeated "num_keys" times
2009 bdaddr_t bdaddr; --- remote address(es)
2010 uint8_t key[HCI_KEY_SIZE]; --- key(s) */
2011 } __packed hci_return_link_keys_ep;
2012
2013 #define HCI_EVENT_PIN_CODE_REQ 0x16
2014 typedef struct {
2015 bdaddr_t bdaddr; /* remote unit address */
2016 } __packed hci_pin_code_req_ep;
2017
2018 #define HCI_EVENT_LINK_KEY_REQ 0x17
2019 typedef struct {
2020 bdaddr_t bdaddr; /* remote unit address */
2021 } __packed hci_link_key_req_ep;
2022
2023 #define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18
2024 typedef struct {
2025 bdaddr_t bdaddr; /* remote unit address */
2026 uint8_t key[HCI_KEY_SIZE]; /* link key */
2027 uint8_t key_type; /* type of the key */
2028 } __packed hci_link_key_notification_ep;
2029
2030 #define HCI_EVENT_LOOPBACK_COMMAND 0x19
2031 typedef hci_cmd_hdr_t hci_loopback_command_ep;
2032
2033 #define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a
2034 typedef struct {
2035 uint8_t link_type; /* Link type */
2036 } __packed hci_data_buffer_overflow_ep;
2037
2038 #define HCI_EVENT_MAX_SLOT_CHANGE 0x1b
2039 typedef struct {
2040 uint16_t con_handle; /* connection handle */
2041 uint8_t lmp_max_slots; /* Max. # of slots allowed */
2042 } __packed hci_max_slot_change_ep;
2043
2044 #define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c
2045 typedef struct {
2046 uint8_t status; /* 0x00 - success */
2047 uint16_t con_handle; /* Connection handle */
2048 uint16_t clock_offset; /* Clock offset */
2049 } __packed hci_read_clock_offset_compl_ep;
2050
2051 #define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d
2052 typedef struct {
2053 uint8_t status; /* 0x00 - success */
2054 uint16_t con_handle; /* connection handle */
2055 uint16_t pkt_type; /* packet type */
2056 } __packed hci_con_pkt_type_changed_ep;
2057
2058 #define HCI_EVENT_QOS_VIOLATION 0x1e
2059 typedef struct {
2060 uint16_t con_handle; /* connection handle */
2061 } __packed hci_qos_violation_ep;
2062
2063 /* Page Scan Mode Change Event is deprecated */
2064 #define HCI_EVENT_PAGE_SCAN_MODE_CHANGE 0x1f
2065 typedef struct {
2066 bdaddr_t bdaddr; /* destination address */
2067 uint8_t page_scan_mode; /* page scan mode */
2068 } __packed hci_page_scan_mode_change_ep;
2069
2070 #define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20
2071 typedef struct {
2072 bdaddr_t bdaddr; /* destination address */
2073 uint8_t page_scan_rep_mode; /* page scan repetition mode */
2074 } __packed hci_page_scan_rep_mode_change_ep;
2075
2076 #define HCI_EVENT_FLOW_SPECIFICATION_COMPL 0x21
2077 typedef struct {
2078 uint8_t status; /* 0x00 - success */
2079 uint16_t con_handle; /* connection handle */
2080 uint8_t flags; /* reserved */
2081 uint8_t direction; /* flow direction */
2082 uint8_t type; /* service type */
2083 uint32_t token_rate; /* token rate */
2084 uint32_t bucket_size; /* token bucket size */
2085 uint32_t peak_bandwidth; /* peak bandwidth */
2086 uint32_t latency; /* access latency */
2087 } __packed hci_flow_specification_compl_ep;
2088
2089 #define HCI_EVENT_RSSI_RESULT 0x22
2090 typedef struct {
2091 uint8_t num_responses; /* number of responses */
2092 /* hci_rssi_response[num_responses] -- see below */
2093 } __packed hci_rssi_result_ep;
2094
2095 typedef struct {
2096 bdaddr_t bdaddr; /* unit address */
2097 uint8_t page_scan_rep_mode; /* page scan rep. mode */
2098 uint8_t blank; /* reserved */
2099 uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */
2100 uint16_t clock_offset; /* clock offset */
2101 int8_t rssi; /* rssi */
2102 } __packed hci_rssi_response;
2103
2104 #define HCI_EVENT_READ_REMOTE_EXTENDED_FEATURES 0x23
2105 typedef struct {
2106 uint8_t status; /* 0x00 - success */
2107 uint16_t con_handle; /* connection handle */
2108 uint8_t page; /* page number */
2109 uint8_t max; /* max page number */
2110 uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
2111 } __packed hci_read_remote_extended_features_ep;
2112
2113 #define HCI_EVENT_SCO_CON_COMPL 0x2c
2114 typedef struct {
2115 uint8_t status; /* 0x00 - success */
2116 uint16_t con_handle; /* connection handle */
2117 bdaddr_t bdaddr; /* unit address */
2118 uint8_t link_type; /* link type */
2119 uint8_t interval; /* transmission interval */
2120 uint8_t window; /* retransmission window */
2121 uint16_t rxlen; /* rx packet length */
2122 uint16_t txlen; /* tx packet length */
2123 uint8_t mode; /* air mode */
2124 } __packed hci_sco_con_compl_ep;
2125
2126 #define HCI_EVENT_SCO_CON_CHANGED 0x2d
2127 typedef struct {
2128 uint8_t status; /* 0x00 - success */
2129 uint16_t con_handle; /* connection handle */
2130 uint8_t interval; /* transmission interval */
2131 uint8_t window; /* retransmission window */
2132 uint16_t rxlen; /* rx packet length */
2133 uint16_t txlen; /* tx packet length */
2134 } __packed hci_sco_con_changed_ep;
2135
2136 #define HCI_EVENT_SNIFF_SUBRATING 0x2e
2137 typedef struct {
2138 uint8_t status; /* 0x00 - success */
2139 uint16_t con_handle; /* connection handle */
2140 uint16_t tx_latency; /* max transmit latency */
2141 uint16_t rx_latency; /* max receive latency */
2142 uint16_t remote_timeout; /* remote timeout */
2143 uint16_t local_timeout; /* local timeout */
2144 } __packed hci_sniff_subrating_ep;
2145
2146 #define HCI_EVENT_EXTENDED_RESULT 0x2f
2147 typedef struct {
2148 uint8_t num_responses; /* must be 0x01 */
2149 bdaddr_t bdaddr; /* remote device address */
2150 uint8_t page_scan_rep_mode;
2151 uint8_t reserved;
2152 uint8_t uclass[HCI_CLASS_SIZE];
2153 uint16_t clock_offset;
2154 int8_t rssi;
2155 uint8_t response[240]; /* extended inquiry response */
2156 } __packed hci_extended_result_ep;
2157
2158 #define HCI_EVENT_ENCRYPTION_KEY_REFRESH 0x30
2159 typedef struct {
2160 uint8_t status; /* 0x00 - success */
2161 uint16_t con_handle; /* connection handle */
2162 } __packed hci_encryption_key_refresh_ep;
2163
2164 #define HCI_EVENT_IO_CAPABILITY_REQ 0x31
2165 typedef struct {
2166 bdaddr_t bdaddr; /* remote device address */
2167 } __packed hci_io_capability_req_ep;
2168
2169 #define HCI_EVENT_IO_CAPABILITY_RSP 0x32
2170 typedef struct {
2171 bdaddr_t bdaddr; /* remote device address */
2172 uint8_t io_capability;
2173 uint8_t oob_data_present;
2174 uint8_t auth_requirement;
2175 } __packed hci_io_capability_rsp_ep;
2176
2177 #define HCI_EVENT_USER_CONFIRM_REQ 0x33
2178 typedef struct {
2179 bdaddr_t bdaddr; /* remote device address */
2180 uint32_t value; /* 000000 - 999999 */
2181 } __packed hci_user_confirm_req_ep;
2182
2183 #define HCI_EVENT_USER_PASSKEY_REQ 0x34
2184 typedef struct {
2185 bdaddr_t bdaddr; /* remote device address */
2186 } __packed hci_user_passkey_req_ep;
2187
2188 #define HCI_EVENT_REMOTE_OOB_DATA_REQ 0x35
2189 typedef struct {
2190 bdaddr_t bdaddr; /* remote device address */
2191 } __packed hci_remote_oob_data_req_ep;
2192
2193 #define HCI_EVENT_SIMPLE_PAIRING_COMPL 0x36
2194 typedef struct {
2195 uint8_t status; /* 0x00 - success */
2196 bdaddr_t bdaddr; /* remote device address */
2197 } __packed hci_simple_pairing_compl_ep;
2198
2199 #define HCI_EVENT_LINK_SUPERVISION_TO_CHANGED 0x38
2200 typedef struct {
2201 uint16_t con_handle; /* connection handle */
2202 uint16_t timeout; /* link supervision timeout */
2203 } __packed hci_link_supervision_to_changed_ep;
2204
2205 #define HCI_EVENT_ENHANCED_FLUSH_COMPL 0x39
2206 typedef struct {
2207 uint16_t con_handle; /* connection handle */
2208 } __packed hci_enhanced_flush_compl_ep;
2209
2210 #define HCI_EVENT_USER_PASSKEY_NOTIFICATION 0x3b
2211 typedef struct {
2212 bdaddr_t bdaddr; /* remote device address */
2213 uint32_t value; /* 000000 - 999999 */
2214 } __packed hci_user_passkey_notification_ep;
2215
2216 #define HCI_EVENT_KEYPRESS_NOTIFICATION 0x3c
2217 typedef struct {
2218 bdaddr_t bdaddr; /* remote device address */
2219 uint8_t notification_type;
2220 } __packed hci_keypress_notification_ep;
2221
2222 #define HCI_EVENT_REMOTE_FEATURES_NOTIFICATION 0x3d
2223 typedef struct {
2224 bdaddr_t bdaddr; /* remote device address */
2225 uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/
2226 } __packed hci_remote_features_notification_ep;
2227
2228 #define HCI_EVENT_BT_LOGO 0xfe
2229
2230 #define HCI_EVENT_VENDOR 0xff
2231
2232 /**************************************************************************
2233 **************************************************************************
2234 ** HCI Socket Definitions
2235 **************************************************************************
2236 **************************************************************************/
2237
2238 /* HCI socket options */
2239 #define SO_HCI_EVT_FILTER 1 /* get/set event filter */
2240 #define SO_HCI_PKT_FILTER 2 /* get/set packet filter */
2241 #define SO_HCI_DIRECTION 3 /* packet direction indicator */
2242
2243 /* Control Messages */
2244 #define SCM_HCI_DIRECTION SO_HCI_DIRECTION
2245
2246 /*
2247 * HCI socket filter and get/set routines
2248 *
2249 * for ease of use, we filter 256 possible events/packets
2250 */
2251 struct hci_filter {
2252 uint32_t mask[8]; /* 256 bits */
2253 };
2254
2255 static __inline void
2256 hci_filter_set(uint8_t bit, struct hci_filter *filter)
2257 {
2258 uint8_t off = bit - 1;
2259
2260 off >>= 5;
2261 filter->mask[off] |= (1 << ((bit - 1) & 0x1f));
2262 }
2263
2264 static __inline void
2265 hci_filter_clr(uint8_t bit, struct hci_filter *filter)
2266 {
2267 uint8_t off = bit - 1;
2268
2269 off >>= 5;
2270 filter->mask[off] &= ~(1 << ((bit - 1) & 0x1f));
2271 }
2272
2273 static __inline int
2274 hci_filter_test(uint8_t bit, const struct hci_filter *filter)
2275 {
2276 uint8_t off = bit - 1;
2277
2278 off >>= 5;
2279 return (filter->mask[off] & (1 << ((bit - 1) & 0x1f)));
2280 }
2281
2282 /*
2283 * HCI socket ioctl's
2284 *
2285 * Apart from GBTINFOA, these are all indexed on the unit name
2286 */
2287
2288 #define SIOCGBTINFO _IOWR('b', 5, struct btreq) /* get unit info */
2289 #define SIOCGBTINFOA _IOWR('b', 6, struct btreq) /* get info by address */
2290 #define SIOCNBTINFO _IOWR('b', 7, struct btreq) /* next unit info */
2291
2292 #define SIOCSBTFLAGS _IOWR('b', 8, struct btreq) /* set unit flags */
2293 #define SIOCSBTPOLICY _IOWR('b', 9, struct btreq) /* set unit link policy */
2294 #define SIOCSBTPTYPE _IOWR('b', 10, struct btreq) /* set unit packet type */
2295
2296 #define SIOCGBTSTATS _IOWR('b', 11, struct btreq) /* get unit statistics */
2297 #define SIOCZBTSTATS _IOWR('b', 12, struct btreq) /* zero unit statistics */
2298
2299 #define SIOCBTDUMP _IOW('b', 13, struct btreq) /* print debug info */
2300 #define SIOCSBTSCOMTU _IOWR('b', 17, struct btreq) /* set sco_mtu value */
2301
2302 #define SIOCGBTFEAT _IOWR('b', 18, struct btreq) /* get unit features */
2303
2304 struct bt_stats {
2305 uint32_t err_tx;
2306 uint32_t err_rx;
2307 uint32_t cmd_tx;
2308 uint32_t evt_rx;
2309 uint32_t acl_tx;
2310 uint32_t acl_rx;
2311 uint32_t sco_tx;
2312 uint32_t sco_rx;
2313 uint32_t byte_tx;
2314 uint32_t byte_rx;
2315 };
2316
2317 struct btreq {
2318 char btr_name[HCI_DEVNAME_SIZE]; /* device name */
2319
2320 union {
2321 struct {
2322 bdaddr_t btri_bdaddr; /* device bdaddr */
2323 uint16_t btri_flags; /* flags */
2324 uint16_t btri_num_cmd; /* # of free cmd buffers */
2325 uint16_t btri_num_acl; /* # of free ACL buffers */
2326 uint16_t btri_num_sco; /* # of free SCO buffers */
2327 uint16_t btri_acl_mtu; /* ACL mtu */
2328 uint16_t btri_sco_mtu; /* SCO mtu */
2329 uint16_t btri_link_policy; /* Link Policy */
2330 uint16_t btri_packet_type; /* Packet Type */
2331 uint16_t btri_max_acl; /* max ACL buffers */
2332 uint16_t btri_max_sco; /* max SCO buffers */
2333 } btri;
2334 struct {
2335 uint8_t btrf_page0[HCI_FEATURES_SIZE]; /* basic */
2336 uint8_t btrf_page1[HCI_FEATURES_SIZE]; /* extended */
2337 } btrf;
2338 struct bt_stats btrs; /* unit stats */
2339 } btru;
2340 };
2341
2342 #define btr_flags btru.btri.btri_flags
2343 #define btr_bdaddr btru.btri.btri_bdaddr
2344 #define btr_num_cmd btru.btri.btri_num_cmd
2345 #define btr_num_acl btru.btri.btri_num_acl
2346 #define btr_num_sco btru.btri.btri_num_sco
2347 #define btr_acl_mtu btru.btri.btri_acl_mtu
2348 #define btr_sco_mtu btru.btri.btri_sco_mtu
2349 #define btr_link_policy btru.btri.btri_link_policy
2350 #define btr_packet_type btru.btri.btri_packet_type
2351 #define btr_max_acl btru.btri.btri_max_acl
2352 #define btr_max_sco btru.btri.btri_max_sco
2353 #define btr_features0 btru.btrf.btrf_page0
2354 #define btr_features1 btru.btrf.btrf_page1
2355 #define btr_stats btru.btrs
2356
2357 /* hci_unit & btr_flags */
2358 #define BTF_UP (1<<0) /* unit is up */
2359 #define BTF_RUNNING (1<<1) /* unit is running */
2360 #define BTF_XMIT_CMD (1<<2) /* unit is transmitting CMD packets */
2361 #define BTF_XMIT_ACL (1<<3) /* unit is transmitting ACL packets */
2362 #define BTF_XMIT_SCO (1<<4) /* unit is transmitting SCO packets */
2363 #define BTF_XMIT (BTF_XMIT_CMD | BTF_XMIT_ACL | BTF_XMIT_SCO)
2364 #define BTF_INIT_BDADDR (1<<5) /* waiting for bdaddr */
2365 #define BTF_INIT_BUFFER_SIZE (1<<6) /* waiting for buffer size */
2366 #define BTF_INIT_FEATURES (1<<7) /* waiting for features */
2367 #define BTF_POWER_UP_NOOP (1<<8) /* should wait for No-op on power up */
2368 #define BTF_INIT_COMMANDS (1<<9) /* waiting for supported commands */
2369 #define BTF_MASTER (1<<10) /* request Master role */
2370
2371 #define BTF_INIT (BTF_INIT_BDADDR \
2372 | BTF_INIT_BUFFER_SIZE \
2373 | BTF_INIT_FEATURES \
2374 | BTF_INIT_COMMANDS)
2375
2376 /**************************************************************************
2377 **************************************************************************
2378 ** HCI Kernel Definitions
2379 **************************************************************************
2380 **************************************************************************/
2381
2382 #ifdef _KERNEL
2383
2384 #include <sys/condvar.h>
2385 #include <sys/device.h>
2386
2387 struct l2cap_channel;
2388 struct mbuf;
2389 struct sco_pcb;
2390 struct socket;
2391 struct sockopt;
2392
2393 /* global HCI kernel variables */
2394
2395 /* sysctl variables */
2396 extern int hci_memo_expiry;
2397 extern int hci_acl_expiry;
2398 extern int hci_sendspace, hci_recvspace;
2399 extern int hci_eventq_max, hci_aclrxq_max, hci_scorxq_max;
2400
2401 /*
2402 * HCI Connection Information
2403 */
2404 struct hci_link {
2405 struct hci_unit *hl_unit; /* our unit */
2406 TAILQ_ENTRY(hci_link) hl_next; /* next link on unit */
2407
2408 /* common info */
2409 uint16_t hl_state; /* connection state */
2410 uint16_t hl_flags; /* link flags */
2411 bdaddr_t hl_bdaddr; /* dest address */
2412 uint16_t hl_handle; /* connection handle */
2413 uint8_t hl_type; /* link type */
2414
2415 /* ACL link info */
2416 uint8_t hl_lastid; /* last id used */
2417 uint16_t hl_refcnt; /* reference count */
2418 uint16_t hl_mtu; /* signalling mtu for link */
2419 uint16_t hl_flush; /* flush timeout */
2420 uint16_t hl_clock; /* remote clock offset */
2421
2422 TAILQ_HEAD(,l2cap_pdu) hl_txq; /* queue of outgoing PDUs */
2423 int hl_txqlen; /* number of fragments */
2424 struct mbuf *hl_rxp; /* incoming PDU (accumulating)*/
2425 callout_t hl_expire; /* connection expiry timer */
2426 TAILQ_HEAD(,l2cap_req) hl_reqs; /* pending requests */
2427
2428 /* SCO link info */
2429 struct hci_link *hl_link; /* SCO ACL link */
2430 struct sco_pcb *hl_sco; /* SCO pcb */
2431 MBUFQ_HEAD() hl_data; /* SCO outgoing data */
2432 };
2433
2434 /* hci_link state */
2435 #define HCI_LINK_CLOSED 0 /* closed */
2436 #define HCI_LINK_WAIT_CONNECT 1 /* waiting to connect */
2437 #define HCI_LINK_WAIT_AUTH 2 /* waiting for auth */
2438 #define HCI_LINK_WAIT_ENCRYPT 3 /* waiting for encrypt */
2439 #define HCI_LINK_WAIT_SECURE 4 /* waiting for secure */
2440 #define HCI_LINK_OPEN 5 /* ready and willing */
2441 #define HCI_LINK_BLOCK 6 /* open but blocking (see hci_acl_start) */
2442
2443 /* hci_link flags */
2444 #define HCI_LINK_AUTH_REQ (1<<0) /* authentication requested */
2445 #define HCI_LINK_ENCRYPT_REQ (1<<1) /* encryption requested */
2446 #define HCI_LINK_SECURE_REQ (1<<2) /* secure link requested */
2447 #define HCI_LINK_AUTH (1<<3) /* link is authenticated */
2448 #define HCI_LINK_ENCRYPT (1<<4) /* link is encrypted */
2449 #define HCI_LINK_SECURE (1<<5) /* link is secured */
2450 #define HCI_LINK_CREATE_CON (1<<6) /* "Create Connection" pending */
2451
2452 /*
2453 * Bluetooth Memo
2454 * cached device information for remote devices that this unit has seen
2455 */
2456 struct hci_memo {
2457 struct timeval time; /* time of last response */
2458 bdaddr_t bdaddr;
2459 uint8_t page_scan_rep_mode;
2460 uint8_t page_scan_mode;
2461 uint16_t clock_offset;
2462 LIST_ENTRY(hci_memo) next;
2463 };
2464
2465 /*
2466 * The Bluetooth HCI interface attachment structure
2467 */
2468 struct hci_if {
2469 int (*enable)(device_t);
2470 void (*disable)(device_t);
2471 void (*output_cmd)(device_t, struct mbuf *);
2472 void (*output_acl)(device_t, struct mbuf *);
2473 void (*output_sco)(device_t, struct mbuf *);
2474 void (*get_stats)(device_t, struct bt_stats *, int);
2475 int ipl; /* for locking */
2476 };
2477
2478 /*
2479 * The Bluetooth HCI device unit structure
2480 */
2481 struct hci_unit {
2482 device_t hci_dev; /* bthci handle */
2483 device_t hci_bthub; /* bthub(4) handle */
2484 const struct hci_if *hci_if; /* bthci driver interface */
2485
2486 /* device info */
2487 bdaddr_t hci_bdaddr; /* device address */
2488 uint16_t hci_flags; /* see BTF_ above */
2489 kcondvar_t hci_init; /* sleep on this */
2490
2491 uint16_t hci_packet_type; /* packet types */
2492 uint16_t hci_acl_mask; /* ACL packet capabilities */
2493 uint16_t hci_sco_mask; /* SCO packet capabilities */
2494
2495 uint16_t hci_link_policy; /* link policy */
2496 uint16_t hci_lmp_mask; /* link policy capabilities */
2497
2498 uint8_t hci_feat0[HCI_FEATURES_SIZE]; /* features mask */
2499 uint8_t hci_feat1[HCI_FEATURES_SIZE]; /* extended */
2500 uint8_t hci_cmds[HCI_COMMANDS_SIZE]; /* opcode bitmask */
2501
2502 /* flow control */
2503 uint16_t hci_max_acl_size; /* ACL payload mtu */
2504 uint16_t hci_num_acl_pkts; /* free ACL packet buffers */
2505 uint16_t hci_max_acl_pkts; /* max ACL packet buffers */
2506 uint8_t hci_num_cmd_pkts; /* free CMD packet buffers */
2507 uint8_t hci_max_sco_size; /* SCO payload mtu */
2508 uint16_t hci_num_sco_pkts; /* free SCO packet buffers */
2509 uint16_t hci_max_sco_pkts; /* max SCO packet buffers */
2510
2511 TAILQ_HEAD(,hci_link) hci_links; /* list of ACL/SCO links */
2512 LIST_HEAD(,hci_memo) hci_memos; /* cached memo list */
2513
2514 /* input queues */
2515 void *hci_rxint; /* receive interrupt cookie */
2516 kmutex_t hci_devlock; /* device queue lock */
2517 MBUFQ_HEAD() hci_eventq; /* Event queue */
2518 MBUFQ_HEAD() hci_aclrxq; /* ACL rx queue */
2519 MBUFQ_HEAD() hci_scorxq; /* SCO rx queue */
2520 uint16_t hci_eventqlen; /* Event queue length */
2521 uint16_t hci_aclrxqlen; /* ACL rx queue length */
2522 uint16_t hci_scorxqlen; /* SCO rx queue length */
2523
2524 /* output queues */
2525 MBUFQ_HEAD() hci_cmdwait; /* pending commands */
2526 MBUFQ_HEAD() hci_scodone; /* SCO done queue */
2527
2528 SIMPLEQ_ENTRY(hci_unit) hci_next;
2529 };
2530
2531 extern SIMPLEQ_HEAD(hci_unit_list, hci_unit) hci_unit_list;
2532
2533 /*
2534 * HCI layer function prototypes
2535 */
2536
2537 /* hci_event.c */
2538 void hci_event(struct mbuf *, struct hci_unit *);
2539
2540 /* hci_ioctl.c */
2541 int hci_ioctl_pcb(unsigned long, void *);
2542
2543 /* hci_link.c */
2544 struct hci_link *hci_acl_open(struct hci_unit *, bdaddr_t *);
2545 struct hci_link *hci_acl_newconn(struct hci_unit *, bdaddr_t *);
2546 void hci_acl_close(struct hci_link *, int);
2547 void hci_acl_timeout(void *);
2548 int hci_acl_setmode(struct hci_link *);
2549 void hci_acl_linkmode(struct hci_link *);
2550 void hci_acl_recv(struct mbuf *, struct hci_unit *);
2551 int hci_acl_send(struct mbuf *, struct hci_link *, struct l2cap_channel *);
2552 void hci_acl_start(struct hci_link *);
2553 void hci_acl_complete(struct hci_link *, int);
2554 struct hci_link *hci_sco_newconn(struct hci_unit *, bdaddr_t *);
2555 void hci_sco_recv(struct mbuf *, struct hci_unit *);
2556 void hci_sco_start(struct hci_link *);
2557 void hci_sco_complete(struct hci_link *, int);
2558 struct hci_link *hci_link_alloc(struct hci_unit *, bdaddr_t *, uint8_t);
2559 void hci_link_free(struct hci_link *, int);
2560 struct hci_link *hci_link_lookup_bdaddr(struct hci_unit *, bdaddr_t *, uint8_t);
2561 struct hci_link *hci_link_lookup_handle(struct hci_unit *, uint16_t);
2562
2563 /* hci_misc.c */
2564 int hci_route_lookup(bdaddr_t *, bdaddr_t *);
2565 struct hci_memo *hci_memo_find(struct hci_unit *, bdaddr_t *);
2566 struct hci_memo *hci_memo_new(struct hci_unit *, bdaddr_t *);
2567 void hci_memo_free(struct hci_memo *);
2568
2569 /* hci_socket.c */
2570 void hci_drop(void *);
2571 void hci_init(void);
2572 int hci_ctloutput(int, struct socket *, struct sockopt *);
2573 void hci_mtap(struct mbuf *, struct hci_unit *);
2574
2575 /* hci_unit.c */
2576 struct hci_unit *hci_attach_pcb(const struct hci_if *, device_t, uint16_t);
2577 void hci_detach_pcb(struct hci_unit *);
2578 int hci_enable(struct hci_unit *);
2579 void hci_disable(struct hci_unit *);
2580 struct hci_unit *hci_unit_lookup(const bdaddr_t *);
2581 int hci_send_cmd(struct hci_unit *, uint16_t, void *, uint8_t);
2582 void hci_num_cmds(struct hci_unit *, uint8_t);
2583 bool hci_input_event(struct hci_unit *, struct mbuf *);
2584 bool hci_input_acl(struct hci_unit *, struct mbuf *);
2585 bool hci_input_sco(struct hci_unit *, struct mbuf *);
2586 bool hci_complete_sco(struct hci_unit *, struct mbuf *);
2587 void hci_output_cmd(struct hci_unit *, struct mbuf *);
2588 void hci_output_acl(struct hci_unit *, struct mbuf *);
2589 void hci_output_sco(struct hci_unit *, struct mbuf *);
2590
2591 #endif /* _KERNEL */
2592
2593 #endif /* _NETBT_HCI_H_ */
2594