S3C2440之LCD的初始化配置

<pre name="code" class="objc"><pre name="code" class="objc">#define LADDR 0x30800000 
#define HMIX 240
#define VMIX 320 

unsigned short * addrbuf = (unsigned short *)LADDR;
 
 
/************************************************* 
Function  name  :   lcd_init
Description     :   Init
Input parameter :   NONE
Return          :   none              
Others          :   none                                                   
*************************************************/
void lcd_init(void)
{
	lcd_pin_init();
	lcd_reg_init();
	lcd_enable();
}
/************************************************* 
Function  name  :   lcd_pin_init
Description     :   配置lcd引脚
Input parameter :   none
Return          :   none              
Others          :   none                                                   
*************************************************/
void lcd_pin_init(void)
{
	rGPCCON = 0xaaaaaaaa;//配置为特殊功能寄存器
	rGPDCON = 0xaaaaaaaa;//配置为特殊功能寄存器	
	rGPGCON |= 0x3<<8; 
}
/************************************************* 
Function  name  :   lcd_reg_init
Description     :   配置lcd的寄存器
Input parameter :   none
Return          :   none              
Others          :   none                                                   
*************************************************/
void lcd_reg_init(void)
{
	// CLKVAL PNRMODE BPPMODE ENVID
	rLCDCON1 = ((0x9<<8)|(0x3<<5)|(0xc<<1));
	//4 319 4 5 
	rLCDCON2 = ((0x4<<24)|(0x13f<<14)|(0x4<<6)|(0x5));
	//HBPD = 10 HOZVAL = 239 HFPD = 10
	rLCDCON3 = ((0xa<<19)|(0xef<<8)|(0xa));
	//HSPW = 9
	rLCDCON4 = 0x9;
	//看手册398页
	rLCDCON5 = ((0x1<<11)|(0x1<<6)|(0x1<<3)|(0x1<<2)|(0x1));
	//配置图像缓存地址
	rLCDSADDR1 = (((LADDR>>1) & 0x1fffff) | (((LADDR>>22) & 0x1ff)<<21));
	rLCDSADDR2 = (((LADDR+VMIX*HMIX*2)>>1)&0x1fffff);
}
/************************************************* 
Function  name  :   lcd_enable
Description     :   开关
Input parameter :   none
Return          :   none              
Others          :   none                                                   
*************************************************/
void lcd_enable(void)
{
	rLCDCON1 |= 0x1;//电源使能
}

/************************************************* 
Function  name  :   clr_lcd
Description     :   清屏函数
Input parameter :   const unsigned char c要显示的颜色
Return          :   none              
Others          :   none                                                   
*************************************************/
void clr_lcd(const unsigned int c)//
{
int i,j;
	for(i = 0;i<VMIX;i++)
	{
		for(j = 0;j<HMIX;j++)
		{
			addrbuf[HMIX*i+j] = c;
		}
	}
}


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值