RTI Connext Micro  Version 2.4.1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
osapi_config.h
Go to the documentation of this file.
1 /*
2  * FILE: osapi_config.h - OS Configuration
3  *
4  * (c) Copyright, Real-Time Innovations, 2012-2014
5  *
6  * All rights reserved.
7  *
8  * No duplications, whole or partial, manual or electronic, may be made
9  * without express written permission. Any such copies, or
10  * revisions thereof, must display this notice unaltered.
11  * This code contains trade secrets of Real-Time Innovations, Inc.
12  *
13  * Modification History
14  * --------------------
15  * 23apr2013,eh MICRO-106: add RTI_HAVE_LONG_DOUBLE comment
16  * 23feb2012,tk Written
17  *
18  */
19 
20 /*ce \file
21  * \brief OS API Configuration
22  */
23 #ifndef osapi_config_h
24 #define osapi_config_h
25 
26 #define RTI_PRIVATE static
27 
28 /* OSAPI_PLATFORM_XXX
29  * Defines platforms supported by OSAPI.
30  *
31  * The platform includes:
32  * - OS API
33  * - Hardware dependencies
34  *
35  * The platform specific OSAPI should include. Any HW dependencies to support
36  * portable code. Likely candidates are clock/timer support.
37  */
38 #define OSAPI_PLATFORM_POSIX 1
39 #define OSAPI_PLATFORM_STOS 2 /* not currently supported */
40 #define OSAPI_PLATFORM_FREERTOS 3
41 #define OSAPI_PLATFORM_VXWORKS 4
42 #define OSAPI_PLATFORM_WINDOWS 5
43 #define OSAPI_PLATFORM_STELLARIS 6
44 
45 /* The global configuration is read first. Local definitions must
46  * check if the global configuration has set an option or not. Note that
47  * a module cannot disable a feature.
48  */
49 #ifdef HAVE_GLOBAL_CONFIG
50 #include "rti_me_config.h"
51 #endif
52 
53 /*
54  * ENABLE_FACE_COMPLIANCE:
55  * 0 - Do not include changes to compile with a FACE compliant OSS
56  * 1 - Include changes to compile with a FACE compliant OSS. Cirrently this
57  * disables support for multicast
58  */
59 #ifndef ENABLE_FACE_COMPLIANCE
60 #define ENABLE_FACE_COMPLIANCE 0
61 #endif
62 
63 #if defined(__GNUC__) && (__GNUC__ >= 4)
64 #define MUST_CHECK_RETURN __attribute__((warn_unused_result))
65 #define SHOULD_CHECK_RETURN
66 #define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
67 typedef SHOULD_CHECK_RETURN ftdef_;
68 #define FUNCTION_MUST_TYPEDEF(ftdef_) \
69 typedef MUST_CHECK_RETURN ftdef_;
70 #elif defined(_MSC_VER) || defined(WIN32)
71 #include <CodeAnalysis\SourceAnnotations.h>
72 #define MUST_CHECK_RETURN [returnvalue:SA_Post(MustCheck=SA_Yes)]
73 #define SHOULD_CHECK_RETURN
74 #define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
75 typedef ftdef_;
76 #define FUNCTION_MUST_TYPEDEF(ftdef_) \
77 typedef ftdef_;
78 #else
79 #define MUST_CHECK_RETURN
80 #define SHOULD_CHECK_RETURN
81 #define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
82 typedef SHOULD_CHECK_RETURN ftdef_;
83 #define FUNCTION_MUST_TYPEDEF(ftdef_) \
84 typedef MUST_CHECK_RETURN ftdef_;
85 #endif
86 
87 #define UNUSED_ARG(x) (void)(x)
88 
89 /* If the platform has not been specified, attempt to determine it.
90  */
91 #ifndef OSAPI_PLATFORM
92 #if defined(__APPLE__) && defined(__MACH__)
93 #define OSAPI_PLATFORM OSAPI_PLATFORM_POSIX
94 #elif defined(__linux__)
95 #define OSAPI_PLATFORM OSAPI_PLATFORM_POSIX
96 #elif defined(_MSC_VER) || defined(WIN32)
97 #define OSAPI_PLATFORM OSAPI_PLATFORM_WINDOWS
98 #elif defined(__vxworks)
99 #define OSAPI_PLATFORM OSAPI_PLATFORM_VXWORKS
100 #else
101 #error "Unable to determine OSAPI_PLATFORM. Please specify."
102 #endif
103 #endif
104 
105 /* INCLUDE_POSIX
106  *
107  * Set INCLUDE_POSIX is the target platform used the POSIX API. Note that
108  * 100% POSIX compliance is required, it is expected that nuances in the API
109  * is reflected in the POSIX platform files. This is a coarse grained
110  * inclusion.
111  */
112 #if OSAPI_PLATFORM == OSAPI_PLATFORM_POSIX
113 #ifdef _POSIX_C_SOURCE
114 #undef _POSIX_C_SOURCE
115 #endif
116 #define _POSIX_C_SOURCE 200112L
117 
118 #ifdef _XOPEN_SOURCE
119 #undef _XOPEN_SOURCE
120 #endif
121 #define _XOPEN_SOURCE 700
122 
123 #ifndef INCLUDE_POSIX
124 #define INCLUDE_POSIX
125 #endif
126 #if defined(__APPLE__) && defined(__MACH__)
127 #define _DARWIN_C_SOURCE
128 #endif
129 #ifndef RTI_UNIX
130 #define RTI_UNIX
131 #endif
132 #include <stdio.h>
133 #include <stdlib.h>
134 #include <stdarg.h>
135 #include <errno.h>
136 #include <sys/time.h>
137 #include <time.h>
138 #include <sys/types.h>
139 #include <pthread.h>
140 #include <string.h>
141 #define HAVE_SOCKET_API
142 #define RTI_HAVE_FLOAT
143 #if defined(__APPLE__) && defined(__MACH__)
144 #include <malloc/malloc.h>
145 #define HAVE_MEMALIGN 0
146 #define USE_TIMER_GCD
147 #define USE_TIMER_THREAD_SEMAPHORE
148 #ifndef RTI_DARWIN
149 #define RTI_DARWIN
150 #endif /* RTI_DARWIN */
151 #if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
152 #ifdef __LITTLE_ENDIAN__
153 #define RTI_ENDIAN_LITTLE 1
154 #else
155 #define RTI_ENDIAN_BIG 1
156 #endif /* !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE) */
157 #endif
158 /* Linux/GCC */
159 #elif defined(__linux__)
160 #if !ENABLE_FACE_COMPLIANCE
161 #include <malloc.h>
162 #endif
163 #include <time.h>
164 #ifdef __ANDROID__
165 /* NOTE: This is supported in R8D, but missing from the header-file
166  * https://code.google.com/p/android/issues/detail?id=20140
167  */
168 extern int clock_nanosleep(clockid_t clock_id, int flags,
169  const struct timespec *request,
170  struct timespec *remain);
171 #endif
172 
173 /*
174  * Tick generation on Linux can be done via real-time signals, real-time
175  * sleep or sleep. The default is real-time sleep.
176  * NOTE: real-time signals on Arm/Linux has odd behavior.
177  *
178  * To enable real-time signals enable the following macros and comment
179  * out USE_TIMER_THREAD_RT
180  * #define USE_TIMER_SIGNAL
181  * #define USE_TIMER_THREAD_SEMAPHORE
182  */
183 #define USE_TIMER_THREAD_RT
184 
185 #ifndef RTI_LINUX
186 #define RTI_LINUX
187 #endif
188 #if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
189 #if __BYTE_ORDER == __LITTLE_ENDIAN
190 #define RTI_ENDIAN_LITTLE 1
191 #elif __BYTE_ORDER == __BIG_ENDIAN
192 #define RTI_ENDIAN_BIG 1
193 #else
194 #error "Unable to determine endianess. Please specify RTI_ENDIAN_BIG RTI_ENDIAN_LITTLE"
195 #error
196 #endif
197 #endif /* !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE) */
198 /* #define HAVE_RTI_POSIX_SCHED_POLICY */
199 #endif
200 #endif
201 
202 /* Windows */
203 #if OSAPI_PLATFORM == OSAPI_PLATFORM_WINDOWS
204 #include <stdio.h>
205 #include <stdlib.h>
206 #include <stdarg.h>
207 #include <errno.h>
208 #define _WINSOCKAPI_
209 #ifndef RTI_WIN32
210 #define RTI_WIN32
211 #endif
212 #define HAVE_SOCKET_API
213 #define RTI_HAVE_FLOAT
214 #if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
215 #ifdef _M_IX86
216 #define RTI_ENDIAN_LITTLE 1
217 #else
218 #error "Unable to determine endianess. Please specify RTI_ENDIAN_BIG RTI_ENDIAN_LITTLE"
219 #endif
220 #endif
221 #endif
222 
223 /* VxWorks */
224 #if OSAPI_PLATFORM == OSAPI_PLATFORM_VXWORKS
225 #include <stdio.h>
226 #include <stdlib.h>
227 #include <stdarg.h>
228 #include <errno.h>
229 #include <time.h>
230 #ifdef CERT
231 #ifndef RTI_CERT
232 #define RTI_CERT
233 #endif
234 #endif
235 #ifdef RTI_RTP
236 #include <strings.h>
237 #include <string.h>
238 #else
239 #include <string.h>
240 #endif
241 #ifndef RTI_USE_MUNCH
242 #define RTI_USE_MUNCH
243 #endif
244 #ifndef RTI_VXWORKS
245 #define RTI_VXWORKS
246 #endif
247 #include <vxWorks.h>
248 #ifdef RTI_RTP
249 /* #define USE_TIMER_SIGNAL */
250 #define USE_TIMER_THREAD_RT
251 #else
252 #define USE_WD_TIMER
253 #define USE_TIMER_THREAD_SEMAPHORE
254 #include <wdLib.h>
255 #include <logLib.h>
256 #endif
257 #if !defined(va_copy) && defined(__va_copy)
258 #define va_copy __va_copy
259 #elif !defined(va_copy)
260 #error "Unable to determine which va_copy to use"
261 #endif
262 #define HAVE_SOCKET_API
263 #define RTI_HAVE_FLOAT
264 #if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
265 #ifdef __BIG_ENDIAN__
266 #define RTI_ENDIAN_BIG 1
267 #else
268 #define RTI_ENDIAN_LITTLE 1
269 #endif
270 #endif /* !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE) */
271 
272 #define VXWORKS_VERSION_6_8_OR_BETTER \
273  ( ((VXWORKS_MAJOR_VERSION == 6) && (VXWORKS_MINOR_VERSION >= 8)) || \
274  (VXWORKS_MAJOR_VERSION > 6) \
275  )
276 
277 #define VXWORKS_VERSION_6_3_OR_BETTER \
278  ( ((VXWORKS_MAJOR_VERSION == 6) && (VXWORKS_MINOR_VERSION >= 3)) || \
279  (VXWORKS_MAJOR_VERSION > 6) \
280  )
281 
282 #define VXWORKS_VERSION_6_0_OR_BETTER \
283  ( ((VXWORKS_MAJOR_VERSION == 6) && (VXWORKS_MINOR_VERSION >= 0)) || \
284  (VXWORKS_MAJOR_VERSION > 6) \
285  )
286 
287 #define VXWORKS_VERSION_5_4_OR_BETTER \
288  ( ((VXWORKS_MAJOR_VERSION == 5) && (VXWORKS_MINOR_VERSION >= 4)) || \
289  (VXWORKS_MAJOR_VERSION > 5) \
290  )
291 
292 #endif
293 
294 /* Stellaris */
295 #if OSAPI_PLATFORM == OSAPI_PLATFORM_STELLARIS
296 #include <stdio.h>
297 #include <stdlib.h>
298 #include <stdarg.h>
299 #include <errno.h>
300 #define LWIP_NOSYS
301 #define RTI_ENDIAN_LITTLE 1
302 #endif
303 
304 /* FreeRTOS */
305 #if OSAPI_PLATFORM == OSAPI_PLATFORM_FREERTOS
306 #define RTI_FREERTOS
307 #include <stdio.h>
308 #include <stdlib.h>
309 #include <stdarg.h>
310 #include <string.h>
311 #include <errno.h>
312 #ifndef INC_FREERTOS_H
313 #include "FreeRTOS.h"
314 #endif
315 #define HAVE_SOCKET_API
316 #define LWIP_SYS
317 #define RTI_ENDIAN_LITTLE 1
318 #define OSAPI_PLATFORM_FREERTOS_HOSTNAME "FreeRTOS-host"
319 #define TARGET "FreeRTOS-target"
320 #define BUILDABLE_SOURCE
321 #define TARGET "FreeRTOS-target"
322 #define OSAPI_PLATFORM_FREERTOS_STACK_SIZE_DEFAULT 256
323 
324 /* Configuration for FreeRTOS
325  *
326  */
327 
328 #endif
329 
330 
331 /* Some platforms do not support long double or have different sizes for that
332  * type than defined by IDL (16 bytes). On such platforms, DDS_LongDouble
333  * (as well as the unsigned version) is mapped to a character array that
334  * matches the expected size of that type by default. If you are using a
335  * platform whose native mapping has exactly the expected size, you can
336  * instruct Connext Micro to use the native type instead. That is, if
337  * sizeof(long double) == 16, you can tell Connext Micro to map DDS_LongDouble
338  * to long double by defining the following macro, RTI_HAVE_LONG_DOUBLE.
339  */
340 /* #define RTI_HAVE_LONG_DOUBLE */
341 
342 
343 
344 #endif /* osapi_config_h */

RTI Connext Micro Version 2.4.1.0 Copyright © Thu Nov 20 2014 Real-Time Innovations, Inc