kbdmouse.cpp
来自「WinCE 3.0 BSP, 包含Inter SA1110, Intel_815」· C++ 代码 · 共 151 行
CPP
151 行
/* -*-C-*-
*
* $Revision: 1.3 $
* $Author: kwelton $
* $Date: 2000/06/14 03:38:21 $
*
* 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
*/
#include <windows.h>
#include <ceddk.h>
#include "oalintr.h"
#include "platform.h"
#include "pl050port.hpp"
#include "pl050keybd.hpp"
#include "pl050mouse.hpp"
static pl050Port *port1 = NULL, *port2 = NULL;
static pl050Keybd *kbdport = NULL;
static pl050Mouse *mouseport = NULL;
/**********************************************************************/
BOOL WINAPI DllMain(HANDLE hinstDll, DWORD dwReason, LPVOID lpReserved)
{
pl050Port *port;
BOOL bRet = FALSE;
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
if (port1 != NULL)
{
bRet = TRUE;
goto leave;
}
/*
* Unlike the code we are ripping off, there are two
* completely separate devices: one for the keyboard,
* and one for the mouse. However, it is possible for
* either device (kbd/mouse) to be connected to either
* port. We initialise both ports, then see which has what
* device: no mouse is toletable, no kbd is a fatal error
*/
if (!(port1 = new pl050Port) ||
!(port2 = new pl050Port) ||
!(kbdport = new pl050Keybd) ||
!(mouseport = new pl050Mouse))
{
ERRORMSG(1, (TEXT("Heap exhausted\r\n")));
goto dodelete;
}
if (!port1->Initialise(KMI0_BASE, SYSINTR_KEYBOARD) ||
!port2->Initialise(KMI1_BASE, SYSINTR_MOUSE))
{
ERRORMSG(1, (TEXT("Could not initialise ports\r\n")));
goto dodelete;
}
if (port1->KbdFound())
port = port1;
else if (port2->KbdFound())
port = port2;
else
{
ERRORMSG(1, (TEXT("No keyboard found, please type address of")
TEXT(" kbd driver port and hit F3\r\n")));
goto dodelete;
}
RETAILMSG(1, (TEXT("Initialising keyboard on port%d\r\n"),
(port == port1) ? 1 : 2));
if (kbdport->Initialise(port))
kbdport->IsrThreadStart();
else
{
ERRORMSG(1, (TEXT("Could not initialise kbd\r\n")));
goto dodelete;
}
if (port1->MouseFound())
port = port1;
else if (port2->MouseFound())
port = port2;
else
{
RETAILMSG(1, (TEXT("No mouse found\r\n")));
port = NULL;
}
if (port)
{
DEBUGMSG(1, (TEXT("Initialising mouse on port%d\r\n"),
(port == port1) ? 1 : 2));
if (mouseport->Initialise(port))
mouseport->IsrThreadStart();
else
{
RETAILMSG(1, (TEXT("Could not initialise mouse\r\n")));
delete mouseport;
mouseport = NULL;
}
}
bRet = TRUE;
dodelete:
if (!bRet)
{
delete port1;
port1 = NULL;
delete port2;
port2 = NULL;
delete kbdport;
kbdport = NULL;
delete mouseport;
mouseport = NULL;
}
break;
default:
break;
}
leave:
return bRet;
}
/* EOF kbdmouse.cpp */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?