]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blobdiff - frsh_opaque_types.h
Fixes for C++ compatibility
[frescor/frsh-include.git] / frsh_opaque_types.h
index b5b1f56e90bf35f91eda71b9687047f9f9670e6c..55e802c58d90c9873eea78d8ac5a354a8bc0556b 100644 (file)
 // -----------------------------------------------------------------------
-//   Copyright (C) 2005  Mälardalen University, SWEDEN
+//  Copyright (C) 2006 - 2009 FRESCOR consortium partners:
+//
+//    Universidad de Cantabria,              SPAIN
+//    University of York,                    UK
+//    Scuola Superiore Sant'Anna,            ITALY
+//    Kaiserslautern University,             GERMANY
+//    Univ. Politécnica  Valencia,           SPAIN
+//    Czech Technical University in Prague,  CZECH REPUBLIC
+//    ENEA                                   SWEDEN
+//    Thales Communication S.A.              FRANCE
+//    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
+//        in part by the European Union Sixth Framework Programme
+//        The European Union is not liable of any use that may be
+//        made of this code.
+//
+//
+//  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
 //                       University of York, UK
 //
-//   FRSH API web pages: http://marte.unican.es/frsh/docs/
+//   FSF API web pages: http://marte.unican.es/fsf/docs
 //                      http://shark.sssup.it/contrib/first/docs/
 //
-//  This file is part of FRSH API
+//   This file is part of FRSH (FRescor ScHeduler)
 //
-//  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 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.
 //
-//  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.
-//
-//  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.
-//
-//  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_opaque_types.h
-//=======================================================================
-//       FFFFFFIII   RRRRR      SSTTTTTTT
-//      FF         IIR   RR    SS
-//     FF           IR        SS
-//    FFFFFF         RRRR    SSSSST
-//   FF       FI       RRR  SS
-//  FF         II     RRR  SS
-// FF           IIIIIR    RS
+//==============================================
+//  ******** *******    ********  **      **
+//  **///// /**////**  **//////  /**     /**
+//  **      /**   /** /**        /**     /**
+//  ******* /*******  /********* /**********
+//  **////  /**///**  ////////** /**//////**
+//  **      /**  //**        /** /**     /**
+//  **      /**   //** ********  /**     /**
+//  //       //     // ////////   //      //
 //
-// Basic FRSH(FIRST Scheduling Framework) contract management opaque types
-//=======================================================================
-// Implementation dependent definitions
-
-#include <signal.h>
+// FRSH(FRescor ScHeduler), pronounced "fresh"
+//==============================================
 
+// Implementation dependent definitions
 #ifndef _FRSH_OPAQUE_TYPES_H_
 #define _FRSH_OPAQUE_TYPES_H_
 
