XilinxProcessorIPLib/drivers/dppsu/examples/xdppsu_poll_example.c
static void DpPsu_HpdPoll(XDpPsu *InstancePtr)
{
	u32 InterruptSignalState;
	u32 InterruptStatus;
	u32 HpdState;
	u32 HpdEvent;
	u32 HpdPulseDetected;
	u32 HpdDuration;

	/* Read interrupt registers. */
	InterruptSignalState = XDpPsu_ReadReg(InstancePtr->Config.BaseAddr,
						XDPPSU_INTERRUPT_SIG_STATE);
	InterruptStatus = XDpPsu_ReadReg(InstancePtr->Config.BaseAddr,
							XDPPSU_INTR_STATUS);

	/* Check for HPD events. */
	HpdState = InterruptSignalState &
				XDPPSU_INTERRUPT_SIG_STATE_HPD_STATE_MASK;
	HpdEvent = InterruptStatus & XDPPSU_INTR_HPD_EVENT_MASK;
	HpdPulseDetected = InterruptStatus &
				XDPPSU_INTR_HPD_PULSE_DETECTED_MASK;
	if (HpdPulseDetected) {
		HpdDuration = XDpPsu_ReadReg(InstancePtr->Config.BaseAddr,
							XDPPSU_HPD_DURATION);
	}

	/* HPD event handling. */
	if (HpdState && HpdEvent) {
		xil_printf("+===> HPD connection event detected.\n");

		/* Initiate link training. */
		DpPsu_Run(InstancePtr);
	}
	else if (HpdState && HpdPulseDetected && (HpdDuration >= 250)) {
		xil_printf("===> HPD pulse detected.\n");

		/* Re-train if needed. */
		DpPsu_Run(InstancePtr);
	}
	else if (!HpdState && HpdEvent) {
		xil_printf("+===> HPD disconnection event detected.\n\n");

		/* Disable main link. */
		XDpPsu_EnableMainLink(InstancePtr, 0);
	}
}
/******************************************************************************/
/**
 * This function polls the XDPPSU_INTERRUPT_SIG_STATE and XDPPSU_INTERRUPT_STATUS
 * registers for Hot-Plug-Detect (HPD) events and handles them accordingly. If a
 * connection or pulse event is detected, link training will begin (if required)
 * and a video stream will be initiated.
 *
 * @param	InstancePtr is a pointer to the XDpPsu instance.
 *
 * @return	None.
 *
 * @note	None.
 *
*******************************************************************************/
This function polls the XDPPSU_INTERRUPT_SIG_STATE and XDPPSU_INTERRUPT_STATUS
registers for Hot-Plug-Detect (HPD) events and handles them accordingly. If a
connection or pulse event is detected, link training will begin (if required)
and a video stream will be initiated.

@param       InstancePtr is a pointer to the XDpPsu instance.

@return      None.

@note        None.
This function polls the XDPPSU_INTERRUPT_SIG_STATE and XDPPSU_INTERRUPT_STATUS registers for Hot - Plug - Detect ( HPD ) events and handles them accordingly . If a connection or pulse event is detected link training will begin ( if required ) and a video stream will be initiated . @param InstancePtr is a pointer to the XDpPsu instance . @return None . @note None .
static void DpPsu_HpdPoll(XDpPsu *InstancePtr)
{
	u32 InterruptSignalState;
	u32 InterruptStatus;
	u32 HpdState;
	u32 HpdEvent;
	u32 HpdPulseDetected;
	u32 HpdDuration;
	InterruptSignalState = XDpPsu_ReadReg(InstancePtr->Config.BaseAddr,
						XDPPSU_INTERRUPT_SIG_STATE);
	InterruptStatus = XDpPsu_ReadReg(InstancePtr->Config.BaseAddr,
							XDPPSU_INTR_STATUS);
	HpdState = InterruptSignalState &
				XDPPSU_INTERRUPT_SIG_STATE_HPD_STATE_MASK;
	HpdEvent = InterruptStatus & XDPPSU_INTR_HPD_EVENT_MASK;
	HpdPulseDetected = InterruptStatus &
				XDPPSU_INTR_HPD_PULSE_DETECTED_MASK;
	if (HpdPulseDetected) {
		HpdDuration = XDpPsu_ReadReg(InstancePtr->Config.BaseAddr,
							XDPPSU_HPD_DURATION);
	}
	if (HpdState && HpdEvent) {
		xil_printf("+===> HPD connection event detected.\n");
		DpPsu_Run(InstancePtr);
	}
	else if (HpdState && HpdPulseDetected && (HpdDuration >= 250)) {
		xil_printf("===> HPD pulse detected.\n");
		DpPsu_Run(InstancePtr);
	}
	else if (!HpdState && HpdEvent) {
		xil_printf("+===> HPD disconnection event detected.\n\n");
		XDpPsu_EnableMainLink(InstancePtr, 0);
	}
}
static void DpPsu_HpdPoll ( XDpPsu * InstancePtr ) { u32 InterruptSignalState ; u32 InterruptStatus ; u32 HpdState ; u32 HpdEvent ; u32 HpdPulseDetected ; u32 HpdDuration ; InterruptSignalState = XDpPsu_ReadReg ( InstancePtr -> Config . BaseAddr , XDPPSU_INTERRUPT_SIG_STATE ) ; InterruptStatus = XDpPsu_ReadReg ( InstancePtr -> Config . BaseAddr , XDPPSU_INTR_STATUS ) ; HpdState = InterruptSignalState & XDPPSU_INTERRUPT_SIG_STATE_HPD_STATE_MASK ; HpdEvent = InterruptStatus & XDPPSU_INTR_HPD_EVENT_MASK ; HpdPulseDetected = InterruptStatus & XDPPSU_INTR_HPD_PULSE_DETECTED_MASK ; if ( HpdPulseDetected ) { HpdDuration = XDpPsu_ReadReg ( InstancePtr -> Config . BaseAddr , XDPPSU_HPD_DURATION ) ; } if ( HpdState && HpdEvent ) { xil_printf ( " \n " ) ; DpPsu_Run ( InstancePtr ) ; } else if ( HpdState && HpdPulseDetected && ( HpdDuration >= 250 ) ) { xil_printf ( " \n " ) ; DpPsu_Run ( InstancePtr ) ; } else if ( ! HpdState && HpdEvent ) { xil_printf ( " \n \n " ) ; XDpPsu_EnableMainLink ( InstancePtr , 0 ) ; } }
This function polls the XDPPSU_INTERRUPT_SIG_STATE and XDPPSU_INTERRUPT_STATUS
 registers for Hot-Plug-Detect (HPD) events and handles them accordingly.
This function polls the XDPPSU_INTERRUPT_SIG_STATE and XDPPSU_INTERRUPT_STATUS registers for Hot - Plug - Detect ( HPD ) events and handles them accordingly .
/* Read interrupt registers. */ /* Check for HPD events. */ /* HPD event handling. */ /* Initiate link training. */ /* Re-train if needed. */ /* Disable main link. */