|
- 回shuiyan前辈,这个上面的代码不是我写的啊,是微软自带的键盘IST,我只是移植到BSP下编译,这样可以增加打印信息。
- 这样写没有问题吧。
- (*pKeybdIst->pfnKeybdEvent)是BSP下的代码转换过来的。
- 这里有
- KEYBD_IST keybdIst;
- keybdIst.hevInterrupt = m_hevInterrupt;
- keybdIst.dwSysIntr_Keybd = dwSysIntr_Keybd;
- keybdIst.uiPddId = v_uiPddId;
- keybdIst.pfnGetKeybdEvent = KeybdPdd_GetEventEx2;
- keybdIst.pfnKeybdEvent = v_pfnKeybdEvent;
-
- KeybdIstLoop(&keybdIst);
- KeybdPdd_GetEventEx2是扫面键盘的函数,里面调用了7290驱动,我也纳闷啊,代码没有改,在4.2BSP行,在5.0就不行了。
- //主要的扫描码处理函数
- static UINT KeybdPdd_GetEventEx2(UINT uiPddId, UINT32 rguiScanCode[16], BOOL rgfKeyUp[16])
- {
- SETFNAME(_T("KeybdPdd_GetEventEx2"));
- UINT32 scInProgress = 0;
- static UINT32 scPrevious;
- BOOL fKeyUp;
- UINT8 ui8ScanCode=0;
- UINT cEvents = 0;
- // int i;
- unsigned char key[4];
- //DEBUGCHK(rguiScanCode != NULL);
- //DEBUGCHK(rgfKeyUp != NULL);
- //for(i=0;i<4;i++)
- // key[i] = 0;
- //getsFromKBCTL(&ui8ScanCode, 1);
- ZLG7290_GetKey(key);
-
- // RETAILMSG(1, (_T("zlg7290 get keys: %x %x %x %x \r\n"),key[0],key[1],key[2],key[3]));
- // OEMWriteDebugString((TEXT("zlg7290 get keys!!!!\r\n")));
-
- // RETAILMSG(1, (_T("v_pIICregs->rIICCON : %x\r\n"),v_pIICregs->rIICCON));
- // RETAILMSG(1, (_T("v_pIOPregs->rGPECON : %x\r\n"),v_pIOPregs->rGPECON));
- if(key[0]&0x01) //key down
- {
- fKeyUp = FALSE;
- // enable rising int trigger
- //v_pIOPregs->rEXTINT1 &= ~(0x7 << 12); // Clear EINT11
- //v_pIOPregs->rEXTINT1 |= (0x2 << 8); // fallig edge triggered for EINT11
- //v_pIOPregs->rEXTINT1 |= (0x6 << 12); // both edge
- //v_pIOPregs->rEXTINT1 |= (0x1 << 14); // enable rising int trigger
- }
- else//key up
- {
- fKeyUp = TRUE;
- // enable falling int trigger
- //v_pIOPregs->rEXTINT1 &= ~(0x7 << 12); // Low level triggered
- //v_pIOPregs->rEXTINT1 |= (0x2 << 8); // fallig edge triggered for EINT11
- //v_pIOPregs->rEXTINT1 |= (0x6 << 12); // both edge
- //v_pIOPregs->rEXTINT1 |= (0x1 << 13); // enable falling int trigger
- }
- /* if( (key[3] & 0x01) == 0)//F1
- {
- ui8ScanCode = 0x01;
- }
- else if( (key[3] & 0x02) == 0)//F2
- {
- ui8ScanCode = 0x02;
- }
- else if( (key[3] & 0x04) == 0)//F3
- {
- ui8ScanCode = 0x03;
- }
- else if( (key[3] & 0x08) == 0)//F4
- {
- ui8ScanCode = 0x04;
- }
- else */
- if(key[1] != 0x0)//other KEYS
- {
- ui8ScanCode = key[1];
- }
- else
- {
- ui8ScanCode = 0;
- }
- //sent bl key press event to backlight driver
- /*if(ui8ScanCode == 19) //bl key scancode = 19
- {
- //only get key down
- if(fKeyUp == FALSE)
- SetEvent(evtBLKeyPress);
- return cEvents;
- }*/ //wsf 20080924
- //v_pIOPregs->rGPFCON |= 0x01;//GPF0 OUTPUT
- // if (fKeyUp==FALSE)
- // v_pIOPregs->rGPFDAT &= ~(1 << 1); /* LED 0 On */
- // else
- // v_pIOPregs->rGPFDAT |= (1 << 1); /* LED 0 Off */
-
- // DEBUGMSG(ZONE_SCANCODES,
- // (_T("%s: scan code 0x%08x, code in progress 0x%08x, previous 0x%08x\r\n"),
- // pszFname, ui8ScanCode, scInProgress, scPrevious));
- scInProgress = ui8ScanCode;
- //按键有效,而且键值相同,auto-repeat
- //if ( (scInProgress == scPrevious) && (fKeyUp == FALSE) )
- //{
- // mdd handles auto-repeat so ignore auto-repeats from keybd
- //}
- //else
- //{
- // Not a repeated key. This is the real thing.
- scPrevious = scInProgress;
-
- rguiScanCode[cEvents] = scInProgress;
- rgfKeyUp[cEvents] = fKeyUp;
- ++cEvents;
- //}
- //send a user input event to backlight driver!
- SetEvent(evtUserInput);
- return cEvents;
- }
复制代码 |
|