// -----------------------------------------------------------------------
-// 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
//==============================================
#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
* 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);
/**
* 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);
/**
* 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
* 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);
* 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);
* 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
* implementation and dependant applications
**/
int fosa_ads_set_appscheduled
- (frsh_thread_id_t thread,
+ (fosa_thread_id_t thread,
bool 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);
* 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
* 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);
* 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
* 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);
* 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()
* 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
**/
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()
* 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
**/
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);
/**
* 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
**/
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()
* 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
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()
* 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
**/
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);
/**
* 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);
/**
* 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
/*}*/
+FOSA_CPP_END_DECLS
#endif /* !FOSA_APP_DEF_SCHED_H_ */