/**
 * @file drv_hdmi_inc.h
 * @brief HDMI RX driver layer interface.
 * @verbatim
 * ==============================================================================
 *                        ##### How to use this driver #####
 * ==============================================================================
 * (+) Use HS_HAL_WDT_Start(...) to start the wdt immediately.
 * (+) Use HS_HAL_WDT_Stop(...) to stop the wdt immediately.
 * (+) Use HS_HAL_WDT_Feed(...) to feed the watchdog and it will restart the counter immediately. 
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 0.0.1
 * @date 2022-08-22
 */

#ifndef __HV_CAL_HDMIINC_H__
#define __HV_CAL_HDMIINC_H__

#include "Common/hv_comm_DataType.h"
#include "hv_cal_HdmiRx.h"
#include "hv_comm_Define.h"
#include "ProjectConfig.h"

typedef struct _HdmiRxLaneCED
{
    USHORT16      usLane0CED;
    USHORT16      usLane1CED;
    USHORT16      usLane2CED;
    USHORT16      usLane3CED;
}HdmiRxLaneCED;

typedef struct _CalAmdSpdInfoParam
{
    BOOL        bFreeSyncSupported;
    BOOL        bFreeSyncEnabled;   /* Sync Should Prapared to Entered FreeSync */
    BOOL        bFreeSyncActive;    /* Entered the Frame changed status */
    BOOL        bNativeColorSpaceActive;
    BOOL        bLocalDimmingDisabled; /* 1: disabled Local Dimming. 0: enable the Local Dimming */
    BOOL        bGamma26EOTFActive;
    BOOL        bGamma22EOTFActive;
    BOOL        bBT709EOTFActive;
    BOOL        bSRGBEOTFActive;
    UCHAR8      ucVersion;
    UCHAR8      ucFreeSyncMinReFresh;
    UCHAR8      ucFreeSyncMaxReFresh;
    UCHAR8      ucBrightneesControl;
}CalAmdSpdInfoParam;

typedef struct _CalNvidiaVendSpecInfoParam
{
    UCHAR8          ucModeName[HV_VENDOR_DESCRIP_LEN];
    SouceInfoType   eSourceInfoCode;
}CalNvidiaVendSpecInfoParam;

typedef struct _CalVRRMDContent
{
    VfrVRRType  eVfrVrrType;
    BOOL        bVRREnable;      /* Including All VfrVRRType: bVRRGamingEnable and bVRRQMSEnable */
    UCHAR8      ucFVAFactorM1;   /* VfrVRRType_HDMIMDGamingFVA Only */
    UCHAR8      ucBase_Vfront;
    UCHAR8      ucNextTFR;       /* VfrVRRType_HDMIMDQMS Only */
    USHORT16    usBaseRefreshRate;
}CalVRRMDContent;

typedef struct _CalVRRInfoParam
{
    BOOL        bVRREnable;            /* HV_TRUE:Source Entered VRR; HV_HV_FALSE:Source Out Of VRR */
    VendorType  eVendor;               /* Type == VendorType_UnKnown±íÊ¾·ÇVRR±¨ÎÄ */
    union
    {
        CalAmdSpdInfoParam         stAmdSpdInfPara;
        CalNvidiaVendSpecInfoParam stNvidiaVSIPara;
        CalVRRMDContent            stCommVRRinMD;    /* HF-VRR with EMP */
    } uvsi;
}CalVRRInfoParam;

typedef struct _CalVideoTimingParam
{
    USHORT16 usHTotal;
    USHORT16 usHFProch;
    USHORT16 usHSyncW;
    USHORT16 usHBProch;
    USHORT16 usHActive;
    USHORT16 usHPol;
    USHORT16 usVTotal;
    USHORT16 usVFProch;
    USHORT16 usVSyncW;
    USHORT16 usVBProch;
    USHORT16 usVActive;
    USHORT16 usVPol;
    USHORT16 usFrameRate;
    BOOL     bInterlacedMode;       /* Interlace mode or not */
    BOOL     bIsEnterALLM;          /* ALLM Mode Open or Closed */
    BOOL     bIsNoSignal;   /* Ture：表示HDMI未解析出信号，无法SyncOK ,提示"No Signal"； 
                               False：表示HDMI可以正确识别信号，但是无法解析出Timing 及关键参数 AVI etc，提示"Not Support".
                               Only 返回 HV_FAILURE 时候该字段有意义 */
    UINT32   uiFreqKHz;             /* RX Received Pixel Clock KHz */
    UINT32   uiHFreqHz;             /*horizontal frequency*/
    UINT32   uiRxDpllSetFreqKHz;    /* RX dpll set Pixel Clock KHz: 0表示未配置，非0表示已经配置 */
    FLOAT32  fFrameRate;            /* Detail of the Frame rate Detected */
}CalVideoTimingParam;


#define MAX_PACKET_DATA_SIZE    28

typedef struct _PacketInfo
{
    UCHAR8 ucVersion;
    UCHAR8 ucLegth;
    UCHAR8 ucData[MAX_PACKET_DATA_SIZE];
}PacketInfo;

typedef struct _CalVideoColorParam
{
    ColorFormatType     eClrFormat;
    ColorSpaceType      eClrSpace;
    ColorDepthType      eClrDepth;
    ColorRangeType      eClrRange;
    CorlorContentType   eContent;
    UCHAR8              ucPixelRepe;
}CalVideoColorParam;

typedef struct _CalAudioPara
{
    AudioSampleRate  enSampleRate;
    AudioSampleDepth enSampleDepth;
    AudioCodingType  enCodingType;
    BOOL             bAudClkStable;
    UCHAR8           ucChnlCnt;
    UINT32           uiCtsValue;
    UINT32           uiNValue;
}CalAudioPara;

