Enda Kilgarriff / platform_drivers
Embed: (wiki syntax)

« Back to documentation index

uart.cpp File Reference

uart.cpp File Reference

Implementation of UART No-OS platform driver interfaces. More...

Go to the source code of this file.

Functions

int32_t uart_read (struct uart_desc *desc, uint8_t *data, uint32_t bytes_number)
 Read data from UART device.
int32_t uart_write (struct uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
 Write data to UART device.
int32_t uart_read_nonblocking (struct uart_desc *desc, uint8_t *data, uint32_t bytes_number)
 Submit reading buffer to the UART driver.
int32_t uart_write_nonblocking (struct uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
 Submit writting buffer to the UART driver.
int32_t uart_init (struct uart_desc **desc, struct uart_init_param *param)
 Initialize the UART communication peripheral.
int32_t uart_remove (struct uart_desc *desc)
 Free the resources allocated by uart_init().
uint32_t uart_get_errors (struct uart_desc *desc)
 Get number of UART errors.

Detailed Description

Implementation of UART No-OS platform driver interfaces.

Copyright (c) 2020 Analog Devices, Inc.

All rights reserved.

This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Definition in file uart.cpp.


Function Documentation

uint32_t uart_get_errors ( struct uart_desc desc )

Get number of UART errors.

Parameters:
desc- The UART descriptor.
Returns:
number of errors.

Definition at line 237 of file uart.cpp.

int32_t uart_init ( struct uart_desc **  desc,
struct uart_init_param param 
)

Initialize the UART communication peripheral.

Parameters:
desc- The UART descriptor.
param- The structure that contains the UART parameters.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 162 of file uart.cpp.

int32_t uart_read ( struct uart_desc desc,
uint8_t *  data,
uint32_t  bytes_number 
)

Read data from UART device.

Parameters:
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 34 of file uart.cpp.

int32_t uart_read_nonblocking ( struct uart_desc desc,
uint8_t *  data,
uint32_t  bytes_number 
)

Submit reading buffer to the UART driver.

Buffer is used until bytes_number bytes are read.

Parameters:
desc,:Descriptor of the UART device
data,:Buffer where data will be read
bytes_number,:Number of bytes to be read.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 95 of file uart.cpp.

int32_t uart_remove ( struct uart_desc desc )

Free the resources allocated by uart_init().

Parameters:
desc- The UART descriptor.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 209 of file uart.cpp.

int32_t uart_write ( struct uart_desc desc,
const uint8_t *  data,
uint32_t  bytes_number 
)

Write data to UART device.

Parameters:
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 63 of file uart.cpp.

int32_t uart_write_nonblocking ( struct uart_desc desc,
const uint8_t *  data,
uint32_t  bytes_number 
)

Submit writting buffer to the UART driver.

Data from the buffer is sent over the UART, the function returns imediatly.

Parameters:
desc,:Descriptor of the UART device
data,:Buffer where data will be written
bytes_number,:Number of bytes to be written.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 130 of file uart.cpp.