FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
iot_uart.h File Reference

File for the HAL APIs of UART called by application layer. More...

#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  IotUARTConfig_t
 Configuration parameters for the UART. More...
 

Macros

#define IOT_UART_BAUD_RATE_DEFAULT   ( 115200 )
 The default baud rate for a given UART port.
 
#define IOT_UART_SUCCESS   ( 0 )
 Error codes returned by every function module in UART HAL. More...
 
#define IOT_UART_INVALID_VALUE   ( 1 )
 
#define IOT_UART_WRITE_FAILED   ( 2 )
 
#define IOT_UART_READ_FAILED   ( 3 )
 
#define IOT_UART_BUSY   ( 4 )
 
#define IOT_UART_NOTHING_TO_CANCEL   ( 5 )
 
#define IOT_UART_FUNCTION_NOT_SUPPORTED   ( 6 )
 

Typedefs

typedef void(* IotUARTCallback_t) (IotUARTOperationStatus_t xStatus, void *pvUserContext)
 The callback function for completion of UART operation. More...
 
typedef struct IotUARTDescriptor_t * IotUARTHandle_t
 IotUARTHandle_t is the handle type returned by calling iot_uart_open(). This is initialized in open and returned to caller. The caller must pass this pointer to the rest of APIs.
 

Enumerations

enum  IotUARTOperationStatus_t { eUartCompleted = IOT_UART_SUCCESS, eUartLastWriteFailed = IOT_UART_WRITE_FAILED, eUartLastReadFailed = IOT_UART_READ_FAILED }
 UART read/write operation status values. More...
 
enum  IotUARTParity_t { eUartParityNone, eUartParityOdd, eUartParityEven }
 UART parity mode. More...
 
enum  IotUARTStopBits_t { eUartStopBitsOne, eUartStopBitsTwo }
 UART stop bits. More...
 
enum  IotUARTIoctlRequest_t { eUartSetConfig, eUartGetConfig, eGetTxNoOfbytes, eGetRxNoOfbytes }
 Ioctl requests for UART HAL. More...
 

Functions

IotUARTHandle_t iot_uart_open (int32_t lUartInstance)
 Initializes the UART peripheral of the board. More...
 
void iot_uart_set_callback (IotUARTHandle_t const pxUartPeripheral, IotUARTCallback_t xCallback, void *pvUserContext)
 Sets the application callback to be called on completion of an operation. More...
 
int32_t iot_uart_read_sync (IotUARTHandle_t const pxUartPeripheral, uint8_t *const pvBuffer, size_t xBytes)
 Starts receiving the data from UART synchronously. More...
 
int32_t iot_uart_write_sync (IotUARTHandle_t const pxUartPeripheral, uint8_t *const pvBuffer, size_t xBytes)
 Starts the transmission of data from UART synchronously. More...
 
int32_t iot_uart_read_async (IotUARTHandle_t const pxUartPeripheral, uint8_t *const pvBuffer, size_t xBytes)
 Starts receiving the data from UART asynchronously. More...
 
int32_t iot_uart_write_async (IotUARTHandle_t const pxUartPeripheral, uint8_t *const pvBuffer, size_t xBytes)
 Starts the transmission of data from UART asynchronously. More...
 
int32_t iot_uart_ioctl (IotUARTHandle_t const pxUartPeripheral, IotUARTIoctlRequest_t xUartRequest, void *const pvBuffer)
 Configures the UART port with user configuration. More...
 
int32_t iot_uart_cancel (IotUARTHandle_t const pxUartPeripheral)
 Aborts the operation on the UART port if any underlying driver allows cancellation of the operation. More...
 
int32_t iot_uart_close (IotUARTHandle_t const pxUartPeripheral)
 Stops the operation and de-initializes the UART peripheral. More...
 

Detailed Description

File for the HAL APIs of UART called by application layer.