/*
 * @file hv_cal_Audio.h
 * @brief Header file of audio module.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use Hv_Cal_Audio_SetRxOut()
 * @endverbatim
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-18
 */

#ifndef __SDK_CAL_AUDIO_H__
#define __SDK_CAL_AUDIO_H__

#include "Common/hv_comm_DataType.h"
#include "hv_comm_Define.h"

#define _AUDIO_HDMI_0       0
#define _AUDIO_HDMI_1       1
#define _AUDIO_DP_0         2
#define _AUDIO_DP_1         3
#define _AUDIO_TYPE_C_0     4
#define _AUDIO_TYPE_C_1     5
#define _AUDIO_PATTERN      6
#define _AUDIO_I2S_PAD      7
#define _AUDIO_SPDIF_PAD    8

#define _AUDIO_DETECT_FS    0xc
#define _AUDIO_PATH_UNMUTE  0x720
#define _DP_AUDIO_PATH_UNMUTE  0x00

#define _AUDIO_INT_EDGE_P   0
#define _AUDIO_INT_EDGE_N   1

#define _AUDIO_MUTE_BIT_UI  (1UL << 0)
#define _AUDIO_MUTE_BIT_FS  (1UL << 1)
#define _AUDIO_MUTE_BIT_HW  (1UL << 2)

extern BOOL g_bHeadsetInsertion;        /*记录耳机是否插入，0-未插入；1-已插入*/
extern UINT32 g_uiSoundVolumeValue;     /*记录当前音量，0-100*/
extern UINT32 g_uiEQMode;               /*记录当前音效模式*/
extern UINT32 g_uiMuteState;            /*记录当前用户是否设置静音*/
extern UINT32 g_uiSoundDelayTime;       /*记录当前声音延时时间*/
extern UINT32 g_uiHardwareMute;         /*支持硬件mute*/
extern UINT32 g_uiInterruptTriggerMode; /*记录当前中断trigger方式*/

/**
 * @brief initialize audio GPIO.
 */
VOID Hv_Cal_Audio_GpioInit(VOID);

/**
 * @brief Audio Speaker Mute.
 */
VOID Hv_Cal_Audio_SpeakerMute(VOID);

/**
 * @brief Audio Speaker UnMute.
 */
VOID Hv_Cal_Audio_SpeakerUnMute(VOID);

/**
 * @brief initialize audio HeadsetDetect.
 */
VOID Hv_Cal_Audio_HeadsetDetectInit(VOID);

/**
 * @brief set audio source.
 * @param[in] uiRxOutIndex: HDMI1/HDMI2/DP1/DP2.
 */
Status Hv_Cal_Audio_SetRxOut(UINT32 uiRxOutIndex, ChannelType enChannelType);

/**
 * @brief audio spdif out.
 */
VOID Hv_Cal_Audio_SetSpdifOutGpio(BOOL bAudioSpdifOut);

/**
 * @brief audio datapath mute_module init.
 */
VOID Hv_Cal_Audio_DataPathMuteModuleInit(VOID);

/**
 * @brief audio interrupt Trigger unMute.
 */
VOID Hv_Cal_Audio_SetUnMuteTrigger(VOID);

/**
 * @brief audio interrupt Trigger Mute.
 */
VOID Hv_Cal_Audio_SetMuteTrigger(VOID);

/**
 * @brief audio datapath unmute.
 */
VOID Hv_Cal_Audio_ClearTXMute_EnableAllInt(BOOL bDpisPlay);

/**
 * @brief audio datapath unmute interrupt clear.
 */
VOID Hv_Cal_Audio_DisableAllInt_ClearInt(UINT32 uiIntFlag);

/**
 * @brief audio datapath unmute interrupt clear.
 */
VOID Hv_Cal_Audio_ClearInt(UINT32 uiIntFlag);

/**
 * @brief audio datapath mute Source.
 */
UINT32 Hv_Cal_Audio_DataPathMuteSource(VOID);

/**
 * @brief audio fs's detect init.
 */
VOID Hv_Cal_Audio_DetectFsModuleInit(VOID);

/**
 * @brief audio fs's detect init.
 */
VOID Hv_Cal_Audio_SetSpdifTX(VOID);

#endif