typedef struct _CalHDRParam
{
    HDREOTF xType;
    UCHAR8  ucMetaID;
    USHORT16 usPrimX0;
    USHORT16 usPrimY0;
    USHORT16 usPrimX1;
    USHORT16 usPrimY1;
    USHORT16 usPrimX2;
    USHORT16 usPrimY2;
    USHORT16 usWhtX;
    USHORT16 usWhtY;
    USHORT16 usMaxLum;
    USHORT16 usMinLum;
    USHORT16 usMaxCntn;
    USHORT16 usMaxFrmAvg;
}CalHDRParam;

/**
 * @brief Init the HDMI Interrupt At Beginning.
 * @param[in] ucPortIndex used for the HDMI RX.
 * @return 0: Success or 1: Fail.
 */
Status Hv_Cal_HdmiRx_InterruptInitEvent(UCHAR8 ucPortIndex);

/**
 * @brief Clear the HDMI Interrupt without any Event report.
 * @param[in] ucPortIndex used for the HDMI RX.
 * @param[in] pstHdmiIntRxStatus used for the Default Opened Interrupt Value.
 * @return 0: Success or 1: Fail.
 */
Status Hv_Cal_HdmiRx_InterruptClearEvent(UCHAR8 ucPortIndex, HdmiRxIntStatus *pstHdmiIntRxStatus);

/**
 * @brief HDMI Add InterruptEvent
 * @param[in] ucPortIndex used for the HDMI RX.
 * @return Status with 0: Success, 1: Failure.
 */
Status Hv_Cal_HdmiRx_AddInterruptEvent(UCHAR8 ucPortIndex, const HdmiRxIntStatus *pstHdmiIntRxStatus);

/**
 * @brief HDMI Remove InterruptEvent
 * @param[in] ucPortIndex used for the HDMI RX.
 * @return Status with 0: Success, 1: Failure.
 */

Status Hv_Cal_HdmiRx_RemoveInterruptEvent(UCHAR8 ucPortIndex, const HdmiRxIntStatus *pstHdmiIntRxStatus);

/**
 * @brief Init +5V/cable connect status detect.
 * @param[in]: Port Index of the cable
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_CableConnectInit(UCHAR8 ucPortIndex);

/**
 * @brief Get +5V/cable connect status software value.
 * @param[in] Port Index of the cable
 * @return Connected or Not.
 */
BOOL Hv_Cal_HdmiRx_GetCableStatus(UCHAR8 ucPortIndex);

/**
 * @brief Get +5V/cable connect status software value.
 * @param[in] Port Index of the cable
 * @return Connected or Not.
 */
BOOL Hv_Cal_HdmiRx_GetCableConnectStatus(UCHAR8 ucPortIndex);

/**
 * @brief Switch HDMI Rx mode.
 * @param[in] bEnable: 1 for HDMI 2.0, 0 for HDMI 2.1
 * @return VOID.
 */
Status Hv_Cal_HdmiRx_SetHdmi21Enable(UCHAR8 ucPortIndex, BOOL bEnable);

/**
 * @brief Set CEC default recieve address.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
**/
Status Hv_Cal_HdmiRx_CecInit(UCHAR8 ucPortIndex);

/**
 * @brief CEC send data.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
**/
Status Hv_Cal_HdmiRx_SendCecMsg(UCHAR8 ucPortIndex, UCHAR8 *pucBuf, UCHAR8 ucLen);

/**
 * @brief Set CEC revice data.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
**/
UCHAR8 Hv_Cal_HdmiRx_ReceiveCecMsg(UCHAR8 ucPortIndex, UCHAR8 *pucBuf);

/**
 * @brief Ddcci init on HDMI.
 * @param[in] Port Index of HDMI.
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_DdcInit(UCHAR8 ucPortIndex);

/**
 * @brief Action for the HDMI Enter the Standby.
 * @param[in] Port Index of HDMI.
 * @param[in] Status of Enter or Leave the standby.
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_EnterStandby(UCHAR8 ucPortIndex, BOOL bEnterStandby);

/**
 * @brief set the eq value which to be saved
 * @param[in] Port Index of HDMI.
 * @param[in] eq value.
 */
void Hv_Cal_HdmiRx_WriteEqToStandby(UCHAR8 ucPortIndex, UINT32 uiVal);

/**
 * @brief get the eq value which to be saved
 * @param[in] Port Index of HDMI.
 * @param[out] eq value.
 */
void Hv_Cal_HdmiRx_ReadEqFromStandby(UCHAR8 ucPortIndex, UINT32 *puiVal);

/**
 * @brief Received the DDCCI message.
 * @param[in] Port Index of HDMI.
 * @return Status of this Function and the msg from the DDC.
 */
UCHAR8 Hv_Cal_HdmiRx_RecvDdcMsg(UCHAR8 ucPortIndex, UCHAR8 *pucBuf);

/**
 * @brief Send the DDCCI message.
 * @param[in] Port Index of HDMI and the msg want to send with DDC.
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_SendDdcMsg(UCHAR8 ucPortIndex, UINT32 uiLen, UCHAR8 *pucBuf);

/**
 * @brief Clear the ddcci register.
 * @param[in] Port Index of HDMI.
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_ClrDdcSendReg(UCHAR8 ucPortIndex);

/**
 * @brief Clear the msg with NULL for DDC.
 * @param[in] Port Index of HDMI.
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_DdcNullMsg(UCHAR8 ucPortIndex, UCHAR8 *pucBuf);

/**
 * @brief Calculate the CheckSum of the DDC.
 * @param[in] Port Index of HDMI and the Value of the DDC message.
 * @return Check sum of Byte of the message.
 */
UCHAR8 Hv_Cal_HdmiRx_DdcCheckSum(UCHAR8 ucPortIndex, const UCHAR8 *pucBuf, UCHAR8 ucLen);

