Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
uart.h File Reference

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

#include "mcu_periph/uart_arch.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   128
 
#define UART_TX_BUFFER_SIZE   128
 
#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_t tx_enabled, bool_t rx_enabled, bool_t hw_flow_control)
 
void uart_transmit (struct uart_periph *p, uint8_t data)
 
bool_t uart_check_free_space (struct uart_periph *p, uint8_t len)
 
uint8_t uart_getch (struct uart_periph *p)
 
static uint16_t uart_char_available (struct uart_periph *p)
 Check UART for available chars in receive buffer. More...
 

Detailed Description

arch independent UART (Universal Asynchronous Receiver/Transmitter) API

Definition in file uart.h.

Macro Definition Documentation

#define UART_DEV_NAME_SIZE   16

Definition at line 36 of file uart.h.

#define UART_RX_BUFFER_SIZE   128

Definition at line 34 of file uart.h.

Referenced by uart_char_available(), uart_getch(), uart_handler(), uart_ISR(), and usart_isr().

#define UART_TX_BUFFER_SIZE   128

Definition at line 35 of file uart.h.

Referenced by uart_check_free_space(), uart_handler(), uart_ISR(), uart_transmit(), and usart_isr().

#define UBITS_7   7

Definition at line 42 of file uart.h.

Referenced by uart_periph_set_bits_stop_parity().

#define UBITS_8   8

Definition at line 43 of file uart.h.

Referenced by sbus_common_init().

#define UPARITY_EVEN   2

Definition at line 50 of file uart.h.

Referenced by sbus_common_init(), and uart_periph_set_bits_stop_parity().

#define UPARITY_NO   0

Definition at line 48 of file uart.h.

#define UPARITY_ODD   1

Definition at line 49 of file uart.h.

Referenced by uart_periph_set_bits_stop_parity().

#define USTOP_1   1

Definition at line 45 of file uart.h.

#define USTOP_2   2

Definition at line 46 of file uart.h.

Referenced by sbus_common_init(), and uart_periph_set_bits_stop_parity().

Function Documentation

static uint16_t uart_char_available ( struct uart_periph p)
inlinestatic

Check UART for available chars in receive buffer.

Returns
number of chars in the buffer

Definition at line 87 of file uart.h.

References uart_periph::rx_extract_idx, uart_periph::rx_insert_idx, and UART_RX_BUFFER_SIZE.

Referenced by hott_check_serial_data(), hott_send_telemetry_data(), ImuEvent(), main(), ReadGX3Buffer(), and sbus_common_decode_event().

+ Here is the caller graph for this function:

bool_t uart_check_free_space ( struct uart_periph p,
uint8_t  len 
)

Definition at line 197 of file uart.c.

References uart_periph::tx_extract_idx, uart_periph::tx_insert_idx, and UART_TX_BUFFER_SIZE.

Referenced by main().

+ Here is the caller graph for this function:

uint8_t uart_getch ( struct uart_periph p)

Definition at line 204 of file uart.c.

References uart_periph::rx_buf, uart_periph::rx_extract_idx, and UART_RX_BUFFER_SIZE.

Referenced by hott_check_serial_data(), hott_send_telemetry_data(), main(), ReadGX3Buffer(), and sbus_common_decode_event().

+ Here is the caller graph for this function:

void uart_periph_set_baudrate ( struct uart_periph p,
uint32_t  baud 
)

Definition at line 65 of file uart_arch.c.

References uart_periph::dev, port, uart_periph::reg_addr, serial_port_close(), serial_port_free(), serial_port_new(), serial_port_open_raw(), TRACE, uart_disable_interrupts(), uart_enable_interrupts(), and uart_set_baudrate().

Referenced by sbus_common_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 71 of file uart_arch.c.

References uart_periph::reg_addr, UBITS_7, UPARITY_EVEN, UPARITY_ODD, and USTOP_2.

Referenced by sbus_common_init().

+ Here is the caller graph for this function:

void uart_periph_set_mode ( struct uart_periph p,
bool_t  tx_enabled,
bool_t  rx_enabled,
bool_t  hw_flow_control 
)

Definition at line 88 of file uart_arch.c.

References uart_periph::reg_addr.

Referenced by hott_enable_receiver(), and hott_enable_transmitter().

+ Here is the caller graph for this function:

void uart_transmit ( struct uart_periph p,
uint8_t  data 
)

Definition at line 75 of file uart_arch.c.

References disableIRQ(), SerialPort::fd, port, uart_periph::reg_addr, restoreIRQ(), TRACE, TRUE, uart_periph::tx_buf, uart_periph::tx_extract_idx, uart_periph::tx_insert_idx, uart_periph::tx_running, UART_TX_BUFFER_SIZE, and UIER_ETBEI.

Referenced by ahrs_align(), hott_send_telemetry_data(), imu_impl_init(), and main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: