]> git.ipfire.org Git - thirdparty/pciutils.git/blob - pciutils.h
Merge remote-tracking branch 'pali/win32-sysdbg'
[thirdparty/pciutils.git] / pciutils.h
1 /*
2 * The PCI Utilities -- Declarations
3 *
4 * Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz>
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9 #include "lib/pci.h"
10 #include "lib/sysdep.h"
11
12 /*
13 * gcc predefines macro __MINGW32__ for all MinGW targets.
14 * Including some MinGW header (e.g. windef.h) defines additional
15 * macro __MINGW32_MAJOR_VERSION (available for all MinGW targets).
16 */
17 #if defined(PCI_OS_WINDOWS) && defined(__MINGW32__)
18 #include <windef.h>
19 #endif
20
21 /*
22 * On Windows only MinGW 3.0 and higher versions provides <getopt.h>
23 * header file. Older MinGW versions and MSVC do not have it.
24 */
25 #if defined(PCI_OS_WINDOWS) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 3)
26 #include "compat/getopt.h"
27 #else
28 #include <unistd.h>
29 #endif
30
31 #define PCIUTILS_VERSION PCILIB_VERSION
32
33 extern const char program_name[];
34
35 void die(char *msg, ...) NONRET PCI_PRINTF(1,2);
36 void *xmalloc(size_t howmuch);
37 void *xrealloc(void *ptr, size_t howmuch);
38 char *xstrdup(const char *str);
39 int parse_generic_option(int i, struct pci_access *pacc, char *arg);
40
41 #ifdef PCI_HAVE_PM_INTEL_CONF
42 #define GENOPT_INTEL "H:"
43 #define GENHELP_INTEL "-H <mode>\tUse direct hardware access (<mode> = 1 or 2)\n"
44 #else
45 #define GENOPT_INTEL
46 #define GENHELP_INTEL
47 #endif
48 #if defined(PCI_HAVE_PM_DUMP) && !defined(PCIUTILS_SETPCI)
49 #define GENOPT_DUMP "F:"
50 #define GENHELP_DUMP "-F <file>\tRead PCI configuration dump from a given file\n"
51 #else
52 #define GENOPT_DUMP
53 #define GENHELP_DUMP
54 #endif
55
56 #define GENERIC_OPTIONS "A:GO:" GENOPT_INTEL GENOPT_DUMP
57 #define GENERIC_HELP \
58 "-A <method>\tUse the specified PCI access method (see `-A help' for a list)\n" \
59 "-O <par>=<val>\tSet PCI access parameter (see `-O help' for a list)\n" \
60 "-G\t\tEnable PCI access debugging\n" \
61 GENHELP_INTEL GENHELP_DUMP