注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

还东国的博客

行之苟有恒,久久自芬芳

 
 
 

日志

 
 

嵌入式开发实战4——内核的编译之八LCD支持  

2012-06-14 22:03:20|  分类: ARM开发 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
 

嵌入式开发实战4——内核的编译之八LCD支持

 

 

今天把LCD的驱动打上,其实主要还是在mach-mini2440.c这个文件里。

首先打开这个文件:

把程序原来自带的删除(蓝色部分):

/* LCD driver info */

/*

 

static struct s3c2410fb_display mini2440_lcd_cfg __initdata = {

 

         .lcdcon5   = S3C2410_LCDCON5_FRM565 |

                              S3C2410_LCDCON5_INVVLINE |

                              S3C2410_LCDCON5_INVVFRAME |

                              S3C2410_LCDCON5_PWREN |

                              S3C2410_LCDCON5_HWSWP,

 

         .type                  = S3C2410_LCDCON1_TFT,

 

         .width                = 240,

         .height               = 320,

 

         .pixclock   = 166667, // HCLK 60 MHz, divisor 10

         .xres                   = 240,

         .yres                   = 320,

         .bpp          = 16,

         .left_margin     = 20,

         .right_margin  = 8,

         .hsync_len        = 4,

         .upper_margin         = 8,

         .lower_margin          = 7,

         .vsync_len         = 4,

};

 

static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {

         .displays  = &mini2440_lcd_cfg,

         .num_displays = 1,

         .default_display = 0,

 

#if 0

         // currently setup by downloader

         .gpccon             = 0xaa940659,

         .gpccon_mask = 0xffffffff,

         .gpcup               = 0x0000ffff,

         .gpcup_mask   = 0xffffffff,

         .gpdcon             = 0xaa84aaa0,

         .gpdcon_mask = 0xffffffff,

         .gpdup               = 0x0000faff,

         .gpdup_mask   = 0xffffffff,

#endif

 

         .lpcsel                = ((0xCE6) & ~7) | 1<<4,

};

-------------------------ownerself delete------------------fjf delete 2012-6-14-------*/

然后增加友善的移植部分:

/*add myself 2012-6-14  LCD --------------------------------------------------------------------*/

 

 

/* LCD driver info */

 

//NEC 3.5”??LCD 的??配?置?和¨?参?数?y设?¨¨置?

#if defined(CONFIG_FB_S3C2410_N240320)

 

#define LCD_WIDTH 240

#define LCD_HEIGHT 320

#define LCD_PIXCLOCK 100000

 

#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

 

//夏?普?8”??LCD 的??配?置?和¨?参?数?y设?¨¨置?

#elif defined(CONFIG_FB_S3C2410_TFT640480)

#define LCD_WIDTH 640

#define LCD_HEIGHT 480

#define LCD_PIXCLOCK 80000

 

#define LCD_RIGHT_MARGIN 67  

#define LCD_LEFT_MARGIN 40

#define LCD_HSYNC_LEN 31

 

#define LCD_UPPER_MARGIN 25

#define LCD_LOWER_MARGIN 5

#define LCD_VSYNC_LEN 1

 

//统?3宝?|3.5”??LCD 的??配?置?和¨?参?数?y设?¨¨置?

#elif defined(CONFIG_FB_S3C2410_T240320)

#define LCD_WIDTH 240

#define LCD_HEIGHT 320

#define LCD_PIXCLOCK 146250//170000

 

 

 

#define LCD_RIGHT_MARGIN 25

#define LCD_LEFT_MARGIN 0

#define LCD_HSYNC_LEN 4

 

#define LCD_UPPER_MARGIN 1

#define LCD_LOWER_MARGIN 4

#define LCD_VSYNC_LEN 1

 

//群¨o创???7”??LCD 的??配?置?和¨?参?数?y设?¨¨置?

#elif defined(CONFIG_FB_S3C2410_TFT800480)

#define LCD_WIDTH 800

#define LCD_HEIGHT 480

#define LCD_PIXCLOCK 11463//40000

 

#define LCD_RIGHT_MARGIN 67

#define LCD_LEFT_MARGIN 40

#define LCD_HSYNC_LEN 31

 

#define LCD_UPPER_MARGIN 25

#define LCD_LOWER_MARGIN 5

#define LCD_VSYNC_LEN 1

 

//LCD2VGA(分¤?辨??率¨?为a1024x768)模?ê块¨?的??配?置?和¨?参?数?y设?¨¨置?

#elif defined(CONFIG_FB_S3C2410_VGA1024768)

#define LCD_WIDTH 1024

