PDK API Guide for J721E
|
UART driver interface.
============================================================================
The UART header file should be included in an application as follows:
The UART driver simplifies reading and writing to any of the UART peripherals on the board with multiple modes of operation and performance. These include blocking, non-blocking, and polling as well as text/binary mode, echo and return characters. The boards UART peripheral and pins must be configured before initializing the UART driver. The application initializes the UART driver by calling UART_init() and is then ready to open a UART by calling UART_open() and passing in a UART parameters data structure.
The APIs in this driver serve as an interface to a typical TI-RTOS application. The specific peripheral implementations are responsible to create all the OS specific primitives to allow for thread-safe operation.
This module serves as the main interface for TI-RTOS applications. Its purpose is to redirect the module's APIs to specific peripheral implementations which are specified using a pointer to a UART_FxnTable.
The UART driver interface module is joined (at link time) to a NULL-terminated array of UART_Config data structures named UART_config. UART_config is implemented in the application with each entry being an instance of a UART peripheral. Each entry in UART_config contains a:
Go to the source code of this file.
Data Structures | |
struct | UART_Transaction |
A UART_Transaction data structure is used with UART_read2(), UART_write2() and UART_Callback2() More... | |
struct | UART_Params |
Basic UART Parameters. More... | |
struct | UART_FxnTable |
The definition of a UART function table that contains the required set of functions to control a specific UART driver implementation. More... | |
struct | UART_Config |
UART Global configuration. More... | |
Macros | |
#define | UART_SUCCESS ((int32_t)(0)) |
#define | UART_ERROR (-((int32_t)1)) |
#define | UART_ERRNO_BASE (0) |
UART driver error base. More... | |
#define | UART_EINVAL (UART_ERRNO_BASE-1) |
Error Code: Invalid argument. More... | |
#define | UART_EINUSE (UART_ERRNO_BASE-2) |
Error Code: Operation cannot be implemented because a previous operation is still not complete. More... | |
#define | UART_ENOTIMPL (UART_ERRNO_BASE-3) |
Error Code: Operation is not implemented. More... | |
#define | UART_NO_WAIT ((uint32_t)0U) |
UART transaction timeout define. More... | |
#define | UART_WAIT_FOREVER (~((uint32_t)0U)) |
#define | UART_MAX_CONFIG_CNT (14U) |
Typedefs | |
typedef struct UART_Config_s * | UART_Handle |
A handle that is returned from a UART_open() call. More... | |
typedef void(* | UART_Callback) (UART_Handle handle, void *buf, size_t count) |
The definition of a callback function used by the UART driver when used in UART_MODE_CALLBACK. More... | |
typedef void(* | UART_Callback2) (UART_Handle handle, UART_Transaction *transaction) |
The definition of a callback2 function used by the UART driver when used in UART_MODE_CALLBACK. More... | |
typedef void(* | UART_CloseFxn) (UART_Handle handle) |
A function pointer to a driver specific implementation of UART_CloseFxn(). More... | |
typedef int32_t(* | UART_ControlFxn) (UART_Handle handle, uint32_t cmd, void *arg) |
A function pointer to a driver specific implementation of UART_ControlFxn(). More... | |
typedef void(* | UART_InitFxn) (UART_Handle handle) |
A function pointer to a driver specific implementation of UART_InitFxn(). More... | |
typedef UART_Handle(* | UART_OpenFxn) (UART_Handle handle, const UART_Params *params) |
A function pointer to a driver specific implementation of UART_OpenFxn(). More... | |
typedef int32_t(* | UART_ReadFxn) (UART_Handle handle, void *buffer, size_t size) |
A function pointer to a driver specific implementation of UART_ReadFxn(). More... | |
typedef int32_t(* | UART_ReadPollingFxn) (UART_Handle handle, void *buffer, size_t size) |
A function pointer to a driver specific implementation of UART_ReadPollingFxn(). More... | |
typedef void(* | UART_ReadCancelFxn) (UART_Handle handle) |
A function pointer to a driver specific implementation of UART_ReadCancelFxn(). More... | |
typedef int32_t(* | UART_WriteFxn) (UART_Handle handle, const void *buffer, size_t size) |
A function pointer to a driver specific implementation of UART_CloseFxn(). More... | |
typedef int32_t(* | UART_WritePollingFxn) (UART_Handle handle, const void *buffer, size_t size) |
A function pointer to a driver specific implementation of UART_WritePollingFxn(). More... | |
typedef void(* | UART_WriteCancelFxn) (UART_Handle handle) |
A function pointer to a driver specific implementation of UART_WriteCancelFxn(). More... | |
typedef int32_t(* | UART_ReadFxn2) (UART_Handle handle, UART_Transaction *transaction) |
A function pointer to a driver specific implementation of UART_ReadFxn2(). More... | |
typedef int32_t(* | UART_WriteFxn2) (UART_Handle handle, UART_Transaction *transaction) |
A function pointer to a driver specific implementation of UART_WriteFxn2(). More... | |
typedef UART_Config | UART_config_list[UART_MAX_CONFIG_CNT] |
Functions | |
void | UART_close (UART_Handle uartHnd) |
Function to closes a given UART peripheral specified by the UART handle. More... | |
int32_t | UART_control (UART_Handle uartHnd, uint32_t cmd, void *arg) |
Function performs implementation specific features on a given UART_Handle. More... | |
void | UART_init (void) |
Function to initializes the UART module. More... | |
UART_Handle | UART_open (uint32_t idx, UART_Params *uartParams) |
Function to initialize a given UART peripheral specified by the particular index value. The parameter specifies which mode the UART will operate. More... | |
void | UART_Params_init (UART_Params *uartParams) |
Function to initialize the UART_Params struct to its defaults. More... | |
int32_t | UART_write (UART_Handle uartHnd, const void *buffer, size_t size) |
Function that writes data to a UART. More... | |
int32_t | UART_writePolling (UART_Handle uartHnd, const void *buffer, size_t size) |
Function that writes data to a UART. More... | |
void | UART_writeCancel (UART_Handle handle) |
Function that cancels a UART_write function call. More... | |
int32_t | UART_read (UART_Handle handle, void *buffer, size_t size) |
Function that read data from a UART. More... | |
int32_t | UART_readPolling (UART_Handle handle, void *buffer, size_t size) |
Function that reads data from a UART. More... | |
void | UART_readCancel (UART_Handle handle) |
Function that cancels a UART_read function call. More... | |
int32_t | UART_read2 (UART_Handle handle, UART_Transaction *uartTrans) |
Extended function that read data from a UART. More... | |
int32_t | UART_write2 (UART_Handle handle, UART_Transaction *uartTrans) |
Extended function that writes data to a UART. More... | |
void | UART_transactionInit (UART_Transaction *uartTrans) |
Function to initialize the UART_Transaction struct to its defaults. More... | |