Ok, now I assume i get the correct sysint value.
My question now is the following.
Is the wince 6.0 bianry bsp is configure to handle PIO interrupts ?
I set up the PIOC like this.
Code:
PHYSICAL_ADDRESS PhysAddr = {0};
AT91PS_PIO g_pPIO = NULL;
AT91PS_PMC pPmc = NULL;
AT91PS_AIC pAic = NULL;
// Get the virtual address of the PMC
PhysAddr.LowPart = (DWORD) AT91C_BASE_PMC;
PhysAddr.HighPart = 0;
pPmc = (AT91PS_PMC) MmMapIoSpace(PhysAddr,sizeof(AT91PS_PMC),FALSE);
// Get the virtual address of the PIOC
PhysAddr.LowPart = (DWORD) AT91C_BASE_PIOC;
PhysAddr.HighPart = 0;
g_pPIO = (AT91PS_PIO) MmMapIoSpace(PhysAddr,sizeof(AT91PS_PIO),FALSE);
// Get the virtual address of the AIC
PhysAddr.LowPart = (DWORD) AT91C_BASE_AIC;
PhysAddr.HighPart = 0;
pAic = (AT91PS_AIC) MmMapIoSpace(PhysAddr,sizeof(AT91PS_AIC),FALSE);
/* Enable the periph clock for the PIO controller */
/* This is mandatory when PIO are configured as input */
pPmc->PMC_PCER = (1 << AT91C_ID_PIOCDE);
/* Set the PIO line in input */
g_pPIO->PIO_ODR = AT91C_PIO_PC5;
/* Set the PIO controller in PIO mode instead of peripheral mode */
g_pPIO->PIO_PER = AT91C_PIO_PC5;
/* Disable the interrupt on the interrupt controller */
pAic->AIC_IDCR = (1 << AT91C_ID_PIOCDE);
/* Store the Source Mode Register */
pAic->AIC_SMR[AT91C_ID_PIOCDE] = AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | AT91C_AIC_PRIOR_LOWEST;
/* Clear the interrupt on the interrupt controller */
pAic->AIC_ICCR = (1 << AT91C_ID_PIOCDE);
/* Enable button interrupts generation through the PIO controller */
g_pPIO->PIO_IER = AT91C_ID_PIOCDE;
/* Enable PIO interrupt in the interrupt controller */
pAic->AIC_IECR = (1 << AT91C_ID_PIOCDE);
MmUnmapIoSpace(pPmc,sizeof(AT91PS_PMC));
MmUnmapIoSpace(g_pPIO,sizeof(AT91S_PIO));
MmUnmapIoSpace(pAic,sizeof(AT91PS_AIC));
Assuming that the sysint is the the good one (it's set as 128+5), I should handle some interupts in my IST when the buton is pressed. But nothing happens. Dis I miss somethnig in my PIO configuration ?