rtai_wrappers.h

00001 /*
00002  * Copyright (C) 2004 Philippe Gerum <rpm@xenomai.org>
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef _RTAI_WRAPPERS_H
00020 #define _RTAI_WRAPPERS_H
00021 
00022 #ifdef __KERNEL__
00023 
00024 #include <linux/version.h>
00025 #include <linux/config.h>
00026 #ifndef __cplusplus
00027 #include <linux/module.h>
00028 #endif /* !__cplusplus */
00029 
00030 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
00031 
00032 #define PID_MAX_LIMIT     PID_MAX
00033 #define num_online_cpus() smp_num_cpus
00034 #define mm_remap_page_range(vma,from,to,size,prot) remap_page_range(from,to,size,prot)
00035 #define __user
00036 
00037 #define set_tsk_need_resched(t) do { \
00038     (t)->need_resched = 1; \
00039 } while(0)
00040 
00041 #define clear_tsk_need_resched(t) do { \
00042     (t)->need_resched = 0; \
00043 } while(0)
00044 
00045 #define set_need_resched() set_tsk_need_resched(current)
00046 
00047 #define LIST_POISON1  NULL
00048 #define LIST_POISON2  NULL
00049 
00050 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) || __cplusplus
00051 typedef void irqreturn_t;
00052 #endif  /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) || __cplusplus */
00053 
00054 #define set_tsk_used_fpu(t)  do { \
00055     (t)->flags |= PF_USEDFPU; \
00056 } while(0)
00057 
00058 #define get_tsk_addr_limit(t) ((t)->addr_limit.seg)
00059 
00060 #define task_cpu(t) ((t)->processor)
00061 
00062 #define self_daemonize(name) do { \
00063    strcpy(current->comm,"gatekeeper"); \
00064    daemonize(); \
00065 } while(0)
00066 
00067 #define get_thread_ptr(t)  (t)
00068 
00069 #define RTAI_LINUX_IRQ_HANDLED  /* i.e. "void" return */
00070 
00071 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
00072 
00073 #define mm_remap_page_range(vma,from,to,size,prot) remap_page_range(vma,from,to,size,prot)
00074 
00075 #define set_tsk_used_fpu(t)  do { \
00076     (t)->thread_info->status |= TS_USEDFPU; \
00077 } while(0)
00078 
00079 #define get_tsk_addr_limit(t) ((t)->thread_info->addr_limit.seg)
00080 
00081 #define self_daemonize(name) daemonize(name)
00082 
00083 #define get_thread_ptr(t)  ((t)->thread_info)
00084 
00085 #define RTAI_LINUX_IRQ_HANDLED IRQ_HANDLED
00086 
00087 #ifndef MODULE_LICENSE
00088 #define MODULE_LICENSE(s)       /* For really old 2.4 kernels. */
00089 #endif /* !MODULE_LICENSE */
00090 
00091 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) */
00092 
00093 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,7)
00094 #define CPUMASK_T(name) (name)
00095 #define CPUMASK(name)   (name)
00096 #else /* LINUX_VERSION_CODE > KERNEL_VERSION(2,6,7) */
00097 #define CPUMASK_T(name)  ((cpumask_t){ { name } })
00098 #define CPUMASK(name)    (name.bits[0])
00099 #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,7) */
00100 
00101 #endif /* __KERNEL__ */
00102 
00103 #endif /* !_RTAI_WRAPPERS_H */

Generated on Tue Jan 18 22:53:52 2005 for RTAI API by  doxygen 1.3.9.1