csl_uartAux.h
Go to the documentation of this file.
00001 /*  ============================================================================
00002  *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 2008
00003  *
00004  *   Use of this software is controlled by the terms and conditions found in the
00005  *   license agreement under which this software has been supplied.
00006  *  ============================================================================
00007  */
00008 
00019 /* ============================================================================
00020  * Revision History
00021  * ================
00022  * 17-Sep-2008 Created
00023  * ============================================================================
00024  */
00025 
00026  #ifndef _CSL_UARTAUX_H_
00027 #define _CSL_UARTAUX_H_
00028 
00029 #include <csl_uart.h>
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00078 static inline
00079  Bool UART_getDataReadyStatus(CSL_UartHandle hUart)
00080 {
00081     Uint16 DatRdy = 0;
00082 
00083     DatRdy = CSL_FEXT(hUart->uartRegs->LSR,UART_LSR_DR);
00084     if( DatRdy )
00085         return TRUE;
00086     return FALSE;
00087 }
00088 
00089 
00131 static inline
00132 Bool UART_getXmitHoldRegEmptyStatus(CSL_UartHandle hUart)
00133 {
00134     Uint16 XmitRdy = 0;
00135 
00136     XmitRdy = CSL_FEXT(hUart->uartRegs->LSR,UART_LSR_THRE);
00137 
00138     if( XmitRdy )
00139         return TRUE;
00140     return FALSE;
00141 }
00142 
00184 static inline
00185 CSL_Status UART_getRecvorResetStatus(CSL_UartHandle hUart)
00186 {
00187     Uint16 UrRst = 0;
00188 
00189     UrRst = CSL_FEXT(hUart->uartRegs->PWREMU_MGMT,UART_PWREMU_MGMT_URRST);
00190     if( UrRst )
00191         return FALSE;
00192     return TRUE;
00193 
00194 }
00236 static inline
00237 CSL_Status UART_getXmitorResetState(CSL_UartHandle hUart)
00238 {
00239     Uint16 UtRst = 0;
00240 
00241     UtRst = CSL_FEXT(hUart->uartRegs->PWREMU_MGMT,UART_PWREMU_MGMT_UTRST);
00242     if( UtRst )
00243         return FALSE;
00244     return TRUE;
00245 
00246 }
00295 static inline
00296 CSL_UartXferMode UART_getModeOfTransfer(CSL_UartHandle hUart)
00297 {
00298     Uint16 UtRst = 0;
00299 
00300     UtRst = CSL_FEXT(hUart->uartRegs->FCR,UART_IIR_FIFOEN);
00301 
00302     if( 0 == UtRst )
00303     {
00304         return CSL_UART_NON_FIFO_MODE;
00305     }
00306     if (3 == UtRst)
00307     {
00308         return CSL_UART_FIFO_MODE;
00309     }
00310     return CSL_UART_MODE_UNDEFINED;
00311 
00312 }
00354 static inline
00355 CSL_Status UART_setToIntMode(CSL_UartHandle hUart)
00356 {
00357     CSL_Status status = CSL_SOK;
00358     if( NULL == hUart )
00359     {
00360         return CSL_ESYS_BADHANDLE;
00361     }
00362     hUart->opmode = UART_INTERRUPT;
00363     return status;
00364 }static inline
00404 CSL_Status UART_setToPollMode(CSL_UartHandle hUart)
00405 {
00406     CSL_Status status = CSL_SOK;
00407     hUart->opmode = UART_POLLED;
00408     return status;
00409 }
00410 
00458 static inline
00459 CSL_Status UART_enableFreeRun(CSL_UartHandle hUart)
00460 {
00461     CSL_Status status = CSL_SOK;
00462     CSL_FINST(hUart->uartRegs->PWREMU_MGMT, UART_PWREMU_MGMT_FREE,RUN);
00463     return status;
00464 }
00465 
00518 static inline
00519 CSL_Status UART_disableFreeRun(CSL_UartHandle hUart)
00520 {
00521     CSL_Status status = CSL_SOK;
00522     CSL_FINST(hUart->uartRegs->PWREMU_MGMT,UART_PWREMU_MGMT_FREE,STOP);
00523     return status;
00524 }
00525 
00528 #ifdef __cplusplus
00529  }
00530 #endif
00531 #endif// _CSL_UARTAUX_H_