/* 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.
 *
 *****************************************************************************/


/**************************************************************************
 * Filename:
 * ---------
 *   $Workfile: source_select.h $
 *
 * Description:
 *    deal with source select
 * ------------
 *
 *
 * Author:  Rock Hsieh
 * -------
 *
 * Last changed:
 * -------------
 * $Author: yangyang.tian $
 * $Revision: #2 $
 * $Date: 2015/07/03 $
 ****************************************************************************/

#ifndef _SOURCE_SELECT_H_
#define _SOURCE_SELECT_H_

#include "source_table.h"

/**
 * Get the video decoder of main path.
 */
#ifdef CC_SOURCE_AUTO_DETECT
typedef struct _SOURCE_DETECT_STATUS_T
{
     UINT8  ui2SrcStatus_av1;
	 UINT8  ui2SrcStatus_ypbpr1;
	 UINT8  ui2SrcStatus_hdmi1;
	 UINT8  ui2SrcStatus_hdmi2;
	 UINT8  ui2SrcStatus_hdmi3;
	 UINT8  ui2SrcStatus_hdmi4;
	 UINT8  ui2SrcStatus_vga;
} SOURCE_DETECT_STATUS_T;
#endif
UINT8 bGetInternalDec(UINT8 bPath) ;
extern BOOL fgIsSrcAtv(UINT8 bPath);
extern BOOL fgIsSrcScart(UINT8 bPath);
extern BOOL fgIsSrcDtv(UINT8 bPath);
extern BOOL fgIsSrcAV(UINT8 bPath);
extern BOOL fgIsSrcSV(UINT8 bPath);
extern BOOL fgIsSrcVGA(UINT8 bPath);
extern BOOL fgIsSrcYPBPR(UINT8 bPath);
extern UINT8 bGetICInputType(UINT8 bPath) reentrant;
extern UINT8 bGetSignalType(UINT8 bPath) ;
extern void vDrvSetTVMux(UINT8 bSrc,UINT8 bMonSrc);
extern UINT32 dAvMuxMask(UINT8 bAvMux,UINT8 bCh);

extern UINT8 bGetDecodeType(UINT8 bSrc);
extern UINT8 bGetVideoDecTypeNew(UINT8 bPath);
extern UINT8 bGetSignalTypeNew(UINT8 bPath);

#if defined(CC_SUPPORT_TVE)||defined(CC_SUPPORT_TVE_82xx)
extern UINT8 bGetSignalTypeBySrc(UINT8 bSrc);
#endif
extern void initAVSV(UINT8 vsrc,UINT8 mon_src);
extern void initYPbPrVGA(UINT8 ic);
extern void initSCARTRGB(UINT8 bVSrc, UINT8 ic);
extern void vSetMOutMux(UINT8 dec);
extern UINT8 vGetOmuxMap(UINT8 dec);
extern void vSetSOutMux(UINT8 dec);
extern void vSetNOutMux(UINT8 dec);
extern void vDrvSetInternalMux(UINT8 path,UINT8 src);
extern void vMuxCleanup(void);
#ifdef CC_SOURCE_AUTO_DETECT
extern void vDrvDetectSourceState(void);
#endif
extern UINT32 u4DrvGetAvMuxByCh(UINT8 ch);

#endif
