1 // -----------------------------------------------------------------------
2 // Copyright (C) 2006 - 2008 FRESCOR consortium partners:
4 // Universidad de Cantabria, SPAIN
5 // University of York, UK
6 // Scuola Superiore Sant'Anna, ITALY
7 // Kaiserslautern University, GERMANY
8 // Univ. Politécnica Valencia, SPAIN
9 // Czech Technical University in Prague, CZECH REPUBLIC
11 // Thales Communication S.A. FRANCE
12 // Visual Tools S.A. SPAIN
13 // Rapita Systems Ltd UK
16 // See http://www.frescor.org for a link to partners' websites
18 // FRESCOR project (FP6/2005/IST/5-034026) is funded
19 // in part by the European Union Sixth Framework Programme
20 // The European Union is not liable of any use that may be
24 // based on previous work (FSF) done in the FIRST project
26 // Copyright (C) 2005 Mälardalen University, SWEDEN
27 // Scuola Superiore S.Anna, ITALY
28 // Universidad de Cantabria, SPAIN
29 // University of York, UK
31 // FSF API web pages: http://marte.unican.es/fsf/docs
32 // http://shark.sssup.it/contrib/first/docs/
34 // This file is part of FOSA (Frsh Operating System Adaption)
36 // FOSA is free software; you can redistribute it and/or modify it
37 // under terms of the GNU General Public License as published by the
38 // Free Software Foundation; either version 2, or (at your option) any
39 // later version. FOSA is distributed in the hope that it will be
40 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
41 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 // General Public License for more details. You should have received a
43 // copy of the GNU General Public License along with FOSA; see file
44 // COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
45 // Cambridge, MA 02139, USA.
47 // As a special exception, including FOSA header files in a file,
48 // instantiating FOSA generics or templates, or linking other files
49 // with FOSA objects to produce an executable application, does not
50 // by itself cause the resulting executable application to be covered
51 // by the GNU General Public License. This exception does not
52 // however invalidate any other reasons why the executable file might be
53 // covered by the GNU Public License.
54 // -----------------------------------------------------------------------
56 //==============================================
57 // ******** ****** ******** **********
58 // **///// /** ** **////// /** /**
59 // ** /** ** /** /** /**
60 // ******* /** ** /********* /**********
61 // **//// /** ** ////////** /**//////**
62 // ** /** ** /** /** /**
63 // ** /** ** ******** /** /**
64 // // /******/ //////// // //
66 // FOSA(Frescor Operating System Adaptation layer)
67 //================================================
69 // Implementation dependent definitions
71 #ifndef _FOSA_OPAQUE_TYPES_H_
72 #define _FOSA_OPAQUE_TYPES_H_
76 #include "fosa_cpp_macros.h"
77 #include "fosa_opaque_types_time.h"
79 /////////////////////// MARTE_OS /////////////////////////////
92 /* Thread and signals */
93 /**********************/
94 typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
95 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
97 typedef int FOSA_SIGNAL_T_OPAQUE;
98 /* Signal info is defined as a union in thread_and_signals */
100 #define FOSA_SIGNAL_MIN SIGRTMIN
101 #define FOSA_SIGNAL_MAX SIGRTMIN+0
103 #define FOSA_NULL_SIGNAL 0
105 /* Clocks and timers */
106 /**********************/
107 typedef clockid_t FOSA_CLOCK_ID_T_OPAQUE;
108 typedef timer_t FOSA_TIMER_ID_T_OPAQUE;
110 #define FOSA_SYSTEM_CLOCK_OPAQUE CLOCK_MONOTONIC
112 /* Mutex and conditional variables */
113 /***********************************/
114 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
115 typedef pthread_cond_t FOSA_COND_T_OPAQUE;
118 /* Application defined Scheduling */
119 /**********************************/
120 #define FOSA_ADS_ACTIONS_T_OPAQUE struct \
122 posix_appsched_actions_t actions; \
123 struct timespec *timeout_ptr; \
124 struct timespec timeout; \
133 #include "marte_non_local_jmp.h"
135 #define FOSA_LONG_JUMP_CONTEXT_T_OPAQUE struct { \
136 marte_nonlocaljmp_context_t marte_context; \
137 fosa_thread_id_t tid; \
143 /** Not enough memory available **/
144 #define FOSA_ENOMEM ENOMEM
146 /** Invalid parameter **/
147 #define FOSA_EINVAL EINVAL
149 /** Still pending information **/
150 #define FOSA_EAGAIN EAGAIN
152 /** FOSA ADS errors **/
154 #define EREJECT 201 /* (for linux_lib_arch) Appsched has rejected object */
157 #define FOSA_EREJECT EREJECT
158 #define FOSA_EMASKED -2
159 #define FOSA_EPOLICY -3
161 #define FOSA_ETIMEDOUT ETIMEDOUT
165 /////////////////////// End of MARTE_OS /////////////////////////////
168 /////////////////////// RT_LINUX ///////////////////////////
172 /* Very similar to MARTE_OS but I leave separate for clarity */
179 #include <rtl_timer.h>
182 /* Threads and signals */
183 /***********************/
184 #define FOSA_THREAD_ID_T_OPAQUE pthread_t
186 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
187 typedef int FOSA_SIGNAL_T_OPAQUE;
188 /* Signal info is defined as a union in fosa_types.h */
190 // The minimum and maximum signal numbers that may be used by the FRSH
192 #define FOSA_SIGNAL_MIN SIGRTMIN
193 #define FOSA_SIGNAL_MAX SIGRTMIN+0
194 #define FOSA_NULL_SIGNAL 0
196 /* Clocks and timers */
197 /*********************/
198 #define FOSA_CLOCK_ID_T_OPAQUE clockid_t
199 #define FOSA_TIMER_ID_T_OPAQUE timer_t
200 #define FOSA_SYSTEM_CLOCK_OPAQUE CLOCK_MONOTONIC
202 /* Mutex and cond vars */
203 /***********************/
204 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
205 #define FOSA_COND_T_OPAQUE pthread_cond_t
210 /** Not enough memory available **/
211 #define FOSA_ENOMEM ENOMEM
212 /** Invalid parameter **/
213 #define FOSA_EINVAL EINVAL
214 /** Still pending information **/
215 #define FOSA_EAGAIN EAGAIN
217 /** FOSA ADS errors **/
218 #define FOSA_EREJECT EREJECT
219 #define FOSA_EMASKED -2
220 #define FOSA_EPOLICY -3
222 #define FOSA_ETIMEDOUT ETIMEDOUT
226 /////////////////////// End of RT_LINUX /////////////////////////////
229 ////////////////////////// OSE //////////////////////////////////////
235 /* Put OSE dependent includes and defines here */
241 /////////////////////// AQuoSA ///////////////////////////
246 #include <linux/unistd.h>
248 #define _XOPEN_SOURCE 500
258 // typedef struct timespec fosa_rel_time_t;
259 // typedef struct timespec fosa_abs_time_t;
262 /* Threads and signals */
263 /***********************/
265 pthread_t pthread_id;
268 } FOSA_THREAD_ID_T_OPAQUE;
271 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
272 typedef int FOSA_SIGNAL_T_OPAQUE;
275 // The minimum and maximum signal numbers that may be used by the FRSH
277 #define FOSA_SIGNAL_MIN SIGRTMIN
278 #define FOSA_SIGNAL_MAX SIGRTMIN+0
280 #define FOSA_NULL_SIGNAL 0
283 /* Clocks and signals */
284 /**********************/
285 #define FOSA_CLOCK_ID_T_OPAQUE clockid_t
286 #define FOSA_SYSTEM_CLOCK_OPAQUE CLOCK_MONOTONIC
287 #define FOSA_TIMER_ID_T_OPAQUE timer_t
291 /* Mutex and cond vars */
292 /***********************/
293 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
294 #define FOSA_COND_T_OPAQUE pthread_cond_t
297 /* Application Defined Scheduling */
298 /**********************************/
299 /* hack to get AQuoSA sources compile without having none
300 * of the application level scheduler header files and symbols */
301 #define posix_appsched_actions_t int
302 #define FOSA_LONG_JUMP_CONTEXT_T_OPAQUE int
304 #define FOSA_ADS_ACTIONS_T_OPAQUE posix_appsched_actions_t
309 /** Not enough memory available **/
310 #define FOSA_ENOMEM ENOMEM
312 /** Invalid parameter **/
313 #define FOSA_EINVAL EINVAL
315 /** Still pending information **/
316 #define FOSA_EAGAIN EAGAIN
318 #define FOSA_EREJECT EREJECT
319 #define FOSA_EMASKED -2
320 #define FOSA_EPOLICY -3
322 #define FOSA_ETIMEDOUT ETIMEDOUT
326 ////////////////// END of AQuoSA //////////////////////
330 /////////////////////////////////// PARTIKLE ///////////////////////////////////////////
331 #if defined(PARTIKLE)
342 posix_appsched_actions_t actions;
343 struct timespec * timeout_ptr;
344 struct timespec timeout;
348 } FOSA_ADS_ACTIONS_T_OPAQUE;
350 typedef unsigned long FOSA_LONG_JUMP_CONTEXT_T_OPAQUE [32];
352 typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
353 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
354 typedef int FOSA_SIGNAL_T_OPAQUE;
355 typedef clockid_t FOSA_CLOCK_ID_T_OPAQUE;
356 typedef timer_t FOSA_TIMER_ID_T_OPAQUE;
357 typedef pthread_cond_t FOSA_COND_T_OPAQUE;
358 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
362 enum _fosa_clocks_e {
363 FOSA_SYSTEM_CLOCK_OPAQUE = CLOCK_MONOTONIC
366 #define LONGJMP_NSIG 3
368 #if LONGJMP_NSIG > (RTSIG_MAX - 1)
369 # error LONGJMP_NSIG too big (LONGJMP_NSIG > RTSIG_MAX - 1)
372 enum _fosa_signal_limits_e {
373 LONGJMP_FIRSTSIG = SIGRTMAX - LONGJMP_NSIG + 1,
374 FOSA_SIGNAL_MAX = LONGJMP_FIRSTSIG - 1,
375 FOSA_SIGNAL_MIN = FOSA_SIGNAL_MAX,
379 enum _fosa_errors_e {
380 FOSA_EINVAL = EINVAL,
381 FOSA_EAGAIN = EAGAIN,
382 FOSA_EREJECT = EREJECT,
383 FOSA_EMASKED = EMASKED,
384 FOSA_EPOLICY = EPOLICY,
385 FOSA_ETIMEDOUT = ETIMEDOUT,
386 FOSA_ENOMEM = ENOMEM,
390 /////////////////////////////////// PARTIKLE END //////////////////////////////////////
394 ////////////////////////// VIRTUAL TIME //////////////////////////////////////
399 // typedef struct timespec fosa_rel_time_t;
400 // typedef struct timespec fosa_abs_time_t;
404 #define FOSA_THREAD_ID_T_OPAQUE vt_posix_process_t
405 #define FOSA_THREAD_ATTR_T_OPAQUE fosa_thread_attr_t
406 #define FOSA_SIGNAL_T_OPAQUE int
408 #define FOSA_MUTEX_T_OPAQUE fosa_mutex_t
410 // The minimum and maximum signal numbers that may be used by the FRSH
412 #define FOSA_SIGNAL_MIN 8
413 #define FOSA_SIGNAL_MAX 31
415 // the min. and max. priority a fosa thread can have
416 #define FOSA_PRIORITY_MAX VT_PRIORITY_MIN - 1
417 #define FOSA_PRIORITY_MIN VT_PRIORITY_MAX
419 #define FOSA_NULL_SIGNAL 0
421 /* FOSA Errors and return values*/
423 /** Invalid parameter **/
424 #define FOSA_EINVAL -1
426 /** Not enough memory available **/
427 #define FOSA_ENOMEM -2
429 /** Still pending information **/
430 #define FOSA_EAGAIN -3
432 /** Mutex not available **/
433 #define FOSA_EBUSY -4
435 /** Cond var timedout **/
436 #define FOSA_ETIMEDOUT -5
438 /** FOSA ADS errors **/
439 #define FOSA_EREJECT -6
440 #define FOSA_EMASKED -7
443 /** Sched policy not correct */
444 #define FOSA_EPOLICY -8
446 /** the value given by thread_id is not valid for ADS */
447 #define FOSA_ESRCH -9
449 /** retval if no action performed **/
450 #define FOSA_NO_ACTION 0
452 #endif /* VIRTUAL_TIME */
453 //////////////////////////End of VIRTUAL TIME ///////////////////////////////////
456 ////////////////////////// DUMMY_OS //////////////////////////////////////
458 #if defined(DUMMY_OS)
460 /* With this define we make sure that we are truly POSIX and OSE */
461 /* independent at the FRSH code. */
462 /*****************************************************************/
466 // typedef struct timespec fosa_rel_time_t;
467 // typedef struct timespec fosa_abs_time_t;
469 /* Thread and signals */
470 /**********************/
471 typedef int FOSA_THREAD_ID_T_OPAQUE;
472 typedef int FOSA_THREAD_ATTR_T_OPAQUE;
474 typedef int FOSA_SIGNAL_T_OPAQUE;
475 typedef int FOSA_SIGNAL_INFO_T_OPAQUE;
477 /* Signal info is defined as a union in thread_and_signals */
479 #define FOSA_SIGNAL_MIN 42
480 #define FOSA_SIGNAL_MAX 44
482 #define FOSA_NULL_SIGNAL 0
484 /* Clocks and timers */
485 /**********************/
486 typedef int FOSA_CLOCK_ID_T_OPAQUE;
487 typedef int FOSA_TIMER_ID_T_OPAQUE;
489 #define FOSA_SYSTEM_CLOCK_OPAQUE 25
491 /* Mutex and conditional variables */
492 /***********************************/
493 typedef int FOSA_MUTEX_T_OPAQUE;
494 typedef int FOSA_COND_T_OPAQUE;
496 /* Application defined Scheduling */
497 /**********************************/
498 #define FOSA_ADS_ACTIONS_T_OPAQUE int
502 //////////////////////////End of DUMMY_OS ////////////////////////////////////
507 #endif // _FOSA_OPAQUE_TYPES_H_