+++ /dev/null
-// -----------------------------------------------------------------------
-// Copyright (C) 2006 - 2007 FRESCOR consortium partners:
-//
-// 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 for a link to partners' websites
-//
-// 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.
-//
-// 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.
-//
-// 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.
-//
-// 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.
-// -----------------------------------------------------------------------
-//fosa_types.h
-//==============================================
-// ******** ****** ******** **********
-// **///// /** ** **////// /** /**
-// ** /** ** /** /** /**
-// ******* /** ** /********* /**********
-// **//// /** ** ////////** /**//////**
-// ** /** ** /** /** /**
-// ** /** ** ******** /** /**
-// // /******/ //////// // //
-//
-// FOSA(Frescor Operating System Adaptation layer)
-//================================================
-
-
-#ifndef _FOSA_TYPES_H_
-#define _FOSA_TYPES_H_
-
-// Include needed to have the "frsh_thread_t" type.
-#include "../../../../frsh/trunk/include/frsh_fosa.h"
-
-#include "fosa_opaque_types.h"
-
-/**
- * @addtogroup clocksandtimers
- *
- * @{
- **/
-// identifier of a clock
-// either a real-time clock or a cpu-time clock
-typedef FOSA_CLOCK_ID_T_OPAQUE fosa_clock_id_t;
-
-// identifier of a one-shot timer
-typedef FOSA_TIMER_ID_T_OPAQUE fosa_timer_id_t;
-
-/*@}*/
-
-typedef int frsh_signal_t;
-typedef void * frsh_signal_info_t;
-typedef int bool;
-
-/**
- * @addtrogroup mutexesandcondvars
- *
- * @{
- **/
-// a condition variable
-typedef FOSA_COND_T_OPAQUE fosa_cond_t;
-/*@}*/
-
-/**
- * @addtogroup appdefsched
- *
- * @{
- **/
-
-/*********
- * ADS
- *********/
-
-/**
- * ADS actions
- *
- * This type is used to represent a list of scheduling actions that the
- * scheduler will later request to be executed by the system. The pos-
- * sible actions are of the following kinds:
- * - reject a thread that has requested attachment to this scheduler
- * - activate an application-scheduled thread with the desired value
- * of urgency
- * - suspend an application-scheduled thread
- * - program a timeout
- * - program a timed notification associated to a particular
- * application-scheduled thread.
- *
- * No comparison or assignment operators are defined for this type
- **/
-typedef FOSA_ADS_ACTIONS_T_OPAQUE fosa_ads_actions_t;
-
-
-/**
- * Causes of error in the appsched_error primitive operation
- **/
-typedef enum {FOSA_ADS_THREAD_NOT_ATTACHED, FOSA_ADS_INVALID_ACTION}
- fosa_ads_error_cause_t;
-
-
-/**
- * The urgency used to orde the threads of the same priority in the
- * underlying scheduler. Support for urgency scheduling is required
- * for supporting the hierarchhical scheduling module
- **/
-typedef int fosa_ads_urgency_t;
-
-
-/**
- * Scheduler primitive operations
- *
- * This structure is used to create application schedulers. It
- * contains pointers to the primitive operations that are invoked by
- * the system when a scheduling event occurs:
- *
- * - The \b init() primitive operation is invoked by the system just after
- * the scheduler has been created using fosa_ads_scheduler_create().
- *
- * - The \b new_thread() primitive operation is invoked by the system when
- * a thread has requested attachment to this scheduler; this can be a
- * newly created thread (via fosa_thread_create()), or an existing thread
- * that was not running under ads scheduler (via
- * fosa_ads_set_appscheduled()).\n \n
- * .
- * The thread can be rejected by the scheduler adding a
- * reject-thread action to the actions parameter using
- * fosa_ads_actions_add_reject(). If no reject-thread action is
- * added, the thread is accepted.\n \n
- * .
- * Newly created threads shall be activated by the system after the
- * execution of the new_thread() primitive operation. The urgency of
- * an accepted thread (either newly created or existing) shall be set
- * to a value of zero, unless an activate-thread action with a
- * different value of urgency is added via
- * fosa_ads_actions_add_activate().\n \n
- * .
- * If a request to attach a thread to this scheduler was made via
- * fosa_ads_set_appscheduled(), at the finalization of the new_thread()
- * primitive operation if the newly attached thread is blocked by the
- * system (not by the scheduler itself via a suspend scheduling
- * action), a thread-block event shall be generated for the scheduler
- * immediately and, consequently, the thread_block() primitive
- * operation shall be invoked by the system.
- *
- * - The \b thread_terminate() primitive operation is invoked by the system
- * when a thread attached to this scheduler is terminating (via an
- * explicit or implicit thread termination, or cancellation, or when
- * it is no longer sceduled by the ads scheduler (via
- * fosa_ads_setappscheduled()). \n\n
- * .
- * Before the thread_terminate() primitive operation is invoked by
- * the system, all the thread-notification events programmed for that
- * thread are cancelled. \n\n
- * .
- * In the case of a thread that is terminating, the
- * thread_terminate() primitive operation is executed before the
- * execution of the cleanup handlers and of the thread-specific data
- * destructor functions. In that way, the thread parameter corresponds
- * to a valid thread Id and the thread-specific data is valid and can
- * be accessed from the thread_terminate() primitive operation. \n\n
- * .
- * Also for terminating threads, after the thread_terminate() primitive
- * operation finishes, the system shall lower the urgency of the
- * thread identified by thread to a value of zero, and shall deattach
- * it from the ads scheduler. Then, the thread shall execute the
- * cleanup handlers and the thread-specific data destructor functions
- * outside the management of its former scheduler. Notice that in a
- * multiprocessor system this may imply the suspension of the thread
- * identified by parameter thread during the execution of the
- * thread_terminate() primitive operation.
- *
- * - The \b thread_ready() primitive operation is invoked by the system
- * when a thread attached to this scheduler that was blocked has
- * become unblocked by the system.
- *
- * - 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 explicit_call_with_data() primitive operation is invoked by the
- * system when a thread (identified by the thread parameter) has
- * explicitly invoked the scheduler with a message containing
- * scheduling information, and possibly requesting a reply message,
- * via fosa_ads_invoke_withdata().
- *
- * - The \b notification_for_thread() primitive operation is invoked by the
- * system when the time for a thread-notification previously programed
- * by the scheduler via fosa_ads_actions_add_thread_notification()
- * is reached. Parameter clock identifies the clock for which the
- * thread-notification was programmed.
- *
- * - The \b timeout() primitive operation is invoked by the system when a
- * timeout requested by the scheduler (via
- * fosa_ads_actions_add_timeout()) has expired.
- *
- * - The \b signal() primitive operation is invoked by the system when a
- * signal belonging to the set of signals for which the scheduler is
- * waiting (via fosa_ads_set_handled_signal_set()) has been
- * generated. \n\n
- * .
- * The signal number and its associated information (if any) are
- * passed in the arguments signal and siginfo.\n\n
- * .
- * The signal is consumed with the invocation of this primitive
- * operation, which implies that it will not cause the execution of
- * any signal handler, nor it may be accepted by any thread waiting
- * for this signal number.
- *
- * - The \b appsched_error() primitive operation is invoked by the system
- * 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
- *
- * Every primitive operation receives the argument sched_data. It is a
- * pointer to a memory area containing information shared by all the
- * scheduler operations. It can be used to store the data structures
- * required by the scheduler (for example, a ready queue and a delay
- * queue). Scheduler operations should not use any other global data out
- * of this memory area.
- *
- * The actions argument is used by the scheduler to request the operating
- * system to execute a set of scheduling actions at the end of the
- * primitive operation. It is passed empty by the system, and the
- * scheduler may add multiple scheduling actions.
- *
- * The current_time argument contains the system time
- * measured immediately before the invocation of the primitive operation
- * using the FOSA_CLOCK_REALTIME clock
- *
- * In addition to these common parameters, most of the primitive
- * operations receive a thread argument. This argument allows the
- * primitive operations to know which is the thread that has produced or
- * is related to the event.
- **/
-typedef struct {
- void (*init) (void * sched_data, void * arg);
- void (*new_thread) (void * sched_data,
- frsh_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_ads_actions_t * actions,
- struct timespec *current_time);
- void (*thread_ready) (void * sched_data,
- frsh_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_ads_actions_t * actions,
- struct timespec *current_time);
- //void (*thread_yield) (void * sched_data,
- // frsh_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_ads_actions_t * actions,
- struct timespec *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);
- //void (*explicit_call) (void * sched_data,
- // frsh_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,
- 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_clock_id_t clock,
- fosa_ads_actions_t * actions,
- struct timespec *current_time);
- void (*timeout) (void * sched_data,
- fosa_ads_actions_t * actions,
- struct timespec *current_time);
- void (*signal) (void * sched_data,
- frsh_signal_t signal,
- frsh_signal_info_t siginfo,
- fosa_ads_actions_t * actions,
- struct timespec *current_time);
- //void (*priority_inherit) (void * sched_data,
- // frsh_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,
- // int sched_priority,
- // fosa_ads_actions_t * actions,
- // struct timespec *current_time);
- void (*appshed_error) (void * sched_data,
- frsh_thread_id_t thread,
- fosa_ads_error_cause_t cause,
- fosa_ads_actions_t * actions);
-} fosa_ads_scheduler_ops_t;
-
-
-/*@}*/
-
-#endif // _FOSA_TYPES_H_