S5PV210 u-boot LCD驱动 自动更新增加进度条

这里使用的是 ICOOL210开发板 之前我写过一篇2416的u-boot LCD驱动 具体请参照 http://blog.csdn.net/hclydao/article/details/17911747

过程基本都是差不多这里实现的效果跟之前的2416的不一样主要是把之前的串口打印的信息显示在LCD上这样自动更新的时候会占用不少时间所以这里我去掉了这个功能在上面加了一个进度条

具体修改过程如下

首先在drivers/video/下增加gzsd210_lcd_pg.c 内容如下


[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. /* 
  2.  * Gzsd2416 Framebuffer driver. 
  3.  * 
  4.  * Copyright 2013 Store information technology guangzhou ltd 
  5.  * hclydao <hclydao@gmail.com> 
  6.  * 
  7.  * This program is free software; you can redistribute it and/or 
  8.  * modify it under the terms of the GNU General Public License as 
  9.  * published by the Free Software Foundation; either version 2 of 
  10.  * the License, or (at your option) any later version. 
  11.  * 
  12.  * This program is distributed in the hope that it will be useful, 
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  15.  * GNU General Public License for more details. 
  16.  */  
  17. #include <common.h>  
  18. #include "gzsd210_lcd.h"  
  19. #include <config.h>  
  20. #include <command.h>  
  21. #include <asm/io.h>  
  22. #include <video_font.h>     
  23.   
  24. void *win0_base;  
  25. void *win1_base;  
  26. #define LCD_FRAMEBUFFER_ADDR        0x49f00000//(0x50000000 - 0x200000)  
  27.   
  28. #define PG_WIDTH    700 //进度条宽度  
  29. #define PG_HEIGHT   20 //进度条高度  
  30. #define PG_PIEXL    2 //边框像素  
  31. #define PG_X ((S3CFB_HRES - PG_WIDTH)/2//进度条起点x坐标  
  32. #define PG_Y ((S3CFB_VRES - PG_HEIGHT)/2)//进度条起点y坐标  
  33. #define DOOR_COLOR  0xffff//0xffff //边框颜色  
  34. #define PG_COLOR    0xffff//0xffff //进度条颜色  
  35. #define PG_FULL_COLOR   0x07e0//0xffff //进度条满时的颜色  
  36. #define COLOR_FG    0xf0f0  
  37. #define COLOR_BG    0x0000  
  38.   
  39. void lcd_backlight(int enable) //背光控制  
  40. {  
  41.     unsigned long reg;  
  42.     reg = readl(GPD0CON);  
  43.     reg &= ~(0xf << 0);  
  44.     reg |= (0x1 << 0);  
  45.     writel(reg,GPD0CON);  
  46.   
  47.     reg = readl(GPD0PUD);  
  48.     reg &= ~(0x3 << 0);  
  49.     reg |= (0x2 << 0);  
  50.     writel(reg,GPD0PUD);  
  51.   
  52.     reg = readl(GPD0DAT);  
  53.     if(enable)  
  54.         reg |= (0x1 << 0);  
  55.     else  
  56.         reg &= ~(0x1 << 0);  
  57.     writel(reg, GPD0DAT);  
  58. }  
  59.   
  60. void lcd_disable (void)  
  61. {  
  62.     VIDCON0_REG &= (~(VIDCON0_ENVID_ENABLE | VIDCON0_ENVID_F_ENABLE));  
  63. }  
  64.   
  65. void lcd_enable (void)  
  66. {  
  67.     VIDCON0_REG |= (VIDCON0_ENVID_ENABLE | VIDCON0_ENVID_F_ENABLE);  
  68. }  
  69.   
  70. void lcd_panel_disable(void)  
  71. {  
  72. }  
  73.   
  74. ulong calc_fbsize (void)  
  75. {  
  76.     ulong size;  
  77.   
  78.     int line_length = (S3CFB_HRES * PIXELBITS) / 8;  
  79.     size = line_length * S3CFB_VRES;  
  80.   
  81.     return size;  
  82. }  
  83.   
  84.   
  85. void gzsd_drawdoor(ushort x,ushort y) { //画边框  
  86.     uchar *dest,*d;  
  87.     int i,j;  
  88.     int lcd_line_length = (S3CFB_HRES * PIXELBITS) / 8;  
  89.     dest = (uchar *)(win1_base + y * lcd_line_length + x * PIXELBITS / 8);  
  90.   
  91.     for(i=0;i<PG_HEIGHT;i++) {  
  92.         d = dest;  
  93.         for(j=0;j<PG_WIDTH*2;j++) {  
  94.             if((i<PG_PIEXL) || (i>(PG_HEIGHT - PG_PIEXL)) || (j<PG_PIEXL) || (j > (PG_WIDTH*2 - PG_PIEXL)))  
  95.                 *d = DOOR_COLOR;  
  96.             d++;  
  97.         }  
  98.         dest += lcd_line_length;  
  99.     }  
  100.   
  101. }  
  102.   
  103. void gzsd_drawpg(ushort x,ushort y,int pg,int color) { //画进度条  
  104.     uchar *dest,*d;  
  105.     int i,j;  
  106.     int lcd_line_length = (S3CFB_HRES * PIXELBITS) / 8;  
  107.     dest = (uchar *)(win1_base + (y + PG_PIEXL + 1)* lcd_line_length + (x + PG_PIEXL)* PIXELBITS / 8);  
  108.     for(i=0;i<(PG_HEIGHT - 2*PG_PIEXL - 1);i++) {  
  109.         d = dest;  
  110.         for(j=0;j<(PG_WIDTH*2 - 2 * PG_PIEXL - 4)*pg/100;j++) {  
  111.             *d++ = color;  
  112.         }  
  113.         dest += lcd_line_length;  
  114.     }  
  115. }  
  116.   
  117. static void gzsd_drawchars (ushort x, ushort y, uchar *str, int count)//显示字符 这个函数lcd.c中有  
  118. {  
  119.     uchar *dest;  
  120.     ushort off, row;  
  121.     int lcd_color_fg = 0xffff;  
  122.     int lcd_color_bg = 0x0000;  
  123.     int lcd_line_length = (S3CFB_HRES * PIXELBITS) / 8;  
  124.     dest = (uchar *)(win1_base + y * lcd_line_length + x * PIXELBITS / 8);  
  125.     off  = x * PIXELBITS % 8;  
  126.   
  127.     for (row=0;  row < VIDEO_FONT_HEIGHT;  ++row, dest += lcd_line_length)  {  
  128.         uchar *s = str;  
  129.         uchar *d = dest;  
  130.         int i;  
  131.   
  132.         for (i=0; i<count; ++i) {  
  133.             uchar c, bits;  
  134.             c = *s++;  
  135.             bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];  
  136.             for (c=0; c<16; ++c) {  
  137.                 *d++ = (bits & 0x80) ?  
  138.                         lcd_color_fg : lcd_color_bg;  
  139.                 bits <<= 1;  
  140.             }  
  141.         }  
  142.     }  
  143. }  
  144.   
  145. void gzsd_setprogress(int percentage)//设置进度  
  146. {  
  147.     if(percentage == 100//进度条满时修改颜色  
  148.         gzsd_drawpg(PG_X,PG_Y,percentage,PG_FULL_COLOR);  
  149.     else  
  150.         gzsd_drawpg(PG_X,PG_Y,percentage,PG_COLOR);  
  151. }  
  152.   
  153. void gzsd_lcd_init(void)//lcd初始化  
  154. {  
  155.     ulong freq_lcdclk;  
  156.     ulong freq_Hclk;  
  157.     ulong fb_size;  
  158.     unsigned char nn;  
  159. //config port  
  160.     GPF0CON_REG = 0x22222222;  
  161.     GPF0DRV_REG = 0xffffffff;  
  162.     GPF0PUD_REG = 0x0;  
  163.     GPF1CON_REG = 0x22222222;  
  164.     GPF1DRV_REG = 0xffffffff;  
  165.     GPF1PUD_REG = 0x0;  
  166.     GPF2CON_REG = 0x22222222;  
  167.     GPF2DRV_REG = 0xffffffff;  
  168.     GPF2PUD_REG = 0x0;  
  169.     GPF3CON_REG = 0x2222;  
  170.     GPF3DRV_REG = 0xff;  
  171.     GPF3PUD_REG = 0x0;  
  172. //display control  
  173.     DISCONTROL_REG = DISPLAY_PATH_SEL(2);  
  174. //lcd disable  
  175.     lcd_disable();  
  176.     WINCON0_REG &= ~WINCON_ENWIN_ENABLE;  
  177.     WINCON1_REG &= ~WINCON_ENWIN_ENABLE;  
  178. //vidconx  
  179.     freq_lcdclk = S3CFB_PIXEL_CLOCK;  
  180.     freq_Hclk = get_HCLK();  
  181.     nn = (unsigned char)(freq_Hclk / freq_lcdclk) - 1;  
  182.   
  183.     if(freq_lcdclk < freq_Hclk/2) {  
  184.         VIDCON0_REG = (VIDCON0_S_RGB_IF) | (VIDCON0_VCLKFREE_NORMAL)  
  185.                 | (VIDCON0_S_CLKDIR_DIVIDED) | (VIDCON0_S_CLKSEL_HCLK) | VIDCON0_CLKVALUP_ALWAYS | VIDCON0_CLKVAL_F(nn);  
  186.     }  
  187.     else {  
  188.         VIDCON0_REG = (VIDCON0_S_RGB_IF) | (VIDCON0_VCLKFREE_NORMAL)  
  189.                 | (VIDCON0_S_CLKDIR_DIVIDED) | (VIDCON0_S_CLKSEL_HCLK) | VIDCON0_CLKVALUP_ALWAYS | VIDCON0_CLKVAL_F(0);  
  190.     }  
  191.   
  192.     VIDCON1_REG = ( VIDCON1_S_HSYNC_INVERTED) | (VIDCON1_S_VSYNC_INVERTED);  
  193.     VIDTCON0_REG = VIDTCON0_VBPD(S3CFB_VBP - 1) | VIDTCON0_VFPD(S3CFB_VFP - 1) | VIDTCON0_VSPW(S3CFB_VSW - 1) | VIDTCON0_VBPDE(0);  
  194.     VIDTCON1_REG = VIDTCON1_HBPD(S3CFB_HBP - 1) | VIDTCON1_HFPD(S3CFB_HFP - 1) | VIDTCON1_HSPW(S3CFB_HSW - 1) | VIDTCON1_VFPDE(0);  
  195.     VIDTCON2_REG = VIDTCON2_LINEVAL(S3CFB_VRES - 1) | VIDTCON2_HOZVAL(S3CFB_HRES - 1);  
  196. #if 0  
  197.     WINCON0_REG = WINCON_ALPHA0_SEL | WINCON_INRGB_RGB | WINCON_DATAPATH_DMA | WINCON_HAWSWP_ENABLE  
  198.                 | WINCON_WSWP_DISABLE |  WINCON_BYTESWP_DISABLE | WINCON_BITSWP_DISABLE | ( 0x5 << WINCON_BPPMODE_SHIFT);//bpp 32 0xd 32 0x5 16  
  199.     WINCON1_REG = WINCON_ALPHA0_SEL | WINCON_INRGB_RGB | WINCON_DATAPATH_DMA | WINCON_HAWSWP_ENABLE  
  200.                 | WINCON_WSWP_DISABLE |  WINCON_BYTESWP_DISABLE | WINCON_BITSWP_DISABLE | ( 0x5 << WINCON_BPPMODE_SHIFT);  
  201. #else  
  202.     WINCON0_REG = WINCON_INRGB_RGB | WINCON_HAWSWP_ENABLE | WINCON_BPPMODE_RGB565;//| WINCON_BLD_PIXEL | WINCON_ALPHA0_SEL;WINCON_INRGB_RGB |   
  203.     WINCON1_REG = WINCON_INRGB_RGB | WINCON_HAWSWP_ENABLE | WINCON_BPPMODE_RGB565 | WINCON_BLD_PIXEL;  
  204. #endif  
  205.   
  206.     SHODOWCON_REG = (0x3 << 0);//channel 0 1 enable  
  207. //protect  
  208.     //SHODOWCON_REG |= SHADOWCON_PROTECT(0x3);  
  209.     VIDOSD0A_REG = VIDOSDxA_OSD_LTX_F(0) | VIDOSDxA_OSD_LTY_F(0);  
  210.   
  211.     VIDOSD0B_REG = VIDOSDxB_OSD_RBX_F(S3CFB_HRES - 1) | VIDOSDxB_OSD_RBY_F(S3CFB_VRES - 1);  
  212.   
  213.     VIDOSD1A_REG = VIDOSDxA_OSD_LTX_F(0) | VIDOSDxA_OSD_LTY_F(0);  
  214.   
  215.     VIDOSD1B_REG = VIDOSDxB_OSD_RBX_F(S3CFB_HRES - 1) | VIDOSDxB_OSD_RBY_F(S3CFB_VRES - 1);  
  216.     VIDOSD1C_REG = 0xFFF000;//0xDDD000;/*alpha blending*/  
  217.     //VIDW0ALPHA0_REG = (0xf << 16) | ( 0xf << 8) | (0xf << 0);  
  218. //end  
  219. //osd size  
  220.     VIDOSD0C_REG = (S3CFB_HRES * S3CFB_VRES) << 0;  
  221.     VIDOSD1D_REG = (S3CFB_HRES * S3CFB_VRES) << 0;  
  222.   
  223.     fb_size = calc_fbsize();  
  224.     win0_base = (void *)LCD_FRAMEBUFFER_ADDR;  
  225.     win1_base = (void *)(LCD_FRAMEBUFFER_ADDR + fb_size);  
  226.     VIDW00ADD0B0_REG = virt_to_phys((unsigned int)win0_base);  
  227.     VIDW01ADD0B0_REG = virt_to_phys(win1_base);  
  228.     VIDW00ADD1B0_REG = virt_to_phys((unsigned int)win0_base) + fb_size;  
  229.     VIDW01ADD1B0_REG = virt_to_phys(win1_base) + fb_size;  
  230.   
  231. //buffer size  
  232.   
  233.     VIDW00ADD2_REG = VIDADDR_PAGEWIDTH(S3CFB_HRES * PIXELBITS / 8) | VIDADDR_OFFSIZE(0);//bpp  
  234.     VIDW01ADD2_REG = VIDADDR_PAGEWIDTH(S3CFB_HRES * PIXELBITS / 8) | VIDADDR_OFFSIZE(0);  
  235. //WxKEYCON  
  236.     W1KEYCON0_REG  = WxKEYCON0_KEYBLEN_ENABLE | WxKEYCON0_KEYEN_F_ENABLE | WxKEYCON0_COMPKEY(0xFFFF);  
  237.     W1KEYCON1_REG  = 0x00000000;/*color key*/  
  238.     //SHODOWCON_REG &= ~SHADOWCON_PROTECT(0x3);  
  239.     memset(win0_base,0x0000,fb_size*2);  
  240.     lcd_enable();  
  241.     WINCON0_REG |= WINCON_ENWIN_ENABLE;  
  242.     WINCON1_REG |= WINCON_ENWIN_ENABLE;  
  243.       
  244.     char cmd_buf[256];  
  245.     sprintf(cmd_buf, "fatload mmc 1 0x%x logo.bin",LCD_FRAMEBUFFER_ADDR);//背景  
  246.     run_command(cmd_buf, 0);  
  247.     gzsd_drawdoor(PG_X,PG_Y);  
  248.     gzsd_setprogress(0);  
  249.     lcd_backlight(1);  
  250.     return 0;   
  251. }  
这里主要需要用到的函数有

gzsd_lcd_init

gzsd_setprogress

先调用 gzsd_lcd_init进行初始化 然后在需要设置进度的地方使用gzsd_setprogress设置即可 

下面是需要的头文件

gzsd210_lcd.h

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. #ifndef GZSD2416_LCD_H  
  2. #define GZSD2416_LCD_H  
  3. #include <config.h>  
  4. #include "s3cfb_reg.h"  
  5. #include <regs.h>  
  6.   
  7. #if defined(CONFIG_LCD_NC43)  
  8.   
  9. #define S3CFB_HSW               41  
  10. #define S3CFB_HBP               2  
  11. #define S3CFB_HFP               2  
  12.   
  13. #define S3CFB_VSW               10  
  14. #define S3CFB_VBP               2  
  15. #define S3CFB_VFP               2  
  16.   
  17. #define S3CFB_HRES              480  
  18. #define S3CFB_VRES              272  
  19. #define S3CFB_VFRAME_FREQ       60  
  20.   
  21. #elif defined(CONFIG_LCD_AT070)  
  22.   
  23. #define S3CFB_HSW               20  
  24. #define S3CFB_HBP               30  
  25. #define S3CFB_HFP               88  
  26.   
  27. #define S3CFB_VSW               5  
  28. #define S3CFB_VBP               15  
  29. #define S3CFB_VFP               5  
  30.   
  31. #define S3CFB_HRES              800  
  32. #define S3CFB_VRES              480  
  33. #define S3CFB_VFRAME_FREQ       60  
  34.   
  35. #endif  
  36.   
  37. #if defined(CONFIG_LCDBPP_32)  
  38. #define PIXELBITS               32  
  39. //#define LCD_BPP                   LCD_COLOR32  
  40. #elif defined(CONFIG_LCDBPP_16)  
  41. #define PIXELBITS               16  
  42. //#define LCD_BPP                   LCD_COLOR16  
  43. #endif  
  44.   
  45. #define S3CFB_IVCLK             0//CFG_LOW  
  46. #define S3CFB_IHSYNC            1//CFG_HIGH  
  47. #define S3CFB_IVSYNC            1//CFG_HIGH  
  48. #define S3CFB_IVDEN             0//CFG_LOW  
  49.   
  50. #define S3CFB_PIXEL_CLOCK       (S3CFB_VFRAME_FREQ * (S3CFB_HFP + S3CFB_HSW + S3CFB_HBP + S3CFB_HRES) * (S3CFB_VFP + S3CFB_VSW + S3CFB_VBP + S3CFB_VRES))  
  51. #endif  

s3cfb_reg.h

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. #ifndef S3CFB_REG_H  
  2. #define S3CFB_REG_H  
  3.   
  4. #include <asm/hardware.h>  
  5. //display control  
  6. #define DISCONTROL_REG      __REG(0xE0107008)  
  7. #define DISCONTROLCON       (0xE0107008)  
  8. //lcd data  
  9. #define GPF0CON_REG         __REG(0xE0200120)  
  10. #define GPF0PUD_REG         __REG(0xE0200128)  
  11. #define GPF0DRV_REG         __REG(0xE020012C)  
  12. #define GPF1CON_REG         __REG(0xE0200140)  
  13. #define GPF1PUD_REG         __REG(0xE0200148)  
  14. #define GPF1DRV_REG         __REG(0xE020014C)  
  15. #define GPF2CON_REG         __REG(0xE0200160)  
  16. #define GPF2PUD_REG         __REG(0xE0200168)  
  17. #define GPF2DRV_REG         __REG(0xE020016C)  
  18. #define GPF3CON_REG         __REG(0xE0200180)  
  19. #define GPF3PUD_REG         __REG(0xE0200188)  
  20. #define GPF3DRV_REG         __REG(0xE020018C)  
  21. //lcd con  
  22. #define VIDCON0_REG         __REG(0xF8000000)  
  23. #define VIDCON1_REG         __REG(0xF8000004)  
  24. #define VIDCON2_REG         __REG(0xF8000008)  
  25.   
  26. #define VIDTCON0_REG        __REG(0xF8000010)  
  27. #define VIDTCON1_REG        __REG(0xF8000014)  
  28. #define VIDTCON2_REG        __REG(0xF8000018)  
  29.   
  30. #define WINCON0_REG         __REG(0xF8000020)  
  31. #define WINCON1_REG         __REG(0xF8000024)  
  32. #define WINCON2_REG         __REG(0xF8000028)  
  33. #define WINCON3_REG         __REG(0xF800002C)  
  34. #define WINCON4_REG         __REG(0xF8000030)  
  35.   
  36. //shadow control  
  37. #define SHODOWCON_REG       __REG(0xF8000034)  
  38.   
  39. //specifiles video size control  
  40. #define VIDOSD0A_REG        __REG(0xF8000040)  
  41. #define VIDOSD0B_REG        __REG(0xF8000044)  
  42. #define VIDOSD0C_REG        __REG(0xF8000048)  
  43. #define VIDOSD1A_REG        __REG(0xF8000050)  
  44. #define VIDOSD1B_REG        __REG(0xF8000054)  
  45. #define VIDOSD1C_REG        __REG(0xF8000058)  
  46. #define VIDOSD1D_REG        __REG(0xF800005C)  
  47.   
  48. #define VIDW00ADD0B0_REG    __REG(0xF80000A0)  
  49. #define VIDW01ADD0B0_REG    __REG(0xF80000A8)  
  50. #define VIDW00ADD1B0_REG    __REG(0xF80000D0)  
  51. #define VIDW01ADD1B0_REG    __REG(0xF80000D8)  
  52. #define VIDW00ADD2_REG      __REG(0xF8000100)  
  53. #define VIDW01ADD2_REG      __REG(0xF8000104)  
  54.   
  55. #define W1KEYCON0_REG       __REG(0xF8000140)  
  56. #define W1KEYCON1_REG       __REG(0xF8000144)  
  57.   
  58. #define VIDW0ALPHA0_REG     __REG(0xF8000200)  
  59. #define VIDW0ALPHA1_REG     __REG(0xF8000204)  
  60. #define VIDW1ALPHA0_REG     __REG(0xF8000208)  
  61. #define VIDW1ALPHA1_REG     __REG(0xF800020C)  
  62. //display control  
  63. #define DISPLAY_PATH_SEL(x) (((x)&0x3)<<0)  
  64. //rVIDCON0  
  65. #define VIDCON0_S_RGB_IF (0<<26)  
  66. #define VIDCON0_S_RGB_PAR (1<<17)  
  67. #define VIDCON0_S_CLKDIR_DIVIDED (1<<4)  
  68. #define VIDCON0_S_CLKSEL_HCLK (0<<2)  
  69. #define VIDCON0_ENVID_ENABLE (1 << 1)  
  70. #define VIDCON0_ENVID_F_ENABLE (1 << 0)  
  71. #define VIDCON0_CLKVALUP_ALWAYS     (0 << 16)  
  72. #define VIDCON0_VCLKFREE_NORMAL     (0 << 5)  
  73.   
  74. #define VIDCON0_CLKVAL_F(x) (((x)&0xff)<<6)  
  75.   
  76. //rVIDCON1  
  77. #define VIDCON1_S_HSYNC_INVERTED (1<<6)  
  78. #define VIDCON1_S_VSYNC_INVERTED (1<<5)  
  79.   
  80. /* VIDCON2 */  
  81. #define VIDCON2_EN601_DISABLE           (0 << 23)  
  82. #define VIDCON2_EN601_ENABLE            (1 << 23)  
  83. #define VIDCON2_EN601_MASK              (1 << 23)  
  84. #define VIDCON2_WB_DISABLE              (0 << 15)  
  85. #define VIDCON2_WB_ENABLE               (1 << 15)  
  86. #define VIDCON2_WB_MASK                 (1 << 15)  
  87. #define VIDCON2_TVFORMATSEL_HW          (0 << 14)  
  88. #define VIDCON2_TVFORMATSEL_SW          (1 << 14)  
  89. #define VIDCON2_TVFORMATSEL_MASK        (1 << 14)  
  90. #define VIDCON2_TVFORMATSEL_YUV422      (1 << 12)  
  91. #define VIDCON2_TVFORMATSEL_YUV444      (2 << 12)  
  92. #define VIDCON2_TVFORMATSEL_YUV_MASK    (3 << 12)  
  93. #define VIDCON2_ORGYUV_YCBCR            (0 << 8)  
  94. #define VIDCON2_ORGYUV_CBCRY            (1 << 8)  
  95. #define VIDCON2_ORGYUV_MASK             (1 << 8)  
  96. #define VIDCON2_YUVORD_CBCR             (0 << 7)  
  97. #define VIDCON2_YUVORD_CRCB             (1 << 7)  
  98. #define VIDCON2_YUVORD_MASK             (1 << 7)  
  99.   
  100. //rVIDTCON0  
  101. #define VIDTCON0_VBPDE(x) (((x)&0xff)<<24)  
  102. #define VIDTCON0_VBPD(x) (((x)&0xff)<<16)  
  103. #define VIDTCON0_VFPD(x) (((x)&0xff)<<8)  
  104. #define VIDTCON0_VSPW(x) (((x)&0xff)<<0)  
  105.   
  106. //rVIDTCON1  
  107. #define VIDTCON1_VFPDE(x) (((x)&0xff)<<24)  
  108. #define VIDTCON1_HBPD(x) (((x)&0xff)<<16)  
  109. #define VIDTCON1_HFPD(x) (((x)&0xff)<<8)  
  110. #define VIDTCON1_HSPW(x) (((x)&0xff)<<0)  
  111.   
  112. //rVIDTCON2  
  113. #define VIDTCON2_LINEVAL(x) (((x)&0x7ff)<<11)  
  114. #define VIDTCON2_HOZVAL(x) (((x)&0x7ff)<<0)  
  115.   
  116. /* window 0~4 control */  
  117. #define WINCON_DATAPATH_DMA             (0 << 22)  
  118. #define WINCON_DATAPATH_LOCAL           (1 << 22)  
  119. #define WINCON_DATAPATH_MASK            (1 << 22)  
  120. #define WINCON_BUFSEL_0                 (0 << 20)  
  121. #define WINCON_BUFSEL_1                 (1 << 20)  
  122. #define WINCON_BUFSEL_MASK              (1 << 20)  
  123. #define WINCON_BUFSEL_SHIFT             (20)  
  124. #define WINCON_BUFAUTO_DISABLE          (0 << 19)  
  125. #define WINCON_BUFAUTO_ENABLE           (1 << 19)  
  126. #define WINCON_BUFAUTO_MASK             (1 << 19)  
  127. #define WINCON_BITSWP_DISABLE           (0 << 18)  
  128. #define WINCON_BITSWP_ENABLE            (1 << 18)  
  129. #define WINCON_BITSWP_SHIFT             (18)  
  130. #define WINCON_BYTESWP_DISABLE          (0 << 17)  
  131. #define WINCON_BYTESWP_ENABLE           (1 << 17)  
  132. #define WINCON_BYTESWP_SHIFT            (17)  
  133. #define WINCON_HAWSWP_DISABLE           (0 << 16)  
  134. #define WINCON_HAWSWP_ENABLE            (1 << 16)  
  135. #define WINCON_HAWSWP_SHIFT             (16)  
  136. #define WINCON_WSWP_DISABLE             (0 << 15)  
  137. #define WINCON_WSWP_ENABLE              (1 << 15)  
  138. #define WINCON_WSWP_SHIFT               (15)  
  139. #define WINCON_INRGB_RGB                (0 << 13)  
  140. #define WINCON_INRGB_YUV                (1 << 13)  
  141. #define WINCON_INRGB_MASK               (1 << 13)  
  142. #define WINCON_BURSTLEN_16WORD          (0 << 9)  
  143. #define WINCON_BURSTLEN_8WORD           (1 << 9)  
  144. #define WINCON_BURSTLEN_4WORD           (2 << 9)  
  145. #define WINCON_BURSTLEN_MASK            (3 << 9)  
  146. #define WINCON_ALPHA_MULTI_DISABLE      (0 << 7)  
  147. #define WINCON_ALPHA_MULTI_ENABLE       (1 << 7)  
  148. #define WINCON_BLD_PLANE                (0 << 6)  
  149. #define WINCON_BLD_PIXEL                (1 << 6)  
  150. #define WINCON_BLD_MASK                 (1 << 6)  
  151. #define WINCON_BPPMODE_1BPP             (0 << 2)  
  152. #define WINCON_BPPMODE_2BPP             (1 << 2)  
  153. #define WINCON_BPPMODE_4BPP             (2 << 2)  
  154. #define WINCON_BPPMODE_8BPP_PAL         (3 << 2)  
  155. #define WINCON_BPPMODE_8BPP             (4 << 2)  
  156. #define WINCON_BPPMODE_16BPP_565        (5 << 2)  
  157. #define WINCON_BPPMODE_16BPP_A555       (6 << 2)  
  158. #define WINCON_BPPMODE_18BPP_666        (8 << 2)  
  159. #define WINCON_BPPMODE_18BPP_A665       (9 << 2)  
  160. #define WINCON_BPPMODE_24BPP_888        (0xb << 2)  
  161. #define WINCON_BPPMODE_24BPP_A887       (0xc << 2)  
  162. #define WINCON_BPPMODE_32BPP            (0xd << 2)  
  163. #define WINCON_BPPMODE_16BPP_A444       (0xe << 2)  
  164. #define WINCON_BPPMODE_15BPP_555        (0xf << 2)  
  165. #define WINCON_BPPMODE_MASK             (0xf << 2)  
  166. #define WINCON_BPPMODE_SHIFT            (2)  
  167. #define WINCON_BPPMODE_RGB565           (0x5 << 2)  
  168. #define WINCON_ALPHA0_SEL               (0 << 1)  
  169. #define WINCON_ALPHA1_SEL               (1 << 1)  
  170. #define WINCON_ALPHA_SEL_MASK           (1 << 1)  
  171. #define WINCON_ENWIN_DISABLE            (0 << 0)  
  172. #define WINCON_ENWIN_ENABLE             (1 << 0)  
  173.   
  174. #define WINCONx_BLD_PIX_PIXEL           (1<<6)  
  175. #define WINCONx_HAWSWP_ENABLE           (1<<16)  
  176.   
  177. //rVIDOSD0A  
  178. #define VIDOSDxA_OSD_LTX_F(x) (((x)&0x7ff)<<11)  
  179. #define VIDOSDxA_OSD_LTY_F(x) (((x)&0x7ff)<<0)  
  180.   
  181. //rVIDOSD0B  
  182. #define VIDOSDxB_OSD_RBX_F(x) (((x)&0x7ff)<<11)  
  183. #define VIDOSDxB_OSD_RBY_F(x) (((x)&0x7ff)<<0)  
  184.   
  185. /* VIDOSD0C, VIDOSDxD */  
  186. #define VIDOSD_SIZE(x)                  (((x) & 0xffffff) << 0)  
  187. //* VIDWxADD2  
  188. #define VIDWxADD2_OFFSIZE_F(x) (((x)&0x1fff)<<13)  
  189. #define VIDWxADD2_PAGEWIDTH_F(x) (((x)&0x1fff)<<0)   
  190. //WxKEYCON0  
  191. #define WxKEYCON0_KEYBLEN_ENABLE            (1<<26)  
  192. #define WxKEYCON0_KEYEN_F_ENABLE            (1<<25)  
  193. #define WxKEYCON0_COMPKEY(x)            (((x)&0xFFFFFF)<<0)  
  194.   
  195. /* SHADOWCON */  
  196. #define SHADOWCON_PROTECT(x)            (((x) & 0x1f) << 10)  
  197. #define SHADOWCON_CH_ENABLE(x)          (1 << (x))  
  198. #define SHADOWCON_CH_DISABLE(x)         (1 << (x))  
  199. #define SHADOWCON_LOCAL_ENABLE(x)       (0x20 << (x))  
  200. #define SHADOWCON_LOCAL_DISABLE(x)      (0x20 << (x))  
  201.   
  202. /* Buffer Size */  
  203. #define VIDADDR_OFFSIZE(x)              (((x) & 0x1fff) << 13)  
  204. #define VIDADDR_PAGEWIDTH(x)            (((x) & 0x1fff) << 0)  
  205. #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

效果如下


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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值