diff options
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index d2347f8629..9287a7dd2b 100644 --- a/include/common.h +++ b/include/common.h @@ -34,6 +34,24 @@ #include <linux/stddef.h> #include <asm/common.h> +/* + * sanity check. The Linux Kernel defines only one of __LITTLE_ENDIAN and + * __BIG_ENDIAN. Endianess can then be tested with #ifdef __xx_ENDIAN. Userspace + * always defined both __LITTLE_ENDIAN and __BIG_ENDIAN and byteorder can then + * be tested with #if __BYTE_ORDER == __xx_ENDIAN. + * + * As we tend to use a lot of Kernel code in barebox we use the kernel way of + * determing the byte order. Make sure here that architecture code properly + * defines it. + */ +#include <asm/byteorder.h> +#if defined __LITTLE_ENDIAN && defined __BIG_ENDIAN +#error "both __LITTLE_ENDIAN and __BIG_ENDIAN are defined" +#endif +#if !defined __LITTLE_ENDIAN && !defined __BIG_ENDIAN +#error "None of __LITTLE_ENDIAN and __BIG_ENDIAN are defined" +#endif + #define pr_info(fmt, arg...) printf(fmt, ##arg) #define pr_notice(fmt, arg...) printf(fmt, ##arg) #define pr_err(fmt, arg...) printf(fmt, ##arg) |