/**
 * @brief Set the DDC/CI on/off.
 * @param[in] Port Index of HDMI.
 * @param[in] 1: on, 0: off.
 */
VOID Hv_Cal_HdmiRx_DdcciEnable(UCHAR8 ucPortIndex, BOOL bEnable);

/**
 * @brief Set the DDC Slave Address.
 * @param[in] Port Index of HDMI.
 * @param[in] Slave Addr.
 */
VOID Hv_Cal_HdmiRx_SetDdcciAddr(UCHAR8 ucPortIndex, UCHAR8 ucSlvAddr);

/**
 * @brief Get the DDC Slave Address.
 * @param[in] Port Index of HDMI.
 * @return Status of this Function and the Address of the DDC Slave.
 */
Status Hv_Cal_HdmiRx_GetDdcSlvAddr(UCHAR8 ucPortIndex, UCHAR8 *pucSlvAddr);

/**
 * @brief Get the Interrupt status.
 * @param[in] Port Index of HDMI.
 * @return Status of the Interrupt.
 */
Status Hv_Cal_HdmiRx_GetInterruptEvent(UCHAR8 ucPortIndex, HdmiRxInterruptEvent * pstIntEvent);

/**
 * @brief Output Hotplug HIGH.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_HPDOn(UCHAR8 ucPortIndex);

/**
 * @brief Output Hotplug HIGH with the Source 5V provide HPD
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_HPDOnWithSource5V(UCHAR8 ucPortIndex);

/**
 * @brief Output Hotplug LOW.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_HPDOff(UCHAR8 ucPortIndex);

/**
 * @brief Output Hotplug LOW with the Source 5V provide HPD
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_HPDOffWithSource5V(UCHAR8 ucPortIndex);

/**
 * @brief Init Hotplug LOW.
 * @param[in]
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_HPDIOInit(UCHAR8 ucPortIndex);

/**
 * @brief Enable the HDMI Edid and Esegment.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_EdidReadEnable(UCHAR8 ucPortIndex);

/**
 * @brief Init hdmi IRQs trigger.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_SetInterruptTriggerRule(UCHAR8 ucPortIndex);

/**
 * @brief Clear hdmi IRQs status.
 * @param[in] Port Index of HDMI and the status handled for the interrupt.
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_ClearInterruptStatus(UCHAR8 ucPortIndex, HdmiRxInterruptEvent * pstIntEvent);

/**
 * @brief Closed the register EDID when the EDID Used the out device EEPROM.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_CloseRegisterEdid(UCHAR8 ucPortIndex);

/**
 * @brief Open the register EDID instead of the EDID Used the out device EEPROM.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_OpenRegisterEdid(UCHAR8 ucPortIndex, UCHAR8 ucSupportESegment);

/**
 * @brief Get hdmi events from hdmi IRQ status
 * @param[in] pstHdmiRxStatus: hdmi IRQ status, pstHdmiRxEventList: hdmi event list
 * @return HV_SUCCESS or HV_FAILURE
 */
Status Hv_Cal_HdmiRx_GetInputPortEvent(HdmiRxIntStatus *pstHdmiRxStatus, HDMIRxIntEventList *pstHdmiRxEventList);

/**
 * @brief Update the EDID of HDMI.
 * @param[in] Port Index of HDMI, EDID length and EDID Value.
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_UpdateEdidData(UCHAR8 ucPortIndex, USHORT16 usLength, const UCHAR8 *pucEdidData);

/**
 * @brief SCDC switch Control.
 * @param[in] Port Index of HDMI and the switch for the SCDC.
 * @param[in] The switch of the SCDC.
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_ControlScdcByHPDSwitch(UCHAR8 ucPortIndex, BOOL bSwitch);

/**
 * @brief SCDC Enable switch.
 * @param[in] Port Index of HDMI and the switch for the SCDC.
 * @param[in] The switch of the SCDC Enable.
 * @return None.
 */
VOID Hv_Cal_HdmiRx_EnableScdcBySwitch(UCHAR8 ucPortIndex, BOOL bSwitch);

/**
 * @brief Detect HDMI Rx aln lock.
 * @param[in] Port Index of HDMI.
 * @param[in] Clock Lane Swap ID.
 * @return HV_TRUE of HV_FALSE.
 */
BOOL Hv_Cal_HdmiRx_IsClockStable(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);

/**
 * @brief Detect HDMI Timing Statble.
 * @param[in] Port Index of HDMI
 * @return HV_TRUE of HV_FALSE.
 */
BOOL Hv_Cal_HdmiRx_IsTimingStable(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);

/**
 * @brief Reset the HDMI RX Moudle.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_Reset(UCHAR8 ucPortIndex);

/**
 * @brief Reset the HDMI RX Related PHY.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
 Status Hv_Cal_HdmiRx_ResetPhy(UCHAR8 ucPortIndex);

/**
 * @brief Reset the HDMI When Signal Loss.
 * @param[in] Port Index of HDMI
 * @return Status of this Function.
 */
Status Hv_Cal_HdmiRx_ResetSingLoss(UCHAR8 ucPortIndex);

/**
 * @brief Set the HDMI TMDS Pol Inv.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS as Received.
 */
Status Hv_Cal_HdmiRx_ConfigTmdsPolInv(UCHAR8 ucPortIndex, UCHAR8 ucTmdsPolInv);

/**
 * @brief Check if the HDMI Edid is Valid.
 * @param[in] Port Index of HDMI
 * @return HV_TRUE as Valid, HV_FALSE as Unvalid.
 */
BOOL Hv_Cal_HdmiRx_IsEdidInvalid(UCHAR8 ucPortIndex);

/**
 * @brief Get the EDID Value.
 * @param[in] Port Index of HDMI
 * @return Value of the EDID.
 */
