/**
 * @file hv_cal_MainMute.h
 * @brief Header file of mute module.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 *
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-22
 */

#ifndef __HV_CAL_DPU_MAIN_MUTE_H__
#define __HV_CAL_DPU_MAIN_MUTE_H__

#include "hv_comm_DataType.h"
#include "hv_comm_Define.h"

typedef enum{
    V_BLANKING_ABNORMAL     = 1 << 0,
    HTOTAL_MAXIMAL_ABNORMAL = 1 << 1,
    VACT_MAXIMAL_ABNORMAL   = 1 << 2,
    VACT_MINIMAL_ABNORMAL   = 1 << 3,
    HACT_MAXIMAL_ABNORMAL   = 1 << 4,
    HACT_MINIMAL_ABNORMAL   = 1 << 5,
    NO_DE                   = 1 << 6,
    CLK_ABNORMAL            = 1 << 7,
    VBORX_DE_ABNORMAL       = 1 << 8,
    VBORX_LOCKN_ABNORMAL    = 1 << 9,
    VS_FREQ_ABNORMAL        = 1 << 10,
    VTTL_SHORT_ABNORMAL     = 1 << 11,
    VBLANK_SHORT_ABNORMAL   = 1 << 12,
    HTOTAL_SHORT_ABNORMAL   = 1 << 13,
}DPU_MUTE_RESULT_E;

typedef enum{
    NORMAL_STATE  = 1 << 0,
    FREERUN_STATE = 1 << 1,
    IDLE          = 1 << 2,
    FREERUN       = 1 << 3,
    WAIT0         = 1 << 4,
    NORMAL        = 1 << 5,
    WAIT1         = 1 << 6,
    WAIT2         = 1 << 7,
    WAIT3         = 1 << 8,
    WAIT4         = 1 << 9,
}DPU_MUTE_STATE_E;

typedef struct _VIDEO_TIMING_PARAM
{
    USHORT16 uhwHTotal;
    USHORT16 uhwVTotal;
    USHORT16 uhwHActive;
    USHORT16 uhwVActive;
    USHORT16 uhwHStart;
    USHORT16 uhwVStart;
    USHORT16 uhwHSyncW;
    USHORT16 uhwVSyncW;
    UCHAR8 uhwHSP;
    UCHAR8 uhwVSP;
}T_VIDEO_TIMING_PARAM;

/**
 * @brief set mute.
 * @param[in] value set htotal.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHtotal(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vtotal.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVtotal(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hact.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHact(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vact.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVact(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hact min.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHactMin(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hact max.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHactMax(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vact min.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVactMin(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vact max.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVactMax(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set frm trig pos.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteFrmTrigPos(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value tongle reg_mute_de_normal_option.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteNormOption(VOID);
/**
 * @brief set mute.
 * @param[in] value set force stable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteForceStable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hmin det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHminDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hmax det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHmaxDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vmin det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVminDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vmax det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVmaxDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set httl max det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHttlMaxDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set prog src stable enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteSh12ProgSrcStableEn(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set htotal max.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHtotalMax(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set htotal min.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHtotalMin(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vttl min det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVttlMinDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set httl min det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHttlMinDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hs bproth.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHsBporth(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vs bproth.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVsBporth(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hs width.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHsWidth(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vs width.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVsWidth(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set freerun keep time.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteFreerunKeepTime(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set rx lock det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteRxLocknDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set rx de det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteRxDeDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hs pos.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHsPos(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vs pos.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVsPos(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set norm post delay.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteNormPostDelay(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set freerun to norm threshold.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteFreerun2normThreshold(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set clk det enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteClkDetEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set inclk unlocked threshold.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteInclkUnlockedTh(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set ex clk stable sel.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteRxclkStableSel(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set inclk no ck option.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteInclkNoCkOption(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set antiglitch threshold.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteAntiglitchTh(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set no de enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteNoDeEnable(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set htotal out mode.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHtotalOutMode(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set measure enable.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVsMeasureEn(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set norm clr delay.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteNormClrDelay(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set httl min comp en.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHttlMinCompEn(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set vblank min.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVblankMin(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set freq low threshold.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteInclkFreqLowTh(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set high threshold.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteInclkFreqHighTh(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set hact out.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteHactOut(UINT32 uiValue);


/**
 * @brief set mute.
 * @param[in] value set vact out.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteVactOut(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] NULL.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
//Status Hv_Cal_DpuScaler_ResetDeDetectFunc(VOID);

/**
 * @brief set mute.
 * @param[in] value set mute interrupt.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_SetMuteSh12MuteInt(UINT32 uiValue);


/**
 * @brief set mute.
 * @param[in] value set into normal delay register.
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Cal_DpuScaler_SetMuteNormDelay(UINT32 uiValue);

/**
 * @brief set mute.
 * @param[in] value set into no de detection threshold register.
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Cal_DpuScaler_SetMuteNoDeTh(UINT32 uiValue);

/**
 * @brief get mut result.
 * @param[in] None.
 * @return result:
    [13]: htotal short abnormal
    [12]: vblank short abnormal
    [11]: vttl_short_abnormal
    [10]: vs_freq_abnormal
    [9]: vborx_lockn_abnormal
    [8]: vborx_de_abnormal
    [7]: clk abnormal
    [6]: no de
    [5]: Hact minimal abnormal
    [4]: Hact maximal abnormal
    [3]: Vact minimal abnormal
    [2]: Vact maximal abnormal
    [1]: Htotal maximal abnormal
    [0]: V blanking abnormal
 **/
UINT32 Hv_Cal_DpuScaler_GetMuteResult(VOID);

/**
 * @brief get mut result.
 * @param[in] None.
 * @return status:
    Readback of internal state machine.
    [9]:wait4;
    [8]wait3;
    [7]:wait2;
    [6]:wait1;
    [5]:normal;
    [4]:wait0;
    [3]freerun;
    [2]:idle;
    [1]:freerun state;
    [0]:normal state;
 **/
UINT32 Hv_Cal_DpuScaler_GetMuteState(VOID);

/**
 * @brief readback of clock detection abnormal. High is abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteClkAbn(VOID);

/**
 * @brief readback of DE H active minimal abnormal. High is abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteHdeMinAbn(VOID);

/**
 * @brief readback of DE H active maximal abnormal. High is abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteHdeMaxAbn(VOID);

/**
 * @brief readback of H total maximal abnormal. High is abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteHTotalMaxAbn(VOID);

/**
 * @brief readback of DE V active minimal abnormal. High is abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVDeMinAbn(VOID);

/**
 * @brief readback of DE V active maximal abnormal. High is abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVDeMaxAbn(VOID);

/**
 * @brief readback of V blanking maximal abnormal. High is abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVBlkMaxAbn(VOID);

/**
 * @brief readback of no DE at all.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteNoDe(VOID);

/**
 * @brief readback of MUTE function enable.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteEn(VOID);

/**
 * @brief readback of vx1 lock abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVx1LockAbn(VOID);

/**
 * @brief readback of vx1 de abnormall.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVx1DeAbn(VOID);

/**
 * @brief readback of low vs frequency abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVsFreqIsLow(VOID);

/**
 * @brief readback of high vs frequency abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVsFreqIsHigh(VOID);

/**
 * @brief readback of v total minimal abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVttlMinAbn(VOID);

/**
 * @brief readback of vs frequency diff abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVsFreqDiffHigh(VOID);

/**
 * @brief readback of vs frequency diff abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVsFreqDiffLong(VOID);

/**
 * @brief readback htotal minimal abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteHTotalMinAbn(VOID);

/**
 * @brief readback vblank minimal abnormal.
 * @param[in]None.
 * @return.
 */
UINT32 Hv_Cal_DpuScaler_GetMuteVBlkMinAbn(VOID);


/**
 * @brief get DTC regr_mon_cycle_refclk_vblank.
 */
UINT32 Hv_Cal_DpuScaler_GetDtcMonCycleRefclkVblank(VOID);

/**
 * @brief set misc int 2 bit enable.
 * @param[in]None.
 * @return.
 */
Status Hv_Cal_DpuScaler_SetMiscInt2BitEnable(VOID);

/**
 * @brief set misc int 2 bit diable.
 * @param[in]None.
 * @return.
 */
Status Hv_Cal_DpuScaler_SetMiscInt2BitDisable(VOID);

Status Hv_Cal_DpuScaler_SetKtxFullBlackPatt(BOOL bKtxPattSwitch);

Status Hv_Cal_DpuScaler_SetMainMisc84(UINT32 uiValue);

Status Hv_Cal_DpuScaler_SetMuteSh12MuteInt(UINT32 uiValue);

Status Hv_Cal_DpuScaler_LDGMainInsertBlackEventInit(UINT32 uiValue);

void Hv_Cal_DpuScaler_LDGMainReleaseBlack(VOID);

Status Hv_Cal_DpuScaler_LDGMainInsertBlackCableDetect(VOID);

Status Hv_Cal_DpuScaler_SetMainMuteCompW2Enable(UINT32 uiValue);

UINT32 Hv_Cal_DpuScaler_GetMainMuteStatus(VOID);

Status Hv_Cal_DpuScaler_MuteReleaseBlack(ChannelType enChannelType);

UINT32 Hv_Cal_DpuScaler_GetMuteMainIntReason(VOID);

Status Hv_Cal_DpuScaler_MuteClearInsertBlack(ChannelType enChannelType);

/**
 * @brief set mute.
 * @param[in] value set force freerun.
 * @return Status, 0-HV_SUCCESS, 1-FAILUER.
 */
Status Hv_Cal_DpuScaler_MainMuteForceFreeRun(BOOL bSwitch);

UINT32 Hv_Cal_DpuScaler_GetBalckInsertStatus(ChannelType mutePath);

UINT32 Hv_Cal_DpuScaler_GetAudioBalckInsertStatus(VOID);

VOID Hv_Cal_DpuScaler_SetMuteThreahold(ChannelType mutePath);

VOID Hv_Cal_DpuScaler_ClearMuteEn(VOID);

UINT32 Hv_Cal_DpuScaler_GetMuteStatus(VOID);

Status Hv_Cal_DpuScaler_SetMuteStateW4Enable(UINT32 uiValue);


#endif

