/*
 * @file hv_app_Ddcci.h
 * @brief Header file of ddcci.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use 
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-01-31
 */

#ifndef _HV_APP_DDCCI_H
#define _HV_APP_DDCCI_H

#include "hv_comm_DataType.h"
#include "hv_vos_Comm.h"
#include "hv_mw_Ddcci.h"


#define DDC_LOG_ENABLE
#ifdef DDC_LOG_ENABLE
#define DDC_PRINT(...)           HV_LOG_INFO(DDCCI, __VA_ARGS__)
#define DDC_BUF_PRINT(...)       HV_LOG_BUF_INFO(__VA_ARGS__)
#else
#define DDC_PRINT(...)
#define DDC_BUF_PRINT(...)
#endif

#define LOBYTE(w)                               ((UCHAR8)(w))
#define HIBYTE(w)                               ((UCHAR8)(((USHORT16)(w) >> 8) & 0x00FF))
#define LOWORD(dw)                              ((USHORT16)(dw))
#define HIWORD(dw)                              ((USHORT16)((dw) >> 16))

#define TO_WORD(byte_h, byte_l)                 (((USHORT16)((UCHAR8)(byte_h)) << 8) |\
                                                ((USHORT16)((UCHAR8)(byte_l)) << 0))

#define TO_DWORD(byte_hh, byte_hl,\
                 byte_lh, byte_ll)              (((USHORT16)((UCHAR8)(byte_hh)) << 24) |\
                                                ((USHORT16)((UCHAR8)(byte_hl)) << 16) |\
                                                ((USHORT16)((UCHAR8)(byte_lh)) << 8) |\
                                                ((USHORT16)((UCHAR8)(byte_ll)) << 0))

#define DDCCI_TYPE_JUDGE_BYTE                   1
#define DDCCI_CONTROL_STATUS_FLAG               0x80

#define DDCCI_FAC_CMD_TYPE_READ                 0x12
#define DDCCI_FAC_CMD_TYPE_WRITE                0x11

#define DDCCI_FAC_OFFSET_LEN_HIGH               4
#define DDCCI_FAC_OFFSET_LEN_LOW                5

typedef enum 
{
    DDCCI_RW_READ,
    DDCCI_RW_WRITE,
    DDCCI_RW_UNKNOWN
} DDCCI_CMD_RW_E;

typedef enum 
{
    DDCCI_TYPE_HIVIEW_TOOL,
    DDCCI_TYPE_HIVIEW_OTA,
    DDCCI_TYPE_VCP_STANDARD,
    DDCCI_TYPE_VCP_TPV,
    DDCCI_TYPE_VCP_AUO,
    DDCCI_TYPE_VCP_CTX,
    DDCCI_TYPE_UNKNOWN
} DDCCI_CMD_TYPE_E;

typedef VOID (*DDCCI_PROC_HANDLE)(UCHAR8, UCHAR8 *, USHORT16);

//--------------------------------------------------
// Definitions of DDCCI Commands. From DDC CI v1.1(12. Appendix C: Summary of Op. Codes).
//--------------------------------------------------
#define DDCCI_CMD_GET_VCP_FEATURE                  0x01
#define DDCCI_CMD_GET_VCP_FEATURE_REPLY            0x02
#define DDCCI_CMD_SET_VCP_FEATURE                  0x03
#define DDCCI_CMD_REPLY_TIMING_MESSAGE             0x06
#define DDCCI_CMD_GET_TIMING_REPORT                0x07
#define DDCCI_CMD_SAVE_CURRENT_SETTINGS            0x0C
#define DDCCI_CMD_CAPABILITIES_REQUEST_REPLY       0xE3
#define DDCCI_CMD_CAPABILITIES_REQUEST             0xF3
#define DDCCI_CMD_MANUFACTURER_AT_REQ_1            0xC0
#define DDCCI_CMD_MANUFACTURER_AT_REQ_2            0xD0
#define DDCCI_CMD_MANUFACTURER_FW_UPDATE           0xC6

// RC
#define DDCCI_CMD_GETVCP_RC_NO_ERROR               0x00
#define DDCCI_CMD_GETVCP_RC_UNSUPPORTED            0x01

// TP
#define DDCCI_CMD_GETVCP_TP_SET_PARAMETER          0x00
#define DDCCI_CMD_GETVCP_TP_MOMENTARY              0x01

//--------------------------------------------------
// Definitions of DDCCI Address
//--------------------------------------------------
#define DDCCI_DEST_ADDRESS                         0x6E
#define DDCCI_SRC_ADDRESS                          0x51

