Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
datalink.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2005 Pascal Brisset, Antoine Drouin
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
29 #ifndef DATALINK_H
30 #define DATALINK_H
31 
32 #ifdef DATALINK_C
33 #define EXTERN
34 #else
35 #define EXTERN extern
36 #endif
37 
38 #ifdef __IEEE_BIG_ENDIAN /* From machine/ieeefp.h */
39 #define Swap32IfBigEndian(_u) { _u = (_u << 32) | (_u >> 32); }
40 #else
41 #define Swap32IfBigEndian(_) {}
42 #endif
43 
44 #include "std.h"
45 #include "dl_protocol.h"
46 
48 #define PPRZ 1
49 #define XBEE 2
50 
55 
56 #define MSG_SIZE 128
57 EXTERN uint8_t dl_buffer[MSG_SIZE] __attribute__ ((aligned));
58 
59 EXTERN void dl_parse_msg(void);
63 #define DlCheckAndParse() { \
64  if (dl_msg_available) { \
65  dl_parse_msg(); \
66  dl_msg_available = FALSE; \
67  } \
68 }
69 
70 #if DATALINK == PPRZ
71 
72 #define DatalinkEvent() { \
73  PprzCheckAndParse(PPRZ_UART, pprz_tp); \
74  DlCheckAndParse(); \
75 }
76 
77 #elif DATALINK == XBEE
78 
79 #define DatalinkEvent() { \
80  XBeeCheckAndParse(XBEE_UART, xbee_tp); \
81  DlCheckAndParse(); \
82 }
83 
84 #else
85 
86 // Unknown DATALINK
87 #define DatalinkEvent() {}
88 
89 #endif /* DATALINK == */
90 
91 #endif /* DATALINK_H */
unsigned short uint16_t
Definition: types.h:16
unsigned char uint8_t
Definition: types.h:14