Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
uart_arch.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Antoine Drouin <poinix@gmail.com>
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
26 #ifndef UART_ARCH_H
27 #define UART_ARCH_H
28 
29 // higher default uart buffer sizes on linux
30 #ifndef UART_RX_BUFFER_SIZE
31 #define UART_RX_BUFFER_SIZE 512
32 #endif
33 #ifndef UART_TX_BUFFER_SIZE
34 #define UART_TX_BUFFER_SIZE 512
35 #endif
36 
37 #include "mcu_periph/uart.h"
38 
39 // for definition of baud rates
40 #include <termios.h>
41 
42 // for conversion between linux baud rate definition and actual speed
43 static inline int uart_speed(int def)
44 {
45  switch (def) {
46  case B1200: return 1200;
47  case B2400: return 2400;
48  case B4800: return 4800;
49  case B9600: return 9600;
50  case B19200: return 19200;
51  case B38400: return 38400;
52  case B57600: return 57600;
53  case B115200: return 115200;
54  case B230400: return 230400;
55 #ifdef B921600
56  case B921600: return 921600;
57 #endif
58  default: return 9600;
59  }
60 }
61 #define UART_SPEED(_def) uart_speed(_def)
62 
63 #endif /* UART_ARCH_H */
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define B9600
Definition: uart_arch.h:40
#define B115200
Definition: uart_arch.h:45
#define B38400
Definition: uart_arch.h:42
#define B57600
Definition: uart_arch.h:43
#define B19200
Definition: uart_arch.h:41
static int uart_speed(int def)
Definition: uart_arch.h:43
#define B1200
Definition: uart_arch.h:37
#define B921600
Definition: uart_arch.h:42
#define B230400
Definition: uart_arch.h:46
#define B4800
Definition: uart_arch.h:39
#define B2400
Definition: uart_arch.h:38