OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2007-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 Driver Development Kit: UART Driver Interface</b> |
| 36 * |
| 37 * @b Description: This file defines the interface to the UART driver. |
| 38 */ |
| 39 |
| 40 #ifndef INCLUDED_NVDDK_UART_H |
| 41 #define INCLUDED_NVDDK_UART_H |
| 42 |
| 43 /** |
| 44 * @defgroup nvddk_uart UART Driver Interface |
| 45 * |
| 46 * This is the Universal Asynchronous Receiver Transmitter (UART) interface. |
| 47 * There may be more than one UART in the SOC, which communicate with other |
| 48 * systems. This interface provides the communication channel configuration, |
| 49 * basic data transfer (receive and transmit) and hardware flow control (modem |
| 50 * flow control). |
| 51 * This driver does not support any software protocols, like IrDA SIR protocol. |
| 52 * |
| 53 * @ingroup nvddk_modules |
| 54 * @{ |
| 55 */ |
| 56 |
| 57 #include "nvcommon.h" |
| 58 #include "nvos.h" |
| 59 #include "nvrm_init.h" |
| 60 #include "nvrm_module.h" |
| 61 |
| 62 #if defined(__cplusplus) |
| 63 extern "C" |
| 64 { |
| 65 #endif |
| 66 |
| 67 /** Opaque context to the NvDdkUartRec interface. |
| 68 */ |
| 69 typedef struct NvDdkUartRec *NvDdkUartHandle; |
| 70 |
| 71 |
| 72 /** |
| 73 * Defines the UART communication signal configuration for parity bit. |
| 74 */ |
| 75 typedef enum |
| 76 { |
| 77 /// Specifies parity to be none. |
| 78 NvDdkUartParity_None = 0x1, |
| 79 /// Specifies parity to be odd. |
| 80 NvDdkUartParity_Odd, |
| 81 /// Specifies even parity to be even. |
| 82 NvDdkUartParity_Even, |
| 83 /// Ignore -- Forces compilers to make 32-bit enums. |
| 84 NvDdkUartParity_Force32 = 0x7FFFFFFF |
| 85 } NvDdkUartParity; |
| 86 |
| 87 /** |
| 88 * Defines the UART communication signal configuration for stop bit. |
| 89 */ |
| 90 typedef enum |
| 91 { |
| 92 /// Specifies stop bit 1, word length can be 5, 6, 7, or 8. |
| 93 NvDdkUartStopBit_1= 0x1, |
| 94 /// Specifies stop bit 2, word length can be 6, 7, or 8. |
| 95 NvDdkUartStopBit_2, |
| 96 /// Specifies stop bit 1.5, word length should be 5 only. |
| 97 NvDdkUartStopBit_1_5, |
| 98 /// Ignore -- Forces compilers to make 32-bit enums. |
| 99 NvDdkUartStopBit_Force32 = 0x7FFFFFFF |
| 100 } NvDdkUartStopBit; |
| 101 |
| 102 /** |
| 103 * Defines the UART modem signal name to get/set the status/value. |
| 104 */ |
| 105 typedef enum |
| 106 { |
| 107 /// Specifies a modem signal name of RxD. |
| 108 NvDdkUartSignalName_Rxd = 0x1, |
| 109 /// Specifies a modem signal name of TxD. |
| 110 NvDdkUartSignalName_Txd = 0x2, |
| 111 /// Specifies a modem signal name of RTS. |
| 112 NvDdkUartSignalName_Rts = 0x4, |
| 113 /// Specifies a modem signal name of CTS. |
| 114 NvDdkUartSignalName_Cts = 0x8, |
| 115 /// Specifies a modem signal name of DTR. |
| 116 NvDdkUartSignalName_Dtr = 0x10, |
| 117 /// Specifies a modem signal name of DSR. |
| 118 NvDdkUartSignalName_Dsr = 0x20, |
| 119 /// Specifies a modem signal name for ring indicator. |
| 120 NvDdkUartSignalName_Ri = 0x40, |
| 121 /// Specifies a modem signal name for carrier detect. |
| 122 NvDdkUartSignalName_Cd = 0x80, |
| 123 /// Ignore -- Forces compilers to make 32-bit enums. |
| 124 NvDdkUartSignalName_Force32 = 0x7FFFFFFF |
| 125 } NvDdkUartSignalName; |
| 126 |
| 127 /** |
| 128 * Defines the HW flow control signal states and their behavior. |
| 129 * This is applicable for the modem flow control signal, like RTS, CTS, DSR, DTR
, |
| 130 * RI, and CD. |
| 131 * The handshake flow control is configured for the RTS and CTS. When RTS and CT
S |
| 132 * lines are set for the handshake the driver will transfer the data based on |
| 133 * status of the line. |
| 134 */ |
| 135 typedef enum |
| 136 { |
| 137 /// Disable the flow control. The output signal state will be low. |
| 138 NvDdkUartFlowControl_Disable = 0x1, |
| 139 |
| 140 /// Enable the flow control. The output signal state will be high. |
| 141 NvDdkUartFlowControl_Enable, |
| 142 |
| 143 /// Enable the handshake of the flow control line. |
| 144 /// This is applicable for the RTS and CTS line. |
| 145 /// For RTS line, when the buffer is full or UART driver is not able to |
| 146 /// receive the data, it will deactivate the line. |
| 147 /// For CTS line, the data is transmitted only when the CTS line is active, |
| 148 /// otherwise it will not send the data. |
| 149 NvDdkUartFlowControl_Handshake, |
| 150 /// Ignore -- Forces compilers to make 32-bit enums. |
| 151 NvDdkUartFlowControl_Force32 = 0x7FFFFFFF |
| 152 } NvDdkUartFlowControl; |
| 153 |
| 154 /** |
| 155 * Combines the UART port configuration parameter, like baud rate, |
| 156 * parity, data length, stop bit, IrDA modulation, and interfacing type. |
| 157 */ |
| 158 typedef struct |
| 159 { |
| 160 /// Holds the baud rate. Baudrate should be in the bps (bit per second). |
| 161 NvU32 UartBaudRate; |
| 162 |
| 163 /// Holds the parity bit. This can be even, odd, or none. |
| 164 NvDdkUartParity UartParityBit; |
| 165 |
| 166 /// Holds the data length in number of bits per UART asynchronous frame. |
| 167 /// This is number of bits between start and stop bit of UART asynch frame. |
| 168 /// The valid length are 5,6,7, and 8. |
| 169 NvU8 UartDataLength; |
| 170 |
| 171 /// Holds the stop bit. |
| 172 /// The UART controller does not support all stop bits with all data |
| 173 /// lengths (16550 compatible UART). |
| 174 /// The valid combinations are: |
| 175 /// 1 stop bit for data length 5, 6, 7, or 8. |
| 176 /// 1.5 stop bit for data length 5. |
| 177 /// 2 stop bit for data length 6, 7, or 8. |
| 178 NvDdkUartStopBit UartStopBit; |
| 179 |
| 180 /// Holds whether IrDA signal modulation is enabled or not. |
| 181 NvBool IsEnableIrdaModulation; |
| 182 } NvDdkUartConfiguarations; |
| 183 |
| 184 /** |
| 185 * Opens the UART channel and creates the handle of UART. This function |
| 186 * allocates the memory/OS resources for the requested UART channel and |
| 187 * returns the handle to the client. The client will call other API by |
| 188 * passing this handle. |
| 189 * This initializes the UART controller. |
| 190 * |
| 191 * @param hDevice Handle to the Rm device that is required by DDK to acquire |
| 192 * the resources from RM. |
| 193 * @param ChannelId Specifies the UART channel ID for which context handle is |
| 194 * required. Valid instance ID start from 0. |
| 195 * @param phUart A pointer to the UART handle where the allocated handle pointer |
| 196 * will be stored. |
| 197 * |
| 198 * @retval NvSuccess Indicates the controller successfully initialized. |
| 199 * @retval NvError_InsufficientMemory Indicates that function fails to allocate |
| 200 * the memory for handle. |
| 201 * @retval NvError_AlreadyOpen Indicates a channel is already open and so it |
| 202 * returns the NULL handle. |
| 203 * @retval NvError_BadValue Indicates that the channel ID is not valid. It may |
| 204 * be more than supported channel ID. |
| 205 * @retval NvError_MemoryMapFailed Indicates that the memory mapping for |
| 206 * controller register failed. |
| 207 * @retval NvError_MutexCreateFailed Indicates that the creation of mutex |
| 208 * failed. Mutex is required to provide the thread safety. |
| 209 * @retval NvError_SemaphoreCreateFailed Indicates that the creation of |
| 210 * semaphore failed. Semaphore is required to provide the synchronous |
| 211 * operation. |
| 212 */ |
| 213 NvError |
| 214 NvDdkUartOpen( |
| 215 NvRmDeviceHandle hDevice, |
| 216 NvU32 ChannelId, |
| 217 NvDdkUartHandle *phUart); |
| 218 |
| 219 /** |
| 220 * Deinitialize the UART controller and release the UART handle. This |
| 221 * frees the memory/OS resources which is allocated for the UART driver related |
| 222 * to this channel ID. After calling this API by client, client should not call |
| 223 * any other APIs related to this handle. |
| 224 * |
| 225 * @param hUart Handle to the UART which is allocated from Open(). |
| 226 */ |
| 227 void NvDdkUartClose(NvDdkUartHandle hUart); |
| 228 |
| 229 |
| 230 /** |
| 231 * Sets the different UART port configuration. It will set the |
| 232 * baud rate, parity bit, data length, stop bit, line interfacing type, Irda |
| 233 * modulation, flow control. It returns the related error if any of the |
| 234 * parameter is out of range or not supported. |
| 235 * |
| 236 * The baud rate should be less than the supported maximum baudrate. |
| 237 * The UART controller does not support all stop bits with all data lengths |
| 238 * (16550 compatible UART). The valid combinations are: |
| 239 * - 1 stop bit for data length 5, 6, 7, or 8 |
| 240 * - 1.5 stop bit for data length 5 |
| 241 * - 2 stop bit for data length 6, 7, or 8 |
| 242 * |
| 243 * @note It is recommended that client first call the |
| 244 * NvDdkUartGetConfiguration() to get the current setting and change only those |
| 245 * parameters that are required to change. Do not touch the other parameters and |
| 246 * then call this function. |
| 247 * |
| 248 * @param hUart Handle to the UART. |
| 249 * @param pUartDriverConfiguration A pointer to the structure where the settings
|
| 250 * are stored. |
| 251 * |
| 252 * @retval NvSuccess Indicates the operation succeeded. |
| 253 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 254 * @retval NvError_BadValue Indicates that illegal value specified for the |
| 255 * parameter. |
| 256 * The possible cases for this error are: |
| 257 * - The data length is illegal, e.g. it is not 5,6,7, or 8. |
| 258 * - The stop bit restriction is not matching with the data length. |
| 259 * - The baud rate is more than maximum supported baud rate. |
| 260 * @retval NvError_NotSupported There may be many case to return this error. |
| 261 * Possible cases are: |
| 262 * - Requested baudrate is not supported because of the it may be not |
| 263 * possible to set the correct timing related to this baud rate. |
| 264 * - The requested parity bit is not supported. |
| 265 */ |
| 266 NvError |
| 267 NvDdkUartSetConfiguration( |
| 268 NvDdkUartHandle hUart, |
| 269 const NvDdkUartConfiguarations* const pUartDriverConfiguration); |
| 270 |
| 271 /** |
| 272 * Gets the UART port configuration parameter which is configured. |
| 273 * Client can get the configuration parameter after calling this function. |
| 274 * |
| 275 * @note If client wants to set any port parameter, it is better to first call |
| 276 * this function for getting the default value and then change the desired |
| 277 * parameter with new value and call the NvDdkUartSetConfiguration(). |
| 278 * |
| 279 * @param hUart Handle to the UART. |
| 280 * @param pUartDriverConfiguration A pointer to the structure where the |
| 281 * information will be stored. |
| 282 * |
| 283 * @retval NvSuccess Indicates the operation succeeded. |
| 284 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 285 * @retval NvError_BadValue Indicates that illegal value specified for the |
| 286 * parameter. |
| 287 */ |
| 288 NvError |
| 289 NvDdkUartGetConfiguration( |
| 290 NvDdkUartHandle hUart, |
| 291 NvDdkUartConfiguarations* const pUartDriverConfiguration); |
| 292 |
| 293 /** |
| 294 * Start the read opeartion from the HW and store the receive data in |
| 295 * the local buffer created locally at the driver level with the buffer size. |
| 296 * This function will create the local buffer for the receive |
| 297 * data as requested by client. The receive data will be stored in this local |
| 298 * buffer if there is no read call from client side and data arrived. When |
| 299 * client makes the read call, it will first copied the data from the local buff
er |
| 300 * to the requested buffer and then it will wait for reading the remaining |
| 301 * data (if requested number of bytes was not available on the local buffer). |
| 302 * |
| 303 * It will also signal the semaphore \a hRxEventSema if the number of bytes |
| 304 * available in the local buffer changes from 0 to any value and if there is no |
| 305 * read call. Means if there is no read call and there is no data available on |
| 306 * the local buffer and when data arrives, the data will be copied into the |
| 307 * local buffer and it signals the semaphore. This will be use by the client |
| 308 * that data are available in the local buffer, and so client can made the read |
| 309 * call. |
| 310 * |
| 311 * It also notifies to the client by signalling the semaphore \a hRxEventSema |
| 312 * if there is any error or break condition received in the receive line. |
| 313 * |
| 314 * @param hUart Handle to the UART. |
| 315 * @param hRxEventSema The semaphore ID which is signalled if any data is |
| 316 * recevived or there is any error in the receive flow. |
| 317 * @param BufferSize Size of the local buffer where received data will be |
| 318 * buffered. |
| 319 * |
| 320 * @retval NvSuccess Indicates the operation succeeded. |
| 321 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 322 * @retval NvError_BadValue Indicates that illegal value specified for the local |
| 323 * \a BufferSize. |
| 324 * @retval NvError_InsufficientMemory Indicates that it is not able to create |
| 325 * the memory for requested size. |
| 326 */ |
| 327 |
| 328 NvError |
| 329 NvDdkUartStartReadOnBuffer( |
| 330 NvDdkUartHandle hUart, |
| 331 NvOsSemaphoreHandle hRxEventSema, |
| 332 NvU32 BufferSize); |
| 333 |
| 334 /** |
| 335 * Clears the receive buffer. All data will be cleared and the |
| 336 * counter which keeps the number of bytes available will be reset to 0. |
| 337 * |
| 338 * @param hUart Handle to the UART. |
| 339 * |
| 340 * @retval NvSuccess Indicates the operation succeeded. |
| 341 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 342 * @retval NvError_NotSupported Indicates that this feature is not supported. |
| 343 */ |
| 344 NvError NvDdkUartClearReceiveBuffer(NvDdkUartHandle hUart); |
| 345 |
| 346 /** |
| 347 * Update the local buffer if the data arrives in the UART. |
| 348 * This API reads the data from HW FIFO to the local buffer once the data has |
| 349 * arrived. This also returns the number of bytes available in the FIFO. |
| 350 * This API should be called once the client gets the notification from the DDK. |
| 351 * |
| 352 * @param hUart Handle to the UART. |
| 353 * @param pAvailableBytes Returns the number of bytes available in the local |
| 354 * buffer. |
| 355 * |
| 356 * @retval NvSuccess Indicates the operation succeeded. |
| 357 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 358 * @retval NvError_NotSupported Indicates that this feature is not supported. |
| 359 */ |
| 360 NvError |
| 361 NvDdkUartUpdateReceiveBuffer( |
| 362 NvDdkUartHandle hUart, |
| 363 NvU32 *pAvailableBytes); |
| 364 |
| 365 /** |
| 366 * Starts the data receiving with the buffer provided. This is blocking |
| 367 * type. |
| 368 * |
| 369 * First it copies the available data from the local buffer to the client |
| 370 * buffer, and if bytes are remaining to read then: |
| 371 * - It will wait for reading the remaining data (synchronous ops), or |
| 372 * - keep reading from the UART channel to the client buffer and signal |
| 373 * when there is no remaining data (async ops) or |
| 374 * - no more reading of the remaining data in the client buffer (read only |
| 375 * from local buffer). |
| 376 * |
| 377 * If non-zero timeout is selected then it will wait maximum for a given |
| 378 * timeout for reading the data from channel. It can also wait for forever |
| 379 * based on the argument passed. |
| 380 * If zero timeout is selected then it just copies from local buffer to the |
| 381 * client buffer with available number of bytes (if it is less than the |
| 382 * requested size) or requested number of bytes (if available data is more |
| 383 * than the requested size) and immediately return. |
| 384 * |
| 385 * @note If previous read is going on then this read call will return an error. |
| 386 * |
| 387 * @param hUart Handle to the UART. |
| 388 * @param pReceiveBuffer A pointer to the receive buffer where data |
| 389 * will be stored. |
| 390 * @param BytesRequested Number of bytes need to be read. |
| 391 * @param pBytesRead A pointer to the variable that stores the number of bytes |
| 392 * requested to read when it is called and stores the actual number of bytes |
| 393 * read when return from the function. |
| 394 * @param WaitTimeoutMs The time needed to wait in milliseconds. If |
| 395 * it is zero then it will be returned immediately with reading the |
| 396 * number of bytes available in local buffer. |
| 397 * If is non-zero, then it will wait for a requested timeout. If it is |
| 398 * ::NV_WAIT_INFINITE then it will wait for infinitely until the transaction |
| 399 * completes. |
| 400 * |
| 401 * @retval NvSuccess Indicates the operation succeeded. |
| 402 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 403 * @retval NvError_Timeout Indicates the operation is not completed in a given |
| 404 * timeout. |
| 405 * @retval NvError_UartOverrun Indicates that overrun error occur during |
| 406 * receiving of the data. |
| 407 * @retval NvError_UartFifo Indicates the operation is not completed because of |
| 408 * FIFO error. |
| 409 * @retval NvError_UartBreakReceived Indicates the break condition received. |
| 410 * @retval NvError_UartFraming Indicates the operation is not completed due to |
| 411 * framing error. |
| 412 * @retval NvError_UartParity Indicates the operation is not completed due to |
| 413 * parity error. |
| 414 * @retval NvError_InvalidState Indicates that the last read call is not |
| 415 * completed/stopped. |
| 416 */ |
| 417 NvError |
| 418 NvDdkUartRead( |
| 419 NvDdkUartHandle hUart, |
| 420 NvU8 *pReceiveBuffer, |
| 421 NvU32 BytesRequested, |
| 422 NvU32 *pBytesRead, |
| 423 NvU32 WaitTimeoutMs); |
| 424 |
| 425 /** |
| 426 * Stops the read operation. The NvDdkUartRead() will be aborted. |
| 427 * The DDK will keep reading the data from the external interface to the local |
| 428 * buffer and it will not be cleared. |
| 429 * |
| 430 * @param hUart Handle to the UART. |
| 431 * |
| 432 */ |
| 433 void NvDdkUartStopRead( NvDdkUartHandle hUart); |
| 434 |
| 435 |
| 436 /** |
| 437 * Starts the data transfer with the buffer provided. This is blocking |
| 438 * type call. If zero timeout is selected then it will return immediately |
| 439 * without transferring any data. |
| 440 * |
| 441 * @param hUart Handle to the UART. |
| 442 * @param pTransmitBuffer A pointer to the transmit buffer where transmitted |
| 443 * data are available. |
| 444 * @param BytesRequested Number of bytes to be sent. |
| 445 * @param pBytesWritten A pointer to the variable that stores the number of |
| 446 * bytes requested to transmit when it is called and stores the actual number of |
| 447 * bytes transmitted when returning from the function. |
| 448 * @param WaitTimeoutMs The time need to wait in milliseconds. If |
| 449 * it is zero then it will be returned immediately without sending any data. |
| 450 * |
| 451 * @retval NvSuccess Indicates the operation succeeded. |
| 452 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 453 * @retval NvError_Timeout Indicates the operation is not completed in a given |
| 454 * timeout. |
| 455 * @retval NvError_UartTransmit Indicates that a transmit error happened during |
| 456 * sending of the data. |
| 457 * @retval NvError_InvalidState Indicates that there is already write call made |
| 458 * that is not completed yet. |
| 459 */ |
| 460 NvError |
| 461 NvDdkUartWrite( |
| 462 NvDdkUartHandle hUart, |
| 463 NvU8 *pTransmitBuffer, |
| 464 NvU32 BytesRequested, |
| 465 NvU32 *pBytesWritten, |
| 466 NvU32 WaitTimeoutMs); |
| 467 |
| 468 /** |
| 469 * Stops the write operation. No more data will be transmitted from the |
| 470 * buffer, which was passed with the function NvDdkUartWrite(). |
| 471 * |
| 472 * @param hUart Handle to the UART provided after getting the channel. |
| 473 */ |
| 474 void NvDdkUartStopWrite( NvDdkUartHandle hUart); |
| 475 |
| 476 /** |
| 477 * Gets the current transfer status at the UART channel. This API |
| 478 * returns the number of bytes remaining to send on the channel, transmit status
, |
| 479 * number of bytes available in the rx buffer, and receive status. |
| 480 * This API returns the status at the calling time and after calling this API, |
| 481 * the data may be changed as data transfer may be still going on. |
| 482 * This is just polling type query about the data transfer status. |
| 483 * |
| 484 * @param hUart Handle to the UART provided after getting the channel. |
| 485 * @param pTxBytesToRemain A pointer to variable where number of bytes remaining |
| 486 * to transfer is stored. |
| 487 * @param pTxStatus A pointer to variable where tramsit status is stored. |
| 488 * @param pRxBytesAvailable A pointer to variable where number of bytes availabl
e |
| 489 * in rx buffer is returned. |
| 490 * @param pRxStatus A pointer to variable where receive status is returned. |
| 491 * |
| 492 */ |
| 493 void |
| 494 NvDdkUartGetTransferStatus( |
| 495 NvDdkUartHandle hUart, |
| 496 NvU32 *pTxBytesToRemain, |
| 497 NvError *pTxStatus, |
| 498 NvU32 *pRxBytesAvailable, |
| 499 NvError *pRxStatus); |
| 500 |
| 501 |
| 502 /** |
| 503 * Starts/stops sending the break signal from the channel. |
| 504 * The break siganl can be started by calling this function with \a IsStart = NV
_TRUE, |
| 505 * and it can be stopped by calling this API with \a isStart = NV_FALSE. |
| 506 * |
| 507 * @param hUart Handle to the UART. |
| 508 * @param IsStart NV_TRUE to start sending the break signal, or NV_FALSE to stop
. |
| 509 * |
| 510 * @retval NvSuccess Indicates the operation succeeded. |
| 511 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 512 * @retval NvError_NotSupported Indicates that this feature is not supported. |
| 513 */ |
| 514 NvError NvDdkUartSetBreakSignal(NvDdkUartHandle hUart, NvBool IsStart); |
| 515 |
| 516 /** |
| 517 * Sets the flow control signal to be disabled, enabled, or in handshake mode. |
| 518 * |
| 519 * @param hUart Handle to the UART. |
| 520 * @param SignalName Specifies the name of the signal to set. |
| 521 * @param FlowControl Specifies whether this is disabled, enable, or in handshak
e |
| 522 * mode. |
| 523 * |
| 524 * @retval NvSuccess Indicates the operation succeeded. |
| 525 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 526 * @retval NvError_NotSupported Indicates that requested functionality is not |
| 527 * supported for given signal. |
| 528 * @retval NvError_BadValue Indicates that illegal value specified for the |
| 529 * parameter. This may be because the signal name is not valid for this operatio
n. |
| 530 */ |
| 531 NvError |
| 532 NvDdkUartSetFlowControlSignal( |
| 533 NvDdkUartHandle hUart, |
| 534 NvDdkUartSignalName SignalName, |
| 535 NvDdkUartFlowControl FlowControl); |
| 536 |
| 537 /** |
| 538 * Gets the flow control signal level. This will tell the actual level of |
| 539 * the signal on the UART pins. |
| 540 * This API can be called by more than one signal name by ORing them. |
| 541 * The state of the signal (high or low) can be determined by the position of th
e |
| 542 * bit state. |
| 543 * |
| 544 * @param hUart Handle to the UART. |
| 545 * @param SignalName Specifies the name of the signal whose status need to be |
| 546 * queried. Can be more than one signal name by ORing them. |
| 547 * @param pSignalState The state of the signal. The 1 in corresponding location |
| 548 * shows that state is high, otherwise it shows as low. |
| 549 * |
| 550 * @retval NvSuccess Indicates the operation succeeded. |
| 551 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 552 * @retval NvError_NotSupported Indicates that requested functionality is not |
| 553 * supported for given signal. |
| 554 * @retval NvError_BadValue Indicates an illegal value was specified for the |
| 555 * parameter. This may be because the signal name is not valid for this operatio
n. |
| 556 */ |
| 557 NvError |
| 558 NvDdkUartGetFlowControlSignalLevel( |
| 559 NvDdkUartHandle hUart, |
| 560 NvDdkUartSignalName SignalName, |
| 561 NvU32 *pSignalState); |
| 562 |
| 563 typedef void (*NvDdkUartSignalChangeCallback)(void *args); |
| 564 |
| 565 /** |
| 566 * Registers a callback funciton for the modem signal state change. |
| 567 * Whenever the modem signal change, this API is called. |
| 568 * Callback typically will call NvDdkUartGetFlowControlSignalLevel() for |
| 569 * finding the signal status. |
| 570 * |
| 571 * Clients can pass NULL callback function for unregistering the signal |
| 572 * change. |
| 573 * |
| 574 * The callback function is called from the ISR/IST. |
| 575 * |
| 576 * @param hUart Handle to the UART. |
| 577 * @param SignalName Specifies the name of the signal to observe. |
| 578 * @param Callback Callback function which is called from ISR/IST of DDK wheneve
r |
| 579 * signal change is detected by the DDK. |
| 580 * @param args Argument to the signal change handler. |
| 581 * |
| 582 * @retval NvSuccess Indicates the operation succeeded. |
| 583 * @retval NvError_NotInitialized Indicates that the UART channel is not opened. |
| 584 * @retval NvError_NotSupported Indicates that requested functionality is not |
| 585 * supported. |
| 586 * @retval NvError_BadValue Indicates that an illegal value was specified for th
e |
| 587 * parameter. |
| 588 */ |
| 589 NvError |
| 590 NvDdkUartRegisterModemSignalChange( |
| 591 NvDdkUartHandle hUart, |
| 592 NvDdkUartSignalName SignalName, |
| 593 NvDdkUartSignalChangeCallback Callback, |
| 594 void *args); |
| 595 |
| 596 /** |
| 597 * Power mode suspend the UART controller. |
| 598 * |
| 599 * @param hUart Handle to the UART. |
| 600 * |
| 601 * @retval NvSuccess Indicates the operation succeeded. |
| 602 * @retval NvError_NotSupported Indicates that requested functionality is not |
| 603 * supported. |
| 604 */ |
| 605 NvError NvDdkUartSuspend(NvDdkUartHandle hUart); |
| 606 |
| 607 /** |
| 608 * Power mode resume the UART controller. This will resume the controller |
| 609 * from the suspend states. |
| 610 * |
| 611 * @param hUart Handle to the UART. |
| 612 * |
| 613 * @retval NvSuccess Indicates the operation succeeded. |
| 614 * @retval NvError_NotSupported Indicates that requested functionality is not |
| 615 * supported. |
| 616 */ |
| 617 NvError NvDdkUartResume(NvDdkUartHandle hUart); |
| 618 |
| 619 |
| 620 /** @} */ |
| 621 |
| 622 |
| 623 #if defined(__cplusplus) |
| 624 } |
| 625 #endif |
| 626 |
| 627 #endif // INCLUDED_NVDDK_UART_H |
OLD | NEW |