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 * Vibrate Interface</b> |
| 37 * |
| 38 * @b Description: Defines the ODM interface for vibrate devices. |
| 39 * |
| 40 */ |
| 41 |
| 42 #ifndef INCLUDED_NVODM_VIBRATE_H |
| 43 #define INCLUDED_NVODM_VIBRATE_H |
| 44 |
| 45 #include "nvcommon.h" |
| 46 |
| 47 /** |
| 48 * @defgroup nvodm_vibrate Vibrate Adaption Interface |
| 49 * |
| 50 * This is the Vibrate ODM adaptation interface. |
| 51 * |
| 52 * @ingroup nvodm_adaptation |
| 53 * @{ |
| 54 */ |
| 55 |
| 56 /** |
| 57 * @brief Opaque handle to the vibrate device. |
| 58 */ |
| 59 typedef struct NvOdmVibDeviceRec *NvOdmVibDeviceHandle; |
| 60 |
| 61 /** |
| 62 * @brief Defines attributes that can be set/queried by clients. |
| 63 */ |
| 64 typedef enum |
| 65 { |
| 66 NvOdmVibCaps_Invalid = 0x0, |
| 67 /** Specifies the maximum supported frequency. */ |
| 68 NvOdmVibCaps_MaxFreq, |
| 69 /** Specifies the minimum supported frequency. */ |
| 70 NvOdmVibCaps_MinFreq, |
| 71 /** Specifies the maximum supported duty cycle. */ |
| 72 NvOdmVibCaps_MaxDutyCycle, |
| 73 NvOdmVibCaps_Num, |
| 74 NvOdmVibCaps_Force32 = 0x7FFFFFFF, |
| 75 } NvOdmVibCaps; |
| 76 |
| 77 #if defined(_cplusplus) |
| 78 extern "C" |
| 79 { |
| 80 #endif |
| 81 |
| 82 /** |
| 83 * @brief Allocates a handle to the device. Configures the PWM |
| 84 * control to the vibro motor with default values. To change |
| 85 * the duty cycle and frequency, use NvOdmVibSetFrequency() and |
| 86 * NvOdmVibSetDutyCycle() APIs. |
| 87 * @param hOdmVibrate [IN] A pointer to the opaque handle to the device. |
| 88 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 89 */ |
| 90 NvBool |
| 91 NvOdmVibOpen(NvOdmVibDeviceHandle *hOdmVibrate); |
| 92 |
| 93 /** |
| 94 * @brief Closes the ODM device and destroys all allocated resources. |
| 95 * @param hOdmVibrate [IN] The opaque handle to the device. |
| 96 */ |
| 97 void |
| 98 NvOdmVibClose(NvOdmVibDeviceHandle hOdmVibrate); |
| 99 |
| 100 /** |
| 101 * @brief Gets capabilities of the vibrate device. |
| 102 * @param hDevice [IN] The opaque handle to the device. |
| 103 * @param RequestedCaps [IN] Specifies the capability to get. |
| 104 * @param pCapsValue [OUT] A pointer to the returned value. |
| 105 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 106 */ |
| 107 NvBool |
| 108 NvOdmVibGetCaps( |
| 109 NvOdmVibDeviceHandle hDevice, |
| 110 NvOdmVibCaps RequestedCaps, |
| 111 NvU32 *pCapsValue); |
| 112 |
| 113 /** |
| 114 * @brief Sets the frequency to the vibro motor. |
| 115 * A frequency less than zero will be set to zero |
| 116 * and a frequency value beyond the maximum supported value |
| 117 * will be set to the maximum supported value. |
| 118 * @param hDevice [IN] The opaque handle to the device. |
| 119 * @param Freq [IN] The frequency to set in Hz. |
| 120 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 121 */ |
| 122 NvBool |
| 123 NvOdmVibSetFrequency(NvOdmVibDeviceHandle hDevice, NvS32 Freq); |
| 124 |
| 125 /** |
| 126 * @brief Sets the dutycycle of the PWM driving the vibro motor. |
| 127 * A duty cycle less than zero will be set to zero |
| 128 * and value beyond the maximum supported value |
| 129 * will be set to the maximum supported value. |
| 130 * @param hDevice [IN] The opaque handle to the device. |
| 131 * @param DCycle [IN] The duty cycle value to set in percentage (0%-100%)
. |
| 132 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 133 */ |
| 134 NvBool |
| 135 NvOdmVibSetDutyCycle(NvOdmVibDeviceHandle hDevice, NvS32 DCycle); |
| 136 |
| 137 /** |
| 138 * @brief Starts the vibro with the frequency and duty cycle set using the |
| 139 * set API. |
| 140 * @param hDevice [IN] The opaque handle to the device. |
| 141 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 142 */ |
| 143 NvBool |
| 144 NvOdmVibStart(NvOdmVibDeviceHandle hDevice); |
| 145 |
| 146 /** |
| 147 * @brief Stops the vibro motor. |
| 148 * @param hDevice [IN] The opaque handle to the device. |
| 149 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 150 */ |
| 151 NvBool |
| 152 NvOdmVibStop(NvOdmVibDeviceHandle hDevice); |
| 153 |
| 154 #if defined(__cplusplus) |
| 155 } |
| 156 #endif |
| 157 |
| 158 /** @} */ |
| 159 |
| 160 #endif // INCLUDED_NVODM_VIBRATE_H |
OLD | NEW |