fosi_interface.h
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Peter Soetens  Mon Jun 26 13:25:56 CEST 2006  fosi_interface.h
00003 
00004                         fosi_interface.h -  description
00005                            -------------------
00006     begin                : Mon June 26 2006
00007     copyright            : (C) 2006 Peter Soetens
00008     email                : peter.soetens@fmtc.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 
00038 
00047 #ifndef ORO_FOSI_INTERFACE_H
00048 #define ORO_FOSI_INTERFACE_H
00049 
00050 #error "This file is a template for developers, do not include directly."
00051 
00052 #ifdef __cplusplus
00053 extern "C"
00054 {
00055 #endif
00056 
00057   struct MyTask;
00058   typedef struct MyTask RTOS_TASK;
00059 
00060   // include 'atomic' functions,
00061   // depends on processor target, not OS.
00062 #include "oro_arch.h"
00063 
00064 #define ORO_SCHED_RT    0 
00065 #define ORO_SCHED_OTHER 1 
00070   typedef long long NANO_TIME;
00071 
00074   typedef long long TICK_TIME;
00075 
00079   NANO_TIME rtos_get_time_ns( void );
00080 
00085   TICK_TIME rtos_get_time_ticks (void );
00086 
00090   TICK_TIME nano2ticks( NANO_TIME nano );
00094   NANO_TIME ticks2nano( TICK_TIME count );
00095 
00096   // Semaphore functions
00097   typedef struct sem_struct rt_sem_t;
00101   int rtos_sem_init(rt_sem_t* m, int value );
00102   int rtos_sem_destroy(rt_sem_t* m );
00103   int rtos_sem_signal(rt_sem_t* m );
00104   int rtos_sem_wait(rt_sem_t* m );
00105   int rtos_sem_trywait(rt_sem_t* m );
00106   int rtos_sem_wait_timed(rt_sem_t* m, NANO_TIME delay );
00107   int rtos_sem_wait_until(rt_sem_t* m, NANO_TIME abs_time );
00108   int rtos_sem_value(rt_sem_t* m );
00109 
00110   // Mutex and recursive mutex functions
00111   typedef struct mutex_struct rt_mutex_t;
00112   typedef struct recursive_mutex_struct rt_rec_mutex_t;
00113 
00114   int rtos_mutex_init(rt_mutex_t* m);
00115   int rtos_mutex_destroy(rt_mutex_t* m );
00116   int rtos_mutex_rec_init(rt_rec_mutex_t* m);
00117   int rtos_mutex_rec_destroy(rt_rec_mutex_t* m );
00118   int rtos_mutex_lock( rt_mutex_t* m);
00119   int rtos_mutex_trylock( rt_mutex_t* m);
00120   int rtos_mutex_lock_until( rt_rec_mutex_t* m, NANO_TIME abs_time);
00121   int rtos_mutex_unlock( rt_mutex_t* m);
00122   int rtos_mutex_rec_lock( rt_rec_mutex_t* m);
00123   int rtos_mutex_rec_trylock( rt_rec_mutex_t* m);
00124   int rtos_mutex_rec_lock_until( rt_rec_mutex_t* m, NANO_TIME abs_time);
00125   int rtos_mutex_rec_unlock( rt_rec_mutex_t* m);
00126 
00127   // Condition variables must support waiting, timed waiting and broadcasting.
00128   typedef struct cond_struct rt_cond_t;
00129   int rtos_cond_init(rt_cond_t *cond);
00130   int rtos_cond_destroy(rt_cond_t *cond);
00131   int rtos_cond_wait(rt_cond_t *cond, rt_mutex_t *mutex);
00132   int rtos_cond_timedwait(rt_cond_t *cond, rt_mutex_t *mutex, NANO_TIME abs_time);
00133   int rtos_cond_broadcast(rt_cond_t *cond);
00134 
00138         int rtos_printf( const char *fmt, ... );
00139 
00141   void rtos_enable_rt_warning();
00143   void rtos_disable_rt_warning();
00144 
00145 #ifdef __cplusplus
00146 }
00147 #endif
00148 
00149 #endif // ORO_FOSI_INTERFACE_H


rtt
Author(s): RTT Developers
autogenerated on Sat Jun 8 2019 18:46:11