VDMA中断处理

来源:互联网 发布:ps淘宝美工 编辑:程序博客网 时间:2024/06/05 20:26

最近,调试VDMA中断,按照以前的方法感觉不灵了,又重新复习了一遍,参考官网例程和接口说明,重新定义了一下VDMA中断配置流程:

1. 接口配置(参考上面博文)

2. 中断配置:

2.1 XScuGic_LookupConfig (Looks up the device configuration)

2.2 XScuGic_CfgInitialize(CfgInitialize a specific interrupt controller instance)

2.3 XScuGic_SetPriorityTriggerType(Sets the interrupt priority and trigger type)

2.4 XScuGic_Connect(Makes the connection between interrupt source and the handler)

2.5 XScuGic_Enable(Enables the interrupt source)

2.6 Xil_ExceptionRegisterHandler(Makes the connection exception source)

2.7 Xil_ExceptionEnable(Enable the IRQ exception)

2.8 XAxiVdma_SetCallBack(call back interrupt  function)

2.9 XAxiVdma_IntrEnable(Enable specific interrupts)


上述就是官网例程配置中断流程,也是一个学习过程。下面是实例的一部分:


IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
if (NULL == IntcConfig) return XST_FAILURE;


Status = XScuGic_CfgInitialize(&Intc, IntcConfig, IntcConfig->CpuBaseAddress);
if (Status != XST_SUCCESS) return XST_FAILURE;


XScuGic_SetPriorityTriggerType(&Intc, WRITE_INTR_ID0, 0xA0, 0x3);


Status = XScuGic_Connect(&Intc, WRITE_INTR_ID0,(Xil_InterruptHandler)XAxiVdma_WriteIntrHandler,&vdmaInst0);
if (Status != XST_SUCCESS) return XST_FAILURE;


XScuGic_Enable(&Intc, WRITE_INTR_ID0); /* enable the interrupt for the DMA device */


Xil_ExceptionInit();
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT,(Xil_ExceptionHandler)XScuGic_InterruptHandler,&Intc);
Xil_ExceptionEnable();  /* enable interrupt in the Processor */


/* Register callback functions
*/
XAxiVdma_SetCallBack(&vdmaInst0, XAXIVDMA_HANDLER_GENERAL, WriteCallBack, (void *)&vdmaInst0, XAXIVDMA_WRITE);
XAxiVdma_SetCallBack(&vdmaInst0, XAXIVDMA_HANDLER_ERROR, WriteErrorCallBack, (void *)&vdmaInst0, XAXIVDMA_WRITE);
XAxiVdma_IntrEnable(&vdmaInst0, XAXIVDMA_IXR_ALL_MASK, XAXIVDMA_WRITE);

总体来说,流程还是挺多的,如果没有官方例程恐怕真不好配。


原创粉丝点击