]> git.ipfire.org Git - thirdparty/pciutils.git/blob - lib/i386-io-windows.h
lib/i386-ports.c, lib/i386-io-*: Moved the logic which keeps track of
[thirdparty/pciutils.git] / lib / i386-io-windows.h
1 /*
2 * The PCI Library -- Access to i386 I/O ports on Windows
3 *
4 * Copyright (c) 2004 Alexander Stock <stock.alexander@gmx.de>
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9 #include <io.h>
10 #include <conio.h>
11 #include <windows.h>
12
13 #define outb(x,y) _outp(y,x)
14 #define outw(x,y) _outpw(y,x)
15 #define outl(x,y) _outpd(y,x)
16
17 #define inb(x) _inp(x)
18 #define inw(x) _inpw(x)
19 #define inl(x) _inpd(x)
20
21 static int
22 intel_setup_io(void)
23 {
24 typedef int (*MYPROC)(void);
25 MYPROC InitializeWinIo;
26 HMODULE lib;
27
28 intel_iopl_set = 0;
29
30 lib = LoadLibrary("WinIo.dll");
31 if (!lib)
32 {
33 fprintf(stderr, "libpci: Couldn't load WinIo.dll.\n");
34 return 0;
35 }
36 /* XXX: Is this really needed? --mj */
37 GetProcAddress(lib, "InitializeWinIo");
38
39 InitializeWinIo = (MYPROC) GetProcAddress(lib, "InitializeWinIo");
40 if (!InitializeWinIo)
41 {
42 fprintf(stderr, "libpci: Couldn't find InitializeWinIo function.\n");
43 return 0;
44 }
45
46 if (!InitializeWinIo())
47 {
48 fprintf(stderr, "libpci: InitializeWinIo() failed.\n");
49 return 0;
50 }
51
52 return 1;
53 }
54
55 static inline int
56 intel_cleanup_io(void)
57 {
58 //TODO: DeInitializeWinIo!
59 return 1;
60 }