2 * include/asm-microblaze/byteorder.h -- Endian id and conversion ops
4 * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
5 * Copyright (C) 2001 NEC Corporation
6 * Copyright (C) 2001 Miles Bader <miles@gnu.org>
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this
10 * archive for more details.
12 * Written by Miles Bader <miles@gnu.org>
13 * Microblaze port by John Williams
16 #ifndef __MICROBLAZE_BYTEORDER_H__
17 #define __MICROBLAZE_BYTEORDER_H__
19 #include <asm/types.h>
23 /* This is effectively a dupe of the arch-independent byteswap
24 code in include/linux/byteorder/swab.h, however we force a cast
25 of the result up to 32 bits. This in turn forces the compiler
26 to explicitly clear the high 16 bits, which it wasn't doing otherwise.
28 I think this is a symptom of a bug in mb-gcc. JW 20040303
30 static __inline__ __const__ __u16 ___arch__swab16 (__u16 half_word)
32 /* 32 bit temp to cast result, forcing clearing of high word */
35 temp = ((half_word & 0x00FFU) << 8) | ((half_word & 0xFF00U) >> 8);
40 #define __arch__swab16(x) ___arch__swab16(x)
42 /* Microblaze has no arch-specific endian conversion insns */
44 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
45 # define __BYTEORDER_HAS_U64__
46 # define __SWAB_64_THRU_32__
51 #include <linux/byteorder/big_endian.h>
53 #endif /* __MICROBLAZE_BYTEORDER_H__ */