亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tchpdd.cpp

?? 跟640x480屏幕配套的觸摸屏的驅動(for winCE)
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 2002. Samsung Electronics, co. ltd  All rights reserved.

Module Name:

  tchpdd.cpp

Abstract:

  This module contains the DDSI implementation and PDD support routines
  for the touch panel for the P2 implementation.

Functions:

  TouchDriverCalibrationPointGet
  DdsiTouchPanelGetDeviceCaps
  DdsiTouchPanelSetMode
  DdsiTouchPanelEnable
  DdsiTouchPanelDisable
  DdsiTouchPanelAttach
  DdsiTouchPanelDetach
  DdsiTouchPanelGetPoint
  DdsiTouchPanelPowerHandler

Notes:


Revision History:


--*/

#define DBGPOINTS1 1
#define TRACE_TIP_STATE

#include    <windows.h>
#include	<types.h>
#include    <memory.h>
#include    <nkintr.h>
#include    <oalintr.h>
#include    <tchddsi.h>
#include    <tchpdd.h>
#include    <drv_glob.h>
//#include    <p2debug.h>

#include    <S2410.H>
#include 	"reg.h"

#define TOUCH_TIMER_PRESCALER	24
#define TOUCH_TIMER_DIVIDER 4

#define JYLEE_TEST 0
#define JYLEE_TEST1 0

#define TFT240_320	1
#define TFT640_480	4
#define LCD_TYPE	TFT640_480//TFT240_320

#if ( LCD_TYPE == TFT640_480 )
	#define ADC_DELAY_TIME	5000		// charlie, 020620
#else
	#define ADC_DELAY_TIME	1000	// Charlie
#endif

DWORD gIntrTouch = SYSINTR_TOUCH;
DWORD gIntrTouchChanged = SYSINTR_TOUCH_CHANGED;

#ifdef TRACE_TIP_STATE
BOOL PenIsUp = TRUE;
#endif

#if defined(MIPS) || defined(PPC821) || defined(PPC823) || defined(ARM) || defined(SH4)
#define PAGE_MASK 0x0fff
#define PAGE_SIZE 0x1000
volatile static PVOID pTmpRegs;
#endif

static void TouchPanelPowerOff();
static void TouchPanelPowerOn();
static BOOL Touch_Timer0_Setup(void) ;

static BOOL Touch_Pen_filtering(INT *px, INT *py);

// The MDD requires a minimum of MIN_CAL_COUNT consecutive samples before
// it will return a calibration coordinate to GWE.  This value is defined
// in the PDD so that each OEM can control the behaviour of the touch
// panel and still use the Microsoft supplied MDD.  Note that the extern "C"
// is required so that the variable name doesn't get decorated, and
// since we have an initializer the 'extern' is actually ignored and
// space is allocated.
extern "C" const int MIN_CAL_COUNT = 40;

INT		CurrentSampleRateSetting = 0;	//	Low sample rate setting

// @globalvar PTCHAUD_ASIC_REGISTERS | v_pTchAudAsicRegisters | Pointer to Asic regs

PTCHAUD_ASIC_REGISTERS              v_pTchAudAsicRegisters = NULL;

// @globalvar PTOUCHPANEL_POINT_SAMPLE | v_pPenSamples | Pointer to pen samples area
PDRIVER_GLOBALS      v_pDriverGlobals = NULL;

volatile static PVOID v_pCpuRegs = NULL;

TOUCH_PANEL_SAMPLE_FLAGS SampleFlags;

#ifdef CHECK_RATE
    UINT32	tmp_leds = 0x55;
#endif

// Mutex to prevent contention with audio while accessing shared registers
static HANDLE v_hTchAudMutex;

// Global flag to indicate whether we are in power handler routine, so
// we know to avoid system calls.
static BOOL bInPowerHandler = FALSE;


