]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lib/types.h
Released as 3.2.0.
[thirdparty/pciutils.git] / lib / types.h
CommitLineData
489233b4
MM
1/*
2 * The PCI Library -- Types and Format Strings
3 *
cd3b0e3e 4 * Copyright (c) 1997--2008 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>
15typedef BYTE u8;
16typedef WORD u16;
17typedef DWORD u32;
cd3b0e3e 18#elif defined(PCI_HAVE_STDINT_H) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
e49ed044
MM
19#include <stdint.h>
20typedef uint8_t u8;
21typedef uint16_t u16;
22typedef uint32_t u32;
489233b4 23#else
489233b4 24typedef u_int8_t u8;
489233b4
MM
25typedef u_int16_t u16;
26typedef u_int32_t u32;
27#endif
28
29#ifdef PCI_HAVE_64BIT_ADDRESS
30#include <limits.h>
31#if ULONG_MAX > 0xffffffff
32typedef unsigned long u64;
33#define PCI_U64_FMT "l"
34#else
70edf349 35typedef 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
43typedef 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
47typedef 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
4f6b38ca 60
17c39b8a 61#if defined(__GNUC__) && __GNUC__ > 2
4f6b38ca
MM
62#define PCI_PRINTF(x,y) __attribute__((format(printf, x, y)))
63#else
64#define PCI_PRINTF(x,y)
65#endif