// -----------------------------------------------------------------------
-// Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+// Copyright (C) 2006 - 2008 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_types.h
//==============================================
#define _FOSA_TYPES_H_
#include "fosa_opaque_types.h"
-#include "frsh_fosa.h"
+
+FOSA_CPP_BEGIN_DECLS
+
+/**
+ * @addtogroup threadandsignals
+ *
+ * @{
+ **/
+
+/* Coming from FRSH-FOSA */
+
+/** identifier of a FOSA thread **/
+typedef FOSA_THREAD_ID_T_OPAQUE fosa_thread_id_t;
+
+
+/** thread attributes object **/
+typedef FOSA_THREAD_ATTR_T_OPAQUE fosa_thread_attr_t;
+
+typedef FOSA_SIGNAL_T_OPAQUE fosa_signal_t;
+
+/**
+ * The type references a function that may become a thread's
+ * code
+ **/
+typedef void * (*fosa_thread_code_t) (void *);
+
+
+/** information associated to a signal **/
+#if defined(VIRTUAL_TIME)
+
+#include <vt_ose.h>
+typedef vt_posix_signal_info_t fosa_signal_info_t;
+
+#else
+
+typedef union {int sival_int; void * sival_ptr; } fosa_signal_info_t;
+/* typedef FOSA_SIGNAL_INFO_T_OPAQUE fosa_signal_info_t; */
+
+#endif
+
+/* @} */
+
+
/**
* @addtogroup clocksandtimers
*
**/
// identifier of a clock
// either a real-time clock or a cpu-time clock
+
+typedef FOSA_REL_TIME_T_OPAQUE fosa_rel_time_t;
+typedef FOSA_ABS_TIME_T_OPAQUE fosa_abs_time_t;
+
typedef FOSA_CLOCK_ID_T_OPAQUE fosa_clock_id_t;
#define FOSA_SYSTEM_CLOCK FOSA_SYSTEM_CLOCK_OPAQUE
* @{
**/
// a condition variable
+/** Mutex object. Attributes are handled by FOSA **/
+typedef FOSA_MUTEX_T_OPAQUE fosa_mutex_t;
+
typedef FOSA_COND_T_OPAQUE fosa_cond_t;
/*@}*/
*
* - The \b thread_block() primitive operation is invoked by the system
* when a thread attached to this scheduler has blocked.
- *
- * - The \b change_sched_param_thread() primitive operation is invoked by
- * the system when the scheduling parameters of a thread attached to
- * this scheduler have been changed, but the thread continues to run
- * under this scheduler. The change includes either the regular
- * scheduling parameters (fosa_thread_set_prio() or the application-
- * defined scheduling parameters, via fosa_ads_set_appsched_param().
+ *
+ * - The \b change_sched_param_thread() primitive operation is invoked
+ * by the system when the scheduling parameters of a thread attached
+ * to this scheduler have been changed OUTSIDE OF AN SCHEDULER
+ * CALLBACK, and the thread continues to run under this scheduler.
+ * .
+ * The change includes either the regular scheduling parameters
+ * (fosa_thread_set_prio() or the application-defined scheduling
+ * parameters, via fosa_ads_set_appsched_param().
*
* - The \b explicit_call_with_data() primitive operation is invoked by the
* system when a thread (identified by the thread parameter) has
* when an error in the scheduling actions list specified in a
* previous primitive operation is detected. The cause of the error is
* notified in the parameter cause. The defined causes of error are
- * described fosa_ads_error_cause_tappdefsched
+ * described fosa_ads_error_cause_t
*
* Every primitive operation receives the argument sched_data. It is a
* pointer to a memory area containing information shared by all the
typedef struct {
void (*init) (void * sched_data, void * arg);
void (*new_thread) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
void (*thread_terminate) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
void (*thread_ready) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
void (*thread_block) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
//void (*thread_yield) (void * sched_data,
- // frsh_thread_id_t thread,
+ // fosa_thread_id_t thread,
// fosa_ads_actions_t * actions,
- // struct timespec *current_time);
+ // fosa_abs_time_t *current_time);
void (*change_sched_param_thread) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
//void msg_from_scheduler(void * sched_data,
// fosa_ads_scheduler_id_t scheduler_id,
// const void * msg, size_t msg_size,
// fosa_ads_actions_t * actions,
- // struct timespec *current_time);
+ // fosa_bas_time_t *current_time);
//void (*explicit_call) (void * sched_data,
- // frsh_thread_id_t thread,
+ // fosa_thread_id_t thread,
// int user_event_code,
// fosa_ads_actions_t * actions,
- // struct timespec *current_time);
+ // fosa_abs_time_t *current_time);
void (*explicit_call_with_data) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
const void * msg, size_t msg_size,
- void **reply, size_t *reply_size,
+ void *reply, size_t *reply_size,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
void (*notification_for_thread) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
fosa_clock_id_t clock,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
void (*timeout) (void * sched_data,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
void (*signal) (void * sched_data,
- frsh_signal_t signal,
- frsh_signal_info_t siginfo,
+ fosa_signal_t signal,
+ fosa_signal_info_t siginfo,
fosa_ads_actions_t * actions,
- struct timespec *current_time);
+ fosa_abs_time_t *current_time);
//void (*priority_inherit) (void * sched_data,
- // frsh_thread_id_t thread,
+ // fosa_thread_id_t thread,
// int sched_priority,
// fosa_ads_actions_t * actions,
- // struct timespec *current_time);
+ // fosa_abs_time_t *current_time);
//void (*priority_uninherit) (void * sched_data,
- // frsh_thread_id_t thread,
+ // fosa_thread_id_t thread,
// int sched_priority,
// fosa_ads_actions_t * actions,
- // struct timespec *current_time);
+ // fosa_abs_time_t *current_time);
void (*appsched_error) (void * sched_data,
- frsh_thread_id_t thread,
+ fosa_thread_id_t thread,
fosa_ads_error_cause_t cause,
fosa_ads_actions_t * actions);
} fosa_ads_scheduler_ops_t;
/*@}*/
+/*********************
+ * LONG JUMPS
+ *********************/
+
+/**
+ * The fosa_jump_context_t type defines a data area where the context
+ * of a thread can be saved, so that a long jump to recover that context
+ * may be executed in the future, from a long jump handler.
+ */
+
+typedef FOSA_LONG_JUMP_CONTEXT_T_OPAQUE fosa_long_jump_context_t;
+
+
+FOSA_CPP_END_DECLS
+
+
#endif // _FOSA_TYPES_H_