예제 #1
0
파일: lcd_ili8961.c 프로젝트: mrtos/dv3251
void lcd_init(void) 
{
	deg_Printf("lcd_init spi_ili8961 \n");
	blcd_FrameEnd_Flag = 0;	
	blcd_writeback_Flag = 0;
	
	PIN_CONF()
	SPI_PIN_CONF()	  	

//====open lcd ldo=====
	REG32(SYS_CON) = 0x932B;	//SPEC request value
	REG32(LDO_ACON) |= 0x4;			// 3.0v
	REG32(LDO_ACON) |= (1<<3);		//lcd ldo enable
	deg_Printf("lcd ldo open \n");
	Delay_MS(100);
//====end open lcd ldo=====

	lcd_spirgb_timing_init(spi_ili8961);
    	lcd_spi_init(&table_init[0][0]);	

#if (USER_CONFIG==CONFIG_AX3251_K6000)
	reset_rgb_data_en(0xfe);			// data  7bit en  
#endif

	deg_Printf("Reg1=%x,%x,%x,%x,%x\n",REG32(PF_DIR),REG32(PG_DIR),REG32(PMAP_CFG0),REG32(LCD_CFG),REG32(LCD_CFG_EMI));
	
    spi_to_rgb(); 
	//REG32(LCDCON0)|=BIT(8)|BIT(13);//XJC
	SetIntSrc(LCD_INT);
	REG32(LCDCON0) |= 1<<10;	
}
static int hx8357a_hvga_panel_on(struct platform_device *pdev)
{
    if (!hx8357a_hvga_state.disp_initialized) 
    {
        hx8357a_hvga_reset();
        lcd_spi_init(lcdc_hx8357a_hvga_pdata);	/* LCD needs SPI */
        hx8357a_hvga_disp_powerup();
        hx8357a_hvga_disp_on();
        hx8357a_hvga_state.disp_initialized = TRUE;
        LCD_DEBUG("%s: hx8357a lcd initialized\n", __func__);
    } 
    else if (!hx8357a_hvga_state.display_on) 
    {
    	switch(lcd_panel_hvga)
    	{
    	    case LCD_HX8357A_TRULY_HVGA:
    	      /* Exit Standby Mode */
    	      process_lcdc_table((struct command*)&hx8357a_truly_hvga_standby_exit_table, ARRAY_SIZE(hx8357a_truly_hvga_standby_exit_table));
    	      break;
    	    
    	    case LCD_HX8357A_WINTEK_HVGA:
    	      /* Exit Standby Mode */
    	      process_lcdc_table((struct command*)&hx8357a_wintek_hvga_standby_exit_table, ARRAY_SIZE(hx8357a_wintek_hvga_standby_exit_table));
    	      break;
			default:
    	      break;
    	}
        LCD_DEBUG("%s: Exit Standby Mode\n", __func__);
        hx8357a_hvga_state.display_on = TRUE;
    }
    
    return 0;
}
static int hx8357c_hvga_panel_on(struct platform_device *pdev)
{
    boolean para_debug_flag = FALSE;
    uint32 para_num = 0;
    /* open debug file and read the para */
    switch(lcd_panel_hvga)
    {
        case LCD_HX8357C_TIANMA_HVGA:
            para_debug_flag = lcd_debug_malloc_get_para( "hx8357c_tianma_hvga_init_table", 
            (void**)&hx8357c_hvga_init_table,&para_num);
            break;
        default:
            break;
    }    
       
    if (!hx8357c_hvga_state.disp_initialized) 
    {
        hx8357c_hvga_reset();
        lcd_spi_init(lcdc_hx8357c_hvga_pdata);	/* LCD needs SPI */
        hx8357c_hvga_disp_powerup();
        hx8357c_hvga_disp_on(); 
        hx8357c_hvga_state.disp_initialized = TRUE;
        if( (TRUE == para_debug_flag) && (NULL != hx8357c_hvga_init_table))
        {
            // lcd_reset();
            process_lcdc_table(hx8357c_hvga_init_table, para_num,lcd_panel_hvga);
        }
        LCD_DEBUG("%s: hx8357c lcd initialized\n", __func__);
    } 
    else if (!hx8357c_hvga_state.display_on) 
    {
    	switch(lcd_panel_hvga)
    	{
    	    case LCD_HX8357C_TIANMA_HVGA:
                if( (TRUE == para_debug_flag)&&(NULL != hx8357c_hvga_init_table))
                {
                     //  lcd_reset();
                     process_lcdc_table(hx8357c_hvga_init_table, para_num,lcd_panel_hvga);

                }
                else
                {
                    /* Exit Standby Mode */
                    process_lcdc_table((struct sequence*)&hx8357c_tianma_hvga_standby_exit_table, 
                    	ARRAY_SIZE(hx8357c_tianma_hvga_standby_exit_table), lcd_panel_hvga);
                }
                break;			
            default:
                break;
    	}
         LCD_DEBUG("%s: Exit Standby Mode\n", __func__);
        hx8357c_hvga_state.display_on = TRUE;
    }
/* Must malloc before,then you can call free */
	if((TRUE == para_debug_flag)&&(NULL != hx8357c_hvga_init_table))
	{
		lcd_debug_free_para((void *)hx8357c_hvga_init_table);
	}
    return 0;
}
static int nt35410_hvga_panel_on(struct platform_device *pdev)
{
    boolean para_debug_flag = FALSE;
    uint32 para_num = 0;
	
    switch(lcd_panel_hvga)
    {
        case LCD_NT35410_CHIMEI_HVGA:
            para_debug_flag = lcd_debug_malloc_get_para( "lcdc_nt35410_hvga_init_table", 
            (void**)&lcdc_nt35410_hvga_init_table,&para_num);
            break;
        default:
            break;
    }    
	
    if (!nt35410_hvga_state.disp_initialized) 
    {
        nt35410_hvga_reset();
        lcd_spi_init(lcdc_nt35410_hvga_pdata);	/* LCD needs SPI */
        nt35410_hvga_disp_powerup();
        nt35410_hvga_disp_on();
        nt35410_hvga_state.disp_initialized = TRUE;
    	if((TRUE == para_debug_flag) && (NULL != lcdc_nt35410_hvga_init_table))
        {
            process_lcdc_table(lcdc_nt35410_hvga_init_table,para_num,lcd_panel_hvga);
        }

        LCD_DEBUG("%s: nt35410 lcd initialized\n", __func__);
    } 
    else if (!nt35410_hvga_state.display_on) 
    {
    	switch(lcd_panel_hvga)
    	{
    	    case LCD_NT35410_CHIMEI_HVGA:
    		if( (TRUE == para_debug_flag)&&(NULL != lcdc_nt35410_hvga_init_table))
            {
                process_lcdc_table(lcdc_nt35410_hvga_init_table,para_num,lcd_panel_hvga);

            }
    		else
    		{
    	    	/* Exit Standby Mode */
                process_lcdc_table((struct sequence*)&nt35410_chimei_hvga_standby_exit_table, 
                ARRAY_SIZE(nt35410_chimei_hvga_standby_exit_table),lcd_panel_hvga);
    		}
            break;
        default:
            break;
    	}
        LCD_DEBUG("%s: Exit Standby Mode\n", __func__);
        nt35410_hvga_state.display_on = TRUE;
    }
/* Must malloc before,then you can call free */
    if((TRUE == para_debug_flag)&&(NULL != lcdc_nt35410_hvga_init_table))
    {
         lcd_debug_free_para((void *)lcdc_nt35410_hvga_init_table);
    }
    return 0;
}
static int lcdc_s6d74a0_panel_on(struct platform_device *pdev)
{
	boolean para_debug_flag = FALSE;
	uint32 para_num = 0;

	LCD_DEBUG("ENTER lcdc_s6d74a0_panel_on\n");
	/* open debug file and read the para */
	switch(lcd_panel_hvga)
	{
		case LCD_S6D74A0_SAMSUNG_HVGA:
			para_debug_flag = lcd_debug_malloc_get_para( "s6d74a0_samsung_init_table", 
			(void**)&s6d74a0_samsung_init_table,&para_num);
			break;
		default:
			break;
	} 
	if(!lcd_s6d74a0_state.disp_initialized)
	{
		lcdc_s6d74a0_pdata->panel_config_gpio(1);
		lcd_reset_gpio = *(lcdc_s6d74a0_pdata->gpio_num + 4);		
		lcd_spi_init(lcdc_s6d74a0_pdata);	/* LCD needs SPI */
		lcd_s6d74a0_disp_powerup();
		lcd_s6d74a0_state.display_on = TRUE;
		lcd_s6d74a0_state.disp_initialized = TRUE;

	}
	else if(!lcd_s6d74a0_state.display_on)
	{
		switch(lcd_panel_hvga)
		{
		case LCD_S6D74A0_SAMSUNG_HVGA:
			if((TRUE == para_debug_flag)
				&&(NULL != s6d74a0_samsung_init_table))
			{
				//seriout(0x0010, 0x0000); the table should add this value on the front delete by zhangpeng 20110112
				process_lcdc_table(s6d74a0_samsung_init_table, para_num, LCD_S6D74A0_SAMSUNG_HVGA);
			}
			else
			{
				process_lcdc_table((struct sequence*)&s6d74a0_samsung_init, 
						ARRAY_SIZE(s6d74a0_samsung_init), LCD_S6D74A0_SAMSUNG_HVGA);	
			}
			break;
		default:
			break;
		}
		lcd_s6d74a0_state.display_on = TRUE;  
	}

	/* Must malloc before,then you can call free */
	if((TRUE == para_debug_flag)&&(NULL != s6d74a0_samsung_init_table))
	{
		lcd_debug_free_para((void *)s6d74a0_samsung_init_table);
	}
	return 0;	
	
}
예제 #6
0
파일: hp49gp.c 프로젝트: cdenix/psmame
ADDRESS_MAP_END

