]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blobdiff - frsh_core_types.h
Update transaction API
[frescor/frsh-include.git] / frsh_core_types.h
index 1629ace0385ddcd6e9deb2aa63d3ddad847f0364..d355c25c7a11520bb8aadf4f86f42a37adc8c0c1 100644 (file)
@@ -1,5 +1,5 @@
 // -----------------------------------------------------------------------
-//  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+//  Copyright (C) 2006 - 2009 FRESCOR consortium partners:
 //
 //    Universidad de Cantabria,              SPAIN
 //    University of York,                    UK
@@ -12,7 +12,7 @@
 //    Visual Tools S.A.                      SPAIN
 //    Rapita Systems Ltd                     UK
 //    Evidence                               ITALY
-//    
+//
 //    See http://www.frescor.org for a link to partners' websites
 //
 //           FRESCOR project (FP6/2005/IST/5-034026) is funded
@@ -22,7 +22,7 @@
 //
 //
 //  based on previous work (FSF) done in the FIRST project
-//                       
+//
 //   Copyright (C) 2005  Mälardalen University, SWEDEN
 //                       Scuola Superiore S.Anna, ITALY
 //                       Universidad de Cantabria, SPAIN
 //   FSF API web pages: http://marte.unican.es/fsf/docs
 //                      http://shark.sssup.it/contrib/first/docs/
 //
-//  This file is part of FRSH API
-//
-//  FRSH API is free software; you can  redistribute it and/or  modify
-//  it under the terms of  the GNU General Public License as published by
-//  the Free Software Foundation;  either  version 2, or (at  your option)
-//  any later version.
-//
-//  FRSH API  is distributed  in  the hope  that  it  will  be useful,  but
-//  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
-//  MERCHANTABILITY  or  FITNESS FOR  A  PARTICULAR PURPOSE. See  the  GNU
-//  General Public License for more details.
+//   This file is part of FRSH (FRescor ScHeduler)
 //
-//  You should have  received a  copy of  the  GNU  General Public License
-//  distributed  with  FRSH API;  see file COPYING.   If not,  write to the
-//  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
-//  02111-1307, USA.
+//  FRSH is free software; you can redistribute it and/or modify it
+//  under terms of the GNU General Public License as published by the
+//  Free Software Foundation; either version 2, or (at your option) any
+//  later version.  FRSH is distributed in the hope that it will be
+//  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+//  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//  General Public License for more details. You should have received a
+//  copy of the GNU General Public License along with FRSH; see file
+//  COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+//  Cambridge, MA 02139, USA.
 //
-//  As a special exception, if you include this header file into source
-//  files to be compiled, this header file does not by itself cause
-//  the resulting executable to be covered by the GNU General Public
-//  License.  This exception does not however invalidate any other
-//  reasons why the executable file might be covered by the GNU General
-//  Public License.
+//  As a special exception, including FRSH header files in a file,
+//  instantiating FRSH generics or templates, or linking other files
+//  with FRSH objects to produce an executable application, does not
+//  by itself cause the resulting executable application to be covered
+//  by the GNU General Public License. This exception does not
+//  however invalidate any other reasons why the executable file might be
+//  covered by the GNU Public License.
 // -----------------------------------------------------------------------
 //frsh_core_types.h
 //==============================================
 //  **////  /**///**  ////////** /**//////**
 //  **      /**  //**        /** /**     /**
 //  **      /**   //** ********  /**     /**
-//  //       //     // ////////   //      // 
+//  //       //     // ////////   //      //
 //
 // FRSH(FRescor ScHeduler), pronounced "fresh"
 //==============================================
 
 
-#ifndef        FRSH_CORE_TYPES_H_
-#define        FRSH_CORE_TYPES_H_
+#ifndef   FRSH_CORE_TYPES_H_
+#define   FRSH_CORE_TYPES_H_
 
+#include <stdbool.h>
+#include "frsh_time_types.h"
 #include "frsh_configuration_parameters.h"
 #include "frsh_opaque_types.h"
 #include "frsh_shared_objects_types.h"
 #include "frsh_hierarchical_types.h"
 #include "frsh_distributed_types.h"
 #include "frsh_error.h"
-#include "frsh_fosa.h"
+
+#include "fosa.h"
+
+FRSH_CPP_BEGIN_DECLS
+
+/**
+ * @file frsh_core_types.h
+ **/
+
 
 /**
  * \addtogroup core
 /*@{*/
 
 
+/** identifier of a frsh thread **/
+typedef fosa_thread_id_t frsh_thread_id_t;
+
+
+/** thread attributes object **/
+typedef fosa_thread_attr_t frsh_thread_attr_t;
+
 /**
- * Bool as a byte value (char)
- *
- * We will revisit this if we have a problem with bool in C++
+ *  The type references a function that may become a thread's
+ *  code
  **/
-typedef char bool;
-#define true   1
-#define false  0
+typedef fosa_thread_code_t frsh_thread_code_t;
+
 
-/** Kind of workload expected in servers **/
-typedef enum {FRSH_WT_BOUNDED, FRSH_WT_INDETERMINATE} frsh_workload_t;                           
+/** signal number; it is an integer type **/
+typedef fosa_signal_t frsh_signal_t;
 
