阅读:1847回复:0
AU1200 中断
HANDLE g_hEvent=NULL;
HANDLE g_hThread=NULL; DWORD g_dwThreadID=0; DWORD g_dwIRNO=0; DWORD TestGPIOThreadProc(PVOID pParam) { DWORD dwStatus=WAIT_TIMEOUT; HANDLE hGPIO=GPIO_Init(); g_dwThreadID=0; while (1){ RETAILMSG(1,(TEXT("\n*****Enter TestGPIOThreadProc\n"))); dwStatus=WaitForSingleObject(g_hEvent,10000); if (dwStatus==WAIT_OBJECT_0){ RETAILMSG(1,(TEXT("dwStatus==WAIT_OBJECT_0\n"))); }else{ RETAILMSG(1,(TEXT("dwStatus==WAIT_TIMEOUT\n"))); } InterruptDone(g_dwIRNO); } GPIO_Close(hGPIO); } VOID KCTestGPIOIR() { HANDLE hGPIO=GPIO_Init(); if (hGPIO==NULL){ RETAILMSG(1,(TEXT("GPIO_Init() Failed\n"))); return; } //if(!GPIO_SetAsOutput(hGPIO,GPIO_5)){ // To Test Output for GPIO_5 if(!GPIO_SetAsInput(hGPIO,GPIO_5)){ RETAILMSG(1,(TEXT("SMBUS: GPIO_SetAsInput Failed\n"))); return; } GPIO_Close(hGPIO); RETAILMSG(1,(TEXT("Start InterruptConnect HWINTR_GPIO5=0x%x\n"),HWINTR_GPIO5)); g_dwIRNO=InterruptConnect(Internal, 0, HWINTR_GPIO5, 3); if (g_dwIRNO==SYSINTR_NOP){ RETAILMSG(1,(TEXT("dwIRNO==SYSINTR_NOP\n"))); return; } g_hEvent=CreateEvent(NULL, FALSE, FALSE, NULL); if (g_hEvent==NULL){ RETAILMSG(1,(TEXT("g_hEvent==NULL\n"))); return; } if (!InterruptInitialize (g_dwIRNO, g_hEvent, NULL, 0)){ RETAILMSG(1,(TEXT("InterruptInitialize==FALSE\n"))); return; } //InterruptDone(g_dwIRNO); g_hThread = CreateThread(NULL, 0, /*(LPTHREAD_START_ROUTINE)*/TestGPIOThreadProc, NULL, 0, &g_dwThreadID); if (g_hThread==NULL){ RETAILMSG(1,(TEXT("g_hThread==NULL\n"))); return; } RETAILMSG(1,(TEXT("-----End KCTestGPIOIR(),ThreadID=0x%d\n"),g_dwThreadID)); } 就是响应不到中断,求高手赐教啊!! |
|