Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7688585
  • 博文数量: 961
  • 博客积分: 15795
  • 博客等级: 上将
  • 技术积分: 16612
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 14:23
文章分类

全部博文(961)

文章存档

2016年(1)

2015年(61)

2014年(41)

2013年(51)

2012年(235)

2011年(391)

2010年(181)

分类: 嵌入式

2010-08-14 10:27:26

嵌入式学习入门 http://blog.chinaunix.net/u3/117680/showart.php?id=2300212  

      文章——>嵌入式学习入门    全面的讲述学习嵌入式linux中的每个步骤 

 

内核里已经有很完善的LCD驱动了,只要根据所用的LCD进行简单的修改,在内核源码drivers/video/s3c2410fb.cLCD驱动的源码,首先要设置LCD的时钟频率,有一个计算公式,很复杂,不用管它,直接修改程序实现。

在第365行开始的函数:

static void s3c2410fb_activate_var(struct fb_info *info)

{

    struct s3c2410fb_info *fbi = info->par;

void __iomem *regs = fbi->io;

int type = fbi->regs.lcdcon1 & S3C2410_LCDCON1_TFT;

struct fb_var_screeninfo *var = &info->var;

struct s3c2410fb_mach_info *mach_info = fbi->dev->platform_data;

struct s3c2410fb_display *default_display = mach_info->displays + mach_info->default_display;

int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2;

dprintk("%s: var->xres = %d\n", __func__, var->xres);

dprintk("%s: var->yres = %d\n", __func__, var->yres);

dprintk("%s: var->bpp = %d\n", __func__, var->bits_per_pixel);

if (type == S3C2410_LCDCON1_TFT) {

s3c2410fb_calculate_tft_lcd_regs(info, &fbi->regs);

--clkdiv;

if (clkdiv < 0)

clkdiv = 0;

} else {

s3c2410fb_calculate_stn_lcd_regs(info, &fbi->regs);

if (clkdiv < 2)

clkdiv = 2;

}

// fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(clkdiv);

fbi->regs.lcdcon1 |=

S3C2410_LCDCON1_CLKVAL(default_display->setclkval);

这几句是在s3c2410fb_display结构体中加入了setclkval变量,我们需要在结构体原型中加入这个变量,在arch/arm/mach-s3c2410/include/mach/fb.h中第40行加入:unsigned setclkval; /*clkval*/

 

修改LCD参数配置:(这个要查看所用LCD的手册来确定参数)

修改arch/arm/mach-s3c2440/mach-smdk2440.c中第107行的结构体,我修改的参

数如下:

static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {

.lcdcon5 = S3C2410_LCDCON5_FRM565 |

S3C2410_LCDCON5_INVVLINE |

S3C2410_LCDCON5_INVVFRAME |

S3C2410_LCDCON5_PWREN |

S3C2410_LCDCON5_HWSWP,

 

.type = S3C2410_LCDCON1_TFT,

 

.width = 320,

.height = 240,


.pixclock = 100000, /* HCLK 60 MHz, divisor 10 */

.setclkval = 0x3, /*add by xgc*/

.xres = 320,

.yres = 240,

.bpp = 16,

.left_margin = 19,

.right_margin = 24,

.hsync_len = 44,

.upper_margin = 7,

.lower_margin = 5,

.vsync_len = 15,

};

 


屏蔽掉第150行的语句:

 

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

 

2. 配置内核选项。选上LCD支持和Logo图标

 

Device Drivers --->
    Graphics support --->
        < > Lowlevel video output switch controls
        <*> Support for frame buffer devices --->
            --- Support for frame buffer devices
            [*] Enable firmware EDID
            [ ] Framebuffer foreign endianness support --->
            [*] Enable Video Mode Handling Helpers
            [ ] Enable Tile Blitting Support
            *** Frame buffer hardware drivers ***
            < > Epson S1D13XXX framebuffer support
            <*> S3C2410 LCD framebuffer support
            [ ] S3C2410 lcd debug messages
            < > Silicon Motion SM501 framebuffer support
            < > Virtual Frame Buffer support (ONLY FOR TESTING!)
            < > E-Ink Metronome/8track controller support
            < > Fujitsu MB862xx GDC support
            < > E-Ink Broadsheet/Epson S1D13521 controller support
        [*] Backlight & LCD device support --->
            Display device support --->
            Console display driver support --->
        [*] Bootup logo --->
            --- Bootup logo
            [ ] Standard black and white Linux logo
            [ ] Standard 16-color Linux logo
            [*] Standard 224-color Linux logo (NEW)


3. 重新编译内核并下载到开发板上,上电系统启动后可以看到LCD亮起,并且出现小企鹅图标。

阅读(1833) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~