/** * * This function installs a custom delay/sleep function to be used by the * DisplayPort RX Subsystem. * * @param InstancePtr is a pointer to the XDpRxSs core instance. * @param CallbackFunc is the address to the callback function. * @param CallbackRef is the user data item (microseconds to delay) that * will be passed to the custom sleep/delay function when it is * invoked. * * @return None. * * @note None. * ******************************************************************************/ void XDpRxSs_SetUserTimerHandler(XDpRxSs *InstancePtr, XDpRxSs_TimerHandler CallbackFunc, void *CallbackRef) { /* Verify arguments. */ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(CallbackFunc != NULL); Xil_AssertVoid(CallbackRef != NULL); /* Set custom timer wait handler */ XDp_SetUserTimerHandler(InstancePtr->DpPtr, CallbackFunc, CallbackRef); }
/** * This function sets up a custom timer which the driver will use for MicroBlaze * systems. * * @param InstancePtr is a pointer to the XDp instance. * @param TimerCounterPtr is a pointer to the timer instance. * @param TimerId is the ID of the timer controller to use for delays. * * @return * - XST_SUCCESS if a timer controller exists for use. * - XST_FAILURE otherwise. * * @note A timer controller must be present in the system. * *******************************************************************************/ static u32 Dprx_SetupTimerHandler(XDp *InstancePtr, XTmrCtr *TimerCounterPtr, u16 TimerId) { u32 Status; Status = XTmrCtr_Initialize(TimerCounterPtr, TimerId); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* Set a custom timer handler for improved delay accuracy on MicroBlaze * systems since the driver does not assume/have a dependency on the * system having a timer in the FPGA. * Note: This only has an affect for MicroBlaze systems since the Zynq * ARM SoC contains a timer, which is used when the driver calls the * delay function. */ XDp_SetUserTimerHandler(InstancePtr, &Dprx_CustomWaitUs, TimerCounterPtr); XTmrCtr_SetResetValue(InstancePtr->UserTimerPtr, 0, 0); XTmrCtr_Reset(InstancePtr->UserTimerPtr, 0); return XST_SUCCESS; }
/** * The main entry point for the interrupt with timer example using the XDp * driver. This function will set up the system, interrupt controller and * interrupt handlers, and the custom sleep handler. * * @param InstancePtr is a pointer to the XDp instance. * @param DeviceId is the unique device ID of the DisplayPort RX core * 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 RX connection to * the interrupt controller. * @param TimerCounterPtr is a pointer to the timer instance. * * @return * - XST_SUCCESS if the system was set up correctly and link * training was successful. * - XST_FAILURE otherwise. * * @note None. * *******************************************************************************/ u32 Dprx_IntrTimerExample(XDp *InstancePtr, u16 DeviceId, INTC *IntcPtr, u16 IntrId, u16 DpIntrId, XTmrCtr *TimerCounterPtr) { u32 Status; /* Do platform initialization here. This is hardware system specific - * it is up to the user to implement this function. */ Dprx_PlatformInit(InstancePtr); /*******************/ Status = Dprx_SetupExample(InstancePtr, DeviceId); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* Set a custom timer handler for improved delay accuracy on MicroBlaze * systems since the driver does not assume/have a dependency on the * system having a timer in the FPGA. * Note: This only has an affect for MicroBlaze systems since the Zynq * ARM SoC contains a timer, which is used when the driver calls the * delay function. */ XDp_SetUserTimerHandler(InstancePtr, &Dprx_CustomWaitUs, TimerCounterPtr); /* Setup interrupt handling in the system. */ Status = Dprx_SetupInterruptHandler(InstancePtr, IntcPtr, IntrId, DpIntrId); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* Do not return in order to allow interrupt handling to run. */ while (1); return XST_SUCCESS; }