- Main Page
- Modules
- Data Structures
- Files

Functions
UART Functions
UART

## Functions
CSL_Status | UART_init (CSL_UartObj *uartObj, Uint32 uartInstId, CSL_UartOpmode opmode)
CSL_Status | UART_setup (CSL_UartHandle hUart, CSL_UartSetup *uartSetup)
CSL_Status | UART_config (CSL_UartHandle hUart, CSL_UartConfig *uartConfig)
CSL_Status | UART_setupBaudRate (CSL_UartHandle hUart, Uint32 clkInput, Uint32 baudRate)
CSL_Status | UART_reset (CSL_UartHandle hUart)
CSL_Status | UART_resetOff (CSL_UartHandle hUart)
CSL_Status | UART_eventEnable (CSL_UartHandle hUart, CSL_UartEventType uartEvent)
CSL_Status | UART_eventDisable (CSL_UartHandle hUart, CSL_UartEventType uartEvent)
CSL_Status | UART_read (CSL_UartHandle hUart, Char *pBuf, Uint16 count, Uint32 timeout)
CSL_Status | UART_write (CSL_UartHandle hUart, Char *pBuf, Uint16 count, Uint32 timeout)
CSL_Status | UART_fgetc (CSL_UartHandle hUart, Char *elem, Uint32 timeout)
CSL_Status | UART_fputc (CSL_UartHandle hUart, const Char elem, Uint32 timeout)
CSL_Status | UART_fgets (CSL_UartHandle hUart, Char *pBuf, Uint16 bufSize, Uint32 timeout)
CSL_Status | UART_fputs (CSL_UartHandle hUart, const Char *pBuf, Uint32 timeout)
Int16 | UART_getEventId (CSL_UartHandle hUart)
CSL_Status | UART_getConfig (CSL_UartHandle hUart, CSL_UartConfig *config)
CSL_Status | UART_setCallback (CSL_UartHandle hUart, CSL_UartIsrAddr *isrAddr)
static Bool | UART_getDataReadyStatus (CSL_UartHandle hUart)
static Bool | UART_getXmitHoldRegEmptyStatus (CSL_UartHandle hUart)
static CSL_Status | UART_getRecvorResetStatus (CSL_UartHandle hUart)
static CSL_Status | UART_getXmitorResetState (CSL_UartHandle hUart)
static CSL_UartXferMode | UART_getModeOfTransfer (CSL_UartHandle hUart)
static CSL_Status | UART_setToIntMode (CSL_UartHandle hUart)
static CSL_Status | UART_setToPollMode (CSL_UartHandle hUart)
static CSL_Status | UART_enableFreeRun (CSL_UartHandle hUart)
static CSL_Status | UART_disableFreeRun (CSL_UartHandle hUart)

## Function Documentation

CSL_Status UART_config | ( | CSL_UartHandle | hUart,
|  | CSL_UartConfig * | uartConfig
| ) |  |

============================================================================
UART_config

Description
This is a low level API than UART_setup API. It's used to configure registers directly.

Arguments

     		hUart  Handle to the UART.
    		pConfig     Pointer to the CSL_UartConfig structure.

Return Value CSL_Status

- CSL_SOK - UART_config call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid pointer to UART Config strucutre. Pre Condition
  UART_init should be called successfully. Post Condition
  Confgiure the registers.

Modifies
Handle is modified

Example

    		CSL_Status              status;
     	    CSL_UartObj                uartObj;
            Uint32                      uartInstId;
            CSL_UartConfig 		 Config;

            Config.DLL  =
            Config.DLH =
            Config.LCR  =
            Config.FCR =
            Config.MCR =
            uartInstId = 0;

            status = UART_init(&uartObj,uartInstId);
            status =  UART_config(CSL_UartHandle hUart,&Config);

============================================================================

============================================================================
UART_config

Description
This is a low level API which is used to confgiure registers DLL,DLH,FCR,MCR,LCR. Arguments

     		hUart  Handle to the UART.
    		pConfig     Pointer to the CSL_UartConfig structure.

Return Value CSL_Status

- CSL_SOK - UART_config call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid pointer to UART Config strucutre. Pre Condition
  UART_init should be called successfully. Post Condition
  Registers are configured.

Modifies
Handle is modified

Example

    		CSL_Status              status;
     	    CSL_UartObj                uartObj;
            CSL_UartHandle             hUart;
            Uint32                  uartInstId;
            CSL_UartConfig 		    Config;
            CSL_UartSetup              uartSetup;
            uartInstId  = 0;

            Config.FCR = CSL_UART_FIFO_DMA1_DISABLE_TRIG01;
            Config.DLL = 0x001b;
            Config.DLH = 0x0006;
            Config.LCR = 0x0003
            Config.MCR = 0x0000;

            status = UART_init(&uartObj,uartInstId);
            hUart = (CSL_UartHandle)&uartObj);
            status = UART_reset(hUart);
            status = UART_config(hUart,&Config);
            status = UART_resetOff(hUart);

============================================================================

References CSL_UartConfig::DLH, CSL_UartConfig::DLL, CSL_UartConfig::FCR, CSL_UartConfig::LCR, CSL_UartConfig::MCR, CSL_UartObj::trigLevel, and CSL_UartObj::uartRegs.

static CSL_Status UART_disableFreeRun | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_disableFreeRun

Description
This API is used to stop free running mode.

Arguments

                hUart        Handle to the uart

Return Value CSL_Status

- CSL_ESYS_BADHANDLE - Invalid handle.

- CSL_SOK - Stop Free running mode.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             CSL_UartSetup                 uartSetup;
             uartInstId = 0;

             uartSetup.afeEnable = CSL_UART_NO_AFE;
             uartSetup.baud = 2400;
             uartSetup.clkInput = 60000000;
             uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
             uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
             uartSetup.parity =  CSL_UART_DISABLE_PARITY;
             uartSetup.rtsEnable = CSL_UART_NO_RTS;
             uartSetup.stopBits = 0;
             uartSetup.wordLength = CSL_UART_WORD8;

             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             status = UART_setup(hUart,&setup);
             status = UUART_disableFreeRun(hUart);

============================================================================

References CSL_UartObj::uartRegs.

static CSL_Status UART_enableFreeRun | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_enableFreeRun

Description
This API is used to start free running mode.

Arguments

                hUart        Handle to the uart

Return Value CSL_Status

- CSL_ESYS_BADHANDLE - Invalid handle.

