?????????????????????????????????????????????????????????????????????????????????????н???????????????????????????????????????????ж????д????ж??????????????????????????????????????????????????????????????????????????????????????????????????????????touch_timer_fire?б????????????λ????????????????????????????ж????stylus_updown


static irqreturn_t stylus_updown(int irq?? void *dev_id)
{
       unsigned long data0;
       unsigned long data1;
       int updown;
       if (down_trylock(&ADC_LOCK) == 0) { //??λ????
              OwnADC = 1;
              data0 = ioread32(base_addr+S3C2410_ADCDAT0);
              data1 = ioread32(base_addr+S3C2410_ADCDAT1);
              updown = (!(data0 & S3C2410_ADCDAT0_UPDOWN)) && (!(data1 & S3C2410_ADCDAT0_UPDOWN));
              if (updown) {   //?????????????????updowm=0
                     touch_timer_fire(0);
              } else {
                     OwnADC = 0;
                     up(&ADC_LOCK);   //?????
              }
       }
       return IRQ_HANDLED;
}


?????????????????????????????δ????????????

????????′?????????????????й???:

????Step1?????????INT_ADC??INT_TS?ж??????ADCCON?????AD???????????????????ADCDLY????????????????????????????????????ADCTSC???????????????????????

????Step2??????????£?????INT_TC?ж?????stylus_updown??stylus_updown?????ж??ж???????????????????£???????????????touch_timer_fire????touch_timer_fire??????ADCTSC??????????????????X/Y????????????????ADCCON????????????????stylus_updown??

????Step3????????????????????????X/Y??????????????????浽ADCDAT0??ADADAT1?У???????INT_ADC?ж??????????ɡ?

????Step4??????INT_ADC?ж???????stylus_action?????X/Y??????????????????????????????????????ADCTSC????????????????????????????????????????????????touch_timer_fire??input????????????

????Step5???????????????????INT_TC?ж?????????ж?????????????????????????????ADCTSC????????????????ε?????????????

??????????????????????

????????mini2440????????????????input?????????input?????????????????input_event???壬?????????????ò??????????壬????????????з????????????????????


struct input_event { struct timeval time;
       unsigned short type;  //???????????EV_ABS
       unsigned short code;   //???????????????????????ABS_X
       unsigned int value;  //?
};


?????????????????????ò????????


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/input.h>
#include <sys/fcntl.h>
int main(int argc?? char *argv[])
{
       int fd = -1;
       int num;
       size_t rb;
       int version;
       char name[20];
       struct input_event ev;
       int i=0;
       if ((fd = open("/dev/input/event0"?? O_RDONLY)) < 0)  //???豸
       {
              perror("open error");
              exit(1);
       }
       while(1)
       {
              rb = read(fd?? &ev?? sizeof(struct input_event));  //????豸
              if (rb < (int)sizeof(struct input_event))  //???????
              {
                     perror("read error");
                     exit(1);
              }
              if (EV_ABS==ev.type)                     //???????????
              {
              printf("event=%s??value=%d "??ev.code==ABS_X?"ABS_X":ev.code==ABS_Y?"ABS_Y":ev.code==ABS_PRESSURE?"ABS_PRESSURE":"UNKNOWEN"??ev.value);     
              }else{
              printf("not ev_abs ");        
              }
       }    
        close(fd);
       return 0;
}


??????????????test.c

????arm-linux-gcc test.c –o test

????????????

????./test

????????????????????′???????

????event=ABS_X?? value=505
????event=ABS_Y?? value=334
????event=ABS_PRESSURE?? value=1