📄 ps2port.hpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*
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.
*/
#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;
bool m_bIntelliMouseFound;
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
);
UINT8
MouseId(
void
);
bool
EnterWrite(
void
);
bool
LeaveWrite(
void
);
bool
SelfTest(
void
);
void
SetModeIntelliMouse
(
void
);
public:
bool
Initialize(
unsigned int iopBase
);
bool
bMouseFound(
void
)
{
return m_bMouseFound;
}
bool
bIntelliMouseFound(
void
)
{
return m_bIntelliMouseFound;
}
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -