unit uWinIo;
interface
uses
Windows;
type
bool = boolean;
{ Init PortIO Service }
function __InitializeWinIo(): bool;
WinAPI;
{ Fint PortIO Service }
function __ShutdownWinIo(): bool;
WinAPI;
{ Remove PortIO Service }
function __RemoveWinIo(): boolean;
WinAPI;
{ Read or write PortIO, Size = 1, 2, 3, 4(Bytes) }
function __In(wPortAddr: WORD;
PortVal: PDWORD;
Size: BYTE): bool;
WinAPI;
function __Out(wPortAddr: WORD;
PortVal: DWORD;
Size: BYTE): bool;
WinAPI;
function __GetPhys(dwPhysAddr: DWORD;
PortVal: PDWORD): bool;
WinAPI;
function __SetPhys(dwPhysAddr: DWORD;
dwPortVal: DWORD): bool;
WinAPI;
{ Read or write Memory, }
function __MapPhysToLin(dwPhysAddr: DWORD;
dwPhysSize: DWORD;
hPhysHandle: PHandle): PByte;
WinAPI;
function __UnmapPhysMemory(hPhysHandle: THandle;
pbLinAddr: DWORD): bool;
WinAPI;
var
IOSuc: Boolean;
implementation
const
WINIODLL = 'WinIo.dll';
function __InitializeWinIo;
external WINIODLL name 'InitializeWinIo';
function __ShutdownWinIo;
external WINIODLL name 'ShutdownWinIo';
function __RemoveWinIo;
external WINIODLL name 'RemoveWinIoDriver';
function __In;
external WINIODLL name 'GetPortVal';
function __Out;
external WINIODLL name 'SetPortVal';
function __GetPhys;
external WINIODLL name 'GetPhysLong';
function __SetPhys;
external WINIODLL name 'SetPhysLong';
function __MapPhysToLin;
external WINIODLL name 'MapPhysToLin';
function __UnmapPhysMemory;
external WINIODLL name 'UnmapPhysicalMemory';
initialization
IOSuc := __InitializeWinIo;
finalization
__ShutdownWinIo();
end.
用这个单元,引用dll,把那几个文件copy到程序目录下即可