ps2port.hpp

来自「WinCE 3.0 BSP, 包含Inter SA1110, Intel_815」· HPP 代码 · 共 110 行

HPP
110
字号
/* -*-C-*-
 *
 * $Revision: 1.2 $
 *   $Author: kwelton $
 *     $Date: 2000/05/10 19:38:20 $
 *
 * Ps2Port:
 *
 * This is a very simple minded i8042 interface.
 *
 * It does not provide a complete interface to the i8042 chip.  It is
 * intended to provide only basic keyboard and mouse support.
 *
 * 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-1998  Microsoft Corporation
 * Copyright (c) 2000 ARM Limited
 * All Rights Reserved
 */

#ifndef integrator_ps2port_hpp
#define integrator_ps2port_hpp

#include <windows.h>
#include "board.h"

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 + VA_PCI_IO_BASE));
    }

    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 + VA_PCI_IO_BASE + 4), cmd8042);
        return;
    }

    void InputBufWrite(UINT8 data)
    {
        WRITE_PORT_UCHAR((PUCHAR)(m_iopBase + VA_PCI_IO_BASE), 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 /* ndef integrator_ps2port_hpp */

/* EOF ps2port.hpp */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?