Esempio n. 1
0
int do_get_mmap(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
    U32 addr=0;
    U32 len=0;
    int ret=0;
    UBOOT_TRACE("IN\n");

    if(argc!=2)
    {
        cmd_usage(cmdtp);
        return -1;  
    }
    if(strncmp(argv[1], "-l", 2) == 0)
    {
        
        ret=list_mmap_id();
    }
    else
    {
        ret=get_addr_from_mmap(argv[1],&addr);
        if(ret!=0)
        {
            UBOOT_ERROR("get addresss fail\n");
            return -1;
        }
        ret=get_length_from_mmap(argv[1],&len);    
        if(ret!=0)
        {
            UBOOT_ERROR("get addresss fail\n");
            return -1;
        }    
        UBOOT_INFO("addr=0x%x\n",(unsigned int)addr);
        UBOOT_INFO("len=0x%x\n",(unsigned int)len);    
    }


    if(ret!=0)
    {
        UBOOT_ERROR("get_mmap fail\n");
    }
    else
    {
        UBOOT_TRACE("OK\n");
    }
    
    return 0;
}
Esempio n. 2
0
//--------------------------------------------------------------------------------------------------
///Entry function
//--------------------------------------------------------------------------------------------------
int MsDrv_VE_init(HDMITX_VIDEO_TIMING outPutType)
{

    U32 u32Addr=0,u32Size=0;
	XC_INITDATA sXC_InitData;
    XC_INITDATA *pstXC_InitData= &sXC_InitData;
    UBOOT_TRACE("IN\n");
    
    // reset to zero

    memset(&sXC_InitData, 0, sizeof(sXC_InitData));

    // Init XC
		// (OBA2!=1) // remove when XC driver update
    // Check library version. Do not modify this statement please.
    pstXC_InitData->u32XC_version = XC_INITDATA_VERSION;

    pstXC_InitData->u32XTAL_Clock = MST_XTAL_CLOCK_HZ;
    if(get_addr_from_mmap("E_MMAP_ID_XC_MAIN_FB", &u32Addr)!=0)
    {
        UBOOT_ERROR("get E_MMAP_ID_XC_MAIN_FB mmap fail\n");
    }
    if(u32Addr==0xFFFF)
    {
        UBOOT_ERROR("get E_MMAP_ID_XC_MAIN_FB mmap fail\n");
        return -1;
    }
    get_length_from_mmap("E_MMAP_ID_XC_MAIN_FB", (U32 *)&u32Size);
    UBOOT_DEBUG("E_MMAP_ID_XC_MAIN_FB 0x%x \n",u32Addr);

    pstXC_InitData->u32Main_FB_Size = u32Size; //SCALER_DNR_BUF_LEN;
    pstXC_InitData->u32Main_FB_Start_Addr = u32Addr;//((SCALER_DNR_BUF_MEMORY_TYPE & MIU1) ? (SCALER_DNR_BUF_ADR | MIU_INTERVAL) : (SCALER_DNR_BUF_ADR));

    // Init DNR Address in Main & Sub channel. Keep the same. If project support FB PIP mode, set Sub DNR Address in AP layer (eg. mapp_init).
    pstXC_InitData->u32Sub_FB_Size = pstXC_InitData->u32Main_FB_Size;
    pstXC_InitData->u32Sub_FB_Start_Addr = pstXC_InitData->u32Main_FB_Start_Addr;

    // Chip related.
    pstXC_InitData->bIsShareGround = ENABLE;
    // (OBA2!=1) // remove when XC driver update
    // Board related
    pstXC_InitData->eScartIDPort_Sel = SCART_ID_SEL;//SCART_ID_SEL | SCART2_ID_SEL ;

    pstXC_InitData->bCEC_Use_Interrupt = FALSE;

    pstXC_InitData->bEnableIPAutoCoast = 0;

    pstXC_InitData->bMirror = FALSE;
  

    // panel info 
    pstXC_InitData->stPanelInfo.u16HStart = g_IPanel.HStart();      // DE H start
    pstXC_InitData->stPanelInfo.u16VStart = g_IPanel.VStart();
    pstXC_InitData->stPanelInfo.u16Width  = g_IPanel.Width();
    pstXC_InitData->stPanelInfo.u16Height = g_IPanel.Height();
    pstXC_InitData->stPanelInfo.u16HTotal = g_IPanel.HTotal();
    pstXC_InitData->stPanelInfo.u16VTotal = g_IPanel.VTotal();

    pstXC_InitData->stPanelInfo.u16DefaultVFreq = g_IPanel.DefaultVFreq();

    pstXC_InitData->stPanelInfo.u8LPLL_Mode = g_IPanel.LPLL_Mode();
    pstXC_InitData->stPanelInfo.enPnl_Out_Timing_Mode = (E_XC_PNL_OUT_TIMING_MODE)(g_IPanel.OutTimingMode());

    pstXC_InitData->stPanelInfo.u16DefaultHTotal = g_IPanel.HTotal();
    pstXC_InitData->stPanelInfo.u16DefaultVTotal = g_IPanel.VTotal();
    pstXC_InitData->stPanelInfo.u32MinSET = g_IPanel.MinSET();
    pstXC_InitData->stPanelInfo.u32MaxSET = g_IPanel.MaxSET();
    pstXC_InitData->stPanelInfo.eLPLL_Type = (E_XC_PNL_LPLL_TYPE) g_IPanel.LPLL_Type();
    pstXC_InitData->bDLC_Histogram_From_VBlank = FALSE;

    if(MApi_XC_Init(pstXC_InitData, sizeof(XC_INITDATA)) == FALSE)
    {
        UBOOT_ERROR("L:%d, XC_Init failed because of InitData wrong, please update header file and compile again\n", __LINE__);
        return -1;
    }
#if (CONFIG_HDMITX_MSTAR_ROCKET==1)
    //set display window 
    MApi_XC_SetDispWindowColor(0x82,MAIN_WINDOW);
    
    MApi_XC_SetFrameColor(0x00801080); 
#endif
    //0. VE initialization
    if(get_addr_from_mmap("E_MMAP_ID_VE", &u32Addr)!=0)
    {
        UBOOT_ERROR("get E_MMAP_ID_VE fail\n");
        return -1;
    }
   
   
    MApi_XC_SetOutputCapture(ENABLE,E_XC_OP2);      // Enable op2 to ve path
    MDrv_VE_Init(u32Addr); //MDrv_VE_Init(VE_BUFFER_ADDR);
    UBOOT_DEBUG("E_MMAP_ID_VE 0x%x \n",u32Addr);
    MDrv_VE_SetOSD(FALSE);
    
    MDrv_VE_SetOutputVideoStd(getVEVideoSys(outPutType));
    //setHDMITxAnalogTuning(outPutType);    //set bank21_0x2e(16bit mode)
    //1. VE configuration
    MS_Switch_VE_Src_Info SwitchInputSrc;
    SwitchInputSrc.InputSrcType = MS_VE_SRC_SCALER;
    
    MDrv_VE_SwitchInputSource(&SwitchInputSrc);

    MS_Switch_VE_Dest_Info SwitchOutputDest;
	SwitchOutputDest.OutputDstType = MS_VE_DEST_SCART;
    
    MDrv_VE_SwitchOuputDest(&SwitchOutputDest);

    MS_VE_Set_Mode_Type SetModeType;
    SetModeType.u16H_CapSize     = g_IPanel.Width();
    
#if (CONFIG_HDMITX_MSTAR_ROCKET==1 && ENABLE_MSTAR_NAPOLI==1) 
    extern MS_BOOL is_Interlace(HDMITX_VIDEO_TIMING outputTiming);

    if(is_Interlace(outPutType))
    {
        SetModeType.u16V_CapSize     = g_IPanel.Height()*2;
        SetModeType.bSrcInterlace = TRUE;
        UBOOT_DEBUG("interlaced u16V_CapSize X2 !!!\n"); 
    }
    else
#endif

    {
        SetModeType.bSrcInterlace = FALSE;
        SetModeType.u16V_CapSize     = g_IPanel.Height();
    }
    SetModeType.u16H_CapStart    = g_IPanel.HStart();
    SetModeType.u16V_CapStart    = g_IPanel.VStart();
    SetModeType.u16H_SC_CapSize  = g_IPanel.Width();
    SetModeType.u16V_SC_CapSize  = g_IPanel.Height();
    SetModeType.u16H_SC_CapStart = g_IPanel.HStart();
    SetModeType.u16V_SC_CapStart = g_IPanel.VStart();
    SetModeType.u16InputVFreq = getFrameRates(outPutType)*2/10;
    
    SetModeType.bHDuplicate   = FALSE;
    
    MDrv_VE_SetMode(&SetModeType);

    MS_VE_Output_Ctrl OutputCtrl;
    OutputCtrl.bEnable = TRUE;
    
    OutputCtrl.OutputType = MS_VE_OUT_TVENCODER;
    
    MDrv_VE_SetOutputCtrl(&OutputCtrl);
    MDrv_VE_SetRGBIn(FALSE);
    MApi_XC_ADC_SetCVBSOut(ENABLE, OUTPUT_CVBS1, INPUT_SOURCE_DTV, TRUE);
    MsDrv_OSDC_init();
    UBOOT_TRACE("OUT\n");
    return 1;

}
Esempio n. 3
0
//--------------------------------------------------------------------------------------------------
/// API for JPEG decoder initialization::
void MsDrv_JpdInit(void)
{
    UBOOT_TRACE("IN\n");

    //for test code
    g_state = E_JPEG_INIT;
    //u16ImageWidth = 0;
    //u16ImageHeight = 0;
    //u16ImageOriWidth = 0;
    //u16ImageOriHeight = 0;
    //u16ImageNonAlignWidth = 0;
    //u16ImageNonAlignHeight = 0;
    //u16ErrorCode = 0;
    //u8ScaleDownFactor = 0;
    //bIsProgressive = FALSE;

    //u8DebugLevel = 0x0;

    s32InitByteRead = 0;
    u8EOF_flag = FALSE;
#if CONFIG_MINIUBOOT
    u32ReadBuffPA = MMAP_E_MMAP_ID_JPD_READ_ADDR;
    u32WriteBuffPA = MMAP_E_MMAP_ID_JPD_WRITE_ADDR;
    u32InterBuffPA = MMAP_E_MMAP_ID_PHOTO_INTER_ADDR;

    u32ReadBuffSize = MMAP_E_MMAP_ID_JPD_READ_SIZE;
    u32WriteBuffSize = MMAP_E_MMAP_ID_JPD_WRITE_SIZE;
    u32InterBuffSize = MMAP_E_MMAP_ID_PHOTO_INTER_SIZE;
#else
    get_addr_from_mmap("E_MMAP_ID_JPD_READ", (U32 *)&u32ReadBuffPA);
    get_addr_from_mmap("E_MMAP_ID_JPD_WRITE", (U32 *)&u32WriteBuffPA);
    get_addr_from_mmap("E_MMAP_ID_PHOTO_INTER", (U32 *)&u32InterBuffPA);

    get_length_from_mmap("E_MMAP_ID_JPD_READ", (U32 *)&u32ReadBuffSize);
    get_length_from_mmap("E_MMAP_ID_JPD_WRITE", (U32 *)&u32WriteBuffSize);
    get_length_from_mmap("E_MMAP_ID_PHOTO_INTER", (U32 *)&u32InterBuffSize);
#endif
    u32ReadBuffVirAddr = MS_PA2KSEG1(u32ReadBuffPA);
    u32IntBuffVirAddr = MS_PA2KSEG1(u32InterBuffPA);
    u32OutBuffVirAddr = MS_PA2KSEG1(u32WriteBuffPA);

    UBOOT_DEBUG("u32ReadBuffVirAddr = %lx, u32IntBuffVirAddr = %lx, u32OutBuffVirAddr = %lx\n", u32ReadBuffVirAddr, u32IntBuffVirAddr, u32OutBuffVirAddr);


#if 0
    #if (TEST_EXAMPLE==BASELINE_EXAMPLE)
    u8InputDataAddr = (MS_U8 *)u8BaseLineJPEG;
    u32InputDataLength = sizeof(u8BaseLineJPEG);
    #elif (TEST_EXAMPLE==PROGRESSIVE_EXAMPLE)
    u8InputDataAddr = (MS_U8 *)u8ProgressiveJPEG;
    u32InputDataLength = sizeof(u8ProgressiveJPEG);
    #endif
#else
    //logo jpd decode using BaseLine
    u8InputDataAddr = (MS_U8 *)TARGET_LOGO_ADDR;
    u32InputDataLength = TARGET_LOGO_SIZE;
#endif


    u32ReadPosition = 0;

    _gEXIF_DateTime.bHasDataTime = FALSE;
    _gEXIF_DateTime.u32Year = 0;
    _gEXIF_DateTime.u32Month = 0;
    _gEXIF_DateTime.u32Day = 0;
    _gEXIF_DateTime.u32Hour = 0;
    _gEXIF_DateTime.u32Minute = 0;
    _gEXIF_DateTime.u32Second = 0;
    _gEXIF_Orientation = E_JPEG_EXIF_ORIENT_NOT_FOUND;

    //MsDrv_InitFileSystem();
    MApi_JPEG_SetDbgLevel(E_JPEG_DEBUG_NONE);

    //MApi_JPEG_SetDbgLevel(E_JPEG_DEBUG_ALL);
    UBOOT_TRACE("OK\n");
}
Esempio n. 4
0
int do_draw_jpg (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
    U32 u32LogoAddr=0;
    U32 u32LogoSize=0;
    U32 JPD_InputADDR=0;
    U32 JPD_OUTADDR=0;
    char *PhotoPath=NULL;
    BltConfigParams stConfig;
    UBOOT_TRACE("IN\n");

    get_addr_from_mmap("E_MMAP_ID_JPD_READ", &JPD_InputADDR);
    get_addr_from_mmap("E_MMAP_ID_JPD_WRITE", &JPD_OUTADDR);

	if(JPD_InputADDR==0xFFFF || JPD_OUTADDR==0xFFFF)
	{
		UBOOT_ERROR("Get Mmap for JPD Fail Skip JPD Decode !!! \n");
		return -1;

	}
    if(argc < 6)
    {
#if (CONFIG_BINARY_RELEASE == 1)
    stConfig.u16DispX = DEFAULT_OSD_STRING_X;
    stConfig.u16DispY = DEFAULT_OSD_STRING_Y;
    stConfig.u16DispW = DEFAULT_OSD_LAYER_WIDTH;
    stConfig.u16DispH = DEFAULT_OSD_LAYER_HEIGHT; 
#else
        cmd_usage(cmdtp);
        return 1;
#endif
    }
    else
    {
        stConfig.u16DispX = simple_strtoul(argv[2], NULL, 10);
        stConfig.u16DispY = simple_strtoul(argv[3], NULL, 10);
        stConfig.u16DispW = simple_strtoul(argv[4], NULL, 10);
        stConfig.u16DispH = simple_strtoul(argv[5], NULL, 10);       
    }
    if(IsPanelReady()!=0)
    {
         UBOOT_ERROR("Panle is not ready\n");
        return -1;
    }


    UBOOT_DEBUG("u16DispX=0x%x,u16DispY=0x%x,u16DispW=0x%x,u16DispH=0x%x\n",stConfig.u16DispX,stConfig.u16DispY,stConfig.u16DispW,stConfig.u16DispH);

    if(strncmp(argv[1], "-fs", 3)==0) // jpd from filesystem
    {
        PhotoPath = argv[6];
        UBOOT_DEBUG("PhotoPath=%s\n",PhotoPath);
        u32LogoSize = LoadJpg2Dram(PhotoPath, JPD_InputADDR);
        UBOOT_DEBUG("u32LogoSize : 0x%x \n",u32LogoSize);
        if(u32LogoSize == 0)
        {
            UBOOT_ERROR("Fail: Load_Photo2Dram return size is 0 !!\n");
            return -1;
        }
    }
    else if(strncmp(argv[1], "-s", 2)==0)
    {
        mboot_raw_io_Config();
        u32LogoAddr= simple_strtoul(argv[6],NULL,16);
        u32LogoSize= simple_strtoul(argv[7],NULL,16);;
        raw_read(PA2NVA(JPD_InputADDR),u32LogoAddr,u32LogoSize);
    }
    else
    {
#if (CONFIG_BINARY_RELEASE == 1)
        PhotoPath = DEFAULT_OSD_BACKGROUND_PATH;
        UBOOT_DEBUG("PhotoPath=%s\n",PhotoPath);
        u32LogoSize = LoadJpg2Dram(PhotoPath,LOGO_JPG_DRAM_ADDR);
        UBOOT_DEBUG("u32LogoSize : 0x%x \n",u32LogoSize);
        if(u32LogoSize == 0)
        {
            UBOOT_ERROR("Fail: Load_Photo2Dram return size is 0 !!\n");
            return -1;
        }
#else
        cmd_usage(cmdtp);
        return -1;
#endif
    }    
    MsApi_JPD_Decode(JPD_InputADDR, u32LogoSize);
    draw_jpg(stConfig,JPD_OUTADDR);
    UBOOT_TRACE("OK\n");
    return 0;
}
Esempio n. 5
0
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
int do_create_osdlayer(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
    U32 u32GopBuffer;
    MS_U16 w, h;

    if (argc < 3)
    {
#if (CONFIG_BINARY_RELEASE == 1)
        w = DEFAULT_OSD_LAYER_WIDTH;
        h = DEFAULT_OSD_LAYER_HEIGHT;
#else
        printf("Usage:\n%s\n", cmdtp->usage);
        return 1;
#endif
    }
    else
    {
       w = simple_strtoul(argv[1], NULL, 10); 
       h = simple_strtoul(argv[2], NULL, 10);
    }

    MS_U32 size = w * h;

    if (0 == size)
    {
        printf("Usage:\n%s\n", cmdtp->usage);
        return 1;
    }

    if(IsPanelReady()!= 0)
    {
        if(run_command("panel_init",0)!=0)
        {
            printf("Error : panel_init fail!!\n");
            return -1;
        }
    }

#if defined(CONFIG_ENABLE_4K2K_PANEL)
#if defined(CONFIG_INX_NOVA_VB1)
	run_command("inx_panel_set_init", 0);
#endif
#endif

#if(ENABLE_HDMI_TX == 1)
    if(run_command("hdmi init",0)!=0)
    {
        printf("Error : hdmi init fail!!\n");
        return -1;
    }

#endif

#if (CONFIG_ENABLE_RTPM)
	run_command ("runtime_pm" , 0);
#endif

#if defined(CONFIG_INX_VB1) && defined(CONFIG_BOOTLOGO_4K2K)
	run_command("panel_inx_vb1_init", 0);
#endif

    if(get_addr_from_mmap("E_DFB_FRAMEBUFFER", &u32GopBuffer)!=0)
    {
        UBOOT_ERROR("get E_DFB_FRAMEBUFFER_ADR mmap fail\n");
    }
    if(u32GopBuffer==0xFFFF)
    {
        UBOOT_ERROR("Get Mmap for GOP Failed !!! \n");
        return -1;
    }

    GFX_Block dstBlk = {0, 0, w, h};
    MsApiOsdCreate(&dstBlk,u32GopBuffer);
    return 0;
}