예제 #1
0
__s32 Hdmi_init(struct platform_device *dev)
{
	__audio_hdmi_func audio_func;
	__disp_hdmi_func disp_func;
	int err = 0;

	if (init_hdmi_obj()) {
		pr_warning("hdmi: init kobject failed\n");
		return -1;
	}

	run_sem = kmalloc(sizeof(struct semaphore), GFP_KERNEL | __GFP_ZERO);
	sema_init((struct semaphore *)run_sem, 0);

	hdmi_base = (void __iomem *) ghdmi.base_hdmi;
	hdmi_core_initial();
	err = hdmi_i2c_sunxi_probe(dev);
	if (err)
		return err;


	audio_info.channel_num = 2;
#if 0
	{ /* for audio test */
		hdmi_audio_t audio_para;

		audio_para.ch0_en = 1;
		audio_para.sample_rate = 44100;
		Hdmi_hal_set_audio_para(&audio_para);

		Hdmi_hal_audio_enable(0, 1);
	}
#endif


	/* Run main task once, should give EDID information directly */
	hdmi_main_task_loop();

	HDMI_task = kthread_create(Hdmi_run_thread, (void *)0, "hdmi proc");
	if (IS_ERR(HDMI_task)) {
		__s32 err = 0;

		__wrn("Unable to start kernel thread %s.\n", "hdmi proc");
		err = PTR_ERR(HDMI_task);
		HDMI_task = NULL;
		return err;
	}
	/* Launch main task loop */
	wake_up_process(HDMI_task);


	audio_func.hdmi_audio_enable = Hdmi_Audio_Enable;
	audio_func.hdmi_set_audio_para = Hdmi_Set_Audio_Para;
#if defined CONFIG_SND_SUNXI_SOC_HDMIAUDIO || \
    (defined CONFIG_SND_SUNXI_SOC_HDMIAUDIO_MODULE && \
     defined CONFIG_FB_SUNXI_HDMI_MODULE)
	audio_set_hdmi_func(&audio_func);
#endif

	disp_func.hdmi_wait_edid = hdmi_wait_edid;
	disp_func.Hdmi_open = Hdmi_open;
	disp_func.Hdmi_close = Hdmi_close;
	disp_func.hdmi_set_mode = Hdmi_set_display_mode;
	disp_func.hdmi_set_videomode = Hdmi_set_display_videomode;
	disp_func.hdmi_mode_support = Hdmi_mode_support;
	disp_func.hdmi_get_video_timing = hdmi_get_video_timing;
	disp_func.hdmi_get_HPD_status = Hdmi_get_HPD_status;
	disp_func.hdmi_set_pll = Hdmi_set_pll;
	disp_set_hdmi_func(&disp_func);

	return 0;
}
예제 #2
0
__s32 BSP_disp_capture_screen(__u32 sel, __disp_capture_screen_para_t * para)
{
    __scal_buf_addr_t in_addr;
    __scal_buf_addr_t out_addr;
    __scal_src_size_t in_size;
    __scal_out_size_t out_size;
    __scal_src_type_t in_type;
    __scal_out_type_t out_type;
    __scal_scan_mod_t in_scan;
    __scal_scan_mod_t out_scan;
    __u32 size = 0;
    __s32 scaler_idx = 0;
    __s32 ret = 0;

    if(para==NULL)
    {
        DE_WRN("input parameter can't be null!\n");
        return DIS_FAIL;
    }

    scaler_idx =  Scaler_Request(0xff);
    if(scaler_idx < 0)
    {
        DE_WRN("request scaler fail in BSP_disp_capture_screen\n");
        return DIS_FAIL;
    }
    else
    {
        gdisp.scaler[sel].screen_index = 0xff;
    }

    in_type.mod= Scaler_sw_para_to_reg(1,DISP_MOD_INTERLEAVED);
    in_type.fmt= Scaler_sw_para_to_reg(0,DISP_FORMAT_ARGB8888);
    in_type.ps= Scaler_sw_para_to_reg(2,DISP_SEQ_ARGB);
    in_type.byte_seq = 0;
    in_type.sample_method = 0;

    if(get_fb_type(para->output_fb.format) == DISP_FB_TYPE_YUV)
    {      
        if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR)
        {
            out_type.fmt = Scaler_sw_para_to_reg(3, para->output_fb.format);
        }
        else
        {	
            DE_WRN("output mode:%d invalid in Display_Scaler_Start\n",para->output_fb.mode);
            return DIS_FAIL;
        }
    }
    else
    {
        if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR && (para->output_fb.format == DISP_FORMAT_RGB888 || para->output_fb.format == DISP_FORMAT_ARGB8888))
        {
            out_type.fmt = DE_SCAL_OUTPRGB888;
        }
        else if(para->output_fb.mode == DISP_MOD_INTERLEAVED && para->output_fb.format == DISP_FORMAT_ARGB8888)
        {
            out_type.fmt = DE_SCAL_OUTI0RGB888;
        }
        else
        {
            DE_WRN("output para invalid in Display_Scaler_Start,mode:%d,format:%d\n",para->output_fb.mode, para->output_fb.format);
            return DIS_FAIL;
        }
        para->output_fb.br_swap= FALSE;
    }  
    out_type.byte_seq = Scaler_sw_para_to_reg(2,para->output_fb.seq);

    out_size.width     = para->output_fb.size.width;
    out_size.height = para->output_fb.size.height;

    if(BSP_disp_get_output_type(sel) != DISP_OUTPUT_TYPE_NONE)
    {
        in_size.src_width = BSP_disp_get_screen_width(sel);
        in_size.src_height = BSP_disp_get_screen_height(sel);
        in_size.x_off = 0;
        in_size.y_off = 0;
        in_size.scal_width= BSP_disp_get_screen_width(sel);
        in_size.scal_height= BSP_disp_get_screen_height(sel);
    }
    else
    {
        in_size.src_width = para->screen_size.width;
        in_size.src_height= para->screen_size.height;
        in_size.x_off = 0;
        in_size.y_off = 0;
        in_size.scal_width= para->screen_size.width;
        in_size.scal_height= para->screen_size.height;
    }

    in_scan.field = FALSE;
    in_scan.bottom = FALSE;

    out_scan.field = FALSE;	//when use scaler as writeback, won't be outinterlaced for any display device
    out_scan.bottom = FALSE;

    in_addr.ch0_addr = 0;
    in_addr.ch1_addr = 0;
    in_addr.ch2_addr = 0;

    out_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[0]));
    out_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[1]));
    out_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[2]));

    size = (para->output_fb.size.width * para->output_fb.size.height * de_format_to_bpp(para->output_fb.format) + 7)/8;
    OSAL_CacheRangeFlush((void *)para->output_fb.addr[0],size ,CACHE_FLUSH_D_CACHE_REGION);

    if(BSP_disp_get_output_type(sel) == DISP_OUTPUT_TYPE_NONE)
    {
        DE_SCAL_Input_Select(scaler_idx, 6 + sel);
        DE_BE_set_display_size(sel, para->screen_size.width, para->screen_size.height);
        DE_BE_Output_Select(sel, 6 + scaler_idx);
        image_clk_on(sel);
        Image_open(sel);
        DE_BE_Cfg_Ready(sel);
    }
    else
    {
        DE_SCAL_Input_Select(scaler_idx, 4 + sel);
        DE_BE_Output_Select(sel, 2 + (scaler_idx * 2) + sel);
    }
    DE_SCAL_Config_Src(scaler_idx,&in_addr,&in_size,&in_type,FALSE,FALSE);
    DE_SCAL_Set_Scaling_Factor(scaler_idx, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type);
    DE_SCAL_Set_Init_Phase(scaler_idx, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, FALSE);
    DE_SCAL_Set_CSC_Coef(scaler_idx, DISP_BT601, para->output_fb.cs_mode, DISP_FB_TYPE_RGB, get_fb_type(para->output_fb.format), 0, 0);
    DE_SCAL_Set_Scaling_Coef(scaler_idx, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, DISP_VIDEO_NATUAL);
    DE_SCAL_Set_Out_Format(scaler_idx, &out_type);
    DE_SCAL_Set_Out_Size(scaler_idx, &out_scan,&out_type, &out_size);
    DE_SCAL_Set_Writeback_Addr(scaler_idx,&out_addr);
    DE_SCAL_Output_Select(scaler_idx, 3);
    DE_SCAL_ClearINT(scaler_idx,DE_WB_END_IE);
    DE_SCAL_EnableINT(scaler_idx,DE_WB_END_IE);
    DE_SCAL_Set_Reg_Rdy(scaler_idx);
    DE_SCAL_Writeback_Enable(scaler_idx);
    DE_SCAL_Start(scaler_idx);   

    DE_INF("capture begin\n");
#ifndef __LINUX_OSAL__
    while(!(DE_SCAL_QueryINT(scaler_idx) & DE_WB_END_IE) )
    {
    }
#else
    {
        long timeout = (100 * HZ)/1000;//100ms

        init_waitqueue_head(&(gdisp.scaler[scaler_idx].scaler_queue));
        gdisp.scaler[scaler_idx].b_scaler_finished = 1;
        DE_SCAL_Writeback_Enable(scaler_idx);
        
        timeout = wait_event_interruptible_timeout(gdisp.scaler[scaler_idx].scaler_queue, gdisp.scaler[scaler_idx].b_scaler_finished == 2, timeout);
        gdisp.scaler[scaler_idx].b_scaler_finished = 0;
        if(timeout == 0)
        {
            __wrn("wait scaler %d finished timeout\n", scaler_idx);
            return -1;
        }
    }
#endif
    DE_SCAL_Reset(scaler_idx);
    Scaler_Release(scaler_idx, FALSE);
    if(BSP_disp_get_output_type(sel) == DISP_OUTPUT_TYPE_NONE)
    {
        Image_close(sel);
        image_clk_off(sel);
    }
    DE_BE_Output_Select(sel, sel);

    return ret;

}
예제 #3
0
__s32 BSP_disp_scaler_start(__u32 handle,__disp_scaler_para_t *para)
{
	__scal_buf_addr_t in_addr;
	__scal_buf_addr_t out_addr;
	__scal_src_size_t in_size;
	__scal_out_size_t out_size;
	__scal_src_type_t in_type;
	__scal_out_type_t out_type;
	__scal_scan_mod_t in_scan;
	__scal_scan_mod_t out_scan;
	__u32 size = 0;
	__u32 sel = 0;
	__s32 ret = 0;
	__u32 i = 0;
	__u32 ch_num = 0;

	if(para==NULL)
	{
		DE_WRN("input parameter can't be null!\n");
		return DIS_FAIL;
	}

	sel = SCALER_HANDTOID(handle);
	
	in_type.mod= Scaler_sw_para_to_reg(1,para->input_fb.mode);
	in_type.fmt= Scaler_sw_para_to_reg(0,para->input_fb.format);
	in_type.ps= Scaler_sw_para_to_reg(2,(__u8)para->input_fb.seq);
	in_type.byte_seq = 0;
	in_type.sample_method = 0;

	if(get_fb_type(para->output_fb.format) == DISP_FB_TYPE_YUV)
	{      
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR)
		{
			out_type.fmt = Scaler_sw_para_to_reg(3, para->output_fb.format);
		}
		else
		{	
			DE_WRN("output mode:%d invalid in Display_Scaler_Start\n",para->output_fb.mode);
			return DIS_FAIL;
		}
	}
	else
	{
		if(para->output_fb.mode == DISP_MOD_NON_MB_PLANAR && (para->output_fb.format == DISP_FORMAT_RGB888 || para->output_fb.format == DISP_FORMAT_ARGB8888))
		{
			out_type.fmt = DE_SCAL_OUTPRGB888;
		}
		else if(para->output_fb.mode == DISP_MOD_INTERLEAVED && para->output_fb.format == DISP_FORMAT_ARGB8888)
		{
			out_type.fmt = DE_SCAL_OUTI0RGB888;
		}
		else
		{
			DE_WRN("output para invalid in Display_Scaler_Start,mode:%d,format:%d\n",para->output_fb.mode, para->output_fb.format);
			return DIS_FAIL;
		}
	}  
    out_type.byte_seq = Scaler_sw_para_to_reg(2,para->output_fb.seq);

    out_size.width     = para->output_fb.size.width;
    out_size.height = para->output_fb.size.height;

    in_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[0]));
    in_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[1]));
    in_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->input_fb.addr[2]));

    in_size.src_width = para->input_fb.size.width;
    in_size.src_height = para->input_fb.size.height;
    in_size.x_off = para->source_regn.x;
    in_size.y_off = para->source_regn.y;
    in_size.scal_width= para->source_regn.width;
    in_size.scal_height= para->source_regn.height;

    in_scan.field = FALSE;
    in_scan.bottom = FALSE;

    out_scan.field = FALSE;	//when use scaler as writeback, won't be outinterlaced for any display device
    out_scan.bottom = FALSE;

    out_addr.ch0_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[0]));
    out_addr.ch1_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[1]));
    out_addr.ch2_addr = (__u32)OSAL_VAtoPA((void*)(para->output_fb.addr[2]));

    size = (para->input_fb.size.width * para->input_fb.size.height * de_format_to_bpp(para->input_fb.format) + 7)/8;
    OSAL_CacheRangeFlush((void *)para->input_fb.addr[0],size ,CACHE_CLEAN_FLUSH_D_CACHE_REGION);

    size = (para->output_fb.size.width * para->output_fb.size.height * de_format_to_bpp(para->output_fb.format) + 7)/8;
    OSAL_CacheRangeFlush((void *)para->output_fb.addr[0],size ,CACHE_FLUSH_D_CACHE_REGION);
    if(para->input_fb.b_trd_src)
    {
        __scal_3d_inmode_t inmode;
        __scal_3d_outmode_t outmode = 0;
        __scal_buf_addr_t scal_addr_right;

        inmode = Scaler_3d_sw_para_to_reg(0, para->input_fb.trd_mode, FALSE);
        outmode = Scaler_3d_sw_para_to_reg(1, para->output_fb.trd_mode, FALSE);
        
        DE_SCAL_Get_3D_In_Single_Size(inmode, &in_size, &in_size);
        if(para->output_fb.b_trd_src)
        {
            DE_SCAL_Get_3D_Out_Single_Size(outmode, &out_size, &out_size);
        }
        
    	scal_addr_right.ch0_addr= (__u32)OSAL_VAtoPA((void*)(para->input_fb.trd_right_addr[0]));
    	scal_addr_right.ch1_addr= (__u32)OSAL_VAtoPA((void*)(para->input_fb.trd_right_addr[1]));
    	scal_addr_right.ch2_addr= (__u32)OSAL_VAtoPA((void*)(para->input_fb.trd_right_addr[2]));

        DE_SCAL_Set_3D_Ctrl(sel, para->output_fb.b_trd_src, inmode, outmode);
        DE_SCAL_Config_3D_Src(sel, &in_addr, &in_size, &in_type, inmode, &scal_addr_right);
    }
    else
    {
        DE_SCAL_Config_Src(sel,&in_addr,&in_size,&in_type,FALSE,FALSE);
    }
    DE_SCAL_Set_Scaling_Factor(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type);
    DE_SCAL_Set_Init_Phase(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, FALSE);
    DE_SCAL_Set_CSC_Coef(sel, para->input_fb.cs_mode, para->output_fb.cs_mode, get_fb_type(para->input_fb.format), get_fb_type(para->output_fb.format),  para->input_fb.br_swap, para->output_fb.br_swap);
    DE_SCAL_Set_Scaling_Coef(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, DISP_VIDEO_NATUAL);
    DE_SCAL_Set_Out_Format(sel, &out_type);
    DE_SCAL_Set_Out_Size(sel, &out_scan,&out_type, &out_size);

    if(para->output_fb.mode == DISP_MOD_INTERLEAVED)
    {
        ch_num = 1;
    }
    else if(para->output_fb.mode == DISP_MOD_MB_UV_COMBINED || para->output_fb.mode == DISP_MOD_NON_MB_UV_COMBINED)
    {
        ch_num = 2;
    }
    else if(para->output_fb.mode == DISP_MOD_MB_PLANAR|| para->output_fb.mode == DISP_MOD_NON_MB_PLANAR)
    {
        ch_num = 3;
    }
    
	for(i=0; i<ch_num; i++)
	{
	    __scal_buf_addr_t addr;
	    ret = 0;
	    
	    addr.ch0_addr = out_addr.ch0_addr;
	    if(i == 1)
	    {
	        addr.ch0_addr = out_addr.ch1_addr;
	    }
	    else if(i == 2)
	    {
	        addr.ch0_addr = out_addr.ch2_addr;
	    }
        DE_SCAL_Enable(sel);

    	DE_SCAL_Set_Writeback_Addr(sel,&addr);
    	DE_SCAL_Set_Writeback_Chnl(sel, i);
        DE_SCAL_Output_Select(sel, 3);
    	DE_SCAL_EnableINT(sel,DE_WB_END_IE);
    	DE_SCAL_Start(sel);   
    	DE_SCAL_Set_Reg_Rdy(sel);

#ifndef __LINUX_OSAL__
        DE_SCAL_Writeback_Enable(sel);
        while(!(DE_SCAL_QueryINT(sel) & DE_WB_END_IE) )
        {
        }
#else
        {
            long timeout = (100 * HZ)/1000;//100ms

            init_waitqueue_head(&(gdisp.scaler[sel].scaler_queue));
            gdisp.scaler[sel].b_scaler_finished = 1;
            DE_SCAL_Writeback_Enable(sel);
            
            timeout = wait_event_interruptible_timeout(gdisp.scaler[sel].scaler_queue, gdisp.scaler[sel].b_scaler_finished == 2, timeout);
            gdisp.scaler[sel].b_scaler_finished = 0;
            if(timeout == 0)
            {
                __wrn("wait scaler %d finished timeout\n", sel);
                DE_SCAL_Writeback_Disable(sel);
                DE_SCAL_Reset(sel);
                DE_SCAL_Disable(sel);
                
                return -1;
            }
        }
#endif
        DE_SCAL_Writeback_Disable(sel);
        DE_SCAL_Reset(sel);
        DE_SCAL_Disable(sel);
	}

    return ret;
}
예제 #4
0
__s32 var_to_disp_fb(__disp_fb_t *fb, struct fb_var_screeninfo *var, struct fb_fix_screeninfo * fix)//todo
{    
    if(var->nonstd == 0)//argb
    {
		var->reserved[0] = DISP_MOD_INTERLEAVED;
		var->reserved[1] = DISP_FORMAT_ARGB8888;
		var->reserved[2] = DISP_SEQ_ARGB;
		var->reserved[3] = 0;

		switch (var->bits_per_pixel) 
		{
		case 1:
		    var->red.offset = var->green.offset = var->blue.offset	= 0;
			var->red.length	= var->green.length = var->blue.length	= 1;
			var->reserved[1] = DISP_FORMAT_1BPP;
			break;

		case 2:
		    var->red.offset = var->green.offset = var->blue.offset	= 0;
			var->red.length	= var->green.length = var->blue.length	= 2;
			var->reserved[1] = DISP_FORMAT_2BPP;
			break;

		case 4:
		    var->red.offset = var->green.offset = var->blue.offset	= 0;
			var->red.length	= var->green.length = var->blue.length	= 4;
			var->reserved[1] = DISP_FORMAT_4BPP;
			break;
			
		case 8:
		    var->red.offset = var->green.offset = var->blue.offset	= 0;
			var->red.length	= var->green.length = var->blue.length	= 8;
			var->reserved[1] = DISP_FORMAT_8BPP;
			break;
						
		case 16:
			if(var->red.length==6 && var->green.length==5 && var->blue.length==5)
			{
			    var->reserved[1] = DISP_FORMAT_RGB655;
			    if(var->red.offset == 10 && var->green.offset == 5 && var->blue.offset == 0)//rgb
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			    else if(var->blue.offset == 11 && var->green.offset == 6 && var->red.offset == 0)//bgr
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 1;
			    }
			    else
			    {
			        __wrn("invalid RGB655 format<red.offset:%d,green.offset:%d,blue.offset:%d>\n",var->red.offset,var->green.offset,var->blue.offset);
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
				
			}
			else if(var->red.length==5 && var->green.length==6 && var->blue.length==5)
			{
				var->reserved[1] = DISP_FORMAT_RGB565;
				if(var->red.offset == 11 && var->green.offset == 5 && var->blue.offset == 0)//rgb
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			    else if(var->blue.offset == 11 && var->green.offset == 5 && var->red.offset == 0)//bgr
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 1;
			    }
			    else
			    {
			        __wrn("invalid RGB565 format<red.offset:%d,green.offset:%d,blue.offset:%d>\n",var->red.offset,var->green.offset,var->blue.offset);
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			}
			else if(var->red.length==5 && var->green.length==5 && var->blue.length==6)
			{
				var->reserved[1] = DISP_FORMAT_RGB556;
				if(var->red.offset == 11 && var->green.offset == 6 && var->blue.offset == 0)//rgb
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			    else if(var->blue.offset == 10 && var->green.offset == 5 && var->red.offset == 0)//bgr
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 1;
			    }
			    else
			    {
			        __wrn("invalid RGB556 format<red.offset:%d,green.offset:%d,blue.offset:%d>\n",var->red.offset,var->green.offset,var->blue.offset);
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			}
			else if(var->transp.length==1 && var->red.length==5 && var->green.length==5 && var->blue.length==5)
			{
				var->reserved[1] = DISP_FORMAT_ARGB1555;
				if(var->transp.offset == 15 && var->red.offset == 10 && var->green.offset == 5 && var->blue.offset == 0)//argb
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			    else if(var->transp.offset == 15 && var->blue.offset == 10 && var->green.offset == 5 && var->red.offset == 0)//abgr
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 1;
			    }
			    else
			    {
			        __wrn("invalid ARGB1555 format<transp.offset:%d,red.offset:%d,green.offset:%d,blue.offset:%d>\n",var->transp.offset,var->red.offset,var->green.offset,var->blue.offset);
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			}
			else if(var->transp.length==4 && var->red.length==4 && var->green.length==4 && var->blue.length==4)
			{
				var->reserved[1] = DISP_FORMAT_ARGB4444;
				if(var->transp.offset == 12 && var->red.offset == 8 && var->green.offset == 4 && var->blue.offset == 0)//argb
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			    else if(var->transp.offset == 12 && var->blue.offset == 8 && var->green.offset == 4 && var->red.offset == 0)//abgr
			    {
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 1;
			    }
			    else
			    {
			        __wrn("invalid ARGB4444 format<transp.offset:%d,red.offset:%d,green.offset:%d,blue.offset:%d>\n",var->transp.offset,var->red.offset,var->green.offset,var->blue.offset);
			        var->reserved[2] = DISP_SEQ_ARGB;
			        var->reserved[3] = 0;
			    }
			}
			else
			{
			    __wrn("invalid bits_per_pixel :%d\n", var->bits_per_pixel);
				return -EINVAL;
			}
			break;
			
		case 24:
			var->red.length		= 8;
			var->green.length	= 8;
			var->blue.length	= 8;
			var->reserved[1] = DISP_FORMAT_RGB888;
			if(var->red.offset == 16 && var->green.offset == 8 && var->blue.offset == 0)//rgb
		    {
		        var->reserved[2] = DISP_SEQ_ARGB;
		        var->reserved[3] = 0;
		    }
		    else if(var->blue.offset == 16 && var->green.offset == 8&& var->red.offset == 0)//bgr
		    {
		        var->reserved[2] = DISP_SEQ_ARGB;
		        var->reserved[3] = 1;
		    }
		    else
		    {
		        __wrn("invalid RGB888 format<red.offset:%d,green.offset:%d,blue.offset:%d>\n",var->red.offset,var->green.offset,var->blue.offset);
		        var->reserved[2] = DISP_SEQ_ARGB;
		        var->reserved[3] = 0;
		    }
			break;
			
		case 32:
			var->transp.length  = 8;
			var->red.length		= 8;
			var->green.length	= 8;
			var->blue.length	= 8;
			var->reserved[1] = DISP_FORMAT_ARGB8888;

			if(var->red.offset == 16 && var->green.offset == 8 && var->blue.offset == 0)//argb
			{
			    var->reserved[2] = DISP_SEQ_ARGB;
			    var->reserved[3] = 0;
 			}
			else if(var->blue.offset == 24 && var->green.offset == 16 && var->red.offset == 8)//bgra
			{
			    var->reserved[2] = DISP_SEQ_BGRA;
			    var->reserved[3] = 0;
			}
			else if(var->blue.offset == 16 && var->green.offset == 8 && var->red.offset == 0)//abgr
			{
			    var->reserved[2] = DISP_SEQ_ARGB;
			    var->reserved[3] = 1;
			}
			else if(var->red.offset == 24 && var->green.offset == 16 && var->blue.offset == 8)//rgba
			{
			    var->reserved[2] = DISP_SEQ_BGRA;
			    var->reserved[3] = 1;
			}
			else
			{
			    __wrn("invalid argb format<transp.offset:%d,red.offset:%d,green.offset:%d,blue.offset:%d>\n",var->transp.offset,var->red.offset,var->green.offset,var->blue.offset);
			    var->reserved[2] = DISP_SEQ_ARGB;
			    var->reserved[3] = 0;
			}
			break;
			
		default:
		    __wrn("invalid bits_per_pixel :%d\n", var->bits_per_pixel);
			return -EINVAL;
		}
	}

    fb->mode = var->reserved[0];
    fb->format = var->reserved[1];
    fb->seq = var->reserved[2];
    fb->br_swap = var->reserved[3];
    fb->size.width = var->xres_virtual;
    
    fix->line_length = (var->xres_virtual * var->bits_per_pixel) / 8;
	
	return 0;
}
예제 #5
0
파일: smenulist.c 프로젝트: silview/C100A
//==================================================================
//function name:    SIconList_DelItem
//author:           
//date:             2008-12-13
//description:      iconlist delitem 
//parameters:       
//return:           if success return DIS_SUCCESS
//                  if fail return the number of fail
//modify history: 
//==================================================================
//------------------------------------------------------------------------------------------------------------
__u32	 SIconList_DelItem(__icons_iconlist_t *iconlist , __icons_iconitem_t * iconitem)
{
    __icons_iconitem_t *item;
    __icons_iconitem_t *Cur_Item;
    __icons_iconitem_t *pitem;
    __icons_iconitem_t *nitem;
    //void *base;

    if(!iconlist)
    {
        return __LINE__;
    }

    if(!iconitem)
    {
        return OK;
    }

    if(iconlist->ItemCount == 1)
    {
    	if(iconlist->head == iconitem)
    	{
    		iconlist->head = NULL;
			iconlist->tail = NULL;
			iconlist->ItemCount--;

			return SIconItem_Destroy(iconitem); 
    	}
		else
		{
			__wrn("iconitem not in iconlist!\n");
			return __LINE__;
		}
    }
	
	if(iconlist->tail == iconitem)
    {
        iconlist->tail                  = iconitem->Prev;
        iconlist->tail->Next            = iconlist->head;
        iconlist->head->Prev            = iconlist->tail;
        iconlist->ItemCount--;   

		return SIconItem_Destroy(iconitem);
    }

    item                                = iconlist->head;
    while(item != iconlist->tail)
    {
        if(item == iconitem)
        {
            Cur_Item                    = iconitem->Next;
            for(;Cur_Item != iconlist->head;)
            {     
                Cur_Item->itemno        = Cur_Item->itemno - 1;
                Cur_Item                = Cur_Item->Next;
            }
            if(item == iconlist->head)
            {
                iconlist->head          = iconitem->Next;
                iconlist->head->Prev    = iconlist->tail;
                iconlist->tail->Next    = iconlist->head;
                iconlist->ItemCount--;
            }
            else
            {
                pitem                   = iconitem->Prev;
                nitem                   = iconitem->Next;
                pitem->Next            	= nitem;
                nitem->Prev             = pitem;
                iconlist->ItemCount--;
            }

			break;
        }

        item                            = item->Next;
    }

    
    return SIconItem_Destroy(iconitem);
}
예제 #6
0
__s32 get_audio_info(__s32 sample_rate)
{
   //ACR_N 32000 44100 48000 88200 96000 176400 192000
   //		4096  6272  6144  12544 12288  25088  24576

   __inf("sample_rate:%d in get_audio_info\n", sample_rate);

   switch(sample_rate)
    {
    	case 32000 :{audio_info.ACR_N = 4096 ;
    				 audio_info.CH_STATUS0 = (3 <<24);
    				 audio_info.CH_STATUS1 = 0x0000000b;
    				 break;}
    	case 44100 :{audio_info.ACR_N = 6272 ;
    				 audio_info.CH_STATUS0 = (0 <<24);
    				 audio_info.CH_STATUS1 = 0x0000000b;
    				 break;}
    	case 48000 :{audio_info.ACR_N = 6144 ;
    				 audio_info.CH_STATUS0 = (2 <<24);
    				 audio_info.CH_STATUS1 = 0x0000000b;
    				 break;}
    	case 88200 :{audio_info.ACR_N = 12544;
    				audio_info.CH_STATUS0 = (8 <<24);
    				audio_info.CH_STATUS1 = 0x0000000b;
    				break;}
    	case 96000 :{audio_info.ACR_N = 12288;
    				 audio_info.CH_STATUS0 = (10<<24);
    				 audio_info.CH_STATUS1 = 0x0000000b;
    				 break;}
    	case 176400:{audio_info.ACR_N = 25088;
    				 audio_info.CH_STATUS0 = (12<<24);
    				 audio_info.CH_STATUS1 = 0x0000000b;
    				 break;}
    	case 192000:{audio_info.ACR_N = 24576;
    				 audio_info.CH_STATUS0 = (14<<24);
    				 audio_info.CH_STATUS1 = 0x0000000b;
    				 break;}
    	default:	{__wrn("un-support sample_rate,value=%d\n",sample_rate);
    	             return -1;  }
    }

   if( (video_mode == HDMI1440_480I) || (video_mode == HDMI1440_576I) ||
       (video_mode == HDMI480P)      || (video_mode == HDMI576P)       )
   {
   		 audio_info.CTS =   ((27000000/100) *(audio_info.ACR_N /128)) / (sample_rate/100);
   }
   else if( (video_mode == HDMI720P_50 ) || (video_mode == HDMI720P_60 ) ||
            (video_mode == HDMI1080I_50) || (video_mode == HDMI1080I_60) || (video_mode == HDMI1080P_24) )
   {
   		 audio_info.CTS =   ((74250000/100) *(audio_info.ACR_N /128)) / (sample_rate/100);
   }
   else if( (video_mode == HDMI1080P_50)       || (video_mode == HDMI1080P_60)       ||
            (video_mode == HDMI1080P_24_3D_FP) || (video_mode == HDMI720P_50_3D_FP) ||
            (video_mode == HDMI720P_60_3D_FP) )
   {
   		 audio_info.CTS =   ((148500000/100) *(audio_info.ACR_N /128)) / (sample_rate/100);
   }
   else
   {
   		 __wrn("unkonwn video format when configure audio\n");
   		 return -1;
   }

   __inf("audio CTS calc:%d\n",audio_info.CTS);

   return 0;
}
예제 #7
0
__s32 hdmi_main_task_loop(void)
{
	static __u32 times = 0;

	HPD = main_Hpd_Check();
	if( !HPD )
	{
	    if((times++) >= 10)
	    {
	        times = 0;
	        __inf("unplug state\n");
	    }
                if(hdmi_state > HDMI_State_Wait_Hpd)
                {
                        __inf("plugout\n");
                }

		if(hdmi_state > HDMI_State_Idle)
		{
			hdmi_state = HDMI_State_Wait_Hpd;
		}
	}
	switch(hdmi_state)
    {
    	case HDMI_State_Idle:
    		 hdmi_state = 	HDMI_State_Wait_Hpd;
    		 return 0;

    	case HDMI_State_Wait_Hpd:
    		 if(HPD)
    		 {
    		 	hdmi_state = 	HDMI_State_EDID_Parse;
    		 	__inf("plugin\n");
    		 }else
    		 {
    		 	return 0;
    		 }

    	case HDMI_State_Rx_Sense:

    	case HDMI_State_EDID_Parse:
    	     HDMI_WUINT32(0x004,0x80000000);
    	     HDMI_WUINT32(0x208,(1<<31)+ (1<<30)+ (1<<29)+ (3<<27)+ (0<<26)+
	    		       (1<<25)+ (0<<24)+ (0<<23)+ (4<<20)+ (7<<17)+
	    		       (15<<12)+ (7<<8)+ (0x0f<<4)+(8<<0) );
         	HDMI_WUINT32(0x200,0xfe800000);   			//txen enable
        	HDMI_WUINT32(0x204,0x00D8C850);   			//ckss = 1

            HDMI_WUINT32(0x20c, 0 << 21);


    		 ParseEDID();
    		 HDMI_RUINT32(0x5f0);

    		 hdmi_state = HDMI_State_Wait_Video_config;

    	case HDMI_State_Wait_Video_config:
    	    if(video_enable)
    		 {
    		    hdmi_state = 	HDMI_State_Video_config;
    		 }else
    		 {
    		 	return 0;
    		 }

    	case HDMI_State_Video_config:
    		 video_config(video_mode);
    		 hdmi_state = 	HDMI_State_Audio_config;

    	case HDMI_State_Audio_config:
    		 audio_config();
    		 hdmi_state = 	HDMI_State_Playback;

    	case HDMI_State_Playback:
    		 return 0;

		default:
			 __wrn(" unkonwn hdmi state, set to idle\n");
			 hdmi_state = HDMI_State_Idle;
			 return 0;
    }
}
예제 #8
0
__s32 OSAL_GPIO_DevSetONEPIN_PULL_STATUS(u32 p_handler, __u32 set_pull_status, const char *gpio_name)
{
        __wrn("OSAL_GPIO_DevSetONEPIN_PULL_STATUS is NULL\n");
        return 0;
}
예제 #9
0
__hdle OSAL_GPIO_Request_Ex(char *main_name, const char *sub_name)
{
        __wrn("OSAL_GPIO_Request_Ex is NULL\n");
        return 0;
}
예제 #10
0
int de_fce_init(unsigned int sel, unsigned int chno, unsigned int reg_base)
{
    unsigned int base;
    void *memory;

    base = reg_base + (sel+1)*0x00100000 + FCE_OFST;	//FIXME  display path offset should be defined
    fce_hw_base[sel][chno] = base;

    __inf("sel %d, fce_base[%d]=0x%x\n", sel, chno, base);

    memory = disp_sys_malloc(sizeof(__fce_reg_t));
    if(NULL == memory) {
        __wrn("malloc fce[%d][%d] memory fail! size=0x%x\n", sel, chno, sizeof(__fce_reg_t));
        return -1;
    }

    fce_para_block[sel][chno].off			= base;
    fce_para_block[sel][chno].val			= memory;
    fce_para_block[sel][chno].size			= 0x34;
    fce_para_block[sel][chno].dirty 		= 0;

    fce_celut_block[sel][chno].off			= base + 0x100;
    fce_celut_block[sel][chno].val			= memory + 0x100;
    fce_celut_block[sel][chno].size		    = 0x100;
    fce_celut_block[sel][chno].dirty 		= 0;

    fce_hist_block[sel][chno].off			= base + 0x200;
    fce_hist_block[sel][chno].val			= memory + 0x200;
    fce_hist_block[sel][chno].size			= 0x400;
    fce_hist_block[sel][chno].dirty 		= 0;

    de_fce_set_reg_base(sel, chno, (unsigned int)memory);

    //hist
    g_hist_status[sel][chno] = disp_sys_malloc(sizeof(__hist_status_t));	//FIXME where to FREE?
    if(NULL == g_hist_status[sel][chno]) {
        __wrn("malloc g_hist_status[%d][%d] memory fail! size=0x%x\n", sel, chno, sizeof(__hist_status_t));
        return -1;
    }
    __inf("g_hist_status[%d][%d]=0x%x\n", sel, chno, (unsigned int)g_hist_status[sel][chno]);

    g_hist_status[sel][chno]->Runtime = 0;
    g_hist_status[sel][chno]->IsEnable = 0;
    g_hist_status[sel][chno]->TwoHistReady = 0;

    g_hist[sel][chno] = disp_sys_malloc(1024);		//FIXME where to FREE?
    if(NULL == g_hist[sel][chno]) {
        __wrn("malloc hist[%d][%d] memory fail! size=0x%x\n", sel, chno, 1024);
        return -1;
    }

    g_hist_p[sel][chno] = disp_sys_malloc(1024);	//FIXME where to FREE?
    if(NULL == g_hist_p[sel][chno]) {
        __wrn("malloc hist_p[%d][%d] memory fail! size=0x%x\n", sel, chno, 1024);
        return -1;
    }

    //ce
    g_ce_status[sel][chno] = disp_sys_malloc(sizeof(__ce_status_t));	//FIXME where to FREE?
    if(NULL == g_ce_status[sel][chno]) {
        __wrn("malloc g_ce_status[%d][%d] memory fail! size=0x%x\n", sel, chno, sizeof(__ce_status_t));
        return -1;
    }

    g_ce_status[sel][chno]->IsEnable = 0;

    g_celut[sel][chno] = disp_sys_malloc(256);	//FIXME where to FREE?
    if(NULL == g_celut[sel][chno]) {
        __wrn("malloc celut[%d][%d] memory fail! size=0x%x\n", sel, chno, 256);
        return -1;
    }

    return 0;
}
예제 #11
0
파일: msg_emit.c 프로젝트: silview/C100A
static __s32 key_msg_cb(void *msg)
{	
	__msrv_msg_t	*pmsg;
	__u8 error;
	
	__u32 i;
	__input_event_packet_t *pPacket;
    __input_event_t        *pEventFrame;				
	
    if (msg == NULL)
    {
        __msg("invalid argument for call back\n");
        return EPDK_FAIL;
    }

    __inf("1------------------------------------------------\n");
    
    //dump packet events
    pPacket = (__input_event_packet_t *)msg;
    if (pPacket->event_cnt > INPUT_MAX_EVENT_NR)
    {
        __msg("invalid event count number\n");
        return EPDK_FAIL;
    }
	__inf("2------------------------------------------------\n");
	for (i = 0; i < pPacket->event_cnt; i++)
	{
		pEventFrame = &(pPacket->events[i]);
		__msg("Event %d: type = %d, code = %d, value = %d\n", i + 1,
                                                                 pEventFrame->type,
                                                                 pEventFrame->code,
                                                                 pEventFrame->value
                                                                 );
		if(pEventFrame->type == EV_KEY) 
		{		   
			__msg("pEventFrame->type == EV_KEY\n");
            
			esKRNL_SemPend(emit_ctr.p_array_sem, 0, &error);
			pmsg = get_msg_buf(&emit_ctr);			
			esKRNL_SemPost(emit_ctr.p_array_sem);	
			
			
			switch(pEventFrame->code)
			{
				case KPAD_SCR_ONOFF:
				{			
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_SCR_ONOFF;
					break;
				}
				case KPAD_STORE_UP:
				{			
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_STORE_UP;
					break;
				}
				case KPAD_STORE_UP_PLAY:
				{			
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_STORE_UP_PLAY;
					break;
				}
				case KPAD_LR:
				{
                    __wrn("KPAD_LR\n");
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_LR; 
                    break;
				}
				case KPAD_MODE:
				{
                    __wrn("KPAD_MODE\n");
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_MODE; 
                    break;
				}
				case KPAD_MENU:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_MENU;
					__msg("GUI_MSG_KEY_MENU\n");
                   			 break;
				}
				case KPAD_UP:
			 	{
					pmsg->type 	= GUI_MSG_KEY;
			 		pmsg->id 	= GUI_MSG_KEY_UP;
					__msg("GUI_MSG_KEY_UP\n");
					break;
				}
				case KPAD_DOWN:
			 	{
					pmsg->type 	= GUI_MSG_KEY;
			 		pmsg->id 	= GUI_MSG_KEY_DOWN;
					__msg("GUI_MSG_KEY_DOWN\n");
					break;
				}
				case KPAD_LEFT:
			 	{
					pmsg->type 	= GUI_MSG_KEY;
			 		pmsg->id 	= GUI_MSG_KEY_LEFT;
					__msg("GUI_MSG_KEY_LEFT\n");
					break;
				}
				case KPAD_RIGHT:
			 	{
					pmsg->type 	= GUI_MSG_KEY;
			 		pmsg->id 	= GUI_MSG_KEY_RIGHT;
					__msg("GUI_MSG_KEY_RIGHT\n");
					break;
				}					
				case KPAD_VOICEUP:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_VADD;
					__msg("GUI_MSG_KEY_VADD\n");
					break;
				}
				case KPAD_VOICEDOWN:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_VDEC;
					__msg("GUI_MSG_KEY_VDEC\n");
					break;
				}
				case KPAD_ENTER:
			 	{
					pmsg->type 	= GUI_MSG_KEY;
			 		pmsg->id 	= GUI_MSG_KEY_ENTER;
					__msg("GUI_MSG_KEY_ENTER\n");
					break;
				}
				case KPAD_REPLACE_ENTER:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_ENTER;
					__msg("KPAD_REPLACE_ENTER\n");
					break;
				}
				case KPAD_RETURN:
			 	{
					pmsg->type 	= GUI_MSG_KEY;
			 		pmsg->id 	= GUI_MSG_KEY_ESCAPE;
					__msg("GUI_MSG_KEY_ESCAPE\n");
					break;
				}
				case KPAD_POWER:
				{			
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_POWER;
					__msg("GUI_MSG_KEY_POWER\n");
					break;
				}
				case KPAD_PHOTO:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_PHOTO;
					eLIBs_printf("GUI_MSG_KEY_PHOTO\n");
					break;
				}
				case KPAD_MUSIC:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_MUSIC;
					break;
				}
				case KPAD_MOVIE:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_MOVIE;
					break;
				}
				case KPAD_PAUSE:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_PAUSE;
					__msg("GUI_MSG_KEY_PAUSE\n");
					break;
				}
				case KPAD_SETTING:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_SETTING;
					break;
				}
				case KPAD_FM:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_FM;
					break;
				}
				case KPAD_LINEIN_PLUGIN:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_LINEIN_PLUGIN;
					break;
				}
				case KPAD_LINEIN_PLUGOUT:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_LINEIN_PLUGOUT;
					break;
				}
				case KPAD_CALENDAR:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_CALENDAR;
					break;
				}
				case KPAD_MEDIA_PRE:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_MEDIA_PRE;
					break;
				}
				case KPAD_RECORD:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_RECORD;
					break;
				}
				case KPAD_MEDIA_NEXT:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_MEDIA_NEXT;
					break;
				}
