1 /******************************************************************************
2  *
3  *  Copyright (C) 1999-2014 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 #ifndef HCIDEFS_H
20 #define HCIDEFS_H
21 
22 #include "common/bt_target.h"
23 
24 #include "stack/bt_types.h"
25 
26 #define HCI_PROTO_VERSION     0x01      /* Version for BT spec 1.1          */
27 #define HCI_PROTO_VERSION_1_2 0x02      /* Version for BT spec 1.2          */
28 #define HCI_PROTO_VERSION_2_0 0x03      /* Version for BT spec 2.0          */
29 #define HCI_PROTO_VERSION_2_1 0x04      /* Version for BT spec 2.1 [Lisbon] */
30 #define HCI_PROTO_VERSION_3_0 0x05      /* Version for BT spec 3.0          */
31 #define HCI_PROTO_VERSION_4_0 0x06      /* Version for BT spec 4.0          */
32 #define HCI_PROTO_VERSION_4_1 0x07      /* Version for BT spec 4.1          */
33 #define HCI_PROTO_VERSION_4_2 0x08      /* Version for BT spec 4.2          */
34 #define HCI_PROTO_REVISION    0x000C    /* Current implementation version   */
35 /*
36 **  Definitions for HCI groups
37 */
38 #define HCI_GRP_LINK_CONTROL_CMDS       (0x01 << 10)            /* 0x0400 */
39 #define HCI_GRP_LINK_POLICY_CMDS        (0x02 << 10)            /* 0x0800 */
40 #define HCI_GRP_HOST_CONT_BASEBAND_CMDS (0x03 << 10)            /* 0x0C00 */
41 #define HCI_GRP_INFORMATIONAL_PARAMS    (0x04 << 10)            /* 0x1000 */
42 #define HCI_GRP_STATUS_PARAMS           (0x05 << 10)            /* 0x1400 */
43 #define HCI_GRP_TESTING_CMDS            (0x06 << 10)            /* 0x1800 */
44 
45 #define HCI_GRP_VENDOR_SPECIFIC         (0x3F << 10)            /* 0xFC00 */
46 
47 /* Group occupies high 6 bits of the HCI command rest is opcode itself */
48 #define HCI_OGF(p)  (UINT8)(0x003F & (p >> 10))
49 #define HCI_OCF(p)  ( 0x3FF & (p))
50 
51 /*
52 **  Definitions for Link Control Commands
53 */
54 /* Following opcode is used only in command complete event for flow control */
55 #define HCI_COMMAND_NONE                0x0000
56 
57 /* Commands of HCI_GRP_LINK_CONTROL_CMDS group */
58 #define HCI_INQUIRY                     (0x0001 | HCI_GRP_LINK_CONTROL_CMDS)
59 #define HCI_INQUIRY_CANCEL              (0x0002 | HCI_GRP_LINK_CONTROL_CMDS)
60 #define HCI_PERIODIC_INQUIRY_MODE       (0x0003 | HCI_GRP_LINK_CONTROL_CMDS)
61 #define HCI_EXIT_PERIODIC_INQUIRY_MODE  (0x0004 | HCI_GRP_LINK_CONTROL_CMDS)
62 #define HCI_CREATE_CONNECTION           (0x0005 | HCI_GRP_LINK_CONTROL_CMDS)
63 #define HCI_DISCONNECT                  (0x0006 | HCI_GRP_LINK_CONTROL_CMDS)
64 #define HCI_ADD_SCO_CONNECTION          (0x0007 | HCI_GRP_LINK_CONTROL_CMDS)
65 #define HCI_CREATE_CONNECTION_CANCEL    (0x0008 | HCI_GRP_LINK_CONTROL_CMDS)
66 #define HCI_ACCEPT_CONNECTION_REQUEST   (0x0009 | HCI_GRP_LINK_CONTROL_CMDS)
67 #define HCI_REJECT_CONNECTION_REQUEST   (0x000A | HCI_GRP_LINK_CONTROL_CMDS)
68 #define HCI_LINK_KEY_REQUEST_REPLY      (0x000B | HCI_GRP_LINK_CONTROL_CMDS)
69 #define HCI_LINK_KEY_REQUEST_NEG_REPLY  (0x000C | HCI_GRP_LINK_CONTROL_CMDS)
70 #define HCI_PIN_CODE_REQUEST_REPLY      (0x000D | HCI_GRP_LINK_CONTROL_CMDS)
71 #define HCI_PIN_CODE_REQUEST_NEG_REPLY  (0x000E | HCI_GRP_LINK_CONTROL_CMDS)
72 #define HCI_CHANGE_CONN_PACKET_TYPE     (0x000F | HCI_GRP_LINK_CONTROL_CMDS)
73 #define HCI_AUTHENTICATION_REQUESTED    (0x0011 | HCI_GRP_LINK_CONTROL_CMDS)
74 #define HCI_SET_CONN_ENCRYPTION         (0x0013 | HCI_GRP_LINK_CONTROL_CMDS)
75 #define HCI_CHANGE_CONN_LINK_KEY        (0x0015 | HCI_GRP_LINK_CONTROL_CMDS)
76 #define HCI_MASTER_LINK_KEY             (0x0017 | HCI_GRP_LINK_CONTROL_CMDS)
77 #define HCI_RMT_NAME_REQUEST            (0x0019 | HCI_GRP_LINK_CONTROL_CMDS)
78 #define HCI_RMT_NAME_REQUEST_CANCEL     (0x001A | HCI_GRP_LINK_CONTROL_CMDS)
79 #define HCI_READ_RMT_FEATURES           (0x001B | HCI_GRP_LINK_CONTROL_CMDS)
80 #define HCI_READ_RMT_EXT_FEATURES       (0x001C | HCI_GRP_LINK_CONTROL_CMDS)
81 #define HCI_READ_RMT_VERSION_INFO       (0x001D | HCI_GRP_LINK_CONTROL_CMDS)
82 #define HCI_READ_RMT_CLOCK_OFFSET       (0x001F | HCI_GRP_LINK_CONTROL_CMDS)
83 #define HCI_READ_LMP_HANDLE             (0x0020 | HCI_GRP_LINK_CONTROL_CMDS)
84 #define HCI_SETUP_ESCO_CONNECTION       (0x0028 | HCI_GRP_LINK_CONTROL_CMDS)
85 #define HCI_ACCEPT_ESCO_CONNECTION      (0x0029 | HCI_GRP_LINK_CONTROL_CMDS)
86 #define HCI_REJECT_ESCO_CONNECTION      (0x002A | HCI_GRP_LINK_CONTROL_CMDS)
87 #define HCI_IO_CAPABILITY_REQUEST_REPLY (0x002B | HCI_GRP_LINK_CONTROL_CMDS)
88 #define HCI_USER_CONF_REQUEST_REPLY     (0x002C | HCI_GRP_LINK_CONTROL_CMDS)
89 #define HCI_USER_CONF_VALUE_NEG_REPLY   (0x002D | HCI_GRP_LINK_CONTROL_CMDS)
90 #define HCI_USER_PASSKEY_REQ_REPLY      (0x002E | HCI_GRP_LINK_CONTROL_CMDS)
91 #define HCI_USER_PASSKEY_REQ_NEG_REPLY  (0x002F | HCI_GRP_LINK_CONTROL_CMDS)
92 #define HCI_REM_OOB_DATA_REQ_REPLY      (0x0030 | HCI_GRP_LINK_CONTROL_CMDS)
93 #define HCI_REM_OOB_DATA_REQ_NEG_REPLY  (0x0033 | HCI_GRP_LINK_CONTROL_CMDS)
94 #define HCI_IO_CAP_REQ_NEG_REPLY        (0x0034 | HCI_GRP_LINK_CONTROL_CMDS)
95 
96 /* AMP HCI */
97 #define HCI_CREATE_PHYSICAL_LINK        (0x0035 | HCI_GRP_LINK_CONTROL_CMDS)
98 #define HCI_ACCEPT_PHYSICAL_LINK        (0x0036 | HCI_GRP_LINK_CONTROL_CMDS)
99 #define HCI_DISCONNECT_PHYSICAL_LINK    (0x0037 | HCI_GRP_LINK_CONTROL_CMDS)
100 #define HCI_CREATE_LOGICAL_LINK         (0x0038 | HCI_GRP_LINK_CONTROL_CMDS)
101 #define HCI_ACCEPT_LOGICAL_LINK         (0x0039 | HCI_GRP_LINK_CONTROL_CMDS)
102 #define HCI_DISCONNECT_LOGICAL_LINK     (0x003A | HCI_GRP_LINK_CONTROL_CMDS)
103 #define HCI_LOGICAL_LINK_CANCEL         (0x003B | HCI_GRP_LINK_CONTROL_CMDS)
104 #define HCI_FLOW_SPEC_MODIFY            (0x003C | HCI_GRP_LINK_CONTROL_CMDS)
105 
106 #define HCI_ENH_SETUP_ESCO_CONNECTION   (0x003D | HCI_GRP_LINK_CONTROL_CMDS)
107 #define HCI_ENH_ACCEPT_ESCO_CONNECTION  (0x003E | HCI_GRP_LINK_CONTROL_CMDS)
108 
109 /* ConnectionLess Broadcast */
110 #define HCI_TRUNCATED_PAGE              (0x003F | HCI_GRP_LINK_CONTROL_CMDS)
111 #define HCI_TRUNCATED_PAGE_CANCEL       (0x0040 | HCI_GRP_LINK_CONTROL_CMDS)
112 #define HCI_SET_CLB                     (0x0041 | HCI_GRP_LINK_CONTROL_CMDS)
113 #define HCI_RECEIVE_CLB                 (0x0042 | HCI_GRP_LINK_CONTROL_CMDS)
114 #define HCI_START_SYNC_TRAIN            (0x0043 | HCI_GRP_LINK_CONTROL_CMDS)
115 #define HCI_RECEIVE_SYNC_TRAIN          (0x0044 | HCI_GRP_LINK_CONTROL_CMDS)
116 
117 #define HCI_LINK_CTRL_CMDS_FIRST        HCI_INQUIRY
118 #define HCI_LINK_CTRL_CMDS_LAST         HCI_RECEIVE_SYNC_TRAIN
119 
120 /* Commands of HCI_GRP_LINK_POLICY_CMDS */
121 #define HCI_HOLD_MODE                   (0x0001 | HCI_GRP_LINK_POLICY_CMDS)
122 #define HCI_SNIFF_MODE                  (0x0003 | HCI_GRP_LINK_POLICY_CMDS)
123 #define HCI_EXIT_SNIFF_MODE             (0x0004 | HCI_GRP_LINK_POLICY_CMDS)
124 #define HCI_PARK_MODE                   (0x0005 | HCI_GRP_LINK_POLICY_CMDS)
125 #define HCI_EXIT_PARK_MODE              (0x0006 | HCI_GRP_LINK_POLICY_CMDS)
126 #define HCI_QOS_SETUP                   (0x0007 | HCI_GRP_LINK_POLICY_CMDS)
127 #define HCI_ROLE_DISCOVERY              (0x0009 | HCI_GRP_LINK_POLICY_CMDS)
128 #define HCI_SWITCH_ROLE                 (0x000B | HCI_GRP_LINK_POLICY_CMDS)
129 #define HCI_READ_POLICY_SETTINGS        (0x000C | HCI_GRP_LINK_POLICY_CMDS)
130 #define HCI_WRITE_POLICY_SETTINGS       (0x000D | HCI_GRP_LINK_POLICY_CMDS)
131 #define HCI_READ_DEF_POLICY_SETTINGS    (0x000E | HCI_GRP_LINK_POLICY_CMDS)
132 #define HCI_WRITE_DEF_POLICY_SETTINGS   (0x000F | HCI_GRP_LINK_POLICY_CMDS)
133 #define HCI_FLOW_SPECIFICATION          (0x0010 | HCI_GRP_LINK_POLICY_CMDS)
134 #define HCI_SNIFF_SUB_RATE              (0x0011 | HCI_GRP_LINK_POLICY_CMDS)
135 
136 #define HCI_LINK_POLICY_CMDS_FIRST      HCI_HOLD_MODE
137 #define HCI_LINK_POLICY_CMDS_LAST       HCI_SNIFF_SUB_RATE
138 
139 
140 /* Commands of HCI_GRP_HOST_CONT_BASEBAND_CMDS */
141 #define HCI_SET_EVENT_MASK              (0x0001 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
142 #define HCI_RESET                       (0x0003 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
143 #define HCI_SET_EVENT_FILTER            (0x0005 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
144 #define HCI_FLUSH                       (0x0008 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
145 #define HCI_READ_PIN_TYPE               (0x0009 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
146 #define HCI_WRITE_PIN_TYPE              (0x000A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
147 #define HCI_CREATE_NEW_UNIT_KEY         (0x000B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
148 #define HCI_GET_MWS_TRANS_LAYER_CFG     (0x000C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
149 #define HCI_READ_STORED_LINK_KEY        (0x000D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
150 #define HCI_WRITE_STORED_LINK_KEY       (0x0011 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
151 #define HCI_DELETE_STORED_LINK_KEY      (0x0012 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
152 #define HCI_CHANGE_LOCAL_NAME           (0x0013 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
153 #define HCI_READ_LOCAL_NAME             (0x0014 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
154 #define HCI_READ_CONN_ACCEPT_TOUT       (0x0015 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
155 #define HCI_WRITE_CONN_ACCEPT_TOUT      (0x0016 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
156 #define HCI_READ_PAGE_TOUT              (0x0017 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
157 #define HCI_WRITE_PAGE_TOUT             (0x0018 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
158 #define HCI_READ_SCAN_ENABLE            (0x0019 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
159 #define HCI_WRITE_SCAN_ENABLE           (0x001A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
160 #define HCI_READ_PAGESCAN_CFG           (0x001B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
161 #define HCI_WRITE_PAGESCAN_CFG          (0x001C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
162 #define HCI_READ_INQUIRYSCAN_CFG        (0x001D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
163 #define HCI_WRITE_INQUIRYSCAN_CFG       (0x001E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
164 #define HCI_READ_AUTHENTICATION_ENABLE  (0x001F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
165 #define HCI_WRITE_AUTHENTICATION_ENABLE (0x0020 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
166 #define HCI_READ_ENCRYPTION_MODE        (0x0021 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
167 #define HCI_WRITE_ENCRYPTION_MODE       (0x0022 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
168 #define HCI_READ_CLASS_OF_DEVICE        (0x0023 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
169 #define HCI_WRITE_CLASS_OF_DEVICE       (0x0024 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
170 #define HCI_READ_VOICE_SETTINGS         (0x0025 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
171 #define HCI_WRITE_VOICE_SETTINGS        (0x0026 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
172 #define HCI_READ_AUTO_FLUSH_TOUT        (0x0027 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
173 #define HCI_WRITE_AUTO_FLUSH_TOUT       (0x0028 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
174 #define HCI_READ_NUM_BCAST_REXMITS      (0x0029 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
175 #define HCI_WRITE_NUM_BCAST_REXMITS     (0x002A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
176 #define HCI_READ_HOLD_MODE_ACTIVITY     (0x002B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
177 #define HCI_WRITE_HOLD_MODE_ACTIVITY    (0x002C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
178 #define HCI_READ_TRANSMIT_POWER_LEVEL   (0x002D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
179 #define HCI_READ_SCO_FLOW_CTRL_ENABLE   (0x002E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
180 #define HCI_WRITE_SCO_FLOW_CTRL_ENABLE  (0x002F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
181 #define HCI_SET_HC_TO_HOST_FLOW_CTRL    (0x0031 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
182 #define HCI_HOST_BUFFER_SIZE            (0x0033 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
183 #define HCI_HOST_NUM_PACKETS_DONE       (0x0035 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
184 #define HCI_READ_LINK_SUPER_TOUT        (0x0036 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
185 #define HCI_WRITE_LINK_SUPER_TOUT       (0x0037 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
186 #define HCI_READ_NUM_SUPPORTED_IAC      (0x0038 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
187 #define HCI_READ_CURRENT_IAC_LAP        (0x0039 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
188 #define HCI_WRITE_CURRENT_IAC_LAP       (0x003A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
189 #define HCI_READ_PAGESCAN_PERIOD_MODE   (0x003B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
190 #define HCI_WRITE_PAGESCAN_PERIOD_MODE  (0x003C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
191 #define HCI_READ_PAGESCAN_MODE          (0x003D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
192 #define HCI_WRITE_PAGESCAN_MODE         (0x003E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
193 #define HCI_SET_AFH_CHANNELS            (0x003F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
194 
195 #define HCI_READ_INQSCAN_TYPE           (0x0042 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
196 #define HCI_WRITE_INQSCAN_TYPE          (0x0043 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
197 #define HCI_READ_INQUIRY_MODE           (0x0044 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
198 #define HCI_WRITE_INQUIRY_MODE          (0x0045 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
199 #define HCI_READ_PAGESCAN_TYPE          (0x0046 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
200 #define HCI_WRITE_PAGESCAN_TYPE         (0x0047 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
201 #define HCI_READ_AFH_ASSESSMENT_MODE    (0x0048 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
202 #define HCI_WRITE_AFH_ASSESSMENT_MODE   (0x0049 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
203 #define HCI_READ_EXT_INQ_RESPONSE       (0x0051 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
204 #define HCI_WRITE_EXT_INQ_RESPONSE      (0x0052 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
205 #define HCI_REFRESH_ENCRYPTION_KEY      (0x0053 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
206 #define HCI_READ_SIMPLE_PAIRING_MODE    (0x0055 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
207 #define HCI_WRITE_SIMPLE_PAIRING_MODE   (0x0056 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
208 #define HCI_READ_LOCAL_OOB_DATA         (0x0057 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
209 #define HCI_READ_INQ_TX_POWER_LEVEL     (0x0058 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
210 #define HCI_WRITE_INQ_TX_POWER_LEVEL    (0x0059 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
211 #define HCI_READ_ERRONEOUS_DATA_RPT     (0x005A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
212 #define HCI_WRITE_ERRONEOUS_DATA_RPT    (0x005B | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
213 #define HCI_ENHANCED_FLUSH              (0x005F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
214 #define HCI_SEND_KEYPRESS_NOTIF         (0x0060 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
215 
216 
217 /* AMP HCI */
218 #define HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT  (0x0061 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
219 #define HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT (0x0062 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
220 #define HCI_SET_EVENT_MASK_PAGE_2             (0x0063 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
221 #define HCI_READ_LOCATION_DATA                (0x0064 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
222 #define HCI_WRITE_LOCATION_DATA               (0x0065 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
223 #define HCI_READ_FLOW_CONTROL_MODE            (0x0066 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
224 #define HCI_WRITE_FLOW_CONTROL_MODE           (0x0067 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
225 #define HCI_READ_BE_FLUSH_TOUT                (0x0069 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
226 #define HCI_WRITE_BE_FLUSH_TOUT               (0x006A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
227 #define HCI_SHORT_RANGE_MODE                  (0x006B | HCI_GRP_HOST_CONT_BASEBAND_CMDS) /* 802.11 only */
228 #define HCI_READ_LE_HOST_SUPPORT              (0x006C | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
229 #define HCI_WRITE_LE_HOST_SUPPORT             (0x006D | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
230 
231 
232 /* MWS coexistence */
233 #define HCI_SET_MWS_CHANNEL_PARAMETERS          (0x006E | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
234 #define HCI_SET_EXTERNAL_FRAME_CONFIGURATION    (0x006F | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
235 #define HCI_SET_MWS_SIGNALING                   (0x0070 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
236 #define HCI_SET_MWS_TRANSPORT_LAYER             (0x0071 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
237 #define HCI_SET_MWS_SCAN_FREQUENCY_TABLE        (0x0072 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
238 #define HCI_SET_MWS_PATTERN_CONFIGURATION       (0x0073 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
239 
240 /* Connectionless Broadcast */
241 #define HCI_SET_RESERVED_LT_ADDR                (0x0074 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
242 #define HCI_DELETE_RESERVED_LT_ADDR             (0x0075 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
243 #define HCI_WRITE_CLB_DATA                      (0x0076 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
244 #define HCI_READ_SYNC_TRAIN_PARAM               (0x0077 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
245 #define HCI_WRITE_SYNC_TRAIN_PARAM              (0x0078 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
246 
247 #define HCI_READ_SECURE_CONNS_SUPPORT           (0x0079 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
248 #define HCI_WRITE_SECURE_CONNS_SUPPORT          (0x007A | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
249 #define HCI_CONT_BASEBAND_CMDS_FIRST    HCI_SET_EVENT_MASK
250 #define HCI_CONT_BASEBAND_CMDS_LAST     HCI_READ_SYNC_TRAIN_PARAM
251 
252 
253 /* Commands of HCI_GRP_INFORMATIONAL_PARAMS group */
254 #define HCI_READ_LOCAL_VERSION_INFO     (0x0001 | HCI_GRP_INFORMATIONAL_PARAMS)
255 #define HCI_READ_LOCAL_SUPPORTED_CMDS   (0x0002 | HCI_GRP_INFORMATIONAL_PARAMS)
256 #define HCI_READ_LOCAL_FEATURES         (0x0003 | HCI_GRP_INFORMATIONAL_PARAMS)
257 #define HCI_READ_LOCAL_EXT_FEATURES     (0x0004 | HCI_GRP_INFORMATIONAL_PARAMS)
258 #define HCI_READ_BUFFER_SIZE            (0x0005 | HCI_GRP_INFORMATIONAL_PARAMS)
259 #define HCI_READ_COUNTRY_CODE           (0x0007 | HCI_GRP_INFORMATIONAL_PARAMS)
260 #define HCI_READ_BD_ADDR                (0x0009 | HCI_GRP_INFORMATIONAL_PARAMS)
261 #define HCI_READ_DATA_BLOCK_SIZE        (0x000A | HCI_GRP_INFORMATIONAL_PARAMS)
262 #define HCI_READ_LOCAL_SUPPORTED_CODECS (0x000B | HCI_GRP_INFORMATIONAL_PARAMS)
263 
264 #define HCI_INFORMATIONAL_CMDS_FIRST    HCI_READ_LOCAL_VERSION_INFO
265 #define HCI_INFORMATIONAL_CMDS_LAST     HCI_READ_LOCAL_SUPPORTED_CODECS
266 
267 
268 /* Commands of HCI_GRP_STATUS_PARAMS group */
269 #define HCI_READ_FAILED_CONTACT_COUNT   (0x0001 | HCI_GRP_STATUS_PARAMS)
270 #define HCI_RESET_FAILED_CONTACT_COUNT  (0x0002 | HCI_GRP_STATUS_PARAMS)
271 #define HCI_GET_LINK_QUALITY            (0x0003 | HCI_GRP_STATUS_PARAMS)
272 #define HCI_READ_RSSI                   (0x0005 | HCI_GRP_STATUS_PARAMS)
273 #define HCI_READ_AFH_CH_MAP             (0x0006 | HCI_GRP_STATUS_PARAMS)
274 #define HCI_READ_CLOCK                  (0x0007 | HCI_GRP_STATUS_PARAMS)
275 #define HCI_READ_ENCR_KEY_SIZE          (0x0008 | HCI_GRP_STATUS_PARAMS)
276 
277 /* AMP HCI */
278 #define HCI_READ_LOCAL_AMP_INFO         (0x0009 | HCI_GRP_STATUS_PARAMS)
279 #define HCI_READ_LOCAL_AMP_ASSOC        (0x000A | HCI_GRP_STATUS_PARAMS)
280 #define HCI_WRITE_REMOTE_AMP_ASSOC      (0x000B | HCI_GRP_STATUS_PARAMS)
281 
282 #define HCI_STATUS_PARAMS_CMDS_FIRST    HCI_READ_FAILED_CONTACT_COUNT
283 #define HCI_STATUS_PARAMS_CMDS_LAST     HCI_WRITE_REMOTE_AMP_ASSOC
284 
285 /* Commands of HCI_GRP_TESTING_CMDS group */
286 #define HCI_READ_LOOPBACK_MODE          (0x0001 | HCI_GRP_TESTING_CMDS)
287 #define HCI_WRITE_LOOPBACK_MODE         (0x0002 | HCI_GRP_TESTING_CMDS)
288 #define HCI_ENABLE_DEV_UNDER_TEST_MODE  (0x0003 | HCI_GRP_TESTING_CMDS)
289 #define HCI_WRITE_SIMP_PAIR_DEBUG_MODE  (0x0004 | HCI_GRP_TESTING_CMDS)
290 
291 /* AMP HCI */
292 #define HCI_ENABLE_AMP_RCVR_REPORTS     (0x0007 | HCI_GRP_TESTING_CMDS)
293 #define HCI_AMP_TEST_END                (0x0008 | HCI_GRP_TESTING_CMDS)
294 #define HCI_AMP_TEST                    (0x0009 | HCI_GRP_TESTING_CMDS)
295 
296 #define HCI_TESTING_CMDS_FIRST          HCI_READ_LOOPBACK_MODE
297 #define HCI_TESTING_CMDS_LAST           HCI_AMP_TEST
298 
299 #define HCI_VENDOR_CMDS_FIRST           0x0001
300 #define HCI_VENDOR_CMDS_LAST            0xFFFF
301 #define HCI_VSC_MULTI_AV_HANDLE         0x0AAA
302 #define HCI_VSC_BURST_MODE_HANDLE       0x0BBB
303 
304 /* BLE HCI */
305 #define HCI_GRP_BLE_CMDS                (0x08 << 10)
306 /* Commands of BLE Controller setup and configuration */
307 #define HCI_BLE_SET_EVENT_MASK          (0x0001 | HCI_GRP_BLE_CMDS)
308 #define HCI_BLE_READ_BUFFER_SIZE        (0x0002 | HCI_GRP_BLE_CMDS)
309 #define HCI_BLE_READ_LOCAL_SPT_FEAT     (0x0003 | HCI_GRP_BLE_CMDS)
310 #define HCI_BLE_WRITE_LOCAL_SPT_FEAT    (0x0004 | HCI_GRP_BLE_CMDS)
311 #define HCI_BLE_WRITE_RANDOM_ADDR       (0x0005 | HCI_GRP_BLE_CMDS)
312 #define HCI_BLE_WRITE_ADV_PARAMS        (0x0006 | HCI_GRP_BLE_CMDS)
313 #define HCI_BLE_READ_ADV_CHNL_TX_POWER  (0x0007 | HCI_GRP_BLE_CMDS)
314 #define HCI_BLE_WRITE_ADV_DATA          (0x0008 | HCI_GRP_BLE_CMDS)
315 #define HCI_BLE_WRITE_SCAN_RSP_DATA     (0x0009 | HCI_GRP_BLE_CMDS)
316 #define HCI_BLE_WRITE_ADV_ENABLE        (0x000A | HCI_GRP_BLE_CMDS)
317 #define HCI_BLE_WRITE_SCAN_PARAMS       (0x000B | HCI_GRP_BLE_CMDS)
318 #define HCI_BLE_WRITE_SCAN_ENABLE       (0x000C | HCI_GRP_BLE_CMDS)
319 #define HCI_BLE_CREATE_LL_CONN          (0x000D | HCI_GRP_BLE_CMDS)
320 #define HCI_BLE_CREATE_CONN_CANCEL      (0x000E | HCI_GRP_BLE_CMDS)
321 #define HCI_BLE_READ_WHITE_LIST_SIZE    (0x000F | HCI_GRP_BLE_CMDS)
322 #define HCI_BLE_CLEAR_WHITE_LIST        (0x0010 | HCI_GRP_BLE_CMDS)
323 #define HCI_BLE_ADD_WHITE_LIST          (0x0011 | HCI_GRP_BLE_CMDS)
324 #define HCI_BLE_REMOVE_WHITE_LIST       (0x0012 | HCI_GRP_BLE_CMDS)
325 #define HCI_BLE_UPD_LL_CONN_PARAMS      (0x0013 | HCI_GRP_BLE_CMDS)
326 #define HCI_BLE_SET_HOST_CHNL_CLASS     (0x0014 | HCI_GRP_BLE_CMDS)
327 #define HCI_BLE_READ_CHNL_MAP           (0x0015 | HCI_GRP_BLE_CMDS)
328 #define HCI_BLE_READ_REMOTE_FEAT        (0x0016 | HCI_GRP_BLE_CMDS)
329 #define HCI_BLE_ENCRYPT                 (0x0017 | HCI_GRP_BLE_CMDS)
330 #define HCI_BLE_RAND                    (0x0018 | HCI_GRP_BLE_CMDS)
331 #define HCI_BLE_START_ENC               (0x0019 | HCI_GRP_BLE_CMDS)
332 #define HCI_BLE_LTK_REQ_REPLY           (0x001A | HCI_GRP_BLE_CMDS)
333 #define HCI_BLE_LTK_REQ_NEG_REPLY       (0x001B | HCI_GRP_BLE_CMDS)
334 #define HCI_BLE_READ_SUPPORTED_STATES   (0x001C | HCI_GRP_BLE_CMDS)
335 /*0x001D, 0x001E and 0x001F are reserved*/
336 #define HCI_BLE_RECEIVER_TEST           (0x001D | HCI_GRP_BLE_CMDS)
337 #define HCI_BLE_TRANSMITTER_TEST        (0x001E | HCI_GRP_BLE_CMDS)
338 /* BLE TEST COMMANDS */
339 #define HCI_BLE_TEST_END                (0x001F | HCI_GRP_BLE_CMDS)
340 #define HCI_BLE_RC_PARAM_REQ_REPLY      (0x0020 | HCI_GRP_BLE_CMDS)
341 #define HCI_BLE_RC_PARAM_REQ_NEG_REPLY  (0x0021 | HCI_GRP_BLE_CMDS)
342 
343 #define HCI_BLE_SET_DATA_LENGTH             (0x0022 | HCI_GRP_BLE_CMDS)
344 #define HCI_BLE_READ_DEFAULT_DATA_LENGTH    (0x0023 | HCI_GRP_BLE_CMDS)
345 #define HCI_BLE_WRITE_DEFAULT_DATA_LENGTH   (0x0024 | HCI_GRP_BLE_CMDS)
346 
347 #define HCI_BLE_ADD_DEV_RESOLVING_LIST      (0x0027 | HCI_GRP_BLE_CMDS)
348 #define HCI_BLE_RM_DEV_RESOLVING_LIST       (0x0028 | HCI_GRP_BLE_CMDS)
349 #define HCI_BLE_CLEAR_RESOLVING_LIST        (0x0029 | HCI_GRP_BLE_CMDS)
350 #define HCI_BLE_READ_RESOLVING_LIST_SIZE    (0x002A | HCI_GRP_BLE_CMDS)
351 #define HCI_BLE_READ_RESOLVABLE_ADDR_PEER   (0x002B | HCI_GRP_BLE_CMDS)
352 #define HCI_BLE_READ_RESOLVABLE_ADDR_LOCAL  (0x002C | HCI_GRP_BLE_CMDS)
353 #define HCI_BLE_SET_ADDR_RESOLUTION_ENABLE  (0x002D | HCI_GRP_BLE_CMDS)
354 #define HCI_BLE_SET_RAND_PRIV_ADDR_TIMOUT   (0x002E | HCI_GRP_BLE_CMDS)
355 #if (BLE_50_FEATURE_SUPPORT == TRUE)
356 #define HCI_BLE_READ_PHY                    (0x0030 | HCI_GRP_BLE_CMDS)
357 #define HCI_BLE_SET_DEFAULT_PHY             (0x0031 | HCI_GRP_BLE_CMDS)
358 #define HCI_BLE_SET_PHY                     (0x0032 | HCI_GRP_BLE_CMDS)
359 #define HCI_BLE_ENH_RX_TEST                 (0x0033 | HCI_GRP_BLE_CMDS)
360 #define HCI_BLE_ENH_TX_TEST                 (0x0034 | HCI_GRP_BLE_CMDS)
361 #define HCI_BLE_SET_ADV_RAND_ADDR           (0x0035 | HCI_GRP_BLE_CMDS)
362 #define HCI_BLE_SET_EXT_ADV_PARAM           (0x0036 | HCI_GRP_BLE_CMDS)
363 #define HCI_BLE_SET_EXT_ADV_DATA            (0x0037 | HCI_GRP_BLE_CMDS)
364 #define HCI_BLE_SET_EXT_SCAN_RSP_DATA       (0x0038 | HCI_GRP_BLE_CMDS)
365 #define HCI_BLE_SET_EXT_ADV_ENABLE          (0x0039 | HCI_GRP_BLE_CMDS)
366 #define HCI_BLE_RD_MAX_ADV_DATA_LEN         (0x003A | HCI_GRP_BLE_CMDS)
367 #define HCI_BLE_RD_NUM_OF_ADV_SETS          (0x003B | HCI_GRP_BLE_CMDS)
368 #define HCI_BLE_REMOVE_ADV_SET              (0x003C | HCI_GRP_BLE_CMDS)
369 #define HCI_BLE_CLEAR_ADV_SETS              (0x003D | HCI_GRP_BLE_CMDS)
370 #define HCI_BLE_SET_PERIOD_ADV_PARAMS       (0x003E | HCI_GRP_BLE_CMDS)
371 #define HCI_BLE_SET_PERIOD_ADV_DATA         (0x003F | HCI_GRP_BLE_CMDS)
372 #define HCI_BLE_SET_PERIOD_ADV_ENABLE       (0x0040 | HCI_GRP_BLE_CMDS)
373 #define HCI_BLE_SET_EXT_SCAN_PARAMS         (0x0041 | HCI_GRP_BLE_CMDS)
374 #define HCI_BLE_SET_EXT_SCAN_ENABLE         (0x0042 | HCI_GRP_BLE_CMDS)
375 #define HCI_BLE_EXT_CREATE_CONN             (0x0043 | HCI_GRP_BLE_CMDS)
376 #define HCI_BLE_PERIOD_ADV_CREATE_SYNC      (0x0044 | HCI_GRP_BLE_CMDS)
377 #define HCI_BLE_PERIOD_ADV_CREATE_SYNC_CANCEL (0x0045 | HCI_GRP_BLE_CMDS)
378 #define HCI_BLE_PERIOD_ADV_TERM_SYNC        (0x0046 | HCI_GRP_BLE_CMDS)
379 #define HCI_BLE_ADV_DEV_TO_PERIOD_ADV_LIST  (0x0047 | HCI_GRP_BLE_CMDS)
380 #define HCI_BLE_REMOVE_DEV_FROM_PERIOD_ADV_LIST (0x0048 | HCI_GRP_BLE_CMDS)
381 #define HCI_BLE_CLEAR_PERIOD_ADV_LIST       (0x0049 | HCI_GRP_BLE_CMDS)
382 #define HCI_BLE_RD_PERIOD_ADV_LIST_SIZE     (0x004A | HCI_GRP_BLE_CMDS)
383 #define HCI_BLE_RD_TRANSMIT_POWER           (0x004B | HCI_GRP_BLE_CMDS)
384 #define HCI_BLE_RD_RF_PATH_COMPENSATION     (0x004C | HCI_GRP_BLE_CMDS)
385 #define HCI_BLE_WR_RF_PATH_COMPENSATION     (0x004D | HCI_GRP_BLE_CMDS)
386 #define HCI_BLE_SET_PRIVACY_MODE            (0x004E | HCI_GRP_BLE_CMDS)
387 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
388 #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
389 #define HCI_BLE_SET_PERIOD_ADV_RECV_ENABLE  (0x0059 | HCI_GRP_BLE_CMDS)
390 #define HCI_BLE_PERIOD_ADV_SYNC_TRANS       (0x005A | HCI_GRP_BLE_CMDS)
391 #define HCI_BLE_PERIOD_ADV_SET_INFO_TRANS   (0x005B | HCI_GRP_BLE_CMDS)
392 #define HCI_BLE_SET_PERIOD_ADV_SYNC_TRANS_PARAMS    (0x005C | HCI_GRP_BLE_CMDS)
393 #endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
394 // Vendor OGF define
395 #define HCI_VENDOR_OGF          0x3F
396 
397 // ESP vendor group define
398 #define HCI_ESP_GROUP_COMMON    0x01
399 #define HCI_ESP_GROUP_BLE       0x02
400 #define HCI_ESP_GROUP_BT        0x03
401 #define HCI_ESP_GROUP_END       0x07
402 
403 //ESP common subcode define
404 #define HCI_SUBCODE_COMMON_INIT        0x00
405 #define HCI_SUBCODE_COMMON_ECHO        0x01
406 #define HCI_SUBCODE_COMMON_COEX_STATUS 0x02
407 #define HCI_SUBCODE_COMMON_MAX         0x7F
408 
409 //ESP BLE subcode define
410 #define HCI_SUBCODE_BLE_INIT                       0x00
411 #define HCI_SUBCODE_BLE_MULTI_ADV                  0x01
412 #define HCI_SUBCODE_BLE_BATCH_SCAN                 0x02
413 #define HCI_SUBCODE_BLE_ADV_FILTER                 0x03
414 #define HCI_SUBCODE_BLE_TRACK_ADV                  0x04
415 #define HCI_SUBCODE_BLE_ENERGY_INFO                0x05
416 #define HCI_SUBCODE_BLE_EXTENDED_SCAN_PARAMS       0x06
417 #define HCI_SUBCODE_BLE_LONG_ADV                   0x07
418 #define HCI_SUBCODE_BLE_DUPLICATE_EXCEPTIONAL_LIST 0x08
419 #define HCI_SUBCODE_BLE_SET_ADV_FLOW_CONTROL       0x09
420 #define HCI_SUBCODE_BLE_ADV_REPORT_FLOW_CONTROL    0x0A
421 #define HCI_SUBCODE_BLE_MAX                        0x7F
422 
423 //ESP BT subcode define
424 #define HCI_SUBCODE_BT_INIT     0x00
425 #define HCI_SUBCODE_BT_MAX      0x7F
426 
427 #define HCI_ESP_VENDOR_OPCODE_BUILD(ogf, group, subcode) ((ogf << 10) | (group <<7) | (subcode << 0))
428 /*
429 * |     OGF     | VENDIOR GROUP | GROUP SUBCODE |
430 * | 1 1 1 1 1 1 |     0 0 0     | X X X X X X X | Already Exist
431 * | 1 1 1 1 1 1 |     0 0 1     | X X X X X X X | ESP VENDOR COMMON HCI CMD
432 * | 1 1 1 1 1 1 |     0 1 0     | X X X X X X X | ESP VENDOR BLE HCI CMD
433 * | 1 1 1 1 1 1 |     0 1 1     | X X X X X X X | ESP VENDOR BT HCI CMD
434 * | 1 1 1 1 1 1 |     1 0 0     | X X X X X X X | RESERVED FOR FUTURE USE
435 * | 1 1 1 1 1 1 |     1 0 1     | X X X X X X X | RESERVED FOR FUTURE USE
436 * | 1 1 1 1 1 1 |     1 1 0     | X X X X X X X | RESERVED FOR FUTURE USE
437 * | 1 1 1 1 1 1 |     1 1 1     | X X X X X X X | RESERVED FOR FUTURE USE
438 */
439 
440 // ESP COMMON HCI CMD
441 #define HCI_VENDOR_COMMON_ECHO_CMD_OPCODE HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_COMMON, HCI_SUBCODE_COMMON_ECHO)
442 // Set/clear coex schm status
443 #define HCI_VENDOR_COMMON_COEX_STATUS_CMD_OPCODE HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_COMMON, HCI_SUBCODE_COMMON_COEX_STATUS)
444 
445 //ESP BLE HCI CMD
446 /* Multi adv OCF */
447 #define HCI_BLE_MULTI_ADV_OCF             HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_MULTI_ADV)
448 /* Batch scan OCF */
449 #define HCI_BLE_BATCH_SCAN_OCF            HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_BATCH_SCAN)
450 /* ADV filter OCF */
451 #define HCI_BLE_ADV_FILTER_OCF            HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_ADV_FILTER)
452 /* Tracking OCF */
453 #define HCI_BLE_TRACK_ADV_OCF             HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_TRACK_ADV)
454 /* Energy info OCF */
455 #define HCI_BLE_ENERGY_INFO_OCF           HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_ENERGY_INFO)
456 /* Extended BLE Scan parameters OCF */
457 #define HCI_BLE_EXTENDED_SCAN_PARAMS_OCF  HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_EXTENDED_SCAN_PARAMS)
458 /* Long BLE Adv data OCF */
459 #define HCI_VENDOR_BLE_LONG_ADV_DATA      HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_LONG_ADV)
460 /* BLE update duplicate scan exceptional list */
461 #define HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST  HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_DUPLICATE_EXCEPTIONAL_LIST)
462 #define HCI_VENDOR_BLE_SET_ADV_FLOW_CONTROL        HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_SET_ADV_FLOW_CONTROL)
463 #define HCI_VENDOR_BLE_ADV_REPORT_FLOW_CONTROL     HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_ADV_REPORT_FLOW_CONTROL)
464 //ESP BT HCI CMD
465 
466 /* subcode for multi adv feature */
467 #define BTM_BLE_MULTI_ADV_SET_PARAM                     0x01
468 #define BTM_BLE_MULTI_ADV_WRITE_ADV_DATA                0x02
469 #define BTM_BLE_MULTI_ADV_WRITE_SCAN_RSP_DATA           0x03
470 #define BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR               0x04
471 #define BTM_BLE_MULTI_ADV_ENB                           0x05
472 
473 /* multi adv VSE subcode */
474 #define HCI_VSE_SUBCODE_BLE_MULTI_ADV_ST_CHG       0x55 /* multi adv instance state change */
475 
476 /* subcode for batch scan feature */
477 #define BTM_BLE_BATCH_SCAN_ENB_DISAB_CUST_FEATURE      0x01
478 #define BTM_BLE_BATCH_SCAN_SET_STORAGE_PARAM           0x02
479 #define BTM_BLE_BATCH_SCAN_SET_PARAMS                  0x03
480 #define BTM_BLE_BATCH_SCAN_READ_RESULTS                0x04
481 
482 /* batch scan VSE subcode */
483 #define HCI_VSE_SUBCODE_BLE_THRESHOLD_SUB_EVT      0x54 /* Threshold event */
484 
485 /* tracking sub event */
486 #define HCI_VSE_SUBCODE_BLE_TRACKING_SUB_EVT       0x56 /* Tracking event */
487 
488 /* LE supported states definition */
489 #define HCI_LE_ADV_STATE          0x00000001
490 #define HCI_LE_SCAN_STATE         0x00000002
491 #define HCI_LE_INIT_STATE         0x00000004
492 #define HCI_LE_CONN_SL_STATE      0x00000008
493 #define HCI_LE_ADV_SCAN_STATE     0x00000010
494 #define HCI_LE_ADV_INIT_STATE     0x00000020
495 #define HCI_LE_ADV_MA_STATE       0x00000040
496 #define HCI_LE_ADV_SL_STATE       0x00000080
497 #define HCI_LE_SCAN_INIT_STATE    0x00000100
498 #define HCI_LE_SCAN_MA_STATE      0x00000200
499 #define HCI_LE_SCAN_SL_STATE      0x00000400
500 #define HCI_LE_INIT_MA_STATE      0x00000800
501 
502 /* LE Supported States */
503 /* Non Connectable Adv state is supported. 0x0000000000000001 */
504 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_MASK          0x01
505 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_OFF           0
506 #define HCI_LE_STATES_NON_CONN_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_MASK)
507 
508 /*Scanneable Connectable Adv state  is supported. 0x0000000000000002 */
509 #define HCI_SUPP_LE_STATES_SCAN_ADV_MASK          0x02
510 #define HCI_SUPP_LE_STATESSCAN_ADV_OFF           0
511 #define HCI_LE_STATES_SCAN_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATESSCAN_ADV_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_MASK)
512 
513 /* Connectable Adv state is supported. 0x0000000000000004 */
514 #define HCI_SUPP_LE_STATES_CONN_ADV_MASK          0x04
515 #define HCI_SUPP_LE_STATES_CONN_ADV_OFF           0
516 #define HCI_LE_STATES_CONN_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_MASK)
517 
518 /* Hi duty Cycle Directed Adv state is supported. 0x0000000000000008 */
519 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASK          0x08
520 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_OFF           0
521 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_OFF] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASK)
522 
523 /* Passive Scan state is supported. 0x0000000000000010 */
524 #define HCI_SUPP_LE_STATES_PASS_SCAN_MASK          0x10
525 #define HCI_SUPP_LE_STATES_PASS_SCAN_OFF           0
526 #define HCI_LE_STATES_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_PASS_SCAN_MASK)
527 
528 /* Active Scan state is supported. 0x0000000000000020 */
529 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASK          0x20
530 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_OFF           0
531 #define HCI_LE_STATES_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASK)
532 
533 /* Initiating state is supported. 0x0000000000000040 (or connection state in master role is also supported) */
534 #define HCI_SUPP_LE_STATES_INIT_MASK          0x40
535 #define HCI_SUPP_LE_STATES_INIT_OFF           0
536 #define HCI_LE_STATES_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_INIT_OFF] & HCI_SUPP_LE_STATES_INIT_MASK)
537 
538 /*connection state in slave  role is also supported. 0x0000000000000080 */
539 #define HCI_SUPP_LE_STATES_SLAVE_MASK          0x80
540 #define HCI_SUPP_LE_STATES_SLAVE_OFF           0
541 #define HCI_LE_STATES_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SLAVE_OFF] & HCI_SUPP_LE_STATES_SLAVE_MASK)
542 
543 /* Non Connectable Adv state and Passive Scanning State combination is supported. 0x0000000000000100 */
544 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_MASK          0x01
545 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_OFF           1
546 #define HCI_LE_STATES_NON_CONN_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_PASS_SCAN_MASK)
547 
548 /*Scannable Adv state and Passive Scanning State combination is supported. 0x0000000000000200 */
549 #define HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_MASK          0x02
550 #define HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_OFF           1
551 #define HCI_LE_STATES_SCAN_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_PASS_SCAN_MASK)
552 
553 /*Connectable Adv state and Passive Scanning State combination is supported. 0x0000000000000400 */
554 #define HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_MASK          0x04
555 #define HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_OFF           1
556 #define HCI_LE_STATES_CONN_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_PASS_SCAN_MASK)
557 
558 /*High Duty Cycl Directed ADv and Passive Scanning State combination is supported. 0x0000000000000800 */
559 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_MASK          0x08
560 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_OFF           1
561 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_MASK] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_PASS_SCAN_OFF)
562 
563 /*Non Connectable Adv state and Passive Scanning State combination is supported. 0x0000000000001000 */
564 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_MASK          0x10
565 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_OFF           1
566 #define HCI_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_ACTIVE_SCAN_MASK)
567 
568 /*Scannable Adv state and Active Scanning State combination is supported. 0x0000000000002000 */
569 #define HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_MASK          0x20
570 #define HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_OFF           1
571 #define HCI_LE_STATES_SCAN_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_ACTIVE_SCAN_MASK)
572 
573 /*Connectable Adv state and Active Scanning State combination is supported. 0x0000000000004000 */
574 #define HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_MASK          0x40
575 #define HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_OFF           1
576 #define HCI_LE_STATES_CONN_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_ACTIVE_SCAN_MASK)
577 
578 /*High Duty Cycl Directed ADv and ACtive Scanning State combination is supported. 0x0000000000008000 */
579 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_MASK          0x80
580 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_OFF           1
581 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_MASK] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_ACTIVE_SCAN_OFF)
582 
583 /*Non-Connectable Adv state and Initiating State combination is supported. 0x0000000000010000 */
584 #define HCI_SUPP_LE_STATES_NON_CONN_INIT_MASK          0x01
585 #define HCI_SUPP_LE_STATES_NON_CONN_INIT_OFF           2
586 #define HCI_LE_STATES_NON_CONN_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_INIT_OFF] & HCI_SUPP_LE_STATES_NON_CONN_INIT_MASK)
587 
588 /* Scannable Adv state and Initiating State combination is supported. 0x0000000000020000 */
589 #define HCI_SUPP_LE_STATES_SCAN_ADV_INIT_MASK          0x02
590 #define HCI_SUPP_LE_STATES_SCAN_ADV_INIT_OFF           2
591 #define HCI_LE_STATES_SCAN_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_INIT_MASK)
592 
593 /* Non-Connectable Adv state and Master Role combination is supported. 0x0000000000040000 */
594 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_MASK          0x04
595 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_OFF           2
596 #define HCI_LE_STATES_NON_CONN_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_MASTER_MASK)
597 
598 /*Scannable Adv state and Master Role combination is supported. 0x0000000000040000 */
599 #define HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_MASK          0x08
600 #define HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_OFF           2
601 #define HCI_LE_STATES_SCAN_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_MASTER_MASK)
602 
603 /* Non-Connectable Adv and Slave Role combination is supported. 0x000000000100000 */
604 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_MASK          0x10
605 #define HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_OFF           2
606 #define HCI_LE_STATES_NON_CONN_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_NON_CONN_ADV_SLAVE_MASK)
607 
608 /*Scannable Adv and Slave Role combination is supported. 0x000000000200000 */
609 #define HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_MASK          0x20
610 #define HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_OFF           2
611 #define HCI_LE_STATES_SCAN_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_SCAN_ADV_SLAVE_MASK)
612 
613 /*Passive Scan and Initiating State combination is supported. 0x000000000400000 */
614 #define HCI_SUPP_LE_STATES_PASS_SCAN_INIT_MASK          0x40
615 #define HCI_SUPP_LE_STATES_PASS_SCAN_INIT_OFF           2
616 #define HCI_LE_STATES_PASS_SCAN_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_PASS_SCAN_INIT_OFF] & HCI_SUPP_LE_STATES_PASS_SCAN_INIT_MASK)
617 
618 /*Active Scan and Initiating State combination is supported. 0x000000000800000 */
619 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_MASK          0x80
620 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_OFF           2
621 #define HCI_LE_STATES_ACTIVE_SCAN_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_INIT_MASK)
622 
623 /*Passive Scan and Master Role combination is supported. 0x000000001000000 */
624 #define HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_MASK          0x01
625 #define HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_OFF           3
626 #define HCI_LE_STATES_PASS_SCAN_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_OFF] & HCI_SUPP_LE_STATES_PASS_SCAN_MASTER_MASK)
627 
628 /*Active Scan and Master Role combination is supported. 0x000000002000000 */
629 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_MASK          0x02
630 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_OFF           3
631 #define HCI_LE_STATES_ACTIVE_SCAN_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_MASTER_MASK)
632 
633 /*Passive Scan and Slave Role combination is supported. 0x000000004000000 */
634 #define HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_MASK          0x04
635 #define HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_OFF           3
636 #define HCI_LE_STATES_PASS_SCAN_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_OFF] & HCI_SUPP_LE_STATES_PASS_SCAN_SLAVE_MASK)
637 
638 /*Active Scan and Slave Role combination is supported. 0x000000008000000 */
639 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_MASK          0x08
640 #define HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_OFF           3
641 #define HCI_LE_STATES_ACTIVE_SCAN_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_OFF] & HCI_SUPP_LE_STATES_ACTIVE_SCAN_SLAVE_MASK)
642 
643 /*Link Layer Topology Added States Combo */
644 /*Initiating State and Master Role combination supported.
645   Master Role and Master Role combination is also supported. 0x0000000010000000 */
646 #define HCI_SUPP_LE_STATES_INIT_MASTER_MASK          0x10
647 #define HCI_SUPP_LE_STATES_INIT_MASTER_OFF           3
648 #define HCI_LE_STATES_INIT_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_INIT_MASTER_OFF] & HCI_SUPP_LE_STATES_INIT_MASTER_MASK)
649 
650 /*Low Duty Cycle Directed Advertising State . 0x0000000020000000 */
651 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASK          0x20
652 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_OFF           3
653 #define HCI_LE_STATES_LOW_DUTY_DIR_ADV_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LOW_DUTY_DIR_ADV_OFF] & HCI_SUPP_LE_STATES_LOW_DUTY_DIR_ADV_MASK)
654 
655 /*Low Duty Cycle Directed Advertising State and Passive scan combination. 0x0000000040000000 */
656 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_MASK          0x40
657 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_OFF           3
658 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_PASS_SCAN_MASK)
659 
660 /*Low Duty Cycle Directed Advertising State and Active scan combination . 0x0000000080000000 */
661 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_MASK          0x80
662 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_OFF           3
663 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_ACTIVE_SCAN_MASK)
664 
665 /* Connectable Advertising State and Initiating State combination supported. 0x0000000100000000 */
666 #define HCI_SUPP_LE_STATES_CONN_ADV_INIT_MASK          0x01
667 #define HCI_SUPP_LE_STATES_CONN_ADV_INIT_OFF           4
668 #define HCI_LE_STATES_CONN_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_INIT_MASK)
669 
670 /* High Duty Cycle Directed Advertising State and Initiating State combination supported. */
671 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_MASK          0x02
672 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_OFF           4
673 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_INIT_MASK)
674 
675 /* Low Duty Cycle Directed Advertising State and Initiating State combination supported.*/
676 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_MASK          0x04
677 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_OFF           4
678 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_INIT_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_INIT_MASK)
679 
680 /* Connectable Advertising State and Master Role combination supported.*/
681 #define HCI_SUPP_LE_STATES_CONN_ADV_MASTER_MASK          0x08
682 #define HCI_SUPP_LE_STATES_CONN_ADV_MASTER_OFF           4
683 #define HCI_LE_STATES_CONN_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_MASTER_MASK)
684 
685 /* High Duty Cycle Directed Advertising State and Master Role combination supported.*/
686 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_MASK          0x10
687 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_OFF           4
688 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_MASTER_MASK)
689 
690 /* Low Duty Cycle Directed Advertising State and Master Role combination supported.*/
691 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_MASK          0x20
692 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_OFF           4
693 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_MASTER_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_MASTER_MASK)
694 
695 /* Connectable Advertising State and Slave Role combination supported. */
696 #define HCI_SUPP_LE_STATES_CONN_ADV_SLAVE_MASK          0x40
697 #define HCI_SUPP_LE_STATES_CONN_ADV_SLAVE_OFF           4
698 #define HCI_LE_STATES_CONN_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_CONN_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_CONN_ADV_SLAVE_MASK)
699 
700 /* High Duty Cycle Directed Advertising State and slave Role combination supported.*/
701 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_MASK          0x80
702 #define HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_OFF           4
703 #define HCI_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_HI_DUTY_DIR_ADV_SLAVE_MASK)
704 
705 /* Low Duty Cycle Directed Advertising State and slave Role combination supported.*/
706 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_MASK          0x01
707 #define HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_OFF           5
708 #define HCI_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_OFF] & HCI_SUPP_LE_STATES_LO_DUTY_DIR_ADV_SLAVE_MASK)
709 
710 /* Initiating State and Slave Role combination supported.
711    Master Role and Slave Role combination also supported.
712  */
713 #define HCI_SUPP_LE_STATES_INIT_MASTER_SLAVE_MASK          0x02
714 #define HCI_SUPP_LE_STATES_INIT_MASTER_SLAVE_OFF           5
715 #define HCI_LE_STATES_INIT_MASTER_SLAVE_SUPPORTED(x)      ((x)[HCI_SUPP_LE_STATES_INIT_MASTER_SLAVE_OFF] & HCI_SUPP_LE_STATES_INIT_MASTER_SLAVE_MASK)
716 
717 /*
718 **  Definitions for HCI Events
719 */
720 #define HCI_INQUIRY_COMP_EVT                0x01
721 #define HCI_INQUIRY_RESULT_EVT              0x02
722 #define HCI_CONNECTION_COMP_EVT             0x03
723 #define HCI_CONNECTION_REQUEST_EVT          0x04
724 #define HCI_DISCONNECTION_COMP_EVT          0x05
725 #define HCI_AUTHENTICATION_COMP_EVT         0x06
726 #define HCI_RMT_NAME_REQUEST_COMP_EVT       0x07
727 #define HCI_ENCRYPTION_CHANGE_EVT           0x08
728 #define HCI_CHANGE_CONN_LINK_KEY_EVT        0x09
729 #define HCI_MASTER_LINK_KEY_COMP_EVT        0x0A
730 #define HCI_READ_RMT_FEATURES_COMP_EVT      0x0B
731 #define HCI_READ_RMT_VERSION_COMP_EVT       0x0C
732 #define HCI_QOS_SETUP_COMP_EVT              0x0D
733 #define HCI_COMMAND_COMPLETE_EVT            0x0E
734 #define HCI_COMMAND_STATUS_EVT              0x0F
735 #define HCI_HARDWARE_ERROR_EVT              0x10
736 #define HCI_FLUSH_OCCURED_EVT               0x11
737 #define HCI_ROLE_CHANGE_EVT                 0x12
738 #define HCI_NUM_COMPL_DATA_PKTS_EVT         0x13
739 #define HCI_MODE_CHANGE_EVT                 0x14
740 #define HCI_RETURN_LINK_KEYS_EVT            0x15
741 #define HCI_PIN_CODE_REQUEST_EVT            0x16
742 #define HCI_LINK_KEY_REQUEST_EVT            0x17
743 #define HCI_LINK_KEY_NOTIFICATION_EVT       0x18
744 #define HCI_LOOPBACK_COMMAND_EVT            0x19
745 #define HCI_DATA_BUF_OVERFLOW_EVT           0x1A
746 #define HCI_MAX_SLOTS_CHANGED_EVT           0x1B
747 #define HCI_READ_CLOCK_OFF_COMP_EVT         0x1C
748 #define HCI_CONN_PKT_TYPE_CHANGE_EVT        0x1D
749 #define HCI_QOS_VIOLATION_EVT               0x1E
750 #define HCI_PAGE_SCAN_MODE_CHANGE_EVT       0x1F
751 #define HCI_PAGE_SCAN_REP_MODE_CHNG_EVT     0x20
752 #define HCI_FLOW_SPECIFICATION_COMP_EVT     0x21
753 #define HCI_INQUIRY_RSSI_RESULT_EVT         0x22
754 #define HCI_READ_RMT_EXT_FEATURES_COMP_EVT  0x23
755 #define HCI_ESCO_CONNECTION_COMP_EVT        0x2C
756 #define HCI_ESCO_CONNECTION_CHANGED_EVT     0x2D
757 #define HCI_SNIFF_SUB_RATE_EVT              0x2E
758 #define HCI_EXTENDED_INQUIRY_RESULT_EVT     0x2F
759 #define HCI_ENCRYPTION_KEY_REFRESH_COMP_EVT 0x30
760 #define HCI_IO_CAPABILITY_REQUEST_EVT       0x31
761 #define HCI_IO_CAPABILITY_RESPONSE_EVT      0x32
762 #define HCI_USER_CONFIRMATION_REQUEST_EVT   0x33
763 #define HCI_USER_PASSKEY_REQUEST_EVT        0x34
764 #define HCI_REMOTE_OOB_DATA_REQUEST_EVT     0x35
765 #define HCI_SIMPLE_PAIRING_COMPLETE_EVT     0x36
766 #define HCI_LINK_SUPER_TOUT_CHANGED_EVT     0x38
767 #define HCI_ENHANCED_FLUSH_COMPLETE_EVT     0x39
768 #define HCI_USER_PASSKEY_NOTIFY_EVT         0x3B
769 #define HCI_KEYPRESS_NOTIFY_EVT             0x3C
770 #define HCI_RMT_HOST_SUP_FEAT_NOTIFY_EVT    0x3D
771 
772 /*#define HCI_GENERIC_AMP_LINK_KEY_NOTIF_EVT  0x3E Removed from spec */
773 #define HCI_PHYSICAL_LINK_COMP_EVT          0x40
774 #define HCI_CHANNEL_SELECTED_EVT            0x41
775 #define HCI_DISC_PHYSICAL_LINK_COMP_EVT     0x42
776 #define HCI_PHY_LINK_LOSS_EARLY_WARNING_EVT 0x43
777 #define HCI_PHY_LINK_RECOVERY_EVT           0x44
778 #define HCI_LOGICAL_LINK_COMP_EVT           0x45
779 #define HCI_DISC_LOGICAL_LINK_COMP_EVT      0x46
780 #define HCI_FLOW_SPEC_MODIFY_COMP_EVT       0x47
781 #define HCI_NUM_COMPL_DATA_BLOCKS_EVT       0x48
782 #define HCI_SHORT_RANGE_MODE_COMPLETE_EVT   0x4C
783 #define HCI_AMP_STATUS_CHANGE_EVT           0x4D
784 #define HCI_SET_TRIGGERED_CLOCK_CAPTURE_EVT 0x4E
785 
786 /* ULP HCI Event */
787 #define HCI_BLE_EVENT                       0x3e
788 /* ULP Event sub code */
789 #define HCI_BLE_CONN_COMPLETE_EVT           0x01
790 #define HCI_BLE_ADV_PKT_RPT_EVT             0x02
791 #define HCI_BLE_LL_CONN_PARAM_UPD_EVT       0x03
792 #define HCI_BLE_READ_REMOTE_FEAT_CMPL_EVT   0x04
793 #define HCI_BLE_LTK_REQ_EVT                 0x05
794 #define HCI_BLE_RC_PARAM_REQ_EVT            0x06
795 #define HCI_BLE_DATA_LENGTH_CHANGE_EVT      0x07
796 #define HCI_BLE_ENHANCED_CONN_COMPLETE_EVT  0x0a
797 #define HCI_BLE_DIRECT_ADV_EVT              0x0b
798 /* ESP vendor BLE Event sub code */
799 #define HCI_BLE_ADV_DISCARD_REPORT_EVT      0XF0
800 #if (BLE_50_FEATURE_SUPPORT == TRUE)
801 #define HCI_BLE_PHY_UPDATE_COMPLETE_EVT     0x0c
802 #define HCI_BLE_EXT_ADV_REPORT_EVT          0x0d
803 #define HCI_BLE_PERIOD_ADV_SYNC_ESTAB_EVT   0x0e
804 #define HCI_BLE_PERIOD_ADV_REPORT_EVT       0x0f
805 #define HCI_BLE_PERIOD_ADV_SYNC_LOST_EVT    0x10
806 #define HCI_BLE_SCAN_TIMEOUT_EVT            0x11
807 #define HCI_BLE_ADV_SET_TERMINATED_EVT      0x12
808 #define HCI_BLE_SCAN_REQ_RECEIVED_EVT       0x13
809 #define HCI_BLE_CHANNEL_SELECT_ALG          0x14
810 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
811 #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
812 #define HCI_BLE_PERIOD_ADV_SYNC_TRANS_RECV_EVT 0x18
813 #endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
814 
815 /* Definitions for LE Channel Map */
816 #define HCI_BLE_CHNL_MAP_SIZE               5
817 
818 #define HCI_VENDOR_SPECIFIC_EVT         0xFF  /* Vendor specific events */
819 #define HCI_NAP_TRACE_EVT               0xFF  /* was define 0xFE, 0xFD, change to 0xFF
820                                                  because conflict w/ TCI_EVT and per
821                                                  specification compliant */
822 
823 /*
824 **  Defentions for HCI Error Codes that are past in the events
825 */
826 #define HCI_SUCCESS                                     0x00
827 #define HCI_PENDING                                     0x00
828 #define HCI_ERR_ILLEGAL_COMMAND                         0x01
829 #define HCI_ERR_NO_CONNECTION                           0x02
830 #define HCI_ERR_HW_FAILURE                              0x03
831 #define HCI_ERR_PAGE_TIMEOUT                            0x04
832 #define HCI_ERR_AUTH_FAILURE                            0x05
833 #define HCI_ERR_KEY_MISSING                             0x06
834 #define HCI_ERR_MEMORY_FULL                             0x07
835 #define HCI_ERR_CONNECTION_TOUT                         0x08
836 #define HCI_ERR_MAX_NUM_OF_CONNECTIONS                  0x09
837 #define HCI_ERR_MAX_NUM_OF_SCOS                         0x0A
838 #define HCI_ERR_CONNECTION_EXISTS                       0x0B
839 #define HCI_ERR_COMMAND_DISALLOWED                      0x0C
840 #define HCI_ERR_HOST_REJECT_RESOURCES                   0x0D
841 #define HCI_ERR_HOST_REJECT_SECURITY                    0x0E
842 #define HCI_ERR_HOST_REJECT_DEVICE                      0x0F
843 #define HCI_ERR_HOST_TIMEOUT                            0x10
844 #define HCI_ERR_UNSUPPORTED_VALUE                       0x11
845 #define HCI_ERR_ILLEGAL_PARAMETER_FMT                   0x12
846 #define HCI_ERR_PEER_USER                               0x13
847 #define HCI_ERR_PEER_LOW_RESOURCES                      0x14
848 #define HCI_ERR_PEER_POWER_OFF                          0x15
849 #define HCI_ERR_CONN_CAUSE_LOCAL_HOST                   0x16
850 #define HCI_ERR_REPEATED_ATTEMPTS                       0x17
851 #define HCI_ERR_PAIRING_NOT_ALLOWED                     0x18
852 #define HCI_ERR_UNKNOWN_LMP_PDU                         0x19
853 #define HCI_ERR_UNSUPPORTED_REM_FEATURE                 0x1A
854 #define HCI_ERR_SCO_OFFSET_REJECTED                     0x1B
855 #define HCI_ERR_SCO_INTERVAL_REJECTED                   0x1C
856 #define HCI_ERR_SCO_AIR_MODE                            0x1D
857 #define HCI_ERR_INVALID_LMP_PARAM                       0x1E
858 #define HCI_ERR_UNSPECIFIED                             0x1F
859 #define HCI_ERR_UNSUPPORTED_LMP_PARAMETERS              0x20
860 #define HCI_ERR_ROLE_CHANGE_NOT_ALLOWED                 0x21
861 #define HCI_ERR_LMP_RESPONSE_TIMEOUT                    0x22
862 #define HCI_ERR_LMP_ERR_TRANS_COLLISION                 0x23
863 #define HCI_ERR_LMP_PDU_NOT_ALLOWED                     0x24
864 #define HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE               0x25
865 #define HCI_ERR_UNIT_KEY_USED                           0x26
866 #define HCI_ERR_QOS_NOT_SUPPORTED                       0x27
867 #define HCI_ERR_INSTANT_PASSED                          0x28
868 #define HCI_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED     0x29
869 #define HCI_ERR_DIFF_TRANSACTION_COLLISION              0x2A
870 #define HCI_ERR_UNDEFINED_0x2B                          0x2B
871 #define HCI_ERR_QOS_UNACCEPTABLE_PARAM                  0x2C
872 #define HCI_ERR_QOS_REJECTED                            0x2D
873 #define HCI_ERR_CHAN_CLASSIF_NOT_SUPPORTED              0x2E
874 #define HCI_ERR_INSUFFCIENT_SECURITY                    0x2F
875 #define HCI_ERR_PARAM_OUT_OF_RANGE                      0x30
876 #define HCI_ERR_UNDEFINED_0x31                          0x31
877 #define HCI_ERR_ROLE_SWITCH_PENDING                     0x32
878 #define HCI_ERR_UNDEFINED_0x33                          0x33
879 #define HCI_ERR_RESERVED_SLOT_VIOLATION                 0x34
880 #define HCI_ERR_ROLE_SWITCH_FAILED                      0x35
881 #define HCI_ERR_INQ_RSP_DATA_TOO_LARGE                  0x36
882 #define HCI_ERR_SIMPLE_PAIRING_NOT_SUPPORTED            0x37
883 #define HCI_ERR_HOST_BUSY_PAIRING                       0x38
884 #define HCI_ERR_REJ_NO_SUITABLE_CHANNEL                 0x39
885 #define HCI_ERR_CONTROLLER_BUSY                         0x3A
886 #define HCI_ERR_UNACCEPT_CONN_INTERVAL                  0x3B
887 #define HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT            0x3C
888 #define HCI_ERR_CONN_TOUT_DUE_TO_MIC_FAILURE            0x3D
889 #define HCI_ERR_CONN_FAILED_ESTABLISHMENT               0x3E
890 #define HCI_ERR_MAC_CONNECTION_FAILED                   0x3F
891 
892 /* ConnectionLess Broadcast errors */
893 #define HCI_ERR_LT_ADDR_ALREADY_IN_USE                  0x40
894 #define HCI_ERR_LT_ADDR_NOT_ALLOCATED                   0x41
895 #define HCI_ERR_CLB_NOT_ENABLED                         0x42
896 #define HCI_ERR_CLB_DATA_TOO_BIG                        0x43
897 
898 #define HCI_ERR_MAX_ERR                                 0x43
899 
900 //ESP vendor error code
901 #define HCI_ERR_ESP_VENDOR_FAIL                         0xE0
902 
903 #define HCI_HINT_TO_RECREATE_AMP_PHYS_LINK              0xFF
904 #if (BLE_50_FEATURE_SUPPORT == TRUE)
905 typedef UINT8 tHCI_STATUS;
906 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
907 
908 /*
909 ** Definitions for HCI enable event
910 */
911 #define HCI_INQUIRY_COMPLETE_EV(p)          (*((UINT32 *)(p)) & 0x00000001)
912 #define HCI_INQUIRY_RESULT_EV(p)            (*((UINT32 *)(p)) & 0x00000002)
913 #define HCI_CONNECTION_COMPLETE_EV(p)       (*((UINT32 *)(p)) & 0x00000004)
914 #define HCI_CONNECTION_REQUEST_EV(p)        (*((UINT32 *)(p)) & 0x00000008)
915 #define HCI_DISCONNECTION_COMPLETE_EV(p)    (*((UINT32 *)(p)) & 0x00000010)
916 #define HCI_AUTHENTICATION_COMPLETE_EV(p)   (*((UINT32 *)(p)) & 0x00000020)
917 #define HCI_RMT_NAME_REQUEST_COMPL_EV(p)    (*((UINT32 *)(p)) & 0x00000040)
918 #define HCI_CHANGE_CONN_ENCRPT_ENABLE_EV(p) (*((UINT32 *)(p)) & 0x00000080)
919 #define HCI_CHANGE_CONN_LINK_KEY_EV(p)      (*((UINT32 *)(p)) & 0x00000100)
920 #define HCI_MASTER_LINK_KEY_COMPLETE_EV(p)  (*((UINT32 *)(p)) & 0x00000200)
921 #define HCI_READ_RMT_FEATURES_COMPL_EV(p)   (*((UINT32 *)(p)) & 0x00000400)
922 #define HCI_READ_RMT_VERSION_COMPL_EV(p)    (*((UINT32 *)(p)) & 0x00000800)
923 #define HCI_QOS_SETUP_COMPLETE_EV(p)        (*((UINT32 *)(p)) & 0x00001000)
924 #define HCI_COMMAND_COMPLETE_EV(p)          (*((UINT32 *)(p)) & 0x00002000)
925 #define HCI_COMMAND_STATUS_EV(p)            (*((UINT32 *)(p)) & 0x00004000)
926 #define HCI_HARDWARE_ERROR_EV(p)            (*((UINT32 *)(p)) & 0x00008000)
927 #define HCI_FLASH_OCCURED_EV(p)             (*((UINT32 *)(p)) & 0x00010000)
928 #define HCI_ROLE_CHANGE_EV(p)               (*((UINT32 *)(p)) & 0x00020000)
929 #define HCI_NUM_COMPLETED_PKTS_EV(p)        (*((UINT32 *)(p)) & 0x00040000)
930 #define HCI_MODE_CHANGE_EV(p)               (*((UINT32 *)(p)) & 0x00080000)
931 #define HCI_RETURN_LINK_KEYS_EV(p)          (*((UINT32 *)(p)) & 0x00100000)
932 #define HCI_PIN_CODE_REQUEST_EV(p)          (*((UINT32 *)(p)) & 0x00200000)
933 #define HCI_LINK_KEY_REQUEST_EV(p)          (*((UINT32 *)(p)) & 0x00400000)
934 #define HCI_LINK_KEY_NOTIFICATION_EV(p)     (*((UINT32 *)(p)) & 0x00800000)
935 #define HCI_LOOPBACK_COMMAND_EV(p)          (*((UINT32 *)(p)) & 0x01000000)
936 #define HCI_DATA_BUF_OVERFLOW_EV(p)         (*((UINT32 *)(p)) & 0x02000000)
937 #define HCI_MAX_SLOTS_CHANGE_EV(p)          (*((UINT32 *)(p)) & 0x04000000)
938 #define HCI_READ_CLOCK_OFFSET_COMP_EV(p)    (*((UINT32 *)(p)) & 0x08000000)
939 #define HCI_CONN_PKT_TYPE_CHANGED_EV(p)     (*((UINT32 *)(p)) & 0x10000000)
940 #define HCI_QOS_VIOLATION_EV(p)             (*((UINT32 *)(p)) & 0x20000000)
941 #define HCI_PAGE_SCAN_MODE_CHANGED_EV(p)    (*((UINT32 *)(p)) & 0x40000000)
942 #define HCI_PAGE_SCAN_REP_MODE_CHNG_EV(p)   (*((UINT32 *)(p)) & 0x80000000)
943 
944 /* the default event mask for 2.1+EDR (Lisbon) does not include Lisbon events */
945 #define HCI_DEFAULT_EVENT_MASK_0            0xFFFFFFFF
946 #define HCI_DEFAULT_EVENT_MASK_1            0x00001FFF
947 
948 /* the event mask for 2.0 + EDR and later (includes Lisbon events) */
949 #define HCI_LISBON_EVENT_MASK_0             0xFFFFFFFF
950 #define HCI_LISBON_EVENT_MASK_1             0x1DBFFFFF
951 #define HCI_LISBON_EVENT_MASK               "\x0D\xBF\xFF\xFF\xFF\xFF\xFF\xFF"
952 #define HCI_LISBON_EVENT_MASK_EXT           "\x1D\xBF\xFF\xFF\xFF\xFF\xFF\xFF"
953 #define HCI_DUMO_EVENT_MASK_EXT             "\x3D\xBF\xFF\xFF\xFF\xFF\xFF\xFF"
954 /*  0x00001FFF FFFFFFFF Default - no Lisbon events
955     0x00000800 00000000 Synchronous Connection Complete Event
956     0x00001000 00000000 Synchronous Connection Changed Event
957     0x00002000 00000000 Sniff Subrate Event
958     0x00004000 00000000 Extended Inquiry Result Event
959     0x00008000 00000000 Encryption Key Refresh Complete Event
960     0x00010000 00000000 IO Capability Request Event
961     0x00020000 00000000 IO Capability Response Event
962     0x00040000 00000000 User Confirmation Request Event
963     0x00080000 00000000 User Passkey Request Event
964     0x00100000 00000000 Remote OOB Data Request Event
965     0x00200000 00000000 Simple Pairing Complete Event
966     0x00400000 00000000 Generic AMP Link Key Notification Event
967     0x00800000 00000000 Link Supervision Timeout Changed Event
968     0x01000000 00000000 Enhanced Flush Complete Event
969     0x04000000 00000000 User Passkey Notification Event
970     0x08000000 00000000 Keypress Notification Event
971     0x10000000 00000000 Remote Host Supported Features Notification Event
972     0x20000000 00000000 LE Meta Event
973  */
974 
975 #define HCI_LE_ONLY_EVENT_MASK              "\x20\x00\x80\x00\x02\x00\x88\x90"
976 /*  0x00000000 00000010 Disconnection complete event
977     0x00000000 00000080 Encryption change event
978     0x00000000 00000800 Read remote version information complete event
979     0x00000000 00008000 Hardware error event
980     0x00000000 02000000 Data buffer overflow event
981     0x00008000 00000000 Encryption key refresh complete event
982     0x20000000 00000000 LE Meta Event
983 */
984 
985 /* the event mask for AMP controllers */
986 #define HCI_AMP_EVENT_MASK_3_0               "\x00\x00\x00\x00\x00\x00\x3F\xFF"
987 
988 /*  0x0000000000000000 No events specified (default)
989     0x0000000000000001 Physical Link Complete Event
990     0x0000000000000002 Channel Selected Event
991     0x0000000000000004 Disconnection Physical Link Event
992     0x0000000000000008 Physical Link Loss Early Warning Event
993     0x0000000000000010 Physical Link Recovery Event
994     0x0000000000000020 Logical Link Complete Event
995     0x0000000000000040 Disconnection Logical Link Complete Event
996     0x0000000000000080 Flow Spec Modify Complete Event
997     0x0000000000000100 Number of Completed Data Blocks Event
998     0x0000000000000200 AMP Start Test Event
999     0x0000000000000400 AMP Test End Event
1000     0x0000000000000800 AMP Receiver Report Event
1001     0x0000000000001000 Short Range Mode Change Complete Event
1002     0x0000000000002000 AMP Status Change Event
1003 */
1004 
1005 /* the event mask page 2 (CLB + CSA4) for BR/EDR controller */
1006 #define HCI_PAGE_2_EVENT_MASK                  "\x00\x00\x00\x00\x00\x7F\xC0\x00"
1007 /*  0x0000000000004000 Triggered Clock Capture Event
1008     0x0000000000008000 Sync Train Complete Event
1009     0x0000000000010000 Sync Train Received Event
1010     0x0000000000020000 Connectionless Broadcast Receive Event
1011     0x0000000000040000 Connectionless Broadcast Timeout Event
1012     0x0000000000080000 Truncated Page Complete Event
1013     0x0000000000100000 Salve Page Response Timeout Event
1014     0x0000000000200000 Connectionless Broadcast Channel Map Change Event
1015     0x0000000000400000 Inquiry Response Notification Event
1016 */
1017 #if BLE_PRIVACY_SPT == TRUE
1018 /* BLE event mask */
1019 #define HCI_BLE_EVENT_MASK_DEF               "\x00\x00\x00\x00\x00\x00\x07\xff"
1020 #else
1021 #define HCI_BLE_EVENT_MASK_DEF              "\x00\x00\x00\x00\x00\x00\x00\x7f"
1022 #endif
1023 /*
1024 ** Definitions for packet type masks (BT1.2 and BT2.0 definitions)
1025 */
1026 #define HCI_PKT_TYPES_MASK_NO_2_DH1         0x0002
1027 #define HCI_PKT_TYPES_MASK_NO_3_DH1         0x0004
1028 #define HCI_PKT_TYPES_MASK_DM1              0x0008
1029 #define HCI_PKT_TYPES_MASK_DH1              0x0010
1030 #define HCI_PKT_TYPES_MASK_HV1              0x0020
1031 #define HCI_PKT_TYPES_MASK_HV2              0x0040
1032 #define HCI_PKT_TYPES_MASK_HV3              0x0080
1033 #define HCI_PKT_TYPES_MASK_NO_2_DH3         0x0100
1034 #define HCI_PKT_TYPES_MASK_NO_3_DH3         0x0200
1035 #define HCI_PKT_TYPES_MASK_DM3              0x0400
1036 #define HCI_PKT_TYPES_MASK_DH3              0x0800
1037 #define HCI_PKT_TYPES_MASK_NO_2_DH5         0x1000
1038 #define HCI_PKT_TYPES_MASK_NO_3_DH5         0x2000
1039 #define HCI_PKT_TYPES_MASK_DM5              0x4000
1040 #define HCI_PKT_TYPES_MASK_DH5              0x8000
1041 
1042 /* Packet type should be one of valid but at least one should be specified */
1043 #define HCI_VALID_SCO_PKT_TYPE(t) (((((t) & ~(HCI_PKT_TYPES_MASK_HV1       \
1044                                            |  HCI_PKT_TYPES_MASK_HV2       \
1045                                            |  HCI_PKT_TYPES_MASK_HV3)) == 0)) \
1046                                     && ((t) != 0))
1047 
1048 
1049 
1050 
1051 
1052 /* Packet type should not be invalid and at least one should be specified */
1053 #define HCI_VALID_ACL_PKT_TYPE(t) (((((t) & ~(HCI_PKT_TYPES_MASK_DM1        \
1054                                            |  HCI_PKT_TYPES_MASK_DH1        \
1055                                            |  HCI_PKT_TYPES_MASK_DM3        \
1056                                            |  HCI_PKT_TYPES_MASK_DH3        \
1057                                            |  HCI_PKT_TYPES_MASK_DM5        \
1058                                            |  HCI_PKT_TYPES_MASK_DH5        \
1059                                            |  HCI_PKT_TYPES_MASK_NO_2_DH1   \
1060                                            |  HCI_PKT_TYPES_MASK_NO_3_DH1   \
1061                                            |  HCI_PKT_TYPES_MASK_NO_2_DH3   \
1062                                            |  HCI_PKT_TYPES_MASK_NO_3_DH3   \
1063                                            |  HCI_PKT_TYPES_MASK_NO_2_DH5   \
1064                                            |  HCI_PKT_TYPES_MASK_NO_3_DH5  )) == 0)) \
1065                                     && (((t) &  (HCI_PKT_TYPES_MASK_DM1        \
1066                                               |  HCI_PKT_TYPES_MASK_DH1        \
1067                                               |  HCI_PKT_TYPES_MASK_DM3        \
1068                                               |  HCI_PKT_TYPES_MASK_DH3        \
1069                                               |  HCI_PKT_TYPES_MASK_DM5        \
1070                                               |  HCI_PKT_TYPES_MASK_DH5)) != 0))
1071 
1072 /*
1073 ** Definitions for eSCO packet type masks (BT1.2 and BT2.0 definitions)
1074 */
1075 #define HCI_ESCO_PKT_TYPES_MASK_HV1         0x0001
1076 #define HCI_ESCO_PKT_TYPES_MASK_HV2         0x0002
1077 #define HCI_ESCO_PKT_TYPES_MASK_HV3         0x0004
1078 #define HCI_ESCO_PKT_TYPES_MASK_EV3         0x0008
1079 #define HCI_ESCO_PKT_TYPES_MASK_EV4         0x0010
1080 #define HCI_ESCO_PKT_TYPES_MASK_EV5         0x0020
1081 #define HCI_ESCO_PKT_TYPES_MASK_NO_2_EV3    0x0040
1082 #define HCI_ESCO_PKT_TYPES_MASK_NO_3_EV3    0x0080
1083 #define HCI_ESCO_PKT_TYPES_MASK_NO_2_EV5    0x0100
1084 #define HCI_ESCO_PKT_TYPES_MASK_NO_3_EV5    0x0200
1085 
1086 /* Packet type should be one of valid but at least one should be specified for 1.2 */
1087 #define HCI_VALID_ESCO_PKT_TYPE(t) (((((t) & ~(HCI_ESCO_PKT_TYPES_MASK_EV3       \
1088                                            |   HCI_ESCO_PKT_TYPES_MASK_EV4       \
1089                                            |   HCI_ESCO_PKT_TYPES_MASK_EV5)) == 0)) \
1090                                     && ((t) != 0))/* Packet type should be one of valid but at least one should be specified */
1091 
1092 #define HCI_VALID_ESCO_SCOPKT_TYPE(t) (((((t) & ~(HCI_ESCO_PKT_TYPES_MASK_HV1       \
1093                                            |      HCI_ESCO_PKT_TYPES_MASK_HV2       \
1094                                            |      HCI_ESCO_PKT_TYPES_MASK_HV3)) == 0)) \
1095                                     && ((t) != 0))
1096 
1097 #define HCI_VALID_SCO_ALL_PKT_TYPE(t) (((((t) & ~(HCI_ESCO_PKT_TYPES_MASK_HV1       \
1098                                            |      HCI_ESCO_PKT_TYPES_MASK_HV2       \
1099                                            |      HCI_ESCO_PKT_TYPES_MASK_HV3       \
1100                                            |      HCI_ESCO_PKT_TYPES_MASK_EV3       \
1101                                            |      HCI_ESCO_PKT_TYPES_MASK_EV4       \
1102                                            |      HCI_ESCO_PKT_TYPES_MASK_EV5)) == 0)) \
1103                                     && ((t) != 0))
1104 
1105 /*
1106 ** Define parameters to allow role switch during create connection
1107 */
1108 #define HCI_CR_CONN_NOT_ALLOW_SWITCH    0x00
1109 #define HCI_CR_CONN_ALLOW_SWITCH        0x01
1110 
1111 /*
1112 ** Hold Mode command destination
1113 */
1114 #define HOLD_MODE_DEST_LOCAL_DEVICE     0x00
1115 #define HOLD_MODE_DEST_RMT_DEVICE       0x01
1116 
1117 /*
1118 **  Definitions for different HCI parameters
1119 */
1120 #define HCI_PER_INQ_MIN_MAX_PERIOD      0x0003
1121 #define HCI_PER_INQ_MAX_MAX_PERIOD      0xFFFF
1122 #define HCI_PER_INQ_MIN_MIN_PERIOD      0x0002
1123 #define HCI_PER_INQ_MAX_MIN_PERIOD      0xFFFE
1124 
1125 #define HCI_MAX_INQUIRY_LENGTH          0x30
1126 
1127 #define HCI_MIN_INQ_LAP                 0x9E8B00
1128 #define HCI_MAX_INQ_LAP                 0x9E8B3F
1129 
1130 /* HCI role defenitions */
1131 #define HCI_ROLE_MASTER                 0x00
1132 #define HCI_ROLE_SLAVE                  0x01
1133 #define HCI_ROLE_UNKNOWN                0xff
1134 
1135 /* HCI mode defenitions */
1136 #define HCI_MODE_ACTIVE                 0x00
1137 #define HCI_MODE_HOLD                   0x01
1138 #define HCI_MODE_SNIFF                  0x02
1139 #define HCI_MODE_PARK                   0x03
1140 
1141 /* HCI Flow Control Mode defenitions */
1142 #define HCI_PACKET_BASED_FC_MODE        0x00
1143 #define HCI_BLOCK_BASED_FC_MODE         0x01
1144 
1145 /* Define Packet types as requested by the Host */
1146 #define HCI_ACL_PKT_TYPE_NONE           0x0000
1147 #define HCI_ACL_PKT_TYPE_DM1            0x0008
1148 #define HCI_ACL_PKT_TYPE_DH1            0x0010
1149 #define HCI_ACL_PKT_TYPE_AUX1           0x0200
1150 #define HCI_ACL_PKT_TYPE_DM3            0x0400
1151 #define HCI_ACL_PKT_TYPE_DH3            0x0800
1152 #define HCI_ACL_PKT_TYPE_DM5            0x4000
1153 #define HCI_ACL_PKT_TYPE_DH5            0x8000
1154 
1155 /* Define key type in the Master Link Key command */
1156 #define HCI_USE_SEMI_PERMANENT_KEY      0x00
1157 #define HCI_USE_TEMPORARY_KEY           0x01
1158 
1159 /* Page scan period modes */
1160 #define HCI_PAGE_SCAN_REP_MODE_R0       0x00
1161 #define HCI_PAGE_SCAN_REP_MODE_R1       0x01
1162 #define HCI_PAGE_SCAN_REP_MODE_R2       0x02
1163 
1164 /* Define limits for page scan repetition modes */
1165 #define HCI_PAGE_SCAN_R1_LIMIT          0x0800
1166 #define HCI_PAGE_SCAN_R2_LIMIT          0x1000
1167 
1168 /* Page scan period modes */
1169 #define HCI_PAGE_SCAN_PER_MODE_P0       0x00
1170 #define HCI_PAGE_SCAN_PER_MODE_P1       0x01
1171 #define HCI_PAGE_SCAN_PER_MODE_P2       0x02
1172 
1173 /* Page scan modes */
1174 #define HCI_MANDATARY_PAGE_SCAN_MODE    0x00
1175 #define HCI_OPTIONAL_PAGE_SCAN_MODE1    0x01
1176 #define HCI_OPTIONAL_PAGE_SCAN_MODE2    0x02
1177 #define HCI_OPTIONAL_PAGE_SCAN_MODE3    0x03
1178 
1179 /* Page and inquiry scan types */
1180 #define HCI_SCAN_TYPE_STANDARD          0x00
1181 #define HCI_SCAN_TYPE_INTERLACED        0x01       /* 1.2 devices or later */
1182 #define HCI_DEF_SCAN_TYPE               HCI_SCAN_TYPE_STANDARD
1183 
1184 /* Definitions for quality of service service types */
1185 #define HCI_SERVICE_NO_TRAFFIC          0x00
1186 #define HCI_SERVICE_BEST_EFFORT         0x01
1187 #define HCI_SERVICE_GUARANTEED          0x02
1188 
1189 #define HCI_QOS_LATENCY_DO_NOT_CARE     0xFFFFFFFF
1190 #define HCI_QOS_DELAY_DO_NOT_CARE       0xFFFFFFFF
1191 
1192 /* Definitions for Flow Specification */
1193 #define HCI_FLOW_SPEC_LATENCY_DO_NOT_CARE 0xFFFFFFFF
1194 
1195 /* Definitions for AFH Channel Map */
1196 #define HCI_AFH_CHANNEL_MAP_LEN         10
1197 
1198 /* Definitions for Extended Inquiry Response */
1199 #define HCI_EXT_INQ_RESPONSE_LEN        240
1200 #define HCI_EIR_FLAGS_TYPE                   BT_EIR_FLAGS_TYPE
1201 #define HCI_EIR_MORE_16BITS_UUID_TYPE        BT_EIR_MORE_16BITS_UUID_TYPE
1202 #define HCI_EIR_COMPLETE_16BITS_UUID_TYPE    BT_EIR_COMPLETE_16BITS_UUID_TYPE
1203 #define HCI_EIR_MORE_32BITS_UUID_TYPE        BT_EIR_MORE_32BITS_UUID_TYPE
1204 #define HCI_EIR_COMPLETE_32BITS_UUID_TYPE    BT_EIR_COMPLETE_32BITS_UUID_TYPE
1205 #define HCI_EIR_MORE_128BITS_UUID_TYPE       BT_EIR_MORE_128BITS_UUID_TYPE
1206 #define HCI_EIR_COMPLETE_128BITS_UUID_TYPE   BT_EIR_COMPLETE_128BITS_UUID_TYPE
1207 #define HCI_EIR_SHORTENED_LOCAL_NAME_TYPE    BT_EIR_SHORTENED_LOCAL_NAME_TYPE
1208 #define HCI_EIR_COMPLETE_LOCAL_NAME_TYPE     BT_EIR_COMPLETE_LOCAL_NAME_TYPE
1209 #define HCI_EIR_TX_POWER_LEVEL_TYPE          BT_EIR_TX_POWER_LEVEL_TYPE
1210 #define HCI_EIR_URL_TYPE                     BT_EIR_URL_TYPE
1211 #define HCI_EIR_MANUFACTURER_SPECIFIC_TYPE   BT_EIR_MANUFACTURER_SPECIFIC_TYPE
1212 #define HCI_EIR_OOB_BD_ADDR_TYPE             BT_EIR_OOB_BD_ADDR_TYPE
1213 #define HCI_EIR_OOB_COD_TYPE                 BT_EIR_OOB_COD_TYPE
1214 #define HCI_EIR_OOB_SSP_HASH_C_TYPE          BT_EIR_OOB_SSP_HASH_C_TYPE
1215 #define HCI_EIR_OOB_SSP_RAND_R_TYPE          BT_EIR_OOB_SSP_RAND_R_TYPE
1216 
1217 /* Definitions for Write Simple Pairing Mode */
1218 #define HCI_SP_MODE_UNDEFINED           0x00
1219 #define HCI_SP_MODE_ENABLED             0x01
1220 
1221 /* Definitions for Write Simple Pairing Debug Mode */
1222 #define HCI_SPD_MODE_DISABLED           0x00
1223 #define HCI_SPD_MODE_ENABLED            0x01
1224 
1225 /* Definitions for Write Secure Connections Host Support */
1226 #define HCI_SC_MODE_DISABLED            0x00
1227 #define HCI_SC_MODE_ENABLED             0x01
1228 
1229 /* Definitions for IO Capability Response/Command */
1230 #define HCI_IO_CAP_DISPLAY_ONLY         0x00
1231 #define HCI_IO_CAP_DISPLAY_YESNO        0x01
1232 #define HCI_IO_CAP_KEYBOARD_ONLY        0x02
1233 #define HCI_IO_CAP_NO_IO                0x03
1234 
1235 #define HCI_OOB_AUTH_DATA_NOT_PRESENT   0x00
1236 #define HCI_OOB_REM_AUTH_DATA_PRESENT   0x01
1237 
1238 #define HCI_MITM_PROTECT_NOT_REQUIRED  0x00
1239 #define HCI_MITM_PROTECT_REQUIRED      0x01
1240 
1241 
1242 /* Policy settings status */
1243 #define HCI_DISABLE_ALL_LM_MODES        0x0000
1244 #define HCI_ENABLE_MASTER_SLAVE_SWITCH  0x0001
1245 #define HCI_ENABLE_HOLD_MODE            0x0002
1246 #define HCI_ENABLE_SNIFF_MODE           0x0004
1247 #define HCI_ENABLE_PARK_MODE            0x0008
1248 
1249 /* By default allow switch, because host can not allow that */
1250 /* that until he created the connection */
1251 #define HCI_DEFAULT_POLICY_SETTINGS     HCI_DISABLE_ALL_LM_MODES
1252 
1253 /* Filters that are sent in set filter command */
1254 #define HCI_FILTER_TYPE_CLEAR_ALL       0x00
1255 #define HCI_FILTER_INQUIRY_RESULT       0x01
1256 #define HCI_FILTER_CONNECTION_SETUP     0x02
1257 
1258 #define HCI_FILTER_COND_NEW_DEVICE      0x00
1259 #define HCI_FILTER_COND_DEVICE_CLASS    0x01
1260 #define HCI_FILTER_COND_BD_ADDR         0x02
1261 
1262 #define HCI_DO_NOT_AUTO_ACCEPT_CONNECT  1
1263 #define HCI_DO_AUTO_ACCEPT_CONNECT      2   /* role switch disabled */
1264 #define HCI_DO_AUTO_ACCEPT_CONNECT_RS   3   /* role switch enabled (1.1 errata 1115) */
1265 
1266 /* Auto accept flags */
1267 #define HCI_AUTO_ACCEPT_OFF             0x00
1268 #define HCI_AUTO_ACCEPT_ACL_CONNECTIONS 0x01
1269 #define HCI_AUTO_ACCEPT_SCO_CONNECTIONS 0x02
1270 
1271 /* PIN type */
1272 #define HCI_PIN_TYPE_VARIABLE           0
1273 #define HCI_PIN_TYPE_FIXED              1
1274 
1275 /* Loopback Modes */
1276 #define HCI_LOOPBACK_MODE_DISABLED      0
1277 #define HCI_LOOPBACK_MODE_LOCAL         1
1278 #define HCI_LOOPBACK_MODE_REMOTE        2
1279 
1280 #define SLOTS_PER_10MS                  16      /* 0.625 ms slots in a 10 ms tick */
1281 
1282 /* Maximum connection accept timeout in 0.625msec */
1283 #define HCI_MAX_CONN_ACCEPT_TOUT        0xB540  /* 29 sec */
1284 #define HCI_DEF_CONN_ACCEPT_TOUT        0x1F40  /* 5 sec */
1285 
1286 /* Page timeout is used in LC only and LC is counting down slots not using OS */
1287 #define HCI_DEFAULT_PAGE_TOUT           0x2000  /* 5.12 sec (in slots) */
1288 
1289 /* Scan enable flags */
1290 #define HCI_NO_SCAN_ENABLED             0x00
1291 #define HCI_INQUIRY_SCAN_ENABLED        0x01
1292 #define HCI_PAGE_SCAN_ENABLED           0x02
1293 
1294 /* Pagescan timer definitions in 0.625 ms */
1295 #define HCI_MIN_PAGESCAN_INTERVAL       0x12    /* 11.25 ms */
1296 #define HCI_MAX_PAGESCAN_INTERVAL       0x1000  /* 2.56 sec */
1297 #define HCI_DEF_PAGESCAN_INTERVAL       0x0800  /* 1.28 sec */
1298 
1299 /* Parameter for pagescan window is passed to LC and is kept in slots */
1300 #define HCI_MIN_PAGESCAN_WINDOW         0x11    /* 10.625 ms */
1301 #define HCI_MAX_PAGESCAN_WINDOW         0x1000  /* 2.56  sec */
1302 #define HCI_DEF_PAGESCAN_WINDOW         0x12    /* 11.25 ms  */
1303 
1304 /* Inquiryscan timer definitions in 0.625 ms */
1305 #define HCI_MIN_INQUIRYSCAN_INTERVAL    0x12    /* 11.25 ms */
1306 #define HCI_MAX_INQUIRYSCAN_INTERVAL    0x1000  /* 2.56 sec */
1307 #define HCI_DEF_INQUIRYSCAN_INTERVAL    0x1000  /* 2.56 sec */
1308 
1309 /* Parameter for inquiryscan window is passed to LC and is kept in slots */
1310 #define HCI_MIN_INQUIRYSCAN_WINDOW      0x11    /* 10.625 ms */
1311 #define HCI_MAX_INQUIRYSCAN_WINDOW      0x1000  /* 2.56 sec */
1312 #define HCI_DEF_INQUIRYSCAN_WINDOW      0x12    /* 11.25 ms */
1313 
1314 /* Encryption modes */
1315 #define HCI_ENCRYPT_MODE_DISABLED       0x00
1316 #define HCI_ENCRYPT_MODE_POINT_TO_POINT 0x01
1317 #define HCI_ENCRYPT_MODE_ALL            0x02
1318 
1319 /* Voice settings */
1320 #define HCI_INP_CODING_LINEAR           0x0000 /* 0000000000 */
1321 #define HCI_INP_CODING_U_LAW            0x0100 /* 0100000000 */
1322 #define HCI_INP_CODING_A_LAW            0x0200 /* 1000000000 */
1323 #define HCI_INP_CODING_MASK             0x0300 /* 1100000000 */
1324 
1325 #define HCI_INP_DATA_FMT_1S_COMPLEMENT  0x0000 /* 0000000000 */
1326 #define HCI_INP_DATA_FMT_2S_COMPLEMENT  0x0040 /* 0001000000 */
1327 #define HCI_INP_DATA_FMT_SIGN_MAGNITUDE 0x0080 /* 0010000000 */
1328 #define HCI_INP_DATA_FMT_UNSIGNED       0x00c0 /* 0011000000 */
1329 #define HCI_INP_DATA_FMT_MASK           0x00c0 /* 0011000000 */
1330 
1331 #define HCI_INP_SAMPLE_SIZE_8BIT        0x0000 /* 0000000000 */
1332 #define HCI_INP_SAMPLE_SIZE_16BIT       0x0020 /* 0000100000 */
1333 #define HCI_INP_SAMPLE_SIZE_MASK        0x0020 /* 0000100000 */
1334 
1335 #define HCI_INP_LINEAR_PCM_BIT_POS_MASK 0x001c /* 0000011100 */
1336 #define HCI_INP_LINEAR_PCM_BIT_POS_OFFS 2
1337 
1338 #define HCI_AIR_CODING_FORMAT_CVSD      0x0000 /* 0000000000 */
1339 #define HCI_AIR_CODING_FORMAT_U_LAW     0x0001 /* 0000000001 */
1340 #define HCI_AIR_CODING_FORMAT_A_LAW     0x0002 /* 0000000010 */
1341 #define HCI_AIR_CODING_FORMAT_TRANSPNT  0x0003 /* 0000000011 */
1342 #define HCI_AIR_CODING_FORMAT_MASK      0x0003 /* 0000000011 */
1343 
1344 /* default                                        0001100000 */
1345 #define HCI_DEFAULT_VOICE_SETTINGS    (HCI_INP_CODING_LINEAR \
1346                                      | HCI_INP_DATA_FMT_2S_COMPLEMENT \
1347                                      | HCI_INP_SAMPLE_SIZE_16BIT \
1348                                      | HCI_AIR_CODING_FORMAT_CVSD)
1349 
1350 #define HCI_CVSD_SUPPORTED(x)       (((x) & HCI_AIR_CODING_FORMAT_MASK) == HCI_AIR_CODING_FORMAT_CVSD)
1351 #define HCI_U_LAW_SUPPORTED(x)      (((x) & HCI_AIR_CODING_FORMAT_MASK) == HCI_AIR_CODING_FORMAT_U_LAW)
1352 #define HCI_A_LAW_SUPPORTED(x)      (((x) & HCI_AIR_CODING_FORMAT_MASK) == HCI_AIR_CODING_FORMAT_A_LAW)
1353 #define HCI_TRANSPNT_SUPPORTED(x)   (((x) & HCI_AIR_CODING_FORMAT_MASK) == HCI_AIR_CODING_FORMAT_TRANSPNT)
1354 
1355 /* Retransmit timer definitions in 0.625 */
1356 #define HCI_MAX_AUTO_FLUSH_TOUT         0x07FF
1357 #define HCI_DEFAULT_AUTO_FLUSH_TOUT     0       /* No auto flush */
1358 
1359 /* Broadcast retransmitions */
1360 #define HCI_DEFAULT_NUM_BCAST_RETRAN    1
1361 
1362 /* Define broadcast data types as passed in the hci data packet */
1363 #define HCI_DATA_POINT_TO_POINT         0x00
1364 #define HCI_DATA_ACTIVE_BCAST           0x01
1365 #define HCI_DATA_PICONET_BCAST          0x02
1366 
1367 /* Hold mode activity */
1368 #define HCI_MAINTAIN_CUR_POWER_STATE    0x00
1369 #define HCI_SUSPEND_PAGE_SCAN           0x01
1370 #define HCI_SUSPEND_INQUIRY_SCAN        0x02
1371 #define HCI_SUSPEND_PERIODIC_INQUIRIES  0x04
1372 
1373 /* Default Link Supervision timeoout */
1374 #define HCI_DEFAULT_INACT_TOUT          0x7D00  /* BR/EDR (20 seconds) */
1375 #define HCI_DEFAULT_AMP_INACT_TOUT      0x3E80  /* AMP    (10 seconds) */
1376 
1377 /* Read transmit power level parameter */
1378 #define HCI_READ_CURRENT                0x00
1379 #define HCI_READ_MAXIMUM                0x01
1380 
1381 /* Link types for connection complete event */
1382 #define HCI_LINK_TYPE_SCO               0x00
1383 #define HCI_LINK_TYPE_ACL               0x01
1384 #define HCI_LINK_TYPE_ESCO              0x02
1385 
1386 /* Link Key Notification Event (Key Type) definitions */
1387 #define HCI_LKEY_TYPE_COMBINATION       0x00
1388 #define HCI_LKEY_TYPE_LOCAL_UNIT        0x01
1389 #define HCI_LKEY_TYPE_REMOTE_UNIT       0x02
1390 #define HCI_LKEY_TYPE_DEBUG_COMB        0x03
1391 #define HCI_LKEY_TYPE_UNAUTH_COMB       0x04
1392 #define HCI_LKEY_TYPE_AUTH_COMB         0x05
1393 #define HCI_LKEY_TYPE_CHANGED_COMB      0x06
1394 #define HCI_LKEY_TYPE_UNAUTH_COMB_P_256 0x07
1395 #define HCI_LKEY_TYPE_AUTH_COMB_P_256   0x08
1396 
1397 /* Internal definitions - not used over HCI */
1398 #define HCI_LKEY_TYPE_AMP_WIFI          0x80
1399 #define HCI_LKEY_TYPE_AMP_UWB           0x81
1400 #define HCI_LKEY_TYPE_UNKNOWN           0xff
1401 
1402 /* Read Local Version HCI Version return values (Command Complete Event) */
1403 #define HCI_VERSION_1_0B                0x00
1404 #define HCI_VERSION_1_1                 0x01
1405 
1406 /* Define an invalid value for a handle */
1407 #define HCI_INVALID_HANDLE              0xFFFF
1408 
1409 /* Define max ammount of data in the HCI command */
1410 #define HCI_COMMAND_SIZE        255
1411 
1412 /* Define the preamble length for all HCI Commands.
1413 ** This is 2-bytes for opcode and 1 byte for length
1414 */
1415 #define HCIC_PREAMBLE_SIZE      3
1416 
1417 /* Define the preamble length for all HCI Events
1418 ** This is 1-byte for opcode and 1 byte for length
1419 */
1420 #define HCIE_PREAMBLE_SIZE      2
1421 #define HCI_SCO_PREAMBLE_SIZE   3
1422 #define HCI_DATA_PREAMBLE_SIZE  4
1423 
1424 /* local Bluetooth controller id for AMP HCI */
1425 #define LOCAL_BR_EDR_CONTROLLER_ID      0
1426 
1427 /* controller id types for AMP HCI */
1428 #define HCI_CONTROLLER_TYPE_BR_EDR      0
1429 #define HCI_CONTROLLER_TYPE_802_11      1
1430 #define HCI_CONTROLLER_TYPE_ECMA        2
1431 #define HCI_MAX_CONTROLLER_TYPES        3
1432 
1433 /*  ConnectionLess Broadcast */
1434 #define HCI_CLB_DISABLE                 0x00
1435 #define HCI_CLB_ENABLE                  0x01
1436 
1437 /* ConnectionLess Broadcast Data fragment */
1438 #define HCI_CLB_FRAGMENT_CONT           0x00
1439 #define HCI_CLB_FRAGMENT_START          0x01
1440 #define HCI_CLB_FRAGMENT_END            0x02
1441 #define HCI_CLB_FRAGMENT_SINGLE         0x03
1442 
1443 /* AMP Controller Status codes
1444 */
1445 #define HCI_AMP_CTRLR_PHYSICALLY_DOWN   0
1446 #define HCI_AMP_CTRLR_USABLE_BY_BT      1
1447 #define HCI_AMP_CTRLR_UNUSABLE_FOR_BT   2
1448 #define HCI_AMP_CTRLR_LOW_CAP_FOR_BT    3
1449 #define HCI_AMP_CTRLR_MED_CAP_FOR_BT    4
1450 #define HCI_AMP_CTRLR_HIGH_CAP_FOR_BT   5
1451 #define HCI_AMP_CTRLR_FULL_CAP_FOR_BT   6
1452 
1453 #define HCI_MAX_AMP_STATUS_TYPES        7
1454 
1455 
1456 /* Define the extended flow specification fields used by AMP */
1457 typedef struct {
1458     UINT8       id;
1459     UINT8       stype;
1460     UINT16      max_sdu_size;
1461     UINT32      sdu_inter_time;
1462     UINT32      access_latency;
1463     UINT32      flush_timeout;
1464 } tHCI_EXT_FLOW_SPEC;
1465 
1466 
1467 /* HCI message type definitions (for H4 messages) */
1468 #define HCIT_TYPE_COMMAND   1
1469 #define HCIT_TYPE_ACL_DATA  2
1470 #define HCIT_TYPE_SCO_DATA  3
1471 #define HCIT_TYPE_EVENT     4
1472 #define HCIT_TYPE_LM_DIAG   7
1473 #define HCIT_TYPE_NFC       16
1474 
1475 #define HCIT_LM_DIAG_LENGTH 63
1476 
1477 /* Parameter information for HCI_BRCM_SET_ACL_PRIORITY */
1478 #define HCI_BRCM_ACL_PRIORITY_PARAM_SIZE    3
1479 #define HCI_BRCM_ACL_PRIORITY_LOW           0x00
1480 #define HCI_BRCM_ACL_PRIORITY_HIGH          0xFF
1481 #define HCI_BRCM_SET_ACL_PRIORITY           (0x0057 | HCI_GRP_VENDOR_SPECIFIC)
1482 
1483 /* Define values for LMP Test Control parameters
1484 ** Test Scenario, Hopping Mode, Power Control Mode
1485 */
1486 #define LMP_TESTCTL_TESTSC_PAUSE        0
1487 #define LMP_TESTCTL_TESTSC_TXTEST_0     1
1488 #define LMP_TESTCTL_TESTSC_TXTEST_1     2
1489 #define LMP_TESTCTL_TESTSC_TXTEST_1010  3
1490 #define LMP_TESTCTL_TESTSC_PSRND_BITSEQ 4
1491 #define LMP_TESTCTL_TESTSC_CLOSEDLB_ACL 5
1492 #define LMP_TESTCTL_TESTSC_CLOSEDLB_SCO 6
1493 #define LMP_TESTCTL_TESTSC_ACL_NOWHIT   7
1494 #define LMP_TESTCTL_TESTSC_SCO_NOWHIT   8
1495 #define LMP_TESTCTL_TESTSC_TXTEST_11110000  9
1496 #define LMP_TESTCTL_TESTSC_EXITTESTMODE 255
1497 
1498 #define LMP_TESTCTL_HOPMOD_RXTX1FREQ    0
1499 #define LMP_TESTCTL_HOPMOD_HOP_EURUSA   1
1500 #define LMP_TESTCTL_HOPMOD_HOP_JAPAN    2
1501 #define LMP_TESTCTL_HOPMOD_HOP_FRANCE   3
1502 #define LMP_TESTCTL_HOPMOD_HOP_SPAIN    4
1503 #define LMP_TESTCTL_HOPMOD_REDUCED_HOP  5
1504 
1505 #define LMP_TESTCTL_POWCTL_FIXEDTX_OP   0
1506 #define LMP_TESTCTL_POWCTL_ADAPTIVE     1
1507 
1508 // TODO(zachoverflow): remove this once broadcom specific hacks are removed
1509 #define LMP_COMPID_BROADCOM             15
1510 
1511 /*
1512 ** Define the packet types in the packet header, and a couple extra
1513 */
1514 #define PKT_TYPE_NULL   0x00
1515 #define PKT_TYPE_POLL   0x01
1516 #define PKT_TYPE_FHS    0x02
1517 #define PKT_TYPE_DM1    0x03
1518 
1519 #define PKT_TYPE_DH1    0x04
1520 #define PKT_TYPE_HV1    0x05
1521 #define PKT_TYPE_HV2    0x06
1522 #define PKT_TYPE_HV3    0x07
1523 #define PKT_TYPE_DV     0x08
1524 #define PKT_TYPE_AUX1   0x09
1525 
1526 #define PKT_TYPE_DM3    0x0a
1527 #define PKT_TYPE_DH3    0x0b
1528 
1529 #define PKT_TYPE_DM5    0x0e
1530 #define PKT_TYPE_DH5    0x0f
1531 
1532 
1533 #define PKT_TYPE_ID     0x10        /* Internally used packet types */
1534 #define PKT_TYPE_BAD    0x11
1535 #define PKT_TYPE_NONE   0x12
1536 
1537 /*
1538 ** Define packet size
1539 */
1540 #define HCI_DM1_PACKET_SIZE         17
1541 #define HCI_DH1_PACKET_SIZE         27
1542 #define HCI_DM3_PACKET_SIZE         121
1543 #define HCI_DH3_PACKET_SIZE         183
1544 #define HCI_DM5_PACKET_SIZE         224
1545 #define HCI_DH5_PACKET_SIZE         339
1546 #define HCI_AUX1_PACKET_SIZE        29
1547 #define HCI_HV1_PACKET_SIZE         10
1548 #define HCI_HV2_PACKET_SIZE         20
1549 #define HCI_HV3_PACKET_SIZE         30
1550 #define HCI_DV_PACKET_SIZE          9
1551 #define HCI_EDR2_DH1_PACKET_SIZE    54
1552 #define HCI_EDR2_DH3_PACKET_SIZE    367
1553 #define HCI_EDR2_DH5_PACKET_SIZE    679
1554 #define HCI_EDR3_DH1_PACKET_SIZE    83
1555 #define HCI_EDR3_DH3_PACKET_SIZE    552
1556 #define HCI_EDR3_DH5_PACKET_SIZE    1021
1557 
1558 /* Feature Pages */
1559 #define HCI_EXT_FEATURES_PAGE_0     0       /* Extended Feature Page 0 (regular features) */
1560 #define HCI_EXT_FEATURES_PAGE_1     1       /* Extended Feature Page 1 */
1561 #define HCI_EXT_FEATURES_PAGE_2     2       /* Extended Feature Page 2 */
1562 #define HCI_EXT_FEATURES_PAGE_MAX   HCI_EXT_FEATURES_PAGE_2
1563 
1564 #define HCI_FEATURE_BYTES_PER_PAGE      8
1565 
1566 #define HCI_FEATURES_KNOWN(x) ((x[0] | x[1] | x[2] | x[3] | x[4] | x[5] | x[6] | x[7]) != 0)
1567 
1568 /*
1569 **   LMP features encoding - page 0
1570 */
1571 #define HCI_FEATURE_3_SLOT_PACKETS_MASK 0x01
1572 #define HCI_FEATURE_3_SLOT_PACKETS_OFF  0
1573 #define HCI_3_SLOT_PACKETS_SUPPORTED(x) ((x)[HCI_FEATURE_3_SLOT_PACKETS_OFF] & HCI_FEATURE_3_SLOT_PACKETS_MASK)
1574 
1575 #define HCI_FEATURE_5_SLOT_PACKETS_MASK 0x02
1576 #define HCI_FEATURE_5_SLOT_PACKETS_OFF  0
1577 #define HCI_5_SLOT_PACKETS_SUPPORTED(x) ((x)[HCI_FEATURE_5_SLOT_PACKETS_OFF] & HCI_FEATURE_5_SLOT_PACKETS_MASK)
1578 
1579 #define HCI_FEATURE_ENCRYPTION_MASK     0x04
1580 #define HCI_FEATURE_ENCRYPTION_OFF      0
1581 #define HCI_ENCRYPTION_SUPPORTED(x)     ((x)[HCI_FEATURE_ENCRYPTION_OFF] & HCI_FEATURE_ENCRYPTION_MASK)
1582 
1583 #define HCI_FEATURE_SLOT_OFFSET_MASK    0x08
1584 #define HCI_FEATURE_SLOT_OFFSET_OFF     0
1585 #define HCI_SLOT_OFFSET_SUPPORTED(x)    ((x)[HCI_FEATURE_SLOT_OFFSET_OFF] & HCI_FEATURE_SLOT_OFFSET_MASK)
1586 
1587 #define HCI_FEATURE_TIMING_ACC_MASK     0x10
1588 #define HCI_FEATURE_TIMING_ACC_OFF      0
1589 #define HCI_TIMING_ACC_SUPPORTED(x)     ((x)[HCI_FEATURE_TIMING_ACC_OFF] & HCI_FEATURE_TIMING_ACC_MASK)
1590 
1591 #define HCI_FEATURE_SWITCH_MASK         0x20
1592 #define HCI_FEATURE_SWITCH_OFF          0
1593 #define HCI_SWITCH_SUPPORTED(x)         ((x)[HCI_FEATURE_SWITCH_OFF] & HCI_FEATURE_SWITCH_MASK)
1594 
1595 #define HCI_FEATURE_HOLD_MODE_MASK      0x40
1596 #define HCI_FEATURE_HOLD_MODE_OFF       0
1597 #define HCI_HOLD_MODE_SUPPORTED(x)      ((x)[HCI_FEATURE_HOLD_MODE_OFF] & HCI_FEATURE_HOLD_MODE_MASK)
1598 
1599 #define HCI_FEATURE_SNIFF_MODE_MASK     0x80
1600 #define HCI_FEATURE_SNIFF_MODE_OFF      0
1601 #define HCI_SNIFF_MODE_SUPPORTED(x)      ((x)[HCI_FEATURE_SNIFF_MODE_OFF] & HCI_FEATURE_SNIFF_MODE_MASK)
1602 
1603 #define HCI_FEATURE_PARK_MODE_MASK      0x01
1604 #define HCI_FEATURE_PARK_MODE_OFF       1
1605 #define HCI_PARK_MODE_SUPPORTED(x)      ((x)[HCI_FEATURE_PARK_MODE_OFF] & HCI_FEATURE_PARK_MODE_MASK)
1606 
1607 #define HCI_FEATURE_RSSI_MASK           0x02
1608 #define HCI_FEATURE_RSSI_OFF            1
1609 #define HCI_RSSI_SUPPORTED(x)           ((x)[HCI_FEATURE_RSSI_OFF] & HCI_FEATURE_RSSI_MASK)
1610 
1611 #define HCI_FEATURE_CQM_DATA_RATE_MASK  0x04
1612 #define HCI_FEATURE_CQM_DATA_RATE_OFF   1
1613 #define HCI_CQM_DATA_RATE_SUPPORTED(x)  ((x)[HCI_FEATURE_CQM_DATA_RATE_OFF] & HCI_FEATURE_CQM_DATA_RATE_MASK)
1614 
1615 #define HCI_FEATURE_SCO_LINK_MASK       0x08
1616 #define HCI_FEATURE_SCO_LINK_OFF        1
1617 #define HCI_SCO_LINK_SUPPORTED(x)       ((x)[HCI_FEATURE_SCO_LINK_OFF] & HCI_FEATURE_SCO_LINK_MASK)
1618 
1619 #define HCI_FEATURE_HV2_PACKETS_MASK    0x10
1620 #define HCI_FEATURE_HV2_PACKETS_OFF     1
1621 #define HCI_HV2_PACKETS_SUPPORTED(x)    ((x)[HCI_FEATURE_HV2_PACKETS_OFF] & HCI_FEATURE_HV2_PACKETS_MASK)
1622 
1623 #define HCI_FEATURE_HV3_PACKETS_MASK    0x20
1624 #define HCI_FEATURE_HV3_PACKETS_OFF     1
1625 #define HCI_HV3_PACKETS_SUPPORTED(x)    ((x)[HCI_FEATURE_HV3_PACKETS_OFF] & HCI_FEATURE_HV3_PACKETS_MASK)
1626 
1627 #define HCI_FEATURE_U_LAW_MASK          0x40
1628 #define HCI_FEATURE_U_LAW_OFF           1
1629 #define HCI_LMP_U_LAW_SUPPORTED(x)      ((x)[HCI_FEATURE_U_LAW_OFF] & HCI_FEATURE_U_LAW_MASK)
1630 
1631 #define HCI_FEATURE_A_LAW_MASK          0x80
1632 #define HCI_FEATURE_A_LAW_OFF           1
1633 #define HCI_LMP_A_LAW_SUPPORTED(x)      ((x)[HCI_FEATURE_A_LAW_OFF] & HCI_FEATURE_A_LAW_MASK)
1634 
1635 #define HCI_FEATURE_CVSD_MASK           0x01
1636 #define HCI_FEATURE_CVSD_OFF            2
1637 #define HCI_LMP_CVSD_SUPPORTED(x)       ((x)[HCI_FEATURE_CVSD_OFF] & HCI_FEATURE_CVSD_MASK)
1638 
1639 #define HCI_FEATURE_PAGING_SCHEME_MASK  0x02
1640 #define HCI_FEATURE_PAGING_SCHEME_OFF   2
1641 #define HCI_PAGING_SCHEME_SUPPORTED(x) ((x)[HCI_FEATURE_PAGING_SCHEME_OFF] & HCI_FEATURE_PAGING_SCHEME_MASK)
1642 
1643 #define HCI_FEATURE_POWER_CTRL_MASK     0x04
1644 #define HCI_FEATURE_POWER_CTRL_OFF      2
1645 #define HCI_POWER_CTRL_SUPPORTED(x)     ((x)[HCI_FEATURE_POWER_CTRL_OFF] & HCI_FEATURE_POWER_CTRL_MASK)
1646 
1647 #define HCI_FEATURE_TRANSPNT_MASK       0x08
1648 #define HCI_FEATURE_TRANSPNT_OFF        2
1649 #define HCI_LMP_TRANSPNT_SUPPORTED(x)   ((x)[HCI_FEATURE_TRANSPNT_OFF] & HCI_FEATURE_TRANSPNT_MASK)
1650 
1651 #define HCI_FEATURE_FLOW_CTRL_LAG_MASK  0x70
1652 #define HCI_FEATURE_FLOW_CTRL_LAG_OFF   2
1653 #define HCI_FLOW_CTRL_LAG_VALUE(x)      (((x)[HCI_FEATURE_FLOW_CTRL_LAG_OFF] & HCI_FEATURE_FLOW_CTRL_LAG_MASK) >> 4)
1654 
1655 #define HCI_FEATURE_BROADCAST_ENC_MASK  0x80
1656 #define HCI_FEATURE_BROADCAST_ENC_OFF   2
1657 #define HCI_LMP_BCAST_ENC_SUPPORTED(x)  ((x)[HCI_FEATURE_BROADCAST_ENC_OFF] & HCI_FEATURE_BROADCAST_ENC_MASK)
1658 
1659 #define HCI_FEATURE_SCATTER_MODE_MASK   0x01
1660 #define HCI_FEATURE_SCATTER_MODE_OFF    3
1661 #define HCI_LMP_SCATTER_MODE_SUPPORTED(x) ((x)[HCI_FEATURE_SCATTER_MODE_OFF] & HCI_FEATURE_SCATTER_MODE_MASK)
1662 
1663 #define HCI_FEATURE_EDR_ACL_2MPS_MASK   0x02
1664 #define HCI_FEATURE_EDR_ACL_2MPS_OFF    3
1665 #define HCI_EDR_ACL_2MPS_SUPPORTED(x)   ((x)[HCI_FEATURE_EDR_ACL_2MPS_OFF] & HCI_FEATURE_EDR_ACL_2MPS_MASK)
1666 
1667 #define HCI_FEATURE_EDR_ACL_3MPS_MASK   0x04
1668 #define HCI_FEATURE_EDR_ACL_3MPS_OFF    3
1669 #define HCI_EDR_ACL_3MPS_SUPPORTED(x)   ((x)[HCI_FEATURE_EDR_ACL_3MPS_OFF] & HCI_FEATURE_EDR_ACL_3MPS_MASK)
1670 
1671 #define HCI_FEATURE_ENHANCED_INQ_MASK   0x08
1672 #define HCI_FEATURE_ENHANCED_INQ_OFF    3
1673 #define HCI_ENHANCED_INQ_SUPPORTED(x)   ((x)[HCI_FEATURE_ENHANCED_INQ_OFF] & HCI_FEATURE_ENHANCED_INQ_MASK)
1674 
1675 #define HCI_FEATURE_INTERLACED_INQ_SCAN_MASK   0x10
1676 #define HCI_FEATURE_INTERLACED_INQ_SCAN_OFF    3
1677 #define HCI_LMP_INTERLACED_INQ_SCAN_SUPPORTED(x) ((x)[HCI_FEATURE_INTERLACED_INQ_SCAN_OFF] & HCI_FEATURE_INTERLACED_INQ_SCAN_MASK)
1678 
1679 #define HCI_FEATURE_INTERLACED_PAGE_SCAN_MASK  0x20
1680 #define HCI_FEATURE_INTERLACED_PAGE_SCAN_OFF   3
1681 #define HCI_LMP_INTERLACED_PAGE_SCAN_SUPPORTED(x) ((x)[HCI_FEATURE_INTERLACED_PAGE_SCAN_OFF] & HCI_FEATURE_INTERLACED_PAGE_SCAN_MASK)
1682 
1683 #define HCI_FEATURE_INQ_RSSI_MASK       0x40
1684 #define HCI_FEATURE_INQ_RSSI_OFF        3
1685 #define HCI_LMP_INQ_RSSI_SUPPORTED(x)   ((x)[HCI_FEATURE_INQ_RSSI_OFF] & HCI_FEATURE_INQ_RSSI_MASK)
1686 
1687 #define HCI_FEATURE_ESCO_EV3_MASK       0x80
1688 #define HCI_FEATURE_ESCO_EV3_OFF        3
1689 #define HCI_ESCO_EV3_SUPPORTED(x)       ((x)[HCI_FEATURE_ESCO_EV3_OFF] & HCI_FEATURE_ESCO_EV3_MASK)
1690 
1691 #define HCI_FEATURE_ESCO_EV4_MASK       0x01
1692 #define HCI_FEATURE_ESCO_EV4_OFF        4
1693 #define HCI_ESCO_EV4_SUPPORTED(x)       ((x)[HCI_FEATURE_ESCO_EV4_OFF] & HCI_FEATURE_ESCO_EV4_MASK)
1694 
1695 #define HCI_FEATURE_ESCO_EV5_MASK       0x02
1696 #define HCI_FEATURE_ESCO_EV5_OFF        4
1697 #define HCI_ESCO_EV5_SUPPORTED(x)       ((x)[HCI_FEATURE_ESCO_EV5_OFF] & HCI_FEATURE_ESCO_EV5_MASK)
1698 
1699 #define HCI_FEATURE_ABSENCE_MASKS_MASK  0x04
1700 #define HCI_FEATURE_ABSENCE_MASKS_OFF   4
1701 #define HCI_LMP_ABSENCE_MASKS_SUPPORTED(x) ((x)[HCI_FEATURE_ABSENCE_MASKS_OFF] & HCI_FEATURE_ABSENCE_MASKS_MASK)
1702 
1703 #define HCI_FEATURE_AFH_CAP_SLAVE_MASK  0x08
1704 #define HCI_FEATURE_AFH_CAP_SLAVE_OFF   4
1705 #define HCI_LMP_AFH_CAP_SLAVE_SUPPORTED(x) ((x)[HCI_FEATURE_AFH_CAP_SLAVE_OFF] & HCI_FEATURE_AFH_CAP_SLAVE_MASK)
1706 
1707 #define HCI_FEATURE_AFH_CLASS_SLAVE_MASK 0x10
1708 #define HCI_FEATURE_AFH_CLASS_SLAVE_OFF  4
1709 #define HCI_LMP_AFH_CLASS_SLAVE_SUPPORTED(x) ((x)[HCI_FEATURE_AFH_CLASS_SLAVE_OFF] & HCI_FEATURE_AFH_CLASS_SLAVE_MASK)
1710 
1711 #if 1
1712 #define HCI_FEATURE_BREDR_NOT_SPT_MASK     0x20
1713 #define HCI_FEATURE_BREDR_NOT_SPT_OFF      4
1714 #define HCI_BREDR_NOT_SPT_SUPPORTED(x) ((x)[HCI_FEATURE_BREDR_NOT_SPT_OFF] & HCI_FEATURE_BREDR_NOT_SPT_MASK)
1715 
1716 #define HCI_FEATURE_LE_SPT_MASK      0x40
1717 #define HCI_FEATURE_LE_SPT_OFF       4
1718 #define HCI_LE_SPT_SUPPORTED(x)  ((x)[HCI_FEATURE_LE_SPT_OFF] & HCI_FEATURE_LE_SPT_MASK)
1719 #else
1720 
1721 #define HCI_FEATURE_ALIAS_AUTH_MASK     0x20
1722 #define HCI_FEATURE_ALIAS_AUTH_OFF      4
1723 #define HCI_LMP_ALIAS_AUTH_SUPPORTED(x) ((x)[HCI_FEATURE_ALIAS_AUTH_OFF] & HCI_FEATURE_ALIAS_AUTH_MASK)
1724 
1725 #define HCI_FEATURE_ANON_MODE_MASK      0x40
1726 #define HCI_FEATURE_ANON_MODE_OFF       4
1727 #define HCI_LMP_ANON_MODE_SUPPORTED(x)  ((x)[HCI_FEATURE_ANON_MODE_OFF] & HCI_FEATURE_ANON_MODE_MASK)
1728 #endif
1729 
1730 #define HCI_FEATURE_3_SLOT_EDR_ACL_MASK 0x80
1731 #define HCI_FEATURE_3_SLOT_EDR_ACL_OFF  4
1732 #define HCI_3_SLOT_EDR_ACL_SUPPORTED(x) ((x)[HCI_FEATURE_3_SLOT_EDR_ACL_OFF] & HCI_FEATURE_3_SLOT_EDR_ACL_MASK)
1733 
1734 #define HCI_FEATURE_5_SLOT_EDR_ACL_MASK 0x01
1735 #define HCI_FEATURE_5_SLOT_EDR_ACL_OFF  5
1736 #define HCI_5_SLOT_EDR_ACL_SUPPORTED(x) ((x)[HCI_FEATURE_5_SLOT_EDR_ACL_OFF] & HCI_FEATURE_5_SLOT_EDR_ACL_MASK)
1737 
1738 #define HCI_FEATURE_SNIFF_SUB_RATE_MASK 0x02
1739 #define HCI_FEATURE_SNIFF_SUB_RATE_OFF  5
1740 #define HCI_SNIFF_SUB_RATE_SUPPORTED(x) ((x)[HCI_FEATURE_SNIFF_SUB_RATE_OFF] & HCI_FEATURE_SNIFF_SUB_RATE_MASK)
1741 
1742 #define HCI_FEATURE_ATOMIC_ENCRYPT_MASK 0x04
1743 #define HCI_FEATURE_ATOMIC_ENCRYPT_OFF  5
1744 #define HCI_ATOMIC_ENCRYPT_SUPPORTED(x) ((x)[HCI_FEATURE_ATOMIC_ENCRYPT_OFF] & HCI_FEATURE_ATOMIC_ENCRYPT_MASK)
1745 
1746 #define HCI_FEATURE_AFH_CAP_MASTR_MASK  0x08
1747 #define HCI_FEATURE_AFH_CAP_MASTR_OFF   5
1748 #define HCI_LMP_AFH_CAP_MASTR_SUPPORTED(x) ((x)[HCI_FEATURE_AFH_CAP_MASTR_OFF] & HCI_FEATURE_AFH_CAP_MASTR_MASK)
1749 
1750 #define HCI_FEATURE_AFH_CLASS_MASTR_MASK 0x10
1751 #define HCI_FEATURE_AFH_CLASS_MASTR_OFF  5
1752 #define HCI_LMP_AFH_CLASS_MASTR_SUPPORTED(x) ((x)[HCI_FEATURE_AFH_CLASS_MASTR_OFF] & HCI_FEATURE_AFH_CLASS_MASTR_MASK)
1753 
1754 #define HCI_FEATURE_EDR_ESCO_2MPS_MASK  0x20
1755 #define HCI_FEATURE_EDR_ESCO_2MPS_OFF   5
1756 #define HCI_EDR_ESCO_2MPS_SUPPORTED(x)  ((x)[HCI_FEATURE_EDR_ESCO_2MPS_OFF] & HCI_FEATURE_EDR_ESCO_2MPS_MASK)
1757 
1758 #define HCI_FEATURE_EDR_ESCO_3MPS_MASK  0x40
1759 #define HCI_FEATURE_EDR_ESCO_3MPS_OFF   5
1760 #define HCI_EDR_ESCO_3MPS_SUPPORTED(x)  ((x)[HCI_FEATURE_EDR_ESCO_3MPS_OFF] & HCI_FEATURE_EDR_ESCO_3MPS_MASK)
1761 
1762 #define HCI_FEATURE_3_SLOT_EDR_ESCO_MASK 0x80
1763 #define HCI_FEATURE_3_SLOT_EDR_ESCO_OFF  5
1764 #define HCI_3_SLOT_EDR_ESCO_SUPPORTED(x) ((x)[HCI_FEATURE_3_SLOT_EDR_ESCO_OFF] & HCI_FEATURE_3_SLOT_EDR_ESCO_MASK)
1765 
1766 #define HCI_FEATURE_EXT_INQ_RSP_MASK    0x01
1767 #define HCI_FEATURE_EXT_INQ_RSP_OFF     6
1768 #define HCI_EXT_INQ_RSP_SUPPORTED(x)    ((x)[HCI_FEATURE_EXT_INQ_RSP_OFF] & HCI_FEATURE_EXT_INQ_RSP_MASK)
1769 
1770 #if 1 /* TOKYO spec definition */
1771 #define HCI_FEATURE_SIMUL_LE_BREDR_MASK 0x02
1772 #define HCI_FEATURE_SIMUL_LE_BREDR_OFF  6
1773 #define HCI_SIMUL_LE_BREDR_SUPPORTED(x) ((x)[HCI_FEATURE_SIMUL_LE_BREDR_OFF] & HCI_FEATURE_SIMUL_LE_BREDR_MASK)
1774 
1775 #else
1776 #define HCI_FEATURE_ANUM_PIN_AWARE_MASK 0x02
1777 #define HCI_FEATURE_ANUM_PIN_AWARE_OFF  6
1778 #define HCI_ANUM_PIN_AWARE_SUPPORTED(x) ((x)[HCI_FEATURE_ANUM_PIN_AWARE_OFF] & HCI_FEATURE_ANUM_PIN_AWARE_MASK)
1779 #endif
1780 
1781 #define HCI_FEATURE_ANUM_PIN_CAP_MASK   0x04
1782 #define HCI_FEATURE_ANUM_PIN_CAP_OFF    6
1783 #define HCI_ANUM_PIN_CAP_SUPPORTED(x)   ((x)[HCI_FEATURE_ANUM_PIN_CAP_OFF] & HCI_FEATURE_ANUM_PIN_CAP_MASK)
1784 
1785 #define HCI_FEATURE_SIMPLE_PAIRING_MASK 0x08
1786 #define HCI_FEATURE_SIMPLE_PAIRING_OFF  6
1787 #define HCI_SIMPLE_PAIRING_SUPPORTED(x) ((x)[HCI_FEATURE_SIMPLE_PAIRING_OFF] & HCI_FEATURE_SIMPLE_PAIRING_MASK)
1788 
1789 #define HCI_FEATURE_ENCAP_PDU_MASK      0x10
1790 #define HCI_FEATURE_ENCAP_PDU_OFF       6
1791 #define HCI_ENCAP_PDU_SUPPORTED(x)      ((x)[HCI_FEATURE_ENCAP_PDU_OFF] & HCI_FEATURE_ENCAP_PDU_MASK)
1792 
1793 #define HCI_FEATURE_ERROR_DATA_MASK     0x20
1794 #define HCI_FEATURE_ERROR_DATA_OFF      6
1795 #define HCI_ERROR_DATA_SUPPORTED(x)     ((x)[HCI_FEATURE_ERROR_DATA_OFF] & HCI_FEATURE_ERROR_DATA_MASK)
1796 
1797 #define HCI_FEATURE_NON_FLUSHABLE_PB_MASK      0x40
1798 #define HCI_FEATURE_NON_FLUSHABLE_PB_OFF       6
1799 
1800 /* This feature is causing frequent link drops when doing call switch with certain av/hfp headsets */
1801 #define HCI_NON_FLUSHABLE_PB_SUPPORTED(x)      (0)//((x)[HCI_FEATURE_NON_FLUSHABLE_PB_OFF] & HCI_FEATURE_NON_FLUSHABLE_PB_MASK)
1802 
1803 #define HCI_FEATURE_LINK_SUP_TO_EVT_MASK 0x01
1804 #define HCI_FEATURE_LINK_SUP_TO_EVT_OFF  7
1805 #define HCI_LINK_SUP_TO_EVT_SUPPORTED(x) ((x)[HCI_FEATURE_LINK_SUP_TO_EVT_OFF] & HCI_FEATURE_LINK_SUP_TO_EVT_MASK)
1806 
1807 #define HCI_FEATURE_INQ_RESP_TX_MASK     0x02
1808 #define HCI_FEATURE_INQ_RESP_TX_OFF      7
1809 #define HCI_INQ_RESP_TX_SUPPORTED(x)     ((x)[HCI_FEATURE_INQ_RESP_TX_OFF] & HCI_FEATURE_INQ_RESP_TX_MASK)
1810 
1811 #define HCI_FEATURE_EXTENDED_MASK       0x80
1812 #define HCI_FEATURE_EXTENDED_OFF        7
1813 #define HCI_LMP_EXTENDED_SUPPORTED(x)   ((x)[HCI_FEATURE_EXTENDED_OFF] & HCI_FEATURE_EXTENDED_MASK)
1814 
1815 /*
1816 **   LMP features encoding - page 1
1817 */
1818 #define HCI_EXT_FEATURE_SSP_HOST_MASK 0x01
1819 #define HCI_EXT_FEATURE_SSP_HOST_OFF  0
1820 #define HCI_SSP_HOST_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_SSP_HOST_OFF] & HCI_EXT_FEATURE_SSP_HOST_MASK)
1821 
1822 #define HCI_EXT_FEATURE_LE_HOST_MASK 0x02
1823 #define HCI_EXT_FEATURE_LE_HOST_OFF  0
1824 #define HCI_LE_HOST_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_LE_HOST_OFF] & HCI_EXT_FEATURE_LE_HOST_MASK)
1825 
1826 #define HCI_EXT_FEATURE_SIMUL_DUMO_HOST_MASK 0x04
1827 #define HCI_EXT_FEATURE_SIMUL_DUMO_HOST_OFF  0
1828 #define HCI_SIMUL_DUMO_HOST_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_SIMUL_DUMO_HOST_OFF] & HCI_EXT_FEATURE_SIMUL_DUMO_HOST_MASK)
1829 
1830 #define HCI_EXT_FEATURE_SC_HOST_MASK 0x08
1831 #define HCI_EXT_FEATURE_SC_HOST_OFF  0
1832 #define HCI_SC_HOST_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_SC_HOST_OFF] & HCI_EXT_FEATURE_SC_HOST_MASK)
1833 
1834 /*
1835 **   LMP features encoding - page 2
1836 */
1837 #define HCI_EXT_FEATURE_CSB_MASTER_MASK         0x01
1838 #define HCI_EXT_FEATURE_CSB_MASTER_OFF          0
1839 #define HCI_CSB_MASTER_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_CSB_MASTER_OFF] & HCI_EXT_FEATURE_CSB_MASTER_MASK)
1840 
1841 #define HCI_EXT_FEATURE_CSB_SLAVE_MASK          0x02
1842 #define HCI_EXT_FEATURE_CSB_SLAVE_OFF           0
1843 #define HCI_CSB_SLAVE_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_CSB_SLAVE_OFF] & HCI_EXT_FEATURE_CSB_SLAVE_MASK)
1844 
1845 #define HCI_EXT_FEATURE_SYNC_TRAIN_MASTER_MASK  0x04
1846 #define HCI_EXT_FEATURE_SYNC_TRAIN_MASTER_OFF   0
1847 #define HCI_SYNC_TRAIN_MASTER_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_SYNC_TRAIN_MASTER_OFF] & HCI_EXT_FEATURE_SYNC_TRAIN_MASTER_MASK)
1848 
1849 #define HCI_EXT_FEATURE_SYNC_SCAN_SLAVE_MASK    0x08
1850 #define HCI_EXT_FEATURE_SYNC_SCAN_SLAVE_OFF     0
1851 #define HCI_SYNC_SCAN_SLAVE_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_SYNC_SCAN_SLAVE_OFF] & HCI_EXT_FEATURE_SYNC_SCAN_SLAVE_MASK)
1852 
1853 #define HCI_EXT_FEATURE_INQ_RESP_NOTIF_MASK     0x10
1854 #define HCI_EXT_FEATURE_INQ_RESP_NOTIF_OFF      0
1855 #define HCI_INQ_RESP_NOTIF_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_INQ_RESP_NOTIF_OFF] & HCI_EXT_FEATURE_INQ_RESP_NOTIF_MASK)
1856 
1857 #define HCI_EXT_FEATURE_SC_CTRLR_MASK           0x01
1858 #define HCI_EXT_FEATURE_SC_CTRLR_OFF            1
1859 #define HCI_SC_CTRLR_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_SC_CTRLR_OFF] & HCI_EXT_FEATURE_SC_CTRLR_MASK)
1860 
1861 #define HCI_EXT_FEATURE_PING_MASK               0x02
1862 #define HCI_EXT_FEATURE_PING_OFF                1
1863 #define HCI_PING_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_PING_OFF] & HCI_EXT_FEATURE_PING_MASK)
1864 
1865 /*
1866 **   LE features encoding - page 0 (the only page for now)
1867 */
1868 /* LE Encryption */
1869 #define HCI_LE_FEATURE_LE_ENCRYPTION_MASK       0x01
1870 #define HCI_LE_FEATURE_LE_ENCRYPTION_OFF        0
1871 #define HCI_LE_ENCRYPTION_SUPPORTED(x) ((x)[HCI_LE_FEATURE_LE_ENCRYPTION_OFF] & HCI_LE_FEATURE_LE_ENCRYPTION_MASK)
1872 
1873 /* Connection Parameters Request Procedure */
1874 #define HCI_LE_FEATURE_CONN_PARAM_REQ_MASK       0x02
1875 #define HCI_LE_FEATURE_CONN_PARAM_REQ_OFF        0
1876 #define HCI_LE_CONN_PARAM_REQ_SUPPORTED(x) ((x)[HCI_LE_FEATURE_CONN_PARAM_REQ_OFF] & HCI_LE_FEATURE_CONN_PARAM_REQ_MASK)
1877 
1878 /* Extended Reject Indication */
1879 #define HCI_LE_FEATURE_EXT_REJ_IND_MASK       0x04
1880 #define HCI_LE_FEATURE_EXT_REJ_IND_OFF        0
1881 #define HCI_LE_EXT_REJ_IND_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_REJ_IND_OFF] & HCI_LE_FEATURE_EXT_REJ_IND_MASK)
1882 
1883 /* Slave-initiated Features Exchange */
1884 #define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK       0x08
1885 #define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF        0
1886 #define HCI_LE_SLAVE_INIT_FEAT_EXC_SUPPORTED(x) ((x)[HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF] & HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK)
1887 
1888 /* Enhanced privacy Feature: bit 6 */
1889 #define HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK       0x40
1890 #define HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF        0
1891 #define HCI_LE_ENHANCED_PRIVACY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF] & HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK)
1892 
1893 /* Extended scanner filter policy : 7 */
1894 #define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK       0x80
1895 #define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF        0
1896 #define HCI_LE_EXT_SCAN_FILTER_POLICY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF] & HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK)
1897 
1898 /* Slave-initiated Features Exchange */
1899 #define HCI_LE_FEATURE_DATA_LEN_EXT_MASK       0x20
1900 #define HCI_LE_FEATURE_DATA_LEN_EXT_OFF        0
1901 #define HCI_LE_DATA_LEN_EXT_SUPPORTED(x) ((x)[HCI_LE_FEATURE_DATA_LEN_EXT_OFF] & HCI_LE_FEATURE_DATA_LEN_EXT_MASK)
1902 
1903 /*
1904 **   Local Supported Commands encoding
1905 */
1906 #define HCI_NUM_SUPP_COMMANDS_BYTES           64
1907 
1908 /* Supported Commands Byte 0 */
1909 #define HCI_SUPP_COMMANDS_INQUIRY_MASK 0x01
1910 #define HCI_SUPP_COMMANDS_INQUIRY_OFF  0
1911 #define HCI_INQUIRY_SUPPORTED(x) ((x)[HCI_SUPP_COMMANDS_INQUIRY_OFF] & HCI_SUPP_COMMANDS_INQUIRY_MASK)
1912 
1913 #define HCI_SUPP_COMMANDS_INQUIRY_CANCEL_MASK 0x02
1914 #define HCI_SUPP_COMMANDS_INQUIRY_CANCEL_OFF  0
1915 #define HCI_INQUIRY_CANCEL_SUPPORTED(x) ((x)[HCI_SUPP_COMMANDS_INQUIRY_CANCEL_OFF] & HCI_SUPP_COMMANDS_INQUIRY_CANCEL_MASK)
1916 
1917 #define HCI_SUPP_COMMANDS_PERIODIC_INQUIRY_MASK     0x04
1918 #define HCI_SUPP_COMMANDS_PERIODIC_INQUIRY_OFF      0
1919 #define HCI_PERIODIC_INQUIRY_SUPPORTED(x)     ((x)[HCI_SUPP_COMMANDS_PERIODIC_INQUIRY_OFF] & HCI_SUPP_COMMANDS_PERIODIC_INQUIRY_MASK)
1920 
1921 #define HCI_SUPP_COMMANDS_EXIT_PERIODIC_INQUIRY_MASK    0x08
1922 #define HCI_SUPP_COMMANDS_EXIT_PERIODIC_INQUIRY_OFF     0
1923 #define HCI_EXIT_PERIODIC_INQUIRY_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_EXIT_PERIODIC_INQUIRY_OFF] & HCI_SUPP_COMMANDS_EXIT_PERIODIC_INQUIRY_MASK)
1924 
1925 #define HCI_SUPP_COMMANDS_CREATE_CONN_MASK     0x10
1926 #define HCI_SUPP_COMMANDS_CREATE_CONN_OFF      0
1927 #define HCI_CREATE_CONN_SUPPORTED(x)     ((x)[HCI_SUPP_COMMANDS_CREATE_CONN_OFF] & HCI_SUPP_COMMANDS_CREATE_CONN_MASK)
1928 
1929 #define HCI_SUPP_COMMANDS_DISCONNECT_MASK         0x20
1930 #define HCI_SUPP_COMMANDS_DISCONNECT_OFF          0
1931 #define HCI_DISCONNECT_SUPPORTED(x)         ((x)[HCI_SUPP_COMMANDS_DISCONNECT_OFF] & HCI_SUPP_COMMANDS_DISCONNECT_MASK)
1932 
1933 #define HCI_SUPP_COMMANDS_ADD_SCO_CONN_MASK      0x40
1934 #define HCI_SUPP_COMMANDS_ADD_SCO_CONN_OFF       0
1935 #define HCI_ADD_SCO_CONN_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_ADD_SCO_CONN_OFF] & HCI_SUPP_COMMANDS_ADD_SCO_CONN_MASK)
1936 
1937 #define HCI_SUPP_COMMANDS_CANCEL_CREATE_CONN_MASK     0x80
1938 #define HCI_SUPP_COMMANDS_CANCEL_CREATE_CONN_OFF      0
1939 #define HCI_CANCEL_CREATE_CONN_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_CANCEL_CREATE_CONN_OFF] & HCI_SUPP_COMMANDS_CANCEL_CREATE_CONN_MASK)
1940 
1941 #define HCI_SUPP_COMMANDS_ACCEPT_CONN_REQUEST_MASK      0x01
1942 #define HCI_SUPP_COMMANDS_ACCEPT_CONN_REQUEST_OFF       1
1943 #define HCI_ACCEPT_CONN_REQUEST_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_ACCEPT_CONN_REQUEST_OFF] & HCI_SUPP_COMMANDS_ACCEPT_CONN_REQUEST_MASK)
1944 
1945 #define HCI_SUPP_COMMANDS_REJECT_CONN_REQUEST_MASK           0x02
1946 #define HCI_SUPP_COMMANDS_REJECT_CONN_REQUEST_OFF            1
1947 #define HCI_REJECT_CONN_REQUEST_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_REJECT_CONN_REQUEST_OFF] & HCI_SUPP_COMMANDS_REJECT_CONN_REQUEST_MASK)
1948 
1949 #define HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_REPLY_MASK  0x04
1950 #define HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_REPLY_OFF   1
1951 #define HCI_LINK_KEY_REQUEST_REPLY_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_REPLY_OFF] & HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_REPLY_MASK)
1952 
1953 #define HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_NEG_REPLY_MASK       0x08
1954 #define HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_NEG_REPLY_OFF        1
1955 #define HCI_LINK_KEY_REQUEST_NEG_REPLY_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_NEG_REPLY_OFF] & HCI_SUPP_COMMANDS_LINK_KEY_REQUEST_NEG_REPLY_MASK)
1956 
1957 #define HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_REPLY_MASK    0x10
1958 #define HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_REPLY_OFF     1
1959 #define HCI_PIN_CODE_REQUEST_REPLY_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_REPLY_OFF] & HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_REPLY_MASK)
1960 
1961 #define HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_NEG_REPLY_MASK    0x20
1962 #define HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_NEG_REPLY_OFF     1
1963 #define HCI_PIN_CODE_REQUEST_NEG_REPLY_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_NEG_REPLY_OFF] & HCI_SUPP_COMMANDS_PIN_CODE_REQUEST_NEG_REPLY_MASK)
1964 
1965 #define HCI_SUPP_COMMANDS_CHANGE_CONN_PKT_TYPE_MASK          0x40
1966 #define HCI_SUPP_COMMANDS_CHANGE_CONN_PKT_TYPE_OFF           1
1967 #define HCI_CHANGE_CONN_PKT_TYPE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_CHANGE_CONN_PKT_TYPE_OFF] & HCI_SUPP_COMMANDS_CHANGE_CONN_PKT_TYPE_MASK)
1968 
1969 #define HCI_SUPP_COMMANDS_AUTH_REQUEST_MASK          0x80
1970 #define HCI_SUPP_COMMANDS_AUTH_REQUEST_OFF           1
1971 #define HCI_AUTH_REQUEST_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_AUTH_REQUEST_OFF] & HCI_SUPP_COMMANDS_AUTH_REQUEST_MASK)
1972 
1973 #define HCI_SUPP_COMMANDS_SET_CONN_ENCRYPTION_MASK      0x01
1974 #define HCI_SUPP_COMMANDS_SET_CONN_ENCRYPTION_OFF       2
1975 #define HCI_SET_CONN_ENCRYPTION_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_SET_CONN_ENCRYPTION_OFF] & HCI_SUPP_COMMANDS_SET_CONN_ENCRYPTION_MASK)
1976 
1977 #define HCI_SUPP_COMMANDS_CHANGE_CONN_LINK_KEY_MASK           0x02
1978 #define HCI_SUPP_COMMANDS_CHANGE_CONN_LINK_KEY_OFF            2
1979 #define HCI_CHANGE_CONN_LINK_KEY_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_CHANGE_CONN_LINK_KEY_OFF] & HCI_SUPP_COMMANDS_CHANGE_CONN_LINK_KEY_MASK)
1980 
1981 #define HCI_SUPP_COMMANDS_MASTER_LINK_KEY_MASK  0x04
1982 #define HCI_SUPP_COMMANDS_MASTER_LINK_KEY_OFF   2
1983 #define HCI_MASTER_LINK_KEY_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_MASTER_LINK_KEY_OFF] & HCI_SUPP_COMMANDS_MASTER_LINK_KEY_MASK)
1984 
1985 #define HCI_SUPP_COMMANDS_REMOTE_NAME_REQUEST_MASK       0x08
1986 #define HCI_SUPP_COMMANDS_REMOTE_NAME_REQUEST_OFF        2
1987 #define HCI_REMOTE_NAME_REQUEST_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_REMOTE_NAME_REQUEST_OFF] & HCI_SUPP_COMMANDS_REMOTE_NAME_REQUEST_MASK)
1988 
1989 #define HCI_SUPP_COMMANDS_CANCEL_REMOTE_NAME_REQUEST_MASK    0x10
1990 #define HCI_SUPP_COMMANDS_CANCEL_REMOTE_NAME_REQUEST_OFF     2
1991 #define HCI_CANCEL_REMOTE_NAME_REQUEST_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_CANCEL_REMOTE_NAME_REQUEST_OFF] & HCI_SUPP_COMMANDS_CANCEL_REMOTE_NAME_REQUEST_MASK)
1992 
1993 #define HCI_SUPP_COMMANDS_READ_REMOTE_SUPP_FEATURES_MASK    0x20
1994 #define HCI_SUPP_COMMANDS_READ_REMOTE_SUPP_FEATURES_OFF     2
1995 #define HCI_READ_REMOTE_SUPP_FEATURES_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_REMOTE_SUPP_FEATURES_OFF] & HCI_SUPP_COMMANDS_READ_REMOTE_SUPP_FEATURES_MASK)
1996 
1997 #define HCI_SUPP_COMMANDS_READ_REMOTE_EXT_FEATURES_MASK          0x40
1998 #define HCI_SUPP_COMMANDS_READ_REMOTE_EXT_FEATURES_OFF           2
1999 #define HCI_READ_REMOTE_EXT_FEATURES_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_REMOTE_EXT_FEATURES_OFF] & HCI_SUPP_COMMANDS_READ_REMOTE_EXT_FEATURES_MASK)
2000 
2001 #define HCI_SUPP_COMMANDS_READ_REMOTE_VER_INFO_MASK          0x80
2002 #define HCI_SUPP_COMMANDS_READ_REMOTE_VER_INFO_OFF           2
2003 #define HCI_READ_REMOTE_VER_INFO_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_REMOTE_VER_INFO_OFF] & HCI_SUPP_COMMANDS_READ_REMOTE_VER_INFO_MASK)
2004 
2005 #define HCI_SUPP_COMMANDS_READ_CLOCK_OFFSET_MASK           0x01
2006 #define HCI_SUPP_COMMANDS_READ_CLOCK_OFFSET_OFF            3
2007 #define HCI_READ_CLOCK_OFFSET_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_READ_CLOCK_OFFSET_OFF] & HCI_SUPP_COMMANDS_READ_CLOCK_OFFSET_MASK)
2008 
2009 #define HCI_SUPP_COMMANDS_READ_LMP_HANDLE_MASK  0x02
2010 #define HCI_SUPP_COMMANDS_READ_LMP_HANDLE_OFF   3
2011 #define HCI_READ_LMP_HANDLE_SUPPORTED(x) ((x)[HCI_SUPP_COMMANDS_READ_LMP_HANDLE_OFF] & HCI_SUPP_COMMANDS_READ_LMP_HANDLE_MASK)
2012 
2013 #define HCI_SUPP_COMMANDS_HOLD_MODE_CMD_MASK           0x02
2014 #define HCI_SUPP_COMMANDS_HOLD_MODE_CMD_OFF            4
2015 #define HCI_HOLD_MODE_CMD_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_HOLD_MODE_CMD_OFF] & HCI_SUPP_COMMANDS_HOLD_MODE_CMD_MASK)
2016 
2017 #define HCI_SUPP_COMMANDS_SNIFF_MODE_CMD_MASK  0x04
2018 #define HCI_SUPP_COMMANDS_SNIFF_MODE_CMD_OFF   4
2019 #define HCI_SNIFF_MODE_CMD_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_SNIFF_MODE_CMD_OFF] & HCI_SUPP_COMMANDS_SNIFF_MODE_CMD_MASK)
2020 
2021 #define HCI_SUPP_COMMANDS_EXIT_SNIFF_MODE_MASK       0x08
2022 #define HCI_SUPP_COMMANDS_EXIT_SNIFF_MODE_OFF        4
2023 #define HCI_EXIT_SNIFF_MODE_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_EXIT_SNIFF_MODE_OFF] & HCI_SUPP_COMMANDS_EXIT_SNIFF_MODE_MASK)
2024 
2025 #define HCI_SUPP_COMMANDS_PARK_STATE_MASK    0x10
2026 #define HCI_SUPP_COMMANDS_PARK_STATE_OFF     4
2027 #define HCI_PARK_STATE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_PARK_STATE_OFF] & HCI_SUPP_COMMANDS_PARK_STATE_MASK)
2028 
2029 #define HCI_SUPP_COMMANDS_EXIT_PARK_STATE_MASK    0x20
2030 #define HCI_SUPP_COMMANDS_EXIT_PARK_STATE_OFF     4
2031 #define HCI_EXIT_PARK_STATE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_EXIT_PARK_STATE_OFF] & HCI_SUPP_COMMANDS_EXIT_PARK_STATE_MASK)
2032 
2033 #define HCI_SUPP_COMMANDS_QOS_SETUP_MASK          0x40
2034 #define HCI_SUPP_COMMANDS_QOS_SETUP_OFF           4
2035 #define HCI_QOS_SETUP_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_QOS_SETUP_OFF] & HCI_SUPP_COMMANDS_QOS_SETUP_MASK)
2036 
2037 #define HCI_SUPP_COMMANDS_ROLE_DISCOVERY_MASK          0x80
2038 #define HCI_SUPP_COMMANDS_ROLE_DISCOVERY_OFF           4
2039 #define HCI_ROLE_DISCOVERY_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_ROLE_DISCOVERY_OFF] & HCI_SUPP_COMMANDS_ROLE_DISCOVERY_MASK)
2040 
2041 #define HCI_SUPP_COMMANDS_SWITCH_ROLE_MASK      0x01
2042 #define HCI_SUPP_COMMANDS_SWITCH_ROLE_OFF       5
2043 #define HCI_SWITCH_ROLE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_SWITCH_ROLE_OFF] & HCI_SUPP_COMMANDS_SWITCH_ROLE_MASK)
2044 
2045 #define HCI_SUPP_COMMANDS_READ_LINK_POLICY_SET_MASK           0x02
2046 #define HCI_SUPP_COMMANDS_READ_LINK_POLICY_SET_OFF            5
2047 #define HCI_READ_LINK_POLICY_SET_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_READ_LINK_POLICY_SET_OFF] & HCI_SUPP_COMMANDS_READ_LINK_POLICY_SET_MASK)
2048 
2049 #define HCI_SUPP_COMMANDS_WRITE_LINK_POLICY_SET_MASK  0x04
2050 #define HCI_SUPP_COMMANDS_WRITE_LINK_POLICY_SET_OFF   5
2051 #define HCI_WRITE_LINK_POLICY_SET_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_WRITE_LINK_POLICY_SET_OFF] & HCI_SUPP_COMMANDS_WRITE_LINK_POLICY_SET_MASK)
2052 
2053 #define HCI_SUPP_COMMANDS_READ_DEF_LINK_POLICY_SET_MASK       0x08
2054 #define HCI_SUPP_COMMANDS_READ_DEF_LINK_POLICY_SET_OFF        5
2055 #define HCI_READ_DEF_LINK_POLICY_SET_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_READ_DEF_LINK_POLICY_SET_OFF] & HCI_SUPP_COMMANDS_READ_DEF_LINK_POLICY_SET_MASK)
2056 
2057 #define HCI_SUPP_COMMANDS_WRITE_DEF_LINK_POLICY_SET_MASK    0x10
2058 #define HCI_SUPP_COMMANDS_WRITE_DEF_LINK_POLICY_SET_OFF     5
2059 #define HCI_WRITE_DEF_LINK_POLICY_SET_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_WRITE_DEF_LINK_POLICY_SET_OFF] & HCI_SUPP_COMMANDS_WRITE_DEF_LINK_POLICY_SET_MASK)
2060 
2061 #define HCI_SUPP_COMMANDS_FLOW_SPECIFICATION_MASK    0x20
2062 #define HCI_SUPP_COMMANDS_FLOW_SPECIFICATION_OFF     5
2063 #define HCI_FLOW_SPECIFICATION_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_FLOW_SPECIFICATION_OFF] & HCI_SUPP_COMMANDS_FLOW_SPECIFICATION_MASK)
2064 
2065 #define HCI_SUPP_COMMANDS_SET_EVENT_MASK_MASK          0x40
2066 #define HCI_SUPP_COMMANDS_SET_EVENT_MASK_OFF           5
2067 #define HCI_SET_EVENT_MASK_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_SET_EVENT_MASK_OFF] & HCI_SUPP_COMMANDS_SET_EVENT_MASK_MASK)
2068 
2069 #define HCI_SUPP_COMMANDS_RESET_MASK          0x80
2070 #define HCI_SUPP_COMMANDS_RESET_OFF           5
2071 #define HCI_RESET_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_RESET_OFF] & HCI_SUPP_COMMANDS_RESET_MASK)
2072 
2073 #define HCI_SUPP_COMMANDS_SET_EVENT_FILTER_MASK      0x01
2074 #define HCI_SUPP_COMMANDS_SET_EVENT_FILTER_OFF       6
2075 #define HCI_SET_EVENT_FILTER_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_SET_EVENT_FILTER_OFF] & HCI_SUPP_COMMANDS_SET_EVENT_FILTER_MASK)
2076 
2077 #define HCI_SUPP_COMMANDS_FLUSH_MASK           0x02
2078 #define HCI_SUPP_COMMANDS_FLUSH_OFF            6
2079 #define HCI_FLUSH_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_FLUSH_OFF] & HCI_SUPP_COMMANDS_FLUSH_MASK)
2080 
2081 #define HCI_SUPP_COMMANDS_READ_PIN_TYPE_MASK  0x04
2082 #define HCI_SUPP_COMMANDS_READ_PIN_TYPE_OFF   6
2083 #define HCI_READ_PIN_TYPE_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_PIN_TYPE_OFF] & HCI_SUPP_COMMANDS_READ_PIN_TYPE_MASK)
2084 
2085 #define HCI_SUPP_COMMANDS_WRITE_PIN_TYPE_MASK       0x08
2086 #define HCI_SUPP_COMMANDS_WRITE_PIN_TYPE_OFF        6
2087 #define HCI_WRITE_PIN_TYPE_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_WRITE_PIN_TYPE_OFF] & HCI_SUPP_COMMANDS_WRITE_PIN_TYPE_MASK)
2088 
2089 #define HCI_SUPP_COMMANDS_CREATE_NEW_UNIT_KEY_MASK    0x10
2090 #define HCI_SUPP_COMMANDS_CREATE_NEW_UNIT_KEY_OFF     6
2091 #define HCI_CREATE_NEW_UNIT_KEY_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_CREATE_NEW_UNIT_KEY_OFF] & HCI_SUPP_COMMANDS_CREATE_NEW_UNIT_KEY_MASK)
2092 
2093 #define HCI_SUPP_COMMANDS_READ_STORED_LINK_KEY_MASK    0x20
2094 #define HCI_SUPP_COMMANDS_READ_STORED_LINK_KEY_OFF     6
2095 #define HCI_READ_STORED_LINK_KEY_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_STORED_LINK_KEY_OFF] & HCI_SUPP_COMMANDS_READ_STORED_LINK_KEY_MASK)
2096 
2097 #define HCI_SUPP_COMMANDS_WRITE_STORED_LINK_KEY_MASK          0x40
2098 #define HCI_SUPP_COMMANDS_WRITE_STORED_LINK_KEY_OFF           6
2099 #define HCI_WRITE_STORED_LINK_KEY_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_STORED_LINK_KEY_OFF] & HCI_SUPP_COMMANDS_WRITE_STORED_LINK_KEY_MASK)
2100 
2101 #define HCI_SUPP_COMMANDS_DELETE_STORED_LINK_KEY_MASK          0x80
2102 #define HCI_SUPP_COMMANDS_DELETE_STORED_LINK_KEY_OFF           6
2103 #define HCI_DELETE_STORED_LINK_KEY_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_DELETE_STORED_LINK_KEY_OFF] & HCI_SUPP_COMMANDS_DELETE_STORED_LINK_KEY_MASK)
2104 
2105 #define HCI_SUPP_COMMANDS_WRITE_LOCAL_NAME_MASK      0x01
2106 #define HCI_SUPP_COMMANDS_WRITE_LOCAL_NAME_OFF       7
2107 #define HCI_WRITE_LOCAL_NAME_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_LOCAL_NAME_OFF] & HCI_SUPP_COMMANDS_WRITE_LOCAL_NAME_MASK)
2108 
2109 #define HCI_SUPP_COMMANDS_READ_LOCAL_NAME_MASK           0x02
2110 #define HCI_SUPP_COMMANDS_READ_LOCAL_NAME_OFF            7
2111 #define HCI_READ_LOCAL_NAME_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_NAME_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_NAME_MASK)
2112 
2113 #define HCI_SUPP_COMMANDS_READ_CONN_ACCEPT_TOUT_MASK  0x04
2114 #define HCI_SUPP_COMMANDS_READ_CONN_ACCEPT_TOUT_OFF   7
2115 #define HCI_READ_CONN_ACCEPT_TOUT_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_CONN_ACCEPT_TOUT_OFF] & HCI_SUPP_COMMANDS_READ_CONN_ACCEPT_TOUT_MASK)
2116 
2117 #define HCI_SUPP_COMMANDS_WRITE_CONN_ACCEPT_TOUT_MASK       0x08
2118 #define HCI_SUPP_COMMANDS_WRITE_CONN_ACCEPT_TOUT_OFF        7
2119 #define HCI_WRITE_CONN_ACCEPT_TOUT_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_WRITE_CONN_ACCEPT_TOUT_OFF] & HCI_SUPP_COMMANDS_WRITE_CONN_ACCEPT_TOUT_MASK)
2120 
2121 #define HCI_SUPP_COMMANDS_READ_PAGE_TOUT_MASK    0x10
2122 #define HCI_SUPP_COMMANDS_READ_PAGE_TOUT_OFF     7
2123 #define HCI_READ_PAGE_TOUT_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_PAGE_TOUT_OFF] & HCI_SUPP_COMMANDS_READ_PAGE_TOUT_MASK)
2124 
2125 #define HCI_SUPP_COMMANDS_WRITE_PAGE_TOUT_MASK    0x20
2126 #define HCI_SUPP_COMMANDS_WRITE_PAGE_TOUT_OFF     7
2127 #define HCI_WRITE_PAGE_TOUT_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_WRITE_PAGE_TOUT_OFF] & HCI_SUPP_COMMANDS_WRITE_PAGE_TOUT_MASK)
2128 
2129 #define HCI_SUPP_COMMANDS_READ_SCAN_ENABLE_MASK          0x40
2130 #define HCI_SUPP_COMMANDS_READ_SCAN_ENABLE_OFF           7
2131 #define HCI_READ_SCAN_ENABLE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_SCAN_ENABLE_OFF] & HCI_SUPP_COMMANDS_READ_SCAN_ENABLE_MASK)
2132 
2133 #define HCI_SUPP_COMMANDS_WRITE_SCAN_ENABLE_MASK          0x80
2134 #define HCI_SUPP_COMMANDS_WRITE_SCAN_ENABLE_OFF           7
2135 #define HCI_WRITE_SCAN_ENABLE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_SCAN_ENABLE_OFF] & HCI_SUPP_COMMANDS_WRITE_SCAN_ENABLE_MASK)
2136 
2137 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_ACTIVITY_MASK      0x01
2138 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_ACTIVITY_OFF       8
2139 #define HCI_READ_PAGE_SCAN_ACTIVITY_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_PAGE_SCAN_ACTIVITY_OFF] & HCI_SUPP_COMMANDS_READ_PAGE_SCAN_ACTIVITY_MASK)
2140 
2141 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_ACTIVITY_MASK           0x02
2142 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_ACTIVITY_OFF            8
2143 #define HCI_WRITE_PAGE_SCAN_ACTIVITY_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_ACTIVITY_OFF] & HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_ACTIVITY_MASK)
2144 
2145 #define HCI_SUPP_COMMANDS_READ_INQURIY_SCAN_ACTIVITY_MASK  0x04
2146 #define HCI_SUPP_COMMANDS_READ_INQURIY_SCAN_ACTIVITY_OFF   8
2147 #define HCI_READ_INQURIY_SCAN_ACTIVITY_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_INQURIY_SCAN_ACTIVITY_OFF] & HCI_SUPP_COMMANDS_READ_INQURIY_SCAN_ACTIVITY_MASK)
2148 
2149 #define HCI_SUPP_COMMANDS_WRITE_INQURIY_SCAN_ACTIVITY_MASK       0x08
2150 #define HCI_SUPP_COMMANDS_WRITE_INQURIY_SCAN_ACTIVITY_OFF        8
2151 #define HCI_WRITE_INQURIY_SCAN_ACTIVITY_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_WRITE_INQURIY_SCAN_ACTIVITY_OFF] & HCI_SUPP_COMMANDS_WRITE_INQURIY_SCAN_ACTIVITY_MASK)
2152 
2153 #define HCI_SUPP_COMMANDS_READ_AUTH_ENABLE_MASK    0x10
2154 #define HCI_SUPP_COMMANDS_READ_AUTH_ENABLE_OFF     8
2155 #define HCI_READ_AUTH_ENABLE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_AUTH_ENABLE_OFF] & HCI_SUPP_COMMANDS_READ_AUTH_ENABLE_MASK)
2156 
2157 #define HCI_SUPP_COMMANDS_WRITE_AUTH_ENABLE_MASK    0x20
2158 #define HCI_SUPP_COMMANDS_WRITE_AUTH_ENABLE_OFF     8
2159 #define HCI_WRITE_AUTH_ENABLE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_WRITE_AUTH_ENABLE_OFF] & HCI_SUPP_COMMANDS_WRITE_AUTH_ENABLE_MASK)
2160 
2161 #define HCI_SUPP_COMMANDS_READ_ENCRYPT_ENABLE_MASK          0x40
2162 #define HCI_SUPP_COMMANDS_READ_ENCRYPT_ENABLE_OFF           8
2163 #define HCI_READ_ENCRYPT_ENABLE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_ENCRYPT_ENABLE_OFF] & HCI_SUPP_COMMANDS_READ_ENCRYPT_ENABLE_MASK)
2164 
2165 #define HCI_SUPP_COMMANDS_WRITE_ENCRYPT_ENABLE_MASK          0x80
2166 #define HCI_SUPP_COMMANDS_WRITE_ENCRYPT_ENABLE_OFF           8
2167 #define HCI_WRITE_ENCRYPT_ENABLE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_ENCRYPT_ENABLE_OFF] & HCI_SUPP_COMMANDS_WRITE_ENCRYPT_ENABLE_MASK)
2168 
2169 #define HCI_SUPP_COMMANDS_READ_CLASS_DEVICE_MASK      0x01
2170 #define HCI_SUPP_COMMANDS_READ_CLASS_DEVICE_OFF       9
2171 #define HCI_READ_CLASS_DEVICE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_CLASS_DEVICE_OFF] & HCI_SUPP_COMMANDS_READ_CLASS_DEVICE_MASK)
2172 
2173 #define HCI_SUPP_COMMANDS_WRITE_CLASS_DEVICE_MASK           0x02
2174 #define HCI_SUPP_COMMANDS_WRITE_CLASS_DEVICE_OFF            9
2175 #define HCI_WRITE_CLASS_DEVICE_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_WRITE_CLASS_DEVICE_OFF] & HCI_SUPP_COMMANDS_WRITE_CLASS_DEVICE_MASK)
2176 
2177 #define HCI_SUPP_COMMANDS_READ_VOICE_SETTING_MASK  0x04
2178 #define HCI_SUPP_COMMANDS_READ_VOICE_SETTING_OFF   9
2179 #define HCI_READ_VOICE_SETTING_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_VOICE_SETTING_OFF] & HCI_SUPP_COMMANDS_READ_VOICE_SETTING_MASK)
2180 
2181 #define HCI_SUPP_COMMANDS_WRITE_VOICE_SETTING_MASK       0x08
2182 #define HCI_SUPP_COMMANDS_WRITE_VOICE_SETTING_OFF        9
2183 #define HCI_WRITE_VOICE_SETTING_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_WRITE_VOICE_SETTING_OFF] & HCI_SUPP_COMMANDS_WRITE_VOICE_SETTING_MASK)
2184 
2185 #define HCI_SUPP_COMMANDS_READ_AUTO_FLUSH_TOUT_MASK    0x10
2186 #define HCI_SUPP_COMMANDS_READ_AUTO_FLUSH_TOUT_OFF     9
2187 #define HCI_READ_AUTO_FLUSH_TOUT_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_AUTO_FLUSH_TOUT_OFF] & HCI_SUPP_COMMANDS_READ_AUTO_FLUSH_TOUT_MASK)
2188 
2189 #define HCI_SUPP_COMMANDS_WRITE_AUTO_FLUSH_TOUT_MASK    0x20
2190 #define HCI_SUPP_COMMANDS_WRITE_AUTO_FLUSH_TOUT_OFF     9
2191 #define HCI_WRITE_AUTO_FLUSH_TOUT_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_WRITE_AUTO_FLUSH_TOUT_OFF] & HCI_SUPP_COMMANDS_WRITE_AUTO_FLUSH_TOUT_MASK)
2192 
2193 #define HCI_SUPP_COMMANDS_READ_NUM_BROAD_RETRANS_MASK          0x40
2194 #define HCI_SUPP_COMMANDS_READ_NUM_BROAD_RETRANS_OFF           9
2195 #define HCI_READ_NUM_BROAD_RETRANS_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_NUM_BROAD_RETRANS_OFF] & HCI_SUPP_COMMANDS_READ_NUM_BROAD_RETRANS_MASK)
2196 
2197 #define HCI_SUPP_COMMANDS_WRITE_NUM_BROAD_RETRANS_MASK          0x80
2198 #define HCI_SUPP_COMMANDS_WRITE_NUM_BROAD_RETRANS_OFF           9
2199 #define HCI_WRITE_NUM_BROAD_RETRANS_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_NUM_BROAD_RETRANS_OFF] & HCI_SUPP_COMMANDS_WRITE_NUM_BROAD_RETRANS_MASK)
2200 
2201 #define HCI_SUPP_COMMANDS_READ_HOLD_MODE_ACTIVITY_MASK      0x01
2202 #define HCI_SUPP_COMMANDS_READ_HOLD_MODE_ACTIVITY_OFF       10
2203 #define HCI_READ_HOLD_MODE_ACTIVITY_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_HOLD_MODE_ACTIVITY_OFF] & HCI_SUPP_COMMANDS_READ_HOLD_MODE_ACTIVITY_MASK)
2204 
2205 #define HCI_SUPP_COMMANDS_WRITE_HOLD_MODE_ACTIVITY_MASK           0x02
2206 #define HCI_SUPP_COMMANDS_WRITE_HOLD_MODE_ACTIVITY_OFF            10
2207 #define HCI_WRITE_HOLD_MODE_ACTIVITY_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_WRITE_HOLD_MODE_ACTIVITY_OFF] & HCI_SUPP_COMMANDS_WRITE_HOLD_MODE_ACTIVITY_MASK)
2208 
2209 #define HCI_SUPP_COMMANDS_READ_TRANS_PWR_LEVEL_MASK  0x04
2210 #define HCI_SUPP_COMMANDS_READ_TRANS_PWR_LEVEL_OFF   10
2211 #define HCI_READ_TRANS_PWR_LEVEL_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_TRANS_PWR_LEVEL_OFF] & HCI_SUPP_COMMANDS_READ_TRANS_PWR_LEVEL_MASK)
2212 
2213 #define HCI_SUPP_COMMANDS_READ_SYNCH_FLOW_CTRL_ENABLE_MASK       0x08
2214 #define HCI_SUPP_COMMANDS_READ_SYNCH_FLOW_CTRL_ENABLE_OFF        10
2215 #define HCI_READ_SYNCH_FLOW_CTRL_ENABLE_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_READ_SYNCH_FLOW_CTRL_ENABLE_OFF] & HCI_SUPP_COMMANDS_READ_SYNCH_FLOW_CTRL_ENABLE_MASK)
2216 
2217 #define HCI_SUPP_COMMANDS_WRITE_SYNCH_FLOW_CTRL_ENABLE_MASK    0x10
2218 #define HCI_SUPP_COMMANDS_WRITE_SYNCH_FLOW_CTRL_ENABLE_OFF     10
2219 #define HCI_WRITE_SYNCH_FLOW_CTRL_ENABLE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_WRITE_SYNCH_FLOW_CTRL_ENABLE_OFF] & HCI_SUPP_COMMANDS_WRITE_SYNCH_FLOW_CTRL_ENABLE_MASK)
2220 
2221 #define HCI_SUPP_COMMANDS_SET_HOST_CTRLR_TO_HOST_FC_MASK    0x20
2222 #define HCI_SUPP_COMMANDS_SET_HOST_CTRLR_TO_HOST_FC_OFF     10
2223 #define HCI_SET_HOST_CTRLR_TO_HOST_FC_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_SET_HOST_CTRLR_TO_HOST_FC_OFF] & HCI_SUPP_COMMANDS_SET_HOST_CTRLR_TO_HOST_FC_MASK)
2224 
2225 #define HCI_SUPP_COMMANDS_HOST_BUFFER_SIZE_MASK          0x40
2226 #define HCI_SUPP_COMMANDS_HOST_BUFFER_SIZE_OFF           10
2227 #define HCI_HOST_BUFFER_SIZE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_HOST_BUFFER_SIZE_OFF] & HCI_SUPP_COMMANDS_HOST_BUFFER_SIZE_MASK)
2228 
2229 #define HCI_SUPP_COMMANDS_HOST_NUM_COMPLETED_PKTS_MASK          0x80
2230 #define HCI_SUPP_COMMANDS_HOST_NUM_COMPLETED_PKTS_OFF           10
2231 #define HCI_HOST_NUM_COMPLETED_PKTS_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_HOST_NUM_COMPLETED_PKTS_OFF] & HCI_SUPP_COMMANDS_HOST_NUM_COMPLETED_PKTS_MASK)
2232 
2233 #define HCI_SUPP_COMMANDS_READ_LINK_SUP_TOUT_MASK      0x01
2234 #define HCI_SUPP_COMMANDS_READ_LINK_SUP_TOUT_OFF       11
2235 #define HCI_READ_LINK_SUP_TOUT_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_LINK_SUP_TOUT_OFF] & HCI_SUPP_COMMANDS_READ_LINK_SUP_TOUT_MASK)
2236 
2237 #define HCI_SUPP_COMMANDS_WRITE_LINK_SUP_TOUT_MASK           0x02
2238 #define HCI_SUPP_COMMANDS_WRITE_LINK_SUP_TOUT_OFF            11
2239 #define HCI_WRITE_LINK_SUP_TOUT_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_WRITE_LINK_SUP_TOUT_OFF] & HCI_SUPP_COMMANDS_WRITE_LINK_SUP_TOUT_MASK)
2240 
2241 #define HCI_SUPP_COMMANDS_READ_NUM_SUPP_IAC_MASK  0x04
2242 #define HCI_SUPP_COMMANDS_READ_NUM_SUPP_IAC_OFF   11
2243 #define HCI_READ_NUM_SUPP_IAC_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_NUM_SUPP_IAC_OFF] & HCI_SUPP_COMMANDS_READ_NUM_SUPP_IAC_MASK)
2244 
2245 #define HCI_SUPP_COMMANDS_READ_CURRENT_IAC_LAP_MASK       0x08
2246 #define HCI_SUPP_COMMANDS_READ_CURRENT_IAC_LAP_OFF        11
2247 #define HCI_READ_CURRENT_IAC_LAP_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_READ_CURRENT_IAC_LAP_OFF] & HCI_SUPP_COMMANDS_READ_CURRENT_IAC_LAP_MASK)
2248 
2249 #define HCI_SUPP_COMMANDS_WRITE_CURRENT_IAC_LAP_MASK    0x10
2250 #define HCI_SUPP_COMMANDS_WRITE_CURRENT_IAC_LAP_OFF     11
2251 #define HCI_WRITE_CURRENT_IAC_LAP_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_WRITE_CURRENT_IAC_LAP_OFF] & HCI_SUPP_COMMANDS_WRITE_CURRENT_IAC_LAP_MASK)
2252 
2253 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_PER_MODE_MASK    0x20
2254 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_PER_MODE_OFF     11
2255 #define HCI_READ_PAGE_SCAN_PER_MODE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_PAGE_SCAN_PER_MODE_OFF] & HCI_SUPP_COMMANDS_READ_PAGE_SCAN_PER_MODE_MASK)
2256 
2257 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_PER_MODE_MASK          0x40
2258 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_PER_MODE_OFF           11
2259 #define HCI_WRITE_PAGE_SCAN_PER_MODE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_PER_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_PER_MODE_MASK)
2260 
2261 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_MODE_MASK          0x80
2262 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_MODE_OFF           11
2263 #define HCI_READ_PAGE_SCAN_MODE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_PAGE_SCAN_MODE_OFF] & HCI_SUPP_COMMANDS_READ_PAGE_SCAN_MODE_MASK)
2264 
2265 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_MODE_MASK      0x01
2266 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_MODE_OFF       12
2267 #define HCI_WRITE_PAGE_SCAN_MODE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_MODE_MASK)
2268 
2269 #define HCI_SUPP_COMMANDS_SET_AFH_CHNL_CLASS_MASK           0x02
2270 #define HCI_SUPP_COMMANDS_SET_AFH_CHNL_CLASS_OFF            12
2271 #define HCI_SET_AFH_CHNL_CLASS_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_SET_AFH_CHNL_CLASS_OFF] & HCI_SUPP_COMMANDS_SET_AFH_CHNL_CLASS_MASK)
2272 
2273 #define HCI_SUPP_COMMANDS_READ_INQUIRY_SCAN_TYPE_MASK    0x10
2274 #define HCI_SUPP_COMMANDS_READ_INQUIRY_SCAN_TYPE_OFF     12
2275 #define HCI_READ_INQUIRY_SCAN_TYPE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_INQUIRY_SCAN_TYPE_OFF] & HCI_SUPP_COMMANDS_READ_INQUIRY_SCAN_TYPE_MASK)
2276 
2277 #define HCI_SUPP_COMMANDS_WRITE_INQUIRY_SCAN_TYPE_MASK    0x20
2278 #define HCI_SUPP_COMMANDS_WRITE_INQUIRY_SCAN_TYPE_OFF     12
2279 #define HCI_WRITE_INQUIRY_SCAN_TYPE_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_WRITE_INQUIRY_SCAN_TYPE_OFF] & HCI_SUPP_COMMANDS_WRITE_INQUIRY_SCAN_TYPE_MASK)
2280 
2281 #define HCI_SUPP_COMMANDS_READ_INQUIRY_MODE_MASK          0x40
2282 #define HCI_SUPP_COMMANDS_READ_INQUIRY_MODE_OFF           12
2283 #define HCI_READ_INQUIRY_MODE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_INQUIRY_MODE_OFF] & HCI_SUPP_COMMANDS_READ_INQUIRY_MODE_MASK)
2284 
2285 #define HCI_SUPP_COMMANDS_WRITE_INQUIRY_MODE_MASK          0x80
2286 #define HCI_SUPP_COMMANDS_WRITE_INQUIRY_MODE_OFF           12
2287 #define HCI_WRITE_INQUIRY_MODE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_WRITE_INQUIRY_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_INQUIRY_MODE_MASK)
2288 
2289 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_TYPE_MASK      0x01
2290 #define HCI_SUPP_COMMANDS_READ_PAGE_SCAN_TYPE_OFF       13
2291 #define HCI_READ_PAGE_SCAN_TYPE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_PAGE_SCAN_TYPE_OFF] & HCI_SUPP_COMMANDS_READ_PAGE_SCAN_TYPE_MASK)
2292 
2293 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_TYPE_MASK           0x02
2294 #define HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_TYPE_OFF            13
2295 #define HCI_WRITE_PAGE_SCAN_TYPE_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_TYPE_OFF] & HCI_SUPP_COMMANDS_WRITE_PAGE_SCAN_TYPE_MASK)
2296 
2297 #define HCI_SUPP_COMMANDS_READ_AFH_CHNL_ASSESS_MODE_MASK  0x04
2298 #define HCI_SUPP_COMMANDS_READ_AFH_CHNL_ASSESS_MODE_OFF   13
2299 #define HCI_READ_AFH_CHNL_ASSESS_MODE_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_AFH_CHNL_ASSESS_MODE_OFF] & HCI_SUPP_COMMANDS_READ_AFH_CHNL_ASSESS_MODE_MASK)
2300 
2301 #define HCI_SUPP_COMMANDS_WRITE_AFH_CHNL_ASSESS_MODE_MASK       0x08
2302 #define HCI_SUPP_COMMANDS_WRITE_AFH_CHNL_ASSESS_MODE_OFF        13
2303 #define HCI_WRITE_AFH_CHNL_ASSESS_MODE_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_WRITE_AFH_CHNL_ASSESS_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_AFH_CHNL_ASSESS_MODE_MASK)
2304 
2305 #define HCI_SUPP_COMMANDS_READ_LOCAL_VER_INFO_MASK       0x08
2306 #define HCI_SUPP_COMMANDS_READ_LOCAL_VER_INFO_OFF        14
2307 #define HCI_READ_LOCAL_VER_INFO_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_VER_INFO_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_VER_INFO_MASK)
2308 
2309 #define HCI_SUPP_COMMANDS_READ_LOCAL_SUP_CMDS_MASK       0x10
2310 #define HCI_SUPP_COMMANDS_READ_LOCAL_SUP_CMDS_OFF        14
2311 #define HCI_READ_LOCAL_SUP_CMDS_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_SUP_CMDS_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_SUP_CMDS_MASK)
2312 
2313 #define HCI_SUPP_COMMANDS_READ_LOCAL_SUPP_FEATURES_MASK    0x20
2314 #define HCI_SUPP_COMMANDS_READ_LOCAL_SUPP_FEATURES_OFF     14
2315 #define HCI_READ_LOCAL_SUPP_FEATURES_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_SUPP_FEATURES_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_SUPP_FEATURES_MASK)
2316 
2317 #define HCI_SUPP_COMMANDS_READ_LOCAL_EXT_FEATURES_MASK          0x40
2318 #define HCI_SUPP_COMMANDS_READ_LOCAL_EXT_FEATURES_OFF           14
2319 #define HCI_READ_LOCAL_EXT_FEATURES_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_EXT_FEATURES_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_EXT_FEATURES_MASK)
2320 
2321 #define HCI_SUPP_COMMANDS_READ_BUFFER_SIZE_MASK          0x80
2322 #define HCI_SUPP_COMMANDS_READ_BUFFER_SIZE_OFF           14
2323 #define HCI_READ_BUFFER_SIZE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_BUFFER_SIZE_OFF] & HCI_SUPP_COMMANDS_READ_BUFFER_SIZE_MASK)
2324 
2325 #define HCI_SUPP_COMMANDS_READ_COUNTRY_CODE_MASK      0x01
2326 #define HCI_SUPP_COMMANDS_READ_COUNTRY_CODE_OFF       15
2327 #define HCI_READ_COUNTRY_CODE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_COUNTRY_CODE_OFF] & HCI_SUPP_COMMANDS_READ_COUNTRY_CODE_MASK)
2328 
2329 #define HCI_SUPP_COMMANDS_READ_BD_ADDR_MASK           0x02
2330 #define HCI_SUPP_COMMANDS_READ_BD_ADDR_OFF            15
2331 #define HCI_READ_BD_ADDR_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_READ_BD_ADDR_OFF] & HCI_SUPP_COMMANDS_READ_BD_ADDR_MASK)
2332 
2333 #define HCI_SUPP_COMMANDS_READ_FAIL_CONTACT_CNTR_MASK  0x04
2334 #define HCI_SUPP_COMMANDS_READ_FAIL_CONTACT_CNTR_OFF   15
2335 #define HCI_READ_FAIL_CONTACT_CNTR_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_READ_FAIL_CONTACT_CNTR_OFF] & HCI_SUPP_COMMANDS_READ_FAIL_CONTACT_CNTR_MASK)
2336 
2337 #define HCI_SUPP_COMMANDS_RESET_FAIL_CONTACT_CNTR_MASK       0x08
2338 #define HCI_SUPP_COMMANDS_RESET_FAIL_CONTACT_CNTR_OFF        15
2339 #define HCI_RESET_FAIL_CONTACT_CNTR_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_RESET_FAIL_CONTACT_CNTR_OFF] & HCI_SUPP_COMMANDS_RESET_FAIL_CONTACT_CNTR_MASK)
2340 
2341 #define HCI_SUPP_COMMANDS_GET_LINK_QUALITY_MASK    0x10
2342 #define HCI_SUPP_COMMANDS_GET_LINK_QUALITY_OFF     15
2343 #define HCI_GET_LINK_QUALITY_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_GET_LINK_QUALITY_OFF] & HCI_SUPP_COMMANDS_GET_LINK_QUALITY_MASK)
2344 
2345 #define HCI_SUPP_COMMANDS_READ_RSSI_MASK    0x20
2346 #define HCI_SUPP_COMMANDS_READ_RSSI_OFF     15
2347 #define HCI_READ_RSSI_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_READ_RSSI_OFF] & HCI_SUPP_COMMANDS_READ_RSSI_MASK)
2348 
2349 #define HCI_SUPP_COMMANDS_READ_AFH_CH_MAP_MASK          0x40
2350 #define HCI_SUPP_COMMANDS_READ_AFH_CH_MAP_OFF           15
2351 #define HCI_READ_AFH_CH_MAP_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_AFH_CH_MAP_OFF] & HCI_SUPP_COMMANDS_READ_AFH_CH_MAP_MASK)
2352 
2353 #define HCI_SUPP_COMMANDS_READ_BD_CLOCK_MASK          0x80
2354 #define HCI_SUPP_COMMANDS_READ_BD_CLOCK_OFF           15
2355 #define HCI_READ_BD_CLOCK_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_BD_CLOCK_OFF] & HCI_SUPP_COMMANDS_READ_BD_CLOCK_MASK)
2356 
2357 #define HCI_SUPP_COMMANDS_READ_LOOPBACK_MODE_MASK      0x01
2358 #define HCI_SUPP_COMMANDS_READ_LOOPBACK_MODE_OFF       16
2359 #define HCI_READ_LOOPBACK_MODE_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_READ_LOOPBACK_MODE_OFF] & HCI_SUPP_COMMANDS_READ_LOOPBACK_MODE_MASK)
2360 
2361 #define HCI_SUPP_COMMANDS_WRITE_LOOPBACK_MODE_MASK           0x02
2362 #define HCI_SUPP_COMMANDS_WRITE_LOOPBACK_MODE_OFF            16
2363 #define HCI_WRITE_LOOPBACK_MODE_SUPPORTED(x)           ((x)[HCI_SUPP_COMMANDS_WRITE_LOOPBACK_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_LOOPBACK_MODE_MASK)
2364 
2365 #define HCI_SUPP_COMMANDS_ENABLE_DEV_UNDER_TEST_MASK  0x04
2366 #define HCI_SUPP_COMMANDS_ENABLE_DEV_UNDER_TEST_OFF   16
2367 #define HCI_ENABLE_DEV_UNDER_TEST_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_ENABLE_DEV_UNDER_TEST_OFF] & HCI_SUPP_COMMANDS_ENABLE_DEV_UNDER_TEST_MASK)
2368 
2369 #define HCI_SUPP_COMMANDS_SETUP_SYNCH_CONN_MASK       0x08
2370 #define HCI_SUPP_COMMANDS_SETUP_SYNCH_CONN_OFF        16
2371 #define HCI_SETUP_SYNCH_CONN_SUPPORTED(x)       ((x)[HCI_SUPP_COMMANDS_SETUP_SYNCH_CONN_OFF] & HCI_SUPP_COMMANDS_SETUP_SYNCH_CONN_MASK)
2372 
2373 #define HCI_SUPP_COMMANDS_ACCEPT_SYNCH_CONN_MASK    0x10
2374 #define HCI_SUPP_COMMANDS_ACCEPT_SYNCH_CONN_OFF     16
2375 #define HCI_ACCEPT_SYNCH_CONN_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_ACCEPT_SYNCH_CONN_OFF] & HCI_SUPP_COMMANDS_ACCEPT_SYNCH_CONN_MASK)
2376 
2377 #define HCI_SUPP_COMMANDS_REJECT_SYNCH_CONN_MASK    0x20
2378 #define HCI_SUPP_COMMANDS_REJECT_SYNCH_CONN_OFF     16
2379 #define HCI_REJECT_SYNCH_CONN_SUPPORTED(x)    ((x)[HCI_SUPP_COMMANDS_REJECT_SYNCH_CONN_OFF] & HCI_SUPP_COMMANDS_REJECT_SYNCH_CONN_MASK)
2380 
2381 #define HCI_SUPP_COMMANDS_READ_EXT_INQUIRY_RESP_MASK   0x01
2382 #define HCI_SUPP_COMMANDS_READ_EXT_INQUIRY_RESP_OFF    17
2383 #define HCI_READ_EXT_INQUIRY_RESP_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_EXT_INQUIRY_RESP_OFF] & HCI_SUPP_COMMANDS_READ_EXT_INQUIRY_RESP_MASK)
2384 
2385 #define HCI_SUPP_COMMANDS_WRITE_EXT_INQUIRY_RESP_MASK  0x02
2386 #define HCI_SUPP_COMMANDS_WRITE_EXT_INQUIRY_RESP_OFF   17
2387 #define HCI_WRITE_EXT_INQUIRY_RESP_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_WRITE_EXT_INQUIRY_RESP_OFF] & HCI_SUPP_COMMANDS_WRITE_EXT_INQUIRY_RESP_MASK)
2388 
2389 #define HCI_SUPP_COMMANDS_REFRESH_ENCRYPTION_KEY_MASK   0x04
2390 #define HCI_SUPP_COMMANDS_REFRESH_ENCRYPTION_KEY_OFF    17
2391 #define HCI_REFRESH_ENCRYPTION_KEY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_REFRESH_ENCRYPTION_KEY_OFF] & HCI_SUPP_COMMANDS_REFRESH_ENCRYPTION_KEY_MASK)
2392 
2393 /* Octet 17, bit 3 is reserved */
2394 
2395 #define HCI_SUPP_COMMANDS_SNIFF_SUB_RATE_MASK       0x10
2396 #define HCI_SUPP_COMMANDS_SNIFF_SUB_RATE_OFF        17
2397 #define HCI_SNIFF_SUB_RATE_CMD_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SNIFF_SUB_RATE_OFF] & HCI_SUPP_COMMANDS_SNIFF_SUB_RATE_MASK)
2398 
2399 #define HCI_SUPP_COMMANDS_READ_SIMPLE_PAIRING_MODE_MASK   0x20
2400 #define HCI_SUPP_COMMANDS_READ_SIMPLE_PAIRING_MODE_OFF    17
2401 #define HCI_READ_SIMPLE_PAIRING_MODE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_SIMPLE_PAIRING_MODE_OFF] & HCI_SUPP_COMMANDS_READ_SIMPLE_PAIRING_MODE_MASK)
2402 
2403 #define HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_MODE_MASK   0x40
2404 #define HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_MODE_OFF    17
2405 #define HCI_WRITE_SIMPLE_PAIRING_MODE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_MODE_MASK)
2406 
2407 #define HCI_SUPP_COMMANDS_READ_LOCAL_OOB_DATA_MASK   0x80
2408 #define HCI_SUPP_COMMANDS_READ_LOCAL_OOB_DATA_OFF    17
2409 #define HCI_READ_LOCAL_OOB_DATA_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_OOB_DATA_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_OOB_DATA_MASK)
2410 
2411 #define HCI_SUPP_COMMANDS_READ_INQUIRY_RESPONSE_TX_POWER_MASK   0x01
2412 #define HCI_SUPP_COMMANDS_READ_INQUIRY_RESPONSE_TX_POWER_OFF    18
2413 #define HCI_READ_INQUIRY_RESPONSE_TX_POWER_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_INQUIRY_RESPONSE_TX_POWER_OFF] & HCI_SUPP_COMMANDS_READ_INQUIRY_RESPONSE_TX_POWER_MASK)
2414 
2415 #define HCI_SUPP_COMMANDS_WRITE_INQUIRY_RESPONSE_TX_POWER_MASK   0x02
2416 #define HCI_SUPP_COMMANDS_WRITE_INQUIRY_RESPONSE_TX_POWER_OFF    18
2417 #define HCI_WRITE_INQUIRY_RESPONSE_TX_POWER_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_INQUIRY_RESPONSE_TX_POWER_OFF] & HCI_SUPP_COMMANDS_WRITE_INQUIRY_RESPONSE_TX_POWER_MASK)
2418 
2419 #define HCI_SUPP_COMMANDS_READ_DEFAULT_ERRONEOUS_DATA_REPORTING_MASK   0x04
2420 #define HCI_SUPP_COMMANDS_READ_DEFAULT_ERRONEOUS_DATA_REPORTING_OFF    18
2421 #define HCI_READ_DEFAULT_ERRONEOUS_DATA_REPORTING_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_DEFAULT_ERRONEOUS_DATA_REPORTING_OFF] & HCI_SUPP_COMMANDS_READ_DEFAULT_ERRONEOUS_DATA_REPORTING_MASK)
2422 
2423 #define HCI_SUPP_COMMANDS_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING_MASK   0x08
2424 #define HCI_SUPP_COMMANDS_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING_OFF    18
2425 #define HCI_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING_OFF] & HCI_SUPP_COMMANDS_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING_MASK)
2426 
2427 #define HCI_SUPP_COMMANDS_IO_CAPABILITY_REQUEST_REPLY_MASK   0x80
2428 #define HCI_SUPP_COMMANDS_IO_CAPABILITY_REQUEST_REPLY_OFF    18
2429 #define HCI_IO_CAPABILITY_REQUEST_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_IO_CAPABILITY_REQUEST_REPLY_OFF] & HCI_SUPP_COMMANDS_IO_CAPABILITY_REQUEST_REPLY_MASK)
2430 
2431 #define HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_REPLY_MASK   0x01
2432 #define HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_REPLY_OFF    19
2433 #define HCI_USER_CONFIRMATION_REQUEST_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_REPLY_OFF] & HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_REPLY_MASK)
2434 
2435 #define HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_NEG_REPLY_MASK   0x02
2436 #define HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_NEG_REPLY_OFF    19
2437 #define HCI_USER_CONFIRMATION_REQUEST_NEG_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_NEG_REPLY_OFF] & HCI_SUPP_COMMANDS_USER_CONFIRMATION_REQUEST_NEG_REPLY_MASK)
2438 
2439 #define HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_REPLY_MASK   0x04
2440 #define HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_REPLY_OFF    19
2441 #define HCI_USER_PASSKEY_REQUEST_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_REPLY_OFF] & HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_REPLY_MASK)
2442 
2443 #define HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_NEG_REPLY_MASK   0x08
2444 #define HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_NEG_REPLY_OFF    19
2445 #define HCI_USER_PASSKEY_REQUEST_NEG_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_NEG_REPLY_OFF] & HCI_SUPP_COMMANDS_USER_PASSKEY_REQUEST_NEG_REPLY_MASK)
2446 
2447 #define HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_REPLY_MASK   0x10
2448 #define HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_REPLY_OFF    19
2449 #define HCI_REMOTE_OOB_DATA_REQUEST_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_REPLY_OFF] & HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_REPLY_MASK)
2450 
2451 #define HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_DBG_MODE_MASK       0x20
2452 #define HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_DBG_MODE_OFF        19
2453 #define HCI_WRITE_SIMPLE_PAIRING_DBG_MODE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_DBG_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_SIMPLE_PAIRING_DBG_MODE_MASK)
2454 
2455 #define HCI_SUPP_COMMANDS_ENHANCED_FLUSH_MASK   0x40
2456 #define HCI_SUPP_COMMANDS_ENHANCED_FLUSH_OFF    19
2457 #define HCI_ENHANCED_FLUSH_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_ENHANCED_FLUSH_OFF] & HCI_SUPP_COMMANDS_ENHANCED_FLUSH_MASK)
2458 
2459 #define HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_NEG_REPLY_MASK       0x80
2460 #define HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_NEG_REPLY_OFF        19
2461 #define HCI_REMOTE_OOB_DATA_REQUEST_NEG_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_NEG_REPLY_OFF] & HCI_SUPP_COMMANDS_REMOTE_OOB_DATA_REQUEST_NEG_REPLY_MASK)
2462 
2463 /* Supported Commands (Byte 20) */
2464 #define HCI_SUPP_COMMANDS_SEND_KEYPRESS_NOTIF_MASK       0x04
2465 #define HCI_SUPP_COMMANDS_SEND_KEYPRESS_NOTIF_OFF        20
2466 #define HCI_SEND_NOTIF_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SEND_KEYPRESS_NOTIF_OFF] & HCI_SUPP_COMMANDS_SEND_KEYPRESS_NOTIF_MASK)
2467 
2468 #define HCI_SUPP_COMMANDS_IO_CAP_REQ_NEG_REPLY_MASK      0x08
2469 #define HCI_SUPP_COMMANDS_IO_CAP_REQ_NEG_REPLY_OFF       20
2470 #define HCI_IO_CAP_REQ_NEG_REPLY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_IO_CAP_REQ_NEG_REPLY_OFF] & HCI_SUPP_COMMANDS_IO_CAP_REQ_NEG_REPLY_MASK)
2471 
2472 #define HCI_SUPP_COMMANDS_READ_ENCR_KEY_SIZE_MASK      0x10
2473 #define HCI_SUPP_COMMANDS_READ_ENCR_KEY_SIZE_OFF       20
2474 #define HCI_READ_ENCR_KEY_SIZE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_ENCR_KEY_SIZE_OFF] & HCI_SUPP_COMMANDS_READ_ENCR_KEY_SIZE_MASK)
2475 
2476 /* Supported Commands (Byte 21) */
2477 #define HCI_SUPP_COMMANDS_CREATE_PHYSICAL_LINK_MASK   0x01
2478 #define HCI_SUPP_COMMANDS_CREATE_PHYSICAL_LINK_OFF    21
2479 #define HCI_CREATE_PHYSICAL_LINK_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_CREATE_PHYSICAL_LINK_OFF] & HCI_SUPP_COMMANDS_CREATE_PHYSICAL_LINK_MASK)
2480 
2481 #define HCI_SUPP_COMMANDS_ACCEPT_PHYSICAL_LINK_MASK   0x02
2482 #define HCI_SUPP_COMMANDS_ACCEPT_PHYSICAL_LINK_OFF    21
2483 #define HCI_ACCEPT_PHYSICAL_LINK_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_ACCEPT_PHYSICAL_LINK_OFF] & HCI_SUPP_COMMANDS_ACCEPT_PHYSICAL_LINK_MASK)
2484 
2485 #define HCI_SUPP_COMMANDS_DISCONNECT_PHYSICAL_LINK_MASK   0x04
2486 #define HCI_SUPP_COMMANDS_DISCONNECT_PHYSICAL_LINK_OFF    21
2487 #define HCI_DISCONNECT_PHYSICAL_LINK_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_DISCONNECT_PHYSICAL_LINK_OFF] & HCI_SUPP_COMMANDS_DISCONNECT_PHYSICAL_LINK_MASK)
2488 
2489 #define HCI_SUPP_COMMANDS_CREATE_LOGICAL_LINK_MASK   0x08
2490 #define HCI_SUPP_COMMANDS_CREATE_LOGICAL_LINK_OFF    21
2491 #define HCI_CREATE_LOGICAL_LINK_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_CREATE_LOGICAL_LINK_OFF] & HCI_SUPP_COMMANDS_CREATE_LOGICAL_LINK_MASK)
2492 
2493 #define HCI_SUPP_COMMANDS_ACCEPT_LOGICAL_LINK_MASK   0x10
2494 #define HCI_SUPP_COMMANDS_ACCEPT_LOGICAL_LINK_OFF    21
2495 #define HCI_ACCEPT_LOGICAL_LINK_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_ACCEPT_LOGICAL_LINK_OFF] & HCI_SUPP_COMMANDS_ACCEPT_LOGICAL_LINK_MASK)
2496 
2497 #define HCI_SUPP_COMMANDS_DISCONNECT_LOGICAL_LINK_MASK   0x20
2498 #define HCI_SUPP_COMMANDS_DISCONNECT_LOGICAL_LINK_OFF    21
2499 #define HCI_DISCONNECT_LOGICAL_LINK_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_DISCONNECT_LOGICAL_LINK_OFF] & HCI_SUPP_COMMANDS_DISCONNECT_LOGICAL_LINK_MASK)
2500 
2501 #define HCI_SUPP_COMMANDS_LOGICAL_LINK_CANCEL_MASK   0x40
2502 #define HCI_SUPP_COMMANDS_LOGICAL_LINK_CANCEL_OFF    21
2503 #define HCI_LOGICAL_LINK_CANCEL_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_LOGICAL_LINK_CANCEL_OFF] & HCI_SUPP_COMMANDS_LOGICAL_LINK_CANCEL_MASK)
2504 
2505 #define HCI_SUPP_COMMANDS_FLOW_SPEC_MODIFY_MASK       0x80
2506 #define HCI_SUPP_COMMANDS_FLOW_SPEC_MODIFY_OFF        21
2507 #define HCI_FLOW_SPEC_MODIFY_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_FLOW_SPEC_MODIFY_OFF] & HCI_SUPP_COMMANDS_FLOW_SPEC_MODIFY_MASK)
2508 
2509 /* Supported Commands (Byte 22) */
2510 #define HCI_SUPP_COMMANDS_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_MASK   0x01
2511 #define HCI_SUPP_COMMANDS_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_OFF    22
2512 #define HCI_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_OFF] & HCI_SUPP_COMMANDS_READ_LOGICAL_LINK_ACCEPT_TIMEOUT_MASK)
2513 
2514 #define HCI_SUPP_COMMANDS_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_MASK   0x02
2515 #define HCI_SUPP_COMMANDS_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_OFF    22
2516 #define HCI_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_OFF] & HCI_SUPP_COMMANDS_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_MASK)
2517 
2518 #define HCI_SUPP_COMMANDS_SET_EVENT_MASK_PAGE_2_MASK   0x04
2519 #define HCI_SUPP_COMMANDS_SET_EVENT_MASK_PAGE_2_OFF    22
2520 #define HCI_SET_EVENT_MASK_PAGE_2_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_EVENT_MASK_PAGE_2_OFF] & HCI_SUPP_COMMANDS_SET_EVENT_MASK_PAGE_2_MASK)
2521 
2522 #define HCI_SUPP_COMMANDS_READ_LOCATION_DATA_MASK   0x08
2523 #define HCI_SUPP_COMMANDS_READ_LOCATION_DATA_OFF    22
2524 #define HCI_READ_LOCATION_DATA_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_LOCATION_DATA_OFF] & HCI_SUPP_COMMANDS_READ_LOCATION_DATA_MASK)
2525 
2526 #define HCI_SUPP_COMMANDS_WRITE_LOCATION_DATA_MASK   0x10
2527 #define HCI_SUPP_COMMANDS_WRITE_LOCATION_DATA_OFF    22
2528 #define HCI_WRITE_LOCATION_DATA_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_LOCATION_DATA_OFF] & HCI_SUPP_COMMANDS_WRITE_LOCATION_DATA_MASK)
2529 
2530 #define HCI_SUPP_COMMANDS_READ_LOCAL_AMP_INFO_MASK   0x20
2531 #define HCI_SUPP_COMMANDS_READ_LOCAL_AMP_INFO_OFF    22
2532 #define HCI_READ_LOCAL_AMP_INFO_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_AMP_INFO_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_AMP_INFO_MASK)
2533 
2534 #define HCI_SUPP_COMMANDS_READ_LOCAL_AMP_ASSOC_MASK   0x40
2535 #define HCI_SUPP_COMMANDS_READ_LOCAL_AMP_ASSOC_OFF    22
2536 #define HCI_READ_LOCAL_AMP_ASSOC_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_AMP_ASSOC_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_AMP_ASSOC_MASK)
2537 
2538 #define HCI_SUPP_COMMANDS_WRITE_REMOTE_AMP_ASSOC_MASK   0x80
2539 #define HCI_SUPP_COMMANDS_WRITE_REMOTE_AMP_ASSOC_OFF    22
2540 #define HCI_WRITE_REMOTE_AMP_ASSOC_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_REMOTE_AMP_ASSOC_OFF] & HCI_SUPP_COMMANDS_WRITE_REMOTE_AMP_ASSOC_MASK)
2541 
2542 /* Supported Commands (Byte 23) */
2543 #define HCI_SUPP_COMMANDS_READ_FLOW_CONTROL_MODE_MASK   0x01
2544 #define HCI_SUPP_COMMANDS_READ_FLOW_CONTROL_MODE_OFF    23
2545 #define HCI_READ_FLOW_CONTROL_MODE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_FLOW_CONTROL_MODE_OFF] & HCI_SUPP_COMMANDS_READ_FLOW_CONTROL_MODE_MASK)
2546 
2547 #define HCI_SUPP_COMMANDS_WRITE_FLOW_CONTROL_MODE_MASK   0x02
2548 #define HCI_SUPP_COMMANDS_WRITE_FLOW_CONTROL_MODE_OFF    23
2549 #define HCI_WRITE_FLOW_CONTROL_MODE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_FLOW_CONTROL_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_FLOW_CONTROL_MODE_MASK)
2550 
2551 #define HCI_SUPP_COMMANDS_READ_DATA_BLOCK_SIZE_MASK   0x04
2552 #define HCI_SUPP_COMMANDS_READ_DATA_BLOCK_SIZE_OFF    23
2553 #define HCI_READ_DATA_BLOCK_SIZE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_DATA_BLOCK_SIZE_OFF] & HCI_SUPP_COMMANDS_READ_DATA_BLOCK_SIZE_MASK)
2554 
2555 #define HCI_SUPP_COMMANDS_ENABLE_AMP_RCVR_REPORTS_MASK   0x20
2556 #define HCI_SUPP_COMMANDS_ENABLE_AMP_RCVR_REPORTS_OFF    23
2557 #define HCI_ENABLE_AMP_RCVR_REPORTS_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_ENABLE_AMP_RCVR_REPORTS_OFF] & HCI_SUPP_COMMANDS_ENABLE_AMP_RCVR_REPORTS_MASK)
2558 
2559 #define HCI_SUPP_COMMANDS_AMP_TEST_END_MASK   0x40
2560 #define HCI_SUPP_COMMANDS_AMP_TEST_END_OFF    23
2561 #define HCI_AMP_TEST_END_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_AMP_TEST_END_OFF] & HCI_SUPP_COMMANDS_AMP_TEST_END_MASK)
2562 
2563 #define HCI_SUPP_COMMANDS_AMP_TEST_MASK   0x80
2564 #define HCI_SUPP_COMMANDS_AMP_TEST_OFF    23
2565 #define HCI_AMP_TEST_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_AMP_TEST_OFF] & HCI_SUPP_COMMANDS_AMP_TEST_MASK)
2566 
2567 /* Supported Commands (Byte 24) */
2568 #define HCI_SUPP_COMMANDS_READ_TRANSMIT_POWER_LEVEL_MASK   0x01
2569 #define HCI_SUPP_COMMANDS_READ_TRANSMIT_POWER_LEVEL_OFF    24
2570 #define HCI_READ_TRANSMIT_POWER_LEVEL_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_TRANSMIT_POWER_LEVEL_OFF] & HCI_SUPP_COMMANDS_READ_TRANSMIT_POWER_LEVEL_MASK)
2571 
2572 #define HCI_SUPP_COMMANDS_READ_BE_FLUSH_TOUT_MASK   0x04
2573 #define HCI_SUPP_COMMANDS_READ_BE_FLUSH_TOUT_OFF    24
2574 #define HCI_READ_BE_FLUSH_TOUT_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_BE_FLUSH_TOUT_OFF] & HCI_SUPP_COMMANDS_READ_BE_FLUSH_TOUT_MASK)
2575 
2576 #define HCI_SUPP_COMMANDS_WRITE_BE_FLUSH_TOUT_MASK   0x08
2577 #define HCI_SUPP_COMMANDS_WRITE_BE_FLUSH_TOUT_OFF    24
2578 #define HCI_WRITE_BE_FLUSH_TOUT_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_BE_FLUSH_TOUT_OFF] & HCI_SUPP_COMMANDS_WRITE_BE_FLUSH_TOUT_MASK)
2579 
2580 #define HCI_SUPP_COMMANDS_SHORT_RANGE_MODE_MASK   0x10
2581 #define HCI_SUPP_COMMANDS_SHORT_RANGE_MODE_OFF    24
2582 #define HCI_SHORT_RANGE_MODE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SHORT_RANGE_MODE_OFF] & HCI_SUPP_COMMANDS_SHORT_RANGE_MODE_MASK)
2583 
2584 /* LE commands TBD
2585 ** Supported Commands (Byte 24 continued)
2586 ** Supported Commands (Byte 25)
2587 ** Supported Commands (Byte 26)
2588 ** Supported Commands (Byte 27)
2589 ** Supported Commands (Byte 28)
2590 */
2591 
2592 /* Supported Commands (Byte 29) */
2593 #define HCI_SUPP_COMMANDS_ENH_SETUP_SYNCH_CONN_MASK     0x08
2594 #define HCI_SUPP_COMMANDS_ENH_SETUP_SYNCH_CONN_OFF      29
2595 #define HCI_READ_ENH_SETUP_SYNCH_CONN_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_ENH_SETUP_SYNCH_CONN_OFF] & HCI_SUPP_COMMANDS_ENH_SETUP_SYNCH_CONN_MASK)
2596 
2597 #define HCI_SUPP_COMMANDS_ENH_ACCEPT_SYNCH_CONN_MASK    0x10
2598 #define HCI_SUPP_COMMANDS_ENH_ACCEPT_SYNCH_CONN_OFF     29
2599 #define HCI_READ_ENH_ACCEPT_SYNCH_CONN_SUPPORTED(x)     ((x)[HCI_SUPP_COMMANDS_ENH_ACCEPT_SYNCH_CONN_OFF] & HCI_SUPP_COMMANDS_ENH_ACCEPT_SYNCH_CONN_MASK)
2600 
2601 #define HCI_SUPP_COMMANDS_READ_LOCAL_CODECS_MASK        0x20
2602 #define HCI_SUPP_COMMANDS_READ_LOCAL_CODECS_OFF         29
2603 #define HCI_READ_LOCAL_CODECS_SUPPORTED(x)              ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_CODECS_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_CODECS_MASK)
2604 
2605 #define HCI_SUPP_COMMANDS_SET_MWS_CHANN_PARAM_MASK      0x40
2606 #define HCI_SUPP_COMMANDS_SET_MWS_CHANN_PARAM_OFF       29
2607 #define HCI_SET_MWS_CHANNEL_PARAMETERS_SUPPORTED(x)     ((x)[HCI_SUPP_COMMANDS_SET_MWS_CHANN_PARAM_OFF] & HCI_SUPP_COMMANDS_SET_MWS_CHANN_PARAM_MASK)
2608 
2609 #define HCI_SUPP_COMMANDS_SET_EXT_FRAME_CONF_MASK       0x80
2610 #define HCI_SUPP_COMMANDS_SET_EXT_FRAME_CONF_OFF        29
2611 #define HCI_SET_EXTERNAL_FRAME_CONFIGURATION_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_EXT_FRAME_CONF_OFF] & HCI_SUPP_COMMANDS_SET_EXT_FRAME_CONF_MASK)
2612 
2613 
2614 /* Supported Commands (Byte 30) */
2615 #define HCI_SUPP_COMMANDS_SET_MWS_SIGNALING_MASK     0x01
2616 #define HCI_SUPP_COMMANDS_SET_MWS_SIGNALING_OFF      30
2617 #define HCI_SET_MWS_SIGNALING_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_MWS_SIGNALING_OFF] & HCI_SUPP_COMMANDS_SET_MWS_SIGNALING_MASK)
2618 
2619 #define HCI_SUPP_COMMANDS_SET_MWS_TRANS_LAYER_MASK   0x02
2620 #define HCI_SUPP_COMMANDS_SET_MWS_TRANS_LAYER_OFF    30
2621 #define HCI_SET_MWS_TRANSPORT_LAYER_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_MWS_TRANS_LAYER_OFF] & HCI_SUPP_COMMANDS_SET_MWS_TRANS_LAYER_MASK)
2622 
2623 #define HCI_SUPP_COMMANDS_SET_MWS_SCAN_FREQ_TABLE_MASK   0x04
2624 #define HCI_SUPP_COMMANDS_SET_MWS_SCAN_FREQ_TABLE_OFF    30
2625 #define HCI_SET_MWS_SCAN_FREQUENCY_TABLE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_MWS_SCAN_FREQ_TABLE_OFF] & HCI_SUPP_COMMANDS_SET_MWS_SCAN_FREQ_TABLE_MASK)
2626 
2627 #define HCI_SUPP_COMMANDS_GET_TRANS_LAYER_CONF_MASK      0x08
2628 #define HCI_SUPP_COMMANDS_GET_TRANS_LAYER_CONF_OFF    30
2629 #define HCI_GET_MWS_TRANS_LAYER_CFG_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_GET_TRANS_LAYER_CONF_OFF] & HCI_SUPP_COMMANDS_GET_TRANS_LAYER_CONF_MASK)
2630 
2631 #define HCI_SUPP_COMMANDS_SET_MWS_PATTERN_CONF_MASK      0x10
2632 #define HCI_SUPP_COMMANDS_SET_MWS_PATTERN_CONF_OFF       30
2633 #define HCI_SET_MWS_PATTERN_CONFIGURATION_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_MWS_PATTERN_CONF_OFF] & HCI_SUPP_COMMANDS_SET_MWS_PATTERN_CONF_MASK)
2634 
2635 /* Supported Commands (Byte 30 bit 5) */
2636 #define HCI_SUPP_COMMANDS_SET_TRIG_CLK_CAP_MASK         0x20
2637 #define HCI_SUPP_COMMANDS_SET_TRIG_CLK_CAP_OFF          30
2638 #define HCI_SET_TRIG_CLK_CAP_SUPPORTED(x)               ((x)[HCI_SUPP_COMMANDS_SET_TRIG_CLK_CAP_OFF] & HCI_SUPP_COMMANDS_SET_TRIG_CLK_CAP_MASK)
2639 
2640 
2641 /* Supported Commands (Byte 30 bit 6-7) */
2642 #define HCI_SUPP_COMMANDS_TRUNCATED_PAGE             0x06
2643 #define HCI_SUPP_COMMANDS_TRUNCATED_PAGE_OFF         30
2644 #define HCI_TRUNCATED_PAGE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_TRUNCATED_PAGE_OFF] & HCI_SUPP_COMMANDS_TRUNCATED_PAGE)
2645 
2646 #define HCI_SUPP_COMMANDS_TRUNCATED_PAGE_CANCEL             0x07
2647 #define HCI_SUPP_COMMANDS_TRUNCATED_PAGE_CANCEL_OFF         30
2648 #define HCI_TRUNCATED_PAGE_CANCEL_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_TRUNCATED_PAGE_CANCEL_OFF] & HCI_SUPP_COMMANDS_TRUNCATED_PAGE_CANCEL)
2649 
2650 /* Supported Commands (Byte 31 bit 6-7) */
2651 #define HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST             0x00
2652 #define HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_OFF         31
2653 #define HCI_SET_CONLESS_SLAVE_BRCST_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_OFF] & HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST)
2654 
2655 #define HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_RECEIVE             0x01
2656 #define HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_RECEIVE_OFF         31
2657 #define HCI_SET_CONLESS_SLAVE_BRCST_RECEIVE_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_RECEIVE_OFF] & HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_RECEIVE)
2658 
2659 #define HCI_SUPP_COMMANDS_START_SYNC_TRAIN             0x02
2660 #define HCI_SUPP_COMMANDS_START_SYNC_TRAIN_OFF         31
2661 #define HCI_START_SYNC_TRAIN_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_START_SYNC_TRAIN_OFF] & HCI_SUPP_COMMANDS_START_SYNC_TRAIN)
2662 
2663 #define HCI_SUPP_COMMANDS_RECEIVE_SYNC_TRAIN             0x03
2664 #define HCI_SUPP_COMMANDS_RECEIVE_SYNC_TRAIN_OFF         31
2665 #define HCI_RECEIVE_SYNC_TRAIN_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_RECEIVE_SYNC_TRAIN_OFF] & HCI_SUPP_COMMANDS_RECEIVE_SYNC_TRAIN)
2666 
2667 #define HCI_SUPP_COMMANDS_SET_RESERVED_LT_ADDR             0x04
2668 #define HCI_SUPP_COMMANDS_SET_RESERVED_LT_ADDR_OFF         31
2669 #define HCI_SET_RESERVED_LT_ADDR_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_RESERVED_LT_ADDR_OFF] & HCI_SUPP_COMMANDS_SET_RESERVED_LT_ADDR)
2670 
2671 #define HCI_SUPP_COMMANDS_DELETE_RESERVED_LT_ADDR             0x05
2672 #define HCI_SUPP_COMMANDS_DELETE_RESERVED_LT_ADDR_OFF         31
2673 #define HCI_DELETE_RESERVED_LT_ADDR_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_DELETE_RESERVED_LT_ADDR_OFF] & HCI_SUPP_COMMANDS_DELETE_RESERVED_LT_ADDR)
2674 
2675 #define HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_DATA             0x06
2676 #define HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_DATA_OFF         31
2677 #define HCI_SET_CONLESS_SLAVE_BRCST_DATA_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_DATA_OFF] & HCI_SUPP_COMMANDS_SET_CONLESS_SLAVE_BRCST_DATA)
2678 
2679 #define HCI_SUPP_COMMANDS_READ_SYNC_TRAIN_PARAM             0x07
2680 #define HCI_SUPP_COMMANDS_READ_SYNC_TRAIN_PARAM_OFF         31
2681 #define HCI_READ_SYNC_TRAIN_PARAM_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_SYNC_TRAIN_PARAM_OFF] & HCI_SUPP_COMMANDS_READ_SYNC_TRAIN_PARAM)
2682 
2683 /* Supported Commands (Byte 32 bit 0) */
2684 #define HCI_SUPP_COMMANDS_WRITE_SYNC_TRAIN_PARAM             0x00
2685 #define HCI_SUPP_COMMANDS_WRITE_SYNC_TRAIN_PARAM_OFF         32
2686 #define HCI_WRITE_SYNC_TRAIN_PARAM_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_WRITE_SYNC_TRAIN_PARAM_OFF] & HCI_SUPP_COMMANDS_WRITE_SYNC_TRAIN_PARAM)
2687 
2688 #define HCI_SUPP_COMMANDS_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY_MASK   0x02
2689 #define HCI_SUPP_COMMANDS_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY_OFF    32
2690 #define HCI_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY_SUPPORTED(x) ((x)[HCI_SUPP_COMMANDS_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY_OFF] & HCI_SUPP_COMMANDS_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY_MASK)
2691 
2692 #define HCI_SUPP_COMMANDS_READ_SECURE_CONNS_SUPPORT_MASK    0x04
2693 #define HCI_SUPP_COMMANDS_READ_SECURE_CONNS_SUPPORT_OFF     32
2694 #define HCI_READ_SECURE_CONNS_SUPPORT_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_SECURE_CONNS_SUPPORT_OFF] & HCI_SUPP_COMMANDS_READ_SECURE_CONNS_SUPPORT_MASK)
2695 
2696 #define HCI_SUPP_COMMANDS_WRITE_SECURE_CONNS_SUPPORT_MASK   0x08
2697 #define HCI_SUPP_COMMANDS_WRITE_SECURE_CONNS_SUPPORT_OFF    32
2698 #define HCI_WRITE_SECURE_CONNS_SUPPORT_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_WRITE_SECURE_CONNS_SUPPORT_OFF] & HCI_SUPP_COMMANDS_WRITE_SECURE_CONNS_SUPPORT_MASK)
2699 
2700 #define HCI_SUPP_COMMANDS_READ_AUTHENT_PAYLOAD_TOUT_MASK    0x10
2701 #define HCI_SUPP_COMMANDS_READ_AUTHENT_PAYLOAD_TOUT_OFF     32
2702 #define HCI_READ_AUTHENT_PAYLOAD_TOUT_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_AUTHENT_PAYLOAD_TOUT_OFF] & HCI_SUPP_COMMANDS_READ_AUTHENT_PAYLOAD_TOUT_MASK)
2703 
2704 #define HCI_SUPP_COMMANDS_WRITE_AUTHENT_PAYLOAD_TOUT_MASK   0x20
2705 #define HCI_SUPP_COMMANDS_WRITE_AUTHENT_PAYLOAD_TOUT_OFF    32
2706 #define HCI_WRITE_AUTHENT_PAYLOAD_TOUT_SUPPORTED(x)  ((x)[HCI_SUPP_COMMANDS_WRITE_AUTHENT_PAYLOAD_TOUT_OFF] & HCI_SUPP_COMMANDS_WRITE_AUTHENT_PAYLOAD_TOUT_MASK)
2707 
2708 #define HCI_SUPP_COMMANDS_READ_LOCAL_OOB_EXTENDED_DATA_MASK 0x40
2709 #define HCI_SUPP_COMMANDS_READ_LOCAL_OOB_EXTENDED_DATA_OFF  32
2710 #define HCI_READ_LOCAL_OOB_EXTENDED_DATA_SUPPORTED(x)   ((x)[HCI_SUPP_COMMANDS_READ_LOCAL_OOB_EXTENDED_DATA_OFF] & HCI_SUPP_COMMANDS_READ_LOCAL_OOB_EXTENDED_DATA_MASK)
2711 
2712 #define HCI_SUPP_COMMANDS_WRITE_SECURE_CONNECTIONS_TEST_MODE_MASK   0x80
2713 #define HCI_SUPP_COMMANDS_WRITE_SECURE_CONNECTIONS_TEST_MODE_OFF    32
2714 #define HCI_WRITE_SECURE_CONNECTIONS_TEST_MODE_SUPPORTED(x) ((x)[HCI_SUPP_COMMANDS_WRITE_SECURE_CONNECTIONS_TEST_MODE_OFF] & HCI_SUPP_COMMANDS_WRITE_SECURE_CONNECTIONS_TEST_MODE_MASK)
2715 
2716 /* supported LE remote control connection parameter request reply */
2717 #define HCI_SUPP_COMMANDS_LE_RC_CONN_PARAM_UPD_RPY_MASK          0x10
2718 #define HCI_SUPP_COMMANDS_LE_RC_CONN_PARAM_UPD_RPY_OFF           33
2719 #define HCI_LE_RC_CONN_PARAM_UPD_RPY_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_LE_RC_CONN_PARAM_UPD_RPY_OFF] & HCI_SUPP_COMMANDS_LE_RC_CONN_PARAM_UPD_RPY_MASK)
2720 
2721 #define HCI_SUPP_COMMANDS_RLE_RC_CONN_PARAM_UPD_NEG_RPY_MASK          0x20
2722 #define HCI_SUPP_COMMANDS_LE_RC_CONN_PARAM_UPD_NEG_RPY_OFF           33
2723 #define HCI_LE_RC_CONN_PARAM_UPD_NEG_RPY_SUPPORTED(x)      ((x)[HCI_SUPP_COMMANDS_LE_RC_CONN_PARAM_UPD_NEG_RPY_OFF] & HCI_SUPP_COMMANDS_RLE_RC_CONN_PARAM_UPD_NEG_RPY_MASK)
2724 
2725 #endif
2726