2008-03-05 09:52:00 -05:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Microsoft Research Singularity
|
|
|
|
//
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
//
|
|
|
|
// File: IoPort.cpp
|
|
|
|
//
|
2008-11-17 18:29:00 -05:00
|
|
|
// Note: Kernel & Process
|
2008-03-05 09:52:00 -05:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "hal.h"
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////// I/O Port Access.
|
|
|
|
//
|
|
|
|
|
2008-11-17 18:29:00 -05:00
|
|
|
// Note: eventually we need to fix the IoPort class for ARM.
|
|
|
|
// For now, though, we conditionalize this code since we don't have
|
|
|
|
// io port operations
|
|
|
|
//
|
|
|
|
|
2008-03-05 09:52:00 -05:00
|
|
|
uint8 Class_Microsoft_Singularity_Io_IoPort::g_HalReadInt8(uint32 port)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
return __inbyte(port);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
return 0;
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 Class_Microsoft_Singularity_Io_IoPort::g_HalReadInt16(uint32 port)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
return __inword(port);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
return 0;
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Class_Microsoft_Singularity_Io_IoPort::g_HalReadInt32(uint32 port)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
return __indword(port);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
return 0;
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void Class_Microsoft_Singularity_Io_IoPort::g_HalWriteInt8(uint32 port,
|
|
|
|
uint8 value)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
__outbyte(port, value);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void Class_Microsoft_Singularity_Io_IoPort::g_HalWriteInt16(uint32 port,
|
|
|
|
uint16 value)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
__outword(port, value);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void Class_Microsoft_Singularity_Io_IoPort::g_HalWriteInt32(uint32 port,
|
|
|
|
uint32 value)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
__outdword(port, value);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#if DO_UNSAFE_CODE_IN_IO
|
2008-11-17 18:29:00 -05:00
|
|
|
|
2008-03-05 09:52:00 -05:00
|
|
|
void Class_Microsoft_Singularity_Io_IoPort::g_HalReadFifo16(uint32 port,
|
|
|
|
uint16 *buffer,
|
|
|
|
uint32 count)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
__inwordstring(port, buffer, count);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void Class_Microsoft_Singularity_Io_IoPort::g_HalWriteFifo16(uint32 port,
|
|
|
|
uint16 *buffer,
|
|
|
|
uint32 count)
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
#if ISA_IX86 || ISA_IX64
|
|
|
|
__outwordstring(port, buffer, count);
|
|
|
|
#else
|
|
|
|
__debugbreak();
|
|
|
|
#endif
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
|
2008-11-17 18:29:00 -05:00
|
|
|
#endif // DO_UNSAFE_CODE_IN_IO
|
2008-03-05 09:52:00 -05:00
|
|
|
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////// End of File.
|