您好,我在测试DM6446,ARM端的(引脚)外部中断(官网下载的例子程序,路径:davincievm\csl\arm\example\intc)时不能进入中断。所以函数都能正确执行,但是就是无法进入中断,我也尝试过其他的例子程序,都不能进入中断,这是怎么回事,请指点一二,万分感激!!!
SWI_sysMode();
/* Initialize INTC */
CSL_intcInit();
/* Initialize INTC Dispatcher */
CSL_intcDispatcherInit();
/* Enable all interrupts */
CSL_intcGlobalEnable(&eventStat);
/* Open INTC */
gpioIntcHwSetup.priority = CSL_INTC_PRIORITY_2;
gpioIntcHandle = CSL_intcOpen(&gpioIntcObj, CSL_INTC_EVENTID_GPIO0,
CSL_INTC_VECTID_DEFAULT, &gpioIntcHwSetup, &status);
/* HwSetup INTC */
CSL_intcHwSetup(gpioIntcHandle, &gpioIntcHwSetup);
/* Bind ISR HandleGPIO_INT to Interrupt Controller */
isr_gpio.handler = HandleGPIO_INT;
isr_gpio.arg = NULL;
CSL_intcPlugEventHandler(gpioIntcHandle, &isr_gpio);
/* Event Enable */
CSL_intcEventEnable(CSL_INTC_EVENTID_GPIO0, &eventStat);
printf ("\nINTC: Interrupt Controller Setup… Passed.\n");
status = CSL_SOK;
/* Initialize the GPIO CSL module */
status = CSL_gpioInit(&pContext);
status = CSL_SOK;
if (status != CSL_SOK) {
printf ("GPIO: Initialization… Failed.\n");
return;
}
else {
printf ("GPIO: Module Initialization… Passed.\n");
}
/* Open the CSL module */
hGpio = CSL_gpioOpen(&gpioObj, CSL_GPIO, NULL, &status);
if ((hGpio == NULL) || (status != CSL_SOK)) {
printf ("GPIO: Module Open… Failed.\n");
return;
}
else {
hGpio->numBanks = CSL_GPIO_NUM_BANKS;
hGpio->numPins = CSL_GPIO_NUM_PINS;
printf ("GPIO: Module open… Passed.\n");
}
/* Setup hardware parameters */
hwSetup.extendSetup = NULL;
/* Setup the General Purpose IO */
status = CSL_gpioHwSetup(hGpio, &hwSetup);
printf ("GPIO: Module Setup… Passed.\n");
/* Interrupt Generation indicator flag is reset */
IntGenFlag = 0;
/* Configure pins 0 & 8 to generate an interrupt on Rising Edge, and
* configure it as an output, then set the data High (Low->High).
* Set Trigger
*/
// status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_BANK_INT_ENABLE, &banknumber);
hGpio->regs->BINTEN = 1;
config.pinNum = CSL_GPIO_PIN0;
config.trigger = CSL_GPIO_TRIG_RISING_EDGE;
config.direction = CSL_GPIO_DIR_OUTPUT;
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CONFIG_BIT, &config);
if (status != CSL_SOK) {
printf ("GPIO: Command to GPIO configuration… Failed.\n");
errorExit();
}
config.pinNum = CSL_GPIO_PIN8;
config.trigger = CSL_GPIO_TRIG_RISING_EDGE;
config.direction = CSL_GPIO_DIR_OUTPUT;
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CONFIG_BIT, &config);
if (status != CSL_SOK) {
printf ("GPIO: Command to GPIO configuration… Failed.\n");
errorExit();
}
/* Set Data High: */
pinNum = CSL_GPIO_PIN0;
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CLEAR_BIT, &pinNum);
if (status != CSL_SOK) {
printf ("GPIO: Command to set bit… Failed.\n");
errorExit();
}
/* pinNum = CSL_GPIO_PIN0;
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_SET_BIT, &pinNum);
if (status != CSL_SOK) {
printf ("GPIO: Command to set bit… Failed.\n");
errorExit();
}
*/
pinNum = CSL_GPIO_PIN8;
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CLEAR_BIT, &pinNum);
if (status != CSL_SOK) {
printf ("GPIO: Command to set bit… Failed.\n");
errorExit();
}
printf ("GPIO: Condition for interrupt generation… Done.\n");
/* Wait for interrupt to be generated.
* On receiving the interrupt, the CPU control goes to the ISR
* In the ISR, the variable IntGenFlag becomes 1
*/
pinNum = CSL_GPIO_PIN0;
while (IntGenFlag == 0)
{
DAVINCIEVM_wait(10000); status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_SET_BIT, &pinNum);
DAVINCIEVM_wait(10000);
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CLEAR_BIT, &pinNum);
}
printf ("\nGPIO: Interrupt Occurred.\n");
/* Check Interrupt Status: */
bankData.data = 0;
bankData.index = 0;
status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_GET_INTSTATUS, &bankData);
if (status != CSL_SOK) {
printf ("GPIO: Command to GPIO configuration… Failed.\n");
errorExit();
}
if (bankData.data != 0x00000101){
printf ("\nError in Interrupt Loopback Path\n");
}
/* Close the opened instances of GPIO and INTC */
CSL_gpioClose (hGpio);
CSL_intcClose (gpioIntcHandle);
Ternence_Hsu:
你好;
你这个是用什么版本的sdk 开发的?