Sat Jan 28 19:07:16 2017 UTC ()
factor out common subexpressions.


(christos)
diff -r1.41 -r1.42 src/sys/netbt/hci.h

cvs diff -r1.41 -r1.42 src/sys/netbt/hci.h (switch to unified diff)

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