WinCE 5.0下鼠标键盘驱动分析(下)
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
嵌入式新闻 嵌入式资料 嵌入式培训 嵌入式linux 嵌入式系统 嵌入式开发 嵌入式 相关文章:
- 煤矿井下综合自动化系统中的应用(04-06)
- 软件Overlay:程序编写与调试(01-20)
- USB数据通信接□模块的程序设计(10-17)
- 东江产业园:力争2017年产值达千亿(09-30)
- 硅谷数模的SlimPort扩大了Nexus7的显示屏选择(08-01)
- Lonworks控制网络技术在城市排水泵站自动化中的应用(06-06)