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

#ifndef __SDK_DRIVER_AUDIO_H__
#define __SDK_DRIVER_AUDIO_H__

#include "hv_comm_DataType.h"
#include "hv_comm_DataBase.h"
#include "hv_comm_Define.h"

#define _AUDIO_FLAG_ENABLE      1
#define _AUDIO_FLAG_DISABLE     0

#define _AUDIO_MAX_VOLUME       100
typedef enum _AudioCkRef
{
    CLK_27M     = 0,
    CLK_HDMI    = 1,
    CLK_DP      = 2,
    CLK_CK_MAX  = 3
}AudioCkRef;

/**
 * @brief Audio PLL reset.
 */
VOID Hv_Drv_Audio_PllReset(VOID);

/**
 * @brief set reset.
 */
VOID Hv_Drv_Audio_SetReset(VOID);

/**
 * @brief set VCO to 27M and fs to 48K.
 */
VOID Hv_Drv_Audio_ManualDefaultClock(VOID);

/**
 * @brief Check Lock PLL State.
 */
Status Hv_Drv_Audio_GetClockLockState(VOID);

/**
 * @brief Lock PLL.
 */
VOID Hv_Drv_Audio_ClockLock(VOID);

/**
 * @brief change new FS's PLL configures.
 */
VOID Hv_Drv_Audio_ChangeClock(VOID);

/**
 * @brief set PLL configures.
 */
 VOID Hv_Drv_Audio_SetAudioClock(VOID);

/**
 * @brief initialize audio Pll.
 */
VOID Hv_Drv_Audio_PllInit(VOID);

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

/**
 * @brief initialize audio RX IP.
 */
VOID Hv_Drv_Audio_RxInit(VOID);

/**
 * @brief initialize audio TX IP.
 */
VOID Hv_Drv_Audio_TxInit(VOID);

/**
 * @brief initialize audio DAC IP.
 */
VOID Hv_Drv_Audio_DacInit(VOID);

/**
 * @brief initialize audio HW IP.
 */
VOID Hv_Drv_Audio_HwInit(VOID);

/**
 * @brief initialize audio DM IP.
 */
VOID Hv_Drv_Audio_DmInit(VOID);

/**
 * @brief initialize audio Interrupt.
 */
VOID Hv_Drv_Audio_InterruptInit(VOID);

/**
 * @brief initialize audio Path.
 */
VOID Hv_Drv_Audio_PathInit(VOID);

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

/**
 * @brief get headset volume value from datebase.
 * @return 0-100 value.
 */
UINT32 Hv_Drv_Audio_GetHeadsetVolume(VOID);

/**
 * @brief get speaker volume value from datebase.
 * @return 0-100 value.
 */
UINT32 Hv_Drv_Audio_GetSpeakerVolume(VOID);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiDacVolumeValue: 0-100.
 */
Status Hv_Drv_Audio_SetHeadsetVolume(UINT32 uiDacVolumeValue);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiDacVolumeValue: 0-100.
 */
Status Hv_Drv_Audio_SetSpeakerVolume(UINT32 uiDacVolumeValue);

/**
 * @brief Set DAC Mute Bit.
 */
void Hv_Drv_Audio_SetMuteBit(UINT32 uiBitMsk);
/**
 * @brief Clear DAC Mute Bit.
 */
void Hv_Drv_Audio_ClearMuteBit(UINT32 uiBitMsk);

/**
 * @brief mute audio DAC from UI.
 */
VOID Hv_Drv_Audio_DACMute(UINT32 uiBitMsk);

/**
 * @brief unmute audio DAC from UI.
 */
VOID Hv_Drv_Audio_DACUnMute(UINT32 uiBitMsk);

/**
 * @brief mute audio path from channel manager.
 */
VOID Hv_Drv_Audio_TXMute(UINT32 uiBitMsk);

/**
 * @brief unmute audio path from channel manager.
 */
VOID Hv_Drv_Audio_TXUnMute(UINT32 uiBitMsk);

#ifdef HV_PROJECT_CONFIG_AUDIO_EQ
/**
 * @brief set default value to s_tAudioEqData.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetEQDefaultValue(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] : uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_GetLpf0DataAndSetRegs(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_GetHpf0DataAndSetRegs(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_GetBpf0DataAndSetRegs(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_GetBpf1DataAndSetRegs(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_GetBpf2DataAndSetRegs(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_GetBpf3DataAndSetRegs(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_GetBpf4DataAndSetRegs(UINT32 uiEQMode);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetLpf0DataAndSetRegs(UINT32 uiEQMode, AudioLpfData stAudioLpfData);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetHpf0DataAndSetRegs(UINT32 uiEQMode, AudioHpfData stAudioHpfData);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetBpf0DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetBpf1DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetBpf2DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetBpf3DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);

/**
 * @brief set 0-100 value to driver.
 * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
 */
VOID Hv_Drv_Audio_SetBpf4DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);
#endif

/**
 * @brief set DDR size value in DM register.
 */
VOID Hv_Drv_Audio_SetSoundDelayDDRSize(UINT32 uiDelayTime);

/**
 * @brief set DDR Address value in DM register.
 */
VOID Hv_Drv_Audio_SetSoundDelayDDRAddress(VOID);

/**
 * @brief enalbe the DM write module.
 */
VOID Hv_Drv_Audio_DmWriteEnable(VOID);

/**
 * @brief enalbe the DM read module.
 */
VOID Hv_Drv_Audio_DmReadEnable(VOID *pvArg, USHORT16 usTimerId);

/**
 * @brief disalbe the DM module.
 */
VOID Hv_Drv_Audio_DmDisable(VOID);

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

#endif

