rtai-core/include/rtai_spl.h

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 int rt_spl_init(struct rtai_spl *spl);
00041 
00042 int rt_spl_delete(struct rtai_spl *spl);
00043 
00044 int rt_spl_lock(struct rtai_spl *spl);
00045 
00046 int rt_spl_lock_if(struct rtai_spl *spl);
00047 
00048 int rt_spl_lock_timed(struct rtai_spl *spl,
00049                       unsigned long ns);
00050 
00051 int rt_spl_unlock(struct rtai_spl *spl);
00052 
00053 #ifdef __cplusplus
00054 }
00055 #endif /* __cplusplus */
00056 
00057 #else /* !__KERNEL__ */
00058 
00059 #ifdef __cplusplus
00060 extern "C" {
00061 #endif /* __cplusplus */
00062 
00063 RTAI_PROTO(struct rtai_spl *, rt_spl_init,(unsigned long name))
00064 {
00065         struct { unsigned long name; } arg = { name };
00066         return (struct rtai_spl *)rtai_lxrt(BIDX, SIZARG, LXRT_SPL_INIT, &arg).v[LOW];
00067 }
00068 
00069 RTAI_PROTO(int, rt_spl_delete,(struct rtai_spl *spl))
00070 {
00071         struct { struct rtai_spl *spl; } arg = { spl };
00072         return rtai_lxrt(BIDX, SIZARG, LXRT_SPL_DELETE, &arg).i[LOW];
00073 }
00074 
00075 RTAI_PROTO(struct rtai_spl *, rt_named_spl_init,(const char *name))
00076 {
00077         struct { const char *name; } arg = { name };
00078         return (struct rtai_spl *)rtai_lxrt(BIDX, SIZARG, NAMED_SPL_INIT, &arg).v[LOW];
00079 }
00080 
00081 RTAI_PROTO(int, rt_named_spl_delete,(struct rtai_spl *spl))
00082 {
00083         struct { struct rtai_spl *spl; } arg = { spl };
00084         return rtai_lxrt(BIDX, SIZARG, NAMED_SPL_DELETE, &arg).i[LOW];
00085 }
00086 
00087 RTAI_PROTO(int, rt_spl_lock,(struct rtai_spl *spl))
00088 {
00089         struct { struct rtai_spl *spl; } arg = { spl };
00090         return rtai_lxrt(BIDX, SIZARG, SPL_LOCK, &arg).i[LOW];
00091 }
00092 
00093 RTAI_PROTO(int, rt_spl_lock_if,(struct rtai_spl *spl))
00094 {
00095         struct { struct rtai_spl *spl; } arg = { spl };
00096         return rtai_lxrt(BIDX, SIZARG, SPL_LOCK_IF, &arg).i[LOW];
00097 }
00098 
00099 RTAI_PROTO(int, rt_spl_lock_timed,(struct rtai_spl *spl, RTIME delay))
00100 {
00101         struct { struct rtai_spl *spl; RTIME delay; } arg = { spl, delay };
00102         return rtai_lxrt(BIDX, SIZARG, SPL_LOCK_TIMED, &arg).i[LOW];
00103 }
00104 
00105 RTAI_PROTO(int, rt_spl_unlock,(struct rtai_spl *spl))
00106 {
00107         struct { struct rtai_spl *spl; } arg = { spl };
00108         return rtai_lxrt(BIDX, SIZARG, SPL_UNLOCK, &arg).i[LOW];
00109 }
00110 
00111 #ifdef __cplusplus
00112 }
00113 #endif /* __cplusplus */
00114 
00115 #endif /* __KERNEL__ */
00116 
00117 #if !defined(__KERNEL__) || defined(__cplusplus)
00118 
00119 typedef struct rtai_spl {
00120     int opaque;
00121 } SPL;
00122 
00123 #endif /* !__KERNEL__ || __cplusplus */
00124 
00125 #endif /* !_RTAI_SPL_H */

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