#ifdef SUPPORT_DIGIT_KEY
				case KPAD_NUM0:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM0;
					__msg("GUI_MSG_KEY_NUM0\n");
                   			 break;
				}
				case KPAD_NUM1:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM1;
					__msg("GUI_MSG_KEY_NUM1\n");
                   			 break;
				}
				case KPAD_NUM2:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM2;
					__msg("GUI_MSG_KEY_NUM2\n");
                   			 break;
				}
				case KPAD_NUM3:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM3;
					__msg("GUI_MSG_KEY_NUM3\n");
                   			 break;
				}
				case KPAD_NUM4:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM4;
					__msg("GUI_MSG_KEY_NUM4\n");
                   			 break;
				}
				case KPAD_NUM5:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM5;
					__msg("GUI_MSG_KEY_NUM5\n");
                   			 break;
				}
				case KPAD_NUM6:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM6;
					__msg("GUI_MSG_KEY_NUM6\n");
                   			 break;
				}
				case KPAD_NUM7:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM7;
					__msg("GUI_MSG_KEY_NUM7\n");
                   			 break;
				}
				case KPAD_NUM8:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM8;
					__msg("GUI_MSG_KEY_NUM8\n");
                   			 break;
				}
				case KPAD_NUM9:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM9;
					__msg("GUI_MSG_KEY_NUM9\n");
                   			 break;
				}
				case KPAD_NUM_CLR:
				{
					pmsg->type 	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_NUM_CLEAR;
					__msg("GUI_MSG_KEY_NUM_CLEAR\n");
                   			 break;
				}
