Subversion Repositories shark

Rev

Rev 971 | Rev 993 | 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
 
15
#include <time.h>
16
#include "fsf_opaque_types.h"
17
#include "fsf_configuration_parameters.h"
18
 
19
#ifndef _FSF_BASIC_TYPES_H_
20
#define _FSF_BASIC_TYPES_H_
21
 
22
 
23
// Definition of types and constants used in fsf modules
24
 
25
 
26
//
27
// Types for the core module
28
//
29
 
889 trimarchi 30
// Kind of workload expected in servers
881 trimarchi 31
typedef enum {FSF_BOUNDED, FSF_INDETERMINATE, FSF_OVERHEAD} fsf_workload_t;                          
32
 
889 trimarchi 33
// Constants for assigning default values
34
 
881 trimarchi 35
#define FSF_DEFAULT_WORKLOAD       FSF_INDETERMINATE
36
#define FSF_DEFAULT_D_EQUALS_T     false
37
#define FSF_DEFAULT_DEADLINE       {0,0} //struct timespec
38
 
889 trimarchi 39
// Constants for omitting the assignment of values
40
// to specific arguments in calls to
41
// initialization functions
42
 
881 trimarchi 43
#define FSF_NULL_DEADLINE     (struct timespec *)NULL
44
#define FSF_NULL_SIGNAL       0
45
 
971 trimarchi 46
/**
47
   Possible values returned by fsf_get_renegotiation_status
48
*/
49
typedef enum {FSF_IN_PROGRESS,
50
              FSF_REJECTED,
51
              FSF_ADMITTED,
52
              FSF_NOT_REQUESTED}
53
    fsf_renegotiation_status_t;
889 trimarchi 54
 
971 trimarchi 55
 
985 julio 56
/**
57
    Contract parameters type; it is an opaque type (i.e. the internal
58
    structure of this data type is implementation dependent). The user
59
    can access and modify the parameters of a contract only with the
60
    proper functions, and should never access the data directly.
61
*/
62
typedef FSF_CONTRACT_PARAMETERS_T_OPAQUE fsf_contract_parameters_t;
63
 
64
 
65
/**
66
    Synchronization object handle type, this an opaque type
67
    used to signaling of servers
68
*/
69
typedef FSF_SYNCH_OBJ_HANDLE_T_OPAQUE fsf_synch_obj_handle_t;
70
 
71
 
72
 
73
/**
74
    Server Id type, that identifies a server created to manage a given
75
    contract
76
*/
77
typedef int      fsf_server_id_t;             // => 0
78
 
79
/**
80
    The type references a function that may become a thread's
81
    code
82
*/
83
typedef void * (*fsf_thread_code_t) (void *);
84
 
85
 
86
/// List of contracts to negotiate
87
typedef struct {
88
  int  size;
89
  fsf_contract_parameters_t*  contracts[FSF_MAX_N_SERVERS];
90
} fsf_contracts_group_t;
91
 
92
/// List of servers to cancel
93
typedef  struct {
94
  int             size;
95
  fsf_server_id_t servers[FSF_MAX_N_SERVERS];
96
} fsf_servers_group_t;
97
 
98
 
99
 
100
 
881 trimarchi 101
//
102
// Types for the spare capacity module
103
//
104
 
889 trimarchi 105
// Granularity of spare capacity requirements
881 trimarchi 106
typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t;
107
 
889 trimarchi 108
// Utilization (budget and period) value
881 trimarchi 109
typedef struct {
110
  struct timespec    budget;    // Execution time
111
  struct timespec    period;    // Period
112
} fsf_utilization_value_t;
113
 
889 trimarchi 114
//List of utilization values
881 trimarchi 115
typedef struct {
116
  int                         size; // = 0
117
  fsf_utilization_value_t    
118
      value[FSF_MAX_N_UTILIZATION_VALUES];
119
} fsf_utilization_set_t;
120
 
889 trimarchi 121
// Constants for assigning default values
881 trimarchi 122
#define FSF_DEFAULT_GRANULARITY         FSF_CONTINUOUS
123
#define FSF_DEFAULT_QUALITY             0
124
#define FSF_DEFAULT_IMPORTANCE          1
125
 