// Macros for aquiring semaphore for shared access to ASIC registers. If
// we are in the power handler routines, we don't need/want to aquire semaphore,
// since we are serialized at that point, and can't make any system calls.
#define TCHAUD_SEM_LOCK()  \
    if (!bInPowerHandler) { \
        DEBUGMSG(ZONE_TIPSTATE,(TEXT("TchPDD Getting semaphore...\r\n"))); \
        TchAudLock(v_hTchAudMutex, &(v_pDriverGlobals->tch.semaphore)); \
    }
#define TCHAUD_SEM_UNLOCK() \
    if (!bInPowerHandler) { \
        DEBUGMSG(ZONE_TIPSTATE,(TEXT("TchPDD Releasing semaphore...\r\n"))); \
        TchAudUnlock(v_hTchAudMutex, &(v_pDriverGlobals->tch.semaphore)); \
    }

// Macros for accessing registers on the touch audio ASIC.  The code for
// these functions is in drvlib so it can be shared between touch and audio.
#define ASIC_READ_REG(reg, pval) \
    TchAudReadReg(reg, pval, v_pTchAudAsicRegisters, bInPowerHandler)
#define ASIC_WRITE_REG(reg, val) \
    TchAudWriteReg(reg, val, v_pTchAudAsicRegisters, bInPowerHandler)
#define ASIC_AND_REG(reg, val) \
    TchAudAndReg(reg, val, v_pTchAudAsicRegisters, bInPowerHandler)
#define ASIC_OR_REG(reg, val) \
    TchAudOrReg(reg, val, v_pTchAudAsicRegisters, bInPowerHandler)


volatile IOPreg *v_pIOPregs;
volatile ADCreg *v_pADCregs;
volatile PWMreg *v_pPWMregs;
volatile INTreg *v_pINTregs;    

volatile unsigned short xbuf[10], ybuf[10];
static unsigned int touch_down = 1;

#define ADCPRS  49
#define DELAY   1000
#define SDELAY  5

/*++

Routine Description:

    Deallocates the virtual memory reserved for the Touch/Audio Asic registers,
    and the pen samples dma area.

Arguments:

    None.


Return Value:

    None.

Autodoc Information:

    @doc IN_TOUCH_DDSI INTERNAL DRIVERS PDD TOUCH_PANEL

    @func VOID | PddpTouchPanelDeallocateVm |
    Deallocates the virtual memory reserved for the Touch/Audio Asic registers,
    and the pen samples dma area.

--*/
static
void
PddpTouchPanelDeallocateVm(
    VOID
    )
{
    if(v_pIOPregs)
    {
        VirtualFree((void*)v_pIOPregs, sizeof(IOPreg), MEM_RELEASE);
        v_pIOPregs=NULL;
    }
    if(v_pADCregs)
    {   
        VirtualFree((void*)v_pADCregs, sizeof(ADCreg), MEM_RELEASE);
        v_pADCregs = NULL;
    }        
    if ( v_pDriverGlobals )
    {
        VirtualFree( v_pDriverGlobals,
                     DRIVER_GLOBALS_PHYSICAL_MEMORY_SIZE ,
                     MEM_RELEASE
                    );
        v_pDriverGlobals = NULL;
    }    
}

//
// PDD Internal Support Routines
//

/*++
    @doc IN_TOUCH_DDSI INTERNAL DRIVERS PDD TOUCH_PANEL

    @func VOID | PddpTouchPanelGetSamples |
    Copies from the pen dma area the most recent point sample into the location
    pointed to by pPointSamples.  During the copy the sample information is
    adjusted to be consistent with the 12 bit pen data format.
    Has the side effect of reinitializing ioPenPointer if we are near the
    end of the pen sample area.
--*/
static
void
PddpTouchPanelGetSamples(
    PTOUCHPANEL_POINT_SAMPLE pPointSamples //@PARM Pointer to where the samples will be stored.
    )
{
//    ULONG   devDrvPointer;
    ULONG   irg;

    //
    // Copy the samples to our buffer munging the data for the 12 bit
    //  pen data format.
    //

    for ( irg = 0; irg < NUMBER_SAMPLES_PER_POINT; irg++ )
    {
        pPointSamples[ irg ].XSample = xbuf[irg];
        pPointSamples[ irg ].YSample = ybuf[irg];
    }
}

