no-OS
Functions
generic_uart.c File Reference
#include <stdio.h>
#include "no_os_error.h"
#include "no_os_uart.h"
#include "no_os_util.h"
Include dependency graph for generic_uart.c:

Functions

int32_t no_os_uart_read (struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
 Read data from UART device. More...
 
int32_t no_os_uart_write (struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
 Write data to UART device. More...
 
int32_t no_os_uart_read_nonblocking (struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
 Submit reading buffer to the UART driver. More...
 
int32_t no_os_uart_write_nonblocking (struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
 Submit writting buffer to the UART driver. More...
 
int32_t no_os_uart_init (struct no_os_uart_desc **desc, struct no_os_uart_init_param *param)
 Initialize the UART communication peripheral. More...
 
int32_t no_os_uart_remove (struct no_os_uart_desc *desc)
 Free the resources allocated by no_os_uart_init(). More...
 
uint32_t no_os_uart_get_errors (struct no_os_uart_desc *desc)
 Get number of UART errors. More...
 

Detailed Description

Author
Cristian Pop (crist.nosp@m.ian..nosp@m.pop@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2019(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ no_os_uart_get_errors()

uint32_t no_os_uart_get_errors ( struct no_os_uart_desc desc)

Get number of UART errors.

Check if errors occurred on UART.

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

◆ no_os_uart_init()

int32_t no_os_uart_init ( struct no_os_uart_desc **  desc,
struct no_os_uart_init_param param 
)

Initialize the UART communication peripheral.

Parameters
desc- The UART descriptor.
param- The structure that contains the UART parameters.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_uart_read()

int32_t no_os_uart_read ( struct no_os_uart_desc desc,
uint8_t *  data,
uint32_t  bytes_number 
)

Read data from UART device.

Read data from UART.

Parameters
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_uart_read_nonblocking()

int32_t no_os_uart_read_nonblocking ( struct no_os_uart_desc desc,
uint8_t *  data,
uint32_t  bytes_number 
)

Submit reading buffer to the UART driver.

Read data from UART non-blocking.

Buffer is used until bytes_number bytes are read.

Parameters
descDescriptor of the UART device
dataBuffer where data will be read
bytes_numberNumber of bytes to be read.
Returns
0 in case of success, -1 otherwise.

◆ no_os_uart_remove()

int32_t no_os_uart_remove ( struct no_os_uart_desc desc)

Free the resources allocated by no_os_uart_init().

Parameters
desc- The UART descriptor.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_uart_write()

int32_t no_os_uart_write ( struct no_os_uart_desc desc,
const uint8_t *  data,
uint32_t  bytes_number 
)

Write data to UART device.

Write to UART.

Parameters
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_uart_write_nonblocking()

int32_t no_os_uart_write_nonblocking ( struct no_os_uart_desc desc,
const uint8_t *  data,
uint32_t  bytes_number 
)

Submit writting buffer to the UART driver.

Write to UART non-blocking.

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

Parameters
descDescriptor of the UART device
dataBuffer where data will be written
bytes_numberNumber of bytes to be written.
Returns
0 in case of success, -1 otherwise.