File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / pciutils / lib / i386-io-windows.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Fri Feb 17 15:18:43 2012 UTC (13 years, 1 month ago) by misho
Branches: pciutils, MAIN
CVS tags: v3_1_9, HEAD
pciutils

    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:  *	Copyright (c) 2006 Martin Mares <mj@ucw.cz>
    6:  *
    7:  *	Can be freely distributed and used under the terms of the GNU GPL.
    8:  */
    9: 
   10: #include <io.h>
   11: #include <windows.h>
   12: 
   13: #ifndef __GNUC__
   14: #include <conio.h>
   15: #else
   16: int _outp(unsigned short port, int databyte);
   17: unsigned short _outpw(unsigned short port, unsigned short dataword);
   18: unsigned long _outpd(unsigned short port, unsigned long dataword);
   19: int _inp(unsigned short port);
   20: unsigned short _inpw(unsigned short port);
   21: unsigned long _inpd(unsigned short port);
   22: #endif
   23: 
   24: #define outb(x,y) _outp(y,x)
   25: #define outw(x,y) _outpw(y,x)
   26: #define outl(x,y) _outpd(y,x)
   27: 
   28: #define inb(x) _inp(x)
   29: #define inw(x) _inpw(x)
   30: #define inl(x) _inpd(x)
   31: 
   32: static int
   33: intel_setup_io(struct pci_access *a)
   34: {
   35:   typedef int (*MYPROC)(void);
   36:   MYPROC InitializeWinIo;
   37:   HMODULE lib;
   38: 
   39:   lib = LoadLibrary("WinIo.dll");
   40:   if (!lib)
   41:     {
   42:       a->warning("i386-io-windows: Couldn't load WinIo.dll.");
   43:       return 0;
   44:     }
   45:   /* XXX: Is this really needed? --mj */
   46:   GetProcAddress(lib, "InitializeWinIo");
   47: 
   48:   InitializeWinIo = (MYPROC) GetProcAddress(lib, "InitializeWinIo");
   49:   if (!InitializeWinIo)
   50:     {
   51:       a->warning("i386-io-windows: Couldn't find InitializeWinIo function.");
   52:       return 0;
   53:     }
   54: 
   55:   if (!InitializeWinIo())
   56:     {
   57:       a->warning("i386-io-windows: InitializeWinIo() failed.");
   58:       return 0;
   59:     }
   60: 
   61:   return 1;
   62: }
   63: 
   64: static inline int
   65: intel_cleanup_io(struct pci_access *a UNUSED)
   66: {
   67:   //TODO: DeInitializeWinIo!
   68:   return 1;
   69: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>