s5pv210 LCD控制器功能模块框图:
初始化中对寄存器的配置:
(1)VIDCON0:时钟信号配置
(2)VIDCON1:信号极性设置
(3)VIDTCON0:VSYNC时序配置
(4)VIDTCON1:HSYNC时序配置
(5)VIDTCON2:像素设置
(6)WINCON0:设置像素对应数据的特征
(7)SHODOWCON:通道使能
(8)VIDOSD0A:窗口在LCD屏幕中左上角坐标的定位
(9)VIDOSD0B:设置窗口在LCD屏幕中右下角坐标的定位
(10)VIDOSD0C:确定窗口的大小
(11)VIDW00ADD0B0:framebuffer的起始地址设置
(12)VIDW00ADD1B0:framebuffer的末位地址设置
(13)VID00ADD2:设置framebuffer在虚拟屏幕中的偏移量和尺寸,用于反推framebuffer的末位地址
(14)DISPLAY_CONTROL:选择模式输出
初始化源码参考:
#include "stdio.h" #include "s5pv210.h" void lcd_PortInit() { rGPF0CON =0x22222222; rGPF1CON =0x22222222; rGPF2CON =0x22222222; rGPF3CON =0x22222222; } void lcd_Init() { //VIDCON0[0:1]=0B11;[2]=0;[4]=1;[6:13]=4;[26:28]=000; rVIDCON0 |= (0X3<<0); rVIDCON0 &= ~(0X1<<2); rVIDCON0 |= (0X1<<4); rVIDCON0 &= ~(0XFF<<6); rVIDCON0 |= (0X4<<6); rVIDCON0 &= ~(0X7<<26); //VIDCON1[4]=0;[5]=1;[6]=1; rVIDCON1 &= ~(0X1<<4); //Specifies the VDEN signal polarity rVIDCON1 |= (0X1<<5); //Specifies the VSYNC pulse polarity. rVIDCON1 |= (0X1<<6); //Specifies the HSYNC pulse polarity //VIDTCON0[0:7]=19;[8:15]=21;[16:23]=2; rVIDTCON0 &= ~(0XFF<<0); //VSPW rVIDTCON0 |= (0X13<<0); rVIDTCON0 &= ~(0XFF<<8); //VFPD rVIDTCON0 |= (0X15<<8); rVIDTCON0 &= ~(0XFF<<16); //VBPD rVIDTCON0 |= (0X2<<16); //VIDTCON1[0:7]=39;[8:15]=29;[16:23]=5; rVIDTCON1 &= ~(0XFF<<0); //HSPW rVIDTCON1 |= (0X27<<0); rVIDTCON1 &= ~(0XFF<<8); //HFPD rVIDTCON1 |= (0X1D<<8); rVIDTCON1 &= ~(0XFF<<16); //HBPD rVIDTCON1 |= (0X5<<16); //VIDTCON2[0:10]=799;[11:21]=479;Determines the size of display rVIDTCON2 &= ~(0X7FF<<0); rVIDTCON2 |= (0X31F); //HOZVAL = (Horizontal display size) -1 rVIDTCON2 &= ~(0X7FF<<11); rVIDTCON2 |= (0X1DF<<11); //LINEVAL = (Vertical display size) –1 //WINCON0[0]=1;[2:5]=0XB;[15]=1; rWINCON0 |= (0X1<<0); rWINCON0 &= ~(0XF<<2); rWINCON0 |= (0XB<<2); //1011 = Unpacked 24 bpp ( non-palletized R:8-G:8-B:8 ) rWINCON0 |= (0X1<<15); //Specifies the Word swap control bit //SHADOWCON[0]=1; rSHADOWCON |= (0X1<<0); //Enables Channel 0 //VIDOSD0A[0:10]=0;[11:21]=0; rVIDOSD0A &= ~(0X7FF<<0); //Specifies the vertical screen coordinate for left top pixel of OSD image rVIDOSD0A &= ~(0X7FF<<11); //Specifies the horizontal screen coordinate for left top pixel of OSD image. //VIDOSD0B[0:10]=479;[11:21]=799; rVIDOSD0B &= ~(0X7FF<<0); rVIDOSD0B |= (0X1DF<<0); rVIDOSD0B &= ~(0X7FF<<11); rVIDOSD0B |= (0X31F<<11); //VIDOSD0C[0:23]=800*480 rVIDOSD0C &= ~(0XFFFFFF); rVIDOSD0C |= (0X5DC00); //Specifies the Window Size //VIDW00ADD0B0[0:31]=0X42000000 rVIDW00ADD0B0 &= ~(0XFFFFFFFF); rVIDW00ADD0B0 |= (0X42000000); // Specifies window 0’s buffer start address //VIDW00ADD1B0[0:31]=0X4200000+800*480*4 rVIDW00ADD1B0 &= ~(0XFFFFFFFF); rVIDW00ADD1B0 |= (0X42177000); //Specifies window 0’s buffer end address //VIDW00ADD2[0:12]=800;[13:25]=0; rVIDW00ADD2 &= ~(0X3FFFFFF); rVIDW00ADD2 |= (0X320<<0); //DISPLAY_CONTROL[0:1]=0B10 rDISPLAY_CONTROL &= ~(0X3<<0); rDISPLAY_CONTROL |= (0X1<<1); //10: RGB=FIMD I80=FIMD ITU=FIMD } void delay() { int i,j; for(i=0;i<100;i++) for(j=0;j<100;j++); } void lcd_screen(int i,int j,int i1,int j1,int color) //(i,j) is the site of the focus. { unsigned int *fbuf =(unsigned int *)0x42000000; int x,y; for(y=0;y<480;y++) { for(x=0;x<800;x++) { if(((x-i)*(x-i)+(y-j)*(y-j))<=900) *(fbuf+800*y+x)=0xffff00; else if(((x-i1)*(x-i1)+(y-j1)*(y-j1))<=900) *(fbuf+800*y+x)=0x00ffff; else *(fbuf+800*y+x)=color; } } delay(); } int fimd_lcd() { int x=400,y=240,x1=400,y1=240,flag_x=1,flag_y=1,flag_x1=1,flag_y1=1; lcd_PortInit(); lcd_Init(); while(1) { if(x==30) flag_x=1; //x have to increase if(x==770) flag_x=0; //x have to decrease if(y==30) flag_y=1; //y have to increase if(y==450) flag_y=0; //y have to decrease if(x1==30) flag_x1=1; //x1 have to increase if(x1==770) flag_x1=0; //x1 have to decrease if(y1==30) flag_y1=1; //y1have to increase if(y1==450) flag_y1=0; //y1 have to decrease if(flag_x) x=x+2; else x-=2; if(flag_y) y++; else y--; if(flag_x1) x1++; else x1--; if(flag_y1) y1=y1+2; else y1=y1-2; lcd_screen(x,y,x1,y1,0xffffff); } return 0; }