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