GPIOPS中断成功,问题仍旧存在 ZEDBOARD,ZYNQ-7000

原文地址:http://www.cnblogs.com/dragen/archive/2013/06/15/3138134.html

I just add a sentence: XGpioPs_IntrDisablePin(pGpioPs,50)and it works!

Now a screen shot for memory!

GPIOPS中断成功,问题仍旧存在 ZEDBOARD,ZYNQ-7000_第1张图片


 
   XGpioPs* pGpioPs=(XGpioPs*)CallBackRef;

    XGpioPs_IntrDisablePin(pGpioPs,50);

    xil_printf("Gpio Handler...\n");

    XGpioPs_IntrEnablePin(pGpioPs,50);


But I just commented the sentence and re-build the application, it runs either! I don't know why?

and i have noticed that although i just press BTN8 once ,but it prints "Gpio Handler..." 2 times!

The interrupt remains undetected if:

XScuGic_SetPriorityTriggerType(&ScuGic,52,0xFF,0x01);

 But it remains interrupt detected if:

1
XScuGic_SetPriorityTriggerType(&ScuGic,52,0xa0,0x03);

The total application is shown as follows:

static void GpioHandler(void*CallBackRef,intBank, u32 Status)
 
{
 
    xil_printf("Gpio Handler...\n");
 
}
 
int main()
 
{
 
    u32 data;
 
    XGpioPs Gpio;
 
    XGpioPs_Config *ConfigPtr;
 
    ConfigPtr = XGpioPs_LookupConfig(0);
 
    XGpioPs_CfgInitialize(&Gpio, ConfigPtr, ConfigPtr->BaseAddr);
 
  
 
    XGpioPs_SetDirectionPin(&Gpio,50,0x0);
 
    XGpioPs_SetOutputEnablePin(&Gpio,50,0x1);
 
  
 
    XGpioPs_SetIntrTypePin(&Gpio,50,XGPIOPS_IRQ_TYPE_EDGE_FALLING);
 
    XGpioPs_SetCallbackHandler(&Gpio, (void*)&Gpio, GpioHandler);
 
    XGpioPs_IntrEnablePin(&Gpio,50);
 
  
 
    XScuGic ScuGic;
 
    XScuGic_Config* pScuGicCfg;
 
    pScuGicCfg=XScuGic_LookupConfig(XPAR_SCUGIC_SINGLE_DEVICE_ID);
 
    XScuGic_CfgInitialize(&ScuGic,pScuGicCfg,pScuGicCfg->CpuBaseAddress);
 
    XScuGic_Connect(&ScuGic, 52,
 
                    (Xil_ExceptionHandler)XGpioPs_IntrHandler,
 
                    (void*)&Gpio);
 
    XScuGic_SetPriorityTriggerType(&ScuGic,52,0xA0,0x01);
 
    XScuGic_Enable(&ScuGic,52);
 
  
 
    Xil_ExceptionInit();
 
    Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,(Xil_ExceptionHandler)XScuGic_InterruptHandler,&ScuGic);
 
    Xil_ExceptionEnable();
 
  
 
    xil_printf("Intr test: \n");
 
  
 
    while(1)
    {
 
    }
 
  
 
}


  

I notify that the XGpioPs_GetPinNumber remains go wrong at the pin 50; it says pin 50 belongs to bank 0.

I don't know why?

你可能感兴趣的:(zynq,7000,SOC)