1 // -----------------------------------------------------------------------
2 // Copyright (C) 2006 - 2007 FRESCOR consortium partners:
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
11 // Thales Communication S.A. FRANCE
12 // Visual Tools S.A. SPAIN
13 // Rapita Systems Ltd UK
16 // See http://www.frescor.org for a link to partners' websites
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
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 // FSF API web pages: http://marte.unican.es/fsf/docs
32 // http://shark.sssup.it/contrib/first/docs/
34 // This file is part of FRSH API
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)
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.
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
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
57 // -----------------------------------------------------------------------
58 //frsh_implementation_specific.h
59 //==============================================
60 // ******** ******* ******** ** **
61 // **///// /**////** **////// /** /**
62 // ** /** /** /** /** /**
63 // ******* /******* /********* /**********
64 // **//// /**///** ////////** /**//////**
65 // ** /** //** /** /** /**
66 // ** /** //** ******** /** /**
67 // // // // //////// // //
69 // FRSH(FRescor ScHeduler), pronounced "fresh"
70 //==============================================
71 #ifndef _FRSH_IMPLEMENTATION_SPECIFIC_H_
72 #define _FRSH_IMPLEMENTATION_SPECIFIC_H_
74 #include "frsh_implementation_specific_types.h"
75 #include "frsh_core.h"
77 #define FRSH_IMPLEMENTATION_SPECIFIC_MODULE_SUPPORTED 1
82 * @file frsh_implementation_specific.h
87 * @defgroup implementationspec Implementation Specific module
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.
94 * e.g. being able to manually assign priorities assuming that the OS
95 * uses a fixed priority paradigm).
101 * frsh_contract_set_preemption_level()
103 * The operation updates the specified contract parameters object by
104 * setting its preemption level to the specified input parameter.
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.
112 int frsh_contract_set_preemption_level
113 (frsh_contract_t *contract,
114 frsh_preemption_level_t preemption_level);
118 * frsh_contract_get_preemption_level()
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.
124 int frsh_contract_get_preemption_level
125 (const frsh_contract_t *contract,
126 frsh_preemption_level_t *preemption_level);
129 * frsh_service_thread_set_preemption_level()
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.
137 int frsh_service_thread_set_preemption_level
138 (frsh_preemption_level_t preemption_level);
141 * frsh_service_thread_get_preemption_level()
143 * This function stores the current preemption level of the service
144 * thread in the variable pointed to by preemption_level
146 int frsh_service_thread_get_preemption_level
147 (frsh_preemption_level_t *preemption_level);
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.
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.
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.
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.
177 * If there are some problems with MaRTE in thread termination
178 * it should be fixed in the OS and not here.
180 * The function does not do anything special that is not done in the
181 * terminate callback of the FRSH scheduler.
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.
186 void frsh_thread_exit (void *value_ptr);
190 * frsh_sharedobj_set_preemption_level()
192 * The operation updates the specified shared object by setting its
193 * preemption level to the specified input parameter.
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.
200 int frsh_sharedobj_set_preemption_level(frsh_sharedobj_handle_t obj_handle,
201 frsh_preemption_level_t preemption_level);
204 * frsh_sharedobj_get_preemption_level()
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.
210 int frsh_sharedobj_get_preemption_level(frsh_sharedobj_handle_t obj_handle,
211 frsh_preemption_level_t *preemption_level);
217 #endif // _FRSH_IMPLEMENTATION_SPECIFIC_H_