2 * The PCI Library -- System-Dependent Stuff
4 * Copyright (c) 1997--2020 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))
12 #define FORMAT_CHECK(x,y,z) __attribute__((format(x,y,z)))
16 #define FORMAT_CHECK(x,y,z)
24 #define strcasecmp _strcmpi
27 #ifdef PCI_HAVE_LINUX_BYTEORDER_H
29 #include <asm/byteorder.h>
30 #define cpu_to_le16 __cpu_to_le16
31 #define cpu_to_le32 __cpu_to_le32
32 #define le16_to_cpu __le16_to_cpu
33 #define le32_to_cpu __le32_to_cpu
39 #define BYTE_ORDER __BYTE_ORDER
40 #define BIG_ENDIAN __BIG_ENDIAN
44 #include <sys/byteorder.h>
45 #if defined(__i386) && defined(LITTLE_ENDIAN)
46 # define BYTE_ORDER LITTLE_ENDIAN
47 #elif defined(__sparc) && defined(BIG_ENDIAN)
48 # define BYTE_ORDER BIG_ENDIAN
50 #define BIG_ENDIAN 4321
54 #define BYTE_ORDER 1234
56 #define BYTE_ORDER 4321
58 #endif /* BYTE_ORDER */
59 #endif /* PCI_OS_SUNOS */
63 #include <sys/param.h>
66 #define BIG_ENDIAN 4321
67 #define LITTLE_ENDIAN 1234
68 #define BYTE_ORDER LITTLE_ENDIAN
69 #define snprintf _snprintf
78 #define BIG_ENDIAN 4321
79 #define LITTLE_ENDIAN 1234
80 #define BYTE_ORDER LITTLE_ENDIAN
83 #if !defined(BYTE_ORDER)
84 #error "BYTE_ORDER not defined for your platform"
87 #if BYTE_ORDER == BIG_ENDIAN
88 #define cpu_to_le16 swab16
89 #define cpu_to_le32 swab32
90 #define le16_to_cpu swab16
91 #define le32_to_cpu swab32
93 static inline word swab16(word w)
95 return (w << 8) | ((w >> 8) & 0xff);
98 static inline u32 swab32(u32 w)
100 return ((w & 0xff000000) >> 24) |
101 ((w & 0x00ff0000) >> 8) |
102 ((w & 0x0000ff00) << 8) |
103 ((w & 0x000000ff) << 24);
106 #define cpu_to_le16(x) (x)
107 #define cpu_to_le32(x) (x)
108 #define le16_to_cpu(x) (x)
109 #define le32_to_cpu(x) (x)