Subversion Repositories shark

Rev

Rev 874 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
864 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
 
30
// Kind of workload expected in servers
874 trimarchi 31
typedef enum {FSF_BOUNDED, FSF_INDETERMINATE, FSF_OVERHEAD} fsf_workload_t;    
864 trimarchi 32
 
33
// Constants for assigning default values
34
 
35
#define FSF_DEFAULT_WORKLOAD       FSF_INDETERMINATE
877 trimarchi 36
#define FSF_DEFAULT_D_EQUALS_T     TRUE
864 trimarchi 37
#define FSF_DEFAULT_DEADLINE       {0,0} //struct timespec
38
 
39
// Constants for omitting the assignment of values
40
// to specific arguments in calls to
41
// initialization functions
42
 
43
#define FSF_NULL_DEADLINE     (struct timespec *)NULL
44
#define FSF_NULL_SIGNAL       0
45
 
46
 
47
//
48
// Types for the spare capacity module
49
//
50
 
51
// Granularity of spare capacity requirements
52
typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t;
53
 
54
// Utilization (budget and period) value
55
typedef struct {
56
  struct timespec    budget;    // Execution time
57
  struct timespec    period;    // Period
58
} fsf_utilization_value_t;
59
 
60
//List of utilization values
61
typedef struct {
62
  int                         size; // = 0
63
  fsf_utilization_value_t    
64
      value[FSF_MAX_N_UTILIZATION_VALUES];
65
} fsf_utilization_set_t;
66
 
67
// Constants for assigning default values
68
#define FSF_DEFAULT_GRANULARITY         FSF_CONTINUOUS
69
#define FSF_DEFAULT_QUALITY             0
70
#define FSF_DEFAULT_IMPORTANCE          1
71
 
72
// Constants for omitting the assignment of values to specific
73
// arguments in calls to initialization functions
74
 
75
#define FSF_NULL_UTILIZATION_SET     \
76
   (fsf_utilization_set_t *)NULL
77
 
78
 
79
//
80
// Types for the implementation specific module
81
//
82
 
83
//Implementation specific preemption level values
84
typedef unsigned long      fsf_preemption_level_t;
85
                           // range 1..2**32-1
86
 
87
 
88
//
89
// Types for the shared objects module
90
//
91
 
92
// Shared object identifier (null character terminated string)
93
typedef char  * fsf_shared_obj_id_t;    
94
 
95
// Shared object handle (opaque type)
96
typedef FSF_SHARED_OBJ_HANDLE_T_OPAQUE  fsf_shared_obj_handle_t;
97
 
98
// Critical section data
99
typedef struct {
100
   fsf_shared_obj_handle_t obj_handle;
101
   struct timespec         wcet;  //Execution time
102
} fsf_critical_section_data_t;
103
 
104
// List of critical sections
105
typedef struct {
106
  int size; // = 0
107
  fsf_critical_section_data_t  
108
      section[FSF_MAX_N_CRITICAL_SECTIONS];
109
} fsf_critical_sections_t;
110
 
111
 
112
//
113
// Types for the hierarchical module
114
//
115
 
116
// Scheduling policies
117
typedef enum {FSF_FP, FSF_EDF, FSF_RM, FSF_POSIX, FSF_TABLE_DRIVEN, FSF_NONE}
118
    fsf_sched_policy_t;
119
 
120
// Scheduling policy and parameters
121
typedef struct {
122
  fsf_sched_policy_t    policy;
123
  void *                params;
124
} fsf_sched_params_t;
125
// The params member is a pointer to one of the 
126
// following:
127
//    FP:  int (priority)
128
//    EDF: struct timespec (deadline)
129
//    TABLE_DRIVEN : struct fsf_table_driven_params_t
130
 
877 trimarchi 131
struct target_window {
132
  pthread_t           task_id;
133
  struct timespec     start;
134
  struct timespec     end;
135
  struct timespec     comp_time;
136
};
864 trimarchi 137
 
138
//Scheduling parameters for the table-driven policy (t.b.d)
139
typedef struct {
877 trimarchi 140
  int size;
141
  struct target_window * table;
864 trimarchi 142
} fsf_table_driven_params_t;
143
 
144
 
145
//Initialization information for a scheduling policy
146
typedef void * fsf_sched_init_info_t;
147
// It shall be one of the following:
148
//    FP:  none
149
//    EDF: none
150
//    TABLE_DRIVEN : struct timespec (schedule duration)
151
 
152
 
153
// Error codes
154
#define FSF_ERR_TOO_MANY_TASKS                  0x02003001
155
#define FSF_ERR_BAD_ARGUMENT                    0x02003002
156
#define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE        0x02003003
157
#define FSF_ERR_NO_RENEGOTIATION_REQUESTED      0x02003004
158
#define FSF_ERR_CONTRACT_REJECTED               0x02003005
873 trimarchi 159
#define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD    0x02003006  // ??
864 trimarchi 160
#define FSF_ERR_UNBOUND_THREAD                  0x02003007
161
#define FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD     0x02003008
162
#define FSF_ERR_NOT_CONTRACTED_SERVER           0x02003009
163
#define FSF_ERR_NOT_SCHEDULED_THREAD            0x02003010
164
#define FSF_ERR_TOO_MANY_SERVICE_JOBS           0x02003011
165
#define FSF_ERR_TOO_MANY_SYNCH_OBJS             0x02003012
166
#define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ   0x02003013
167
#define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ    0x02003014
168
#define FSF_ERR_INTERNAL_ERROR                  0x02003015
169
#define FSF_ERR_TOO_MANY_SERVERS                0x02003016
170
#define FSF_ERR_INVALID_SCHEDULER_REPLY         0x02003017
171
#define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 0x02003018
873 trimarchi 172
#define FSF_WRN_MODULE_NOT_SUPPORTED            0x02004001
864 trimarchi 173
 
873 trimarchi 174
// added by Peppe
175
#define FSF_ERR_TIME_SPEC_IN_THE_PAST           0x02003020  //JULIO: Shall this be actually an error??
864 trimarchi 176
 
873 trimarchi 177
// added by Julio
178
#define FSF_ERR_SYSTEM_ALREADY_INITIALIZED      0x02004002
179
#define FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED  0x02004003
180
#define FSF_ERR_SHARED_OBJ_NOT_INITIALIZED      0x02004004
181
#define FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE     0x02004005
864 trimarchi 182
 
183
 
184
#define FSF_WRN_MODULE_NOT_SUPPORTED            0x02004001
185
 
186
 
187
 
188
#endif // _FSF_BASIC_TYPES_H_