#define DDCCI_DATA_LEN_CTRL                        (~DDCCI_CONTROL_STATUS_FLAG)

/**
 * @brief MCCS消息头的长度，包括addr(1B)+len(1B)+crc(1B)
 */
#define DDCCI_HEADER_LEN                           3

/**
 * @brief Capabilities消息返回时的冗余数据长度，包括addr(1B)+len(1B)+opcode(1B)+ofsh(1B)+ofsL(1B)+crc(1B)
 */
#define DDCCI_GET_CAP_HEADER_LEN                   6

#define DDCCI_GET_VCP_DATA_LEN                     8

#define DDCCI_HDMI_CAP_TX_LEN                      32
#define DDCCI_DP_CAP_TX_LEN                        16

//--------------------------------------------------
// Definitions of DDCCI Protocol Items. Byte Order.
//--------------------------------------------------
#define DDCCI_SOURCE                               0
#define DDCCI_LENGTH                               1
#define DDCCI_COMMAND                              2
#define DDCCI_SOURCE_OPCODE                        3

#define DDCCI_RESULT_CODE                          3
#define DDCCI_SINK_OPCODE                          4
#define DDCCI_TYPE_CODE                            5
#define DDCCI_MAX_HIGH_BYTE                        6
#define DDCCI_MAX_LOW_BYTE                         7
#define DDCCI_PRESENT_HIGH_BYTE                    8
#define DDCCI_PRESENT_LOW_BYTE                     9

#define DDCCI_SET_HIGH_BYTE                        4
#define DDCCI_SET_LOW_BYTE                         5

#define DDCCI_OFS_HIGH_BYTE                        3
#define DDCCI_OFS_LOW_BYTE                         4

#define DDCCI_TIMING_MSG_COMMAND                   1
#define DDCCI_TIMING_MSG_OPCODE                    2
#define DDCCI_TIMING_STATUS                        3
#define DDCCI_TIMING_HFREQ_HBYTE                   4
#define DDCCI_TIMING_HFREQ_LBYTE                   5
#define DDCCI_TIMING_VFREQ_HBYTE                   6
#define DDCCI_TIMING_VFREQ_LBYTE                   7


//--------------------------------------------------
// Definitions of DDCCI Commands. From DDC CI v1.1(12. Appendix C: Summary of Op. Codes).
//--------------------------------------------------
#define DDCCI_CMD_GET_VCP_FEATURE                  0x01
#define DDCCI_CMD_GET_VCP_FEATURE_REPLY            0x02
#define DDCCI_CMD_SET_VCP_FEATURE                  0x03
#define DDCCI_CMD_REPLY_TIMING_MESSAGE             0x06
#define DDCCI_CMD_GET_TIMING_REPORT                0x07
#define DDCCI_CMD_SAVE_CURRENT_SETTINGS            0x0C
#define DDCCI_CMD_CAPABILITIES_REQUEST_REPLY       0xE3
#define DDCCI_CMD_CAPABILITIES_REQUEST             0xF3
#define DDCCI_CMD_MANUFACTURER_AT_REQ_1            0xC0
#define DDCCI_CMD_MANUFACTURER_AT_REQ_2            0xD0
#define DDCCI_CMD_MANUFACTURER_FW_UPDATE           0xC6

#define DDCCI_VIRTUAL_HOST_ADDRESS                 0x50


