XilinxProcessorIPLib/drivers/scuwdt/examples/xscuwdt_intr_example.c
static int WdtSetupIntrSystem(XScuGic *IntcInstancePtr,
			      XScuWdt *WdtInstancePtr, u16 WdtIntrId)
{
	int Status;
	u32 Reg;

#ifndef TESTAPP_GEN
	XScuGic_Config *IntcConfig;
	/*
	 * 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;
	}

	Xil_ExceptionInit();

	/*
	 * 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);
#endif
	/*
	 * 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, WdtIntrId,
				(Xil_ExceptionHandler)WdtIntrHandler,
				(void *)WdtInstancePtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}

	/*
	 * Enable the watchdog interrupts for timer mode.
	 */
	Reg = XScuWdt_GetControlReg(WdtInstancePtr);
	XScuWdt_SetControlReg(WdtInstancePtr,
				Reg | XSCUWDT_CONTROL_IT_ENABLE_MASK);

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

#ifndef TESTAPP_GEN
	/*
	 * Enable interrupts in the Processor.
	 */
	Xil_ExceptionEnable();
#endif
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets up the interrupt system such that interrupts can occur
* for the device.
*
* @param	IntcInstancePtr is a pointer to the instance of the XScuGic
*		driver.
* @param	WdtInstancePtr is a pointer to the instance of XScuWdt driver.
* @param	WdtIntrId is the Interrupt Id of the XScuWdt device.
*
* @return	XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note		None.
*
******************************************************************************/
This function sets up the interrupt system such that interrupts can occur
for the device.
This function sets up the interrupt system such that interrupts can occur for the device .
static int WdtSetupIntrSystem(XScuGic *IntcInstancePtr,
			      XScuWdt *WdtInstancePtr, u16 WdtIntrId)
{
	int Status;
	u32 Reg;
#ifndef TESTAPP_GEN
	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_ExceptionInit();
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				    (Xil_ExceptionHandler)
				    XScuGic_InterruptHandler,
				    IntcInstancePtr);
#endif
	Status = XScuGic_Connect(IntcInstancePtr, WdtIntrId,
				(Xil_ExceptionHandler)WdtIntrHandler,
				(void *)WdtInstancePtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	Reg = XScuWdt_GetControlReg(WdtInstancePtr);
	XScuWdt_SetControlReg(WdtInstancePtr,
				Reg | XSCUWDT_CONTROL_IT_ENABLE_MASK);
	XScuGic_Enable(IntcInstancePtr, WdtIntrId);
#ifndef TESTAPP_GEN
	Xil_ExceptionEnable();
#endif
	return XST_SUCCESS;
}
static int WdtSetupIntrSystem ( XScuGic * IntcInstancePtr , XScuWdt * WdtInstancePtr , u16 WdtIntrId ) { int Status ; u32 Reg ; #ifndef TESTAPP_GEN 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_ExceptionInit ( ) ; Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) XScuGic_InterruptHandler , IntcInstancePtr ) ; #endif Status = XScuGic_Connect ( IntcInstancePtr , WdtIntrId , ( Xil_ExceptionHandler ) WdtIntrHandler , ( void * ) WdtInstancePtr ) ; if ( Status != XST_SUCCESS ) { return Status ; } Reg = XScuWdt_GetControlReg ( WdtInstancePtr ) ; XScuWdt_SetControlReg ( WdtInstancePtr , Reg | XSCUWDT_CONTROL_IT_ENABLE_MASK ) ; XScuGic_Enable ( IntcInstancePtr , WdtIntrId ) ; #ifndef TESTAPP_GEN Xil_ExceptionEnable ( ) ; #endif return XST_SUCCESS ; }
This function sets up the interrupt system such that interrupts can occur
for the device.
This function sets up the interrupt system such that interrupts can occur for the device .
/*
	 * 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 watchdog interrupts for timer mode.
	 */ /*
	 * Enable the interrupt for the device.
	 */ /*
	 * Enable interrupts in the Processor.
	 */