]>
Commit | Line | Data |
---|---|---|
98e39e09 | 1 | /* |
4284af58 | 2 | * The PCI Utilities -- Declarations |
98e39e09 | 3 | * |
af34f014 | 4 | * Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz> |
98e39e09 MM |
5 | * |
6 | * Can be freely distributed and used under the terms of the GNU GPL. | |
7 | */ | |
8 | ||
727ce158 | 9 | #include "lib/pci.h" |
489233b4 | 10 | #include "lib/sysdep.h" |
98e39e09 | 11 | |
4658bfad PR |
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) | |
ee7d8384 | 26 | #include "compat/getopt.h" |
a30f0839 MM |
27 | #else |
28 | #include <unistd.h> | |
ee7d8384 MM |
29 | #endif |
30 | ||
727ce158 | 31 | #define PCIUTILS_VERSION PCILIB_VERSION |
98e39e09 | 32 | |
81afa98c MM |
33 | extern const char program_name[]; |
34 | ||
4f6b38ca | 35 | void die(char *msg, ...) NONRET PCI_PRINTF(1,2); |
d1d7d88a MM |
36 | void *xmalloc(size_t howmuch); |
37 | void *xrealloc(void *ptr, size_t howmuch); | |
38 | char *xstrdup(const char *str); | |
af34f014 | 39 | int parse_generic_option(int i, struct pci_access *pacc, char *arg); |
e4842ff3 | 40 | |
489233b4 | 41 | #ifdef PCI_HAVE_PM_INTEL_CONF |
727ce158 MM |
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 | |
1b99a704 | 48 | #if defined(PCI_HAVE_PM_DUMP) && !defined(PCIUTILS_SETPCI) |
727ce158 | 49 | #define GENOPT_DUMP "F:" |
1b99a704 | 50 | #define GENHELP_DUMP "-F <file>\tRead PCI configuration dump from a given file\n" |
727ce158 MM |
51 | #else |
52 | #define GENOPT_DUMP | |
53 | #define GENHELP_DUMP | |
54 | #endif | |
e4842ff3 | 55 | |
f2b31663 | 56 | #define GENERIC_OPTIONS "A:GO:" GENOPT_INTEL GENOPT_DUMP |
1b99a704 | 57 | #define GENERIC_HELP \ |
a0407443 | 58 | "-A <method>\tUse the specified PCI access method (see `-A help' for a list)\n" \ |
1b99a704 | 59 | "-O <par>=<val>\tSet PCI access parameter (see `-O help' for a list)\n" \ |
553d12c8 | 60 | "-G\t\tEnable PCI access debugging\n" \ |
1b99a704 | 61 | GENHELP_INTEL GENHELP_DUMP |