/* 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: drv_regen.h $
 *
 * Project:
 * --------
 *
 *
 * Description:
 * ------------
 *
 *
 * Author:
 * -------
 *
 *
 * Last changed:
 * -------------
 * $Author: peng.liu $
 *
 * $Date: 2015/07/04 $
 *
 * $Revision: #2 $
*************************************************************************/
#ifndef _DRV_MON_OUT_H_
#define _DRV_MON_OUT_H_

#include "general.h"
#include "video_def.h"

#define     MON_OUT_DRAM_FRAME_NUM   2

typedef enum {
    E_TTT_2D_IN          =0,
    E_TTT_PR_IN          =1,
    E_TTT_SG_IN          =2,
    E_TTT_SBS_IN		 =3,
    E_TTT_TB_IN			 =4,
}E_MON_OUT_TTT_CONFIG;



typedef enum {
    E_MON_OUT_MIXER         =0,
    E_MON_OUT_MAIN_FSC_OUT  =1,
    E_MON_OUT_SUB_FSC_OUT   =2,
    E_MON_OUT_MAIN_MIB_OUT  =3,
    E_MON_OUT_SUB_MIB_OUT   =4,
    E_MON_OUT_MAIN_PREDOWN  =5,
    E_MON_OUT_SUB_PREDOWN   =6,   
    E_MON_OUT_PANEL         =7,
    E_MON_OUT_OMUX          =8,
    E_FSC_SUB_TO_TVE        =9,
}E_MON_OUT_IN_SELECT;

typedef enum {
    E_MON_OUT_TVE	        =0,
	E_MON_OUT_VENC			=1,
	E_MON_OUT_GFX			=2,
}E_MON_OUT_OUTPUT_SELECT;


typedef enum {    
    E_MON_OUT_WITH_ALL_OSD  =0,
    E_MON_OUT_WITH_ONE_OSD  =1,
    E_MON_OUT_WITH_NO_OSD   =2,
 }E_MON_OUT_IN_SELECT_2;

typedef enum
{
    MON_STATE_IDLE = 0,
    MON_STATE_MOD_CHG = 1,
    MON_STATE_MOD_CHG_DONE = 2,
}E_MON_OUT_STATE;



#define  FRAME_START_AT_FALLING      0
#define  FRAME_START_AT_RISING       1



#define MONOUT_WRITE_FLD(reg,value,fld) vIO32WriteFldAlign(reg, value, fld)
#define MONOUT_READ_FLD(reg,fld) IO32ReadFldAlign(reg,fld)

#define getMonOutInfo()       (&_rMonitorOutInfo)
#define getVrmMonOutInfo()    (&_vrm_mon_out_info)


void vMonOutNormProc(void);
void vMonOutModuleCfg(void);
void vDrvMonOutInit(void);
void vMonOutUpdatePreDownParameter(void);
void vMonOutUpdateDramParameter( void );
void vMonOutSetMuxSelIn(E_MON_OUT_IN_SELECT MonOutMuxIn);
UINT8 vMonOutGetMuxSelIn(void);
void vMonOutSetOSDSelIn(E_MON_OUT_IN_SELECT_2 MonOutOSDIn);
void vMonOutSetOutput(E_MON_OUT_OUTPUT_SELECT MonOutOutput);
void vMonOutSetOutputRes(UINT16 width ,UINT16 height);
void vMonOutGetOutputRes(UINT16* width ,UINT16* height);
void vMonOutSetTveFormat(UINT8 TimeGenSel);
void vMonOutSetEnable(UINT8 Enable);
UINT8 vMonOutGetEnable(void);
void vMonOutSetRegen(VDP_DISP_REGION_T rRegion);
UINT8 u1IsMonOutVenc(void);
void vMonOutGetVideoBlackBar(UINT32 *top,UINT32 *bottom,UINT32 *left,UINT32 *right);

UINT8 vMonOutGetDramReadEnable(void);
UINT8 vMonOutGetDramWriteEnable(void);
void vMonOutSetDramWriteARB(UINT8 u1ReadOnoff, UINT8 u1WriteOnOff);
UINT8 u1MonOutGetFldInfo(void);
void vMonOutSetDotByDotOutput(BOOL bflag);
BOOL vMonOutGetDotByDotOutput(void);
UINT8 vMonOutGetBypassRGB2YUV (void);
UINT8 vMonOutGetTVETG422to444_1(void);
UINT8 vMonOutGetDaFrameNum(void);
void vDrvMonVRMResume(void);

#endif
