import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / char / xilinx_ts / xtouchscreen_l.h
1 /* $Id: xtouchscreen_l.h,v 1.1.1.1 2005/04/11 02:50:21 jack Exp $ */
2 /******************************************************************************
3 *
4 *     Author: Xilinx, Inc.
5 *     
6 *     
7 *     This program is free software; you can redistribute it and/or modify it
8 *     under the terms of the GNU General Public License as published by the
9 *     Free Software Foundation; either version 2 of the License, or (at your
10 *     option) any later version.
11 *     
12 *     
13 *     XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
14 *     COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
15 *     ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
16 *     XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
17 *     FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR
18 *     OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
19 *     XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
20 *     THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
21 *     WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
22 *     CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
23 *     FITNESS FOR A PARTICULAR PURPOSE.
24 *     
25 *     
26 *     Xilinx products are not intended for use in life support appliances,
27 *     devices, or systems. Use in such applications is expressly prohibited.
28 *     
29 *     
30 *     (c) Copyright 2002 Xilinx Inc.
31 *     All rights reserved.
32 *     
33 *     
34 *     You should have received a copy of the GNU General Public License along
35 *     with this program; if not, write to the Free Software Foundation, Inc.,
36 *     675 Mass Ave, Cambridge, MA 02139, USA.
37 *
38 *****************************************************************************/
39 /****************************************************************************/
40 /**
41 *
42 * @file xtouchscreen_l.h
43 *
44 * This header file contains identifiers and low-level driver functions (or
45 * macros) that can be used to access the device.  The user should refer to the
46 * hardware device specification for more details of the device operation.
47 * High-level driver functions are defined in xtouchscreen.h.
48 *
49 * <pre>
50 * MODIFICATION HISTORY:
51 *
52 * Ver   Who  Date     Changes
53 * ----- ---- -------- -----------------------------------------------
54 * 1.00a ch   08/08/02 First release
55 * </pre>
56 *
57 *****************************************************************************/
58
59 #ifndef XTOUCHSCREEN_L_H        /* prevent circular inclusions */
60 #define XTOUCHSCREEN_L_H        /* by using protection macros  */
61
62 /***************************** Include Files ********************************/
63
64 #include "xbasic_types.h"
65 #include "xio.h"
66
67 /************************** Constant Definitions ****************************/
68
69 /* Register offsets */
70 #define XTOUCHSCREEN_CTRL_REG_OFFSET     0
71 #define XTOUCHSCREEN_INTR_REG_OFFSET     4
72
73 /* control register channel selectors */
74 #define XTOUCHSCREEN_CTRL_CHSEL_X    0xd3
75 #define XTOUCHSCREEN_CTRL_CHSEL_Y    0x93
76 #define XTOUCHSCREEN_CTRL_CHSEL_Z1   0xb3
77 #define XTOUCHSCREEN_CTRL_CHSEL_Z2   0xc3
78
79 /* interrupt register positions */
80 #define XTOUCHSCREEN_INT_PEN_UP      0x01
81 #define XTOUCHSCREEN_INT_PEN_DOWN    0x02
82
83 /* error reading touchscreen */
84 #define XTOUCHSCREEN_SAMPLE_ERROR     0xffffffff
85
86 /**************************** Type Definitions ******************************/
87
88 /***************** Macros (Inline Functions) Definitions ********************/
89
90 /*****************************************************************************
91 *
92 * Low-level driver macros.  The list below provides signatures to help the
93 * user use the macros.
94 *
95 * u32 XTouchscreen_mReadCtrlReg(u32 BaseAddress)
96 * void XTouchscreen_mWriteCtrlReg(u32 BaseAddress, u8 Value)
97
98 * u32 XTouchscreen_mGetIntrStatus(u32 BaseAddress)
99 * void XTouchscreen_mClearIntr(u32 BaseAddress, u32 ClearMask)
100 *
101 *****************************************************************************/
102
103 /****************************************************************************/
104 /**
105 * Read the control register.
106 *
107 * @param    BaseAddress contains the base address of the device.
108 *
109 * @return   The value read from the register.
110 *
111 * @note     None.
112 *
113 *****************************************************************************/
114 #define XTouchscreen_mReadCtrlReg(BaseAddress) \
115             XIo_In32((BaseAddress) + XTOUCHSCREEN_CTRL_REG_OFFSET)
116
117 /****************************************************************************/
118 /**
119 * Write to the control register
120 *
121 * @param    BaseAddress contains the base address of the device.
122             Value to be written
123 *
124 * @return   None.
125 *
126 * @note     None.
127 *
128 *****************************************************************************/
129 #define XTouchscreen_mWriteCtrlReg(BaseAddress, Value) \
130             XIo_Out8((BaseAddress) + XTOUCHSCREEN_CTRL_REG_OFFSET, Value)
131
132 /****************************************************************************/
133 /**
134 * Read the interrupt status register.
135 *
136 * @param    BaseAddress contains the base address of the device.
137 *
138 * @return   The value read from the register.
139 *
140 * @note     None.
141 *
142 *****************************************************************************/
143 #define XTouchscreen_mGetIntrStatus(BaseAddress) \
144             XIo_In32((BaseAddress) + XTOUCHSCREEN_INTR_REG_OFFSET)
145
146 /****************************************************************************/
147 /**
148 * Clear pending interrupts.
149 *
150 * @param    BaseAddress contains the base address of the device.
151 *           Bitmask for interrupts to be cleared. A "1" clears the interrupt.
152 *
153 * @return   None.
154 *
155 * @note     None.
156 *
157 *****************************************************************************/
158 #define XTouchscreen_mClearIntr(BaseAddress, ClearMask) \
159             XIo_Out32((BaseAddress) + XTOUCHSCREEN_INTR_REG_OFFSET, ClearMask)
160
161 /************************** Variable Definitions ****************************/
162
163 /************************** Function Prototypes *****************************/
164
165 u32 XTouchscreen_GetValue(u32 BaseAddress, u8 Channel);
166
167 /****************************************************************************/
168
169 #endif