Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
uart.h File Reference

arch independent UART (Universal Asynchronous Receiver/Transmitter) API More...

#include "mcu_periph/uart_arch.h"
#include "pprzlink/pprzlink_device.h"
#include "std.h"
Include dependency graph for uart.h:

Go to the source code of this file.

Data Structures

struct  uart_periph
 UART peripheral. More...

Macros

#define UART_RX_BUFFER_SIZE   256
#define UART_TX_BUFFER_SIZE   256
#define UART_DEV_NAME_SIZE   16
#define UBITS_7   7
#define UBITS_8   8
#define USTOP_1   1
#define USTOP_2   2
#define UPARITY_NO   0
#define UPARITY_ODD   1
#define UPARITY_EVEN   2

Functions

void uart_periph_init (struct uart_periph *p)
void uart_periph_set_baudrate (struct uart_periph *p, uint32_t baud)
void uart_periph_set_bits_stop_parity (struct uart_periph *p, uint8_t bits, uint8_t stop, uint8_t parity)
void uart_periph_set_mode (struct uart_periph *p, bool tx_enabled, bool rx_enabled, bool hw_flow_control)
void uart_periph_invert_data_logic (struct uart_periph *p, bool invert_rx, bool invert_tx)
void uart_put_byte (struct uart_periph *p, long fd, uint8_t data)
void uart_put_buffer (struct uart_periph *p, long fd, const uint8_t *data, uint16_t len)
int uart_check_free_space (struct uart_periph *p, long *fd, uint16_t len)
void uart_send_message (struct uart_periph *p, long fd)
uint8_t uart_getch (struct uart_periph *p)
int uart_char_available (struct uart_periph *p)
 Check UART for available chars in receive buffer.
void uart_arch_init (void)

Detailed Description

arch independent UART (Universal Asynchronous Receiver/Transmitter) API

Definition in file uart.h.


Data Structure Documentation

◆ uart_periph

struct uart_periph

UART peripheral.

Definition at line 72 of file uart.h.

Data Fields
int baudrate UART Baudrate.
char dev[UART_DEV_NAME_SIZE] UART Dev (linux).
struct link_device device Generic device interface.
volatile uint16_t fe_err framing error counter
void * init_struct User init struct.
volatile uint16_t ne_err noise error counter
volatile uint16_t ore overrun error counter
void * reg_addr UART Register.
uint8_t rx_buf[UART_RX_BUFFER_SIZE] Receive buffer.
uint16_t rx_extract_idx
uint16_t rx_insert_idx
uint8_t tx_buf[UART_TX_BUFFER_SIZE] Transmit buffer.
uint16_t tx_extract_idx
uint16_t tx_insert_idx
volatile uint8_t tx_running

Macro Definition Documentation

◆ UART_DEV_NAME_SIZE

#define UART_DEV_NAME_SIZE   16

Definition at line 53 of file uart.h.

◆ UART_RX_BUFFER_SIZE

#define UART_RX_BUFFER_SIZE   256

Definition at line 40 of file uart.h.

◆ UART_TX_BUFFER_SIZE

#define UART_TX_BUFFER_SIZE   256

Definition at line 49 of file uart.h.

◆ UBITS_7

#define UBITS_7   7

Definition at line 59 of file uart.h.

◆ UBITS_8

#define UBITS_8   8

Definition at line 60 of file uart.h.

◆ UPARITY_EVEN

#define UPARITY_EVEN   2

Definition at line 67 of file uart.h.

◆ UPARITY_NO

#define UPARITY_NO   0

Definition at line 65 of file uart.h.

◆ UPARITY_ODD

#define UPARITY_ODD   1

Definition at line 66 of file uart.h.

◆ USTOP_1

#define USTOP_1   1

Definition at line 62 of file uart.h.

◆ USTOP_2

#define USTOP_2   2

Definition at line 63 of file uart.h.

Function Documentation

◆ uart_arch_init()

void uart_arch_init ( void )
extern

Definition at line 54 of file uart_arch.c.

References uart_mutex, and uart_thread().

Referenced by mcu_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart_char_available()

◆ uart_check_free_space()

int uart_check_free_space ( struct uart_periph * p,
long * fd,
uint16_t len )
extern

Definition at line 151 of file uart.c.

References fd, p, and UART_TX_BUFFER_SIZE.

Referenced by uart_periph_init().

Here is the caller graph for this function:

◆ uart_getch()

◆ uart_periph_init()

void uart_periph_init ( struct uart_periph * p)
extern

◆ uart_periph_invert_data_logic()

void uart_periph_invert_data_logic ( struct uart_periph * p,
bool invert_rx,
bool invert_tx )
extern

Definition at line 194 of file uart.c.

References p.

Referenced by actuators_sbus_init(), and sbus_common_init().

Here is the caller graph for this function:

◆ uart_periph_set_baudrate()

void uart_periph_set_baudrate ( struct uart_periph * p,
uint32_t baud )
extern

◆ uart_periph_set_bits_stop_parity()

void uart_periph_set_bits_stop_parity ( struct uart_periph * p,
uint8_t bits,
uint8_t stop,
uint8_t parity )
extern

Definition at line 296 of file uart_arch.c.

References uart_periph::reg_addr, and serial_port_set_bits_stop_parity().

Referenced by actuators_sbus_init(), hott_common_init(), and sbus_common_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart_periph_set_mode()

void uart_periph_set_mode ( struct uart_periph * p,
bool tx_enabled,
bool rx_enabled,
bool hw_flow_control )
extern

References fd, and p.

Referenced by hott_enable_receiver(), and hott_enable_transmitter().

Here is the caller graph for this function:

◆ uart_put_buffer()

void uart_put_buffer ( struct uart_periph * p,
long fd,
const uint8_t * data,
uint16_t len )
extern

Definition at line 161 of file uart.c.

References fd, p, and uart_put_byte().

Referenced by actuators_ostrich_periodic(), if(), nmea_send(), pdec_send_frame(), send_message(), sts3032_event(), and uart_periph_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart_put_byte()

void uart_put_byte ( struct uart_periph * p,
long fd,
uint8_t data )
extern

◆ uart_send_message()

void uart_send_message ( struct uart_periph * p,
long fd )
extern

Definition at line 170 of file uart.c.

References fd, and p.

Referenced by faulhaber_send_command(), and uart_periph_init().

Here is the caller graph for this function: