types.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_TYPES_H
00047 #define _RTAI_NUCLEUS_TYPES_H
00048 
00049 #include <linux/errno.h>
00050 #include <nucleus/asm/system.h>
00051 
00052 typedef int xnsigmask_t;
00053 
00054 typedef unsigned long long xnticks_t;
00055 
00056 typedef long long xnsticks_t;
00057 
00058 typedef unsigned long long xntime_t; /* ns */
00059 
00060 typedef long long xnstime_t;
00061 
00062 #ifdef CONFIG_RTAI_OPT_TIMESTAMPS
00063 typedef struct xntimes {
00064     xnticks_t tick_shot;
00065     xnticks_t tick_delivery;
00066     xnticks_t timer_entry;
00067     xnticks_t timer_handler;
00068     xnticks_t timer_handled;
00069     xnticks_t timer_exit;
00070     xnsticks_t timer_drift;
00071     xnticks_t intr_resched;
00072     xnticks_t resume_entry;
00073     xnticks_t resume_exit;
00074     xnticks_t switch_in;
00075     xnticks_t switch_out;
00076     xnticks_t periodic_wakeup;
00077     xnticks_t periodic_exit;
00078 } xntimes_t;
00079 #endif /* CONFIG_RTAI_OPT_TIMESTAMPS */
00080 
00081 #define XN_INFINITE   (0)
00082 #define XN_NONBLOCK   ((xnticks_t)-1)
00083 
00084 #define testbits(flags,mask) ((flags) & (mask))
00085 #define setbits(flags,mask)  xnarch_atomic_set_mask(&(flags),mask)
00086 #define clrbits(flags,mask)  xnarch_atomic_clear_mask(&(flags),mask)
00087 #define __testbits(flags,mask) testbits(flags,mask)
00088 #define __setbits(flags,mask)  do { (flags) |= (mask); } while(0)
00089 #define __clrbits(flags,mask)  do { (flags) &= ~(mask); } while(0)
00090 
00091 typedef atomic_flags_t xnflags_t;
00092 
00093 #ifndef NULL
00094 #define NULL 0
00095 #endif
00096 
00097 #define XNOBJECT_NAME_LEN 32
00098 
00099 static inline void xnobject_copy_name (char *dst,
00100                                        const char *src)
00101 {
00102     if (src)
00103         {
00104         const char *rp = src;
00105         char *wp = dst;
00106         do
00107             *wp++ = *rp;
00108         while (*rp && rp++ - src < XNOBJECT_NAME_LEN);
00109         }
00110     else
00111         *dst = '\0';
00112 }
00113 
00114 #define minval(a,b) ((a) < (b) ? (a) : (b))
00115 #define maxval(a,b) ((a) > (b) ? (a) : (b))
00116 
00117 #define XN_NBBY 8 /* Assume a byte is always 8 bits :o> */
00118 
00119 #ifdef __cplusplus
00120 extern "C" {
00121 #endif
00122 
00123 const char *xnpod_fatal_helper(const char *format, ...);
00124 
00125 #ifdef __cplusplus
00126 }
00127 #endif
00128 
00129 #define xnpod_fatal(format,args...) \
00130 do { \
00131    const char *panic = xnpod_fatal_helper(format,##args); \
00132    xnarch_halt(panic); \
00133 } while (0)
00134 
00135 #endif /* !_RTAI_NUCLEUS_TYPES_H */

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