2 * BT-AMP (BlueTooth Alternate Mac and Phy) HCI (Host/Controller Interface)
4 * Copyright (C) 1999-2016, Broadcom Corporation
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
25 * <<Broadcom-WL-IPTag/Open:>>
27 * $Id: bt_amp_hci.h 518342 2014-12-01 23:21:41Z $
33 /* This marks the start of a packed structure section. */
34 #include <packed_section_start.h>
37 /* AMP HCI CMD packet format */
38 typedef BWL_PRE_PACKED_STRUCT struct amp_hci_cmd {
42 } BWL_POST_PACKED_STRUCT amp_hci_cmd_t;
44 #define HCI_CMD_PREAMBLE_SIZE OFFSETOF(amp_hci_cmd_t, parms)
45 #define HCI_CMD_DATA_SIZE 255
47 /* AMP HCI CMD opcode layout */
48 #define HCI_CMD_OPCODE(ogf, ocf) ((((ogf) & 0x3F) << 10) | ((ocf) & 0x03FF))
49 #define HCI_CMD_OGF(opcode) ((uint8)(((opcode) >> 10) & 0x3F))
50 #define HCI_CMD_OCF(opcode) ((opcode) & 0x03FF)
52 /* AMP HCI command opcodes */
53 #define HCI_Read_Failed_Contact_Counter HCI_CMD_OPCODE(0x05, 0x0001)
54 #define HCI_Reset_Failed_Contact_Counter HCI_CMD_OPCODE(0x05, 0x0002)
55 #define HCI_Read_Link_Quality HCI_CMD_OPCODE(0x05, 0x0003)
56 #define HCI_Read_Local_AMP_Info HCI_CMD_OPCODE(0x05, 0x0009)
57 #define HCI_Read_Local_AMP_ASSOC HCI_CMD_OPCODE(0x05, 0x000A)
58 #define HCI_Write_Remote_AMP_ASSOC HCI_CMD_OPCODE(0x05, 0x000B)
59 #define HCI_Create_Physical_Link HCI_CMD_OPCODE(0x01, 0x0035)
60 #define HCI_Accept_Physical_Link_Request HCI_CMD_OPCODE(0x01, 0x0036)
61 #define HCI_Disconnect_Physical_Link HCI_CMD_OPCODE(0x01, 0x0037)
62 #define HCI_Create_Logical_Link HCI_CMD_OPCODE(0x01, 0x0038)
63 #define HCI_Accept_Logical_Link HCI_CMD_OPCODE(0x01, 0x0039)
64 #define HCI_Disconnect_Logical_Link HCI_CMD_OPCODE(0x01, 0x003A)
65 #define HCI_Logical_Link_Cancel HCI_CMD_OPCODE(0x01, 0x003B)
66 #define HCI_Flow_Spec_Modify HCI_CMD_OPCODE(0x01, 0x003C)
67 #define HCI_Write_Flow_Control_Mode HCI_CMD_OPCODE(0x01, 0x0067)
68 #define HCI_Read_Best_Effort_Flush_Timeout HCI_CMD_OPCODE(0x01, 0x0069)
69 #define HCI_Write_Best_Effort_Flush_Timeout HCI_CMD_OPCODE(0x01, 0x006A)
70 #define HCI_Short_Range_Mode HCI_CMD_OPCODE(0x01, 0x006B)
71 #define HCI_Reset HCI_CMD_OPCODE(0x03, 0x0003)
72 #define HCI_Read_Connection_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0015)
73 #define HCI_Write_Connection_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0016)
74 #define HCI_Read_Link_Supervision_Timeout HCI_CMD_OPCODE(0x03, 0x0036)
75 #define HCI_Write_Link_Supervision_Timeout HCI_CMD_OPCODE(0x03, 0x0037)
76 #define HCI_Enhanced_Flush HCI_CMD_OPCODE(0x03, 0x005F)
77 #define HCI_Read_Logical_Link_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0061)
78 #define HCI_Write_Logical_Link_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0062)
79 #define HCI_Set_Event_Mask_Page_2 HCI_CMD_OPCODE(0x03, 0x0063)
80 #define HCI_Read_Location_Data_Command HCI_CMD_OPCODE(0x03, 0x0064)
81 #define HCI_Write_Location_Data_Command HCI_CMD_OPCODE(0x03, 0x0065)
82 #define HCI_Read_Local_Version_Info HCI_CMD_OPCODE(0x04, 0x0001)
83 #define HCI_Read_Local_Supported_Commands HCI_CMD_OPCODE(0x04, 0x0002)
84 #define HCI_Read_Buffer_Size HCI_CMD_OPCODE(0x04, 0x0005)
85 #define HCI_Read_Data_Block_Size HCI_CMD_OPCODE(0x04, 0x000A)
87 /* AMP HCI command parameters */
88 typedef BWL_PRE_PACKED_STRUCT struct read_local_cmd_parms {
90 uint8 offset[2]; /* length so far */
92 } BWL_POST_PACKED_STRUCT read_local_cmd_parms_t;
94 typedef BWL_PRE_PACKED_STRUCT struct write_remote_cmd_parms {
99 } BWL_POST_PACKED_STRUCT write_remote_cmd_parms_t;
101 typedef BWL_PRE_PACKED_STRUCT struct phy_link_cmd_parms {
106 } BWL_POST_PACKED_STRUCT phy_link_cmd_parms_t;
108 typedef BWL_PRE_PACKED_STRUCT struct dis_phy_link_cmd_parms {
111 } BWL_POST_PACKED_STRUCT dis_phy_link_cmd_parms_t;
113 typedef BWL_PRE_PACKED_STRUCT struct log_link_cmd_parms {
117 } BWL_POST_PACKED_STRUCT log_link_cmd_parms_t;
119 typedef BWL_PRE_PACKED_STRUCT struct ext_flow_spec {
123 uint8 sdu_ia_time[4];
124 uint8 access_latency[4];
125 uint8 flush_timeout[4];
126 } BWL_POST_PACKED_STRUCT ext_flow_spec_t;
128 typedef BWL_PRE_PACKED_STRUCT struct log_link_cancel_cmd_parms {
131 } BWL_POST_PACKED_STRUCT log_link_cancel_cmd_parms_t;
133 typedef BWL_PRE_PACKED_STRUCT struct flow_spec_mod_cmd_parms {
137 } BWL_POST_PACKED_STRUCT flow_spec_mod_cmd_parms_t;
139 typedef BWL_PRE_PACKED_STRUCT struct plh_pad {
142 } BWL_POST_PACKED_STRUCT plh_pad_t;
144 typedef BWL_PRE_PACKED_STRUCT union hci_handle {
147 } BWL_POST_PACKED_STRUCT hci_handle_t;
149 typedef BWL_PRE_PACKED_STRUCT struct ls_to_cmd_parms {
152 } BWL_POST_PACKED_STRUCT ls_to_cmd_parms_t;
154 typedef BWL_PRE_PACKED_STRUCT struct befto_cmd_parms {
157 } BWL_POST_PACKED_STRUCT befto_cmd_parms_t;
159 typedef BWL_PRE_PACKED_STRUCT struct srm_cmd_parms {
162 } BWL_POST_PACKED_STRUCT srm_cmd_parms_t;
164 typedef BWL_PRE_PACKED_STRUCT struct ld_cmd_parms {
169 } BWL_POST_PACKED_STRUCT ld_cmd_parms_t;
171 typedef BWL_PRE_PACKED_STRUCT struct eflush_cmd_parms {
174 } BWL_POST_PACKED_STRUCT eflush_cmd_parms_t;
176 /* Generic AMP extended flow spec service types */
177 #define EFS_SVCTYPE_NO_TRAFFIC 0
178 #define EFS_SVCTYPE_BEST_EFFORT 1
179 #define EFS_SVCTYPE_GUARANTEED 2
181 /* AMP HCI event packet format */
182 typedef BWL_PRE_PACKED_STRUCT struct amp_hci_event {
186 } BWL_POST_PACKED_STRUCT amp_hci_event_t;
188 #define HCI_EVT_PREAMBLE_SIZE OFFSETOF(amp_hci_event_t, parms)
190 /* AMP HCI event codes */
191 #define HCI_Command_Complete 0x0E
192 #define HCI_Command_Status 0x0F
193 #define HCI_Flush_Occurred 0x11
194 #define HCI_Enhanced_Flush_Complete 0x39
195 #define HCI_Physical_Link_Complete 0x40
196 #define HCI_Channel_Select 0x41
197 #define HCI_Disconnect_Physical_Link_Complete 0x42
198 #define HCI_Logical_Link_Complete 0x45
199 #define HCI_Disconnect_Logical_Link_Complete 0x46
200 #define HCI_Flow_Spec_Modify_Complete 0x47
201 #define HCI_Number_of_Completed_Data_Blocks 0x48
202 #define HCI_Short_Range_Mode_Change_Complete 0x4C
203 #define HCI_Status_Change_Event 0x4D
204 #define HCI_Vendor_Specific 0xFF
206 /* AMP HCI event mask bit positions */
207 #define HCI_Physical_Link_Complete_Event_Mask 0x0001
208 #define HCI_Channel_Select_Event_Mask 0x0002
209 #define HCI_Disconnect_Physical_Link_Complete_Event_Mask 0x0004
210 #define HCI_Logical_Link_Complete_Event_Mask 0x0020
211 #define HCI_Disconnect_Logical_Link_Complete_Event_Mask 0x0040
212 #define HCI_Flow_Spec_Modify_Complete_Event_Mask 0x0080
213 #define HCI_Number_of_Completed_Data_Blocks_Event_Mask 0x0100
214 #define HCI_Short_Range_Mode_Change_Complete_Event_Mask 0x1000
215 #define HCI_Status_Change_Event_Mask 0x2000
216 #define HCI_All_Event_Mask 0x31e7
217 /* AMP HCI event parameters */
218 typedef BWL_PRE_PACKED_STRUCT struct cmd_status_parms {
222 } BWL_POST_PACKED_STRUCT cmd_status_parms_t;
224 typedef BWL_PRE_PACKED_STRUCT struct cmd_complete_parms {
228 } BWL_POST_PACKED_STRUCT cmd_complete_parms_t;
230 typedef BWL_PRE_PACKED_STRUCT struct flush_occurred_evt_parms {
232 } BWL_POST_PACKED_STRUCT flush_occurred_evt_parms_t;
234 typedef BWL_PRE_PACKED_STRUCT struct write_remote_evt_parms {
237 } BWL_POST_PACKED_STRUCT write_remote_evt_parms_t;
239 typedef BWL_PRE_PACKED_STRUCT struct read_local_evt_parms {
244 } BWL_POST_PACKED_STRUCT read_local_evt_parms_t;
246 typedef BWL_PRE_PACKED_STRUCT struct read_local_info_evt_parms {
255 uint16 AMP_ASSOC_len;
256 uint32 max_flush_timeout;
257 uint32 be_flush_timeout;
258 } BWL_POST_PACKED_STRUCT read_local_info_evt_parms_t;
260 typedef BWL_PRE_PACKED_STRUCT struct log_link_evt_parms {
265 } BWL_POST_PACKED_STRUCT log_link_evt_parms_t;
267 typedef BWL_PRE_PACKED_STRUCT struct disc_log_link_evt_parms {
271 } BWL_POST_PACKED_STRUCT disc_log_link_evt_parms_t;
273 typedef BWL_PRE_PACKED_STRUCT struct log_link_cancel_evt_parms {
277 } BWL_POST_PACKED_STRUCT log_link_cancel_evt_parms_t;
279 typedef BWL_PRE_PACKED_STRUCT struct flow_spec_mod_evt_parms {
282 } BWL_POST_PACKED_STRUCT flow_spec_mod_evt_parms_t;
284 typedef BWL_PRE_PACKED_STRUCT struct phy_link_evt_parms {
287 } BWL_POST_PACKED_STRUCT phy_link_evt_parms_t;
289 typedef BWL_PRE_PACKED_STRUCT struct dis_phy_link_evt_parms {
293 } BWL_POST_PACKED_STRUCT dis_phy_link_evt_parms_t;
295 typedef BWL_PRE_PACKED_STRUCT struct read_ls_to_evt_parms {
299 } BWL_POST_PACKED_STRUCT read_ls_to_evt_parms_t;
301 typedef BWL_PRE_PACKED_STRUCT struct read_lla_ca_to_evt_parms {
304 } BWL_POST_PACKED_STRUCT read_lla_ca_to_evt_parms_t;
306 typedef BWL_PRE_PACKED_STRUCT struct read_data_block_size_evt_parms {
309 uint16 data_block_len;
310 uint16 data_block_num;
311 } BWL_POST_PACKED_STRUCT read_data_block_size_evt_parms_t;
313 typedef BWL_PRE_PACKED_STRUCT struct data_blocks {
317 } BWL_POST_PACKED_STRUCT data_blocks_t;
319 typedef BWL_PRE_PACKED_STRUCT struct num_completed_data_blocks_evt_parms {
322 data_blocks_t completed[1];
323 } BWL_POST_PACKED_STRUCT num_completed_data_blocks_evt_parms_t;
325 typedef BWL_PRE_PACKED_STRUCT struct befto_evt_parms {
328 } BWL_POST_PACKED_STRUCT befto_evt_parms_t;
330 typedef BWL_PRE_PACKED_STRUCT struct srm_evt_parms {
334 } BWL_POST_PACKED_STRUCT srm_evt_parms_t;
336 typedef BWL_PRE_PACKED_STRUCT struct contact_counter_evt_parms {
340 } BWL_POST_PACKED_STRUCT contact_counter_evt_parms_t;
342 typedef BWL_PRE_PACKED_STRUCT struct contact_counter_reset_evt_parms {
345 } BWL_POST_PACKED_STRUCT contact_counter_reset_evt_parms_t;
347 typedef BWL_PRE_PACKED_STRUCT struct read_linkq_evt_parms {
351 } BWL_POST_PACKED_STRUCT read_linkq_evt_parms_t;
353 typedef BWL_PRE_PACKED_STRUCT struct ld_evt_parms {
359 } BWL_POST_PACKED_STRUCT ld_evt_parms_t;
361 typedef BWL_PRE_PACKED_STRUCT struct eflush_complete_evt_parms {
363 } BWL_POST_PACKED_STRUCT eflush_complete_evt_parms_t;
365 typedef BWL_PRE_PACKED_STRUCT struct vendor_specific_evt_parms {
368 } BWL_POST_PACKED_STRUCT vendor_specific_evt_parms_t;
370 typedef BWL_PRE_PACKED_STRUCT struct local_version_info_evt_parms {
376 uint16 pal_subversion;
377 } BWL_POST_PACKED_STRUCT local_version_info_evt_parms_t;
379 #define MAX_SUPPORTED_CMD_BYTE 64
380 typedef BWL_PRE_PACKED_STRUCT struct local_supported_cmd_evt_parms {
382 uint8 cmd[MAX_SUPPORTED_CMD_BYTE];
383 } BWL_POST_PACKED_STRUCT local_supported_cmd_evt_parms_t;
385 typedef BWL_PRE_PACKED_STRUCT struct status_change_evt_parms {
388 } BWL_POST_PACKED_STRUCT status_change_evt_parms_t;
390 /* AMP HCI error codes */
391 #define HCI_SUCCESS 0x00
392 #define HCI_ERR_ILLEGAL_COMMAND 0x01
393 #define HCI_ERR_NO_CONNECTION 0x02
394 #define HCI_ERR_MEMORY_FULL 0x07
395 #define HCI_ERR_CONNECTION_TIMEOUT 0x08
396 #define HCI_ERR_MAX_NUM_OF_CONNECTIONS 0x09
397 #define HCI_ERR_CONNECTION_EXISTS 0x0B
398 #define HCI_ERR_CONNECTION_DISALLOWED 0x0C
399 #define HCI_ERR_CONNECTION_ACCEPT_TIMEOUT 0x10
400 #define HCI_ERR_UNSUPPORTED_VALUE 0x11
401 #define HCI_ERR_ILLEGAL_PARAMETER_FMT 0x12
402 #define HCI_ERR_CONN_TERM_BY_LOCAL_HOST 0x16
403 #define HCI_ERR_UNSPECIFIED 0x1F
404 #define HCI_ERR_UNIT_KEY_USED 0x26
405 #define HCI_ERR_QOS_REJECTED 0x2D
406 #define HCI_ERR_PARAM_OUT_OF_RANGE 0x30
407 #define HCI_ERR_NO_SUITABLE_CHANNEL 0x39
408 #define HCI_ERR_CHANNEL_MOVE 0xFF
410 /* AMP HCI ACL Data packet format */
411 typedef BWL_PRE_PACKED_STRUCT struct amp_hci_ACL_data {
412 uint16 handle; /* 12-bit connection handle + 2-bit PB and 2-bit BC flags */
413 uint16 dlen; /* data total length */
415 } BWL_POST_PACKED_STRUCT amp_hci_ACL_data_t;
417 #define HCI_ACL_DATA_PREAMBLE_SIZE OFFSETOF(amp_hci_ACL_data_t, data)
419 #define HCI_ACL_DATA_BC_FLAGS (0x0 << 14)
420 #define HCI_ACL_DATA_PB_FLAGS (0x3 << 12)
422 #define HCI_ACL_DATA_HANDLE(handle) ((handle) & 0x0fff)
423 #define HCI_ACL_DATA_FLAGS(handle) ((handle) >> 12)
425 /* AMP Activity Report packet formats */
426 typedef BWL_PRE_PACKED_STRUCT struct amp_hci_activity_report {
430 } BWL_POST_PACKED_STRUCT amp_hci_activity_report_t;
432 typedef BWL_PRE_PACKED_STRUCT struct amp_hci_activity_report_triple {
436 } BWL_POST_PACKED_STRUCT amp_hci_activity_report_triple_t;
438 #define HCI_AR_SCHEDULE_KNOWN 0x01
441 /* This marks the end of a packed structure section. */
442 #include <packed_section_end.h>
444 #endif /* _bt_amp_hci_h_ */