예제 #1
0
static void disp_drv_init_ctrl_if(void)
{
    const LCM_DBI_PARAMS *dbi = &(lcm_params->dbi);

	if(lcm_params == NULL)
		return;

    switch(lcm_params->ctrl)
    {
    case LCM_CTRL_NONE :
    case LCM_CTRL_GPIO : return;

    case LCM_CTRL_SERIAL_DBI :
        ASSERT(dbi->port <= 1);
        ctrl_if = LCD_IF_SERIAL_0 + dbi->port;
        LCD_ConfigSerialIF(ctrl_if,
									 (LCD_IF_SERIAL_BITS)dbi->data_width,
									 dbi->serial.sif_3wire,
									 dbi->serial.sif_sdi,
									 dbi->serial.sif_1st_pol,
									 dbi->serial.sif_sck_def,
									 dbi->serial.sif_div2,
									 dbi->serial.sif_hw_cs,
									 dbi->serial.css,
									 dbi->serial.csh,
									 dbi->serial.rd_1st,
									 dbi->serial.rd_2nd,
									 dbi->serial.wr_1st,
									 dbi->serial.wr_2nd);

        break;
        
    case LCM_CTRL_PARALLEL_DBI :
        ASSERT(dbi->port <= 2);
        ctrl_if = LCD_IF_PARALLEL_0 + dbi->port;
        LCD_ConfigParallelIF(ctrl_if,
                             (LCD_IF_PARALLEL_BITS)dbi->data_width,
                             (LCD_IF_PARALLEL_CLK_DIV)dbi->clock_freq,
                             dbi->parallel.write_setup,
                             dbi->parallel.write_hold,
                             dbi->parallel.write_wait,
                             dbi->parallel.read_setup,
							 dbi->parallel.read_hold,
                             dbi->parallel.read_latency,
                             dbi->parallel.wait_period,
							 dbi->parallel.cs_high_width);
        break;

    default : ASSERT(0);
    }

    LCD_CHECK_RET(LCD_SelectWriteIF(ctrl_if));

    LCD_CHECK_RET(LCD_ConfigIfFormat(dbi->data_format.color_order,
                                     dbi->data_format.trans_seq,
                                     dbi->data_format.padding,
                                     dbi->data_format.format,
                                     to_lcd_if_width(dbi->data_format.width)));
}
int disphal_init_ctrl_if(void)
{
    const LCM_DBI_PARAMS *dbi = NULL;

    if(lcm_params== NULL)
        return -1;

    dbi = &(lcm_params->dbi);
    switch(lcm_params->ctrl)
    {
    case LCM_CTRL_NONE :
    case LCM_CTRL_GPIO :
    	return 0;

    case LCM_CTRL_SERIAL_DBI :
        ASSERT(dbi->port <= 1);
        LCD_CHECK_RET(LCD_Init());
        ctrl_if = LCD_IF_SERIAL_0 + dbi->port;
#if (MTK_LCD_HW_SIF_VERSION == 1)
        LCD_ConfigSerialIF(ctrl_if,
            (LCD_IF_SERIAL_BITS)dbi->data_width,
            dbi->serial.clk_polarity,
            dbi->serial.clk_phase,
            dbi->serial.cs_polarity,
            dbi->serial.clock_base,
            dbi->serial.clock_div,
            dbi->serial.is_non_dbi_mode);
#else    ///(MTK_LCD_HW_SIF_VERSION == 2)
        LCD_ConfigSerialIF(ctrl_if,
            (LCD_IF_SERIAL_BITS)dbi->data_width,
            dbi->serial.sif_3wire,
            dbi->serial.sif_sdi,
            dbi->serial.sif_1st_pol,
            dbi->serial.sif_sck_def,
            dbi->serial.sif_div2,
            dbi->serial.sif_hw_cs,
            dbi->serial.css,
            dbi->serial.csh,
            dbi->serial.rd_1st,
            dbi->serial.rd_2nd,
            dbi->serial.wr_1st,
            dbi->serial.wr_2nd);
#endif
        break;

    case LCM_CTRL_PARALLEL_DBI :
        ASSERT(dbi->port <= 2);
        LCD_CHECK_RET(LCD_Init());
        ctrl_if = LCD_IF_PARALLEL_0 + dbi->port;
        LCD_ConfigParallelIF(ctrl_if,
            (LCD_IF_PARALLEL_BITS)dbi->data_width,
            (LCD_IF_PARALLEL_CLK_DIV)dbi->clock_freq,
            dbi->parallel.write_setup,
            dbi->parallel.write_hold,
            dbi->parallel.write_wait,
            dbi->parallel.read_setup,
            dbi->parallel.read_hold,
            dbi->parallel.read_latency,
            dbi->parallel.wait_period,
            dbi->parallel.cs_high_width);
        break;

    default : ASSERT(0);
    }

    LCD_CHECK_RET(LCD_SelectWriteIF(ctrl_if));

    LCD_CHECK_RET(LCD_ConfigIfFormat(dbi->data_format.color_order,
        dbi->data_format.trans_seq,
        dbi->data_format.padding,
        dbi->data_format.format,
        to_lcd_if_width(dbi->data_format.width)));
    return 0;
}