Linux?μ??????????
???????????? ???????[ 2013/1/10 10:03:12 ] ????????
????????????????????????????£?????????????ж?????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); //???X??????
data1 = ioread32(base_addr+S3C2410_ADCDAT1); //???Y??????
updown = (!(data0 & S3C2410_ADCDAT0_UPDOWN)) && (!(data1 & S3C2410_ADCDAT0_UPDOWN)); //????????????£?????updowm=1
if (updown) {
touch_timer_fire(0); // ??????????????£????touch_timer_fire
} else { //????????????????
OwnADC = 0;
up(&ADC_LOCK);
}
}
return IRQ_HANDLED;
}
???????????????η???touch_timer_fire????????????????????ж??е?????????????????赱????????????o?????????????AD???
static void touch_timer_fire(unsigned long data)
{
unsigned long data0;
unsigned long data1;
int updown;
data0 = ioread32(base_addr+S3C2410_ADCDAT0);
data1 = ioread32(base_addr+S3C2410_ADCDAT1);
updown = (!(data0 & S3C2410_ADCDAT0_UPDOWN)) && (!(data1 & S3C2410_ADCDAT0_UPDOWN));
if (updown) { //????????????
if (count != 0) { //count?????????????AD???????????δAD???
long tmp;
tmp = xp;
xp = yp;
yp = tmp;
xp >>= 2;
yp >>= 2;
input_report_abs(dev?? ABS_X?? xp);
input_report_abs(dev?? ABS_Y?? yp);
input_report_key(dev?? BTN_TOUCH?? 1);
input_report_abs(dev?? ABS_PRESSURE?? 1);
input_sync(dev);
}
xp = 0; //??????????????£?????δ???AD???
yp = 0;
count = 0;
//???????????X??Y????
iowrite32(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST?? base_addr+S3C2410_ADCTSC);
//AD?????????λ??????????
iowrite32(ioread32(base_addr+S3C2410_ADCCON) | S3C2410_ADCCON_ENABLE_START?? base_addr+S3C2410_ADCCON);
} else {
count = 0;
input_report_key(dev?? BTN_TOUCH?? 0);
input_report_abs(dev?? ABS_PRESSURE?? 0);
input_sync(dev);
iowrite32(WAIT4INT(0)?? base_addr+S3C2410_ADCTSC);
if (OwnADC) {
OwnADC = 0;
up(&ADC_LOCK);
}
}
}
???????????????????????????????£?????AD????????????????????AD????????????X??Y????????????AD????ж?????AD??????ж???????????????????????????£???X??Y?????????????????AD????????AD??????ж????????????????????AD??????ж???????
static irqreturn_t stylus_action(int irq?? void *dev_id)
{
unsigned long data0;
unsigned long data1;
if (OwnADC) { //??д??????????£??????????ж???????1
data0 = ioread32(base_addr+S3C2410_ADCDAT0); //???X????
data1 = ioread32(base_addr+S3C2410_ADCDAT1); //???Y????
xp += data0 & S3C2410_ADCDAT0_XPDATA_MASK;//????X????
yp += data1 & S3C2410_ADCDAT1_YPDATA_MASK;//????Y????
count++; //???AD???????
if (count < (1<<2)) { //???AD???????????4??
//???????????X??Y????
iowrite32(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST?? base_addr+S3C2410_ADCTSC);
//AD?????????λ??????????
iowrite32(ioread32(base_addr+S3C2410_ADCCON) |S3C2410_ADCCON_ENABLE_START??base_addr+S3C2410_ADCCON);
} else {
mod_timer(&touch_timer?? jiffies+1); //???AD?????????????
iowrite32(WAIT4INT(1)?? base_addr+S3C2410_ADCTSC);//??????
}
}
return IRQ_HANDLED;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11