www.pudn.com > touchscreeAndUsbkeyboardMouseDriver.rar > ֲɹfor2.6.rtf, change:2007-06-12,size:23644b
在 linux2.6.14 中没有提供 s3c2410 的驱动,所以我们要新建驱动文件,我们在 linux2.6.14/drivers/input/touchscreen 目录下建立新的文件 hfrk_s3c2410_ts.c 文件,驱动文件我们可以参考类似的触摸屏驱动,具体的内容参看网站或者光盘提供的源代码。
首先:我们需要修改 linux2.6.14/drivers/input/touchscreen 目录下的 makefile 文件,在文件的最后 添加 :
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += hfrk_s3c2410_ts.o
第二:我们需要修改 linux2.6.14/ drivers/input/touchscreen/Kconfig 中添加:
config TOUCHSCREEN_S
tristate "Samsung S3C2410 touchscreen input driver"
depends on ARCH_SMDK2410 && INPUT && INPUT_TOUCHSCREEN
select SERIO
help
Say Y here if you have the s3c2410 touchscreen.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called s3c2410_ts.
config TOUCHSCREEN_S3C2410_DEBUG
boolean "Samsung S3C2410 touchscreen debug messages"
depends on TOUCHSCREEN_S3C2410
help
Select this if you want debug messages
修改完成以后,在我们配置内核的时候,就会增加关系s3c2410的触摸屏配置,我们选择上这些配置就可以把驱动增加进去了
Device drivers - à
Input device support à
Touchscreens à
<*>Samsung S3C2410 touchscreen input driver
[]Samsung s3c2410 touchscreen debug message
第三:在 /linux-2.6.14/arch/arm/mach-s3c2410/mach-smdk2410.c, 中增加如下内容:
static struct s3c2410_ts_mach_info sbc2410_ts_cfg __initdata = {
.delay = 10000,
.presc = 49,
.oversampling_shift = 2,
};
在smdk2410_devices结构中,添加:
&s3c_device_ts,
在smdk2410_map_io函数中添加:
set_s3c2410ts_info(&sbc2410_ts_cfg);
第四:在 /linux-2.6.14/ arch/arm/mach-s3c2410/devs.h 文件中添加:
extern struct platform_device s3c_device_ts;
第五:在arch/arm/mach-s3c2410/devs.c文件中添加如下几行:
/* Touchscreen */
static struct s3c2410_ts_mach_info s3c2410ts_info;
void __init set_s3c2410ts_info(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
{
memcpy(&s3c2410ts_info,hard_s3c2410ts_info,sizeof(struct s3c2410_ts_mach_info));
}
EXPORT_SYMBOL(set_s3c2410ts_info);
struct platform_device s3c_device_ts = {
.name = "s3c2410-ts",
.id = -1,
.dev = {
.platform_data = &s3c2410ts_info,
}
};
EXPORT_SYMBOL(s3c_device_ts);
经过这些修改,我们的触摸屏驱动已经完成 , 我们编译就可以了。我们的 这个触摸屏驱动在内核注册为 /dev/input/mouse0
十.创建设备文件
根据你的配置情况创建相应的设备文件例如:
mknod -m 666 ts -c 13 128 等
首先需要有调试好的2.6触摸屏驱动,该驱动在网上可以找到,它将触摸屏注册为input设备,将坐标信息传输到input层。tslib可以直接从input层获取坐标信息,因此,下面将要介绍如何让qte3.3.5支持tslib。这样qte3.3.5的程序就可以用触摸屏控制了。
qte2,qtopia都直接支持tslib,而qte3不能直接支持tslib,需要加patch。具体方法如下:
1.编译qte3.3.5
* cd qte-3.3.5
* export QTDIR=$PWD
* cp uic bin/(拷贝x-11的bin/uic工具到bin下)
* (关键步骤,否则编译时会报错说libts不兼容)
$ echo yes |./configure -embedded arm -thread
$ cd src/moc
$ make
* 从网上寻找tslib-patch。该patch针对qte3.3.4,此处根据patch内容手动patch:增加两个文件到 src/embedded/下(src/embedded/qmousetslib_qws.h, src/embedded/qmousetslib_qws.cpp),修改相应文件 (src/embedded/qmousedriverfactory_qws.cpp, src/embedded/qt_embedded.pri,configure)
* 编译tslib,拷贝tslib.h到include,libts.so等库到lib下。
* $ echo yes |./configure -embedded arm –thread –qt-mouse-tslib –I$QTDIR/include –L$QTDIR/lib –lts
* make
* make install
2.拷贝文件到目标板
拷贝qte3.3.5/lib到目标板,拷贝tslib的build目录到目标板(记住,要拷贝和编译qte时使用的相同的tslib版本)
3.设置环境变量
export QTDIR=/hjcai
export LD_LIBRARY_PATH=/hjcai/lib
export QWS_MOUSE_PROTO=tslib:/dev/input/tsraw0
export TSLIB_TSDEVICE=/dev/input/tsraw0
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONFFILE=/hjcai/build/etc/ts.conf
export TSLIB_PLUGINDIR=/hjcai/build/share/ts/plugins
export TSLIB_TSEVENTTYPE="H3600"
export TSLIB_CALIBFILE=/etc/pointercal
4 触摸屏校正
先进行触摸屏校正,注释掉build/etc/ts.conf中的dejitter模块,执行build/bin下的ts_calibrate程序,此时会在/etc下生成pointercal文件。
5 测试
拷贝qte3.3.5下examples/hello/hello文件到目标板,修改权限,然后执行
./hello –qws
发现程序可以用触摸屏控制。
关于硬件。
从LCD的型号来来看,与s3c2410兼容得比较好的LCD是Sumsung自己产的LTS系列,如LTS350Q1PD1,LTS350Q1PE1。但是这类型号现在已停产,基本上无法买到。代替的型号是LTV系列,如LTV350QVF04,LTV350QVF05。
我使用的是LTV350QVF05。这是一款3.5寸,由TFT LCD,背光电路,触摸屏,内置驱动四部分组成的LCD模块。由于内置了驱动电路,因此它可以和s3c2410之间可以直接相连,硬件设计简单。少量购买的价格在300左右。
LTV350QVF05通过一个60pin的软平线接口和外面相连,其中除了和s3c2410相连接的信号外,最重要的是它的几个电源信号,包括背光部分的电源。调试硬件,首先要保证它的几个电源信号满足要求。Max1779芯片提供三路电源输出,能很好地满足需求。另外需要提供一个Vcom信号。该信号用于LCD的行翻转,是一个低电平0V,高电平3.3V左右的方波信号。LCD模块内部提供一个M信号,只需要将该信号取反就可以得到Vcom信号。通常会搭一个可调的运放电路来实现,调整放大倍数和偏移可以改变屏的亮度和对比度。
在调试好几个电源信号后,上电,应该可以把屏点亮。起初应该是白屏。
下面介绍驱动的移植。
关于驱动移植。
网上可以找到代码s3c2410fb.c,基本上可以直接使用。移植的基本步骤是:
1. 添加s3c2410fb.c到drivers/video目录下。
2. 在s3c2410fb.c中添加适当的LCD初始化代码。LTV350QV接口中有一个spi接口用来启动LCD,设计中可以采用gpio口来模拟spi口输出控制信号。编写一个初始化函数,然后在s3c2410fb_init函数中调用即可。
3. 修改video目录的Kconfig和Makefile,保证s3c2410fb.c被编译进内核。
4. 在arch/arm/mach-s3c2410/mach-smdk2410.c中添加static struct s3c2410fb_mach_info smdk2410_lcd_platdata结构。该结构的参数用于设置s3c2410的LCD控制寄存器,需要认真根据自己的LCD参数来设置。包括分辨率、帧频、图像格式等参数。
5. 在arch/arm/mach-s3c2410/mach-smdk2410.c函数smdk2410_map_io中添加代码:
set_s3c2410fb_info(&smdk2410_lcd_platdata)
6. 在arch/arm/mach-s3c2410/devs.c中添加以下代码:
static struct s3c2410fb_mach_info s3c2410fb_info;
void __init set_s3c2410fb_info(struct s3c2410fb_mach_info *hard_s3c2410fb_info)
{
memcpy(&s3c2410fb_info,hard_s3c2410fb_info,sizeof(struct s3c2410fb_mach_info));
s3c_device_lcd.dev.platform_data = &s3c2410fb_info;
}
EXPORT_SYMBOL(set_s3c2410fb_info);
7. 配置内核,添加对LCD的支持,包括启动logo(小企鹅)的支持。
如果启动后可以看见小企鹅,说明LCD驱动移植成功。
可能的问题:
1. smdk2410_lcd_platdata结构中帧频(Vsync的频率)的设置不能高于LCD的最高帧频,可以增大lcdcon1中clkval的值Vclk,进而降低Vsync。
2. 图像深度最好设为16bpp,我用过24bpp,结果无法显示企鹅,可能是内核驱动本身不支持。
3. 如果过几分钟后,图像没了。注释掉drivers/char/vt.c中的blank_screen_t()函数内容。
调试过程:
按照以上步骤做好后,在终端输入命令:make bzImage
确保linux-2.6.14/include/asm/arch-s3c2410/s3c2410_ts.h有该文件
出现以下错误:
CC arch/arm/mach-s3c2410/mach-smdk2410.o
arch/arm/mach-s3c2410/mach-smdk2410.c:131: error: variable `sbc2410_ts_cfg' has initializer but incomplete type
arch/arm/mach-s3c2410/mach-smdk2410.c:132: error: unknown field `delay' specified in initializer
arch/arm/mach-s3c2410/mach-smdk2410.c:132: warning: excess elements in struct initializer
arch/arm/mach-s3c2410/mach-smdk2410.c:132: warning: (near initialization for `sbc2410_ts_cfg')
arch/arm/mach-s3c2410/mach-smdk2410.c:133: error: unknown field `presc' specified in initializer
arch/arm/mach-s3c2410/mach-smdk2410.c:133: warning: excess elements in struct initializer
arch/arm/mach-s3c2410/mach-smdk2410.c:133: warning: (near initialization for `sbc2410_ts_cfg')
arch/arm/mach-s3c2410/mach-smdk2410.c:134: error: unknown field `oversampling_shift' specified in initializer
arch/arm/mach-s3c2410/mach-smdk2410.c:134: warning: excess elements in struct initializer
arch/arm/mach-s3c2410/mach-smdk2410.c:134: warning: (near initialization for `sbc2410_ts_cfg')
arch/arm/mach-s3c2410/mach-smdk2410.c: In function `smdk2410_map_io':
arch/arm/mach-s3c2410/mach-smdk2410.c:143: warning: implicit declaration of function `set_s3c2410ts_info'
arch/arm/mach-s3c2410/mach-smdk2410.c: At top level:
arch/arm/mach-s3c2410/mach-smdk2410.c:131: error: storage size of `sbc2410_ts_cfg' isn't known
make[1]: *** [arch/arm/mach-s3c2410/mach-smdk2410.o] 错误 1
make: *** [arch/arm/mach-s3c2410] 错误 2
在arch/arm/mach-s3c2410/devs.c文件中添加如下几行:
#include
在 /linux-2.6.14/arch/arm/mach-s3c2410/mach-smdk2410.c, 中增加如下内容:
#include
重新编译,有下面的错误:
CC drivers/input/touchscreen/s3c2410_ts.o
drivers/input/touchscreen/s3c2410_ts.c: In function `touch_timer_fire':
drivers/input/touchscreen/s3c2410_ts.c:145: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c:154: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c: In function `stylus_action':
drivers/input/touchscreen/s3c2410_ts.c:196: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c:200: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c: In function `s3c2410ts_probe':
drivers/input/touchscreen/s3c2410_ts.c:261: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c: In function `touch_timer_fire':
drivers/input/touchscreen/s3c2410_ts.c:145: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c:154: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c: In function `stylus_action':
drivers/input/touchscreen/s3c2410_ts.c:196: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c:200: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c: In function `s3c2410ts_probe':
drivers/input/touchscreen/s3c2410_ts.c:261: warning: statement with no effect
make[3]: *** [drivers/input/touchscreen/s3c2410_ts.o] 错误 1
make[2]: *** [drivers/input/touchscreen] 错误 2
make[1]: *** [drivers/input] 错误 2
make: *** [drivers] 错误 2
在文件位置在 include/asm-arm/arch-s3c2410/regs-adc.h, 并在其添加如下内容
#define S3C2410_ADCTSC_XY_PST_N (0x0<<0)
#define S3C2410_ADCTSC_XY_PST_X (0x1<<0)
#define S3C2410_ADCTSC_XY_PST_Y (0x2<<0)
#define S3C2410_ADCTSC_XY_PST_W (0x3<<0)
但好象没效果。
下面是使用胡军国给的tsFrom军国的s3c2410_ts.c和s3c2410_ts.h(需复制到linux-2.6.14/include/asm/arch
)文件,
$make bzImage
出现以下错误:
CC drivers/input/touchscreen/s3c2410_ts.o
drivers/input/touchscreen/s3c2410_ts.c:107:1: warning: "IRQ_HANDLED" redefined
In file included from include/linux/rcuref.h:36,
from include/linux/fs.h:12,
from include/linux/mm.h:15,
from include/linux/poll.h:11,
from drivers/input/touchscreen/s3c2410_ts.c:85:
include/linux/interrupt.h:33:1: warning: this is the location of the previous definition
drivers/input/touchscreen/s3c2410_ts.c: In function `touch_timer_fire':
drivers/input/touchscreen/s3c2410_ts.c:244: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c:275: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c:200: warning: unused variable `updown'
drivers/input/touchscreen/s3c2410_ts.c:200: warning: unused variable `i'
drivers/input/touchscreen/s3c2410_ts.c: In function `stylus_updown':
drivers/input/touchscreen/s3c2410_ts.c:294: warning: unused variable `lcdstate'
drivers/input/touchscreen/s3c2410_ts.c:294: warning: unused variable `lcdenble'
drivers/input/touchscreen/s3c2410_ts.c: In function `stylus_action':
drivers/input/touchscreen/s3c2410_ts.c:365: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c:376: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c: In function `s3c2410ts_probe':
drivers/input/touchscreen/s3c2410_ts.c:430: warning: implicit declaration of function `clk_get'
drivers/input/touchscreen/s3c2410_ts.c:430: warning: assignment makes pointer from integer without a cast
drivers/input/touchscreen/s3c2410_ts.c:440: warning: implicit declaration of function `clk_use'
drivers/input/touchscreen/s3c2410_ts.c:442: warning: implicit declaration of function `clk_enable'
drivers/input/touchscreen/s3c2410_ts.c:486: error: called object is not a function
drivers/input/touchscreen/s3c2410_ts.c:533: warning: passing arg 2 of `request_irq' from incompatible pointer type
drivers/input/touchscreen/s3c2410_ts.c:545: warning: passing arg 2 of `request_irq' from incompatible pointer type
drivers/input/touchscreen/s3c2410_ts.c: In function `s3c2410ts_remove':
drivers/input/touchscreen/s3c2410_ts.c:588: warning: implicit declaration of function `clk_disable'
drivers/input/touchscreen/s3c2410_ts.c:590: warning: implicit declaration of function `clk_unuse'
drivers/input/touchscreen/s3c2410_ts.c:592: warning: implicit declaration of function `clk_put'
drivers/input/touchscreen/s3c2410_ts.c: In function `touch_timer_fire':
drivers/input/touchscreen/s3c2410_ts.c:244: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c:275: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c: In function `stylus_action':
drivers/input/touchscreen/s3c2410_ts.c:365: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c:376: warning: statement with no effect
drivers/input/touchscreen/s3c2410_ts.c: In function `s3c2410ts_probe':
drivers/input/touchscreen/s3c2410_ts.c:486: warning: statement with no effect
make[3]: *** [drivers/input/touchscreen/s3c2410_ts.o] 错误 1
make[2]: *** [drivers/input/touchscreen] 错误 2
make[1]: *** [drivers/input] 错误 2
make: *** [drivers] 错误 2
在regs-adc.h中加入相应内容:
/* linux/include/asm/arch-s3c2410/regs-adc.h
*
* Copyright (c) 2004 Shannon Holland
*
* This program is free software; yosu can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* S3C2410 ADC registers
*
* Changelog:
* 27-09-2004 SAH Created file
*/
#ifndef __ASM_ARCH_REGS_ADC_H
#define __ASM_ARCH_REGS_ADC_H "regs-adc.h"
#define S3C2410_ADCREG(x) (x)
#define S3C2410_ADCCON S3C2410_ADCREG(0x00)
#define S3C2410_ADCTSC S3C2410_ADCREG(0x04)
#define S3C2410_ADCDLY S3C2410_ADCREG(0x08)
#define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C)
#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
/***************************add by lfc***************************/
#define S3C2410_ADC_IN0 0
#define S3C2410_ADC_IN1 1
#define S3C2410_ADC_IN2 2
#define S3C2410_ADC_IN3 3
#define S3C2410_ADC_IN4 4
#define S3C2410_ADC_IN5 5
#define S3C2410_ADC_IN6 6
#define S3C2410_ADC_IN7 7
#define S3C2410_ADC_BUSY 1
#define S3C2410_ADC_READY 0
#define S3C2410_NOP_MODE 0
#define S3C2410_X_AXIS_MODE 1
#define S3C2410_Y_AXIS_MODE 2
#define S3C2410_WAIT_INT_MODE 3
/*****************************end add****************************/
/* ADCCON Register Bits */
#define S3C2410_ADCCON_ECFLG (1<<15)
#define S3C2410_ADCCON_PRSCEN (1<<14)
#define S3C2410_ADCCON_PRSCVL(x) (((x)&0xFF)<<6)
#define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6)
#define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3)
#define S3C2410_ADCCON_MUXMASK (0x7<<3)
#define S3C2410_ADCCON_STDBM (1<<2)
#define S3C2410_ADCCON_READ_START (1<<1)
#define S3C2410_ADCCON_ENABLE_START (1<<0)
#define S3C2410_ADCCON_STARTMASK (0x3<<0)
/**************************add by lfc***********************/
#define S3C2410_ADCCON_PRSCDIS (S3C2410_ADCCON_PRSCEN*0)
/***************************end add*************************/
/* ADCTSC Register Bits */
/**************************add by lfc************************/
#define S3C2410_UD_SEN (1<<8)
/***************************end add**************************/
#define S3C2410_ADCTSC_YM_SEN (1<<7)
#define S3C2410_ADCTSC_YP_SEN (1<<6)
#define S3C2410_ADCTSC_XM_SEN (1<<5)
#define S3C2410_ADCTSC_XP_SEN (1<<4)
#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
#define S3C2410_ADCTSC_AUTO_PST (1<<2)
#define S3C2410_ADCTSC_XY_PST (0x3<<0)
/**********************modify by lfc**************************/
#define S3C2410_ADCTSC_XY_PST(x) (((x)&0x3)<<0)
#define S3C2410_DOWN_INT (S3C2410_UD_SEN*0)
#define S3C2410_UP_INT (S3C2410_UD_SEN*1)
#define S3C2410_ADCTSC_XM_HIZ (S3C2410_ADCTSC_XM_SEN*0)
#define S3C2410_ADCTSC_XM_GND (S3C2410_ADCTSC_XM_SEN*1)
#define S3C2410_ADCTSC_XP_EXTVLT (S3C2410_ADCTSC_XP_SEN*0)
#define S3C2410_ADCTSC_XP_AIN (S3C2410_ADCTSC_XP_SEN*1)
#define S3C2410_ADCTSC_YM_HIZ (S3C2410_ADCTSC_YM_SEN*0)
#define S3C2410_ADCTSC_YM_GND (S3C2410_ADCTSC_YM_SEN*1)
#define S3C2410_ADCTSC_YP_EXTVLT (S3C2410_ADCTSC_YP_SEN*0)
#define S3C2410_ADCTSC_YP_AIN (S3C2410_ADCTSC_YP_SEN*1)
#define S3C2410_ADCTSC_XP_PULL_UP_EN (S3C2410_ADCTSC_XP_PULL_UP_DIS*0)
/************************end modify***************************/
/* ADCDAT0 Bits */
#define S3C2410_ADCDAT0_UPDOWN (1<<15)
#define S3C2410_ADCDAT0_AUTO_PST (1<<14)
#define S3C2410_ADCDAT0_XY_PST (0x3<<12)
#define S3C2410_ADCDAT0_XPDATA_MASK (0x03FF)
/* ADCDAT1 Bits */
#define S3C2410_ADCDAT1_UPDOWN (1<<15)
#define S3C2410_ADCDAT1_AUTO_PST (1<<14)
#define S3C2410_ADCDAT1_XY_PST (0x3<<12)
#define S3C2410_ADCDAT1_YPDATA_MASK (0x03FF)
/*added by Zxh*/
#define S3C2410_ADCTSC_XY_PST_N (0x0<<0)
#define S3C2410_ADCTSC_XY_PST_X (0x1<<0)
#define S3C2410_ADCTSC_XY_PST_Y (0x2<<0)
#define S3C2410_ADCTSC_XY_PST_W (0x3<<0)
/*added by Zxh*/
#endif /* __ASM_ARCH_REGS_ADC_H */
后重新编译解决问题。
要选中input device support中的Touchscreen interface
内核配置中选择device driver-->graphics support-->logo configuration
重新编译内核,烧到开发板中。就OK了
学会ctags命令可cscope查找一下
按理说,这样做过后,启动开发板应该出现小企鹅,但结果并没有显示。后来经过搜索相应资料,了解到这可能是framebuffer驱动没搞好的缘故。因为该驱动和屏幕分辩率有关。2007.6.12日早上和潘建聊起来,他说需要在bootloader启动时加参数VGA,如在grub.conf中加入VGA=0x...,但这一般适用于PC机,在嵌入式系统中
胡军国说:最好编译tslib,用它来检测触摸屏。tslib可以直接从input层获取坐标信息
以下是成功显示小企鹅的步骤:
启动开发板,出现小企鹅表明framebuffer驱动成功(LCD驱动)成功。先前没有出现是因为framebuffer驱动没搞好。
也就是说先要移植LCD驱动。
我们通过上面的工作,在串口中已经看到了 linux2.6.14 的启动信息,但是在 LCD 上没有任何显示,这是因为我们还没有对 LCD 进行初始化, linux2.6.14 已经包含了 lcd 的驱动程序,驱动程序位于 /linux-2.6.14/drivers/video/ 目录下,文件名是 s3c2410fb.c, 头文件是 s3c2410fb.h. 。我们在这里可以不研究这个文件。只要我们对 lcd 进行以下初始化就可以了。
我们打开 /linux-2.6.14/arch/arm/mach-s3c2410/mach-smdk2410.c, 在这个文件里增加包含文件:
#include
然后增加 LCD 初始化的代码,
static struct s3c2410fb_mach_info hfrk_lcdcfg __initdata = {
.fixed_syncs= 0,
.regs={
.lcdcon1= S3C2410_LCDCON1_TFT16BPP | \
S3C2410_LCDCON1_TFT | \
S3C2410_LCDCON1_CLKVAL(6),
.lcdcon2= S3C2410_LCDCON2_VBPD(2) | \
S3C2410_LCDCON2_LINEVAL(319) | \
S3C2410_LCDCON2_VFPD(0) | \
S3C2410_LCDCON2_VSPW(4),
.lcdcon3= S3C2410_LCDCON3_HBPD(47) | \
S3C2410_LCDCON3_HOZVAL(239) | \
S3C2410_LCDCON3_HFPD(15),
.lcdcon4= S3C2410_LCDCON4_MVAL(1) | \
S3C2410_LCDCON4_HSPW(31),
.lcdcon5= S3C2410_LCDCON5_FRM565 | \
S3C2410_LCDCON5_INVVLINE | \
S3C2410_LCDCON5_HWSWP,
},
.lpcsel= 0x0,
.gpccon= 0xaaaaaaaa,
.gpccon_mask= 0xffffffff,
.gpcup= 0xffffffff,
.gpcup_mask= 0xffffffff,
.gpdcon= 0xaaaaaaaa,
.gpdcon_mask= 0x0,
.gpdup= 0xffffffff,
.gpdup_mask= 0xffffffff,
.width= 240,
.height= 320,
.xres= {240,240,240},
.yres= {320,320,320},
.bpp= {16,16,16},
};
static void __init sdmk2410_init(void)
{
set_s3c2410fb_info(&hfrk_lcdcfg);
}
在系统初始化中增加对 lcd 的初始化。
MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
* to SMDK2410 */
/* Maintainer: Jonas Dietsche */
……
.map_io = smdk2410_map_io,
.init_irq = smdk2410_init_irq,
.init_machine = sdmk2410_init, /* 这一句是新增加的*/
.timer = &s3c24xx_timer,
MACHINE_END
现在我们重新保存这个文件,现在需要重新进入配置菜单,检查一下 LCD 的相关选项是否选上, [Device Drivers->Graphics support->] 这个配置菜单下面是相关 LCD 的配置。回到根目录下,输入 make 编译内核,重现烧写内核到开发板,再次启动 linxu2.6.14 以后就可以在 lcd 上看到一个小的企鹅。我们的 lcd 驱动已经移植完成了。