00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00030 #define linux_semaphore semaphore
00031 #endif
00032
00033 #endif
00034
00035 #ifndef __KERNEL__
00036 #include <sys/types.h>
00037 #endif
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;
00049
00050 typedef long long xnstime_t;
00051
00052 struct xnintr;
00053
00054 typedef int (*xnisr_t)(struct xnintr *intr);
00055
00056 #define XN_INFINITE (0)
00057 #define XN_NONBLOCK ((xnticks_t)-1)
00058
00059 #define XN_APERIODIC_TICK 0
00060 #define XN_NO_TICK ((xnticks_t)-1)
00061
00062 #define testbits(flags,mask) ((flags) & (mask))
00063 #define setbits(flags,mask) xnarch_atomic_set_mask(&(flags),mask)
00064 #define clrbits(flags,mask) xnarch_atomic_clear_mask(&(flags),mask)
00065 #define __testbits(flags,mask) testbits(flags,mask)
00066 #define __setbits(flags,mask) do { (flags) |= (mask); } while(0)
00067 #define __clrbits(flags,mask) do { (flags) &= ~(mask); } while(0)
00068
00069 typedef atomic_flags_t xnflags_t;
00070
00071 #ifndef NULL
00072 #define NULL 0
00073 #endif
00074
00075 #define XNOBJECT_NAME_LEN 32
00076
00077 static inline void xnobject_copy_name (char *dst,
00078 const char *src)
00079 {
00080 if (src)
00081 {
00082 const char *rp = src;
00083 char *wp = dst;
00084 do
00085 *wp++ = *rp;
00086 while (*rp && rp++ - src < XNOBJECT_NAME_LEN);
00087 }
00088 else
00089 *dst = '\0';
00090 }
00091
00092 #define minval(a,b) ((a) < (b) ? (a) : (b))
00093 #define maxval(a,b) ((a) > (b) ? (a) : (b))
00094
00095 #if !defined(__KERNEL__) && !defined(BITS_PER_LONG)
00096 #include <stdint.h>
00097 #define BITS_PER_LONG __WORDSIZE
00098 #endif
00099
00100 #ifdef __cplusplus
00101 extern "C" {
00102 #endif
00103
00104 const char *xnpod_fatal_helper(const char *format, ...);
00105
00106 int __fusion_user_init(void);
00107
00108 void __fusion_user_exit(void);
00109
00110 #ifdef __cplusplus
00111 }
00112 #endif
00113
00114 #define xnpod_fatal(format,args...) \
00115 do { \
00116 const char *panic = xnpod_fatal_helper(format,##args); \
00117 xnarch_halt(panic); \
00118 } while (0)
00119
00120 #define root_thread_init __fusion_user_init
00121 #define root_thread_exit __fusion_user_exit
00122
00123 #endif