-
-#define FRSH_CONTRACT_PARAMETERS_T_OPAQUE struct {   \
-\
-  struct timespec         budget_min;                \
-  struct timespec         period_max;                \
-  struct timespec         budget_max;                \
-  struct timespec         period_min;                \
-  frsh_workload_t          workload;                  \
-                                                     \
-  bool                    d_equals_t;                \
-  struct timespec         deadline;                  \
-  int                     budget_overrun_sig_notify; \
-  union sigval            budget_overrun_sig_value;  \
-  int                     deadline_miss_sig_notify;  \
-  union sigval            deadline_miss_sig_value;   \
-                                                     \
-  frsh_granularity_t       granularity;               \
-  frsh_utilization_set_t   utilization_set;           \
-  int                     quality;                   \
+FRSH_CPP_BEGIN_DECLS
+
+/**
+ * @file frsh_opaque_types.h
+ **/
+
+/**
+ * @defgroup opaque Opaque types
+ *
+ * This module specifies some #defines for privates types in the
+ * interface.  In this way we warn the FRSH user never to access the internal
+ * members of the types directly allowing us to change their internal
+ * definitions to suit our needs.
+ *
+ * Note that in Ada the FRSH user would never be allowed to access the
+ * members directly, however in C the compiler does not prevent this.
+ * But this is the best we can do in this language.
+ *
+ * @{
+ **/
+
+#define FRSH_VRES_ID_T_OPAQUE unsigned int
+
+/** frsh_contract_parameters_t **/
+#define FRSH_CONTRACT_T_OPAQUE struct { \
+\
+  /** Processor Id or Network Id **/                          \
+  frsh_resource_id_t   resource_id;                             \
+\
+  /** Whether processor or network **/                        \
+  frsh_resource_type_t resource_type;                           \
+\
+  /** Printable name for the contract
+     Unique within the local node               **/         \
+  frsh_contract_label_t      contract_label;                        \
+\
+  /** Minimum budget needed to perform a job.  With the energy
+      module this will be an array **/              \
+  frsh_rel_time_t         budget_min;                         \
+\
+  /** Maximum period that the system system can sustain **/   \
+  frsh_rel_time_t         period_max;                         \
+\
+  /** Maximum budget that the vres can use
+     (and would be happy to have).  With the energy module
+     this will be an array **/              \
+  frsh_rel_time_t         budget_max;                         \
+\
+  /** Minimum period for that
+     the system can use (and would be happy to have) **/     \
+  frsh_rel_time_t         period_min;                         \
+\
+  /** Set of discrete values for budget and period.  With the
+      energy module this will be an array **/        \
+  frsh_utilization_set_t   utilization_set;          \
+\
+  /** Workload_type:  bounded, indeterminate, overhead **/    \
+  frsh_workload_t          workload;                          \
+\
+  /** Scheduling type:  Regular, background
+     (in round-robin) or dummy             **/               \
+  frsh_contract_type_t    contract_type;                      \
+\
+  /** Whether delay equals period **/                         \
+  bool                    d_equals_t;                         \
+\
+  /** Deadline (will be ignored if d_equals_t is TRUE **/     \
+  frsh_rel_time_t         deadline;                           \
+\
+  /** Signal parameters for the case of
+      attempting to use too much budget       **/             \
+  frsh_signal_t           budget_overrun_signal;          \
+  frsh_signal_info_t      budget_overrun_siginfo;           \
+\
+  /** Signal parameters for the case a deadline
+     is missed **/                                           \
+  frsh_signal_t           deadline_miss_signal;           \
+  frsh_signal_info_t      deadline_miss_siginfo;            \
+\
+  /** Wether the range of period and budget is specified
+      in a continuous way (max-min) or as a set of
+      discrete values                                    **/  \
+  frsh_granularity_t       granularity;                       \
+\
+  /** Non-cooperative parameter for fair capacity
+      distribution                                **/         \
   int                     importance;                \
-                                                     \
-  frsh_preemption_level_t  preemption_level;          \
-  frsh_critical_sections_t critical_sections;         \
-                                                     \
-  frsh_sched_policy_t      policy;                    \
-                                                     \
-  frsh_network_id_t        network_id;                \
-  bool                    granted_capacity_flag;     \
-                                                     \
+\
+  /** Cooperative parameter for fair capacity
+      distribution **/                                        \
+  int                     weight;                   \
+\
+  /** If > 0 it describes a duration for which
+      the allocated budget and capacity will be
+      maintained across negotiations  and will
+      not be affected for dynamic spare capacity    **/       \
+  frsh_rel_time_t         stability_time;  \
+\
+  /** Low level parameter related with the elegibility
+      preempt other threads                            **/    \
+  frsh_preemption_level_t  preemption_level;                  \
+\
+  /** Set of critical sections that the vres executes
+      besides the normal budget                        **/   \
+  frsh_csects_group_t critical_sections;                 \
+\
+  /** Internal scheduling policy within the vres for
+      hierarchical scheduling systems                  **/    \
+  frsh_sched_policy_t      policy;                            \
+\
+  /** Protocol info for distributed systems.  We store it
+      as a pointer+size.  It's internal meaning is imple-
+      mentation dependent.                              **/    \
+  frsh_protocol_info_t    protocol_info; \
+  frsh_endpoint_queueing_info_t    queueing_info; \
+\
+  /** Maximum loss rate
+      Percentage of packet loss in the network that is
+      tolerated by the application **/                       \
+int                     max_loss_rate; \
+\
+ /** Minimum memory size to be reserved **/ \
+size_t                  minimum_memory; \
+\
+/** Maximum memory size to be reserved  **/ \
+size_t                  maximum_memory; \
 }
 
 
