Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
#include "serial_port.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <termios.h>
Go to the source code of this file.
Macros | |
#define | B100000 100000 |
some definitions from PPRZ uart driver as we can't include it directly More... | |
#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 |
#define | IUCLC 0 |
#define | TRACE(type, fmt, args...) |
#define | TRACE_ERROR 1 |
Functions | |
static int | uart_speed (int def) |
struct SerialPort * | serial_port_new (void) |
void | serial_port_free (struct SerialPort *me) |
void | serial_port_flush (struct SerialPort *me) |
void | serial_port_flush_output (struct SerialPort *me) |
int | serial_port_open_raw (struct SerialPort *me, const char *device, speed_t speed) |
int | serial_port_open (struct SerialPort *me, const char *device, void(*term_conf_callback)(struct termios *, speed_t *)) |
void | serial_port_close (struct SerialPort *me) |
int | serial_port_set_baudrate (struct SerialPort *me, speed_t speed) |
int | serial_port_set_bits_stop_parity (struct SerialPort *me, const int bits, const int stop, const int parity) |
#define B100000 100000 |
some definitions from PPRZ uart driver as we can't include it directly
Definition at line 25 of file serial_port.c.
Referenced by uart_speed().
#define IUCLC 0 |
Definition at line 67 of file serial_port.c.
Referenced by serial_port_open_raw().
#define TRACE | ( | type, | |
fmt, | |||
args... | |||
) |
Definition at line 71 of file serial_port.c.
Referenced by serial_port_close(), serial_port_flush(), serial_port_flush_output(), serial_port_open(), serial_port_open_raw(), serial_port_set_baudrate(), and serial_port_set_bits_stop_parity().
#define TRACE_ERROR 1 |
Definition at line 72 of file serial_port.c.
Referenced by serial_port_close(), serial_port_flush(), serial_port_flush_output(), serial_port_open(), serial_port_open_raw(), serial_port_set_baudrate(), and serial_port_set_bits_stop_parity().
#define UBITS_7 7 |
Definition at line 49 of file serial_port.c.
Referenced by serial_port_set_bits_stop_parity(), and uart_periph_set_bits_stop_parity().
#define UBITS_8 8 |
Definition at line 50 of file serial_port.c.
Referenced by actuators_sbus_init(), hott_common_init(), and sbus_common_init().
#define UPARITY_EVEN 2 |
Definition at line 57 of file serial_port.c.
Referenced by actuators_sbus_init(), sbus_common_init(), serial_port_set_bits_stop_parity(), and uart_periph_set_bits_stop_parity().
#define UPARITY_NO 0 |
Definition at line 55 of file serial_port.c.
Referenced by hott_common_init().
#define UPARITY_ODD 1 |
Definition at line 56 of file serial_port.c.
Referenced by serial_port_set_bits_stop_parity(), and uart_periph_set_bits_stop_parity().
#define USTOP_1 1 |
Definition at line 52 of file serial_port.c.
Referenced by hott_common_init(), and serial_port_set_bits_stop_parity().
#define USTOP_2 2 |
Definition at line 53 of file serial_port.c.
Referenced by actuators_sbus_init(), sbus_common_init(), and uart_periph_set_bits_stop_parity().
void serial_port_close | ( | struct SerialPort * | me | ) |
Definition at line 181 of file serial_port.c.
References SerialPort::fd, SerialPort::orig_termios, TRACE, and TRACE_ERROR.
Referenced by uart_periph_open().
void serial_port_flush | ( | struct SerialPort * | me | ) |
Definition at line 89 of file serial_port.c.
References SerialPort::fd, TRACE, and TRACE_ERROR.
Referenced by serial_port_open(), and serial_port_open_raw().
void serial_port_flush_output | ( | struct SerialPort * | me | ) |
Definition at line 100 of file serial_port.c.
References SerialPort::fd, TRACE, and TRACE_ERROR.
void serial_port_free | ( | struct SerialPort * | me | ) |
Definition at line 80 of file serial_port.c.
Referenced by uart_periph_open().
struct SerialPort* serial_port_new | ( | void | ) |
Definition at line 74 of file serial_port.c.
Referenced by uart_periph_open().
int serial_port_open | ( | struct SerialPort * | me, |
const char * | device, | ||
void(*)(struct termios *, speed_t *) | term_conf_callback | ||
) |
Definition at line 150 of file serial_port.c.
References SerialPort::cur_termios, SerialPort::fd, SerialPort::orig_termios, serial_port_flush(), TRACE, and TRACE_ERROR.
int serial_port_open_raw | ( | struct SerialPort * | me, |
const char * | device, | ||
speed_t | speed | ||
) |
Definition at line 111 of file serial_port.c.
References SerialPort::cur_termios, SerialPort::fd, IUCLC, SerialPort::orig_termios, serial_port_flush(), TRACE, and TRACE_ERROR.
Referenced by uart_periph_open().
int serial_port_set_baudrate | ( | struct SerialPort * | me, |
speed_t | speed | ||
) |
Definition at line 207 of file serial_port.c.
References SerialPort::cur_termios, SerialPort::fd, TRACE, and TRACE_ERROR.
Referenced by uart_periph_set_baudrate().
int serial_port_set_bits_stop_parity | ( | struct SerialPort * | me, |
const int | bits, | ||
const int | stop, | ||
const int | parity | ||
) |
Definition at line 221 of file serial_port.c.
References SerialPort::cur_termios, SerialPort::fd, TRACE, TRACE_ERROR, UBITS_7, UPARITY_EVEN, UPARITY_ODD, and USTOP_1.
Referenced by uart_periph_set_bits_stop_parity().