diff options
Diffstat (limited to 'include/net/bluetooth/hci.h')
-rw-r--r-- | include/net/bluetooth/hci.h | 110 |
1 files changed, 97 insertions, 13 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 3def64ba77fa..ccd723e0f783 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -30,6 +30,9 @@ | |||
30 | #define HCI_MAX_EVENT_SIZE 260 | 30 | #define HCI_MAX_EVENT_SIZE 260 |
31 | #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) | 31 | #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) |
32 | 32 | ||
33 | #define HCI_LINK_KEY_SIZE 16 | ||
34 | #define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) | ||
35 | |||
33 | /* HCI dev events */ | 36 | /* HCI dev events */ |
34 | #define HCI_DEV_REG 1 | 37 | #define HCI_DEV_REG 1 |
35 | #define HCI_DEV_UNREG 2 | 38 | #define HCI_DEV_UNREG 2 |
@@ -56,9 +59,12 @@ | |||
56 | #define HCI_BREDR 0x00 | 59 | #define HCI_BREDR 0x00 |
57 | #define HCI_AMP 0x01 | 60 | #define HCI_AMP 0x01 |
58 | 61 | ||
62 | /* First BR/EDR Controller shall have ID = 0 */ | ||
63 | #define HCI_BREDR_ID 0 | ||
64 | |||
59 | /* HCI device quirks */ | 65 | /* HCI device quirks */ |
60 | enum { | 66 | enum { |
61 | HCI_QUIRK_NO_RESET, | 67 | HCI_QUIRK_RESET_ON_CLOSE, |
62 | HCI_QUIRK_RAW_DEVICE, | 68 | HCI_QUIRK_RAW_DEVICE, |
63 | HCI_QUIRK_FIXUP_BUFFER_SIZE | 69 | HCI_QUIRK_FIXUP_BUFFER_SIZE |
64 | }; | 70 | }; |
@@ -133,13 +139,12 @@ enum { | |||
133 | #define HCIINQUIRY _IOR('H', 240, int) | 139 | #define HCIINQUIRY _IOR('H', 240, int) |
134 | 140 | ||
135 | /* HCI timeouts */ | 141 | /* HCI timeouts */ |
136 | #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ | 142 | #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ |
137 | #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ | 143 | #define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ |
138 | #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ | 144 | #define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ |
139 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ | 145 | #define HCI_CMD_TIMEOUT msecs_to_jiffies(1000) /* 1 second */ |
140 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | 146 | #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ |
141 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ | 147 | #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ |
142 | #define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */ | ||
143 | 148 | ||
144 | /* HCI data types */ | 149 | /* HCI data types */ |
145 | #define HCI_COMMAND_PKT 0x01 | 150 | #define HCI_COMMAND_PKT 0x01 |
@@ -371,7 +376,7 @@ struct hci_cp_reject_conn_req { | |||
371 | #define HCI_OP_LINK_KEY_REPLY 0x040b | 376 | #define HCI_OP_LINK_KEY_REPLY 0x040b |
372 | struct hci_cp_link_key_reply { | 377 | struct hci_cp_link_key_reply { |
373 | bdaddr_t bdaddr; | 378 | bdaddr_t bdaddr; |
374 | __u8 link_key[16]; | 379 | __u8 link_key[HCI_LINK_KEY_SIZE]; |
375 | } __packed; | 380 | } __packed; |
376 | 381 | ||
377 | #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c | 382 | #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c |
@@ -523,6 +528,28 @@ struct hci_cp_io_capability_neg_reply { | |||
523 | __u8 reason; | 528 | __u8 reason; |
524 | } __packed; | 529 | } __packed; |
525 | 530 | ||
531 | #define HCI_OP_CREATE_PHY_LINK 0x0435 | ||
532 | struct hci_cp_create_phy_link { | ||
533 | __u8 phy_handle; | ||
534 | __u8 key_len; | ||
535 | __u8 key_type; | ||
536 | __u8 key[HCI_AMP_LINK_KEY_SIZE]; | ||
537 | } __packed; | ||
538 | |||
539 | #define HCI_OP_ACCEPT_PHY_LINK 0x0436 | ||
540 | struct hci_cp_accept_phy_link { | ||
541 | __u8 phy_handle; | ||
542 | __u8 key_len; | ||
543 | __u8 key_type; | ||
544 | __u8 key[HCI_AMP_LINK_KEY_SIZE]; | ||
545 | } __packed; | ||
546 | |||
547 | #define HCI_OP_DISCONN_PHY_LINK 0x0437 | ||
548 | struct hci_cp_disconn_phy_link { | ||
549 | __u8 phy_handle; | ||
550 | __u8 reason; | ||
551 | } __packed; | ||
552 | |||
526 | #define HCI_OP_SNIFF_MODE 0x0803 | 553 | #define HCI_OP_SNIFF_MODE 0x0803 |
527 | struct hci_cp_sniff_mode { | 554 | struct hci_cp_sniff_mode { |
528 | __le16 handle; | 555 | __le16 handle; |
@@ -818,6 +845,31 @@ struct hci_rp_read_local_amp_info { | |||
818 | __le32 be_flush_to; | 845 | __le32 be_flush_to; |
819 | } __packed; | 846 | } __packed; |
820 | 847 | ||
848 | #define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a | ||
849 | struct hci_cp_read_local_amp_assoc { | ||
850 | __u8 phy_handle; | ||
851 | __le16 len_so_far; | ||
852 | __le16 max_len; | ||
853 | } __packed; | ||
854 | struct hci_rp_read_local_amp_assoc { | ||
855 | __u8 status; | ||
856 | __u8 phy_handle; | ||
857 | __le16 rem_len; | ||
858 | __u8 frag[0]; | ||
859 | } __packed; | ||
860 | |||
861 | #define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b | ||
862 | struct hci_cp_write_remote_amp_assoc { | ||
863 | __u8 phy_handle; | ||
864 | __le16 len_so_far; | ||
865 | __le16 rem_len; | ||
866 | __u8 frag[0]; | ||
867 | } __packed; | ||
868 | struct hci_rp_write_remote_amp_assoc { | ||
869 | __u8 status; | ||
870 | __u8 phy_handle; | ||
871 | } __packed; | ||
872 | |||
821 | #define HCI_OP_LE_SET_EVENT_MASK 0x2001 | 873 | #define HCI_OP_LE_SET_EVENT_MASK 0x2001 |
822 | struct hci_cp_le_set_event_mask { | 874 | struct hci_cp_le_set_event_mask { |
823 | __u8 mask[8]; | 875 | __u8 mask[8]; |
@@ -1048,7 +1100,7 @@ struct hci_ev_link_key_req { | |||
1048 | #define HCI_EV_LINK_KEY_NOTIFY 0x18 | 1100 | #define HCI_EV_LINK_KEY_NOTIFY 0x18 |
1049 | struct hci_ev_link_key_notify { | 1101 | struct hci_ev_link_key_notify { |
1050 | bdaddr_t bdaddr; | 1102 | bdaddr_t bdaddr; |
1051 | __u8 link_key[16]; | 1103 | __u8 link_key[HCI_LINK_KEY_SIZE]; |
1052 | __u8 key_type; | 1104 | __u8 key_type; |
1053 | } __packed; | 1105 | } __packed; |
1054 | 1106 | ||
@@ -1196,6 +1248,39 @@ struct hci_ev_le_meta { | |||
1196 | __u8 subevent; | 1248 | __u8 subevent; |
1197 | } __packed; | 1249 | } __packed; |
1198 | 1250 | ||
1251 | #define HCI_EV_PHY_LINK_COMPLETE 0x40 | ||
1252 | struct hci_ev_phy_link_complete { | ||
1253 | __u8 status; | ||
1254 | __u8 phy_handle; | ||
1255 | } __packed; | ||
1256 | |||
1257 | #define HCI_EV_CHANNEL_SELECTED 0x41 | ||
1258 | struct hci_ev_channel_selected { | ||
1259 | __u8 phy_handle; | ||
1260 | } __packed; | ||
1261 | |||
1262 | #define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42 | ||
1263 | struct hci_ev_disconn_phy_link_complete { | ||
1264 | __u8 status; | ||
1265 | __u8 phy_handle; | ||
1266 | __u8 reason; | ||
1267 | } __packed; | ||
1268 | |||
1269 | #define HCI_EV_LOGICAL_LINK_COMPLETE 0x45 | ||
1270 | struct hci_ev_logical_link_complete { | ||
1271 | __u8 status; | ||
1272 | __le16 handle; | ||
1273 | __u8 phy_handle; | ||
1274 | __u8 flow_spec_id; | ||
1275 | } __packed; | ||
1276 | |||
1277 | #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46 | ||
1278 | struct hci_ev_disconn_logical_link_complete { | ||
1279 | __u8 status; | ||
1280 | __le16 handle; | ||
1281 | __u8 reason; | ||
1282 | } __packed; | ||
1283 | |||
1199 | #define HCI_EV_NUM_COMP_BLOCKS 0x48 | 1284 | #define HCI_EV_NUM_COMP_BLOCKS 0x48 |
1200 | struct hci_comp_blocks_info { | 1285 | struct hci_comp_blocks_info { |
1201 | __le16 handle; | 1286 | __le16 handle; |
@@ -1296,7 +1381,6 @@ struct hci_sco_hdr { | |||
1296 | __u8 dlen; | 1381 | __u8 dlen; |
1297 | } __packed; | 1382 | } __packed; |
1298 | 1383 | ||
1299 | #include <linux/skbuff.h> | ||
1300 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) | 1384 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) |
1301 | { | 1385 | { |
1302 | return (struct hci_event_hdr *) skb->data; | 1386 | return (struct hci_event_hdr *) skb->data; |
@@ -1313,12 +1397,12 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) | |||
1313 | } | 1397 | } |
1314 | 1398 | ||
1315 | /* Command opcode pack/unpack */ | 1399 | /* Command opcode pack/unpack */ |
1316 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) | 1400 | #define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10))) |
1317 | #define hci_opcode_ogf(op) (op >> 10) | 1401 | #define hci_opcode_ogf(op) (op >> 10) |
1318 | #define hci_opcode_ocf(op) (op & 0x03ff) | 1402 | #define hci_opcode_ocf(op) (op & 0x03ff) |
1319 | 1403 | ||
1320 | /* ACL handle and flags pack/unpack */ | 1404 | /* ACL handle and flags pack/unpack */ |
1321 | #define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) | 1405 | #define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12))) |
1322 | #define hci_handle(h) (h & 0x0fff) | 1406 | #define hci_handle(h) (h & 0x0fff) |
1323 | #define hci_flags(h) (h >> 12) | 1407 | #define hci_flags(h) (h >> 12) |
1324 | 1408 | ||