- CSL_SOK - Free running mode is enabled.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             CSL_UartConfig                config;
             uartInstId = 0;
             config.FCR = CSL_UART_FIFO_DMA1_DISABLE_TRIG01;
             config.DLL = 0x001b;
             config.DLH = 0x0006;
             config.LCR = 0x0003
             config.MCR = 0x0000;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             status = UART_config(hUart,&config);
             status = UART_resetOff(hUart);
             status = UUART_enableFreeRun(hUart);

============================================================================

References CSL_UartObj::uartRegs.

CSL_Status UART_eventDisable | ( | CSL_UartHandle | hUart,
|  | CSL_UartEventType | uartEvent
| ) |  |

============================================================================
UART_eventDisable

Description
This API is used to enable events like Receiver data availabe, Transmitter holding register empty

Arguments

    		hUart  Handle to the UART.
    	    isrMask Particular events can be disabled by setting correspoding
           	bits in the variable

Return Value CSL_Status

- CSL_SOK - UART_eventDisable call is successful
- CSL_ESYS_BADHANDLE - Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  The correspoding events are disabled.

Modifies
Handle is modified

Example

     	     CSL_Status              status;
     	     CSL_UartObj                uartObj;
             Uint32                  uartInstId;
             CSL_UartSetup 		     uartSetup;
             Uint16 isrMask = 0x01;
             uartInstId = 0;

             uartSetup.afeEnable = CSL_UART_NO_AFE;
             uartSetup.baud = 2400;
             uartSetup.clkInput = 60000000;
             uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
             uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
             uartSetup.parity =  CSL_UART_DISABLE_PARITY;
             uartSetup.rtsEnable = CSL_UART_NO_RTS;
             uartSetup.stopBits = 0;
             uartSetup.wordLength = CSL_UART_WORD8;

             status = UART_init(&uartObj,uartInstId);
             status = UART_eventDisable(&uartObj,CSL_RTC_RECVOR_REG_DATA_INTERRUPT);
             status = CSL_UartSetup( hUart,&uartSetup);
             status = UART_eventEnable(hUart,CSL_RTC_XMITOR_REG_EMPTYINTERRUPT);

============================================================================

============================================================================
UART_eventDisable

Description
This API is used to enable events like Receiver data availabe, Transmitter holding register empty

Arguments

    		hUart  Handle to the UART.
    	    isrMask Particular events can be disabled by setting correspoding
           	bits in the variable

Return Value CSL_Status

- CSL_SOK - UART_eventDisable call is successful
- CSL_ESYS_BADHANDLE - Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  The correspoding events are disabled.

Modifies
Handle is modified

Example

     	     CSL_Status              status;
     	     CSL_UartObj                uartObj;
             Uint32                  uartInstId;
             CSL_UartSetup 		     uartSetup;
             Uint16 isrMask = 0x01;
             uartInstId = 0;

             uartSetup.afeEnable = CSL_UART_NO_AFE;
             uartSetup.baud = 2400;
             uartSetup.clkInput = 60000000;
             uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
             uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
             uartSetup.parity =  CSL_UART_DISABLE_PARITY;
             uartSetup.rtsEnable = CSL_UART_NO_RTS;
             uartSetup.stopBits = 0;
             uartSetup.wordLength = CSL_UART_WORD8;

             status = UART_init(&uartObj,uartInstId);
             status = UART_eventDisable(&uartObj,CSL_UART_RECVOR_REG_DATA_INTERRUPT);
             status = UART_setup( hUart,&uartSetup);
             status = UART_eventEnable(hUart,CSL_UART_XMITOR_REG_EMPTYINTERRUPT);

============================================================================

References CSL_UART_RECVOR_LINE_STATUS_INTERRUPT, CSL_UART_RECVOR_REG_DATA_INTERRUPT, CSL_UART_XMITOR_REG_EMPTY_INTERRUPT, and CSL_UartObj::uartRegs.

CSL_Status UART_eventEnable | ( | CSL_UartHandle | hUart,
|  | CSL_UartEventType | uartEvent
| ) |  |

============================================================================
UART_eventEnable

Description
This API is used to enable events like Receiver data availabe, Transmitter holding register empty

Arguments

     		hUart  Handle to the UART.
    	 	isrMask Interested particular events can be enabled by setting the
            correspoding bits in the variable

Return Value CSL_Status

- CSL_SOK - UART_eventEnable call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  The corresponding events are enabled.

Modifies
Handle is modified

Example

     	    CSL_Status              status;
     	    CSL_UartObj                uartObj;
           	CSL_UartSetup 		        uartSetup;
         	Uint16 isrMask = 0x01;
         	Uint32 uartInstId = 0x0;
            uartSetup.afeEnable = CSL_UART_NO_AFE;
            uartSetup.baud = 2400;
            uartSetup.clkInput = 60000000;
            uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
            uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
            uartSetup.parity =  CSL_UART_DISABLE_PARITY;
            uartSetup.rtsEnable = CSL_UART_NO_RTS;
            uartSetup.stopBits = 0;
            uartSetup.wordLength = CSL_UART_WORD8;
        	status = UART_init(&uartObj,uartInstId);
            status = UART_Setup( &uartObj,&uartSetup);
            status = UART_eventEnable(&uartObj,CSL_RTC_RECVOR_REG_DATA_INTERRUPT)

============================================================================

============================================================================
UART_eventEnable

Description
This API is used to enable events like Receiver data availabe, Transmitter holding register empty

Arguments

     		hUart  Handle to the UART.
    	 	isrMask Interested particular events can be enabled by setting the
            correspoding bits in the variable

Return Value CSL_Status

- CSL_SOK - UART_eventEnable call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  The corresponding events are enabled.

Modifies
Handle is modified

Example

     	    CSL_Status              status;
     	    CSL_UartObj                uartObj;
           	CSL_UartSetup 		        uartSetup;
         	Uint16 isrMask = 0x01;
         	Uint32 uartInstId = 0x0;
            uartSetup.afeEnable = CSL_UART_NO_AFE;
            uartSetup.baud = 2400;
            uartSetup.clkInput = 60000000;
            uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
            uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
            uartSetup.parity =  CSL_UART_DISABLE_PARITY;
            uartSetup.rtsEnable = CSL_UART_NO_RTS;
            uartSetup.stopBits = 0;
            uartSetup.wordLength = CSL_UART_WORD8;
        	status = UART_init(&uartObj,uartInstId);
            status = UART_setup( &uartObj,&uartSetup);
            status = UART_eventEnable(&uartObj,CSL_UART_RECVOR_REG_DATA_INTERRUPT)

