v_hdmitx
Xilinx SDK Drivers API Documentation
xv_hdmitx.c File Reference

Overview

This is the main file for Xilinx HDMI TX core.

Please see xv_hdmitx.h for more details of the driver.

MODIFICATION HISTORY:
Ver   Who    Date     Changes

1.00 10/07/15 Initial release. 1.01 yh 15/01/16 Add 3D Support 1.02 MG 09/03/16 Added XV_HdmiTx_SetHdmiMode and XV_HdmiTx_SetDviMode 1.03 YH 25/07/16 Used UINTPTR instead of u32 for BaseAddress XV_HdmiTx_CfgInitialize 1.04 YH 27/07/16 Remove checking VideoMode<(XVIDC_VM_NUM_SUPPORTED)); 1.05 YH 17/08/16 Add XV_HdmiTx_SetAxiClkFreq Move XV_HdmiTx_DdcInit to XV_HdmiTx_SetAxiClkFreq squash unused variable compiler warning 1.06 MG 07/03/17 Updated XV_HdmiTx_Auxsend with packet ready check 1.07 YH 19/07/17 Added Video Masking Check API

Functions

int XV_HdmiTx_CfgInitialize (XV_HdmiTx *InstancePtr, XV_HdmiTx_Config *CfgPtr, UINTPTR EffectiveAddr)
 This function initializes the HDMI TX core. More...
 
void XV_HdmiTx_SetAxiClkFreq (XV_HdmiTx *InstancePtr, u32 ClkFreq)
 This function sets the AXI4-Lite Clock Frequency. More...
 
void XV_HdmiTx_SetHdmiMode (XV_HdmiTx *InstancePtr)
 This function sets the core into HDMI mode. More...
 
void XV_HdmiTx_SetDviMode (XV_HdmiTx *InstancePtr)
 This function sets the core into DVI mode. More...
 
void XV_HdmiTx_Clear (XV_HdmiTx *InstancePtr)
 This function clear the HDMI TX variables and sets it to the defaults. More...
 
u8 XV_HdmiTx_LookupVic (XVidC_VideoMode VideoMode)
 This function provides video identification code of video mode. More...
 
int XV_HdmiTx_Scrambler (XV_HdmiTx *InstancePtr)
 This function controls the scrambler. More...
 
int XV_HdmiTx_ClockRatio (XV_HdmiTx *InstancePtr)
 This function controls the TMDS clock ratio. More...
 
int XV_HdmiTx_DetectHdmi20 (XV_HdmiTx *InstancePtr)
 This function detects connected sink is a HDMI 2.0/HDMI 1.4 sink device and sets appropriate flag in the TX stream. More...
 
void XV_HdmiTx_ShowSCDC (XV_HdmiTx *InstancePtr)
 This function shows the sinks SCDC registers. More...
 
u32 XV_HdmiTx_SetStream (XV_HdmiTx *InstancePtr, XVidC_VideoMode VideoMode, XVidC_ColorFormat ColorFormat, XVidC_ColorDepth Bpc, XVidC_PixelsPerClock Ppc, XVidC_3DInfo *Info3D)
 This function sets the HDMI TX stream parameters. More...
 
void XV_HdmiTx_SetPixelRate (XV_HdmiTx *InstancePtr)
 This function sets the pixel rate at output. More...
 
void XV_HdmiTx_SetSampleRate (XV_HdmiTx *InstancePtr, u8 SampleRate)
 This function sets the sample rate at output. More...
 
void XV_HdmiTx_SetColorFormat (XV_HdmiTx *InstancePtr)
 This function sets the color format. More...
 
void XV_HdmiTx_SetColorDepth (XV_HdmiTx *InstancePtr)
 This function sets the color depth. More...
 
void XV_HdmiTx_DdcInit (XV_HdmiTx *InstancePtr, u32 Frequency)
 This function prepares TX DDC peripheral to use. More...
 
int XV_HdmiTx_DdcGetAck (XV_HdmiTx *InstancePtr)
 This function gets the acknowledge flag. More...
 
int XV_HdmiTx_DdcWaitForDone (XV_HdmiTx *InstancePtr)
 This function waits for the done flag to be set. More...
 
void XV_HdmiTx_DdcWriteCommand (XV_HdmiTx *InstancePtr, u32 Cmd)
 This function writes data into the command fifo. More...
 
u8 XV_HdmiTx_DdcReadData (XV_HdmiTx *InstancePtr)
 This function reads data from the data fifo. More...
 
