/*----------------------------------------------------------------------------*
 * No Warranty                                                                *
 * Except as may be otherwise agreed to in writing, no warranties of any      *
 * kind, whether express or implied, are given by MTK with respect to any MTK *
 * Deliverables or any use thereof, and MTK Deliverables are provided on an   *
 * "AS IS" basis.  MTK hereby expressly disclaims all such warranties,        *
 * including any implied warranties of merchantability, non-infringement and  *
 * fitness for a particular purpose and any warranties arising out of course  *
 * of performance, course of dealing or usage of trade.  Parties further      *
 * acknowledge that Company may, either presently and/or in the future,       *
 * instruct MTK to assist it in the development and the implementation, in    *
 * accordance with Company's designs, of certain softwares relating to        *
 * Company's product(s) (the "Services").  Except as may be otherwise agreed  *
 * to in writing, no warranties of any kind, whether express or implied, are  *
 * given by MTK with respect to the Services provided, and the Services are   *
 * provided on an "AS IS" basis.  Company further acknowledges that the       *
 * Services may contain errors, that testing is important and Company is      *
 * solely responsible for fully testing the Services and/or derivatives       *
 * thereof before they are used, sublicensed or distributed.  Should there be *
 * any third party action brought against MTK, arising out of or relating to  *
 * the Services, Company agree to fully indemnify and hold MTK harmless.      *
 * If the parties mutually agree to enter into or continue a business         *
 * relationship or other arrangement, the terms and conditions set forth      *
 * hereunder shall remain effective and, unless explicitly stated otherwise,  *
 * shall prevail in the event of a conflict in the terms in any agreements    *
 * entered into between the parties.                                          *
 *---------------------------------------------------------------------------*/

/*****************************************************************************
*  Uart : Maple PQ command
*****************************************************************************/
#define CC_CLI
#include "x_lint.h"

LINT_SAVE_AND_DISABLE

#ifdef __MW_CLI_DEF__
#include "x_mid_cli.h"
#else
#include "x_drv_cli.h"
#endif

#include "x_os.h"
#include "x_printf.h"
#include "x_stl_lib.h"
#include "drv_MapleApi.h" 



static INT32 _i4GetMapleAPPicCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_PIC_SETTING_T pPictureSetting;

	DRVCUST_GetPictureSetting(&pPictureSetting);

	Printf("====== DRVCUST_GetPictureSetting ======\n"); 
    Printf("ePicMode            %d\n", pPictureSetting.ePicMode);                            
    Printf("u1Backlight         %d\n", pPictureSetting.u1Backlight);                                 
    Printf("u1Contrast          %d\n", pPictureSetting.u1Contrast);                                  
    Printf("u1Brightness        %d\n", pPictureSetting.u1Brightness);                                
    Printf("u1Color             %d\n", pPictureSetting.u1Color);                                     
    Printf("u1Hue               %d\n", pPictureSetting.u1Hue);                                       
    Printf("u1Sharpness         %d\n", pPictureSetting.u1Sharpness);                                 
    Printf("eColTmp             %d\n", pPictureSetting.eColTmp);                             
    Printf("eNoiseReduction     %d\n", pPictureSetting.eNoiseReduction);             
    Printf("eMpegNoiseReduction %d\n", pPictureSetting.eMpegNoiseReduction);     
	Printf("eRealityCreation	%d\n", pPictureSetting.eRealityCreation);                                 
    Printf("eMasteredIn4K       %d\n", pPictureSetting.eMasteredIn4K);                             
    Printf("i2Resolution	     %d\n", pPictureSetting.i2Resolution);             
    Printf("i2NoiseFiltering	 %d\n", pPictureSetting.i2NoiseFiltering);  
    Printf("eMotionFlow         %d\n", pPictureSetting.eMotionFlow);                     
	Printf("i2MotionFlowSmoothness	     %d\n", pPictureSetting.i2MotionFlowSmoothness);             
    Printf("i2MotionFlowClearness	 %d\n", pPictureSetting.i2MotionFlowClearness);  
    Printf("eFilmMode           %d\n", pPictureSetting.eFilmMode);                       
    Printf("eAdvContrastEnhancer    %d\n", pPictureSetting.eAdvContrastEnhancer);
    Printf("eBlackCorrector     %d\n", pPictureSetting.eBlackCorrector);             
    Printf("i2Gamma             %d\n", pPictureSetting.i2Gamma);    
	Printf("eLedDynamicCtrl     %d\n", pPictureSetting.eLedDynamicCtrl); 
    Printf("eLiveColor          %d\n", pPictureSetting.eLiveColor);                      
    Printf("i2RGain			    %d\n", pPictureSetting.i2RGain);     
	Printf("i2GGain			    %d\n", pPictureSetting.i2GGain);   
	Printf("i2RGain			    %d\n", pPictureSetting.i2BGain);   
	Printf("i2RBias			    %d\n", pPictureSetting.i2RBias);   
	Printf("i2GBias			    %d\n", pPictureSetting.i2GBias);   
	Printf("i2BBias			    %d\n", pPictureSetting.i2BBias);   
    Printf("eSpeedPreference    %d\n", pPictureSetting.eSpeedPreference);   
	Printf("eLedMotionMode   	%d\n", pPictureSetting.eLedMotionMode);
	Printf("eXdr			    %d\n", pPictureSetting.eXdr);   
    Printf("eDrange    			%d\n", pPictureSetting.eDrange);   
	Printf("eColorSpace   	%d\n", pPictureSetting.eColorSpace);

    return 0;

}

