|
I am trying the PIO Interrupt on AT91RM9200DK in WinCE.
I have connected a switch between PIN 17 (input with pullup) and PIN 11 (output)
Once i press the switch i get the following output:
+pioGetLogintr() = 103 (!=3) +SOCDisablePioIrq(103) bank 1 pin 7 +SOCEnablePioIrq(103) bank 1 pin 7 +pioGetLogintr() = 107 (!=3) +SOCDisablePioIrq(107) bank 1 pin 11 +SOCEnablePioIrq(107) bank 1 pin 11 +pioGetLogintr() = 113 (!=3) +SOCDisablePioIrq(113) bank 1 pin 17 +SOCEnablePioIrq(113) bank 1 pin 17
Why i get 3 Interrupts ??? The next press doesnt generate an output anymore...
Thats the thread for interrupt handling:
T_PIO_DESC PIO_DETECT = { AT91C_VA_BASE_PIOB, 17 }; void DSInterruptThread(void) { DWORD RetVal = 0; HANDLE hEvent; DWORD SysintrValue; DWORD IRQ = GetPIOLogintr(&PIO_DETECT);
AT91PS_PIO pPio = (AT91PS_PIO)VirtualAllocCopy(sizeof(AT91S_PIO), TEXT("GPIO AllocateVirtual : pPio failed"), (PVOID) AT91C_VA_BASE_PIOB); AT91F_PIO_CfgOutput(pPio, 1 << 11); AT91F_PIO_ClearOutput(pPio, 1 << 11);
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &IRQ, sizeof(DWORD), &SysintrValue, sizeof(DWORD), NULL) ; RetVal = InterruptInitialize( SysintrValue, hEvent, NULL, 0 );
CeSetThreadPriority(GetCurrentThread(), 150);
while (1) { RetVal = WaitForSingleObject(hEvent, 2000 );
if( RetVal == WAIT_OBJECT_0 ) { //todo InterruptDone( SysintrValue ); } else if( RetVal == WAIT_TIMEOUT ) { } }
InterruptDisable( SysintrValue ); CloseHandle( hEvent ); KernelIoControl(IOCTL_HAL_RELEASE_SYSINTR, &SysintrValue, sizeof(DWORD), NULL, 0, NULL); }
|