//--------------------------------------------------
// Definitions of DDCCI VCP Opcode. From MCCS2.2a Table 11-1(VCP Code).
//--------------------------------------------------
#define DDCCI_OPCODE_VCP_CODE_PAGE                 0x00
#define DDCCI_OPCODE_VCP_DEGAUSS                   0x01
#define DDCCI_OPCODE_VCP_NEW_CONTROL_VALUE         0x02
#define DDCCI_OPCODE_VCP_SOFT_CONTROLS             0x03
#define DDCCI_OPCODE_VCP_FACTORY_RESET             0x04
#define DDCCI_OPCODE_VCP_RECAL_BRI_CON             0x05
#define DDCCI_OPCODE_VCP_GEOMETRY_RESET            0x06
#define DDCCI_OPCODE_VCP_COLOR_RESET               0x08
#define DDCCI_OPCODE_VCP_FACTORY_TV_RESET          0x0A
#define DDCCI_OPCODE_VCP_COLOR_TEMP_INCREMENT      0x0B
#define DDCCI_OPCODE_VCP_COLOR_TEMP_REQUEST        0x0C
#define DDCCI_OPCODE_VCP_CLOCK                     0x0E
#define DDCCI_OPCODE_VCP_BACKLIGHT                 0x10
#define DDCCI_OPCODE_VCP_FLESH_TONE_ENHANCEMENT    0x11
#define DDCCI_OPCODE_VCP_CONTRAST                  0x12
#define DDCCI_OPCODE_VCP_SELECT_COLOR_PRESET       0x14
#define DDCCI_OPCODE_VCP_RED_GAIN                  0x16
#define DDCCI_OPCODE_VCP_COLOR_VISION_COMPENSATION 0x17
#define DDCCI_OPCODE_VCP_GREEN_GAIN                0x18
#define DDCCI_OPCODE_VCP_BLUE_GAIN                 0x1A
#define DDCCI_OPCODE_VCP_FOCUS                     0x1C
#define DDCCI_OPCODE_VCP_AUTO_SET_UP               0x1E
#define DDCCI_OPCODE_VCP_AUTO_COLOR                0x1F
#define DDCCI_OPCODE_VCP_HPOSITION                 0x20
#define DDCCI_OPCODE_VCP_HSIZE                     0x22
#define DDCCI_OPCODE_VCP_HPINCUSHION               0x24
#define DDCCI_OPCODE_VCP_HPINCUSHION_BALANCE       0x26
#define DDCCI_OPCODE_VCP_HCONVERGENCE_RB           0x28
#define DDCCI_OPCODE_VCP_HCONVERGENCE_MG           0x29
#define DDCCI_OPCODE_VCP_HLINEARITY                0x2A
#define DDCCI_OPCODE_VCP_HLINEARITY_BALANCE        0x2C
#define DDCCI_OPCODE_VCP_GRAY_SCALE_EXPANSION      0x2E
#define DDCCI_OPCODE_VCP_VPOSITION                 0x30
#define DDCCI_OPCODE_VCP_VSIZE                     0x32
#define DDCCI_OPCODE_VCP_VPINCUSHION               0x34
#define DDCCI_OPCODE_VCP_VPINCUSHION_BALANCE       0x36
#define DDCCI_OPCODE_VCP_VCONVERGENCE_RB           0x38
#define DDCCI_OPCODE_VCP_VCONVERGENCE_MG           0x39
#define DDCCI_OPCODE_VCP_VLINEARITY                0x3A
#define DDCCI_OPCODE_VCP_VLINEARITY_BALANCE        0x3C
#define DDCCI_OPCODE_VCP_CLOCK_PHASE               0x3E
#define DDCCI_OPCODE_VCP_HPARALLELOGRAM            0x40
#define DDCCI_OPCODE_VCP_VPARALLELOGRAM            0x41
#define DDCCI_OPCODE_VCP_HKEYSTONE                 0x42
#define DDCCI_OPCODE_VCP_VKEYSTONE                 0x43
#define DDCCI_OPCODE_VCP_ROTATION                  0x44
#define DDCCI_OPCODE_VCP_TOP_CORNER_FLARE          0x46
#define DDCCI_OPCODE_VCP_TOP_CORNER_HOOK           0x48
#define DDCCI_OPCODE_VCP_BOTTOM_CORNER_FLARE       0x4A
#define DDCCI_OPCODE_VCP_BOTTOM_CORNER_HOOK        0x4C
#define DDCCI_OPCODE_VCP_TIMING_MSG                0x4E
#define DDCCI_OPCODE_VCP_ACTIVE_CONTROL            0x52
#define DDCCI_OPCODE_VCP_COLORTEMP                 0x54
#define DDCCI_OPCODE_VCP_HMOIRE                    0x56
#define DDCCI_OPCODE_VCP_VMOIRE                    0x58
#define DDCCI_OPCODE_VCP_SAT_RED                   0x59
#define DDCCI_OPCODE_VCP_SAT_YELLOW                0x5A
#define DDCCI_OPCODE_VCP_SAT_GREEN                 0x5B
#define DDCCI_OPCODE_VCP_SAT_CYAN                  0x5C
#define DDCCI_OPCODE_VCP_SAT_BLUE                  0x5D
#define DDCCI_OPCODE_VCP_SAT_MAGENTA               0x5E
#define DDCCI_OPCODE_VCP_INPUT_SOURCE              0x60
#define DDCCI_OPCODE_VCP_AUDIO_VOLUME              0x62
#define DDCCI_OPCODE_VCP_SPEAKER_SELECT            0x63
#define DDCCI_OPCODE_VCP_MICROPHONE_VOLUME         0x64
#define DDCCI_OPCODE_VCP_AMBIENT_LIGHT_SENSOR      0x66
#define DDCCI_OPCODE_VCP_BACKLIGHT_LEVEL_WHITE     0x6B
#define DDCCI_OPCODE_VCP_RED_BLACK_LEVEL           0x6C
#define DDCCI_OPCODE_VCP_BACKLIGHT_LEVEL_RED       0x6D
#define DDCCI_OPCODE_VCP_GREEN_BLACK_LEVEL         0x6E
#define DDCCI_OPCODE_VCP_BACKLIGHT_LEVEL_GREEN     0x6F
#define DDCCI_OPCODE_VCP_BLUE_BLACK_LEVEL          0x70
#define DDCCI_OPCODE_VCP_BACKLIGHT_LEVEL_BLUE      0x71
#define DDCCI_OPCODE_VCP_GAMMA                     0x72
#define DDCCI_OPCODE_VCP_LUT_SIZE                  0x73
#define DDCCI_OPCODE_VCP_SINGLE_POINT_LUT          0x74
#define DDCCI_OPCODE_VCP_BLOCK_LUT                 0x75
#define DDCCI_OPCODE_VCP_REMOTE_PROC_CALL          0x76
#define DDCCI_OPCODE_VCP_ID_DATA_OPERATION         0x78
#define DDCCI_OPCODE_VCP_ADJUST_ZOOM               0x7C
#define DDCCI_OPCODE_VCP_PRODUCTKEY                0x7E
#define DDCCI_OPCODE_VCP_HMIRROR                   0x82
#define DDCCI_OPCODE_VCP_VMIRROR                   0x84
#define DDCCI_OPCODE_VCP_DISPLAY_SCALING           0x86
#define DDCCI_OPCODE_VCP_SHARPNESS                 0x87
#define DDCCI_OPCODE_VCP_VELOCITY_SCAN_MODULATION  0x88
#define DDCCI_OPCODE_VCP_TV_SATURATION             0x8A
#define DDCCI_OPCODE_VCP_TV_CHANNEL_UP_DOWN        0x8B
#define DDCCI_OPCODE_VCP_TV_SHARPNESS              0x8C
#define DDCCI_OPCODE_VCP_AUDIO_MUTE                0x8D
#define DDCCI_OPCODE_VCP_TV_CONTRAST               0x8E
#define DDCCI_OPCODE_VCP_AUDIO_TREBLE              0x8F
#define DDCCI_OPCODE_VCP_HUE                       0x90
#define DDCCI_OPCODE_VCP_AUDIO_BASS                0x91
#define DDCCI_OPCODE_VCP_TV_BLACK_LEVEL            0x92
#define DDCCI_OPCODE_VCP_AUDIO_BALANCE             0x93
#define DDCCI_OPCODE_VCP_AUDIO_PROCESSOR_MODE      0x94
#define DDCCI_OPCODE_VCP_WINDOW_POSITION_TL_X      0x95
#define DDCCI_OPCODE_VCP_WINDOW_POSITION_TL_Y      0x96
#define DDCCI_OPCODE_VCP_WINDOW_POSITION_BR_X      0x97
#define DDCCI_OPCODE_VCP_WINDOW_POSITION_BR_Y      0x98
#define DDCCI_OPCODE_VCP_WINDOW_BACKGROUND         0x9A
#define DDCCI_OPCODE_VCP_RED                       0x9B
#define DDCCI_OPCODE_VCP_YELLOW                    0x9C
#define DDCCI_OPCODE_VCP_GREEN                     0x9D
#define DDCCI_OPCODE_VCP_CYAN                      0x9E
#define DDCCI_OPCODE_VCP_BLUE                      0x9F
#define DDCCI_OPCODE_VCP_MAGENDA                   0xA0
#define DDCCI_OPCODE_VCP_AUTO_SETUP                0xA2
#define DDCCI_OPCODE_VCP_WINDOW_MASK_CONTROL       0xA4
#define DDCCI_OPCODE_VCP_WINDOW_SELECT             0xA5
#define DDCCI_OPCODE_VCP_WINDOW_SIZE               0xA6
#define DDCCI_OPCODE_VCP_WINDOW_TRANSPARENCY       0xA7
#define DDCCI_OPCODE_VCP_SYNC_TYPE                 0xA8
#define DDCCI_OPCODE_VCP_SCREEN_ORIENTATION        0xAA
#define DDCCI_OPCODE_VCP_HFREQ                     0xAC
#define DDCCI_OPCODE_VCP_VFREQ                     0xAE
#define DDCCI_OPCODE_VCP_STORE_SETTING             0xB0
#define DDCCI_OPCODE_VCP_PANEL_TYPE                0xB2
#define DDCCI_OPCODE_VCP_RGB_ORDERING              0xB4
#define DDCCI_OPCODE_VCP_COLOR_CODING              0xB5
#define DDCCI_OPCODE_VCP_MONITOR_TYPE              0xB6
#define DDCCI_OPCODE_VCP_MONITOR_STATUS            0xB7
#define DDCCI_OPCODE_VCP_PACKET_COUNT              0xB8
#define DDCCI_OPCODE_VCP_MONITOR_X_ORIGIN          0xB9
#define DDCCI_OPCODE_VCP_MONITOR_Y_ORIGIN          0xBA
#define DDCCI_OPCODE_VCP_HEADER_ERROR_COUNT        0xBB
#define DDCCI_OPCODE_VCP_BODY_CRC_ERROR_COUNT      0xBC
#define DDCCI_OPCODE_VCP_CLIENT_ID                 0xBD
#define DDCCI_OPCODE_VCP_LINK_CONTROL              0xBE
#define DDCCI_OPCODE_VCP_USAGE_TIME                0xC0
#define DDCCI_OPCODE_VCP_DISP_DESCRIPTOR_LENGTH    0xC2
#define DDCCI_OPCODE_VCP_TRANSMIT_DISP_DESCRIPTOR  0xC3
#define DDCCI_OPCODE_VCP_DISP_DESCRIPTOR_EN        0xC4
#define DDCCI_OPCODE_VCP_APPLICATION_ENABLE        0xC6
#define DDCCI_OPCODE_VCP_DISP_ENABLE_KEY           0xC7
#define DDCCI_OPCODE_VCP_CONTROLLER_TYPE           0xC8
#define DDCCI_OPCODE_VCP_FW_LEVEL                  0xC9
#define DDCCI_OPCODE_VCP_OSD_ON_OFF                0xCA
#define DDCCI_OPCODE_VCP_OSD_LANGUAGE              0xCC
#define DDCCI_OPCODE_VCP_STATUS_INDICATOR          0xCD
#define DDCCI_OPCODE_VCP_AUXILIARY_DISP_SIZE       0xCE
#define DDCCI_OPCODE_VCP_AUXILIARY_DISP_DATA       0xCF
#define DDCCI_OPCODE_VCP_OUTPUT_SELECT             0xD0
#define DDCCI_OPCODE_VCP_ASSET_TAG                 0xD2
#define DDCCI_OPCODE_VCP_STEREO_VIDEO_MODE         0xD4
#define DDCCI_OPCODE_VCP_POWER_MODE                0xD6
#define DDCCI_OPCODE_VCP_AUXILIARY_POWER_OUTPUT    0xD7
#define DDCCI_OPCODE_VCP_SCAN_MODE                 0xDA
#define DDCCI_OPCODE_VCP_IMAGE_MODE                0xDB
#define DDCCI_OPCODE_VCP_DISPLAY_APPLICATION       0xDC
#define DDCCI_OPCODE_VCP_SCRACHPAD                 0xDE
#define DDCCI_OPCODE_VCP_VERSION                   0xDF
#define DDCCI_OPCODE_VCP_MANUFACTURER_ENERGY_LEVEL 0xE2
#define DDCCI_OPCODE_VCP_AMD_FREE_SYNC_ON_OFF      0xE6