============================================================================

References CSL_UART_RECVOR_LINE_STATUS_INTERRUPT, CSL_UART_RECVOR_REG_DATA_INTERRUPT, CSL_UART_XMITOR_REG_EMPTY_INTERRUPT, and CSL_UartObj::uartRegs.

CSL_Status UART_fgetc | ( | CSL_UartHandle | hUart,
|  | Char * | elem,
|  | Uint32 | timeout
| ) |  |

============================================================================
UART_fgetc

Description
UART_fgetc reads a single character from the RBR into elem.

Arguments

     		hUart  Handle to the UART.
            elem   A size one buffer.
            timeout Timeout value
                    0 - wait indefinitely for DR bit to get set.
                    x - wait x value for DR bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fgetc call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid address of input buffer
- CSL_EUART_TIMEOUT - had a timeout due to DR bit not set. Pre Condition
  UART_init and CSL_UartSetup should be called successfully. Post Condition
  elem contains a single character.

Modifies
Handle is modified
elem is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
             	Uint32                      uartInstId;
                CSL_UartSetup 		 uartSetup;
                CSL_UartHandle hUart;
                Char  buf[1];
                uartInstId = 0;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status =  CSL_UartSetup( hUart,&uartSetup);
                status = UART_fgetc(hUart,buf,200)

============================================================================

============================================================================
UART_fgetc

Description
UART_fgetc reads a single character from the RBR into elem.

Arguments

     		hUart  Handle to the UART.
            elem   A size one buffer.
            timeout Timeout value
                    0 - wait indefinitely for DR bit to get set.
                    x - wait x value for DR bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fgetc call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid address of input buffer
- CSL_EUART_TIMEOUT - had a timeout due to DR bit not set. Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  elem will have a single character.

Modifies
Handle is modified
elem is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
             	Uint32                      uartInstId;
                CSL_UartSetup 		 uartSetup;
                CSL_UartHandle hUart;
                Char  buf[1];
                uartInstId = 0;

                uartSetup.afeEnable = CSL_UART_NO_AFE;
                uartSetup.baud = 2400;
                uartSetup.clkInput = 60000000;
                uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
                uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
                uartSetup.parity =  CSL_UART_DISABLE_PARITY;
                uartSetup.rtsEnable = CSL_UART_NO_RTS;
                uartSetup.stopBits = 0;
                uartSetup.wordLength = CSL_UART_WORD8;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status =  UART_setup( hUart,&uartSetup);
                status = UART_fgetc(hUart,buf,200)

============================================================================

References CSL_EUART_TIMEOUT, UART_getDataReadyStatus(), and CSL_UartObj::uartRegs.

CSL_Status UART_fgets | ( | CSL_UartHandle | hUart,
|  | Char * | pBuf,
|  | Uint16 | bufSize,
|  | Uint32 | timeout
| ) |  |

============================================================================
UART_fgets

Description
UART_fgets reads in at most one less than bufSize characters from RBR and stores them into the buffer pointed to by pBuf.Reading stops after a newline. If a newline is read, it is stored into the buffer. A "\0" is stored after the last character in the buffer. Arguments

    	        hUart  Handle to the UART.
           	 	pBuf   Output buffer
    	        bufSize  Size of output buffer
                timeout Timeout value
                        0 - wait indefinitely for DR bit to get set.
                        x - wait x value for DR bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fgets call is successful
- CSL_ESYS_BADHANDLE - Invalid handle.
- CSL_ESYS_INVPARAMS- Invalid output buffer
- CSL_EUART_INVALID_LENGTH- Invalid string length.
- CSL_EUART_TIMEOUT - had a timeout due to DR bit not set. Pre Condition
  UART_init and CSL_UartSetup should be called successfully. Post Condition
  Input buffer will contain a string.

Modifies
Handle is modified
pBuf is modified Example

     	        CSL_Status              status;
     	        CSL_UartObj                uartObj;
                Uint32                      uartInstId;
                CSL_UartSetup 		 uartSetup;
                CSL_UartHandle hUart;
                Char  buf[12];
                Uint16 N = 12;
                uartInstId = 0;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status =  CSL_UartSetup( hUart,&uartSetup);
                status = UART_fgets(hUart,buf,N,100) ;

============================================================================

============================================================================
UART_fgets

Description
UART_fgets reads in at most one less than bufSize characters from RBR and stores them into the buffer pointed to by pBuf.Reading stops after a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer. Arguments

    	        hUart  Handle to the UART.
           	 	pBuf   Output buffer
    	        bufSize  Size of output buffer
                timeout Timeout value
                        0 - wait indefinitely for DR bit to get set.
                        x - wait x value for DR bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fgets call is successful
- CSL_ESYS_BADHANDLE - Invalid handle.
- CSL_ESYS_INVPARAMS- Invalid output buffer
- CSL_EUART_INVALID_LENGTH- Invalid string length.
- CSL_EUART_TIMEOUT - had a timeout due to DR bit not set. Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  Input buffer will have a string.

Modifies
Handle is modified
pBuf is modified Example

     	        CSL_Status              status;
     	        CSL_UartObj                uartObj;
                Uint32                  uartInstId;
                CSL_UartSetup 		        uartSetup;
                CSL_UartHandle hUart;
                Char  buf[12];
                Uint16 N = 12;
                uartInstId = 0;

                uartSetup.afeEnable = CSL_UART_NO_AFE;
                uartSetup.baud = 2400;
                uartSetup.clkInput = 60000000;
                uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
                uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
                uartSetup.parity =  CSL_UART_DISABLE_PARITY;
                uartSetup.rtsEnable = CSL_UART_NO_RTS;
                uartSetup.stopBits = 0;
                uartSetup.wordLength = CSL_UART_WORD8;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status =  CSL_UartSetup( hUart,&uartSetup);
                status = UART_fgets(hUart,buf,N,100) ;

============================================================================

References CSL_EUART_INVALID_BUFSIZE, CSL_EUART_TIMEOUT, UART_getDataReadyStatus(), and CSL_UartObj::uartRegs.

CSL_Status UART_fputc | ( | CSL_UartHandle | hUart,
|  | const Char | elem,
|  | Uint32 | timeout
| ) |  |

============================================================================
UART_fputc

