]> rtime.felk.cvut.cz Git - frescor/fosa.git/blobdiff - include/fosa_app_def_sched.h
Updating header text in FOSA files for the incoming final project
[frescor/fosa.git] / include / fosa_app_def_sched.h
index 1b56cfc030688cb4b99f7cf4859b173ea53b8930..9dff2272b0396b32b405722f7f5607067ee29854 100644 (file)
@@ -1,18 +1,18 @@
 // -----------------------------------------------------------------------
-//  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+//  Copyright (C) 2006 - 2009 FRESCOR consortium partners:
 //
 //    Universidad de Cantabria,              SPAIN
 //    University of York,                    UK
 //    Scuola Superiore Sant'Anna,            ITALY
 //    Kaiserslautern University,             GERMANY
-//    Univ. Politecnica  Valencia,           SPAIN
+//    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
 //        The European Union is not liable of any use that may be
 //        made of this code.
 //
-//  This file is part of the FRSH implementation
 //
-//  FRSH 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.
+//  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/
 //
-//  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.
+//   This file is part of FOSA (Frsh Operating System Adaption)
 //
-//  You should have  received a  copy of  the  GNU  General Public License
-//  distributed  with  FRSH;  see file COPYING.   If not,  write to the
-//  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
-//  02111-1307, USA.
+//  FOSA 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.  FOSA 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 FOSA; 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 FOSA header files in a file,
+//  instantiating FOSA generics or templates, or linking other files
+//  with FOSA 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.
 // -----------------------------------------------------------------------
 //fosa_app_def_sched.h
 //==============================================
@@ -64,6 +72,8 @@
 
 #include "fosa_types.h"
 
+FOSA_CPP_BEGIN_DECLS
+
 /**
  * @defgroup appdefsched Application Defined Scheduling
  * @ingroup fosa
  * system minus the configuration parameter FOSA_ADS_SCHEDULER_PRIO_DIFF.
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: The value of scheduler_ops was invalid
- *     EAGAIN: The system lacks enough resources to create the scheduler
+ *
+ *     FOSA_EINVAL: The value of scheduler_ops was invalid \n
+ *     FOSA_EAGAIN: The system lacks enough resources to create the
+ *                  scheduler \n
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
@@ -148,14 +160,15 @@ int fosa_ads_scheduler_create
  * the system under a fixed priority scheduler
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: The value of attr is invalid
+ *
+ *     FOSA_EINVAL: The value of attr is invalid
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
  * implementation and dependant applications
  **/
 int fosa_thread_attr_set_appscheduled
