59 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (c) 2014, Mentor Graphics Corporation
 | 
						|
 * All rights reserved.
 | 
						|
 *
 | 
						|
 * Copyright (c) 2016 Xilinx, Inc. All rights reserved.
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier: BSD-3-Clause
 | 
						|
 */
 | 
						|
#include "xscugic.h"
 | 
						|
 | 
						|
#define INTC_DEVICE_ID		XPAR_SCUGIC_0_DEVICE_ID
 | 
						|
 | 
						|
static XScuGic xInterruptController;
 | 
						|
 | 
						|
/* Interrupt Controller setup */
 | 
						|
static int app_gic_initialize(void)
 | 
						|
{
 | 
						|
	u32 Status;
 | 
						|
	XScuGic_Config *IntcConfig;	/* The configuration parameters of the interrupt controller */
 | 
						|
 | 
						|
	Xil_ExceptionDisable();
 | 
						|
 | 
						|
	/*
 | 
						|
	 * Initialize the interrupt controller driver
 | 
						|
	 */
 | 
						|
	IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
 | 
						|
	if (NULL == IntcConfig) {
 | 
						|
		return XST_FAILURE;
 | 
						|
	}
 | 
						|
 | 
						|
	Status = XScuGic_CfgInitialize(&xInterruptController, IntcConfig,
 | 
						|
				       IntcConfig->CpuBaseAddress);
 | 
						|
	if (Status != XST_SUCCESS) {
 | 
						|
		return XST_FAILURE;
 | 
						|
	}
 | 
						|
 | 
						|
	/*
 | 
						|
	 * Register the interrupt handler to the hardware interrupt handling
 | 
						|
	 * logic in the ARM processor.
 | 
						|
	 */
 | 
						|
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT,
 | 
						|
			(Xil_ExceptionHandler)XScuGic_InterruptHandler,
 | 
						|
			&xInterruptController);
 | 
						|
 | 
						|
	Xil_ExceptionEnable();
 | 
						|
 | 
						|
	return 0;
 | 
						|
}
 | 
						|
 | 
						|
/* Main hw machinery initialization entry point, called from main()*/
 | 
						|
/* return 0 on success */
 | 
						|
int init_system(void)
 | 
						|
{
 | 
						|
	/* configure the global interrupt controller */
 | 
						|
	app_gic_initialize();
 | 
						|
 | 
						|
	return 0;
 | 
						|
}
 |