WinCE 5.0下鼠标键盘驱动分析续2_Loki | linux 内核| linux 驱动 ...

Driver Code----Kbdmouse.cpp

实现了KEYBD_PDD结构中的2个函数(函数指针)PS2_EMUL_PowerHandlerPS2_EMUL_ToggleLights

入口函数:

         PS2_EMUL_Entry()

{

*ppKeybdPdd = &PS28042Pdd;                    //设定键盘控制器是PS2 8042键盘控制器

v_pp2p = new Ps2Port;

// We always assume that there is a keyboard.

v_pp2k = new Ps2Keybd;                                //NEW一个键盘

v_pp2k -> Initialize(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,滚轮)的函数。

获取鼠标的{jd1}位置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




郑重声明:资讯 【WinCE 5.0下鼠标键盘驱动分析续2_Loki | linux 内核| linux 驱动 ...】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——