#define LCD_HEIGHT 768

#define LCD_PIXCLOCK 80000

 

#define LCD_RIGHT_MARGIN 15

#define LCD_LEFT_MARGIN 199

#define LCD_HSYNC_LEN 15

 

#define LCD_UPPER_MARGIN 1

#define LCD_LOWER_MARGIN 1

#define LCD_VSYNC_LEN 1

#define LCD_CON5 (S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_HWSWP)

 

#endif

 

 

 

#if defined (LCD_WIDTH)

 

static struct s3c2410fb_display mini2440_lcd_cfg __initdata = {

 

#if !defined (LCD_CON5)

        .lcdcon5        = S3C2410_LCDCON5_FRM565 |

                          S3C2410_LCDCON5_INVVLINE |

                          S3C2410_LCDCON5_INVVFRAME |

                          S3C2410_LCDCON5_PWREN |

                          S3C2410_LCDCON5_HWSWP,

#else

        .lcdcon5        = LCD_CON5,

#endif

 

        .type           = S3C2410_LCDCON1_TFT,

 

        .width          = LCD_WIDTH,

        .height         = LCD_HEIGHT,

 

        .pixclock       = LCD_PIXCLOCK,

        .xres           = LCD_WIDTH,

        .yres           = LCD_HEIGHT,

        .bpp            = 16,

        .left_margin    = LCD_LEFT_MARGIN + 1,

        .right_margin   = LCD_RIGHT_MARGIN + 1,

        .hsync_len      = LCD_HSYNC_LEN + 1,

        .upper_margin   = LCD_UPPER_MARGIN + 1,

        .lower_margin   = LCD_LOWER_MARGIN + 1,

        .vsync_len      = LCD_VSYNC_LEN + 1,

};

 

static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {

        .displays       = &mini2440_lcd_cfg,

        .num_displays   = 1,

        .default_display = 0,

 

        .gpccon =       0xaa955699,

        .gpccon_mask =  0xffc003cc,

        .gpcup =        0x0000ffff,

 

 

        .gpcup_mask =   0xffffffff,

 

        .gpdcon =       0xaa95aaa1,

        .gpdcon_mask =  0xffc0fff0,

        .gpdup =        0x0000faff,

        .gpdup_mask =   0xffffffff,

 

 

        .lpcsel         = 0xf82,

};

 

#endif

 

 

/*------------------endregion----------------------------------------------------------------------*/

这样基本上LCD的驱动就OK了,下来就是老规矩,配置Kconfig文件,进入到/drivers/video目录下:

打开Kconfig配置文件,增加下红色部分代码:

config FB_S3C2410_DEBUG

  bool "S3C2410 lcd debug messages"

  depends on FB_S3C2410

 help

      Turn on debugging messages. Note that you can set/unset at run time

    through sysfs

 

choice

  prompt "LCD select"

  depends on FB_S3C2410

 help

     S3C24x0 LCD size select

 

config FB_S3C2410_T240320

  boolean "3.5 inch 240X320 Toppoly LCD"

  depends on FB_S3C2410

 help

      3.5 inch 240X320 Toppoly LCD

 

config FB_S3C2410_N240320

  boolean "3.5 inch 240X320 NEC LCD"

  depends on FB_S3C2410

 help

        3.5 inch 240x320 NEC LCD

 

config FB_S3C2410_TFT640480

 

 

  boolean "8 inch 640X480 L80 LCD"

  depends on FB_S3C2410

 help

     8 inch 640X480 LCD

 

config FB_S3C2410_TFT800480

  boolean "7 inch 800x480 TFT LCD"

  depends on FB_S3C2410

 help

     7 inch 800x480 TFT LCD

 

config FB_S3C2410_VGA1024768

  boolean "VGA 1024x768"

  depends on FB_S3C2410

 help

     VGA 1024x768

 

endchoice

 

config BACKLIGHT_MINI2440

  tristate "Backlight support for mini2440 from FriendlyARM"

  depends on MACH_MINI2440 && FB_S3C2410

 help

      backlight driver for MINI2440 from FriendlyARM

 

下来就是配置make menuconfig了,命令启动界面:

Device Drivers  --->

  Graphics support  --->

<*> Support for frame buffer devices    --->

  LCD select (3.5 inch  240X320 Toppoly LCD)  --->

找到自己的LCD,这里是第一项。选中。回车退出,最后记得保存。

然后就可以执行:make zImage,等上两三分钟,搞定。

要努力学习,努力工作。勤勤恳恳,永不言败。

  评论这张
 
阅读(848)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017