2 * The PCI Library -- System-Dependent Stuff
4 * Copyright (c) 1997--2004 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
10 #define UNUSED __attribute__((unused))
11 #define NONRET __attribute__((noreturn))
22 #define strcasecmp strcmpi
25 #ifdef PCI_HAVE_LINUX_BYTEORDER_H
27 #include <asm/byteorder.h>
28 #define cpu_to_le16 __cpu_to_le16
29 #define cpu_to_le32 __cpu_to_le32
30 #define le16_to_cpu __le16_to_cpu
31 #define le32_to_cpu __le32_to_cpu
37 #define BYTE_ORDER __BYTE_ORDER
38 #define BIG_ENDIAN __BIG_ENDIAN
42 #include <sys/byteorder.h>
43 #define BIG_ENDIAN 4321
45 #define BYTE_ORDER 1234
47 #define BYTE_ORDER 4321
53 #include <sys/param.h>
56 #define BIG_ENDIAN 4321
57 #define LITTLE_ENDIAN 1234
58 #define BYTE_ORDER LITTLE_ENDIAN
59 #define snprintf _snprintf
63 #if BYTE_ORDER == BIG_ENDIAN
64 #define cpu_to_le16 swab16
65 #define cpu_to_le32 swab32
66 #define le16_to_cpu swab16
67 #define le32_to_cpu swab32
69 static inline word swab16(word w)
71 return (w << 8) | ((w >> 8) & 0xff);
74 static inline u32 swab32(u32 w)
76 return ((w & 0xff000000) >> 24) |
77 ((w & 0x00ff0000) >> 8) |
78 ((w & 0x0000ff00) << 8) |
79 ((w & 0x000000ff) << 24);
82 #define cpu_to_le16(x) (x)
83 #define cpu_to_le32(x) (x)
84 #define le16_to_cpu(x) (x)
85 #define le32_to_cpu(x) (x)