Cync
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VP_SDK / VP_Os / vp_os_types.h
1 /**
2  *  \brief    VP OS. Types declaration.
3  *  \brief    These types are used to provide clean types declaration for portability between OSes
4  *  \author   Sylvain Gaeremynck <sylvain.gaeremynck@parrot.fr>
5  *  \version  1.0
6  *  \date     first release 19/12/2006
7  *  \date     modification  26/03/2007
8  */
9
10 #ifndef _VP_SDK_TYPES_H_
11 #define _VP_SDK_TYPES_H_
12
13 #include <stdint.h>
14 #include <VP_Os/vp_os.h>
15
16 #if defined(USE_LINUX) || defined(__ELINUX__)
17 # include "vp_os_serial.h"
18 #endif // USE_LINUX
19
20 #define C_RESULT        int
21 #define C_OK            0
22 #define C_FAIL          -1
23
24 #define VP_SUCCESS         (0)
25 #define VP_FAILURE            (!VP_SUCCESS)
26
27 #define VP_SUCCEEDED(a) (((a) & 0xffff) == VP_SUCCESS)
28 #define VP_FAILED(a)    (((a) & 0xffff) != VP_SUCCESS)
29
30 #ifndef _WIN32
31         /* 
32         Those macros have been used in the SDK but are already defined in Windows.h
33         and thus used with a wrong value when compiling under Windows, leading to a crash.
34         VP_xxx macros should be used to avoid confusion. 
35         */
36         #define SUCCESS VP_SUCCESS
37         #define FAIL VP_FAILURE
38
39         #define SUCCEED VP_SUCCEEDED
40         #define FAILED VP_FAILED        
41 #endif
42
43 #ifdef USE_MINGW32
44 #include <windows.h>
45 #include <windef.h>
46 //typedef unsigned __int64 off64_t;
47 #endif
48
49 #if defined(_WIN32) || defined(USE_MINGW32)
50
51 // Definition des types entiers
52 typedef signed    __int8    int8_t;
53 typedef unsigned  __int8    uint8_t;
54 typedef signed    __int16   int16_t;
55 typedef unsigned  __int16   uint16_t;
56 typedef signed    __int32   int32_t;
57 typedef unsigned  __int32   uint32_t;
58 typedef signed    __int64   int64_t;
59 typedef unsigned  __int64   uint64_t;
60
61 #endif // < _WIN32
62
63 #if defined(__NDS__) || defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
64
65 #ifdef __NDS__
66 #include <nds.h>
67 #endif // ! __NDS__
68
69 #ifndef NULL
70 #define NULL (void*)0
71 #endif
72
73 #endif // < __NDS__ || TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
74
75 typedef float               float32_t;
76 typedef double              float64_t;
77
78 #if defined(__linux__) && !defined(USE_MINGW32)
79 #include <stdint.h>
80 #include <stddef.h>
81
82 #define CBOOL int
83
84 #endif // < __linux__
85
86 #if defined(USE_ANDROID)
87
88 #include <time.h>
89 #undef __FD_ZERO
90 #define __FD_ZERO(fdsetp)   (vp_os_memset (fdsetp, 0, sizeof (*(fd_set *)(fdsetp))))
91 #undef FD_ZERO
92 #define FD_ZERO(fdsetp) __FD_ZERO(fdsetp)
93
94 #endif
95
96 #define bool_t  int32_t
97
98 #if defined(USE_PARROTOS_CORE)
99 #include <generic/parrotOS_types.h>
100 #define TYPEDEF_BOOL
101 #endif
102
103 #if !defined(USE_MINGW32)
104
105 #ifndef TRUE
106 #define TRUE    1
107 #endif
108
109 #ifndef FALSE
110 #define FALSE   0
111 #endif
112
113 #endif // < USE_MINGW32
114
115 #if !defined(USE_ANDROID)
116 typedef volatile uint8_t    vuint8;
117 typedef volatile uint16_t   vuint16;
118 typedef volatile uint32_t   vuint32;
119 typedef volatile uint64_t   vuint64;
120
121 typedef volatile int8_t     vint8;
122 typedef volatile int16_t    vint16;
123 typedef volatile int32_t    vint32;
124 typedef volatile int64_t    vint64;
125
126 #ifndef INT_MAX
127 #define INT_MAX 2147483647
128 #endif // ! INT_MAX
129
130 #endif // !USE_ANDROID
131
132 #ifdef __linux__
133 #    include <VP_Os/linux/intrin.h>
134 #endif
135
136 #define BDADDR_SIZE   6
137
138 #if !defined(__BLUETOOTH_H)
139 typedef struct _bdaddr_t
140 {
141   uint8_t b[BDADDR_SIZE];
142 } bdaddr_t;
143 #endif // !defined(__BLUETOOTH_H)
144
145 typedef C_RESULT (*Read)  (void* s, int8_t* buffer, int32_t* size);
146 typedef C_RESULT (*Write) (void* s, const int8_t* buffer, int32_t* size);
147
148 #endif // _TYPES_H_