xref: /haiku/headers/os/bluetooth/HCI/btHCI_acl.h (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 /*
2  * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef _BTHCI_ACL_H_
6 #define _BTHCI_ACL_H_
7 
8 #include <bluetooth/bluetooth.h>
9 #include <bluetooth/HCI/btHCI.h>
10 
11 #define HCI_ACL_HDR_SIZE	4
12 
13 struct hci_acl_header {
14 	uint16 	handle;		/* Handle & Flags(PB, BC) */
15 	uint16 	alen;
16 } __attribute__ ((packed)) ;
17 
18 /* ACL handle and flags pack/unpack */
19 #define pack_acl_handle_flags(h, pb, bc)	(((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))
20 #define get_acl_handle(h)					((h) & 0x0fff)
21 #define get_acl_pb_flag(h)					(((h) & 0x3000) >> 12)
22 #define get_acl_bc_flag(h)					(((h) & 0xc000) >> 14)
23 
24 /* PB flag values */
25 /* 00 - reserved for future use */
26 #define	HCI_ACL_PACKET_FRAGMENT		0x1
27 #define	HCI_ACL_PACKET_START		0x2
28 /* 11 - reserved for future use */
29 
30 /* BC flag values */
31 #define HCI_ACL_POINT2POINT			0x0 /* only Host controller to Host */
32 #define HCI_ACL_BROADCAST_ACTIVE	0x1 /* both directions */
33 #define HCI_ACL_BROADCAST_PICONET	0x2 /* both directions */
34 										/* 11 - reserved for future use */
35 
36 #endif // _BTHCI_ACL_H_
37