【Linux基础】GEC2440&linux-2.6.30&ADC&Touchscreeen

本帖最后由 唯C达人 于 2013-9-20 19:38 编辑

选择支持触摸屏接口,事件接口及三星S3C2410触摸屏输入驱动。
添加代码
(1)将touchscreen驱动源码gec2440_ts.c添加到linux-2.6.30源码目录drivers/input/touchscreen中。
(2)将ADC驱动源码gec2440_adc.c及头文件s3c24xx-adc.h添加到Linux入门培训linux-2.6.30源码目录drivers/char中。
2、修改drivers/input/touchscreen/Makefile文件。
#vim drivers/input/touchscreen/Makefile
添加(放于同格式的前面,下同)
obj-$(CONFIG_TOUCHSCREEN_GEC2440) += gec2440_ts.o
修改drivers/input/touchscreen/Kconfig文件
#vim drivers/input/touchscreen/Kconfig
添加
config TOUCHSCREEN_GEC2440
tristate "GEC2440 touchscreen input driver"
help
Say Y here if you have the s3c2440 touchscreen.
修改drivers/char/Makefile文件
#vim drivers/char/Makefile
添加
obj-$(CONFIG_GEC2440_ADC) += gec2440_adc.o
修改drivers/char/Kconfig文件
#vi drivers/char/Kconfig
添加
config GEC2440_ADC
tristate"GEC2440_ADC"
---help---
Say Y here if you have the s3c2440 ADC.
修改arch/arm/mach-s3c2410/mach-smdk2410.c文件
#vim arch/arm/mach-s3c2410/mach-smdk2410.c
添加
static struct s3c2410_ts_mach_info gec2410_ts_cfg __initdata = {
.delay = 10000,
.presc = 49,
.oversampling_shift = 2,
};
在static void __init smdk2410_map_io(void)函数中添加:
s3c24xx_init_touchscreen(&gec2410_ts_cfg);
C语言教程修改arch/arm/mach-s3c2440/mach-smdk2440.c文件
#vim arch/arm/mach-s3c2440/mach-smdk2440.c
在static struct platform_device *smdk2440_devices[] __initdata
结构体中添加:
&s3c_device_ts,
修改arch/arm/plat-s3c/include/plat/devs.h文件
#vim arch/arm/plat-s3c/include/plat/devs.h
添加:
struct s3c2410_ts_mach_info {
int delay;
int presc;
int oversampling_shift;
};
void __init s3c24xx_init_touchscreen(struct s3c2410_ts_mach_info *hard_s3c2410_ts_info);
extern struct platform_device s3c_device_ts;
修改arch/arm/plat-s3c24xx/devs.c文件
#vim arch/arm/plat-s3c24xx/devs.c
在文件后面添加
/* Touchscreen */
static struct s3c2410_ts_mach_info s3c2410_ts_info;
void __init s3c24xx_init_touchscreen(struct s3c2410_ts_mach_info *hard_s3c2410_ts_info)
{
memcpy(&s3c2410_ts_info,hard_s3c2410_ts_info,sizeof(struct s3c2410_ts_mach_info));
}
EXPORT_SYMBOL(s3c24xx_init_touchscreen);
struct platform_device s3c_device_ts = {
.name = "s3c2410-ts",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_adc_resource),
.resource = s3c_adc_resource,
.dev = {
.platform_data = &s3c2410_ts_info,
}
};
EXPORT_SYMBOL(s3c_device_ts);
编译配置内核
#make menuconfig
配置菜单添加驱动到内核:
Device Drivers --->
Input device support --->
Touchscreens --->
<*> GEC2440 touchscreen input driver
Character devices --->
<*> GEC2440_ADC
编译内核生成静态驱动模块
#make
在内核启动中可以看到(需要自己查找)
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /class/input/input0
注册信息为:(开发板启动后,在dnw窗口或者超级终端中输入下列指令)
#cat /proc/bus/input/devices
信息截图如图:

C语言入门 根文件系统中建立相关设备节点:(开发板中执行,若文件已经存则不能建立)
#mkdir /dev/input
#mknod /dev/input/event0 c 13 64
#mknod /dev/input/mouse0 c 13 32
若提示“...Read-only file system”,或者 “mkdir: cannot create directory '/dev/input': File exists”。
解决方法如下:
#chmod 777 /dev/
# mount -o remount rw /
测试触摸屏
#cat /dev/input/event0
然后点击触摸屏,有信息输出,通常为乱码。
本文转载于C语言入门:http://www.weicedu.com/thread-275839-1-2.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值