Hello, my question is about csl example with gpio interrupt.
void main (
void
)
{
Next 3 operations are not completed successfully in debugger , because operation is in endless loop with gpioEn != TRUE
Bool gpioEn;
/* Unlock the control register */
CSL_FINST(((CSL_DevRegs*)CSL_DEV_REGS)->PERLOCK, DEV_PERLOCK_LOCKVAL, UNLOCK);
/* Enable the GPIO */
CSL_FINST(((CSL_DevRegs*)CSL_DEV_REGS)->PERCFG0, DEV_PERCFG0_GPIOCTL, ENABLE);
do {
gpioEn = (Bool) CSL_FEXT(((CSL_DevRegs*)CSL_DEV_REGS)->PERSTAT0, DEV_PERSTAT0_GPIOSTAT);
} while (gpioEn != TRUE);
/* Invoking example script */
gpioInternalLoopbackDemo();
return;
}
if I will comment thus 3 operations, program will be in other endless loop, tells that interrupt was not generated
void gpioInternalLoopbackDemo (
void
)
{
CSL_Status intStat;
CSL_GpioPinConfig config;
CSL_GpioPinNum pinNum;
CSL_Status status;
CSL_GpioContext pContext;
CSL_GpioObj gpioObj;
CSL_GpioHwSetup hwSetup;
CSL_IntcGlobalEnableState state;
CSL_IntcParam vectId;
/* Initialize INTC */
context.numEvtEntries = 1;
context.eventhandlerRecord = record;
intStat = CSL_intcInit(&context);
/* Enable NMIs */
intStat = CSL_intcGlobalNmiEnable();
/* Enable all interrupts */
intStat = CSL_intcGlobalEnable(&state);
/* Open interrupt module */
vectId = CSL_INTC_VECTID_12;
gpioIntcHandle = CSL_intcOpen(&gpioIntcObj, CSL_INTC_EVENTID_GPINT5,&vectId, &intStat);
/* Bind ISR to Interrupt */
isr_gpio.handler = (CSL_IntcEventHandler)&HandleGPIO_INT;
isr_gpio.arg = gpioIntcHandle;
CSL_intcPlugEventHandler(gpioIntcHandle, &isr_gpio);
/* Event Enable */
CSL_intcHwControl(gpioIntcHandle, CSL_INTC_CMD_EVTENABLE, NULL);
/* Initialize the GPIO CSL module */
status = CSL_gpioInit(&pContext);
/* Open the CSL module */
hGpio = CSL_gpioOpen(&gpioObj, CSL_GPIO, NULL, &status);
intrCnt = 0;
/* Setup hardware parameters */
hwSetup.extendSetup = NULL;
/* Setup the General Purpose IO */
status = CSL_gpioHwSetup(hGpio, &hwSetup);
/* Configure pin 5 to generate an interrupt on Rising Edge, and
* configure it as an output, then set the data High (Low->High).
* Set Trigger:
*/
config.pinNum = CSL_GPIO_PIN5;
config.trigger = CSL_GPIO_TRIG_RISING_EDGE;
config.direction = CSL_GPIO_DIR_OUTPUT;
/* Enable the bank interrupt */
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_BANK_INT_ENABLE, NULL);
/* configure the gpio pin 5 */
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CONFIG_BIT, &config);
/* Set Data High: */
pinNum = CSL_GPIO_PIN5;
status = CSL_gpioHwControl (hGpio, CSL_GPIO_CMD_SET_BIT, &pinNum);
/* Wait for interrupt to be generated. */
while (1) {
if (intrCnt == 1)
break;
}
/* Set Data Low again: */
pinNum = CSL_GPIO_PIN5;
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CLEAR_BIT, &pinNum);
status = CSL_gpioClose(hGpio);
return;
}