/* 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: brianpc.huang $
 * $Date: 2015/05/29 $
 * $RCSfile: nptv_drvif.h,v $
 * $Revision: #1 $
 *
 *---------------------------------------------------------------------------*/

#ifndef _NPTV_DRVIF_H_
#define _NPTV_DRVIF_H_

/***********************************************************************************/
/*********************************   global part  ****************************************/
/***********************************************************************************/
#include "nptv_if.h"
#include "sv_const.h"
#include "drv_tvd.h"

 /***********************************************************************************/
 /********************************* for  Driver only**************************************/
 /***********************************************************************************/

 /**
  * @brief vApiVideoSrcChangeNotify
  * Input Change Notify, ReCalculate Source Region
  */
//void vApiVideoInputChangeNotify(UINT8 bPath);

 /* TVD */
//extern void vTvdHoldMode(UINT8 bHoldOnOff);
//extern void vTvd3dChannelChange(void);

 /**
  * @brief LboxDetectionInit
  */
void LboxDetectionInit(void);

 /*
    Function    : void vApiVideoMainloop(void)
    Description :
    Parameters  :
    Return      :
  */
void vApiVideoMainloop(void);
BOOL VdoMLInit(void);
void vAllocateSWReg(void);
// *****************************************************
// Event Flags Definition
// ****************************************************
// Main Channel Related
#define VDO_FLG_MAIN_MODECHG (1<<0)
#define VDO_FLG_MAIN_MODECHG_DONE (1<<1)
#define VDO_FLG_MAIN_UPDATE_OSD (1<<2)
 // Pip Channel Related
#define VDO_FLG_PIP_MODECHG (1<<3)
#define VDO_FLG_PIP_MODECHG_DONE (1<<4)
#define VDO_FLG_PIP_UPDATE_OSD (1<<5)
 // VGA Auto
#define VDO_FLG_VGAAUTO_DOING (1<<6)
 // SV First Related
 #define VDO_FLG_SCART_SF_CHG (1<<9)


 // TVD Auto calibration
#define VDO_FLG_TVDAUTO_DOING (1<<10)

 //extern UINT16   _wEventFlag;
extern UINT16 _wEventFlag;

 /*
  * Description:
  *    Check if some event flag(s) is set, if more than two flags are
  *    given in dwFlag, this function will return TRUE only if all the flags
  *    are set.
  *  Parameters:
  *    dwFlag  --- Flag to be checked
  *  Return : TRUE -- Flag(s) is set
  *           FALSE        Flag(s) is not set
  */
#define fgApiVideoIsEvtFlgSet(arg) ((_wEventFlag & (arg)) > 0)

 /*  Description:
  *    Clear event flags
  *  Parameters:
  *    dwFlag  --- Flags to be cleared
  *  Return : None
  *  Remark:
  *    UI can use this function to clear the events which are (to be)
  */
#define vApiVideoClrEvtFlg(arg) (_wEventFlag &= (~(arg)))

 /*  Description:
  *    Set event flags
  *  Parameters:
  *    dwFlag  --- Flags to be set
  *  Return : None
  *  Remark:
  *    This function is used to set event flags to inform UI about some
  *    status or mode changes. (not including actions triggered by UI itself.
  *    Should not be called by UI)
  */
#define vApiVideoSetEvtFlg(arg) (_wEventFlag |= (arg))

#endif /* _NPTV_DRVIF_H_ */
