XilinxProcessorIPLib/drivers/dppsu/examples/xdppsu_intr_example.c
static u32 DpPsu_SetupInterruptHandler(XDpPsu *InstancePtr, INTC *IntcPtr,
		u16 IntrId, u16 DpIntrId, XDpPsu_HpdEventHandler HpdEventHandler,
		XDpPsu_HpdPulseHandler HpdPulseHandler)
{
	u32 Status;
	u32 IntrMask = XDPPSU_INTR_HPD_IRQ_MASK | XDPPSU_INTR_HPD_EVENT_MASK;

	/* Set the HPD interrupt handlers. */
	XDpPsu_SetHpdEventHandler(InstancePtr, HpdEventHandler, InstancePtr);
	XDpPsu_SetHpdPulseHandler(InstancePtr, HpdPulseHandler, InstancePtr);

	/* Initialize interrupt controller driver. */

	XScuGic_Config *IntcConfig;

	IntcConfig = XScuGic_LookupConfig(IntrId);
	Status = XScuGic_CfgInitialize(IntcPtr, IntcConfig,
	IntcConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuGic_SetPriorityTriggerType(IntcPtr, DpIntrId, 0x0, 0x3);


	/* 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(IntcPtr, DpIntrId,
		(Xil_InterruptHandler)XDpPsu_HpdInterruptHandler, InstancePtr);

	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/* Start the interrupt controller. */

	XScuGic_Enable(IntcPtr, DpIntrId);

	/* Initialize the exception table. */
	Xil_ExceptionInit();

	/* Register the interrupt controller handler with the exception table. */
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler)INTC_HANDLER, 0);

	/* Enable exceptions. */
	Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ);
	Xil_ExceptionEnable();

	/* Enable DP interrupts. */
	XScuGic_Enable(IntcPtr,DpIntrId);
	XDpPsu_WriteReg(InstancePtr->Config.BaseAddr, XDPPSU_INTR_EN, IntrMask);

	return XST_SUCCESS;
}
/******************************************************************************/
/**
 * This function sets up the interrupt system such that interrupts caused by
 * Hot-Plug-Detect (HPD) events and pulses are handled. This function is
 * application-specific for systems that have an interrupt controller connected
 * to the processor. The user should modify this function to fit the
 * application.
 *
 * @param	InstancePtr is a pointer to the XDpPsu instance.
 * @param	IntcPtr is a pointer to the interrupt instance.
 * @param	IntrId is the unique device ID of the interrupt controller.
 * @param	DpIntrId is the interrupt ID of the DisplayPort TX connection to
 *		the interrupt controller.
 * @param	HpdEventHandler is a pointer to the handler called when an HPD
 *		event occurs.
 * @param	HpdPulseHandler is a pointer to the handler called when an HPD
 *		pulse occurs.
 *
 * @return
 *		- XST_SUCCESS if the interrupt system was successfully set up.
 *		- XST_FAILURE otherwise.
 *
 * @note	An interrupt controller must be present in the system, connected
 *		to the processor and the DisplayPort TX core.
 *
*******************************************************************************/
This function sets up the interrupt system such that interrupts caused by
Hot-Plug-Detect (HPD) events and pulses are handled. This function is
application-specific for systems that have an interrupt controller connected
to the processor. The user should modify this function to fit the
application.

@param       InstancePtr is a pointer to the XDpPsu instance.
@param       IntcPtr is a pointer to the interrupt instance.
@param       IntrId is the unique device ID of the interrupt controller.
@param       DpIntrId is the interrupt ID of the DisplayPort TX connection to
the interrupt controller.
@param       HpdEventHandler is a pointer to the handler called when an HPD
event occurs.
@param       HpdPulseHandler is a pointer to the handler called when an HPD
pulse occurs.

@return
- XST_SUCCESS if the interrupt system was successfully set up.