-#define FRSH_DEFAULT_WORKLOAD       FRSH_WT_INDETERMINATE
-#define FRSH_DEFAULT_D_EQUALS_T     false
-#define FRSH_DEFAULT_DEADLINE       {0,0} //struct timespec
+#define FRSH_NULL_SIGNAL      FOSA_NULL_SIGNAL
 
 
-#define FRSH_NULL_DEADLINE     (struct timespec *)NULL
+#define FRSH_SIGNAL_MIN       FOSA_SIGNAL_MIN
+#define FRSH_SIGNAL_MAX       FOSA_SIGNAL_MAX
+
+
+typedef fosa_signal_info_t frsh_signal_info_t;
+
+
+/** Kind of workload expected in vres: bounded or indeterminate **/
+typedef enum {
+    FRSH_WT_BOUNDED       = 0,
+    FRSH_WT_INDETERMINATE = 1,
+    FRSH_WT_SYNCHRONIZED  = 2
+} frsh_workload_t;
+/**
+ * In the synchronized workload the virtual resource hosts one or more
+ * threads that synchronize the execution of their jobs with the start
+ * of the virtual resource's period. In this kind of workload, once
+ * the threads that were activated at the beginning of the period
+ * finish their current job, the virtual resource may return any
+ * unused capacity to the system. This kind of workload can be
+ * scheduled using a regular periodic server that has the properties
+ * of being simple, having less overhead, and being able to increase
+ * the schedulability of periodic synchronized threads
+ **/
+
+#define FRSH_NULL_DEADLINE     (frsh_rel_time_t *)NULL
 // #define FRSH_NULL_SIGNAL       0 /* Defined at frsh_adaption.h */
 
-/** Possible values returned by frsh_get_renegotiation_status **/
+/** Negotiation status: In_progress, rejected, admitted, not_requested **/
 typedef enum {FRSH_RS_IN_PROGRESS,
               FRSH_RS_REJECTED,
               FRSH_RS_ADMITTED,
               FRSH_RS_NOT_REQUESTED} frsh_renegotiation_status_t;
 
-
-
-/** 
- *  Server Id type, that identifies a server created to manage a given
+/**
+ *  Vres Id type, that identifies a vres created to manage a given
  *  contract
  **/
-typedef int      frsh_vres_id_t;             // => 0
-
-/** Contract ressource type:  processor or network **/
-typedef enum {FRSH_RT_PROCESSOR, FRSH_RT_NETWORK} frsh_resource_type_t;
+typedef FRSH_VRES_ID_T_OPAQUE frsh_vres_id_t;             // => 0
+
+/** Contract ressource type:  processor, network, memory **/
+typedef enum {
+    FRSH_RT_PROCESSOR = 0,
+    FRSH_RT_NETWORK   = 1,
+    FRSH_RT_MEMORY    = 2,
+    FRSH_RT_DISK      = 3,
+    FRSH_RT_FPGA      = 4,
+    FRSH_RT_LCD       = 5
+} frsh_resource_type_t;
 
 /** Ressource Id: processor_id or network_id **/
 /**********************************************/
-typedef int frsh_resource_id_t;
+typedef fosa_resource_id_t frsh_resource_id_t;
 
-/** Kind of contract **/
-typedef enum {FRSH_CT_REGULAR, FRSH_CT_BACKGROUND, FRSH_CT_DUMMY} frsh_contract_type_t;
+/** Kind of contract: regular, background or dummy **/
+typedef enum {
+        FRSH_CT_REGULAR    = 0,
+        FRSH_CT_BACKGROUND = 1,
+        FRSH_CT_DUMMY      = 2
+} frsh_contract_type_t;
 
-#define CONTRACT_ID_MAXLENGTH 15
-typedef char frsh_contract_id_t[CONTRACT_ID_MAXLENGTH];
+// The name of this constant has been updated to have the FRSH_ prefix
+typedef char frsh_contract_label_t[FRSH_CONTRACT_LABEL_MAXLENGTH + 1];
 
-/** 
+/**
  *  Contract parameters type; it is an opaque type (i.e. the internal
  *  structure of this data type is implementation dependent). The user
  *  can access and modify the parameters of a contract only with the
@@ -149,20 +193,16 @@ typedef FRSH_CONTRACT_T_OPAQUE  frsh_contract_t;
 /** List of vres **/
 typedef  struct {
   int             size;
-  frsh_vres_id_t  vres[FRSH_MAX_N_VRES];
+  frsh_vres_id_t  vres[FRSH_MAX_GROUP_OPS];
 } frsh_vres_group_t;
 
 /** List of contracts to negotiate **/
 typedef struct {
     int  size;
-    frsh_contract_t*  contracts[FRSH_MAX_N_VRES];
+    frsh_contract_t contracts[FRSH_MAX_GROUP_OPS];
 } frsh_contracts_group_t;
 
-typedef struct {
-    int size;
-    frsh_contract_id_t contract_ids[FRSH_MAX_N_VRES];
-} frsh_contract_ids_group_t;
-
+typedef FRSH_GROUP_ID_T_OPAQUE frsh_group_id_t;
 
 /**
  * An abstract synchronization object is defined by the application.
@@ -177,5 +217,6 @@ typedef FRSH_SYNCHOBJ_HANDLE_T_OPAQUE frsh_synchobj_handle_t;
 
 /*@}*/
 
+FRSH_CPP_END_DECLS
 
-#endif             /* !FRSH_CORE_TYPES_H_ */
+#endif   /* !FRSH_CORE_TYPES_H_ */