int XV_HdmiTx_DdcWrite (XV_HdmiTx *InstancePtr, u8 Slave, u16 Length, u8 *Buffer, u8 Stop)
 This function writes data from DDC peripheral from given slave address. More...
 
int XV_HdmiTx_DdcRead (XV_HdmiTx *InstancePtr, u8 Slave, u16 Length, u8 *Buffer, u8 Stop)
 This function reads data from DDC peripheral from given slave address. More...
 
u32 XV_HdmiTx_AuxSend (XV_HdmiTx *InstancePtr)
 This function transmits the infoframes generated by the processor. More...
 
void XV_HdmiTx_DebugInfo (XV_HdmiTx *InstancePtr)
 This function prints stream and timing information on STDIO/Uart console. More...
 
int XV_HdmiTx_IsStreamScrambled (XV_HdmiTx *InstancePtr)
 This function provides status of the stream. More...
 
int XV_HdmiTx_IsStreamConnected (XV_HdmiTx *InstancePtr)
 This function provides the stream connected status. More...
 
int XV_HdmiTx_SetAudioChannels (XV_HdmiTx *InstancePtr, u8 Value)
 This function sets the active audio channels. More...
 

Function Documentation

◆ XV_HdmiTx_AuxSend()

u32 XV_HdmiTx_AuxSend ( XV_HdmiTx InstancePtr)

This function transmits the infoframes generated by the processor.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
  • XST_SUCCESS if infoframes transmitted successfully.
  • XST_FAILURE if AUX FIFO is full.
Note
None.

References XV_HdmiTx::Aux, XV_HdmiTx_Config::BaseAddress, XV_HdmiTx::Config, XV_HdmiTx_AuxHeader::Data, XV_HdmiTx_AuxData::Data, XV_HdmiTx_Aux::Data, XV_HdmiTx_Aux::Header, XV_HDMITX_AUX_DAT_OFFSET, XV_HDMITX_AUX_STA_FIFO_FUL_MASK, XV_HDMITX_AUX_STA_OFFSET, XV_HDMITX_AUX_STA_PKT_RDY_MASK, XV_HdmiTx_ReadReg, and XV_HdmiTx_WriteReg.

◆ XV_HdmiTx_CfgInitialize()

int XV_HdmiTx_CfgInitialize ( XV_HdmiTx InstancePtr,
XV_HdmiTx_Config CfgPtr,
UINTPTR  EffectiveAddr 
)

This function initializes the HDMI TX core.

This function must be called prior to using the HDMI TX core. Initialization of the HDMI TX includes setting up the instance data and ensuring the hardware is in a quiescent state.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
CfgPtrpoints to the configuration structure associated with the HDMI TX core.
EffectiveAddris the base address of the device. If address translation is being used, then this parameter must reflect the virtual base address. Otherwise, the physical address should be used.
Returns
  • XST_SUCCESS if XV_HdmiTx_CfgInitialize was successful.
  • XST_FAILURE if HDMI TX PIO ID mismatched.
Note
None.

References XV_HdmiTx_Config::BaseAddress, XV_HdmiTx::Config, and XV_HdmiTx::ConnectCallback.

◆ XV_HdmiTx_Clear()

void XV_HdmiTx_Clear ( XV_HdmiTx InstancePtr)

This function clear the HDMI TX variables and sets it to the defaults.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
Note
This is required after a reset or init.

◆ XV_HdmiTx_ClockRatio()

int XV_HdmiTx_ClockRatio ( XV_HdmiTx InstancePtr)

This function controls the TMDS clock ratio.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
  • XST_SUCCESS if HDMI 2.0
  • XST_FAILURE if HDMI 1.4
Note
None.

References XV_HdmiTx_Stream::IsHdmi20, XV_HdmiTx::Stream, XV_HdmiTx_Stream::TMDSClockRatio, XV_HdmiTx_DdcRead(), and XV_HdmiTx_DdcWrite().

Referenced by XV_HdmiTx_SetStream().

◆ XV_HdmiTx_DdcGetAck()

int XV_HdmiTx_DdcGetAck ( XV_HdmiTx InstancePtr)

This function gets the acknowledge flag.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Note
None.

References XV_HdmiTx_Config::BaseAddress, XV_HdmiTx::Config, XV_HDMITX_DDC_STA_ACK_MASK, XV_HDMITX_DDC_STA_OFFSET, and XV_HdmiTx_ReadReg.

Referenced by XV_HdmiTx_DdcRead(), and XV_HdmiTx_DdcWrite().

◆ XV_HdmiTx_DdcInit()