Description
UART_fputc writes a single character to THR(Transmitter Holding Register).

Arguments

    		hUart  Handle to the UART.
    	    elem   Character to transmit
            timeout Timeout value
                    0 - wait indefinitely for THRE bit to get set.
                    x - wait x value for THRE bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fputc call is successful
- CSL_ESYS_BADHANDLE - Handle is invalid
- CSL_EUART_TIMEOUT - had a timeout due to THRE bit not set. Pre Condition
  UART_init and CSL_UartSetup should be called successfully. Post Condition
  A character got transmitted.

Modifies
Handle is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                Uint32                  uartInstId;
                CSL_UartSetup 		        uartSetup;
                CSL_UartHandle hUart;
                Char  buf[1];
                uartInstId = 0;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status = CSL_UartSetup( hUart,&uartSetup);
                status = UART_fputc(hUart,buf[0],200)

============================================================================

============================================================================
UART_fputc

Description
UART_fputc writes a single character to THR(Transmitter Holding Register).

Arguments

    		hUart  Handle to the UART.
    	    elem   Character to transmit
            timeout Timeout value
                    0 - wait indefinitely for THRE bit to get set.
                    x - wait x value for THRE bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fputc call is successful
- CSL_ESYS_BADHANDLE - Handle is invalid
- CSL_EUART_TIMEOUT - had a timeout due to THRE bit not set. Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  A character will get transmitted.

Modifies
Handle is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                Uint32                  uartInstId;
                CSL_UartSetup 		        uartSetup;
                CSL_UartHandle hUart;
                Char  buf[1];
                uartInstId = 0;

                uartSetup.afeEnable = CSL_UART_NO_AFE;
                uartSetup.baud = 2400;
                uartSetup.clkInput = 60000000;
                uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
                uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
                uartSetup.parity =  CSL_UART_DISABLE_PARITY;
                uartSetup.rtsEnable = CSL_UART_NO_RTS;
                uartSetup.stopBits = 0;
                uartSetup.wordLength = CSL_UART_WORD8;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status = UART_setup( hUart,&uartSetup);
                status = UART_fputc(hUart,buf[0],200)

============================================================================

References CSL_EUART_TIMEOUT, UART_getXmitHoldRegEmptyStatus(), and CSL_UartObj::uartRegs.

CSL_Status UART_fputs | ( | CSL_UartHandle | hUart,
|  | const Char * | pBuf,
|  | Uint32 | timeout
| ) |  |

============================================================================
UART_fputs

Description
UART_fputs writes the string pointed by pBuf to THR, without its trailing "\0".

Arguments

            hUart  Handle to the UART.
            pBuf   Input buffer
            timeout Timeout value
                    0 - wait indefinitely for THRE bit to get set.
                    x - wait x value for THRE bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fputs call is successful
- CSL_ESYS_BADHANDLE - UART_fputs call is successful
- CSL_ESYS_INVPARAMS - Invalid input buffer
- CSL_EUART_TIMEOUT - had a timeout due to THRE bit not set. Pre Condition
  UART_init and CSL_UartSetup should be called successfully. Post Condition
  A string will get transmitted.

Modifies
Handle is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                Uint32                  uartInstId;
                CSL_UartSetup 		        uartSetup;
                CSL_UartHandle hUart;
                Char  buf[12] ="Test";
                uartInstId = 0;
                status =  UART_init(&uartObj,uartInstId);
                hUart  = (CSL_UartHandle)&uartObj;
                status =  UART_Setup( hUart,&uartSetup);
                status =  UART_fputs(hUart,buf);

============================================================================

============================================================================
UART_fputs

Description
UART_fputs writes the string pointed by pBuf to THR, without its trailing '\0'.

Arguments

            hUart  Handle to the UART.
            pBuf   Input buffer
            timeout Timeout value
                    0 - wait indefinitely for THRE bit to get set.
                    x - wait x value for THRE bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_fputs call is successful
- CSL_ESYS_BADHANDLE - UART_fputs call is successful
- CSL_ESYS_INVPARAMS - Invalid input buffer
- CSL_EUART_TIMEOUT - had a timeout due to THRE bit not set. Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  A string will get transmitted.

Modifies
Handle is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                Uint32                  uartInstId;
                CSL_UartSetup 		        uartSetup;
                CSL_UartHandle             hUart;
                Char  buf[12] ="Test";
                uartInstId = 0;

                uartSetup.afeEnable = CSL_UART_NO_AFE;
                uartSetup.baud = 2400;
                uartSetup.clkInput = 60000000;
                uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
                uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
                uartSetup.parity =  CSL_UART_DISABLE_PARITY;
                uartSetup.rtsEnable = CSL_UART_NO_RTS;
                uartSetup.stopBits = 0;
                uartSetup.wordLength = CSL_UART_WORD8;

                status =  UART_init(&uartObj,uartInstId);
                hUart  = (CSL_UartHandle)&uartObj;
                status =  UART_setup( hUart,&uartSetup);
                status =  UART_fputs(hUart,buf);

============================================================================

References CSL_EUART_TIMEOUT, UART_getXmitHoldRegEmptyStatus(), and CSL_UartObj::uartRegs.

CSL_Status UART_getConfig | ( | CSL_UartHandle | hUart,
|  | CSL_UartConfig * | config
| ) |  |

============================================================================
UART_getEventId

Description
UART_getEventId returns the event id in the Handle.

Arguments

             None

Return Value Uint16

- IRQ_EVT_UART -UART_getEventId call is successful. Pre Condition
  UART_init should be called successfully. Post Condition
  None

Modifies
None Example

                 CSL_Status              status;
                 CSL_UartObj                uartObj;
                 Uint32                      uartInstId;
                 Uint16                      uartEvtId;
                 uartInstId = 0;
                 status =  UART_init(&uartObj,uartInstId);
                 uartEvtId =  UART_getEventId();

============================================================================

============================================================================
UART_getConfig

Description
UART_getEventId returns the event id in the Handle.

Arguments

            None

Return Value Uint16

- IRQ_EVT_UART -UART_getEventId call is successful. Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  None

