/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 *
 * $Author: wenming.wu $
 * $Date  $
 * $RCSfile: drv_hdmi.h,v $
 * $Revision: #11 $
 *
 *---------------------------------------------------------------------------*/
#ifndef _DRV_HDMICOM_H_
#define _DRV_HDMICOM_H_

#include "typedef.h"
#include "x_timer.h"
#include "drv_mhlcom.h"

#define HDMI2_COM_INVALID_FRAME_RATE 1 //Set 1 as invalid frame rate for calculation

typedef enum
{
    HDMI2ANA_DELAY_SAOSC,
    HDMI2ANA_DELAY_EQLOCK_HALF,
    HDMI2ANA_DELAY_EQLOCK_FULL,
    HDMI2ANA_DELAY_EQINCREASE,
    HDMI2ANA_DELAY_MAX
}HDMI2ANA_DELAY_ITEM;

typedef struct _HDMI2ANA_LEQ_ITEM
{
    BOOL fgLeak;
    BOOL fgAvg;
    BOOL fgLeak_Increase;
    BOOL fgLeak_Decrease;
    BOOL fgLEQ_Reduce;
}HDMI2ANA_LEQ_ITEM;

typedef struct _HDMI2ANA_CONFIG
{
    UINT16 au2DelayRatio[HDMI2ANA_DELAY_MAX]; //ratio*10%
    HDMI2ANA_LEQ_ITEM tLEQItem;
    UINT8 u1SAOSC_LFSEL;
    UINT8 u1EQOSC_LFSEL;
    BOOL fgSupport3GHDMI20;
    BOOL fgForce40xMode;
}HDMI2ANA_CONFIG;

extern void vHDMI2ComAnaEQ_OS_LF_SELSet(UINT16 u2HdmiAnaBase,UINT8 u1LfSel);

extern UINT8 bHDMI2ComAnaEQ_OS_LF_SELGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaLFSelValue_Set(UINT8 u1SAOSC_LFSelValue,UINT8 u1EQOSC_LFSelValue);

extern void vHDMI2ComAnaHYBiasSet(UINT16 u2HdmiAnaBase,UINT8 u1HYBias);

extern UINT8 bHDMI2ComAnaHYBiasGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaD2SBiasSet(UINT16 u2HdmiAnaBase,UINT8 u1D2SBias);

extern UINT8 bHDMI2ComAnaD2SBiasGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQBiasSet(UINT16 u2HdmiAnaBase,UINT8 u1EQBias);

extern UINT8 bHDMI2ComAnaEQBiasGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaKPGainSet(UINT16 u2HdmiAnaBase,UINT8 u1KPGain);

extern UINT8 bHDMI2ComAnaKPGainGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaRXModeSet(UINT16 u2HdmiAnaBase,UINT8 u1RXMode);

extern UINT8 bHDMI2ComAnaRXModeGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQGainSet(UINT16 u2HdmiAnaBase,UINT8 u1EQGain);

extern UINT8 bHDMI2ComAnaEQGainGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaGainBufSet(UINT16 u2HdmiAnaBase,UINT8 u1GainBuf);

extern UINT8 bHDMI2ComAnaGainBufGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaData_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb); //0:reset 1:reset release

extern void vHDMI2ComAnaEQALG_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb); //0:reset 1:reset release

extern void vHDMI2ComAnaCDR_RST(UINT16 u2HdmiAnaBase,UINT8 u1Rst); //0:reset release 1:reset

extern void vHDMI2ComAnaSAOSC_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb); //0:reset 1:reset release

extern void vHDMI2ComAnaEQOSC_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb); //0:reset 1:reset release

extern void vHDMI2ComAnaEQ_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb); //0:reset 1:reset release

extern void vHDMI2ComAnaEQIncrease_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb); //0:reset 1:reset release

extern void vHDMI2ComAnaAdjust_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb); //0:reset 1:reset release

extern void vHDMI2ComAnaCKDIV2_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb);

extern void vHDMI2ComAnaCKGEN_RSTB(UINT16 u2HdmiAnaBase,UINT8 u1Rstb);

extern void vHDMI2ComAnaPLL_EN(UINT16 u2HdmiAnaBase,UINT8 u1Enable);

extern void vHDMI2ComAnaDeepPLL_EN(UINT16 u2HdmiAnaBase,UINT8 u1Enable);