-//Default values for frsh_contract_parameters_t:
-//  budget_min                 => {0,0};
-//  period_max                 => {0,0};
-//  budget_max                 => {0,0};
-//  period_min                 => {0,0};
-//  workload                   => DEFAULT_WORKLOAD;
-
-//  d_equals_t                 => DEFAULT_D_EQUALS_T;
-//                               (false or true)
-//  deadline                   => DEFAULT_DEADLINE;
-//  budget_overrun_sig_notify  => 0;  (signal number)
-//  budget_overrun_sig_value   => {0, NULL};
-//  deadline_miss_sig_notify   => 0;  (signal number)
-//  deadline_miss_sig_value    => {0, NULL};
-//
-//  granularity                => DEFAULT_GRANULARITY;
-
-//  utilization_set;           => size = 0
-//  quality                    => DEFAULT_QUALITY; 
-//                                (range 0..2**32-1)
-//  importance                 => DEFAULT_IMPORTANCE;
-//                                (range 1..5)
-//
-//  preemption_level           => 0;
-//                                (range 1..2**32-1)
-//  critical_sections          => size = 0
-//
-//  policy                     => DEFAULT_SCHED_POLICY;
-//                                (FRSH_NONE)             
-//
-//  network_id                 => FRSH_NULL_NETWORK_ID;
-//                                (0)
-//  granted_capacity_flag      => false;
-
-
-#define FRSH_SYNCH_OBJ_HANDLE_T_OPAQUE int
-
-#define FRSH_SHARED_OBJ_HANDLE_T_OPAQUE int
+typedef int FRSH_SYNCHOBJ_HANDLE_T_OPAQUE;
+
+typedef int FRSH_SHAREDOBJ_HANDLE_T_OPAQUE;
+
+typedef unsigned int FRSH_GROUP_ID_T_OPAQUE;
+
+/**
+ * Critical section data
+ * - comon parameters
+ *     op_kind;     // kind of operation (READ or WRITE)
+ *     obj_handle;  // handle to shared object
+ *     wcet;        // Execution time
+ *     blocking;    // Blocking time (execution time + protection overheads)
+ * - attributes used only for protected shared objects
+ *     op;          // pointer to the operation
+ * - attributes used only for protected write operations
+ *     areas;       // memory areas to be protected
+ *
+ **/
+#define FRSH_CSECT_T_OPAQUE struct { \
+  frsh_csect_op_kind_t op_kind;                 \
+  frsh_sharedobj_handle_t obj_handle;               \
+  frsh_rel_time_t wcet;                              \
+  frsh_rel_time_t blocking;                              \
+  frsh_csect_op_t op;                           \
+  frsh_memory_areas_t areas;                         \
+  frsh_memory_areas_t storage;                         \
+}
 
 
 //opaque types for frsh endpoints
-#define FRSH_SEND_ENDPOINT_T_OPAQUE int
+typedef int FRSH_SEND_ENDPOINT_T_OPAQUE;
+
+typedef int FRSH_RECEIVE_ENDPOINT_T_OPAQUE;
 
-#define FRSH_RECEIVE_ENDPOINT_T_OPAQUE int
+/*@}*/
 
+FRSH_CPP_END_DECLS
 
 #endif // _FRSH_OPAQUE_TYPES_H_