问题描述
我正在尝试将GPIO中断添加到Xilinx的lwIP示例中。以下是无法启用我的中断的中断设置:
void platform_setup_interrupts(void)
{
Xil_ExceptionInit();
XScuGic_DeviceInitialize(INTC_DEVICE_ID);
/*
* Connect the interrupt controller interrupt handler to the hardware
* interrupt handling logic in the processor.
*/
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT,(Xil_ExceptionHandler)XScuGic_DeviceInterruptHandler,(void *)INTC_DEVICE_ID);
/*
* Connect the device driver handler that will be called when an
* interrupt for the device occurs,the handler defined above performs
* the specific interrupt processing for the device.
*/
XScuGic_RegisterHandler(INTC_BASE_ADDR,TIMER_IRPT_INTR,(Xil_ExceptionHandler)timer_callback,(void *)&TimerInstance);
//My GPIO_INT setup
XScuGic_RegisterHandler(INTC_BASE_ADDR,INTC_GPIO_INTERRUPT_ID,(Xil_ExceptionHandler)SWC_Intr_Handler,(void *)&SWCInst);
/*
* Enable the interrupt for scu timer.
*/
XScuGic_EnableIntr(INTC_DIST_BASE_ADDR,TIMER_IRPT_INTR);
//My gpio_int enabler
XScuGic_EnableIntr(INTC_DIST_BASE_ADDR,INTC_GPIO_INTERRUPT_ID);
return;
}
以下内容也包括在内,但主要是变量声明和支持代码:
#include "xscugic.h"
#include "xgpio.h"
#include "echo.h"
#define INTC_GPIO_INTERRUPT_ID XPAR_FABRIC_AXI_GPIO_0_IP2INTC_IRPT_INTR // port for switch interrupts
#define SWC_INT XGPIO_IR_CH1_MASK /* Interrupt mask */
int swc_value;
XGpio LEDInst,SWCInst;
XScuGic INTCInst;
static void Print_Code(); //Nolan code prototype
static void SWC_Intr_Handler(void *InstancePtr)
{
// Disable GPIO interrupts
XGpio_InterruptDisable(&SWCInst,1);
//My function to be run
Print_Code();
//clear interrupts
(void)XGpio_InterruptClear(&SWCInst,SWC_INT);
// Enable GPIO interrupts
XGpio_InterruptEnable(&SWCInst,SWC_INT);
}
当我尝试不添加中断时,它运行正常。 (当客户端按下某个键时,会通过以太网吐出交换机的值。但是我希望当交换机被翻转时,该值会被吐出来。为此,必须启用来自交换机的中断。
任何指导将不胜感激。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)