Status Hv_Cal_HdmiRx_GetEdidData(UCHAR8 ucPortIndex, UCHAR8 *pucEdidData);

/**
 * @brief Set the Value for debug on Misc register.
 * @param[in] Port Index of HDMI
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetMiscForDebug(UCHAR8 ucPortIndex, UINT32 uiValue);

/**
 * @brief Get frl rate
 * @param[in] Port Index of HDMI
 * @return 0-6
 */
UCHAR8 Hv_Cal_HdmiRx_GetFrlRate(UCHAR8 ucPortIndex);

/**
 * @brief Get hdmi sink version
 * @param[in] Port Index of HDMI
 * @return 0 or 1
 */
UCHAR8 Hv_Cal_HdmiRx_GetSinkVersion(UCHAR8 ucPortIndex);

/**
 * @brief Get hdmi source version
 * @param[in] Port Index of HDMI
 * @return 0 or 1
 */
UCHAR8 Hv_Cal_HdmiRx_GetSourceVersion(UCHAR8 ucPortIndex);

/**
 * @brief Get hdmi TMDS bitclkratio
 * @param[in] Port Index of HDMI
 * @return 0 or 1
 */
UCHAR8 Hv_Cal_HdmiRx_GetScdcTmdsBitClkRatio(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);

/**
 * @brief Init hdmi TMDS link path.
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
//VOID Hv_Cal_HdmiRx_TmdsLinkInit(UCHAR8 ucPortIndex);

/**
 * @brief Init hdmi TMDS deskew setting.
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_TmdsDeskewInit(UCHAR8 ucPortIndex);

/**
 * @brief Init hdmi TMDS alignment setting.
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_TmdsCharacterAlignInit(UCHAR8 ucPortIndex);

/**
 * @brief Init hdmi TMDS lane clock setting.
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_TmdsLaneClockInit(UCHAR8 ucPortIndex);

/**
 * @brief TMDS 4-Lane settings
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_Tmds4LaneMode(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);

/**
 * @brief FRL 3-Lane settings
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_Frl3LaneMode(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);

/**
 * @brief FRL 4-Lane settings
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_Frl4LaneMode(UCHAR8 ucPortIndex);

/**
 * @brief HDMI Rx Lane mode switch.
 * @param[in]  Port Index of HDMI and Lane mode
 * @return VOID.
 */
VOID Hv_Cal_HdmiRX_PhyClockInit(UCHAR8 ucPortIndex, UCHAR8 ucLaneMode, UCHAR8 ucLaneSwap);

/**
 * @brief HDMI Rx Phy Gear Mode change.
 * @param[in] Port Index of HDMI and gear mode.
 * @return VOID.
 */
VOID Hv_Cal_HdmiRX_SwitchPhyGearMode(UCHAR8 ucPortIndex, HdmiRxGearMode ucGrearMode, UCHAR8 ucLaneSwap);

/**
 * @brief HDMI Rx Phy Gear Mode Robust checking.
 * @param[in] Port Index of HDMI and gear mode.
 * @return HV_TRUE for Ratio mode and HV_TRUE for Normal.
 */
BOOL Hv_Cal_HdmiRX_RobustCheckRatioMode(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);

/**
 * @brief Get Phy Gear Mode with freq.
 * @param[in] Port Index of HDMI and gear mode now configured.
 * @return Gear Mode of the new value.
 */
HdmiRxGearMode Hv_Cal_HdmiRx_GetGearMode(UCHAR8 ucPortIndex, HdmiRxGearMode emGearModeCfg, UCHAR8 ucLaneSwap);

/**
 * @brief Configure the PHY OFFSET.
 * @param[in] Port Index of HDMI.
 * @return HV_TRUE for HV_SUCCESS.
 */
BOOL Hv_Cal_HdmiRX_CfgPhyOffset(UCHAR8 ucPortIndex);

/**
 * @brief Init hdmi FRL link path.
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_FrlInit(UCHAR8 ucPortIndex);

/**
 * @brief Get HDMI Rx AVI info.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_GetAVIPara(UCHAR8 ucPortIndex, CalVideoColorParam *pstVideoAVIPara);

/**
 * @brief Get HDMI Rx audio info.
 * @param[in] Port Index of HDMI
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_GetAudioPara(UCHAR8 ucPortIndex, CalAudioPara *pstAudioPara);

/**
 * @brief Get AVI Info VIC.
 * @param[in] Port Index of HDMI
 * @return VIC in AVI.
 */
UCHAR8 Hv_Cal_HdmiRx_GetVic(UCHAR8 ucPortIndex);

/**
 * @brief Get TMDS Clk (KHz).
 * @param[in] Port Index of HDMI
 * @return
 */
UINT32 Hv_Cal_HdmiRx_GetTmdsClk(UCHAR8 ucPortIndex);

/**
 * @brief Get FrameRate.
 * @param[in] Port Index of HDMI
 * @return Frame Rate of the Timing.
 */
UINT32 Hv_Cal_HdmiRx_GetFrameRate(UCHAR8 ucPortIndex);

/**
 * @brief Get ColorFormat.
 * @param[in] Port Index of HDMI
 * @return The color format type of current Vedio, detail ref the define of ColorFormatType.
 */
ColorFormatType Hv_Cal_HdmiRx_GetColorFormat(UCHAR8 ucPortIndex);
/**
 * @brief Get Aspect Ratio for current Vedio.
 * @param[in] Port Index of HDMI
 * @return The ratio type aspected, detail ref the define of PicAspRatioType.
 */
PicAspRatioType Hv_Cal_HdmiRx_GetPicAspRatio(UCHAR8 ucPortIndex);

/**
 * @brief Get ColorDepth.
 * @param[in] Port Index of HDMI
 * @return
 */
ColorDepthType Hv_Cal_HdmiRx_GetColorDepth(UCHAR8 ucPortIndex);