static INT32 _i4GetMapleAPScreenCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SCREEN_SETTING_T pScreenSetting;

	DRVCUST_GetScreenSetting(&pScreenSetting);

	Printf("====== DRVCUST_GetScreenSetting ======\n"); 
    Printf("eWideMode            %d\n", pScreenSetting.eWideMode);   
	Printf("eDisplayArea            %d\n", pScreenSetting.eDisplayArea);   
	Printf("i2HCenter            %d\n", pScreenSetting.i2HCenter);   
	Printf("i2VCenter            %d\n", pScreenSetting.i2VCenter);   
	Printf("i2VerticalSize            %d\n", pScreenSetting.i2VerticalSize);   
	Printf("eZoom            %d\n", pScreenSetting.eZoom);   
	Printf("ePcWIdeMode            %d\n", pScreenSetting.ePcWIdeMode);   
	Printf("i2PcPhase            %d\n", pScreenSetting.i2PcPhase);   
	Printf("i2PcPitch            %d\n", pScreenSetting.i2PcPitch);   
	Printf("i2PcHCenter            %d\n", pScreenSetting.i2PcHCenter);   
	Printf("i2PcVCenter            %d\n", pScreenSetting.i2PcVCenter);  

    return 0;

}

static INT32 _i4GetMapleAP3DCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_3D_SETTING_T p3DSetting;

	DRVCUST_Get3DSetting(&p3DSetting);

	Printf("====== DRVCUST_Get3DSetting ======\n"); 
    Printf("e3dDisplay            %d\n", p3DSetting.e3dDisplay);   
	Printf("i23dDepthAdjustment            %d\n", p3DSetting.i23dDepthAdjustment);   
	Printf("e3dGlassBrightness            %d\n", p3DSetting.e3dGlassBrightness);

    return 0;

}

static INT32 _i4GetMapleAPECOCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_ECO_SETTING_T pEcoSetting;

	DRVCUST_GetEcoSetting(&pEcoSetting);

	Printf("====== DRVCUST_GetEcoSetting ======\n"); 
    Printf("ePowerSaving            %d\n", pEcoSetting.ePowerSaving);   
	Printf("eLightSensor            %d\n", pEcoSetting.eLightSensor); 

    return 0;

}

static INT32 _i4GetMapleDemoModeCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_DEMO_MODE_T pDemoMode;

	DRVCUST_GetDemoMode(&pDemoMode);

	Printf("====== DRVCUST_GetDemoMode ======\n"); 
    Printf("eDemoMode            %d\n", pDemoMode.eDemoMode);   
	Printf("eDemoPattern            %d\n", pDemoMode.eDemoPattern);   
	Printf("u4DemoOption            %d\n", pDemoMode.u4DemoOption); 

    return 0;

}

static INT32 _i4GetMapleDemoOSDMaskCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_DEMO_OSD_MASK_T pOsdMask;
	UINT32 i;

	DRVCUST_GetDemoOsdMaskArea(&pOsdMask);

    Printf("====== DRVCUST_GetDemoOsdMaskArea ======\n"); 
    Printf("u1Num            %d\n", pOsdMask.u1Num);
	for(i = 0; i < 8; i++)
	{
		Printf("rectArea[%d] u2X           %d\n", i, pOsdMask.rectArea[i].u2X);  
		Printf("rectArea[%d] u2Y           %d\n", i, pOsdMask.rectArea[i].u2Y); 
		Printf("rectArea[%d] u2Width       %d\n", i, pOsdMask.rectArea[i].u2Width); 
		Printf("rectArea[%d] u2Height      %d\n", i, pOsdMask.rectArea[i].u2Height); 
	}
	Printf("b4KCoordinate            %d\n", pOsdMask.b4KCoordinate);

    return 0;

}


static INT32 _i4GetMapleServiceWBCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SERVICE_SETTING_T pServiceSetting;

	DRVCUST_GetServiceSetting(&pServiceSetting);

	Printf("====== DRVCUST_GetServiceSetting ======\n"); 
    Printf("u2RGain            %d\n", pServiceSetting.u2RGain);
	Printf("u2GGain            %d\n", pServiceSetting.u2GGain);
	Printf("u2BGain            %d\n", pServiceSetting.u2BGain);
	Printf("u2ROffset            %d\n", pServiceSetting.u2ROffset);
	Printf("u2GOffset            %d\n", pServiceSetting.u2GOffset);
	Printf("u2BOffset            %d\n", pServiceSetting.u2BOffset);

    return 0;

}


static INT32 _i4GetMapleServiceTransCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SERVICE_TRANS_T pServiceTrans;

	DRVCUST_GetServiceTransferSetting(&pServiceTrans);

	Printf("====== DRVCUST_GetServiceTransferSetting ======\n"); 
    Printf("eWBTransferMode            %d\n", pServiceTrans.eWBTransferMode);
	Printf("eMuraTransferMode            %d\n", pServiceTrans.eMuraTransferMode);
	Printf("eCUCTransferMode            %d\n", pServiceTrans.eCUCTransferMode);

    return 0;

}


static INT32 _i4GetMapleServiceVcomCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SERVICE_VCOM_T pServiceVcom;

	DRVCUST_GetServiceVcomAdjust(&pServiceVcom);

	Printf("====== DEBUG_GetServiceSetting ======\n"); 
    Printf("bMode            %d\n", pServiceVcom.bMode);
	Printf("u2Data            %d\n", pServiceVcom.u2Data);

    return 0;

}

static INT32 _i4GetMapleUiInputCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	E_CUST_UI_INPUT_TARGET eUiInput;
	
	eUiInput = DRVCUST_GetUiInputTarget();

	Printf("====== DRVCUST_GetUiInputTarget ======\n"); 
    Printf("eUiInput            %d\n", eUiInput);

    return 0;

}

static INT32 _i4GetMapleAPWBOffsetCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_WB_OFFSET_T pWbOffset;

	DRVCUST_GetWhiteBalanceOffset(&pWbOffset);

	Printf("====== DRVCUST_GetWhiteBalanceOffset ======\n"); 
    Printf("i2ROffset1            %d\n", pWbOffset.i2ROffset1);
	Printf("i2ROffset2            %d\n", pWbOffset.i2ROffset2);
	Printf("i2ROffset3            %d\n", pWbOffset.i2ROffset3);
	Printf("i2ROffset4            %d\n", pWbOffset.i2ROffset4);
	Printf("i2ROffset5            %d\n", pWbOffset.i2ROffset5);
	Printf("i2ROffset6            %d\n", pWbOffset.i2ROffset6);
	Printf("i2ROffset7            %d\n", pWbOffset.i2ROffset7);
	Printf("i2ROffset8            %d\n", pWbOffset.i2ROffset8);
	Printf("i2ROffset9            %d\n", pWbOffset.i2ROffset9);
	Printf("i2ROffset10            %d\n", pWbOffset.i2ROffset10);
	Printf("i2GOffset1            %d\n", pWbOffset.i2GOffset1);
	Printf("i2GOffset2            %d\n", pWbOffset.i2GOffset2);
	Printf("i2GOffset3            %d\n", pWbOffset.i2GOffset3);
	Printf("i2GOffset4            %d\n", pWbOffset.i2GOffset4);
	Printf("i2GOffset5            %d\n", pWbOffset.i2GOffset5);
	Printf("i2GOffset6            %d\n", pWbOffset.i2GOffset6);
	Printf("i2GOffset7            %d\n", pWbOffset.i2GOffset7);
	Printf("i2GOffset8            %d\n", pWbOffset.i2GOffset8);
	Printf("i2GOffset9            %d\n", pWbOffset.i2GOffset9);
	Printf("i2GOffset10            %d\n", pWbOffset.i2GOffset10);
	Printf("i2BOffset1            %d\n", pWbOffset.i2BOffset1);
	Printf("i2BOffset2            %d\n", pWbOffset.i2BOffset2);
	Printf("i2BOffset3            %d\n", pWbOffset.i2BOffset3);
	Printf("i2BOffset4            %d\n", pWbOffset.i2BOffset4);
	Printf("i2BOffset5            %d\n", pWbOffset.i2BOffset5);
	Printf("i2BOffset6            %d\n", pWbOffset.i2BOffset6);
	Printf("i2BOffset7            %d\n", pWbOffset.i2BOffset7);
	Printf("i2BOffset8            %d\n", pWbOffset.i2BOffset8);
	Printf("i2BOffset9            %d\n", pWbOffset.i2BOffset9);
	Printf("i2BOffset10            %d\n", pWbOffset.i2BOffset10);

    return 0;

}

static INT32 _i4GetMapleAPBTCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_BT_SETTING_T pBtSetting;

	DRVCUST_GetBTSetting(&pBtSetting);

	Printf("====== DRVCUST_GetBTSetting ======\n"); 
    Printf("bDelayMode            %d\n", pBtSetting.bDelayMode);

    return 0;

}