extern void vHDMI2ComAnaDebug1Ctrl_EN(UINT16 u2HdmiAnaBase,UINT8 u1Enable);

extern void vHDMI2ComAnaDelaySet(HDMI2ANA_DELAY_ITEM eDelayItem,UINT16 u2Delay);

extern UINT16 wHDMI2ComAnaDelayGet(HDMI2ANA_DELAY_ITEM eDelayItem);

extern void vHDMI2ComAnaSupport3GHDMI20(BOOL fgEnable);

extern void vHDMI2ComAnaForce40xMode(BOOL fgEnable);

extern void vHDMI2ComAnaConTestSet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaConControl(UINT16 u2HdmiAnaBase, UINT8 u1ConValue, UINT8 u1ConType);

extern void vHDMI2ComAnaLeqItemSet(HDMI2ANA_LEQ_ITEM *ptLeqItem);

extern void vHDMI2ComAnaLeqItemGet(HDMI2ANA_LEQ_ITEM *ptLeqItem);

extern void vHDMI2ComAnaDelayInit(void);

extern void vHDMI2ComAnaLeqItemInit(void);

extern void vHDMI2ComAnaDebugResetPar(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQMacroInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaSAOSCInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQOSCInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQDIGInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQIncreaseInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaAdjustInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaDebug1Init(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaDebug2Init(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaPLLInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaDeepPLLInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaInit(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaSetConMon(UINT16 u2HdmiAnaBase,UINT8 u1MonSel);

extern UINT8 bHDMI2ComAnaGetCDRLPO(UINT16 u2HdmiAnaBase,HdmiTmdsDataChannel_t eChannel);

extern UINT8 bHDMI2ComAnaGetAlgMonStatus(UINT16 u2HdmiAnaBase,UINT8 u1MonSel, HdmiTmdsDataChannel_t eChannel);

extern UINT8 bHDMI2ComAnaGetEQCtrl(UINT16 u2HdmiAnaBase,HdmiTmdsDataChannel_t eChannel);

extern UINT16 wHDMI2ComAnaGetDebug1Status(UINT16 u2HdmiAnaBase,UINT8 u1EvenSel, UINT8 u1MonSel, HdmiTmdsDataChannel_t eChannel);

extern BOOL bHDMI2ComAnaGetDebug1Ready(UINT16 u2HdmiAnaBase,HdmiTmdsDataChannel_t eChannel);

extern void vHDMI2ComAnaHalfRateSet(UINT16 u2HdmiAnaBase,BOOL b40xMode);

extern BOOL bHDMI2ComAnaHalfRateGet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQBandSet(UINT16 u2HdmiAnaBase,HdmiTmdsClkRate_t eBand, BOOL b40xMode);

extern void vHDMI2ComAnaPLLSet(UINT16 u2HdmiAnaBase,HdmiTmdsClkRate_t eBand, BOOL b40xMode);

extern void vHDMI2ComAnaDeepPLLSet(UINT16 u2HdmiAnaBase,HdmiTmdsClkRate_t eBand, BOOL b40xMode);

extern BOOL bHDMI2ComAnaAdjustRatioSet(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaDebug1CntTargetSet(UINT16 u2HdmiAnaBase,UINT32 u4CntTarget);

extern void vHDMI2ComAnaDebug1PatSet(UINT16 u2HdmiAnaBase,UINT16 u2PatMask, UINT16 u2TargetPat);

extern void vHDMI2ComAnaDebug1ParSet(UINT16 u2HdmiAnaBase,INT8 s1Par1,INT8 s1Par2);

extern void vHDMI2ComAnaPLLEnable(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaEQMacroEnable(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaDataReset(UINT16 u2HdmiAnaBase); //reserve for reset

extern void vHDMI2ComAnaEQALGReset(UINT16 u2HdmiAnaBase); //reserve for reset

extern void vHDMI2ComAnaSAOSC(UINT16 u2HdmiAnaBase,BOOL fgResetSAOSC);

extern void vHDMI2ComAnaSAOSCReset(UINT16 u2HdmiAnaBase); //reserve for reset

extern void vHDMI2ComAnaEQOSC(UINT16 u2HdmiAnaBase,BOOL fgResetEQOSC);

extern void vHDMI2ComAnaEQOSCReset(UINT16 u2HdmiAnaBase); //reserve for reset

extern void vHDMI2ComAnaCDRLock(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaCDRReset(UINT16 u2HdmiAnaBase); //reserve for reset

extern void vHDMI2ComAnaEQLock(UINT16 u2HdmiAnaBase,BOOL b40xMode, HDMI2ANA_LEQ_ITEM *ptLeqItem, BOOL fgResetEQ);

extern void vHDMI2ComAnaFixEQ(UINT16 u2HdmiAnaBase,BOOL bFix, UINT8 u1EQInitVal);

extern void vHDMI2ComAnaEQReset(UINT16 u2HdmiAnaBase,BOOL b40xMode, HDMI2ANA_LEQ_ITEM *ptLeqItem);

extern void vHDMI2ComAnaEQIncreaseEnable(UINT16 u2HdmiAnaBase,BOOL fgResetEQIncrease);

extern void vHDMI2ComAnaEQIncreaseReset(UINT16 u2HdmiAnaBase); //reserve for reset

extern void vHDMI2ComAnaAdjustEnable(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaAdjustReset(UINT16 u2HdmiAnaBase); //reserve for reset

extern void vHDMI2ComAnaDeepPLLEnable(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaTermCtrl(UINT16 u2HdmiAnaBase,BOOL bOnOff);

extern void vHDMI2ComAnaTMDSCtrl(UINT16 u2HdmiAnaBase,BOOL bOnOff);

extern void vHDMI2ComAnaAllReset(UINT16 u2HdmiAnaBase,BOOL b40xMode);

extern void vHDMI2ComAnaEqPostProcess6G(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaSetting(UINT16 u2HdmiAnaBase,HdmiTmdsClkRate_t eBand, BOOL b40xMode,BOOL fgFirstAnaSetting);

extern void vHDMI2ComAnaDebug1Enable(UINT16 u2HdmiAnaBase,BOOL bEnable);

extern void vHDMI2ComAnaDebug2Enable(UINT16 u2HdmiAnaBase);

extern void vHDMI2ComAnaSetLeq(UINT16 u2HdmiAnaBase,BOOL bEn);

extern void vHDMI2ComSetHdmiClkOn(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSetHdmiClkOff(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSetMhl2Clk(void);

extern void vHDMI2ComSetMhl3Clk(void);

extern void vHDMI2ComSetHdcpDdcEn(HdmiRxPort eHdmiPort,UINT8 u1En);

extern void vHDMI2MHLComHdcpSel(UINT8 u1Mhl);

extern void vHDMI2ComSetHdcpDdcDeglitch(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSetCcir0Clk(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSetCcir1Clk(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSelMainVideo(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSelAudio(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSelSubVideo(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSelW2DVideo(HdmiRxPort eHdmiPort);

extern void vHDMI2ComSelAacrCtrl(UINT16 u2HdmiBase,BOOL bEn);

extern BOOL fgHDMI2ComGetAudioPllCtrl(UINT16 u2HdmiBase);

extern BOOL fgHDMI2ComIsHdcp1xDecyptOn(UINT16 u2HdmiBase);

extern BOOL fgHDMI2ComIsHdcp2xDecyptOn(UINT16 u2HdmiBase);

extern void vHDMI2ComSetHdmiMode(void);

extern void vHDMI2ComSetMHL2NorMode(void);

extern void vHDMI2ComSetMHL2PpMode(void);

extern void vHDMI2ComSetMHL3NorMode(void);

extern void vHDMI2ComSetMHL3PpMode(void);

extern UINT32 dwHDMI2ComHTotal(UINT16 u2HdmiBase);

extern UINT32 dwHDMI2ComVTotalEven(UINT16 u2HdmiBase);

extern UINT32 dwHDMI2ComVTotalOdd(UINT16 u2HdmiBase);

extern UINT32 dwHDMI2ComVTotal(UINT16 u2HdmiBase);

extern UINT32 dwHDMI2ComHActive(UINT16 u2HdmiBase);

extern UINT32 dwHDMI2ComVActive(UINT16 u2HdmiBase);

extern UINT32 dwHDMI2ComFrameRate(UINT16 u2HdmiBase);

extern UINT32 dwHDMI2ComPixelClk(UINT16 u2HdmiBase);

//1:internal pattern gen
extern void vHDMI2ComPatternGenSet(UINT16 u2HdmiBase,UINT8 u1En);
extern BOOL fgHDMI2ComAnaCRC(UINT16 u2HdmiBase,UINT16 u2Times);
extern BOOL fgHDMI2ComGetSingleCRC(UINT16 u2HdmiBase,UINT32 *pu4Crc);

extern BOOL fgHDMI2ComCRC(UINT16 u2HdmiBase,UINT16 u2Times);

/**
 * @brief     Get HDMI AVMute status
 * @param    Base address by port
 * @retval    1:interlace,0:program
 */
extern BOOL fgHDMI2ComGetInterlaced(UINT16 u2HdmiBase);

/**
 * @brief     Get HDMI AVMute status
 * @param    Base address by port
 * @retval    1:mute,0:clear mute
 */
extern BOOL fgHDMI2ComGetMute(UINT16 u2HdmiBase);

extern BOOL fgHDMI2ComGetAvMute(UINT16 u2HdmiBase);

/**
 * @brief     Clear HDMI AVMute status
 * @param    Base address by port, enable or disable
 */
extern void vHDMI2ComClrAvMute(UINT16 u2HdmiBase,UINT8 u1En);

/**
 * @brief     Get HDMI mode status
 * @param    Base address by port
 * @retval    1:HDMI mode,0:DVI mode
 */
extern BOOL fgHDMI2ComGetHdmiMode(UINT16 u2HdmiBase);

/**
 * @brief     Get HDMI audio mute status
 * @param    Base address by port
 * @retval    1:mute,0:active
 */
extern BOOL fgHDMI2ComGetAudioMute(UINT16 u2HdmiBase);

/**
 * @brief     Get HDMI Tx scrambling en/dis status
 * @param    Base address by port
 * @retval    1:need descrambling input data,
             0:not need descrambling input data
 */
extern BOOL fgHDMI2ComGetScramblingBySCDC(UINT16 u2HdmiBase);

/**
 * @brief     Get HW en/dis scrambling status,default scrambling en/dis is controled by HW
 * @param    Base address by port
 * @retval    1:enable,
             0:disable
 */
extern BOOL fgHDMI2ComGetHWScramblingEn(UINT16 u2HdmiBase);


/**
 * @brief     Get TMDS clk ratio by scdc
 * @param    Base address by port
 * @retval    1:1/40,0:1/30
 */
extern BOOL fgHDMI2ComGetTmdsClkRatio(UINT16 u2HdmiBase);

/**
 * @brief     Get TMDS clk status
 * @param    Base address by port
 * @retval    1:clk active,0:no clk
 **/
extern BOOL fgHDMI2ComGetCKDT(UINT16 u2HdmiBase);

/**
 * @brief     Get SCDT status
 * @param    Base address by port
 * @retval    1:sync active,0:no scdt
 */
extern BOOL fgHDMI2ComGetSCDT(UINT16 u2HdmiBase);

/**
 * @brief     Get SCDT status
 * @param    Base address by port
 * @retval    1:sync active,0:no scdt
 */
extern UINT32 dwHDMI2ComGetCTS(UINT16 u2HdmiBase);

/**
 * @brief     Get SCDT status
 * @param    Base address by port
 * @retval    1:sync active,0:no scdt
 */
extern UINT32 dwHDMI2ComGetN(UINT16 u2HdmiBase);

/**
 * @brief     Get SCDT status
 * @param    Base address by port
 * @retval    1:sync active,0:no scdt
 */
extern UINT8 bHDMI2ComGetFs(UINT16 u2HdmiBase);

/**
 * @brief     Get SCDT status
 * @param    Base address by port
 * @retval    1:sync active,0:no scdt
 */
extern void vHDMI2ComGetChannelStatus(HdmiRxObject_t *HdmiRx);

/**
 * @brief     Get audio layout status
 * @param    Base address by port
 * @retval    1:up to 8 channel,0:2 channel
 */
extern BOOL fgHDMI2ComGetAudioLayout(UINT16 u2HdmiBase);

/**
 * @brief     Get audio layout status
 * @param    Base address by port
 * @retval    1:up to 8 channel,0:2 channel
 */
extern BOOL fgHDMI2ComGetAudFifo(UINT16 u2HdmiBase);


/**
 * @brief     Get deep color  status
 * @param    Base address by port
 * @retval    3:16 bit
             2:12 bit
             1:10 bit
             0:8 bit
 */
extern HdmiRxBitDepth_t bHDMI2ComGetDeepSta(UINT16 u2HdmiBase);

/**
 * @brief     Get SCDT status
 * @param    Base address by port
 * @retval    1:sync active,0:no scdt
 */
extern HdmiTmdsClkRate_t bHDMI2ComGetClkRate(UINT16 u2HdmiBase);

/**
 * @brief     Get infoframe data
 * @param    info type
 * @retval    1
 **/
extern void vHDMI2ComGetInfoframe(HdmiRxInfo_t *ptRxInfo,UINT16 u2HdmiBase,UINT8 Type);

/**
 * @brief set DDC enable or disable
 * @param    Base address by port,enable/disable
 * @retval    none
 **/
extern void vHDMI2ComSetHdcpDDC(UINT16 u2HdmiBase,UINT8 u1En);


/**
 * @brief     set split mode enable or disable
 * @param    Base address by port, enable or disable
 * @retval    none
 **/
extern void vHDMI2ComSetSplit(UINT16 u2HdmiBase,UINT8 u1En);

/**
 * @brief     set Scrambling mode enable or disable by sw,used for some 1.4 timing
 * @param    Base address by port, enable or disable
 * @retval    none
 **/
extern void vHDMI2ComSetScrambling(UINT16 u2HdmiBase,UINT8 u1En);

/**
 * @brief     set 420 enable or disable,used for 4k 420 timing
 * @param    Base address by port, enable or disable
 * @retval    none
 **/
extern void vHDMI2ComSet420(UINT16 u2HdmiBase,UINT8 u1En);

/**
 * @brief     set 420 to 422 enable or disable,used for 4k 420 timing
 * @param    Base address by port, enable or disable
 * @retval    none
 **/
extern void vHDMI2ComSet420To422(UINT16 u2HdmiBase,UINT8 u1En);

/**
 * @brief     set 422 to 444 enable or disable,used for 4k 420 timing
 * @param    Base address by port, enable or disable
 * @retval    none
 **/
extern void vHDMI2ComSet422To444(UINT16 u2HdmiBase,UINT8 u1En);
//void vHDMI2ComDeepRst(UINT16 u2HdmiBase);
extern void vHDMI2ComFifoRst(UINT16 u2HdmiBase);
extern void vHDMI2ComAcrRst(UINT16 u2HdmiBase);
extern void vHDMI2ComDAcrRst(UINT16 u2HdmiBase);
extern void vHDMI2ComDeepRst1(UINT16 u2HdmiBase);
extern void vHDMI2ComDeepRst(UINT16 u2HdmiBase,UINT8 u1En);
extern void vHDMI2ComDigPhyRst1(UINT16 u2HdmiBase);
extern void vHDMI2ComRxTdRst(UINT16 u2HdmiBase);
extern void vHDMI2ComDigPhyRst(UINT16 u2HdmiBase,UINT8 u1En);
extern void vMHL3ComMhl32HdmiRst(void);
extern void vHDMI2ComSplitRst(UINT16 u2HdmiBase);
extern void vHDMI2ComHdcp1Rst(UINT16 u2HdmiBase);
extern void vHDMI2ComHdcp2Rst(UINT16 u2HdmiBase);
extern void vHDMI2ComSetHDCP2RepeaterMode(UINT16 u2HdmiBase,BOOL bEn);
extern void vHDMI2ComSetHDCP2RepeaterPara(UINT16 u2HdmiBase,BOOL bIsHdcp2DownStream,UINT8 u1DeviceDepth,UINT8 u1DeviceCount,UINT8 *pReceiverID);
extern void vHDMI2ComHDCP2Init(UINT16 u2HdmiBase);
extern void vHDMI2ComHDCP2PUPD(UINT16 u2HdmiBase);
extern void vHDMI2ComRxInit(UINT16 u2HdmiBase,HdmiRxPort eHdmiPort);
extern void vHDMI2ComSwRst(UINT16 u2HdmiBase);
extern void vHDMI2ComSet420To444(UINT16 u2HdmiBase,UINT8 u1En);
extern void vHDMI2ComGetVideoStatus(UINT16 u2HdmiBase);
extern void vHDMI2ComGetAudioStatus(UINT16 u2HdmiBase);
extern UINT8 bHDMI2ComGetHdcp1Status(UINT16 u2HdmiBase);
extern UINT8 bHDMI2ComGetHdcp2Status(UINT16 u2HdmiBase);
extern void vHDMI2ComGetVideoInfoByAVI(UINT16 u2HdmiBase);
extern BOOL fgHDMI2ComGet420Mode(UINT16 u2HdmiBase);
extern void vHDMI2ComSetClk(UINT16 u2HdmiBase);
extern void vHDMI2ComAnaDeepCtrl(UINT16 u2HdmiBase,UINT8 u1En);
//extern void vHDMI2ComNewDigSel(UINT16 u2HdmiBase,UINT8 u1En);
extern void vHDMI2ComMainClkSel(UINT16 u2HdmiBase,UINT8 u1En);
extern void vHDMI2ComSubClkSel(UINT16 u2HdmiBase,UINT8 u1En);
extern void vHDMI2ComAudPllSel(UINT16 u2HdmiBase,UINT8 u1Pll);
extern void vHDMI2ComAudMuteSet(UINT16 u2HdmiBase,UINT8 u1En);
extern void vHDMI2ComVideMuteSet(UINT16 u2HdmiBase,UINT8 u1En);
extern void vHDMI2ComVideoBlackSet(UINT16 u2HdmiBase,UINT8 u1IsRgb);
extern void vHDMI2ComAudCfg(UINT16 u2HdmiBase);
extern void vHDMI2ComSetScdc(UINT8 u1En);
extern void vHDMI2ComClearScdcStatus(HdmiRxPort ePort);
extern UINT32 dwHDMI2ComHClk(UINT16 u2HdmiBase);
extern BOOL fgHDMI2ComGetHresStb(UINT16 u2HdmiBase);
extern BOOL fgHDMI2ComGetVresStd(UINT16 u2HdmiBase);
extern void vHDMI2ComAacEn(UINT16 u2HdmiBase,UINT8 u1En);
extern UINT8 bHDMI2ComGetAudFifo(UINT16 u2HdmiBase);
extern void vHDMI2ComAudioSigmaDeltaSettingEx(UINT16 u2HdmiBase,UINT32 value1, UINT8 value2, UINT8 bSDINOVR);
extern void bHDMI2ComAudioSigmaDeltaFineTuneSettingEx(UINT16 u2HdmiBase,UINT32 value1, UINT8 value2, UINT32 target, UINT8 bSDINOVR);
extern BOOL fgHDMI2ComAudioPCMMode(UINT16 u2HdmiBase);
/**
 * @brief     Get TMDS clk frequency, cal from pixel frequency, only avaliable at stable signal
 * @param    Base address by port
 * @retval    1:sync active,0:no scdt
 */
extern UINT32 bHDMI2ComGetTMDSClkFreq(UINT16 u2HdmiBase);
extern UINT8 bHDMI2AudSampleRateCal(UINT16 u2HdmiBase);
extern void vHDMI2ComAudStatusSel(UINT16 u2HdmiBase,UINT8 u1On);
extern UINT8 bHDMI2ComGetClkRateForDig(UINT16 u2HdmiBase);
extern UINT32 u4HDMI2ComGetRefClkKhz(UINT16 u2HdmiBase);
extern void vHDMI2ComAnaEnTMDSTermCtrl(UINT16 u2HdmiAnaOfst,MhlRxCbusMode_t e_mode,BOOL fgOnOff);
extern void vHDMI2ComAnaMainPLLSrcSel(UINT16 u2HdmiAnaOfst,MhlRxCbusMode_t e_mode);
extern void vHDMI2Com420ClkSel(UINT16 u2HdmiBase, HdmiRxPort eHdmiPort,UINT8 u1En);
extern BOOL fgHDMI2ComIsAVIHeaderValid(UINT16 u2HdmiBase);
extern void vHDMI2ComFsSel(UINT16 u2HdmiBase,BOOL fgHwSwSel,UINT8 u1FsVal);
extern void vHDMI2ComEDID1ResetDDC(HdmiRxPort ePort);
extern void vHDMI2ComEDID2ResetDDC(HdmiRxPort ePort);
extern UINT16 u2HDMI2ComGetHdcpError(UINT16 u2HdmiBase);
#endif

