Hello,
I am using C6748 LCDK.
I want to use pin GP5[0] as a interrupt on falling edge for that I write code
userswitch3();
CONFIG_enable_user_switch3_interrupt();
void userswitch3(void)
{
GPIODirModeSet(SOC_GPIO_0_REGS, 81, GPIO_DIR_INPUT);
}
void CONFIG_enable_user_switch3_interrupt(void)
{
/*
** Configure rising edge and falling edge triggers on pin 81 to generate
** an interrupt
*/
GPIOIntTypeSet(SOC_GPIO_0_REGS, 81, GPIO_INT_TYPE_FALLEDGE);
/* Enable interrupts for Bank 5.*/
GPIOBankIntEnable(SOC_GPIO_0_REGS, 5);
/* Configuring the AINTC to handle interrupts.*/
SetupInt();
/* Configure GPIO interrupts */
CONFIG_IntGPIO_user_switch3();
}
/*
** \brief This function configures the AINTC to receive the GPIO interrupt.
*/
static void CONFIG_IntGPIO_user_switch3(void)
{
// Configure GPIO interrupts for ARM or DSP
#ifdef _TMS320C6X
// Register the ISR in the Interrupt Vector Table
IntRegister(C674X_MASK_INT5, GPIO_user_switch3_Isr);
// Map the system interrupt to the DSP maskable interrupt
IntEventMap(C674X_MASK_INT5, SYS_INT_GPIO_B5INT);
// Enable DSP maskable interrupt
IntEnable(C674X_MASK_INT5);
#else
// Register the ISR in the Interrupt Vector Table.
IntRegister(SYS_INT_GPIOB5, GPIO_user_switch3_Isr);
// Map the channnel number 2 of AINTC to GPIO BANK 5 system interrupt.
IntChannelSet(SYS_INT_GPIOB5, 2);
// Enable the System Interrupts for AINTC.
IntSystemEnable(SYS_INT_GPIOB5);
#endif
}
void GPIO_user_switch3_Isr(void)
{
/* Disable the interrupts for pins of bank 5 in GPIO.*/
GPIOBankIntDisable(SOC_GPIO_0_REGS, 5);
#ifdef _TMS320C6X
// Clear the system interrupt status in the DSPINTC
IntEventClear(SYS_INT_GPIO_B5INT);
#else
/* Clears the system interrupt status of GPIO in AINTC.*/
IntSystemStatusClear(SYS_INT_GPIOB5);
#endif
/* Clears the Interrupt Status of GP5[0] in GPIO.*/
GPIOPinIntClear(SOC_GPIO_0_REGS, 81);
//flag = 1;
/* Enable interrupts for pins of bank 5.*/
//GPIOBankIntEnable(SOC_GPIO_0_REGS, 5);
}
static void SetupInt(void)
{
// Setup ARM or DSP interrupt controller
#ifdef _TMS320C6X
// Initialize the DSP Interrupt Controller
IntDSPINTCInit();
// Enable DSP Interrupts Globally
IntGlobalEnable();
#else
/* Initialize the ARM Interrupt Controller.*/
IntAINTCInit();
/* Enable IRQ in CPSR.*/
IntMasterIRQEnable();
/* Enable the interrupts in GER of AINTC.*/
IntGlobalEnable();
/* Enable the interrupts in HIER of AINTC.*/
IntIRQEnable();
#endif
}
But problem is that interrupt comes two times instead of one . Even after the execution of isr, no interrupt pending in INSTAT45 register and interrupt disable in BINTEN register.
Please give the some solution of that problem.
regards
Sachin Arora