Modifies
None Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                Uint32                  uartInstId;
                Uint16                  uartEvtId;
                CSL_UartSetup              uartSetup;
                CSL_UartConfig             getconfig;
                uartInstId = 0;

                uartSetup.afeEnable = CSL_UART_NO_AFE;
                uartSetup.baud = 2400;
                uartSetup.clkInput = 60000000;
                uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
                uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
                uartSetup.parity =  CSL_UART_DISABLE_PARITY;
                uartSetup.rtsEnable = CSL_UART_NO_RTS;
                uartSetup.stopBits = 0;
                uartSetup.wordLength = CSL_UART_WORD8;

                status =  UART_init(&uartObj,uartInstId);
                status =  UART_Setup(hUart,&uartSetup);
                status =  UART_getConfig(hUart,&getconfig);

============================================================================

References CSL_UartConfig::DLH, CSL_UartConfig::DLL, CSL_UartConfig::FCR, CSL_UartConfig::LCR, CSL_UartConfig::MCR, and CSL_UartObj::uartRegs.

static Bool UART_getDataReadyStatus | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_getDataReadyStatus

Description
This API is used to get the status of DR bit in LSR reg

Arguments

                hUart        Handle to the uart

Return Value Bool

- TRUE - DR bit is set

- FALSE - DR bit is not set.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             Bool                    	bStatus;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             uartInstId = 0;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             bStatus = UART_getDataReadyStatus(hUart);

============================================================================

References CSL_UartObj::uartRegs.

Referenced by UART_fgetc(), UART_fgets(), and UART_read().

Int16 UART_getEventId | ( | CSL_UartHandle | hUart | ) |

============================================================================
UART_getEventId

Description
UART_getEventId returns the event id.

Arguments

            None

Return Value Int16

- Returns Eventid - call is successful.
- Returns CSL_ESYS_BADHANDLE - Handle is NULL. Pre Condition
  UART_init should be called successfully. Post Condition
  None

Modifies
None Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                CSL_UartHandle             hUart;
                Uint16                  uartEvtId;
                Uint32 uartInstId = 0;
                status =  UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)(&uartObj);
                uartEvtId =  UART_getEventId(hUart);

============================================================================

============================================================================
UART_getEventId

Description
UART_getEventId returns the event id in the Handle.

Arguments

            None

Return Value Uint16

- IRQ_EVT_UART -UART_getEventId call is successful. Pre Condition
  UART_init should be called successfully. Post Condition
  None

Modifies
None Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                CSL_UartHandle             hUart;
                Uint16                  uartEvtId;
                Uint32 uartInstId = 0;
                status =  UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)(&uartObj);
                uartEvtId =  UART_getEventId(hUart);

============================================================================

References CSL_UartObj::uartRegs.

static CSL_UartXferMode UART_getModeOfTransfer | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_getModeOfTransfer

Description
This API is used to get Xfer mode of UART in ,Fifo mode or non fifo mode.

Arguments

                hUart        Handle to the uart

Return Value CSL_UartXferMode

- CSL_UART_FIFO_MODE - UART in fifo mode.

- CSL_UART_NON_FIFO_MODE - UART in non fifo mode.

- CSL_UART_MODE_UNDEFINED - UART Xfer mode is undefined.

Pre Condition
UART_init and UART_setup should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             CSL_UartXferMode       uartXferMode;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             CSL_UartSetup                 uartSetup;
             uartSetup.....

             uartInstId = 0;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             status = UART_setup(hUart,&uartSetup);
             uartXferMode = UART_getModeOfTransfer(hUart);

============================================================================

References CSL_UART_FIFO_MODE, CSL_UART_MODE_UNDEFINED, CSL_UART_NON_FIFO_MODE, and CSL_UartObj::uartRegs.

Referenced by UART_write().

static CSL_Status UART_getRecvorResetStatus | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_getRecvorResetStatus

Description
This API is used to get the Receiver reset status

Arguments

                hUart        Handle to the uart

Return Value Bool

- TRUE - Receiver in reset state.

- FALSE - Receiver is enabled.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             Bool                    	bStatus;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             uartInstId = 0;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             bStatus = UART_getRecvorResetStatus(hUart);

============================================================================

References CSL_UartObj::uartRegs.

static Bool UART_getXmitHoldRegEmptyStatus | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_getXmitHoldRegEmptyStatus

Description
This API is used to get the status of THRE bit in LSR reg

Arguments

                hUart        Handle to the uart

Return Value Bool

- TRUE - THRE bit is set

- FALSE - THRE bit is not set.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             Bool                    	bStatus;
             CSL_UartObj         		uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             uartInstId = 0;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             bStatus = UART_getXmitHoldRegEmptyStatus(hUart);

============================================================================

References CSL_UartObj::uartRegs.

Referenced by UART_fputc(), UART_fputs(), and UART_write().

static CSL_Status UART_getXmitorResetState | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_getXmitorResetState

Description
This API is used to get the Receiver reset status

Arguments

                hUart        Handle to the uart

Return Value Bool

- TRUE - Transmittor in reset state.

- FALSE - Transmittor is enabled.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             Bool                    	bStatus;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             uartInstId = 0;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             bStatus = UART_getXmitorResetState(hUart);

============================================================================

References CSL_UartObj::uartRegs.

CSL_Status UART_init | ( | CSL_UartObj * | uartObj,
|  | Uint32 | uartInstId,
|  | CSL_UartOpmode | opmode
| ) |  |

============================================================================
UART_init

Description
This is the initialization function for the uart CSL. The function must be called before calling any other API from this CSL. This will initialize the uart object. Arguments

    		uartInstId  Instance number of the uart
    		uartObj     Pointer to the uart object
            opmode      Operation mode of uart

Return Value CSL_Status

- CSL_SOK - Init call is successful
- CSL_ESYS_INVPARAMS- Invalid parameter
- CSL_UART_INVALID_INST_ID- Invalid instance id Pre Condition
  None Post Condition
  PLL object structure is populated

Modifies
Handle is modified

Example

    		CSL_Status              status;
    		CSL_UartObj                uartObj;
    		Uint32                  uartInstId;
            CSL_UartOpmode opmode = UART_POLLED;
    		uartInstId = CSL_UART_INST_0;
    		status = UART_init(&uartObj,uartInstId);

============================================================================

Enable Master clock

Enable uart peripheral clock gating

Resetting UART module

References CSL_EUART_INVALID_INST_ID, CSL_UART_INST_0, CSL_UART_INST_INVALID, CSL_UartObj::insId, CSL_UartObj::opmode, CSL_UartObj::sysAddr, UART_OPMODE_OTHER, and CSL_UartObj::uartRegs.

CSL_Status UART_read | ( | CSL_UartHandle | hUart,
|  | Char * | pBuf,
|  | Uint16 | count,
|  | Uint32 | timeout
| ) |  |

