/**
 * @file hv_drv_EdpTxTraining.h
 * @brief Header file of CAL EdpTxTraining sturct.
 * 
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * 
 * 
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 0.0.1
 * @date 2022-10-12
 */

#ifndef _HV_DRV_EDP_TX_TRAINING_H_
#define _HV_DRV_EDP_TX_TRAINING_H_

#include "Common/hv_comm_DataType.h"
#include "hv_cal_EdpTxCommon.h"
#include "hv_comm_Define.h"
/* EDP training type */
#define HV_EDP_TX_NO_LINK_TRAINING             0
#define HV_EDP_TX_FAST_LINK_TRAINING           1
#define HV_EDP_TX_FULL_LINK_TRAINING           2

typedef enum _HvEdpTxDpcdAddr
{
    DPCD_REV                    = 0x00,
    TRAINING_AUX_RD_INTERVAL    = 0x0E,
    LINK_BW_SET                 = 0x100,
    TRAINING_PATTERN_SELECT     = 0x102,
    TRAINING_LANE0_SET          = 0x103,
    MSTM_CTRL                   = 0x111,
    SINK_COUNT                  = 0x200,
    LANE0_1_STATUS              = 0x202,
    SET_DP_PWR_VOLTAGE          = 0x600,
}HvEdpTxDpcdAddr;

typedef struct _HvEdpTxSinkLinkStatusInfo
{
    UCHAR8    ucLane01Status;
    UCHAR8    ucLane23Status;
    UCHAR8    ucLaneAlignStatus;
    UCHAR8    ucSinkStatus;
    UCHAR8    ucLane0SwingLevel;
    UCHAR8    ucLane0PreEmpLevel;
    UCHAR8    ucLane1SwingLevel;
    UCHAR8    ucLane1PreEmpLevel;
    UCHAR8    ucLane2SwingLevel;
    UCHAR8    ucLane2PreEmpLevel;
    UCHAR8    ucLane3SwingLevel;
    UCHAR8    ucLane3PreEmpLevel;
}HvEdpTxSinkLinkStatusInfo;

typedef struct _HvEdpTxAnalogParam
{
    UCHAR8 aucSwingLevel[4];
    UCHAR8 aucPreEmphLevel[4];
}HvEdpTxAnalogParam;

typedef struct _HvSinkDpcdAbility
{
    UCHAR8 ucLinkRate;
    UCHAR8 ucLaneCount;
    UCHAR8 ucDpcdRev;
    UCHAR8 ucRdItrVal;
    UCHAR8 ucEnhnFrame;
    UCHAR8 ucTPS3Sprt;
    UCHAR8 ucTPS4Sprt;
}HvSinkDpcdAbility;

Status Hv_Drv_EdpTx_NoLinkTrainingStatus(VOID);

/**
 * @brief EdpTx ExecuteTraining.
 * @param[in] pstTrainingInputParam: edp training inp param.
 */
BOOL Hv_Drv_EdpTx_ExecuteTraining(HvEdpTxTrainingInputParam *pstTrainingInputParam);

/**
 * @brief EdpTx OLED set backlight.
 * @param[in] bSb: MSB LSB
 */
VOID Hv_Drv_EDP_SetOledBacklight(VOID);
#endif
