Functions
UART Driver External Functions

The section has a list of all the exported API which the applications need to invoke in order to use the UART driver. More...

Functions

void UART_close (UART_Handle handle)
 Function to close a UART peripheral specified by the UART handle. More...
 
int32_t UART_control (UART_Handle handle, uint32_t cmd, void *arg)
 Function performs implementation specific features on a given UART_Handle. More...
 
void UART_init (void)
 Function to initialize the UART module. More...
 
UART_Handle UART_open (uint32_t index, UART_Params *params)
 Function to initialize a given UART peripheral. More...
 
void UART_Params_init (UART_Params *params)
 Function to initialize the UART_Params struct to its defaults. More...
 
int32_t UART_write (UART_Handle handle, uint8_t *buffer, uint32_t size)
 Function that writes data to a UART with interrupts enabled. Usage of this API is mutually exclusive with usage of UART_writePolling(). In other words, for an opened UART peripheral, either UART_write() or UART_writePolling() may be used, but not both. More...
 
int32_t UART_writePolling (UART_Handle handle, uint8_t *buffer, uint32_t size)
 Function that writes data to a UART, polling the peripheral to wait until new data can be written. Usage of this API is mutually exclusive with usage of UART_write(). More...
 
void UART_writeCancel (UART_Handle handle)
 Function that cancels a UART_write() function call. More...
 
int32_t UART_read (UART_Handle handle, uint8_t *buffer, uint32_t size)
 Function that reads data from a UART with interrupt enabled. This API must be used mutually exclusive with UART_readPolling(). More...
 
int32_t UART_readPolling (UART_Handle handle, uint8_t *buffer, uint32_t size)
 Function that reads data from a UART without interrupts. This API must be used mutually exclusive with UART_read(). More...
 
void UART_readCancel (UART_Handle handle)
 Function that cancels a UART_read() function call. This function cancels a UART_read() operation for a UART peripheral. More...
 

Detailed Description

The section has a list of all the exported API which the applications need to invoke in order to use the UART driver.

Function Documentation

void UART_close ( UART_Handle  handle)

Function to close a UART peripheral specified by the UART handle.

Precondition
UART_open() has been called.
Parameters
handleA UART_Handle returned from UART_open()
See also
UART_open()
int32_t UART_control ( UART_Handle  handle,
uint32_t  cmd,
void *  arg 
)

Function performs implementation specific features on a given UART_Handle.

Commands for UART_control can originate from UART.h or from implementation specific UART*.h (UARTCC26XX.h, UARTTiva.h, etc.. ) files. While commands from UART.h are API portable across driver implementations, not all implementations may support all these commands. Conversely, commands from driver implementation specific UART*.h files add unique driver capabilities but are not API portable across all UART driver implementations.

Commands supported by UART.h follow a UART_CMD_<cmd> naming convention.
Commands supported by UART*.h follow a UART*_CMD_<cmd> naming convention.
Each control command defines arg differently. The types of arg are documented with each command.

See UART_control command codes for command codes.

See UART_control return status codes for status codes.

Precondition
UART_open() has to be called.
Parameters
handleA UART handle returned from UART_open()
cmdUART.h or UART*.h commands.
argAn optional R/W (read/write) command argument accompanied with cmd
Returns
Implementation specific return codes. Negative values indicate unsuccessful operations.
See also
UART_open()
void UART_init ( void  )

Function to initialize the UART module.

Precondition
The UART_config structure must exist and be persistent before this function can be called. This function must also be called before any other UART driver APIs.
UART_Handle UART_open ( uint32_t  index,
UART_Params params 
)

Function to initialize a given UART peripheral.

Function to initialize a given UART peripheral specified by the particular index value.

Precondition
UART_init() has been called
Parameters
indexLogical peripheral number for the UART indexed into the UART_config table
paramsPointer to a parameter block. If NULL, default parameter values will be used. All the fields in this structure are RO (read-only).
Returns
A UART_Handle upon success. NULL if an error occurs, or if the indexed UART peripheral is already opened.
See also
UART_init()
UART_close()
void UART_Params_init ( UART_Params params)

Function to initialize the UART_Params struct to its defaults.

Parameters
paramsAn pointer to UART_Params structure for initialization

Defaults values are: readTimeout = UART_WAIT_FOREVER; writeTimeout = UART_WAIT_FOREVER; readReturnMode = UART_RETURN_NEWLINE; readDataMode = UART_DATA_TEXT; writeDataMode = UART_DATA_TEXT; readEcho = UART_ECHO_ON; baudRate = 115200; dataLength = UART_LEN_8; stopBits = UART_STOP_ONE; parityType = UART_PAR_NONE;

int32_t UART_read ( UART_Handle  handle,
uint8_t *  buffer,
uint32_t  size 
)

Function that reads data from a UART with interrupt enabled. This API must be used mutually exclusive with UART_readPolling().

This function initiates an operation to read data from a UART controller.

In UART_MODE_BLOCKING, UART_read() will block task execution until all the data in buffer has been read.

See also
UART_readPolling()
Parameters
handleA UART_Handle
bufferA RO (read-only) pointer to an empty buffer in which received data should be written to.
sizeThe number of bytes to be written into buffer
Returns
Returns the number of bytes that have been read from the UART, one of the UART Error codes on an error.
void UART_readCancel ( UART_Handle  handle)

Function that cancels a UART_read() function call. This function cancels a UART_read() operation for a UART peripheral.

Parameters
handleA UART_Handle
int32_t UART_readPolling ( UART_Handle  handle,
uint8_t *  buffer,
uint32_t  size 
)

Function that reads data from a UART without interrupts. This API must be used mutually exclusive with UART_read().

This function initiates an operation to read data from a UART peripheral.

UART_readPolling will not return until size data was read to the UART.

See also
UART_read()
Parameters
handleA UART_Handle
bufferA RO (read-only) pointer to an empty buffer in which received data should be written to.
sizeThe number of bytes to be written into buffer
Returns
Returns the number of bytes that have been read from the UART, one of the UART Error codes on an error.
int32_t UART_write ( UART_Handle  handle,
uint8_t *  buffer,
uint32_t  size 
)

Function that writes data to a UART with interrupts enabled. Usage of this API is mutually exclusive with usage of UART_writePolling(). In other words, for an opened UART peripheral, either UART_write() or UART_writePolling() may be used, but not both.

In UART_MODE_BLOCKING, UART_write() will block task execution until all the data in buffer has been written.

See also
UART_writePolling()
Parameters
handleA UART_Handle
bufferA WO (write-only) pointer to buffer containing data to be written to the UART.
sizeThe number of bytes in the buffer that should be written to the UART.
Returns
Returns the number of bytes that have been written to the UART. If an error occurs, one of the UART Error codes is returned.
void UART_writeCancel ( UART_Handle  handle)

Function that cancels a UART_write() function call.

This function cancels a UART_write() operation to a UART peripheral.

Parameters
handleA UART_Handle
int32_t UART_writePolling ( UART_Handle  handle,
uint8_t *  buffer,
uint32_t  size 
)

Function that writes data to a UART, polling the peripheral to wait until new data can be written. Usage of this API is mutually exclusive with usage of UART_write().

This function initiates an operation to write data to a UART controller.

UART_writePolling() will not return until all the data was written to the UART (or to its FIFO if applicable).

See also
UART_write()
Parameters
handleA UART_Handle
bufferA pointer to the buffer containing the data to be written to the UART.
sizeThe number of bytes in the buffer that should be written to the UART.
Returns
Returns the number of bytes that have been written to the UART. If an error occurs, one of the UART Error codes is returned.

Copyright 2018, Texas Instruments Incorporated