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

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

?? tchpdd.cpp

?? windows ce 50 drive program
?? 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    <S2440.H>
#include 	"reg.h"

#define SYS_TIMER_PRESCALER	24
#define SYS_TIMER_DIVIDER 4 // 2
//#define OEM_CLOCK_FREQ (S2440PCLK / (SYS_TIMER_PRESCALER+1) / SYS_TIMER_DIVIDER)

#define JYLEE_TEST 0
#define JYLEE_TEST1 0


#define ADC_DELAY_TIME	5000	// vencent


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	// 200Mhz
#define ADCPRS  55	// 200Mhz
//#define ADCPRS  65		// 532Mhz

/*++

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) );

}

//
// PddpSetupPenDownIntr()
//

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一级片网站| 中文字幕一区二区三区不卡在线| 久久色.com| 一区二区三区四区在线播放| 久久99这里只有精品| 色素色在线综合| 久久久精品欧美丰满| 日韩综合在线视频| 91丨porny丨蝌蚪视频| 精品国产乱码久久久久久浪潮| 一区二区在线观看视频在线观看| 久久国产剧场电影| 91精品婷婷国产综合久久性色| 亚洲蜜臀av乱码久久精品蜜桃| 国产一区啦啦啦在线观看| 3atv一区二区三区| 洋洋av久久久久久久一区| 波多野结衣在线一区| 久久综合九色综合97婷婷| 天天综合色天天| 欧美美女直播网站| 一区二区三区波多野结衣在线观看 | 91美女视频网站| 中文欧美字幕免费| 国产一区二区在线观看免费| 日韩视频免费观看高清在线视频| 婷婷丁香久久五月婷婷| 在线看一区二区| 亚洲女爱视频在线| 91浏览器打开| 亚洲电影视频在线| 欧美日韩在线三级| 日韩电影免费在线看| 91精品国产综合久久蜜臀| 日产欧产美韩系列久久99| 制服丝袜日韩国产| 青椒成人免费视频| 欧美一级生活片| 国产真实精品久久二三区| 久久婷婷一区二区三区| 国产精品91xxx| 国产精品久久99| 欧美午夜视频网站| 奇米综合一区二区三区精品视频 | 9l国产精品久久久久麻豆| ㊣最新国产の精品bt伙计久久| 91丨九色porny丨蝌蚪| 亚洲综合色丁香婷婷六月图片| 欧美精选在线播放| 韩国精品一区二区| 中文字幕一区av| 欧美在线影院一区二区| 午夜激情一区二区| 久久蜜桃一区二区| 日本久久一区二区| 日本视频在线一区| 国产人妖乱国产精品人妖| 色诱亚洲精品久久久久久| 午夜亚洲福利老司机| 2023国产精品| 欧美在线999| 国产久卡久卡久卡久卡视频精品| 中文字幕一区三区| 日韩一区二区三区四区五区六区| 粉嫩在线一区二区三区视频| 亚洲一区二区美女| 2019国产精品| 欧美亚州韩日在线看免费版国语版| 日本不卡视频在线| 亚洲欧洲韩国日本视频| 欧美一区二区在线播放| 成人av电影在线| 精一区二区三区| 亚洲黄色免费网站| 国产欧美精品一区| 欧美理论片在线| www.欧美.com| 国产精品一区二区在线观看不卡| 亚洲成人免费在线观看| 日本一区二区免费在线| 欧美久久久一区| 色综合色狠狠天天综合色| 狠狠色丁香婷婷综合| 亚洲国产aⅴ天堂久久| 国产精品成人一区二区艾草| 日韩欧美一区二区在线视频| 色综合久久久久综合| 韩国精品久久久| 亚洲国产精品久久久久秋霞影院| 国产精品三级av在线播放| 宅男在线国产精品| 91精品福利视频| 成人黄色在线看| 久久99热这里只有精品| 图片区小说区区亚洲影院| 中文字幕一区二区三区视频| 精品国产精品网麻豆系列| 欧美精品在线观看一区二区| 99riav久久精品riav| 国产传媒欧美日韩成人| 美腿丝袜亚洲一区| 日韩国产一区二| 天堂影院一区二区| 亚洲成av人片观看| 亚洲国产欧美在线| 亚洲高清免费观看| 亚洲午夜久久久久久久久久久| 亚洲欧美日韩国产手机在线 | 91麻豆蜜桃一区二区三区| 成人午夜免费av| 成人自拍视频在线| 成人丝袜18视频在线观看| 国产精品一线二线三线| 国产一区二区三区在线观看免费| 日本美女一区二区三区视频| 日本成人在线网站| 日韩激情一二三区| 看片网站欧美日韩| 久久精品国产免费| 国产精品一区二区视频| 国产黑丝在线一区二区三区| 国产成人在线色| 成人h动漫精品| 一本久道中文字幕精品亚洲嫩| 99re热这里只有精品免费视频| 99久久国产免费看| 欧美唯美清纯偷拍| 日韩午夜精品视频| 国产欧美一区视频| 一区二区三区 在线观看视频| 亚洲一区二区在线播放相泽| 天天av天天翘天天综合网| 乱一区二区av| 国产91精品一区二区| 色综合久久久久久久久久久| 欧美日韩激情一区二区| 欧美一级理论性理论a| 久久久av毛片精品| 亚洲免费在线观看| 另类成人小视频在线| 国产精品一区免费在线观看| 91免费版在线看| 欧美精品日韩精品| 久久伊99综合婷婷久久伊| 最好看的中文字幕久久| 亚洲一区二区成人在线观看| 免费观看久久久4p| 成人黄页毛片网站| 欧美老女人在线| 国产欧美精品在线观看| 亚洲一区二区三区在线播放| 极品尤物av久久免费看| bt7086福利一区国产| 69p69国产精品| 中文字幕一区二区日韩精品绯色| 亚洲成国产人片在线观看| 国产suv精品一区二区6| 欧美乱妇23p| 亚洲欧洲中文日韩久久av乱码| 日本欧美加勒比视频| 91在线观看污| 久久久无码精品亚洲日韩按摩| 亚洲一级在线观看| 国产成人精品免费| 欧美精品一二三| 一色屋精品亚洲香蕉网站| 久久99精品久久久久久动态图| 欧美在线观看一二区| 国产欧美日韩在线| 男人操女人的视频在线观看欧美| 99久久久久久99| 国产三级一区二区| 青青草国产精品亚洲专区无| 91亚洲精品久久久蜜桃网站| 久久久久久久久伊人| 日本视频一区二区| 91成人看片片| 1000精品久久久久久久久| 精品一区二区三区在线播放| 欧美日韩一区二区三区不卡| 中文字幕中文字幕一区二区| 国内一区二区视频| 日韩美女主播在线视频一区二区三区 | 国产午夜精品一区二区三区嫩草 | 成人午夜视频网站| 国产天堂亚洲国产碰碰| 久久国产福利国产秒拍| 欧美一区二区三区在线| 亚洲自拍都市欧美小说| 91亚洲精华国产精华精华液| 国产精品午夜电影| 国产激情视频一区二区在线观看 | 国产.精品.日韩.另类.中文.在线.播放| 91麻豆精品国产91久久久久久久久| 亚洲精品免费视频| 色欧美片视频在线观看| 亚洲精品免费电影| 欧美性猛交xxxxxxxx| 午夜久久久久久久久| 69久久夜色精品国产69蝌蚪网|