889 trimarchi 126
// Constants for omitting the assignment of values to specific
127
// arguments in calls to initialization functions
128
 
881 trimarchi 129
#define FSF_NULL_UTILIZATION_SET     \
130
   (fsf_utilization_set_t *)NULL
131
 
985 julio 132
// Constants used in the specification of the spare capacity
133
// operations
134
#define FSF_MAX_QUALITY     (2**32 -1)
135
#define FSF_MIN_QUALITY     0
136
#define FSF_MAX_IMPORTANCE  FSF_N_IMPORTANCE_LEVELS
137
#define FSF_MIN_IMPORTANCE  1
881 trimarchi 138
 
985 julio 139
 
140
 
141
 
881 trimarchi 142
//
143
// Types for the implementation specific module
144
//
145
 
889 trimarchi 146
//Implementation specific preemption level values
881 trimarchi 147
typedef unsigned long      fsf_preemption_level_t;
148
                           // range 1..2**32-1
149
 
150
 
151
//
152
// Types for the shared objects module
153
//
154
 
889 trimarchi 155
// Shared object identifier (null character terminated string)
881 trimarchi 156
typedef char  * fsf_shared_obj_id_t;    
157
 
889 trimarchi 158
// Shared object handle (opaque type)
881 trimarchi 159
typedef FSF_SHARED_OBJ_HANDLE_T_OPAQUE  fsf_shared_obj_handle_t;
160
 
889 trimarchi 161
// Critical section data
881 trimarchi 162
typedef struct {
163
   fsf_shared_obj_handle_t obj_handle;
164
   struct timespec         wcet;  //Execution time
165
} fsf_critical_section_data_t;
166
 
889 trimarchi 167
// List of critical sections
881 trimarchi 168
typedef struct {
169
  int size; // = 0
170
  fsf_critical_section_data_t  
171
      section[FSF_MAX_N_CRITICAL_SECTIONS];
172
} fsf_critical_sections_t;
173
 
174
 
175
//
176
// Types for the hierarchical module
177
//
178
 
889 trimarchi 179
// Scheduling policies
971 trimarchi 180
typedef enum {FSF_FP, FSF_EDF, FSF_TABLE_DRIVEN, FSF_RR, FSF_NONE}
881 trimarchi 181
    fsf_sched_policy_t;
182
 
889 trimarchi 183
// Scheduling policy and parameters
881 trimarchi 184
typedef struct {
185
  fsf_sched_policy_t    policy;
186
  void *                params;
187
} fsf_sched_params_t;
889 trimarchi 188
// The params member is a pointer to one of the 
189
// following:
190
//    FP:  int (priority)
191
//    EDF: struct timespec (deadline)
985 julio 192
//    RR:  none
889 trimarchi 193
//    TABLE_DRIVEN : struct fsf_table_driven_params_t
881 trimarchi 194
 
971 trimarchi 195
 
196
//Scheduling parameters for the table-driven policy
197
//list of target windows 
198
typedef struct fsf_target_window {
199
   struct timespec   start;
200
   struct timespec   end;
201
   struct timespec   comp_time;
202
} fsf_target_window;
203
 
881 trimarchi 204
typedef struct {
909 trimarchi 205
  int size;
971 trimarchi 206
  fsf_target_window  table[FSF_MAX_N_TARGET_WINDOWS];
881 trimarchi 207
} fsf_table_driven_params_t;
208
 
209
 
889 trimarchi 210
//Initialization information for a scheduling policy
881 trimarchi 211
typedef void * fsf_sched_init_info_t;
889 trimarchi 212
// It shall be one of the following:
213
//    FP:  none
214
//    EDF: none
985 julio 215
//    RR: struct timespec (slice duration)
889 trimarchi 216
//    TABLE_DRIVEN : struct timespec (schedule duration)
881 trimarchi 217
 
985 julio 218
// Constant for assigning default values
219
#define FSF_DEFAULT_SCHED_POLICY        FSF_NONE
220
 
221
 
901 trimarchi 222
//
223
// Types for the distributed services module
224
//
881 trimarchi 225
 
