/**
 * @file hv_cal_Hdcp.h
 * @brief Header file of Cal module.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use Hv_Cal_Hdcp1x_HdmiGetRxAnFromReg(...) Get Hdmi Hdcp An Msg.
 * (+) Use Hv_Cal_Hdcp1x_HdmiGetRxAksvFromReg(...) Get Hdmi Hdcp Aksv Msg.
 * (+) Use Hv_Cal_Hdcp1x_DpGetRxAnFromReg(...) sGet Dp Hdcp An Msg.
 * (+) Use Hv_Cal_Hdcp1x_DpGetRxAksvFromReg(...) Get Dp Hdcp Aksv Msg.
 * (+) Use Hv_Cal_Hdcp2x_SetRxMsgToReg(...) Set HDCP Msg to Register for Hdcp2x.
 * (+) Use Hv_Cal_Hdcp2x_GetRxMsgFromReg(...) Get HDCP Msg From Register for Hdcp2x.
 * (+) Use Hv_Cal_Hdcp1x_HdmiRxAuthStart(...) Set Hdcp Auth Start.
 * (+) Use Hv_Cal_Hdcp2x_DpResetLinkIntegrityFailure(...) Reset Link Integrity Failure Status.
 * (+) Use Hv_Cal_Hdcp2x_HdmiResetLinkIntegrityFailure(...) Reset Link Integrity Failure Status.
 * (+) Use Hv_Cal_Hdcp_CheckDpRxRdMsgIrq(...) Check Dp Rx Read msg Irq.
 *
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-30
 */



#ifndef _HV_CAL_HDCP_H
#define _HV_CAL_HDCP_H

#include "Common/hv_comm_DataType.h"
#include "hv_drv_HdcpRx.h"
#include "hv_comm_Define.h"
#include "hv_comm_Utilities.h"

#define HV_HDCP_ADDR_OFFSET         0x100
#define HDCP_ADDR_OFFSET(a) (((a) == 1) ? 0 : HV_HDCP_ADDR_OFFSET)

/**************DP HDCP INT MASK BEGIN**************************** */
#define RX_EDP_MAC_IRQ_H_BASE     32
typedef enum  {
    HV_HDCP_1X_0 = (48-RX_EDP_MAC_IRQ_H_BASE),
    HV_HDCP_1X_1,
    HV_HDCP_1X_2,
    HV_HDCP_1X_3,
    HV_HDCP_2X_0,
    HV_HDCP_2X_1,
    HV_HDCP_2X_2,
    HV_HDCP_2X_3,
    HV_HDCP_2X_4,
    HV_HDCP_2X_5,
    HV_HDCP_2X_6,
    HV_HDCP_2X_7,
    HV_HDCP_2X_8,
    HV_HDCP_2X_9,
    HV_HDCP_2X_10,
    HV_HDCP_2X_11
} HdcpRxDpIntBit;

typedef enum
{
    HV_HDCP_DP_1X_WTITE_0X68XX_DONE_INT                 =    (1 <<(HV_HDCP_1X_0)),
    HV_HDCP_DP_1X_READ_0X68XX_DONE_INT                  =    (1 <<(HV_HDCP_1X_1)),
    HV_HDCP_DP_1X_WTITE_AKSV_DONE_INT                   =    (1 <<(HV_HDCP_1X_2)),
    HV_HDCP_DP_1X_WTITE_AINFO_DONE_INT                  =    (1 <<(HV_HDCP_1X_3)),
    HV_HDCP_DP_2X_WTITE_0X69XX_DONE_INT                 =    (1 <<(HV_HDCP_2X_0)),
    HV_HDCP_DP_2X_READ_0X69XX_DONE_INT                  =    (1 <<(HV_HDCP_2X_1)),
    HV_HDCP_DP_2X_WTITE_TXCAP_DONE_INT                  =    (1 <<(HV_HDCP_2X_2)),
    HV_HDCP_DP_2X_WTITE_EKPUB_KM_DONE_INT               =    (1 <<(HV_HDCP_2X_3)),
    HV_HDCP_DP_2X_WTITE_M_DONE_INT                      =    (1 <<(HV_HDCP_2X_4)),
    HV_HDCP_DP_2X_WTITE_RN_KM_DONE_INT                  =    (1 <<(HV_HDCP_2X_5)),
    HV_HDCP_DP_2X_WTITE_RIV_DONE_INT                    =    (1 <<(HV_HDCP_2X_6)),
    HV_HDCP_DP_2X_WTITE_V_KM_DONE_INT                   =    (1 <<(HV_HDCP_2X_7)),
    HV_HDCP_DP_2X_WTITE_STREAM_ID_TYPE_DONE_INT         =    (1 <<(HV_HDCP_2X_8)),
    HV_HDCP_DP_2X_READ_H_DONE                           =    (1 <<(HV_HDCP_2X_9)),
    HV_HDCP_DP_2X_READ_PAIR_INFO_DONE                   =    (1 <<(HV_HDCP_2X_10)),
    HV_HDCP_DP_2X_READ_STREAM_TYPE_DONE                 =    (1 <<(HV_HDCP_2X_11)),
    HV_HDCP_DP_INT_ALL_ENABLE                           =    (0xFFFFF000),
    HV_HDCP_DP_INT_2X_ALL_ENABLE                        =    (0xFFF80000),//(0x3FF80000),
    HV_HDCP_DP_INT_1X_ALL_ENABLE                        =    (0x0000F000)
} HdcpRxDpIntBitMask;


