RTI Connext Micro
Version 2.4.4.0
Main Page
Related Pages
Manuals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
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-2015
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 - No compliance with FACE is required
56
* 1 - Comply with the SECURITY profile (not supported)
57
* 2 - Comply with the SAFTEY_BASE profile (not supported)
58
* 3 - Comply with the SAFETY_EXTENDED profile (supported)
59
* 4 - Comply with the GENERAL profile (supported)
60
*/
61
#define FACE_COMPLIANCE_LEVEL_NONE 0
62
#define FACE_COMPLIANCE_LEVEL_SECURITY 1
63
#define FACE_COMPLIANCE_LEVEL_SAFETY_BASE 2
64
#define FACE_COMPLIANCE_LEVEL_SAFETY_EXTENDED 3
65
#define FACE_COMPLIANCE_LEVEL_GENERAL 4
66
67
#ifndef ENABLE_FACE_COMPLIANCE
68
#define ENABLE_FACE_COMPLIANCE FACE_COMPLIANCE_LEVEL_NONE
69
#endif
70
71
#if (ENABLE_FACE_COMPLIANCE > FACE_COMPLIANCE_LEVEL_NONE) && \
72
(ENABLE_FACE_COMPLIANCE < FACE_COMPLIANCE_LEVEL_SAFTEY_EXTENDED)
73
#error "RTI Connext Micro only support FACE profile Safety Extended and higher"
74
#endif
75
76
#ifndef OSAPI_ENABLE_LOG
77
#if NDEBUG && defined(RTI_CERT)
78
#define OSAPI_ENABLE_LOG 0
79
#else
80
#define OSAPI_ENABLE_LOG 1
81
#endif
82
#endif
83
84
#ifndef OSAPI_ENABLE_TRACE
85
#if NDEBUG || defined(RTI_CERT)
86
#define OSAPI_ENABLE_TRACE 0
87
#else
88
#define OSAPI_ENABLE_TRACE 1
89
#endif
90
#endif
91
92
#if OSAPI_ENABLE_TRACE && !OSAPI_ENABLE_LOG
93
#warning "OSAPI_ENABLE_TRACE=1 requires OSAPI_ENABLE_LOG=1, but OSAPI_ENABLE_LOG=0. Forcing OSAPI_ENABLE_LOG=1"
94
#ifdef OSAPI_ENABLE_LOG
95
#undef OSAPI_ENABLE_LOG
96
#endif
97
#define OSAPI_ENABLE_LOG 1
98
#endif
99
100
#ifndef OSAPI_ENABLE_PRECONDITION
101
#if NDEBUG || defined(RTI_CERT)
102
#define OSAPI_ENABLE_PRECONDITION 0
103
#else
104
#define OSAPI_ENABLE_PRECONDITION 1
105
#endif
106
#endif
107
108
#if OSAPI_ENABLE_PRECONDITION
109
#define PRECOND_ARG(x_)
110
#else
111
#define PRECOND_ARG(x_) (void)(x_);
112
#endif
113
114
#if defined(__GNUC__) && (__GNUC__ >= 4)
115
#define MUST_CHECK_RETURN __attribute__((warn_unused_result))
116
#define SHOULD_CHECK_RETURN
117
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
118
typedef SHOULD_CHECK_RETURN ftdef_;
119
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
120
typedef MUST_CHECK_RETURN ftdef_;
121
#elif defined(_MSC_VER) || defined(WIN32)
122
#include <CodeAnalysis\SourceAnnotations.h>
123
#define MUST_CHECK_RETURN [returnvalue:SA_Post(MustCheck=SA_Yes)]
124
#define SHOULD_CHECK_RETURN
125
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
126
typedef ftdef_;
127
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
128
typedef ftdef_;
129
#else
130
#define MUST_CHECK_RETURN
131
#define SHOULD_CHECK_RETURN
132
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
133
typedef SHOULD_CHECK_RETURN ftdef_;
134
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
135
typedef MUST_CHECK_RETURN ftdef_;
136
#endif
137
138
#define UNUSED_ARG(x) (void)(x)
139
#define IGNORE_RETVAL(x) (void)(x)
140
141
/* If the platform has not been specified, attempt to determine it.
142
*/
143
#ifndef OSAPI_PLATFORM
144
#if defined(__APPLE__) && defined(__MACH__)
145
#define OSAPI_PLATFORM OSAPI_PLATFORM_POSIX
146
#define OSAPI_HAVE_PRINTF 1
147
#elif defined(__linux__)
148
#define OSAPI_PLATFORM OSAPI_PLATFORM_POSIX
149
#define OSAPI_HAVE_PRINTF 1
150
#elif defined(_MSC_VER) || defined(WIN32)
151
#define OSAPI_PLATFORM OSAPI_PLATFORM_WINDOWS
152
#define OSAPI_HAVE_PRINTF_S 1
153
#elif defined(__vxworks)
154
#define OSAPI_HAVE_PRINTF 1
155
#define OSAPI_PLATFORM OSAPI_PLATFORM_VXWORKS
156
#else
157
#error "Unable to determine OSAPI_PLATFORM. Please specify."
158
#endif
159
#endif
160
161
/* INCLUDE_POSIX
162
*
163
* Set INCLUDE_POSIX is the target platform used the POSIX API. Note that
164
* 100% POSIX compliance is required, it is expected that nuances in the API
165
* is reflected in the POSIX platform files. This is a coarse grained
166
* inclusion.
167
*/
168
#if OSAPI_PLATFORM == OSAPI_PLATFORM_POSIX
169
170
#if ENABLE_FACE_COMPLIANCE > FACE_COMPLIANCE_LEVEL_NONE
171
#if OSAPI_HAVE_PRINTF
172
#undef OSAPI_HAVE_PRINTF
173
#define OSAPI_HAVE_PRINTF 0
174
#endif
175
#endif
176
177
#ifdef _POSIX_C_SOURCE
178
#undef _POSIX_C_SOURCE
179
#endif
180
#define _POSIX_C_SOURCE 200112L
181
182
#ifdef _XOPEN_SOURCE
183
#undef _XOPEN_SOURCE
184
#endif
185
#define _XOPEN_SOURCE 700
186
187
#ifndef INCLUDE_POSIX
188
#define INCLUDE_POSIX
189
#endif
190
#if defined(__APPLE__) && defined(__MACH__)
191
#define _DARWIN_C_SOURCE
192
#endif
193
#ifndef RTI_UNIX
194
#define RTI_UNIX
195
#endif
196
#include <stdio.h>
197
#include <stdlib.h>
198
#include <stdarg.h>
199
#include <errno.h>
200
#include <sys/time.h>
201
#include <time.h>
202
#include <sys/types.h>
203
#include <pthread.h>
204
#include <string.h>
205
#define HAVE_SOCKET_API
206
#define RTI_HAVE_FLOAT
207
#if defined(__APPLE__) && defined(__MACH__)
208
#include <malloc/malloc.h>
209
#define HAVE_MEMALIGN 0
210
#if ENABLE_FACE_COMPLIANCE > FACE_COMPLIANCE_LEVEL_NONE
211
#error "FACE compliance is not supported in Darwin"
212
#endif
213
#define USE_TIMER_GCD
214
#define USE_TIMER_THREAD_SEMAPHORE
215
#ifndef RTI_DARWIN
216
#define RTI_DARWIN
217
#endif
/* RTI_DARWIN */
218
#if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
219
#ifdef __LITTLE_ENDIAN__
220
#define RTI_ENDIAN_LITTLE 1
221
#else
222
#define RTI_ENDIAN_BIG 1
223
#endif
/* !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE) */
224
#endif
225
/* Linux/GCC */
226
#elif defined(__linux__)
227
#if ENABLE_FACE_COMPLIANCE == FACE_COMPLIANCE_LEVEL_NONE
228
#include <malloc.h>
229
#endif
230
#include <time.h>
231
232
#if ENABLE_FACE_COMPLIANCE == FACE_COMPLIANCE_LEVEL_NONE
233
#ifdef __ANDROID__
234
/* NOTE: This is supported in R8D, but missing from the header-file
235
* https://code.google.com/p/android/issues/detail?id=20140
236
*/
237
extern
int
clock_nanosleep(clockid_t clock_id,
int
flags,
238
const
struct
timespec *request,
239
struct
timespec *remain);
240
#if OSAPI_ENABLE_LOG
241
#include <android/log.h>
242
#endif
243
#endif
244
/*
245
* Tick generation on Linux can be done via real-time signals, real-time
246
* sleep or sleep. The default is real-time sleep.
247
* NOTE: real-time signals on Arm/Linux has odd behavior.
248
*
249
* To enable real-time signals enable the following macros and comment
250
* out USE_TIMER_THREAD_RT
251
* #define USE_TIMER_SIGNAL
252
* #define USE_TIMER_THREAD_SEMAPHORE
253
*/
254
#define USE_TIMER_THREAD_RT
255
#else
256
#define USE_TIMER_THREAD_SLEEP
257
#endif
258
#ifndef RTI_LINUX
259
#define RTI_LINUX
260
#endif
261
#if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
262
#if __BYTE_ORDER == __LITTLE_ENDIAN
263
#define RTI_ENDIAN_LITTLE 1
264
#elif __BYTE_ORDER == __BIG_ENDIAN
265
#define RTI_ENDIAN_BIG 1
266
#else
267
#error "Unable to determine endianess. Please specify RTI_ENDIAN_BIG RTI_ENDIAN_LITTLE"
268
#error
269
#endif
270
#endif
/* !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE) */
271
/* #define HAVE_RTI_POSIX_SCHED_POLICY */
272
#endif
273
#endif
274
275
/* Windows */
276
#if OSAPI_PLATFORM == OSAPI_PLATFORM_WINDOWS
277
#include <stdio.h>
278
#include <stdlib.h>
279
#include <stdarg.h>
280
#include <errno.h>
281
#define _WINSOCKAPI_
282
#ifndef RTI_WIN32
283
#define RTI_WIN32
284
#endif
285
#define HAVE_SOCKET_API
286
#define RTI_HAVE_FLOAT
287
#if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
288
#ifdef _M_IX86
289
#define RTI_ENDIAN_LITTLE 1
290
#else
291
#error "Unable to determine endianess. Please specify RTI_ENDIAN_BIG RTI_ENDIAN_LITTLE"
292
#endif
293
#endif
294
#endif
295
296
/* VxWorks */
297
#if OSAPI_PLATFORM == OSAPI_PLATFORM_VXWORKS
298
#include <stdio.h>
299
#include <stdlib.h>
300
#include <stdarg.h>
301
#include <errno.h>
302
#include <time.h>
303
#ifdef CERT
304
#ifndef RTI_CERT
305
#define RTI_CERT
306
#endif
307
#endif
308
#ifdef RTI_RTP
309
#include <strings.h>
310
#include <string.h>
311
#else
312
#include <string.h>
313
#endif
314
#ifndef RTI_USE_MUNCH
315
#define RTI_USE_MUNCH
316
#endif
317
#ifndef RTI_VXWORKS
318
#define RTI_VXWORKS
319
#endif
320
#include <vxWorks.h>
321
#ifdef RTI_RTP
322
/* #define USE_TIMER_SIGNAL */
323
#define USE_TIMER_THREAD_RT
324
#else
325
#define USE_WD_TIMER
326
#define USE_TIMER_THREAD_SEMAPHORE
327
#include <wdLib.h>
328
#include <logLib.h>
329
#endif
330
#if !defined(va_copy) && defined(__va_copy)
331
#define va_copy __va_copy
332
#elif !defined(va_copy)
333
#error "Unable to determine which va_copy to use"
334
#endif
335
#define HAVE_SOCKET_API
336
#define RTI_HAVE_FLOAT
337
#if !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE)
338
#ifdef __BIG_ENDIAN__
339
#define RTI_ENDIAN_BIG 1
340
#else
341
#define RTI_ENDIAN_LITTLE 1
342
#endif
343
#endif
/* !defined(RTI_ENDIAN_BIG) && !defined(RTI_ENDIAN_LITTLE) */
344
345
#define VXWORKS_VERSION_6_8_OR_BETTER \
346
( ((VXWORKS_MAJOR_VERSION == 6) && (VXWORKS_MINOR_VERSION >= 8)) || \
347
(VXWORKS_MAJOR_VERSION > 6) \
348
)
349
350
#define VXWORKS_VERSION_6_3_OR_BETTER \
351
( ((VXWORKS_MAJOR_VERSION == 6) && (VXWORKS_MINOR_VERSION >= 3)) || \
352
(VXWORKS_MAJOR_VERSION > 6) \
353
)
354
355
#define VXWORKS_VERSION_6_0_OR_BETTER \
356
( ((VXWORKS_MAJOR_VERSION == 6) && (VXWORKS_MINOR_VERSION >= 0)) || \
357
(VXWORKS_MAJOR_VERSION > 6) \
358
)
359
360
#define VXWORKS_VERSION_5_4_OR_BETTER \
361
( ((VXWORKS_MAJOR_VERSION == 5) && (VXWORKS_MINOR_VERSION >= 4)) || \
362
(VXWORKS_MAJOR_VERSION > 5) \
363
)
364
365
#endif
366
367
/* Stellaris */
368
#if OSAPI_PLATFORM == OSAPI_PLATFORM_STELLARIS
369
#include <stdio.h>
370
#include <stdlib.h>
371
#include <stdarg.h>
372
#include <errno.h>
373
#define LWIP_NOSYS
374
#define RTI_ENDIAN_LITTLE 1
375
#endif
376
377
/* FreeRTOS */
378
#if OSAPI_PLATFORM == OSAPI_PLATFORM_FREERTOS
379
#define RTI_FREERTOS
380
#include <stdio.h>
381
#include <stdlib.h>
382
#include <stdarg.h>
383
#include <string.h>
384
#include <errno.h>
385
#ifndef INC_FREERTOS_H
386
#include "FreeRTOS.h"
387
#endif
388
#define OSAPI_HAVE_PRINTF 1
389
#define HAVE_SOCKET_API
390
#define LWIP_SYS
391
#define RTI_ENDIAN_LITTLE 1
392
#define OSAPI_PLATFORM_FREERTOS_HOSTNAME "FreeRTOS-host"
393
#define TARGET "FreeRTOS-target"
394
#define BUILDABLE_SOURCE
395
#define TARGET "FreeRTOS-target"
396
#define OSAPI_PLATFORM_FREERTOS_STACK_SIZE_DEFAULT 256
397
398
/* Configuration for FreeRTOS
399
*
400
*/
401
402
#endif
403
404
405
/* Some platforms do not support long double or have different sizes for that
406
* type than defined by IDL (16 bytes). On such platforms, DDS_LongDouble
407
* (as well as the unsigned version) is mapped to a character array that
408
* matches the expected size of that type by default. If you are using a
409
* platform whose native mapping has exactly the expected size, you can
410
* instruct Connext Micro to use the native type instead. That is, if
411
* sizeof(long double) == 16, you can tell Connext Micro to map DDS_LongDouble
412
* to long double by defining the following macro, RTI_HAVE_LONG_DOUBLE.
413
*/
414
/* #define RTI_HAVE_LONG_DOUBLE */
415
416
417
418
#endif
/* osapi_config_h */
RTI Connext Micro Version 2.4.4.0
Copyright © Thu Apr 30 2015
Real-Time Innovations, Inc