]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blobdiff - frsh_fosa_opaque.h
Correcting a wrong copy-paste problem in frsh_debug.h
[frescor/frsh-include.git] / frsh_fosa_opaque.h
index bfc6de07ac89fe82c05d765dc94a61a05f74c2ad..a75da9b5d1f7be8645fb687e99bbc627fa102cf1 100644 (file)
@@ -12,7 +12,7 @@
 //    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
@@ -22,7 +22,7 @@
 //
 //
 //  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
@@ -64,7 +64,7 @@
 //  **////  /**///**  ////////** /**//////**    **////  /**    ** ////////** /**//////**
 //  **      /**  //**        /** /**     /**    **      /**    **        /** /**     /**
 //  **      /**   //** ********  /**     /**    **      /**    **  ********  /**     /**
-//  //       //     // ////////   //      //    //       /******/  ////////   //      // 
+//  //       //     // ////////   //      //    //       /******/  ////////   //      //
 //
 // 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  /////////////////////////
+/////////////////////MaRTE OS, RT_LINUX & AQuoSA  //////////////////////
 
-#if defined(MARTE_OS) || defined(RT_LINUX)
+#if defined(MARTE_OS) || defined(RT_LINUX) || defined(AQuoSA)
 
 #include <pthread.h>
 #include <signal.h>
+#include <errno.h>
 #include <time.h>
+#include <stdbool.h>
 
-#define FOSA_THREAD_ID_T_OPAQUE   pthread_t
+#ifdef AQuoSA
 
-#define FOSA_THREAD_ATTR_T_OPAQUE pthread_attr_t
+typedef struct {
+       pthread_t pthread_id;
+       pid_t linux_pid;
+       pid_t linux_tid;
+} FOSA_THREAD_ID_T_OPAQUE;
 
-#define FOSA_SIGNAL_T_OPAQUE      int
+#else  /* !AQuoSA, MARTE_OS, RT_LINUX */
 
-#define FOSA_MUTEX_T_OPAQUE int
+typedef pthread_t FOSA_THREAD_ID_T_OPAQUE;
+
+#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
 
 /* FOSA Errors */
 
-#include <error.h>
+/* #include <error.h> */
 
 /** Not enough memory available **/
 #define FOSA_ENOMEM   ENOMEM
 
 /** FOSA ADS errors **/
 #define FOSA_EREJECT   EREJECT
-#define FOSA_EMASKED   EMASKED
+#define FOSA_EMASKED   -2
+#define FOSA_EPOLICY   -3
+
+
+
+#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
 
-#endif /* MARTE_OS || RT_LINUX */
+#define FOSA_THREAD_ATTR_T_OPAQUE fosa_thread_attr_t
 
-//////////////////////////End of MaRTE OS & RT_LINUX  ///////////////////
+#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)
 #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_ */