no-OS
Functions | Variables
maxim_uart.c File Reference

Source file of UART driver for STM32. More...

#include <errno.h>
#include <stdlib.h>
#include "maxim_irq.h"
#include "maxim_uart.h"
#include "mxc_sys.h"
#include "mxc_errors.h"
#include "no_os_uart.h"
#include "no_os_irq.h"
#include "no_os_util.h"
#include "no_os_lf256fifo.h"
#include "uart.h"
Include dependency graph for maxim_uart.c:

Functions

void uart_rx_callback (void *context)
 
int32_t no_os_uart_read (struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
 Read data from UART device. Blocking function. 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. Blocking function. More...
 
int32_t no_os_uart_read_nonblocking (struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
 Read data from UART device. Non blocking function. More...
 
int32_t no_os_uart_write_nonblocking (struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
 Write data to UART device. Non blocking function. 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)
 Not implemented. More...
 

Variables

mxc_uart_req_t uart_irq_state [MXC_UART_INSTANCES]
 Descriptors to hold the state of nonblocking read and writes on each port. More...
 
bool is_callback
 

Detailed Description

Source file of UART driver for STM32.

Author
Ciprian Regus (cipri.nosp@m.an.r.nosp@m.egus@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2022(c) Analog Devices, Inc.

All rights reserved.

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

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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)

Not implemented.

Free the resources allocated by no_os_uart_init().

Parameters
desc- The UART descriptor.
Returns
-ENOSYS

◆ 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, errno codes otherwise.

◆ 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. Blocking function.

Read data from UART. Blocking function.

Parameters
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns
positive number of received bytes in case of success, negative error code otherwise.

◆ 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 
)

Read data from UART device. Non blocking function.

Submit reading buffer to the UART driver.

Parameters
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns
positive number of received bytes in case of success, negative error code 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().

Free the resources allocated by no_os_uart_init().

Parameters
desc- The UART descriptor.
Returns
0 in case of success, errno codes otherwise.

◆ 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. Blocking function.

Write data to UART. Blocking function.

Parameters
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns
0 in case of success, errno codes otherwise.

◆ 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 
)

Write data to UART device. Non blocking function.

Submit writting buffer to the UART driver.

Parameters
desc- Instance of UART.
data- Pointer to buffer containing data.
bytes_number- Number of bytes to read.
Returns
0 in case of success, errno codes otherwise.

◆ uart_rx_callback()

void uart_rx_callback ( void *  context)

Variable Documentation

◆ is_callback

bool is_callback

◆ uart_irq_state

mxc_uart_req_t uart_irq_state[MXC_UART_INSTANCES]

Descriptors to hold the state of nonblocking read and writes on each port.