2013-11-26 20:20:51 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: GPL - See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Virtual DOS Machine
|
|
|
|
* FILE: io.c
|
|
|
|
* PURPOSE: I/O Port Handlers
|
|
|
|
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
|
|
|
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _IO_H_
|
|
|
|
#define _IO_H_
|
|
|
|
|
|
|
|
/* DEFINES ********************************************************************/
|
|
|
|
|
|
|
|
#define EMULATOR_MAX_IOPORTS_NUM 0x10000
|
|
|
|
|
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
2014-10-23 12:17:44 +00:00
|
|
|
typedef UCHAR (WINAPI *EMULATOR_INB_PROC)(USHORT Port);
|
|
|
|
typedef USHORT (WINAPI *EMULATOR_INW_PROC)(USHORT Port);
|
|
|
|
typedef ULONG (WINAPI *EMULATOR_IND_PROC)(USHORT Port);
|
2013-11-26 20:20:51 +00:00
|
|
|
|
2014-10-23 12:17:44 +00:00
|
|
|
typedef VOID (WINAPI *EMULATOR_INSB_PROC)(USHORT Port, PUCHAR Buffer, ULONG Count);
|
|
|
|
typedef VOID (WINAPI *EMULATOR_INSW_PROC)(USHORT Port, PUSHORT Buffer, ULONG Count);
|
|
|
|
typedef VOID (WINAPI *EMULATOR_INSD_PROC)(USHORT Port, PULONG Buffer, ULONG Count);
|
2013-11-26 20:20:51 +00:00
|
|
|
|
2014-10-23 12:17:44 +00:00
|
|
|
typedef VOID (WINAPI *EMULATOR_OUTB_PROC)(USHORT Port, UCHAR Data);
|
|
|
|
typedef VOID (WINAPI *EMULATOR_OUTW_PROC)(USHORT Port, USHORT Data);
|
|
|
|
typedef VOID (WINAPI *EMULATOR_OUTD_PROC)(USHORT Port, ULONG Data);
|
2013-12-23 18:17:29 +00:00
|
|
|
|
2014-10-23 12:17:44 +00:00
|
|
|
typedef VOID (WINAPI *EMULATOR_OUTSB_PROC)(USHORT Port, PUCHAR Buffer, ULONG Count);
|
|
|
|
typedef VOID (WINAPI *EMULATOR_OUTSW_PROC)(USHORT Port, PUSHORT Buffer, ULONG Count);
|
|
|
|
typedef VOID (WINAPI *EMULATOR_OUTSD_PROC)(USHORT Port, PULONG Buffer, ULONG Count);
|
2013-12-23 18:17:29 +00:00
|
|
|
|
|
|
|
|
2014-01-11 14:40:03 +00:00
|
|
|
UCHAR
|
2014-10-23 12:17:44 +00:00
|
|
|
IOReadB(USHORT Port);
|
2014-01-11 14:40:03 +00:00
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOReadStrB(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
PUCHAR Buffer,
|
|
|
|
ULONG Count);
|
|
|
|
|
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOWriteB(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
UCHAR Buffer);
|
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOWriteStrB(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
PUCHAR Buffer,
|
|
|
|
ULONG Count);
|
|
|
|
|
|
|
|
USHORT
|
2014-10-23 12:17:44 +00:00
|
|
|
IOReadW(USHORT Port);
|
2014-01-11 14:40:03 +00:00
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOReadStrW(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
PUSHORT Buffer,
|
|
|
|
ULONG Count);
|
|
|
|
|
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOWriteW(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
USHORT Buffer);
|
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOWriteStrW(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
PUSHORT Buffer,
|
|
|
|
ULONG Count);
|
|
|
|
|
|
|
|
ULONG
|
2014-10-23 12:17:44 +00:00
|
|
|
IOReadD(USHORT Port);
|
2014-01-11 14:40:03 +00:00
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOReadStrD(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
PULONG Buffer,
|
|
|
|
ULONG Count);
|
|
|
|
|
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOWriteD(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
ULONG Buffer);
|
|
|
|
VOID
|
2014-10-23 12:17:44 +00:00
|
|
|
IOWriteStrD(USHORT Port,
|
2014-01-11 14:40:03 +00:00
|
|
|
PULONG Buffer,
|
|
|
|
ULONG Count);
|
|
|
|
|
|
|
|
|
2014-10-23 12:17:44 +00:00
|
|
|
VOID RegisterIoPort(USHORT Port,
|
2013-12-23 18:17:29 +00:00
|
|
|
EMULATOR_INB_PROC InHandler,
|
|
|
|
EMULATOR_OUTB_PROC OutHandler);
|
|
|
|
|
2014-10-23 12:17:44 +00:00
|
|
|
VOID UnregisterIoPort(USHORT Port);
|
2013-12-08 14:22:27 +00:00
|
|
|
|
2013-11-26 20:20:51 +00:00
|
|
|
VOID WINAPI EmulatorReadIo
|
|
|
|
(
|
|
|
|
PFAST486_STATE State,
|
2014-10-23 12:17:44 +00:00
|
|
|
USHORT Port,
|
2013-11-26 20:20:51 +00:00
|
|
|
PVOID Buffer,
|
|
|
|
ULONG DataCount,
|
|
|
|
UCHAR DataSize
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID WINAPI EmulatorWriteIo
|
|
|
|
(
|
|
|
|
PFAST486_STATE State,
|
2014-10-23 12:17:44 +00:00
|
|
|
USHORT Port,
|
2013-11-26 20:20:51 +00:00
|
|
|
PVOID Buffer,
|
|
|
|
ULONG DataCount,
|
|
|
|
UCHAR DataSize
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif // _IO_H_
|
|
|
|
|
|
|
|
/* EOF */
|