ps2port.hpp
来自「WinCE 3.0 BSP, 包含Inter SA1110, Intel_815」· HPP 代码 · 共 217 行
HPP
217 行
/*
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-2000 Microsoft Corporation. All rights reserved.
*/
#ifndef __PS2PORT_HPP_INCLUDED__
#define __PS2PORT_HPP_INCLUDED__
#include <windows.h>
/*++
Ps2Port:
This is a very simplistic i8042 interface.
It does not provide a complete interface to the i8042 chip. It is
intended to provide only basic keyboard and mouse support.
--*/
class Ps2Port
{
unsigned int m_iopBase;
CRITICAL_SECTION m_csWrite;
int m_cEnterWrites;
bool m_bMouseFound;
UINT8 m_ui8CmdByte;
UINT8
ui8IopRead(
unsigned int iop
)
{
return READ_PORT_UCHAR( (PUCHAR)iop);
}
UINT8
ui8StatusRead(
void
)
{
return ui8IopRead(m_iopBase+4);
}
UINT8
ui8OutputBufRead(
void
)
{
return ui8IopRead(m_iopBase);
}
bool
MainOutputBufIsFull(
void
);
bool
AuxOutputBufIsFull(
void
);
void
CommandWrite(
UINT8 cmd8042
)
{
WRITE_PORT_UCHAR((PUCHAR)m_iopBase+4, cmd8042);
return;
}
void
InputBufWrite(
UINT8 data
)
{
WRITE_PORT_UCHAR((PUCHAR)m_iopBase, data);
return;
}
bool
InputBufPollForEmpty(
void
);
bool
OutputBufPollRead(
UINT8 *pui8
);
bool
CommandPut(
UINT8 cmd8042
);
bool
InputBufPut(
UINT8 ui8Data
);
bool
CmdByteModify(
UINT8 ui8Set,
UINT8 ui8Clear
);
void
MouseCommandPut(
UINT8 cmdMouse
);
bool
MouseTest(
void
);
bool
EnterWrite(
void
);
bool
LeaveWrite(
void
);
bool
SelfTest(
void
);
public:
bool
Initialize(
unsigned int iopBase
);
bool
bMouseFound(
void
)
{
return m_bMouseFound;
}
bool
MouseDataRead(
UINT8 *pui8Data
);
bool
MouseInterruptEnable(
void
);
bool
KeyboardInterfaceTest(
void
);
bool
KeyboardCommandPut(
UINT8 ui8Cmd
);
bool
KeyboardReset(
void
);
void
KeyboardLights(
unsigned int fLights
);
bool
KeybdInterruptEnable(
void
);
bool
KeybdDataRead(
UINT8 *pui8Data
);
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?