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))
19 #define bzero(x,y) memset(x,0,y)
20 #define strcasecmp strcmpi
23 #ifdef PCI_HAVE_LINUX_BYTEORDER_H
25 #include <asm/byteorder.h>
26 #define cpu_to_le16 __cpu_to_le16
27 #define cpu_to_le32 __cpu_to_le32
28 #define le16_to_cpu __le16_to_cpu
29 #define le32_to_cpu __le32_to_cpu
35 #define BYTE_ORDER __BYTE_ORDER
36 #define BIG_ENDIAN __BIG_ENDIAN
40 #include <sys/byteorder.h>
41 #define BIG_ENDIAN 4321
43 #define BYTE_ORDER 1234
45 #define BYTE_ORDER 4321
51 #include <sys/param.h>
54 #define BIG_ENDIAN 4321
55 #define LITTLE_ENDIAN 1234
56 #define BYTE_ORDER LITTLE_ENDIAN
57 #define snprintf _snprintf
61 #if BYTE_ORDER == BIG_ENDIAN
62 #define cpu_to_le16 swab16
63 #define cpu_to_le32 swab32
64 #define le16_to_cpu swab16
65 #define le32_to_cpu swab32
67 static inline word swab16(word w)
69 return (w << 8) | ((w >> 8) & 0xff);
72 static inline u32 swab32(u32 w)
74 return ((w & 0xff000000) >> 24) |
75 ((w & 0x00ff0000) >> 8) |
76 ((w & 0x0000ff00) << 8) |
77 ((w & 0x000000ff) << 24);
80 #define cpu_to_le16(x) (x)
81 #define cpu_to_le32(x) (x)
82 #define le16_to_cpu(x) (x)
83 #define le32_to_cpu(x) (x)