============================================================================
UART_read

Description
UART_read attempts to read up to count characters from RBR(Recieve Buffer Register) into the buffer starting at pBuf

Arguments

    		hUart  Handle to the UART.
    	   	pBuf   Output buffer
          	count  No of characters to read.
            timeout Timeout value
                    0 - wait indefinitely for DR bit to get set.
                    x - wait x value for DR bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_read call is successful.
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid address of the buffer.
- CSL_EUART_TIMEOUT - Read had a timeout due to DR bit not set. Pre Condition
  UART_init and CSL_UartSetup should be called successfully. Post Condition
  pBuf contains count number of characters.

Modifies
Handle is modified
bBuf is modified Example

     	     CSL_Status              status;
     	     CSL_UartObj                uartObj;
             Uint32                  uartInstId;
             CSL_UartSetup 		    uartSetup;
             CSL_UartHandle hUart;
             Char  buf[12];
             Uint16 N = 12;
             uartInstId = 0;

             status = UART_init(&uartObj,uartInstId);
             hUart = (CSL_UartHandle)&uartObj;
             status = CSL_UartSetup( hUart,&uartSetup);
             status = UART_read(hUart,buf,N,1000) ;

============================================================================

============================================================================
UART_read

Description
UART_read attempts to read up to count characters from RBR(Recieve Buffer Register) into the buffer starting at pBuf in polled mode. In interrupt mode,only charater it will read . Arguments

    		hUart  Handle to the UART.
    	   	pBuf   Output buffer
          	count  No of characters to read.
            timeout Timeout value
                    0 - wait indefinitely for DR bit to get set.
                    x - wait x value for DR bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_read call is successful.
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid address of the buffer.
- CSL_EUART_TIMEOUT - Read had a timeout due to DR bit not set. Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  pBuf contains count number of characters.

Modifies
Handle is modified
bBuf is modified Example

     	     CSL_Status              status;
     	     CSL_UartObj                uartObj;
             Uint32                  uartInstId;
             CSL_UartSetup 		     uartSetup;
             CSL_UartHandle hUart;
             Char  buf[12];
             Uint16 N = 12;
             uartInstId = 0;

             uartSetup.afeEnable = CSL_UART_NO_AFE;
             uartSetup.baud = 2400;
             uartSetup.clkInput = 60000000;
             uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
             uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
             uartSetup.parity =  CSL_UART_DISABLE_PARITY;
             uartSetup.rtsEnable = CSL_UART_NO_RTS;
             uartSetup.stopBits = 0;
             uartSetup.wordLength = CSL_UART_WORD8;

             status = UART_init(&uartObj,uartInstId);
             hUart = (CSL_UartHandle)&uartObj;
             status = UART_setup( hUart,&uartSetup);
             status = UART_read(hUart,buf,N,1000) ;

============================================================================

References CSL_EUART_TIMEOUT, CSL_UartObj::opmode, UART_getDataReadyStatus(), UART_POLLED, and CSL_UartObj::uartRegs.

CSL_Status UART_reset | ( | CSL_UartHandle | hUart | ) |

============================================================================
UART_reset

Description
This API is used to reset the UART receiver and transmitter.

Arguments

    		hUart  Handle to the UART.

Return Value CSL_Status

- CSL_SOK - UART_setupBaudRate call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  uart receiver and transmitter are in reset state.

Modifies
Handle is modified

Example

     	     CSL_Status              status;
     	     CSL_UartObj                uartObj;
             CSL_UartHandle             hUart;
             Uint32                  uartInstId;
             Bool                    brecvstatus;
             Bool                    bxmitstatus;
             uartInstId = 0;
    	     status = UART_init(&uartObj,uartInstId);
             hUart = CSL_UartHandle(&uartObj);
    	     status = UART_resetOff(hUart);
    	     status = UART_reset(hUart);
             brecvstatus = UART_getRecvorResetStatus(hUart);
             bxmitstatus = UART_getXmitorResetState(hUart);

============================================================================

============================================================================
UART_reset

Description
This API is used to reset the UART receiver and transmitter.

Arguments

    		hUart  Handle to the UART.

Return Value CSL_Status

- CSL_SOK - UART_setupBaudRate call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  uart receiver and transmitter are in reset state.

Modifies
Handle is modified

Example

     	     CSL_Status              status;
     	     CSL_UartObj                uartObj;
             CSL_UartHandle             hUart;
             CSL_UartConfig             Config;
             Uint32                  uartInstId;
             Bool                    brecvstatus;
             Bool                    bxmitstatus;
             uartInstId = 0;
             Config.FCR = CSL_UART_FIFO_DMA1_DISABLE_TRIG01;
             Config.DLL = 0x001b;
             Config.DLH = 0x0006;
             Config.LCR = 0x0003
             Config.MCR = 0x0000;
    	     status = UART_init(&uartObj,uartInstId);
             hUart  = CSL_UartHandle(&uartObj);
             status = UART_reset(hUart);
             status = UART_config(hUart,&Config);
             status = UART_resetOff(hUart);
             brecvstatus = UART_getRecvorResetStatus(hUart);
             bxmitstatus = UART_getXmitorResetState(hUart);

============================================================================

References CSL_UartObj::uartRegs.

CSL_Status UART_resetOff | ( | CSL_UartHandle | hUart | ) |

============================================================================
UART_resetOff

Description
This API is used to set the UART receiver and transmitter.

Arguments

    		hUart  Handle to the UART.

Return Value CSL_Status

- CSL_SOK - UART_setupBaudRate call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  uart receiver and transmitter are on state.

Modifies
Handle is modified

Example

    		 CSL_Status              status;
     	     CSL_UartObj                uartObj;
             CSL_UartHandle             hUart;
             Uint32                  uartInstId;
             Bool                    brecvstatus;
             Bool                    bxmitstatus;
             uartInstId = 0;
    	     status = UART_init(&uartObj,uartInstId);
             hUart = CSL_UartHandle(&uartObj);
    	     status = UART_resetOff(hUart);
             brecvstatus = UART_getRecvorResetStatus(hUart);
             bxmitstatus = UART_getXmitorResetState(hUart);

============================================================================

============================================================================
UART_resetOff

Description
This API is used to set the UART receiver and transmitter.

Arguments

    		hUart  Handle to the UART.

Return Value CSL_Status