void XV_HdmiTx_DdcInit ( XV_HdmiTx InstancePtr,
u32  Frequency 
)

This function prepares TX DDC peripheral to use.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Frequencyspecifies the value that needs to be set.
Returns
None.
Note
None.

Referenced by XV_HdmiTx_SetAxiClkFreq().

◆ XV_HdmiTx_DdcRead()

int XV_HdmiTx_DdcRead ( XV_HdmiTx InstancePtr,
u8  Slave,
u16  Length,
u8 *  Buffer,
u8  Stop 
)

This function reads data from DDC peripheral from given slave address.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Slavespecifies the slave address from where data needs to be read.
Lengthspecifies number of bytes to be read.
Bufferspecifies a pointer to u8 variable that will be filled with data.
Stopspecifies the stop flag which is either TRUE/FALSE.
Returns
  • XST_SUCCESS if an acknowledgement received and timeout.
  • XST_FAILURE if no acknowledgement received.
Note
None.

References XV_HDMITX_DDC_CMD_RD_TOKEN, XV_HDMITX_DDC_CMD_STP_TOKEN, XV_HDMITX_DDC_CMD_STR_TOKEN, XV_HDMITX_DDC_CMD_WR_TOKEN, XV_HdmiTx_DdcDisable, XV_HdmiTx_DdcEnable, XV_HdmiTx_DdcGetAck(), XV_HdmiTx_DdcIntrDisable, XV_HdmiTx_DdcReadData(), XV_HdmiTx_DdcWaitForDone(), and XV_HdmiTx_DdcWriteCommand().

Referenced by XV_HdmiTx_ClockRatio(), XV_HdmiTx_Scrambler(), and XV_HdmiTx_ShowSCDC().

◆ XV_HdmiTx_DdcReadData()

u8 XV_HdmiTx_DdcReadData ( XV_HdmiTx InstancePtr)

This function reads data from the data fifo.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Note
None.

References XV_HdmiTx_Config::BaseAddress, XV_HdmiTx::Config, XV_HDMITX_DDC_CTRL_OFFSET, XV_HDMITX_DDC_CTRL_RUN_MASK, XV_HDMITX_DDC_DAT_OFFSET, XV_HDMITX_DDC_STA_DAT_EMPTY, XV_HDMITX_DDC_STA_OFFSET, and XV_HdmiTx_ReadReg.

Referenced by XV_HdmiTx_DdcRead().

◆ XV_HdmiTx_DdcWaitForDone()

int XV_HdmiTx_DdcWaitForDone ( XV_HdmiTx InstancePtr)

◆ XV_HdmiTx_DdcWrite()

int XV_HdmiTx_DdcWrite ( XV_HdmiTx InstancePtr,
u8  Slave,
u16  Length,
u8 *  Buffer,
u8  Stop 
)

This function writes data from DDC peripheral from given slave address.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Slavespecifies the slave address from where data needs to be read.
Lengthspecifies number of bytes to be read.
Bufferspecifies a pointer to u8 variable that will be filled with data.
Stopspecifies the stop flag which is either TRUE/FALSE.
Returns
  • XST_SUCCESS if an acknowledgement received and timeout.
  • XST_FAILURE if no acknowledgement received.
Note
None.

References XV_HDMITX_DDC_CMD_STP_TOKEN, XV_HDMITX_DDC_CMD_STR_TOKEN, XV_HDMITX_DDC_CMD_WR_TOKEN, XV_HdmiTx_DdcDisable, XV_HdmiTx_DdcEnable, XV_HdmiTx_DdcGetAck(), XV_HdmiTx_DdcIntrDisable, XV_HdmiTx_DdcWaitForDone(), and XV_HdmiTx_DdcWriteCommand().

Referenced by XV_HdmiTx_ClockRatio(), XV_HdmiTx_DetectHdmi20(), XV_HdmiTx_Scrambler(), and XV_HdmiTx_ShowSCDC().

◆ XV_HdmiTx_DdcWriteCommand()

void XV_HdmiTx_DdcWriteCommand ( XV_HdmiTx InstancePtr,
u32  Cmd 
)

This function writes data into the command fifo.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Note
None.

References XV_HdmiTx_Config::BaseAddress, XV_HdmiTx::Config, XV_HDMITX_DDC_CMD_OFFSET, XV_HDMITX_DDC_CTRL_OFFSET, XV_HDMITX_DDC_CTRL_RUN_MASK, XV_HDMITX_DDC_STA_CMD_FULL, XV_HDMITX_DDC_STA_OFFSET, XV_HdmiTx_ReadReg, and XV_HdmiTx_WriteReg.

