这里使用的是 ICOOL210开发板 之前我写过一篇2416的u-boot LCD驱动 具体请参照 http://blog.youkuaiyun.com/hclydao/article/details/17911747
过程基本都是差不多这里实现的效果跟之前的2416的不一样主要是把之前的串口打印的信息显示在LCD上这样自动更新的时候会占用不少时间所以这里我去掉了这个功能在上面加了一个进度条
具体修改过程如下
首先在drivers/video/下增加gzsd210_lcd_pg.c 内容如下
/*
* Gzsd2416 Framebuffer driver.
*
* Copyright 2013 Store information technology guangzhou ltd
* hclydao <hclydao@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <common.h>
#include "gzsd210_lcd.h"
#include <config.h>
#include <command.h>
#include <asm/io.h>
#include <video_font.h>
void *win0_base;
void *win1_base;
#define LCD_FRAMEBUFFER_ADDR 0x49f00000//(0x50000000 - 0x200000)
#define PG_WIDTH 700 //进度条宽度
#define PG_HEIGHT 20 //进度条高度
#define PG_PIEXL 2 //边框像素
#define PG_X ((S3CFB_HRES - PG_WIDTH)/2) //进度条起点x坐标
#define PG_Y ((S3CFB_VRES - PG_HEIGHT)/2)//进度条起点y坐标
#define DOOR_COLOR 0xffff//0xffff //边框颜色
#define PG_COLOR 0xffff//0xffff //进度条颜色
#define PG_FULL_COLOR 0x07e0//0xffff //进度条满时的颜色
#define COLOR_FG 0xf0f0
#define COLOR_BG 0x0000
void lcd_backlight(int enable) //背光控制
{
unsigned long reg;
reg = readl(GPD0CON);
reg &= ~(0xf << 0);
reg |= (0x1 << 0);
writel(reg,GPD0CON);
reg = readl(GPD0PUD);
reg &= ~(0x3 << 0);
reg |= (0x2 << 0);
writel(reg,GPD0PUD);
reg = readl(GPD0DAT);
if(enable)
reg |= (0x1 << 0);
else
reg &= ~(0x1 << 0);
writel(reg, GPD0DAT);
}
void lcd_disable (void)
{
VIDCON0_REG &= (~(VIDCON0_ENVID_ENABLE | VIDCON0_ENVID_F_ENABLE));
}
void lcd_enable (void)
{
VIDCON0_REG |= (VIDCON0_ENVID_ENABLE | VIDCON0_ENVID_F_ENABLE);
}
void lcd_panel_disable(void)
{
}
ulong calc_fbsize (void)
{
ulong size;
int line_length = (S3CFB_HRES * PIXELBITS) / 8;
size = line_length * S3CFB_VRES;
return size;
}
void gzsd_drawdoor(ushort x,ushort y) { //画边框
uchar *dest,*d;
int i,j;
int lcd_line_length = (S3CFB_HRES * PIXELBITS) / 8;
dest = (uchar *)(win1_base + y * lcd_line_length + x * PIXELBITS / 8);
for(i=0;i<PG_HEIGHT;i++) {
d = dest;
for(j=0;j<PG_WIDTH*2;j++) {
if((i<PG_PIEXL) || (i>(PG_HEIGHT - PG_PIEXL)) || (j<PG_PIEXL) || (j > (PG_WIDTH*2 - PG_PIEXL)))
*d = DOOR_COLOR;
d++;
}
dest += lcd_line_length;
}
}
void gzsd_drawpg(ushort x,ushort y,int pg,int color) { //画进度条
uchar *dest,*d;
int i,j;
int lcd_line_length = (S3CFB_HRES * PIXELBITS) / 8;
dest = (uchar *)(win1_base + (y + PG_PIEXL + 1)* lcd_line_length + (x + PG_PIEXL)* PIXELBITS / 8);
for(i=0;i<(PG_HEIGHT - 2*PG_PIEXL - 1);i++) {
d = dest;
for(j=0;j<(PG_WIDTH*2 - 2 * PG_PIEXL - 4)*pg/100;j++) {
*d++ = color;
}
dest += lcd_line_length;
}
}
static void gzsd_drawchars (ushort x, ushort y, uchar *str, int count)//显示字符 这个函数lcd.c中有
{
uchar *dest;
ushort off, row;
int lcd_color_fg = 0xffff;
int lcd_color_bg = 0x0000;
int lcd_line_length = (S3CFB_HRES * PIXELBITS) / 8;
dest = (uchar *)(win1_base + y * lcd_line_length + x * PIXELBITS / 8);
off = x * PIXELBITS % 8;
for (row=0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
uchar *s = str;
uchar *d = dest;
int i;
for (i=0; i<count; ++i) {
uchar c, bits;
c = *s++;
bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
for (c=0; c<16; ++c) {
*d++ = (bits & 0x80) ?
lcd_color_fg : lcd_color_bg;
bits <<= 1;
}
}
}
}
void gzsd_setprogress(int percentage)//设置进度
{
if(percentage == 100) //进度条满时修改颜色
gzsd_drawpg(PG_X,PG_Y,percentage,PG_FULL_COLOR);
else
gzsd_drawpg(PG_X,PG_Y,percentage,PG_COLOR);
}
void gzsd_lcd_init(void)//lcd初始化
{
ulong freq_lcdclk;
ulong freq_Hclk;
ulong fb_size;
unsigned char nn;
//config port
GPF0CON_REG = 0x22222222;
GPF0DRV_REG = 0xffffffff;
GPF0PUD_REG = 0x0;
GPF1CON_REG = 0x22222222;
GPF1DRV_REG = 0xffffffff;
GPF1PUD_REG = 0x0;
GPF2CON_REG = 0x22222222;
GPF2DRV_REG = 0xffffffff;
GPF2PUD_REG = 0x0;
GPF3CON_REG = 0x2222;
GPF3DRV_REG = 0xff;
GPF3PUD_REG = 0x0;
//display control
DISCONTROL_REG = DISPLAY_PATH_SEL(2);
//lcd disable
lcd_disable();
WINCON0_REG &= ~WINCON_ENWIN_ENABLE;
WINCON1_REG &= ~WINCON_ENWIN_ENABLE;
//vidconx
freq_lcdclk = S3CFB_PIXEL_CLOCK;
freq_Hclk = get_HCLK();
nn = (unsigned char)(freq_Hclk / freq_lcdclk) - 1;
if(freq_lcdclk < freq_Hclk/2) {
VIDCON0_REG = (VIDCON0_S_RGB_IF) | (VIDCON0_VCLKFREE_NORMAL)
| (VIDCON0_S_CLKDIR_DIVIDED) | (VIDCON0_S_CLKSEL_HCLK) | VIDCON0_CLKVALUP_ALWAYS | VIDCON0_CLKVAL_F(nn);
}
else {
VIDCON0_REG = (VIDCON0_S_RGB_IF) | (VIDCON0_VCLKFREE_NORMAL)
| (VIDCON0_S_CLKDIR_DIVIDED) | (VIDCON0_S_CLKSEL_HCLK) | VIDCON0_CLKVALUP_ALWAYS | VIDCON0_CLKVAL_F(0);
}
VIDCON1_REG = ( VIDCON1_S_HSYNC_INVERTED) | (VIDCON1_S_VSYNC_INVERTED);
VIDTCON0_REG = VIDTCON0_VBPD(S3CFB_VBP - 1) | VIDTCON0_VFPD(S3CFB_VFP - 1) | VIDTCON0_VSPW(S3CFB_VSW - 1) | VIDTCON0_VBPDE(0);
VIDTCON1_REG = VIDTCON1_HBPD(S3CFB_HBP - 1) | VIDTCON1_HFPD(S3CFB_HFP - 1) | VIDTCON1_HSPW(S3CFB_HSW - 1) | VIDTCON1_VFPDE(0);
VIDTCON2_REG = VIDTCON2_LINEVAL(S3CFB_VRES - 1) | VIDTCON2_HOZVAL(S3CFB_HRES - 1);
#if 0
WINCON0_REG = WINCON_ALPHA0_SEL | WINCON_INRGB_RGB | WINCON_DATAPATH_DMA | WINCON_HAWSWP_ENABLE
| WINCON_WSWP_DISABLE | WINCON_BYTESWP_DISABLE | WINCON_BITSWP_DISABLE | ( 0x5 << WINCON_BPPMODE_SHIFT);//bpp 32 0xd 32 0x5 16
WINCON1_REG = WINCON_ALPHA0_SEL | WINCON_INRGB_RGB | WINCON_DATAPATH_DMA | WINCON_HAWSWP_ENABLE
| WINCON_WSWP_DISABLE | WINCON_BYTESWP_DISABLE | WINCON_BITSWP_DISABLE | ( 0x5 << WINCON_BPPMODE_SHIFT);
#else
WINCON0_REG = WINCON_INRGB_RGB | WINCON_HAWSWP_ENABLE | WINCON_BPPMODE_RGB565;//| WINCON_BLD_PIXEL | WINCON_ALPHA0_SEL;WINCON_INRGB_RGB |
WINCON1_REG = WINCON_INRGB_RGB | WINCON_HAWSWP_ENABLE | WINCON_BPPMODE_RGB565 | WINCON_BLD_PIXEL;
#endif
SHODOWCON_REG = (0x3 << 0);//channel 0 1 enable
//protect
//SHODOWCON_REG |= SHADOWCON_PROTECT(0x3);
VIDOSD0A_REG = VIDOSDxA_OSD_LTX_F(0) | VIDOSDxA_OSD_LTY_F(0);
VIDOSD0B_REG = VIDOSDxB_OSD_RBX_F(S3CFB_HRES - 1) | VIDOSDxB_OSD_RBY_F(S3CFB_VRES - 1);
VIDOSD1A_REG = VIDOSDxA_OSD_LTX_F(0) | VIDOSDxA_OSD_LTY_F(0);
VIDOSD1B_REG = VIDOSDxB_OSD_RBX_F(S3CFB_HRES - 1) | VIDOSDxB_OSD_RBY_F(S3CFB_VRES - 1);
VIDOSD1C_REG = 0xFFF000;//0xDDD000;/*alpha blending*/
//VIDW0ALPHA0_REG = (0xf << 16) | ( 0xf << 8) | (0xf << 0);
//end
//osd size
VIDOSD0C_REG = (S3CFB_HRES * S3CFB_VRES) << 0;
VIDOSD1D_REG = (S3CFB_HRES * S3CFB_VRES) << 0;
fb_size = calc_fbsize();
win0_base = (void *)LCD_FRAMEBUFFER_ADDR;
win1_base = (void *)(LCD_FRAMEBUFFER_ADDR + fb_size);
VIDW00ADD0B0_REG = virt_to_phys((unsigned int)win0_base);
VIDW01ADD0B0_REG = virt_to_phys(win1_base);
VIDW00ADD1B0_REG = virt_to_phys((unsigned int)win0_base) + fb_size;
VIDW01ADD1B0_REG = virt_to_phys(win1_base) + fb_size;
//buffer size
VIDW00ADD2_REG = VIDADDR_PAGEWIDTH(S3CFB_HRES * PIXELBITS / 8) | VIDADDR_OFFSIZE(0);//bpp
VIDW01ADD2_REG = VIDADDR_PAGEWIDTH(S3CFB_HRES * PIXELBITS / 8) | VIDADDR_OFFSIZE(0);
//WxKEYCON
W1KEYCON0_REG = WxKEYCON0_KEYBLEN_ENABLE | WxKEYCON0_KEYEN_F_ENABLE | WxKEYCON0_COMPKEY(0xFFFF);
W1KEYCON1_REG = 0x00000000;/*color key*/
//SHODOWCON_REG &= ~SHADOWCON_PROTECT(0x3);
memset(win0_base,0x0000,fb_size*2);
lcd_enable();
WINCON0_REG |= WINCON_ENWIN_ENABLE;
WINCON1_REG |= WINCON_ENWIN_ENABLE;
char cmd_buf[256];
sprintf(cmd_buf, "fatload mmc 1 0x%x logo.bin",LCD_FRAMEBUFFER_ADDR);//背景
run_command(cmd_buf, 0);
gzsd_drawdoor(PG_X,PG_Y);
gzsd_setprogress(0);
lcd_backlight(1);
return 0;
}
这里主要需要用到的函数有
gzsd_lcd_init
gzsd_setprogress
先调用 gzsd_lcd_init进行初始化 然后在需要设置进度的地方使用gzsd_setprogress设置即可
下面是需要的头文件
gzsd210_lcd.h
#ifndef GZSD2416_LCD_H
#define GZSD2416_LCD_H
#include <config.h>
#include "s3cfb_reg.h"
#include <regs.h>
#if defined(CONFIG_LCD_NC43)
#define S3CFB_HSW 41
#define S3CFB_HBP 2
#define S3CFB_HFP 2
#define S3CFB_VSW 10
#define S3CFB_VBP 2
#define S3CFB_VFP 2
#define S3CFB_HRES 480
#define S3CFB_VRES 272
#define S3CFB_VFRAME_FREQ 60
#elif defined(CONFIG_LCD_AT070)
#define S3CFB_HSW 20
#define S3CFB_HBP 30
#define S3CFB_HFP 88
#define S3CFB_VSW 5
#define S3CFB_VBP 15
#define S3CFB_VFP 5
#define S3CFB_HRES 800
#define S3CFB_VRES 480
#define S3CFB_VFRAME_FREQ 60
#endif
#if defined(CONFIG_LCDBPP_32)
#define PIXELBITS 32
//#define LCD_BPP LCD_COLOR32
#elif defined(CONFIG_LCDBPP_16)
#define PIXELBITS 16
//#define LCD_BPP LCD_COLOR16
#endif
#define S3CFB_IVCLK 0//CFG_LOW
#define S3CFB_IHSYNC 1//CFG_HIGH
#define S3CFB_IVSYNC 1//CFG_HIGH
#define S3CFB_IVDEN 0//CFG_LOW
#define S3CFB_PIXEL_CLOCK (S3CFB_VFRAME_FREQ * (S3CFB_HFP + S3CFB_HSW + S3CFB_HBP + S3CFB_HRES) * (S3CFB_VFP + S3CFB_VSW + S3CFB_VBP + S3CFB_VRES))
#endif
s3cfb_reg.h
#ifndef S3CFB_REG_H
#define S3CFB_REG_H
#include <asm/hardware.h>
//display control
#define DISCONTROL_REG __REG(0xE0107008)
#define DISCONTROLCON (0xE0107008)
//lcd data
#define GPF0CON_REG __REG(0xE0200120)
#define GPF0PUD_REG __REG(0xE0200128)
#define GPF0DRV_REG __REG(0xE020012C)
#define GPF1CON_REG __REG(0xE0200140)
#define GPF1PUD_REG __REG(0xE0200148)
#define GPF1DRV_REG __REG(0xE020014C)
#define GPF2CON_REG __REG(0xE0200160)
#define GPF2PUD_REG __REG(0xE0200168)
#define GPF2DRV_REG __REG(0xE020016C)
#define GPF3CON_REG __REG(0xE0200180)
#define GPF3PUD_REG __REG(0xE0200188)
#define GPF3DRV_REG __REG(0xE020018C)
//lcd con
#define VIDCON0_REG __REG(0xF8000000)
#define VIDCON1_REG __REG(0xF8000004)
#define VIDCON2_REG __REG(0xF8000008)
#define VIDTCON0_REG __REG(0xF8000010)
#define VIDTCON1_REG __REG(0xF8000014)
#define VIDTCON2_REG __REG(0xF8000018)
#define WINCON0_REG __REG(0xF8000020)
#define WINCON1_REG __REG(0xF8000024)
#define WINCON2_REG __REG(0xF8000028)
#define WINCON3_REG __REG(0xF800002C)
#define WINCON4_REG __REG(0xF8000030)
//shadow control
#define SHODOWCON_REG __REG(0xF8000034)
//specifiles video size control
#define VIDOSD0A_REG __REG(0xF8000040)
#define VIDOSD0B_REG __REG(0xF8000044)
#define VIDOSD0C_REG __REG(0xF8000048)
#define VIDOSD1A_REG __REG(0xF8000050)
#define VIDOSD1B_REG __REG(0xF8000054)
#define VIDOSD1C_REG __REG(0xF8000058)
#define VIDOSD1D_REG __REG(0xF800005C)
#define VIDW00ADD0B0_REG __REG(0xF80000A0)
#define VIDW01ADD0B0_REG __REG(0xF80000A8)
#define VIDW00ADD1B0_REG __REG(0xF80000D0)
#define VIDW01ADD1B0_REG __REG(0xF80000D8)
#define VIDW00ADD2_REG __REG(0xF8000100)
#define VIDW01ADD2_REG __REG(0xF8000104)
#define W1KEYCON0_REG __REG(0xF8000140)
#define W1KEYCON1_REG __REG(0xF8000144)
#define VIDW0ALPHA0_REG __REG(0xF8000200)
#define VIDW0ALPHA1_REG __REG(0xF8000204)
#define VIDW1ALPHA0_REG __REG(0xF8000208)
#define VIDW1ALPHA1_REG __REG(0xF800020C)
//display control
#define DISPLAY_PATH_SEL(x) (((x)&0x3)<<0)
//rVIDCON0
#define VIDCON0_S_RGB_IF (0<<26)
#define VIDCON0_S_RGB_PAR (1<<17)
#define VIDCON0_S_CLKDIR_DIVIDED (1<<4)
#define VIDCON0_S_CLKSEL_HCLK (0<<2)
#define VIDCON0_ENVID_ENABLE (1 << 1)
#define VIDCON0_ENVID_F_ENABLE (1 << 0)
#define VIDCON0_CLKVALUP_ALWAYS (0 << 16)
#define VIDCON0_VCLKFREE_NORMAL (0 << 5)
#define VIDCON0_CLKVAL_F(x) (((x)&0xff)<<6)
//rVIDCON1
#define VIDCON1_S_HSYNC_INVERTED (1<<6)
#define VIDCON1_S_VSYNC_INVERTED (1<<5)
/* VIDCON2 */
#define VIDCON2_EN601_DISABLE (0 << 23)
#define VIDCON2_EN601_ENABLE (1 << 23)
#define VIDCON2_EN601_MASK (1 << 23)
#define VIDCON2_WB_DISABLE (0 << 15)
#define VIDCON2_WB_ENABLE (1 << 15)
#define VIDCON2_WB_MASK (1 << 15)
#define VIDCON2_TVFORMATSEL_HW (0 << 14)
#define VIDCON2_TVFORMATSEL_SW (1 << 14)
#define VIDCON2_TVFORMATSEL_MASK (1 << 14)
#define VIDCON2_TVFORMATSEL_YUV422 (1 << 12)
#define VIDCON2_TVFORMATSEL_YUV444 (2 << 12)
#define VIDCON2_TVFORMATSEL_YUV_MASK (3 << 12)
#define VIDCON2_ORGYUV_YCBCR (0 << 8)
#define VIDCON2_ORGYUV_CBCRY (1 << 8)
#define VIDCON2_ORGYUV_MASK (1 << 8)
#define VIDCON2_YUVORD_CBCR (0 << 7)
#define VIDCON2_YUVORD_CRCB (1 << 7)
#define VIDCON2_YUVORD_MASK (1 << 7)
//rVIDTCON0
#define VIDTCON0_VBPDE(x) (((x)&0xff)<<24)
#define VIDTCON0_VBPD(x) (((x)&0xff)<<16)
#define VIDTCON0_VFPD(x) (((x)&0xff)<<8)
#define VIDTCON0_VSPW(x) (((x)&0xff)<<0)
//rVIDTCON1
#define VIDTCON1_VFPDE(x) (((x)&0xff)<<24)
#define VIDTCON1_HBPD(x) (((x)&0xff)<<16)
#define VIDTCON1_HFPD(x) (((x)&0xff)<<8)
#define VIDTCON1_HSPW(x) (((x)&0xff)<<0)
//rVIDTCON2
#define VIDTCON2_LINEVAL(x) (((x)&0x7ff)<<11)
#define VIDTCON2_HOZVAL(x) (((x)&0x7ff)<<0)
/* window 0~4 control */
#define WINCON_DATAPATH_DMA (0 << 22)
#define WINCON_DATAPATH_LOCAL (1 << 22)
#define WINCON_DATAPATH_MASK (1 << 22)
#define WINCON_BUFSEL_0 (0 << 20)
#define WINCON_BUFSEL_1 (1 << 20)
#define WINCON_BUFSEL_MASK (1 << 20)
#define WINCON_BUFSEL_SHIFT (20)
#define WINCON_BUFAUTO_DISABLE (0 << 19)
#define WINCON_BUFAUTO_ENABLE (1 << 19)
#define WINCON_BUFAUTO_MASK (1 << 19)
#define WINCON_BITSWP_DISABLE (0 << 18)
#define WINCON_BITSWP_ENABLE (1 << 18)
#define WINCON_BITSWP_SHIFT (18)
#define WINCON_BYTESWP_DISABLE (0 << 17)
#define WINCON_BYTESWP_ENABLE (1 << 17)
#define WINCON_BYTESWP_SHIFT (17)
#define WINCON_HAWSWP_DISABLE (0 << 16)
#define WINCON_HAWSWP_ENABLE (1 << 16)
#define WINCON_HAWSWP_SHIFT (16)
#define WINCON_WSWP_DISABLE (0 << 15)
#define WINCON_WSWP_ENABLE (1 << 15)
#define WINCON_WSWP_SHIFT (15)
#define WINCON_INRGB_RGB (0 << 13)
#define WINCON_INRGB_YUV (1 << 13)
#define WINCON_INRGB_MASK (1 << 13)
#define WINCON_BURSTLEN_16WORD (0 << 9)
#define WINCON_BURSTLEN_8WORD (1 << 9)
#define WINCON_BURSTLEN_4WORD (2 << 9)
#define WINCON_BURSTLEN_MASK (3 << 9)
#define WINCON_ALPHA_MULTI_DISABLE (0 << 7)
#define WINCON_ALPHA_MULTI_ENABLE (1 << 7)
#define WINCON_BLD_PLANE (0 << 6)
#define WINCON_BLD_PIXEL (1 << 6)
#define WINCON_BLD_MASK (1 << 6)
#define WINCON_BPPMODE_1BPP (0 << 2)
#define WINCON_BPPMODE_2BPP (1 << 2)
#define WINCON_BPPMODE_4BPP (2 << 2)
#define WINCON_BPPMODE_8BPP_PAL (3 << 2)
#define WINCON_BPPMODE_8BPP (4 << 2)
#define WINCON_BPPMODE_16BPP_565 (5 << 2)
#define WINCON_BPPMODE_16BPP_A555 (6 << 2)
#define WINCON_BPPMODE_18BPP_666 (8 << 2)
#define WINCON_BPPMODE_18BPP_A665 (9 << 2)
#define WINCON_BPPMODE_24BPP_888 (0xb << 2)
#define WINCON_BPPMODE_24BPP_A887 (0xc << 2)
#define WINCON_BPPMODE_32BPP (0xd << 2)
#define WINCON_BPPMODE_16BPP_A444 (0xe << 2)
#define WINCON_BPPMODE_15BPP_555 (0xf << 2)
#define WINCON_BPPMODE_MASK (0xf << 2)
#define WINCON_BPPMODE_SHIFT (2)
#define WINCON_BPPMODE_RGB565 (0x5 << 2)
#define WINCON_ALPHA0_SEL (0 << 1)
#define WINCON_ALPHA1_SEL (1 << 1)
#define WINCON_ALPHA_SEL_MASK (1 << 1)
#define WINCON_ENWIN_DISABLE (0 << 0)
#define WINCON_ENWIN_ENABLE (1 << 0)
#define WINCONx_BLD_PIX_PIXEL (1<<6)
#define WINCONx_HAWSWP_ENABLE (1<<16)
//rVIDOSD0A
#define VIDOSDxA_OSD_LTX_F(x) (((x)&0x7ff)<<11)
#define VIDOSDxA_OSD_LTY_F(x) (((x)&0x7ff)<<0)
//rVIDOSD0B
#define VIDOSDxB_OSD_RBX_F(x) (((x)&0x7ff)<<11)
#define VIDOSDxB_OSD_RBY_F(x) (((x)&0x7ff)<<0)
/* VIDOSD0C, VIDOSDxD */
#define VIDOSD_SIZE(x) (((x) & 0xffffff) << 0)
//* VIDWxADD2
#define VIDWxADD2_OFFSIZE_F(x) (((x)&0x1fff)<<13)
#define VIDWxADD2_PAGEWIDTH_F(x) (((x)&0x1fff)<<0)
//WxKEYCON0
#define WxKEYCON0_KEYBLEN_ENABLE (1<<26)
#define WxKEYCON0_KEYEN_F_ENABLE (1<<25)
#define WxKEYCON0_COMPKEY(x) (((x)&0xFFFFFF)<<0)
/* SHADOWCON */
#define SHADOWCON_PROTECT(x) (((x) & 0x1f) << 10)
#define SHADOWCON_CH_ENABLE(x) (1 << (x))
#define SHADOWCON_CH_DISABLE(x) (1 << (x))
#define SHADOWCON_LOCAL_ENABLE(x) (0x20 << (x))
#define SHADOWCON_LOCAL_DISABLE(x) (0x20 << (x))
/* Buffer Size */
#define VIDADDR_OFFSIZE(x) (((x) & 0x1fff) << 13)
#define VIDADDR_PAGEWIDTH(x) (((x) & 0x1fff) << 0)
#endif
Makefile增加一条如下
COBJS-$(CONFIG_VIDEO_GZSD210PG) += gzsd210_lcd_pg.o
然后须要在配置文件里增加如下宏定义及相关声明
#define CONFIG_LCD_AT070 1
#define CONFIG_LCDBPP_16 1
#define CONFIG_VIDEO_GZSD210PG 1
#if !defined(__ASSEMBLY__)
extern void gzsd_setprogress(int percentage);
extern void gzsd_lcd_init(void);
#endif
效果如下