- CSL_SOK - UART_setupBaudRate call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  uart receiver and transmitter are on state.

Modifies
Handle is modified

Example

    		CSL_Status              status;
     	     CSL_UartObj                uartObj;
             CSL_UartHandle             hUart;
             Uint32                  uartInstId;
             Bool                    brecvstatus;
             Bool                    bxmitstatus;
             uartInstId = 0;
             config.FCR = CSL_UART_FIFO_DMA1_DISABLE_TRIG01;
             config.DLL = 0x001b;
             config.DLH = 0x0006;
             config.LCR = 0x0003
             config.MCR = 0x0000;
    	     status = UART_init(&uartObj,uartInstId);
             hUart  = CSL_UartHandle(&uartObj);
             status = UART_reset(hUart);
             status = UART_config(hUart,&Config);
             status = UART_resetOff(hUart);
             brecvstatus = UART_getRecvorResetStatus(hUart);
             bxmitstatus = UART_getXmitorResetState(hUart);

============================================================================

References CSL_UartObj::uartRegs.

CSL_Status UART_setCallback | ( | CSL_UartHandle | hUart,
|  | CSL_UartIsrAddr * | isrAddr
| ) |  |

============================================================================
UART_setCallback

Description
UART_setCallback will set call back functions in isrDispatchTable.

Arguments

     		hUart - Handle to the UART.
     		isrAddr - pointer to the 	CSL_UartIsrAddr.

Return Value CSL_Status

- CSL_SOK - UART_setCallback call is successful. Pre Condition
  UART_init should be called successfully. Post Condition
  Setup call back functions in the UART_isrDispatchTable

Modifies
hUart Example

     	     CSL_Status              status;
     	     CSL_UartObj                uartObj;
                Uint32                      uartInstId;
                CSL_UartHandle 		 hUart;
                CSL_UartIsrAddr 		isrAddr;
                uartInstId = 0;

                status =  UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status =   UART_setCallback(hUart,&isrAddr);

============================================================================

References CSL_UartIsrAddr::ctoi, CSL_UartIsrAddr::lsiAddr, CSL_UartIsrAddr::rbiAddr, CSL_UartIsrAddr::tbeiAddr, UART_EVT_CTOI_IID, UART_EVT_LSI_IID, UART_EVT_RBI_IID, UART_EVT_TBEI_IID, and CSL_UartObj::UART_isrDispatchTable.

static CSL_Status UART_setToIntMode | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_setToIntMode

Description
This API is used to set the interrupt mode.

Arguments

                hUart        Handle to the uart

Return Value CSL_Status

- CSL_ESYS_BADHANDLE - Invalid handle.

- CSL_SOK - Changed to interruptmode.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             uartInstId = 0;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             status = UART_setToIntMode(hUart);

============================================================================

References CSL_UartObj::opmode, and UART_INTERRUPT.

static CSL_Status UART_setToPollMode | ( | CSL_UartHandle | hUart | ) | `[inline, static]`

============================================================================
UART_setToPollMode

Description
This API is used to switch to the poll mode.

Arguments

                hUart        Handle to the uart

Return Value CSL_Status

- CSL_ESYS_BADHANDLE - Invalid handle.

- CSL_SOK - Successfully changed to poll mode.

Pre Condition
UART_init should be called successfully.

Post Condition
none

Modifies
none

Example

             CSL_Status              	status;
             CSL_UartObj         		    uartObj;
             CSL_UartHandle            	hUart;
             Uint32                  	uartInstId;
             uartInstId = 0;
             status = UART_init(&uartObj,uartInstId);
             hUart = &uartObj;
             status = UART_setToPollMode(hUart);

============================================================================

References CSL_UartObj::opmode, and UART_POLLED.

CSL_Status UART_setup | ( | CSL_UartHandle | hUart,
|  | CSL_UartSetup * | uartSetup
| ) |  |

============================================================================
UART_setup

Description
The main function of this API is to setup the baud rate,configure fifo,enable transmitter and receiver UART setup word size,stop bits and parity.

Arguments

    		hUart  Handle to the UART.
            uartSetup     Pointer to the UART_Setup structure.

Return Value CSL_Status

- CSL_SOK - UART_setup call is successful
- CSL_ESYS_BADHANDLE- Invalid Handle
- CSL_ESYS_INVPARAMS- Invalid uartSetup Pre Condition
  UART_init should be called successfully. Post Condition
  Setup the UART for transmission and reception.

Modifies
Handle is modified

Example

    		CSL_Status       status;
     	    CSL_UartObj         uartObj;
            Uint32           uartInstId;
            CSL_UartSetup 		 uartSetup;
            uartInstId = 0;
    	    status = UART_init(&uartObj,uartInstId);
            status =  UART_setup(CSL_UartHandle hUart,&uartSetup);

============================================================================

============================================================================
UART_setup

Description
The main function of this API is to setup the baud rate,configure fifo,enable transmitter and receiver UART setup word size,stop bits and parity.

Arguments

    		hUart  Handle to the UART.
            uartSetup     Pointer to the CSL_UartSetup structure.

Return Value CSL_Status

- CSL_SOK - UART_setup call is successful
- CSL_ESYS_BADHANDLE- Invalid Handle
- CSL_ESYS_INVPARAMS- Invalid uartSetup Pre Condition
  UART_init should be called successfully. Post Condition
  Setup the UART for transmission and reception.

Modifies
Handle is modified

Example

    		CSL_Status       status;
     	    CSL_UartObj         uartObj;
            Uint32           uartInstId;
            CSL_UartSetup 		 uartSetup;
            uartInstId = 0;

    	    status = UART_init(&uartObj,uartInstId);
            uartSetup.afeEnable = CSL_UART_NO_AFE;
            uartSetup.baud = 2400;
            uartSetup.clkInput = 60000000;
            uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
            uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
            uartSetup.parity =  CSL_UART_DISABLE_PARITY;
            uartSetup.rtsEnable = CSL_UART_NO_RTS;
            uartSetup.stopBits = 0;
            uartSetup.wordLength = CSL_UART_WORD8;

            status =  UART_setup(CSL_UartHandle hUart,&uartSetup);

============================================================================

Putting UART recvor and xmittor in reset state

