]> rtime.felk.cvut.cz Git - frescor/fosa.git/blobdiff - src_ose/fosa_ose_implementation_specific.h
• Brief description:
[frescor/fosa.git] / src_ose / fosa_ose_implementation_specific.h
diff --git a/src_ose/fosa_ose_implementation_specific.h b/src_ose/fosa_ose_implementation_specific.h
new file mode 100644 (file)
index 0000000..f7fefad
--- /dev/null
@@ -0,0 +1,266 @@
+// -----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
+//
+//    Universidad de Cantabria,              SPAIN
+//    University of York,                    UK
+//    Scuola Superiore Sant'Anna,            ITALY
+//    Kaiserslautern University,             GERMANY
+//    Univ. Politecnica  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
+//
+//        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.
+//
+//  All rights reserved.
+//
+//  Redistribution and use in source and binary forms, with or 
+//  without modification, are permitted provided that the 
+//  following conditions are met:
+//
+//    * Redistributions of source code must retain the above 
+//      copyright notice, this list of conditions and the 
+//      following disclaimer.
+//    * Redistributions in binary form must reproduce the above 
+//      copyright notice, this list of conditions and the 
+//      following disclaimer in the documentation and/or other 
+//      materials provided with the distribution.
+//    * Neither the name of FRESCOR nor the names of its 
+//      contributors may be used to endorse or promote products 
+//      derived from this software without specific prior 
+//      written permission.
+//
+//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+//  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
+//  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
+//  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+//  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
+//  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
+//  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+//  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
+//  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
+//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+//  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+//  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+//  POSSIBILITY OF SUCH DAMAGE.
+// -----------------------------------------------------------------------
+//fosa_ose_implementation_specific.h
+//==============================================
+//  ********  ******    ********  **********
+//  **///// /**    **  **//////  /**     /**
+//  **      /**    ** /**        /**     /**
+//  ******* /**    ** /********* /**********
+//  **////  /**    ** ////////** /**//////**
+//  **      /**    **        /** /**     /**
+//  **      /**    **  ********  /**     /**
+//  //       /******/  ////////   //      // 
+//
+// FOSA(Frescor Operating System Adaptation layer)
+//================================================
+
+/*
+ * Intended to be used only by internal .c files to include all
+ * internal declarations visible only within the src library directory.
+ *
+ * It is not used by any .h file to avoid include deadlocks.
+ */
+
+
+#ifndef     FOSA_OSE_IMPLEMENTATION_SPECIFIC_H
+#define     FOSA_OSE_IMPLEMENTATION_SPECIFIC_H
+
+#include "fosa_ose_signals.sig" //The only place where this file is incl.
+#include "fosa_ose_types.h"
+
+#include "ose.h"
+//#include "fosa.h"
+
+//Debug purpose only:
+#include "ramlog.h"
+
+/*************************
+ * Global Data
+ *************************/ 
+
+/*
+ * author erth
+ *
+ * This global variable is used to initialize a process when made by
+ * fosa_thread_create. It makes the names of the processes to 
+ * "fosa_ose_1", "fosa_ose_2" and so on.
+ */
+extern unsigned int process_name_number;
+
+/*
+ * author erth
+ *
+ * Global bool to keep track of if the keys array are initialized (all set
+ * two false) these are used in the functions fosa_key_create() and 
+ * fosa_key_destroy().
+ */
+extern bool fosa_ose_keys_initialized;
+extern bool fosa_ose_keys_taken[];
+
+/*************************
+ * General Help Functions
+ *************************/ 
+
+/*
+ * author erth
+ *
+ * Function to convert systime, or actually system_tick and microseconds
+ * to timespec, or seconds and nanoseconds. 
+ */
+void fosa_ose_systime_to_timespec(unsigned long ticks, 
+                    unsigned long microsec, struct timespec* time);
+
+/*************************
+ * Process Specific Functions
+ *************************/ 
+
+/*
+ * author erth
+ *
+ * Internal function that takes a pid as argument and returns true if it
+ * is an active process (OS_BG_PROC, OS_PRI_PROC, OS_TI_PROC, OS_INT_PROC
+ * or OS_PHANTOM process), otherwise false are returned.
+ */
+bool fosa_ose_is_process(PROCESS Pid);
+
+extern fosa_ose_process_info_t* fosa_ose_processes;
+
+/*
+ * author erth
+ *
+ * This function returns a pointer to the node with the given pid in the 
+ * fosa_ose_processes list.
+ */
+fosa_ose_process_info_t* fosa_ose_process_get_node(frsh_thread_id_t pid);
+
+/*
+ * author erth
+ *
+ * This function is called to remove a node in the list fosa_ose_processes
+ * prefferable from the kill handler, or the scheduler.
+ * 
+ * return 0 if success.
+ */
+int fosa_ose_process_list_node_remove(frsh_thread_id_t pid);
+
+/*************************
+ * Application defined scheduling functions
+ *************************/ 
+
+/*
+ * author erth
+ *
+ * Function to initialize an action queue. This function should be used
+ * before the fosa_ads_actions_t type can be used by other functions.
+ */
+void fosa_ose_ads_actions_init(fosa_ads_actions_t *sched_actions);
+
+/*
+ * author erth
+ *
+ * Function to remove the first action in an fosa_ads_actions_t queue.
+ */
+void fosa_ose_adsactions_remove_first(fosa_ads_actions_t *sched_actions);
+
+void fosa_ose_execute_action_activate(PROCESS pid);
+
+void fosa_ose_execute_action_suspend(PROCESS pid);
+
+void fosa_ose_execute_action_reject(PROCESS pid);
+
+void fosa_ose_execute_action_accept(PROCESS pid);
+
+void fosa_ose_execute_action_thread_notification(
+    fosa_ose_action_t* action);
+
+void fosa_ose_execute_action_timeout(
+    fosa_ose_action_t* action);
+
+
+/*
+ * author erth
+ *
+ * This function initialize the scheduler operations.
+ */
+void fosa_ose_scheduler_ops_init(fosa_ads_scheduler_ops_t *scheduler_ops);
+
+/*
+ * author erth
+ *
+ * This function are used to send an event to the fosa scheduler.
+ * @param event_pid    the pid that the event is about.
+ * @param event_isg    the event that has occured. 
+ */
+void fosa_ose_send_event_to_scheduler(  PROCESS event_pid, 
+                                        SIGSELECT event_sig);
+                                       
+
+/*************************
+ * Test Help Functions
+ *************************/ 
+
+//For test purpose only........remove.....................................
+//Bad design if this has to be here!!!....................................
+extern void * test_function(char * text);
+
+/*
+ * author erth
+ *
+ * Callback to test the callback functionality of fosa. Returns 0 if 
+ * succesful. Otherwise it returns an error.
+ */
+int frsh_ose_callback_test();
+
+/*
+ * author erth
+ *
+ * fosa_ose_adsactions_add_test()
+ *
+ * Test action that can be added to an actions list.
+ *
+ * This function adds a test action to the that will cause the
+ * test action to be invoked.
+ * 
+ *  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
+ *
+ *  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_ose_adsactions_add_test(fosa_ads_actions_t *sched_actions,
+        action_t string);
+
+/**
+ * fosa_ose_convert_prio_to_ose()
+ *
+ * Maps fosa priority to ose priority. FOSA internal function.
+ **/
+//OSPRIORITY fosa_ose_convert_prio_to_ose(int fosa_prio);
+
+/**
+ * fosa_ose_convert_prio_to_fosa()
+ *
+ * Maps ose priority to fosa priority. FOSA internal function.
+ **/
+//int fosa_ose_convert_prio_to_fosa(OSPRIORITY ose_prio);
+
+
+#endif /*  FOSA_OSE_IMPLEMENTATION_SPECIFIC_H */
+