//Color Preset
#define COLOR_SRGB                      0x01
#define COLOR_NATIVE                    0x02
#define COLOR_5000K                     0x04
#define COLOR_WARM                      0x05  //6500K
#define COLOR_NORMAL                    0x06  //7300K or 7500K
#define COLOR_8200K                     0x07
#define COLOR_COOL                      0x08  //9300K
#define COLOR_11500K                    0x0A
#define COLOR_USER                      0x0B
#define COLOR_ADOBE_RGB                 0x0E

//Input Source
#define SRC_DP1                         0x0F
#define SRC_DP2                         0x10
#define SRC_HDMI1                       0x11
#define SRC_HDMI2                       0x12
#define SRC_TYPEC1                      0x15
#define SRC_TYPEC2                      0x16

//Display Scaling
#define SCALING_1_1                     0x01
#define SCALING_FULL_SCREEN_WIDE        0x02
#define SCALING_FULL_SCREEN_4_3         0x05
#define SCALING_17INCH_4_3              0x0B
#define SCALING_19INCH_4_3              0x0C
#define SCALING_19INCH_5_4              0x0D
#define SCALING_19INCH_16_10            0x0E
#define SCALING_21P5INCH_16_9           0x0F
#define SCALING_22INCH_16_10            0x10
#define SCALING_23INCH_16_9             0x11
#define SCALING_23P6INCH_16_9           0x12
#define SCALING_24INCH_16_9             0x13
#define SCALING_27INCH_16_9             0x14
#define SCALING_MOVIE1                  0x21
#define SCALING_MOVIE2                  0x22
#define SCALING_ASPECT                  0x23