CLI_EXEC_T arCmdMapleAPTbl[] = {
    {"Picture info", "pic",    _i4GetMapleAPPicCmd,     NULL,   "Picture Menu information",  CLI_GUEST}, 
	{"Screen info", "screen",    _i4GetMapleAPScreenCmd,     NULL,   "Screen Menu information",  CLI_GUEST}, 
	{"3D info", "3d",    _i4GetMapleAP3DCmd,     NULL,   "3D Menu information",  CLI_GUEST}, 
	{"ECO info", "eco",    _i4GetMapleAPECOCmd,     NULL,   "ECO Menu information",  CLI_GUEST}, 
	{"Demo mode info", "demo",    _i4GetMapleDemoModeCmd,     NULL,   "Demo mode information",  CLI_GUEST},
	{"Demo OSD mask", "mask",    _i4GetMapleDemoOSDMaskCmd,     NULL,   "Demo OSD mask information",  CLI_GUEST},
	{"Service WB", "swb",    _i4GetMapleServiceWBCmd,     NULL,   "Service WB adjustment",  CLI_GUEST},
	{"Service tran", "tran",    _i4GetMapleServiceTransCmd,     NULL,   "Service trans",  CLI_GUEST},
	{"Service Vcom", "vcom",    _i4GetMapleServiceVcomCmd,     NULL,   "Service Vcom",  CLI_GUEST},
	{"UI Input", "input",    _i4GetMapleUiInputCmd,     NULL,   "UI Input",  CLI_GUEST},
	{"WB Offset", "wbofst",    _i4GetMapleAPWBOffsetCmd,     NULL,   "WB Offset ",  CLI_GUEST},
	{"BT setting", "bt",    _i4GetMapleAPBTCmd,     NULL,   "BT setting",  CLI_GUEST},
    {NULL, NULL, NULL, NULL, NULL, CLI_SUPERVISOR}
};


static INT32 _i4GetMapleSysInputCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	
	E_CUST_INPUT_TYPE tmp ;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	tmp = DRVCUST_GetInputType((UINT8)u4Path);

	Printf("====== DRVCUST_GetInputType ======\n"); 
    Printf("Input Type            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysSigFmtCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	
	CUST_SIG_FMT_T pSignalFormat;

	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	DRVCUST_GetSignalFormat(u4Path, &pSignalFormat);

	Printf("====== DRVCUST_GetSignalFormat(%d) ======\n", u4Path);
    Printf("eSigSta             %d\n", pSignalFormat.eSigSta);  	
    Printf("u4Width             %d\n", pSignalFormat.u4Width); 				
    Printf("u4Height            %d\n", pSignalFormat.u4Height);        	
    Printf("u4CodecWidth        %d\n", pSignalFormat.u4CodecWidth);   
    Printf("u4CodecHeight       %d\n", pSignalFormat.u4CodecHeight); 	
    Printf("eContentType	    %d\n", pSignalFormat.eContentType);   
    Printf("eScanType	        %d\n", pSignalFormat.eScanType); 			
    Printf("eColorSystem	    %d\n", pSignalFormat.eColorSystem);   
    Printf("eFrameRate	        %d\n", pSignalFormat.eFrameRate); 			
    Printf("eStreamingType	    %d\n", pSignalFormat.eStreamingType); 
    Printf("eDimension	        %d\n", pSignalFormat.eDimension); 			
    Printf("e3dFormat	        %d\n", pSignalFormat.e3dFormat); 			
    Printf("eColorimetry	    %d\n", pSignalFormat.eColorimetry);
    Printf("eColorFormat	    %d\n", pSignalFormat.eColorFormat);
    Printf("eColorDepth	        %d\n", pSignalFormat.eColorDepth); 		
    Printf("eColorSpace	        %d\n", pSignalFormat.eColorSpace);    	
    Printf("ePhotoColorSpace 	%d\n", pSignalFormat.ePhotoColorSpace);
    Printf("eDynamicRange	    %d\n", pSignalFormat.eDynamicRange); 
    Printf("eAspect	            %d\n", pSignalFormat.eAspect); 				
    Printf("eVideoCodec	        %d\n", pSignalFormat.eVideoCodec); 		
    Printf("eHdmi4kPhoto	    %d\n", pSignalFormat.eHdmi4kPhoto); 
    Printf("eHdrType	        %d\n", pSignalFormat.eHDRType); 

    return 0;

}

static INT32 _i4GetMapleSysWindowModeCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	E_CUST_WINDOW_MODE tmp ;

	tmp  = DRVCUST_GetWindowMode();

	Printf("====== DRVCUST_GetWindowMode ======\n"); 
    Printf("Window Mode            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysPlaneMuteCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	
	E_CUST_MUTE_STATE tmp ;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	tmp  = DRVCUST_GetPlaneMuteState(u4Path);

	Printf("====== DRVCUST_GetPlaneMuteState ======\n"); 
    Printf("Mute state            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysOutputMuteCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	
	E_CUST_MUTE_STATE tmp ;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Video\n");
		Printf("1: GFX\n");
		return 0;
	}
	
	tmp  = DRVCUST_GetOutputMuteState(u4Path);

	Printf("====== DRVCUST_GetOutputMuteState ======\n"); 
    Printf("Output Mute state            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysOutPosiCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_OUT_POSI_T pOutPosition;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	DRVCUST_GetOutputPosition(u4Path, &pOutPosition);

	Printf("====== DRVCUST_GetOutputPosition ======\n");
	Printf("u4X 			 %d\n", pOutPosition.u4X);
	Printf("u4Y 			 %d\n", pOutPosition.u4Y);
	Printf("u4Width 		 %d\n", pOutPosition.u4Width);
	Printf("u4Height		 %d\n", pOutPosition.u4Height);

    return 0;

}

static INT32 _i4GetMapleSysSrcAreaCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SRC_AREA_T pSclReq;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if (i4Argc != 2)
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("BeHandle\n");
		return 0;
	}

	DRVCUST_GetSourceArea(u4Path, &pSclReq);

	Printf("====== DRVCUST_GetOutputPosition ======\n");
	Printf("u4SrcX 			 %d\n", pSclReq.u4SrcX);
	Printf("u4SrcY 			 %d\n", pSclReq.u4SrcY);
	Printf("u4SrcWidth 		 %d\n", pSclReq.u4SrcWidth);
	Printf("u4SrcHeight		 %d\n", pSclReq.u4SrcHeight);

    return 0;

}

static INT32 _i4GetMapleSysSclReqCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SRC_AREA_T pSclReq;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if (i4Argc != 2)
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("BeHandle\n");
		return 0;
	}

	DRVCUST_GetScalingRequest(u4Path, &pSclReq);

	Printf("====== DRVCUST_GetOutputPosition ======\n");
	Printf("u4SrcX 			 %d\n", pSclReq.u4SrcX);
	Printf("u4SrcY 			 %d\n", pSclReq.u4SrcY);
	Printf("u4SrcWidth 		 %d\n", pSclReq.u4SrcWidth);
	Printf("u4SrcHeight		 %d\n", pSclReq.u4SrcHeight);

    return 0;

}

static INT32 _i4GetMapleSysOutFmtCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_OUT_FMT_T pOutFmt;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Video\n");
		Printf("1: GFX\n");
		return 0;
	}

	DRVCUST_GetOutputFormat(u4Path, &pOutFmt);

	Printf("====== DRVCUST_GetOutputFormat ======\n");
    Printf("u4Htotal		    %d\n", pOutFmt.u4Htotal);
    Printf("u4Vtotal		    %d\n", pOutFmt.u4Vtotal);
    Printf("u4ActX			    %d\n", pOutFmt.u4ActX);
    Printf("u4ActY			    %d\n", pOutFmt.u4ActY);
    Printf("u4ActWidth		    %d\n", pOutFmt.u4ActWidth);
    Printf("u4ActHeight		    %d\n", pOutFmt.u4ActHeight);
    Printf("eFrameRate		    %d\n", pOutFmt.eFrameRate);
    Printf("eDimension		    %d\n", pOutFmt.eDimension);
    Printf("e3dFormat		    %d\n", pOutFmt.e3dFormat);
    Printf("eColorimetry	    %d\n", pOutFmt.eColorimetry);
    Printf("eColorFormat	    %d\n", pOutFmt.eColorFormat);
    Printf("eColorDepth		    %d\n", pOutFmt.eColorDepth);
    Printf("eColorSpace		    %d\n", pOutFmt.eColorSpace);
    Printf("eDynamicRange	    %d\n", pOutFmt.eDynamicRange);
    Printf("ePath			    %d\n", pOutFmt.ePath);
	Printf("bCtrlBitValid		%d\n", pOutFmt.bCtrlBitValid);

    return 0;

}

static INT32 _i4GetMapleSysMCVPMeterCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	CUST_MCVP_METER_T pMcvpMeter;

	DRVCUST_GetMCVPMeter(&pMcvpMeter);

	Printf("====== DRVCUST_GetMCVPMeter ======\n");
    Printf("u1NoiseLevel              %d\n", pMcvpMeter.u1NoiseLevel);                  
    Printf("u1BlockNoiseLevel            %d\n", pMcvpMeter.u1BlockNoiseLevel);                
    Printf("u4FrmDiff               %d\n", pMcvpMeter.u4FrmDiff);     
	Printf("u1FreqHpfH              %d\n", pMcvpMeter.u1FreqHpfH);                  
    Printf("u1FreqHpfV            %d\n", pMcvpMeter.u1FreqHpfV);                
    Printf("u1FreqBpfH               %d\n", pMcvpMeter.u1FreqBpfH);

    return 0;

}

