Rev 985 | Rev 994 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
881 | trimarchi | 1 | //fsf_basic_types.h |
2 | //======================================================================= |
||
3 | // FFFFFFIII RRRRR SSTTTTTTT |
||
4 | // FF IIR RR SS |
||
5 | // FF IR SS |
||
6 | // FFFFFF RRRR SSSSST |
||
7 | // FF FI RRR SS |
||
8 | // FF II RRR SS |
||
9 | // FF IIIIIR RS |
||
10 | // |
||
11 | // Basic FSF(FIRST Scheduling Framework) common types |
||
12 | //======================================================================= |
||
13 | // |
||
14 | |||
993 | lipari | 15 | /** |
16 | \file fsf_basic_types.h |
||
17 | */ |
||
18 | |||
881 | trimarchi | 19 | #include <time.h> |
20 | #include "fsf_opaque_types.h" |
||
21 | #include "fsf_configuration_parameters.h" |
||
22 | |||
23 | #ifndef _FSF_BASIC_TYPES_H_ |
||
24 | #define _FSF_BASIC_TYPES_H_ |
||
25 | |||
26 | |||
27 | // Definition of types and constants used in fsf modules |
||
28 | |||
29 | |||
30 | // |
||
31 | // Types for the core module |
||
32 | // |
||
33 | |||
993 | lipari | 34 | /** |
35 | This data type is used for defining the workload parameter in the |
||
36 | contract specification functions. |
||
37 | |||
38 | It can have the following values: |
||
39 | |||
40 | - FSF_BOUNDED: The workload generated by the task(s) in the server is bounded |
||
41 | |||
42 | - FSF_INDETERMINATE: The workload generated by the task(s) in the server is indeterminate |
||
43 | |||
44 | - FSF_OVERHEAD: The workload generated by the task(s) in the server is TBD |
||
45 | |||
46 | */ |
||
881 | trimarchi | 47 | typedef enum {FSF_BOUNDED, FSF_INDETERMINATE, FSF_OVERHEAD} fsf_workload_t; |
48 | |||
993 | lipari | 49 | /// Default value for the workload parameter |
50 | #define FSF_DEFAULT_WORKLOAD FSF_INDETERMINATE |
||
889 | trimarchi | 51 | |
993 | lipari | 52 | /// Default value for the parameter d_equal_t in the contract initialization |
881 | trimarchi | 53 | #define FSF_DEFAULT_D_EQUALS_T false |
993 | lipari | 54 | |
55 | // Default value for the server relative deadline |
||
881 | trimarchi | 56 | #define FSF_DEFAULT_DEADLINE {0,0} //struct timespec |
57 | |||
889 | trimarchi | 58 | // Constants for omitting the assignment of values |
59 | // to specific arguments in calls to |
||
60 | // initialization functions |
||
61 | |||
993 | lipari | 62 | /// A null deadline |
881 | trimarchi | 63 | #define FSF_NULL_DEADLINE (struct timespec *)NULL |
993 | lipari | 64 | |
65 | /// A null signal |
||
881 | trimarchi | 66 | #define FSF_NULL_SIGNAL 0 |
67 | |||
971 | trimarchi | 68 | /** |
993 | lipari | 69 | This data type is used to express the list of possible values |
70 | returned by fsf_get_renegotiation_status. It can assume the |
||
71 | following values: |
||
72 | |||
73 | |||
971 | trimarchi | 74 | */ |
75 | typedef enum {FSF_IN_PROGRESS, |
||
76 | FSF_REJECTED, |
||
77 | FSF_ADMITTED, |
||
78 | FSF_NOT_REQUESTED} |
||
79 | fsf_renegotiation_status_t; |
||
889 | trimarchi | 80 | |
971 | trimarchi | 81 | |
985 | julio | 82 | /** |
83 | Contract parameters type; it is an opaque type (i.e. the internal |
||
84 | structure of this data type is implementation dependent). The user |
||
85 | can access and modify the parameters of a contract only with the |
||
86 | proper functions, and should never access the data directly. |
||
87 | */ |
||
88 | typedef FSF_CONTRACT_PARAMETERS_T_OPAQUE fsf_contract_parameters_t; |
||
89 | |||
90 | |||
91 | /** |
||
92 | Synchronization object handle type, this an opaque type |
||
93 | used to signaling of servers |
||
94 | */ |
||
95 | typedef FSF_SYNCH_OBJ_HANDLE_T_OPAQUE fsf_synch_obj_handle_t; |
||
96 | |||
97 | |||
98 | |||
99 | /** |
||
100 | Server Id type, that identifies a server created to manage a given |
||
101 | contract |
||
102 | */ |
||
103 | typedef int fsf_server_id_t; // => 0 |
||
104 | |||
105 | /** |
||
106 | The type references a function that may become a thread's |
||
107 | code |
||
108 | */ |
||
109 | typedef void * (*fsf_thread_code_t) (void *); |
||
110 | |||
111 | |||
112 | /// List of contracts to negotiate |
||
113 | typedef struct { |
||
114 | int size; |
||
115 | fsf_contract_parameters_t* contracts[FSF_MAX_N_SERVERS]; |
||
116 | } fsf_contracts_group_t; |
||
117 | |||
118 | /// List of servers to cancel |
||
119 | typedef struct { |
||
120 | int size; |
||
121 | fsf_server_id_t servers[FSF_MAX_N_SERVERS]; |
||
122 | } fsf_servers_group_t; |
||
123 | |||
124 | |||
125 | |||
126 | |||
881 | trimarchi | 127 | // |
128 | // Types for the spare capacity module |
||
129 | // |
||
130 | |||
993 | lipari | 131 | /** |
132 | Granularity of spare capacity requirements. This data type is used |
||
133 | in the spare capacity module to specify the kind of granularity in |
||
134 | spare capacity allocation when creating a new contract. |
||
135 | |||
136 | A variable of this type can assume the following values: |
||
137 | |||
138 | - FSF_CONTINUOUS the utilization assigned to the server by the |
||
139 | spare capacity module can assume any value between the minimum |
||
140 | (Cmin / Tmax) and the maximum (Cmax/Tmin). |
||
141 | |||
142 | - FSF_DISCRETE the utilization assigned to the server can assume |
||
143 | only values in a discrete set of pairs (C,T) (to be specified |
||
144 | with a variable of type fsf_utilization_set_t) |
||
145 | |||
146 | */ |
||
881 | trimarchi | 147 | typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t; |
148 | |||
993 | lipari | 149 | /** |
150 | This data type is used in the spare capacity module to specify |
||
151 | pairs of (budget,period) that can be assigned by the spare capacity |
||
152 | distribution algorithm to the server. |
||
153 | respectively. |
||
154 | */ |
||
881 | trimarchi | 155 | typedef struct { |
993 | lipari | 156 | /// server capacity |
157 | struct timespec budget; |
||
158 | /// server period |
||
159 | struct timespec period; |
||
881 | trimarchi | 160 | } fsf_utilization_value_t; |
161 | |||
993 | lipari | 162 | |
163 | /** |
||
164 | This data type is used in the spare capacity module to specify a |
||
165 | set of possible pairs (C,T) that can be assigned to the server. |
||
166 | */ |
||
881 | trimarchi | 167 | typedef struct { |
993 | lipari | 168 | /// lenght of the array |
881 | trimarchi | 169 | int size; // = 0 |
993 | lipari | 170 | /// array of pairs (C,T) |
881 | trimarchi | 171 | fsf_utilization_value_t |
172 | value[FSF_MAX_N_UTILIZATION_VALUES]; |
||
173 | } fsf_utilization_set_t; |
||
174 | |||
993 | lipari | 175 | |
176 | /// The defualt granularity |
||
881 | trimarchi | 177 | #define FSF_DEFAULT_GRANULARITY FSF_CONTINUOUS |
993 | lipari | 178 | |
179 | /// Defaut value for the quality parameter |
||
881 | trimarchi | 180 | #define FSF_DEFAULT_QUALITY 0 |
993 | lipari | 181 | |
182 | /// Default value for the importance parameter |
||
881 | trimarchi | 183 | #define FSF_DEFAULT_IMPORTANCE 1 |
184 | |||
993 | lipari | 185 | /// Constant for omitting the assignment of values to the |
186 | /// fsf_utilizazion_set_t parameter in call to the contract initialization |
||
187 | /// functions |
||
881 | trimarchi | 188 | #define FSF_NULL_UTILIZATION_SET \ |
189 | (fsf_utilization_set_t *)NULL |
||
190 | |||
993 | lipari | 191 | /// Maximum value of the quality parameter |
985 | julio | 192 | #define FSF_MAX_QUALITY (2**32 -1) |
993 | lipari | 193 | |
194 | /// Minimum value of the quality parameter |
||
985 | julio | 195 | #define FSF_MIN_QUALITY 0 |
993 | lipari | 196 | |
197 | /// Maximum value of the importance parameter |
||
985 | julio | 198 | #define FSF_MAX_IMPORTANCE FSF_N_IMPORTANCE_LEVELS |
993 | lipari | 199 | |
200 | /// Minimum value of the importance parameter |
||
985 | julio | 201 | #define FSF_MIN_IMPORTANCE 1 |
881 | trimarchi | 202 | |
985 | julio | 203 | |
204 | |||
205 | |||
881 | trimarchi | 206 | // |
207 | // Types for the implementation specific module |
||
208 | // |
||
209 | |||
889 | trimarchi | 210 | //Implementation specific preemption level values |
881 | trimarchi | 211 | typedef unsigned long fsf_preemption_level_t; |
212 | // range 1..2**32-1 |
||
213 | |||
214 | |||
215 | // |
||
216 | // Types for the shared objects module |
||
217 | // |
||
218 | |||
889 | trimarchi | 219 | // Shared object identifier (null character terminated string) |
881 | trimarchi | 220 | typedef char * fsf_shared_obj_id_t; |
221 | |||
889 | trimarchi | 222 | // Shared object handle (opaque type) |
881 | trimarchi | 223 | typedef FSF_SHARED_OBJ_HANDLE_T_OPAQUE fsf_shared_obj_handle_t; |
224 | |||
889 | trimarchi | 225 | // Critical section data |
881 | trimarchi | 226 | typedef struct { |
227 | fsf_shared_obj_handle_t obj_handle; |
||
228 | struct timespec wcet; //Execution time |
||
229 | } fsf_critical_section_data_t; |
||
230 | |||
889 | trimarchi | 231 | // List of critical sections |
881 | trimarchi | 232 | typedef struct { |
233 | int size; // = 0 |
||
234 | fsf_critical_section_data_t |
||
235 | section[FSF_MAX_N_CRITICAL_SECTIONS]; |
||
236 | } fsf_critical_sections_t; |
||
237 | |||
238 | |||
239 | // |
||
240 | // Types for the hierarchical module |
||
241 | // |
||
242 | |||
889 | trimarchi | 243 | // Scheduling policies |
971 | trimarchi | 244 | typedef enum {FSF_FP, FSF_EDF, FSF_TABLE_DRIVEN, FSF_RR, FSF_NONE} |
881 | trimarchi | 245 | fsf_sched_policy_t; |
246 | |||
889 | trimarchi | 247 | // Scheduling policy and parameters |
881 | trimarchi | 248 | typedef struct { |
249 | fsf_sched_policy_t policy; |
||
250 | void * params; |
||
251 | } fsf_sched_params_t; |
||
889 | trimarchi | 252 | // The params member is a pointer to one of the |
253 | // following: |
||
254 | // FP: int (priority) |
||
255 | // EDF: struct timespec (deadline) |
||
985 | julio | 256 | // RR: none |
889 | trimarchi | 257 | // TABLE_DRIVEN : struct fsf_table_driven_params_t |
881 | trimarchi | 258 | |
971 | trimarchi | 259 | |
260 | //Scheduling parameters for the table-driven policy |
||
261 | //list of target windows |
||
262 | typedef struct fsf_target_window { |
||
263 | struct timespec start; |
||
264 | struct timespec end; |
||
265 | struct timespec comp_time; |
||
266 | } fsf_target_window; |
||
267 | |||
881 | trimarchi | 268 | typedef struct { |
909 | trimarchi | 269 | int size; |
971 | trimarchi | 270 | fsf_target_window table[FSF_MAX_N_TARGET_WINDOWS]; |
881 | trimarchi | 271 | } fsf_table_driven_params_t; |
272 | |||
273 | |||
889 | trimarchi | 274 | //Initialization information for a scheduling policy |
881 | trimarchi | 275 | typedef void * fsf_sched_init_info_t; |
993 | lipari | 276 | |
889 | trimarchi | 277 | // It shall be one of the following: |
278 | // FP: none |
||
279 | // EDF: none |
||
985 | julio | 280 | // RR: struct timespec (slice duration) |
889 | trimarchi | 281 | // TABLE_DRIVEN : struct timespec (schedule duration) |
881 | trimarchi | 282 | |
985 | julio | 283 | // Constant for assigning default values |
284 | #define FSF_DEFAULT_SCHED_POLICY FSF_NONE |
||
285 | |||
286 | |||
901 | trimarchi | 287 | // |
288 | // Types for the distributed services module |
||
289 | // |
||
881 | trimarchi | 290 | |
901 | trimarchi | 291 | // Type designating the network ids. They need not |
292 | // be sequential numbers. |
||
293 | typedef unsigned int fsf_network_id_t; |
||
881 | trimarchi | 294 | |
901 | trimarchi | 295 | #define FSF_DEFAULT_NETWORK_ID 1 |
296 | #define FSF_NULL_NETWORK_ID 0 |
||
297 | |||
985 | julio | 298 | //opaque types for fsf endpoints |
299 | typedef FSF_SEND_ENDPOINT_T_OPAQUE fsf_send_endpoint_t; |
||
300 | typedef FSF_RECEIVE_ENDPOINT_T_OPAQUE fsf_receive_endpoint_t; |
||
901 | trimarchi | 301 | |
985 | julio | 302 | /** |
303 | \ingroup distjmodule |
||
304 | |||
305 | The node_address type specifies the node address in a |
||
306 | communication-protocol-independent way. The actual address is |
||
307 | obtained via a configuration dependent mapping function |
||
308 | */ |
||
309 | typedef unsigned int fsf_node_address_t; |
||
310 | |||
311 | /** |
||
312 | \ingroup distjmodule |
||
313 | |||
314 | The port type specifies the information that is necessary to get in |
||
315 | contact with the thread in the receiving node, in a |
||
316 | protocol-independent way. The actual port number is obtained via a |
||
317 | configuration dependent mapping function |
||
318 | */ |
||
319 | typedef unsigned int fsf_port_t; |
||
320 | |||
321 | |||
322 | |||
323 | |||
889 | trimarchi | 324 | // Error codes |
971 | trimarchi | 325 | #define FSF_ERR_BASE_VALUE 0x02004000 |
889 | trimarchi | 326 | |
971 | trimarchi | 327 | #define FSF_ERR_TOO_MANY_TASKS 0x02004001 |
328 | #define FSF_ERR_BAD_ARGUMENT 0x02004002 |
||
329 | #define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE 0x02004003 |
||
330 | #define FSF_ERR_NO_RENEGOTIATION_REQUESTED 0x02004004 |
||
331 | #define FSF_ERR_CONTRACT_REJECTED 0x02004005 |
||
332 | #define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD 0x02004006 |
||
985 | julio | 333 | #define FSF_ERR_NOT_BOUND 0x02004007 |
971 | trimarchi | 334 | #define FSF_ERR_UNKNOWN_SCHEDULED_THREAD 0x02004008 |
335 | #define FSF_ERR_NOT_CONTRACTED_SERVER 0x02004009 |
||
336 | #define FSF_ERR_NOT_SCHEDULED_THREAD 0x0200400A |
||
337 | #define FSF_ERR_TOO_MANY_SERVICE_JOBS 0x0200400B |
||
338 | #define FSF_ERR_TOO_MANY_SYNCH_OBJS 0x0200400C |
||
339 | #define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ 0x0200400D |
||
340 | #define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ 0x0200400E |
||
341 | #define FSF_ERR_INTERNAL_ERROR 0x0200400F |
||
342 | #define FSF_ERR_TOO_MANY_SERVERS 0x02004010 |
||
343 | #define FSF_ERR_INVALID_SCHEDULER_REPLY 0x02004011 |
||
344 | #define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 0x02004012 |
||
345 | #define FSF_ERR_SYSTEM_ALREADY_INITIALIZED 0x02004013 |
||
346 | #define FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED 0x02004014 |
||
347 | #define FSF_ERR_SHARED_OBJ_NOT_INITIALIZED 0x02004015 |
||
348 | #define FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE 0x02004016 |
||
349 | #define FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE 0x02004017 |
||
350 | #define FSF_ERR_ALREADY_BOUND 0x02004018 |
||
351 | #define FSF_ERR_WRONG_NETWORK 0x02004019 |
||
352 | #define FSF_ERR_TOO_LARGE 0x0200401A |
||
353 | #define FSF_ERR_BUFFER_FULL 0x0200401B |
||
354 | #define FSF_ERR_NO_SPACE 0x0200401C |
||
355 | #define FSF_ERR_NO_MESSAGES 0x0200401D |
||
356 | #define FSF_WRN_MODULE_NOT_SUPPORTED 0x0200401E |
||
357 | #define FSF_ERR_SYSTEM_NOT_INITIALIZED 0x0200401F |
||
358 | #define FSF_ERR_TOO_MANY_SHARED_OBJS 0x02004020 |
||
889 | trimarchi | 359 | |
971 | trimarchi | 360 | #define FSF_ERR_LAST_VALUE 0x02004020 |
361 | |||
889 | trimarchi | 362 | |
901 | trimarchi | 363 | |
881 | trimarchi | 364 | #endif // _FSF_BASIC_TYPES_H_ |