diff options
author | Sven Gothel <[email protected]> | 2020-04-26 14:01:30 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-04-26 14:01:30 +0200 |
commit | 6052ac481d60004d864fa80502d3622134fcc949 (patch) | |
tree | e419f4dd81f12b15b3598dab75b1e217f91adbe2 /api/direct_bt/BTIoctl.hpp | |
parent | 0c3be5a703def35ddfcf50d66ece608411fd9976 (diff) |
BTIoctl: Remove unused 'helpers'; Fix MgmtDisconnectCmd setup
Diffstat (limited to 'api/direct_bt/BTIoctl.hpp')
-rw-r--r-- | api/direct_bt/BTIoctl.hpp | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/api/direct_bt/BTIoctl.hpp b/api/direct_bt/BTIoctl.hpp index b410152b..91ae3900 100644 --- a/api/direct_bt/BTIoctl.hpp +++ b/api/direct_bt/BTIoctl.hpp @@ -162,169 +162,4 @@ enum { BT_CLOSED }; -/** - * Additional ordinary helpers .. - */ - -/* Byte order conversions */ -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define htobs(d) (d) -#define htobl(d) (d) -#define htobll(d) (d) -#define btohs(d) (d) -#define btohl(d) (d) -#define btohll(d) (d) -#elif __BYTE_ORDER == __BIG_ENDIAN -#define htobs(d) bswap_16(d) -#define htobl(d) bswap_32(d) -#define htobll(d) bswap_64(d) -#define btohs(d) bswap_16(d) -#define btohl(d) bswap_32(d) -#define btohll(d) bswap_64(d) -#else -#error "Unknown byte order" -#endif - -/* Bluetooth unaligned access */ -#define bt_get_unaligned(ptr) \ -__extension__ ({ \ - struct __attribute__((packed)) { \ - __typeof__(*(ptr)) __v; \ - } *__p = (__typeof__(__p)) (ptr); \ - __p->__v; \ -}) - -#define bt_put_unaligned(val, ptr) \ -do { \ - struct __attribute__((packed)) { \ - __typeof__(*(ptr)) __v; \ - } *__p = (__typeof__(__p)) (ptr); \ - __p->__v = (val); \ -} while(0) - -#if __BYTE_ORDER == __LITTLE_ENDIAN -static inline uint64_t bt_get_le64(const void *ptr) -{ - return bt_get_unaligned((const uint64_t *) ptr); -} - -static inline uint64_t bt_get_be64(const void *ptr) -{ - return bswap_64(bt_get_unaligned((const uint64_t *) ptr)); -} - -static inline uint32_t bt_get_le32(const void *ptr) -{ - return bt_get_unaligned((const uint32_t *) ptr); -} - -static inline uint32_t bt_get_be32(const void *ptr) -{ - return bswap_32(bt_get_unaligned((const uint32_t *) ptr)); -} - -static inline uint16_t bt_get_le16(const void *ptr) -{ - return bt_get_unaligned((const uint16_t *) ptr); -} - -static inline uint16_t bt_get_be16(const void *ptr) -{ - return bswap_16(bt_get_unaligned((const uint16_t *) ptr)); -} - -static inline void bt_put_le64(uint64_t val, const void *ptr) -{ - bt_put_unaligned(val, (uint64_t *) ptr); -} - -static inline void bt_put_be64(uint64_t val, const void *ptr) -{ - bt_put_unaligned(bswap_64(val), (uint64_t *) ptr); -} - -static inline void bt_put_le32(uint32_t val, const void *ptr) -{ - bt_put_unaligned(val, (uint32_t *) ptr); -} - -static inline void bt_put_be32(uint32_t val, const void *ptr) -{ - bt_put_unaligned(bswap_32(val), (uint32_t *) ptr); -} - -static inline void bt_put_le16(uint16_t val, const void *ptr) -{ - bt_put_unaligned(val, (uint16_t *) ptr); -} - -static inline void bt_put_be16(uint16_t val, const void *ptr) -{ - bt_put_unaligned(bswap_16(val), (uint16_t *) ptr); -} - -#elif __BYTE_ORDER == __BIG_ENDIAN -static inline uint64_t bt_get_le64(const void *ptr) -{ - return bswap_64(bt_get_unaligned((const uint64_t *) ptr)); -} - -static inline uint64_t bt_get_be64(const void *ptr) -{ - return bt_get_unaligned((const uint64_t *) ptr); -} - -static inline uint32_t bt_get_le32(const void *ptr) -{ - return bswap_32(bt_get_unaligned((const uint32_t *) ptr)); -} - -static inline uint32_t bt_get_be32(const void *ptr) -{ - return bt_get_unaligned((const uint32_t *) ptr); -} - -static inline uint16_t bt_get_le16(const void *ptr) -{ - return bswap_16(bt_get_unaligned((const uint16_t *) ptr)); -} - -static inline uint16_t bt_get_be16(const void *ptr) -{ - return bt_get_unaligned((const uint16_t *) ptr); -} - -static inline void bt_put_le64(uint64_t val, const void *ptr) -{ - bt_put_unaligned(bswap_64(val), (uint64_t *) ptr); -} - -static inline void bt_put_be64(uint64_t val, const void *ptr) -{ - bt_put_unaligned(val, (uint64_t *) ptr); -} - -static inline void bt_put_le32(uint32_t val, const void *ptr) -{ - bt_put_unaligned(bswap_32(val), (uint32_t *) ptr); -} - -static inline void bt_put_be32(uint32_t val, const void *ptr) -{ - bt_put_unaligned(val, (uint32_t *) ptr); -} - -static inline void bt_put_le16(uint16_t val, const void *ptr) -{ - bt_put_unaligned(bswap_16(val), (uint16_t *) ptr); -} - -static inline void bt_put_be16(uint16_t val, const void *ptr) -{ - bt_put_unaligned(val, (uint16_t *) ptr); -} -#else -#error "Unknown byte order" -#endif - #endif /* BT_IOCTL_HPP_ */ |