基于OK6410的LCD操作
*((volatile unsigned long*)0x771000A0)
#define VIDW00ADD1B0 *((volatile unsigned long*)0x771000D0)
#define WPALCON *((volatile unsigned long *)0x771001A0)
#define FRAME_BUFFER 0x54000000
#define VBPD 1
#define VFPD 1
#define VSPW 9
#define HBPD 1
#define HFPD 1
#define HSPW 40
#define LINEVAL 271
#define HOZVAL 479
#define LeftTopX 0
#define LeftTopY 0
#define RightBotX 479
#define RightBotY 271
#define FRAME_BUFFER 0x54000000
extern unsigned char bmp[387368];
void lcd_port_init()
{
GPICON=0xaaaaaaaa;
GPJCON=0xaaaaaaaa;
}
void lcd_contral_init()
{
//[3]Select (mux) control for LCD bypass Normal mode
MIFPCON=(0<3);
SPCON=0x01;
//初始化使用的时钟HCLK到LCD,配置HSYNC和VSYNC位倒转(因为和三星的默认使用不同)
VIDCON0=(14<6)|(1<4)|(1<1)|(1<0);
VIDCON1=(1<6)|(1<5);
//配置VBPD,VFPD,VSPW,HBPD,HFPD,HSPW,LINEVAL,HOZVAL
VIDTCON0=(VBPD<16)|(VFPD<8)|(VSPW<0);
VIDTCON1=(HBPD<16)|(HFPD<8)|(HSPW<0);
VIDTCON2=(LINEVAL<11)|(HOZVAL<0);
//[16]Half-Word swap enable
WINCON0=(0<17)|(0<18)|(0<16)|(0xb<2)|(1<0);
//设置屏幕的起始地址(最左上角),终止地址(最左下角),屏幕大小
VIDOSD0A=(LeftTopX<11)|(LeftTopY<0);
VIDOSD0B=(RightBotX<11)|(RightBotY<0);
VIDOSD0C=(LINEVAL+1)|(HOZVAL+1);
//初始化写入起始地址和终止地址
VIDW00ADD0B0=FRAME_BUFFER;
VIDW00ADD1B0=((FRAME_BUFFER+(HOZVAL+1)*4*(LINEVAL+1)*4));
WPALCON=0b001; //110
}
void point(int row,int col,int color)
{
unsigned int red,green,blue;
unsigned long *point=(unsigned long*)FRAME_BUFFER;
red=(color>>16)&0xff;
green=(color>>8)&0xff;
blue=(color>>0)&0xff;
*(point + row*480 + col) = color;
}
void draw_bmp()
{
int i,j,t=8;
// unsigned char *p = (unsigned char *)bmp;
int red,green,blue;
int color;
for(i=0;i<272;i++)
{
for(j=0;j<480;j++)
{
red=bmp[t++];
green=bmp[t++];
blue=bmp[t++];
color=(red<16)|(green<8)|(blue<0);
point(i,j,color);
}
}
}
void lcd_init()
{
lcd_port_init();
lcd_contral_init();
}
void lcd_test()
{
int x,y;
draw_bmp();
}
OK6410LCD操 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)