xref: /reactos/subsystems/mvdm/ntvdm/io.h (revision c2c66aff)
1 /*
2  * COPYRIGHT:       GPL - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/io.h
5  * PURPOSE:         I/O Port Handlers
6  * PROGRAMMERS:     Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  *                  Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8  */
9 
10 #ifndef _IO_H_
11 #define _IO_H_
12 
13 /* DEFINES ********************************************************************/
14 
15 #define EMULATOR_MAX_IOPORTS_NUM    0x10000
16 
17 /* FUNCTIONS ******************************************************************/
18 
19 typedef UCHAR  (WINAPI *EMULATOR_INB_PROC)(USHORT Port);
20 typedef USHORT (WINAPI *EMULATOR_INW_PROC)(USHORT Port);
21 typedef ULONG  (WINAPI *EMULATOR_IND_PROC)(USHORT Port);
22 
23 typedef VOID (WINAPI *EMULATOR_INSB_PROC)(USHORT Port, PUCHAR  Buffer, ULONG Count);
24 typedef VOID (WINAPI *EMULATOR_INSW_PROC)(USHORT Port, PUSHORT Buffer, ULONG Count);
25 typedef VOID (WINAPI *EMULATOR_INSD_PROC)(USHORT Port, PULONG  Buffer, ULONG Count);
26 
27 typedef VOID (WINAPI *EMULATOR_OUTB_PROC)(USHORT Port, UCHAR  Data);
28 typedef VOID (WINAPI *EMULATOR_OUTW_PROC)(USHORT Port, USHORT Data);
29 typedef VOID (WINAPI *EMULATOR_OUTD_PROC)(USHORT Port, ULONG  Data);
30 
31 typedef VOID (WINAPI *EMULATOR_OUTSB_PROC)(USHORT Port, PUCHAR  Buffer, ULONG Count);
32 typedef VOID (WINAPI *EMULATOR_OUTSW_PROC)(USHORT Port, PUSHORT Buffer, ULONG Count);
33 typedef VOID (WINAPI *EMULATOR_OUTSD_PROC)(USHORT Port, PULONG  Buffer, ULONG Count);
34 
35 
36 UCHAR
37 IOReadB(USHORT Port);
38 VOID
39 IOReadStrB(USHORT Port,
40            PUCHAR Buffer,
41            ULONG  Count);
42 
43 VOID
44 IOWriteB(USHORT Port,
45          UCHAR  Buffer);
46 VOID
47 IOWriteStrB(USHORT Port,
48             PUCHAR Buffer,
49             ULONG  Count);
50 
51 USHORT
52 IOReadW(USHORT Port);
53 VOID
54 IOReadStrW(USHORT  Port,
55            PUSHORT Buffer,
56            ULONG   Count);
57 
58 VOID
59 IOWriteW(USHORT Port,
60          USHORT Buffer);
61 VOID
62 IOWriteStrW(USHORT  Port,
63             PUSHORT Buffer,
64             ULONG   Count);
65 
66 ULONG
67 IOReadD(USHORT Port);
68 VOID
69 IOReadStrD(USHORT Port,
70            PULONG Buffer,
71            ULONG  Count);
72 
73 VOID
74 IOWriteD(USHORT Port,
75          ULONG  Buffer);
76 VOID
77 IOWriteStrD(USHORT Port,
78             PULONG Buffer,
79             ULONG  Count);
80 
81 
82 VOID RegisterIoPort(USHORT Port,
83                     EMULATOR_INB_PROC  InHandler,
84                     EMULATOR_OUTB_PROC OutHandler);
85 
86 VOID UnregisterIoPort(USHORT Port);
87 
88 VOID FASTCALL EmulatorReadIo
89 (
90     PFAST486_STATE State,
91     USHORT Port,
92     PVOID Buffer,
93     ULONG DataCount,
94     UCHAR DataSize
95 );
96 
97 VOID FASTCALL EmulatorWriteIo
98 (
99     PFAST486_STATE State,
100     USHORT Port,
101     PVOID Buffer,
102     ULONG DataCount,
103     UCHAR DataSize
104 );
105 
106 #endif /* _IO_H_ */
107