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