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 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
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