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_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 #include "mcu_periph/uart.h"
30 
31 // for definition of baud rates
32 #include <termios.h>
33 
34 // for conversion between linux baud rate definition and actual speed
35 static inline int uart_speed(int def) {
36  switch (def) {
37  case B1200: return 1200;
38  case B2400: return 2400;
39  case B4800: return 4800;
40  case B9600: return 9600;
41  case B19200: return 19200;
42  case B38400: return 38400;
43  case B57600: return 57600;
44  case B115200: return 115200;
45  case B230400: return 230400;
46  case B921600: return 921600;
47  default: return 9600;
48  }
49 }
50 #define UART_SPEED(_def) uart_speed(_def)
51 
52 #define UART1_irq_handler usart1_irq_handler
53 #define UART2_irq_handler usart2_irq_handler
54 #define UART3_irq_handler usart3_irq_handler
55 #define UART5_irq_handler usart5_irq_handler
56 
57 #if USE_UART0
58 extern void uart0_handler(void);
59 #endif
60 
61 #if USE_UART1
62 extern void uart1_handler(void);
63 #endif
64 
65 #endif /* UART_ARCH_H */
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static int uart_speed(int def)
Definition: uart_arch.h:35
#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
#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