This source file includes following definitions.
- hci_cmd_hdr_t
- hci_acldata_hdr_t
- hci_scodata_hdr_t
- hci_event_hdr_t
- hci_status_rp
- hci_inquiry_cp
- hci_periodic_inquiry_cp
- hci_create_con_cp
- hci_discon_cp
- hci_add_sco_con_cp
- hci_create_con_cancel_cp
- hci_create_con_cancel_rp
- hci_accept_con_cp
- hci_reject_con_cp
- hci_link_key_rep_cp
- hci_link_key_rep_rp
- hci_link_key_neg_rep_cp
- hci_link_key_neg_rep_rp
- hci_pin_code_rep_cp
- hci_pin_code_rep_rp
- hci_pin_code_neg_rep_cp
- hci_pin_code_neg_rep_rp
- hci_change_con_pkt_type_cp
- hci_auth_req_cp
- hci_set_con_encryption_cp
- hci_change_con_link_key_cp
- hci_master_link_key_cp
- hci_remote_name_req_cp
- hci_remote_name_req_cancel_cp
- hci_remote_name_req_cancel_rp
- hci_read_remote_features_cp
- hci_read_remote_extended_features_cp
- hci_read_remote_ver_info_cp
- hci_read_clock_offset_cp
- hci_read_lmp_handle_cp
- hci_read_lmp_handle_rp
- hci_setup_sco_con_cp
- hci_accept_sco_con_req_cp
- hci_reject_sco_con_req_cp
- hci_hold_mode_cp
- hci_sniff_mode_cp
- hci_exit_sniff_mode_cp
- hci_park_mode_cp
- hci_exit_park_mode_cp
- hci_qos_setup_cp
- hci_role_discovery_cp
- hci_role_discovery_rp
- hci_switch_role_cp
- hci_read_link_policy_settings_cp
- hci_read_link_policy_settings_rp
- hci_write_link_policy_settings_cp
- hci_write_link_policy_settings_rp
- hci_read_default_link_policy_settings_rp
- hci_write_default_link_policy_settings_cp
- hci_flow_specification_cp
- hci_set_event_mask_cp
- hci_set_event_filter_cp
- hci_flush_cp
- hci_flush_rp
- hci_read_pin_type_rp
- hci_write_pin_type_cp
- hci_read_stored_link_key_cp
- hci_read_stored_link_key_rp
- hci_write_stored_link_key_cp
- hci_write_stored_link_key_rp
- hci_delete_stored_link_key_cp
- hci_delete_stored_link_key_rp
- hci_write_local_name_cp
- hci_read_local_name_rp
- hci_read_con_accept_timeout_rp
- hci_write_con_accept_timeout_cp
- hci_read_page_timeout_rp
- hci_write_page_timeout_cp
- hci_read_scan_enable_rp
- hci_write_scan_enable_cp
- hci_read_page_scan_activity_rp
- hci_write_page_scan_activity_cp
- hci_read_inquiry_scan_activity_rp
- hci_write_inquiry_scan_activity_cp
- hci_read_auth_enable_rp
- hci_write_auth_enable_cp
- hci_read_encryption_mode_rp
- hci_write_encryption_mode_cp
- hci_read_unit_class_rp
- hci_write_unit_class_cp
- hci_read_voice_setting_rp
- hci_write_voice_setting_cp
- hci_read_auto_flush_timeout_cp
- hci_read_auto_flush_timeout_rp
- hci_write_auto_flush_timeout_cp
- hci_write_auto_flush_timeout_rp
- hci_read_num_broadcast_retrans_rp
- hci_write_num_broadcast_retrans_cp
- hci_read_hold_mode_activity_rp
- hci_write_hold_mode_activity_cp
- hci_read_xmit_level_cp
- hci_read_xmit_level_rp
- hci_read_sco_flow_control_rp
- hci_write_sco_flow_control_cp
- hci_hc2h_flow_control_cp
- hci_host_buffer_size_cp
- hci_host_num_compl_pkts_cp
- hci_read_link_supervision_timeout_cp
- hci_read_link_supervision_timeout_rp
- hci_write_link_supervision_timeout_cp
- hci_write_link_supervision_timeout_rp
- hci_read_num_supported_iac_rp
- hci_read_iac_lap_rp
- hci_write_iac_lap_cp
- hci_read_page_scan_period_rp
- hci_write_page_scan_period_cp
- hci_read_page_scan_rp
- hci_write_page_scan_cp
- hci_set_afh_classification_cp
- hci_read_inquiry_scan_type_rp
- hci_write_inquiry_scan_type_cp
- hci_read_inquiry_mode_rp
- hci_write_inquiry_mode_cp
- hci_read_page_scan_type_rp
- hci_write_page_scan_type_cp
- hci_read_afh_assessment_rp
- hci_write_afh_assessment_cp
- hci_read_local_ver_rp
- hci_read_local_commands_rp
- hci_read_local_features_rp
- hci_read_local_extended_features_cp
- hci_read_local_extended_features_rp
- hci_read_buffer_size_rp
- hci_read_country_code_rp
- hci_read_bdaddr_rp
- hci_read_failed_contact_cntr_cp
- hci_read_failed_contact_cntr_rp
- hci_reset_failed_contact_cntr_cp
- hci_reset_failed_contact_cntr_rp
- hci_read_link_quality_cp
- hci_read_link_quality_rp
- hci_read_rssi_cp
- hci_read_rssi_rp
- hci_read_afh_channel_map_cp
- hci_read_afh_channel_map_rp
- hci_read_clock_cp
- hci_read_clock_rp
- hci_read_loopback_mode_rp
- hci_write_loopback_mode_cp
- hci_inquiry_compl_ep
- hci_inquiry_result_ep
- hci_inquiry_response
- hci_con_compl_ep
- hci_con_req_ep
- hci_discon_compl_ep
- hci_auth_compl_ep
- hci_remote_name_req_compl_ep
- hci_encryption_change_ep
- hci_change_con_link_key_compl_ep
- hci_master_link_key_compl_ep
- hci_read_remote_features_compl_ep
- hci_read_remote_ver_info_compl_ep
- hci_qos_setup_compl_ep
- hci_command_compl_ep
- hci_command_status_ep
- hci_hardware_error_ep
- hci_flush_occur_ep
- hci_role_change_ep
- hci_num_compl_pkts_ep
- hci_mode_change_ep
- hci_return_link_keys_ep
- hci_pin_code_req_ep
- hci_link_key_req_ep
- hci_link_key_notification_ep
- hci_data_buffer_overflow_ep
- hci_max_slot_change_ep
- hci_read_clock_offset_compl_ep
- hci_con_pkt_type_changed_ep
- hci_qos_violation_ep
- hci_page_scan_mode_change_ep
- hci_page_scan_rep_mode_change_ep
- hci_flow_specification_compl_ep
- hci_rssi_result_ep
- hci_rssi_response_ep
- hci_read_remote_extended_features_ep
- hci_sco_con_compl_ep
- hci_sco_con_changed_ep
- hci_filter_set
- hci_filter_clr
- hci_filter_test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 #ifndef _NETBT_HCI_H_
76 #define _NETBT_HCI_H_
77
78 #include <netbt/bluetooth.h>
79
80
81
82
83
84
85
86 #define HCI_LAP_SIZE 3
87 #define HCI_KEY_SIZE 16
88 #define HCI_PIN_SIZE 16
89 #define HCI_EVENT_MASK_SIZE 8
90 #define HCI_CLASS_SIZE 3
91 #define HCI_FEATURES_SIZE 8
92 #define HCI_UNIT_NAME_SIZE 248
93 #define HCI_DEVNAME_SIZE 16
94
95
96 #define HCI_SPEC_V10 0x00
97 #define HCI_SPEC_V11 0x01
98 #define HCI_SPEC_V12 0x02
99 #define HCI_SPEC_V20 0x03
100
101
102
103
104 #define HCI_LMP_3SLOT 0x01
105 #define HCI_LMP_5SLOT 0x02
106 #define HCI_LMP_ENCRYPTION 0x04
107 #define HCI_LMP_SLOT_OFFSET 0x08
108 #define HCI_LMP_TIMIACCURACY 0x10
109 #define HCI_LMP_ROLE_SWITCH 0x20
110 #define HCI_LMP_HOLD_MODE 0x40
111 #define HCI_LMP_SNIFF_MODE 0x80
112
113 #define HCI_LMP_PARK_MODE 0x01
114 #define HCI_LMP_RSSI 0x02
115 #define HCI_LMP_CHANNEL_QUALITY 0x04
116 #define HCI_LMP_SCO_LINK 0x08
117 #define HCI_LMP_HV2_PKT 0x10
118 #define HCI_LMP_HV3_PKT 0x20
119 #define HCI_LMP_ULAW_LOG 0x40
120 #define HCI_LMP_ALAW_LOG 0x80
121
122 #define HCI_LMP_CVSD 0x01
123 #define HCI_LMP_PAGISCHEME 0x02
124 #define HCI_LMP_POWER_CONTROL 0x04
125 #define HCI_LMP_TRANSPARENT_SCO 0x08
126 #define HCI_LMP_FLOW_CONTROL_LAG0 0x10
127 #define HCI_LMP_FLOW_CONTROL_LAG1 0x20
128 #define HCI_LMP_FLOW_CONTROL_LAG2 0x40
129 #define HCI_LMP_BC_ENCRYPTION 0x80
130
131
132 #define HCI_LMP_EDR_ACL_2MBPS 0x02
133 #define HCI_LMP_EDR_ACL_3MBPS 0x04
134 #define HCI_LMP_ENHANCED_ISCAN 0x08
135 #define HCI_LMP_INTERLACED_ISCAN 0x10
136 #define HCI_LMP_INTERLACED_PSCAN 0x20
137 #define HCI_LMP_RSSI_INQUIRY 0x40
138 #define HCI_LMP_EV3_PKT 0x80
139
140 #define HCI_LMP_EV4_PKT 0x01
141 #define HCI_LMP_EV5_PKT 0x02
142
143 #define HCI_LMP_AFH_CAPABLE_SLAVE 0x08
144 #define HCI_LMP_AFH_CLASS_SLAVE 0x10
145
146
147 #define HCI_LMP_3SLOT_EDR_ACL 0x80
148
149 #define HCI_LMP_5SLOT_EDR_ACL 0x01
150
151
152 #define HCI_LMP_AFH_CAPABLE_MASTER 0x08
153 #define HCI_LMP_AFH_CLASS_MASTER 0x10
154 #define HCI_LMP_EDR_eSCO_2MBPS 0x20
155 #define HCI_LMP_EDR_eSCO_3MBPS 0x40
156 #define HCI_LMP_3SLOT_EDR_eSCO 0x80
157
158
159
160 #define HCI_LMP_EXTENDED_FEATURES 0x80
161
162
163 #define HCI_LINK_SCO 0x00
164 #define HCI_LINK_ACL 0x01
165 #define HCI_LINK_eSCO 0x02
166
167
168
169
170
171
172
173
174 #define HCI_PKT_2MBPS_DH1 0x0002
175 #define HCI_PKT_3MBPS_DH1 0x0004
176 #define HCI_PKT_DM1 0x0008
177 #define HCI_PKT_DH1 0x0010
178 #define HCI_PKT_2MBPS_DH3 0x0100
179 #define HCI_PKT_3MBPS_DH3 0x0200
180 #define HCI_PKT_DM3 0x0400
181 #define HCI_PKT_DH3 0x0800
182 #define HCI_PKT_2MBPS_DH5 0x1000
183 #define HCI_PKT_3MBPS_DH5 0x2000
184 #define HCI_PKT_DM5 0x4000
185 #define HCI_PKT_DH5 0x8000
186
187
188 #define HCI_PKT_HV1 0x0001
189 #define HCI_PKT_HV2 0x0002
190 #define HCI_PKT_HV3 0x0004
191 #define HCI_PKT_EV3 0x0008
192 #define HCI_PKT_EV4 0x0010
193 #define HCI_PKT_EV5 0x0020
194 #define HCI_PKT_2MBPS_EV3 0x0040
195 #define HCI_PKT_3MBPS_EV3 0x0080
196 #define HCI_PKT_2MBPS_EV5 0x0100
197 #define HCI_PKT_3MBPS_EV5 0x0200
198
199
200
201
202
203
204
205
206
207
208 #define HCI_MANDATORY_PAGE_SCAN_MODE 0x00
209 #define HCI_OPTIONAL_PAGE_SCAN_MODE1 0x01
210 #define HCI_OPTIONAL_PAGE_SCAN_MODE2 0x02
211 #define HCI_OPTIONAL_PAGE_SCAN_MODE3 0x03
212
213
214
215 #define HCI_SCAN_REP_MODE0 0x00
216 #define HCI_SCAN_REP_MODE1 0x01
217 #define HCI_SCAN_REP_MODE2 0x02
218
219
220
221 #define HCI_PAGE_SCAN_PERIOD_MODE0 0x00
222 #define HCI_PAGE_SCAN_PERIOD_MODE1 0x01
223 #define HCI_PAGE_SCAN_PERIOD_MODE2 0x02
224
225
226
227 #define HCI_NO_SCAN_ENABLE 0x00
228 #define HCI_INQUIRY_SCAN_ENABLE 0x01
229 #define HCI_PAGE_SCAN_ENABLE 0x02
230
231
232
233 #define HCI_HOLD_MODE_NO_CHANGE 0x00
234 #define HCI_HOLD_MODE_SUSPEND_PAGE_SCAN 0x01
235 #define HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN 0x02
236 #define HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY 0x04
237
238
239
240 #define HCI_ROLE_MASTER 0x00
241 #define HCI_ROLE_SLAVE 0x01
242
243
244
245 #define HCI_USE_SEMI_PERMANENT_LINK_KEYS 0x00
246 #define HCI_USE_TEMPORARY_LINK_KEY 0x01
247
248
249
250 #define HCI_PIN_TYPE_VARIABLE 0x00
251 #define HCI_PIN_TYPE_FIXED 0x01
252
253
254 #define HCI_LINK_KEY_TYPE_COMBINATION_KEY 0x00
255 #define HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY 0x01
256 #define HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY 0x02
257
258
259
260 #define HCI_ENCRYPTION_MODE_NONE 0x00
261 #define HCI_ENCRYPTION_MODE_P2P 0x01
262 #define HCI_ENCRYPTION_MODE_ALL 0x02
263
264
265
266 #define HCI_SERVICE_TYPE_NO_TRAFFIC 0x00
267 #define HCI_SERVICE_TYPE_BEST_EFFORT 0x01
268 #define HCI_SERVICE_TYPE_GUARANTEED 0x02
269
270
271
272 #define HCI_LINK_POLICY_DISABLE_ALL_LM_MODES 0x0000
273 #define HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001
274 #define HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002
275 #define HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004
276 #define HCI_LINK_POLICY_ENABLE_PARK_MODE 0x0008
277
278
279
280 #define HCI_EVMSK_ALL 0x00000000ffffffff
281 #define HCI_EVMSK_NONE 0x0000000000000000
282 #define HCI_EVMSK_INQUIRY_COMPL 0x0000000000000001
283 #define HCI_EVMSK_INQUIRY_RESULT 0x0000000000000002
284 #define HCI_EVMSK_CON_COMPL 0x0000000000000004
285 #define HCI_EVMSK_CON_REQ 0x0000000000000008
286 #define HCI_EVMSK_DISCON_COMPL 0x0000000000000010
287 #define HCI_EVMSK_AUTH_COMPL 0x0000000000000020
288 #define HCI_EVMSK_REMOTE_NAME_REQ_COMPL 0x0000000000000040
289 #define HCI_EVMSK_ENCRYPTION_CHANGE 0x0000000000000080
290 #define HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL 0x0000000000000100
291 #define HCI_EVMSK_MASTER_LINK_KEY_COMPL 0x0000000000000200
292 #define HCI_EVMSK_READ_REMOTE_FEATURES_COMPL 0x0000000000000400
293 #define HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL 0x0000000000000800
294 #define HCI_EVMSK_QOS_SETUP_COMPL 0x0000000000001000
295 #define HCI_EVMSK_COMMAND_COMPL 0x0000000000002000
296 #define HCI_EVMSK_COMMAND_STATUS 0x0000000000004000
297 #define HCI_EVMSK_HARDWARE_ERROR 0x0000000000008000
298 #define HCI_EVMSK_FLUSH_OCCUR 0x0000000000010000
299 #define HCI_EVMSK_ROLE_CHANGE 0x0000000000020000
300 #define HCI_EVMSK_NUM_COMPL_PKTS 0x0000000000040000
301 #define HCI_EVMSK_MODE_CHANGE 0x0000000000080000
302 #define HCI_EVMSK_RETURN_LINK_KEYS 0x0000000000100000
303 #define HCI_EVMSK_PIN_CODE_REQ 0x0000000000200000
304 #define HCI_EVMSK_LINK_KEY_REQ 0x0000000000400000
305 #define HCI_EVMSK_LINK_KEY_NOTIFICATION 0x0000000000800000
306 #define HCI_EVMSK_LOOPBACK_COMMAND 0x0000000001000000
307 #define HCI_EVMSK_DATA_BUFFER_OVERFLOW 0x0000000002000000
308 #define HCI_EVMSK_MAX_SLOT_CHANGE 0x0000000004000000
309 #define HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE 0x0000000008000000
310 #define HCI_EVMSK_CON_PKT_TYPE_CHANGED 0x0000000010000000
311 #define HCI_EVMSK_QOS_VIOLATION 0x0000000020000000
312 #define HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x0000000040000000
313 #define HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x0000000080000000
314
315
316
317 #define HCI_FILTER_TYPE_NONE 0x00
318 #define HCI_FILTER_TYPE_INQUIRY_RESULT 0x01
319 #define HCI_FILTER_TYPE_CON_SETUP 0x02
320
321
322
323 #define HCI_FILTER_COND_INQUIRY_NEW_UNIT 0x00
324 #define HCI_FILTER_COND_INQUIRY_UNIT_CLASS 0x01
325 #define HCI_FILTER_COND_INQUIRY_BDADDR 0x02
326
327
328
329 #define HCI_FILTER_COND_CON_ANY_UNIT 0x00
330 #define HCI_FILTER_COND_CON_UNIT_CLASS 0x01
331 #define HCI_FILTER_COND_CON_BDADDR 0x02
332
333
334
335 #define HCI_XMIT_LEVEL_CURRENT 0x00
336 #define HCI_XMIT_LEVEL_MAXIMUM 0x01
337
338
339
340 #define HCI_HC2H_FLOW_CONTROL_NONE 0x00
341 #define HCI_HC2H_FLOW_CONTROL_ACL 0x01
342 #define HCI_HC2H_FLOW_CONTROL_SCO 0x02
343 #define HCI_HC2H_FLOW_CONTROL_BOTH 0x03
344
345
346
347 #define HCI_LOOPBACK_NONE 0x00
348 #define HCI_LOOPBACK_LOCAL 0x01
349 #define HCI_LOOPBACK_REMOTE 0x02
350
351
352
353
354
355
356
357
358
359
360
361
362
363 #define HCI_OPCODE(gf,cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff))
364 #define HCI_OCF(op) ((op) & 0x3ff)
365 #define HCI_OGF(op) (((op) >> 10) & 0x3f)
366
367
368
369
370
371
372 #define HCI_CON_HANDLE(h) ((h) & 0x0fff)
373 #define HCI_PB_FLAG(h) (((h) & 0x3000) >> 12)
374 #define HCI_BC_FLAG(h) (((h) & 0xc000) >> 14)
375 #define HCI_MK_CON_HANDLE(h, pb, bc) \
376 (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))
377
378
379
380 #define HCI_PACKET_FRAGMENT 0x1
381 #define HCI_PACKET_START 0x2
382
383
384
385 #define HCI_POINT2POINT 0x0
386 #define HCI_BROADCAST_ACTIVE 0x1
387 #define HCI_BROADCAST_PICONET 0x2
388
389
390
391 typedef struct {
392 uint8_t type;
393 uint16_t opcode;
394 uint8_t length;
395 } __attribute__ ((__packed__)) hci_cmd_hdr_t;
396
397 #define HCI_CMD_PKT 0x01
398 #define HCI_CMD_PKT_SIZE (sizeof(hci_cmd_hdr_t) + 0xff)
399
400
401 typedef struct {
402 uint8_t type;
403 uint16_t con_handle;
404 uint16_t length;
405 } __attribute__ ((__packed__)) hci_acldata_hdr_t;
406
407 #define HCI_ACL_DATA_PKT 0x02
408 #define HCI_ACL_PKT_SIZE (sizeof(hci_acldata_hdr_t) + 0xffff)
409
410
411 typedef struct {
412 uint8_t type;
413 uint16_t con_handle;
414 uint8_t length;
415 } __attribute__ ((__packed__)) hci_scodata_hdr_t;
416
417 #define HCI_SCO_DATA_PKT 0x03
418 #define HCI_SCO_PKT_SIZE (sizeof(hci_scodata_hdr_t) + 0xff)
419
420
421 typedef struct {
422 uint8_t type;
423 uint8_t event;
424 uint8_t length;
425 } __attribute__ ((__packed__)) hci_event_hdr_t;
426
427 #define HCI_EVENT_PKT 0x04
428 #define HCI_EVENT_PKT_SIZE (sizeof(hci_event_hdr_t) + 0xff)
429
430
431 typedef struct {
432 uint8_t status;
433 } __attribute__ ((__packed__)) hci_status_rp;
434
435
436
437
438
439
440
441 #define HCI_OGF_LINK_CONTROL 0x01
442
443 #define HCI_OCF_INQUIRY 0x0001
444 #define HCI_CMD_INQUIRY 0x0401
445 typedef struct {
446 uint8_t lap[HCI_LAP_SIZE];
447 uint8_t inquiry_length;
448 uint8_t num_responses;
449 } __attribute__ ((__packed__)) hci_inquiry_cp;
450
451
452 #define HCI_OCF_INQUIRY_CANCEL 0x0002
453 #define HCI_CMD_INQUIRY_CANCEL 0x0402
454
455 typedef hci_status_rp hci_inquiry_cancel_rp;
456
457 #define HCI_OCF_PERIODIC_INQUIRY 0x0003
458 #define HCI_CMD_PERIODIC_INQUIRY 0x0403
459 typedef struct {
460 uint16_t max_period_length;
461 uint16_t min_period_length;
462 uint8_t lap[HCI_LAP_SIZE];
463 uint8_t inquiry_length;
464 uint8_t num_responses;
465 } __attribute__ ((__packed__)) hci_periodic_inquiry_cp;
466
467 typedef hci_status_rp hci_periodic_inquiry_rp;
468
469 #define HCI_OCF_EXIT_PERIODIC_INQUIRY 0x0004
470 #define HCI_CMD_EXIT_PERIODIC_INQUIRY 0x0404
471
472 typedef hci_status_rp hci_exit_periodic_inquiry_rp;
473
474 #define HCI_OCF_CREATE_CON 0x0005
475 #define HCI_CMD_CREATE_CON 0x0405
476 typedef struct {
477 bdaddr_t bdaddr;
478 uint16_t pkt_type;
479 uint8_t page_scan_rep_mode;
480 uint8_t page_scan_mode;
481 uint16_t clock_offset;
482 uint8_t accept_role_switch;
483 } __attribute__ ((__packed__)) hci_create_con_cp;
484
485
486 #define HCI_OCF_DISCONNECT 0x0006
487 #define HCI_CMD_DISCONNECT 0x0406
488 typedef struct {
489 uint16_t con_handle;
490 uint8_t reason;
491 } __attribute__ ((__packed__)) hci_discon_cp;
492
493
494
495 #define HCI_OCF_ADD_SCO_CON 0x0007
496 #define HCI_CMD_ADD_SCO_CON 0x0407
497 typedef struct {
498 uint16_t con_handle;
499 uint16_t pkt_type;
500 } __attribute__ ((__packed__)) hci_add_sco_con_cp;
501
502
503 #define HCI_OCF_CREATE_CON_CANCEL 0x0008
504 #define HCI_CMD_CREATE_CON_CANCEL 0x0408
505 typedef struct {
506 bdaddr_t bdaddr;
507 } __attribute__ ((__packed__)) hci_create_con_cancel_cp;
508
509 typedef struct {
510 uint8_t status;
511 bdaddr_t bdaddr;
512 } __attribute__ ((__packed__)) hci_create_con_cancel_rp;
513
514 #define HCI_OCF_ACCEPT_CON 0x0009
515 #define HCI_CMD_ACCEPT_CON 0x0409
516 typedef struct {
517 bdaddr_t bdaddr;
518 uint8_t role;
519 } __attribute__ ((__packed__)) hci_accept_con_cp;
520
521
522 #define HCI_OCF_REJECT_CON 0x000a
523 #define HCI_CMD_REJECT_CON 0x040A
524 typedef struct {
525 bdaddr_t bdaddr;
526 uint8_t reason;
527 } __attribute__ ((__packed__)) hci_reject_con_cp;
528
529
530 #define HCI_OCF_LINK_KEY_REP 0x000b
531 #define HCI_CMD_LINK_KEY_REP 0x040B
532 typedef struct {
533 bdaddr_t bdaddr;
534 uint8_t key[HCI_KEY_SIZE];
535 } __attribute__ ((__packed__)) hci_link_key_rep_cp;
536
537 typedef struct {
538 uint8_t status;
539 bdaddr_t bdaddr;
540 } __attribute__ ((__packed__)) hci_link_key_rep_rp;
541
542 #define HCI_OCF_LINK_KEY_NEG_REP 0x000c
543 #define HCI_CMD_LINK_KEY_NEG_REP 0x040C
544 typedef struct {
545 bdaddr_t bdaddr;
546 } __attribute__ ((__packed__)) hci_link_key_neg_rep_cp;
547
548 typedef struct {
549 uint8_t status;
550 bdaddr_t bdaddr;
551 } __attribute__ ((__packed__)) hci_link_key_neg_rep_rp;
552
553 #define HCI_OCF_PIN_CODE_REP 0x000d
554 #define HCI_CMD_PIN_CODE_REP 0x040D
555 typedef struct {
556 bdaddr_t bdaddr;
557 uint8_t pin_size;
558 uint8_t pin[HCI_PIN_SIZE];
559 } __attribute__ ((__packed__)) hci_pin_code_rep_cp;
560
561 typedef struct {
562 uint8_t status;
563 bdaddr_t bdaddr;
564 } __attribute__ ((__packed__)) hci_pin_code_rep_rp;
565
566 #define HCI_OCF_PIN_CODE_NEG_REP 0x000e
567 #define HCI_CMD_PIN_CODE_NEG_REP 0x040E
568 typedef struct {
569 bdaddr_t bdaddr;
570 } __attribute__ ((__packed__)) hci_pin_code_neg_rep_cp;
571
572 typedef struct {
573 uint8_t status;
574 bdaddr_t bdaddr;
575 } __attribute__ ((__packed__)) hci_pin_code_neg_rep_rp;
576
577 #define HCI_OCF_CHANGE_CON_PACKET_TYPE 0x000f
578 #define HCI_CMD_CHANGE_CON_PACKET_TYPE 0x040F
579 typedef struct {
580 uint16_t con_handle;
581 uint16_t pkt_type;
582 } __attribute__ ((__packed__)) hci_change_con_pkt_type_cp;
583
584
585 #define HCI_OCF_AUTH_REQ 0x0011
586 #define HCI_CMD_AUTH_REQ 0x0411
587 typedef struct {
588 uint16_t con_handle;
589 } __attribute__ ((__packed__)) hci_auth_req_cp;
590
591
592 #define HCI_OCF_SET_CON_ENCRYPTION 0x0013
593 #define HCI_CMD_SET_CON_ENCRYPTION 0x0413
594 typedef struct {
595 uint16_t con_handle;
596 uint8_t encryption_enable;
597 } __attribute__ ((__packed__)) hci_set_con_encryption_cp;
598
599
600 #define HCI_OCF_CHANGE_CON_LINK_KEY 0x0015
601 #define HCI_CMD_CHANGE_CON_LINK_KEY 0x0415
602 typedef struct {
603 uint16_t con_handle;
604 } __attribute__ ((__packed__)) hci_change_con_link_key_cp;
605
606
607 #define HCI_OCF_MASTER_LINK_KEY 0x0017
608 #define HCI_CMD_MASTER_LINK_KEY 0x0417
609 typedef struct {
610 uint8_t key_flag;
611 } __attribute__ ((__packed__)) hci_master_link_key_cp;
612
613
614 #define HCI_OCF_REMOTE_NAME_REQ 0x0019
615 #define HCI_CMD_REMOTE_NAME_REQ 0x0419
616 typedef struct {
617 bdaddr_t bdaddr;
618 uint8_t page_scan_rep_mode;
619 uint8_t page_scan_mode;
620 uint16_t clock_offset;
621 } __attribute__ ((__packed__)) hci_remote_name_req_cp;
622
623
624 #define HCI_OCF_REMOTE_NAME_REQ_CANCEL 0x001a
625 #define HCI_CMD_REMOTE_NAME_REQ_CANCEL 0x041A
626 typedef struct {
627 bdaddr_t bdaddr;
628 } __attribute__ ((__packed__)) hci_remote_name_req_cancel_cp;
629
630 typedef struct {
631 uint8_t status;
632 bdaddr_t bdaddr;
633 } __attribute__ ((__packed__)) hci_remote_name_req_cancel_rp;
634
635 #define HCI_OCF_READ_REMOTE_FEATURES 0x001b
636 #define HCI_CMD_READ_REMOTE_FEATURES 0x041B
637 typedef struct {
638 uint16_t con_handle;
639 } __attribute__ ((__packed__)) hci_read_remote_features_cp;
640
641
642 #define HCI_OCF_READ_REMOTE_EXTENDED_FEATURES 0x001c
643 #define HCI_CMD_READ_REMOTE_EXTENDED_FEATURES 0x041C
644 typedef struct {
645 uint16_t con_handle;
646 uint8_t page;
647 } __attribute__ ((__packed__)) hci_read_remote_extended_features_cp;
648
649
650 #define HCI_OCF_READ_REMOTE_VER_INFO 0x001d
651 #define HCI_CMD_READ_REMOTE_VER_INFO 0x041D
652 typedef struct {
653 uint16_t con_handle;
654 } __attribute__ ((__packed__)) hci_read_remote_ver_info_cp;
655
656
657 #define HCI_OCF_READ_CLOCK_OFFSET 0x001f
658 #define HCI_CMD_READ_CLOCK_OFFSET 0x041F
659 typedef struct {
660 uint16_t con_handle;
661 } __attribute__ ((__packed__)) hci_read_clock_offset_cp;
662
663
664 #define HCI_OCF_READ_LMP_HANDLE 0x0020
665 #define HCI_CMD_READ_LMP_HANDLE 0x0420
666 typedef struct {
667 uint16_t con_handle;
668 } __attribute__ ((__packed__)) hci_read_lmp_handle_cp;
669
670 typedef struct {
671 uint8_t status;
672 uint16_t con_handle;
673 uint8_t lmp_handle;
674 uint32_t reserved;
675 } __attribute__ ((__packed__)) hci_read_lmp_handle_rp;
676
677 #define HCI_OCF_SETUP_SCO_CON 0x0028
678 #define HCI_CMD_SETUP_SCO_CON 0x0428
679 typedef struct {
680 uint16_t con_handle;
681 uint32_t tx_bandwidth;
682 uint32_t rx_bandwidth;
683 uint16_t latency;
684 uint16_t voice;
685 uint8_t rt_effort;
686 uint16_t pkt_type;
687 } __attribute__ ((__packed__)) hci_setup_sco_con_cp;
688
689
690 #define HCI_OCF_ACCEPT_SCO_CON_REQ 0x0029
691 #define HCI_CMD_ACCEPT_SCO_CON_REQ 0x0429
692 typedef struct {
693 bdaddr_t bdaddr;
694 uint32_t tx_bandwidth;
695 uint32_t rx_bandwidth;
696 uint16_t latency;
697 uint16_t content;
698 uint8_t rt_effort;
699 uint16_t pkt_type;
700 } __attribute__ ((__packed__)) hci_accept_sco_con_req_cp;
701
702
703 #define HCI_OCF_REJECT_SCO_CON_REQ 0x002a
704 #define HCI_CMD_REJECT_SCO_CON_REQ 0x042a
705 typedef struct {
706 bdaddr_t bdaddr;
707 uint8_t reason;
708 } __attribute__ ((__packed__)) hci_reject_sco_con_req_cp;
709
710
711
712
713
714
715
716
717 #define HCI_OGF_LINK_POLICY 0x02
718
719 #define HCI_OCF_HOLD_MODE 0x0001
720 #define HCI_CMD_HOLD_MODE 0x0801
721 typedef struct {
722 uint16_t con_handle;
723 uint16_t max_interval;
724 uint16_t min_interval;
725 } __attribute__ ((__packed__)) hci_hold_mode_cp;
726
727
728 #define HCI_OCF_SNIFF_MODE 0x0003
729 #define HCI_CMD_SNIFF_MODE 0x0803
730 typedef struct {
731 uint16_t con_handle;
732 uint16_t max_interval;
733 uint16_t min_interval;
734 uint16_t attempt;
735 uint16_t timeout;
736 } __attribute__ ((__packed__)) hci_sniff_mode_cp;
737
738
739 #define HCI_OCF_EXIT_SNIFF_MODE 0x0004
740 #define HCI_CMD_EXIT_SNIFF_MODE 0x0804
741 typedef struct {
742 uint16_t con_handle;
743 } __attribute__ ((__packed__)) hci_exit_sniff_mode_cp;
744
745
746 #define HCI_OCF_PARK_MODE 0x0005
747 #define HCI_CMD_PARK_MODE 0x0805
748 typedef struct {
749 uint16_t con_handle;
750 uint16_t max_interval;
751 uint16_t min_interval;
752 } __attribute__ ((__packed__)) hci_park_mode_cp;
753
754
755 #define HCI_OCF_EXIT_PARK_MODE 0x0006
756 #define HCI_CMD_EXIT_PARK_MODE 0x0806
757 typedef struct {
758 uint16_t con_handle;
759 } __attribute__ ((__packed__)) hci_exit_park_mode_cp;
760
761
762 #define HCI_OCF_QOS_SETUP 0x0007
763 #define HCI_CMD_QOS_SETUP 0x0807
764 typedef struct {
765 uint16_t con_handle;
766 uint8_t flags;
767 uint8_t service_type;
768 uint32_t token_rate;
769 uint32_t peak_bandwidth;
770 uint32_t latency;
771 uint32_t delay_variation;
772 } __attribute__ ((__packed__)) hci_qos_setup_cp;
773
774
775 #define HCI_OCF_ROLE_DISCOVERY 0x0009
776 #define HCI_CMD_ROLE_DISCOVERY 0x0809
777 typedef struct {
778 uint16_t con_handle;
779 } __attribute__ ((__packed__)) hci_role_discovery_cp;
780
781 typedef struct {
782 uint8_t status;
783 uint16_t con_handle;
784 uint8_t role;
785 } __attribute__ ((__packed__)) hci_role_discovery_rp;
786
787 #define HCI_OCF_SWITCH_ROLE 0x000b
788 #define HCI_CMD_SWITCH_ROLE 0x080B
789 typedef struct {
790 bdaddr_t bdaddr;
791 uint8_t role;
792 } __attribute__ ((__packed__)) hci_switch_role_cp;
793
794
795 #define HCI_OCF_READ_LINK_POLICY_SETTINGS 0x000c
796 #define HCI_CMD_READ_LINK_POLICY_SETTINGS 0x080C
797 typedef struct {
798 uint16_t con_handle;
799 } __attribute__ ((__packed__)) hci_read_link_policy_settings_cp;
800
801 typedef struct {
802 uint8_t status;
803 uint16_t con_handle;
804 uint16_t settings;
805 } __attribute__ ((__packed__)) hci_read_link_policy_settings_rp;
806
807 #define HCI_OCF_WRITE_LINK_POLICY_SETTINGS 0x000d
808 #define HCI_CMD_WRITE_LINK_POLICY_SETTINGS 0x080D
809 typedef struct {
810 uint16_t con_handle;
811 uint16_t settings;
812 } __attribute__ ((__packed__)) hci_write_link_policy_settings_cp;
813
814 typedef struct {
815 uint8_t status;
816 uint16_t con_handle;
817 } __attribute__ ((__packed__)) hci_write_link_policy_settings_rp;
818
819 #define HCI_OCF_READ_DEFAULT_LINK_POLICY_SETTINGS 0x000e
820 #define HCI_CMD_READ_DEFAULT_LINK_POLICY_SETTINGS 0x080E
821
822 typedef struct {
823 uint8_t status;
824 uint16_t settings;
825 } __attribute__ ((__packed__)) hci_read_default_link_policy_settings_rp;
826
827 #define HCI_OCF_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x000f
828 #define HCI_CMD_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x080F
829 typedef struct {
830 uint16_t settings;
831 } __attribute__ ((__packed__)) hci_write_default_link_policy_settings_cp;
832
833 typedef hci_status_rp hci_write_default_link_policy_settings_rp;
834
835 #define HCI_OCF_FLOW_SPECIFICATION 0x0010
836 #define HCI_CMD_FLOW_SPECIFICATION 0x0810
837 typedef struct {
838 uint16_t con_handle;
839 uint8_t flags;
840 uint8_t flow_direction;
841 uint8_t service_type;
842 uint32_t token_rate;
843 uint32_t token_bucket;
844 uint32_t peak_bandwidth;
845 uint32_t latency;
846 } __attribute__ ((__packed__)) hci_flow_specification_cp;
847
848
849
850
851
852
853
854
855 #define HCI_OGF_HC_BASEBAND 0x03
856
857 #define HCI_OCF_SET_EVENT_MASK 0x0001
858 #define HCI_CMD_SET_EVENT_MASK 0x0C01
859 typedef struct {
860 uint8_t event_mask[HCI_EVENT_MASK_SIZE];
861 } __attribute__ ((__packed__)) hci_set_event_mask_cp;
862
863 typedef hci_status_rp hci_set_event_mask_rp;
864
865 #define HCI_OCF_RESET 0x0003
866 #define HCI_CMD_RESET 0x0C03
867
868 typedef hci_status_rp hci_reset_rp;
869
870 #define HCI_OCF_SET_EVENT_FILTER 0x0005
871 #define HCI_CMD_SET_EVENT_FILTER 0x0C05
872 typedef struct {
873 uint8_t filter_type;
874 uint8_t filter_condition_type;
875
876
877 } __attribute__ ((__packed__)) hci_set_event_filter_cp;
878
879 typedef hci_status_rp hci_set_event_filter_rp;
880
881 #define HCI_OCF_FLUSH 0x0008
882 #define HCI_CMD_FLUSH 0x0C08
883 typedef struct {
884 uint16_t con_handle;
885 } __attribute__ ((__packed__)) hci_flush_cp;
886
887 typedef struct {
888 uint8_t status;
889 uint16_t con_handle;
890 } __attribute__ ((__packed__)) hci_flush_rp;
891
892 #define HCI_OCF_READ_PIN_TYPE 0x0009
893 #define HCI_CMD_READ_PIN_TYPE 0x0C09
894
895 typedef struct {
896 uint8_t status;
897 uint8_t pin_type;
898 } __attribute__ ((__packed__)) hci_read_pin_type_rp;
899
900 #define HCI_OCF_WRITE_PIN_TYPE 0x000a
901 #define HCI_CMD_WRITE_PIN_TYPE 0x0C0A
902 typedef struct {
903 uint8_t pin_type;
904 } __attribute__ ((__packed__)) hci_write_pin_type_cp;
905
906 typedef hci_status_rp hci_write_pin_type_rp;
907
908 #define HCI_OCF_CREATE_NEW_UNIT_KEY 0x000b
909 #define HCI_CMD_CREATE_NEW_UNIT_KEY 0x0C0B
910
911 typedef hci_status_rp hci_create_new_unit_key_rp;
912
913 #define HCI_OCF_READ_STORED_LINK_KEY 0x000d
914 #define HCI_CMD_READ_STORED_LINK_KEY 0x0C0D
915 typedef struct {
916 bdaddr_t bdaddr;
917 uint8_t read_all;
918 } __attribute__ ((__packed__)) hci_read_stored_link_key_cp;
919
920 typedef struct {
921 uint8_t status;
922 uint16_t max_num_keys;
923 uint16_t num_keys_read;
924 } __attribute__ ((__packed__)) hci_read_stored_link_key_rp;
925
926 #define HCI_OCF_WRITE_STORED_LINK_KEY 0x0011
927 #define HCI_CMD_WRITE_STORED_LINK_KEY 0x0C11
928 typedef struct {
929 uint8_t num_keys_write;
930
931
932
933 } __attribute__ ((__packed__)) hci_write_stored_link_key_cp;
934
935 typedef struct {
936 uint8_t status;
937 uint8_t num_keys_written;
938 } __attribute__ ((__packed__)) hci_write_stored_link_key_rp;
939
940 #define HCI_OCF_DELETE_STORED_LINK_KEY 0x0012
941 #define HCI_CMD_DELETE_STORED_LINK_KEY 0x0C12
942 typedef struct {
943 bdaddr_t bdaddr;
944 uint8_t delete_all;
945 } __attribute__ ((__packed__)) hci_delete_stored_link_key_cp;
946
947 typedef struct {
948 uint8_t status;
949 uint16_t num_keys_deleted;
950 } __attribute__ ((__packed__)) hci_delete_stored_link_key_rp;
951
952 #define HCI_OCF_WRITE_LOCAL_NAME 0x0013
953 #define HCI_CMD_WRITE_LOCAL_NAME 0x0C13
954 typedef struct {
955 char name[HCI_UNIT_NAME_SIZE];
956 } __attribute__ ((__packed__)) hci_write_local_name_cp;
957
958 typedef hci_status_rp hci_write_local_name_rp;
959
960 #define HCI_OCF_READ_LOCAL_NAME 0x0014
961 #define HCI_CMD_READ_LOCAL_NAME 0x0C14
962
963 typedef struct {
964 uint8_t status;
965 char name[HCI_UNIT_NAME_SIZE];
966 } __attribute__ ((__packed__)) hci_read_local_name_rp;
967
968 #define HCI_OCF_READ_CON_ACCEPT_TIMEOUT 0x0015
969 #define HCI_CMD_READ_CON_ACCEPT_TIMEOUT 0x0C15
970
971 typedef struct {
972 uint8_t status;
973 uint16_t timeout;
974 } __attribute__ ((__packed__)) hci_read_con_accept_timeout_rp;
975
976 #define HCI_OCF_WRITE_CON_ACCEPT_TIMEOUT 0x0016
977 #define HCI_CMD_WRITE_CON_ACCEPT_TIMEOUT 0x0C16
978 typedef struct {
979 uint16_t timeout;
980 } __attribute__ ((__packed__)) hci_write_con_accept_timeout_cp;
981
982 typedef hci_status_rp hci_write_con_accept_timeout_rp;
983
984 #define HCI_OCF_READ_PAGE_TIMEOUT 0x0017
985 #define HCI_CMD_READ_PAGE_TIMEOUT 0x0C17
986
987 typedef struct {
988 uint8_t status;
989 uint16_t timeout;
990 } __attribute__ ((__packed__)) hci_read_page_timeout_rp;
991
992 #define HCI_OCF_WRITE_PAGE_TIMEOUT 0x0018
993 #define HCI_CMD_WRITE_PAGE_TIMEOUT 0x0C18
994 typedef struct {
995 uint16_t timeout;
996 } __attribute__ ((__packed__)) hci_write_page_timeout_cp;
997
998 typedef hci_status_rp hci_write_page_timeout_rp;
999
1000 #define HCI_OCF_READ_SCAN_ENABLE 0x0019
1001 #define HCI_CMD_READ_SCAN_ENABLE 0x0C19
1002
1003 typedef struct {
1004 uint8_t status;
1005 uint8_t scan_enable;
1006 } __attribute__ ((__packed__)) hci_read_scan_enable_rp;
1007
1008 #define HCI_OCF_WRITE_SCAN_ENABLE 0x001a
1009 #define HCI_CMD_WRITE_SCAN_ENABLE 0x0C1A
1010 typedef struct {
1011 uint8_t scan_enable;
1012 } __attribute__ ((__packed__)) hci_write_scan_enable_cp;
1013
1014 typedef hci_status_rp hci_write_scan_enable_rp;
1015
1016 #define HCI_OCF_READ_PAGE_SCAN_ACTIVITY 0x001b
1017 #define HCI_CMD_READ_PAGE_SCAN_ACTIVITY 0x0C1B
1018
1019 typedef struct {
1020 uint8_t status;
1021 uint16_t page_scan_interval;
1022 uint16_t page_scan_window;
1023 } __attribute__ ((__packed__)) hci_read_page_scan_activity_rp;
1024
1025 #define HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001c
1026 #define HCI_CMD_WRITE_PAGE_SCAN_ACTIVITY 0x0C1C
1027 typedef struct {
1028 uint16_t page_scan_interval;
1029 uint16_t page_scan_window;
1030 } __attribute__ ((__packed__)) hci_write_page_scan_activity_cp;
1031
1032 typedef hci_status_rp hci_write_page_scan_activity_rp;
1033
1034 #define HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY 0x001d
1035 #define HCI_CMD_READ_INQUIRY_SCAN_ACTIVITY 0x0C1D
1036
1037 typedef struct {
1038 uint8_t status;
1039 uint16_t inquiry_scan_interval;
1040 uint16_t inquiry_scan_window;
1041 } __attribute__ ((__packed__)) hci_read_inquiry_scan_activity_rp;
1042
1043 #define HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY 0x001e
1044 #define HCI_CMD_WRITE_INQUIRY_SCAN_ACTIVITY 0x0C1E
1045 typedef struct {
1046 uint16_t inquiry_scan_interval;
1047 uint16_t inquiry_scan_window;
1048 } __attribute__ ((__packed__)) hci_write_inquiry_scan_activity_cp;
1049
1050 typedef hci_status_rp hci_write_inquiry_scan_activity_rp;
1051
1052 #define HCI_OCF_READ_AUTH_ENABLE 0x001f
1053 #define HCI_CMD_READ_AUTH_ENABLE 0x0C1F
1054
1055 typedef struct {
1056 uint8_t status;
1057 uint8_t auth_enable;
1058 } __attribute__ ((__packed__)) hci_read_auth_enable_rp;
1059
1060 #define HCI_OCF_WRITE_AUTH_ENABLE 0x0020
1061 #define HCI_CMD_WRITE_AUTH_ENABLE 0x0C20
1062 typedef struct {
1063 uint8_t auth_enable;
1064 } __attribute__ ((__packed__)) hci_write_auth_enable_cp;
1065
1066 typedef hci_status_rp hci_write_auth_enable_rp;
1067
1068 #define HCI_OCF_READ_ENCRYPTION_MODE 0x0021
1069 #define HCI_CMD_READ_ENCRYPTION_MODE 0x0C21
1070
1071 typedef struct {
1072 uint8_t status;
1073 uint8_t encryption_mode;
1074 } __attribute__ ((__packed__)) hci_read_encryption_mode_rp;
1075
1076 #define HCI_OCF_WRITE_ENCRYPTION_MODE 0x0022
1077 #define HCI_CMD_WRITE_ENCRYPTION_MODE 0x0C22
1078 typedef struct {
1079 uint8_t encryption_mode;
1080 } __attribute__ ((__packed__)) hci_write_encryption_mode_cp;
1081
1082 typedef hci_status_rp hci_write_encryption_mode_rp;
1083
1084 #define HCI_OCF_READ_UNIT_CLASS 0x0023
1085 #define HCI_CMD_READ_UNIT_CLASS 0x0C23
1086
1087 typedef struct {
1088 uint8_t status;
1089 uint8_t uclass[HCI_CLASS_SIZE];
1090 } __attribute__ ((__packed__)) hci_read_unit_class_rp;
1091
1092 #define HCI_OCF_WRITE_UNIT_CLASS 0x0024
1093 #define HCI_CMD_WRITE_UNIT_CLASS 0x0C24
1094 typedef struct {
1095 uint8_t uclass[HCI_CLASS_SIZE];
1096 } __attribute__ ((__packed__)) hci_write_unit_class_cp;
1097
1098 typedef hci_status_rp hci_write_unit_class_rp;
1099
1100 #define HCI_OCF_READ_VOICE_SETTING 0x0025
1101 #define HCI_CMD_READ_VOICE_SETTING 0x0C25
1102
1103 typedef struct {
1104 uint8_t status;
1105 uint16_t settings;
1106 } __attribute__ ((__packed__)) hci_read_voice_setting_rp;
1107
1108 #define HCI_OCF_WRITE_VOICE_SETTING 0x0026
1109 #define HCI_CMD_WRITE_VOICE_SETTING 0x0C26
1110 typedef struct {
1111 uint16_t settings;
1112 } __attribute__ ((__packed__)) hci_write_voice_setting_cp;
1113
1114 typedef hci_status_rp hci_write_voice_setting_rp;
1115
1116 #define HCI_OCF_READ_AUTO_FLUSH_TIMEOUT 0x0027
1117 #define HCI_CMD_READ_AUTO_FLUSH_TIMEOUT 0x0C27
1118 typedef struct {
1119 uint16_t con_handle;
1120 } __attribute__ ((__packed__)) hci_read_auto_flush_timeout_cp;
1121
1122 typedef struct {
1123 uint8_t status;
1124 uint16_t con_handle;
1125 uint16_t timeout;
1126 } __attribute__ ((__packed__)) hci_read_auto_flush_timeout_rp;
1127
1128 #define HCI_OCF_WRITE_AUTO_FLUSH_TIMEOUT 0x0028
1129 #define HCI_CMD_WRITE_AUTO_FLUSH_TIMEOUT 0x0C28
1130 typedef struct {
1131 uint16_t con_handle;
1132 uint16_t timeout;
1133 } __attribute__ ((__packed__)) hci_write_auto_flush_timeout_cp;
1134
1135 typedef struct {
1136 uint8_t status;
1137 uint16_t con_handle;
1138 } __attribute__ ((__packed__)) hci_write_auto_flush_timeout_rp;
1139
1140 #define HCI_OCF_READ_NUM_BROADCAST_RETRANS 0x0029
1141 #define HCI_CMD_READ_NUM_BROADCAST_RETRANS 0x0C29
1142
1143 typedef struct {
1144 uint8_t status;
1145 uint8_t counter;
1146 } __attribute__ ((__packed__)) hci_read_num_broadcast_retrans_rp;
1147
1148 #define HCI_OCF_WRITE_NUM_BROADCAST_RETRANS 0x002a
1149 #define HCI_CMD_WRITE_NUM_BROADCAST_RETRANS 0x0C2A
1150 typedef struct {
1151 uint8_t counter;
1152 } __attribute__ ((__packed__)) hci_write_num_broadcast_retrans_cp;
1153
1154 typedef hci_status_rp hci_write_num_broadcast_retrans_rp;
1155
1156 #define HCI_OCF_READ_HOLD_MODE_ACTIVITY 0x002b
1157 #define HCI_CMD_READ_HOLD_MODE_ACTIVITY 0x0C2B
1158
1159 typedef struct {
1160 uint8_t status;
1161 uint8_t hold_mode_activity;
1162 } __attribute__ ((__packed__)) hci_read_hold_mode_activity_rp;
1163
1164 #define HCI_OCF_WRITE_HOLD_MODE_ACTIVITY 0x002c
1165 #define HCI_CMD_WRITE_HOLD_MODE_ACTIVITY 0x0C2C
1166 typedef struct {
1167 uint8_t hold_mode_activity;
1168 } __attribute__ ((__packed__)) hci_write_hold_mode_activity_cp;
1169
1170 typedef hci_status_rp hci_write_hold_mode_activity_rp;
1171
1172 #define HCI_OCF_READ_XMIT_LEVEL 0x002d
1173 #define HCI_CMD_READ_XMIT_LEVEL 0x0C2D
1174 typedef struct {
1175 uint16_t con_handle;
1176 uint8_t type;
1177 } __attribute__ ((__packed__)) hci_read_xmit_level_cp;
1178
1179 typedef struct {
1180 uint8_t status;
1181 uint16_t con_handle;
1182 char level;
1183 } __attribute__ ((__packed__)) hci_read_xmit_level_rp;
1184
1185 #define HCI_OCF_READ_SCO_FLOW_CONTROL 0x002e
1186 #define HCI_CMD_READ_SCO_FLOW_CONTROL 0x0C2E
1187
1188 typedef struct {
1189 uint8_t status;
1190 uint8_t flow_control;
1191 } __attribute__ ((__packed__)) hci_read_sco_flow_control_rp;
1192
1193 #define HCI_OCF_WRITE_SCO_FLOW_CONTROL 0x002f
1194 #define HCI_CMD_WRITE_SCO_FLOW_CONTROL 0x0C2F
1195 typedef struct {
1196 uint8_t flow_control;
1197 } __attribute__ ((__packed__)) hci_write_sco_flow_control_cp;
1198
1199 typedef hci_status_rp hci_write_sco_flow_control_rp;
1200
1201 #define HCI_OCF_HC2H_FLOW_CONTROL 0x0031
1202 #define HCI_CMD_HC2H_FLOW_CONTROL 0x0C31
1203 typedef struct {
1204 uint8_t hc2h_flow;
1205 } __attribute__ ((__packed__)) hci_hc2h_flow_control_cp;
1206
1207 typedef hci_status_rp hci_h2hc_flow_control_rp;
1208
1209 #define HCI_OCF_HOST_BUFFER_SIZE 0x0033
1210 #define HCI_CMD_HOST_BUFFER_SIZE 0x0C33
1211 typedef struct {
1212 uint16_t max_acl_size;
1213 uint8_t max_sco_size;
1214 uint16_t num_acl_pkts;
1215 uint16_t num_sco_pkts;
1216 } __attribute__ ((__packed__)) hci_host_buffer_size_cp;
1217
1218 typedef hci_status_rp hci_host_buffer_size_rp;
1219
1220 #define HCI_OCF_HOST_NUM_COMPL_PKTS 0x0035
1221 #define HCI_CMD_HOST_NUM_COMPL_PKTS 0x0C35
1222 typedef struct {
1223 uint8_t nu_con_handles;
1224
1225
1226
1227 } __attribute__ ((__packed__)) hci_host_num_compl_pkts_cp;
1228
1229
1230 #define HCI_OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036
1231 #define HCI_CMD_READ_LINK_SUPERVISION_TIMEOUT 0x0C36
1232 typedef struct {
1233 uint16_t con_handle;
1234 } __attribute__ ((__packed__)) hci_read_link_supervision_timeout_cp;
1235
1236 typedef struct {
1237 uint8_t status;
1238 uint16_t con_handle;
1239 uint16_t timeout;
1240 } __attribute__ ((__packed__)) hci_read_link_supervision_timeout_rp;
1241
1242 #define HCI_OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037
1243 #define HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT 0x0C37
1244 typedef struct {
1245 uint16_t con_handle;
1246 uint16_t timeout;
1247 } __attribute__ ((__packed__)) hci_write_link_supervision_timeout_cp;
1248
1249 typedef struct {
1250 uint8_t status;
1251 uint16_t con_handle;
1252 } __attribute__ ((__packed__)) hci_write_link_supervision_timeout_rp;
1253
1254 #define HCI_OCF_READ_NUM_SUPPORTED_IAC 0x0038
1255 #define HCI_CMD_READ_NUM_SUPPORTED_IAC 0x0C38
1256
1257 typedef struct {
1258 uint8_t status;
1259 uint8_t num_iac;
1260 } __attribute__ ((__packed__)) hci_read_num_supported_iac_rp;
1261
1262 #define HCI_OCF_READ_IAC_LAP 0x0039
1263 #define HCI_CMD_READ_IAC_LAP 0x0C39
1264
1265 typedef struct {
1266 uint8_t status;
1267 uint8_t num_iac;
1268
1269
1270 } __attribute__ ((__packed__)) hci_read_iac_lap_rp;
1271
1272 #define HCI_OCF_WRITE_IAC_LAP 0x003a
1273 #define HCI_CMD_WRITE_IAC_LAP 0x0C3A
1274 typedef struct {
1275 uint8_t num_iac;
1276
1277
1278 } __attribute__ ((__packed__)) hci_write_iac_lap_cp;
1279
1280 typedef hci_status_rp hci_write_iac_lap_rp;
1281
1282 #define HCI_OCF_READ_PAGE_SCAN_PERIOD 0x003b
1283 #define HCI_CMD_READ_PAGE_SCAN_PERIOD 0x0C3B
1284
1285 typedef struct {
1286 uint8_t status;
1287 uint8_t page_scan_period_mode;
1288 } __attribute__ ((__packed__)) hci_read_page_scan_period_rp;
1289
1290 #define HCI_OCF_WRITE_PAGE_SCAN_PERIOD 0x003c
1291 #define HCI_CMD_WRITE_PAGE_SCAN_PERIOD 0x0C3C
1292 typedef struct {
1293 uint8_t page_scan_period_mode;
1294 } __attribute__ ((__packed__)) hci_write_page_scan_period_cp;
1295
1296 typedef hci_status_rp hci_write_page_scan_period_rp;
1297
1298
1299 #define HCI_OCF_READ_PAGE_SCAN 0x003d
1300 #define HCI_CMD_READ_PAGE_SCAN 0x0C3D
1301
1302 typedef struct {
1303 uint8_t status;
1304 uint8_t page_scan_mode;
1305 } __attribute__ ((__packed__)) hci_read_page_scan_rp;
1306
1307
1308 #define HCI_OCF_WRITE_PAGE_SCAN 0x003e
1309 #define HCI_CMD_WRITE_PAGE_SCAN 0x0C3E
1310 typedef struct {
1311 uint8_t page_scan_mode;
1312 } __attribute__ ((__packed__)) hci_write_page_scan_cp;
1313
1314 typedef hci_status_rp hci_write_page_scan_rp;
1315
1316 #define HCI_OCF_SET_AFH_CLASSIFICATION 0x003f
1317 #define HCI_CMD_SET_AFH_CLASSIFICATION 0x0C3F
1318 typedef struct {
1319 uint8_t classification[10];
1320 } __attribute__ ((__packed__)) hci_set_afh_classification_cp;
1321
1322 typedef hci_status_rp hci_set_afh_classification_rp;
1323
1324 #define HCI_OCF_READ_INQUIRY_SCAN_TYPE 0x0042
1325 #define HCI_CMD_READ_INQUIRY_SCAN_TYPE 0x0C42
1326
1327
1328 typedef struct {
1329 uint8_t status;
1330 uint8_t type;
1331 } __attribute__ ((__packed__)) hci_read_inquiry_scan_type_rp;
1332
1333 #define HCI_OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043
1334 #define HCI_CMD_WRITE_INQUIRY_SCAN_TYPE 0x0C43
1335 typedef struct {
1336 uint8_t type;
1337 } __attribute__ ((__packed__)) hci_write_inquiry_scan_type_cp;
1338
1339 typedef hci_status_rp hci_write_inquiry_scan_type_rp;
1340
1341 #define HCI_OCF_READ_INQUIRY_MODE 0x0044
1342 #define HCI_CMD_READ_INQUIRY_MODE 0x0C44
1343
1344
1345 typedef struct {
1346 uint8_t status;
1347 uint8_t mode;
1348 } __attribute__ ((__packed__)) hci_read_inquiry_mode_rp;
1349
1350 #define HCI_OCF_WRITE_INQUIRY_MODE 0x0045
1351 #define HCI_CMD_WRITE_INQUIRY_MODE 0x0C45
1352 typedef struct {
1353 uint8_t mode;
1354 } __attribute__ ((__packed__)) hci_write_inquiry_mode_cp;
1355
1356 typedef hci_status_rp hci_write_inquiry_mode_rp;
1357
1358 #define HCI_OCF_READ_PAGE_SCAN_TYPE 0x0046
1359 #define HCI_CMD_READ_PAGE_SCAN_TYPE 0x0C46
1360
1361
1362 typedef struct {
1363 uint8_t status;
1364 uint8_t type;
1365 } __attribute__ ((__packed__)) hci_read_page_scan_type_rp;
1366
1367 #define HCI_OCF_WRITE_PAGE_SCAN_TYPE 0x0047
1368 #define HCI_CMD_WRITE_PAGE_SCAN_TYPE 0x0C47
1369 typedef struct {
1370 uint8_t type;
1371 } __attribute__ ((__packed__)) hci_write_page_scan_type_cp;
1372
1373 typedef hci_status_rp hci_write_page_scan_type_rp;
1374
1375 #define HCI_OCF_READ_AFH_ASSESSMENT 0x0048
1376 #define HCI_CMD_READ_AFH_ASSESSMENT 0x0C48
1377
1378
1379 typedef struct {
1380 uint8_t status;
1381 uint8_t mode;
1382 } __attribute__ ((__packed__)) hci_read_afh_assessment_rp;
1383
1384 #define HCI_OCF_WRITE_AFH_ASSESSMENT 0x0049
1385 #define HCI_CMD_WRITE_AFH_ASSESSMENT 0x0C49
1386 typedef struct {
1387 uint8_t mode;
1388 } __attribute__ ((__packed__)) hci_write_afh_assessment_cp;
1389
1390 typedef hci_status_rp hci_write_afh_assessment_rp;
1391
1392
1393
1394
1395
1396
1397
1398 #define HCI_OGF_INFO 0x04
1399
1400 #define HCI_OCF_READ_LOCAL_VER 0x0001
1401 #define HCI_CMD_READ_LOCAL_VER 0x1001
1402
1403 typedef struct {
1404 uint8_t status;
1405 uint8_t hci_version;
1406 uint16_t hci_revision;
1407 uint8_t lmp_version;
1408 uint16_t manufacturer;
1409 uint16_t lmp_subversion;
1410 } __attribute__ ((__packed__)) hci_read_local_ver_rp;
1411
1412 #define HCI_OCF_READ_LOCAL_COMMANDS 0x0002
1413 #define HCI_CMD_READ_LOCAL_COMMANDS 0x1002
1414
1415 typedef struct {
1416 uint8_t status;
1417 uint8_t commands[64];
1418 } __attribute__ ((__packed__)) hci_read_local_commands_rp;
1419
1420 #define HCI_OCF_READ_LOCAL_FEATURES 0x0003
1421 #define HCI_CMD_READ_LOCAL_FEATURES 0x1003
1422
1423 typedef struct {
1424 uint8_t status;
1425 uint8_t features[HCI_FEATURES_SIZE];
1426 } __attribute__ ((__packed__)) hci_read_local_features_rp;
1427
1428 #define HCI_OCF_READ_LOCAL_EXTENDED_FEATURES 0x0004
1429 #define HCI_CMD_READ_LOCAL_EXTENDED_FEATURES 0x1004
1430 typedef struct {
1431 uint8_t page;
1432 } __attribute__ ((__packed__)) hci_read_local_extended_features_cp;
1433
1434 typedef struct {
1435 uint8_t status;
1436 uint8_t page;
1437 uint8_t max_page;
1438 uint8_t features[HCI_FEATURES_SIZE];
1439 } __attribute__ ((__packed__)) hci_read_local_extended_features_rp;
1440
1441 #define HCI_OCF_READ_BUFFER_SIZE 0x0005
1442 #define HCI_CMD_READ_BUFFER_SIZE 0x1005
1443
1444 typedef struct {
1445 uint8_t status;
1446 uint16_t max_acl_size;
1447 uint8_t max_sco_size;
1448 uint16_t num_acl_pkts;
1449 uint16_t num_sco_pkts;
1450 } __attribute__ ((__packed__)) hci_read_buffer_size_rp;
1451
1452
1453 #define HCI_OCF_READ_COUNTRY_CODE 0x0007
1454 #define HCI_CMD_READ_COUNTRY_CODE 0x1007
1455
1456 typedef struct {
1457 uint8_t status;
1458 uint8_t country_code;
1459 } __attribute__ ((__packed__)) hci_read_country_code_rp;
1460
1461 #define HCI_OCF_READ_BDADDR 0x0009
1462 #define HCI_CMD_READ_BDADDR 0x1009
1463
1464 typedef struct {
1465 uint8_t status;
1466 bdaddr_t bdaddr;
1467 } __attribute__ ((__packed__)) hci_read_bdaddr_rp;
1468
1469
1470
1471
1472
1473
1474
1475 #define HCI_OGF_STATUS 0x05
1476
1477 #define HCI_OCF_READ_FAILED_CONTACT_CNTR 0x0001
1478 #define HCI_CMD_READ_FAILED_CONTACT_CNTR 0x1401
1479 typedef struct {
1480 uint16_t con_handle;
1481 } __attribute__ ((__packed__)) hci_read_failed_contact_cntr_cp;
1482
1483 typedef struct {
1484 uint8_t status;
1485 uint16_t con_handle;
1486 uint16_t counter;
1487 } __attribute__ ((__packed__)) hci_read_failed_contact_cntr_rp;
1488
1489 #define HCI_OCF_RESET_FAILED_CONTACT_CNTR 0x0002
1490 #define HCI_CMD_RESET_FAILED_CONTACT_CNTR 0x1402
1491 typedef struct {
1492 uint16_t con_handle;
1493 } __attribute__ ((__packed__)) hci_reset_failed_contact_cntr_cp;
1494
1495 typedef struct {
1496 uint8_t status;
1497 uint16_t con_handle;
1498 } __attribute__ ((__packed__)) hci_reset_failed_contact_cntr_rp;
1499
1500 #define HCI_OCF_READ_LINK_QUALITY 0x0003
1501 #define HCI_CMD_READ_LINK_QUALITY 0x1403
1502 typedef struct {
1503 uint16_t con_handle;
1504 } __attribute__ ((__packed__)) hci_read_link_quality_cp;
1505
1506 typedef struct {
1507 uint8_t status;
1508 uint16_t con_handle;
1509 uint8_t quality;
1510 } __attribute__ ((__packed__)) hci_read_link_quality_rp;
1511
1512 #define HCI_OCF_READ_RSSI 0x0005
1513 #define HCI_CMD_READ_RSSI 0x1405
1514 typedef struct {
1515 uint16_t con_handle;
1516 } __attribute__ ((__packed__)) hci_read_rssi_cp;
1517
1518 typedef struct {
1519 uint8_t status;
1520 uint16_t con_handle;
1521 char rssi;
1522 } __attribute__ ((__packed__)) hci_read_rssi_rp;
1523
1524 #define HCI_OCF_READ_AFH_CHANNEL_MAP 0x0006
1525 #define HCI_CMD_READ_AFH_CHANNEL_MAP 0x1406
1526 typedef struct {
1527 uint16_t con_handle;
1528 } __attribute__ ((__packed__)) hci_read_afh_channel_map_cp;
1529
1530 typedef struct {
1531 uint8_t status;
1532 uint16_t con_handle;
1533 uint8_t mode;
1534 uint8_t map[10];
1535 } __attribute__ ((__packed__)) hci_read_afh_channel_map_rp;
1536
1537 #define HCI_OCF_READ_CLOCK 0x0007
1538 #define HCI_CMD_READ_CLOCK 0x1407
1539 typedef struct {
1540 uint16_t con_handle;
1541 uint8_t clock;
1542 } __attribute__ ((__packed__)) hci_read_clock_cp;
1543
1544 typedef struct {
1545 uint8_t status;
1546 uint16_t con_handle;
1547 uint32_t clock;
1548 uint16_t accuracy;
1549 } __attribute__ ((__packed__)) hci_read_clock_rp;
1550
1551
1552
1553
1554
1555
1556
1557
1558 #define HCI_OGF_TESTING 0x06
1559
1560 #define HCI_OCF_READ_LOOPBACK_MODE 0x0001
1561 #define HCI_CMD_READ_LOOPBACK_MODE 0x1801
1562
1563 typedef struct {
1564 uint8_t status;
1565 uint8_t lbmode;
1566 } __attribute__ ((__packed__)) hci_read_loopback_mode_rp;
1567
1568 #define HCI_OCF_WRITE_LOOPBACK_MODE 0x0002
1569 #define HCI_CMD_WRITE_LOOPBACK_MODE 0x1802
1570 typedef struct {
1571 uint8_t lbmode;
1572 } __attribute__ ((__packed__)) hci_write_loopback_mode_cp;
1573
1574 typedef hci_status_rp hci_write_loopback_mode_rp;
1575
1576 #define HCI_OCF_ENABLE_UNIT_UNDER_TEST 0x0003
1577 #define HCI_CMD_ENABLE_UNIT_UNDER_TEST 0x1803
1578
1579 typedef hci_status_rp hci_enable_unit_under_test_rp;
1580
1581
1582
1583
1584
1585
1586
1587
1588 #define HCI_OGF_BT_LOGO 0x3e
1589 #define HCI_OGF_VENDOR 0x3f
1590
1591
1592 #define HCI_CMD_ERICSSON_WRITE_PCM_SETTINGS 0xFC07
1593 #define HCI_CMD_ERICSSON_SET_UART_BAUD_RATE 0xFC09
1594 #define HCI_CMD_ERICSSON_SET_SCO_DATA_PATH 0xFC1D
1595
1596
1597 #define HCI_CMD_CSR_EXTN 0xFC00
1598
1599
1600
1601
1602
1603
1604
1605
1606 #define HCI_EVENT_INQUIRY_COMPL 0x01
1607 typedef struct {
1608 uint8_t status;
1609 } __attribute__ ((__packed__)) hci_inquiry_compl_ep;
1610
1611 #define HCI_EVENT_INQUIRY_RESULT 0x02
1612 typedef struct {
1613 uint8_t num_responses;
1614
1615 } __attribute__ ((__packed__)) hci_inquiry_result_ep;
1616
1617 typedef struct {
1618 bdaddr_t bdaddr;
1619 uint8_t page_scan_rep_mode;
1620 uint8_t page_scan_period_mode;
1621 uint8_t page_scan_mode;
1622 uint8_t uclass[HCI_CLASS_SIZE];
1623 uint16_t clock_offset;
1624 } __attribute__ ((__packed__)) hci_inquiry_response;
1625
1626 #define HCI_EVENT_CON_COMPL 0x03
1627 typedef struct {
1628 uint8_t status;
1629 uint16_t con_handle;
1630 bdaddr_t bdaddr;
1631 uint8_t link_type;
1632 uint8_t encryption_mode;
1633 } __attribute__ ((__packed__)) hci_con_compl_ep;
1634
1635 #define HCI_EVENT_CON_REQ 0x04
1636 typedef struct {
1637 bdaddr_t bdaddr;
1638 uint8_t uclass[HCI_CLASS_SIZE];
1639 uint8_t link_type;
1640 } __attribute__ ((__packed__)) hci_con_req_ep;
1641
1642 #define HCI_EVENT_DISCON_COMPL 0x05
1643 typedef struct {
1644 uint8_t status;
1645 uint16_t con_handle;
1646 uint8_t reason;
1647 } __attribute__ ((__packed__)) hci_discon_compl_ep;
1648
1649 #define HCI_EVENT_AUTH_COMPL 0x06
1650 typedef struct {
1651 uint8_t status;
1652 uint16_t con_handle;
1653 } __attribute__ ((__packed__)) hci_auth_compl_ep;
1654
1655 #define HCI_EVENT_REMOTE_NAME_REQ_COMPL 0x07
1656 typedef struct {
1657 uint8_t status;
1658 bdaddr_t bdaddr;
1659 char name[HCI_UNIT_NAME_SIZE];
1660 } __attribute__ ((__packed__)) hci_remote_name_req_compl_ep;
1661
1662 #define HCI_EVENT_ENCRYPTION_CHANGE 0x08
1663 typedef struct {
1664 uint8_t status;
1665 uint16_t con_handle;
1666 uint8_t encryption_enable;
1667 } __attribute__ ((__packed__)) hci_encryption_change_ep;
1668
1669 #define HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL 0x09
1670 typedef struct {
1671 uint8_t status;
1672 uint16_t con_handle;
1673 } __attribute__ ((__packed__)) hci_change_con_link_key_compl_ep;
1674
1675 #define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a
1676 typedef struct {
1677 uint8_t status;
1678 uint16_t con_handle;
1679 uint8_t key_flag;
1680 } __attribute__ ((__packed__)) hci_master_link_key_compl_ep;
1681
1682 #define HCI_EVENT_READ_REMOTE_FEATURES_COMPL 0x0b
1683 typedef struct {
1684 uint8_t status;
1685 uint16_t con_handle;
1686 uint8_t features[HCI_FEATURES_SIZE];
1687 } __attribute__ ((__packed__)) hci_read_remote_features_compl_ep;
1688
1689 #define HCI_EVENT_READ_REMOTE_VER_INFO_COMPL 0x0c
1690 typedef struct {
1691 uint8_t status;
1692 uint16_t con_handle;
1693 uint8_t lmp_version;
1694 uint16_t manufacturer;
1695 uint16_t lmp_subversion;
1696 } __attribute__ ((__packed__)) hci_read_remote_ver_info_compl_ep;
1697
1698 #define HCI_EVENT_QOS_SETUP_COMPL 0x0d
1699 typedef struct {
1700 uint8_t status;
1701 uint16_t con_handle;
1702 uint8_t flags;
1703 uint8_t service_type;
1704 uint32_t token_rate;
1705 uint32_t peak_bandwidth;
1706 uint32_t latency;
1707 uint32_t delay_variation;
1708 } __attribute__ ((__packed__)) hci_qos_setup_compl_ep;
1709
1710 #define HCI_EVENT_COMMAND_COMPL 0x0e
1711 typedef struct {
1712 uint8_t num_cmd_pkts;
1713 uint16_t opcode;
1714
1715 } __attribute__ ((__packed__)) hci_command_compl_ep;
1716
1717 #define HCI_EVENT_COMMAND_STATUS 0x0f
1718 typedef struct {
1719 uint8_t status;
1720 uint8_t num_cmd_pkts;
1721 uint16_t opcode;
1722 } __attribute__ ((__packed__)) hci_command_status_ep;
1723
1724 #define HCI_EVENT_HARDWARE_ERROR 0x10
1725 typedef struct {
1726 uint8_t hardware_code;
1727 } __attribute__ ((__packed__)) hci_hardware_error_ep;
1728
1729 #define HCI_EVENT_FLUSH_OCCUR 0x11
1730 typedef struct {
1731 uint16_t con_handle;
1732 } __attribute__ ((__packed__)) hci_flush_occur_ep;
1733
1734 #define HCI_EVENT_ROLE_CHANGE 0x12
1735 typedef struct {
1736 uint8_t status;
1737 bdaddr_t bdaddr;
1738 uint8_t role;
1739 } __attribute__ ((__packed__)) hci_role_change_ep;
1740
1741 #define HCI_EVENT_NUM_COMPL_PKTS 0x13
1742 typedef struct {
1743 uint8_t num_con_handles;
1744
1745
1746
1747 } __attribute__ ((__packed__)) hci_num_compl_pkts_ep;
1748
1749 #define HCI_EVENT_MODE_CHANGE 0x14
1750 typedef struct {
1751 uint8_t status;
1752 uint16_t con_handle;
1753 uint8_t unit_mode;
1754 uint16_t interval;
1755 } __attribute__ ((__packed__)) hci_mode_change_ep;
1756
1757 #define HCI_EVENT_RETURN_LINK_KEYS 0x15
1758 typedef struct {
1759 uint8_t num_keys;
1760
1761
1762
1763 } __attribute__ ((__packed__)) hci_return_link_keys_ep;
1764
1765 #define HCI_EVENT_PIN_CODE_REQ 0x16
1766 typedef struct {
1767 bdaddr_t bdaddr;
1768 } __attribute__ ((__packed__)) hci_pin_code_req_ep;
1769
1770 #define HCI_EVENT_LINK_KEY_REQ 0x17
1771 typedef struct {
1772 bdaddr_t bdaddr;
1773 } __attribute__ ((__packed__)) hci_link_key_req_ep;
1774
1775 #define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18
1776 typedef struct {
1777 bdaddr_t bdaddr;
1778 uint8_t key[HCI_KEY_SIZE];
1779 uint8_t key_type;
1780 } __attribute__ ((__packed__)) hci_link_key_notification_ep;
1781
1782 #define HCI_EVENT_LOOPBACK_COMMAND 0x19
1783 typedef hci_cmd_hdr_t hci_loopback_command_ep;
1784
1785 #define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a
1786 typedef struct {
1787 uint8_t link_type;
1788 } __attribute__ ((__packed__)) hci_data_buffer_overflow_ep;
1789
1790 #define HCI_EVENT_MAX_SLOT_CHANGE 0x1b
1791 typedef struct {
1792 uint16_t con_handle;
1793 uint8_t lmp_max_slots;
1794 } __attribute__ ((__packed__)) hci_max_slot_change_ep;
1795
1796 #define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c
1797 typedef struct {
1798 uint8_t status;
1799 uint16_t con_handle;
1800 uint16_t clock_offset;
1801 } __attribute__ ((__packed__)) hci_read_clock_offset_compl_ep;
1802
1803 #define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d
1804 typedef struct {
1805 uint8_t status;
1806 uint16_t con_handle;
1807 uint16_t pkt_type;
1808 } __attribute__ ((__packed__)) hci_con_pkt_type_changed_ep;
1809
1810 #define HCI_EVENT_QOS_VIOLATION 0x1e
1811 typedef struct {
1812 uint16_t con_handle;
1813 } __attribute__ ((__packed__)) hci_qos_violation_ep;
1814
1815
1816 #define HCI_EVENT_PAGE_SCAN_MODE_CHANGE 0x1f
1817 typedef struct {
1818 bdaddr_t bdaddr;
1819 uint8_t page_scan_mode;
1820 } __attribute__ ((__packed__)) hci_page_scan_mode_change_ep;
1821
1822 #define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20
1823 typedef struct {
1824 bdaddr_t bdaddr;
1825 uint8_t page_scan_rep_mode;
1826 } __attribute__ ((__packed__)) hci_page_scan_rep_mode_change_ep;
1827
1828 #define HCI_EVENT_FLOW_SPECIFICATION_COMPL 0x21
1829 typedef struct {
1830 uint8_t status;
1831 uint16_t con_handle;
1832 uint8_t flags;
1833 uint8_t direction;
1834 uint8_t type;
1835 uint32_t token_rate;
1836 uint32_t bucket_size;
1837 uint32_t peak_bandwidth;
1838 uint32_t latency;
1839 } __attribute__ ((__packed__)) hci_flow_specification_compl_ep;
1840
1841 #define HCI_EVENT_RSSI_RESULT 0x22
1842 typedef struct {
1843 uint8_t num_responses;
1844
1845 } __attribute__ ((__packed__)) hci_rssi_result_ep;
1846
1847 typedef struct {
1848 bdaddr_t bdaddr;
1849 uint8_t page_scan_rep_mode;
1850 uint8_t blank;
1851 uint8_t uclass[HCI_CLASS_SIZE];
1852 uint16_t clock_offset;
1853 int8_t rssi;
1854 } __attribute__ ((__packed__)) hci_rssi_response_ep;
1855
1856 #define HCI_EVENT_READ_REMOTE_EXTENDED_FEATURES 0x23
1857 typedef struct {
1858 uint8_t status;
1859 uint16_t con_handle;
1860 uint8_t page;
1861 uint8_t max;
1862 uint8_t features[HCI_FEATURES_SIZE];
1863 } __attribute__ ((__packed__)) hci_read_remote_extended_features_ep;
1864
1865 #define HCI_EVENT_SCO_CON_COMPL 0x2c
1866 typedef struct {
1867 uint8_t status;
1868 uint16_t con_handle;
1869 bdaddr_t bdaddr;
1870 uint8_t link_type;
1871 uint8_t interval;
1872 uint8_t window;
1873 uint16_t rxlen;
1874 uint16_t txlen;
1875 uint8_t mode;
1876 } __attribute__ ((__packed__)) hci_sco_con_compl_ep;
1877
1878 #define HCI_EVENT_SCO_CON_CHANGED 0x2d
1879 typedef struct {
1880 uint8_t status;
1881 uint16_t con_handle;
1882 uint8_t interval;
1883 uint8_t window;
1884 uint16_t rxlen;
1885 uint16_t txlen;
1886 } __attribute__ ((__packed__)) hci_sco_con_changed_ep;
1887
1888 #define HCI_EVENT_BT_LOGO 0xfe
1889
1890 #define HCI_EVENT_VENDOR 0xff
1891
1892
1893
1894
1895
1896
1897
1898
1899 #define SO_HCI_EVT_FILTER 1
1900 #define SO_HCI_PKT_FILTER 2
1901 #define SO_HCI_DIRECTION 3
1902
1903
1904 #define SCM_HCI_DIRECTION SO_HCI_DIRECTION
1905
1906
1907
1908
1909
1910
1911 struct hci_filter {
1912 uint32_t mask[8];
1913 };
1914
1915 static __inline void
1916 hci_filter_set(uint8_t bit, struct hci_filter *filter)
1917 {
1918 uint8_t off = bit - 1;
1919
1920 off >>= 5;
1921 filter->mask[off] |= (1 << ((bit - 1) & 0x1f));
1922 }
1923
1924 static __inline void
1925 hci_filter_clr(uint8_t bit, struct hci_filter *filter)
1926 {
1927 uint8_t off = bit - 1;
1928
1929 off >>= 5;
1930 filter->mask[off] &= ~(1 << ((bit - 1) & 0x1f));
1931 }
1932
1933 static __inline int
1934 hci_filter_test(uint8_t bit, struct hci_filter *filter)
1935 {
1936 uint8_t off = bit - 1;
1937
1938 off >>= 5;
1939 return (filter->mask[off] & (1 << ((bit - 1) & 0x1f)));
1940 }
1941
1942
1943
1944
1945
1946
1947
1948 #define SIOCGBTINFO _IOWR('b', 5, struct btreq)
1949 #define SIOCGBTINFOA _IOWR('b', 6, struct btreq)
1950 #define SIOCNBTINFO _IOWR('b', 7, struct btreq)
1951
1952 #define SIOCSBTFLAGS _IOWR('b', 8, struct btreq)
1953 #define SIOCSBTPOLICY _IOWR('b', 9, struct btreq)
1954 #define SIOCSBTPTYPE _IOWR('b', 10, struct btreq)
1955
1956 #define SIOCGBTSTATS _IOWR('b', 11, struct btreq)
1957 #define SIOCZBTSTATS _IOWR('b', 12, struct btreq)
1958
1959 #define SIOCBTDUMP _IOW('b', 13, struct btreq)
1960 #define SIOCSBTSCOMTU _IOWR('b', 17, struct btreq)
1961
1962 struct bt_stats {
1963 uint32_t err_tx;
1964 uint32_t err_rx;
1965 uint32_t cmd_tx;
1966 uint32_t evt_rx;
1967 uint32_t acl_tx;
1968 uint32_t acl_rx;
1969 uint32_t sco_tx;
1970 uint32_t sco_rx;
1971 uint32_t byte_tx;
1972 uint32_t byte_rx;
1973 };
1974
1975 struct btreq {
1976 char btr_name[HCI_DEVNAME_SIZE];
1977
1978 union {
1979 struct {
1980 bdaddr_t btri_bdaddr;
1981 uint16_t btri_flags;
1982 uint16_t btri_num_cmd;
1983 uint16_t btri_num_acl;
1984 uint16_t btri_num_sco;
1985 uint16_t btri_acl_mtu;
1986 uint16_t btri_sco_mtu;
1987 uint16_t btri_link_policy;
1988 uint16_t btri_packet_type;
1989 } btri;
1990 struct bt_stats btrs;
1991 } btru;
1992 };
1993
1994 #define btr_flags btru.btri.btri_flags
1995 #define btr_bdaddr btru.btri.btri_bdaddr
1996 #define btr_num_cmd btru.btri.btri_num_cmd
1997 #define btr_num_acl btru.btri.btri_num_acl
1998 #define btr_num_sco btru.btri.btri_num_sco
1999 #define btr_acl_mtu btru.btri.btri_acl_mtu
2000 #define btr_sco_mtu btru.btri.btri_sco_mtu
2001 #define btr_link_policy btru.btri.btri_link_policy
2002 #define btr_packet_type btru.btri.btri_packet_type
2003 #define btr_uclass btru.btri.btri_uclass
2004 #define btr_stats btru.btrs
2005
2006
2007 #define BTF_UP (1<<0)
2008 #define BTF_RUNNING (1<<1)
2009 #define BTF_XMIT_CMD (1<<2)
2010 #define BTF_XMIT_ACL (1<<3)
2011 #define BTF_XMIT_SCO (1<<4)
2012 #define BTF_XMIT (BTF_XMIT_CMD | BTF_XMIT_ACL | BTF_XMIT_SCO)
2013 #define BTF_INIT_BDADDR (1<<5)
2014 #define BTF_INIT_BUFFER_SIZE (1<<6)
2015 #define BTF_INIT_FEATURES (1<<7)
2016 #define BTF_INIT (BTF_INIT_BDADDR | BTF_INIT_BUFFER_SIZE | BTF_INIT_FEATURES)
2017
2018
2019
2020
2021
2022
2023
2024 #ifdef _KERNEL
2025
2026 #include <net/if.h>
2027
2028 struct l2cap_channel;
2029 struct mbuf;
2030 struct sco_pcb;
2031 struct socket;
2032
2033
2034
2035
2036 extern int hci_memo_expiry;
2037 extern int hci_acl_expiry;
2038 extern int hci_sendspace, hci_recvspace;
2039 extern int hci_eventq_max, hci_aclrxq_max, hci_scorxq_max;
2040
2041
2042
2043
2044 struct hci_link {
2045 struct hci_unit *hl_unit;
2046 TAILQ_ENTRY(hci_link) hl_next;
2047
2048
2049 uint16_t hl_state;
2050 uint16_t hl_flags;
2051 bdaddr_t hl_bdaddr;
2052 uint16_t hl_handle;
2053 uint8_t hl_type;
2054
2055
2056 uint8_t hl_lastid;
2057 uint16_t hl_refcnt;
2058 uint16_t hl_mtu;
2059 uint16_t hl_flush;
2060
2061 TAILQ_HEAD(,l2cap_pdu) hl_txq;
2062 int hl_txqlen;
2063 struct mbuf *hl_rxp;
2064 struct timeout hl_expire;
2065 TAILQ_HEAD(,l2cap_req) hl_reqs;
2066
2067
2068 struct hci_link *hl_link;
2069 struct sco_pcb *hl_sco;
2070 struct ifqueue hl_data;
2071 };
2072
2073
2074 #define HCI_LINK_CLOSED 0
2075 #define HCI_LINK_WAIT_CONNECT 1
2076 #define HCI_LINK_WAIT_AUTH 2
2077 #define HCI_LINK_WAIT_ENCRYPT 3
2078 #define HCI_LINK_WAIT_SECURE 4
2079 #define HCI_LINK_OPEN 5
2080 #define HCI_LINK_BLOCK 6
2081
2082
2083 #define HCI_LINK_AUTH_REQ (1<<0)
2084 #define HCI_LINK_ENCRYPT_REQ (1<<1)
2085 #define HCI_LINK_SECURE_REQ (1<<2)
2086 #define HCI_LINK_AUTH (1<<3)
2087 #define HCI_LINK_ENCRYPT (1<<4)
2088 #define HCI_LINK_SECURE (1<<5)
2089
2090
2091
2092
2093
2094 struct hci_memo {
2095 struct timeval time;
2096 hci_inquiry_response response;
2097 LIST_ENTRY(hci_memo) next;
2098 };
2099
2100
2101
2102
2103 struct hci_unit {
2104 struct device *hci_softc;
2105 struct device *hci_bthub;
2106
2107
2108 char *hci_devname;
2109 bdaddr_t hci_bdaddr;
2110 uint16_t hci_flags;
2111
2112 uint16_t hci_packet_type;
2113 uint16_t hci_acl_mask;
2114 uint16_t hci_sco_mask;
2115
2116 uint16_t hci_link_policy;
2117 uint16_t hci_lmp_mask;
2118
2119
2120 uint16_t hci_max_acl_size;
2121 uint16_t hci_num_acl_pkts;
2122 uint8_t hci_num_cmd_pkts;
2123 uint8_t hci_max_sco_size;
2124 uint16_t hci_num_sco_pkts;
2125
2126 TAILQ_HEAD(,hci_link) hci_links;
2127 LIST_HEAD(,hci_memo) hci_memos;
2128
2129
2130
2131
2132
2133
2134 int (*hci_enable)
2135 (struct hci_unit *);
2136 void (*hci_disable)
2137 (struct hci_unit *);
2138 void (*hci_start_cmd)
2139 (struct hci_unit *);
2140 void (*hci_start_acl)
2141 (struct hci_unit *);
2142 void (*hci_start_sco)
2143 (struct hci_unit *);
2144 int hci_ipl;
2145
2146
2147 struct ifqueue hci_eventq;
2148 struct ifqueue hci_aclrxq;
2149 struct ifqueue hci_scorxq;
2150 uint16_t hci_eventqlen;
2151 uint16_t hci_aclrxqlen;
2152 uint16_t hci_scorxqlen;
2153
2154
2155 struct ifqueue hci_cmdwait;
2156 struct ifqueue hci_cmdq;
2157 struct ifqueue hci_acltxq;
2158 struct ifqueue hci_scotxq;
2159 struct ifqueue hci_scodone;
2160
2161 struct bt_stats hci_stats;
2162
2163 TAILQ_ENTRY(hci_unit) hci_next;
2164 };
2165
2166 extern TAILQ_HEAD(hci_unit_list, hci_unit) hci_unit_list;
2167
2168
2169
2170
2171
2172
2173 void hci_event(struct mbuf *, struct hci_unit *);
2174
2175
2176 int hci_ioctl(unsigned long, void *, struct proc *);
2177
2178
2179 struct hci_link *hci_acl_open(struct hci_unit *, bdaddr_t *);
2180 struct hci_link *hci_acl_newconn(struct hci_unit *, bdaddr_t *);
2181 void hci_acl_close(struct hci_link *, int);
2182 void hci_acl_timeout(void *);
2183 int hci_acl_setmode(struct hci_link *);
2184 void hci_acl_linkmode(struct hci_link *);
2185 void hci_acl_recv(struct mbuf *, struct hci_unit *);
2186 int hci_acl_send(struct mbuf *, struct hci_link *, struct l2cap_channel *);
2187 void hci_acl_start(struct hci_link *);
2188 void hci_acl_complete(struct hci_link *, int);
2189 struct hci_link *hci_sco_newconn(struct hci_unit *, bdaddr_t *);
2190 void hci_sco_recv(struct mbuf *, struct hci_unit *);
2191 void hci_sco_start(struct hci_link *);
2192 void hci_sco_complete(struct hci_link *, int);
2193 struct hci_link *hci_link_alloc(struct hci_unit *);
2194 void hci_link_free(struct hci_link *, int);
2195 struct hci_link *hci_link_lookup_state(struct hci_unit *, uint16_t, uint16_t);
2196 struct hci_link *hci_link_lookup_bdaddr(struct hci_unit *, bdaddr_t *, uint16_t);
2197 struct hci_link *hci_link_lookup_handle(struct hci_unit *, uint16_t);
2198
2199
2200 int hci_route_lookup(bdaddr_t *, bdaddr_t *);
2201 struct hci_memo *hci_memo_find(struct hci_unit *, bdaddr_t *);
2202 void hci_memo_free(struct hci_memo *);
2203
2204
2205 void hci_drop(void *);
2206 int hci_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *);
2207 int hci_ctloutput(int, struct socket *, int, int, struct mbuf **);
2208 void hci_mtap(struct mbuf *, struct hci_unit *);
2209
2210
2211 void hci_attach(struct hci_unit *);
2212 void hci_detach(struct hci_unit *);
2213 int hci_enable(struct hci_unit *);
2214 void hci_disable(struct hci_unit *);
2215 struct hci_unit *hci_unit_lookup(bdaddr_t *);
2216 int hci_send_cmd(struct hci_unit *, uint16_t, void *, uint8_t);
2217 void hci_input_event(struct hci_unit *, struct mbuf *);
2218 void hci_input_acl(struct hci_unit *, struct mbuf *);
2219 void hci_input_sco(struct hci_unit *, struct mbuf *);
2220 void hci_complete_sco(struct hci_unit *, struct mbuf *);
2221 void hci_output_cmd(struct hci_unit *, struct mbuf *);
2222 void hci_output_acl(struct hci_unit *, struct mbuf *);
2223 void hci_output_sco(struct hci_unit *, struct mbuf *);
2224 void hci_intr(void *);
2225
2226
2227 #define M_GETCTX(m, t) ((t)(m)->m_pkthdr.rcvif)
2228 #define M_SETCTX(m, c) ((m)->m_pkthdr.rcvif = (void *)(c))
2229 #define splraiseipl(ipl) splbio()
2230 #define ENOLINK ENOENT
2231 #define EPASSTHROUGH ENOTTY
2232
2233 #endif
2234
2235 #endif