Subversion Repositories shark

Rev

Rev 887 | Rev 901 | 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
 
889 trimarchi 46
 
881 trimarchi 47
//
48
// Types for the spare capacity module
49
//
50
 
889 trimarchi 51
// Granularity of spare capacity requirements
881 trimarchi 52
typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t;
53
 
889 trimarchi 54
// Utilization (budget and period) value
881 trimarchi 55
typedef struct {
56
  struct timespec    budget;    // Execution time
57
  struct timespec    period;    // Period
58
} fsf_utilization_value_t;
59
 
889 trimarchi 60
//List of utilization values
881 trimarchi 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
 
889 trimarchi 67
// Constants for assigning default values
881 trimarchi 68
#define FSF_DEFAULT_GRANULARITY         FSF_CONTINUOUS
69
#define FSF_DEFAULT_QUALITY             0
70
#define FSF_DEFAULT_IMPORTANCE          1
71
 
889 trimarchi 72
// Constants for omitting the assignment of values to specific
73
// arguments in calls to initialization functions
74
 
881 trimarchi 75
#define FSF_NULL_UTILIZATION_SET     \
76
   (fsf_utilization_set_t *)NULL
77
 
78
 
79
//
80
// Types for the implementation specific module
81
//
82
 
889 trimarchi 83
//Implementation specific preemption level values
881 trimarchi 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
 
889 trimarchi 92
// Shared object identifier (null character terminated string)
881 trimarchi 93
typedef char  * fsf_shared_obj_id_t;    
94
 
889 trimarchi 95
// Shared object handle (opaque type)
881 trimarchi 96
typedef FSF_SHARED_OBJ_HANDLE_T_OPAQUE  fsf_shared_obj_handle_t;
97
 
889 trimarchi 98
// Critical section data
881 trimarchi 99
typedef struct {
100
   fsf_shared_obj_handle_t obj_handle;
101
   struct timespec         wcet;  //Execution time
102
} fsf_critical_section_data_t;
103
 
889 trimarchi 104
// List of critical sections
881 trimarchi 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
 
889 trimarchi 116
// Scheduling policies
117
typedef enum {FSF_FP, FSF_EDF, FSF_TABLE_DRIVEN, FSF_NONE, FSF_RM, FSF_POSIX}
881 trimarchi 118
    fsf_sched_policy_t;
119
 
889 trimarchi 120
// Scheduling policy and parameters
881 trimarchi 121
typedef struct {
122
  fsf_sched_policy_t    policy;
123
  void *                params;
124
} fsf_sched_params_t;
889 trimarchi 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
881 trimarchi 130
 
131
 
889 trimarchi 132
//Scheduling parameters for the table-driven policy (t.b.d)
881 trimarchi 133
typedef struct {
134
  // list of target windows (t.b.d.) 
135
  // deadline (for the API): end of september
136
} fsf_table_driven_params_t;
137
 
138
 
889 trimarchi 139
//Initialization information for a scheduling policy
881 trimarchi 140
typedef void * fsf_sched_init_info_t;
889 trimarchi 141
// It shall be one of the following:
142
//    FP:  none
143
//    EDF: none
144
//    TABLE_DRIVEN : struct timespec (schedule duration)
881 trimarchi 145
 
146
 
147
 
889 trimarchi 148
// Error codes
149
#define FSF_ERR_CODES_BASE                      0x02003000
881 trimarchi 150
#define FSF_ERR_TOO_MANY_TASKS                  0x02003001
151
#define FSF_ERR_BAD_ARGUMENT                    0x02003002
152
#define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE        0x02003003
153
#define FSF_ERR_NO_RENEGOTIATION_REQUESTED      0x02003004
154
#define FSF_ERR_CONTRACT_REJECTED               0x02003005
887 trimarchi 155
#define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD    0x02003006
889 trimarchi 156
#define FSF_ERR_UNBOUND_THREAD                  0x02003007
881 trimarchi 157
#define FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD     0x02003008
158
#define FSF_ERR_NOT_CONTRACTED_SERVER           0x02003009
887 trimarchi 159
#define FSF_ERR_NOT_SCHEDULED_THREAD            0x0200300A
160
#define FSF_ERR_TOO_MANY_SERVICE_JOBS           0x0200300B
161
#define FSF_ERR_TOO_MANY_SYNCH_OBJS             0x0200300C
162
#define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ   0x0200300D
163
#define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ    0x0200300E
164
#define FSF_ERR_INTERNAL_ERROR                  0x0200300F
165
#define FSF_ERR_TOO_MANY_SERVERS                0x02003010
166
#define FSF_ERR_INVALID_SCHEDULER_REPLY         0x02003011
167
#define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 0x02003012
889 trimarchi 168
#define FSF_ERR_CODES_MAX                       0x02003013
881 trimarchi 169
 
889 trimarchi 170
#define FSF_WRN_MODULE_NOT_SUPPORTED            0x02004001
171
 
172
#define FSF_ERR_SYSTEM_ALREADY_INITIALIZED      0x02004002
173
#define FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED  0x02004003
174
#define FSF_ERR_SHARED_OBJ_NOT_INITIALIZED      0x02004004
175
#define FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE     0x02004005
176
 
177
#define FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE  0x02004006  //JULIO: Added to support dummy contracts
178
//there are other 2 or 3 more for the distributed part
179
 
881 trimarchi 180
#endif // _FSF_BASIC_TYPES_H_