]>
| 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 | 5 | * |
| 61829219 MM |
6 | * Can be freely distributed and used under the terms of the GNU GPL v2+ |
| 7 | * | |
| 8 | * SPDX-License-Identifier: GPL-2.0-or-later | |
| 98e39e09 MM |
9 | */ |
| 10 | ||
| 727ce158 | 11 | #include "lib/pci.h" |
| 489233b4 | 12 | #include "lib/sysdep.h" |
| 1ffd04a8 | 13 | #include "bitops.h" |
| 98e39e09 | 14 | |
| 4658bfad PR |
15 | /* |
| 16 | * gcc predefines macro __MINGW32__ for all MinGW targets. | |
| 17 | * Including some MinGW header (e.g. windef.h) defines additional | |
| 18 | * macro __MINGW32_MAJOR_VERSION (available for all MinGW targets). | |
| 19 | */ | |
| 20 | #if defined(PCI_OS_WINDOWS) && defined(__MINGW32__) | |
| 21 | #include <windef.h> | |
| 22 | #endif | |
| 23 | ||
| 24 | /* | |
| 25 | * On Windows only MinGW 3.0 and higher versions provides <getopt.h> | |
| 26 | * header file. Older MinGW versions and MSVC do not have it. | |
| 370be0de | 27 | * DJGPP does not provide <getopt.h>. |
| 4658bfad | 28 | */ |
| 370be0de | 29 | #if defined(PCI_OS_DJGPP) || (defined(PCI_OS_WINDOWS) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 3)) |
| ee7d8384 | 30 | #include "compat/getopt.h" |
| a30f0839 | 31 | #else |
| 37ccbb7e | 32 | #include <getopt.h> |
| ee7d8384 MM |
33 | #endif |
| 34 | ||
| 727ce158 | 35 | #define PCIUTILS_VERSION PCILIB_VERSION |
| 98e39e09 | 36 | |
| 81afa98c MM |
37 | extern const char program_name[]; |
| 38 | ||
| 4f6b38ca | 39 | void die(char *msg, ...) NONRET PCI_PRINTF(1,2); |
| d1d7d88a MM |
40 | void *xmalloc(size_t howmuch); |
| 41 | void *xrealloc(void *ptr, size_t howmuch); | |
| 42 | char *xstrdup(const char *str); | |
| af34f014 | 43 | int parse_generic_option(int i, struct pci_access *pacc, char *arg); |
| e4842ff3 | 44 | |
| 489233b4 | 45 | #ifdef PCI_HAVE_PM_INTEL_CONF |
| 727ce158 MM |
46 | #define GENOPT_INTEL "H:" |
| 47 | #define GENHELP_INTEL "-H <mode>\tUse direct hardware access (<mode> = 1 or 2)\n" | |
| 48 | #else | |
| 49 | #define GENOPT_INTEL | |
| 50 | #define GENHELP_INTEL | |
| 51 | #endif | |
| 1b99a704 | 52 | #if defined(PCI_HAVE_PM_DUMP) && !defined(PCIUTILS_SETPCI) |
| 727ce158 | 53 | #define GENOPT_DUMP "F:" |
| 1b99a704 | 54 | #define GENHELP_DUMP "-F <file>\tRead PCI configuration dump from a given file\n" |
| 727ce158 MM |
55 | #else |
| 56 | #define GENOPT_DUMP | |
| 57 | #define GENHELP_DUMP | |
| 58 | #endif | |
| e4842ff3 | 59 | |
| f2b31663 | 60 | #define GENERIC_OPTIONS "A:GO:" GENOPT_INTEL GENOPT_DUMP |
| 1b99a704 | 61 | #define GENERIC_HELP \ |
| a0407443 | 62 | "-A <method>\tUse the specified PCI access method (see `-A help' for a list)\n" \ |
| 1b99a704 | 63 | "-O <par>=<val>\tSet PCI access parameter (see `-O help' for a list)\n" \ |
| 553d12c8 | 64 | "-G\t\tEnable PCI access debugging\n" \ |
| 1b99a704 | 65 | GENHELP_INTEL GENHELP_DUMP |