]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/commitdiff
Upgrading FRSH trunk to D-AC2v2. Phase I: Moving FRSH-FOSA to FOSA
authortelleriam <telleriam@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Tue, 22 Jan 2008 12:59:49 +0000 (12:59 +0000)
committertelleriam <telleriam@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Tue, 22 Jan 2008 12:59:49 +0000 (12:59 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/frsh/trunk/include@1005 35b4ef3e-fd22-0410-ab77-dab3279adceb

16 files changed:
frsh.h
frsh_core.h
frsh_core_types.h
frsh_debug_and_trace.h [moved from frsh_debug.h with 91% similarity]
frsh_debug_and_trace_types.h [new file with mode: 0644]
frsh_distributed.h
frsh_energy_management.h
frsh_feedback_control.h
frsh_fosa.h [deleted file]
frsh_fosa_opaque.h [deleted file]
frsh_memory_management.h
frsh_shared_objects.h
frsh_shared_objects_types.h
frsh_spare_capacity.h
frsh_thread_attrs.h [new file with mode: 0644]
frsh_time.h [new file with mode: 0644]

diff --git a/frsh.h b/frsh.h
index a34004537928d7dcfebbb1f9d1377d671fb4219c..5190444b2ac820770a5b2bd0f49c44f20d65e23a 100644 (file)
--- a/frsh.h
+++ b/frsh.h
@@ -84,6 +84,8 @@
  * having include deadlocks.
  **/
 
+#include "fosa.h"
+
 #include "frsh_configuration_parameters.h"
 
 /* We include all the types because they are needed for the
@@ -97,6 +99,8 @@
 #include "frsh_implementation_specific_types.h"
 
 #include "frsh_core.h"
+#include "frsh_thread_attrs.h"
+#include "frsh_time.h"
 #include "frsh_implementation_specific.h"
 
 // Configure these modules by commenting out the appropiate lines
index 227881451d1dd3ed7df5c3d881c01e7011b524fd..549bd1a4b0a1b8e8a3575edbc8d9b2d252a2d836 100644 (file)
@@ -667,6 +667,35 @@ int frsh_timed_wait
    bool                  *was_budget_overran);
 
 
+
+/**
+ * frsh_vresperiod_wait()
+ * 
+ * Suspend the calling thread until the start of the specified virtual
+ * resource period, for a synchronized workload.
+ * 
+ * Virtual resource periods are numbered. The number of the current
+ * period can be obtained through the frsh_vres_get_period_number()
+ * operation. 
+ **/
+int frsh_vresperiod_wait
+   (const frsh_vres_id_t vres,
+    long period_num);
+
+
+/**
+ * frsh_vres_get_period()
+ * 
+ * Return the current period number, for a virtual resource of
+ * synchronized workload.
+ **/
+int frsh_vres_get_period_number
+   (const frsh_vres_id_t vres,
+    long *period_num);
+
+
+
+
 /*@}*/
 
 ///////////////////////////////////////////////////////////////////
index a78800055d2a28cc6eb5b90f77d32b9dc702be59..4de2d537e313c49a646d216ac729fe7e3ae40f89 100644 (file)
@@ -83,7 +83,6 @@
 #include "frsh_hierarchical_types.h"
 #include "frsh_distributed_types.h"
 #include "frsh_error.h"
-#include "frsh_fosa.h"
 
 /**
  * @file frsh_core_types.h
 /*@{*/
 
 
+/** 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;
+
+/** 
+ *  The type references a function that may become a thread's
+ *  code
+ **/
+typedef fosa_thread_code_t frsh_thread_code_t;
+
+
+/** signal number; it is an integer type **/
+typedef fosa_signal_t frsh_signal_t;
+
+#define FRSH_NULL_SIGNAL      FOSA_NULL_SIGNAL
+
+
+#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,
similarity index 91%
rename from frsh_debug.h
rename to frsh_debug_and_trace.h
index 0442b1044f82878eab2d0ad5b280122bc14cbcca..d86fd39116b4acb1c14eb869f1abdb76901edcc6 100644 (file)
@@ -77,6 +77,7 @@
 #include <stdio.h> // for vprintf
 #include <stdbool.h> // for bool
 #include <stdarg.h> // for va_list, va_start and va_end
+#include "frsh_debug_and_trace_types.h"
 #include "timespec_operations.h"
 #include "fosa_configuration_parameters.h" /* FOSA_CLOCK_REALTIME */
 #include "fosa_clocks_and_timers.h"
 #define FRSH_TRACE_THREAD_INDEX false
 #define FRSH_TRACE_VRES_INDEX false
 
+/**
+ * frsh_trace_point_insert()
+ *
+ * Insert an application-defined trace-point identifier together with
+ * a timestamp into the trace log, if tracing is enabled; the
+ * identifier is an integer that must be between two configurable
+ * values defined in the FRSH API as constants; if tracing is not
+ * enabled, this function has no effect.
+ */
+int frsh_trace_point_insert(frsh_trace_point_id_t ipoint);
+
 #define FRSH_TRACE_DISTRIBUTED false
 
+/** If FRSH_TRACE_TS_MSECS is defined, each trace line is prefixed
+    with a msec counter **/
 #define FRSH_TRACE_TS_MSECS
 
 /* These variables live defined in frsh_error.c */
diff --git a/frsh_debug_and_trace_types.h b/frsh_debug_and_trace_types.h
new file mode 100644 (file)
index 0000000..1f9c902
--- /dev/null
@@ -0,0 +1,88 @@
+// -----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 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
+//
+//   FSF API web pages: http://marte.unican.es/fsf/docs
+//                      http://shark.sssup.it/contrib/first/docs/
+//
+//  This file is part of FRSH Implementation
+//
+//  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.
+//
+//  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.
+// -----------------------------------------------------------------------
+//==============================================
+//  ******** *******    ********  **      **
+//  **///// /**////**  **//////  /**     /**
+//  **      /**   /** /**        /**     /**
+//  ******* /*******  /********* /**********
+//  **////  /**///**  ////////** /**//////**
+//  **      /**  //**        /** /**     /**
+//  **      /**   //** ********  /**     /**
+//  //       //     // ////////   //      //
+//
+// FRSH(FRescor ScHeduler), pronounced "fresh"
+//==============================================
+//
+// 23-Jul-2007 SANGORRIN: create this file for debugging functions
+// 31-Jul-2007 TELLERIA:  Change "debug" for "trace"
+// -----------------------------------------------------------------------
+#ifndef        FRSH_DEBUG_AND_TRACE_TYPES_H_
+#define        FRSH_DEBUG_AND_TRACE_TYPES_H_
+
+/**  identifier of a trace point **/
+typedef int frsh_trace_point_id_t;
+
+/** constants that describe the valid range of trace point identifiers **/
+#define FRSH_TRACE_POINT_ID_MIN 0
+#define FRSH_TRACE_POINT_ID_MAX 10
+
+
+
+
+
+#endif             /* !FRSH_DEBUG_AND_TRACE_TYPES_H_ */
index 58d8d8b9d83a10c9629115d8f297778c7ad967aa..bb501e25180e6ff5b4f9bef4ef2c16ca94a25cc5 100644 (file)
@@ -344,6 +344,72 @@ int frsh_contract_unmarshal(frsh_contract_t      *contract,
                             const size_t         size);
 
 /*@}*/
+//////////////////////////////////////////////////////////////////////
+//           TWO STEP NEGOTIATION
+//////////////////////////////////////////////////////////////////////
+
+/**
+ * @defgroup twostepnego Two Step Negotiation
+ * @ingroup distributed
+ *
+ * Using the core services of FRSH, contracts may be negotiated in a
+ * single step. 
+ *
+ * An alternative two-step negotiation process is introduced in the
+ * distribution module: the first step involves the reservation of the
+ * resources, but without the right to use them, and the second step
+ * is the commitment to use those resources.  
+ *
+ * The rationale behind this approach is that in distributed systems,
+ * when a distributed transaction is being negotiated the system
+ * should only commit the virtual resources that were negotiated with
+ * various nodes in the system if the results of all negotiations
+ * match together. This approach enhances the efficiency since the
+ * actual temporal values of the virtual resources on distributed
+ * nodes are only changed if the initiator of the distributed
+ * transaction is satisfied with the results of the negotiations.
+ *
+ * After the reservation, it is not necessary to change the actual
+ * virtual resource attributes (and modifying the schedule) on each
+ * node before the initiator of the distributed transaction knows the
+ * amount of available virtual resources. A renegotiation of a
+ * reserved virtual resource is possible, to harmonize for the
+ * available virtual resources in other parts of the system, before a
+ * final commitment is made.
+ *
+ * @{
+ **/
+
+
+/**
+ * frsh_contract_negotiate_reservation()
+ *
+ * Negotiate a service contract, obtaining a virtual resource id that
+ * represents a reservation of resources, but without the right to use
+ * those resources until the reservation is committed via
+ * frsh_vres_commit_reservation. In particular, this virtual resource
+ * cannot be bound until committed, but renegotiations are allowed for
+ * it.
+ */
+int frsh_contract_negotiate_reservation
+  (const frsh_contract_t *contract,
+   frsh_vres_id_t        *vres);
+
+/**
+ * frsh_vres_commit_reservation()
+ * 
+ * Commit the resources reserved for a virtual resource through a
+ * frsh_contract_negotiate_reservation operation. The effects of
+ * subsequent calls to frsh_contract_negotiate_reservation and
+ * frsh_vres_commit_reservation are equivalent to a single call to
+ * frsh_contract_negotiate.
+ */
+int frsh_vres_commit_reservation
+   (const frsh_vres_id_t   vres);
+
+/* @} */
+
+
 
 //////////////////////////////////////////////////////////////////////
 //           TRANSMISSION SERVICES
index 306d6f87b1f4b16c63cc8041113a73eaaf990d35..b7287e1031b4579af655cee78fe291d9abe5bf60 100644 (file)
@@ -75,7 +75,6 @@
 
 #include <time.h>
 
-#include "frsh_fosa.h"
 #include "frsh_energy_management_types.h"
 #include "frsh_core_types.h"
 
@@ -216,26 +215,68 @@ int frsh_contract_get_utilizations_pow(const frsh_utilization_set_pow_t *utiliza
 /**
  * frsh_resource_set_power_level()
  *
- * Set the powerlevel of the CPU given by resource_id. We assume
- * resource_type = FRSH_RT_PROCESSOR.
+ * Set the power level of the resource identified by the supplied type and id.
+ *
+ * @note
+ * Only implementation for resource_type = FRSH_RT_PROCESSOR is mandatory,
+ * if the energy management module is present.
  **/
-int frsh_resource_set_power_level(frsh_resource_id_t resource_id,
-                                  int power_level);
+int frsh_resource_set_power_level(frsh_resource_type_t resource_type,
+                                 frsh_resource_id_t resource_id,
+                                  frsh_power_level_t power_level);
 
+/**
+ * frsh_resource_get_power_level()
+ *
+ * Get version of the previous function.
+ **/
+int frsh_resource_get_power_level(frsh_resource_type_t resource_type,
+                                 frsh_resource_id_t resource_id,
+                                  frsh_power_level_t *power_level);
 
+/**
+ * frsh_resource_get_num_power_levels()
+ *
+ * Get the number of power levels available for the resource identified
+ * by the supplied type and id.
+ *
+ * @note
+ * The power levels that may be used, for the identified resource,
+ * in other functions through a power_level_t type, range from 0
+ * to the value returned by this function minus 1.
+ *
+ * @note
+ * The power level 0 identifies the configuration with the maximum
+ * performance (and energy consumption) for the resource.
+ *
+ * @note
+ * Only implementation for resource_type = FRSH_RT_PROCESSOR is mandatory,
+ * if the energy management module is present.
+ */
+int frsh_resource_get_num_power_levels(frsh_resource_type_t resource_type,
+                                      frsh_resource_id_t resource_id,
+                                      frsh_power_level_t *num_power_levels);
 
 //////////////////////////////////////////////////////////////////////
-//           BATTERY DURATION AND MANAGING POWER LEVELS
+//           BATTERY EXPIRATION AND MANAGING POWER LEVELS
 //////////////////////////////////////////////////////////////////////
 
+/* /\** IS THIS NEEDED AT ALL ? I GUESS NOT - COMMENTED */
+/*  * frsh_resource_get_battery_expiration() */
+/*  * */
+/*  * Get the foreseen expiration time of the battery for the resource */
+/*  * identified by the supplied type and id. */
+/*  * */
+/* int frsh_battery_get_expiration(frsh_resource_type_t resource_type, */
+/*                              frsh_resource_id_t resource_id, */
+/*                              frsh_rel_time_t *expiration); */
+
 /**
- * frsh_resource_get_battery_duration()
+ * frsh_battery_get_expiration()
  *
- * Get the remaining battery duration of the CPU given by resource_id.
- * We assume resource_type = FRSH_RT_PROCESSOR.
+ * Get the foreseen expiration time of the system battery(ies).
  **/
-int frsh_resource_get_battery_duration(frsh_resource_id_t resource_id,
-                                       struct timespec *duration);
+int frsh_battery_get_expiration(struct timespec *expiration);
 
 /*@}*/
 
index f1df01d3bb57288e3af7385010869485b80e0a64..a655a5d922a047b97fc2c6434a86b5de90bd5f8a 100644 (file)
@@ -75,7 +75,6 @@
 
 #include <time.h>
 
-#include "frsh_fosa.h"
 //#include "frsh_feedback_control_types.h"
 #include "frsh_core_types.h"
 
diff --git a/frsh_fosa.h b/frsh_fosa.h
deleted file mode 100644 (file)
index 2c3c6ad..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-// -----------------------------------------------------------------------
-//   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/
-//                      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.
-//
-//  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.
-// -----------------------------------------------------------------------
-// frsh_fosa.h
-//========================================================================================
-//  ******** *******    ********  **      **    ********  ******    ********  **********
-//  **///// /**////**  **//////  /**     /**    **///// /**    **  **//////  /**     /**
-//  **      /**   /** /**        /**     /**    **      /**    ** /**        /**     /**
-//  ******* /*******  /********* /**********    ******* /**    ** /********* /**********
-//  **////  /**///**  ////////** /**//////**    **////  /**    ** ////////** /**//////**
-//  **      /**  //**        /** /**     /**    **      /**    **        /** /**     /**
-//  **      /**   //** ********  /**     /**    **      /**    **  ********  /**     /**
-//  //       //     // ////////   //      //    //       /******/  ////////   //      // 
-//
-// FRSH(FRescor ScHeduler), pronounced "fresh" FOSA(Frescor Oper System Adaptation layer)
-//========================================================================================
-#ifndef        FRSH_FOSA_H_
-#define        FRSH_FOSA_H_
-
-#include <stdlib.h> /* For size_t */
-#include "frsh_fosa_opaque.h"
-
-/**
- * @file frsh_fosa.h
- **/
-
-
-/**
- * @defgroup frshfosa FRSH FOSA public interfaces
- *
- * FOSA is an OS adaption layer that encapsulates all POSIX types and
- * functions into neutral names so that FRSH can compile and be used in
- * non-POSIX operating systems such as OSE.
- *
- * It is divided in two parts:
- *  - FRSH_FOSA:  Types visibles to the application via FRSH_API
- *                (thread, signal, mutexes).
- *  - FOSA:  Types and functions only used within FRSH.
- *
- * The former reside in the FRSH subversion directory and the latter
- * have their own.  They need to be separated because the application
- * must not see FOSA itself.
- *
- * For simplicity, we have chosen to hide the operation function on
- * signals and mutexes with the assumption that a direct mapping
- * exists for frsh_signal_t, frsh_signal_info_t and frsh_mutext_t in
- * the native OS.
- *
- * Since there are some parts which are platform dependent a define
- * has been introduced for each platform.  Currently the supported
- * defines are:
- *
- *         -DRT_LINUX
- *         -DOSE
- *         -DMARTE_OS
- *         -DAQuoSA
- *                -DVIRTUAL_TIME
- *
- * This module contains the FOSA part exposed by the FRSH_API and
- * visible for the application.
- *
- * On the other hand, there was another file in the API which was also
- * OS-dependent:  frsh_os_compatibility.h.  However this dependency
- * relates more to the implementation of FRSH and therefore it has
- * been moved to the src directory.   It may be integrated in FOSA
- * during the implementation.
- *
- * @{
- **/
-
-/**
- * Bool as a byte value (char)
- *
- * We will revisit this if we have a problem with bool in C++
- **/
-
-
-/** identifier of a frsh thread **/
-typedef FOSA_THREAD_ID_T_OPAQUE frsh_thread_id_t;
-
-
-/** thread attributes object **/
-typedef FOSA_THREAD_ATTR_T_OPAQUE frsh_thread_attr_t;
-
-/** 
- *  The type references a function that may become a thread's
- *  code
- **/
-typedef void * (*frsh_thread_code_t) (void *);
-
-
-/** signal number; it is an integer type **/
-typedef FOSA_SIGNAL_T_OPAQUE frsh_signal_t;
-#define FRSH_NULL_SIGNAL       FOSA_NULL_SIGNAL
-
-
-#define FRSH_SIGNAL_MIN       FOSA_SIGNAL_MIN
-#define FRSH_SIGNAL_MAX       FOSA_SIGNAL_MAX
-
-
-
-/** information associated to a signal **/
-#if defined(VIRTUAL_TIME)
-
-#include <vt_ose.h>
-typedef vt_posix_signal_info_t frsh_signal_info_t;
-
-#else
-
-typedef union {int sival_int; void * sival_ptr; } frsh_signal_info_t;
-/* typedef FRSH_SIGNAL_INFO_T_OPAQUE frsh_signal_info_t; */
-
-#endif
-
-
-
-
-/** Mutex object.  Attributes are handled by FOSA **/
-typedef FOSA_MUTEX_T_OPAQUE frsh_mutex_t;
-
-
-
-/*************************
- * Thread attributes
- *************************/ 
-
-/**
- * frsh_thread_attr_init()
- *
- * Initialize a thread attributes object
- *
- * This function initializes the object pointed to by attr to all 
- * the default values defined by FRSH
- *
- * @return 0 if successful; otherwise it returns \n
- *   FOSA_ENOMEM: insufficient memory exists to initialize the thread 
- *           attributes object
- **/
-int frsh_thread_attr_init(frsh_thread_attr_t *attr);
-
-/**
- * frsh_thread_attr_destroy()
- *
- * Destroy a thread attributes object
- *
- * This function is used to destroy the thread attributes object,
- * pointed to by attr, and deallocate any system resources allocated for it
- * 
- * Returns 0
- */
-int frsh_thread_attr_destroy(frsh_thread_attr_t *attr);
-
-/**
- * frsh_thread_attr_set_stacksize()
- *
- * Set the thread minimum stack size in a thread attributes object
- *
- * This function sets the minimum stack size of the thread attributes
- * object attr to the value given by stacksize, in bytes. This
- * function has no runtime effect on the stack size, except when the
- * attributes object is used to create a thread, when it will be
- * created with the specified minimum stack size
- * 
- * @return 0 if successful, or the following error code:
- *    FOSA_EINVAL: the specified stacksize  value is not supported in
- *            this implementation
- */
-int frsh_thread_attr_set_stacksize(frsh_thread_attr_t *attr, size_t stacksize);
-
-/**
- * frsh_thread_attr_get_stacksize()
- *
- * Get the thread minimum stack size from a thread attributes object
- *
- * This function sets the variable pointed to by stacksize to the
- * minimum stack size stored in the thread attributes object attr.
- * 
- * @return 0
- */
-int frsh_thread_attr_get_stacksize
-      (const frsh_thread_attr_t *attr, size_t *stacksize);
-
-
-/**
- * frsh_eat()
- *
- * Keep the thread busy executing for a given period of time.
- **/
-void  frsh_eat(const struct timespec *cpu_time);
-
-
-/*@}*/
-
-
-#endif             /* !FRSH_ADAPTION_H_ */
diff --git a/frsh_fosa_opaque.h b/frsh_fosa_opaque.h
deleted file mode 100644 (file)
index e366775..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-// -----------------------------------------------------------------------
-//  Copyright (C) 2006 - 2007 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
-//
-//   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.
-//
-//  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.
-// -----------------------------------------------------------------------
-//frsh_core_types.h
-//========================================================================================
-//  ******** *******    ********  **      **    ********  ******    ********  **********
-//  **///// /**////**  **//////  /**     /**    **///// /**    **  **//////  /**     /**
-//  **      /**   /** /**        /**     /**    **      /**    ** /**        /**     /**
-//  ******* /*******  /********* /**********    ******* /**    ** /********* /**********
-//  **////  /**///**  ////////** /**//////**    **////  /**    ** ////////** /**//////**
-//  **      /**  //**        /** /**     /**    **      /**    **        /** /**     /**
-//  **      /**   //** ********  /**     /**    **      /**    **  ********  /**     /**
-//  //       //     // ////////   //      //    //       /******/  ////////   //      //
-//
-// FRSH(FRescor ScHeduler), pronounced "fresh" FOSA(Frescor Oper System Adaptation layer)
-//========================================================================================
-
-#ifndef        FRSH_FOSA_OPAQUE_H_
-#define        FRSH_FOSA_OPAQUE_H_
-
-/**
- * @file frsh_fosa_opaque.h
- **/
-
-
-/**
- * \addtogroup frshfosa
- *
- * @{
- **/
-
-
-/////////////////////MaRTE OS, RT_LINUX & AQuoSA  //////////////////////
-
-#if defined(MARTE_OS) || defined(RT_LINUX) || defined(AQuoSA)
-
-#ifdef AQuoSA
-#define __USE_UNIX98
-#endif // AQuoSA
-#include <pthread.h>
-#include <signal.h>
-#include <errno.h>
-#include <time.h>
-#include <stdbool.h>
-
-#ifdef AQuoSA
-
-typedef struct {
-       pthread_t pthread_id;
-       pid_t linux_pid;
-       pid_t linux_tid;
-} FOSA_THREAD_ID_T_OPAQUE;
-
-#else  /* !AQuoSA, MARTE_OS, RT_LINUX */
-
-#ifdef MARTE_OS
-typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
-#else
-//#define FOSA_MUTEX_T_OPAQUE pthread_mutex_t
-#define FOSA_THREAD_ID_T_OPAQUE pthread_t
-#endif
-
-#endif /* AQuoSA */
-
-typedef pthread_attr_t FOSA_THREAD_ATTR_T_OPAQUE;
-
-typedef int FOSA_SIGNAL_T_OPAQUE;
-
-typedef pthread_mutex_t FOSA_MUTEX_T_OPAQUE;
-
-// The minimum and maximum signal numbers that may be used by the FRSH
-// implementation
-#define FOSA_SIGNAL_MIN       SIGRTMIN
-#define FOSA_SIGNAL_MAX       SIGRTMIN+0
-
-#define FOSA_NULL_SIGNAL 0
-
-/* FOSA Errors */
-
-/* #include <error.h> */
-
-/** Not enough memory available **/
-#define FOSA_ENOMEM   ENOMEM
-
-/** Invalid parameter **/
-#define FOSA_EINVAL   EINVAL
-
-/** Still pending information **/
-#define FOSA_EAGAIN   EAGAIN
-
-/** FOSA ADS errors **/
-#ifdef MARTE_OS
-#define EREJECT   201 /* (for linux_lib_arch) Appsched has rejected object */
-#endif
-
-#define FOSA_EREJECT   EREJECT
-#define FOSA_EMASKED   -2
-#define FOSA_EPOLICY   -3
-
-#define FOSA_ETIMEDOUT ETIMEDOUT
-
-
-#endif /* MARTE_OS || RT_LINUX || AQuoSA */
-
-//////////////////End of MaRTE OS, RT_LINUX & AQuoSA  ///////////////////
-
-////////////////////////// VIRTUAL TIME    //////////////////////////////////////
-
-#if defined(VIRTUAL_TIME)
-#include <fosa_vt.h>
-
-#define FOSA_THREAD_ID_T_OPAQUE   vt_posix_process_t
-
-#define FOSA_THREAD_ATTR_T_OPAQUE fosa_thread_attr_t
-
-#define FOSA_SIGNAL_T_OPAQUE      int
-
-#define FOSA_MUTEX_T_OPAQUE fosa_mutex_t
-
-// The minimum and maximum signal numbers that may be used by the FRSH
-// implementation
-#define FOSA_SIGNAL_MIN       8
-#define FOSA_SIGNAL_MAX       31
-
-// the min. and max. priority a fosa thread can have
-#define FOSA_PRIORITY_MAX VT_PRIORITY_MIN - 1
-#define FOSA_PRIORITY_MIN VT_PRIORITY_MAX
-
-#define FOSA_NULL_SIGNAL       0
-
-/* FOSA Errors and return values*/
-
-/** Invalid parameter **/
-#define FOSA_EINVAL   -1
-
-/** Not enough memory available **/
-#define FOSA_ENOMEM   -2
-
-/** Still pending information **/
-#define FOSA_EAGAIN   -3
-
-/** Mutex not available **/
-#define FOSA_EBUSY        -4
-
-/** Cond var timedout **/
-#define FOSA_ETIMEDOUT -5
-
-/** FOSA ADS errors **/
-#define FOSA_EREJECT   -6
-#define FOSA_EMASKED   -7
-
-
-/** Sched policy not correct */
-#define FOSA_EPOLICY   -8
-
-/** the value given by thread_id is not valid for ADS */
-#define FOSA_ESRCH             -9
-
-/** retval if no action performed **/
-#define FOSA_NO_ACTION 0
-
-#endif /* VIRTUAL_TIME */
-//////////////////////////End of VIRTUAL TIME ///////////////////////////////////
-
-////////////////////////// OSE    //////////////////////////////////////
-
-#if defined(OSE)
-
-/* Put OSE dependent includes and defines here */
-
-#endif /* OSE */
-//////////////////////////End of OSE ////////////////////////////////////
-
-////////////////////////// DUMMY_OS    //////////////////////////////////////
-
-#if defined(DUMMY_OS)
-
-/* With this define we make sure that we are truly POSIX and OSE */
-/* independent at the FRSH code.                                 */
-/*****************************************************************/
-
-#define FOSA_THREAD_ID_T_OPAQUE   int
-
-#define FOSA_THREAD_ATTR_T_OPAQUE int
-
-#define FOSA_SIGNAL_T_OPAQUE      int
-
-#define FRSH_SIGNAL_INFO_T_OPAQUE int
-
-#define FOSA_MUTEX_T_OPAQUE int
-
-// The minimum and maximum signal numbers that may be used by the FRSH
-// implementation
-#define FOSA_SIGNAL_MIN       42
-#define FOSA_SIGNAL_MAX       42
-
-#define FOSA_NULL_SIGNAL 0
-
-/* FOSA Errors */
-
-/* #include <error.h> */
-
-/** Not enough memory available **/
-#define FOSA_ENOMEM   -1
-
-/** Invalid parameter **/
-#define FOSA_EINVAL   -2
-
-/** Still pending information **/
-#define FOSA_EAGAIN   -3
-
-/** FOSA ADS errors **/
-#define FOSA_EREJECT   -4
-#define FOSA_EMASKED   -5
-
-#define FOSA_EPOLICY -6
-
-#endif /* DUMMY */
-//////////////////////////End of DUMMY_OS ////////////////////////////////////
-
-
-
-
-
-
-#endif             /* !FRSH_FOSA_OPAQUE_H_ */
index 5c011a363c9015b2e3c48ad7ba546485aa89878c..f0577fa2fc9d6d7cbe06435ce393f9f7c7d4c3fd 100644 (file)
@@ -73,7 +73,6 @@
 #ifndef _FRSH_MEMORY_MANAGEMENT_H_
 #define _FRSH_MEMORY_MANAGEMENT_H_
 
-#include "frsh_fosa.h"
 #include "frsh_core_types.h"
 
 
index 5e9e1683c00fb5cff25772c712e37d1bb5ef2d76..f48dc9d5cb35f7d2baf968cc65cfd9bdeb6bd755 100644 (file)
@@ -73,7 +73,6 @@
 #ifndef _FRSH_SHARED_OBJECTS_H_
 #define _FRSH_SHARED_OBJECTS_H_
 
-#include "frsh_fosa.h"
 #include "frsh_shared_objects_types.h"
 #include "frsh_core_types.h"
 
@@ -621,6 +620,34 @@ int frsh_csect_get_blocking_time
      struct timespec *blocking);
 
 
+/**
+ * frsh_csect_destroy()
+ * 
+ * Destroy a critical section, deallocating all the resources that may
+ * have been allocated to it.
+ **/
+int frsh_csect_destroy
+   (frsh_csect_t *csect);
+
+/**
+ * frsh_csect_register_thread()
+ * 
+ * Register the calling thread for invoking time-protected critical
+ * sections via frsh_csect_invoke.
+ **/
+int frsh_csect_register_thread();
+
+/**
+ * frsh_csect_deregister_thread()
+ * 
+ * Deregister the calling thread from being able to invoke
+ * time-protected critical sections. This operation releases system
+ * resources that may have been allocated for the thread.
+ **/
+int frsh_csect_deregister_thread();
+
+
+
 /*@}*/ /* For so_critical group */
 
 
index 0513d5e98acb254510888d0c53043af7b44e3251..8287b22aef7a2153eb069db53d951f194259874d 100644 (file)
@@ -86,6 +86,9 @@
  * @{
  **/
 
+/** Mutex object.  Attributes are handled by FOSA **/
+typedef fosa_mutex_t frsh_mutex_t;
+
 
 /** 
  *  Shared object handle:  It is an opaque type (i.e. the internal
index 8bac8018a66742c140bf86062d71e63a55e0e54e..2b14098631fa84fc77ea3310b08e9ba53b0d63b0 100644 (file)
  * There are no specific negotiation calls because the algorithms used
  * in the core module take already these min-max ranges into account.
  *
+ * An operation is available for applications to ask for a stability
+ * period of a specified length. The framework will then return the
+ * total capacity (execution time budget and virtual resource period)
+ * that the application is guaranteed to receive in this stability
+ * period. The rationale for this service is that jobs may span a
+ * number of virtual resource periods, and need to have a guaranteed
+ * amount of capacity before they can choose a higher quality (longer
+ * execution time) method, when multiple methods are available. Also
+ * applications may require that the capacity provided to them and
+ * hence the quality of results produced remains consistent for a
+ * period of time, so that consistent behaviour is provided for the
+ * user (e.g. multimedia applications).
+ *
+ * Requesting a new stability period has the effect of cancelling any
+ * previous one. So a subsequent request for stability up to the same
+ * point in time could return a lower total capacity, if spare capacity
+ * re-allocation is in progress due to the admission of a new
+ * application. If a stability period expires without having explicitly
+ * set a new one, the system may decide to perform a reallocation of
+ * spare resources at that point, or may defer this decision to some
+ * future point in time when it is appropriate. In both cases, a new
+ * stability period will start when the new spare capacity assignment
+ * is in effect.
+ *
+ *
  * NOTE:  When we talk here about "spare capacity" we mean STATIC extra
  *        capacity at NEGOTIATION TIME.  This is the minimum capacity
  *        that the vres will get based on contract negotiation.
diff --git a/frsh_thread_attrs.h b/frsh_thread_attrs.h
new file mode 100644 (file)
index 0000000..014bdb6
--- /dev/null
@@ -0,0 +1,166 @@
+// -----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 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
+//
+//   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.
+//
+//  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.
+// -----------------------------------------------------------------------
+//frsh_thread.h
+//==============================================
+//  ******** *******    ********  **      **
+//  **///// /**////**  **//////  /**     /**
+//  **      /**   /** /**        /**     /**
+//  ******* /*******  /********* /**********
+//  **////  /**///**  ////////** /**//////**
+//  **      /**  //**        /** /**     /**
+//  **      /**   //** ********  /**     /**
+//  //       //     // ////////   //      //
+//
+// FRSH(FRescor ScHeduler), pronounced "fresh"
+//==============================================
+#ifndef _FRSH_THREADS_H_
+#define _FRSH_THREADS_H_
+
+/**
+ * @file frsh_thread_attrs.h
+ **/
+
+/**
+ * @defgroup threadfunc FRSH thread functions.
+ * @ingroup core
+ *
+ * These functions are used to manage frsh_thread_t and
+ * frsh_thread_attr_t used in the public API of FRSH.
+ *
+ * @{
+ **/
+
+
+/*************************
+ * Thread attributes
+ *************************/ 
+
+/**
+ * frsh_thread_attr_init()
+ *
+ * Initialize a thread attributes object
+ *
+ * This function initializes the object pointed to by attr to all 
+ * the default values defined by FRSH
+ *
+ * @return 0 if successful; otherwise it returns \n
+ *   FOSA_ENOMEM: insufficient memory exists to initialize the thread 
+ *           attributes object
+ **/
+static inline int frsh_thread_attr_init(frsh_thread_attr_t *attr)
+{
+    return fosa_thread_attr_init(attr);
+}
+
+/**
+ * frsh_thread_attr_destroy()
+ *
+ * Destroy a thread attributes object
+ *
+ * This function is used to destroy the thread attributes object,
+ * pointed to by attr, and deallocate any system resources allocated for it
+ * 
+ * Returns 0
+ */
+static inline int frsh_thread_attr_destroy(frsh_thread_attr_t *attr)
+{
+    return fosa_thread_attr_destroy(attr);
+}
+
+/**
+ * frsh_thread_attr_set_stacksize()
+ *
+ * Set the thread minimum stack size in a thread attributes object
+ *
+ * This function sets the minimum stack size of the thread attributes
+ * object attr to the value given by stacksize, in bytes. This
+ * function has no runtime effect on the stack size, except when the
+ * attributes object is used to create a thread, when it will be
+ * created with the specified minimum stack size
+ * 
+ * @return 0 if successful, or the following error code:
+ *    FOSA_EINVAL: the specified stacksize  value is not supported in
+ *            this implementation
+ */
+static inline int frsh_thread_attr_set_stacksize(frsh_thread_attr_t *attr, size_t stacksize)
+{
+    return fosa_thread_attr_set_stacksize(attr, stacksize);
+}
+
+/**
+ * frsh_thread_attr_get_stacksize()
+ *
+ * Get the thread minimum stack size from a thread attributes object
+ *
+ * This function sets the variable pointed to by stacksize to the
+ * minimum stack size stored in the thread attributes object attr.
+ * 
+ * @return 0
+ */
+static inline int frsh_thread_attr_get_stacksize
+      (const frsh_thread_attr_t *attr, size_t *stacksize)
+{
+    return fosa_thread_attr_get_stacksize(attr, stacksize);
+}
+
+
+/*@}*/
+
+#endif
+
diff --git a/frsh_time.h b/frsh_time.h
new file mode 100644 (file)
index 0000000..a2eb6ae
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+** fosa_time.h
+** 
+** Made by Miguel marciano
+** Login   <miguel@namir.ctr.unican.es>
+** 
+** Started on  Mon Jan 21 20:01:04 2008 Miguel marciano
+** Last update Mon Jan 21 20:01:04 2008 Miguel marciano
+*/
+#ifndef        FRSH_TIME_H_
+#define        FRSH_TIME_H_
+
+/**
+ * frsh_eat()
+ *
+ * Eat some time using system clock facilities
+ **/
+static void inline frsh_eat(const struct timespec *cpu_time)
+{
+    fosa_eat(cpu_time);
+}
+
+
+#endif             /* !FOSA_TIME_H_ */