阅读:1545回复:2
请教WINCE启动
小弟我用2410;刚接触WINCE,写了一个键盘驱动.用EINT0做一个键盘.在BOOL Ps2Keybd::KeybdPowerOn()初始化F0为外部中断.在int OEMInterruptHandler(unsigned int ra)的INTSRC_EINT0 return(SYSINTR_KEYBOARD);在OEMInterruptDone(DWORD idInt)开放EINT0.在void OEMInterruptDisable(DWORD idInt)屏蔽EINT0.在BOOL
OEMInterruptEnable(DWORD idInt,LPVOID pvData,DWORD cbData)开放EINT0.但不知道这些流程咋样.想问一下:还可以在其他地方初始化F0为EINT0吗?OEMInterruptDisable,OEMInterruptEnable,OEMInterruptDone分别在啥时候调用??? 望各位大虾指教.小弟谢谢先!!! |
|
沙发#
发布于:2005-06-09 16:49
我也是才学,你可以参考一下
Subdirectory of %_WINCEROOT%\\Public\\Common\\OAK\\Drivers\\keybd\\PS2_8042,源码写的比较好. 好像总体上是这么做的, 1.定义PDD入口函数,像帮助中的 The following code example shows an updated function definition, which was renamed TGTPLAT_Entry. BOOL WINAPI TGTPLAT_Entry( UINT uiPddId, PFN_KEYBD_EVENT pfnKeybdEvent, PKEYBD_PDD *ppKeybdPdd ) { BOOL bRet = FALSE; if (v_pp2p) { bRet = TRUE; goto leave; } v_pp2p = new Ps2Port; if (!v_pp2p->Initialize()) { ERRORMSG(1,(TEXT(\"Could not initialize ps2 port.\\r\\n\"))); goto leave; } // We always assume that there is a keyboard. v_pp2k = new Ps2Keybd; if (v_pp2k->Initialize(v_pp2p)) { v_pp2k ->IsrThreadStart(); } else { ERRORMSG(1,(TEXT(\"Could not initialize ps2 keyboard.\\r\\n\"))); delete v_pp2k; v_pp2k = NULL; } if (v_pp2p->MOUSE_PRESENT()) { v_pp2m = new Ps2Mouse; if ( v_pp2m -> Initialize(v_pp2p) ) { v_pp2m -> IsrThreadStart(); } else { ERRORMSG(1,(TEXT(\"Could not initialize ps2 mouse\\r\\n\"))); delete v_pp2m; v_pp2m = NULL; } } bRet = TRUE; leave: return bRet; } 2.然后在PDDList中, PFN_KEYBD_PDD_ENTRY g_rgpfnPddEntries[] = { TGTPLAT_Entry, NULL }; 把接口函数指针放置在一个数组中共,然后编译成一个lib库供Layoutmanager使用. 3.在ps2keybd的初试化函数中注册中断,并编写中断处理函数 IsrThreadProc 处理: keybdIst.hevInterrupt = m_hevInterrupt; keybdIst.dwSysIntr_Keybd = dwSysIntr_Keybd; keybdIst.uiPddId = v_uiPddId; keybdIst.pfnGetKeybdEvent = KeybdPdd_GetEventEx2; keybdIst.pfnKeybdEvent = v_pfnKeybdEvent; KeybdIstLoop(&keybdIst); 好像KeybdIstLoop交给layoutmanager去处理. |
|
|
板凳#
发布于:2005-06-10 19:59
谢谢你的好意了,大家一起努力
|
|