这个还真没有试!因为bsp触摸有问题的缘故。也说不清楚,贴下我的按键驱动吧!这个中断号是动态绑定的,我改过它用 静态绑定的 是可以的 ,应该没问题,你可以对照下!!!
#include
//#include
#include
//#include
#include
#include "pmplatform.h"
#include "Pkfuncs.h"
#include "s2440.h"
volatile IOPreg *s2440IOP = (IOPreg *)IOP_BASE;
volatile INTreg *s2440INT = (INTreg *)INT_BASE;
UINT32 g_KeySysIntr[6];
HANDLE KeyThread;
HANDLE KeyEvent;
void Virtual_Alloc(); // Virtual allocation
DWORD UserKeyProcessThread(void);
DWORD UserKeyProcessThread(void)
{
UINT32 IRQ;
KeyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!KeyEvent) {
RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to create event.\r\n")));
return FALSE;
}
IRQ = 36; //IRQ_EINT8;
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(UINT32), &g_KeySysIntr[0], sizeof(UINT32), NULL)) {
RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to request sysintr value.\r\n")));
return FALSE;
}
IRQ = 39; //IRQ_EINT11;
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(UINT32), &g_KeySysIntr[1], sizeof(UINT32), NULL)) {
RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to request sysintr value.\r\n")));
return FALSE;
}
IRQ = 41; //IRQ_EINT13;
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(UINT32), &g_KeySysIntr[2], sizeof(UINT32), NULL)) {
RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to request sysintr value.\r\n")));
return FALSE;
}
IRQ = 42; //IRQ_EINT14;
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(UINT32), &g_KeySysIntr[3], sizeof(UINT32), NULL)) {
RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to request sysintr value.\r\n")));
return FALSE;
}
IRQ = 43; //IRQ_EINT15;
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(UINT32), &g_KeySysIntr[4], sizeof(UINT32), NULL)) {
RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to request sysintr value.\r\n")));
return FALSE;
}
IRQ = 47; //IRQ_EINT19;
if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(UINT32), &g_KeySysIntr[5], sizeof(UINT32), NULL)) {
RETAILMSG(1, (TEXT("ERROR: kEYBD: Failed to request sysintr value.\r\n")));
return FALSE;
}
if (!InterruptInitialize(g_KeySysIntr[0], KeyEvent, NULL, 0)) {
RETAILMSG(1,(TEXT("Fail to initialize userkey interrupt event\r\n")));
return FALSE;
}
if (!InterruptInitialize(g_KeySysIntr[1], KeyEvent, NULL, 0)) {
RETAILMSG(1,(TEXT("Fail to initialize userkey interrupt event\r\n")));
return FALSE;
}
if (!InterruptInitialize(g_KeySysIntr[2], KeyEvent, NULL, 0)) {
RETAILMSG(1,(TEXT("Fail to initialize userkey interrupt event\r\n")));
return FALSE;
}
if (!InterruptInitialize(g_KeySysIntr[3], KeyEvent, NULL, 0)) {
RETAILMSG(1,(TEXT("Fail to initialize userkey interrupt event\r\n")));
return FALSE;
}
if (!InterruptInitialize(g_KeySysIntr[4], KeyEvent, NULL, 0)) {
RETAILMSG(1,(TEXT("Fail to initialize userkey interrupt event\r\n")));
return FALSE;
}
if (!InterruptInitialize(g_KeySysIntr[5], KeyEvent, NULL, 0)) {
RETAILMSG(1,(TEXT("Fail to initialize userkey interrupt event\r\n")));
return FALSE;
}
while(1)
{
WaitForSingleObject(KeyEvent, INFINITE);
RETAILMSG(0,(L"EINTMASK=%X, rGPGCON=%X\r\n", s2440IOP->rEINTMASK, s2440IOP->rGPGCON));
//EINT8 - K1 - VK_TAB - 0x09
if(s2440IOP->rEINTMASK & (DWORD)(0x1