static INT32 _i4GetMapleSysCadenseCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	E_CUST_CADENSE tmp ;

	tmp  = DRVCUST_GetCadense();

	Printf("====== DRVCUST_GetCadense ======\n"); 
    Printf("Cadense            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysPostMeterCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	UINT32 i;
	CUST_POST_PROC_METER_T pPostProcMeter;

	DRVCUST_GetPostProcMeter(&pPostProcMeter);

	
    
    Printf("====== DRVCUST_GetPostProcMeter ======\n");
    Printf("X    %d   Y    %d\n", pPostProcMeter.u4X, pPostProcMeter.u4Y);
    Printf("W    %d   H    %d\n", pPostProcMeter.u4Width, pPostProcMeter.u4Height);
    Printf("APL     %d      %d\n", pPostProcMeter.u1APLL, pPostProcMeter.u1APLR);
	Printf("ASL     %d      %d\n", pPostProcMeter.u1ASLL, pPostProcMeter.u1ASLR);
    Printf("Y Max   %d      %d\n", pPostProcMeter.u1LumaMaxL, pPostProcMeter.u1LumaMaxR);
    Printf("Y Min   %d      %d\n", pPostProcMeter.u1LumaMinL, pPostProcMeter.u1LumaMinR);

    Printf("== Luma Hist ==\n");
    for (i=0; i<65; i++)
    {
        Printf("Luma[%02d]    %d     %d\n", i, pPostProcMeter.u2LumaHistL[i], pPostProcMeter.u2LumaHistR[i]);
    }

    Printf("== Sat Hist ==\n");
    for (i=0; i<SAT_HIST_NUM; i++)
    {
        Printf("Sat[%d]     %d     %d\n", i, pPostProcMeter.u2SatHistL[i], pPostProcMeter.u2SatHistR[i]);
    }

    Printf("== Hue Hist ==\n");
    for (i=0; i<HUE_HIST_NUM; i++)
    {
        Printf("Hue[%d]     %d     %d\n", i, pPostProcMeter.u2HueHistL[i], pPostProcMeter.u2HueHistR[i]);
    }

    return 0;

}

static INT32 _i4GetMapleSysLDMeterCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	UINT32 i;
	CUST_LD_METER_T pLdMeter;

	DRVCUST_GetLdMeter(&pLdMeter);
	
	Printf("====== DRVCUST_GetLdMeter ======\n");
	Printf("== u1LdMaxRGB ==\n");
    for (i=0; i<32; i++)
    {
        Printf("u1LdMaxRGB[%d]         %d\n", i, pLdMeter.u1LdMaxRGB[i]);
    }
	
	Printf("== u2LdMaxHist ==\n");
    for (i=0; i<33; i++)
    {
        Printf("u2LdMaxHist[%d]         %d\n", i, pLdMeter.u2LdMaxHist[i]);
    }

	Printf("== u2LdDimInfo ==\n");
    for (i=0; i<32; i++)
    {
        Printf("u2LdDimInfo[%d]         %d\n", i, pLdMeter.u2LdDimInfo[i]);
    }

	return 0;

}

static INT32 _i4GetMapleSysAnaNoiseCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	UINT8 tmp ;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	tmp  = DRVCUST_GetAnalogDecNoiseLevel(u4Path);

	Printf("====== DRVCUST_GetAnalogDecNoiseLevel ======\n"); 
    Printf("Analog Noise            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysLightSensorCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	UINT8 tmp ;

	tmp  = DRVCUST_GetOpticalSensorLevel();

	Printf("====== DRVCUST_GetOpticalSensorLevel ======\n"); 
    Printf("Light Sensor            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysTempSensorCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	UINT8 tmp ;

	tmp  = DRVCUST_GetTemperatureSensorLevel();

	Printf("====== DRVCUST_GetTemperatureSensorLevel ======\n"); 
    Printf("Temperature Sensor            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysBLPowerLimitCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	UINT8 tmp ;

	tmp  = DRVCUST_GetBLPowerLimit();

	Printf("====== DRVCUST_GetBLPowerLimit ======\n"); 
    Printf("BL Power Limit            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysFrameDelayCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	CUST_VDO_DELAY_INFO_T pVdoDelayInfo;

	DRVCUST_GetVideoFrameDelay(&pVdoDelayInfo);

	Printf("====== DRVCUST_GetVideoFrameDelay ======\n");
    Printf("u4MCVP              %d\n", pVdoDelayInfo.u4MCVP);                  
    Printf("u4Scaler            %d\n", pVdoDelayInfo.u4Scaler);                
    Printf("u4MJC               %d\n", pVdoDelayInfo.u4MJC);     

    return 0;

}

static INT32 _i4GetMapleSysHistoryDataCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	CUST_HISTORY_DATA_T pHistoryData;

	DRVCUST_GetHistoryData(&pHistoryData);

	Printf("====== DRVCUST_GetHistoryData ======\n");
    Printf("u4MCVP              %d\n", pHistoryData.u4TotalOpTime);                  
    Printf("u4Scaler            %d\n", pHistoryData.u4PanelOpTime);                   

    return 0;

}

static INT32 _i4GetMapleSysPowerStateCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	CUST_POWER_STATE_T pPowerState;

	DRVCUST_GetPowerState(&pPowerState);

	Printf("====== DRVCUST_GetPowerState ======\n");
    Printf("Power state               %d\n", pPowerState.ePanelState);     

    return 0;

}

static INT32 _i4GetMapleSysDecBitRateCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	UINT32 tmp ;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	tmp  = DRVCUST_GetDecoderAvgBitRate(u4Path);

	Printf("====== DRVCUST_GetDecoderAvgBitRate ======\n"); 
    Printf("Decoder Bit Rate            %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysADCValueCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	UINT32 tmp ;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 9))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("ADC port\n");
		Printf("0: E_CUST_ADC_PORT_SCART_FS\n");
		Printf("1: E_CUST_ADC_PORT_KEY\n");
		Printf("2: E_CUST_ADC_PORT_LIGHT_SENSOR\n");
		Printf("3: E_CUST_ADC_PORT_PANEL_PWR_DET\n");
		Printf("4: E_CUST_ADC_PORT_BL_ERR_DET\n");
		Printf("5: E_CUST_ADC_PORT_USB_OC2_DET\n");
		Printf("6: E_CUST_ADC_PORT_RF_AGCI\n");
		Printf("7: E_CUST_ADC_PORT_X_SYSTEM_RST\n");
		Printf("8: E_CUST_ADC_PORT_12V_DET\n");
		Printf("9: E_CUST_ADC_PORT_5V_DET\n");
		return 0;
	}

	tmp  = DRVCUST_GetAdcValue(u4Path);

	Printf("====== DRVCUST_GetAdcValue ======\n"); 
    Printf("ADC Value           %d\n", tmp );

    return 0;

}

static INT32 _i4GetMapleSysScreenSaverCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	CUST_SCREEN_SAVER_T pScreenSaver;

	DRVCUST_GetScreenSaver(&pScreenSaver);

	Printf("====== DRVCUST_GetScreenSaver ======\n");
    Printf("eScreenSaverMode               %d\n", pScreenSaver.eScreenSaverMode);     

    return 0;

}

static INT32 _i4GetMapleSysAgingModeCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	CUST_AGING_MODE_T pAgingMode;

	DRVCUST_GetAgingMode(&pAgingMode);

	Printf("====== DRVCUST_GetAgingMode ======\n");
    Printf("bAgingMode               %d\n", pAgingMode.bAgingMode);     

    return 0;

}

static INT32 _i4GetMapleSysTVOutFmtCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	CUST_TV_OUT_FMT_T pTvOutFmt;

	DRVCUST_GetTvOutputFormat(&pTvOutFmt);

	Printf("====== DRVCUST_GetTvOutputFormat ======\n");
    Printf("eDimension               %d\n", pTvOutFmt.eDimension);     

    return 0;

}

static INT32 _i4GetMapleSysScalerInfoCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SCL_AREA_T pScalerArea;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	DRVCUST_GetMuffinScalerInfo(u4Path, &pScalerArea);

	Printf("====== DRVCUST_GetMuffinScalerInfo ======\n");
    Printf("t_DownScalerInput.u4Width               %d\n", pScalerArea.t_DownScalerInput.u4Width);
	Printf("t_DownScalerInput.u4Height               %d\n", pScalerArea.t_DownScalerInput.u4Height);
	Printf("t_DownScalerOutput.u4Width               %d\n", pScalerArea.t_DownScalerOutput.u4Width);
	Printf("t_DownScalerOutput.u4Height               %d\n", pScalerArea.t_DownScalerOutput.u4Height);
	Printf("t_ScalerInput.u4Width				%d\n", pScalerArea.t_ScalerInput.u4Width);
	Printf("t_ScalerInput.u4Height				 %d\n", pScalerArea.t_ScalerInput.u4Height);
	Printf("t_ScalerOutput.u4Width				 %d\n", pScalerArea.t_ScalerOutput.u4Width);
	Printf("t_ScalerOutput.u4Height 			  %d\n", pScalerArea.t_ScalerOutput.u4Height);

    return 0;

}

static INT32 _i4GetMapleSysOSDStateCmd(INT32 i4Argc, const CHAR ** szArgv)
{

	BOOL* bOsdState;

	DRVCUST_GetOsdState(&bOsdState);

	Printf("====== DRVCUST_GetOsdState ======\n");
    Printf("bOsdState               %d\n", bOsdState);     

    return 0;

}

