📄 pl050keybd.cpp
字号:
//
// 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.
//
/* -*-C-*-
*
* 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.
*
* Release Status:OS005-SW-70002-r0p0-00REL0
* $Copyright:
* ----------------------------------------------------------------
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2004 ARM Limited
* ALL RIGHTS RESERVED
* The entire notice above must be reproduced on all authorised
* copies and copies may only be made to the extent permitted
* by a licensing agreement from ARM Limited.
* ----------------------------------------------------------------
* File: pl050keybd.cpp,v
* Revision: 1.1
* ----------------------------------------------------------------
* $
*/
#include <windows.h>
#include <ceddk.h>
#include <nkintr.h>
#include <keybdpdd.h>
#include <laymgr.h>
#include "pl050port.hpp"
#include "pl050keybd.hpp"
unsigned int KbdISRUpcall(bool timedout, unsigned int scancode);
static pl050Keybd *kbdport;
// Scan code consts
static const UINT8 scE0Extended = 0xe0;
static const UINT8 scE1Extended = 0xe1;
static const UINT8 scKeyUpMask = 0x80;
/**********************************************************************/
UINT WINAPI pl050KeybdPdd_GetEventEx2(UINT32 rguiScanCode[16],
BOOL rgfKeyUp[16],
UINT8 ui8ScanCode)
{
SETFNAME(_T("KeybdPdd_GetEventEx2"));
static UINT32 scInProgress;
static UINT32 scPrevious;
static BOOL fKeyUp;
BOOL fEvent = FALSE;
UINT cEvents = 0;
DEBUGCHK(rguiScanCode != NULL);
DEBUGCHK(rgfKeyUp != NULL);
DEBUGMSG(ZONE_SCANCODES,
(_T("%s: scan code 0x%08x, code in progress 0x%08x, previous 0x%08x\r\n"),
pszFname, ui8ScanCode, scInProgress, scPrevious));
if ( ui8ScanCode == 0xf0 )
{
fKeyUp = TRUE;
}
else if ( ui8ScanCode == scE0Extended )
{
scInProgress = 0xe000;
}
else if ( ui8ScanCode == scE1Extended )
{
scInProgress = 0xe10000;
}
else if ( scInProgress == 0xe10000 )
{
scInProgress |= ui8ScanCode << 8;
}
else
{
scInProgress |= ui8ScanCode;
if ( ( scInProgress == scPrevious ) && ( fKeyUp == FALSE ) )
{
// mdd handles auto-repeat so ignore auto-repeats from keybd
}
else // Not a repeated key. This is the real thing.
{
// The Korean keyboard has two keys which generate a single
// scan code when pressed. The keys don't auto-repeat or
// generate a scan code on release. The scan codes are 0xf1
// and 0xf2. It doesn't look like any other driver uses
// the 0x71 or 0x72 scan code so it should be safe.
// If it is one of the Korean keys, drop the previous scan code.
// If we didn't, the earlier check to ignore auto-repeating keys
// would prevent this key from working twice in a row. (Since the
// key does not generate a scan code on release.)
if ( ( fKeyUp == TRUE ) ||
( scInProgress == 0xf1 ) ||
( scInProgress == 0xf2 ) )
{
scPrevious = 0;
}
else
{
scPrevious = scInProgress;
}
rguiScanCode[cEvents] = scInProgress;
rgfKeyUp[cEvents] = fKeyUp;
++cEvents;
}
scInProgress = 0;
fKeyUp = FALSE;
}
return cEvents;
}
bool pl050Keybd::Initialise(pl050Port *port)
{
m_pp2p = port;
kbdport = this;
DEBUGMSG(1, (TEXT("pl050Keybd::Init: kbdport = %x\r\n"), kbdport));
port->SetISRUpcall(KbdISRUpcall);
return true;
}
/* EOF pl050keybd.cpp */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -