v_hdmirxss1
Vitis Drivers API Documentation
xhdmi_example.c File Reference

Overview

This file demonstrates how to use Xilinx HDMI TX Subsystem, HDMI RX Subsystem and Video PHY Controller drivers.

MODIFICATION HISTORY:
Ver   Who    Date     Changes
             dd/mm/yy


1.00 YB 11/05/19 Initial release. 1.01 KU 07/07/20 Support for FrameBuffer Can use FRL on RX and TMDS on TX Video will be clipped if RX resolution in more than 4K Support Revision 2 (Pass 4) of OnSemi retimer Menu option updated for EDID and Training based on MaxRate configuration Added support for 16 BPC 1.02 KU 30/11/20 AVI InfoFrame Version set to 3 for resolutions VIC > 127 Onsemi redriver tweaked for TMDS mode in TX 1.03 ssh 03/17/21 Added EdidHdmi20_t, PsIic0 and PsIic1 declarations 1.04 ssh 04/20/21 Added support for Dynamic HDR and Versal 1.05 ssh 07/14/21 Added support for Native Video 1.06 KU 30/08/21 RX FRL settings updated for VCU118 1.07 ssh 01/28/22 Updated GT Swing settings for VCK190 1.08 ssh 02/01/22 Updated Enable CTS Conversion Function 1.09 ssh 02/04/22 Added param to support Tx to train at the same rate as Rx 1.10 ssh 03/02/22 Added LCPLL and RPLL config for VCK190 Exdes 1.11 ssh 01/25/23 Added support for VEK280 1.12 ssh 09/14/23 Added Tx compliance values for UltrascalePlus 1.13 ssh 04/07/25 Added support for VEK385

 

Functions

int I2cClk (u32 InFreq, u32 OutFreq)
 This function setup SI5324 clock generator either in free or locked mode. More...
 
void Info (void)
 This function outputs the video timing , Audio, Link Status, HDMI RX state of HDMI RX core. More...
 
void DetailedInfo (void)
 This function prints additional details of the system for debug purpose. More...
 
void Hdmiphy1ErrorCallback (void *CallbackRef)
 This function is called whenever an error condition in VPHY occurs. More...
 
void Hdmiphy1ProcessError (void)
 This function is called in the application to process the pending VPHY errors. More...
 
u32 Exdes_SysTmrInitialize (XHdmi_Exdes *InstancePtr, u32 TmrId, u32 TmrIntrId)
 This function is used to initialize the system timer that is used to count and generate given periodic interrupts. More...
 
u32 Exdes_UsToTicks (u32 TimeInUs, u32 TmrCtrClkFreq)
 This function time specified in Us to ticks for a specified timer frequency. More...
 
void Exdes_StartSysTmr (XHdmi_Exdes *InstancePtr, u32 IntervalInMs)
 This function is used to start a the timer to generate periodic pulses of tmrctr interrupt. More...
 
void Exdes_SysTmrCallback (void *CallbackRef, u8 TmrCtrNumber)
 This function is set as the callback handler from the timer counter interrupt handler. More...
 
void Exdes_SysTimerIntrHandler (void *CallbackRef)
 This function is set as the callback handler from the interrupt controller for the system timer interrupts. More...
 
void Exdes_SetDebugPrintf (Exdes_Debug_Printf PrintFunc)
 This function is used to enable and additional debugging prints in the applicaiton. More...
 
void Exdes_SetAuxFifoDebugPrintf (Exdes_Debug_Printf PrintFunc)
 This function is used to enable and additional debugging prints for the Aux Fifo operations in the applicaiton. More...
 
void Exdes_SetHdcpDebugPrintf (Exdes_Debug_Printf PrintFunc)
 This function is used to enable and additional debugging prints for the HDCP operations in the applicaiton. More...
 
void Exdes_InitController (XHdmi_Exdes *InstancePtr)
 This function is used to initialize the example desing controller data strucuture that is used to track the presence and instances of the hdmi 2.1 receiver and transmitter. More...
 
void Exdes_UpdateAuxFifo ()
 This function updates the global array for AUX fifo with the AUX data from the hdmi receiver. More...
 
void Exdes_ReadVRRTimingChange ()
 This function updates the Reads the VRR Video Timing Values from HDMI RX Receiver. More...
 
void Exdes_ProcessVRRTimingChange ()
 This function updates the Reads the VRR Video Timing Values from HDMI RX Receiver and updates to HDMI TX when VRR Manual Mode is enabled. More...
 
void Exdes_ReadVTEMPacket ()
 This function updates the Reads the VRR VTEM Packet from HDMI RX Receiver. More...
 
void Exdes_ProcessVTEMPacket ()
 This function updates the R Reads the VRR VTEM Packet from HDMI RX Receiver and updates to HDMI TX. More...
 
u32 Exdes_CheckforResChange ()
 This function checks if there has been a change in resolution on the incoming rx stream. More...
 
int I2cMuxSel (void *IicPtr, XOnBoard_IicDev Dev)
 This function setup sets up the On Board IIC MUX to select device. More...
 
void Xil_AssertCallbackRoutine (u8 *File, s32 Line)
 This is the callback for assertion error. More...
 
u32 Exdes_SetupClkSrc (u32 ps_iic0_deviceid, u32 ps_iic1_deviceid)
 This function updates the FrameRate for the current video stream. More...
 
int SetupInterruptSystem (void)
 This function setups the interrupt system so interrupts can occur for the HDMI cores. More...
 
int main ()
 Main function to call example with HDMI TX, HDMI RX and HDMI GT drivers. More...
 

Function Documentation

void DetailedInfo ( void  )

This function prints additional details of the system for debug purpose.

Parameters
None.
Returns
None.
Note
None.

References XV_HdmiRxSs1::HdmiRx1Ptr, XV_HdmiRxSs1_DebugInfo(), XV_HdmiRxSs1_ReportCoreInfo(), and XV_HdmiRxSs1_ReportSubcoreVersion().

u32 Exdes_CheckforResChange ( )

This function checks if there has been a change in resolution on the incoming rx stream.

Parameters
None.
Returns
None.
Note

References XV_HdmiRxSs1::IsStreamConnected, XHdmi_Exdes::TxStartTransmit, and XV_HdmiRxSs1_VRST().

void Exdes_InitController ( XHdmi_Exdes InstancePtr)

This function is used to initialize the example desing controller data strucuture that is used to track the presence and instances of the hdmi 2.1 receiver and transmitter.

Parameters
InstancePtris the instance of the example design handle data structure.
Returns
None.
Note

References Exdes_SetAuxFifoDebugPrintf(), Exdes_SetDebugPrintf(), Exdes_SetHdcpDebugPrintf(), XHdmi_Exdes::IsRxPresent, XHdmi_Exdes::IsTxPresent, XHdmi_Exdes::SystemEvent, and XHdmi_Exdes::TxStartTransmit.

Referenced by main().

void Exdes_ProcessVRRTimingChange ( )

This function updates the Reads the VRR Video Timing Values from HDMI RX Receiver and updates to HDMI TX when VRR Manual Mode is enabled.

Parameters
None.
Returns
None.
Note

References XV_HdmiRxSs1_GetVideoStream().

Referenced by Exdes_ProcessVTEMPacket(), and main().

void Exdes_ProcessVTEMPacket ( )

This function updates the R Reads the VRR VTEM Packet from HDMI RX Receiver and updates to HDMI TX.

Parameters
None.
Returns
None.
Note

References Exdes_ProcessVRRTimingChange(), and XV_HdmiRxSs1_GetVrrIf().

void Exdes_ReadVRRTimingChange ( )

This function updates the Reads the VRR Video Timing Values from HDMI RX Receiver.

Parameters
None.
Returns
None.
Note
void Exdes_ReadVTEMPacket ( )

This function updates the Reads the VRR VTEM Packet from HDMI RX Receiver.

Parameters
None.
Returns
None.
Note

References XV_HdmiRxSs1_GetVrrIf().

void Exdes_SetAuxFifoDebugPrintf ( Exdes_Debug_Printf  PrintFunc)

This function is used to enable and additional debugging prints for the Aux Fifo operations in the applicaiton.

Parameters
Printfuncis the function to enable printing.
Returns
None.
Note

Referenced by Exdes_InitController().

void Exdes_SetDebugPrintf ( Exdes_Debug_Printf  PrintFunc)

This function is used to enable and additional debugging prints in the applicaiton.

Parameters
Printfuncis the function to enable printing.
Returns
None.
Note

Referenced by Exdes_InitController().

void Exdes_SetHdcpDebugPrintf ( Exdes_Debug_Printf  PrintFunc)

This function is used to enable and additional debugging prints for the HDCP operations in the applicaiton.

Parameters
Printfuncis the function to enable printing.
Returns
None.
Note

Referenced by Exdes_InitController().

u32 Exdes_SetupClkSrc ( u32  ps_iic0_deviceid,
u32  ps_iic1_deviceid 
)

This function updates the FrameRate for the current video stream.

Parameters
ps_iic0_deviceidis the device id of the ps iic device.
ps_iic1_deviceidis the device id of the ps iic device.
Returns
XST_SUCCESS if the clock source is successfuly set. XST_FAILURE otherwise.
Note
None.

References I2cMuxSel(), RC21008A_ADDR, and Si570_SetFreq().

Referenced by main().

void Exdes_StartSysTmr ( XHdmi_Exdes InstancePtr,
u32  IntervalInMs 
)

This function is used to start a the timer to generate periodic pulses of tmrctr interrupt.

Parameters
InstancePtris a pointer to the example design handler.
IntervalInMsis the user specified period for the timer pulses.
Returns
None.
Note
None.

References Exdes_SysTmrCallback(), Exdes_UsToTicks(), XHdmi_Exdes::SysTmrInst, and XHdmi_Exdes::SysTmrPulseIntervalinMs.

Referenced by main().

void Exdes_SysTimerIntrHandler ( void *  CallbackRef)

This function is set as the callback handler from the interrupt controller for the system timer interrupts.

Parameters
InstancePtris the callback reference.
Returns
None.
Note
None.

References XHdmi_Exdes::SysTmrInst.

Referenced by Exdes_SysTmrInitialize().

void Exdes_SysTmrCallback ( void *  CallbackRef,
u8  TmrCtrNumber 
)

This function is set as the callback handler from the timer counter interrupt handler.

The counters that are used in the application for timer based control and exclusion are be handled in the this function.

The user needs to modify this callback to set the counters and exclusion flags based on the pulse counts in the pulse train generated by the system timer.

Parameters
CallbackRefis the function callback reference.
TmrCtrNumberis the timer counter number.
Returns
None.
Note
None.

Referenced by Exdes_StartSysTmr().

u32 Exdes_SysTmrInitialize ( XHdmi_Exdes InstancePtr,
u32  TmrId,
u32  TmrIntrId 
)

This function is used to initialize the system timer that is used to count and generate given periodic interrupts.

Parameters
InstancePtris a pointer to the example design handler
TmrIdis the device id of the system timer
TmrIntrIdis the interrupt vector id of the system timer
Returns
XST_SUCCESS if successful.
Note
None.

References Exdes_SysTimerIntrHandler(), and XHdmi_Exdes::SysTmrInst.

Referenced by main().

void Exdes_UpdateAuxFifo ( )

This function updates the global array for AUX fifo with the AUX data from the hdmi receiver.

Parameters
None.
Returns
None.
Note

References XV_HdmiRxSs1_GetAuxiliary().

u32 Exdes_UsToTicks ( u32  TimeInUs,
u32  TmrCtrClkFreq 
)

This function time specified in Us to ticks for a specified timer frequency.

Parameters
TimeInUsis the time in microseconds.
TmrCtrClkFreqis the frequency of the clock to be used for counting the ticks.
Returns
Number of ticks.
Note
None.

Referenced by Exdes_StartSysTmr().

void Hdmiphy1ErrorCallback ( void *  CallbackRef)

This function is called whenever an error condition in VPHY occurs.

This will fill the FIFO of VPHY error events which will be processed outside the ISR.

Parameters
CallbackRefis the VPHY instance pointer
ErrIrqTypeis the VPHY error type
Returns
None.
Note
None.

