1 /* $Id: xtouchscreen_l.h,v 1.1.1.1 2005/04/11 02:50:21 jack Exp $ */
2 /******************************************************************************
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.
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.
26 * Xilinx products are not intended for use in life support appliances,
27 * devices, or systems. Use in such applications is expressly prohibited.
30 * (c) Copyright 2002 Xilinx Inc.
31 * All rights reserved.
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.
38 *****************************************************************************/
39 /****************************************************************************/
42 * @file xtouchscreen_l.h
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.
50 * MODIFICATION HISTORY:
52 * Ver Who Date Changes
53 * ----- ---- -------- -----------------------------------------------
54 * 1.00a ch 08/08/02 First release
57 *****************************************************************************/
59 #ifndef XTOUCHSCREEN_L_H /* prevent circular inclusions */
60 #define XTOUCHSCREEN_L_H /* by using protection macros */
62 /***************************** Include Files ********************************/
64 #include "xbasic_types.h"
67 /************************** Constant Definitions ****************************/
69 /* Register offsets */
70 #define XTOUCHSCREEN_CTRL_REG_OFFSET 0
71 #define XTOUCHSCREEN_INTR_REG_OFFSET 4
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
79 /* interrupt register positions */
80 #define XTOUCHSCREEN_INT_PEN_UP 0x01
81 #define XTOUCHSCREEN_INT_PEN_DOWN 0x02
83 /* error reading touchscreen */
84 #define XTOUCHSCREEN_SAMPLE_ERROR 0xffffffff
86 /**************************** Type Definitions ******************************/
88 /***************** Macros (Inline Functions) Definitions ********************/
90 /*****************************************************************************
92 * Low-level driver macros. The list below provides signatures to help the
93 * user use the macros.
95 * u32 XTouchscreen_mReadCtrlReg(u32 BaseAddress)
96 * void XTouchscreen_mWriteCtrlReg(u32 BaseAddress, u8 Value)
98 * u32 XTouchscreen_mGetIntrStatus(u32 BaseAddress)
99 * void XTouchscreen_mClearIntr(u32 BaseAddress, u32 ClearMask)
101 *****************************************************************************/
103 /****************************************************************************/
105 * Read the control register.
107 * @param BaseAddress contains the base address of the device.
109 * @return The value read from the register.
113 *****************************************************************************/
114 #define XTouchscreen_mReadCtrlReg(BaseAddress) \
115 XIo_In32((BaseAddress) + XTOUCHSCREEN_CTRL_REG_OFFSET)
117 /****************************************************************************/
119 * Write to the control register
121 * @param BaseAddress contains the base address of the device.
128 *****************************************************************************/
129 #define XTouchscreen_mWriteCtrlReg(BaseAddress, Value) \
130 XIo_Out8((BaseAddress) + XTOUCHSCREEN_CTRL_REG_OFFSET, Value)
132 /****************************************************************************/
134 * Read the interrupt status register.
136 * @param BaseAddress contains the base address of the device.
138 * @return The value read from the register.
142 *****************************************************************************/
143 #define XTouchscreen_mGetIntrStatus(BaseAddress) \
144 XIo_In32((BaseAddress) + XTOUCHSCREEN_INTR_REG_OFFSET)
146 /****************************************************************************/
148 * Clear pending interrupts.
150 * @param BaseAddress contains the base address of the device.
151 * Bitmask for interrupts to be cleared. A "1" clears the interrupt.
157 *****************************************************************************/
158 #define XTouchscreen_mClearIntr(BaseAddress, ClearMask) \
159 XIo_Out32((BaseAddress) + XTOUCHSCREEN_INTR_REG_OFFSET, ClearMask)
161 /************************** Variable Definitions ****************************/
163 /************************** Function Prototypes *****************************/
165 u32 XTouchscreen_GetValue(u32 BaseAddress, u8 Channel);
167 /****************************************************************************/