1 //----------------------------------------------------------------------
2 // Copyright (C) 2006 - 2007 by the FRESCOR consortium:
4 // Universidad de Cantabria, SPAIN
5 // University of York, UK
6 // Scuola Superiore Sant'Anna, ITALY
7 // Kaiserslautern University, GERMANY
8 // Univ. Politecnica 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
18 // The 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 // This file is part of FOSA (Frsh Operating System Abstraction)
33 // FOSA is free software; you can redistribute it and/or modify it
34 // under terms of the GNU General Public License as published by the
35 // Free Software Foundation; either version 2, or (at your option) any
36 // later version. FOSA is distributed in the hope that it will be
37 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
38 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39 // General Public License for more details. You should have received a
40 // copy of the GNU General Public License along with FOSA; see file
41 // COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
42 // Cambridge, MA 02139, USA.
44 // As a special exception, including FOSA header files in a file,
45 // instantiating FOSA generics or templates, or linking other files
46 // with FOSA objects to produce an executable application, does not
47 // by itself cause the resulting executable application to be covered
48 // by the GNU General Public License. This exception does not
49 // however invalidate any other reasons why the executable file might be
50 // covered by the GNU Public License.
51 // -----------------------------------------------------------------------
53 //==============================================
54 // ******** ****** ******** **********
55 // **///// /** ** **////// /** /**
56 // ** /** ** /** /** /**
57 // ******* /** ** /********* /**********
58 // **//// /** ** ////////** /**//////**
59 // ** /** ** /** /** /**
60 // ** /** ** ******** /** /**
61 // // /******/ //////// // //
63 // FOSA(Frescor Operating System Adaptation layer)
64 //================================================
66 // Implementation dependent definitions
68 #ifndef _FOSA_OPAQUE_TYPES_H_
69 #define _FOSA_OPAQUE_TYPES_H_
73 /////////////////////// MARTE_OS /////////////////////////////
85 // typedef struct timespec fosa_rel_time_t;
86 // typedef struct timespec fosa_abs_time_t;
88 /* Thread and signals */
89 /**********************/
90 typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
91 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
93 typedef int FOSA_SIGNAL_T_OPAQUE;
94 /* Signal info is defined as a union in thread_and_signals */
96 #define FOSA_SIGNAL_MIN SIGRTMIN
97 #define FOSA_SIGNAL_MAX SIGRTMIN+0
99 #define FOSA_NULL_SIGNAL 0
101 /* Clocks and timers */
102 /**********************/
103 typedef clockid_t FOSA_CLOCK_ID_T_OPAQUE;
104 typedef timer_t FOSA_TIMER_ID_T_OPAQUE;
106 #define FOSA_SYSTEM_CLOCK_OPAQUE CLOCK_MONOTONIC
108 /* Mutex and conditional variables */
109 /***********************************/
110 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
111 typedef pthread_cond_t FOSA_COND_T_OPAQUE;
114 /* Application defined Scheduling */
115 /**********************************/
117 posix_appsched_actions_t actions;
118 struct timespec *timeout_ptr;
119 struct timespec timeout;
123 } fosa_ads_actions_internal_t;
125 #define FOSA_ADS_ACTIONS_T_OPAQUE fosa_ads_actions_internal_t
129 #include "marte_non_local_jmp.h"
131 #define FOSA_LONG_JUMP_CONTEXT_T_OPAQUE struct { \
132 marte_nonlocaljmp_context_t marte_context; \
133 fosa_thread_id_t tid; \
139 /** Not enough memory available **/
140 #define FOSA_ENOMEM ENOMEM
142 /** Invalid parameter **/
143 #define FOSA_EINVAL EINVAL
145 /** Still pending information **/
146 #define FOSA_EAGAIN EAGAIN
148 /** FOSA ADS errors **/
150 #define EREJECT 201 /* (for linux_lib_arch) Appsched has rejected object */
153 #define FOSA_EREJECT EREJECT
154 #define FOSA_EMASKED -2
155 #define FOSA_EPOLICY -3
157 #define FOSA_ETIMEDOUT ETIMEDOUT
161 /////////////////////// End of MARTE_OS /////////////////////////////
164 /////////////////////// RT_LINUX ///////////////////////////
168 /* Very similar to MARTE_OS but I leave separate for clarity */
175 #include <rtl_timer.h>
179 // typedef struct timespec fosa_rel_time_t;
180 // typedef struct timespec fosa_abs_time_t;
183 /* Threads and signals */
184 /***********************/
185 #define FOSA_THREAD_ID_T_OPAQUE pthread_t
187 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
188 typedef int FOSA_SIGNAL_T_OPAQUE;
189 /* Signal info is defined as a union in fosa_types.h */
191 // The minimum and maximum signal numbers that may be used by the FRSH
193 #define FOSA_SIGNAL_MIN SIGRTMIN
194 #define FOSA_SIGNAL_MAX SIGRTMIN+0
195 #define FOSA_NULL_SIGNAL 0
197 /* Clocks and timers */
198 /*********************/
199 #define FOSA_CLOCK_ID_T_OPAQUE clockid_t
200 #define FOSA_TIMER_ID_T_OPAQUE timer_t
201 #define FOSA_SYSTEM_CLOCK_OPAQUE CLOCK_MONOTONIC
203 /* Mutex and cond vars */
204 /***********************/
205 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
206 #define FOSA_COND_T_OPAQUE pthread_cond_t
211 /** Not enough memory available **/
212 #define FOSA_ENOMEM ENOMEM
213 /** Invalid parameter **/
214 #define FOSA_EINVAL EINVAL
215 /** Still pending information **/
216 #define FOSA_EAGAIN EAGAIN
218 /** FOSA ADS errors **/
219 #define FOSA_EREJECT EREJECT
220 #define FOSA_EMASKED -2
221 #define FOSA_EPOLICY -3
223 #define FOSA_ETIMEDOUT ETIMEDOUT
227 /////////////////////// End of RT_LINUX /////////////////////////////
230 ////////////////////////// OSE //////////////////////////////////////
236 // typedef struct timespec fosa_rel_time_t;
237 // typedef struct timespec fosa_abs_time_t;
240 /* Put OSE dependent includes and defines here */
246 /////////////////////// AQuoSA ///////////////////////////
259 // typedef struct timespec fosa_rel_time_t;
260 // typedef struct timespec fosa_abs_time_t;
263 /* Threads and signals */
264 /***********************/
266 pthread_t pthread_id;
269 } FOSA_THREAD_ID_T_OPAQUE;
272 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
273 typedef int FOSA_SIGNAL_T_OPAQUE;
276 // The minimum and maximum signal numbers that may be used by the FRSH
278 #define FOSA_SIGNAL_MIN SIGRTMIN
279 #define FOSA_SIGNAL_MAX SIGRTMIN+0
281 #define FOSA_NULL_SIGNAL 0
284 /* Clocks and signals */
285 /**********************/
286 #define FOSA_CLOCK_ID_T_OPAQUE clockid_t
287 #define FOSA_SYSTEM_CLOCK_OPAQUE CLOCK_MONOTONIC
288 #define FOSA_TIMER_ID_T_OPAQUE timer_t
292 /* Mutex and cond vars */
293 /***********************/
294 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
295 #define FOSA_COND_T_OPAQUE pthread_cond_t
298 /* Application Defined Scheduling */
299 /**********************************/
300 /* hack to get AQuoSA sources compile without having none
301 * of the application level scheduler header files and symbols */
302 #define posix_appsched_actions_t int
303 #define FOSA_LONG_JUMP_CONTEXT_T_OPAQUE int
305 #define FOSA_ADS_ACTIONS_T_OPAQUE posix_appsched_actions_t
310 /** Not enough memory available **/
311 #define FOSA_ENOMEM ENOMEM
313 /** Invalid parameter **/
314 #define FOSA_EINVAL EINVAL
316 /** Still pending information **/
317 #define FOSA_EAGAIN EAGAIN
319 #define FOSA_EREJECT EREJECT
320 #define FOSA_EMASKED -2
321 #define FOSA_EPOLICY -3
323 #define FOSA_ETIMEDOUT ETIMEDOUT
327 ////////////////// END of AQuoSA //////////////////////
331 /////////////////////////////////// PARTIKLE ///////////////////////////////////////////
332 #if defined(PARTIKLE)
341 posix_appsched_actions_t actions;
342 struct timespec * timeout_ptr;
343 struct timespec timeout;
347 } fosa_ads_actions_internal_t;
349 typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
350 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
351 typedef int FOSA_SIGNAL_T_OPAQUE;
352 typedef fosa_ads_actions_internal_t FOSA_ADS_ACTIONS_T_OPAQUE;
353 typedef clockid_t FOSA_CLOCK_ID_T_OPAQUE;
354 typedef timer_t FOSA_TIMER_ID_T_OPAQUE;
355 typedef pthread_cond_t FOSA_COND_T_OPAQUE;
356 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
357 typedef void * FOSA_LONG_JUMP_CONTEXT_T_OPAQUE;
360 enum _fosa_clocks_e {
361 FOSA_SYSTEM_CLOCK_OPAQUE = CLOCK_MONOTONIC
364 enum _fosa_signal_limits_e {
365 FOSA_SIGNAL_MIN = SIGRTMIN,
366 FOSA_SIGNAL_MAX = SIGRTMAX,
369 enum _fosa_errors_e {
370 FOSA_EINVAL = EINVAL,
371 FOSA_EAGAIN = EAGAIN,
372 FOSA_EREJECT = EREJECT,
373 FOSA_EMASKED = EMASKED,
374 FOSA_EPOLICY = EPOLICY,
375 FOSA_ETIMEDOUT = ETIMEDOUT,
376 FOSA_ENOMEM = ENOMEM,
380 /////////////////////////////////// PARTIKLE END //////////////////////////////////////
384 ////////////////////////// VIRTUAL TIME //////////////////////////////////////
389 // typedef struct timespec fosa_rel_time_t;
390 // typedef struct timespec fosa_abs_time_t;
394 #define FOSA_THREAD_ID_T_OPAQUE vt_posix_process_t
395 #define FOSA_THREAD_ATTR_T_OPAQUE fosa_thread_attr_t
396 #define FOSA_SIGNAL_T_OPAQUE int
398 #define FOSA_MUTEX_T_OPAQUE fosa_mutex_t
400 // The minimum and maximum signal numbers that may be used by the FRSH
402 #define FOSA_SIGNAL_MIN 8
403 #define FOSA_SIGNAL_MAX 31
405 // the min. and max. priority a fosa thread can have
406 #define FOSA_PRIORITY_MAX VT_PRIORITY_MIN - 1
407 #define FOSA_PRIORITY_MIN VT_PRIORITY_MAX
409 #define FOSA_NULL_SIGNAL 0
411 /* FOSA Errors and return values*/
413 /** Invalid parameter **/
414 #define FOSA_EINVAL -1
416 /** Not enough memory available **/
417 #define FOSA_ENOMEM -2
419 /** Still pending information **/
420 #define FOSA_EAGAIN -3
422 /** Mutex not available **/
423 #define FOSA_EBUSY -4
425 /** Cond var timedout **/
426 #define FOSA_ETIMEDOUT -5
428 /** FOSA ADS errors **/
429 #define FOSA_EREJECT -6
430 #define FOSA_EMASKED -7
433 /** Sched policy not correct */
434 #define FOSA_EPOLICY -8
436 /** the value given by thread_id is not valid for ADS */
437 #define FOSA_ESRCH -9
439 /** retval if no action performed **/
440 #define FOSA_NO_ACTION 0
442 #endif /* VIRTUAL_TIME */
443 //////////////////////////End of VIRTUAL TIME ///////////////////////////////////
446 ////////////////////////// DUMMY_OS //////////////////////////////////////
448 #if defined(DUMMY_OS)
450 /* With this define we make sure that we are truly POSIX and OSE */
451 /* independent at the FRSH code. */
452 /*****************************************************************/
456 // typedef struct timespec fosa_rel_time_t;
457 // typedef struct timespec fosa_abs_time_t;
459 /* Thread and signals */
460 /**********************/
461 typedef int FOSA_THREAD_ID_T_OPAQUE;
462 typedef int FOSA_THREAD_ATTR_T_OPAQUE;
464 typedef int FOSA_SIGNAL_T_OPAQUE;
465 typedef int FOSA_SIGNAL_INFO_T_OPAQUE;
467 /* Signal info is defined as a union in thread_and_signals */
469 #define FOSA_SIGNAL_MIN 42
470 #define FOSA_SIGNAL_MAX 44
472 #define FOSA_NULL_SIGNAL 0
474 /* Clocks and timers */
475 /**********************/
476 typedef int FOSA_CLOCK_ID_T_OPAQUE;
477 typedef int FOSA_TIMER_ID_T_OPAQUE;
479 #define FOSA_SYSTEM_CLOCK_OPAQUE 25
481 /* Mutex and conditional variables */
482 /***********************************/
483 typedef int FOSA_MUTEX_T_OPAQUE;
484 typedef int FOSA_COND_T_OPAQUE;
486 /* Application defined Scheduling */
487 /**********************************/
488 #define FOSA_ADS_ACTIONS_T_OPAQUE int
492 //////////////////////////End of DUMMY_OS ////////////////////////////////////
497 #endif // _FOSA_OPAQUE_TYPES_H_