#ifndef SYS_INTR_H_
#define SYS_INTR_H_
#include "xparameters.h"
#include "xil_exception.h"
#include "xdebug.h"
#include "xscugic.h"
#define INTC_DEVICE_ID XPAR_SCUGIC_SINGLE_DEVICE_ID
#define DMA_IRQ_ID 61U
int Init_Intr_System(XScuGic * IntcInstancePtr);
void Setup_Intr_Exception(XScuGic * IntcInstancePtr);
void DMAirqHandler(void *CallbackRef);
#endif
#include "sys_intr.h"
#include "user_udp.h"
volatile unsigned dma_ddr_addr_flag = 0;
void Setup_Intr_Exception(XScuGic * IntcInstancePtr)
{
Xil_ExceptionInit();
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
(Xil_ExceptionHandler)XScuGic_InterruptHandler,
(void *)IntcInstancePtr);
Xil_ExceptionEnable();
}
int Init_Intr_System(XScuGic * IntcInstancePtr)
{
int Status;
XScuGic_Config * GIC_ConfigPtr ;
GIC_ConfigPtr = XScuGic_LookupConfig(INTC_DEVICE_ID);
if (NULL == GIC_ConfigPtr) {
print("XScuGic_LookupConfig fail\n");
return XST_FAILURE;
}
Status = XScuGic_CfgInitialize(IntcInstancePtr, GIC_ConfigPtr,
GIC_ConfigPtr->CpuBaseAddress);
if (Status != XST_SUCCESS) {
print("XScuGic_CfgInitialize fail\n");
return XST_FAILURE;
}
Status = XScuGic_Connect(IntcInstancePtr, DMA_IRQ_ID,
(Xil_ExceptionHandler)DMAirqHandler,
(void *)IntcInstancePtr);
if(Status != XST_SUCCESS){
print("XScuGic_Connect fail\n");
return Status;
}
Setup_Intr_Exception(IntcInstancePtr);
XScuGic_SetPriorityTrigger