我正在使用ZEDBoard开发CORTEX-A9 FreeRTOS端口 . 我想采取PS-GPIO中断 . 但我在这里面临以下问题......

  • 当发生中断时,GPIO处理程序调用两次......

  • 当我在上升沿或下降沿设置中断时,GPIO状态寄存器上的相应位不是......

这是GPIO配置的代码..

void fpga_gpio_fabric_interrupt_init() 
{
XScuGic_Config *pxGICConfig;
BaseType_t xStatus;

pxGICConfig = XScuGic_LookupConfig( XPAR_SCUGIC_SINGLE_DEVICE_ID );
configASSERT( pxGICConfig );
configASSERT( pxGICConfig->CpuBaseAddress == ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ) );
configASSERT( pxGICConfig->DistBaseAddress == configINTERRUPT_CONTROLLER_BASE_ADDRESS );
xStatus = XScuGic_CfgInitialize( &xInterruptController, pxGICConfig, pxGICConfig->CpuBaseAddress );
configASSERT( xStatus == XST_SUCCESS );
( void ) xStatus;

XGpioPs_Config *pxConfigPtr;
BaseType_t xStatus1;
pxConfigPtr = XGpioPs_LookupConfig(XPAR_XGPIOPS_0_DEVICE_ID);
xStatus1 = XGpioPs_CfgInitialize(&xGpio, pxConfigPtr,pxConfigPtr->BaseAddr);
configASSERT( xStatus1 == XST_SUCCESS );
( void ) xStatus1;

XGpioPs_SetDirectionPin(&xGpio, ZYNQ_GPIO_INTERRUPT_PIN, 0);

XScuGic_Connect(&xInterruptController, GPIO_INTERRUPT_ID,
(Xil_ExceptionHandler)XGpioPs_IntrHandler,
&xGpio);     

XGpioPs_SetIntrTypePin(&xGpio, ZYNQ_GPIO_INTERRUPT_PIN, XGPIOPS_IRQ_TYPE_LEVEL_LOW);

XGpioPs_SetCallbackHandler(&xGpio, (void *)&xGpio, (void *)GPIOIntrHandler);
xil_printf("Declaration Function is called \r\n");
XGpioPs_IntrEnablePin(&xGpio, ZYNQ_GPIO_INTERRUPT_PIN);
XScuGic_Enable(&xInterruptController, GPIO_INTERRUPT_ID);
}

void GPIOIntrHandler(void *CallBackRef)
{

   xil_printf("Interrupt has been occurred \r\n");  
   XGpioPs *Gpioint = (XGpioPs *)CallBackRef;
   XGpioPs_IntrClearPin(Gpioint, ZYNQ_GPIO_INTERRUPT_PIN);

}