1 /******************************************************************************
2 ** File Name: tpc_reg_v3.h *
5 ** Copyright: 2009 Spreatrum, Incoporated. All Rights Reserved. *
7 ******************************************************************************/
8 /******************************************************************************
10 **---------------------------------------------------------------------------*
11 ** DATE NAME DESCRIPTION *
12 ** 09/16/2009 Yi.Qiu Reconstruct TPC driver *
13 ** 05/07/2010 Mingwei.zhang Modify it for SC8800G. *
14 ******************************************************************************/
15 #ifndef _TPC_REG_V3_H_
16 #define _TPC_REG_V3_H_
17 /*----------------------------------------------------------------------------*
19 **------------------------------------------------------------------------- */
21 /**---------------------------------------------------------------------------*
23 **--------------------------------------------------------------------------*/
28 /**---------------------------------------------------------------------------*
30 **---------------------------------------------------------------------------*/
31 /* TPC control registers */
32 #define TPC_REG_BASE TPC_BASE
33 #define TPC_CTRL (TPC_REG_BASE + 0x0000)
34 #define TPC_SAMPLE_CTRL0 (TPC_REG_BASE + 0x0004)
35 #define TPC_SAMPLE_CTRL1 (TPC_REG_BASE + 0x0008)
36 #define TPC_BOUNCE_CTRL (TPC_REG_BASE + 0x000C)
37 #define TPC_FILTER_CTRL (TPC_REG_BASE + 0x0010)
38 #define TPC_CALC_CTRL (TPC_REG_BASE + 0x0014)
39 #define TPC_CALC_X_COEF_A (TPC_REG_BASE + 0x0018)
40 #define TPC_CALC_X_COEF_B (TPC_REG_BASE + 0x001C)
41 #define TPC_CALC_Y_COEF_A (TPC_REG_BASE + 0x0020)
42 #define TPC_CALC_Y_COEF_B (TPC_REG_BASE + 0x0024)
43 #define TPC_INT_EN (TPC_REG_BASE + 0x0028)
44 #define TPC_INT_STS (TPC_REG_BASE + 0x002C)
45 #define TPC_INT_RAW (TPC_REG_BASE + 0x0030)
46 #define TPC_INT_CLR (TPC_REG_BASE + 0x0034)
47 #define TPC_BUF_CTRL (TPC_REG_BASE + 0x0038)
48 #define TPC_X_DATA (TPC_REG_BASE + 0x003C)
49 #define TPC_Y_DATA (TPC_REG_BASE + 0x0040)
50 #define TPC_Z_DATA (TPC_REG_BASE + 0x0044)
53 #define TPC_STOP_BIT BIT_5
54 #define TPC_RUN_BIT BIT_4
55 #define TPC_TPC_MODE_BIT BIT_3
56 #define TPC_PEN_REQ_POL_BIT BIT_1
57 #define TPC_EN_BIT BIT_0
59 #define TPC_PRESCALE_OFFSET 0x08
60 #define TPC_PRESCALE_MSK (0xFF << TPC_PRESCALE_OFFSET)
62 //TPC_SAMPLE_CTRL0 BIT map
63 #define TPC_SAMPLE_INTERVAL_OFFSET 0
64 #define TPC_SAMPLE_INTERVAL_MSK (0xFF << TPC_SAMPLE_INTERVAL_OFFSET)
65 #define TPC_POINT_INTERVAL_OFFSET 8
66 #define TPC_POINT_INTERVAL_MSK (0xFF << TPC_POINT_INTERVAL_OFFSET)
68 //TPC_SAMPLE_CTRL1 BIT map
69 #define TPC_DATA_INTERVAL_OFFSET 0
70 #define TPC_DATA_INTERVAL_MSK (0xFFF << TPC_DATA_INTERVAL_OFFSET)
71 #define TPC_SAMPLE_NUM_OFFSET 12
72 #define TPC_SAMPLE_NUM_MSK (0xF << TPC_SAMPLE_NUM_OFFSET)
74 //TPC_BOUNCE_CTRL BIT map
75 #define TPC_DEBOUNCE_EN_BIT BIT_0
76 #define TPC_DEBOUNCE_NUM_OFFSET 1
77 #define TPC_DEBOUNCE_NUM_MSK (0xFF << TPC_DEBOUNCE_NUM_OFFSET)
80 //TPC_FILTER_CTRL BIT map
81 #define TPC_FILTER_EN_BIT BIT_0
82 #define TPC_FILTER_MODE_BIT BIT_1
83 #define TPC_FILTER_MODE_OFFSET 2
84 #define TPC_FILTER_MODE_MSK (0xF << TPC_FILTER_MODE_OFFSET)
86 //TPC_CALC_CTRL BIT map
87 #define TPC_CALC_EN_BIT BIT_0
90 #define TPC_DONE_IRQ_MSK_BIT BIT_2
91 #define TPC_UP_IRQ_MSK_BIT BIT_1
92 #define TPC_DOWN_IRQ_MSK_BIT BIT_0
93 #define TPC_INT_ALL_MSK (TPC_DONE_IRQ_MSK_BIT|TPC_UP_IRQ_MSK_BIT|TPC_DOWN_IRQ_MSK_BIT)
96 #define TPC_X_COEF_A_MSK 0x3FF
97 #define TPC_X_COEF_B_MSK 0x7FF
98 #define TPC_Y_COEF_A_MSK 0x3FF
99 #define TPC_Y_COEF_B_MSK 0x7FF
101 //TPC_BUF_CTRL BIT map
102 #define TPC_BUF_EMP_BIT BIT_5
103 #define TPC_BUF_FULL BIT_4
104 #define TPC_BUF_LENGTH_OFFSET 0
105 #define TPC_BUF_LENGTH_MSK (0xF << TPC_BUF_LENGTH_OFFSET)
107 /**----------------------------------------------------------------------------*
108 ** Local Function Prototype **
109 **----------------------------------------------------------------------------*/
111 /**----------------------------------------------------------------------------*
112 ** Function Prototype **
113 **----------------------------------------------------------------------------*/
116 /**----------------------------------------------------------------------------*
118 **----------------------------------------------------------------------------*/
122 /**---------------------------------------------------------------------------*/