rtai-core/include/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 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) || __cplusplus
00048 typedef void irqreturn_t;
00049 #endif  /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) || __cplusplus */
00050 
00051 #define set_tsk_used_fpu(t)  do { \
00052     (t)->flags |= PF_USEDFPU; \
00053 } while(0)
00054 
00055 #define get_tsk_addr_limit(t) ((t)->addr_limit.seg)
00056 
00057 #define task_cpu(t) ((t)->processor)
00058 
00059 #define self_daemonize(name) do { \
00060    strcpy(current->comm,"gatekeeper"); \
00061    daemonize(); \
00062 } while(0)
00063 
00064 #define get_thread_ptr(t)  (t)
00065 
00066 #define RTAI_LINUX_IRQ_HANDLED  /* i.e. "void" return */
00067 
00068 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
00069 
00070 #define mm_remap_page_range(vma,from,to,size,prot) remap_page_range(vma,from,to,size,prot)
00071 
00072 #define set_tsk_used_fpu(t)  do { \
00073     (t)->thread_info->status |= TS_USEDFPU; \
00074 } while(0)
00075 
00076 #define get_tsk_addr_limit(t) ((t)->thread_info->addr_limit.seg)
00077 
00078 #define self_daemonize(name) daemonize(name)
00079 
00080 #define get_thread_ptr(t)  ((t)->thread_info)
00081 
00082 #define RTAI_LINUX_IRQ_HANDLED IRQ_HANDLED
00083 
00084 #ifndef MODULE_LICENSE
00085 #define MODULE_LICENSE(s)       /* For really old 2.4 kernels. */
00086 #endif /* !MODULE_LICENSE */
00087 
00088 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) */
00089 
00090 #endif /* __KERNEL__ */
00091 
00092 #endif /* !_RTAI_WRAPPERS_H */

Generated on Sat Jul 24 19:36:04 2004 for RTAI API by doxygen 1.3.4