arm的lcd显示字体

ARM 111浏览
#include "stdio.h"
#include "s5pv210.h"
unsigned int *fbuf = (unsigned int *)0x42000000;
char ywy[5][32]={

{0x20,0x02,0x70,0x0A,0x1E,0x12,0x10,0x12,
0x10,0x02,0xFF,0x7F,0x10,0x02,0x10,0x22,
0x50,0x22,0x30,0x12,0x18,0x0C,0x16,0x44,
0x10,0x4A,0x10,0x51,0xD4,0x60,0x08,0x40},/*"我",0*/

{0x00,0x10,0x80,0x3F,0x7E,0x08,0x44,0x08,
0x88,0x04,0xFE,0x7F,0x42,0x40,0x41,0x20,
0xFE,0x1F,0x20,0x00,0xE0,0x0F,0x50,0x08,
0x88,0x04,0x04,0x03,0xC2,0x0C,0x38,0x70},/*"爱",1*/

{0x00,0x00,0x00,0x77,0x22,0x22,0x14,0x14,
0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00},/*"Y",2*/

{0x00,0x00,0x00,0x6B,0x49,0x49,0x49,0x49,
0x55,0x55,0x36,0x22,0x22,0x22,0x00,0x00},/*"W",3*/

{0x00,0x00,0x00,0x77,0x22,0x22,0x14,0x14,
0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00},/*"Y",4*/

};

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;

}

void v_ywy(){
	int x,y,i,l,y1;
	for(i=0;i<5;i++){//显示5个字体
		if (ywy[i][16])//判断是汉字还是字母
		{
			for(l=0;l<16;l++){//循环显示16行
				for(x = 0;x < 8; x++)//循环判断1个16进制数的位状态
				{
					y=ywy[i][l*2]&(1<<x);//同时判断2个
					y1=ywy[i][2*l+1]&(1<<x);//同时显示1行的前8位和后8位
					if (y)
					{
						*(fbuf + (800*l +x+16*i)) = 0xff;
						//800*l换行,16*i隔i个汉字,防重叠。
					}
					else{
						*(fbuf + (800*l +x+16*i)) = 0xffffff;
					}
					if (y1)
					{
						*(fbuf + (800*l +x+16*i+8)) = 0xff;
						//同步显示后8位比上面+8
					}
					else{
						*(fbuf + (800*l +x+16*i+8)) = 0xffffff;
					}
				}
			}
		}else{//字母的1行只有8位
			for(l=0;l<16;l++)
			{
				for(x = 0;x < 8; x++)
				{
					y=ywy[i][l]&(1<<x);
					if (y)
					{
						*(fbuf + (800*l +x+16*i)) = 0xff;
						//这里字母也隔16位,因为前面是汉字,下一个字母时就会空出8位
						//这问题暂未处理,有种可以试试改变fbuf指到扫描到的地方
					}
					else{
						*(fbuf + (800*l +x+16*i)) = 0xffffff;
						}
					}
				}
		}
	}
}
int fimd_lcd()
{
	lcd_PortInit();
	lcd_Init();

	v_ywy(i);

	//while(1);
	return 0;
}