OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 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 * External GPIO Interface</b> |
| 37 * |
| 38 * @b Description: Defines the ODM adaptation interface for GPIO |
| 39 * pins that are sourced from off-chip peripherals. |
| 40 */ |
| 41 |
| 42 #ifndef INCLUDED_NVODM_GPIO_EXT_H |
| 43 #define INCLUDED_NVODM_GPIO_EXT_H |
| 44 |
| 45 #include "nvcommon.h" |
| 46 #include "nvodm_services.h" |
| 47 |
| 48 /** |
| 49 * @defgroup nvodm_gpio_ext External GPIO Interface |
| 50 * |
| 51 * Your clients do not use the API functions defined here. Instead, they |
| 52 * make use of the ::NvOdmExternalGpioPort enumeration, which defines |
| 53 * logical GPIO ports that may be included in the Peripheral DB entries. |
| 54 * The ODM developer is responsible to write the external GPIO handler in |
| 55 * your ODM Adaptation implementation. |
| 56 * |
| 57 * This feature makes it possible to treat GPIOs sourced from an external |
| 58 * peripheral as if they came from the Tegra application processor itself |
| 59 * (thus, allowing for the use of the NvOdmGpio* functions). This makes |
| 60 * it possible for some adaptation client implementations to remain |
| 61 * unchanged if the pin gets moved from an external to an internal device. |
| 62 * |
| 63 * For instance, the PMU sources a GPIO pin for the backlight, but the |
| 64 * display adaptation just requests the GPIO for this function from the |
| 65 * Peripheral DB. The PMU adaptation implements the actual handling of |
| 66 * the external GPIO. As an alternative, the backlight could be switched |
| 67 * on or off via a GPIO pin from the chip. In that case, the peripheral |
| 68 * DB will get updated, but the display adaptation can remain unchanged, |
| 69 * which is the advantage of this feature. |
| 70 * |
| 71 * @ingroup nvodm_adaptation |
| 72 * @{ |
| 73 */ |
| 74 |
| 75 #if defined(__cplusplus) |
| 76 extern "C" |
| 77 { |
| 78 #endif |
| 79 |
| 80 |
| 81 /** External GPIO device context. */ |
| 82 typedef struct GpioExtDeviceRec* NvOdmGpioExtHandle; |
| 83 |
| 84 /** |
| 85 * @brief Defines the external GPIO ports. These definitions |
| 86 * are generic placeholders, as they map to off-chip |
| 87 * GPIOs as defined by the ODM. The ODM is |
| 88 * responsible for documenting and using these |
| 89 * pre-defined ports consistently between their |
| 90 * adaptation client and their implementation of the |
| 91 * Peripheral Discovery DB entries. |
| 92 */ |
| 93 typedef enum { |
| 94 NVODM_GPIO_EXT_PORT_0 = 0xD0, |
| 95 NVODM_GPIO_EXT_PORT_1, |
| 96 NVODM_GPIO_EXT_PORT_2, |
| 97 NVODM_GPIO_EXT_PORT_3, |
| 98 NVODM_GPIO_EXT_PORT_4, |
| 99 NVODM_GPIO_EXT_PORT_5, |
| 100 NVODM_GPIO_EXT_PORT_6, |
| 101 NVODM_GPIO_EXT_PORT_7, |
| 102 NVODM_GPIO_EXT_PORT_8, |
| 103 NVODM_GPIO_EXT_PORT_9, |
| 104 NVODM_GPIO_EXT_PORT_A, |
| 105 NVODM_GPIO_EXT_PORT_B, |
| 106 NVODM_GPIO_EXT_PORT_C, |
| 107 NVODM_GPIO_EXT_PORT_D, |
| 108 NVODM_GPIO_EXT_PORT_E, |
| 109 NVODM_GPIO_EXT_PORT_F, |
| 110 } NvOdmExternalGpioPort; |
| 111 |
| 112 /** |
| 113 * This is an ODM-specific adaptation that writes the output |
| 114 * state of external (off-chip) GPIO pins for the specified |
| 115 * port. This function is not called directly by the client |
| 116 * that uses the external GPIOs, but rather called indirectly |
| 117 * via NvOdmGpioSetState(). |
| 118 * |
| 119 * @sa NvOdmGpioOpen(), NvOdmExternalGpioReadPins() |
| 120 * |
| 121 * @param Port The specified external GPIO port. |
| 122 * @param Pin The specified GPIO pin. |
| 123 * @param PinValue The pin state to set. 0 means drive low, 1 means drive high. |
| 124 */ |
| 125 void |
| 126 NvOdmExternalGpioWritePins( |
| 127 NvU32 Port, |
| 128 NvU32 Pin, |
| 129 NvU32 PinValue); |
| 130 |
| 131 /** |
| 132 * This is an ODM-specific adaptation that reads the output |
| 133 * state of external (off-chip) GPIO pins for the specified |
| 134 * port. This function is not called directly by the client |
| 135 * that uses the external GPIOs, but rather called indirectly |
| 136 * via NvOdmGpioGetState(). |
| 137 * |
| 138 * @sa NvOdmGpioOpen(), NvOdmExternalGpioWritePins() |
| 139 * |
| 140 * @param Port The specified external GPIO port. |
| 141 * @param Pin The specified GPIO pin. |
| 142 * |
| 143 * @return The current state of the specified port+pin. |
| 144 */ |
| 145 NvU32 |
| 146 NvOdmExternalGpioReadPins( |
| 147 NvU32 Port, |
| 148 NvU32 Pin); |
| 149 |
| 150 #if defined(__cplusplus) |
| 151 } |
| 152 #endif |
| 153 |
| 154 /** @} */ |
| 155 #endif // INCLUDED_NVODM_GPIO_EXT_H |
OLD | NEW |