fusion.h

00001 /*
00002  * Copyright (C) 2001,2002,2003 Philippe Gerum <rpm@xenomai.org>.
00003  *
00004  * Xenomai is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * Xenomai is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with Xenomai; if not, write to the Free Software Foundation,
00016  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  *
00018  * As a special exception, the RTAI project gives permission
00019  * for additional uses of the text contained in its release of
00020  * Xenomai.
00021  *
00022  * The exception is that, if you link the Xenomai libraries with other
00023  * files to produce an executable, this does not by itself cause the
00024  * resulting executable to be covered by the GNU General Public License.
00025  * Your use of that executable is in no way restricted on account of
00026  * linking the Xenomai libraries code into it.
00027  *
00028  * This exception does not however invalidate any other reasons why
00029  * the executable file might be covered by the GNU General Public
00030  * License.
00031  *
00032  * This exception applies only to the code released by the
00033  * RTAI project under the name Xenomai.  If you copy code from other
00034  * RTAI project releases into a copy of Xenomai, as the General Public
00035  * License permits, the exception does not apply to the code that you
00036  * add in this way.  To avoid misleading anyone as to the status of
00037  * such modified files, you must delete this exception notice from
00038  * them.
00039  *
00040  * If you write modifications of your own for Xenomai, it is your
00041  * choice whether to permit this exception to apply to your
00042  * modifications. If you do not wish that, delete this exception
00043  * notice.
00044  */
00045 
00046 #ifndef _RTAI_NUCLEUS_FUSION_H
00047 #define _RTAI_NUCLEUS_FUSION_H
00048 
00049 #define FUSION_SKIN_MAGIC    0x504f5358
00050 
00051 /* Thread priority levels. */
00052 #define FUSION_LOW_PRIO     1
00053 #define FUSION_HIGH_PRIO    99
00054 /* Extra level for IRQ servers in user-space. */
00055 #define FUSION_IRQ_PRIO     (FUSION_HIGH_PRIO + 1)
00056 
00057 #define FUSION_MIN_PRIO     FUSION_LOW_PRIO
00058 #define FUSION_MAX_PRIO     FUSION_IRQ_PRIO
00059 
00060 #ifndef __RTAI_SIM__
00061 
00062 #include <nucleus/asm/syscall.h>
00063 
00064 #define FUSION_APERIODIC_TIMER 0
00065 
00066 #define FUSION_LINUX_DOMAIN    0
00067 #define FUSION_RTAI_DOMAIN     1
00068 
00069 #define __xn_fusion_init         0
00070 #define __xn_fusion_create       1
00071 #define __xn_fusion_start        2
00072 #define __xn_fusion_set_periodic 3
00073 #define __xn_fusion_wait_period  4
00074 #define __xn_fusion_time         5
00075 #define __xn_fusion_cputime      6
00076 #define __xn_fusion_start_timer  7
00077 #define __xn_fusion_stop_timer   8
00078 #define __xn_fusion_sleep        9
00079 #define __xn_fusion_ns2ticks     10
00080 #define __xn_fusion_ticks2ns     11
00081 #define __xn_fusion_inquire      12
00082 #define __xn_fusion_idle         13
00083 #define __xn_fusion_cancel       14
00084 #define __xn_fusion_activate     15
00085 #define __xn_fusion_hold         16
00086 #define __xn_fusion_release      17
00087 
00088 typedef unsigned long long nanotime_t;
00089 
00090 typedef long long nanostime_t;
00091 
00092 #ifdef __cplusplus
00093 extern "C" {
00094 #endif /* __cplusplus */
00095 
00096 #ifdef __KERNEL__
00097 
00098 int xnfusion_mount(void);
00099 
00100 int xnfusion_umount(void);
00101 
00102 int xnfusion_attach(void);
00103 
00104 #else /* !__KERNEL__ */
00105 
00106 #include <sys/types.h>
00107 #include <pthread.h>
00108 
00109     /* Public RTAI/fusion interface. */
00110 
00111 int pthread_info_rt(xnsysinfo_t *infop);
00112 
00113 int pthread_init_rt(const char *name,
00114                     void *uhandle,
00115                     void **khandlep);
00116 
00117 int pthread_create_rt(const char *name,
00118                       void *uhandle,
00119                       pid_t syncpid,
00120                       int *syncp,
00121                       void **khandlep);
00122 
00123 int pthread_barrier_rt(void);
00124 
00125 int pthread_start_rt(void *khandle);
00126 
00127 int pthread_sync_rt(int *syncp);
00128 
00129 int pthread_migrate_rt(int domain);
00130 
00131 int pthread_start_timer_rt(nanotime_t nstick);
00132 
00133 int pthread_stop_timer_rt(void);
00134 
00135 int pthread_time_rt(nanotime_t *tp);
00136 
00137 int pthread_cputime_rt(nanotime_t *tp);
00138 
00139 int pthread_ns2ticks_rt(nanostime_t ns,
00140                         nanostime_t *pticks);
00141 
00142 int pthread_ticks2ns_rt(nanostime_t ticks,
00143                         nanostime_t *pns);
00144 
00145 int pthread_ns2tsc_rt(nanostime_t ns,
00146                       nanostime_t *ptsc);
00147 
00148 int pthread_tsc2ns_rt(nanostime_t tsc,
00149                       nanostime_t *pns);
00150 
00151 int pthread_sleep_rt(nanotime_t ticks);
00152 
00153 int pthread_inquire_rt(xninquiry_t *infop);
00154 
00155 int pthread_set_periodic_rt(nanotime_t idate,
00156                             nanotime_t period);
00157 
00158 int pthread_wait_period_rt(void);
00159 
00160     /* The following routines are private to the RTAI/vm control layer
00161        based on the RTAI/fusion interface. Do not use them in
00162        applications. */
00163 
00164 int __pthread_idle_vm(int *lockp);
00165 
00166 int __pthread_cancel_vm(void *deadhandle,
00167                         void *nexthandle);
00168 
00169 int __pthread_activate_vm(void *nexthandle,
00170                           void *prevhandle);
00171 
00172 int __pthread_hold_vm(int *pendp);
00173 
00174 int __pthread_release_vm(int *lockp);
00175 
00176 #endif /* __KERNEL__ */
00177 
00178 #ifdef __cplusplus
00179 };
00180 #endif /* __cplusplus */
00181 
00182 #endif /* !__RTAI_SIM__ */
00183 
00184 #endif /* !_RTAI_NUCLEUS_FUSION_H */

Generated on Mon Dec 13 09:49:49 2004 for RTAI API by  doxygen 1.3.9.1