/**************DP HDCP INT MASK END**************************** */

/**************CAL FUNCTION BEGIN**************************** */

/**
 * @brief Get An Msg From Register for Hdcp1x.
 * @param[in] pucAn: Pointer of An.
 * @param[in] uiMsgSize: An Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_HdmiGetRxAnFromReg(UCHAR8 *pucAn, UCHAR8 ucPortIndex);

/**
 * @brief Get AKsv Msg From Register for Hdcp1x.
 * @param[in] pucAKsv: Pointer of AKsv.
 * @param[in] uiMsgSize: AKsv Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_HdmiGetRxAksvFromReg(UCHAR8 *pucAKsv, UCHAR8 ucPortIndex);

/**
 * @brief Get An Msg From Register for Hdcp1x.
 * @param[in] pucAn: Pointer of An.
 * @param[in] uiMsgSize: An Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_DpGetRxAnFromReg(UCHAR8 *pucAn, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get AKsv Msg From Register for Hdcp1x.
 * @param[in] pucAKsv: Pointer of AKsv.
 * @param[in] uiMsgSize: AKsv Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_DpGetRxAksvFromReg(UCHAR8 *pucAKsv, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Set HDCP Msg to Register for Hdcp2x.
 * @param[in] pucData: Pointer of HDCP Auth Msg.
 * @param[in] uiMsgSize: the Size of Hdcp Auth Msg.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiSetRxMsgToReg(UCHAR8 *pucData, USHORT16 usMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get HDCP Msg From Register for Hdcp2x.
 * @param[in] pucData: Pointer of HDCP Auth Msg.
 * @param[in] uiMsgSize: the Size of Hdcp Auth Msg.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiGetRxMsgFromReg(UCHAR8 *pucData, USHORT16 usMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Set HDCP Msg Size to Register for Hdcp2x.
 * @param[in] usMsgSize: The Size of Hdcp Auth Msg.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiSetRxStatSize(USHORT16 usMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Clear HDCP Msg Size for Hdcp2x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiClrRxStatSize(UCHAR8 ucPortIndex);

/**
 * @brief Set HDCP Re Authered Bit(11).
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiSetRxStatusReAuth(UCHAR8 ucPortIndex);

/**
 * @brief Get HDCP Re Authered Bit(11).
 * @param[in] ucPortIndex: Port Index.
 * @return UCHAR8.
 */
UCHAR8 Hv_Cal_Hdcp_HdmiGetReAuthStatus(UCHAR8 ucPortIndex);

/**
 * @brief Save Rx Cert to Register for Hdcp2x.
 * @param[in] pucPubCert: Pointer of HDCP2X Rx Cert.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp_DpSaveCertToReg(const UCHAR8 *pucPubCert, UCHAR8 ucPortIndex);

/**
 * @brief Save Rx Bksv to Register for Dp Hdcp1x.
 * @param[in] pucBKsv: Pointer of HDCP2X Rx BKsv.
 * @return None.
 */
VOID Hv_Cal_Hdcp_DpSaveBksvtoReg(const UCHAR8 *pucBKsv, UCHAR8 ucPortIndex);

/**
 * @brief Save Rx Bksv to Register for Hdmi Hdcp1x.
 * @param[in] pucBKsv: Pointer of HDCP2X Rx BKsv.
 * @return None.
 */
