]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_implementation_specific.h
Adapting FRSH to the new time types and synchronising headers with phase 2
[frescor/frsh-include.git] / frsh_implementation_specific.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_implementation_specific.h
59 //==============================================
60 //  ******** *******    ********  **      **
61 //  **///// /**////**  **//////  /**     /**
62 //  **      /**   /** /**        /**     /**
63 //  ******* /*******  /********* /**********
64 //  **////  /**///**  ////////** /**//////**
65 //  **      /**  //**        /** /**     /**
66 //  **      /**   //** ********  /**     /**
67 //  //       //     // ////////   //      // 
68 //
69 // FRSH(FRescor ScHeduler), pronounced "fresh"
70 //==============================================
71 #ifndef _FRSH_IMPLEMENTATION_SPECIFIC_H_
72 #define _FRSH_IMPLEMENTATION_SPECIFIC_H_
73
74 #include "frsh_implementation_specific_types.h"
75 #include "frsh_core.h"
76
77 #define FRSH_IMPLEMENTATION_SPECIFIC_MODULE_SUPPORTED     1
78
79 FRSH_CPP_BEGIN_DECLS
80
81 /**
82  * @file frsh_implementation_specific.h
83  *
84  **/
85
86 /**
87  * @defgroup implementationspec Implementation Specific module
88  *
89  * The operations defined in this module are of optional use. The
90  * intention is to provide better tunning options taking advantage of
91  * specific characteristics of the underlaying OS.
92  *
93  *
94  * e.g. being able to manually assign priorities assuming that the OS
95  * uses a fixed priority paradigm).
96  *
97  * @{
98  **/
99
100 /**
101  * frsh_contract_set_preemption_level()
102  *
103  * The operation updates the specified contract parameters object by
104  * setting its preemption level to the specified input parameter.
105  *
106  * OBSERVATION: if this value is changed being any contract that
107  * uses the resource already accepted, the system's behavior and
108  * particularly the acceptance tests correctness are not garantee
109  * and probably wrong.
110  *
111  **/
112 int frsh_contract_set_preemption_level
113   (frsh_contract_t     *contract,
114    frsh_preemption_level_t         preemption_level);
115
116
117 /**
118  * frsh_contract_get_preemption_level()
119  *
120  * The operation obtains from the specified contract parameters object
121  * its preemption level and copies it to the place pointed to by the
122  * specified input parameter.
123  **/
124 int frsh_contract_get_preemption_level
125       (const frsh_contract_t *contract,
126        frsh_preemption_level_t          *preemption_level);
127
128 /**
129  * frsh_service_thread_set_preemption_level()
130  *
131  * This function sets the preemption level of the service thread to
132  * the specified value. The initial preemption level is a configurable
133  * parameter. This value is stored in a temporary variable and it is
134  * used the next time the service thread data is updated with the
135  * frsh_service_thread_set_data() function.
136  **/
137 int frsh_service_thread_set_preemption_level
138       (frsh_preemption_level_t         preemption_level);
139
140 /**
141  * frsh_service_thread_get_preemption_level()
142  *
143  * This function stores the current preemption level of the service
144  * thread in the variable pointed to by preemption_level
145  **/
146 int frsh_service_thread_get_preemption_level
147         (frsh_preemption_level_t        *preemption_level);
148
149
150 /**
151  * frsh_thread_exit()
152  *
153  * This operation shall terminate the calling thread, make the value
154  * value_ptr available to any successful join with the terminating
155  * thread, and unbind the thread from its associated vres. After
156  * cleaning up the thread management data, it is unbound and the
157  * scheduling policy is changed to fixed priority before the posix
158  * pthread_exit() function is called.
159  *
160  * There is a limitation in the current version of the
161  * MaRTE implementation that causes the information of a terminated
162  * thread to continue to be stored in the frsh scheduler, and the thread
163  * to continue to be counted in the number of threads. The
164  * frsh_thread_exit operation allows the implementation to delete the
165  * thread's information, and then terminate the thread. Therefore, it
166  * is recommended to use this function to terminate a thread under frsh.
167  *
168  * Implementation dependent issue: in the implementation with an
169  * application scheduler, after cleaning up the thread management
170  * data, it is unbound and the scheduling policy changed to fixed
171  * priority before calling the posix pthread_exit() function.
172  *
173  * NOTE:  This function, together with the internal function
174  *        frsh_internal_remove_thread()  has been removed from FRSH
175  *        because it shouldn't be necessary.
176  *
177  *        If there are some problems with MaRTE in thread termination
178  *        it should be fixed in the OS and not here.
179  *
180  * The function does not do anything special that is not done in the
181  * terminate callback of the FRSH scheduler.
182  *
183  * If you want to be curious about what the function did, look at the
184  * SVN repository (revision 273) or one of the past branches.
185  **/
186 void frsh_thread_exit (void *value_ptr);
187
188
189 /**
190  * frsh_sharedobj_set_preemption_level()
191  *
192  * The operation updates the specified shared object by setting its
193  * preemption level to the specified input parameter.
194  *
195  * OBSERVATION: if this value is changed being any contract that
196  * uses the resource already accepted, the system's behavior and
197  * particularly the acceptance tests correctness are not garantee
198  * and probably wrong.
199  **/
200 int frsh_sharedobj_set_preemption_level(frsh_sharedobj_handle_t  obj_handle,
201                                      frsh_preemption_level_t   preemption_level);
202
203 /**
204  * frsh_sharedobj_get_preemption_level()
205  *
206  * The operation obtains from the specified shared object its
207  * preemption level and copies it to the place pointed to by the
208  * specified input parameter.
209  **/
210 int frsh_sharedobj_get_preemption_level(frsh_sharedobj_handle_t  obj_handle,
211                         frsh_preemption_level_t  *preemption_level);
212
213 /*@}*/
214
215 FRSH_CPP_END_DECLS
216
217 #endif // _FRSH_IMPLEMENTATION_SPECIFIC_H_