//Display Application-->
//Gaming Mode
#define APP_GAMING_MODE_OFF             0x00
#define APP_GAMING_MODE_FPS             0x0B
#define APP_GAMING_MODE_RTS             0x0C
#define APP_GAMING_MODE_RACING          0x0D
#define APP_GAMING_MODE_GAMER1          0x0E
#define APP_GAMING_MODE_GAMER2          0x0F
#define APP_GAMING_MODE_GAMER3          0x10
//Eco Mode
#define APP_ECO_MODE_STANDARD           0x80
#define APP_ECO_MODE_TEXT               0x81
#define APP_ECO_MODE_READING            0x82
#define APP_ECO_MODE_INTERNET           0x83
#define APP_ECO_MODE_MOVIE              0x84
#define APP_ECO_MODE_SPORTS             0x85
#define APP_ECO_MODE_PHOTOGRAPHER       0x86
//HDR Mode
#define APP_HDR_MODE_PICTURE            0x87
#define APP_HDR_MODE_MOVIE              0x88
#define APP_HDR_MODE_GAME               0x89
//HDR(Source is hdr on really)
#define APP_HDR_OFF                     0x90
#define APP_HDR_DISPLAY_HDR             0x91
#define APP_HDR_PICTURE                 0x92
#define APP_HDR_MOVIE                   0x93
#define APP_HDR_GAME                    0x94