/**
 * @brief Init hdmi SCDC and packet settings.
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
Status Hv_Cal_HdmiRx_Init(UCHAR8 ucPortIndex, UCHAR8 ucLanSwp);

/**
 * @brief Init hdmi SCDC and packet settings.
 * @param[in] Port Index of HDMI
 * @return VOID.
 */
VOID Hv_Cal_HdmiRx_InitWithCtsOn(UCHAR8 ucPortIndex);

/**
 * @brief Init HDMI Rx Audio path.
 * @param[in] Port Index of HDMI
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_AudioInit(UCHAR8 ucPortIndex);

/**
 * @brief Reset the Audio Fifo when the fifo is Overflow or Underflow.
 * @param[in] Port Index of HDMI
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_ResetAudioFifo(UCHAR8 ucPortIndex);

/**
 * @brief Reset the Audio of HDMI IP Inner.
 * @param[in] Port Index of HDMI
 * @return Status of the function.
 */
VOID Hv_Cal_HdmiRx_ResetSwAudio(UCHAR8 ucPortIndex);

/**
 * @brief Set the Audio Fifo Start Value.
 * @param[in] Port Index of HDMI, the value of the audio fifo to play.
 * @return Status of the function.
 */
 Status Hv_Cal_HdmiRx_SetAudioFifoStartValue(UCHAR8 ucPortIndex, UINT32 uiValue);

/**
 * @brief Toggle the Auto EQ switch for PHY.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_TogglePhyCtl(UCHAR8 ucPortIndex);

/**
 * @brief Get HDR data.
 * @param[in] Port Index of HDMI
 * @return Parameters of HDR send from Source.
 */
Status Hv_Cal_HdmiRx_GetHDRPara(UCHAR8 ucPortIndex, CalHDRParam *pstHDRPara);

/**
 * @brief Get ALLM mode From VSI.
 * @param[in] Port Index of HDMI
 * @return HV_TRUE: Get the ALLM mode from the HF-VSI. HV_FALSE: Leave the ALLM Mode
 */
BOOL Hv_Cal_HdmiRx_GetAllmModeInfo(UCHAR8 ucPortIndex, BOOL *pbAllmMode);

/**
 * @brief set video colordepth from GCP package.
 * @param[in] Port Index of HDMI
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetColorDepth(UCHAR8 ucPortIndex, UCHAR8 ucColorDepSelect, UCHAR8 ucColorDepValue);

/**
 * @brief Init hdmi phy settings.
 * @param[in] Port Index of HDMI
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_PhyInit(UCHAR8 ucPortIndex, UCHAR8 ucInvPn);

/**
 * @brief Parse the SPD of AMD.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE.
 * @return VRR value from the SPD.
 */
Status Hv_Cal_HdmiRx_GetAMDVendSpecInfoPara(UCHAR8 ucPortIndex, CalVRRInfoParam *pstVendSpecInfoPara);

/**
 * @brief Parse the SPD of NVIDIA.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE.
 * @return VRR value from the SPD.
 */
Status Hv_Cal_HdmiRx_GetSPDInfoPara(UCHAR8 ucPortIndex, CalVRRInfoParam *pstSPDPara);

/**
 * @brief Clear the Packet Fifo.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE.
 */
Status Hv_Cal_HdmiRx_ClearPacketFifo(UCHAR8 ucPortIndex);

/**
 * @brief Set the Packet type for the FIFO.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE.
 */
Status Hv_Cal_HdmiRx_SelectAndEnPacketFifo(UCHAR8 ucPortIndex);

/**
 * @brief Set the Packet FIFO thread hold.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE.
 */
Status Hv_Cal_HdmiRx_ConfigPacketFifoThreadhold(UCHAR8 ucPortIndex);

/**
 * @brief Get the Packet FIFO Data.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE and the date of the packet.
 */
Status Hv_Cal_HdmiRx_GetPacketData(UCHAR8 ucPortIndex, PacketInfo *pstPacketData);

/**
 * @brief Open the FIFO new entry interrput with new packet received handle.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE .
 */
Status Hv_Cal_HdmiRx_PacketFifoIntrruptInit(UCHAR8 ucPortIndex);

/**
 * @brief Clear of the MR Timing in HDMI RX.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE .
 */
Status Hv_Cal_HdmiRx_ClrMrTiming(UCHAR8 ucPortIndex);

/**
 * @brief Clear of the Aln Status Flag in HDMI RX.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE .
 */
 Status Hv_Cal_HdmiRx_ClrAlnChangFlag(UCHAR8 ucPortIndex);

/**
 * @brief Reset HDMI Aln and Deskew.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE .
 */
Status Hv_Cal_HdmiRx_ResetAlnDeskew(UCHAR8 ucPortIndex);

/**
 * @brief Clear HDMI Aln and Deskew.
 * @param[in] Port Index of HDMI
 * @return HV_SUCCESS or FAILSE .
 */
Status Hv_Cal_HdmiRx_ClrAlnDeskew(UCHAR8 ucPortIndex);

/**
 * @brief Get the Audio status.
 * @param[in] Port Index of HDMI
 * @return HV_TRUE is Status ready .
 */
BOOL Hv_Cal_HdmiRx_GetAudioStatus(UCHAR8 ucPortIndex);

/**
 * @brief Action for the Cable plug in or out.
 * @param[in] Port Index of HDMI and the cable status.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_CableConnectAction(UCHAR8 ucPortIndex, BOOL bCableSta, UCHAR8 ucLaneSwap);

/**
 * @brief Set the FRL mode.
 * @param[in] Port Index of HDMI and the Mode switch.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetFrlModeOn(UCHAR8 ucPortIndex, UCHAR8 ucModeSwitch);

/**
 * @brief Get the Pixel repeat factor.
 * @param[in] Port Index of HDMI.
 * @return Factor of the Pixel repeat.
 */
