diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-06-28 09:56:23 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-06-28 13:49:16 +0200 |
commit | 51885a7d7321c3e6395c36bc4fe8dde7e78cf562 (patch) | |
tree | c656f1c1e2571181aed4870aaa2e63861120d783 /include/usb/usb.h | |
parent | a6e358b2f5b219fda18a7bc9348cb969043c19d5 (diff) | |
download | barebox-51885a7d7321c3e6395c36bc4fe8dde7e78cf562.tar.gz barebox-51885a7d7321c3e6395c36bc4fe8dde7e78cf562.tar.xz |
Change byte order detection mechanism to kernel style
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 switch to use the kernel
way of determing the byte order.
As this always causes a lot of confusion add a check to include/common.h to
make sure only one of __LITTLE_ENDIAN and __BIG_ENDIAN is defined.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb/usb.h')
-rw-r--r-- | include/usb/usb.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/usb/usb.h b/include/usb/usb.h index 296e4e8ea8..8691400014 100644 --- a/include/usb/usb.h +++ b/include/usb/usb.h @@ -270,12 +270,14 @@ void usb_rescan(void); ((x_ & 0xFF000000UL) >> 24)); \ }) -#if __BYTE_ORDER == __LITTLE_ENDIAN +#ifdef __LITTLE_ENDIAN # define swap_16(x) (x) # define swap_32(x) (x) -#else +#elif defined BIG_ENDIAN # define swap_16(x) __swap_16(x) # define swap_32(x) __swap_32(x) +#else +#error "could not determine byte order" #endif /* |