为什么我的2410在wince下触摸屏只能中断一次呢?
[复制链接]
如题,附上相关源码,请大家帮我看看是什么问题.
==============================================================================
D:\WINCE600\PLATFORM\SMDK2410\SRC\DRIVERS\TOUCH\s3c2410x_touch_2410.cpp
==============================================================================
TSP_PowerOn(VOID)
{
RETAILMSG(1,(TEXT("::: TSP_PowerOn()\r\n")));
/* Use TSXM, TSXP, TSYM, TSYP */
v_pIOPregs->GPGCON |= ((0x3 << 30) | (0x3 << 28) | (0x3 << 26) | (0x3 << 24));
// Disable full up function
v_pIOPregs->GPGUP |= ((0x1 << 15) | (0x1 << 14) | (0x1 << 13) | (0x1 << 12));
v_pADCregs->ADCDLY = 50000;
v_pADCregs->ADCCON = (1 << 14) | /* A/D Converter Enable */
(ADCPRS << 6) | /* Prescaler Setting */
(7 << 3) | /* Analog Input Channel : 0 */ //czx 0 -->7
(0 << 2) | /* Normal Operation Mode */
(0 << 1) | /* Disable Read Start */
(0 << 0); /* No Operation */
v_pADCregs->ADCTSC = (0 << 8) | /* UD_Sen */
(1 << 7) | /* YMON 1 (YM = GND) */
(1 << 6) | /* nYPON 1 (YP Connected AIN[n]) */
(0 << 5) | /* XMON 0 (XM = Z) */
(1 << 4) | /* nXPON 1 (XP = AIN[7]) */
(0 << 3) | /* Pull Up Disable */
(0 << 2) | /* Normal ADC Conversion Mode */
(3 << 0); /* Waiting Interrupt */
v_pINTregs->INTSUBMSK &= ~(1<
v_pPWMregs->TCFG1 &= ~(0xf << 12); /* Timer3's Divider Value */
v_pPWMregs->TCFG1 |= (0 << 12); /* 1/2 */
v_pPWMregs->TCNTB3 = g_timer3_sampleticks; /* Interrupt Frequency */
}
DdsiTouchPanelGetPoint(TOUCH_PANEL_SAMPLE_FLAGS * pTipStateFlags,
INT * pUncalX,
INT * pUncalY)
{
static INT x, y;
RETAILMSG(1, (TEXT("::: DdsiTouchPanelGetPoint()\r\n")));
if (v_pINTregs->SUBSRCPND & (1<
{
*pTipStateFlags = TouchSampleValidFlag;
if ( (v_pADCregs->ADCDAT0 & (1 << 15)) |
(v_pADCregs->ADCDAT1 & (1 << 15)) )
{
bTSP_DownFlag = FALSE;
DEBUGMSG(ZONE_TIPSTATE, (TEXT("up\r\n")));
//RETAILMSG(1, (TEXT("up\r\n")));
v_pADCregs->ADCTSC &= 0xff;
*pUncalX = x;
*pUncalY = y;
TSP_SampleStop();
/* At this point SYSINTR_TOUCH_CHANGED (timer3) interrupt could also be pending (and masked).
Since we do not care about the timer3 interrupt after calling TSP_SampleStop, signal it Done.
If we do not signal done and it was indeed pending and masked, IRQ_TIMER3 will not be unmasked
and won't fire again unless unmasked */
if (v_pINTregs->SRCPND & (1<
InterruptDone(gIntrTouchChanged);
}
else
{
bTSP_DownFlag = TRUE;
if (!TSP_GetXY(&x, &y))
*pTipStateFlags = TouchSampleIgnore;
TSP_TransXY(&x, &y);
*pUncalX = x;
*pUncalY = y;
*pTipStateFlags |= TouchSampleDownFlag;
DEBUGMSG(ZONE_TIPSTATE, (TEXT("down %x %x\r\n"), x, y));
//RETAILMSG(1, (TEXT("down %x %x\r\n"), x, y));
TSP_SampleStart();
}
v_pINTregs->SUBSRCPND = (1<
v_pINTregs->INTSUBMSK &= ~(1<
InterruptDone(gIntrTouch);
}
else /* SYSINTR_TOUCH_CHANGED Interrupt Case */
{
// TSP_SampleStart();
if (bTSP_DownFlag)
{
INT tx, ty;
INT dx, dy;
if (!TSP_GetXY(&tx, &ty))
*pTipStateFlags = TouchSampleIgnore;
else
{
TSP_TransXY(&tx, &ty);
// insert by mostek@dstcorp.com
#define X_ERRV 0x3bf
#define Y_ERRV 0x4ff
// Subsequent info: If the ADC provides a bad reading, this catches it and
// skips over it. Instead, it should be fixed at the source
// so as not to provide a bad reading.
if ((tx == X_ERRV) || (ty == Y_ERRV))
{
tx = x;
ty = y;
}
// =================== mostek
dx = (tx > x) ? (tx - x) : (x - tx);
dy = (ty > y) ? (ty - y) : (y - ty);
if (dx > TSP_CHANGE || dy > TSP_CHANGE)
{
*pUncalX = x = tx;
*pUncalY = y = ty;
DEBUGMSG(ZONE_TIPSTATE, (TEXT("down-c-v %x %x\r\n"), x, y));
*pTipStateFlags = TouchSampleValidFlag | TouchSampleDownFlag;
}
else
{
*pUncalX = x;
*pUncalY = y;
DEBUGMSG(ZONE_TIPSTATE, (TEXT("down-c %x %x\r\n"), x, y));
*pTipStateFlags = TouchSampleIgnore;
}
}
}
else
{
*pTipStateFlags = TouchSampleIgnore;
TSP_SampleStop();
}
InterruptDone(gIntrTouchChanged);
}
}