static inline void s3c2410_get_XY(void) { if (adc_state == 0) { adc_state = 1; disable_ts_adc(); y = (ADCDAT0 & 0x3ff); mode_y_axis(); start_adc_y(); } else if (adc_state == 1) { adc_state = 0; disable_ts_adc(); x = (ADCDAT1 & 0x3ff); tsdev.penStatus = PEN_DOWN; DPRINTK("PEN DOWN: x: %08d, y: %08d\n", x, y); wait_up_int(); tsEvent(); } }
/* * INT_ADC的中断服务程序 * A/D转换结束时发生此中断 * 先读取X、Y坐标值,再进入等待中断模式 */ static void Isr_Adc(void) { // 打印X、Y坐标值 printf("xdata = %4d, ydata = %4d\r\n", (int)(ADCDAT0 & 0x3ff), (int)(ADCDAT1 & 0x3ff)); /* 判断是S3C2410还是S3C2440 */ if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002)) { // S3C2410 wait_down_int(); /* 进入"等待中断模式",等待触摸屏被松开 */ } else { // S3C2440 wait_up_int(); /* 进入"等待中断模式",等待触摸屏被松开 */ } // 清INT_ADC中断 SUBSRCPND |= BIT_SUB_ADC; SRCPND |= BIT_ADC; INTPND |= BIT_ADC; }