]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lib/i386-io-windows.h
pciutils: Add the support for a DOS/DJGPP environment
[thirdparty/pciutils.git] / lib / i386-io-windows.h
CommitLineData
837511b7
MM
1/*
2 * The PCI Library -- Access to i386 I/O ports on Windows
3 *
4 * Copyright (c) 2004 Alexander Stock <stock.alexander@gmx.de>
d305d704 5 * Copyright (c) 2006 Martin Mares <mj@ucw.cz>
837511b7
MM
6 *
7 * Can be freely distributed and used under the terms of the GNU GPL.
8 */
9
10#include <io.h>
837511b7 11#include <windows.h>
1c5cc9b5 12
09156b3b
MM
13#ifndef __GNUC__
14#include <conio.h>
15#else
16int _outp(unsigned short port, int databyte);
17unsigned short _outpw(unsigned short port, unsigned short dataword);
18unsigned long _outpd(unsigned short port, unsigned long dataword);
19int _inp(unsigned short port);
20unsigned short _inpw(unsigned short port);
21unsigned long _inpd(unsigned short port);
22#endif
23
837511b7
MM
24#define outb(x,y) _outp(y,x)
25#define outw(x,y) _outpw(y,x)
26#define outl(x,y) _outpd(y,x)
1c5cc9b5 27
837511b7
MM
28#define inb(x) _inp(x)
29#define inw(x) _inpw(x)
30#define inl(x) _inpd(x)
31
837511b7 32static int
d305d704 33intel_setup_io(struct pci_access *a)
837511b7 34{
9007a292
MM
35 typedef int (*MYPROC)(void);
36 MYPROC InitializeWinIo;
37 HMODULE lib;
837511b7 38
9007a292
MM
39 lib = LoadLibrary("WinIo.dll");
40 if (!lib)
41 {
d305d704 42 a->warning("i386-io-windows: Couldn't load WinIo.dll.");
9007a292
MM
43 return 0;
44 }
45 /* XXX: Is this really needed? --mj */
46 GetProcAddress(lib, "InitializeWinIo");
837511b7 47
9007a292
MM
48 InitializeWinIo = (MYPROC) GetProcAddress(lib, "InitializeWinIo");
49 if (!InitializeWinIo)
50 {
d305d704 51 a->warning("i386-io-windows: Couldn't find InitializeWinIo function.");
9007a292
MM
52 return 0;
53 }
837511b7 54
9007a292
MM
55 if (!InitializeWinIo())
56 {
d305d704 57 a->warning("i386-io-windows: InitializeWinIo() failed.");
9007a292 58 return 0;
837511b7 59 }
9007a292
MM
60
61 return 1;
837511b7
MM
62}
63
9007a292 64static inline int
d305d704 65intel_cleanup_io(struct pci_access *a UNUSED)
837511b7
MM
66{
67 //TODO: DeInitializeWinIo!
9007a292 68 return 1;
837511b7 69}
5c5ce192
RM
70
71static inline void intel_io_lock(void)
72{
73}
74
75static inline void intel_io_unlock(void)
76{
77}