diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-07-16 09:12:07 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-07-17 13:48:22 -0400 |
commit | 01977c0bbbc834e57436be0bab31c3df11d61710 (patch) | |
tree | c1e7750632a018a369d3c774203bd2d88ed2528d /drivers/bluetooth/hci_h5.c | |
parent | c0a1b73c3f7d0cf3a93b58507b411911659d1b6a (diff) |
Bluetooth: Add Three-wire header value convenience macros
This patch adds convenience macros for reading Three-wire header values.
This will help make the code more readable.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'drivers/bluetooth/hci_h5.c')
-rw-r--r-- | drivers/bluetooth/hci_h5.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 6df4c07bbd7b..f50afb2fb364 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c | |||
@@ -43,6 +43,14 @@ | |||
43 | */ | 43 | */ |
44 | #define H5_MAX_LEN (4 + 0xfff + 2) | 44 | #define H5_MAX_LEN (4 + 0xfff + 2) |
45 | 45 | ||
46 | /* Convenience macros for reading Three-wire header values */ | ||
47 | #define H5_HDR_SEQ(hdr) ((hdr)[0] & 0x07) | ||
48 | #define H5_HDR_ACK(hdr) (((hdr)[0] >> 3) & 0x07) | ||
49 | #define H5_HDR_CRC(hdr) (((hdr)[0] >> 6) & 0x01) | ||
50 | #define H5_HDR_RELIABLE(hdr) (((hdr)[0] >> 7) & 0x01) | ||
51 | #define H5_HDR_PKT_TYPE(hdr) ((hdr)[1] & 0x0f) | ||
52 | #define H5_HDR_LEN(hdr) ((((hdr)[1] >> 4) & 0xff) + ((hdr)[2] << 4)) | ||
53 | |||
46 | #define SLIP_DELIMITER 0xc0 | 54 | #define SLIP_DELIMITER 0xc0 |
47 | #define SLIP_ESC 0xdb | 55 | #define SLIP_ESC 0xdb |
48 | #define SLIP_ESC_DELIM 0xdc | 56 | #define SLIP_ESC_DELIM 0xdc |