Referenced by XV_HdmiTx_DdcRead(), and XV_HdmiTx_DdcWrite().

◆ XV_HdmiTx_DebugInfo()

void XV_HdmiTx_DebugInfo ( XV_HdmiTx InstancePtr)

This function prints stream and timing information on STDIO/Uart console.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
None.
Note
None.

References XV_HdmiTx::Stream, and XV_HdmiTx_Stream::Video.

◆ XV_HdmiTx_DetectHdmi20()

int XV_HdmiTx_DetectHdmi20 ( XV_HdmiTx InstancePtr)

This function detects connected sink is a HDMI 2.0/HDMI 1.4 sink device and sets appropriate flag in the TX stream.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
  • XST_SUCCESS if HDMI 2.0
  • XST_FAILURE if HDMI 1.4
Note
None.

References XV_HdmiTx_Stream::IsHdmi20, XV_HdmiTx::Stream, and XV_HdmiTx_DdcWrite().

◆ XV_HdmiTx_IsStreamConnected()

int XV_HdmiTx_IsStreamConnected ( XV_HdmiTx InstancePtr)

This function provides the stream connected status.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
  • TRUE = Stream is connected.
  • FALSE = Stream is connected.
Note
None.

References XV_HdmiTx_Stream::IsConnected, and XV_HdmiTx::Stream.

◆ XV_HdmiTx_IsStreamScrambled()

int XV_HdmiTx_IsStreamScrambled ( XV_HdmiTx InstancePtr)

This function provides status of the stream.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
  • TRUE = Scrambled.
  • FALSE = Not scrambled.
Note
None.

References XV_HdmiTx_Stream::IsScrambled, and XV_HdmiTx::Stream.

◆ XV_HdmiTx_LookupVic()

u8 XV_HdmiTx_LookupVic ( XVidC_VideoMode  VideoMode)

This function provides video identification code of video mode.

Parameters
VideoModespecifies resolution identifier.
Returns
Video identification code defined in the VIC table.
Note
None.

Referenced by XV_HdmiTx_SetStream().

◆ XV_HdmiTx_Scrambler()

int XV_HdmiTx_Scrambler ( XV_HdmiTx InstancePtr)

This function controls the scrambler.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
  • XST_SUCCESS if HDMI 2.0
  • XST_FAILURE if HDMI 1.4
Note
None.

References XV_HdmiTx_Stream::IsHdmi20, XV_HdmiTx_Stream::IsScrambled, XV_HdmiTx::Stream, XV_HdmiTx_DdcRead(), XV_HdmiTx_DdcWrite(), and XV_HdmiTx_SetScrambler.

Referenced by XV_HdmiTx_SetStream().

◆ XV_HdmiTx_SetAudioChannels()

int XV_HdmiTx_SetAudioChannels ( XV_HdmiTx InstancePtr,
u8  Value 
)

This function sets the active audio channels.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
  • XST_SUCCESS if active channels were set.
  • XST_FAILURE if no active channles were set.
Note
None.

References XV_HDMITX_AUD_CTRL_CH_SHIFT, XV_HDMITX_AUD_CTRL_CLR_OFFSET, XV_HDMITX_AUD_CTRL_OFFSET, XV_HDMITX_AUD_CTRL_RUN_MASK, XV_HDMITX_AUD_CTRL_SET_OFFSET, and XV_HdmiTx_WriteReg.

◆ XV_HdmiTx_SetAxiClkFreq()

void XV_HdmiTx_SetAxiClkFreq ( XV_HdmiTx InstancePtr,
u32  ClkFreq 
)

This function sets the AXI4-Lite Clock Frequency.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
ClkFreqspecifies the value that needs to be set.
Returns
Note
This is required after a reset or init.

References XV_HdmiTx_DdcInit().

◆ XV_HdmiTx_SetColorDepth()

void XV_HdmiTx_SetColorDepth ( XV_HdmiTx InstancePtr)

◆ XV_HdmiTx_SetColorFormat()

void XV_HdmiTx_SetColorFormat ( XV_HdmiTx InstancePtr)

◆ XV_HdmiTx_SetDviMode()

void XV_HdmiTx_SetDviMode ( XV_HdmiTx InstancePtr)

This function sets the core into DVI mode.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
Note
This is required after a reset or init.

References XV_HdmiTx_Stream::IsHdmi, XV_HdmiTx::Stream, XV_HdmiTx_AudioDisable, XV_HdmiTx_AuxDisable, and XV_HdmiTx_ClearMode.

