base/include/rtai_spl.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2002,2003 Paolo Mantegazza <mantegazza@aero.polimi.it>
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_SPL_H
00020 #define _RTAI_SPL_H
00021 
00022 #include <rtai_sem.h>
00023 
00024 struct rtai_spl;
00025 
00026 #ifdef __KERNEL__
00027 
00028 #ifndef __cplusplus
00029 
00030 typedef struct rtai_spl {
00031     void *owndby;
00032     int count;
00033     unsigned long flags;
00034 } SPL;
00035 
00036 #else /* __cplusplus */
00037 extern "C" {
00038 #endif /* !__cplusplus */
00039 
00040 RTAI_SYSCALL_MODE int rt_spl_init(struct rtai_spl *spl);
00041 
00042 RTAI_SYSCALL_MODE int rt_spl_delete(struct rtai_spl *spl);
00043 
00044 RTAI_SYSCALL_MODE SPL *_rt_named_spl_init(unsigned long spl_name);
00045 
00046 RTAI_SYSCALL_MODE int rt_named_spl_delete(SPL *spl);
00047 
00048 RTAI_SYSCALL_MODE int rt_spl_lock(struct rtai_spl *spl);
00049 
00050 RTAI_SYSCALL_MODE int rt_spl_lock_if(struct rtai_spl *spl);
00051 
00052 RTAI_SYSCALL_MODE int rt_spl_lock_timed(struct rtai_spl *spl,
00053               unsigned long ns);
00054 
00055 RTAI_SYSCALL_MODE int rt_spl_unlock(struct rtai_spl *spl);
00056 
00057 #ifdef __cplusplus
00058 }
00059 #endif /* __cplusplus */
00060 
00061 #else /* !__KERNEL__ */
00062 
00063 #ifdef __cplusplus
00064 extern "C" {
00065 #endif /* __cplusplus */
00066 
00067 RTAI_PROTO(struct rtai_spl *, rt_spl_init,(unsigned long name))
00068 {
00069     struct { unsigned long name; } arg = { name };
00070     return (struct rtai_spl *)rtai_lxrt(BIDX, SIZARG, LXRT_SPL_INIT, &arg).v[LOW];
00071 }
00072 
00073 RTAI_PROTO(int, rt_spl_delete,(struct rtai_spl *spl))
00074 {
00075     struct { struct rtai_spl *spl; } arg = { spl };
00076     return rtai_lxrt(BIDX, SIZARG, LXRT_SPL_DELETE, &arg).i[LOW];
00077 }
00078 
00079 RTAI_PROTO(struct rtai_spl *, rt_named_spl_init,(const char *name))
00080 {
00081         struct { const char *name; } arg = { name };
00082         return (struct rtai_spl *)rtai_lxrt(BIDX, SIZARG, NAMED_SPL_INIT, &arg).v[LOW];
00083 }
00084 
00085 RTAI_PROTO(int, rt_named_spl_delete,(struct rtai_spl *spl))
00086 {
00087     struct { struct rtai_spl *spl; } arg = { spl };
00088     return rtai_lxrt(BIDX, SIZARG, NAMED_SPL_DELETE, &arg).i[LOW];
00089 }
00090 
00091 RTAI_PROTO(int, rt_spl_lock,(struct rtai_spl *spl))
00092 {
00093     struct { struct rtai_spl *spl; } arg = { spl };
00094     return rtai_lxrt(BIDX, SIZARG, SPL_LOCK, &arg).i[LOW];
00095 }
00096 
00097 RTAI_PROTO(int, rt_spl_lock_if,(struct rtai_spl *spl))
00098 {
00099     struct { struct rtai_spl *spl; } arg = { spl };
00100     return rtai_lxrt(BIDX, SIZARG, SPL_LOCK_IF, &arg).i[LOW];
00101 }
00102 
00103 RTAI_PROTO(int, rt_spl_lock_timed,(struct rtai_spl *spl, RTIME delay))
00104 {
00105     struct { struct rtai_spl *spl; RTIME delay; } arg = { spl, delay };
00106     return rtai_lxrt(BIDX, SIZARG, SPL_LOCK_TIMED, &arg).i[LOW];
00107 }
00108 
00109 RTAI_PROTO(int, rt_spl_unlock,(struct rtai_spl *spl))
00110 {
00111     struct { struct rtai_spl *spl; } arg = { spl };
00112     return rtai_lxrt(BIDX, SIZARG, SPL_UNLOCK, &arg).i[LOW];
00113 }
00114 
00115 #ifdef __cplusplus
00116 }
00117 #endif /* __cplusplus */
00118 
00119 #endif /* __KERNEL__ */
00120 
00121 #if !defined(__KERNEL__) || defined(__cplusplus)
00122 
00123 typedef struct rtai_spl {
00124     int opaque;
00125 } SPL;
00126 
00127 #endif /* !__KERNEL__ || __cplusplus */
00128 
00129 #endif /* !_RTAI_SPL_H */

Generated on Tue Feb 2 17:46:05 2010 for RTAI API by  doxygen 1.4.7