/***************************************************************************
    MACHINE DRIVERS
***************************************************************************/

static DRIVER_INIT( hp49gp )
{
	hp49gp_state *hp49gp = machine.driver_data<hp49gp_state>();
	UINT8 *rom = (UINT8 *)machine.region( "maincpu")->base();
	memcpy( hp49gp->m_steppingstone, rom, 1024);
	lcd_spi_init( machine);
}
예제 #7
0
파일: lcd_hal.c 프로젝트: Laxa/quals-2016
void commonInit(const unsigned char *cmdList) 
{
	colstart  = rowstart = 0; // May be overridden in init func

	lcd_spi_init();

	// Reset screen (TODO: Optimize this to reset faster)
	LCD_PORT |= LCD_RESET_BIT;
	delay_ms(500);
	LCD_PORT &= ~LCD_RESET_BIT;
	delay_ms(500);
	LCD_PORT |= LCD_RESET_BIT;
	delay_ms(500);

	if(cmdList) 
		commandList(cmdList);
}
static int lcdc_hx8357b_panel_on(struct platform_device *pdev)
{
	printk(KERN_INFO "%s\n", __func__);
    if (!lcd_hx8357b_state.disp_initialized) 
    {
        /* Configure reset GPIO that drives DAC */
        lcdc_hx8357b_pdata->panel_config_gpio(1);
        lcd_reset_gpio = *(lcdc_hx8357b_pdata->gpio_num + 4);
 
        lcd_spi_init(lcdc_hx8357b_pdata);	/* LCD needs SPI */
        lcd_hx8357b_disp_powerup();
        lcd_hx8357b_state.display_on = TRUE;
        lcd_hx8357b_state.disp_initialized = TRUE;
    }
    else if(!lcd_hx8357b_state.display_on)
    {
        lcd_hx8357b_panel_exit_sleep();
    }
    return 0;
}
static int lcd_ili9331b_panel_on(struct platform_device *pdev)
{

	if (!lcd_ili9331b_state.disp_initialized) 
    {
		/* Configure reset GPIO that drives DAC */
		lcd_ili9331b_pdata->panel_config_gpio(1);
		lcd_reset_gpio = *(lcd_ili9331b_pdata->gpio_num + 4);
        
		lcd_spi_init(lcd_ili9331b_pdata);	/* LCD needs SPI */
		lcd_ili9331b_disp_powerup();
		lcd_ili9331b_state.display_on = TRUE;
		lcd_ili9331b_state.disp_initialized = TRUE;
	}
    else if(!lcd_ili9331b_state.display_on)
    {
        lcd_ili9331b_disp_exit_sleep();
    }
	return 0;
}
예제 #10
0
static int hx8357a_panel_on(struct platform_device *pdev)
{
    if (!hx8357a_state.disp_initialized) 
    {
        hx8357a_reset();
        lcd_spi_init(lcdc_hx8357a_pdata);	/* LCD needs SPI */
        hx8357a_disp_powerup();
        hx8357a_disp_on();
        hx8357a_state.disp_initialized = TRUE;
        LCD_DEBUG("%s: hx8357a lcd initialized\n", __func__);
    } 
    else if (!hx8357a_state.display_on) 
    {
        /* Exit Standby Mode */
        process_lcdc_table((struct command*)&hx8357a_standby_exit_table, ARRAY_SIZE(hx8357a_standby_exit_table));
        LCD_DEBUG("%s: Exit Standby Mode\n", __func__);
        hx8357a_state.display_on = TRUE;
    }
    
    return 0;
}
static int truly_r61529_hvga_panel_on(struct platform_device *pdev)
{
	boolean para_debug_flag = FALSE;
	uint32 para_num = 0;
	/* open debug file and read the para */
	switch(lcd_panel_hvga)
	{
		case LCD_R61529_TRULY_HVGA:
			para_debug_flag = lcd_debug_malloc_get_para( "truly_r61529_hvga_init_table", 
			(void**)&truly_r61529_hvga_init_table,&para_num);
			break;
		default:
			break;
	}    
       
	if (!truly_r61529_hvga_state.disp_initialized) 
	{
		truly_r61529_hvga_reset();
		lcd_spi_init(lcdc_truly_r61529_hvga_pdata);	/* LCD needs SPI */
		truly_r61529_hvga_disp_powerup();
		truly_r61529_hvga_disp_on(); 
		truly_r61529_hvga_state.disp_initialized = TRUE;
		if( (TRUE == para_debug_flag) && (NULL != truly_r61529_hvga_init_table))
		{
			// lcd_reset();
			process_lcdc_table(truly_r61529_hvga_init_table, para_num,lcd_panel_hvga);
		}
		LCD_DEBUG("%s: truly r61529  lcd initialized\n", __func__);
	} 
	else if (!truly_r61529_hvga_state.display_on) 
	{
		switch(lcd_panel_hvga)
		{
			case LCD_R61529_TRULY_HVGA:
				if( (TRUE == para_debug_flag)&&(NULL != truly_r61529_hvga_init_table))
				{
					//lcd_reset();
					process_lcdc_table(truly_r61529_hvga_init_table, para_num,lcd_panel_hvga);
				}
				else
				{
					/* Exit Standby Mode */
					process_lcdc_table((struct sequence*)&truly_r61529_hvga_standby_exit_table, 
					ARRAY_SIZE(truly_r61529_hvga_standby_exit_table), lcd_panel_hvga);
				}
				/* we use this function to set low to the SPI CS pin 
				 * to ensure this LCD can enter sleep mode and be waken up
				 */
				truly_r61529_set_cs(lcdc_truly_r61529_hvga_pdata);		
				break;
			default:
				break;
		}
		LCD_DEBUG("%s: Exit Standby Mode\n", __func__);
		truly_r61529_hvga_state.display_on = TRUE;
	}
	/* Must malloc before,then you can call free */
	if((TRUE == para_debug_flag)&&(NULL != truly_r61529_hvga_init_table))
	{
		lcd_debug_free_para((void *)truly_r61529_hvga_init_table);
	}
	return 0;
}
예제 #12
0
파일: lcd_basic.c 프로젝트: RGassmann/FRDM
/*! \brief Initialize the LCD.
 *
 *  The LCD is reset and initialized with all predefined settings.
 */