VOID Hv_Cal_Hdcp_HdmiSaveBksvtoReg(const UCHAR8 *pucBKsv, UCHAR8 ucPortIndex);

/**
 * @brief Save Rx PriKey to Register for Hdcp2x.
 * @param[in] priP: Pointer of HDCP2X Rx priP.
 * @param[in] priQ: Pointer of HDCP2X Rx priQ, 
 * @param[in] priDP: Pointer of HDCP2X Rx priDP
 * @param[in] priDP: Pointer of HDCP2X Rx priDQ, 
 * @param[in] priQINV: Pointer of HDCP2X Rx priQINV.
 * @return None.
 */
VOID Hv_Cal_Hdcp_SavePriKeytoReg(const UINT32 *priP, const UINT32 *priQ, const UINT32 *priDP,
        const UINT32 *priDQ, const UINT32 *priQINV);
/**
 * @brief Save Rx Lc128 to Register for Hdcp2x.
 * @param[in] pucLc128: Pointer of HDCP2X Rx Lc128.
 * @return None.
 */
VOID Hv_Cal_Hdcp_SaveLc128toReg(const UCHAR8 *pucLc128);

/**
 * @brief Clear HDCP INT Bit.
 * @param[in] enComIrqNum: Hdcp Int Bit index.
 * @return None.
 */
VOID  Hv_Cal_Hdcp_ComIrqBitClr(HdcpComIrqNum enComIrqNum);

/**
 * @brief Save Rx Kis and Riv to Register for Hdcp2x.
 * @param[in] pucKs: Pointer of HDCP2X Rx Ks, 
 * @param[in] pucRiv: Pointer of HDCP2X Rx Riv.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_RxSaveKsRivToReg(const UCHAR8* pucKs, const UCHAR8* pucRiv, UCHAR8 ucPortIndex);

/**
 * @brief Set Register to start Auth for Hdcp2x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_StartRxAuth(UCHAR8 ucHdcpPortIndex);

/**
 * @brief Set Register to start Auth for Hdcp1x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_HdmiRxAuthStart(UCHAR8 ucPortIndex, UCHAR8 ucHdcpPortIndex);
VOID Hv_Cal_Hdcp1x_HdmiRxSetEessQstc(UCHAR8 ucHdcpPortIndex);
VOID Hv_Cal_Hdcp_HdmiRxClearMsgAfterAutherDone(UCHAR8 ucPortIndex);

/**
 * @brief Set Register to start Auth for Hdcp2x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiStartRxAuthCallBack(UCHAR8 ucPortIndex);

/**
 * @brief Set Register to start Auth for Hdcp2x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxAuthStart(UCHAR8 ucPortIndex, UCHAR8 ucHdcpPortIndex);

/**
 * @brief Set Register to start Auth for Hdcp1x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_DpRxAuthStart(UCHAR8 ucPortIndex, UCHAR8 ucHdcpPortIndex);

/**
 * @brief Get Ri from Register for Hdcp1x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
USHORT16 Hv_Cal_Hdcp1x_RxGetRI(UCHAR8 ucPortIndex);

/**
 * @brief Set Ri to Register for Hdcp1x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */

VOID Hv_Cal_Hdcp1x_HdmiRxSetRI(USHORT16 usRI, UCHAR8 ucPortIndex);
VOID Hv_Cal_Hdcp1x_HdmiRxSetRiSelToHw(UCHAR8 ucPortIndex, UCHAR8 ucHdcpPortIndex);

/**
 * @brief Set Ri to Register for Hdcp1x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */

VOID Hv_Cal_Hdcp1x_DpRxSetRI(USHORT16 usRI, UCHAR8 ucPortIndex);

/**
 * @brief Enable HDCP INT .
 * @param[in] None.
 * @return None.
 */
VOID Hv_Cal_Hdcp_ComIrqEnable(VOID);

/**
 * @brief Clear HDCP INT .
 * @param[in] None.
 * @return None.
 */
//UINT32 Hv_Cal_Hdcp_GetIrqEngineFlag(VOID);