/*++

Routine Description:

    Gathers the most recent sample and evaluates the sample returing
    the determined tip state and the `best guess' for the X and Y coordinates.

    Note: Determined empirically that the variance of the X coordinate of the
          first sample from all other samples is large enough that in order
          to keep the nominal variance small, we discard the first sample.

          Cases of a light touch that locks the ADC into
          seeing X and Y coordinate samples of 0x277 regardless of how the pen
          moves or presses have been seen. XXXXX


Arguments:

    pTipState   Pointer to where the tip state information will be returned.

    pUnCalX     Pointer to where the x coordinate will be returned.

    pUnCalY     Pointer to where the y coordinate will be returned.

Return Value:

    None.

Autodoc Information:

    @doc IN_TOUCH_DDI INTERNAL DRIVERS PDD TOUCH_PANEL

    @func VOID | PddpTouchPanelEvaluateSamples |
    Gathers the most recent sample and evaluates the sample returing
    the determined tip state and the `best guess' for the X and Y coordinates.

--*/
static
void
PddpTouchPanelEvaluateSamples(
    TOUCH_PANEL_SAMPLE_FLAGS	*pSampleFlags, //@PARM Pointer to where the tip state information will be returned.
    INT							*pUncalX,      //@PARM Pointer to where the x coordinate will be returned.
	INT							*pUncalY       //@PARM Pointer to where the y coordinate will be returned.

    )
{
    LONG    dlXDiff0;
    LONG    dlXDiff1;
    LONG    dlXDiff2;
    LONG    dlYDiff0;
    LONG    dlYDiff1;
    LONG    dlYDiff2;

    TOUCHPANEL_POINT_SAMPLES rgPointSamples;

    //
    // Get the sample.
    //

    PddpTouchPanelGetSamples( rgPointSamples );


    //
    // Calcuate the differences for the X samples and insure that
    // the resulting number is positive.
    //

    dlXDiff0 = rgPointSamples[ 0 ].XSample - rgPointSamples[ 1 ].XSample;
    dlXDiff1 = rgPointSamples[ 1 ].XSample - rgPointSamples[ 2 ].XSample;
    dlXDiff2 = rgPointSamples[ 2 ].XSample - rgPointSamples[ 0 ].XSample;
    dlXDiff0 = dlXDiff0 > 0  ? dlXDiff0 : -dlXDiff0;
    dlXDiff1 = dlXDiff1 > 0  ? dlXDiff1 : -dlXDiff1;
    dlXDiff2 = dlXDiff2 > 0  ? dlXDiff2 : -dlXDiff2;

    //
    // Calcuate the differences for the Y samples and insure that
    // the resulting number is positive.
    //

    dlYDiff0 = rgPointSamples[ 0 ].YSample - rgPointSamples[ 1 ].YSample;
    dlYDiff1 = rgPointSamples[ 1 ].YSample - rgPointSamples[ 2 ].YSample;
    dlYDiff2 = rgPointSamples[ 2 ].YSample - rgPointSamples[ 0 ].YSample;
    dlYDiff0 = dlYDiff0 > 0  ? dlYDiff0 : -dlYDiff0;
    dlYDiff1 = dlYDiff1 > 0  ? dlYDiff1 : -dlYDiff1;
    dlYDiff2 = dlYDiff2 > 0  ? dlYDiff2 : -dlYDiff2;

    //
    // The final X coordinate is the average of coordinates of
    // the two MIN of the differences.
    //

    if ( dlXDiff0 < dlXDiff1 )
    {
        if ( dlXDiff2 < dlXDiff0 )
        {

            *pUncalX = (ULONG)( ( ( rgPointSamples[ 0 ].XSample + rgPointSamples[ 2 ].XSample ) >> 1 ) );
        }
        else
        {

            *pUncalX = (ULONG)( ( ( rgPointSamples[ 0 ].XSample + rgPointSamples[ 1 ].XSample ) >> 1 ) );
        }
    }
    else if ( dlXDiff2 < dlXDiff1 )
    {

            *pUncalX = (ULONG)( ( ( rgPointSamples[ 0 ].XSample + rgPointSamples[ 2 ].XSample ) >> 1 ) );
    }
    else
    {

            *pUncalX = (ULONG)( ( ( rgPointSamples[ 1 ].XSample + rgPointSamples[ 2 ].XSample ) >> 1 ) );
    }

    //
    //
    // The final Y coordinate is the average of coordinates of
    // the two MIN of the differences.
    //

    if ( dlYDiff0 < dlYDiff1 )
    {
        if ( dlYDiff2 < dlYDiff0 )
        {

            *pUncalY = (ULONG)( ( ( rgPointSamples[ 0 ].YSample + rgPointSamples[ 2 ].YSample ) >> 1 ) );
        }
        else
        {

            *pUncalY = (ULONG)( ( ( rgPointSamples[ 0 ].YSample + rgPointSamples[ 1 ].YSample ) >> 1 ) );
        }
    }
    else if ( dlYDiff2 < dlYDiff1 )
    {

            *pUncalY = (ULONG)( ( ( rgPointSamples[ 0 ].YSample + rgPointSamples[ 2 ].YSample ) >> 1 ) );
    }
    else
    {

            *pUncalY = (ULONG)( ( ( rgPointSamples[ 1 ].YSample + rgPointSamples[ 2 ].YSample ) >> 1 ) );
    }

    //
    // Validate the coordinates and set the tip state accordingly.
    //

    if ( dlXDiff0 > DELTA_X_COORD_VARIANCE ||
         dlXDiff1 > DELTA_X_COORD_VARIANCE ||
         dlXDiff2 > DELTA_X_COORD_VARIANCE ||
         dlYDiff0 > DELTA_Y_COORD_VARIANCE ||
         dlYDiff1 > DELTA_Y_COORD_VARIANCE ||
         dlYDiff2 > DELTA_Y_COORD_VARIANCE )
    {

//#ifdef DBGPOINTS1
        DEBUGMSG( ZONE_SAMPLES, (TEXT("Sample 0: X 0x%x Y 0x%x\r\n"),
               rgPointSamples[ 0 ].XSample, rgPointSamples[ 0 ].YSample) );
        DEBUGMSG( ZONE_SAMPLES, (TEXT("Sample 1: X 0x%x Y 0x%x\r\n"),
               rgPointSamples[ 1 ].XSample, rgPointSamples[ 1 ].YSample) );
        DEBUGMSG( ZONE_SAMPLES, (TEXT("Sample 2: X 0x%x Y 0x%x\r\n"),
               rgPointSamples[ 2 ].XSample, rgPointSamples[ 2 ].YSample) );


        if ( dlXDiff0 > DELTA_X_COORD_VARIANCE )
            DEBUGMSG( ZONE_SAMPLES, (TEXT("XDiff0 too large 0x%x\r\n"), dlXDiff0) );
        if ( dlXDiff1 > DELTA_X_COORD_VARIANCE )
            DEBUGMSG( ZONE_SAMPLES, (TEXT("XDiff1 too large 0x%x\r\n"), dlXDiff1) );
        if ( dlXDiff2 > DELTA_X_COORD_VARIANCE )
            DEBUGMSG( ZONE_SAMPLES, (TEXT("XDiff2 too large 0x%x\r\n"), dlXDiff2) );

        if ( dlYDiff0 > DELTA_Y_COORD_VARIANCE )
            DEBUGMSG( ZONE_SAMPLES, (TEXT("YDiff0 too large 0x%x\r\n"), dlYDiff0) );
        if ( dlYDiff1 > DELTA_Y_COORD_VARIANCE )
            DEBUGMSG( ZONE_SAMPLES, (TEXT("YDiff1 too large 0x%x\r\n"), dlYDiff1) );
        if ( dlYDiff2 > DELTA_Y_COORD_VARIANCE )
            DEBUGMSG( ZONE_SAMPLES, (TEXT("YDiff2 too large 0x%x\r\n"), dlYDiff2) );

//#endif // DBGPOINTS1

    }
    else
    {
        //
        // Sample is valid. Set tip state accordingly.
        //
		*pSampleFlags = TouchSampleValidFlag | TouchSampleDownFlag;
    }

    DEBUGMSG( ZONE_SAMPLES, (TEXT("Filtered - SampleFlags: 0x%x X: 0x%x Y: 0x%x\r\n"),
           *pSampleFlags, *pUncalX, *pUncalY) );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆6部合集magnet| 国产亚洲精品bt天堂精选| 丝瓜av网站精品一区二区| 国产女人18毛片水真多成人如厕 | 久久蜜臀精品av| 精品乱人伦小说| 久久久久久日产精品| 欧美aaa在线| 视频在线观看国产精品| 欧美日韩国产综合一区二区三区| 99在线精品免费| 欧美日韩精品一二三区| 亚洲国产成人porn| 午夜精品视频一区| 成人网男人的天堂| 正在播放一区二区| 日本一区二区电影| 三级欧美在线一区| 欧美成人a∨高清免费观看| 久久精品999| 欧美影片第一页| 久久蜜臀中文字幕| 99精品桃花视频在线观看| 欧美成人女星排行榜| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 中文在线一区二区| 国产91精品一区二区麻豆网站| 波多野结衣的一区二区三区| 亚洲欧美偷拍卡通变态| 韩国三级中文字幕hd久久精品| 99久久精品免费看| 人妖欧美一区二区| 国产精品沙发午睡系列990531| 一区二区三区在线免费观看| 国产乱对白刺激视频不卡| 日韩三级.com| 久色婷婷小香蕉久久| 欧美成va人片在线观看| 色哟哟精品一区| 亚洲人妖av一区二区| eeuss国产一区二区三区| 日韩国产欧美三级| 91麻豆精品国产91久久久使用方法 | 日韩美女视频一区二区| 在线电影欧美成精品| 久久精品二区亚洲w码| 亚洲精品成人精品456| 欧美一级夜夜爽| 久久精品国产澳门| 亚洲一区二区三区自拍| 欧美精品 国产精品| 色综合天天狠狠| 色激情天天射综合网| 日精品一区二区三区| 亚洲午夜久久久久久久久久久| 中文字幕一区二区三| 欧美日韩精品二区第二页| 色妹子一区二区| 99久久国产综合精品麻豆 | 亚洲一区二区三区自拍| 一区二区三国产精华液| 亚洲在线观看免费| 亚洲国产精品久久一线不卡| 亚洲第一av色| 国产欧美日本一区视频| 日本一区二区成人| 亚洲人成网站影音先锋播放| 亚洲小少妇裸体bbw| 琪琪久久久久日韩精品| 国产精品一区二区91| 一本一本久久a久久精品综合麻豆| 一本色道亚洲精品aⅴ| 欧美日韩激情一区二区三区| 日韩久久免费av| 欧美在线观看18| 91麻豆精东视频| 精品国产不卡一区二区三区| 99久久精品国产一区| 日韩精品中文字幕一区| 亚洲天堂a在线| 久久精品国产99国产| 99久久综合国产精品| 精品少妇一区二区三区在线播放 | 在线观看亚洲专区| www久久久久| 国产色产综合产在线视频| 亚洲香蕉伊在人在线观| 国产成人av资源| 久久综合精品国产一区二区三区| 一区二区在线观看免费| 成人黄页在线观看| 91免费国产视频网站| 国产日产亚洲精品系列| 男女男精品视频网| 91精品国产综合久久国产大片| 中文字幕免费观看一区| 免费高清不卡av| 欧美一区二区三区视频在线观看| 国产精品久久久久桃色tv| 久久免费看少妇高潮| 久久99精品国产麻豆婷婷洗澡| 麻豆91精品视频| 成人激情电影免费在线观看| 精品不卡在线视频| 国产伦精品一区二区三区在线观看| 国产精品888| 国产农村妇女毛片精品久久麻豆 | 制服丝袜亚洲网站| 天天综合日日夜夜精品| 欧美精品丝袜久久久中文字幕| 亚洲人成在线播放网站岛国| 在线观看一区二区视频| 午夜久久久影院| 欧美电影免费提供在线观看| 免费人成精品欧美精品| 日韩欧美高清在线| 国产精品亚洲成人| 亚洲裸体在线观看| 欧美日产在线观看| 国产另类ts人妖一区二区| 亚洲欧洲av色图| 91精品国产综合久久婷婷香蕉| 久久国产成人午夜av影院| 国产精品日产欧美久久久久| 欧美系列亚洲系列| 精品一区二区三区久久| 一区二区三区四区五区视频在线观看 | 无码av免费一区二区三区试看| 精品日韩av一区二区| 91片黄在线观看| 国内偷窥港台综合视频在线播放| 中文字幕一区二区在线播放| 欧美一级电影网站| 91视频在线看| 高清久久久久久| 麻豆一区二区三| 亚洲韩国一区二区三区| 中文一区一区三区高中清不卡| 欧美精品在线观看播放| av不卡一区二区三区| 国产精品69毛片高清亚洲| 日日夜夜一区二区| 亚洲成人免费av| 亚洲免费成人av| 亚洲欧美视频在线观看视频| 国产免费久久精品| 国产日韩欧美a| 国产精品免费免费| 国产欧美精品一区二区三区四区| 精品国精品国产尤物美女| 91精品国产综合久久小美女| 91精品欧美综合在线观看最新 | 欧美日韩视频在线观看一区二区三区 | 欧美色男人天堂| 日韩成人伦理电影在线观看| 午夜精品久久久| 日本视频一区二区| 日本成人中文字幕| 看电影不卡的网站| 国产精品18久久久| bt欧美亚洲午夜电影天堂| 成人国产一区二区三区精品| 不卡电影一区二区三区| 欧美日韩一二三| 亚洲精品一区二区三区精华液 | 欧美精品一区二区三区蜜桃 | 7777精品伊人久久久大香线蕉经典版下载 | 久久亚洲综合av| 亚洲一区在线观看免费观看电影高清| 中文字幕日韩一区| 日本在线不卡一区| 成人午夜免费视频| 久久精品亚洲精品国产欧美kt∨| 久久久久久久av麻豆果冻| 国产精品成人在线观看| 午夜精品久久久久久| 成人福利在线看| 久久在线观看免费| 亚洲在线视频网站| 日韩视频在线永久播放| 中文在线一区二区| 久久成人免费网站| 色欧美片视频在线观看| 国产欧美一二三区| 日韩成人av影视| 欧美日韩亚洲综合一区二区三区 | 在线视频你懂得一区| 久久精品人人做人人爽人人| 日韩精品一级中文字幕精品视频免费观看 | 欧美xxxx老人做受| 天天操天天综合网| 色婷婷狠狠综合| 亚洲欧美另类综合偷拍| 国产成人综合在线观看| 精品国产乱码久久久久久1区2区| 亚洲成a人v欧美综合天堂下载| 色先锋久久av资源部| 中文字幕中文字幕一区| av在线不卡网| 亚洲免费av观看|