X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fcompiler.h;h=ef7b2cb1f7ea354cd075c0d2e561d01d59ddfdcf;hb=6786ce1ce14feb4d02854a0c04bc0cce505be46e;hp=65b826e4d187df332eecc124da5848e5e643f63d;hpb=16f416661ec5ffa46b3f879a0b83907bbec13714;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/compiler.h b/include/compiler.h index 65b826e..ef7b2cb 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -6,6 +6,7 @@ #define __COMPILER_H__ #include +#include #ifdef USE_HOSTCC @@ -46,12 +47,17 @@ # include #elif defined(__MACH__) || defined(__FreeBSD__) # include -typedef unsigned long ulong; #endif #ifdef __FreeBSD__ # include /* htole32 and friends */ +# define __BYTE_ORDER BYTE_ORDER +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __BIG_ENDIAN BIG_ENDIAN #elif defined(__OpenBSD__) # include +# define __BYTE_ORDER BYTE_ORDER +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __BIG_ENDIAN BIG_ENDIAN #endif #include @@ -60,6 +66,10 @@ typedef uint8_t __u8; typedef uint16_t __u16; typedef uint32_t __u32; typedef unsigned int uint; +typedef unsigned long ulong; + +/* Define these on the host so we can build some target code */ +typedef __u32 u32; #define uswap_16(x) \ ((((x) & 0xff00) >> 8) | \ @@ -84,20 +94,7 @@ typedef unsigned int uint; # define uswap_64(x) _uswap_64(x, ) #endif -#if defined(__OpenBSD__) -#define cpu_to_le16(x) htole16(x) -#define cpu_to_le32(x) htole32(x) -#define cpu_to_le64(x) htole64(x) -#define le16_to_cpu(x) letoh16(x) -#define le32_to_cpu(x) letoh32(x) -#define le64_to_cpu(x) letoh64(x) -#define cpu_to_be16(x) htobe16(x) -#define cpu_to_be32(x) htobe32(x) -#define cpu_to_be64(x) htobe64(x) -#define be16_to_cpu(x) betoh16(x) -#define be32_to_cpu(x) betoh32(x) -#define be64_to_cpu(x) betoh64(x) -#elif __BYTE_ORDER == __LITTLE_ENDIAN +#if __BYTE_ORDER == __LITTLE_ENDIAN # define cpu_to_le16(x) (x) # define cpu_to_le32(x) (x) # define cpu_to_le64(x) (x) @@ -127,13 +124,8 @@ typedef unsigned int uint; #else /* !USE_HOSTCC */ -#ifdef CONFIG_USE_STDINT -/* Provided by gcc. */ -#include -#else /* Type for `void *' pointers. */ typedef unsigned long int uintptr_t; -#endif #include #include @@ -156,4 +148,24 @@ typedef unsigned long int uintptr_t; #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) +#ifdef __LP64__ +#define MEM_SUPPORT_64BIT_DATA 1 +#else +#define MEM_SUPPORT_64BIT_DATA 0 +#endif + +/** + * tools_build() - check if we are building host tools + * + * Return: true if building for the host, false if for a target + */ +static inline bool tools_build(void) +{ +#ifdef USE_HOSTCC + return true; +#else + return false; +#endif +} + #endif