@note        An interrupt controller must be present in the system, connected
to the processor and the DisplayPort TX core.
This function sets up the interrupt system such that interrupts caused by Hot - Plug - Detect ( HPD ) events and pulses are handled . This function is application - specific for systems that have an interrupt controller connected to the processor . The user should modify this function to fit the application . @param InstancePtr is a pointer to the XDpPsu instance . @param IntcPtr is a pointer to the interrupt instance . @param IntrId is the unique device ID of the interrupt controller . @param DpIntrId is the interrupt ID of the DisplayPort TX connection to the interrupt controller . @param HpdEventHandler is a pointer to the handler called when an HPD event occurs . @param HpdPulseHandler is a pointer to the handler called when an HPD pulse occurs . @return - XST_SUCCESS if the interrupt system was successfully set up . @note An interrupt controller must be present in the system connected to the processor and the DisplayPort TX core .
static u32 DpPsu_SetupInterruptHandler(XDpPsu *InstancePtr, INTC *IntcPtr,
		u16 IntrId, u16 DpIntrId, XDpPsu_HpdEventHandler HpdEventHandler,
		XDpPsu_HpdPulseHandler HpdPulseHandler)
{
	u32 Status;
	u32 IntrMask = XDPPSU_INTR_HPD_IRQ_MASK | XDPPSU_INTR_HPD_EVENT_MASK;
	XDpPsu_SetHpdEventHandler(InstancePtr, HpdEventHandler, InstancePtr);
	XDpPsu_SetHpdPulseHandler(InstancePtr, HpdPulseHandler, InstancePtr);
	XScuGic_Config *IntcConfig;
	IntcConfig = XScuGic_LookupConfig(IntrId);
	Status = XScuGic_CfgInitialize(IntcPtr, IntcConfig,
	IntcConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuGic_SetPriorityTriggerType(IntcPtr, DpIntrId, 0x0, 0x3);
	Status = XScuGic_Connect(IntcPtr, DpIntrId,
		(Xil_InterruptHandler)XDpPsu_HpdInterruptHandler, InstancePtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuGic_Enable(IntcPtr, DpIntrId);
	Xil_ExceptionInit();
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler)INTC_HANDLER, 0);
	Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ);
	Xil_ExceptionEnable();
	XScuGic_Enable(IntcPtr,DpIntrId);
	XDpPsu_WriteReg(InstancePtr->Config.BaseAddr, XDPPSU_INTR_EN, IntrMask);
	return XST_SUCCESS;
}
static u32 DpPsu_SetupInterruptHandler ( XDpPsu * InstancePtr , INTC * IntcPtr , u16 IntrId , u16 DpIntrId , XDpPsu_HpdEventHandler HpdEventHandler , XDpPsu_HpdPulseHandler HpdPulseHandler ) { u32 Status ; u32 IntrMask = XDPPSU_INTR_HPD_IRQ_MASK | XDPPSU_INTR_HPD_EVENT_MASK ; XDpPsu_SetHpdEventHandler ( InstancePtr , HpdEventHandler , InstancePtr ) ; XDpPsu_SetHpdPulseHandler ( InstancePtr , HpdPulseHandler , InstancePtr ) ; XScuGic_Config * IntcConfig ; IntcConfig = XScuGic_LookupConfig ( IntrId ) ; Status = XScuGic_CfgInitialize ( IntcPtr , IntcConfig , IntcConfig -> CpuBaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XScuGic_SetPriorityTriggerType ( IntcPtr , DpIntrId , 0x0 , 0x3 ) ; Status = XScuGic_Connect ( IntcPtr , DpIntrId , ( Xil_InterruptHandler ) XDpPsu_HpdInterruptHandler , InstancePtr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XScuGic_Enable ( IntcPtr , DpIntrId ) ; Xil_ExceptionInit ( ) ; Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) INTC_HANDLER , 0 ) ; Xil_ExceptionEnableMask ( XIL_EXCEPTION_IRQ ) ; Xil_ExceptionEnable ( ) ; XScuGic_Enable ( IntcPtr , DpIntrId ) ; XDpPsu_WriteReg ( InstancePtr -> Config . BaseAddr , XDPPSU_INTR_EN , IntrMask ) ; return XST_SUCCESS ; }
This function sets up the interrupt system such that interrupts caused by
 Hot-Plug-Detect (HPD) events and pulses are handled.
This function sets up the interrupt system such that interrupts caused by Hot - Plug - Detect ( HPD ) events and pulses are handled .
/* Set the HPD interrupt handlers. */ /* Initialize interrupt controller driver. */ /* 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. */ /* Start the interrupt controller. */ /* Initialize the exception table. */ /* Register the interrupt controller handler with the exception table. */ /* Enable exceptions. */ /* Enable DP interrupts. */