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