诚心求 MTK功能机 RM68080 代码一份,谢谢!
static void init_lcm_registers(void)
{
unsigned int i,j;
#if 1
//************* Start Initial Sequence **********//
set_lcm_register(0x00F0, 0x0001);
set_lcm_register(0x00F2, 0x2010);
set_lcm_register(0x00F0, 0x0000);
set_lcm_register(0x0001, 0x0000);
set_lcm_register(0x0002, 0x0200);
set_lcm_register(0x0003, 0x1030);
set_lcm_register(0x0004, 0x0000);
set_lcm_register(0x0008, 0x0202);
set_lcm_register(0x0009, 0x0000);
set_lcm_register(0x000A, 0x0000);
set_lcm_register(0x000C, 0x0000);
set_lcm_register(0x000D, 0x0000);
set_lcm_register(0x000F, 0x0000);
MDELAY(10); // Delay 10 ms
//*************Power On sequence ****************//
set_lcm_register(0x0010, 0x0000);
set_lcm_register(0x0011, 0x0007);
set_lcm_register(0x0013, 0x0000);
set_lcm_register(0x0007, 0x0001);
set_lcm_register(0x0007, 0x0020);
MDELAY(200); // Dis-charge capacitor power voltage
set_lcm_register(0x0010, 0x1290);
set_lcm_register(0x0011, 0x0221);
MDELAY(50); // Delay 50ms
set_lcm_register(0x0012, 0x0082); // Internal reference voltage
MDELAY(10); // Delay 10ms
// ----------- Vcom set ----------//
set_lcm_register(0x0013, 0x1a00); // VDV[4:0] 0x1900//0x1c00//0x1a00
set_lcm_register(0x0029, 0x0022); // VCM[5:0] 0x002a//0x002b//0x0022//0x2b
set_lcm_register(0x002B, 0x000D); // Set Frame Rate
MDELAY(50); // Delay 50ms
set_lcm_register(0x0020, 0x0000); // GRAM horizontal Address
set_lcm_register(0x0021, 0x0000); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
set_lcm_register(0x0030, 0x0000);
set_lcm_register(0x0031, 0x0706);
set_lcm_register(0x0032, 0x0306);
set_lcm_register(0x0035, 0x0007);
set_lcm_register(0x0036, 0x1000);
set_lcm_register(0x0037, 0x0104);
set_lcm_register(0x0038, 0x0100);
set_lcm_register(0x0039, 0x0707);
set_lcm_register(0x003C, 0x0700);
set_lcm_register(0x003D, 0x0010);
//------------------ Set GRAM area ---------------//
set_lcm_register(0x0050, 0x0000); // Horizontal GRAM Start Address
set_lcm_register(0x0051, 0x00EF); // Horizontal GRAM End Address
set_lcm_register(0x0052, 0x0000); // Vertical GRAM Start Address
set_lcm_register(0x0053, 0x013F); // Vertical GRAM Start Address
set_lcm_register(0x0060, 0x3700); // Gate Scan Line
set_lcm_register(0x0061, 0x0001); // NDL,VLE, REV
set_lcm_register(0x006A, 0x0000); // set scrolling lin
send_ctrl_cmd(0x0022);
for(i=0;i<320;i++)
{
for(j=0;j<240;j++)
{
send_data_cmd(0x00);
// send_data_cmd(0x1f);
}
}
//-------------- Panel Control -------------------//
set_lcm_register(0x0090, 0x0010);
set_lcm_register(0x0092, 0x0000);
MDELAY(10); // Delay 10ms
set_lcm_register(0x0007, 0x0133); // display ON
send_ctrl_cmd(0x0022);
MDELAY(200);
//aa=aa-2;
#endif
}
// ---------------------------------------------------------------------------
// LCM Driver Implementations
// ---------------------------------------------------------------------------
static void lcm_set_util_funcs(const LCM_UTIL_FUNCS *util)
{
memcpy(&lcm_util, util, sizeof(LCM_UTIL_FUNCS));
}
static void lcm_get_params(LCM_PARAMS *params)
{
memset(params, 0, sizeof(LCM_PARAMS));
params->type = LCM_TYPE_DBI;
params->ctrl = LCM_CTRL_PARALLEL_DBI;
params->width = FRAME_WIDTH;
params->height = FRAME_HEIGHT;
params->io_select_mode = 3;
params->dbi.port = 0;
params->dbi.clock_freq = LCM_DBI_CLOCK_FREQ_52M;
params->dbi.data_width = LCM_DBI_DATA_WIDTH_16BITS;
params->dbi.data_format.color_order = LCM_COLOR_ORDER_RGB;
params->dbi.data_format.trans_seq = LCM_DBI_TRANS_SEQ_MSB_FIRST;
params->dbi.data_format.padding = LCM_DBI_PADDING_ON_LSB;
params->dbi.data_format.format = LCM_DBI_FORMAT_RGB565;
params->dbi.data_format.width = LCM_DBI_DATA_WIDTH_16BITS;
params->dbi.cpu_write_bits = LCM_DBI_CPU_WRITE_16_BITS;
params->dbi.io_driving_current = 0;
params->dbi.parallel.write_setup = 2;
params->dbi.parallel.write_hold = 2;
params->dbi.parallel.write_wait = 12;
params->dbi.parallel.read_setup = 2;
params->dbi.parallel.read_latency = 31;
params->dbi.parallel.wait_period = 4;
params->dbi.te_mode = LCM_DBI_TE_MODE_VSYNC_ONLY;
params->dbi.te_edge_polarity = LCM_POLARITY_RISING;
}
static void lcm_init(void)
{
SET_RESET_PIN(1);
MDELAY(1);
SET_RESET_PIN(0);
MDELAY(25);
SET_RESET_PIN(1);
MDELAY(150);
init_lcm_registers();
// MDELAY(200);
#ifdef BUILD_UBOOT
#else
printk("[lcm_init] rm68090\n");
#endif
}
static void lcm_suspend(void)
{
set_lcm_register(0x0007, 0x0131); // Set D1=0, D0=1
MDELAY(10); // Delay 10ms
set_lcm_register(0x0007, 0x0130); // Set D1=0, D0=0
MDELAY(10); // Delay 10ms
set_lcm_register(0x0007, 0x0000); // display OFF
//************* Power OFF sequence **************//
set_lcm_register(0x0010, 0x0080); // SAP, BT[3:0], APE, AP, DSTB, SLP
set_lcm_register(0x0011, 0x0000); // DC1[2:0], DC0[2:0], VC[2:0]
set_lcm_register(0x0012, 0x0000); // VREG1OUT voltage
set_lcm_register(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
MDELAY(50); // Dis-charge capacitor power voltage
set_lcm_register(0x0010, 0x0082); // SAP, BT[3:0], APE, AP, DSTB, SLP
}
static void lcm_resume(void)
{
lcm_init();
}
static void lcm_update(unsigned int x, unsigned int y,
unsigned int width, unsigned int height)
{
unsigned int x0 = x;
unsigned int y0 = y;
unsigned int x1 = x0 + width - 1;
unsigned int y1 = y0 + height - 1;
#if 1
// send_ctrl_cmd(0x00);
send_ctrl_cmd(0x50);
send_data_cmd(x0);
// send_ctrl_cmd(0x00);
send_ctrl_cmd(0x51);
send_data_cmd(x1);
//send_ctrl_cmd(0x00);
send_ctrl_cmd(0x52);
send_data_cmd(y0);
// send_ctrl_cmd(0x00);
send_ctrl_cmd(0x53);
send_data_cmd(y1);
//send_ctrl_cmd(0x00);
send_ctrl_cmd(0x20);
send_data_cmd(x0);
// send_ctrl_cmd(0x00);
send_ctrl_cmd(0x21);
send_data_cmd(y0);
// send_ctrl_cmd(0x00);
send_ctrl_cmd(0x22);
// Write To GRAM
#endif
}
虽然错了,但还是有我要的初始化,谢谢兄弟