Referenced by main().

void Hdmiphy1ProcessError ( void  )

This function is called in the application to process the pending VPHY errors.

Parameters
None.
Returns
None.
Note
This function can be expanded to perform necessary actions depending on the error type. For example, XHDMIPHY1_ERR_PLL_LAYOUT can be used to automatically switch in and out of bonded mode for GTXE2 devices

Referenced by main().

int I2cClk ( u32  InFreq,
u32  OutFreq 
)

This function setup SI5324 clock generator either in free or locked mode.

Parameters
Indexspecifies an index for selecting mode frequency.
Modespecifies either free or locked mode.
Returns
  • Zero if error in programming external clock.
  • One if programmed external clock.
Note
None.

References I2C_CLK_ADDR, I2C_CLK_ADDR1, and IDT_8T49N24x_I2cClk().

Referenced by main().

int I2cMuxSel ( void *  IicPtr,
XOnBoard_IicDev  Dev 
)

This function setup sets up the On Board IIC MUX to select device.

Parameters
None.
Returns
The number of bytes sent.
Note
None.

Referenced by Exdes_SetupClkSrc().

void Info ( void  )

This function outputs the video timing , Audio, Link Status, HDMI RX state of HDMI RX core.

In addition, it also prints information about HDMI TX, and HDMI GT cores.

Parameters
None.
Returns
None.
Note
None.

References XV_HdmiRxSs1::EnableHDCPLogging, XV_HdmiRxSs1_ReportAudio(), XV_HdmiRxSs1_ReportDRMInfo(), XV_HdmiRxSs1_ReportLinkQuality(), and XV_HdmiRxSs1_ReportTiming().

int main ( )

Main function to call example with HDMI TX, HDMI RX and HDMI GT drivers.

Parameters
None.
Returns
  • XST_SUCCESS if HDMI example was successfully.
  • XST_FAILURE if HDMI example failed.
Note
None.

Setup IIC devices and clock sources.

Load the HDCP keys.

Initialize the Audio Generator.

Initialize the Interrupt Controller.

Initialize the HDMI Video Transmitter "state machine" functionality and the downstream HDCP device.

Initialize the HDMI Video Receiver "state machine" functionality and the downstream HDCP device.

Set the Video Phy Error callbacks.

Initialize the controller for the example design mode.

Initialize the TPG and associated GPIO to reset the TPG.

References Exdes_InitController(), Exdes_ProcessVRRTimingChange(), Exdes_SetupClkSrc(), Exdes_StartSysTmr(), Exdes_SysTmrInitialize(), XHdmi_Exdes::ForceIndependent, Hdmiphy1ErrorCallback(), Hdmiphy1ProcessError(), I2cClk(), XVfmc::IicPtr, XHdmi_Exdes::IsRxPresent, XHdmi_Exdes::IsTxPresent, XVfmc::Loc, SetupInterruptSystem(), XHdmi_Exdes::SystemEvent, XHdmi_Exdes::TxBusy, XHdmi_Exdes::TxStartTransmit, XHdmi_MenuInitialize(), XHdmi_MenuProcess(), Xil_AssertCallbackRoutine(), XV_HdmiRxSs1_DynHDR_SetAddr(), XV_HdmiRxSs1_GetVideoStream(), XV_HdmiRxSs1_GetVrrIf(), and XV_HdmiRxSs1_Start().

int SetupInterruptSystem ( void  )

This function setups the interrupt system so interrupts can occur for the HDMI cores.

The function is application-specific since the actual system may or may not have an interrupt controller. The HDMI cores could be directly connected to a processor without an interrupt controller. The user should modify this function to fit the application.

Parameters
None.
Returns
  • XST_SUCCESS if interrupt setup was successful.
  • A specific error code defined in "xstatus.h" if an error occurs.
Note
This function assumes a Microblaze system and no operating system is used.

Referenced by main().

void Xil_AssertCallbackRoutine ( u8 *  File,
s32  Line 
)

This is the callback for assertion error.

Parameters
Fileis string name of the file where the assertion failure occured.
LIneis the line wheer the assertion failure occured.
Returns
None.
Note
None.

Referenced by main().