/*----------------------------------------------------------------------------*
 * 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);
	Printf("eSmoothGradation   	%d\n", pPictureSetting.eSmoothGradation);
	Printf("eTransFunc   	%d\n", pPictureSetting.eTransFunc);

    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.eDelayMode);

    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_DEST_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.u4DestX);
	Printf("u4SrcY 			 %d\n", pSclReq.u4DestY);
	Printf("u4SrcWidth 		 %d\n", pSclReq.u4DestHeight);
	Printf("u4SrcHeight		 %d\n", pSclReq.u4DestHeight);

    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);
    Printf("u2BlockSizeH           %d\n", pMcvpMeter.u2BlockSizeH);
    Printf("u2BlockSizeV           %d\n", pMcvpMeter.u2BlockSizeV);

    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<LUMA_HIST_NUM_113; 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 > 12))
	{
		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;

}

static INT32 _i4GetLetterBoxDetection(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_LETTER_BOX_INFO_T pLetterBoxInfo;
	
	DRVCUST_GetLetterBoxDetection(&pLetterBoxInfo);
	Printf("====Get letter box info====\n");
	Printf("pLetterBoxInfo.u4LBoxLowFinal		%d\n", pLetterBoxInfo.u4LBoxLowFinal);
	Printf("pLetterBoxInfo.u4LBoxUpFinal		%d\n", pLetterBoxInfo.u4LBoxUpFinal);
	Printf("pLetterBoxInfo.u4LBoxRightFinal		%d\n", pLetterBoxInfo.u4LBoxRightFinal);
	Printf("pLetterBoxInfo.u4LBoxLeftFinal		%d\n", pLetterBoxInfo.u4LBoxLeftFinal);	
	return 0;
}

static INT32 _i4SetSCECapEn(INT32 i4Argc, const CHAR ** szArgv)
{	
	BOOL en = StrToInt(szArgv[1]);

	if(i4Argc != 2)
	{
		Printf("Parameter number not correct\n");
		return 0;
	}
	
	DRVCUST_SetScePixMonCapEnable(en);
	return 0;
}

static INT32 _i4SetSCECapPos(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SCE_CAP_DATA_T* SCECAPData = NULL;
	CUST_CAP_POS_T pPos;
	
	if(i4Argc != 3)
	{
		Printf("input CapPostion X Y\n");
		return 0;
	}

	pPos.u2X = StrToInt(szArgv[1]);
	pPos.u2Y = StrToInt(szArgv[2]);

	SCECAPData = DRVCUST_SetScePixMonPos(&pPos);

	Printf("CapPos SCE Input  Yin=%d   Cbin=%d   Crin=%d \n", SCECAPData->SceInput.u2Y_G, SCECAPData->SceInput.u2Cb_B, SCECAPData->SceInput.u2Cr_R);
	Printf("CapPos SCE Output Yout=%d  Cbout=%d  Crout=%d \n", SCECAPData->SceOutput.u2Y_G, SCECAPData->SceOutput.u2Cb_B, SCECAPData->SceOutput.u2Cr_R);
	return 0;
}

static INT32 _i4SetSCECapInk(INT32 i4Argc, const CHAR ** szArgv)
{
	BOOL Inken = StrToInt(szArgv[1]);
	
	if(i4Argc != 2)
	{
		Printf("Parameter number not correct\n");
		return 0;
	}

	DRVCUST_SetScePixMonInkEnable(Inken);
	
	return 0;
}

static INT32 _i4SetSCECapInkColor(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_CAP_DATA_T inkColor;
	
	if(i4Argc != 4)
	{
		Printf("input Ink color control  Y  Cb  Cr\n");
		return 0;
	}

	inkColor.u2Y_G = StrToInt(szArgv[1]);
	inkColor.u2Cb_B = StrToInt(szArgv[2]);
	inkColor.u2Cr_R = StrToInt(szArgv[3]);
	
	DRVCUST_SetScePixMonInkColor(&inkColor);
	return 0;
}

static INT32 _i4SetSCECapData(INT32 i4Argc, const CHAR ** szArgv)
{	
	CUST_SCE_CAP_DATA_T SCECAPData;

	if(i4Argc > 1)
	{		
		Printf("no need input parameter\n");
		return 0;
	}

	DRVCUST_GetScePixMonData(&SCECAPData);
	
	Printf("SCE Input  Yin=%d   Cbin=%d   Crin=%d \n", SCECAPData.SceInput.u2Y_G, SCECAPData.SceInput.u2Cb_B, SCECAPData.SceInput.u2Cr_R);
	Printf("SCE Output Yout=%d  Cbout=%d  Crout=%d \n", SCECAPData.SceOutput.u2Y_G, SCECAPData.SceOutput.u2Cb_B, SCECAPData.SceOutput.u2Cr_R);
	return 0;
}

static INT32 _i4SetOstgCapEn(INT32 i4Argc, const CHAR ** szArgv)
{
	BOOL en = StrToInt(szArgv[1]);

	if(i4Argc != 2)
	{
		Printf("Parameter number not correct\n");
		return 0;
	}
	
	DRVCUST_SetOstgPixMonCapEnable(en);
	return 0;
}

static INT32 _i4SetOstgCapPos(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_CAP_DATA_T* OstgCapData = NULL;
	CUST_CAP_POS_T pPos;
	
	if(i4Argc != 3)
	{
		Printf("input CapPostion X Y\n");
		return 0;
	}
	
	pPos.u2X = StrToInt(szArgv[1]);
	pPos.u2Y = StrToInt(szArgv[2]);
	
	OstgCapData = DRVCUST_SetOstgPixMonPos(&pPos);

	//Printf("CapPos Ostg Cap Data R=%d G=%d B=%\n", OstgCapData.u2Cr_R, OstgCapData.u2Y_G, OstgCapData.u2Cb_B);
	Printf("CapPos Ostg Cap Data R=%d G=%d B=%d\n", OstgCapData->u2Cr_R, OstgCapData->u2Y_G, OstgCapData->u2Cb_B);
	return 0;

}

static INT32 _i4SetOstgCapColor(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_CAP_DATA_T inkColor;
	
	if(i4Argc != 4)
	{
		Printf("input Ink color control  Y  Cb  Cr\n");
		return 0;
	}

	inkColor.u2Y_G = StrToInt(szArgv[1]);
	inkColor.u2Cb_B = StrToInt(szArgv[2]);
	inkColor.u2Cr_R = StrToInt(szArgv[3]);
	
	DRVCUST_SetOstgPixMonCurseColor(&inkColor);
	return 0;
}

static INT32 _i4SetOstgCapData(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_CAP_DATA_T OstgCapData;
	
	if(i4Argc > 1)
	{		
		Printf("no need input parameter\n");
		return 0;
	}

	DRVCUST_GetOstgPixMonData(&OstgCapData);
	
	Printf("Ostg Cap Data R=%d G=%d B=%d\n", OstgCapData.u2Cr_R, OstgCapData.u2Y_G, OstgCapData.u2Cb_B);
	return 0;
}

static INT32 _i4SetDemoMode(INT32 i4Argc, const CHAR ** szArgv)
{
	E_CUST_DEMO_MODE eDemoMode;
	E_CUST_DEMO_PATTERN eDemoPattern;
	UINT32 u4DemoOption;
	if(i4Argc != 4)
	{		
		Printf("input eDemoMode eDemoPattern  u4DemoOption \n");
		return 0;
	}

	
	eDemoMode = StrToInt(szArgv[1]);
	eDemoPattern = StrToInt(szArgv[2]);
	u4DemoOption = StrToInt(szArgv[3]);

	DRVCUST_SetDemoMode( eDemoMode,  eDemoPattern,  u4DemoOption);
	
	return 0;
}

static INT32 _i4BEWriteCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	E_CUST_BE_PART ePartId;
	UINT32 u4Offset;
	//UINT32 u4BufSize;

	UINT8 Arry[10] = {0xFF,0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
	if(i4Argc != 3)
	{
		Printf("size not correct ***\n");
		return 0;
	}
	ePartId = StrToInt(szArgv[1]);
	u4Offset = StrToInt(szArgv[2]);

	DRVCUST_BePartitionWrite( ePartId,  u4Offset, Arry, sizeof(Arry) );
	return 0;
}

static INT32 _i4BEReadeCmd(INT32 i4Argc, const CHAR ** szArgv)
{
	E_CUST_BE_PART ePartId;
	UINT32 u4Offset;
	//UINT32 u4BufSize;
	UINT8 i;

	UINT8 RArry[10];

	if(i4Argc != 2)
	{
		Printf("size not correct ***\n");
		return 0;
	}
	ePartId = StrToInt(szArgv[1]);
	u4Offset = StrToInt(szArgv[2]);
	
	DRVCUST_BePartitionRead(ePartId, u4Offset, RArry,  sizeof(RArry));

	for(i=0; i< 10; i++)
	{
		Printf("RArry[%d]=%d**\n", i, RArry[i]);
	}
	return 0;

}


static INT32 _i4WritSsharpne(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_SHARP_OFST_T Sharpness_P;
	
	Sharpness_P.u1Edf1Th[0]= 0x81;
	Sharpness_P.u1Edf1Th[1]= 0x82;
	Sharpness_P.u1Edf1Th[2]= 0x83;

	
	Sharpness_P.u1Edf2Th[0]= 0x81;
	Sharpness_P.u1Edf2Th[1]= 0x82;
	Sharpness_P.u1Edf2Th[2]= 0x83;
	Sharpness_P.u1Edf2Th[3]= 0x84;
	
	Sharpness_P.u1Edf2FGain[0]= 0x81;
	Sharpness_P.u1Edf2FGain[1]= 0x82;
	Sharpness_P.u1Edf2FGain[2]= 0x83;

	
	Sharpness_P.u1Edf2DGain[0]= 0x81;
	Sharpness_P.u1Edf2DGain[1]= 0x82;
	Sharpness_P.u1Edf2DGain[2]= 0x83;

	Sharpness_P.u1Edf2EGain[0]= 0x81;
	Sharpness_P.u1Edf2EGain[1]= 0x82;
	Sharpness_P.u1Edf2EGain[2]= 0x83;
	Sharpness_P.u1Edf2EGain[3]= 0x84;
	Sharpness_P.u1Edf2EGain[4]= 0x85;
	Sharpness_P.u1Edf2EGain[5]= 0x86;
	
	DRVCUST_SetSharpnessOffset(&Sharpness_P);
}

static INT32 _i4Set4BandFrequencySetting(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_4BAND_FILTER_RANGE sFilterRange;
	CUST_4BAND_H_FILTER sFilterSetting;
	UINT8 bType,i;
	INT16 band0[21] ={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; 

	bType = StrToInt(szArgv[1]);
	
	if(i4Argc != 2)
	{
		Printf("_i4Set4BandFrequencySetting: 0 set the range\n");
		Printf("_i4Set4BandFrequencySetting: 1 set the setting\n");
	}
	
	if(bType == 0)
	{
		sFilterRange.h_filter_h_start=16;
		sFilterRange.h_filter_v_start = 16;
		sFilterRange.h_filter_h_size = 3808;
		sFilterRange.h_filter_v_size = 2128;
		DRVCUST_Set4BandFilterRang(&sFilterRange);
	}

	if(bType == 1)
	{
		sFilterSetting.bitshift_a0 = 2;
		sFilterSetting.bitshift_a1 = 2;
		sFilterSetting.bitshift_a2 = 2;
		sFilterSetting.bitshift_a3 = 2;
		
		sFilterSetting.bitshift_b0 = 1;
		sFilterSetting.bitshift_b1 = 1;
		sFilterSetting.bitshift_b2 = 1;
		sFilterSetting.bitshift_b3 = 1;

		sFilterSetting.h_filter_switch_0 = 1;
		sFilterSetting.h_filter_switch_1 = 1;
		sFilterSetting.h_filter_switch_2 = 1;
		sFilterSetting.h_filter_switch_3 = 1;
		
		sFilterSetting.h_filter_band0_div = 4;
		sFilterSetting.h_filter_band1_div = 4;
		sFilterSetting.h_filter_band2_div = 4;
		sFilterSetting.h_filter_band3_div = 4;
		
		x_memcpy(sFilterSetting.h_filter_band0_coef, band0, sizeof(INT16)*21);
		x_memset(sFilterSetting.h_filter_band1_coef, 2, sizeof(INT8)*15);
		x_memset(sFilterSetting.h_filter_band2_coef, 3, sizeof(INT8)*15);
		x_memset(sFilterSetting.h_filter_band3_coef, 4, sizeof(INT8)*15);

		for(i=0;i<21; i++)
		{
			Printf("%d \n", sFilterSetting.h_filter_band0_coef[i]);
		}
		
		Printf("band0 end!!!! \n");

		
		for(i=0; i<15; i++)
		{
			Printf("%d \n", sFilterSetting.h_filter_band1_coef[i]);
		}
		
		Printf("band1 end!!!! \n");

		DRVCUST_Set4BandHFilter(&sFilterSetting);
	}


}

static INT32 _i4Get4BandHist(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_4BAND_HIST_T sGet4BandHist;
	UINT8 i;
	
	DRVCUST_Get4bandFreqHist(&sGet4BandHist);
	
	Printf("sGet4BandHist.a0_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.a0_hist[i]);
	}
	Printf("\n");

	
	Printf("sGet4BandHist.b0_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.b0_hist[i]);
	}
	Printf("\n");

	
	Printf("sGet4BandHist.a1_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.a1_hist[i]);
	}
	Printf("\n");
	
	Printf("sGet4BandHist.b1_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.b1_hist[i]);
	}
	Printf("\n");

	Printf("sGet4BandHist.a2_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.a2_hist[i]);
	}
	Printf("\n");

	Printf("sGet4BandHist.b2_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.b2_hist[i]);
	}
	Printf("\n");

	
	Printf("sGet4BandHist.a3_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.a3_hist[i]);
	}
	Printf("\n");

	
	Printf("sGet4BandHist.b3_hist\n");
	for(i=0; i<16; i++)
	{
		Printf("[%d]=%x ", i, sGet4BandHist.b3_hist[i]);
	}
	Printf("\n");
}

static INT32 _i4GetQPValue(INT32 i4Argc, const CHAR ** szArgv)
{
	CUST_DECODER_METER_T pDecoderMeter;
	UINT8 bPath, i;

	bPath = StrToInt(szArgv[1]);

	if(i4Argc!=2)
	{
		Printf("Get QP value Main:0, sub:1 ");
		return 0;
	}
	
	DRVCUST_GetDecoderMeter(bPath, &pDecoderMeter);
	
	LOG(0,"s1QpPP = %d\n", pDecoderMeter.s1QpPPS);
	LOG(0,"s1QpPictrue = %d\n", pDecoderMeter.s1QpPictrue);
	LOG(0,"s1QpMB = %d\n", pDecoderMeter.s1QpMB);	
	LOG(0,"bvalid = %d\n", pDecoderMeter.b1Valid);
	LOG(0,"u1PictureCodingType = %d\n", pDecoderMeter.u1PictureCodingType);
	LOG(0,"u4GeneratedBit = %d\n", pDecoderMeter.u4GeneratedBit);        
	LOG(0,"=====u1ScalingListIntra====\n");    
    for(i=0; i<64; i++)
    {
        LOG(0," u1ScalingListIntra[%d]  %d\n", i, pDecoderMeter.u1ScalingListIntra[i]);
    }    
	LOG(0,"=====u1ScalingListInter====\n");    
    for(i=0; i<64; i++)
    {
        LOG(0," u1ScalingListInter[%d]  %d\n", i, pDecoderMeter.u1ScalingListInter[i]);
    }    
	LOG(0,"u1OddEven = %d\n", pDecoderMeter.u1OddEven);
	LOG(0,"u1color_primaries = %d\n", pDecoderMeter.u1color_primaries);
	LOG(0,"u1transfer_characteristics = %d\n", pDecoderMeter.u1transfer_characteristics);
	LOG(0,"u1matrix_coefficients = %d\n", pDecoderMeter.u1matrix_coefficients);
	LOG(0,"=====u1UserData====\n");    
    for(i=0; i<128; i++)
    {
        LOG(0," u1UserData[%d]  %d\n", i, pDecoderMeter.u1UserData[i]);
    }
	
	return 0;
}

static INT32 _i4GetPhysical2VituralAddr(INT32 i4Argc, const CHAR ** szArgv)
{
	FBM_POOL_T* prPool = FBM_GetPoolInfoAuto((UCHAR)FBM_POOL_TYPE_SRS, NULL); 

	Printf("SRS Vitrual address %x\n", DRVCUST_GetPhysical2VirtualAddress(prPool->u4Addr));
	Printf("SRS_Table %x\n",SRS_Table);

}

static INT32 _i4GetVitural2PhysicalAddr(INT32 i4Argc, const CHAR ** szArgv)
{	
	Printf("SRS Physical address %x\n", DRVCUST_GetVirtual2PhysicalAddress((UINT32) SRS_Table));
}

static INT32 _i4PQModuleOnOff(INT32 i4Argc, const CHAR ** szArgv)
{
    D_OSTG_PQ_ENABLE_T Moduel_Onoff_T;

    if(i4Argc !=3)
    {
        Printf("parameter not correct\n");
        return 0;
    }
    Moduel_Onoff_T.eModule = StrToInt(szArgv[1]);
    Moduel_Onoff_T.bOnOff = StrToInt(szArgv[2]);

    d_maple_cust_spec_set(DRV_CUSTOM_CUST_SPEC_SET_PQ_MODULE_ONOFF, &Moduel_Onoff_T, sizeof(D_OSTG_PQ_ENABLE_T), SV_FALSE);
}


static INT32 _i4SetPqColMatrixParam(INT32 i4Argc, const CHAR ** szArgv)
{
	UINT8 u1Upof_ext;
	UINT8 u1Ucof_ext;
	UINT8 u1Ubof_ext;
	CUST_COL_MTX_PARAM_T pColMtxParam ;

	if(i4Argc !=12)
	{
		Printf("parameter not correct\n");
		return 0;
	}
	u1Upof_ext= StrToInt(szArgv[1]);
	u1Ucof_ext= StrToInt(szArgv[2]);
	u1Ubof_ext= StrToInt(szArgv[3]);
	pColMtxParam.u2Cb_gain_ext= StrToInt(szArgv[4]);
	pColMtxParam.u2Cr_gain_ext= StrToInt(szArgv[5]);
	pColMtxParam.u2Yin_ofst_ext= StrToInt(szArgv[6]);	
	pColMtxParam.u2Cbin_ofst_ext= StrToInt(szArgv[7]);
	pColMtxParam.u2Crin_ofst_ext= StrToInt(szArgv[8]);
	pColMtxParam.u2Rout_ofst_ext= StrToInt(szArgv[9]);
	pColMtxParam.u2Gout_ofst_ext= StrToInt(szArgv[10]);
	pColMtxParam.u2Bout_ofst_ext= StrToInt(szArgv[11]);
	DRVCUST_SetPqColMatrixParam(u1Upof_ext,u1Ucof_ext,u1Ubof_ext,&pColMtxParam);
	LOG(0,"pColMtxParam.u2Cb_gain_ext=%d\n",pColMtxParam.u2Cb_gain_ext);
	LOG(0,"pColMtxParam.u2Cr_gain_ext=%d\n",pColMtxParam.u2Cr_gain_ext);
	LOG(0,"pColMtxParam.u2Yin_ofst_ext=%d\n",pColMtxParam.u2Yin_ofst_ext);
	LOG(0,"pColMtxParam.u2Cbin_ofst_ext=%d\n",pColMtxParam.u2Cbin_ofst_ext);
	LOG(0,"pColMtxParam.u2Crin_ofst_ext=%d\n",pColMtxParam.u2Crin_ofst_ext);
	LOG(0,"pColMtxParam.u2Rout_ofst_ext=%d\n",pColMtxParam.u2Rout_ofst_ext);
	LOG(0,"pColMtxParam.u2Gout_ofst_ext=%d\n",pColMtxParam.u2Gout_ofst_ext);
	LOG(0,"pColMtxParam.u2Bout_ofst_ext=%d\n",pColMtxParam.u2Bout_ofst_ext);
  	return 0;
	}
static INT32 _i4SetPqBaseMatrixParam(INT32 i4Argc,const CHAR * * szArgv)
{
	UINT8 i;
	UINT32 pDvBaseMtxTable[15];
	if(i4Argc !=16)
	{
		Printf("parameter not correct\n");
		return 0;
	}
	for(i=0;i<15;i++)
	{
		pDvBaseMtxTable[i]=StrToInt(szArgv[i+1]);
		LOG(0,"pDvBaseMtxTable[%d]t=%d\n",i,pDvBaseMtxTable[i]);

	}
	DRVCUST_SetDVBaseMatrixParam(pDvBaseMtxTable);
  	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},
	{"letter box info", "lb",    _i4GetLetterBoxDetection,	  NULL,   "letter box info",  CLI_GUEST},
	{"SCE cap enable", "scen",	 _i4SetSCECapEn,	  NULL,   "lSCE cap enable",  CLI_GUEST},
	{"SCE cap position", "scp",	 _i4SetSCECapPos,	  NULL,   "SCE cap position",  CLI_GUEST},
	{"SCE cap ink enable", "scie",	 _i4SetSCECapInk,	  NULL,   "SCE cap ink enable",  CLI_GUEST},
	{"SCE cap ink color", "scic",	 _i4SetSCECapInkColor,	  NULL,   "SCE cap ink color",  CLI_GUEST},
	{"SCE cap data", "scd",	 _i4SetSCECapData,	  NULL,   "SCE cap data",  CLI_GUEST},
	{"Ostg cap enable", "oce",	 _i4SetOstgCapEn,	  NULL,   "Ostg cap enable",  CLI_GUEST},
	{"Ostg cap position", "ocp",	 _i4SetOstgCapPos,	  NULL,   "letter box info",  CLI_GUEST},
	{"Ostg cap ink color", "ocic",	 _i4SetOstgCapColor,	  NULL,   "Ostg cap ink color",  CLI_GUEST},
	{"Ostg cap data", "ocd",	 _i4SetOstgCapData,	  NULL,   "Ostg cap data",  CLI_GUEST},
	{"demo mode", "dm",	 _i4SetDemoMode,   NULL,   "demo mode",	CLI_GUEST},
	{"BeWrite", "bew",    _i4BEWriteCmd,	  NULL,   "bew State",  CLI_GUEST}, 
	{"BeRead", "ber",    _i4BEReadeCmd,     NULL,   "ber State",  CLI_GUEST}, 
	{"Sharpness", "sp",	 _i4WritSsharpne, 	NULL,	"sharpness State",  CLI_GUEST}, 
	{"frequencydetset", "fds",  _i4Set4BandFrequencySetting,	NULL,	"frequencydetset State",	CLI_GUEST}, 
	{"4BandGetHist", "fdg",	_i4Get4BandHist,	NULL,	"4BandGetHist State",	CLI_GUEST}, 	
	{"Get QP value", "qp",	_i4GetQPValue,	NULL,	"QP value State",	CLI_GUEST}, 
	{"get virt addr", "gvaddr",	_i4GetPhysical2VituralAddr,	NULL,	"SRS get virtual addr",	CLI_GUEST}, 
	{"get Phy addr", "gpaddr",	_i4GetVitural2PhysicalAddr,	NULL,	"SRS get Physical addr",	CLI_GUEST}, 
    {"PQ module onoff", "pqen",  _i4PQModuleOnOff, NULL,   "set pq module on/off",    CLI_GUEST}, 
    {"PQ CALC PRAM", "pqcal",  _i4SetPqColMatrixParam, NULL,   "set pq PQ CALC PRAM",    CLI_GUEST}, 
    {"PQ Base Matrix", "pqbase",  _i4SetPqBaseMatrixParam, NULL,   "set PQ Base Matrix",    CLI_GUEST},
	{NULL, NULL, NULL, NULL, NULL, CLI_SUPERVISOR}
};