References CSL_UartSetup::afeEnable, CSL_UartSetup::baud, CSL_UartSetup::clkInput, CSL_EUART_INVALID_WORDLENGTH, CSL_UART_CLK_DIVIDER, CSL_UART_DISABLE_PARITY, CSL_UART_EVEN_PARITY, CSL_UART_MARK_PARITY, CSL_UART_ODD_PARITY, CSL_UART_SPACE_PARITY, CSL_UART_WORD5, CSL_UART_WORD6, CSL_UART_WORD7, CSL_UART_WORD8, CSL_UartSetup::fifoControl, CSL_UartSetup::loopBackEnable, CSL_UartSetup::parity, CSL_UartSetup::rtsEnable, CSL_UartSetup::stopBits, CSL_UartObj::trigLevel, CSL_UartObj::uartRegs, and CSL_UartSetup::wordLength.

CSL_Status UART_setupBaudRate | ( | CSL_UartHandle | hUart,
|  | Uint32 | clkInput,
|  | Uint32 | baudRate
| ) |  |

============================================================================
UART_setupBaudRate

Description
This API is used to set the baud rate.

Arguments

    		hUart       Handle to the UART
            clkInput    Input clock frequency in Hz
            baudRate    Baud rate.

Return Value CSL_Status

- CSL_SOK - UART_setupBaudRate call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init should be called successfully. Post Condition
  DLL and DLH registers are set.

Modifies
Handle is modified

Example

    		CSL_Status              status;
     	    CSL_UartObj                uartObj;
            Uint32                  uartInstId;
            UART_baud 		        uartBaud;
            uartInstId = 0;

    	    status = UART_init(&uartObj,uartInstId);
            uartBaud.clkInput = 60000000;
            uartBaud.baudRate = 2400;
            status =  UART_setupBaudRate(CSL_UartHandle hUart,&Config);

============================================================================

============================================================================
UART_setupBaudRate

Description
This API is used to set the baud rate.

Arguments

    		hUart       Handle to the UART
            clkInput    Input clock frequency in Hz
            baudRate    Baud rate.

Return Value CSL_Status

- CSL_SOK - UART_setupBaudRate call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  DLL and DLH registers are set to clkdivisor value.

Modifies
Handle is modified

Example

    		CSL_Status              status;
     	    CSL_UartObj                uartObj;
            CSL_UartHandle             hUart;
            Uint32                  uartInstId;
            CSL_UartSetup              uartSetup;
            uartInstId = 0;

            uartSetup.afeEnable = CSL_UART_NO_AFE;
            uartSetup.baud = 2400;
            uartSetup.clkInput = 60000000;
            uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
            uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
            uartSetup.parity =  CSL_UART_DISABLE_PARITY;
            uartSetup.rtsEnable = CSL_UART_NO_RTS;
            uartSetup.stopBits = 0;
            uartSetup.wordLength = CSL_UART_WORD8;

    	    status = UART_init(&uartObj,uartInstId);
            hUart  = (CSL_UartHandle)&uartObj;
            status = UART_setup(hUart,&uartSetup);
            status = UART_setupBaudRate(hUart,60000000,4800);

============================================================================

References CSL_UART_CLK_DIVIDER, and CSL_UartObj::uartRegs.

CSL_Status UART_write | ( | CSL_UartHandle | hUart,
|  | Char * | pBuf,
|  | Uint16 | count,
|  | Uint32 | timeout
| ) |  |

============================================================================
UART_write

Description
UART_write writes up to count characters to the THR(Transmitter Holding Register) from the buffer starting at pBuf

Arguments

    		hUart  Handle to the UART.
    		pBuf   Input buffer
            count  No of characters to write.
            timeout Timeout value
                    0 - wait indefinitely for THRE bit to get set.
                    x - wait x value for THRE bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_write call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid address of the pBuf
- CSL_EUART_TIMEOUT - Write had a timeout due to THRE bit not set. Pre Condition
  UART_init and CSL_UartSetup should be called successfully. Post Condition
  count number of characters have written to THR.

Modifies
Handle is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                Uint32                      uartInstId;
                CSL_UartSetup 		 uartSetup;
                CSL_UartHandle hUart;
                Char  buf[12];
                Uint16 N = 12;
                uartInstId = 0;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status =  CSL_UartSetup( hUart,&uartSetup);
                status = UART_write(hUart,buf,N,1000) ;

============================================================================

============================================================================
UART_write

Description
UART_write writes up to count characters to the THR(Transmitter Holding Register) from the buffer starting at pBuf In interrupt mode maximum of 16 charaters it will write Arguments

    		hUart  Handle to the UART.
    		pBuf   Input buffer
            count  No of characters to write.
            timeout Timeout value
                    0 - wait indefinitely for THRE bit to get set.
                    x - wait x value for THRE bit to get set.

Return Value CSL_Status

- CSL_SOK - UART_write call is successful
- CSL_ESYS_BADHANDLE- Invalid UART Handle
- CSL_ESYS_INVPARAMS- Invalid address of the pBuf
- CSL_EUART_TIMEOUT - Write had a timeout due to THRE bit not set. Pre Condition
  UART_init and UART_setup should be called successfully. Post Condition
  count number of characters are written to THR.

Modifies
Handle is modified Example

     	     	CSL_Status              status;
     	     	CSL_UartObj                uartObj;
                Uint32                  uartInstId;
                CSL_UartSetup 		        uartSetup;
                CSL_UartHandle             hUart;
                Char                    buf[12];
                Uint16 N = 12;
                uartInstId = 0;

                uartSetup.afeEnable = CSL_UART_NO_AFE;
                uartSetup.baud = 2400;
                uartSetup.clkInput = 60000000;
                uartSetup.fifoControl = CSL_UART_FIFO_DISABLE;
                uartSetup.loopBackEnable = CSL_UART_NO_LOOPBACK;
                uartSetup.parity =  CSL_UART_DISABLE_PARITY;
                uartSetup.rtsEnable = CSL_UART_NO_RTS;
                uartSetup.stopBits = 0;
                uartSetup.wordLength = CSL_UART_WORD8;

                status = UART_init(&uartObj,uartInstId);
                hUart = (CSL_UartHandle)&uartObj;
                status =  UART_setup( hUart,&uartSetup);
                status = UART_write(hUart,buf,N,1000) ;

============================================================================

References CSL_EUART_TIMEOUT, CSL_UART_FIFO_MODE, CSL_UART_NON_FIFO_MODE, CSL_UartObj::opmode, UART_getModeOfTransfer(), UART_getXmitHoldRegEmptyStatus(), UART_POLLED, and CSL_UartObj::uartRegs.