forked from xt-sys/exectos
Implement I/O registers related routines
This commit is contained in:
parent
358b20f1a1
commit
f549ca54a1
@ -36,6 +36,7 @@ list(APPEND XTOSKRNL_SOURCE
|
|||||||
${XTOSKRNL_SOURCE_DIR}/rtl/atomic.c
|
${XTOSKRNL_SOURCE_DIR}/rtl/atomic.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/byteswap.c
|
${XTOSKRNL_SOURCE_DIR}/rtl/byteswap.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/intrin.c
|
${XTOSKRNL_SOURCE_DIR}/rtl/intrin.c
|
||||||
|
${XTOSKRNL_SOURCE_DIR}/rtl/ioreg.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/memory.c
|
${XTOSKRNL_SOURCE_DIR}/rtl/memory.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/plist.c
|
${XTOSKRNL_SOURCE_DIR}/rtl/plist.c
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/string.c
|
${XTOSKRNL_SOURCE_DIR}/rtl/string.c
|
||||||
|
124
xtoskrnl/rtl/ioreg.c
Normal file
124
xtoskrnl/rtl/ioreg.c
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/rtl/ioreg.c
|
||||||
|
* DESCRIPTION: I/O registers related routines
|
||||||
|
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtos.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a byte from a specified register address.
|
||||||
|
*
|
||||||
|
* @param Register
|
||||||
|
* Supplies a pointer to register address holding data to read.
|
||||||
|
*
|
||||||
|
* @return This routine returns UCHAR byte read from the register.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
UCHAR
|
||||||
|
RtlReadRegisterByte(IN VOLATILE PUCHAR Register)
|
||||||
|
{
|
||||||
|
return *Register;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a byte from a specified register address.
|
||||||
|
*
|
||||||
|
* @param Register
|
||||||
|
* Supplies a pointer to register address holding data to read.
|
||||||
|
*
|
||||||
|
* @return This routine returns ULONG byte read from the register.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
ULONG
|
||||||
|
RtlReadRegisterLong(IN VOLATILE PULONG Register)
|
||||||
|
{
|
||||||
|
return *Register;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a byte from a specified register address.
|
||||||
|
*
|
||||||
|
* @param Register
|
||||||
|
* Supplies a pointer to register address holding data to read.
|
||||||
|
*
|
||||||
|
* @return This routine returns USHORT byte read from the register.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
USHORT
|
||||||
|
RtlReadRegisterShort(IN VOLATILE PUSHORT Register)
|
||||||
|
{
|
||||||
|
return *Register;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a byte into a specified register address.
|
||||||
|
*
|
||||||
|
* @param Register
|
||||||
|
* Supplies a pointer to register address where data will be written.
|
||||||
|
*
|
||||||
|
* @param Value
|
||||||
|
* Supplies a new UCHAR value that will be stored into a register.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
RtlWriteRegisterByte(IN PUSHORT Register,
|
||||||
|
IN UCHAR Value)
|
||||||
|
{
|
||||||
|
HlIoPortOutByte((USHORT)(ULONG_PTR)Register, Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a byte into a specified register address.
|
||||||
|
*
|
||||||
|
* @param Register
|
||||||
|
* Supplies a pointer to register address where data will be written.
|
||||||
|
*
|
||||||
|
* @param Value
|
||||||
|
* Supplies a new ULONG value that will be stored into a register.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
RtlWriteRegisterLong(IN PUSHORT Register,
|
||||||
|
IN ULONG Value)
|
||||||
|
{
|
||||||
|
HlIoPortOutLong((USHORT)(ULONG_PTR)Register, Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a byte into a specified register address.
|
||||||
|
*
|
||||||
|
* @param Register
|
||||||
|
* Supplies a pointer to register address where data will be written.
|
||||||
|
*
|
||||||
|
* @param Value
|
||||||
|
* Supplies a new USHORT value that will be stored into a register.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
RtlWriteRegisterShort(IN PUSHORT Register,
|
||||||
|
IN USHORT Value)
|
||||||
|
{
|
||||||
|
HlIoPortOutShort((USHORT)(ULONG_PTR)Register, Value);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user