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