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