To clarify...
seenu461 wrote:
And regarding the issue
at91SysCtrlr->AIC_SVR[0x1A]=(unsigned int)&ext_IRQ0_handler;
I believe IRQ0 handler is user defined...i even changed that to IRQ2...it not working....
It doesn't matter what you call your handler function it could be myisr_button_handler(). But you need to setup the correct SMR (
AIC_SMR[0x1B]) and load your handler address into the SVR for the IRQ you want to service. AIC_SVR[0x1A] is for IRQ1 this needs to be
AIC_SVR[0x1B] because PIO_PA25 uses IRQ2 not IRQ1.
see your definition.
Code:
#define GPIO_PUSH_BUTTON_MASK (AT91C_PIO_PA25)
seenu461 wrote:
while(!(at91SysCtrlr->PIOA_PSR)) // PSR shdnt be 1;
{
printf("PIO Status is IRQ enabled\n");
break;
}
You are
incorrectly checking the entire register.
To check a single bit perform a bitwise AND with the bit(s) you are interested in.
For example:
Code:
// See if the Push Button is set up to use a peripherial
// by testing the bit associated with the Push Button
// 0 = peripheral selected, otherwise = I/O selected.
if( !(at91SysCtrlr->PIOA_PSR & GPIO_PUSH_BUTTON_MASK) )
{
printf( "Push Button is IRQ enabled\n" );
}
EDIT (fyi): You might also have to update the other AIC registers to properly handle IRQ2, I didn't look these up but I suspect these are setup for IRQ0. Review the data sheet for these registers.
seenu461 wrote:
Code:
at91SysCtrlr->AIC_IMR=0x02000000;
at91SysCtrlr->AIC_IECR=0x02000000;
--- snip ---
void ext_IRQ0_handler(void)
{
at91SysCtrlr->AIC_IDCR=0xFFFFFFFF;
at91SysCtrlr->AIC_ICCR=0x02000000;
--- snip---