2006-11-13 04:31:39 +00:00
|
|
|
/*
|
2006-11-29 08:28:20 +00:00
|
|
|
* PROJECT: ReactOS HAL
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: hal/halx86/generic/portio.c
|
|
|
|
* PURPOSE: I/O Functions for access to ports
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
*/
|
2006-11-13 04:31:39 +00:00
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
2001-08-21 20:18:27 +00:00
|
|
|
|
2005-06-18 14:29:31 +00:00
|
|
|
#include <hal.h>
|
2005-06-19 22:53:49 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
2001-08-21 20:18:27 +00:00
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
//
|
|
|
|
// HAL Port to Inlined Port
|
|
|
|
//
|
|
|
|
#define H2I(Port) PtrToUshort(Port)
|
2001-08-21 20:18:27 +00:00
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
2003-12-28 22:39:06 +00:00
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
READ_PORT_BUFFER_UCHAR(IN PUCHAR Port,
|
|
|
|
OUT PUCHAR Buffer,
|
|
|
|
IN ULONG Count)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__inbytestring(H2I(Port), Buffer, Count);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
READ_PORT_BUFFER_USHORT(IN PUSHORT Port,
|
|
|
|
OUT PUSHORT Buffer,
|
|
|
|
IN ULONG Count)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__inwordstring(H2I(Port), Buffer, Count);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
READ_PORT_BUFFER_ULONG(IN PULONG Port,
|
|
|
|
OUT PULONG Buffer,
|
|
|
|
IN ULONG Count)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__indwordstring(H2I(Port), Buffer, Count);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
UCHAR
|
|
|
|
NTAPI
|
|
|
|
READ_PORT_UCHAR(IN PUCHAR Port)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
return __inbyte(H2I(Port));
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
USHORT
|
|
|
|
NTAPI
|
|
|
|
READ_PORT_USHORT(IN PUSHORT Port)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
return __inword(H2I(Port));
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
READ_PORT_ULONG(IN PULONG Port)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
return __indword(H2I(Port));
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
WRITE_PORT_BUFFER_UCHAR(IN PUCHAR Port,
|
|
|
|
IN PUCHAR Buffer,
|
|
|
|
IN ULONG Count)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__outbytestring(H2I(Port), Buffer, Count);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
WRITE_PORT_BUFFER_USHORT(IN PUSHORT Port,
|
|
|
|
IN PUSHORT Buffer,
|
|
|
|
IN ULONG Count)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__outwordstring(H2I(Port), Buffer, Count);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
WRITE_PORT_BUFFER_ULONG(IN PULONG Port,
|
|
|
|
IN PULONG Buffer,
|
|
|
|
IN ULONG Count)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__outdwordstring(H2I(Port), Buffer, Count);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
WRITE_PORT_UCHAR(IN PUCHAR Port,
|
|
|
|
IN UCHAR Value)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__outbyte(H2I(Port), Value);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
WRITE_PORT_USHORT(IN PUSHORT Port,
|
|
|
|
IN USHORT Value)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__outword(H2I(Port), Value);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:31:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
WRITE_PORT_ULONG(IN PULONG Port,
|
|
|
|
IN ULONG Value)
|
2001-08-21 20:18:27 +00:00
|
|
|
{
|
2006-11-13 04:31:39 +00:00
|
|
|
__outdword(H2I(Port), Value);
|
2001-08-21 20:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|