微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > WinCE 5.0下鼠标键盘驱动分析(下)

WinCE 5.0下鼠标键盘驱动分析(下)

时间:02-27 来源:互联网 点击:

alize(v_pp2p) /初始化键盘

v_pp2k -> IsrThreadStart(); /键盘中断处理线程启动

if ( v_pp2p -> bMouseFound() ) /如果有鼠标连着的话

{

v_pp2m = new Ps2Mouse; /NEW一个鼠标

v_pp2m -> Initialize(v_pp2p) /初始化鼠标

v_pp2m -> IsrThreadStart(); /鼠标中断处理线程启动

}

}

Driver Code----ps2mouse.cpp

实现了鼠标中断处理线程,以及获取鼠标数据(x,y,滚轮)的函数。

获取鼠标的绝对位置GetHostMousePosition()

中断服务线程实现:

IsrThreadStart ->Ps2MouseIsrThread->IsrThreadProc

IsrThreadProc()

{

/查注册表,检查中断是否能使系统从休眠中醒来. KernelIoControl

。。。。。。

m_pp2p -> MouseInterruptEnable();

for ( ; ; )

{

wait_for_interrupt:

if(WaitForSingleObject(m_hevInterrupt, (cBytes == 0 ? INFINITE : IN_PACKET_TIMEOUT)) == WAIT_TIMEOUT)

{

/确定鼠标事件和位置,READ_PORT_UCHAR

。。。。。。

goto wait_for_interrupt;

}

}

Driver Code---- Ps2keybd.cpp

函数调用方向:IsrThreadStart ->Ps2KeybdIsrThread->IsrThreadProc

IsrThreadProc()

{

/查注册表,检查中断是否能使系统从休眠中醒来

dwStatus = RegOpenKeyEx();

if (m_pp2p->WillWake()) {

/ Ask the OAL to enable our interrupt to wake the system from suspend.

KernelIoContro();

}

m_pp2p -> KeybdInterruptEnable();

KeybdIstLoop () / KeybdIst.lib

}

Driver Code---- Keybdist.cpp

KeybdIstLoop()

{

wait_for_keybd_interrupt:

if (WaitForSingleObject(pKeybdIst->hevInterrupt, INFINITE) == WAIT_OBJECT_0)

{

....

}

goto wait_for_keybd_interrupt;

ErrorShow……

}

Source file

TARGETNAME=KbdXscXTMsEngUs1

DEFFILE=$(_COMMONOAKROOT)\INC\kbdmouse.def

TARGETTYPE=DYNLINK

DLLENTRY=DllMain

TARGETLIBS= \

$(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\coredll.lib \

$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\ceddk.lib \

$(_TARGETPLATROOT)\lib\$(_CPUINDPATH)\drvlib.lib

SOURCELIBS=\

$(_TARGETPLATROOT)\lib\$(_CPUINDPATH)\KbdmsCommon.lib \

$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\KeybdIst.lib \

$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\PS2_AT_00000409.lib \

$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\layoutmanager.lib \

$(_TARGETPLATROOT)\lib\$(_CPUINDPATH)\kbdpddlist.lib \

$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\InputLang_0409.lib \

$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\numpadrmp.lib


Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top