]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_core_types.h
Update transaction API
[frescor/frsh-include.git] / frsh_core_types.h
1 // -----------------------------------------------------------------------
2 //  Copyright (C) 2006 - 2009 FRESCOR consortium partners:
3 //
4 //    Universidad de Cantabria,              SPAIN
5 //    University of York,                    UK
6 //    Scuola Superiore Sant'Anna,            ITALY
7 //    Kaiserslautern University,             GERMANY
8 //    Univ. Politécnica  Valencia,           SPAIN
9 //    Czech Technical University in Prague,  CZECH REPUBLIC
10 //    ENEA                                   SWEDEN
11 //    Thales Communication S.A.              FRANCE
12 //    Visual Tools S.A.                      SPAIN
13 //    Rapita Systems Ltd                     UK
14 //    Evidence                               ITALY
15 //
16 //    See http://www.frescor.org for a link to partners' websites
17 //
18 //           FRESCOR project (FP6/2005/IST/5-034026) is funded
19 //        in part by the European Union Sixth Framework Programme
20 //        The European Union is not liable of any use that may be
21 //        made of this code.
22 //
23 //
24 //  based on previous work (FSF) done in the FIRST project
25 //
26 //   Copyright (C) 2005  Mälardalen University, SWEDEN
27 //                       Scuola Superiore S.Anna, ITALY
28 //                       Universidad de Cantabria, SPAIN
29 //                       University of York, UK
30 //
31 //   FSF API web pages: http://marte.unican.es/fsf/docs
32 //                      http://shark.sssup.it/contrib/first/docs/
33 //
34 //   This file is part of FRSH (FRescor ScHeduler)
35 //
36 //  FRSH is free software; you can redistribute it and/or modify it
37 //  under terms of the GNU General Public License as published by the
38 //  Free Software Foundation; either version 2, or (at your option) any
39 //  later version.  FRSH is distributed in the hope that it will be
40 //  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
41 //  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 //  General Public License for more details. You should have received a
43 //  copy of the GNU General Public License along with FRSH; see file
44 //  COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
45 //  Cambridge, MA 02139, USA.
46 //
47 //  As a special exception, including FRSH header files in a file,
48 //  instantiating FRSH generics or templates, or linking other files
49 //  with FRSH objects to produce an executable application, does not
50 //  by itself cause the resulting executable application to be covered
51 //  by the GNU General Public License. This exception does not
52 //  however invalidate any other reasons why the executable file might be
53 //  covered by the GNU Public License.
54 // -----------------------------------------------------------------------
55 //frsh_core_types.h
56 //==============================================
57 //  ******** *******    ********  **      **
58 //  **///// /**////**  **//////  /**     /**
59 //  **      /**   /** /**        /**     /**
60 //  ******* /*******  /********* /**********
61 //  **////  /**///**  ////////** /**//////**
62 //  **      /**  //**        /** /**     /**
63 //  **      /**   //** ********  /**     /**
64 //  //       //     // ////////   //      //
65 //
66 // FRSH(FRescor ScHeduler), pronounced "fresh"
67 //==============================================
68
69
70 #ifndef   FRSH_CORE_TYPES_H_
71 #define   FRSH_CORE_TYPES_H_
72
73 #include <stdbool.h>
74 #include "frsh_time_types.h"
75 #include "frsh_configuration_parameters.h"
76 #include "frsh_opaque_types.h"
77 #include "frsh_shared_objects_types.h"
78 #include "frsh_spare_capacity_types.h"
79
80 #include "frsh_implementation_specific_types.h"
81 #include "frsh_hierarchical_types.h"
82 #include "frsh_distributed_types.h"
83 #include "frsh_error.h"
84
85 #include "fosa.h"
86
87 FRSH_CPP_BEGIN_DECLS
88
89 /**
90  * @file frsh_core_types.h
91  **/
92
93
94 /**
95  * \addtogroup core
96  **/
97 /*@{*/
98
99
100 /** identifier of a frsh thread **/
101 typedef fosa_thread_id_t frsh_thread_id_t;
102
103
104 /** thread attributes object **/
105 typedef fosa_thread_attr_t frsh_thread_attr_t;
106
107 /**
108  *  The type references a function that may become a thread's
109  *  code
110  **/
111 typedef fosa_thread_code_t frsh_thread_code_t;
112
113
114 /** signal number; it is an integer type **/
115 typedef fosa_signal_t frsh_signal_t;
116
117 #define FRSH_NULL_SIGNAL      FOSA_NULL_SIGNAL
118
119
120 #define FRSH_SIGNAL_MIN       FOSA_SIGNAL_MIN
121 #define FRSH_SIGNAL_MAX       FOSA_SIGNAL_MAX
122
123
124 typedef fosa_signal_info_t frsh_signal_info_t;
125
126
127 /** Kind of workload expected in vres: bounded or indeterminate **/
128 typedef enum {
129     FRSH_WT_BOUNDED       = 0,
130     FRSH_WT_INDETERMINATE = 1,
131     FRSH_WT_SYNCHRONIZED  = 2
132 } frsh_workload_t;
133 /**
134  * In the synchronized workload the virtual resource hosts one or more
135  * threads that synchronize the execution of their jobs with the start
136  * of the virtual resource's period. In this kind of workload, once
137  * the threads that were activated at the beginning of the period
138  * finish their current job, the virtual resource may return any
139  * unused capacity to the system. This kind of workload can be
140  * scheduled using a regular periodic server that has the properties
141  * of being simple, having less overhead, and being able to increase
142  * the schedulability of periodic synchronized threads
143  **/
144
145 #define FRSH_NULL_DEADLINE     (frsh_rel_time_t *)NULL
146 // #define FRSH_NULL_SIGNAL       0 /* Defined at frsh_adaption.h */
147
148 /** Negotiation status: In_progress, rejected, admitted, not_requested **/
149 typedef enum {FRSH_RS_IN_PROGRESS,
150               FRSH_RS_REJECTED,
151               FRSH_RS_ADMITTED,
152               FRSH_RS_NOT_REQUESTED} frsh_renegotiation_status_t;
153
154 /**
155  *  Vres Id type, that identifies a vres created to manage a given
156  *  contract
157  **/
158 typedef FRSH_VRES_ID_T_OPAQUE frsh_vres_id_t;             // => 0
159
160 /** Contract ressource type:  processor, network, memory **/
161 typedef enum {
162     FRSH_RT_PROCESSOR = 0,
163     FRSH_RT_NETWORK   = 1,
164     FRSH_RT_MEMORY    = 2,
165     FRSH_RT_DISK      = 3,
166     FRSH_RT_FPGA      = 4,
167     FRSH_RT_LCD       = 5
168 } frsh_resource_type_t;
169
170 /** Ressource Id: processor_id or network_id **/
171 /**********************************************/
172 typedef fosa_resource_id_t frsh_resource_id_t;
173
174 /** Kind of contract: regular, background or dummy **/
175 typedef enum {
176         FRSH_CT_REGULAR    = 0,
177         FRSH_CT_BACKGROUND = 1,
178         FRSH_CT_DUMMY      = 2
179 } frsh_contract_type_t;
180
181 // The name of this constant has been updated to have the FRSH_ prefix
182 typedef char frsh_contract_label_t[FRSH_CONTRACT_LABEL_MAXLENGTH + 1];
183
184 /**
185  *  Contract parameters type; it is an opaque type (i.e. the internal
186  *  structure of this data type is implementation dependent). The user
187  *  can access and modify the parameters of a contract only with the
188  *  proper functions, and should never access the data directly.
189  **/
190 typedef FRSH_CONTRACT_T_OPAQUE  frsh_contract_t;
191
192
193 /** List of vres **/
194 typedef  struct {
195   int             size;
196   frsh_vres_id_t  vres[FRSH_MAX_GROUP_OPS];
197 } frsh_vres_group_t;
198
199 /** List of contracts to negotiate **/
200 typedef struct {
201     int  size;
202     frsh_contract_t contracts[FRSH_MAX_GROUP_OPS];
203 } frsh_contracts_group_t;
204
205 typedef FRSH_GROUP_ID_T_OPAQUE frsh_group_id_t;
206
207 /**
208  * An abstract synchronization object is defined by the application.
209  * This object can be used by an application to wait for an event to
210  * arrive by invoking the frsh_sychobj_wait() operation.  It
211  * can also be used to signal the event either causing a waiting
212  * vres to wake up, or the event to be queued if no vres is
213  * waiting for it.
214  **/
215 typedef FRSH_SYNCHOBJ_HANDLE_T_OPAQUE frsh_synchobj_handle_t;
216
217
218 /*@}*/
219
220 FRSH_CPP_END_DECLS
221
222 #endif   /* !FRSH_CORE_TYPES_H_ */