]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_implementation_specific.h
unmarshal
[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 /**
80  * @file frsh_implementation_specific.h
81  *
82  **/
83
84 /**
85  * @defgroup implementationspec Implementation Specific module
86  *
87  * The operations defined in this module are of optional use. The
88  * intention is to provide better tunning options taking advantage of
89  * specific characteristics of the underlaying OS.
90  *
91  *
92  * e.g. being able to manually assign priorities assuming that the OS
93  * uses a fixed priority paradigm).
94  *
95  * @{
96  **/
97
98 /**
99  * frsh_contract_set_preemption_level()
100  *
101  * The operation updates the specified contract parameters object by
102  * setting its preemption level to the specified input parameter.
103  *
104  * OBSERVATION: if this value is changed being any contract that
105  * uses the resource already accepted, the system's behavior and
106  * particularly the acceptance tests correctness are not garantee
107  * and probably wrong.
108  *
109  **/
110 int frsh_contract_set_preemption_level
111   (frsh_contract_t     *contract,
112    frsh_preemption_level_t         preemption_level);
113
114
115 /**
116  * frsh_contract_get_preemption_level()
117  *
118  * The operation obtains from the specified contract parameters object
119  * its preemption level and copies it to the place pointed to by the
120  * specified input parameter.
121  **/
122 int frsh_contract_get_preemption_level
123       (const frsh_contract_t *contract,
124        frsh_preemption_level_t          *preemption_level);
125
126 /**
127  * frsh_service_thread_set_preemption_level()
128  *
129  * This function sets the preemption level of the service thread to
130  * the specified value. The initial preemption level is a configurable
131  * parameter. This value is stored in a temporary variable and it is
132  * used the next time the service thread data is updated with the
133  * frsh_set_service_thread_data() function.
134  **/
135 int frsh_service_thread_set_preemption_level
136       (frsh_preemption_level_t         preemption_level);
137
138 /**
139  * frsh_service_thread_get_preemption_level()
140  *
141  * This function stores the current preemption level of the service
142  * thread in the variable pointed to by preemption_level
143  **/
144 int frsh_service_thread_get_preemption_level
145         (frsh_preemption_level_t        *preemption_level);
146
147
148 /**
149  * frsh_thread_exit()
150  *
151  * This operation shall terminate the calling thread, make the value
152  * value_ptr available to any successful join with the terminating
153  * thread, and unbind the thread from its associated vres. After
154  * cleaning up the thread management data, it is unbound and the
155  * scheduling policy is changed to fixed priority before the posix
156  * pthread_exit() function is called.
157  * 
158  * There is a limitation in the current version of the
159  * MaRTE implementation that causes the information of a terminated
160  * thread to continue to be stored in the frsh scheduler, and the thread
161  * to continue to be counted in the number of threads. The
162  * frsh_thread_exit operation allows the implementation to delete the
163  * thread's information, and then terminate the thread. Therefore, it
164  * is recommended to use this function to terminate a thread under frsh.
165  *
166  * Implementation dependent issue: in the implementation with an
167  * application scheduler, after cleaning up the thread management
168  * data, it is unbound and the scheduling policy changed to fixed
169  * priority before calling the posix pthread_exit() function.
170  **/
171 void frsh_thread_exit (void *value_ptr);
172
173
174 /**
175  * frsh_sharedobj_set_preemption_level()
176  *
177  * The operation updates the specified shared object by setting its
178  * preemption level to the specified input parameter.
179  *
180  * OBSERVATION: if this value is changed being any contract that
181  * uses the resource already accepted, the system's behavior and
182  * particularly the acceptance tests correctness are not garantee
183  * and probably wrong.
184  **/
185 int frsh_sharedobj_set_preemption_level(frsh_sharedobj_handle_t  obj_handle,
186                                      frsh_preemption_level_t   preemption_level);
187
188 /**
189  * frsh_sharedobj_get_preemption_level()
190  *
191  * The operation obtains from the specified shared object its
192  * preemption level and copies it to the place pointed to by the
193  * specified input parameter.
194  **/
195 int frsh_sharedobj_get_preemption_level(frsh_sharedobj_handle_t  obj_handle,
196                         frsh_preemption_level_t  *preemption_level);
197
198 /*@}*/
199
200
201 #endif // _FRSH_IMPLEMENTATION_SPECIFIC_H_