#endif
				case KPAD_IR_LEFT:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_RIGHT;	//GUI_MSG_KEY_IR_LEFT;
					__msg("GUI_MSG_KEY_IR_LEFT\n");
					break;
				}
				case KPAD_IR_RIGHT:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_RIGHT;
					__msg("GUI_MSG_KEY_IR_RIGHT\n");
					break;
				}
				case KPAD_IR_UP:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_UP;
					__msg("GUI_MSG_KEY_IR_UP\n");
					break;
				}
				case KPAD_IR_DOWN:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_DOWN;
					__msg("GUI_MSG_KEY_IR_DOWN\n");
					break;
				}
				case KPAD_IR_VOICEDOWN:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id 	= GUI_MSG_KEY_IR_VDEC;
					break;
				}
				case KPAD_IR_VOICEUP:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_VADD;
					break;
				}
				case KPAD_MUTE:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_MUTE;
					break;
				}
				case KPAD_IR_POWER:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_POWER;
					break;
				}
				case KPAD_IR_TVOUT:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_TVOUT;
				__msg("GUI_MSG_KEY_IR_TVOUT\n");	
					break;
				}
				case KPAD_POWEROFF:
				{
					pmsg->type 	= DSK_MSG_POWER_OFF;
					__msg("GUI_MSG_KEY_POWER_OFF\n");
					break;
				}
				case KPAD_IR_KOK:
				{
					pmsg->type	= GUI_MSG_KEY;
					pmsg->id	= GUI_MSG_KEY_IR_KOK;
					break;					
				}
				default:
					break;
			}			
			pmsg->data 	= pEventFrame->value;
		__msg("czp is add......power_off_id = %d\n", DSK_MSG_POWER_OFF);
            __msg("GUI_MSG_KEY_ val=%d, pmsg->type=%d\n", pmsg->id, pmsg->type);

			esKRNL_QPost(emit_ctr.psys_msg_queue, pmsg);
		}		
	}	
	__inf("3------------------------------------------------\n");			
	
	return EPDK_TRUE;
}
예제 #12
0
파일: drv_display.c 프로젝트: silview/C100A
__s32 DRV_DISP_MInit(void)
{
    __disp_bsp_init_para para;
    __hdle hReg;
    __u32 i = 0;
     user_gpio_set_t  gpio_set[1];
	__s32            ret;
   
    para.base_image0    = 0xf1e60000;
    para.base_scaler0   = 0xf1e00000;
    para.base_lcdc0     = 0xf1c0c000;
    para.base_tvec      = 0xf1c0a000;
    para.base_ccmu      = 0xf1c20000;
    para.base_sdram     = 0xf1c01000;
    para.base_pioc      = 0xf1c20800;
    para.base_timer		= 0xf1c21000;	/*	PWM module register base	*/

    para.power_on       = DRV_lcd_power_on;
    para.power_off      = DRV_lcd_power_off;
    para.scaler_begin   		= DRV_scaler_begin;
    para.scaler_finish  		= DRV_scaler_finish;
    para.tve_interrup   		= DRV_tve_interrup;
	para.hdmi_set_mode  		= DRV_hdmi_set_mode;
	para.Hdmi_open  			= DRV_Hdmi_open;
	para.Hdmi_close  			= DRV_Hdmi_close;
	para.hdmi_mode_support		= DRV_hdmi_mode_support;
	para.hdmi_get_HPD_status	= DRV_hdmi_get_HPD_status;
	para.disp_int_process       = disp_int_process;

	eLIBs_memset(&g_disp_drv, 0, sizeof(__disp_drv_t));
    g_disp_drv.scaler_finished_sem[0] = esKRNL_SemCreate(0);
    if(!g_disp_drv.scaler_finished_sem[0])
    {
        __wrn("create scaler_finished_sem[0] fail!\n");
        return EPDK_FAIL;
    }  
    g_disp_drv.scaler_finished_sem[1] = esKRNL_SemCreate(0);
    if(!g_disp_drv.scaler_finished_sem[1])
    {
        __wrn("create scaler_finished_sem[1] fail!\n");
        return EPDK_FAIL;
    }    

    for(i = 0; i<MAX_EVENT_SEM; i++)
    {
    	g_disp_drv.event_sem[0][i] = NULL;
     	g_disp_drv.event_sem[1][i] = NULL;
    }

    BSP_disp_init(&para);
    BSP_disp_open();

	g_disp_drv.reg_operate_vaild = 1;
	
   	hReg = esDEV_DevReg("DISP", "DISPLAY", &dispdev_ops, 0);
    if(!hReg)
    {
        __inf("esDEV_DevReg() fail!\n");
    	return EPDK_FAIL;
    }

	#if DRV_VCOM_TIMER

	//Soft Vcom Control;

	ret = esCFG_GetKeyValue("softvcom_para", "soft_vcom_en", &vcom_en, 1);
	if (!ret)
	{
		eLIBs_printf(" -- %s, %d, vcom_en = %d -- \n", __FILE__, __LINE__, vcom_en);
	
		if(vcom_en)
		{
			ret = esCFG_GetKeyValue("softvcom_para", "vcom_io", (int *)gpio_set, sizeof(user_gpio_set_t)/4);
			if (!ret)
			{
				vcom_io = esPINS_PinGrpReq(gpio_set, 1);
				if (!vcom_io)
				{
					__wrn("request output_col pin failed\n");
					return EPDK_FAIL;
				}
			}
			else
			{
				__wrn("fetch para from script failed\n");
				return EPDK_FAIL;
			}
		}
	}
	else
	{
		__wrn("fetch para from script failed\n");
		return EPDK_FAIL;
	}

	ret = esPINS_SetPinPull(vcom_io, PIN_PULL_DOWN, NULL);
	if (ret)
	{
		__wrn("pull output_col failed\n");
		return EPDK_FAIL;
	}

    //申请定时器
	vcom_timer_init();

    //让定时器开始跑
	vcom_timer_start();
#endif	

    return EPDK_OK;        
}
예제 #13
0
//              0:ARGB    1:BRGA    2:ABGR    3:RGBA
//seq           ARGB        BRGA       ARGB       BRGA
//br_swqp    0              0            1              1
s32 parser_disp_init_para(disp_init_para * init_para)
{
	int  value;
	int  i;

	memset(init_para, 0, sizeof(disp_init_para));

	if(disp_sys_script_get_item("disp_init", "disp_init_enable", &value, 1) < 0) {
		__wrn("fetch script data disp_init.disp_init_enable fail\n");
		return -1;
	}
	init_para->b_init = value;

	if(disp_sys_script_get_item("disp_init", "disp_mode", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.disp_mode fail\n");
		return -1;
	}
	init_para->disp_mode= value;

	//screen0
	if(disp_sys_script_get_item("disp_init", "screen0_output_type", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.screen0_output_type fail\n");
		return -1;
	}
	if(value == 0) {
		init_para->output_type[0] = DISP_OUTPUT_TYPE_NONE;
	}	else if(value == 1) {
		init_para->output_type[0] = DISP_OUTPUT_TYPE_LCD;
	}	else if(value == 2)	{
		init_para->output_type[0] = DISP_OUTPUT_TYPE_TV;
	}	else if(value == 3)	{
		init_para->output_type[0] = DISP_OUTPUT_TYPE_HDMI;
	}	else if(value == 4)	{
		init_para->output_type[0] = DISP_OUTPUT_TYPE_VGA;
	}	else {
		__wrn("invalid screen0_output_type %d\n", init_para->output_type[0]);
		return -1;
	}

	if(disp_sys_script_get_item("disp_init", "screen0_output_mode", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.screen0_output_mode fail\n");
		return -1;
	}
	if(init_para->output_type[0] == DISP_OUTPUT_TYPE_TV || init_para->output_type[0] == DISP_OUTPUT_TYPE_HDMI
	    || init_para->output_type[0] == DISP_OUTPUT_TYPE_VGA) {
		init_para->output_mode[0]= value;
	}

	//screen1
	if(disp_sys_script_get_item("disp_init", "screen1_output_type", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.screen1_output_type fail\n");
		return -1;
	}
	if(value == 0) {
		init_para->output_type[1] = DISP_OUTPUT_TYPE_NONE;
	}	else if(value == 1)	{
		init_para->output_type[1] = DISP_OUTPUT_TYPE_LCD;
	}	else if(value == 2)	{
		init_para->output_type[1] = DISP_OUTPUT_TYPE_TV;
	}	else if(value == 3)	{
		init_para->output_type[1] = DISP_OUTPUT_TYPE_HDMI;
	}	else if(value == 4)	{
		init_para->output_type[1] = DISP_OUTPUT_TYPE_VGA;
	}	else {
		__wrn("invalid screen1_output_type %d\n", init_para->output_type[1]);
		return -1;
	}

	if(disp_sys_script_get_item("disp_init", "screen1_output_mode", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.screen1_output_mode fail\n");
		return -1;
	}
	if(init_para->output_type[1] == DISP_OUTPUT_TYPE_TV || init_para->output_type[1] == DISP_OUTPUT_TYPE_HDMI
	    || init_para->output_type[1] == DISP_OUTPUT_TYPE_VGA) {
		init_para->output_mode[1]= value;
	}

	//screen2
	if(disp_sys_script_get_item("disp_init", "screen2_output_type", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.screen2_output_type fail\n");
	}
	if(value == 0) {
		init_para->output_type[2] = DISP_OUTPUT_TYPE_NONE;
	}	else if(value == 1) {
		init_para->output_type[2] = DISP_OUTPUT_TYPE_LCD;
	}	else if(value == 2)	{
		init_para->output_type[2] = DISP_OUTPUT_TYPE_TV;
	}	else if(value == 3)	{
		init_para->output_type[2] = DISP_OUTPUT_TYPE_HDMI;
	}	else if(value == 4)	{
		init_para->output_type[2] = DISP_OUTPUT_TYPE_VGA;
	}	else {
		__wrn("invalid screen0_output_type %d\n", init_para->output_type[2]);
	}

	if(disp_sys_script_get_item("disp_init", "screen2_output_mode", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.screen2_output_mode fail\n");
	}
	if(init_para->output_type[2] == DISP_OUTPUT_TYPE_TV || init_para->output_type[2] == DISP_OUTPUT_TYPE_HDMI
	    || init_para->output_type[2] == DISP_OUTPUT_TYPE_VGA) {
		init_para->output_mode[2]= value;
	}

	//fb0
	init_para->buffer_num[0]= 2;

	if(disp_sys_script_get_item("disp_init", "fb0_format", &value, 1) < 0) {
		__wrn("fetch script data disp_init.fb0_format fail\n");
		return -1;
	}
	init_para->format[0]= value;

	if(disp_sys_script_get_item("disp_init", "fb0_width", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.fb0_width fail\n");
		return -1;
	}
	init_para->fb_width[0]= value;

	if(disp_sys_script_get_item("disp_init", "fb0_height", &value, 1) < 0)	{
		__wrn("fetch script data disp_init.fb0_height fail\n");
		return -1;
	}
	init_para->fb_height[0]= value;

	//fb1
	init_para->buffer_num[1]= 2;

	if(disp_sys_script_get_item("disp_init", "fb1_format", &value, 1) < 0) {
		__wrn("fetch script data disp_init.fb1_format fail\n");
	}
	init_para->format[1]= value;

	if(disp_sys_script_get_item("disp_init", "fb1_width", &value, 1) < 0) {
		__wrn("fetch script data disp_init.fb1_width fail\n");
	}
	init_para->fb_width[1]= value;

	if(disp_sys_script_get_item("disp_init", "fb1_height", &value, 1) < 0) {
		__wrn("fetch script data disp_init.fb1_height fail\n");
	}
	init_para->fb_height[1]= value;

	//fb2
	init_para->buffer_num[2]= 2;

	if(disp_sys_script_get_item("disp_init", "fb2_format", &value, 1) < 0) {
		__wrn("fetch script data disp_init.fb2_format fail\n");
	}
	init_para->format[2]= value;

	if(disp_sys_script_get_item("disp_init", "fb2_width", &value, 1) < 0) {
		__wrn("fetch script data disp_init.fb2_width fail\n");
	}
	init_para->fb_width[2]= value;

	if(disp_sys_script_get_item("disp_init", "fb2_height", &value, 1) < 0) {
		__wrn("fetch script data disp_init.fb2_height fail\n");
	}
	init_para->fb_height[2]= value;

	__inf("====display init para begin====\n");
	__inf("b_init:%d\n", init_para->b_init);
	__inf("disp_mode:%d\n\n", init_para->disp_mode);
	for(i=0; i<3; i++) {
		__inf("output_type[%d]:%d\n", i, init_para->output_type[i]);
		__inf("output_mode[%d]:%d\n", i, init_para->output_mode[i]);
	}
	for(i=0; i<3; i++) {
		__inf("buffer_num[%d]:%d\n", i, init_para->buffer_num[i]);
		__inf("format[%d]:%d\n", i, init_para->format[i]);
		__inf("fb_width[%d]:%d\n", i, init_para->fb_width[i]);
		__inf("fb_height[%d]:%d\n", i, init_para->fb_height[i]);
	}
	__inf("====display init para end====\n");

	return 0;
}
예제 #14
0
파일: dev_power.c 프로젝트: silview/C100A
/*
****************************************************************************************************
*
*             DEV_KEY_Ioctrl
*
*  Description:
*       DRV_irkey_MIoctrl
*
*  Parameters:
*
*  Return value:
*       EPDK_OK
*       EPDK_FAIL
****************************************************************************************************
*/
__s32 DEV_PowerIoctrl(__hdle hPower, __u32 cmd, __s32 aux, void *pbuffer)
{
    __s32 ret = EPDK_OK;
    switch(cmd)
    {
        case DRV_POWER_CMD_READ_REG:
        {
            __inf("drvpower DRV_POWER_CMD_READ_REG start\n");
            ret = 0xff;
            break;
        }

        case DRV_POWER_CMD_WRITE_REG:
        {
            __inf("drvpower DRV_POWER_CMD_WRITE_REG start\n");

            break;
        }

        case DRV_POWER_CMD_POWER_ON:
        {
            break;
        }
        
        case DRV_POWER_CMD_POWER_OFF:
        {
            __s32           cpu_sr;
            volatile __u32 *tmpAddr;
            __u32           tmpData;
            
            __wrn("power off enter....\n");
			__close_lcd();	
            if (hPowerOn)
			{
				esPINS_WritePinData(hPowerOn, 0, NULL);
			}
			
            //正常状况下,系统已关机,下面的代码是不会执行到,
            //为了防止插USB或充电器时无法关机的问题,
            //直接将CPU挂死在死循环内.
            
            //关掉watch-dog,防止系统复位
            tmpAddr = TMRC_WACHDOG_CTL_ADDR;
            tmpData = *tmpAddr;
            tmpData &= ~(1 << TMRC_WATCH_DOG_EN_BIT);
            *tmpAddr = tmpData;
            
            //关掉中断
            //ENTER_CRITICAL(cpu_sr);//中断不关,否则定时器不起作用
            
            //防止编译器warning
            //cpu_sr = cpu_sr;
            
            //死循环,挂死CPU
            __wrn("power no use, cpu dumping\n");

            DEV_PowerOnProcess();
            
            while (1)
            {                
                ;
            }
            //unreached
            //break;
        }

        case DRV_POWER_CMD_INT_ENABLE:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_INT_DISABLE:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_INT_QUERY:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_INT_CLEAR:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_VOUT_GET:
        {
            __inf("drvpower DRV_POWER_CMD_VOUT_GET start\n");

            if(aux == POWER_VOL_LDO1)
            {
                if(ldo1set)
                {
                    ret = Vldo1_set;
                }
                else
                {
                    ret = Vldo1_set;
                }
            }
            else if((aux == POWER_VOL_DCDC1) || (aux == POWER_VOL_DCDC2))
            {
                if(aux == POWER_VOL_DCDC1)
                {
                    ret = Vdcdc1_set;
                }
                else
                {
                    if(dc2set)
                    {
                        __inf("drvpower DRV_POWER_CMD_VOUT_GET dc2set\n");
                        ret =  Vdcdc2_set;
                    }
                    else
                    {
                        ret = Vdcdc2_set;
                    }
                }
            }
            else if((aux == POWER_VOL_LDO2) || (aux == POWER_VOL_LDO3) || (aux == POWER_VOL_DCDC3))
            {
                if(aux == POWER_VOL_LDO2)
                {
                    ret = Vldo2_set;
                }
                else if(aux == POWER_VOL_DCDC3)
                {
                    ret = Vdcdc3_set;
                }
                else
                {
                    ret = Vldo3_set ;
                }
            }
            else if(aux == POWER_VOL_LDO4)
            {
                if(aux == POWER_VOL_LDO4)
                {
                    ret = Vldo4_set ;
                }
                else
                {
                    ret = Vldo5_set ;
                }
            }
            __inf("drvpower DRV_POWER_CMD_VOUT_GET dc2 return %d\n",ret);

            break;
        }

        case DRV_POWER_CMD_VOUT_SET:
        {
            __u32       tmp;

            tmp = (__u32)pbuffer;
            if((aux == POWER_VOL_DCDC1) || (aux == POWER_VOL_DCDC2))
            {
                if(aux == POWER_VOL_DCDC1)
                {
                    Vdcdc1_set = tmp;
                }
                else
                {
                    Vdcdc2_set = tmp;
                }
            }
            else if(aux == POWER_VOL_LDO1)
            {
                __wrn("LDO1 Voltage  cant be set!\n");
                Vldo1_set = tmp;
            }
            else if((aux == POWER_VOL_LDO2) || (aux == POWER_VOL_LDO3) || (aux ==POWER_VOL_DCDC3))
            {
                if(aux == POWER_VOL_DCDC3)
                {
                    Vdcdc3_set = tmp;
                }
                else if(aux == POWER_VOL_LDO2)
                {
                    Vldo2_set = tmp;
                }
                else
                {
                    Vldo3_set = tmp;
                }
            }
            else if(aux == POWER_VOL_LDO4)
            {
                if(aux == POWER_VOL_LDO4)
                {
                    Vldo4_set = tmp;
                }
                else
                {
                    Vldo5_set = tmp;
                }
            }
            ret = EPDK_OK;

            break;
        }
        case DRV_POWER_CMD_VSTS_GET:
        {
            break;
        }

        case DRV_POWER_CMD_VSTS_SET:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_PWREPT_GET:
        {
            break;
        }
        case DRV_POWER_CMD_PWREPT_SET:
        {
            break;
        }

        case DRV_POWER_CMD_BATADC_GET:
        {
            __drv_power_battery_status_t1   *bat_sts = (__drv_power_battery_status_t1 *)pbuffer;

            bat_sts->bat_vol = 2500;
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_BATADC_SET:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_GET_BAT_RDC:
        {
            ret = 500;
            break;
        }

        case DRV_POWER_CMD_BATSTATUS_TABLE_GET:
        {
            __drv_power_battery_status_t2  *bat_sts = (__drv_power_battery_status_t2 *)pbuffer;

            bat_sts->battery_exist = 0x0;
            bat_sts->dcin_valid = 0x01;
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_DCINADC_GET:
        {
            __drv_power_dcin_status_t   *dcin_sts = (__drv_power_dcin_status_t *)pbuffer;

            dcin_sts->dcin_exist = 0x01;
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_DCINADC_SET:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_CHARGE_GET:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_CHARGE_SET:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_BASIC_STATUS:
        {
            __drv_power_basic_status_t  *pbasic = (__drv_power_basic_status_t *)pbuffer;

            pbasic->bat_exist   = 0;
            pbasic->bat_charge_status =0;
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_IPS_GET:
        {
            ret = EPDK_OK;
            break;
        }

        case DRV_POWER_CMD_IPS_SET:
        {
            ret = EPDK_OK;
            break;
        }
        case DRV_POWER_CMD_GET_DCIN:
        {
            __drv_power_battery_status_t3 *pstatus = (__drv_power_battery_status_t3 *)pbuffer;
			if (hChargeStatus)
			{
			//__msg(".......111111..........pstatus->charge_status=%d......\n",pstatus->charge_status);
				pstatus->charge_status = esPINS_ReadPinData(hChargeStatus, NULL);
			//	__msg(".......222..........pstatus->charge_status=%d......\n",pstatus->charge_status);
			//	__inf("charge status is %d\n", pstatus->charge_status);
				return EPDK_OK;
			}
			else
			{
				//__msg("charge status pin is null failed\n");
	            pstatus->charge_status = 0x0;
				__msg(".......3333333..........pstatus->charge_status=%d......\n",pstatus->charge_status);
				return EPDK_FAIL;
			}
        }
        case DRV_POWER_CMD_GET_FUELGUAGE:
        {
            __drv_power_fuelguage_t *pbat = (__drv_power_fuelguage_t *)pbuffer;
            eLIBs_memcpy(pbat, &fuelguage, sizeof(__drv_power_fuelguage_t));
           // __wrn("pbat->rest_vol=%d\n", pbat->rest_vol);
            ret = EPDK_OK;
            break;
        }
        case DRV_POWER_CMD_SET_USB_CHARGE:
        {
            ret = EPDK_OK;
            break;
        }
        case DRV_POWER_CMD_SET_STANDBY_FLAG:
        {
            __inf("set sdandby to  1 \n");
            break;
        }
        default:
        {
            __wrn("Unkonwn Command...\n");
            ret = EPDK_FAIL;
            break;
        }
    }
    return ret;
}
예제 #15
0
__s32 DRV_hdmi_set_display_mode(__disp_tv_mode_t mode)
{
    __u32 hdmi_mode;

    switch(mode) {
    case DISP_TV_MOD_480I:
	hdmi_mode = HDMI1440_480I;
	break;

    case DISP_TV_MOD_576I:
	hdmi_mode = HDMI1440_576I;
	break;

    case DISP_TV_MOD_480P:
	hdmi_mode = HDMI480P;
	break;

    case DISP_TV_MOD_576P:
	hdmi_mode = HDMI576P;
	break;

    case DISP_TV_MOD_720P_50HZ:
	hdmi_mode = HDMI720P_50;
	break;

    case DISP_TV_MOD_720P_60HZ:
	hdmi_mode = HDMI720P_60;
	break;

    case DISP_TV_MOD_1080I_50HZ:
	hdmi_mode = HDMI1080I_50;
	break;

    case DISP_TV_MOD_1080I_60HZ:
	hdmi_mode = HDMI1080I_60;
	break;

    case DISP_TV_MOD_1080P_24HZ:
	hdmi_mode = HDMI1080P_24;
	break;

    case DISP_TV_MOD_1080P_50HZ:
	hdmi_mode = HDMI1080P_50;
	break;

    case DISP_TV_MOD_1080P_60HZ:
	hdmi_mode = HDMI1080P_60;
	break;

    case DISP_TV_MOD_1080P_24HZ_3D_FP:
	hdmi_mode = HDMI1080P_24_3D_FP;
	break;

    case DISP_TV_MOD_720P_50HZ_3D_FP:
        hdmi_mode = HDMI720P_50_3D_FP;
        break;

    case DISP_TV_MOD_720P_60HZ_3D_FP:
        hdmi_mode = HDMI720P_60_3D_FP;
        break;

    default:
        __wrn("unsupported video mode %d when set display mode\n", mode);
        return -1;
        }

    return Hdmi_hal_set_display_mode(hdmi_mode);
}
예제 #16
0
__s32 OSAL_GPIO_DevGetAllPins_Status(unsigned p_handler, disp_gpio_set_t *gpio_status, unsigned gpio_count_max, unsigned if_get_from_hardware)
{
        __wrn("OSAL_GPIO_DevGetAllPins_Status is NULL\n");
        return 0;
}
예제 #17
0
long disp_ioctl(void *hd, unsigned int cmd, void *arg)
{
	unsigned long karg[4];
	unsigned long ubuffer[4] = {0};
	__s32 ret = 0;

	if(!display_opens)
	{
		printf("de not open\n");
		return -1;
	}
	if (copy_from_user((void*)karg,(void __user*)arg,4*sizeof(unsigned long)))
	{
		__wrn("copy_from_user fail %d \n",__LINE__);
		return -EFAULT;
	}

	ubuffer[0] = *(unsigned long*)karg;
	ubuffer[1] = (*(unsigned long*)(karg+1));
	ubuffer[2] = (*(unsigned long*)(karg+2));
	ubuffer[3] = (*(unsigned long*)(karg+3));

    if(cmd < DISP_CMD_FB_REQUEST)
    {
        if((ubuffer[0] != 0) && (ubuffer[0] != 1))
        {
            __wrn("para err in disp_ioctl, cmd = 0x%x,screen id = %d\n", cmd, (int)ubuffer[0]);
            return -1;
        }
    }
    if(suspend_status & 2)
    {
        __wrn("ioctl:%x fail when in suspend!\n", cmd);
        return -1;
    }

#if 0
    if(cmd!=DISP_CMD_TV_GET_INTERFACE && cmd!=DISP_CMD_HDMI_GET_HPD_STATUS && cmd!=DISP_CMD_GET_OUTPUT_TYPE
    	&& cmd!=DISP_CMD_SCN_GET_WIDTH && cmd!=DISP_CMD_SCN_GET_HEIGHT
    	&& cmd!=DISP_CMD_VIDEO_SET_FB && cmd!=DISP_CMD_VIDEO_GET_FRAME_ID)
    {
        OSAL_PRINTF("cmd:0x%x,%ld,%ld\n",cmd, ubuffer[0], ubuffer[1]);
    }
#endif

    switch(cmd)
    {
    //----disp global----
    	case DISP_CMD_SET_BKCOLOR:
	    {
	        __disp_color_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_color_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
		    ret = bsp_disp_set_bk_color(ubuffer[0], &para);
		    break;
	    }

    	case DISP_CMD_SET_COLORKEY:
    	{
    	    __disp_colorkey_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_colorkey_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_set_color_key(ubuffer[0], &para);
		    break;
		}

    	case DISP_CMD_SET_PALETTE_TBL:
    	    if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
    	    {
    	        __wrn("para invalid in disp ioctrl DISP_CMD_SET_PALETTE_TBL,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
    	        return -1;
    	    }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[3]))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_set_palette_table(ubuffer[0], (__u32 *)gbuffer, ubuffer[2], ubuffer[3]);
    		break;

    	case DISP_CMD_GET_PALETTE_TBL:
    	    if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
    	    {
    	        __wrn("para invalid in disp ioctrl DISP_CMD_GET_PALETTE_TBL,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
    	        return -1;
    	    }
    		ret = bsp_disp_get_palette_table(ubuffer[0], (__u32 *)gbuffer, ubuffer[2], ubuffer[3]);
    		if(copy_to_user((void __user *)ubuffer[1], gbuffer,ubuffer[3]))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;

    	case DISP_CMD_START_CMD_CACHE:
    		ret = bsp_disp_cmd_cache(ubuffer[0]);
    		break;

    	case DISP_CMD_EXECUTE_CMD_AND_STOP_CACHE:
    		ret = bsp_disp_cmd_submit(ubuffer[0]);
    		break;

    	case DISP_CMD_GET_OUTPUT_TYPE:
    		ret =  bsp_disp_get_output_type(ubuffer[0]);
    		break;

    	case DISP_CMD_SCN_GET_WIDTH:
    		ret = bsp_disp_get_screen_width(ubuffer[0]);
    		break;

    	case DISP_CMD_SCN_GET_HEIGHT:
    		ret = bsp_disp_get_screen_height(ubuffer[0]);
    		break;

    	case DISP_CMD_SET_GAMMA_TABLE:
    	    if((ubuffer[1] == 0) || ((int)ubuffer[2] <= 0))
    	    {
    	        __wrn("para invalid in disp ioctrl DISP_CMD_SET_GAMMA_TABLE,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[2]);
    	        return -1;
    	    }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[2]))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_set_gamma_table(ubuffer[0], (__u32 *)gbuffer, ubuffer[2]);
    		break;

    	case DISP_CMD_GAMMA_CORRECTION_ON:
    		ret = bsp_disp_gamma_correction_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_GAMMA_CORRECTION_OFF:
    		ret = bsp_disp_gamma_correction_disable(ubuffer[0]);
    		break;

        case DISP_CMD_SET_BRIGHT:
            ret = bsp_disp_cmu_set_bright(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_BRIGHT:
            ret = bsp_disp_cmu_get_bright(ubuffer[0]);
    		break;

        case DISP_CMD_SET_CONTRAST:
            ret = bsp_disp_cmu_set_contrast(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_CONTRAST:
            ret = bsp_disp_cmu_get_contrast(ubuffer[0]);
    		break;

        case DISP_CMD_SET_SATURATION:
            ret = bsp_disp_cmu_set_saturation(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_SATURATION:
            ret = bsp_disp_cmu_get_saturation(ubuffer[0]);
    		break;

        case DISP_CMD_SET_HUE:
            ret = bsp_disp_cmu_set_hue(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_HUE:
            ret = bsp_disp_cmu_get_hue(ubuffer[0]);
    		break;

        case DISP_CMD_ENHANCE_ON:
            ret = bsp_disp_cmu_enable(ubuffer[0], 1);
    		break;

        case DISP_CMD_ENHANCE_OFF:
            ret = bsp_disp_cmu_enable(ubuffer[0], 0);
    		break;

        case DISP_CMD_GET_ENHANCE_EN:
            ret = bsp_disp_cmu_get_enable(ubuffer[0]);
    		break;

        case DISP_CMD_SET_ENHANCE_MODE:
            ret = bsp_disp_cmu_set_mode(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_GET_ENHANCE_MODE:
            ret = bsp_disp_cmu_get_mode(ubuffer[0]);
    		break;

        case DISP_CMD_SET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;

            if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
            ret = bsp_disp_cmu_set_window(ubuffer[0], &para);
    		break;
        }

        case DISP_CMD_GET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;

            ret = bsp_disp_cmu_get_window(ubuffer[0], &para);
            if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_CAPTURE_SCREEN:
    	    ret = bsp_disp_capture_screen(ubuffer[0], (__disp_capture_screen_para_t *)ubuffer[1]);
    	    break;

        case DISP_CMD_SET_SCREEN_SIZE:
            ret = bsp_disp_set_screen_size(ubuffer[0], (__disp_rectsz_t*)ubuffer[1]);
            break;

        case DISP_CMD_DE_FLICKER_ON:
            ret = bsp_disp_de_flicker_enable(ubuffer[0], 1);
            break;

        case DISP_CMD_DE_FLICKER_OFF:
            ret = bsp_disp_de_flicker_enable(ubuffer[0], 0);
            break;

        case DISP_CMD_DRC_ON:
            ret = bsp_disp_drc_enable(ubuffer[0], 1);
            break;

        case DISP_CMD_DRC_OFF:
            ret = bsp_disp_drc_enable(ubuffer[0], 0);
            break;

        case DISP_CMD_GET_DRC_EN:
            ret = bsp_disp_drc_get_enable(ubuffer[0]);
            break;

        case DISP_CMD_DRC_SET_WINDOW:
        {
            __disp_rect_t para;

            if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_rect_t)))
            {
                __wrn("copy_from_user fail\n");
                return  -EFAULT;
            }

            ret = bsp_disp_drc_set_window(ubuffer[0], &para);
            break;
       }

       case DISP_CMD_DRC_GET_WINDOW:
        {
            __disp_rect_t para;

            ret = bsp_disp_drc_get_window(ubuffer[0], &para);
            if(copy_to_user((void __user *)ubuffer[1], &para,sizeof(__disp_rect_t)))
            {
                __wrn("copy_to_user fail\n");
                return  -EFAULT;
            }

            return ret;
            break;
       }
    //----layer----
    	case DISP_CMD_LAYER_REQUEST:
    		ret = bsp_disp_layer_request(ubuffer[0], (__disp_layer_work_mode_t)ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_RELEASE:
    		ret = bsp_disp_layer_release(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_OPEN:
    		ret = bsp_disp_layer_open(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_CLOSE:
    		ret = bsp_disp_layer_close(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_SET_FB:
    	{
    	    __disp_fb_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_framebuffer(ubuffer[0], ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
    	}

    	case DISP_CMD_LAYER_GET_FB:
    	{
    	    __disp_fb_t para;

    		ret = bsp_disp_layer_get_framebuffer(ubuffer[0], ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2], &para,sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_SET_SRC_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_src_window(ubuffer[0],ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
        }

    	case DISP_CMD_LAYER_GET_SRC_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_layer_get_src_window(ubuffer[0],ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2], &para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_SET_SCN_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_screen_window(ubuffer[0],ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
        }

    	case DISP_CMD_LAYER_GET_SCN_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_layer_get_screen_window(ubuffer[0],ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2], &para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_SET_PARA:
    	{
    	    __disp_layer_info_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_layer_set_para(ubuffer[0], ubuffer[1], &para);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;
        }

    	case DISP_CMD_LAYER_GET_PARA:
    	{
    	    __disp_layer_info_t para;

    		ret = bsp_disp_layer_get_para(ubuffer[0], ubuffer[1], &para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_LAYER_TOP:
    		ret = bsp_disp_layer_set_top(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_BOTTOM:
    		ret = bsp_disp_layer_set_bottom(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_ALPHA_ON:
    		ret = bsp_disp_layer_alpha_enable(ubuffer[0], ubuffer[1], 1);
    		break;

    	case DISP_CMD_LAYER_ALPHA_OFF:
    		ret = bsp_disp_layer_alpha_enable(ubuffer[0], ubuffer[1], 0);
    		break;

    	case DISP_CMD_LAYER_SET_ALPHA_VALUE:
    		ret = bsp_disp_layer_set_alpha_value(ubuffer[0], ubuffer[1], ubuffer[2]);
    		//DRV_disp_wait_cmd_finish(ubuffer[0]);
    		break;

    	case DISP_CMD_LAYER_CK_ON:
    		ret = bsp_disp_layer_colorkey_enable(ubuffer[0], ubuffer[1], 1);
    		break;

    	case DISP_CMD_LAYER_CK_OFF:
    		ret = bsp_disp_layer_colorkey_enable(ubuffer[0], ubuffer[1], 0);
    		break;

    	case DISP_CMD_LAYER_SET_PIPE:
    		ret = bsp_disp_layer_set_pipe(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

    	case DISP_CMD_LAYER_GET_ALPHA_VALUE:
    		ret = bsp_disp_layer_get_alpha_value(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_ALPHA_EN:
    		ret = bsp_disp_layer_get_alpha_enable(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_CK_EN:
    		ret = bsp_disp_layer_get_colorkey_enable(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_PRIO:
    		ret = bsp_disp_layer_get_piro(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_LAYER_GET_PIPE:
    		ret = bsp_disp_layer_get_pipe(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_SMOOTH:
            ret = bsp_disp_layer_set_smooth(ubuffer[0], ubuffer[1],(__disp_video_smooth_t) ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_SMOOTH:
            ret = bsp_disp_layer_get_smooth(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_BRIGHT:
            ret = bsp_disp_cmu_layer_set_bright(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_BRIGHT:
            ret = bsp_disp_cmu_layer_get_bright(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_CONTRAST:
            ret = bsp_disp_cmu_layer_set_contrast(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_CONTRAST:
            ret = bsp_disp_cmu_layer_get_contrast(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_SATURATION:
            ret = bsp_disp_cmu_layer_set_saturation(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_SATURATION:
            ret = bsp_disp_cmu_layer_get_saturation(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_HUE:
            ret = bsp_disp_cmu_layer_set_hue(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_HUE:
            ret = bsp_disp_cmu_layer_get_hue(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_ENHANCE_ON:
            ret = bsp_disp_cmu_layer_enable(ubuffer[0], ubuffer[1], 1);
    		break;

        case DISP_CMD_LAYER_ENHANCE_OFF:
            ret = bsp_disp_cmu_layer_enable(ubuffer[0], ubuffer[1], 0);
    		break;

        case DISP_CMD_LAYER_GET_ENHANCE_EN:
            ret = bsp_disp_cmu_layer_get_enable(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_ENHANCE_MODE:
            ret = bsp_disp_cmu_layer_set_mode(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_ENHANCE_MODE:
            ret = bsp_disp_cmu_layer_get_mode(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;
            if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
            ret = bsp_disp_cmu_layer_set_window(ubuffer[0], ubuffer[1], &para);
    		break;
       }

        case DISP_CMD_LAYER_GET_ENHANCE_WINDOW:
        {
            __disp_rect_t para;
            ret = bsp_disp_cmu_layer_get_window(ubuffer[0], ubuffer[1], &para);
            if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_layer_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
       }
        case DISP_CMD_LAYER_VPP_ON:
            ret = bsp_disp_deu_enable(ubuffer[0], ubuffer[1], 1);
    		break;

        case DISP_CMD_LAYER_VPP_OFF:
            ret = bsp_disp_deu_enable(ubuffer[0], ubuffer[1], 0);
    		break;

        case DISP_CMD_LAYER_GET_VPP_EN:
            ret = bsp_disp_deu_get_enable(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_LUMA_SHARP_LEVEL:
            ret = bsp_disp_deu_set_luma_sharp_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_LUMA_SHARP_LEVEL:
            ret = bsp_disp_deu_get_luma_sharp_level(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_CHROMA_SHARP_LEVEL:
            ret = bsp_disp_deu_set_chroma_sharp_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_CHROMA_SHARP_LEVEL:
            ret = bsp_disp_deu_get_chroma_sharp_level(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_WHITE_EXTEN_LEVEL:
            ret = bsp_disp_deu_set_white_exten_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_WHITE_EXTEN_LEVEL:
            ret = bsp_disp_deu_get_white_exten_level(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_LAYER_SET_BLACK_EXTEN_LEVEL:
            ret = bsp_disp_deu_set_black_exten_level(ubuffer[0], ubuffer[1], ubuffer[2]);
    		break;

        case DISP_CMD_LAYER_GET_BLACK_EXTEN_LEVEL:
            ret = bsp_disp_deu_get_black_exten_level(ubuffer[0], ubuffer[1]);
    		break;
        case DISP_CMD_LAYER_VPP_SET_WINDOW:
        {
            __disp_rect_t para;

            if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
            {
                __wrn("copy_from_user fail\n");
                return  -EFAULT;
            }

            ret = bsp_disp_deu_set_window(ubuffer[0], ubuffer[1], &para);
            break;
       }

       case DISP_CMD_LAYER_VPP_GET_WINDOW:
        {
            __disp_rect_t para;

            ret = bsp_disp_deu_get_window(ubuffer[0], ubuffer[1], &para);
            if(copy_to_user((void __user *)ubuffer[2], &para,sizeof(__disp_rect_t)))
            {
                __wrn("copy_to_user fail\n");
                return  -EFAULT;
            }

            return ret;
            break;
       }

    //----scaler----
    	case DISP_CMD_SCALER_REQUEST:
    		ret = bsp_disp_scaler_request();
    		break;

    	case DISP_CMD_SCALER_RELEASE:
    		ret = bsp_disp_scaler_release(ubuffer[1]);
    		break;

    	case DISP_CMD_SCALER_EXECUTE:
    	{
    	    __disp_scaler_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_scaler_para_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_scaler_start(ubuffer[1],&para);
    		break;
        }

        case DISP_CMD_SCALER_EXECUTE_EX:
    	{
    	    __disp_scaler_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_scaler_para_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_scaler_start_ex(ubuffer[1],&para);
    		break;
        }

    //----hwc----
    	case DISP_CMD_HWC_OPEN:
    		ret =  bsp_disp_hwc_enable(ubuffer[0], 1);
    		break;

    	case DISP_CMD_HWC_CLOSE:
    		ret =  bsp_disp_hwc_enable(ubuffer[0], 0);
    		break;

    	case DISP_CMD_HWC_SET_POS:
    	{
    	    __disp_pos_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_pos_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_hwc_set_pos(ubuffer[0], &para);
    		break;
        }

    	case DISP_CMD_HWC_GET_POS:
    	{
    	    __disp_pos_t para;

    		ret = bsp_disp_hwc_get_pos(ubuffer[0], &para);
    		if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_pos_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_HWC_SET_FB:
    	{
    	    __disp_hwc_pattern_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_hwc_pattern_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_hwc_set_framebuffer(ubuffer[0], &para);
    		break;
        }

    	case DISP_CMD_HWC_SET_PALETTE_TABLE:
			if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
            {
                __wrn("para invalid in display ioctrl DISP_CMD_HWC_SET_PALETTE_TABLE,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
                return -1;
            }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[3]))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_hwc_set_palette(ubuffer[0], (void*)gbuffer, ubuffer[2], ubuffer[3]);
    		break;


    //----video----
    	case DISP_CMD_VIDEO_START:
    		ret = bsp_disp_video_start(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_VIDEO_STOP:
    		ret = bsp_disp_video_stop(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_VIDEO_SET_FB:
    	{
    	    __disp_video_fb_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_video_fb_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
    		ret = bsp_disp_video_set_fb(ubuffer[0], ubuffer[1], &para);
    		break;
        }

        case DISP_CMD_VIDEO_GET_FRAME_ID:
            ret = bsp_disp_video_get_frame_id(ubuffer[0], ubuffer[1]);
    		break;

        case DISP_CMD_VIDEO_GET_DIT_INFO:
        {
            __disp_dit_info_t para;

            ret = bsp_disp_video_get_dit_info(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_dit_info_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    //----lcd----
    	case DISP_CMD_LCD_ON:
    		ret = DRV_lcd_open(ubuffer[0]);
    		output_type = DISP_OUTPUT_TYPE_LCD;
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_LCD;
            }
    		break;

    	case DISP_CMD_LCD_OFF:
    		ret = DRV_lcd_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_LCD_SET_BRIGHTNESS:
    		ret = bsp_disp_lcd_set_bright(ubuffer[0], ubuffer[1], 0);
    		break;

    	case DISP_CMD_LCD_GET_BRIGHTNESS:
    		ret = bsp_disp_lcd_get_bright(ubuffer[0]);
    		break;

//    	case DISP_CMD_LCD_CPUIF_XY_SWITCH:
// 		ret = bsp_disp_lcd_xy_switch(ubuffer[0], ubuffer[1]);
  //  		break;

    	case DISP_CMD_LCD_SET_SRC:
    		ret = bsp_disp_lcd_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

        case DISP_CMD_LCD_USER_DEFINED_FUNC:
            ret = bsp_disp_lcd_user_defined_func(ubuffer[0], ubuffer[1], ubuffer[2], ubuffer[3]);
            break;

    //----tv----
    	case DISP_CMD_TV_ON:
    		ret = bsp_disp_tv_open(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_TV;
            }
    		break;

    	case DISP_CMD_TV_OFF:
    		ret = bsp_disp_tv_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_TV_SET_MODE:
    		ret = bsp_disp_tv_set_mode(ubuffer[0], (__disp_tv_mode_t)ubuffer[1]);
    		break;

    	case DISP_CMD_TV_GET_MODE:
    		ret = bsp_disp_tv_get_mode(ubuffer[0]);
    		break;

    	case DISP_CMD_TV_AUTOCHECK_ON:
    		ret = bsp_disp_tv_auto_check_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_TV_AUTOCHECK_OFF:
    		ret = bsp_disp_tv_auto_check_disable(ubuffer[0]);
    		break;

    	case DISP_CMD_TV_GET_INTERFACE:
    	    if(suspend_status != 0)
    	    {
    	        ret = DISP_TV_NONE;
    	    }
    	    else
    	    {
    		    ret = bsp_disp_tv_get_interface(ubuffer[0]);
            }
    		break;

    	case DISP_CMD_TV_SET_SRC:
    		ret = bsp_disp_tv_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

        case DISP_CMD_TV_GET_DAC_STATUS:
            if(suspend_status != 0)
            {
                ret = 0;
            }
            else
            {
                ret =  bsp_disp_tv_get_dac_status(ubuffer[0], ubuffer[1]);
            }
            break;

        case DISP_CMD_TV_SET_DAC_SOURCE:
            ret =  bsp_disp_tv_set_dac_source(ubuffer[0], ubuffer[1], (__disp_tv_dac_source)ubuffer[2]);
            break;

        case DISP_CMD_TV_GET_DAC_SOURCE:
            ret =  bsp_disp_tv_get_dac_source(ubuffer[0], ubuffer[1]);
            break;

    //----hdmi----
    	case DISP_CMD_HDMI_ON:
    		ret = bsp_disp_hdmi_open(ubuffer[0]);
    		output_type = DISP_OUTPUT_TYPE_HDMI;
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_HDMI;
            }
    		break;

    	case DISP_CMD_HDMI_OFF:
    		ret = bsp_disp_hdmi_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_HDMI_SET_MODE:
    		ret = bsp_disp_hdmi_set_mode(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_HDMI_GET_MODE:
    		ret = bsp_disp_hdmi_get_mode(ubuffer[0]);
    		break;

    	case DISP_CMD_HDMI_GET_HPD_STATUS:
    	    if(suspend_status != 0)
    	    {
    	        ret = 0;
    	    }
    	    else
    	    {
    	        ret = bsp_disp_hdmi_get_hpd_status(ubuffer[0]);
    	    }
    		break;

    	case DISP_CMD_HDMI_SUPPORT_MODE:
    		ret = bsp_disp_hdmi_check_support_mode(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_HDMI_SET_SRC:
    		ret = bsp_disp_hdmi_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

    //----vga----
    	case DISP_CMD_VGA_ON:
    		ret = bsp_disp_vga_open(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_VGA;
            }
    		break;

    	case DISP_CMD_VGA_OFF:
    		ret = bsp_disp_vga_close(ubuffer[0]);
            if(suspend_status != 0)
            {
                suspend_output_type[ubuffer[0]] = DISP_OUTPUT_TYPE_NONE;
            }
    		break;

    	case DISP_CMD_VGA_SET_MODE:
    		ret = bsp_disp_vga_set_mode(ubuffer[0], (__disp_vga_mode_t)ubuffer[1]);
    		break;

    	case DISP_CMD_VGA_GET_MODE:
    		ret = bsp_disp_vga_get_mode(ubuffer[0]);
    		break;

    	case DISP_CMD_VGA_SET_SRC:
    		ret = bsp_disp_vga_set_src(ubuffer[0], (__disp_lcdc_src_t)ubuffer[1]);
    		break;

    //----sprite----
    /*
    	case DISP_CMD_SPRITE_OPEN:
    		ret = bsp_disp_sprite_open(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_CLOSE:
    		ret = bsp_disp_sprite_close(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_FORMAT:
    		ret = bsp_disp_sprite_set_format(ubuffer[0], (__disp_pixel_fmt_t)ubuffer[1], (__disp_pixel_seq_t)ubuffer[2]);
    		break;

    	case DISP_CMD_SPRITE_GLOBAL_ALPHA_ENABLE:
    		ret = bsp_disp_sprite_alpha_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_GLOBAL_ALPHA_DISABLE:
    		ret = bsp_disp_sprite_alpha_disable(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_ENABLE:
    		ret = bsp_disp_sprite_get_alpha_enable(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_GLOBAL_ALPHA_VALUE:
    		ret = bsp_disp_sprite_set_alpha_vale(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_VALUE:
    		ret = bsp_disp_sprite_get_alpha_value(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_ORDER:
    		ret = bsp_disp_sprite_set_order(ubuffer[0], ubuffer[1],ubuffer[2]);
    		break;

    	case DISP_CMD_SPRITE_GET_TOP_BLOCK:
    		ret = bsp_disp_sprite_get_top_block(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_GET_BOTTOM_BLOCK:
    		ret = bsp_disp_sprite_get_bottom_block(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_SET_PALETTE_TBL:
            if((ubuffer[1] == 0) || ((int)ubuffer[3] <= 0))
            {
                __wrn("para invalid in display ioctrl DISP_CMD_SPRITE_SET_PALETTE_TBL,buffer:0x%x, size:0x%x\n", (unsigned int)ubuffer[1], (unsigned int)ubuffer[3]);
                return -1;
            }
    		if(copy_from_user(gbuffer, (void __user *)ubuffer[1],ubuffer[3]))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret =  bsp_disp_sprite_set_palette_table(ubuffer[0], (__u32 * )gbuffer,ubuffer[2],ubuffer[3]);
    		break;

    	case DISP_CMD_SPRITE_GET_BLOCK_NUM:
    		ret = bsp_disp_sprite_get_block_number(ubuffer[0]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_REQUEST:
    	{
    	    __disp_sprite_block_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_sprite_block_para_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_request(ubuffer[0], &para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_RELEASE:
    		ret = bsp_disp_sprite_block_release(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_SET_SCREEN_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_screen_win(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_SCREEN_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_sprite_block_get_srceen_win(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_SET_SOURCE_WINDOW:
    	{
    	    __disp_rect_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_src_win(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_SOURCE_WINDOW:
    	{
    	    __disp_rect_t para;

    		ret = bsp_disp_sprite_block_get_src_win(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_rect_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_SET_FB:
    	{
    	    __disp_fb_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_framebuffer(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_FB:
    	{
    	    __disp_fb_t para;

    		ret = bsp_disp_sprite_block_get_framebufer(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_fb_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_SET_TOP:
    		ret = bsp_disp_sprite_block_set_top(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_SET_BOTTOM:
    		ret = bsp_disp_sprite_block_set_bottom(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_GET_PREV_BLOCK:
    		ret = bsp_disp_sprite_block_get_pre_block(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_GET_NEXT_BLOCK:
    		ret = bsp_disp_sprite_block_get_next_block(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_GET_PRIO:
    		ret = bsp_disp_sprite_block_get_prio(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_OPEN:
    		ret = bsp_disp_sprite_block_open(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_CLOSE:
    		ret = bsp_disp_sprite_block_close(ubuffer[0], ubuffer[1]);
    		break;

    	case DISP_CMD_SPRITE_BLOCK_SET_PARA:
    	{
    	    __disp_sprite_block_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[2],sizeof(__disp_sprite_block_para_t)))
    		{
    		    __wrn("copy_from_user fail\n");
    			return  -EFAULT;
    		}
    		ret = bsp_disp_sprite_block_set_para(ubuffer[0], ubuffer[1],&para);
    		break;
        }

    	case DISP_CMD_SPRITE_BLOCK_GET_PARA:
    	{
    	    __disp_sprite_block_para_t para;

    		ret = bsp_disp_sprite_block_get_para(ubuffer[0], ubuffer[1],&para);
    		if(copy_to_user((void __user *)ubuffer[2],&para, sizeof(__disp_sprite_block_para_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
    		break;
        }
        */
#ifdef __LINUX_OSAL__
	//----framebuffer----
    	case DISP_CMD_FB_REQUEST:
    	{
    	    __disp_fb_create_para_t para;

    		if(copy_from_user(&para, (void __user *)ubuffer[1],sizeof(__disp_fb_create_para_t)))
    		{
    		    __wrn("copy_from_user fail %d \n",__LINE__);
    			return  -EFAULT;
    		}
			ret = Display_Fb_Request(ubuffer[0], &para);
			break;
        }

		case DISP_CMD_FB_RELEASE:
			ret = Display_Fb_Release(ubuffer[0]);
			break;

	    case DISP_CMD_FB_GET_PARA:
	    {
    	    __disp_fb_create_para_t para;

			ret = Display_Fb_get_para(ubuffer[0], &para);
    		if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_fb_create_para_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
			break;
        }

	    case DISP_CMD_GET_DISP_INIT_PARA:
	    {
    	    __disp_init_t para;

			ret = Display_get_disp_init_para(&para);
    		if(copy_to_user((void __user *)ubuffer[0],&para, sizeof(__disp_init_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
			break;
        }
//----for test----
		case DISP_CMD_MEM_REQUEST:
			ret =  disp_mem_request(ubuffer[0]);
			break;


		case DISP_CMD_MEM_RELASE:
			ret =  disp_mem_release(ubuffer[0]);
			break;

		case DISP_CMD_MEM_SELIDX:
			g_disp_mm_sel = ubuffer[0];
			break;

		case DISP_CMD_MEM_GETADR:
			ret = g_disp_mm[ubuffer[0]].mem_start;
			break;

		case DISP_CMD_MEM_GET_INFO:
		{
    	    __disp_mm_t para;

			ret = disp_mem_get_info(ubuffer[0], &para);
    		if(copy_to_user((void __user *)ubuffer[1],&para, sizeof(__disp_mm_t)))
    		{
    		    __wrn("copy_to_user fail\n");
    			return  -EFAULT;
    		}
			break;
        }
		case DISP_CMD_SUSPEND:
		{
		    pm_message_t state;

			ret = disp_suspend(0, state);
			break;
        }

		case DISP_CMD_RESUME:
			ret = disp_resume(0);
			break;
#endif
		case DISP_CMD_SET_EXIT_MODE:
	    	ret =  g_disp_drv.exit_mode = ubuffer[0];
			break;

		case DISP_CMD_LCD_CHECK_OPEN_FINISH:
			ret = DRV_lcd_check_open_finished(ubuffer[0]);
			break;

		case DISP_CMD_LCD_CHECK_CLOSE_FINISH:
			ret = DRV_lcd_check_close_finished(ubuffer[0]);
			break;

        case DISP_CMD_PRINT_REG:
            ret = bsp_disp_print_reg(1, ubuffer[0]);
            break;

		default:
		    break;
    }

	return ret;
}
예제 #18
0
__s32 OSAL_GPIO_DevGetONEPins_Status(unsigned p_handler, disp_gpio_set_t *gpio_status,const char *gpio_name,unsigned if_get_from_hardware)
{
        __wrn("OSAL_GPIO_DevGetONEPins_Status is NULL\n");
        return 0;
}
예제 #19
0
__s32 audio_config(void)
{
	__s32 i;

	__inf("audio_config, sample_rate:%d\n", audio_info.sample_rate);

	HDMI_WUINT32(0x040,0x00000000);
	HDMI_WUINT32(0x040,0x40000000);
	while(HDMI_RUINT32(0x040) != 0);
	HDMI_WUINT32(0x040,0x40000000);
	while(HDMI_RUINT32(0x040) != 0);

	if(!audio_info.audio_en)
	{
        return 0;
	}
	i = get_audio_info(audio_info.sample_rate);
	if(i == -1)
	{
		return 0;
	}

	if(audio_info.channel_num == 1)
    {
          HDMI_WUINT32(0x044,0x00000000);             	//audio fifo rst and select ddma, 2 ch 16bit pcm
          HDMI_WUINT32(0x048,0x00000000);				//ddma,pcm layout0 1ch
          HDMI_WUINT32(0x04c,0x76543200);

          HDMI_WUINT32(0x0A0,0x710a0184);             	//audio infoframe head
          HDMI_WUINT32(0x0A4,0x00000000);             	//CA = 0X1F
          HDMI_WUINT32(0x0A8,0x00000000);
          HDMI_WUINT32(0x0Ac,0x00000000);
    }else  if(audio_info.channel_num == 2)
    {
          HDMI_WUINT32(0x044,0x00000000);             	//audio fifo rst and select ddma, 2 ch 16bit pcm
          HDMI_WUINT32(0x048,0x00000001);				//ddma,pcm layout0 2ch
          HDMI_WUINT32(0x04c,0x76543210);

          HDMI_WUINT32(0x0A0,0x710a0184);             	//audio infoframe head
          HDMI_WUINT32(0x0A4,0x00000000);             	//CA = 0X1F
          HDMI_WUINT32(0x0A8,0x00000000);
          HDMI_WUINT32(0x0Ac,0x00000000);
    }else if(audio_info.channel_num == 8)
    {
          HDMI_WUINT32(0x044,0x00000000);             	//audio fifo rst and select ddma, 2 ch 16bit pcm
          HDMI_WUINT32(0x048,0x0000000f);				//ddma,pcm layout1 8ch
          HDMI_WUINT32(0x04c,0x76543210);

          HDMI_WUINT32(0x0A0,0x520a0184);             	//audio infoframe head
          HDMI_WUINT32(0x0A4,0x1F000000);             	//CA = 0X1F
          HDMI_WUINT32(0x0A8,0x00000000);
          HDMI_WUINT32(0x0Ac,0x00000000);
    }else
    {
    		__wrn("unkonwn num_ch:%d\n", audio_info.channel_num);
    }


    HDMI_WUINT32(0x050,audio_info.CTS			);                   	//CTS and N
    HDMI_WUINT32(0x054,audio_info.ACR_N			);
    HDMI_WUINT32(0x058,audio_info.CH_STATUS0 	);
    HDMI_WUINT32(0x05c,audio_info.CH_STATUS1 	);

    HDMI_WUINT32(0x040,0x80000000);
    HDMI_WUINT32(0x004,0x80000000);

//for audio test
#if 0
    //dedicated dma setting  aw1623 env
    sys_put_wvalue(0xf1c023a4,0x40c00000);	//ddma ch5 seting from addr =0x40c00000
    sys_put_wvalue(0xf1c023a8,0x00000000);	//des =0
    sys_put_wvalue(0xf1c023ac,0x01f00000);	//byte to trans
    sys_put_wvalue(0xf1c023b8,(31<<24) +(7<<16) + (31<<8) +(7<<0));	//data block and wait cycle
    sys_put_wvalue(0xf1c023a0,0xa4b80481); 	//from src0 to des1,continous mode
#endif

    return 0;
}
예제 #20
0
__s32 OSAL_GPIO_DevSetONEPin_Status(u32 p_handler, disp_gpio_set_t *gpio_status, const char *gpio_name, __u32 if_set_to_current_input_status)
{
        __wrn("OSAL_GPIO_DevSetONEPin_Status is NULL\n");
        return 0;
}
예제 #21
0
//              0:ARGB    1:BRGA    2:ABGR    3:RGBA
//seq           ARGB        BRGA       ARGB       BRGA
//br_swqp    0              0            1              1      
__s32 parser_disp_init_para(__disp_init_t * init_para)
{
    int  value;
    int  i;

    memset(init_para, 0, sizeof(__disp_init_t));
    
    if(OSAL_Script_FetchParser_Data("disp_init", "disp_init_enable", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.disp_init_enable fail\n");
        return -1;
    }
    init_para->b_init = value;

    if(OSAL_Script_FetchParser_Data("disp_init", "disp_mode", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.disp_mode fail\n");
        return -1;
    }
    init_para->disp_mode= value;

//screen0
    if(OSAL_Script_FetchParser_Data("disp_init", "screen0_output_type", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.screen0_output_type fail\n");
        return -1;
    }
    if(value == 0)
    {
        init_para->output_type[0] = DISP_OUTPUT_TYPE_NONE;
    }
    else if(value == 1)
    {
        init_para->output_type[0] = DISP_OUTPUT_TYPE_LCD;
    }
    else if(value == 2)
    {
        init_para->output_type[0] = DISP_OUTPUT_TYPE_TV;
    }
    else if(value == 3)
    {
        init_para->output_type[0] = DISP_OUTPUT_TYPE_HDMI;
    }
    else if(value == 4)
    {
        init_para->output_type[0] = DISP_OUTPUT_TYPE_VGA;
    }
    else
    {
        __wrn("invalid screen0_output_type %d\n", init_para->output_type[0]);
        return -1;
    }
    
    if(OSAL_Script_FetchParser_Data("disp_init", "screen0_output_mode", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.screen0_output_mode fail\n");
        return -1;
    }
    if(init_para->output_type[0] == DISP_OUTPUT_TYPE_TV || init_para->output_type[0] == DISP_OUTPUT_TYPE_HDMI)
    {
        init_para->tv_mode[0]= (__disp_tv_mode_t)value;
    }
    else if(init_para->output_type[0] == DISP_OUTPUT_TYPE_VGA)
    {
        init_para->vga_mode[0]= (__disp_vga_mode_t)value;
    }

//screen1
    if(OSAL_Script_FetchParser_Data("disp_init", "screen1_output_type", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.screen1_output_type fail\n");
        return -1;
    }
    if(value == 0)
    {
        init_para->output_type[1] = DISP_OUTPUT_TYPE_NONE;
    }
    else if(value == 1)
    {
        init_para->output_type[1] = DISP_OUTPUT_TYPE_LCD;
    }
    else if(value == 2)
    {
        init_para->output_type[1] = DISP_OUTPUT_TYPE_TV;
    }
    else if(value == 3)
    {
        init_para->output_type[1] = DISP_OUTPUT_TYPE_HDMI;
    }
    else if(value == 4)
    {
        init_para->output_type[1] = DISP_OUTPUT_TYPE_VGA;
    }
    else
    {
        __wrn("invalid screen1_output_type %d\n", init_para->output_type[1]);
        return -1;
    }
    
    if(OSAL_Script_FetchParser_Data("disp_init", "screen1_output_mode", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.screen1_output_mode fail\n");
        return -1;
    }
    if(init_para->output_type[1] == DISP_OUTPUT_TYPE_TV || init_para->output_type[1] == DISP_OUTPUT_TYPE_HDMI)
    {
        init_para->tv_mode[1]= (__disp_tv_mode_t)value;
    }
    else if(init_para->output_type[1] == DISP_OUTPUT_TYPE_VGA)
    {
        init_para->vga_mode[1]= (__disp_vga_mode_t)value;
    }

//fb0
    if(OSAL_Script_FetchParser_Data("disp_init", "fb0_framebuffer_num", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb0_framebuffer_num fail\n");
        return -1;
    }
    init_para->buffer_num[0]= value;

    if(OSAL_Script_FetchParser_Data("disp_init", "fb0_format", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb0_format fail\n");
        return -1;
    }
    init_para->format[0]= value;

    if(OSAL_Script_FetchParser_Data("disp_init", "fb0_pixel_sequence", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb0_pixel_sequence fail\n");
        return -1;
    }
    init_para->seq[0]= value;

    if(OSAL_Script_FetchParser_Data("disp_init", "fb0_scaler_mode_enable", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb0_scaler_mode_enable fail\n");
        return -1;
    }
    init_para->scaler_mode[0]= value;

//fb1
    if(OSAL_Script_FetchParser_Data("disp_init", "fb1_framebuffer_num", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb1_framebuffer_num fail\n");
        return -1;
    }
    init_para->buffer_num[1]= value;

    if(OSAL_Script_FetchParser_Data("disp_init", "fb1_format", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb1_format fail\n");
        return -1;
    }
    init_para->format[1]= value;

    if(OSAL_Script_FetchParser_Data("disp_init", "fb1_pixel_sequence", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb1_pixel_sequence fail\n");
        return -1;
    }
    init_para->seq[1]= value;

    if(OSAL_Script_FetchParser_Data("disp_init", "fb1_scaler_mode_enable", &value, 1) < 0)
    {
        __wrn("fetch script data disp_init.fb1_scaler_mode_enable fail\n");
        return -1;
    }
    init_para->scaler_mode[1]= value;


    __inf("====display init para begin====\n");
    __inf("b_init:%d\n", init_para->b_init);
    __inf("disp_mode:%d\n\n", init_para->disp_mode);
    for(i=0; i<2; i++)
    {
        __inf("output_type[%d]:%d\n", i, init_para->output_type[i]);
        __inf("tv_mode[%d]:%d\n", i, init_para->tv_mode[i]);
        __inf("vga_mode[%d]:%d\n\n", i, init_para->vga_mode[i]);
    }
    for(i=0; i<2; i++)
    {
        __inf("buffer_num[%d]:%d\n", i, init_para->buffer_num[i]);
        __inf("format[%d]:%d\n", i, init_para->format[i]);
        __inf("seq[%d]:%d\n", i, init_para->seq[i]);
        __inf("br_swap[%d]:%d\n", i, init_para->br_swap[i]);
        __inf("b_scaler_mode[%d]:%d\n", i, init_para->scaler_mode[i]);
    }
    __inf("====display init para end====\n");

    return 0;
}
예제 #22
0
/*
*******************************************************************************
*                     BootMain
*
* Description:
*    BOOT主应用程序
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
int BootMain(int argc, char **argv)
{
	__s32                 ret;
    int                   erase_flash;
	MBR					  mbr_info;
    boot_global_info_t   *global_info;

    DMSG_INFO("big firmware! here we go !\n");
	DMSG_INFO("Sprite start\n");
	{
		char ch;

		ch = wBoot_getc_delay( 1 );  // 27000000
	    __inf("%d\n", ch);

	    switch(ch)
	   	{
	   		case '1':
	   		{
	   			usb_start();
	    		usb_run();
	    		break;
	   		}
	   		case '2':
	   		{
	   			__inf("Jump to fel\n");
	   			wBoot_jump_fel( );
	   			break;
	   		}
	   		case '-':
	   		{
	   			__u32 dbg = 0x55;

	            __inf("hold\n");
		        while(dbg == 0x55);
		        break;
	   		}
	   		case '+':
	   		{
	   			force_debug = 1;
	        	break;
	   		}
	   		default:
	   			break;
	   	}
	}
	*(volatile unsigned int *)(0x1c20C00 + 0x118) = 0;
	*(volatile unsigned int *)(0x1c20C00 + 0x11C) = 3;
	//数据初始化
	memset(&board_res, 0, sizeof(boot_hardware_res));
    //申请内存,填充第一个启动脚本
    global_info = (boot_global_info_t *)wBoot_malloc(sizeof(boot_global_info_t));
    if(!global_info)
    {
        __wrn("unable to malloc memory for bootini\n");

        return -1;
    }
    //填充启动脚本
    memset(global_info, 0, sizeof(boot_global_info_t));
    ret = script_patch("c:\\boot.ini", global_info, 0);
    if(ret < 0)
    {
        __wrn("unable to parser boot.ini\n");

        return -1;
    }
    //初始化显示设备
    __inf("display init\n");
    cue = -1;
    if(boot_ui_init(global_info->display_device, global_info->display_mode) >= 0)
    {
    	//开启字符显示
    	__inf("char init\n");
    	boot_ui_char_init(0);
    	cue = 0;
    }
    sprite_led_init();
    sprite_wrn_init();
    //获取MBR信息
    __inf("mbr fetch\n");
	ret = card_mbr_info((void *)&mbr_info);
	if(ret < 0)
	{
		__wrn("unable to get mbr info\n");

        return -1;
	}
	boot_ui_check_device_open();
    
	ret = wBoot_script_parser_fetch("platform", "eraseflag", &erase_flash, 1);
	if((!ret) && (erase_flash))
	{
		erase_flash = 1;
	}
	else
	{
		erase_flash = 0;
	}
    
    //开始准备系统数据
    ret = card_sprite((void *)&mbr_info,erase_flash, cue);

	sprite_wrn_exit();
	sprite_led_exit(ret);
	if(!ret)
	{
		char	buffer[512];

		board_res.led_status[0] = CARD_SPRITE_SUCCESSED;
		sprite_wrn("CARD OK\n");

		__inf("get work mode\n");
		memset(buffer, 0, 512);
		wBoot_block_dread(15, 1, buffer);
		if(strcmp(buffer, "1234567890abcdefghijklmnopqrstuvwxyz"))
		{
			__inf("try to close\n");
			wBoot_timer_delay(3000);

			wBoot_power_set_off();
		}
		else
		{
			int ret;

			__inf("try to format\n");
			wBoot_timer_delay(500);
			ret = FormatDisk();
			__inf("format %d\n", ret);
			WATCHDOG_REG_MODE = 0x0;
			wBoot_timer_delay(500);
			WATCHDOG_REG_MODE = 0x3;
		}
	}
	else
	{
		board_res.led_status[0] = CARD_SPRITE_FAIL;
	}
	{
		__u32 dbg = 0x55;

		while(dbg == 0x55);
	}

    return 0;
}
예제 #23
0
파일: dev_disp.c 프로젝트: Gucan/h3_lichee
long disp_ioctl(void *hd, unsigned int cmd, void *arg)
{
	unsigned long karg[4];
	unsigned long ubuffer[4] = {0};
	s32 ret = 0;
	int num_screens = 2;
	struct disp_manager *mgr = NULL;
	struct disp_device *dispdev = NULL;
	struct disp_enhance *enhance = NULL;
	struct disp_smbl *smbl = NULL;
	struct disp_capture *cptr = NULL;

	num_screens = bsp_disp_feat_get_num_screens();

	if (copy_from_user((void*)karg,(void*)arg, 4*sizeof(unsigned long))) {
		__wrn("copy_from_user fail\n");
		return -1;
	}

	ubuffer[0] = *(unsigned long*)karg;
	ubuffer[1] = (*(unsigned long*)(karg+1));
	ubuffer[2] = (*(unsigned long*)(karg+2));
	ubuffer[3] = (*(unsigned long*)(karg+3));

	if(ubuffer[0] < num_screens)
		mgr = g_disp_drv.mgr[ubuffer[0]];
	if(mgr) {
		dispdev = mgr->device;
		enhance = mgr->enhance;
		smbl = mgr->smbl;
		cptr = mgr->cptr;
	}

	if(cmd < DISP_FB_REQUEST)	{
		if(ubuffer[0] >= num_screens) {
			__wrn("para err in disp_ioctl, cmd = 0x%x,screen id = %d\n", cmd, (int)ubuffer[0]);
			return -1;
		}
	}
	if(DISPLAY_DEEP_SLEEP == suspend_status) {
		__wrn("ioctl:%x fail when in suspend!\n", cmd);
		return -1;
	}

	if(cmd == disp_cmd_print) {
		//__wrn("cmd:0x%x,%ld,%ld\n",cmd, ubuffer[0], ubuffer[1]);
	}

	switch(cmd)	{
	//----disp global----
	case DISP_SET_BKCOLOR:
	{
		disp_color para;

		if(copy_from_user(&para, (void*)ubuffer[1],sizeof(disp_color)))	{
			__wrn("copy_from_user fail\n");
			return  -1;
		}
		if(mgr && (mgr->set_back_color != NULL))
			ret = mgr->set_back_color(mgr, &para);
		break;
	}

	case DISP_GET_OUTPUT_TYPE:
	{
		if(mgr && mgr->device)
			ret = mgr->device->type;
		break;
	}

	case DISP_GET_SCN_WIDTH:
	{
		unsigned int width = 0,height = 0;
		if(mgr && mgr->device && mgr->device->get_resolution) {
			mgr->device->get_resolution(mgr->device, &width, &height);
		}
		ret = width;
		break;
	}

	case DISP_GET_SCN_HEIGHT:
	{
		unsigned int width = 0,height = 0;
		if(mgr && mgr->device && mgr->device->get_resolution) {
			mgr->device->get_resolution(mgr->device, &width, &height);
		}
		ret = height;
		break;
	}

	case DISP_VSYNC_EVENT_EN:
	{
		ret = bsp_disp_vsync_event_enable(ubuffer[0], ubuffer[1]);
		break;
	}

	case DISP_SHADOW_PROTECT:
	{
		ret = bsp_disp_shadow_protect(ubuffer[0], ubuffer[1]);
		break;
	}

	case DISP_BLANK:
	{
		if(ubuffer[1]) {
			if(dispdev && dispdev->disable)
				ret = dispdev->disable(dispdev);
		} else {
			if(dispdev && dispdev->enable)
				ret = dispdev->enable(dispdev);
		}
		break;
	}

	case DISP_DEVICE_SWITCH:
	{
		if(ubuffer[1] == (unsigned long)DISP_OUTPUT_TYPE_LCD)
			ret = drv_lcd_enable(ubuffer[0]);
		else
			ret = bsp_disp_device_switch(ubuffer[0], (disp_output_type)ubuffer[1], (disp_tv_mode)ubuffer[2]);
		break;
	}

	//----layer----
	case DISP_LAYER_SET_CONFIG:
	{
		disp_layer_config para;

		if(copy_from_user(&para, (void *)ubuffer[1],sizeof(disp_layer_config)))	{
			__wrn("copy_from_user fail\n");
			return  -1;
		}
		if(mgr && mgr->set_layer_config)
			ret = mgr->set_layer_config(mgr, &para, ubuffer[2]);
		break;
	}

	case DISP_LAYER_GET_CONFIG:
	{
		disp_layer_config para;

		if(copy_from_user(&para, (void *)ubuffer[1],sizeof(disp_layer_config)))	{
			__wrn("copy_from_user fail\n");
			return  -1;
		}
		if(mgr && mgr->get_layer_config)
			ret = mgr->get_layer_config(mgr, &para, ubuffer[2]);
		if(copy_to_user(&para, (void *)ubuffer[1], sizeof(disp_layer_config)))	{
			__wrn("copy_to_user fail\n");
			return  -1;
		}
		break;
	}

	//----lcd----
	case DISP_LCD_SET_BRIGHTNESS:
	{
		if(dispdev && (DISP_OUTPUT_TYPE_LCD == dispdev->type)) {
			ret = dispdev->set_bright(dispdev, ubuffer[1]);
		}
		break;
	}

	case DISP_LCD_GET_BRIGHTNESS:
	{
		if(dispdev && (DISP_OUTPUT_TYPE_LCD == dispdev->type)) {
			ret = dispdev->get_bright(dispdev);
		}
		break;
	}


	case DISP_HDMI_GET_HPD_STATUS:
		if(DISPLAY_NORMAL == suspend_status) {
			ret = bsp_disp_hdmi_get_hpd_status(ubuffer[0]);
		}	else {
			ret = 0;
		}
		break;

	case DISP_HDMI_SUPPORT_MODE:
		ret = bsp_disp_hdmi_check_support_mode(ubuffer[0], ubuffer[1]);
		break;

	case DISP_TV_GET_HPD_STATUS:
		if(DISPLAY_NORMAL == suspend_status) {
			ret = bsp_disp_tv_get_hpd_status(ubuffer[0]);
		}	else {
			ret = 0;
		}
		break;

	case DISP_HDMI_GET_EDID:
	{
		u8 *buf;
		u32 bytes = 1024;

		ret = 0;
		buf = (u8*)bsp_disp_hdmi_get_edid(ubuffer[0]);
		if(buf) {
			bytes = (ubuffer[2] > bytes)?bytes:ubuffer[2];
			if(copy_to_user(buf, (void *)ubuffer[1], bytes)) {
				__wrn("copy_to_user fail\n");
			} else {
				ret = bytes;
			}
		}

		break;
	}

#if 0
	case DISP_CMD_HDMI_SET_SRC:
		ret = bsp_disp_hdmi_set_src(ubuffer[0], (disp_lcd_src)ubuffer[1]);
		break;

	//----framebuffer----
	case DISP_CMD_FB_REQUEST:
	{
		disp_fb_create_info para;

		if(copy_from_user(&para, (void *)ubuffer[1],sizeof(disp_fb_create_info))) {
			__wrn("copy_from_user fail\n");
			return  -1;
		}
		ret = Display_Fb_Request(ubuffer[0], &para);
		break;
	}

	case DISP_CMD_FB_RELEASE:
	ret = Display_Fb_Release(ubuffer[0]);
	break;

	case DISP_CMD_FB_GET_PARA:
	{
		disp_fb_create_info para;

		ret = Display_Fb_get_para(ubuffer[0], &para);
		if(copy_to_user((void *)ubuffer[1],&para, sizeof(disp_fb_create_info))) {
			__wrn("copy_to_user fail\n");
			return  -1;
		}
		break;
	}

	case DISP_CMD_GET_DISP_INIT_PARA:
	{
		disp_init_para para;

		ret = Display_get_disp_init_para(&para);
		if(copy_to_user((void *)ubuffer[0],&para, sizeof(disp_init_para)))	{
			__wrn("copy_to_user fail\n");
			return  -1;
		}
		break;
	}

#endif
		//----enhance----
	case DISP_ENHANCE_ENABLE:
	{
		if(enhance && enhance->enable)
			ret = enhance->enable(enhance);
		break;
	}

	case DISP_ENHANCE_DISABLE:
	{
		if(enhance && enhance->disable)
			ret = enhance->disable(enhance);
		break;
	}

	//---smart backlight --
	case DISP_SMBL_ENABLE:
	{
		if(smbl && smbl->enable)
			ret = smbl->enable(smbl);
		break;
	}

	case DISP_SMBL_DISABLE:
	{
		if(smbl && smbl->disable)
			ret = smbl->disable(smbl);
		break;
	}

	case DISP_SMBL_SET_WINDOW:
	{
		disp_rect rect;

		if(copy_from_user(&rect, (void *)ubuffer[1],sizeof(disp_rect)))	{
			__wrn("copy_from_user fail\n");
			return  -1;
		}
		if(smbl && smbl->set_window)
			ret = smbl->set_window(smbl, &rect);
		break;
	}

	//---capture --
	case DISP_CAPTURE_START:
	{
		if(cptr && cptr->start)
			ret = cptr->start(cptr);
		break;
	}

	case DISP_CAPTURE_STOP:
	{
		if(cptr && cptr->stop)
			ret = cptr->stop(cptr);
		break;
	}

	case DISP_CAPTURE_COMMIT:
	{
		disp_capture_info info;

		if(copy_from_user(&info, (void *)ubuffer[1],sizeof(disp_capture_info)))	{
			__wrn("copy_from_user fail\n");
			return  -1;
		}
		if(cptr && cptr->commmit)
			ret = cptr->commmit(cptr, &info);
		break;
	}

#if defined(CONFIG_ARCH_SUN9IW1P1)

#if 0
	//----for test----
	case DISP_CMD_MEM_REQUEST:
		ret =  disp_mem_request(ubuffer[0],ubuffer[1]);
		break;

	case DISP_CMD_MEM_RELEASE:
		ret =  disp_mem_release(ubuffer[0]);
		break;

	case DISP_CMD_MEM_SELIDX:
		g_disp_mm_sel = ubuffer[0];
		break;

	case DISP_CMD_MEM_GETADR:
		ret = g_disp_mm[ubuffer[0]].mem_start;
		break;

//	case DISP_CMD_PRINT_REG:
//		ret = bsp_disp_print_reg(1, ubuffer[0], 0);
//		break;
#endif
#endif

	case DISP_SET_EXIT_MODE:
        ret = g_disp_drv.exit_mode = ubuffer[0];
		break;

	case DISP_LCD_CHECK_OPEN_FINISH:
		ret = drv_lcd_check_open_finished(ubuffer[0]);
		break;

	case DISP_LCD_CHECK_CLOSE_FINISH:
		ret = drv_lcd_check_close_finished(ubuffer[0]);
		break;

	default:
		break;
	}

  return ret;
}
/*
****************************************************************************************************
*
*             DRV_DE_IOCTRL
*
*  Description: 驱动提供的io操作函数,通常用于扩展操作
*
*
*  Parameters:  mid: 模块编号,驱动编写者可以不用关心
*               cmd: 驱动提供的操作命令
*               aux: 用户传进的整型参数
*               pbuffer: 用户传进的指针型参数
*
*  Return value:
*       0
*       -1
****************************************************************************************************
*/
__s32 DRV_DE_IOCTRL(__u32 hd, __u32 cmd, __s32 aux, void *pbuffer)
{
    __u32 para0=0, para1=0, para2=0;

    if(pbuffer != NULL)
    {
        para0 = *((__u32*)pbuffer);
        para1 = *((__u32*)((__u32)pbuffer+4));
        para2 = *((__u32*)((__u32)pbuffer+8));
    }

    switch(cmd)
	{
//----disp global----
	case DISP_CMD_SET_BKCOLOR:
		return BSP_disp_set_bk_color(aux, (__disp_color_t*)para0);

	case DISP_CMD_SET_COLORKEY:
		return BSP_disp_set_color_key(aux, (__disp_colorkey_t *)para0);

	case DISP_CMD_SET_PALETTE_TBL:
		return BSP_disp_set_palette_table(aux, (__u32 *)para0, para1, para2);

	case DISP_CMD_GET_PALETTE_TBL:
		return BSP_disp_get_palette_table(aux, (__u32 *)para0, para1, para2);

	case DISP_CMD_START_CMD_CACHE:
		return BSP_disp_cmd_cache(aux);

	case DISP_CMD_EXECUTE_CMD_AND_STOP_CACHE:
		return BSP_disp_cmd_submit(aux);

	case DISP_CMD_GET_OUTPUT_TYPE:
		return  BSP_disp_get_output_type(aux);

	case DISP_CMD_SCN_GET_WIDTH:
		return BSP_disp_get_screen_width(aux);

	case DISP_CMD_SCN_GET_HEIGHT:
		return BSP_disp_get_screen_height(aux);

	case DISP_CMD_SET_EXIT_MODE:
	    return DRV_set_exit_mode(aux);

	case DISP_CMD_SET_GAMMA_TABLE:
		return BSP_disp_set_gamma_table(aux, (__u32 *)para0, para1);

	case DISP_CMD_GAMMA_CORRECTION_ON:
		return BSP_disp_gamma_correction_enable(aux);

	case DISP_CMD_GAMMA_CORRECTION_OFF:
		return BSP_disp_gamma_correction_disable(aux);


//----layer----
	case DISP_CMD_LAYER_REQUEST:
		return BSP_disp_layer_request(aux, (__disp_layer_work_mode_t)para0);

	case DISP_CMD_LAYER_RELEASE:
		return BSP_disp_layer_release(aux, para0);

	case DISP_CMD_LAYER_OPEN:
		return BSP_disp_layer_open(aux, para0);

	case DISP_CMD_LAYER_CLOSE:
		return BSP_disp_layer_close(aux, para0);

	case DISP_CMD_LAYER_SET_FB:
		return BSP_disp_layer_set_framebuffer(aux, para0, (__disp_fb_t*)para1);

	case DISP_CMD_LAYER_GET_FB:
		return BSP_disp_layer_get_framebuffer(aux, para0, (__disp_fb_t*)para1);

	case DISP_CMD_LAYER_SET_SRC_WINDOW:
		return BSP_disp_layer_set_src_window(aux,para0, (__disp_rect_t*)para1);

	case DISP_CMD_LAYER_GET_SRC_WINDOW:
		return BSP_disp_layer_get_src_window(aux,para0, (__disp_rect_t*)para1);

	case DISP_CMD_LAYER_SET_SCN_WINDOW:
		return BSP_disp_layer_set_screen_window(aux,para0, (__disp_rect_t*)para1);

	case DISP_CMD_LAYER_GET_SCN_WINDOW:
		return BSP_disp_layer_get_screen_window(aux,para0, (__disp_rect_t*)para1);

	case DISP_CMD_LAYER_SET_PARA:
		return BSP_disp_layer_set_para(aux, para0, (__disp_layer_info_t *)para1);

	case DISP_CMD_LAYER_GET_PARA:
		return BSP_disp_layer_get_para(aux, para0, (__disp_layer_info_t *)para1);

	case DISP_CMD_LAYER_TOP:
		return BSP_disp_layer_set_top(aux, para0);

	case DISP_CMD_LAYER_BOTTOM:
		return BSP_disp_layer_set_bottom(aux, para0);

	case DISP_CMD_LAYER_ALPHA_ON:
		return BSP_disp_layer_alpha_enable(aux, para0, 1);

	case DISP_CMD_LAYER_ALPHA_OFF:
		return BSP_disp_layer_alpha_enable(aux, para0, 0);

	case DISP_CMD_LAYER_SET_ALPHA_VALUE:
		return BSP_disp_layer_set_alpha_value(aux, para0, para1);

	case DISP_CMD_LAYER_CK_ON:
		return BSP_disp_layer_colorkey_enable(aux, para0, 1);

	case DISP_CMD_LAYER_CK_OFF:
		return BSP_disp_layer_colorkey_enable(aux, para0, 0);

	case DISP_CMD_LAYER_SET_PIPE:
		return BSP_disp_layer_set_pipe(aux, para0, para1);

	case DISP_CMD_LAYER_GET_ALPHA_VALUE:
		return BSP_disp_layer_get_alpha_value(aux, para0);

	case DISP_CMD_LAYER_GET_ALPHA_EN:
		return BSP_disp_layer_get_alpha_enable(aux, para0);

	case DISP_CMD_LAYER_GET_CK_EN:
		return BSP_disp_layer_get_colorkey_enable(aux, para0);

	case DISP_CMD_LAYER_GET_PRIO:
		return BSP_disp_layer_get_piro(aux, para0);

	case DISP_CMD_LAYER_GET_PIPE:
		return BSP_disp_layer_get_pipe(aux, para0);

    case DISP_CMD_LAYER_SET_SMOOTH:
        return BSP_disp_layer_set_smooth(aux, para0,(__disp_video_smooth_t) para1);

    case DISP_CMD_LAYER_GET_SMOOTH:
        return BSP_disp_layer_get_smooth(aux, para0);


//----scaler----
	case DISP_CMD_SCALER_REQUEST:
		return BSP_disp_scaler_request();

	case DISP_CMD_SCALER_RELEASE:
		return BSP_disp_scaler_release(para0);

	case DISP_CMD_SCALER_EXECUTE:
		return BSP_disp_scaler_start(para0,(__disp_scaler_para_t *)para1);

//----hwc----
	case DISP_CMD_HWC_OPEN:
		return  BSP_disp_hwc_enable(aux, 1);

	case DISP_CMD_HWC_CLOSE:
		return  BSP_disp_hwc_enable(aux, 0);

	case DISP_CMD_HWC_SET_POS:
		return BSP_disp_hwc_set_pos(aux, (__disp_pos_t*)para0);

	case DISP_CMD_HWC_GET_POS:
		return BSP_disp_hwc_get_pos(aux, (__disp_pos_t *)para0);

	case DISP_CMD_HWC_SET_FB:
		return BSP_disp_hwc_set_framebuffer(aux, (__disp_hwc_pattern_t *)para0);

	case DISP_CMD_HWC_SET_PALETTE_TABLE:
		return BSP_disp_hwc_set_palette(aux, (void*)para0, para1, para2);


//----video----
	case DISP_CMD_VIDEO_START:
		return BSP_disp_video_start(aux, para0);

	case DISP_CMD_VIDEO_STOP:
		return BSP_disp_video_stop(aux, para0);

	case DISP_CMD_VIDEO_SET_FB:
		return BSP_disp_video_set_fb(aux, para0, (__disp_video_fb_t *)para1);

    case DISP_CMD_VIDEO_GET_FRAME_ID:
        return BSP_disp_video_get_frame_id(aux, para0);

    case DISP_CMD_VIDEO_GET_DIT_INFO:
        return BSP_disp_video_get_dit_info(aux, para0,(__disp_dit_info_t *)para1);

//----lcd----
	case DISP_CMD_LCD_ON:
		return DRV_lcd_open(aux);

	case DISP_CMD_LCD_OFF:
		return DRV_lcd_close(aux);

	case DISP_CMD_LCD_SET_BRIGHTNESS:
		return BSP_disp_lcd_set_bright(aux, para0);

	case DISP_CMD_LCD_GET_BRIGHTNESS:
		return BSP_disp_lcd_get_bright(aux);

	case DISP_CMD_LCD_CPUIF_XY_SWITCH:
		return BSP_disp_lcd_xy_switch(aux, para0);

	case DISP_CMD_LCD_SET_SRC:
		return BSP_disp_lcd_set_src(aux, (__disp_lcdc_src_t)para0);

	case DISP_CMD_LCD_CHECK_OPEN_FINISH:
		return DRV_lcd_check_open_finished(aux);

	case DISP_CMD_LCD_CHECK_CLOSE_FINISH:
		return DRV_lcd_check_close_finished(aux);


//----tv----
	case DISP_CMD_TV_ON:
		return BSP_disp_tv_open(aux);

	case DISP_CMD_TV_OFF:
		return BSP_disp_tv_close(aux);

	case DISP_CMD_TV_SET_MODE:
		return BSP_disp_tv_set_mode(aux, (__disp_tv_mode_t)para0);

	case DISP_CMD_TV_GET_MODE:
		return BSP_disp_tv_get_mode(aux);

	case DISP_CMD_TV_AUTOCHECK_ON:
		return BSP_disp_tv_auto_check_enable(aux);

	case DISP_CMD_TV_AUTOCHECK_OFF:
		return BSP_disp_tv_auto_check_disable(aux);

	case   DISP_CMD_TV_GET_INTERFACE:
		return BSP_disp_tv_get_interface(aux);

	case DISP_CMD_TV_SET_SRC:
		return BSP_disp_tv_set_src(aux, (__disp_lcdc_src_t)para0);

    case DISP_CMD_TV_GET_DAC_STATUS:
        return BSP_disp_tv_get_dac_status(aux, para0);

    case DISP_CMD_TV_SET_DAC_SOURCE:
        return BSP_disp_tv_set_dac_source(aux, para0, (__disp_tv_dac_source)para1);

    case DISP_CMD_TV_GET_DAC_SOURCE:
        return BSP_disp_tv_get_dac_source(aux, para0);

//----hdmi----
	case DISP_CMD_HDMI_ON:
		return BSP_disp_hdmi_open(aux);

	case DISP_CMD_HDMI_OFF:
		return BSP_disp_hdmi_close(aux);

	case DISP_CMD_HDMI_SET_MODE:
		return BSP_disp_hdmi_set_mode(aux, (__disp_tv_mode_t)para0);

	case DISP_CMD_HDMI_GET_MODE:
		return BSP_disp_hdmi_get_mode(aux);

	case DISP_CMD_HDMI_GET_HPD_STATUS:
	    return BSP_disp_hdmi_get_hpd_status(aux);

	case DISP_CMD_HDMI_SUPPORT_MODE:
		return BSP_disp_hdmi_check_support_mode(aux, para0);

	case DISP_CMD_HDMI_SET_SRC:
		return BSP_disp_hdmi_set_src(aux, (__disp_lcdc_src_t)para0);


//----vga----
	case DISP_CMD_VGA_ON:
		return BSP_disp_vga_open(aux);

	case DISP_CMD_VGA_OFF:
		return BSP_disp_vga_close(aux);

	case DISP_CMD_VGA_SET_MODE:
		return BSP_disp_vga_set_mode(aux, (__disp_vga_mode_t)para0);

	case DISP_CMD_VGA_GET_MODE:
		return BSP_disp_vga_get_mode(aux);

	case DISP_CMD_VGA_SET_SRC:
		return BSP_disp_vga_set_src(aux, (__disp_lcdc_src_t)para0);

//----sprite----
	case DISP_CMD_SPRITE_OPEN:
		return BSP_disp_sprite_open(aux);

	case DISP_CMD_SPRITE_CLOSE:
		return BSP_disp_sprite_close(aux);

	case DISP_CMD_SPRITE_SET_FORMAT:
		return BSP_disp_sprite_set_format(aux, (__disp_pixel_fmt_t)para0, (__disp_pixel_seq_t)para1);

	case DISP_CMD_SPRITE_GLOBAL_ALPHA_ENABLE:
		return BSP_disp_sprite_alpha_enable(aux);

	case DISP_CMD_SPRITE_GLOBAL_ALPHA_DISABLE:
		return BSP_disp_sprite_alpha_disable(aux);

	case DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_ENABLE:
		return BSP_disp_sprite_get_alpha_enable(aux);

	case DISP_CMD_SPRITE_SET_GLOBAL_ALPHA_VALUE:
		return BSP_disp_sprite_set_alpha_vale(aux, para0);

	case DISP_CMD_SPRITE_GET_GLOBAL_ALPHA_VALUE:
		return BSP_disp_sprite_get_alpha_value(aux);

	case DISP_CMD_SPRITE_SET_ORDER:
		return BSP_disp_sprite_set_order(aux, para0,para1);

	case DISP_CMD_SPRITE_GET_TOP_BLOCK:
		return BSP_disp_sprite_get_top_block(aux);

	case DISP_CMD_SPRITE_GET_BOTTOM_BLOCK:
		return BSP_disp_sprite_get_bottom_block(aux);

	case DISP_CMD_SPRITE_SET_PALETTE_TBL:
		return  BSP_disp_sprite_set_palette_table(aux, (__u32 * )para0,para1,para2);

	case DISP_CMD_SPRITE_GET_BLOCK_NUM:
		return BSP_disp_sprite_get_block_number(aux);

	case DISP_CMD_SPRITE_BLOCK_REQUEST:
		return BSP_disp_sprite_block_request(aux, (__disp_sprite_block_para_t*)para0);

	case DISP_CMD_SPRITE_BLOCK_RELEASE:
		return BSP_disp_sprite_block_release(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_SET_SCREEN_WINDOW:
		return BSP_disp_sprite_block_set_screen_win(aux, para0,(__disp_rect_t *)para1);

	case DISP_CMD_SPRITE_BLOCK_GET_SCREEN_WINDOW:
		return BSP_disp_sprite_block_get_srceen_win(aux, para0,(__disp_rect_t *)para1);

	case DISP_CMD_SPRITE_BLOCK_SET_SOURCE_WINDOW:
		return BSP_disp_sprite_block_set_src_win(aux, para0,(__disp_rect_t *)para1);

	case DISP_CMD_SPRITE_BLOCK_GET_SOURCE_WINDOW:
		return BSP_disp_sprite_block_get_src_win(aux, para0,(__disp_rect_t *)para1);

	case DISP_CMD_SPRITE_BLOCK_SET_FB:
		return BSP_disp_sprite_block_set_framebuffer(aux, para0,(__disp_fb_t *)para1);

	case DISP_CMD_SPRITE_BLOCK_GET_FB:
		return BSP_disp_sprite_block_get_framebufer(aux, para0,(__disp_fb_t *)para1);

	case DISP_CMD_SPRITE_BLOCK_SET_TOP:
		return BSP_disp_sprite_block_set_top(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_SET_BOTTOM:
		return BSP_disp_sprite_block_set_bottom(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_GET_PREV_BLOCK:
		return BSP_disp_sprite_block_get_pre_block(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_GET_NEXT_BLOCK:
		return BSP_disp_sprite_block_get_next_block(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_GET_PRIO:
		return BSP_disp_sprite_block_get_prio(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_OPEN:
		return BSP_disp_sprite_block_open(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_CLOSE:
		return BSP_disp_sprite_block_close(aux, para0);

	case DISP_CMD_SPRITE_BLOCK_SET_PARA:
		return BSP_disp_sprite_block_set_para(aux, para0,(__disp_sprite_block_para_t*)para1);

	case DISP_CMD_SPRITE_BLOCK_GET_PARA:
		return BSP_disp_sprite_block_get_para(aux, para0,(__disp_sprite_block_para_t*)para1);

	default:
	    __wrn("not supported display cmd:%x\n",cmd);
	    return eGON2_FAIL;
	}
}