进行逐行扫描RGB的数值,显现出来。图片需要通过image2lcd工具,转为字符数组那样的格式。它每3个值为RGB颜色值,然后放入include文件夹,然后导入即可。
board/fimd_lcd.c
#include "stdio.h"
#include "s5pv210.h"
#include "img1.h"
unsigned int *fbuf = (unsigned int *)0x42000000;
unsigned int *fbufs;
void key_init(){
rGPH2CON &= (0x0<<0);
rGPH2DAT |= (0x1<<0);
}
void lcd_PortInit()
{
rGPF0CON = 0x22222222;
rGPF1CON = 0x22222222;
rGPF2CON = 0x22222222;
rGPF3CON = 0x22222222;
}
void lcd_Init()
{
//VIDCON0[0:1]=3;[2]=0;[4]=1;[6:13]=4;[26:28]=000
rVIDCON0 &=0xffffffff;
rVIDCON0 |=(0x13<<0);
rVIDCON0 |=(4<<6);
//VIDCON1[5:6]=3;
rVIDCON1 |=(3<<5);
//VIDTCON0[0:7]=19;[8:15]=21;[16:23]=2;
rVIDTCON0 |=(19<<0);
rVIDTCON0 |=(21<<8);
rVIDTCON0 |=(2<<16);
//VIDTCON1[0:7]=;[8:15]=;[16:23]=;
rVIDTCON1 |=(39<<0);
rVIDTCON1 |=(0xd1<<8);
rVIDTCON1 |=(5<<16);
//VIDTCON2[0:10] = 799;[11:21]=479;
rVIDTCON2 |=(799<<0);
rVIDTCON2 |=(479<<11);
//WINCON0[0]=1;[2:5]=0xb;[15]=1;
rWINCON0 |=1;
rWINCON0 |=(0xb<<2);
rWINCON0 |=(1<<15);
//SHADOWCON[0]=1;
rSHADOWCON |=1;
//VIDOSD0A[0:10]=0;[11:21]=0;
rVIDOSD0A &=0;
//VIDOSD0B[0:10]=479;[11:21]=799;
rVIDOSD0B |=(479<<0);
rVIDOSD0B |=(799<<11);
//VIDOSD0C [23:0]=800*480;
rVIDOSD0C |=(800*480);
//VIDW00ADD0B0[31:0] = 0X42000000
rVIDW00ADD0B0=0x42000000;
//VIDW00ADD1B0[31:0] = 0X42000000 + 800*480*4
rVIDW00ADD1B0=(0x42000000 + 800*480*4);
//VIDW00ADD2[0:12]=800;[13:25]=0
rVIDW00ADD2 &=0;
rVIDW00ADD2 |=800;
//DISPLAY_CONTROL[1:0]= 2
rDISPLAY_CONTROL |=2;
}
//显示红绿蓝3种色
void lcd_clearscreen(int color)
{
int y, x;
for(y = 0;y < 160 ;y++)
{
for(x = 0;x < 800; x++)
{
// *(fbuf + (800*y + x)) = color; 给每个点赋颜色值
fbufs=fbuf+800*y + x;
*fbufs = color;
}
}fbuf=fbufs;
}
//如果要引入文件那样,显示3种色
//那img1.h内容是
/*
const unsigned char gImage_img1[648] = {
0XFF,0X00,0X00,
0X00,0XFF,0X00,
0X00,0X00,0XFF,
};
//方法是
void lcd_img(const unsigned char *p){
int y, x,color,i;
for(i=0;i<3;i++){
for(y = 0;y < 160 ;y++)
{
for(x = 0;x < 800; x++)
{
color =(*p<<16)+(*(p+1)<<8)+*(p+2);
fbufs=fbuf+800*y + x;
*fbufs = color;
}
}fbuf=fbufs;
p+=3;
}
}
*/
//显示图片
void lcd_img(const unsigned char *p){
int y, x,color;
for(y = 0;y < 480 ;y++)
{
for(x = 0;x < 800; x++)
{
color =(*p<<16)+(*(p+1)<<8)+*(p+2);
*(fbuf + (800*y + x)) = color;
p+=3;
}
}
}
int fimd_lcd()
{
lcd_PortInit();
lcd_Init();
key_init();
lcd_img(gImage_img1);
// 按键切换图片
int k=1,temp;
while(k){
temp=rGPH2DAT;
k=(temp & 0x01);
if (!k)
{
lcd_clearscreen(0xff);
lcd_clearscreen(0xff00);
lcd_clearscreen(0xff00000);
}
}
//while(1);
return 0;
}
cpu/start.S
.text
.extern uart_init
.extern printf
.extern start_armboot
.global _start
_start:
mov r5,lr
bl uart_init
ldr r0,=fmt
bl printf
bl start_armboot
mov lr,r5
bx lr
fmt:
.asciz ">>>>> welcome to arm <<<<<<<\n"
.end
然后再对应修改下cpu/board.c、include/api.h、makefile文件。
说明:
1. lcd介绍(at070tn92)
.物理特性
像素点
.电路接口
数据线: VD0-VD23
控制线:
VSYNC: 帧同步信号
HSYNC:行同步信号
VDEN: 数据有效信号
VCLK:像素同步信号
示例:如何推算lcd的时序参数?
1)vsync/hsync 极性要反
2) VSPW = 19
VBPD = 2
VFPD = 21
LINEVAL = 479
3) HSPW =
HBPD =
HFPD =
HOZVAL = 799
2. s5pv210显示接口
.fimd显示处理模块: 完全的交互式的移动显示设备
.fimc 完全的交互式的移动拍摄设备
lcd_c : rgb
fimd1.0
fimdx.o
fimd6.0
多种接口: yuv , rgb , i80
图像优化:camma , color gain ...
多路获取图像的通道....
.RGB显示接口
.显示原理
framefbuffer (显存)
首地址=帧内存首地址 + 偏移量
帧内存
起始地址 条件: 16M对齐: = 2^4 * 2^20 = 2^24
大小:800 * 480 * 4
底层原理图参考: