xref: /reactos/hal/halx86/generic/portio.c (revision 40462c92)
1 /*
2  * PROJECT:         ReactOS HAL
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            hal/halx86/generic/portio.c
5  * PURPOSE:         I/O Functions for access to ports
6  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <hal.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 //
16 // HAL Port to Inlined Port
17 //
18 #define H2I(Port) PtrToUshort(Port)
19 
20 /* FUNCTIONS *****************************************************************/
21 
22 VOID
23 NTAPI
24 READ_PORT_BUFFER_UCHAR(IN PUCHAR Port,
25                        OUT PUCHAR Buffer,
26                        IN ULONG Count)
27 {
28     __inbytestring(H2I(Port), Buffer, Count);
29 }
30 
31 VOID
32 NTAPI
33 READ_PORT_BUFFER_USHORT(IN PUSHORT Port,
34                         OUT PUSHORT Buffer,
35                         IN ULONG Count)
36 {
37     __inwordstring(H2I(Port), Buffer, Count);
38 }
39 
40 VOID
41 NTAPI
42 READ_PORT_BUFFER_ULONG(IN PULONG Port,
43                        OUT PULONG Buffer,
44                        IN ULONG Count)
45 {
46     __indwordstring(H2I(Port), Buffer, Count);
47 }
48 
49 UCHAR
50 NTAPI
51 READ_PORT_UCHAR(IN PUCHAR Port)
52 {
53     return __inbyte(H2I(Port));
54 }
55 
56 USHORT
57 NTAPI
58 READ_PORT_USHORT(IN PUSHORT Port)
59 {
60     return __inword(H2I(Port));
61 }
62 
63 ULONG
64 NTAPI
65 READ_PORT_ULONG(IN PULONG Port)
66 {
67     return __indword(H2I(Port));
68 }
69 
70 VOID
71 NTAPI
72 WRITE_PORT_BUFFER_UCHAR(IN PUCHAR Port,
73                         IN PUCHAR Buffer,
74                         IN ULONG Count)
75 {
76     __outbytestring(H2I(Port), Buffer, Count);
77 }
78 
79 VOID
80 NTAPI
81 WRITE_PORT_BUFFER_USHORT(IN PUSHORT Port,
82                          IN PUSHORT Buffer,
83                          IN ULONG Count)
84 {
85     __outwordstring(H2I(Port), Buffer, Count);
86 }
87 
88 VOID
89 NTAPI
90 WRITE_PORT_BUFFER_ULONG(IN PULONG Port,
91                         IN PULONG Buffer,
92                         IN ULONG Count)
93 {
94     __outdwordstring(H2I(Port), Buffer, Count);
95 }
96 
97 VOID
98 NTAPI
99 WRITE_PORT_UCHAR(IN PUCHAR Port,
100                  IN UCHAR Value)
101 {
102     __outbyte(H2I(Port), Value);
103 }
104 
105 VOID
106 NTAPI
107 WRITE_PORT_USHORT(IN PUSHORT Port,
108                   IN USHORT Value)
109 {
110     __outword(H2I(Port), Value);
111 }
112 
113 VOID
114 NTAPI
115 WRITE_PORT_ULONG(IN PULONG Port,
116                  IN ULONG Value)
117 {
118     __outdword(H2I(Port), Value);
119 }
120 
121 /* EOF */
122