static INT32 _i4GetMapleSysScreenMirrorCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SCR_MIRROR_CONFIG_T pScrMirrorConfig;
	UINT32 u4Path = StrToInt(szArgv[1]);

	if ((i4Argc != 2) || (u4Path > 1))
	{
		Printf("Usage: %s \n", szArgv[0]);
		Printf("Main or Sub\n");
		Printf("0: Main\n");
		Printf("1: Sub\n");
		return 0;
	}

	DRVCUST_GetScreenMirroringConfig(u4Path, &pScrMirrorConfig);

	Printf("====== DRVCUST_GetScreenMirroringConfig ======\n");
	Printf("eProtocol              %d\n", pScrMirrorConfig.eProtocol);


    return 0;

}




CLI_EXEC_T arCmdMapleSysTbl[] = {
    {"System Input", "input",    _i4GetMapleSysInputCmd,     NULL,   "System Input source",  CLI_GUEST},  
	{"Signal Format", "sigfmt",    _i4GetMapleSysSigFmtCmd,     NULL,   "Input Signal Format",  CLI_GUEST}, 
	{"Window Mode", "win",    _i4GetMapleSysWindowModeCmd,     NULL,   "Window Mode",  CLI_GUEST}, 
	{"Plane Mute", "pm",    _i4GetMapleSysPlaneMuteCmd,     NULL,   "Plane Mute State",  CLI_GUEST}, 
	{"Output Mute", "om",    _i4GetMapleSysOutputMuteCmd,     NULL,   "Output Mute State",  CLI_GUEST}, 
	{"Output Position", "posi",    _i4GetMapleSysOutPosiCmd,     NULL,   "Output Position",  CLI_GUEST}, 
	{"Source Area", "sa",    _i4GetMapleSysSrcAreaCmd,     NULL,   "Source Area",  CLI_GUEST}, 
	{"Scaling Req", "sr",    _i4GetMapleSysSclReqCmd,     NULL,   "Scaling Request",  CLI_GUEST}, 
	{"Output Format", "outfmt",    _i4GetMapleSysOutFmtCmd,     NULL,   "Output Format",  CLI_GUEST}, 
	{"MCVP Meter", "mcvp",    _i4GetMapleSysMCVPMeterCmd,     NULL,   "MCVP Meter",  CLI_GUEST}, 
	{"Cadense ", "cad",    _i4GetMapleSysCadenseCmd,     NULL,   "Cadense",  CLI_GUEST}, 
	{"Post Meter ", "post",    _i4GetMapleSysPostMeterCmd,     NULL,   "Post Proc Meter",  CLI_GUEST}, 
	{"LD Meter ", "ld",    _i4GetMapleSysLDMeterCmd,     NULL,   "LD Meter",  CLI_GUEST}, 
	{"Ana Noise", "ana",    _i4GetMapleSysAnaNoiseCmd,     NULL,   "Analog Noise Level",  CLI_GUEST}, 
	{"LightSensor ", "light",    _i4GetMapleSysLightSensorCmd,     NULL,   "Light Sensor Value",  CLI_GUEST}, 
	{"TempSensor ", "tem",    _i4GetMapleSysTempSensorCmd,     NULL,   "Temperature Sensor Value",  CLI_GUEST}, 
	{"BL Limit ", "bl",    _i4GetMapleSysBLPowerLimitCmd,     NULL,   "BL Power Limit",  CLI_GUEST}, 
	{"Frame Delay ", "delay",    _i4GetMapleSysFrameDelayCmd,     NULL,   "Frame Delay",  CLI_GUEST}, 
	{"History ", "his",    _i4GetMapleSysHistoryDataCmd,     NULL,   "History Data",  CLI_GUEST}, 
	{"Power state ", "powst",    _i4GetMapleSysPowerStateCmd,     NULL,   "Power State",  CLI_GUEST}, 
	{"Dec bitrate", "bitrate",    _i4GetMapleSysDecBitRateCmd,     NULL,   "Decoder Bit Rate",  CLI_GUEST}, 
	{"ADC Value", "adc",    _i4GetMapleSysADCValueCmd,     NULL,   "ADC Value",  CLI_GUEST}, 
	{"Screen Saver ", "saver",    _i4GetMapleSysScreenSaverCmd,     NULL,   "Screen Saver Mode",  CLI_GUEST},
	{"Aging Mode ", "aging",    _i4GetMapleSysAgingModeCmd,     NULL,   "Aging Mode",  CLI_GUEST}, 
	{"TV Output", "tvout",    _i4GetMapleSysTVOutFmtCmd,     NULL,   "TV Output Format",  CLI_GUEST}, 
	{"Scaler Info", "scaler",    _i4GetMapleSysScalerInfoCmd,     NULL,   "Scaler in/out information",  CLI_GUEST}, 
	{"OSD state ", "osd",    _i4GetMapleSysOSDStateCmd,     NULL,   "OSD State",  CLI_GUEST}, 
	{"Screen Mirror", "mirror",    _i4GetMapleSysScreenMirrorCmd,     NULL,   "Screen Mirror State",  CLI_GUEST}, 
	{NULL, NULL, NULL, NULL, NULL, CLI_SUPERVISOR}
};


