]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_fosa_opaque.h
Correcting a double definition of FRSH_MUTEXT_T_OPAQUE
[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 #include <pthread.h>
92 #include <signal.h>
93 #include <errno.h>
94 #include <time.h>
95 #include <stdbool.h>
96
97 #ifdef AQuoSA
98
99 typedef struct {
100         pthread_t pthread_id;
101         pid_t linux_pid;
102         pid_t linux_tid;
103 } FOSA_THREAD_ID_T_OPAQUE;
104
105 #else   /* !AQuoSA, MARTE_OS, RT_LINUX */
106
107 #ifdef MARTE_OS
108 typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
109 #else
110 //#define FOSA_MUTEX_T_OPAQUE pthread_mutex_t
111 #define FOSA_THREAD_ID_T_OPAQUE pthread_t
112 #endif
113
114 #endif  /* AQuoSA */
115
116 typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
117
118 typedef int FOSA_SIGNAL_T_OPAQUE;
119
120 typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
121
122 // The minimum and maximum signal numbers that may be used by the FRSH
123 // implementation
124 #define FOSA_SIGNAL_MIN       SIGRTMIN
125 #define FOSA_SIGNAL_MAX       SIGRTMIN+0
126
127 #define FOSA_NULL_SIGNAL 0
128
129 /* FOSA Errors */
130
131 /* #include <error.h> */
132
133 /** Not enough memory available **/
134 #define FOSA_ENOMEM   ENOMEM
135
136 /** Invalid parameter **/
137 #define FOSA_EINVAL   EINVAL
138
139 /** Still pending information **/
140 #define FOSA_EAGAIN   EAGAIN
141
142 /** FOSA ADS errors **/
143 #define FOSA_EREJECT   EREJECT
144 #define FOSA_EMASKED   -2
145 #define FOSA_EPOLICY   -3
146
147
148
149 #endif /* MARTE_OS || RT_LINUX || AQuoSA */
150
151 //////////////////End of MaRTE OS, RT_LINUX & AQuoSA  ///////////////////
152
153 ////////////////////////// VIRTUAL TIME    //////////////////////////////////////
154
155 #if defined(VIRTUAL_TIME)
156 #include <fosa_vt.h>
157
158 #define FOSA_THREAD_ID_T_OPAQUE   vt_posix_process_t
159
160 #define FOSA_THREAD_ATTR_T_OPAQUE fosa_thread_attr_t
161
162 #define FOSA_SIGNAL_T_OPAQUE      int
163
164 #define FOSA_MUTEX_T_OPAQUE fosa_mutex_t
165
166 // The minimum and maximum signal numbers that may be used by the FRSH
167 // implementation
168 #define FOSA_SIGNAL_MIN       8
169 #define FOSA_SIGNAL_MAX       31
170
171 // the min. and max. priority a fosa thread can have
172 #define FOSA_PRIORITY_MAX VT_PRIORITY_MIN - 1
173 #define FOSA_PRIORITY_MIN VT_PRIORITY_MAX
174
175 #define FOSA_NULL_SIGNAL        0
176
177 /* FOSA Errors and return values*/
178
179 /** Invalid parameter **/
180 #define FOSA_EINVAL   -1
181
182 /** Not enough memory available **/
183 #define FOSA_ENOMEM   -2
184
185 /** Still pending information **/
186 #define FOSA_EAGAIN   -3
187
188 /** Mutex not available **/
189 #define FOSA_EBUSY         -4
190
191 /** Cond var timedout **/
192 #define FOSA_ETIMEDOUT  -5
193
194 /** FOSA ADS errors **/
195 #define FOSA_EREJECT   -6
196 #define FOSA_EMASKED   -7
197
198
199 /** Sched policy not correct */
200 #define FOSA_EPOLICY    -8
201
202 /** the value given by thread_id is not valid for ADS */
203 #define FOSA_ESRCH              -9
204
205 /** retval if no action performed **/
206 #define FOSA_NO_ACTION  0
207
208 #endif /* VIRTUAL_TIME */
209 //////////////////////////End of VIRTUAL TIME ///////////////////////////////////
210
211 ////////////////////////// OSE    //////////////////////////////////////
212
213 #if defined(OSE)
214
215 /* Put OSE dependent includes and defines here */
216
217 #endif /* OSE */
218 //////////////////////////End of OSE ////////////////////////////////////
219
220 ////////////////////////// DUMMY_OS    //////////////////////////////////////
221
222 #if defined(DUMMY_OS)
223
224 /* With this define we make sure that we are truly POSIX and OSE */
225 /* independent at the FRSH code.                                 */
226 /*****************************************************************/
227
228 #define FOSA_THREAD_ID_T_OPAQUE   int
229
230 #define FOSA_THREAD_ATTR_T_OPAQUE int
231
232 #define FOSA_SIGNAL_T_OPAQUE      int
233
234 #define FRSH_SIGNAL_INFO_T_OPAQUE int
235
236 #define FOSA_MUTEX_T_OPAQUE int
237
238 // The minimum and maximum signal numbers that may be used by the FRSH
239 // implementation
240 #define FOSA_SIGNAL_MIN       42
241 #define FOSA_SIGNAL_MAX       42
242
243 #define FOSA_NULL_SIGNAL 0
244
245 /* FOSA Errors */
246
247 /* #include <error.h> */
248
249 /** Not enough memory available **/
250 #define FOSA_ENOMEM   -1
251
252 /** Invalid parameter **/
253 #define FOSA_EINVAL   -2
254
255 /** Still pending information **/
256 #define FOSA_EAGAIN   -3
257
258 /** FOSA ADS errors **/
259 #define FOSA_EREJECT   -4
260 #define FOSA_EMASKED   -5
261
262 #define FOSA_EPOLICY -6
263
264 #endif /* DUMMY */
265 //////////////////////////End of DUMMY_OS ////////////////////////////////////
266
267
268
269
270
271
272 #endif      /* !FRSH_FOSA_OPAQUE_H_ */