void lcd_init(void)
{

lcd_spi_init();

    lcd_reset_on();
	//R_ESET=1;
	//for(i=120; i > 0; i--);
	delay_ms(1);
	lcd_reset_off();
	delay_ms(10);
	//for(i=1200; i > 0; i--);
	lcd_reset_on();
	delay_ms(1000);
	//for(i=12000; i > 0; i--);

static const uint8_t init_commands[] = {
	4, 0xEF, 0x03, 0x80, 0x02,
	4, 0xCF, 0x00, 0XC1, 0X30,
	5, 0xED, 0x64, 0x03, 0X12, 0X81,
	4, 0xE8, 0x85, 0x00, 0x78,
	6, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02,
	2, 0xF7, 0x20,
	3, 0xEA, 0x00, 0x00,
	2, ILI9341_PWCTR1, 0x23, // Power control
	2, ILI9341_PWCTR2, 0x10, // Power control
	3, ILI9341_VMCTR1, 0x3e, 0x28, // VCM control
	2, ILI9341_VMCTR2, 0x86, // VCM control2
	2, ILI9341_MADCTL, 0x48, // Memory Access Control
	2, ILI9341_PIXFMT, 0x55,
	3, ILI9341_FRMCTR1, 0x00, 0x18,
	4, ILI9341_DFUNCTR, 0x08, 0x82, 0x27, // Display Function Control
	2, 0xF2, 0x00, // Gamma Function Disable
	2, ILI9341_GAMMASET, 0x01, // Gamma curve selected
	16, ILI9341_GMCTRP1, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08,
		0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, // Set Gamma
	16, ILI9341_GMCTRN1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07,
		0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, // Set Gamma
	0
};


const uint8_t *addr = init_commands;
	while (1) {
		uint8_t count = *addr++;
		if (count-- == 0) break;
		writecommand_cont(*addr++);
		while (count-- > 0) {
			writedata8_cont(*addr++);
		}
	}
	writecommand_last(ILI9341_SLPOUT);    // Exit Sleep

	writecommand_last(ILI9341_DISPON); // Display on


    /*lcd_send_cmd(ILI9341_PWCTRA);
        lcd_send_data(0x39);
        lcd_send_data(0x2C);
        lcd_send_data(0x00);
        lcd_send_data(0x34);
        lcd_send_data(0x02);

    lcd_send_cmd(ILI9341_PWCTRB);
        lcd_send_data(0x00);
        lcd_send_data(0X81);
        lcd_send_data(0X30);

    lcd_send_cmd(ILI9341_DRVTCTRA);
        lcd_send_data(0x85);
        lcd_send_data(0x00);
        lcd_send_data(0x78);

    lcd_send_cmd(ILI9341_DRVTCTRB);
        lcd_send_data(0x66);
        lcd_send_data(0x00);

    lcd_send_cmd(ILI9341_PWRONCTR);
        lcd_send_data(0x55);
        lcd_send_data(0x01);
        lcd_send_data(0X23);
        lcd_send_data(0X01);

    lcd_send_cmd(ILI9341_PMPRTCTR);
        lcd_send_data(0x10);

    lcd_send_cmd(ILI9341_PWCTR1);    //Power control
        lcd_send_data(0x21);   //VRH[5:0]

    lcd_send_cmd(ILI9341_PWCTR2);    //Power control
        lcd_send_data(0x10);   //SAP[2:0];BT[3:0]

    lcd_send_cmd(ILI9341_VMCTR1);    //VCM control
        lcd_send_data(0x31);
        lcd_send_data(0x3C);

    lcd_send_cmd(ILI9341_VMCTR2);    //VCM control2
        lcd_send_data(0xC0);  //--0x86

    lcd_set_Orientation(rot0);


    lcd_send_cmd(ILI9341_PIXFMT);
        lcd_send_data(0x55);

    lcd_send_cmd(ILI9341_FRMCTR1);
        lcd_send_data(0x00);
        lcd_send_data(0x11);

    lcd_send_cmd(ILI9341_FRMCTR2);
        lcd_send_data(0x00);
        lcd_send_data(0x11);

    lcd_send_cmd(ILI9341_FRMCTR3);
        lcd_send_data(0x00);
        lcd_send_data(0x11);

    lcd_send_cmd(ILI9341_DFUNCTR);    // Display Function Control
        lcd_send_data(0x08);
        lcd_send_data(0x82);
        lcd_send_data(0x27);

    lcd_send_cmd(0xF2);    // 3Gamma Function Disable
        lcd_send_data(0x02);

    lcd_send_cmd(ILI9341_GAMMASET);    //Gamma curve selected
        lcd_send_data(0x01);

    lcd_send_cmd(ILI9341_SLPOUT);    //Exit Sleep*/

        delay_ms(100);

   // lcd_send_cmd(ILI9341_DISPON);    //Display on
  //  lcd_send_cmd(ILI9341_RAMWR);
}