资源描述:
《mini2440裸机lcd测试程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include"def.h"#include"option.h"#include"2440addr.h"#include"2440lib.h"#include"2440slib.h"externconstunsignedcharsunflower_240x320[];#defineLCD_WIDTH240#defineLCD_HEIGHT320#defineLCD_PIXCLOCK4#defineLCD_RIGHT_MARGIN36#defineLCD_LEFT_MARGIN19#defineLCD_HSYNC_LEN5#defineLC
2、D_UPPER_MARGIN1#defineLCD_LOWER_MARGIN5#defineLCD_VSYNC_LEN1#defineLCD_XSIZELCD_WIDTH#defineLCD_YSIZELCD_HEIGHT#defineSCR_XSIZELCD_WIDTH#defineSCR_YSIZELCD_HEIGHTunsignedshortLCD_BUFFER[SCR_YSIZE][SCR_XSIZE];/**************************************************************64
3、0×480TFTLCD数据和控制端口初始化**************************************************************/staticvoidLcd_Port_Init(void){rGPCUP=0xffffffff;//DisablePull-upregisterrGPCCON=0xaaaa02a8;//InitializeVD[7:0],VM,VFRAME,VLINE,VCLKrGPDUP=0xffffffff;//DisablePull-upregisterrGPDCON=0xaaaaaa
4、aa;//InitializeVD[15:8]}/**************************************************************640×480TFTLCD功能模块初始化**************************************************************/staticvoidLCD_Init(void){#defineM5D(n)((n)&0x1fffff)#defineLCD_ADDR((U32)LCD_BUFFER)rLCDCON1=(LCD_PIXCL
5、OCK<<8)
6、(3<<5)
7、(12<<1);rLCDCON2=(LCD_UPPER_MARGIN<<24)
8、((LCD_HEIGHT-1)<<14)
9、(LCD_LOWER_MARGIN<<6)
10、(LCD_VSYNC_LEN<<0);rLCDCON3=(LCD_RIGHT_MARGIN<<19)
11、((LCD_WIDTH-1)<<8)
12、(LCD_LEFT_MARGIN<<0);rLCDCON4=(13<<8)
13、(LCD_HSYNC_LEN<<0);#if!defined(LCD_CON5)#defineLCD_CON5((1<<11)
14、(1<
15、<9)
16、(1<<8)
17、(1<<3)
18、(1<<0))#endifrLCDCON5=LCD_CON5;rLCDSADDR1=((LCD_ADDR>>22)<<21)
19、((M5D(LCD_ADDR>>1))<<0);rLCDSADDR2=M5D((LCD_ADDR+LCD_WIDTH*LCD_HEIGHT*2)>>1);rLCDSADDR3=LCD_WIDTH;rLCDINTMSK
20、=3;rTCONSEL&=(~7);rTPAL=0x0;rTCONSEL&=~((1<<4)
21、1);}/*******************************
22、*******************************LCD视频和控制信号输出或者停止,1开启视频输出**************************************************************/staticvoidLcd_EnvidOnOff(intonoff){if(onoff==1)rLCDCON1
23、=1;//ENVID=ONelserLCDCON1=rLCDCON1&0x3fffe;//ENVIDOff}/********************************************
24、******************320×2408BppTFTLCD电源控制引脚使能**********************************************