UINT32 Hv_Cal_HdmiRx_GetPixelRepeatFactor(UCHAR8 ucPortIndex);

/**
 * @brief Get the Interlace status.
 * @param[in] Port Index of HDMI.
 * @return 1 is for interlace .
 */
UINT32 Hv_Cal_HdmiRx_GetInterlacedStatus(UCHAR8 ucPortIndex);

/**
 * @brief Get the AvMute status.
 * @param[in] Port Index of HDMI.
 * @return True is for Enter AVMute .
 */
BOOL Hv_Cal_HdmiRx_GetAvMuteStatus(UCHAR8 ucPortIndex);
/**
 * @brief Change the Timing change check mode.
 * @param[in] Port Index of HDMI and frame rate report switch.
 * @return status of the function.
 */
Status Hv_Cal_HdmiRx_SetFrameRateTimingChange(UCHAR8 ucPortIndex, BOOL bRmvFrameRate);
/**
 * @brief Get the Segment value for EDDC.
 * @param[in] Port Index of HDMI.
 * @return Segment value from the source.
 */
UINT32 Hv_Cal_HDMIRX_GetSegment(UCHAR8 ucPortIndex);

/**
 * @brief Set the AVMute with HDMI autoly.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetAutoVmute(UCHAR8 ucPortIndex);

/**
 * @brief Closed the AVMute with HDMI autoly.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_ClearAutoVmute(UCHAR8 ucPortIndex);


/**
 * @brief Change the Timing change Frame rate threhold.
 * @param[in] Port Index of HDMI.
 * @param[in] Frame Rate of the threhold for timing change.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_ChangeFrameTh(UCHAR8 ucPortIndex, UINT32 uiFrameRateTh);

/**
 * @brief Set the value of the frequency.
 * @param[in] Port Index of HDMI.
 * @param[in] Lowest frequency and the Highest of the frequency.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetClkDetFreq(UCHAR8 ucPortIndex, UINT32 uiFreqLow, UINT32 uiFreqHigh);

/**
 * @brief Set the frequency of the Timing stable.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetTmdsTimeStableFreq(UCHAR8 ucPortIndex);

/**
 * @brief Set the Clock unstable interrupt switch.
 * @param[in] Port Index of HDMI switch of the interrupt.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetTmdsClkUnstableInterrupt(UCHAR8 ucPortIndex, BOOL bSwitch);

/**
 * @brief Get the Mata Date for the VRR with EMP(0x7F) Packet.
 * @param[in] Port Index of HDMI.
 * @return VRR parameters on EMP.
 */
Status Hv_Cal_HdmiRx_GetMDVrrPara(UCHAR8 ucPortIndex, CalVRRInfoParam* pstVrrMdPara);

/**
 * @brief Set the HDCP Rx Status for retriger the HDCP 2x Auth.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetHDCPRxStatus(UCHAR8 ucPortIndex);

/**
 * @brief Open or Closed the packet error interrupt.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetPacketErrorInt(UCHAR8 ucPortIndex, BOOL bSwitch);

/**
 * @brief Clear the Packet Error Value.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_ClearCEDValue(UCHAR8 ucPortIndex);

/**
 * @brief Get the Packet Error Value.
 * @param[in] Port Index of HDMI.
 * @return Number of the CED Value.
 */
Status Hv_Cal_HdmiRx_GetLaneCEDValue(UCHAR8 ucPortIndex, HdmiRxLaneCED *pstLaneCedValue, UCHAR8 ucLaneSwap);

/**
 * @brief Set the Timing info on Manu Factor of SCDC which is used for Auto testing checking.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetTimingToManuFactorSpec(UCHAR8 ucPortIndex, CalVideoTimingParam *pstTimingPara);

/**
 * @brief Set the SCDC Manu Factor.
 * @param[in] Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_InitSCDCManuFactor(UCHAR8 ucPortIndex, CHAR8 *pacManufact, UINT32 uiMManufactOUI);

/**
 * @brief Get the Interrupt Enable value for Print.
 * @param[in] Port Index of HDMI.
 * @return The Interrupt status Value to configure.
 */
UINT32 Hv_Cal_HdmiRx_InterruptEnPrint(UCHAR8 ucPortIndex, UCHAR8 ucIntr);

/**
 * @brief Get Current Timing parameters decoded by HDMI.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[out] Details of the Timing parameters, including the H V CD information etc.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_GetTimingHVInfo(UCHAR8 ucPortIndex, CalVideoTimingParam *pstTimingPara, UCHAR8 ucLaneSwap);

/**
 * @brief Open the TMDS Auto EQ.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return None.
 */
VOID Hv_Cal_HdmiRx_OpenTmdsAutoEq(UCHAR8 ucPortIndex);

/**
 * @brief Open the FRL Auto EQ.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return None.
 */
VOID Hv_Cal_HdmiRx_OpenFrlAutoEq(UCHAR8 ucPortIndex);

/**
 * @brief Configure the Init EQ value to start.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[in] Eq Value to configure.
 * @return : Eq Value configured.
 */
UCHAR8 Hv_Cal_HdmiRx_CfgHdmiAutoEQInitValue(UCHAR8 ucPortIndex, UCHAR8 ucCfgEqInitValue);

/**
 * @brief Configure the Min Htotal for HDMI to Gen the Timing.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[in] Swith and the Min Htotal Value.
 * @return : None.
 */
VOID Hv_Cal_HdmiRx_ConfigureMinHtotal(UCHAR8 ucPortIndex, UCHAR8 ucCfgSwitch, USHORT16 usHtotalMinValue);

/**
 * @brief Get Current Audio CTS and N decode with packet.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[out] Value of CTS and N.
 * @return : None.
 */
VOID Hv_Cal_HdmiRx_GetAudioCurrentCTSN(UCHAR8 ucPortIndex, UINT32 *puiCTS, UINT32 *puiN);

/**
 * @brief Reset and clear the HDMI decoding para.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SWCfgReset(UCHAR8 ucPortIndex);

/**
 * @brief Checking if there is a stable timing decoded by the HDMI.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return HV_TRUE: No Stable timing ouput; HV_FALSE:Timing is stable for show.
 */
BOOL HV_Cal_HdmirRx_CheckNoTiming(UCHAR8 ucPortIndex);

/**
 * @brief Reset SCDC with the 5V Change.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return : None.
 */
VOID HV_Cal_HdmirRx_ResetScdcWith5V(UCHAR8 ucPortIndex);

/**
 * @brief Reset SCDC with the 5V Change.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return : None.
 */
VOID HV_Cal_HdmirRx_ResetScdcWith5VCtsOn(UCHAR8 ucPortIndex);

/**
 * @brief Get current AVI VIC for Timing checking.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return : VIC of the current AVI.
 */
UINT32 Hv_Cal_HdmiRx_GetVicForCurrentTiming(UCHAR8 ucPortIndex);

/**
 * @brief Check current AVI Change received or not.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return :Status of the AVI Change Status Received.
 */
UINT32 Hv_Cal_HdmiRx_GetAviChangeEvent(UCHAR8 ucPortIndex);

/**
 * @brief Check current HDMI Esegment received or not.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return HV_TRUE:Esegment Received; HV_FALSE:Esegment Not Received.
 */
BOOL Hv_Cal_HdmiRx_IsEsegmentIsrRcved(UCHAR8 ucPortIndex);

/**
 * @brief Get HDMI HDCP Interrupt Event Status.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the HDCP Interrupt.
 */
UINT32 Hv_Cal_HdmiRx_GetHdcpIsrStatus(UCHAR8 ucPortIndex);

/**
 * @brief Clear the HDCP2X Rx Status for Nothing Transfered to Source.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return None.
 */
VOID Hv_Cal_HdmiRx_ClearHDCPRxStatus(UCHAR8 ucPortIndex);

/**
 * @brief Get current HDMI Timing Vedio Mode.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return HV_TRUE:DVI Mode; HV_FALSE:HDMI Mode.
 */
BOOL Hv_Cal_HdmiRx_GetDviMode(UCHAR8 ucPortIndex);

/**
 * @brief Get Phy is Locked or not.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return HV_TRUE : PHY Is locked; HV_FALSE : PHY is UnLocked.
 */
BOOL Hv_Cal_HdmiRX_IsPhyLocked(UCHAR8 ucPortIndex);

/**
 * @brief Set the Frame Trigger Postion of Hdmi.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[in] HDMI OSR value for the frequency.
 * @return Status of the function.
 */
VOID Hv_Cal_HdmiRx_ConfigureFrmTrigPos(UCHAR8 ucPortIndex, UCHAR8 ucGrearMode);

/**
 * @brief Set the HDCP Hdmi Mode.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[in] bHdmiMode 1 for HDMI and 0 for DVI.
 * @return Status of the function.
 */
VOID Hv_Cal_HdmiRx_SetHDCPHdmiMode(UCHAR8 ucPortIndex, BOOL bHdmiMode);
VOID Hv_Cal_HdmiRx_SetHDCP1Xstatus(UCHAR8 ucPortIndex, BOOL bHdmiMode);

/**
 * @brief Set the EQ with Software confiured.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_EnterTmdsSwEq(UCHAR8 ucPortIndex);

/**
 * @brief Set the EQ with Hardeware Auto confiured.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_EnterTmdsHwAutoEq(UCHAR8 ucPortIndex);

/**
 * @brief Finished the EQ Configure.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_FinishTmdsSwEq(UCHAR8 ucPortIndex);

/**
 * @brief Set the EQ with Confgiure Date.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[in] pusSwEqValue The 3Lane Eq Value to be configured 
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetSwEqValue(UCHAR8 ucPortIndex, const USHORT16 *pusSwEqValue, UCHAR8 ucLaneSwap);

/**
 * @brief Check the TMDS Signal.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return HV_TRUE : Received the TMDS signal; HV_FALSE : Do not receive the Signal.
 */
BOOL Hv_Cal_HdmiRx_CheckTmdsSignal(UCHAR8 ucPortIndex);

/**
 * @brief Open the Packet Fifo of the HDMI.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_OpenPdFifo(UCHAR8 ucPortIndex);

/**
 * @brief Close the Packet Fifo of HDMI.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_ClosedPdFifo(UCHAR8 ucPortIndex);

/**
 * @brief Release the Phase configure.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_ReleasePhaseConfig(UCHAR8 ucPortIndex);

/**
 * @brief Configure the Phase with the color depth.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @param[in] Color Deepth of the HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_PhaseConfig(UCHAR8 ucPortIndex, ColorDepthType eColorDeepth);

/**
 * @brief Remove the Interrupt Event of the HDCP.
 * @param[in] ucPortIndex Port Index of HDMI.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_InterruptRmHdcpEvent(UCHAR8 ucPortIndex);

/**
 * @brief Reset The TMDS Pre of Sw.
 * @param[in] Port Number used for the HDMI RX.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_TmdsSwReset(UCHAR8 ucPortIndex);

/**
 * @brief Reset The TMDS Pre of Bus.
 * @param[in] Port Number used for the HDMI RX.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_BusSwReset(UCHAR8 ucPortIndex);

/**
 * @brief Reset The Mode of Pixel.
 * @param[in] Port Number used for the HDMI RX.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_PixelSwReset(UCHAR8 ucPortIndex);

/**
 * @brief Reset The Mode of Vid.
 * @param[in] Port Number used for the HDMI RX.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_VidSwReset(UCHAR8 ucPortIndex);

/**
 * @brief If the PHY is fast locked.
 * @param[in] Port Number used for the HDMI RX.
 * @return TRUE is Loced False is unlocked.
 */
