types.h

00001 /*
00002  * Copyright (C) 2001,2002,2003 Philippe Gerum <rpm@xenomai.org>.
00003  *
00004  * RTAI/fusion is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published
00006  * by the Free Software Foundation; either version 2 of the License,
00007  * or (at your option) any later version.
00008  *
00009  * RTAI/fusion 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 RTAI/fusion; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017  * 02111-1307, USA.
00018  */
00019 
00020 #ifndef _RTAI_NUCLEUS_TYPES_H
00021 #define _RTAI_NUCLEUS_TYPES_H
00022 
00023 #ifndef __RTAI_SIM__
00024 
00025 #include <linux/config.h>
00026 
00027 #ifdef CONFIG_PREEMPT_RT
00028 #define linux_semaphore compat_semaphore
00029 #else /* CONFIG_PREEMPT_RT */
00030 #define linux_semaphore semaphore
00031 #endif /* !CONFIG_PREEMPT_RT */
00032 
00033 #endif /* __RTAI_SIM__ */
00034 
00035 #ifndef __KERNEL__
00036 #include <sys/types.h>
00037 #endif /* __KERNEL__ */
00038 
00039 #include <linux/errno.h>
00040 #include <nucleus/asm/system.h>
00041 
00042 typedef unsigned long xnsigmask_t;
00043 
00044 typedef unsigned long long xnticks_t;
00045 
00046 typedef long long xnsticks_t;
00047 
00048 typedef unsigned long long xntime_t; /* ns */
00049 
00050 typedef long long xnstime_t;
00051 
00052 struct xnintr;
00053 
00054 typedef int (*xnisr_t)(struct xnintr *intr);
00055 
00056 typedef int (*xniack_t)(unsigned irq);
00057 
00058 #define XN_INFINITE   (0)
00059 #define XN_NONBLOCK   ((xnticks_t)-1)
00060 
00061 #define XN_APERIODIC_TICK  0
00062 #define XN_NO_TICK         ((xnticks_t)-1)
00063 
00064 #define testbits(flags,mask) ((flags) & (mask))
00065 #define setbits(flags,mask)  xnarch_atomic_set_mask(&(flags),mask)
00066 #define clrbits(flags,mask)  xnarch_atomic_clear_mask(&(flags),mask)
00067 #define __testbits(flags,mask) testbits(flags,mask)
00068 #define __setbits(flags,mask)  do { (flags) |= (mask); } while(0)
00069 #define __clrbits(flags,mask)  do { (flags) &= ~(mask); } while(0)
00070 
00071 typedef atomic_flags_t xnflags_t;
00072 
00073 #ifndef NULL
00074 #define NULL 0
00075 #endif
00076 
00077 #define XNOBJECT_NAME_LEN 32
00078 
00079 static inline void xnobject_copy_name (char *dst,
00080                                        const char *src)
00081 {
00082     if (src)
00083         {
00084         const char *rp = src;
00085         char *wp = dst;
00086         do
00087             *wp++ = *rp;
00088         while (*rp && rp++ - src < XNOBJECT_NAME_LEN);
00089         }
00090     else
00091         *dst = '\0';
00092 }
00093 
00094 #define minval(a,b) ((a) < (b) ? (a) : (b))
00095 #define maxval(a,b) ((a) > (b) ? (a) : (b))
00096 
00097 #if !defined(__KERNEL__) && !defined(BITS_PER_LONG)
00098 #include <stdint.h>
00099 #define BITS_PER_LONG __WORDSIZE
00100 #endif /* !__KERNEL__ */
00101 
00102 #ifdef __cplusplus
00103 extern "C" {
00104 #endif
00105 
00106 const char *xnpod_fatal_helper(const char *format, ...);
00107 
00108 int __fusion_user_init(void);
00109 
00110 void __fusion_user_exit(void);
00111 
00112 #ifdef __cplusplus
00113 }
00114 #endif
00115 
00116 #define xnpod_fatal(format,args...) \
00117 do { \
00118    const char *panic = xnpod_fatal_helper(format,##args); \
00119    xnarch_halt(panic); \
00120 } while (0)
00121 
00122 #define root_thread_init __fusion_user_init
00123 #define root_thread_exit __fusion_user_exit
00124 
00125 #endif /* !_RTAI_NUCLEUS_TYPES_H */

Generated on Sat Sep 3 12:32:47 2005 for RTAI Fusion API by  doxygen 1.4.2