Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
arch independent UART (Universal Asynchronous Receiver/Transmitter) API More...
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_put_byte (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) |
uint16_t | uart_char_available (struct uart_periph *p) |
Check UART for available chars in receive buffer. More... | |
void | uart_arch_init (void) |
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
Definition in file uart.h.
struct uart_periph |
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 |
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 | |
uint8_t | tx_running |
#define UBITS_7 7 |
Definition at line 47 of file uart.h.
Referenced by uart_periph_set_bits_stop_parity().
#define UBITS_8 8 |
Definition at line 48 of file uart.h.
Referenced by sbus_common_init().
#define UPARITY_EVEN 2 |
Definition at line 55 of file uart.h.
Referenced by sbus_common_init(), and uart_periph_set_bits_stop_parity().
#define UPARITY_ODD 1 |
Definition at line 54 of file uart.h.
Referenced by uart_periph_set_bits_stop_parity().
#define USTOP_2 2 |
Definition at line 51 of file uart.h.
Referenced by sbus_common_init(), and uart_periph_set_bits_stop_parity().
void uart_arch_init | ( | void | ) |
Definition at line 54 of file uart_arch.c.
References uart_thread().
Referenced by mcu_init().
uint16_t uart_char_available | ( | struct uart_periph * | p | ) |
Check UART for available chars in receive buffer.
Definition at line 296 of file uart_arch.c.
References uart_periph::rx_extract_idx, uart_periph::rx_insert_idx, and UART_RX_BUFFER_SIZE.
Referenced by gps_piksi_event(), gps_piksi_read(), high_speed_logger_direct_memory_periodic(), hott_check_serial_data(), hott_send_telemetry_data(), imu_um6_event(), ImuEvent(), ReadGX3Buffer(), sbus_common_decode_event(), tunnel_event(), uart_periph_init(), vn200_event(), and vn200_read_buffer().
bool_t uart_check_free_space | ( | struct uart_periph * | p, |
uint8_t | len | ||
) |
Definition at line 256 of file uart.c.
References uart_periph::tx_extract_idx, uart_periph::tx_insert_idx, and UART_TX_BUFFER_SIZE.
Referenced by sdlogger_spi_direct_periodic(), send_buffer_to_uart(), tunnel_event(), and uart_periph_init().
uint8_t uart_getch | ( | struct uart_periph * | p | ) |
Definition at line 287 of file uart_arch.c.
References uart_periph::rx_buf, uart_periph::rx_extract_idx, and UART_RX_BUFFER_SIZE.
Referenced by gps_piksi_read(), high_speed_logger_direct_memory_periodic(), hott_check_serial_data(), hott_send_telemetry_data(), imu_um6_event(), ReadGX3Buffer(), sbus_common_decode_event(), tunnel_event(), uart_periph_init(), and vn200_read_buffer().
void uart_periph_init | ( | struct uart_periph * | p | ) |
Definition at line 233 of file uart.c.
References link_device::char_available, link_device::check_free_space, DefaultPeriodic, uart_periph::device, FALSE, uart_periph::fe_err, link_device::get_byte, uart_periph::ne_err, null_function(), uart_periph::ore, link_device::periph, link_device::put_byte, register_periodic_telemetry(), uart_periph::rx_extract_idx, uart_periph::rx_insert_idx, link_device::send_message, uart_periph::tx_extract_idx, uart_periph::tx_insert_idx, uart_periph::tx_running, uart_char_available(), uart_check_free_space(), uart_getch(), and uart_put_byte().
Referenced by high_speed_logger_direct_memory_init().
void uart_periph_set_baudrate | ( | struct uart_periph * | p, |
uint32_t | baud | ||
) |
Definition at line 216 of file uart_arch.c.
References uart_periph::baudrate, uart_periph::dev, 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 gps_ubx_ucenter_autobaud(), gps_ubx_ucenter_configure(), sbus_common_init(), and xbee_init().
void uart_periph_set_bits_stop_parity | ( | struct uart_periph * | p, |
uint8_t | bits, | ||
uint8_t | stop, | ||
uint8_t | parity | ||
) |
Definition at line 77 of file uart_arch.c.
References uart_periph::reg_addr, UBITS_7, UPARITY_EVEN, UPARITY_ODD, and USTOP_2.
Referenced by high_speed_logger_direct_memory_init(), and sbus_common_init().
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 92 of file uart_arch.c.
References uart_periph::reg_addr.
Referenced by hott_enable_receiver(), and hott_enable_transmitter().
void uart_put_byte | ( | struct uart_periph * | p, |
uint8_t | data | ||
) |
Definition at line 243 of file uart_arch.c.
References disableIRQ(), SerialPort::fd, 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_gx3_align(), direct_memory_logger_periodic(), drop_ball(), gps_piksi_write(), hott_send_telemetry_data(), imu_impl_init(), sdlogger_spi_direct_periodic(), send_buffer_to_uart(), tunnel_event(), uart_periph_init(), and UM6_send_packet().