#ifndef _HDMI_IF_H_
#define _HDMI_IF_H_
#include "x_typedef.h"
/********************************************HDMI_DRIVER_V2 == Only HDMI2.0 driver is implemented********************************************/
#if !(defined(CC_MT5399) || defined(CC_MT5890) || defined(CC_MT5882) || defined(CC_MT5883))
#define HDMI_DRIVER_V2 1
#else
#define HDMI_DRIVER_V2 0
#endif
/*********************************************Include hdmi driver header files*********************************************/
#if !HDMI_DRIVER_V2
#include "hw_hdmi.h"
#include "drv_hdmi.h"
#include "drv_dvi.h"
#endif
#ifdef CC_HDMI_2_0_SUPPORT
#include "hw_hdmi2.h"
#include "drv_hdmi2.h"
#include "drv_dvi2.h"
#endif
/*******************************************************typedef*******************************************************/
typedef enum
{
	HDMI_IF_AUDIOFREQUENCY_32K = 0,
    HDMI_IF_AUDIOFREQUENCY_44K,
    HDMI_IF_AUDIOFREQUENCY_48K,
    HDMI_IF_AUDIOFREQUENCY_88K,
    HDMI_IF_AUDIOFREQUENCY_96K,
    HDMI_IF_AUDIOFREQUENCY_176K,
    HDMI_IF_AUDIOFREQUENCY_192K,
    HDMI_IF_AUDIOFREQUENCY_NOTINDICATED,
    HDMI_IF_AUDIOFREQUENCY_UNKNOWN,
    HDMI_IF_AUDIOFREQUENCY_MAX
}E_HDMI_IF_AUD_FREQUENCY;

typedef enum 
{
    HDMI_IF_NO_SIGNAL = 0,
    HDMI_IF_HDMI,
    HDMI_IF_DVI,
    HDMI_IF_MODE_MAX
}HDMI_IF_MODE_T;

enum
{
	HDMI_IF_InfoFrame_AVI,
	HDMI_IF_InfoFrame_SPD,
	HDMI_IF_InfoFrame_AUDIO,
	HDMI_IF_InfoFrame_MPEG,
	HDMI_IF_InfoFrame_UNREC,
	HDMI_IF_InfoFrame_GAMUT,
	HDMI_IF_InfoFrame_ACP,
	HDMI_IF_InfoFrame_VSDB
};

typedef enum
{
	HDMI_IF_FORMAT_RGB,
	HDMI_IF_FORMAT_YC420,
	HDMI_IF_FORMAT_YC422,
	HDMI_IF_FORMAT_YC444
}HDMI_IF_SINGAL_FORMAT;

typedef struct
{
  UINT8 HDMI_FrameSize; //*sizeof(UINT32)
  UINT8 HDMI_FrameData[32];
}HDMI_IF_INFOFRAME;

typedef enum
{
    HDMI_IF_CLRSPC_UNKNOW,
	HDMI_IF_CLRSPC_YC444_601,
	HDMI_IF_CLRSPC_YC422_601,
	HDMI_IF_CLRSPC_YC420_601,

	HDMI_IF_CLRSPC_YC444_709,
	HDMI_IF_CLRSPC_YC422_709,
	HDMI_IF_CLRSPC_YC420_709,

	HDMI_IF_CLRSPC_XVYC444_601,
	HDMI_IF_CLRSPC_XVYC422_601,
	HDMI_IF_CLRSPC_XVYC420_601,

	HDMI_IF_CLRSPC_XVYC444_709,
	HDMI_IF_CLRSPC_XVYC422_709,
	HDMI_IF_CLRSPC_XVYC420_709,

	HDMI_IF_CLRSPC_sYCC444_601,
	HDMI_IF_CLRSPC_sYCC422_601,
	HDMI_IF_CLRSPC_sYCC420_601,
	
	HDMI_IF_CLRSPC_Adobe_YCC444_601,
	HDMI_IF_CLRSPC_Adobe_YCC422_601,
	HDMI_IF_CLRSPC_Adobe_YCC420_601,
	
	HDMI_IF_CLRSPC_RGB,
	HDMI_IF_CLRSPC_Adobe_RGB,
	
	HDMI_IF_CLRSPC_BT_2020_RGB_non_const_luminous,
	HDMI_IF_CLRSPC_BT_2020_RGB_const_luminous,
	
	HDMI_IF_CLRSPC_BT_2020_YCC444_non_const_luminous,
	HDMI_IF_CLRSPC_BT_2020_YCC422_non_const_luminous,
	HDMI_IF_CLRSPC_BT_2020_YCC420_non_const_luminous,
	
	HDMI_IF_CLRSPC_BT_2020_YCC444_const_luminous,
	HDMI_IF_CLRSPC_BT_2020_YCC422_const_luminous,
	HDMI_IF_CLRSPC_BT_2020_YCC420_const_luminous

}HDMI_IF_CLR_SPC;

typedef void (*HDMI_IF_ACP_CHG_CB)(UINT8 u1AcpChg,void* pvTag);
/*******************************************************Function Declaration*******************************************************/
/**
 * @brief vHdmiIf_HdmiInit
 * @retval
*/
extern void vHdmiIf_HdmiInit(void);

/**
 * @brief u1HdmiIf_GetUpSta
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetUpSta(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetUPStaChg
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetUPStaChg(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetSvSta
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetSvSta(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetSvStaChg
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetSvStaChg(UINT8 u1Path);

/**
 * @brief u1HdmiIf_Get4KpsSta
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_Get4KpsSta(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetScanInfo
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetScanInfo(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetMhlPortId
 * @retval
*/
extern UINT8 u1HdmiIf_GetMhlPortId(void);

/**
 * @brief u1HdmiIf_GetInputType
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetInputType(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetHdcpStatus
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetHdcpStatus(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetAudioCategoryCode
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetAudioCategoryCode(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetAudioBitWidth
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetAudioBitWidth(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetAspectRatio
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetAspectRatio(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetAFD
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetAFD(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetDeepColorStatus
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetDeepColorStatus(UINT8 u1Path);

/**
 * @brief u1HdmiIf_GetHdmiMode
 * @param u1Path
 * @retval
*/
extern HDMI_IF_MODE_T u1HdmiIf_GetHdmiMode(UINT8 u1Path);

/**
 * @brief eHdmiIf_GetAudioFrequency
 * @param u1Path
 * @retval
*/
extern E_HDMI_IF_AUD_FREQUENCY eHdmiIf_GetAudioFrequency(UINT8 u1Path);

/**
 * @brief fgHdmiIf_IsSupportAudio
 * @param u1Path
 * @retval
*/
extern BOOL fgHdmiIf_IsSupportAudio(UINT8 u1Path);

/**
 * @brief fgHdmiIf_IsPcm
 * @param u1Path
 * @retval
*/
extern BOOL fgHdmiIf_IsPcm(UINT8 u1Path);

/**
 * @brief fgHdmiIf_IsMhlSignal
 * @param u1Path
 * @retval
*/
extern BOOL fgHdmiIf_IsMhlSignal(UINT8 u1Path);

/**
 * @brief fgHdmiIf_IsHDMI2Signal
 * @param u1Path
 * @retval
*/
extern BOOL fgHdmiIf_IsHDMI2Signal(UINT8 u1Path);

/**
 * @brief fgHdmiIf_GetInfoframe
 * @param u1Path
 * @param u1FrameType
 * @param *ptInfoFrame
 * @retval
*/
extern BOOL fgHdmiIf_GetInfoframe(UINT8 u1Path, UINT8 u1FrameType, HDMI_IF_INFOFRAME *ptInfoFrame);

/**
 * @brief u1HdmiIf_GetAudioChannelNum
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetAudioChannelNum(UINT8 u1Path);

/**
 * @brief eHdmiIf_GetSingalFormat
 * @param u1Path
 * @retval
*/
extern HDMI_IF_SINGAL_FORMAT eHdmiIf_GetSingalFormat(UINT8 u1Path);

/**
 * @brief u1HdmiIf_RgbRange
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_RgbRange(UINT8 u1Path);

/**
 * @brief fgHdmiIf_IsVideoTiming
 * @param u1Path
 * @retval
*/
extern BOOL fgHdmiIf_IsVideoTiming(UINT8 u1Path);

/**
 * @brief vHdmiIf_SetAcpChgCb
 * @param pfAcpChgCb
 * @retval
*/
extern void vHdmiIf_SetAcpChgCb(HDMI_IF_ACP_CHG_CB pfAcpChgCb,void* pvTag);

/**
 * @brief u1HdmiIf_GetHdrEOTF
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetHdrEOTF(UINT8 u1Path);

/**
 * @brief eHdmiIf_GetColorSpace
 * @param u1Path
 * @retval
*/
extern HDMI_IF_CLR_SPC eHdmiIf_GetColorSpace(UINT8 u1Path);

/**
 * @brief fgHdmiIf_GetAudioPCMMode
 * @retval
*/
extern BOOL fgHdmiIf_GetAudioPCMMode(void);

/**
 * @brief u1HdmiIf_GetSingalStatus
 * @retval
*/
extern UINT8 u1HdmiIf_GetSingalStatus(UINT8 u1Port,BOOL fgIsVirtualPort);

/**
 * @brief Get HDMI audio channel status
 * @param u1Path: The path(main/sub) to get, for audio, it is reserved for feature usage
 * @param pfgCopyright: Pointer to copy right info
 * @param pu1CategoryCode: Pointer to category code info
 * @param p1WordLength: Pointer to word length info
 * @param pfgIsPcm: Pointer to pcm info
 * @retval
*/
extern void vHdmiIf_GetAudChannelStatus(UINT8 u1Path,BOOL *pfgCopyright,UINT8 *pu1CategoryCode,UINT8 *p1WordLength,BOOL *pfgIsPcm);

/**
 * @brief u1HdmiIf_IsDolbyVision
 * @param u1Path
 * @retval
*/
extern UINT8 u1HdmiIf_GetDolbyVision(UINT8 u1Path);
#endif
