OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2006-2009 NVIDIA Corporation. |
| 3 * All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: |
| 7 * |
| 8 * Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. |
| 10 * |
| 11 * Redistributions in binary form must reproduce the above copyright notice, |
| 12 * this list of conditions and the following disclaimer in the documentation |
| 13 * and/or other materials provided with the distribution. |
| 14 * |
| 15 * Neither the name of the NVIDIA Corporation nor the names of its contributors |
| 16 * may be used to endorse or promote products derived from this software |
| 17 * without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 * POSSIBILITY OF SUCH DAMAGE. |
| 30 * |
| 31 */ |
| 32 |
| 33 /** |
| 34 * @file |
| 35 * <b>NVIDIA Tegra ODM Kit: |
| 36 * Touch Pad Sensor Interface</b> |
| 37 * |
| 38 * @b Description: Defines the ODM adaptation interface for touch pad sensor dev
ices. |
| 39 * |
| 40 */ |
| 41 |
| 42 #ifndef INCLUDED_NVODM_TOUCH_H |
| 43 #define INCLUDED_NVODM_TOUCH_H |
| 44 |
| 45 #if defined(__cplusplus) |
| 46 extern "C" |
| 47 { |
| 48 #endif |
| 49 |
| 50 #include "nvodm_services.h" |
| 51 |
| 52 /** |
| 53 * @defgroup nvodm_touch Touch Pad Adaptation Interface |
| 54 * |
| 55 * This is the touch pad ODM adaptation interface. |
| 56 * |
| 57 * @ingroup nvodm_adaptation |
| 58 * @{ |
| 59 */ |
| 60 |
| 61 |
| 62 /** |
| 63 * Defines an opaque handle that exists for each touch device in the |
| 64 * system, each of which is defined by the customer implementation. |
| 65 */ |
| 66 typedef struct NvOdmTouchDeviceRec *NvOdmTouchDeviceHandle; |
| 67 |
| 68 #define NVODM_MAX_INPUT_COORDS 5 |
| 69 |
| 70 /** |
| 71 * @brief Defines the gesture type. |
| 72 */ |
| 73 typedef enum |
| 74 { |
| 75 /// Indicates the gesture is not supported. |
| 76 NvOdmTouchGesture_Not_Supported = 0x0000, |
| 77 |
| 78 /// Indicates that there was no gesture recognized. |
| 79 NvOdmTouchGesture_No_Gesture = 0x0001, |
| 80 |
| 81 /// Indicates the "tap" gesture: one rapid finger press and release. |
| 82 NvOdmTouchGesture_Tap = 0x0002, |
| 83 |
| 84 /// Indicates the "double tap" gesture: two taps in rapid succession. |
| 85 NvOdmTouchGesture_Double_Tap = 0x0004, |
| 86 |
| 87 /// Indicates the "tap and hold" gesture: a tap event rapidly followed by pr
ess-and-hold. |
| 88 NvOdmTouchGesture_Tap_and_Hold = 0x0008, |
| 89 |
| 90 /// Indicates the "press" gesture: a finger that presses down and stays on t
he panel. |
| 91 NvOdmTouchGesture_Press = 0x0010, |
| 92 |
| 93 /** |
| 94 * Indicates the "press and drag" gesture: a finger that presses down, stays |
| 95 * on the panel and then moves |
| 96 */ |
| 97 NvOdmTouchGesture_Press_Drag = 0x0020, |
| 98 |
| 99 /** |
| 100 * Indicates the "zoom" gesture: a simultaneous two-fingered gesture, where |
| 101 * the two fingers are either moving towards each other, or moving away from |
| 102 * each other. |
| 103 */ |
| 104 NvOdmTouchGesture_Zoom = 0x0040, |
| 105 |
| 106 /** |
| 107 * Indicates the "Flick" gesture: a "tap and drag" gesture or a fast |
| 108 * "press and drag" where the finger stays on the panel only for a short tim
e. |
| 109 */ |
| 110 NvOdmTouchGesture_Flick = 0x0080, |
| 111 |
| 112 NvOdmTouchGestureType_Force32 = 0x7fffffffUL |
| 113 } NvOdmTouchGestureType; |
| 114 |
| 115 |
| 116 /** |
| 117 * Defines the touch orientation based on the LCD screen. |
| 118 */ |
| 119 typedef enum |
| 120 { |
| 121 /// Indicates the touch panel X/Y coords are swapped in relation to LCD scre
en. |
| 122 NvOdmTouchOrientation_XY_SWAP = 0x01, |
| 123 /// Indicates the touch panel X/Y coords are horizontally flipped (or mirror
ed) in relation to LCD screen. |
| 124 NvOdmTouchOrientation_H_FLIP = 0x02, |
| 125 /// Indicates the touch panel X/Y coords are vertically flipped in relation
to LCD screen. |
| 126 NvOdmTouchOrientation_V_FLIP = 0x04, |
| 127 |
| 128 NvOdmTouchOrientation_Force32 = 0x7fffffffUL |
| 129 } NvOdmTouchOrientationType; |
| 130 /** |
| 131 * Defines the touch capabilities. |
| 132 */ |
| 133 typedef struct |
| 134 { |
| 135 /// Holds a value indicating whether or not multi-touch is supported: 1 sing
le touch : 0 multi-touch. |
| 136 NvBool IsMultiTouchSupported; |
| 137 |
| 138 /// Holds the maximum number of finger coordinates that can be reported. |
| 139 NvU32 MaxNumberOfFingerCoordReported; |
| 140 |
| 141 /// Holds a value indicating whether or not relative data for X/Y is support
ed: 1 not support : 0 supported. |
| 142 NvBool IsRelativeDataSupported; |
| 143 |
| 144 /// Holds the maximum value for relative coords that can be reported. |
| 145 NvU32 MaxNumberOfRelativeCoordReported; |
| 146 |
| 147 /// Holds the maximum width value that can be reported. |
| 148 NvU32 MaxNumberOfWidthReported; |
| 149 |
| 150 /// Holds the maximum pressure value that can be reported. |
| 151 NvU32 MaxNumberOfPressureReported; |
| 152 |
| 153 /// Holds a bitmask specifying the supported gestures |
| 154 NvU32 Gesture; |
| 155 |
| 156 /// Holds a value indicating whether or not finger width is supported. |
| 157 NvBool IsWidthSupported; |
| 158 |
| 159 /// Holds a value indicating whether finger signal strength or finger contac
t only is supported. |
| 160 NvBool IsPressureSupported; |
| 161 |
| 162 /// Holds a value indicating whether or not fingers on the panel are support
ed. |
| 163 NvBool IsFingersSupported; |
| 164 |
| 165 /// Holds the minimum X position. |
| 166 NvU32 XMinPosition; |
| 167 |
| 168 /// Holds the minimum Y position. |
| 169 NvU32 YMinPosition; |
| 170 |
| 171 /// Holds the maximum X position. |
| 172 NvU32 XMaxPosition; |
| 173 |
| 174 /// Holds the maximum Y position. |
| 175 NvU32 YMaxPosition; |
| 176 |
| 177 /// Holds the orientation based on the LCD screen. |
| 178 NvU32 Orientation; |
| 179 |
| 180 } NvOdmTouchCapabilities; |
| 181 |
| 182 |
| 183 /** |
| 184 * @brief Defines the possible touch states. |
| 185 */ |
| 186 typedef enum |
| 187 { |
| 188 /// Indicates a valid reading. |
| 189 NvOdmTouchSampleValidFlag = 0x1, |
| 190 |
| 191 /// Indicates to ignore the sample. |
| 192 NvOdmTouchSampleIgnore = 0x2, |
| 193 |
| 194 /// Indicates the state of the finger. |
| 195 NvOdmTouchSampleDownFlag = 0x4, |
| 196 |
| 197 NvOdmTouchSampleFlags_Force32 = 0x7fffffffUL |
| 198 } NvOdmTouchSampleFlags; |
| 199 |
| 200 |
| 201 /** |
| 202 * Defines the ODM touch-specific functionality information. |
| 203 */ |
| 204 typedef struct |
| 205 { |
| 206 /// Indicates x,y-coordinates for multiple input coordinates (fingers). |
| 207 NvU32 multi_XYCoords[NVODM_MAX_INPUT_COORDS][2]; |
| 208 /// Indicates approximate finger width on the touch panel. |
| 209 NvU8 width[NVODM_MAX_INPUT_COORDS]; |
| 210 /// Specifies a bitmask describing the gesture recognized. |
| 211 NvU32 Gesture; |
| 212 /// Indicates whether or not the gesture was valid. |
| 213 NvU8 Confirmed; |
| 214 /// Indicates the number of fingers on the touch panel. |
| 215 NvU8 Fingers; |
| 216 /// Indicates an approximate finger pressure. |
| 217 NvU8 Pressure[NVODM_MAX_INPUT_COORDS]; |
| 218 /// Indicates the relative coordinate information. |
| 219 NvS8 XYDelta[NVODM_MAX_INPUT_COORDS][2]; |
| 220 |
| 221 } NvOdmTouchAdditionalInfo; |
| 222 |
| 223 |
| 224 /** |
| 225 * Defines the ODM touch pad coordinate information. |
| 226 */ |
| 227 typedef struct |
| 228 { |
| 229 /// Specifies the X-coordinate. |
| 230 NvU32 xcoord; |
| 231 /// Specifies the Y-coordinate. |
| 232 NvU32 ycoord; |
| 233 /// Specifies the sample state information. |
| 234 NvU32 fingerstate; |
| 235 /// Specifies additional functionality information. |
| 236 NvOdmTouchAdditionalInfo additionalInfo; |
| 237 /// Specifies a pointer to extended data, if needed. |
| 238 void* pextrainfo; |
| 239 /// Specifies the size of extended data. |
| 240 NvU32 extrainfosize; |
| 241 |
| 242 } NvOdmTouchCoordinateInfo; |
| 243 |
| 244 |
| 245 /** |
| 246 * @brief Defines the structure for the sampling rate. |
| 247 */ |
| 248 typedef struct |
| 249 { |
| 250 /// Specifies a low amount of samples per second. |
| 251 NvU32 NvOdmTouchSampleRateLow; |
| 252 |
| 253 /// Specifies a high amount of samples per second. |
| 254 NvU32 NvOdmTouchSampleRateHigh; |
| 255 |
| 256 /// Specifies the current sample rate setting, zero is low, 1 is high. |
| 257 NvU32 NvOdmTouchCurrentSampleRate; |
| 258 } NvOdmTouchSampleRate; |
| 259 |
| 260 |
| 261 /** |
| 262 * @brief Defines the power mode for the touch panel. |
| 263 */ |
| 264 typedef enum |
| 265 { |
| 266 /// Indicates full power. |
| 267 NvOdmTouch_PowerMode_0 = 0x1, |
| 268 NvOdmTouch_PowerMode_1, |
| 269 NvOdmTouch_PowerMode_2, |
| 270 /// Indicates power off. |
| 271 NvOdmTouch_PowerMode_3, |
| 272 NvOdmTouchPowerMode_Force32 = 0x7fffffffUL |
| 273 } NvOdmTouchPowerModeType; |
| 274 |
| 275 |
| 276 |
| 277 /** |
| 278 * Gets a handle to the touch pad in the system. |
| 279 * |
| 280 * @param hDevice A pointer to the handle of the touch pad. |
| 281 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 282 */ |
| 283 NvBool |
| 284 NvOdmTouchDeviceOpen( NvOdmTouchDeviceHandle *hDevice ); |
| 285 |
| 286 /** |
| 287 * Gets capabilities for the specified touch device. |
| 288 * |
| 289 * @param hDevice The handle of the touch pad. |
| 290 * @param pCapabilities A pointer to the targeted |
| 291 * capabilities returned by the ODM. |
| 292 */ |
| 293 void |
| 294 NvOdmTouchDeviceGetCapabilities(NvOdmTouchDeviceHandle hDevice, NvOdmTouchCapabi
lities* pCapabilities); |
| 295 |
| 296 /** |
| 297 * Gets coordinate info from the touch device. |
| 298 * |
| 299 * @param hDevice The handle to the touch pad. |
| 300 * @param coord A pointer to the structure holding coordinate info. |
| 301 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 302 */ |
| 303 NvBool |
| 304 NvOdmTouchReadCoordinate( NvOdmTouchDeviceHandle hDevice, NvOdmTouchCoordinateIn
fo *coord); |
| 305 |
| 306 |
| 307 /** |
| 308 * Hooks up the interrupt handle to the GPIO interrupt and enables the interrupt
. |
| 309 * |
| 310 * @param hDevice The handle to the touch pad. |
| 311 * @param hInterruptSemaphore A handle to hook up the interrupt. |
| 312 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 313 */ |
| 314 NvBool NvOdmTouchEnableInterrupt(NvOdmTouchDeviceHandle hDevice, NvOdmOsSemaphor
eHandle hInterruptSemaphore); |
| 315 |
| 316 /** |
| 317 * Prepares the next interrupt to get notified from the touch device. |
| 318 * |
| 319 * @param hDevice A handle to the touch pad. |
| 320 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 321 */ |
| 322 NvBool NvOdmTouchHandleInterrupt(NvOdmTouchDeviceHandle hDevice); |
| 323 |
| 324 /** |
| 325 * Gets the touch ADC sample rate. |
| 326 * |
| 327 * @param hDevice A handle to the touch ADC. |
| 328 * @param pTouchSampleRate A pointer to the NvOdmTouchSampleRate stucture. |
| 329 * |
| 330 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 331 */ |
| 332 NvBool |
| 333 NvOdmTouchGetSampleRate(NvOdmTouchDeviceHandle hDevice, NvOdmTouchSampleRate* pT
ouchSampleRate); |
| 334 |
| 335 |
| 336 /** |
| 337 * Sets the touch ADC sample rate. |
| 338 * |
| 339 * @param hDevice A handle to the touch ADC. |
| 340 * @param SampleRate 1 indicates high frequency, 0 indicates low frequency. |
| 341 * |
| 342 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 343 */ |
| 344 NvBool |
| 345 NvOdmTouchSetSampleRate(NvOdmTouchDeviceHandle hDevice, NvU32 SampleRate); |
| 346 |
| 347 |
| 348 /** |
| 349 * Sets the touch panel power mode. |
| 350 * |
| 351 * @param hDevice A handle to the touch ADC. |
| 352 * @param mode The mode, ranging from full power to power off. |
| 353 * |
| 354 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 355 */ |
| 356 NvBool |
| 357 NvOdmTouchPowerControl(NvOdmTouchDeviceHandle hDevice, NvOdmTouchPowerModeType m
ode); |
| 358 |
| 359 /** |
| 360 * Powers the touch device on or off. |
| 361 * |
| 362 * @param hDevice A handle to the touch ADC. |
| 363 * @param OnOff Specify 1 to power on; 0 to power off. |
| 364 */ |
| 365 void |
| 366 NvOdmTouchPowerOnOff(NvOdmTouchDeviceHandle hDevice, NvBool OnOff); |
| 367 |
| 368 /** |
| 369 * Releases the touch pad handle. |
| 370 * |
| 371 * @param hDevice The touch pad handle to be released. If |
| 372 * NULL, this API has no effect. |
| 373 */ |
| 374 void NvOdmTouchDeviceClose(NvOdmTouchDeviceHandle hDevice); |
| 375 |
| 376 /** |
| 377 * Gets the touch ODM debug configuration. |
| 378 * |
| 379 * @param hDevice A handle to the touch pad. |
| 380 * |
| 381 * @return NV_TRUE if debug message is enabled, or NV_FALSE if not. |
| 382 */ |
| 383 NvBool |
| 384 NvOdmTouchOutputDebugMessage(NvOdmTouchDeviceHandle hDevice); |
| 385 |
| 386 /** |
| 387 * Gets the touch panel calibration data. |
| 388 * This is optional as calibration may perform after the OS is up. |
| 389 * This is not required to bring up the touch panel. |
| 390 * |
| 391 * @param hDevice A handle to the touch panel. |
| 392 * @param NumOfCalibrationData Indicates the number of calibration points. |
| 393 * @param pRawCoordBuffer The collection of X/Y coordinate data. |
| 394 * |
| 395 * @return NV_TRUE if preset calibration data is required, or NV_FALSE otherwise
. |
| 396 */ |
| 397 NvBool |
| 398 NvOdmTouchGetCalibrationData(NvOdmTouchDeviceHandle hDevice, NvU32 NumOfCalibrat
ionData, NvS32* pRawCoordBuffer); |
| 399 #if defined(__cplusplus) |
| 400 } |
| 401 #endif |
| 402 |
| 403 /** @} */ |
| 404 |
| 405 #endif // INCLUDED_NVODM_TOUCH_H |
OLD | NEW |