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 #ifndef INCLUDED_nvrm_owr_H |
| 34 #define INCLUDED_nvrm_owr_H |
| 35 |
| 36 |
| 37 #if defined(__cplusplus) |
| 38 extern "C" |
| 39 { |
| 40 #endif |
| 41 |
| 42 #include "nvrm_pinmux.h" |
| 43 #include "nvrm_module.h" |
| 44 #include "nvrm_init.h" |
| 45 |
| 46 #include "nvos.h" |
| 47 #include "nvcommon.h" |
| 48 |
| 49 /** |
| 50 * NvRmOwrHandle is an opaque handle for the RM OWR driver. |
| 51 */ |
| 52 |
| 53 typedef struct NvRmOwrRec *NvRmOwrHandle; |
| 54 |
| 55 /** |
| 56 * @brief Open the OWR driver. This function allocates the |
| 57 * RM OWR handle. |
| 58 * |
| 59 * Assert encountered in debug mode if passed parameter is invalid. |
| 60 * |
| 61 * @param hDevice Handle to the Rm device which is required by Rm to acquire |
| 62 * the resources from RM. |
| 63 * @param instance Instance of the OWR controller to be opened. Starts from 0. |
| 64 * @param phOwr Points to the location where the OWR handle shall be stored. |
| 65 * |
| 66 * @retval NvSuccess OWR driver opened successfully. |
| 67 * @retval NvError_InsufficientMemory Indicates that function fails to allocate |
| 68 * the memory. |
| 69 */ |
| 70 |
| 71 NvError NvRmOwrOpen( |
| 72 NvRmDeviceHandle hDevice, |
| 73 NvU32 instance, |
| 74 NvRmOwrHandle * hOwr ); |
| 75 |
| 76 /** |
| 77 * @brief Closes the OWR driver. Disables the clock and invalidates the OWR hand
le. |
| 78 * This API never fails. |
| 79 * |
| 80 * @param hOwr A handle from NvRmOwrOpen(). If hOwr is NULL, this API does |
| 81 * nothing. |
| 82 */ |
| 83 |
| 84 void NvRmOwrClose( |
| 85 NvRmOwrHandle hOwr ); |
| 86 |
| 87 /** |
| 88 * Defines OWR transaction flags. |
| 89 */ |
| 90 |
| 91 typedef enum |
| 92 { |
| 93 |
| 94 /// OWR read the unique address of the device. |
| 95 NvRmOwr_ReadAddress = 1, |
| 96 |
| 97 /// OWR memory read transaction. |
| 98 NvRmOwr_MemRead, |
| 99 |
| 100 /// OWR memory write transaction. |
| 101 NvRmOwr_MemWrite, |
| 102 |
| 103 /// OWR memory readbyte transaction. |
| 104 NvRmOwr_ReadByte, |
| 105 |
| 106 /// OWR memory writebyte transaction. |
| 107 NvRmOwr_WriteByte, |
| 108 |
| 109 /// OWR memory Check Presence |
| 110 NvRmOwr_CheckPresence, |
| 111 |
| 112 /// OWR readbit transaction. |
| 113 /// The LSB will be received first. |
| 114 NvRmOwr_ReadBit, |
| 115 |
| 116 /// OWR writebit transaction. |
| 117 /// The LSB will be transmitted first. |
| 118 NvRmOwr_WriteBit, |
| 119 |
| 120 NvRmOwrTransactionFlags_Num, |
| 121 NvRmOwrTransactionFlags_Force32 = 0x7FFFFFFF |
| 122 } NvRmOwrTransactionFlags; |
| 123 |
| 124 /** |
| 125 * Defines OWR transaction info structure. Contains details of the transaction. |
| 126 */ |
| 127 |
| 128 typedef struct NvRmOwrTransactionInfoRec |
| 129 { |
| 130 |
| 131 /// Transaction type flags. See @NvRmOwrTransactionFlags |
| 132 NvU32 Flags; |
| 133 |
| 134 /// Offset in the OWR device where Memory read/write operations need to be p
erformed. |
| 135 NvU32 Offset; |
| 136 |
| 137 /// Number of bytes to read/write. |
| 138 NvU32 NumBytes; |
| 139 |
| 140 /// OWR device ROM Id. This can be zero, if there is a single OWR device on
the bus. |
| 141 NvU32 Address; |
| 142 } NvRmOwrTransactionInfo; |
| 143 |
| 144 /** |
| 145 * @brief Does multiple OWR transactions. Each transaction can be a read or writ
e. |
| 146 * |
| 147 * @param hOwr Handle to the OWR channel. |
| 148 * @param OwrPinMap for OWR controllers which are being multiplexed across |
| 149 * multiple pin mux configurations, this specifies which pin mux configur
ation |
| 150 * should be used for the transaction. Must be 0 when the ODM pin mux qu
ery |
| 151 * specifies a non-multiplexed configuration for the controller. |
| 152 * @param Data Pointer to the buffer for all the required read, write transactio
ns. |
| 153 * @param DataLength Length of the data buffer. |
| 154 * @param Transcations Pointer to the NvRmOwrTransactionInfo structure. |
| 155 * See @NvRmOwrTransactionInfo |
| 156 * @param NumOfTransactions Number of transcations |
| 157 * |
| 158 * |
| 159 * @retval NvSuccess OWR Transaction succeeded. |
| 160 * @retval NvError_NotSupported Indicates assumption on parameter values violate
d. |
| 161 * @retval NvError_InvalidState Indicates that the last read or write call is no
t |
| 162 * completed. |
| 163 * @retval NvError_ControllerBusy Indicates controller is presently busy with an |
| 164 * OWR transaction. |
| 165 */ |
| 166 |
| 167 NvError NvRmOwrTransaction( |
| 168 NvRmOwrHandle hOwr, |
| 169 NvU32 OwrPinMap, |
| 170 NvU8 * Data, |
| 171 NvU32 DataLen, |
| 172 NvRmOwrTransactionInfo * Transaction, |
| 173 NvU32 NumOfTransactions ); |
| 174 |
| 175 #if defined(__cplusplus) |
| 176 } |
| 177 #endif |
| 178 |
| 179 #endif |
OLD | NEW |