]> rtime.felk.cvut.cz Git - frescor/fosa.git/blobdiff - include/fosa_types.h
Adding FOSA_CPP_BEING|END_DECLS to allow interfacing with C++
[frescor/fosa.git] / include / fosa_types.h
index 8d018a8adbf7ec801867be7ab57b7f9d75aa7ccb..3968aae8049462968f7ce7878df573eadd3c560b 100644 (file)
@@ -1,5 +1,5 @@
-// -----------------------------------------------------------------------
-//  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+//----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
 //
 //    Universidad de Cantabria,              SPAIN
 //    University of York,                    UK
 //    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
+//    See http://www.frescor.org
+//
+//        The 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.
 //
-//  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
 //
-//  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 Abstraction)
 //
-//  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
  *
@@ -86,6 +133,9 @@ typedef    FOSA_TIMER_ID_T_OPAQUE    fosa_timer_id_t;
  * @{
  **/
 // 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;
 /*@}*/
 
@@ -203,13 +253,15 @@ typedef int fosa_ads_urgency_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
@@ -270,27 +322,27 @@ typedef int fosa_ads_urgency_t;
 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);
    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);
    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);
    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);
   //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);
    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);
   //void msg_from_scheduler(void * sched_data,
@@ -299,18 +351,18 @@ typedef struct {
   //          fosa_ads_actions_t * actions,
   //          struct timespec *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);
   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,
            fosa_ads_actions_t * actions,
            struct timespec *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);
@@ -318,22 +370,22 @@ typedef struct {
            fosa_ads_actions_t * actions,
            struct timespec *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);
   //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);
   //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);
   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;
@@ -341,4 +393,20 @@ typedef struct {
 
 /*@}*/
 
+/*********************
+ *   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_