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