]>
Commit | Line | Data |
---|---|---|
489233b4 MM |
1 | /* |
2 | * The PCI Library -- Types and Format Strings | |
3 | * | |
e49ed044 | 4 | * Copyright (c) 1997--2007 Martin Mares <mj@ucw.cz> |
489233b4 MM |
5 | * |
6 | * Can be freely distributed and used under the terms of the GNU GPL. | |
7 | */ | |
8 | ||
9 | #include <sys/types.h> | |
10 | ||
11 | #ifndef PCI_HAVE_Uxx_TYPES | |
12 | ||
13 | #ifdef PCI_OS_WINDOWS | |
09156b3b MM |
14 | #include <windef.h> |
15 | typedef BYTE u8; | |
16 | typedef WORD u16; | |
17 | typedef DWORD u32; | |
e49ed044 MM |
18 | #elif defined(PCI_HAVE_STDINT_H) |
19 | #include <stdint.h> | |
20 | typedef uint8_t u8; | |
21 | typedef uint16_t u16; | |
22 | typedef uint32_t u32; | |
489233b4 | 23 | #else |
489233b4 | 24 | typedef u_int8_t u8; |
489233b4 MM |
25 | typedef u_int16_t u16; |
26 | typedef u_int32_t u32; | |
27 | #endif | |
28 | ||
29 | #ifdef PCI_HAVE_64BIT_ADDRESS | |
30 | #include <limits.h> | |
31 | #if ULONG_MAX > 0xffffffff | |
32 | typedef unsigned long u64; | |
33 | #define PCI_U64_FMT "l" | |
34 | #else | |
70edf349 | 35 | typedef unsigned long long u64; |
489233b4 MM |
36 | #define PCI_U64_FMT "ll" |
37 | #endif | |
38 | #endif | |
39 | ||
40 | #endif /* PCI_HAVE_Uxx_TYPES */ | |
41 | ||
42 | #ifdef PCI_HAVE_64BIT_ADDRESS | |
43 | typedef u64 pciaddr_t; | |
15296723 | 44 | #define PCIADDR_T_FMT "%08" PCI_U64_FMT "x" |
489233b4 MM |
45 | #define PCIADDR_PORT_FMT "%04" PCI_U64_FMT "x" |
46 | #else | |
47 | typedef u32 pciaddr_t; | |
48 | #define PCIADDR_T_FMT "%08x" | |
49 | #define PCIADDR_PORT_FMT "%04x" | |
50 | #endif | |
51 | ||
52 | #ifdef PCI_ARCH_SPARC64 | |
53 | /* On sparc64 Linux the kernel reports remapped port addresses and IRQ numbers */ | |
54 | #undef PCIADDR_PORT_FMT | |
55 | #define PCIADDR_PORT_FMT PCIADDR_T_FMT | |
56 | #define PCIIRQ_FMT "%08x" | |
57 | #else | |
58 | #define PCIIRQ_FMT "%d" | |
59 | #endif |