int GIC_Init(XUartPs *UartInstancePtr, XScuGic *IntcInstancePtr)
{
int Status;
XScuGic_Config *IntcConfig;
IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
if (NULL == IntcConfig) {
return XST_FAILURE;
}
Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
IntcConfig->CpuBaseAddress);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
(Xil_ExceptionHandler) XScuGic_InterruptHandler,
IntcInstancePtr);
Status = XScuGic_Connect(IntcInstancePtr, UART_INT_IRQ_ID,
(Xil_ExceptionHandler) UART_Handler,
(void *) UartInstancePtr);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
XScuGic_Enable(IntcInstancePtr, UART_INT_IRQ_ID);
Xil_ExceptionEnable();
return XST_SUCCESS;