summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/aw5306_ts/AW5306_Drv.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/aw5306_ts/AW5306_Drv.h')
-rwxr-xr-xdrivers/input/touchscreen/aw5306_ts/AW5306_Drv.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/aw5306_ts/AW5306_Drv.h b/drivers/input/touchscreen/aw5306_ts/AW5306_Drv.h
new file mode 100755
index 00000000..47042361
--- /dev/null
+++ b/drivers/input/touchscreen/aw5306_ts/AW5306_Drv.h
@@ -0,0 +1,158 @@
+/**************************************************************************
+* AW5306_Drv.h
+*
+* AW5306 Driver code version 1.0
+*
+* Create Date : 2012/06/25
+*
+* Modify Date :
+*
+* Create by : wuhaijun
+*
+**************************************************************************/
+
+#ifndef AW5306_DRV_H
+
+#define AW5306_DRV_H
+
+#define Release_Ver 219
+
+
+#define MAX_POINT 5
+
+#define NUM_TX 21 // TX number of TOUCH IC
+#define NUM_RX 12 // RX number of TOUCH IC
+
+//#define NEWBASE_PROCESS //new base process need test!!!
+
+#define ABS(X) ((X > 0) ? (X) : (-X))
+
+
+typedef enum{
+ RawDataMode = 0,
+ DeltaMode,
+ MonitorMode
+}enumWorkMode;
+
+typedef enum{
+ BASE_INITIAL,
+ BASE_FAST_TRACE,
+ BASE_STABLE,
+ TEMP_DRIFT
+} CompensateMode;
+
+typedef struct {
+ unsigned short Base[NUM_TX][NUM_RX];
+ unsigned short ChipBase[NUM_TX][NUM_RX];
+ signed char Flag[NUM_TX][NUM_RX];
+ signed char BaseCnt[NUM_TX][NUM_RX];
+ unsigned char CompensateFlag;
+ unsigned char TraceTempIncCnt;
+ unsigned char TraceTempDecCnt;
+ unsigned char CompensateStateFrameCnt;
+ short LastMaxDiff;
+ CompensateMode CompensateState;
+ unsigned int InitialFrameCnt;
+ unsigned char PosBigAreaTouchFlag;
+ unsigned char NegBigAreaTouchFlag;
+ unsigned char BigAreaFirstFlag;
+ unsigned char BigAreaChangeFlag;
+ unsigned short BigTouchFrame;
+ unsigned short FrameCnt;
+ unsigned char LongStableCnt;
+ unsigned char PosPeakCnt;
+ unsigned char NegPeakCnt;
+ unsigned char PeakCheckFrameCnt;
+ unsigned char BaseFrozen;
+ unsigned char PosPeakCompensateCnt[MAX_POINT];
+ unsigned char NegPeakCompensateCnt[MAX_POINT];
+}STRUCTBASE;
+
+typedef struct {
+ unsigned char Peak[MAX_POINT][2];
+ unsigned char LastPeak[MAX_POINT][2];
+ unsigned char NegPeak[MAX_POINT][2];
+ unsigned char CurrentPointNum;
+ unsigned char CurrentNegPointNum;
+ unsigned char LastPointNum;
+}STRUCTPEAK;
+
+typedef struct {
+ unsigned short X,Y; // X,Y coordinate
+ unsigned char PointID; // Assigned point ID
+ unsigned char Event; // Event of current point
+}STRUCTPOINT;
+
+typedef struct {
+ STRUCTPOINT PointInfo[MAX_POINT];
+ STRUCTPOINT RptPoint[MAX_POINT];
+ unsigned char PointNum;
+ unsigned char LastPointNum;
+ unsigned char NegPointNum;
+ unsigned char FilterPointCnt;
+ unsigned char FirstLiftUpFlag;
+ unsigned char TouchStatus;
+ unsigned char PointHoldCnt[MAX_POINT];
+ unsigned char PointPressCnt[MAX_POINT];
+
+}STRUCTFRAME;
+
+typedef struct {
+ unsigned char fileflag[14];
+ unsigned char TXOFFSET[(NUM_TX+1)/2];
+ unsigned char RXOFFSET[(NUM_RX+1)/2];
+ unsigned char TXCAC[NUM_TX];
+ unsigned char RXCAC[NUM_RX];
+ unsigned char TXGAIN[NUM_TX];
+ short SOFTOFFSET[NUM_TX][NUM_RX];
+}STRUCTCALI;
+
+#define NOISE_LISTENING 0
+#define NOISE_SCAN 1
+#define NOISE_FREQ_JUMP 2
+#define NOISE_SEEK_FAIL 3
+
+#define NOISE_FRM_NORMAL 0
+#define NOISE_FRM_PRE_MEASURE 1
+#define NOISE_FRM_MEASURE 2
+
+typedef struct {
+ unsigned char AllFrmCnt; // Frame counter to generate noise meaure frame indicator
+ unsigned char NoiseFrmCnt; // Frame counter for noise level checking
+ unsigned char IdleFrmCnt; // No touch frame counter
+ unsigned char State; // Noise checking state: LISTENING, SCAN, JUMP
+ unsigned char FrmState; // Frame type indicator: PRE_MEAUSRE, MEAUSRE, NORMAL
+ short NoiseNormal; // Noise in working freq
+ short NoiseScan; // Noise in scan freq
+ short Better_NoiseScan; //pfx:smaller Noise in Scan freq
+ unsigned char Better_ScanFreqID; //pfx:the Scan Freq for the smaller Noise
+ unsigned char ScanFreqID; // Scan freq ID
+ unsigned char WorkFreqID; // Current freq ID
+ short NoiseTh1; // Diff threshold for noise too high judgement
+ char JumpTh; // frame number threshold for freq jumping
+ char FailedFreqList [32]; // Searched freq indicator for freq scanning
+}STRUCTNOISE;
+
+
+void AW5306_TP_Init(void);
+void AW5306_TP_Reinit(void);
+void AW5306_Sleep(void);
+char AW5306_TouchProcess(void);
+void AW5306_ChargeMode(char mode);
+unsigned char AW5306_GetPointNum(void);
+unsigned char AW5306_GetPeakNum(void);
+char AW5306_GetPoint(int *x,int *y, int *id, int *event,char Index);
+void AW5306_GetBase(unsigned short *data, char x,char y);
+void AW5306_GetDiff(short *data, char x,char y);
+char AW5306_GetPeak(unsigned char *x,unsigned char *y,unsigned char Index);
+char AW5306_GetNegPeak(unsigned char *x,unsigned char *y,unsigned char Index);
+char AW5306_GetCalcPoint(unsigned short *x,unsigned short *y,unsigned char Index);
+char AW5306_CLB(void);
+void AW5306_CLB_GetCfg(void);
+void AW5306_CLB_WriteCfg(void);
+void TP_Force_Calibration(void);
+void FreqScan(unsigned char BaseFreq);
+
+
+
+#endif