BOOL Hv_Cal_HdmiRX_IsPhyFastLocked(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);

/**
 * @brief Set Sw EQ form the HW Eq Value.
 * @param[in] Port Number used for the HDMI RX.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetSwEqFromHwValue(UCHAR8 ucPortIndex);

/**
 * @brief If the EQ is configured with Software EQ.
 * @param[in] Port Number used for the HDMI RX.
 * @return TRUE is Loced False is unlocked.
 */
BOOL Hv_Cal_HdmiRx_IsTmdsSwEqCfgured(UCHAR8 ucPortIndex);

/**
 * @brief Get the TMDS Clock Frequency.
 * @param[in] Port Number used for the HDMI RX.
 * @return Value of the TMDS Clock Freqency with 100K.
 */
USHORT16 Hv_Cal_HdmiRx_GetTmdsClkFreq(UCHAR8 ucPortIndex);

/**
 * @brief check ddc current state
 * @param[in] port id
 * @return value of the check result
 */
BOOL Hv_Cal_HdmiRx_DdcCurStateIsIdle(UCHAR8 ucPortIndex);

/**
 * @brief Set HDMI Audio CTS N Measue N or CTS
 * @param[in] port id
 * @param[in] Measure Mode : 1 For Cts, 2 is N, 0 is reset.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetCtsNMeasMode(UCHAR8 ucPortIndex, UCHAR8 ucMeasMode);
/**
 * @brief Set Audio Clock use the Auto or Manual
 * @param[in] port id
 * @param[in] TRUE is for the Manual Audio CTS N Mode
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SwitchAudioManualClk(UCHAR8 ucPortIndex, BOOL bAudioManual);

/**
 * @brief Set the Manual CTS Value used for Audio Clock
 * @param[in] port id
 * @param[in] Over Or Under Matched.
 * @param[in] Last configured OverFlow CTS Value.
 * @param[in] Last configured UnderFlow CTS Value.
 * @return Status of the function.
 */
USHORT16 HV_Cal_HdmiRx_ManualCtsValueSet(UCHAR8 ucPortIndex, BOOL bUnderFlow, USHORT16 uiLastOverValue, USHORT16 uiLastUnderValue);

/**
 * @brief Check Audio Clock if Normal with N 
 * @param[in] port id
 * @return Status of the function.
 */
BOOL Hv_Cal_HdmiRx_RobustCheckAudioManual(UCHAR8 ucPortIndex);

/**
 * @brief check and restore audio fifo
 * @param[in] Port Number used for the HDMI RX.
 */
VOID Hv_Cal_HdmiRx_AudioCheck(UCHAR8 ucPortId);
/**
 * @brief Start Receive CEC Message. 
 * @param[in] port id
 * @return NONE.
 */
void Hv_Cal_HdmiRx_StartRcvCecMsg(UCHAR8 ucPortIndex);

/**
 * @brief reload color depth reg
 * @param[in] Port Number used for the HDMI RX.
 */
VOID Hv_Cal_HdmiRx_ReloadColorDepth(UCHAR8 ucPortIndex);

/**
 * @brief Phy Sw Trigger to configure
 * @param[in] port id
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_PhyCfgSwTrig(UCHAR8 ucPortIndex);

/**
 * @brief Set Frl Flt Update Flag to retrain
 * @param[in] port id
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetFrlFltUpdate(UCHAR8 ucPortIndex);

/**
 * @brief Set Ri Update Autoly or not.
 * @param[in] port id
 * @param[in] Ri sel Value = 1 is Autoly.
 * @return Status of the function.
 */
Status Hv_Cal_HdmiRx_SetHdcp1XRiSel(UCHAR8 ucPortIndex, UCHAR8 ucRiSelValue);

/**
 * @brief If the PHY TMDS Clock Is OverFlow.
 * @param[in] Port Number used for the HDMI RX.
 * @return TRUE is OverFlow False is not OverFlow.
 */
BOOL Hv_Cal_HdmiRX_IsTMDSClockOverFlow(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);
BOOL Hv_Cal_HdmiRx_GetSourceCfgRatioMode(UCHAR8 ucPortIndex);
Status Hv_Cal_HdmiRx_RobustTmdsLockInLowBnd(UCHAR8 ucPortIndex);
Status Hv_Cal_HdmiRx_ReBackTmdsLockInLowBnd(UCHAR8 ucPortIndex);
Status Hv_Cal_HdmiRx_SetDviMode(UCHAR8 ucPortIndex, BOOL bDviMode);
Status Hv_Cal_HdmiRx_ClrDviMode(UCHAR8 ucPortIndex);
VOID Hv_Cal_HdmiRX_SwitchAutoEqTable(UCHAR8 ucPortIndex, BOOL bFreqLow);
Status Hv_Cal_HdmiRx_ConfigureEqCheckValue(UCHAR8 ucPortIndex, BOOL bStrick);
BOOL Hv_Cal_HdmiRx_CheckTmdsClockAbnormal(UCHAR8 ucPortIndex, UCHAR8 ucLaneSwap);
Status Hv_Cal_HdmiRx_SetEqByPass(UCHAR8 ucPortIndex, UCHAR8 ucBypass);
Status Hv_Cal_HdmiRx_GetHdmiAudioFsValue(UCHAR8 ucPortIndex, UINT32 *puiFs);
Status Hv_Cal_HdmiRx_ConfigurePhyRterm(UCHAR8 ucPortIndex, UCHAR8 ucRtermValue);
Status Hv_Cal_HdmiRx_SwitchCECFunc(UCHAR8 ucPortIndex, BOOL bSwitch);

#endif

