标题: S3C2410触摸屏问题 [打印本页] 作者: dxyaopengfei 时间: 2008-09-26 15:36 标题: S3C2410触摸屏问题 小弟最近在我的友善之臂2410开发板上想将其升级到2.6.14的kernel。前段时间费劲周折将kernel移植搞定了,现在在忙着移植一些驱动了。我的触摸屏是s3c2410的,在2.6.14的KERNEL源码树中是没有被包含的。
于是,我在网上找了一些资料,找到了牛人们贴出来的s3c2410触摸屏的驱动程序(参考http://www.cnitblog.com/luofuchong/archive/2007/08/22/32177.html)。我把它移植于我的开发板中,经过一些周折,可以正常RUN起来了,而且,当我触摸屏幕的时候,在超级终端中会打印出时间和X,Y坐标的值。然后,我想编一个应用程序去读驱动返回的坐标值,结果发现应用程序读到的坐标值和驱动程序里面(调试模式下)打印出来的坐标值不相同,验证过好多次都这样的。这是为什么呢,是我的驱动程序本身的问题,还是我写的应用程序的问题呢。希望大虾们能够指点指点啊,小弟已经弄这个小问题已经搞了好几天了,已经没有思路了。。。。。谢谢了!
这是终端打印出来的数据:
T: 440013, X: 533, Y: 623
value,x is: 124,y is: 194,dir is: 1
T: 445047, X: 530, Y: 625
value,x is: 124,y is: 195,dir is: 1
T: 455035, X: 534, Y: 643
value,x is: 125,y is: 199,dir is: 1
T: 460034, X: 535, Y: 643
value,x is: 125,y is: 200,dir is: 1
T: 465034, X: 534, Y: 635
value,x is: 125,y is: 200,dir is: 1
value,x is: 125,y is: 198,dir is: 1
value,x is: 125,y is: 198,dir is: 0
其中,T: 440013, X: 533, Y: 623是驱动程序打印出来的,value,x is: 124,y is: 194,dir is: 1是应用程序打印出来的。
static void touch_timer_fire(unsigned long data)
{
unsigned long data0;
unsigned long data1;
int updown;
data0 = readl(base_addr+S3C2410_ADCDAT0);
data1 = readl(base_addr+S3C2410_ADCDAT1);
/* TODO we should never get an interrupt with updown set while
* the timer is running, but maybe we ought to verify that the
* timer isn't running anyways. */
if (updown)
touch_timer_fire(0);
return IRQ_HANDLED;
}
static irqreturn_t stylus_action(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned long data0;
unsigned long data1;