◆ XV_HdmiTx_SetHdmiMode()

void XV_HdmiTx_SetHdmiMode ( XV_HdmiTx InstancePtr)

This function sets the core into HDMI mode.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
Note
This is required after a reset or init.

References XV_HdmiTx_Stream::IsHdmi, XV_HdmiTx::Stream, and XV_HdmiTx_SetMode.

◆ XV_HdmiTx_SetPixelRate()

void XV_HdmiTx_SetPixelRate ( XV_HdmiTx InstancePtr)

This function sets the pixel rate at output.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
None.
Note
None.

References XV_HdmiTx_Config::BaseAddress, XV_HdmiTx::Config, XV_HdmiTx::Stream, XV_HdmiTx_Stream::Video, XV_HDMITX_PIO_OUT_MSK_OFFSET, XV_HDMITX_PIO_OUT_OFFSET, XV_HDMITX_PIO_OUT_PIXEL_RATE_MASK, XV_HDMITX_PIO_OUT_PIXEL_RATE_SHIFT, and XV_HdmiTx_WriteReg.

Referenced by XV_HdmiTx_SetStream().

◆ XV_HdmiTx_SetSampleRate()

void XV_HdmiTx_SetSampleRate ( XV_HdmiTx InstancePtr,
u8  SampleRate 
)

This function sets the sample rate at output.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
SampleRatespecifies the value that needs to be set.
  • 3 samples per clock.
  • 5 samples per clock.
Returns
None.
Note
None.

References XV_HdmiTx_Config::BaseAddress, XV_HdmiTx::Config, XV_HdmiTx_Stream::SampleRate, XV_HdmiTx::Stream, XV_HDMITX_PIO_OUT_MSK_OFFSET, XV_HDMITX_PIO_OUT_OFFSET, XV_HDMITX_PIO_OUT_SAMPLE_RATE_MASK, XV_HDMITX_PIO_OUT_SAMPLE_RATE_SHIFT, and XV_HdmiTx_WriteReg.

◆ XV_HdmiTx_SetStream()

u32 XV_HdmiTx_SetStream ( XV_HdmiTx InstancePtr,
XVidC_VideoMode  VideoMode,
XVidC_ColorFormat  ColorFormat,
XVidC_ColorDepth  Bpc,
XVidC_PixelsPerClock  Ppc,
XVidC_3DInfo *  Info3D 
)

This function sets the HDMI TX stream parameters.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
VideoModespecifies resolution identifier.
ColorFormatspecifies the type of color format.
  • 0 = XVIDC_CSF_RGB
  • 1 = XVIDC_CSF_YCRCB_444
  • 2 = XVIDC_CSF_YCRCB_422
  • 3 = XVIDC_CSF_YCRCB_420
Bpcspecifies the color depth/bits per color component.
  • 6 = XVIDC_BPC_6
  • 8 = XVIDC_BPC_8
  • 10 = XVIDC_BPC_10
  • 12 = XVIDC_BPC_12
  • 16 = XVIDC_BPC_16
Ppcspecifies the pixel per clock.
  • 1 = XVIDC_PPC_1
  • 2 = XVIDC_PPC_2
  • 4 = XVIDC_PPC_4
Returns
TmdsClock, reference clock calculated based on the input parameters.
Note
None.

In HDMI the colordepth in YUV422 is always 12 bits, although on the link itself it is being transmitted as 8-bits. Therefore if the colorspace is YUV422, then force the colordepth to 12 bits.

References XV_HdmiTx_Stream::IsHdmi20, XV_HdmiTx_Stream::IsScrambled, XV_HdmiTx_Stream::PixelClk, XV_HdmiTx::Stream, XV_HdmiTx_Stream::TMDSClock, XV_HdmiTx_Stream::TMDSClockRatio, XV_HdmiTx_Stream::Vic, XV_HdmiTx_Stream::Video, XV_HdmiTx_ClockRatio(), XV_HdmiTx_LookupVic(), XV_HdmiTx_Scrambler(), XV_HdmiTx_SetColorDepth(), XV_HdmiTx_SetColorFormat(), and XV_HdmiTx_SetPixelRate().

◆ XV_HdmiTx_ShowSCDC()

void XV_HdmiTx_ShowSCDC ( XV_HdmiTx InstancePtr)

This function shows the sinks SCDC registers.

Parameters
InstancePtris a pointer to the XV_HdmiTx core instance.
Returns
None.
Note
None.

References XV_HdmiTx_DdcRead(), and XV_HdmiTx_DdcWrite().