Annotation of embedaddon/pciutils/lib/types.h, revision 1.1
1.1 ! misho 1: /*
! 2: * The PCI Library -- Types and Format Strings
! 3: *
! 4: * Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
! 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
! 14: #include <windef.h>
! 15: typedef BYTE u8;
! 16: typedef WORD u16;
! 17: typedef DWORD u32;
! 18: #elif defined(PCI_HAVE_STDINT_H) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
! 19: #include <stdint.h>
! 20: typedef uint8_t u8;
! 21: typedef uint16_t u16;
! 22: typedef uint32_t u32;
! 23: #else
! 24: typedef u_int8_t u8;
! 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
! 35: typedef unsigned long long u64;
! 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;
! 44: #define PCIADDR_T_FMT "%08" PCI_U64_FMT "x"
! 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
! 60:
! 61: #if defined(__GNUC__) && __GNUC__ > 2
! 62: #define PCI_PRINTF(x,y) __attribute__((format(printf, x, y)))
! 63: #else
! 64: #define PCI_PRINTF(x,y)
! 65: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>