1b15cbc0bSwdenk #ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H 2b15cbc0bSwdenk #define _LINUX_BYTEORDER_BIG_ENDIAN_H 3b15cbc0bSwdenk 4b15cbc0bSwdenk #ifndef __BIG_ENDIAN 5b15cbc0bSwdenk #define __BIG_ENDIAN 4321 6b15cbc0bSwdenk #endif 7b15cbc0bSwdenk #ifndef __BIG_ENDIAN_BITFIELD 8b15cbc0bSwdenk #define __BIG_ENDIAN_BITFIELD 9b15cbc0bSwdenk #endif 10da93ed81Swdenk #define __BYTE_ORDER __BIG_ENDIAN 11b15cbc0bSwdenk 12*eef1cf2dSKim Phillips #include <linux/compiler.h> 13*eef1cf2dSKim Phillips #include <linux/types.h> 14b15cbc0bSwdenk #include <linux/byteorder/swab.h> 15b15cbc0bSwdenk 16*eef1cf2dSKim Phillips #define __constant_htonl(x) ((__force __be32)(__u32)(x)) 17*eef1cf2dSKim Phillips #define __constant_ntohl(x) ((__force __u32)(__be32)(x)) 18*eef1cf2dSKim Phillips #define __constant_htons(x) ((__force __be16)(__u16)(x)) 19*eef1cf2dSKim Phillips #define __constant_ntohs(x) ((__force __u16)(__be16)(x)) 20*eef1cf2dSKim Phillips #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x))) 21*eef1cf2dSKim Phillips #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x)) 22*eef1cf2dSKim Phillips #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) 23*eef1cf2dSKim Phillips #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x)) 24*eef1cf2dSKim Phillips #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) 25*eef1cf2dSKim Phillips #define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x)) 26*eef1cf2dSKim Phillips #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x)) 27*eef1cf2dSKim Phillips #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x)) 28*eef1cf2dSKim Phillips #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x)) 29*eef1cf2dSKim Phillips #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x)) 30*eef1cf2dSKim Phillips #define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x)) 31*eef1cf2dSKim Phillips #define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x)) 32*eef1cf2dSKim Phillips #define __cpu_to_le64(x) ((__force __le64)__swab64((x))) 33*eef1cf2dSKim Phillips #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x)) 34*eef1cf2dSKim Phillips #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) 35*eef1cf2dSKim Phillips #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) 36*eef1cf2dSKim Phillips #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) 37*eef1cf2dSKim Phillips #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) 38*eef1cf2dSKim Phillips #define __cpu_to_be64(x) ((__force __be64)(__u64)(x)) 39*eef1cf2dSKim Phillips #define __be64_to_cpu(x) ((__force __u64)(__be64)(x)) 40*eef1cf2dSKim Phillips #define __cpu_to_be32(x) ((__force __be32)(__u32)(x)) 41*eef1cf2dSKim Phillips #define __be32_to_cpu(x) ((__force __u32)(__be32)(x)) 42*eef1cf2dSKim Phillips #define __cpu_to_be16(x) ((__force __be16)(__u16)(x)) 43*eef1cf2dSKim Phillips #define __be16_to_cpu(x) ((__force __u16)(__be16)(x)) 44*eef1cf2dSKim Phillips __cpu_to_le64p(const __u64 * p)45*eef1cf2dSKim Phillipsstatic inline __le64 __cpu_to_le64p(const __u64 *p) 46*eef1cf2dSKim Phillips { 47*eef1cf2dSKim Phillips return (__force __le64)__swab64p(p); 48*eef1cf2dSKim Phillips } __le64_to_cpup(const __le64 * p)49*eef1cf2dSKim Phillipsstatic inline __u64 __le64_to_cpup(const __le64 *p) 50*eef1cf2dSKim Phillips { 51*eef1cf2dSKim Phillips return __swab64p((__u64 *)p); 52*eef1cf2dSKim Phillips } __cpu_to_le32p(const __u32 * p)53*eef1cf2dSKim Phillipsstatic inline __le32 __cpu_to_le32p(const __u32 *p) 54*eef1cf2dSKim Phillips { 55*eef1cf2dSKim Phillips return (__force __le32)__swab32p(p); 56*eef1cf2dSKim Phillips } __le32_to_cpup(const __le32 * p)57*eef1cf2dSKim Phillipsstatic inline __u32 __le32_to_cpup(const __le32 *p) 58*eef1cf2dSKim Phillips { 59*eef1cf2dSKim Phillips return __swab32p((__u32 *)p); 60*eef1cf2dSKim Phillips } __cpu_to_le16p(const __u16 * p)61*eef1cf2dSKim Phillipsstatic inline __le16 __cpu_to_le16p(const __u16 *p) 62*eef1cf2dSKim Phillips { 63*eef1cf2dSKim Phillips return (__force __le16)__swab16p(p); 64*eef1cf2dSKim Phillips } __le16_to_cpup(const __le16 * p)65*eef1cf2dSKim Phillipsstatic inline __u16 __le16_to_cpup(const __le16 *p) 66*eef1cf2dSKim Phillips { 67*eef1cf2dSKim Phillips return __swab16p((__u16 *)p); 68*eef1cf2dSKim Phillips } __cpu_to_be64p(const __u64 * p)69*eef1cf2dSKim Phillipsstatic inline __be64 __cpu_to_be64p(const __u64 *p) 70*eef1cf2dSKim Phillips { 71*eef1cf2dSKim Phillips return (__force __be64)*p; 72*eef1cf2dSKim Phillips } __be64_to_cpup(const __be64 * p)73*eef1cf2dSKim Phillipsstatic inline __u64 __be64_to_cpup(const __be64 *p) 74*eef1cf2dSKim Phillips { 75*eef1cf2dSKim Phillips return (__force __u64)*p; 76*eef1cf2dSKim Phillips } __cpu_to_be32p(const __u32 * p)77*eef1cf2dSKim Phillipsstatic inline __be32 __cpu_to_be32p(const __u32 *p) 78*eef1cf2dSKim Phillips { 79*eef1cf2dSKim Phillips return (__force __be32)*p; 80*eef1cf2dSKim Phillips } __be32_to_cpup(const __be32 * p)81*eef1cf2dSKim Phillipsstatic inline __u32 __be32_to_cpup(const __be32 *p) 82*eef1cf2dSKim Phillips { 83*eef1cf2dSKim Phillips return (__force __u32)*p; 84*eef1cf2dSKim Phillips } __cpu_to_be16p(const __u16 * p)85*eef1cf2dSKim Phillipsstatic inline __be16 __cpu_to_be16p(const __u16 *p) 86*eef1cf2dSKim Phillips { 87*eef1cf2dSKim Phillips return (__force __be16)*p; 88*eef1cf2dSKim Phillips } __be16_to_cpup(const __be16 * p)89*eef1cf2dSKim Phillipsstatic inline __u16 __be16_to_cpup(const __be16 *p) 90*eef1cf2dSKim Phillips { 91*eef1cf2dSKim Phillips return (__force __u16)*p; 92*eef1cf2dSKim Phillips } 93b15cbc0bSwdenk #define __cpu_to_le64s(x) __swab64s((x)) 94b15cbc0bSwdenk #define __le64_to_cpus(x) __swab64s((x)) 95b15cbc0bSwdenk #define __cpu_to_le32s(x) __swab32s((x)) 96b15cbc0bSwdenk #define __le32_to_cpus(x) __swab32s((x)) 97b15cbc0bSwdenk #define __cpu_to_le16s(x) __swab16s((x)) 98b15cbc0bSwdenk #define __le16_to_cpus(x) __swab16s((x)) 99*eef1cf2dSKim Phillips #define __cpu_to_be64s(x) do { (void)(x); } while (0) 100*eef1cf2dSKim Phillips #define __be64_to_cpus(x) do { (void)(x); } while (0) 101*eef1cf2dSKim Phillips #define __cpu_to_be32s(x) do { (void)(x); } while (0) 102*eef1cf2dSKim Phillips #define __be32_to_cpus(x) do { (void)(x); } while (0) 103*eef1cf2dSKim Phillips #define __cpu_to_be16s(x) do { (void)(x); } while (0) 104*eef1cf2dSKim Phillips #define __be16_to_cpus(x) do { (void)(x); } while (0) 105b15cbc0bSwdenk 106*eef1cf2dSKim Phillips #ifdef __KERNEL__ 107b15cbc0bSwdenk #include <linux/byteorder/generic.h> 108*eef1cf2dSKim Phillips #endif 109b15cbc0bSwdenk 110b15cbc0bSwdenk #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ 111