901 trimarchi 226
// Type designating the network ids. They need not
227
// be sequential numbers.
228
typedef unsigned int       fsf_network_id_t;
881 trimarchi 229
 
901 trimarchi 230
#define FSF_DEFAULT_NETWORK_ID          1
231
#define FSF_NULL_NETWORK_ID             0
232
 
985 julio 233
//opaque types for fsf endpoints
234
typedef FSF_SEND_ENDPOINT_T_OPAQUE   fsf_send_endpoint_t;
235
typedef FSF_RECEIVE_ENDPOINT_T_OPAQUE fsf_receive_endpoint_t;
901 trimarchi 236
 
985 julio 237
/**
238
   \ingroup distjmodule
239
 
240
   The node_address type specifies the node address in a
241
   communication-protocol-independent way. The actual address is
242
   obtained via a configuration dependent mapping function
243
*/
244
typedef unsigned int  fsf_node_address_t;
245
 
246
/**
247
   \ingroup distjmodule
248
 
249
   The port type specifies the information that is necessary to get in
250
   contact with the thread in the receiving node, in a
251
   protocol-independent way.  The actual port number is obtained via a
252
   configuration dependent mapping function
253
*/
254
typedef unsigned int  fsf_port_t;
255
 
256
 
257
 
258
 
889 trimarchi 259
// Error codes
971 trimarchi 260
#define FSF_ERR_BASE_VALUE                      0x02004000
889 trimarchi 261
 
971 trimarchi 262
#define FSF_ERR_TOO_MANY_TASKS                  0x02004001
263
#define FSF_ERR_BAD_ARGUMENT                    0x02004002
264
#define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE        0x02004003
265
#define FSF_ERR_NO_RENEGOTIATION_REQUESTED      0x02004004
266
#define FSF_ERR_CONTRACT_REJECTED               0x02004005
267
#define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD    0x02004006
985 julio 268
#define FSF_ERR_NOT_BOUND                       0x02004007
971 trimarchi 269
#define FSF_ERR_UNKNOWN_SCHEDULED_THREAD        0x02004008
270
#define FSF_ERR_NOT_CONTRACTED_SERVER           0x02004009
271
#define FSF_ERR_NOT_SCHEDULED_THREAD            0x0200400A
272
#define FSF_ERR_TOO_MANY_SERVICE_JOBS           0x0200400B
273
#define FSF_ERR_TOO_MANY_SYNCH_OBJS             0x0200400C
274
#define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ   0x0200400D
275
#define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ    0x0200400E
276
#define FSF_ERR_INTERNAL_ERROR                  0x0200400F
277
#define FSF_ERR_TOO_MANY_SERVERS                0x02004010
278
#define FSF_ERR_INVALID_SCHEDULER_REPLY         0x02004011
279
#define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 0x02004012
280
#define FSF_ERR_SYSTEM_ALREADY_INITIALIZED      0x02004013
281
#define FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED  0x02004014
282
#define FSF_ERR_SHARED_OBJ_NOT_INITIALIZED      0x02004015
283
#define FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE     0x02004016
284
#define FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE  0x02004017
285
#define FSF_ERR_ALREADY_BOUND                   0x02004018
286
#define FSF_ERR_WRONG_NETWORK                   0x02004019
287
#define FSF_ERR_TOO_LARGE                       0x0200401A
288
#define FSF_ERR_BUFFER_FULL                     0x0200401B
289
#define FSF_ERR_NO_SPACE                        0x0200401C
290
#define FSF_ERR_NO_MESSAGES                     0x0200401D
291
#define FSF_WRN_MODULE_NOT_SUPPORTED            0x0200401E
292
#define FSF_ERR_SYSTEM_NOT_INITIALIZED          0x0200401F
293
#define FSF_ERR_TOO_MANY_SHARED_OBJS            0x02004020
889 trimarchi 294
 
971 trimarchi 295
#define FSF_ERR_LAST_VALUE                      0x02004020
296
 
889 trimarchi 297
 
901 trimarchi 298
 
881 trimarchi 299
#endif // _FSF_BASIC_TYPES_H_