Subversion Repositories shark

Rev

Rev 881 | Rev 889 | 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
   \file fsf_basic_types.hh Contains the basic types
27
 
28
   This file contains the definition of the basec types used in
29
   the FSF.
30
 */
31
 
32
 
33
//
34
// Types for the core module
35
//
36
 
37
/// Kind of workload expected in servers
38
typedef enum {FSF_BOUNDED, FSF_INDETERMINATE, FSF_OVERHEAD} fsf_workload_t;                          
39
 
40
/// Constants for assigning default values
41
/// @{
42
#define FSF_DEFAULT_WORKLOAD       FSF_INDETERMINATE
43
#define FSF_DEFAULT_D_EQUALS_T     false
44
#define FSF_DEFAULT_DEADLINE       {0,0} //struct timespec
45
/// @}
46
 
47
/// Constants for omitting the assignment of values
48
/// to specific arguments in calls to
49
/// initialization functions
50
/// @{
51
#define FSF_NULL_DEADLINE     (struct timespec *)NULL
52
#define FSF_NULL_SIGNAL       0
53
/// @}
54
 
55
//
56
// Types for the spare capacity module
57
//
58
 
59
/// Granularity of spare capacity requirements
60
typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t;
61
 
62
/// Utilization (budget and period) value
63
typedef struct {
64
  struct timespec    budget;    // Execution time
65
  struct timespec    period;    // Period
66
} fsf_utilization_value_t;
67
 
68
/// List of utilization values
69
typedef struct {
70
  int                         size; // = 0
71
  fsf_utilization_value_t    
72
      value[FSF_MAX_N_UTILIZATION_VALUES];
73
} fsf_utilization_set_t;
74
 
75
/// Constants for assigning default values
76
/// @{
77
#define FSF_DEFAULT_GRANULARITY         FSF_CONTINUOUS
78
#define FSF_DEFAULT_QUALITY             0
79
#define FSF_DEFAULT_IMPORTANCE          1
80
/// @}
81
 
82
/// Constants for omitting the assignment of values to specific
83
/// arguments in calls to initialization functions
84
#define FSF_NULL_UTILIZATION_SET     \
85
   (fsf_utilization_set_t *)NULL
86
 
87
 
88
//
89
// Types for the implementation specific module
90
//
91
 
92
/// Implementation specific preemption level values
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
 
101
/// Shared object identifier (null character terminated string)
102
typedef char  * fsf_shared_obj_id_t;    
103
 
104
/// Shared object handle (opaque type)
105
typedef FSF_SHARED_OBJ_HANDLE_T_OPAQUE  fsf_shared_obj_handle_t;
106
 
107
/// Critical section data
108
typedef struct {
109
   fsf_shared_obj_handle_t obj_handle;
110
   struct timespec         wcet;  //Execution time
111
} fsf_critical_section_data_t;
112
 
113
/// List of critical sections
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
 
125
/// Scheduling policies
126
typedef enum {FSF_FP, FSF_POSIX, FSF_RM, FSF_EDF, FSF_TABLE_DRIVEN, FSF_NONE}
127
    fsf_sched_policy_t;
128
 
129
/// Scheduling policy and parameters
130
/// The params member is a pointer to one of the 
131
/// following:
132
///    FP:  int (priority)
133
///    EDF: struct timespec (deadline)
134
///    TABLE_DRIVEN : struct fsf_table_driven_params_t
135
typedef struct {
136
  fsf_sched_policy_t    policy;
137
  void *                params;
138
} fsf_sched_params_t;
139
 
140
 
141
/// Scheduling parameters for the table-driven policy (t.b.d)
142
typedef struct {
143
  // list of target windows (t.b.d.) 
144
  // deadline (for the API): end of september
145
} fsf_table_driven_params_t;
146
 
147
 
148
/// Initialization information for a scheduling policy
149
/// It shall be one of the following:
150
///    FP:  none
151
///    EDF: none
152
///    TABLE_DRIVEN : struct timespec (schedule duration)
153
typedef void * fsf_sched_init_info_t;
154
 
155
 
156
 
157
/// Error codes
158
/// @{
887 trimarchi 159
#define FSF_ERR_BASE                            0x02003000
881 trimarchi 160
#define FSF_ERR_TOO_MANY_TASKS                  0x02003001
161
#define FSF_ERR_BAD_ARGUMENT                    0x02003002
162
#define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE        0x02003003
163
#define FSF_ERR_NO_RENEGOTIATION_REQUESTED      0x02003004
164
#define FSF_ERR_CONTRACT_REJECTED               0x02003005
887 trimarchi 165
#define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD    0x02003006
881 trimarchi 166
#define FSF_ERR_UNBOUND                         0x02003007
167
#define FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD     0x02003008
168
#define FSF_ERR_NOT_CONTRACTED_SERVER           0x02003009
887 trimarchi 169
#define FSF_ERR_NOT_SCHEDULED_THREAD            0x0200300A
170
#define FSF_ERR_TOO_MANY_SERVICE_JOBS           0x0200300B
171
#define FSF_ERR_TOO_MANY_SYNCH_OBJS             0x0200300C
172
#define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ   0x0200300D
173
#define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ    0x0200300E
174
#define FSF_ERR_INTERNAL_ERROR                  0x0200300F
175
#define FSF_ERR_TOO_MANY_SERVERS                0x02003010
176
#define FSF_ERR_INVALID_SCHEDULER_REPLY         0x02003011
177
#define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 0x02003012
178
#define FSF_ERR_SYSTEM_ALREADY_INITIALIZED      0x02003013
179
#define FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED  0x02003014
180
#define FSF_ERR_SHARED_OBJ_NOT_INITIALIZED      0x02003015
181
#define FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE     0x02003016
182
#define FSF_ERR_MAX                             0x02003017
183
 
184
// WARNING MESSAGE
881 trimarchi 185
#define FSF_WRN_UNSUPPORTED_FEATURE             0x02004006
887 trimarchi 186
#define FSF_WRN_MODULE_NOT_SUPPORTED            0x02004013
881 trimarchi 187
///@}
188
 
189
#endif // _FSF_BASIC_TYPES_H_