00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _XENO_NUCLEUS_TYPES_H
00021 #define _XENO_NUCLEUS_TYPES_H
00022
00023 #ifdef __KERNEL__
00024 #include <linux/errno.h>
00025 #ifdef CONFIG_PREEMPT_RT
00026 #define linux_semaphore compat_semaphore
00027 #else
00028 #define linux_semaphore semaphore
00029 #endif
00030 #else
00031 #include <sys/types.h>
00032 #include <errno.h>
00033 #ifndef BITS_PER_LONG
00034 #include <stdint.h>
00035 #define BITS_PER_LONG __WORDSIZE
00036 #endif
00037 #endif
00038
00039 #include <asm/xenomai/system.h>
00040 #include <nucleus/compiler.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 typedef unsigned long xnhandle_t;
00053
00054 #define XN_NO_HANDLE ((xnhandle_t)0)
00055
00056 struct xnintr;
00057
00058 typedef int (*xnisr_t)(struct xnintr *intr);
00059
00060 typedef int (*xniack_t)(unsigned irq);
00061
00062 #define XN_INFINITE (0)
00063 #define XN_NONBLOCK ((xnticks_t)-1)
00064
00065 #define XN_APERIODIC_TICK 0
00066 #define XN_NO_TICK ((xnticks_t)-1)
00067
00068 #define testbits(flags,mask) ((flags) & (mask))
00069 #define setbits(flags,mask) xnarch_atomic_set_mask(&(flags),mask)
00070 #define clrbits(flags,mask) xnarch_atomic_clear_mask(&(flags),mask)
00071 #define __testbits(flags,mask) testbits(flags,mask)
00072 #define __setbits(flags,mask) do { (flags) |= (mask); } while(0)
00073 #define __clrbits(flags,mask) do { (flags) &= ~(mask); } while(0)
00074
00075 typedef atomic_flags_t xnflags_t;
00076
00077 #ifndef NULL
00078 #define NULL 0
00079 #endif
00080
00081 #define XNOBJECT_NAME_LEN 32
00082
00083 static inline void xnobject_copy_name(char *dst, const char *src)
00084 {
00085 if (src)
00086 strncpy(dst, src, XNOBJECT_NAME_LEN);
00087 else
00088 *dst = '\0';
00089 }
00090
00091 #define xnobject_create_name(dst, n, obj) \
00092 snprintf(dst, n, "%p", obj)
00093
00094 #define minval(a,b) ((a) < (b) ? (a) : (b))
00095 #define maxval(a,b) ((a) > (b) ? (a) : (b))
00096
00097 #ifdef __cplusplus
00098 extern "C" {
00099 #endif
00100
00101 const char *xnpod_fatal_helper(const char *format, ...);
00102
00103 int __xeno_user_init(void);
00104
00105 void __xeno_user_exit(void);
00106
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110
00111 #define xnprintf(fmt,args...) xnarch_printf(fmt , ##args)
00112 #define xnloginfo(fmt,args...) xnarch_loginfo(fmt , ##args)
00113 #define xnlogwarn(fmt,args...) xnarch_logwarn(fmt , ##args)
00114 #define xnlogerr(fmt,args...) xnarch_logerr(fmt , ##args)
00115
00116 #define xnpod_fatal(format,args...) \
00117 do { \
00118 const char *panic; \
00119 xnarch_trace_panic_freeze(); \
00120 panic = xnpod_fatal_helper(format,##args); \
00121 xnarch_halt(panic); \
00122 } while (0)
00123
00124 #ifdef __XENO_SIM__
00125 #define SKIN_INIT(name) __xeno_skin_init(void)
00126 #define SKIN_EXIT(name) __xeno_skin_exit(void)
00127 #else
00128 #define SKIN_INIT(name) __ ## name ## _skin_init(void)
00129 #define SKIN_EXIT(name) __ ## name ## _skin_exit(void)
00130 #endif
00131
00132 #define root_thread_init __xeno_user_init
00133 #define root_thread_exit __xeno_user_exit
00134
00135 #endif