S3C2440裸机学习[2] - LCD驱动原理及代码分析[二]
特别说明:需要嵌入式UCOSII ucGUI arm和linux入门资料,项目资料,linux驱动资料可以加我QQ!!希望我的一些项目经验和资料可以带你进入嵌入式之门,在浩瀚的linux世界里找到属于你自己的舞台!!!希望大家多多支持 我的QQ:1653687969 下面看看2440test里面的lcd.c文件
很容易发现TFT LCD上显示单个像素的函数实际上很简洁
LCDCON1 0x4d000000 #define LCD_WIDTH 240 #define LCD_HEIGHT 320 #define LCD_PIXCLOCK 4 #define LCD_RIGHT_MARGIN 36 #define LCD_LEFT_MARGIN 19 #define LCD_HSYNC_LEN 5 #define LCD_UPPER_MARGIN 1 #define LCD_LOWER_MARGIN 5 #define LCD_VSYNC_LEN 1 CLKVAL[17:8] = 4 TFT: VCLK = HCLK / [(CLKVAL+1) * 2] ( CLKVAL>=0 ) MMODE[7] = 0 PNRMODE[6:5] = 11 TFT LCD panel BPPMODE[4:1] = 1100 16bpp for TFT ENVID[0] = 0 Disable
LCDCON2 0x4d000004 VBPD = 1 LINVAL = 240 – 1 VFPD = 5 VSPW = 1
LCDCON3 0x4d000008 HBPD = 36 HBPD(horizontal back porch):表示从水平同步信号开始到一行的有效数据开始之间的VCLK的个数,对应驱动中的left_margin HOZVAL = 320 – 1 HOZVAL:LCD屏的水平大小 HFPD = 19 HFPD(horizontal front porth):表示一行的有效数据结束到下一个水平同步信号开始之间的VCLK的个数,对应驱动中的right_margin
LCDCON4 0x4d MVAL = 13 HSPW = 5 HSPW(horizontal sync pulse width):表示水平同步信号的宽度,用VCLK计算,对应驱动中的hsync_len
LCDCON5 0x4d000010 HWSWP = 1 Swap Enable PWREN = 1 Enable PWREN signal INVVFRAME = 1 VFRAME/VSYNC pulse polarity Inverted 选择负极性脉冲 INVVLINE = 1 VLINE/HSYNC pulse polarity Inverted 选择负极性脉冲 FRM565 = 1 5:6:5 Format
INT_FrSyn = 1 LCD frame synchronized interrupt Masked INT_FiCnt = 1 LCD FIFO interrupt Masked
MODE_SEL = 0 Sync mode RES_SEL = 0 320 x 240 LPC_EN = 0 LPC3600 Disable
Temporary palette register enable bit Disable
LCDSADDR1 0x4d000014 帧缓冲起始寄存器1 LCDBANK[29:21] = (U32)LCD_BUFFER >> 22 These bits indicate A[30:22] of the bank location for the video buffer in the system memory. LCDBANK value cannot be changed even when moving the view port. LCD frame buffer should be within aligned 4MB region, which ensures that LCDBANK value will not be changed when moving the view port. So, care should be taken to use the malloc() Function LCDBASEU[20:0] = ((U32)LCD_BUFFER >> 1)&0x1fffff For dual-scan LCD : These bits indicate A[21:1] of the start address of the upper address counter, which is for the upper frame memory of dual scan LCD or the frame memory of single scan LCD. LCDSADDR2 0x4d000018帧缓冲起始寄存器2 LCDBASEL[20:0] = ((LCD_ADDR + LCD_WIDTH * LCD_HEIGHT * 2) >> 1)& 0x1fffff For dual-scan LCD: These bits indicate A[21:1] of the start address of the lower address counter, which is used for the lower frame memory of dual scan LCD. LCDSADDR3 0x4d OFFSIZE = 0 PAGEWIDTH = 320 虚拟屏页宽(半字数量) 定义了帧中的视图域宽度 程序分析至此,大概已经清楚是如何通过LCD_BUFFER[(y)][(x)] = c来实现在LCD上显示单个像素了。 |
|