Rev 909 | Rev 985 | 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 | |
881 | trimarchi | 56 | // |
57 | // Types for the spare capacity module |
||
58 | // |
||
59 | |||
889 | trimarchi | 60 | // Granularity of spare capacity requirements |
881 | trimarchi | 61 | typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t; |
62 | |||
889 | trimarchi | 63 | // Utilization (budget and period) value |
881 | trimarchi | 64 | typedef struct { |
65 | struct timespec budget; // Execution time |
||
66 | struct timespec period; // Period |
||
67 | } fsf_utilization_value_t; |
||
68 | |||
889 | trimarchi | 69 | //List of utilization values |
881 | trimarchi | 70 | typedef struct { |
71 | int size; // = 0 |
||
72 | fsf_utilization_value_t |
||
73 | value[FSF_MAX_N_UTILIZATION_VALUES]; |
||
74 | } fsf_utilization_set_t; |
||
75 | |||
889 | trimarchi | 76 | // Constants for assigning default values |
881 | trimarchi | 77 | #define FSF_DEFAULT_GRANULARITY FSF_CONTINUOUS |
78 | #define FSF_DEFAULT_QUALITY 0 |
||
79 | #define FSF_DEFAULT_IMPORTANCE 1 |
||
80 | |||
889 | trimarchi | 81 | // Constants for omitting the assignment of values to specific |
82 | // arguments in calls to initialization functions |
||
83 | |||
881 | trimarchi | 84 | #define FSF_NULL_UTILIZATION_SET \ |
85 | (fsf_utilization_set_t *)NULL |
||
86 | |||
87 | |||
88 | // |
||
89 | // Types for the implementation specific module |
||
90 | // |
||
91 | |||
889 | trimarchi | 92 | //Implementation specific preemption level values |
881 | trimarchi | 93 | typedef unsigned long fsf_preemption_level_t; |
94 | // range 1..2**32-1 |
||
95 | |||
96 | |||
97 | // |
||
98 | // Types for the shared objects module |
||
99 | // |
||
100 | |||
889 | trimarchi | 101 | // Shared object identifier (null character terminated string) |
881 | trimarchi | 102 | typedef char * fsf_shared_obj_id_t; |
103 | |||
889 | trimarchi | 104 | // Shared object handle (opaque type) |
881 | trimarchi | 105 | typedef FSF_SHARED_OBJ_HANDLE_T_OPAQUE fsf_shared_obj_handle_t; |
106 | |||
889 | trimarchi | 107 | // Critical section data |
881 | trimarchi | 108 | typedef struct { |
109 | fsf_shared_obj_handle_t obj_handle; |
||
110 | struct timespec wcet; //Execution time |
||
111 | } fsf_critical_section_data_t; |
||
112 | |||
889 | trimarchi | 113 | // List of critical sections |
881 | trimarchi | 114 | typedef struct { |
115 | int size; // = 0 |
||
116 | fsf_critical_section_data_t |
||
117 | section[FSF_MAX_N_CRITICAL_SECTIONS]; |
||
118 | } fsf_critical_sections_t; |
||
119 | |||
120 | |||
121 | // |
||
122 | // Types for the hierarchical module |
||
123 | // |
||
124 | |||
889 | trimarchi | 125 | // Scheduling policies |
971 | trimarchi | 126 | typedef enum {FSF_FP, FSF_EDF, FSF_TABLE_DRIVEN, FSF_RR, FSF_NONE} |
881 | trimarchi | 127 | fsf_sched_policy_t; |
128 | |||
889 | trimarchi | 129 | // Scheduling policy and parameters |
881 | trimarchi | 130 | typedef struct { |
131 | fsf_sched_policy_t policy; |
||
132 | void * params; |
||
133 | } fsf_sched_params_t; |
||
889 | trimarchi | 134 | // The params member is a pointer to one of the |
135 | // following: |
||
136 | // FP: int (priority) |
||
137 | // EDF: struct timespec (deadline) |
||
138 | // TABLE_DRIVEN : struct fsf_table_driven_params_t |
||
881 | trimarchi | 139 | |
971 | trimarchi | 140 | |
141 | //Scheduling parameters for the table-driven policy |
||
142 | //list of target windows |
||
143 | typedef struct fsf_target_window { |
||
144 | struct timespec start; |
||
145 | struct timespec end; |
||
146 | struct timespec comp_time; |
||
147 | } fsf_target_window; |
||
148 | |||
881 | trimarchi | 149 | typedef struct { |
909 | trimarchi | 150 | int size; |
971 | trimarchi | 151 | fsf_target_window table[FSF_MAX_N_TARGET_WINDOWS]; |
881 | trimarchi | 152 | } fsf_table_driven_params_t; |
153 | |||
154 | |||
889 | trimarchi | 155 | //Initialization information for a scheduling policy |
881 | trimarchi | 156 | typedef void * fsf_sched_init_info_t; |
889 | trimarchi | 157 | // It shall be one of the following: |
158 | // FP: none |
||
159 | // EDF: none |
||
160 | // TABLE_DRIVEN : struct timespec (schedule duration) |
||
881 | trimarchi | 161 | |
901 | trimarchi | 162 | // |
163 | // Types for the distributed services module |
||
164 | // |
||
881 | trimarchi | 165 | |
901 | trimarchi | 166 | // Type designating the network ids. They need not |
167 | // be sequential numbers. |
||
168 | typedef unsigned int fsf_network_id_t; |
||
881 | trimarchi | 169 | |
901 | trimarchi | 170 | #define FSF_DEFAULT_NETWORK_ID 1 |
171 | #define FSF_NULL_NETWORK_ID 0 |
||
172 | |||
173 | |||
889 | trimarchi | 174 | // Error codes |
971 | trimarchi | 175 | #define FSF_ERR_BASE_VALUE 0x02004000 |
889 | trimarchi | 176 | |
971 | trimarchi | 177 | #define FSF_ERR_TOO_MANY_TASKS 0x02004001 |
178 | #define FSF_ERR_BAD_ARGUMENT 0x02004002 |
||
179 | #define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE 0x02004003 |
||
180 | #define FSF_ERR_NO_RENEGOTIATION_REQUESTED 0x02004004 |
||
181 | #define FSF_ERR_CONTRACT_REJECTED 0x02004005 |
||
182 | #define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD 0x02004006 |
||
183 | #define FSF_ERR_NOT_BOUND_THREAD 0x02004007 |
||
184 | #define FSF_ERR_UNKNOWN_SCHEDULED_THREAD 0x02004008 |
||
185 | #define FSF_ERR_NOT_CONTRACTED_SERVER 0x02004009 |
||
186 | #define FSF_ERR_NOT_SCHEDULED_THREAD 0x0200400A |
||
187 | #define FSF_ERR_TOO_MANY_SERVICE_JOBS 0x0200400B |
||
188 | #define FSF_ERR_TOO_MANY_SYNCH_OBJS 0x0200400C |
||
189 | #define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ 0x0200400D |
||
190 | #define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ 0x0200400E |
||
191 | #define FSF_ERR_INTERNAL_ERROR 0x0200400F |
||
192 | #define FSF_ERR_TOO_MANY_SERVERS 0x02004010 |
||
193 | #define FSF_ERR_INVALID_SCHEDULER_REPLY 0x02004011 |
||
194 | #define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 0x02004012 |
||
195 | #define FSF_ERR_SYSTEM_ALREADY_INITIALIZED 0x02004013 |
||
196 | #define FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED 0x02004014 |
||
197 | #define FSF_ERR_SHARED_OBJ_NOT_INITIALIZED 0x02004015 |
||
198 | #define FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE 0x02004016 |
||
199 | #define FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE 0x02004017 |
||
200 | #define FSF_ERR_ALREADY_BOUND 0x02004018 |
||
201 | #define FSF_ERR_WRONG_NETWORK 0x02004019 |
||
202 | #define FSF_ERR_TOO_LARGE 0x0200401A |
||
203 | #define FSF_ERR_BUFFER_FULL 0x0200401B |
||
204 | #define FSF_ERR_NO_SPACE 0x0200401C |
||
205 | #define FSF_ERR_NO_MESSAGES 0x0200401D |
||
206 | #define FSF_WRN_MODULE_NOT_SUPPORTED 0x0200401E |
||
207 | #define FSF_ERR_SYSTEM_NOT_INITIALIZED 0x0200401F |
||
208 | #define FSF_ERR_TOO_MANY_SHARED_OBJS 0x02004020 |
||
889 | trimarchi | 209 | |
971 | trimarchi | 210 | #define FSF_ERR_LAST_VALUE 0x02004020 |
211 | |||
889 | trimarchi | 212 | |
901 | trimarchi | 213 | |
881 | trimarchi | 214 | #endif // _FSF_BASIC_TYPES_H_ |