-        (frsh_thread_attr_t *attr,
+        (fosa_thread_attr_t *attr,
          bool appscheduled);
 
 /**
@@ -170,14 +183,15 @@ int fosa_thread_attr_set_appscheduled
  * the system under a fixed priority scheduler.
  * 
  * Returns 0 if successful; otherwise it returns an error code:
- *    EINVAL: The value of attr is invalid
+ *
+ *    FOSA_EINVAL: The value of attr is invalid
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
  * implementation and dependant applications
  **/
 int fosa_thread_attr_get_appscheduled
-        (const frsh_thread_attr_t *attr,
+        (const fosa_thread_attr_t *attr,
          bool *appscheduled);
 
 /**
@@ -194,7 +208,8 @@ int fosa_thread_attr_get_appscheduled
  * paramsize bytes and pointed to by param into that attribute
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *    EINVAL: The value of attr is invalid, or paramsize is less than 
+ *
+ *    FOSA_EINVAL: The value of attr is invalid, or paramsize is less than 
  *            zero or larger than FOSA_ADS_SCHEDPARAM_MAX
  *
  * Alternatively, in case of error the implementation is allowed to
@@ -202,7 +217,7 @@ int fosa_thread_attr_get_appscheduled
  * implementation and dependant applications
  **/
 int fosa_thread_attr_set_appsched_params
-        (frsh_thread_attr_t *attr,
+        (fosa_thread_attr_t *attr,
          const void *param,
          size_t paramsize);
 
@@ -222,14 +237,15 @@ int fosa_thread_attr_set_appsched_params
  * paramsize.
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: The value of attr is invalid
+ *
+ *     FOSA_EINVAL: The value of attr is invalid
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
  * implementation and dependant applications
  **/
 int fosa_thread_attr_get_appsched_params
-        (const frsh_thread_attr_t *attr,
+        (const fosa_thread_attr_t *attr,
          void *param,
          size_t *paramsize);
 
@@ -245,9 +261,10 @@ int fosa_thread_attr_get_appsched_params
  * scheduled by the system under a fixed priority scheduler.
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: The value of thread is invalid
  *
- *     EREJECT: the attachment of the thread to the frsh schehduler
+ *     FOSA_EINVAL: The value of thread is invalid
+ *
+ *     FOSA_EREJECT: the attachment of the thread to the frsh schehduler
  *     was rejected by the frsh scheduler possibly because of
  *     incorrect attributes, or because the requested minimum
  *     capacity cannot be guaranteed
@@ -257,7 +274,7 @@ int fosa_thread_attr_get_appsched_params
  * implementation and dependant applications
  **/
 int fosa_ads_set_appscheduled
-        (frsh_thread_id_t thread,
+        (fosa_thread_id_t thread,
          bool appscheduled);
 
 /**
@@ -272,14 +289,15 @@ int fosa_ads_set_appscheduled
  * scheduled by the system under a fixed priority scheduler
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: The value of thread is invalid
+ *
+ *     FOSA_EINVAL: The value of thread is invalid
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
  * implementation and dependant applications
  **/
 int fosa_ads_get_appscheduled
-        (frsh_thread_id_t thread,
+        (fosa_thread_id_t thread,
          bool *appscheduled);
 
 
@@ -298,7 +316,8 @@ int fosa_ads_get_appscheduled
  * that attribute
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *    EINVAL: The value of thread is invalid, or paramsize is less than 
+ *
+ *    FOSA_EINVAL: The value of thread is invalid, or paramsize is less than 
  *            zero or larger than FOSA_ADS_SCHEDPARAM_MAX
  *
  * Alternatively, in case of error the implementation is allowed to
@@ -306,7 +325,7 @@ int fosa_ads_get_appscheduled
  * implementation and dependant applications
  **/
 int fosa_ads_set_appsched_params
-        (frsh_thread_id_t thread,
+        (fosa_thread_id_t thread,
          const void *param,
          size_t paramsize);
 
@@ -326,7 +345,8 @@ int fosa_ads_set_appsched_params
  * bytes equal to paramsize.
  *
  *  Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: The value of thread is invalid, or paramsize is less than 
+ *
+ *     FOSA_EINVAL: The value of thread is invalid, or paramsize is less than 
  *             zero or larger than FOSA_ADS_SCHEDPARAM_MAX
  *
  * Alternatively, in case of error the implementation is allowed to
@@ -334,7 +354,7 @@ int fosa_ads_set_appsched_params
  * implementation and dependant applications.
  **/
 int fosa_ads_get_appsched_params
-        (frsh_thread_id_t thread,
+        (fosa_thread_id_t thread,
          void *param,
          size_t *paramsize);
 
@@ -363,7 +383,7 @@ int fosa_ads_get_appsched_params
  * scheduler primitive operation, the parent of the rejected thread
  * waiting on a fosa_thread_create() or the rejected thread itself
  * waiting on a fosa_ads_set_appscheduled() function shall complete the
- * function with an error code of EREJECT. If no reject-thread action
+ * function with an error code of FOSA_EREJECT. If no reject-thread action
  * is added during the new_thread() scheduler primitive operation, the
  * thread is accepted to be scheduled by the scheduler and the
  * associated fosa_thread_create() or the fosa_ads_set_appscheduled()
@@ -373,11 +393,12 @@ int fosa_ads_get_appsched_params
  * scheduler.
  *
  *  Returns 0 if successful; otherwise it returns an error code:
- *     ENOMEM: There is insufficient memory to add this action
- *     EPOLICY: The thread specified by thread is not the one requesting
+ *
+ *     FOSA_ENOMEM: There is insufficient memory to add this action \n
+ *     FOSA_EPOLICY: The thread specified by thread is not the one requesting
  *               attachment to the scheduler, or the function is not being
- *               called from the new_thread primitive operation
- *     EINVAL: The value specified by sched_actions is invalid
+ *               called from the new_thread primitive operation \n
+ *     FOSA_EINVAL: The value specified by sched_actions is invalid \n
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
@@ -385,7 +406,7 @@ int fosa_ads_get_appsched_params
  **/
 int fosa_adsactions_add_reject(
         fosa_ads_actions_t *sched_actions,
-        frsh_thread_id_t thread);
+        fosa_thread_id_t thread);
 
 /**
  * fosa_adsactions_add_activate()
@@ -410,10 +431,11 @@ int fosa_adsactions_add_reject(
  * with more urgency will be scheduled before those of less urgency.
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     ENOMEM: There is insufficient memory to add this action
- *     EPOLICY: The thread specified by thread has its appscheduled
- *              attribute set to false, 
- *     EINVAL: The value specified by sched_actions is invalid
+ *
+ *     FOSA_ENOMEM: There is insufficient memory to add this action \n
+ *     FOSA_EPOLICY: The thread specified by thread has its appscheduled
+ *              attribute set to false \n
+ *     FOSA_EINVAL: The value specified by sched_actions is invalid \n
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
@@ -421,7 +443,7 @@ int fosa_adsactions_add_reject(
  **/
 int fosa_adsactions_add_activate(
         fosa_ads_actions_t *sched_actions,
-        frsh_thread_id_t thread,
+        fosa_thread_id_t thread,
         fosa_ads_urgency_t urgency);
 
 /**
@@ -438,10 +460,11 @@ int fosa_adsactions_add_activate(
  * operating system.
  * 
  *  Returns 0 if successful; otherwise it returns an error code:
- *     ENOMEM: There is insufficient memory to add this action
- *     EPOLICY: The thread specified by thread has its appscheduled
- *              attribute set to false, 
- *     EINVAL: The value specified by sched_actions is invalid
+ *
+ *     FOSA_ENOMEM: There is insufficient memory to add this action \n
+ *     FOSA_EPOLICY: The thread specified by thread has its appscheduled
+ *              attribute set to false \n
+ *     FOSA_EINVAL: The value specified by sched_actions is invalid \n
  *
  *  Alternatively, in case of error the implementation is allowed to
  *  notify it to the system console and then terminate the FRSH
@@ -449,7 +472,7 @@ int fosa_adsactions_add_activate(
  **/
 int fosa_adsactions_add_suspend(
         fosa_ads_actions_t *sched_actions,
-        frsh_thread_id_t thread);
+        fosa_thread_id_t thread);
 
 /**
  * fosa_adsactions_add_timeout()
@@ -464,8 +487,9 @@ int fosa_adsactions_add_suspend(
  * argument.
  *
  *  Returns 0 if successful; otherwise it returns an error code:
- *     ENOMEM: There is insufficient memory to add this action
- *     EINVAL: The value specified by sched_actions is invalid
+ *
+ *     FOSA_ENOMEM: There is insufficient memory to add this action \n
+ *     FOSA_EINVAL: The value specified by sched_actions is invalid \n
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
@@ -474,7 +498,7 @@ int fosa_adsactions_add_suspend(
 int fosa_adsactions_add_timeout(
         fosa_ads_actions_t *sched_actions,
         fosa_clock_id_t clock_id,
-        const struct timespec *at_time);
+        const fosa_abs_time_t *at_time);
 
 /**
  * fosa_adsactions_add_thread_notification()
@@ -495,10 +519,11 @@ int fosa_adsactions_add_timeout(
  * thread specified by thread and the clock specified by clock_id.
  * 
  *  Returns 0 if successful; otherwise it returns an error code:
- *     ENOMEM: There is insufficient memory to add this action
- *     EPOLICY: The thread specified by thread has its appscheduled
- *              attribute set to false, 
- *     EINVAL: The value specified by sched_actions is invalid
+ *
+ *     FOSA_ENOMEM: There is insufficient memory to add this action \n
+ *     FOSA_EPOLICY: The thread specified by thread has its appscheduled
+ *              attribute set to false \n
+ *     FOSA_EINVAL: The value specified by sched_actions is invalid \n
  *
  *  Alternatively, in case of error the implementation is allowed to
  *  notify it to the system console and then terminate the FRSH
@@ -506,9 +531,9 @@ int fosa_adsactions_add_timeout(
  **/
 int fosa_adsactions_add_thread_notification(
         fosa_ads_actions_t *sched_actions,
-        frsh_thread_id_t thread,
+        fosa_thread_id_t thread,
         fosa_clock_id_t clock_id,
-        const struct timespec *at_time);
+        const fosa_abs_time_t *at_time);
 
 
 /**
@@ -533,15 +558,49 @@ int fosa_adsactions_add_thread_notification(
  * The size of the array is specified by argument size.
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *    EPOLICY: The function has not been called from a scheduler 
- *              primitive operation
- *    EINVAL: The value specified by set is invalid
+ *
+ *    FOSA_EPOLICY: The function has not been called from a scheduler 
+ *              primitive operation \n
+ *    FOSA_EINVAL: The value specified by set is invalid \n
+ *
+ * Alternatively, in case of error the implementation is allowed to
+ * notify it to the system console and then terminate the FRSH
+ * implementation and dependant applications
+ **/
+int fosa_ads_set_handled_signal_set(fosa_signal_t set[], int size);
+
+
+/**
+ * fosa_signal_queue_scheduler()
+ *
+ * Queue a signal destinated to the scheduler
+ *
+ * This is a special case of fosa_signal_queue() in which the
+ * destinator is the scheduler itself.  It is needed by the service
+ * thread to notify the results to the scheduler.
+ *
+ * The problem with this case is that, depending on the implementation,
+ * this call would be translated to a true signal or to a scheduler
+ * notification message.
+ *
+ * Besides for the scheduler we don't have always a destinator
+ * thread_id needed in fosa_signal_queue for OSE.
+ *
+ * So the fosa implementation will solve this issue internally.
+ * 
+ * Returns 0 if successful; otherwise it returns an error code:
+ *     FOSA_EINVAL: the signal specified by signal is not
+ *              between FOSA_SIGNAL_MIN and FOSA_SIGNAL_MAX
+ *
+ *     FOSA_EAGAIN: no resources are available to queue the signal; the
+ *             maximum number of queued signals has been reached, or a
+ *             systemwide resource limit has been exceeded
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
  * implementation and dependant applications
  **/
-int fosa_ads_set_handled_signal_set(frsh_signal_t set[], int size);
+int fosa_signal_queue_scheduler(fosa_signal_t signal, fosa_signal_info_t info);
 
 
 /**
@@ -576,12 +635,13 @@ int fosa_ads_set_handled_signal_set(frsh_signal_t set[], int size);
  * scheduler.
  *
  *  Returns 0 if successful; otherwise it returns an error code:
- *     EPOLICY: The function been called from inside a scheduler 
- *              primitive operation
- *     EINVAL: The value of msg_size is less than zero or larger than 
- *             FOSA_ADS_SCHEDINFO_MAX
- *     EMASKED: The operation cannot be executed because the primitive
- *              operation explicit_call_with_data() is set to NULL
+ *
+ *     FOSA_EPOLICY: The function been called from inside a scheduler 
+ *              primitive operation \n
+ *     FOSA_EINVAL: The value of msg_size is less than zero or larger than 
+ *             FOSA_ADS_SCHEDINFO_MAX \n
+ *     FOSA_EMASKED: The operation cannot be executed because the primitive
+ *              operation explicit_call_with_data() is set to NULL \n
  *
  *  Alternatively, in case of error the implementation is allowed to
  *  notify it to the system console and then terminate the FRSH
@@ -592,5 +652,6 @@ int fosa_ads_invoke_withdata
 
 /*}*/
 
+FOSA_CPP_END_DECLS
 
 #endif             /* !FOSA_APP_DEF_SCHED_H_ */