]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_fosa_opaque.h
e366775797bab9274fd41b4be28be688ae4be0a4
[frescor/frsh-include.git] / frsh_fosa_opaque.h
1 // -----------------------------------------------------------------------
2 //  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
3 //
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
10 //    ENEA                                   SWEDEN
11 //    Thales Communication S.A.              FRANCE
12 //    Visual Tools S.A.                      SPAIN
13 //    Rapita Systems Ltd                     UK
14 //    Evidence                               ITALY
15 //
16 //    See http://www.frescor.org for a link to partners' websites
17 //
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
21 //        made of this code.
22 //
23 //
24 //  based on previous work (FSF) done in the FIRST project
25 //
26 //   Copyright (C) 2005  Mälardalen University, SWEDEN
27 //                       Scuola Superiore S.Anna, ITALY
28 //                       Universidad de Cantabria, SPAIN
29 //                       University of York, UK
30 //
31 //   FSF API web pages: http://marte.unican.es/fsf/docs
32 //                      http://shark.sssup.it/contrib/first/docs/
33 //
34 //  This file is part of FRSH API
35 //
36 //  FRSH API is free software; you can  redistribute it and/or  modify
37 //  it under the terms of  the GNU General Public License as published by
38 //  the Free Software Foundation;  either  version 2, or (at  your option)
39 //  any later version.
40 //
41 //  FRSH API  is distributed  in  the hope  that  it  will  be useful,  but
42 //  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
43 //  MERCHANTABILITY  or  FITNESS FOR  A  PARTICULAR PURPOSE. See  the  GNU
44 //  General Public License for more details.
45 //
46 //  You should have  received a  copy of  the  GNU  General Public License
47 //  distributed  with  FRSH API;  see file COPYING.   If not,  write to the
48 //  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
49 //  02111-1307, USA.
50 //
51 //  As a special exception, if you include this header file into source
52 //  files to be compiled, this header file does not by itself cause
53 //  the resulting executable to be covered by the GNU General Public
54 //  License.  This exception does not however invalidate any other
55 //  reasons why the executable file might be covered by the GNU General
56 //  Public License.
57 // -----------------------------------------------------------------------
58 //frsh_core_types.h
59 //========================================================================================
60 //  ******** *******    ********  **      **    ********  ******    ********  **********
61 //  **///// /**////**  **//////  /**     /**    **///// /**    **  **//////  /**     /**
62 //  **      /**   /** /**        /**     /**    **      /**    ** /**        /**     /**
63 //  ******* /*******  /********* /**********    ******* /**    ** /********* /**********
64 //  **////  /**///**  ////////** /**//////**    **////  /**    ** ////////** /**//////**
65 //  **      /**  //**        /** /**     /**    **      /**    **        /** /**     /**
66 //  **      /**   //** ********  /**     /**    **      /**    **  ********  /**     /**
67 //  //       //     // ////////   //      //    //       /******/  ////////   //      //
68 //
69 // FRSH(FRescor ScHeduler), pronounced "fresh" FOSA(Frescor Oper System Adaptation layer)
70 //========================================================================================
71
72 #ifndef         FRSH_FOSA_OPAQUE_H_
73 #define         FRSH_FOSA_OPAQUE_H_
74
75 /**
76  * @file frsh_fosa_opaque.h
77  **/
78
79
80 /**
81  * \addtogroup frshfosa
82  *
83  * @{
84  **/
85
86
87 /////////////////////MaRTE OS, RT_LINUX & AQuoSA  //////////////////////
88
89 #if defined(MARTE_OS) || defined(RT_LINUX) || defined(AQuoSA)
90
91 #ifdef AQuoSA
92 #define __USE_UNIX98
93 #endif // AQuoSA
94 #include <pthread.h>
95 #include <signal.h>
96 #include <errno.h>
97 #include <time.h>
98 #include <stdbool.h>
99
100 #ifdef AQuoSA
101
102 typedef struct {
103         pthread_t pthread_id;
104         pid_t linux_pid;
105         pid_t linux_tid;
106 } FOSA_THREAD_ID_T_OPAQUE;
107
108 #else   /* !AQuoSA, MARTE_OS, RT_LINUX */
109
110 #ifdef MARTE_OS
111 typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
112 #else
113 //#define FOSA_MUTEX_T_OPAQUE pthread_mutex_t
114 #define FOSA_THREAD_ID_T_OPAQUE pthread_t
115 #endif
116
117 #endif  /* AQuoSA */
118
119 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
120
121 typedef int FOSA_SIGNAL_T_OPAQUE;
122
123 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
124
125 // The minimum and maximum signal numbers that may be used by the FRSH
126 // implementation
127 #define FOSA_SIGNAL_MIN       SIGRTMIN
128 #define FOSA_SIGNAL_MAX       SIGRTMIN+0
129
130 #define FOSA_NULL_SIGNAL 0
131
132 /* FOSA Errors */
133
134 /* #include <error.h> */
135
136 /** Not enough memory available **/
137 #define FOSA_ENOMEM   ENOMEM
138
139 /** Invalid parameter **/
140 #define FOSA_EINVAL   EINVAL
141
142 /** Still pending information **/
143 #define FOSA_EAGAIN   EAGAIN
144
145 /** FOSA ADS errors **/
146 #ifdef MARTE_OS
147 #define EREJECT   201 /* (for linux_lib_arch) Appsched has rejected object */
148 #endif
149
150 #define FOSA_EREJECT   EREJECT
151 #define FOSA_EMASKED   -2
152 #define FOSA_EPOLICY   -3
153
154 #define FOSA_ETIMEDOUT ETIMEDOUT
155
156
157 #endif /* MARTE_OS || RT_LINUX || AQuoSA */
158
159 //////////////////End of MaRTE OS, RT_LINUX & AQuoSA  ///////////////////
160
161 ////////////////////////// VIRTUAL TIME    //////////////////////////////////////
162
163 #if defined(VIRTUAL_TIME)
164 #include <fosa_vt.h>
165
166 #define FOSA_THREAD_ID_T_OPAQUE   vt_posix_process_t
167
168 #define FOSA_THREAD_ATTR_T_OPAQUE fosa_thread_attr_t
169
170 #define FOSA_SIGNAL_T_OPAQUE      int
171
172 #define FOSA_MUTEX_T_OPAQUE fosa_mutex_t
173
174 // The minimum and maximum signal numbers that may be used by the FRSH
175 // implementation
176 #define FOSA_SIGNAL_MIN       8
177 #define FOSA_SIGNAL_MAX       31
178
179 // the min. and max. priority a fosa thread can have
180 #define FOSA_PRIORITY_MAX VT_PRIORITY_MIN - 1
181 #define FOSA_PRIORITY_MIN VT_PRIORITY_MAX
182
183 #define FOSA_NULL_SIGNAL        0
184
185 /* FOSA Errors and return values*/
186
187 /** Invalid parameter **/
188 #define FOSA_EINVAL   -1
189
190 /** Not enough memory available **/
191 #define FOSA_ENOMEM   -2
192
193 /** Still pending information **/
194 #define FOSA_EAGAIN   -3
195
196 /** Mutex not available **/
197 #define FOSA_EBUSY         -4
198
199 /** Cond var timedout **/
200 #define FOSA_ETIMEDOUT  -5
201
202 /** FOSA ADS errors **/
203 #define FOSA_EREJECT   -6
204 #define FOSA_EMASKED   -7
205
206
207 /** Sched policy not correct */
208 #define FOSA_EPOLICY    -8
209
210 /** the value given by thread_id is not valid for ADS */
211 #define FOSA_ESRCH              -9
212
213 /** retval if no action performed **/
214 #define FOSA_NO_ACTION  0
215
216 #endif /* VIRTUAL_TIME */
217 //////////////////////////End of VIRTUAL TIME ///////////////////////////////////
218
219 ////////////////////////// OSE    //////////////////////////////////////
220
221 #if defined(OSE)
222
223 /* Put OSE dependent includes and defines here */
224
225 #endif /* OSE */
226 //////////////////////////End of OSE ////////////////////////////////////
227
228 ////////////////////////// DUMMY_OS    //////////////////////////////////////
229
230 #if defined(DUMMY_OS)
231
232 /* With this define we make sure that we are truly POSIX and OSE */
233 /* independent at the FRSH code.                                 */
234 /*****************************************************************/
235
236 #define FOSA_THREAD_ID_T_OPAQUE   int
237
238 #define FOSA_THREAD_ATTR_T_OPAQUE int
239
240 #define FOSA_SIGNAL_T_OPAQUE      int
241
242 #define FRSH_SIGNAL_INFO_T_OPAQUE int
243
244 #define FOSA_MUTEX_T_OPAQUE int
245
246 // The minimum and maximum signal numbers that may be used by the FRSH
247 // implementation
248 #define FOSA_SIGNAL_MIN       42
249 #define FOSA_SIGNAL_MAX       42
250
251 #define FOSA_NULL_SIGNAL 0
252
253 /* FOSA Errors */
254
255 /* #include <error.h> */
256
257 /** Not enough memory available **/
258 #define FOSA_ENOMEM   -1
259
260 /** Invalid parameter **/
261 #define FOSA_EINVAL   -2
262
263 /** Still pending information **/
264 #define FOSA_EAGAIN   -3
265
266 /** FOSA ADS errors **/
267 #define FOSA_EREJECT   -4
268 #define FOSA_EMASKED   -5
269
270 #define FOSA_EPOLICY -6
271
272 #endif /* DUMMY */
273 //////////////////////////End of DUMMY_OS ////////////////////////////////////
274
275
276
277
278
279
280 #endif      /* !FRSH_FOSA_OPAQUE_H_ */