UCHAR8 Hv_App_Ddcci_LangConvertToOsd(UCHAR8 ucLang);

UCHAR8 Hv_App_Ddcci_LangConvertFromOsd(UCHAR8 ucLang);

/**
 * @brief Send ddcci message by Specified Port.
 * @param[in] enDdcciPort Indicates the ddcci port.
 * @param[in] pucData Pointer of the data.
 * @param[in] ucLen Length of the data.
 * @return Status HV_SUCCESS.
 */
Status Hv_App_Ddcci_SendData(DdcciPortEnum enDdcciPort, UCHAR8 *pucData, UINT32 uiLen);

/**
 * @brief Send Null-Message.
 * @param[in] enDdcciPort 表征是哪个通道.
 * @return None.
 */
VOID Hv_App_Ddcci_SendNullMsg(DdcciPortEnum enDdcciPort);

/**
 * @brief Calculate the CRC.
 * @param[in] pucData Pointer of the data.
 * @return UCHAR8  CRC value.
 */
UCHAR8 Hv_App_Ddcci_CalCheckSum(UCHAR8 *pucData);

/**
 * @brief Calculate the CRC of incoming message. Used for any array with mccs header.
 * @param[in] VOID.
 * @return Status  HV_SUCCESS:verify pass, HV_FAILURE:verify fail.
 */
Status Hv_App_Ddcci_VerifyCheckSum(UCHAR8 *pucData);

/**
 * @brief App层对ddcci通道上消息的处理函数.
 * @param[in] pstDdcEvt Poniter of the ddcci event.
 * @return Status  消息处理成功后返回HV_SUCCESS.
 */
Status  Hv_App_Ddcci_HandleMsg(DdcciEvent *pstDdcEvt);

/**
 * @brief Initial app layer of ddcci.
 * @param[in] None.
 * @return None.
 */
VOID Hv_App_Ddcci_Init(VOID);

/**
 * @brief Send event to osd
 * @param[in] usEventId OSD_EVENT_MCCS
 * @param[in] usValue unused
 * @return Status.
 */
Status Hv_App_Ddcci_SendEventToOsd(USHORT16 usEventId, USHORT16 usValue);

VOID Hv_Mw_Ddcci_JudgeCmdParam(UCHAR8 *pucData, DDCCI_CMD_TYPE_E *, UINT32 *);

VOID Hv_App_Ddcci_Register(DDCCI_PROC_HANDLE pfHandle);

#endif