/**
 * @brief Set Hdcp Version to Register for Hdcp2x .
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
//VOID Hv_Cal_Hdcp2x_SetVerToReg(UCHAR8 ucPortIndex);

/**
 * @brief Save RxCaps to Register for Hdcp2x .
 * @param[in] pucRxCaps: Pointer of RxCaps.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpSaveRxCapsToReg(UCHAR8 ucPortIndex);
VOID Hv_Cal_Hdcp2x_SetDpHdcpVersion(UCHAR8 ucHdcpVersion);

/**
 * @brief Save H Prime to Register for Hdcp2x .
 * @param[in] pucHPrime: Pointer of H Prime.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpSaveHPrimeToReg(UCHAR8* pucHPrime, UCHAR8 ucPortIndex);

/**
 * @brief Save Pairing to Register for Hdcp2x .
 * @param[in] pucEkhKm: Pointer of Pairing.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpSavePairingToReg(UCHAR8* pucEkhKm, UCHAR8 ucPortIndex);

/**
 * @brief Save L Prime to Register for Hdcp2x .
 * @param[in] pucLPrime: Pointer of L Prime.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpSaveLPrimeToReg(UCHAR8* pucLPrime, UCHAR8 ucPortIndex);

/**
 * @brief Get Stream Type.
 * @param[in] ucPortIndex: Port Index.
 * @return Stream Type.
 */
UCHAR8 Hv_Cal_Hdcp2x_DpRxGetStreamType(UCHAR8 ucPortIndex);

/**
 * @brief Set Stream Type to Register for Hdcp2x .
 * @param[in] ucStreamType: Stream Type.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxSetStreamType(UCHAR8 ucStreamType, UCHAR8 ucPortIndex);

/**
 * @brief Init Register to select Mix .
 * @param[in] ucPortIndex: Port Index.
 * @param[in] enPortType: Port Type.
 * @return None.
 */
VOID Hv_Cal_Hdcp_InitSel(UCHAR8 ucHdcpPortIndex, UCHAR8 ucValueSet);

/**
 * @brief Save Rrx to Register for HDCP2X .
 * @param[in] pucRrx: Pointer of Hdcp Rrx.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxSaveRrxToReg(UCHAR8* pucRrx, UCHAR8 ucPortIndex);

/**
 * @brief Get TxCaps from Register for Hdcp2x.
 * @param[in] pucTxCaps: Pointer of TxCaps, 
 * @param[in] uiMsgSize: TxCaps Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetTxCaps(UCHAR8 *pucTxCaps, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get Rtx from Register for Hdcp2x.
 * @param[in] pucRtx: Pointer of Rtx, 
 * @param[in] uiMsgSize: Rtx Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetRtx(UCHAR8 *pucRtx, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get EkupKm from Register for Hdcp2x.
 * @param[in] pucEKpubKm: Pointer of EkupKm, 
 * @param[in] uiMsgSize: EkpubKm Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetEkpubKm(UCHAR8 *pucEKpubKm, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get EkhKm from Register for Hdcp2x.
 * @param[in] pucEkhKm: Pointer of EkhKm,
 * @param[in] uiMsgSize: EkhKm Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetEkhKm(UCHAR8 *pucEkhKm, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get  M from Register for Hdcp2x.
 * @param[in] pucM: Pointer of M, 
 * @param[in] uiMsgSize: M Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetM(UCHAR8 *pucM, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get Rn from Register for Hdcp2x.
 * @param[in] pucRn: Pointer of Rn, 
 * @param[in] uiMsgSize: Rn Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetRn(UCHAR8 *pucRn, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get Riv from Register for Hdcp2x.
 * @param[in] p1--Pointer of Riv, 
 * @param[in] uiMsgSize: Riv Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetRiv(UCHAR8 *pucRiv, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Get Ks from Register for Hdcp2x.
 * @param[in] pucKs: Pointer of Ks. 
 * @param[in] uiMsgSize: Ks Size.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpRxGetKs(UCHAR8 *pucKs, UINT32 uiMsgSize, UCHAR8 ucPortIndex);

/**
 * @brief Init Register for Hdcp1x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_HdmiSetHdcpPath(UCHAR8 ucHdcpPortIndex);

/**
 * @brief Init Register for Hdcp2x.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiSetHdcpPath(UCHAR8 ucHdcpPortIndex);

/**
 * @brief Toggle IRQ.
 * @param[in] enStatusType: Rx State Type.
 * @param[in] ucPortIndex: RX Port Index.
 * @param[in] ucHdcpIndex: HDCP Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_NotifyTxIrq(Hdcp2xDpRxStatusMask enStatusType, UCHAR8 ucPortIndex, UCHAR8 ucHdcpIndex);

/**
 * @brief Toggle IRQ.
 * @param[in] enStatusType: Rx State Type.
 * @param[in] ucPortIndex: RX Port Index.
 * @param[in] ucHdcpIndex: HDCP Port Index.
 * @return None.
 */

