ok6410之lcd驱动程序设计
2014-07-15 17:30
337 查看
#define GPICON (*((volatile unsigned long*)0x7F008100))
#define GPJCON (*((volatile unsigned long*)0x7F008120))
#define MOFPCON (*((volatile unsigned long*)0x7410800C))
#define SPCON (*((volatile unsigned long*)0x7F0081A0))
#define VIDCON0 (*((volatile unsigned long*)0x77100000))
#define VIDCON1 (*((volatile unsigned long*)0x77100004))
#define VIDTCON0 (*((volatile unsigned long*)0x77100010))
#define VIDTCON1 (*((volatile unsigned long*)0x77100014))
#define VIDTCON2 (*((volatile unsigned long*)0x77100018))
#define WINCON0 (*((volatile unsigned long*)0x77100020))
#define VIDOSD0A (*((volatile unsigned long*)0x77100040))
#define VIDOSD0B (*((volatile unsigned long*)0x77100044))
#define VIDOSD0C (*((volatile unsigned long*)0x77100048))
#define VIDW00ADD0B0 (*((volatile unsigned long*)0x771000A0))
#define VIDW00ADD1B0 (*((volatile unsigned long*)0x771000D0))
//以下时序是在4.3寸屏手册中查找的
#define VSPW 9
#define VBPD 1
#define LINEVAL 271
#define VFPD 1
#define HSPW 40
#define HBPD 1
#define HOZVAL 479
#define HFPD 1
#define LeftTopX 0
#define LeftTopY 0
#define RightBotX 479
#define RigntBotY 271
#define FRAME_BUFFER 0x59000000 //如果是58000000和50000000的话就只会显示上一半;
void lcd_port_init()
{
GPICON = 0xaaaaaaaa;
GPJCON = 0xaaaaaa;
}
void lcd_control_init()
{
MOFPCON = 0<<3;
SPCON = 0x01;
VIDCON0 = (14<<6) |(1<<4);
VIDCON1 = 1<<5 | 1<<6;
VIDTCON0 = (VBPD<<16)|(VFPD<<8)|(VSPW<<0);
VIDTCON1 = (HBPD<<16)|(HFPD<<8)|(HSPW<<0);
VIDTCON2 = (LINEVAL<<11) |(HOZVAL<<0);
//24bpp 24位真彩色
WINCON0 = (1<<16)|(0xb<<2)|(1<<0);
VIDOSD0A = (LeftTopX<<11) |(LeftTopY<<0);
VIDOSD0B = (RightBotX<<11)|(RigntBotY<<0);
VIDOSD0C = (LINEVAL+1)*(HOZVAL+1);
VIDW00ADD0B0 = FRAME_BUFFER; //下面的*4有点模糊,
VIDW00ADD1B0 = (FRAME_BUFFER+((HOZVAL+1)*4+0)*(LINEVAL+1))&(0xffffff);
//VIDW00ADD1B0 = (FRAME_BUFFER+((HOZVAL+1)+0)*(LINEVAL+1))&(0xffffff);
}
void lcd_init()
{
lcd_port_init();
lcd_control_init();
}
void point(int row, int col, int color)
{
unsigned long *point = (unsigned long*)FRAME_BUFFER;
*(point + row*480+col) = color;//不咋懂!
//p[row][col] = color;
}
extern unsigned char bmp[135300];
/*void lcd_bmp( const unsigned char bmp)
{
int x,y;
int color;
unsigned char *p = (unsigned char *)bmp;
int red,green,blue;
for(y=0;y<240;y++)
for(x=0;x<240;x++)
{
blue = *p++;
green = *p++;
red = *p++;
color = (red<<18)|(green<<10)|(blue<<2);
point(x,y,color);
}
}*/
void lcd_bmp( unsigned char gImage_bmp[])
{
int i, j;
unsigned char *p = gImage_bmp;
int blue, green, red;
int color;
// 图片大小220x205像素
for (i = 0; i < 205; i++)
for (j = 0; j < 220; j++) //注意在这的205和220,我测试时用的其他或大或小的值都显示不正常!
{
red = *p++;
green = *p++;
blue = *p++;
//green = *p++;
// D[23:16] = Red data, D[15:8] = Green data,D[7:0] = Blue data
color = (red << 16)| (green << 8)|( blue << 0);
point(i, j, color);
/*unsigned long *point = FRAME_BUFFER;
*(point+ i*480+j) = color;*/ //也行!
}
}
void lcd_clean(unsigned int color )
{
int x,y;
for(x=0;x<272;x++)
for(y=0;y<480;y++)
point(x,y,color);
}
void lcd_test()
{
int y,x;
for(y=100;y<380;y++)
for(x=100;x<270;x++)
point(210,y,0xFFFF00);
lcd_bmp(bmp);
lcd_clean(0x0000ff);
}
#define GPJCON (*((volatile unsigned long*)0x7F008120))
#define MOFPCON (*((volatile unsigned long*)0x7410800C))
#define SPCON (*((volatile unsigned long*)0x7F0081A0))
#define VIDCON0 (*((volatile unsigned long*)0x77100000))
#define VIDCON1 (*((volatile unsigned long*)0x77100004))
#define VIDTCON0 (*((volatile unsigned long*)0x77100010))
#define VIDTCON1 (*((volatile unsigned long*)0x77100014))
#define VIDTCON2 (*((volatile unsigned long*)0x77100018))
#define WINCON0 (*((volatile unsigned long*)0x77100020))
#define VIDOSD0A (*((volatile unsigned long*)0x77100040))
#define VIDOSD0B (*((volatile unsigned long*)0x77100044))
#define VIDOSD0C (*((volatile unsigned long*)0x77100048))
#define VIDW00ADD0B0 (*((volatile unsigned long*)0x771000A0))
#define VIDW00ADD1B0 (*((volatile unsigned long*)0x771000D0))
//以下时序是在4.3寸屏手册中查找的
#define VSPW 9
#define VBPD 1
#define LINEVAL 271
#define VFPD 1
#define HSPW 40
#define HBPD 1
#define HOZVAL 479
#define HFPD 1
#define LeftTopX 0
#define LeftTopY 0
#define RightBotX 479
#define RigntBotY 271
#define FRAME_BUFFER 0x59000000 //如果是58000000和50000000的话就只会显示上一半;
void lcd_port_init()
{
GPICON = 0xaaaaaaaa;
GPJCON = 0xaaaaaa;
}
void lcd_control_init()
{
MOFPCON = 0<<3;
SPCON = 0x01;
VIDCON0 = (14<<6) |(1<<4);
VIDCON1 = 1<<5 | 1<<6;
VIDTCON0 = (VBPD<<16)|(VFPD<<8)|(VSPW<<0);
VIDTCON1 = (HBPD<<16)|(HFPD<<8)|(HSPW<<0);
VIDTCON2 = (LINEVAL<<11) |(HOZVAL<<0);
//24bpp 24位真彩色
WINCON0 = (1<<16)|(0xb<<2)|(1<<0);
VIDOSD0A = (LeftTopX<<11) |(LeftTopY<<0);
VIDOSD0B = (RightBotX<<11)|(RigntBotY<<0);
VIDOSD0C = (LINEVAL+1)*(HOZVAL+1);
VIDW00ADD0B0 = FRAME_BUFFER; //下面的*4有点模糊,
VIDW00ADD1B0 = (FRAME_BUFFER+((HOZVAL+1)*4+0)*(LINEVAL+1))&(0xffffff);
//VIDW00ADD1B0 = (FRAME_BUFFER+((HOZVAL+1)+0)*(LINEVAL+1))&(0xffffff);
}
void lcd_init()
{
lcd_port_init();
lcd_control_init();
}
void point(int row, int col, int color)
{
unsigned long *point = (unsigned long*)FRAME_BUFFER;
*(point + row*480+col) = color;//不咋懂!
//p[row][col] = color;
}
extern unsigned char bmp[135300];
/*void lcd_bmp( const unsigned char bmp)
{
int x,y;
int color;
unsigned char *p = (unsigned char *)bmp;
int red,green,blue;
for(y=0;y<240;y++)
for(x=0;x<240;x++)
{
blue = *p++;
green = *p++;
red = *p++;
color = (red<<18)|(green<<10)|(blue<<2);
point(x,y,color);
}
}*/
void lcd_bmp( unsigned char gImage_bmp[])
{
int i, j;
unsigned char *p = gImage_bmp;
int blue, green, red;
int color;
// 图片大小220x205像素
for (i = 0; i < 205; i++)
for (j = 0; j < 220; j++) //注意在这的205和220,我测试时用的其他或大或小的值都显示不正常!
{
red = *p++;
green = *p++;
blue = *p++;
//green = *p++;
// D[23:16] = Red data, D[15:8] = Green data,D[7:0] = Blue data
color = (red << 16)| (green << 8)|( blue << 0);
point(i, j, color);
/*unsigned long *point = FRAME_BUFFER;
*(point+ i*480+j) = color;*/ //也行!
}
}
void lcd_clean(unsigned int color )
{
int x,y;
for(x=0;x<272;x++)
for(y=0;y<480;y++)
point(x,y,color);
}
void lcd_test()
{
int y,x;
for(y=100;y<380;y++)
for(x=100;x<270;x++)
point(210,y,0xFFFF00);
lcd_bmp(bmp);
lcd_clean(0x0000ff);
}
相关文章推荐
- ok6410学习笔记(18.linux串口驱动程序设计)
- 木其工作室(专业程序代写服务)[原]ok6410学习笔记(18.linux串口驱动程序设计)
- ok6410学习笔记(18.linux串口驱动程序设计)
- OK6410 LCD驱动移植
- 关于ok6410 LED and BEEP驱动程序之我见
- ok6410LCD测试程序
- 让OK6410 linux支持自己的LCD
- 嵌入式LCD驱动程序设计(转)
- ok6410 4.3寸lcd 时间参数的设定
- 嵌入式Linux下的LCD驱动程序设计与实现
- 嵌入式Linux下的LCD驱动程序设计与实现
- OK6410按键驱动程序(改)亲测可以运行
- OK6410之ADC驱动程序 字符设备驱动
- LCD驱动程序设计
- OK6410之ADC驱动程序 混杂设备
- lcd裸机驱动程序设计
- ok6410LCD测试程序
- LCD configuration of OK6410
- 飞凌OK6410之LCD的学习
- OK6410按键驱动程序(Linux),测试通过后分享给大家