]>
git.ipfire.org Git - thirdparty/pciutils.git/blob - lib/types.h
2 * The PCI Library -- Types and Format Strings
4 * Copyright (c) 1997--2017 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
11 #ifndef PCI_HAVE_Uxx_TYPES
14 /* On Windows compilers, use <windef.h> */
19 typedef unsigned __int64 u64
;
20 #define PCI_U64_FMT_X "I64x"
22 #elif defined(PCI_HAVE_STDINT_H) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
23 /* Use standard types in C99 and newer */
30 #define PCI_U64_FMT_X PRIx64
33 /* Hope for POSIX types from <sys/types.h> */
35 typedef u_int16_t u16
;
36 typedef u_int32_t u32
;
38 /* u64 will be unsigned (long) long */
40 #if ULONG_MAX > 0xffffffff
41 typedef unsigned long u64
;
42 #define PCI_U64_FMT_X "lx"
44 typedef unsigned long long u64
;
45 #define PCI_U64_FMT_X "llx"
50 #endif /* PCI_HAVE_Uxx_TYPES */
52 #ifdef PCI_HAVE_64BIT_ADDRESS
53 typedef u64 pciaddr_t
;
54 #define PCIADDR_T_FMT "%08" PCI_U64_FMT_X
55 #define PCIADDR_PORT_FMT "%04" PCI_U64_FMT_X
57 typedef u32 pciaddr_t
;
58 #define PCIADDR_T_FMT "%08x"
59 #define PCIADDR_PORT_FMT "%04x"
62 #ifdef PCI_ARCH_SPARC64
63 /* On sparc64 Linux the kernel reports remapped port addresses and IRQ numbers */
64 #undef PCIADDR_PORT_FMT
65 #define PCIADDR_PORT_FMT PCIADDR_T_FMT
66 #define PCIIRQ_FMT "%08x"
68 #define PCIIRQ_FMT "%d"
71 #if defined(__GNUC__) && __GNUC__ > 2
72 #define PCI_PRINTF(x,y) __attribute__((format(printf, x, y)))
74 #define PCI_PRINTF(x,y)