XilinxProcessorIPLib/drivers/dpdma/examples/xdppsu_interrupt.c
void DpPsu_Run(Run_Config *RunCfgPtr)
{
	u32 Status;
	XDpPsu  *DpPsuPtr = RunCfgPtr->DpPsuPtr;

	Status = InitDpDmaSubsystem(RunCfgPtr);
	if (Status != XST_SUCCESS) {
		xil_printf("! InitDpDmaSubsystem failed.\n\r");
		return;
	}

	XDpPsu_EnableMainLink(DpPsuPtr, 0);

	if (!XDpPsu_IsConnected(DpPsuPtr)) {
		XDpDma_SetChannelState(RunCfgPtr->DpDmaPtr, GraphicsChan,
				       XDPDMA_DISABLE);
		xil_printf("! Disconnected.\n\r");
		return;
	}
	else {
		xil_printf("! Connected.\n\r");
	}

	Status = DpPsu_Wakeup(RunCfgPtr);
	if (Status != XST_SUCCESS) {
		xil_printf("! Wakeup failed.\n\r");
		return;
	}


	u8 Count = 0;
	do {
		usleep(100000);
		Count++;

		Status = DpPsu_Hpd_Train(RunCfgPtr);
		if (Status == XST_DEVICE_NOT_FOUND) {
			xil_printf("Lost connection\n\r");
			return;
		}
		else if (Status != XST_SUCCESS)
			continue;

		XDpDma_DisplayGfxFrameBuffer(RunCfgPtr->DpDmaPtr, &FrameBuffer);

		DpPsu_SetupVideoStream(RunCfgPtr);
		XDpPsu_EnableMainLink(DpPsuPtr, 1);

		Status = XDpPsu_CheckLinkStatus(DpPsuPtr, DpPsuPtr->LinkConfig.LaneCount);
		if (Status == XST_DEVICE_NOT_FOUND)
			return;
	} while ((Status != XST_SUCCESS) && (Count < 2));
}
/******************************************************************************/
/**
 * This function will configure and establish a link with the receiver device,
 * afterwards, a video stream will start to be sent over the main link.
 *
 * @param	RunCfgPtr is a pointer to the application configuration structure.
 *
 * @return
 *		- XST_SUCCESS if main link was successfully established.
 *		- XST_FAILURE otherwise.
 *
 * @note	None.
 *
*******************************************************************************/
This function will configure and establish a link with the receiver device,
afterwards, a video stream will start to be sent over the main link.

@param       RunCfgPtr is a pointer to the application configuration structure.

@return
- XST_SUCCESS if main link was successfully established.

@note        None.
This function will configure and establish a link with the receiver device afterwards a video stream will start to be sent over the main link . @param RunCfgPtr is a pointer to the application configuration structure . @return - XST_SUCCESS if main link was successfully established . @note None .
void DpPsu_Run(Run_Config *RunCfgPtr)
{
	u32 Status;
	XDpPsu  *DpPsuPtr = RunCfgPtr->DpPsuPtr;
	Status = InitDpDmaSubsystem(RunCfgPtr);
	if (Status != XST_SUCCESS) {
		xil_printf("! InitDpDmaSubsystem failed.\n\r");
		return;
	}
	XDpPsu_EnableMainLink(DpPsuPtr, 0);
	if (!XDpPsu_IsConnected(DpPsuPtr)) {
		XDpDma_SetChannelState(RunCfgPtr->DpDmaPtr, GraphicsChan,
				       XDPDMA_DISABLE);
		xil_printf("! Disconnected.\n\r");
		return;
	}
	else {
		xil_printf("! Connected.\n\r");
	}
	Status = DpPsu_Wakeup(RunCfgPtr);
	if (Status != XST_SUCCESS) {
		xil_printf("! Wakeup failed.\n\r");
		return;
	}
	u8 Count = 0;
	do {
		usleep(100000);
		Count++;
		Status = DpPsu_Hpd_Train(RunCfgPtr);
		if (Status == XST_DEVICE_NOT_FOUND) {
			xil_printf("Lost connection\n\r");
			return;
		}
		else if (Status != XST_SUCCESS)
			continue;
		XDpDma_DisplayGfxFrameBuffer(RunCfgPtr->DpDmaPtr, &FrameBuffer);
		DpPsu_SetupVideoStream(RunCfgPtr);
		XDpPsu_EnableMainLink(DpPsuPtr, 1);
		Status = XDpPsu_CheckLinkStatus(DpPsuPtr, DpPsuPtr->LinkConfig.LaneCount);
		if (Status == XST_DEVICE_NOT_FOUND)
			return;
	} while ((Status != XST_SUCCESS) && (Count < 2));
}
void DpPsu_Run ( Run_Config * RunCfgPtr ) { u32 Status ; XDpPsu * DpPsuPtr = RunCfgPtr -> DpPsuPtr ; Status = InitDpDmaSubsystem ( RunCfgPtr ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \n \r " ) ; return ; } XDpPsu_EnableMainLink ( DpPsuPtr , 0 ) ; if ( ! XDpPsu_IsConnected ( DpPsuPtr ) ) { XDpDma_SetChannelState ( RunCfgPtr -> DpDmaPtr , GraphicsChan , XDPDMA_DISABLE ) ; xil_printf ( " \n \r " ) ; return ; } else { xil_printf ( " \n \r " ) ; } Status = DpPsu_Wakeup ( RunCfgPtr ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \n \r " ) ; return ; } u8 Count = 0 ; do { usleep ( 100000 ) ; Count ++ ; Status = DpPsu_Hpd_Train ( RunCfgPtr ) ; if ( Status == XST_DEVICE_NOT_FOUND ) { xil_printf ( " \n \r " ) ; return ; } else if ( Status != XST_SUCCESS ) continue ; XDpDma_DisplayGfxFrameBuffer ( RunCfgPtr -> DpDmaPtr , & FrameBuffer ) ; DpPsu_SetupVideoStream ( RunCfgPtr ) ; XDpPsu_EnableMainLink ( DpPsuPtr , 1 ) ; Status = XDpPsu_CheckLinkStatus ( DpPsuPtr , DpPsuPtr -> LinkConfig . LaneCount ) ; if ( Status == XST_DEVICE_NOT_FOUND ) return ; } while ( ( Status != XST_SUCCESS ) && ( Count < 2 ) ) ; }
This function will configure and establish a link with the receiver device,
 afterwards, a video stream will start to be sent over the main link.
This function will configure and establish a link with the receiver device afterwards a video stream will start to be sent over the main link .