MSPM0G1X0X_G3X0X TI-Driver Library  2.01.00.03
Data Structures | Macros | Typedefs | Enumerations | Functions
UART.h File Reference

Detailed Description

UART driver interface.


#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <ti/driverlib/dl_gpio.h>
#include <ti/driverlib/dl_uart_main.h>
Include dependency graph for UART.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  UART_Params
 UART Parameters. More...
 

Macros

#define UART_STATUS_SUCCESS   (0)
 Successful status code returned by UART APIs.
 
#define UART_STATUS_SREADTIMEOUT   (1)
 A read timeout occurred (not an error).
 
#define UART_STATUS_EFRAMING   (-1)
 A framing error occurred.
 
#define UART_STATUS_EPARITY   (-2)
 A parity error occurred.
 
#define UART_STATUS_EBREAK   (-4)
 A break error occurred.
 
#define UART_STATUS_EOVERRUN   (-8)
 A FIFO overrun occurred.
 
#define UART_STATUS_EINUSE   (-9)
 The UART is currently in use.
 
#define UART_STATUS_EINVALID   (-10)
 An invalid argument or UART_Params field was passed to UART API.
 
#define UART_STATUS_EFAIL   (-11)
 General failure status returned by UART API.
 
#define UART_STATUS_EMEMORY   (-12)
 A memory allocation failure occurred.
 
#define UART_STATUS_ETIMEOUT   (-13)
 A timeout occurred for a blocking UART_read or UART_write call.
 
#define UART_STATUS_ECANCELLED   (-14)
 A UART_write() or UART_read() operation was cancelled.
 
#define UART_STATUS_ENOTOPEN   (-15)
 A UART_write() or UART_read() called on a device not opened.
 
#define UART_STATUS_EAGAIN   (-16)
 A UART_write() or UART_read() in UART_Mode_NONBLOCKING would have blocked.
 

Typedefs

typedef struct UART_Config_UART_Handle
 A handle that is returned from a UART_open() call.
 
typedef void(* UART_Callback) (UART_Handle handle, void *buf, size_t count, void *userArg, int_fast16_t status)
 The definition of a callback function used by the UART driver when used in UART_Mode_CALLBACK. The callback can occur in task or interrupt context. More...
 
typedef void(* UART_EventCallback) (UART_Handle handle, uint32_t event, uint32_t data, void *userArg)
 The definition of a callback function used by the UART driver. The callback can occur in task or interrupt context. More...
 

Enumerations

enum  UART_Mode {
  UART_Mode_BLOCKING = 0,
  UART_Mode_CALLBACK,
  UART_Mode_NONBLOCKING
}
 UART mode settings. More...
 
enum  UART_ReadReturnMode {
  UART_ReadReturnMode_FULL = 0,
  UART_ReadReturnMode_PARTIAL
}
 UART return mode settings. More...
 
enum  UART_DataLen {
  UART_DataLen_5 = DL_UART_WORD_LENGTH_5_BITS,
  UART_DataLen_6 = DL_UART_WORD_LENGTH_6_BITS,
  UART_DataLen_7 = DL_UART_WORD_LENGTH_7_BITS,
  UART_DataLen_8 = DL_UART_WORD_LENGTH_8_BITS
}
 UART data length settings. More...
 
enum  UART_StopBits {
  UART_StopBits_1 = DL_UART_STOP_BITS_ONE,
  UART_StopBits_2 = DL_UART_STOP_BITS_TWO
}
 UART stop bit settings. More...
 
enum  UART_Parity {
  UART_Parity_NONE = DL_UART_PARITY_NONE,
  UART_Parity_EVEN = DL_UART_PARITY_EVEN,
  UART_Parity_ODD = DL_UART_PARITY_ODD,
  UART_Parity_ZERO = DL_UART_PARITY_STICK_ZERO,
  UART_Parity_ONE = DL_UART_PARITY_STICK_ONE
}
 UART parity type settings. More...
 

Functions

void UART_Params_init (UART_Params *params)
 Function to initialize the UART_Params struct to its defaults. More...
 
UART_Handle UART_open (uint_least8_t index, UART_Params *params)
 Function to initialize a given UART peripheral. More...
 
void UART_close (UART_Handle handle)
 Function to close a UART peripheral specified by the UART handle. More...
 
int_fast16_t UART_read (UART_Handle handle, void *buf, size_t size, size_t *bytesRead)
 Function that reads data from a UART. More...
 
int_fast16_t UART_write (UART_Handle handle, const void *buf, size_t size, size_t *bytesWritten)
 Function that writes data to a UART. More...
 
int_fast16_t UART_readTimeout (UART_Handle handle, void *buf, size_t size, size_t *bytesRead, uint32_t timeout)
 UART read with timeout. Note that the timeout parameter is different from the hardware read timeout. More...
 
int_fast16_t UART_writeTimeout (UART_Handle handle, const void *buf, size_t size, size_t *bytesWritten, uint32_t timeout)
 UART write with timeout. Note that the timeout parameter is different from the hardware read timeout. More...
 
void UART_readCancel (UART_Handle handle)
 Function that cancels a UART_read() function call. More...
 
void UART_writeCancel (UART_Handle handle)
 Function that cancels a UART_write() function call. More...
 
void UART_rxDisable (UART_Handle handle)
 Function that disables collecting of RX data into the circular buffer. More...
 
void UART_rxEnable (UART_Handle handle)
 Function that enables collecting of RX data into the circular buffer. More...
 
void UART_flushRx (UART_Handle handle)
 Function to flush data in the UART RX FIFO. More...
 
void UART_getRxCount (UART_Handle handle)
 Get the number of bytes available in the circular buffer. More...
 
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale