/**
 * @file        hv_drv_Mailbox.h
 * @brief       hv_drv_Mailbox header file.
 * @details     This file provides the following functions: \n
 * @author      HiView SoC Software Team
 * @version     1.0.0
 * @date        2022-09-06
 * @copyright   Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par         History:
 * <table>
 * <tr><th>Author                        <th>Date         <th>Change Description
 * <tr><td>HiView SoC Software Team      <td>2022-09-06   <td>create
 * </table>
*/
#ifndef __HV_DRV_MAILBOX_H__
#define __HV_DRV_MAILBOX_H__

#include "Common/hv_comm_DataType.h"

/* mailbox param */
#define MAILBOX_MSG_LEN_MAX 12

typedef enum _MailboxMsgType
{
    E_MAILBOX_CMD_NULL = 0,
    E_MAILBOX_CMD_PM_TO_RISC_KEY_VAL = 1,
    E_MAILBOX_CMD_PM_TO_RISC_KEY_UPSPRING = 2,
    E_MAILBOX_CMD_PM_TO_RISC_KEY_COMBO = 3,
    E_MAILBOX_CMD_PM_TO_RISC_WAKEUP = 4,
    E_MAILBOX_CMD_RISC_TO_PM_POWER_OFF_ACK = 5,
    E_MAILBOX_CMD_RISC_TO_PM_STAND_BY = 6,
    E_MAILBOX_CMD_RISC_TO_PM_NORMAL = 7,
    E_MAILBOX_CMD_PM_TO_RISC_IR_VAL = 8,
    E_MAILBOX_CMD_PM_TO_RISC_IR_REPEAT = 9,
    E_MAILBOX_CMD_PM_TO_RISC_POWER_OFF = 10,
    E_MAILBOX_CMD_PM_TO_RISC_HEART_MONITOR = 11,
    E_MAILBOX_CMD_PM_TO_RISC_FACTORY_MODE = 12,
    E_MAILBOX_CMD_RISC_TO_PM_LED_MODE_OFF = 13,
    E_MAILBOX_CMD_RISC_TO_PM_LED_MODE_ON = 14,
    E_MAILBOX_CMD_RISC_TO_PM_FIX_MODE_OFF = 15,
    E_MAILBOX_CMD_RISC_TO_PM_FIX_MODE_ON = 16,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_MAIN_CHANNEL_HDMI0 = 17,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_MAIN_CHANNEL_HDMI1 = 18,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_MAIN_CHANNEL_DP0 = 19,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_MAIN_CHANNEL_DP1 = 20,
    E_MAILBOX_CMD_RISC_TO_PM_FACTORY_OFF = 21,
    E_MAILBOX_CMD_RISC_TO_PM_FACTORY_ON = 22,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_SUB_CHANNEL_HDMI0 = 23,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_SUB_CHANNEL_HDMI1 = 24,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_SUB_CHANNEL_DP0 = 25,
    E_MAILBOX_CMD_RISC_TO_PM_CUR_SUB_CHANNEL_DP1 = 26,
    E_MAILBOX_CMD_RISC_TO_PM_SET_LED_OFF = 27,
    E_MAILBOX_CMD_RISC_TO_PM_SET_LED_ON = 28,
    E_MAILBOX_CMD_RISC_TO_PM_SET_LED_BREATH = 29,
    E_MAILBOX_CMD_RISC_TO_PM_SET_LED_ON1 = 30,
    E_MAILBOX_CMD_RISC_TO_PM_SET_LED_ON2 = 31,
    E_MAILBOX_CMD_RISC_TO_PM_SET_LED_ON3 = 32,
    E_MAILBOX_CMD_PM_TO_RISC_LOCK_MODE   = 33,
    E_MAILBOX_CMD_PM_TO_RISC_DP0_AUXN_INT = 34,
    E_MAILBOX_CMD_PM_TO_RISC_DP1_AUXN_INT = 35,
    E_MAILBOX_CMD_MAX = 127
}MailboxMsgType;

typedef enum _WakeUPType
{
    E_WAKE_UP_TYPE_POWER_ON = 0,
    E_WAKE_UP_TYPE_HDMI_CABLE,
    E_WAKE_UP_TYPE_DP_CABLE,
    E_WAKE_UP_TYPE_TYPE_C_CABLE,

    E_WAKE_UP_TYPE_HDMI_TMDS,
    E_WAKE_UP_TYPE_HDMI_CEC,
    E_WAKE_UP_TYPE_DP_AUX,
    E_WAKE_UP_TYPE_TYPE_C_CC_CMD,

    E_WAKE_UP_TYPE_KEY,
    E_WAKE_UP_TYPE_IR,
    E_WAKE_UP_TYPE_DP_GPIO,
    E_WAKE_UP_TYPE_STANDBY_TO_POWEROFF,
}WakeUPType;

typedef struct _MailboxMsgHeader
{
    UCHAR8   u8MsgType;
    USHORT16 u16MsgLen; /**< little endien */
    UCHAR8   u8Crc;
}__attribute__((packed))MailboxMsgHeader;

typedef struct _MailboxMsg
{
    MailboxMsgHeader stMsgHeader;
    UCHAR8           au8MsgBody[MAILBOX_MSG_LEN_MAX];
}MailboxMsg;

Status Hv_Drv_MailboxRecvMsg(MailboxMsg *pstMsg);
Status Hv_Drv_MailboxSendMsg(MailboxMsg *pstMsg);
Status Hv_Drv_MailboxGetKeyValue(MailboxMsg *pstMsg, UCHAR8 *pucKeyValue);
Status Hv_Drv_MailboxGetIRKeyValue(MailboxMsg *pstMsg, UCHAR8 *pucSysCode, UCHAR8 *pucKeyValue);
UINT32 Hv_Drv_Mailbox_GetPQToolCmdPort(VOID);
UINT32 Hv_Drv_Mailbox_GetSwIntStatus(VOID);
VOID Hv_Drv_Mailbox_ClearSwIntStatus(UINT32 uiSwintStatus);

#endif /**< __HV_DRV_MAILBOX_H__ */
