使用FreeRTOS的PS-PL GPIO中断

时间:2017-07-21 05:29:54

标签: interrupt xilinx gpio freertos zynq

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

  1. 当发生中断时,GPIO处理程序会调用两次......
  2. 当我在上升沿或下降沿设置中断时,GPIO状态寄存器上的相应位不是......
  3. 以下是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);
    
    }
    

0 个答案:

没有答案