/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 *
 * $Author: xiaojun.zhu $
 * $Date: 2015/08/08 $
 * $RCSfile: aud_drvif.h,v $
 * $Revision: #4 $
 *
 *---------------------------------------------------------------------------*/

/** @file aud_drvif.h
 *  Brief of file aud_drvif.h.
 *  Details of file aud_drvif.h (optional).
 */

#ifndef AUD_DRV_IF_H
#define AUD_DRV_IF_H

#include "dmx_if.h"
#include "aud_if.h"

/****************************************************************************
** Type definitions
****************************************************************************/
//CC_AUD_AV_TUNNEL
typedef enum
{
    AUDIO_NOTIFY_DECODE_DONE,
	AUDIO_NOTIFY_NO_DATA,
	AUDIO_NOTIFY_RESUME_DONE,
	AUDIO_NOTIFY_MAX
}AUDIO_NOTIFY_TYPE_T;

#define AUD_HWSYNC_INVALID 0
#define AUD_HWSYNC_STC1 1
#define AUD_HWSYNC_STC2 2

#ifdef  CC_AUD_SUPPORT_NEW_TUNNEL_MODE
extern void AUD_TunnelFlushAudioPts(void);
UINT32 AUD_GetTunnelMuteCnt(UINT8 u1DecId);
#endif
//CC_AUD_AV_TUNNEL end

/****************************************************************************
** Constant definitions
****************************************************************************/
#define DSP_BUSY  ((INT32)  1)
#define DSP_OK    ((INT32)  0)
#define DSP_FAIL  ((INT32) -1)
/****************************************************************************
** Export API
****************************************************************************/
extern void AUD_AtvAvInitialSync(BOOL fgStable);
extern void AUD_AtvAvInitialSync1(BOOL fgStable);
extern void AUD_WaitDspFlush(UINT8 u1DecId);
extern void AUD_TriggerDspPlay(UINT8 u1DecId);
extern void Aud_SetTvSysMask(UINT8 u1DecId, UINT32 u4Mask);

#ifdef CC_AUD_BITRATE_CHG_NOTIFY
extern BOOL AUD_SetBitRateChangedPts(UINT32 u4Pts);
#endif
extern INT32 AUD_GetAudFifo(UINT8 u1DecId, UPTR * pu4FifoStart, UPTR * pu4FifoEnd);
extern INT32 AUD_GetAudFifoB(UINT8 u1DspId, UINT8 u1DecId, UPTR * pu4FifoStart, UPTR * pu4FifoEnd);
extern BOOL AUD_IsFifoEmpty(UINT8 u1DspId, UINT8 u1DecId);

extern BOOL AUD_GetAinCfg(AUD_DEC_STREAM_FROM_T eStreamFrom, AIN_CFG_T* prAinCfg);
extern void AUD_HdmiModeMute(UINT8 u1DecId, BOOL fgMute);
extern void AUD_HdmiDrvModeMute(UINT8 u1DecId, BOOL fgMute);
extern void AUD_AoutDacFs(UINT8 u1DecId, SAMPLE_FREQ_T eFs);
extern void AUD_AinCfg(UINT8 u1DecId, AUD_DEC_STREAM_FROM_T eStrSrc, const AIN_CFG_T* prAinCfg);
extern void AUD_AtunerSigStableNotify(BOOL fgSatble);
extern BOOL fgAudStatistics(void);
extern BOOL AUD_IsFifoFull(UINT8 u1DspId, UINT8 u1DecId);
extern void AUD_MMAoutEnable(UINT8 u1DecId, BOOL fgEnable);
extern void AUD_ClearEOSFlag(UINT8 u1DecId);
extern BOOL _AudFMRadioDetection(void);
extern BOOL _AudPlayFMRadio(void);
extern UINT32  AUD_GetEmptyRetryThres(void);
#ifdef TIME_SHIFT_SUPPORT
extern BOOL AUD_MMFindTickInfo(UINT8 u1DecId, UINT32* u4Tick);
#endif
extern void AUD_MMSetSwdmxSrcId(UINT8 u1DecId, UINT8 u1SwdmxSrcId);

#if defined(CC_ENABLE_AV_SYNC) || defined(CC_AUD_ENABLE_PLAY_MUTE_CONTROL)
extern void AUD_VdpModeChange(void);
extern void AUD_VdpModeChangeDone(void);
#endif

#ifdef __MODEL_slt__
extern void AUD_SltLineInInit(UINT8 u1DspId);
extern void SLT_FlashingAudInit(void);
extern INT32 SLT_SortingAud(void);
#endif

#endif /* AUD_DRV_IF_H */