VOID Hv_Cal_Hdcp1x_NotifyTxIrq(Hdcp1xRxStatusMask enStatusType, UCHAR8 ucPortIndex, UCHAR8 ucHdcpIndex);

/**
 * @brief Save Rx DKS to Register for Hdcp1x.
 * @param[in] puiBkeyTable: Pointer of HDCP1X Rx DKS.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp_SaveDKStoReg(const UINT32 *puiBkeyTable, USHORT16 uiBkSize);

/**
 * @brief Reset Link Integrity Failure Status.
 * @param[in] None.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_DpResetLinkIntegrityFailure(UCHAR8 ucPortIndex);

/**
 * @brief Reset Link Integrity Failure Status.
 * @param[in] None.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_DpResetLinkIntegrityFailure(UCHAR8 ucPortIndex);

/**
 * @brief Reset Link Integrity Failure Status.
 * @param[in] None.
 * @return None.
 */
VOID Hv_Cal_Hdcp2x_HdmiResetLinkIntegrityFailure(UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Rx Read H msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxRdHIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Rx Read Pairing msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxRdPairingIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Write Aksv msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxWrAksvIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Write AKE Init msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxWrAKEInitIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Write No Stored Km msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxWrNoStoredKmIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Write Stored Km msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxWrStoredKmIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Write LC Init msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxWrLCInitIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Write SKE Send Eks msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxWrSKESendEksIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Dp Write Stream Type  Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckDpRxStreamTypeIrq(const UINT32* puiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check HDMI Rx Read msg Irq.
 * @param[in] U32IrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckHdmiRxRdMsgIrq(UINT32 uiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Hdmi Rx Write Aksv msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckHdmiRxWrAksvIrq(UINT32 uiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Hdmi Rx Write AKE Init msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckHdmiRxWrAKEInitIrq(UINT32 uiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Hdmi Rx Write AKE No Stored Km msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckHdmiRxWrAKENoStoredKmIrq(UINT32 uiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Hdmi Rx Write AKE Stored Km msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckHdmiRxWrAKEStoredKmIrq(UINT32 uiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Hdmi Rx Write LC Init msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckHdmiRxWrLCInitIrq(UINT32 uiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Check Hdmi Rx Write LC Init msg Irq.
 * @param[in] puiIrqMask: Irq Mask.
 * @param[in] ucPortIndex: Port Index.
 * @return True and False.
 */
BOOL Hv_Cal_Hdcp_CheckHdmiRxWrSKESendEksIrq(UINT32 uiIrqMask, UCHAR8 ucPortIndex);

/**
 * @brief Set Hdcp1x Bcaps.
 * @param[in] ucBcaps: Hdcp1x Bcaps.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1x_SetBcaps(UCHAR8 ucBcaps, UCHAR8 ucPortIndex);

/**
 * @brief Set Hdcp1x Bcaps.
 * @param[in] ucBcaps: Hdcp1x Bcaps.
 * @param[in] ucPortIndex: Port Index.
 * @return None.
 */
VOID Hv_Cal_HdmiHdcp1x_SetBcaps(UCHAR8 ucBcaps, UCHAR8 ucPortIndex);

/**
 * @brief Get Dp Port index.
 * @param[in] ucPortIndex: Dp Port Index.
 * @return Port Index.
 */
UCHAR8 Hv_Cal_Hdcp_DpGetHdcpPortIndex(UCHAR8 ucPortIndex);

/**
 * @brief Get Hdcp Irq mask.
 * @return None.
 */
UINT32 Hv_Cal_Hdcp_GetIrqFlag(VOID);

/**
 * @brief Set Hdcp Lane Clk.
 * @param[in] ucPortIndex: Dp Port Index.
 * @param[in] ucHdcpPortIndex: Hdcp Port Index.
 * @param[in] enPortType: Port Type DP or Hdmi.
 * @return None.
 */
VOID Hv_Cal_Hdcp_SetLaneClk(UCHAR8 ucValueSet, UCHAR8 ucHdcpPortIndex);

/**
 * @brief Check Hdcp exist.
 * @param[in] ucPortIndex: Hdcp Port Index.
 * @return HV_SUCCESS or HV_FAILURE.
 */
Status Hv_Cal_Hdcp_CheckExist(UCHAR8 ucPortIndex);

/**
 * @brief Hdcp Reset.
 * @param[in] ucPortIndex: Hdcp Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp_Init(UCHAR8 ucHdcpPortIndex);

/**
 * @brief Get DP Port Index.
 * @param[in] ucPortIndex: Hdcp Port Index.
 * @return Dp Port index
 */
UCHAR8 Hv_Cal_Hdcp_GetDpPortIndex(UCHAR8 ucPortIndex);

/**
 * @brief Dp Hdcp Mix Clear.
 * @param[in] ucPortIndex: Hdcp Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp_DpMixClr(UCHAR8 ucHdcpPortIndex);

/**
 * @brief HDMI HDCP Comm Init.
 * @param[in] None.
 * @return None
 */
VOID Hv_Cal_Hdcp_HdmiCommInit();
VOID Hv_Cal_Hdcp_SetHdmiHdcpVersion(UCHAR8 ucHdcpVersion);

/**
 * @brief HDCP Release HDMI Path.
 * @param[in] ucPortIndex: HDMI Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp_RealseHdmiPath(UCHAR8 ucPortIndex);

/**
 * @brief Release DP HDCP Path.
 * @param[in] ucPortIndex: DP Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp_RealseDpPath(UCHAR8 ucPortIndex);

/**
 * @brief Bind DP HDCP Path.
 * @param[in] ucPortIndex: DP Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp_AttachDpPath(UCHAR8 ucPortIndex);
/**
 * @brief Release HDCP Encrypt Status.
 * @param[in] ucHdcpPortIndex: Hdcp Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp_RealseStatus(UCHAR8 ucHdcpPortIndex);

/**
 * @brief Connect DP to HDCP1X Path.
 * @param[in] ucHdcpPortIndex: Hdcp Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp1x_DpSetHdcpPath(UCHAR8 ucHdcpPortIndex);

/**
 * @brief Connect DP to HDCP2X Path.
 * @param[in] ucHdcpPortIndex: Hdcp Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp2x_DpSetHdcpPath(UCHAR8 ucHdcpPortIndex);

/**
 * @brief Bind HDMI to HDCP Path.
 * @param[in] ucPortIndex: HDMI Port Index.
 * @return None
 */
VOID Hv_Cal_Hdcp_AttachHdmiPath(UCHAR8 ucPortIndex);

/**
 * @brief Dp Common Init.
 * @param[in] None.
 * @return None
 */
VOID Hv_Cal_Hdcp_DpCommInit();

/**
 * @brief Hdcp select Hdmi0/Hdmi1/ by Mux.
 * @param[in] ucPortIndex: Port Index of HDMI.
 * @param[in] ucHdcpPortIndex: HDCP Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp_HdmiMuxSel(UCHAR8 ucPortIndex, UCHAR8 ucHdcpPortIndex);

/**
 * @brief Hdcp select DP0/DP1/ by Mux.
 * @param[in] ucPortIndex: Port Index of DP.
 * @param[in] ucHdcpPortIndex: HDCP Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp_DpMuxSel(UCHAR8 ucPortIndex, UCHAR8 ucHdcpPortIndex);

/**
 * @brief Reset HDCP.
 * @param[in] ucHdcpPortIndex: HDCP Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp_Reset(UCHAR8 ucHdcpPortIndex);

/**
 * @brief HDCP1X clear dp fifo.
 * @param[in] ucHdcpPortIndex: HDCP Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp1X_ClrDpFifo(UCHAR8 ucHdcpPortIndex);

/**
 * @brief HDCP2X clear dp fifo.
 * @param[in] ucHdcpPortIndex: HDCP Port Index.
 * @return None.
 */
VOID Hv_Cal_Hdcp2X_ClrDpFifo(UCHAR8 ucHdcpPortIndex);

BOOL Hv_Cal_Hdcp2x_IsHdmiInEncryed(UCHAR8 ucHdcpPortIndex);

VOID Hv_Cal_Hdcp1x_HdcpClrAnAksv(UCHAR8 ucPortIndex);


/**************CAL FUNCTION END**************************** */
#endif
