XilinxProcessorIPLib/drivers/wdttb/examples/xwdttb_gwdt_intr_example.c
static int GWdtSetupIntrSystem(XScuGic *IntcInstancePtr,
			       XWdtTb *GWdtInstancePtr,
			       u16 GWdtIntrId)
{
	int Status;
	XScuGic_Config *IntcConfig;
	u8 Priority, Trigger;

	Xil_ExceptionInit();

	/*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */
	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;
	}

	XScuGic_GetPriorityTriggerType(IntcInstancePtr, GWdtIntrId,
				       &Priority, &Trigger);
	Trigger = 3;
	XScuGic_SetPriorityTriggerType(IntcInstancePtr, GWdtIntrId,
				       Priority, Trigger);

	/*
	 * Connect the interrupt controller interrupt handler to the hardware
	 * interrupt handling logic in the processor.
	 */
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
			(Xil_ExceptionHandler)XScuGic_InterruptHandler,
			IntcInstancePtr);

	/*
	 * 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.
	 */
	Status = XScuGic_Connect(IntcInstancePtr, GWdtIntrId,
			(Xil_ExceptionHandler)GWdtIntrHandler,
			(void *)GWdtInstancePtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}

	/*
	 * Enable the interrupt for the device.
	 */
	XScuGic_Enable(IntcInstancePtr, GWdtIntrId);

	/*
	 * Enable interrupts in the Processor.
	 */
	Xil_ExceptionEnable();

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function setups the interrupt system such that WDT interrupt can occur
* for the WdtTb. This function is application specific since the actual
* system may or may not have an interrupt controller. The WdtTb device could be
* directly connected to a processor without an interrupt controller. The
* user should modify this function to fit the application.
*
* @param	IntcInstancePtr is a pointer to the instance of the Intc driver.
* @param	WdtTbInstancePtr is a pointer to the instance of WdtTb driver.
* @param	WdtTbIntrId is the Interrupt Id of the WDT interrupt and is
*		typically
*		XPAR_<INTC_instance>_<WDTTB_instance>_WDT_INTERRUPT_VEC_ID
*		value from xparameters.h.
*
* @return
*		- XST_SUCCESS if successful.
*		- XST_FAILURE, otherwise.
*
* @note		None.
*
******************************************************************************/
This function setups the interrupt system such that WDT interrupt can occur
for the WdtTb. This function is application specific since the actual
system may or may not have an interrupt controller. The WdtTb device could be
directly connected to a processor without an interrupt controller. The
user should modify this function to fit the application.
This function setups the interrupt system such that WDT interrupt can occur for the WdtTb . This function is application specific since the actual system may or may not have an interrupt controller . The WdtTb device could be directly connected to a processor without an interrupt controller . The user should modify this function to fit the application .
static int GWdtSetupIntrSystem(XScuGic *IntcInstancePtr,
			       XWdtTb *GWdtInstancePtr,
			       u16 GWdtIntrId)
{
	int Status;
	XScuGic_Config *IntcConfig;
	u8 Priority, Trigger;
	Xil_ExceptionInit();
	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;
	}
	XScuGic_GetPriorityTriggerType(IntcInstancePtr, GWdtIntrId,
				       &Priority, &Trigger);
	Trigger = 3;
	XScuGic_SetPriorityTriggerType(IntcInstancePtr, GWdtIntrId,
				       Priority, Trigger);
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
			(Xil_ExceptionHandler)XScuGic_InterruptHandler,
			IntcInstancePtr);
	Status = XScuGic_Connect(IntcInstancePtr, GWdtIntrId,
			(Xil_ExceptionHandler)GWdtIntrHandler,
			(void *)GWdtInstancePtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	XScuGic_Enable(IntcInstancePtr, GWdtIntrId);
	Xil_ExceptionEnable();
	return XST_SUCCESS;
}
static int GWdtSetupIntrSystem ( XScuGic * IntcInstancePtr , XWdtTb * GWdtInstancePtr , u16 GWdtIntrId ) { int Status ; XScuGic_Config * IntcConfig ; u8 Priority , Trigger ; Xil_ExceptionInit ( ) ; 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 ; } XScuGic_GetPriorityTriggerType ( IntcInstancePtr , GWdtIntrId , & Priority , & Trigger ) ; Trigger = 3 ; XScuGic_SetPriorityTriggerType ( IntcInstancePtr , GWdtIntrId , Priority , Trigger ) ; Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) XScuGic_InterruptHandler , IntcInstancePtr ) ; Status = XScuGic_Connect ( IntcInstancePtr , GWdtIntrId , ( Xil_ExceptionHandler ) GWdtIntrHandler , ( void * ) GWdtInstancePtr ) ; if ( Status != XST_SUCCESS ) { return Status ; } XScuGic_Enable ( IntcInstancePtr , GWdtIntrId ) ; Xil_ExceptionEnable ( ) ; return XST_SUCCESS ; }
This function setups the interrupt system such that WDT interrupt can occur
for the WdtTb.
This function setups the interrupt system such that WDT interrupt can occur for the WdtTb .
/*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */ /*
	 * Connect the interrupt controller interrupt handler to the hardware
	 * interrupt handling logic in the processor.
	 */ /*
	 * 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.
	 */ /*
	 * Enable the interrupt for the device.
	 */ /*
	 * Enable interrupts in the Processor.
	 */