base/include/rtai_rwl.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
#ifndef _RTAI_RWL_H
00020
#define _RTAI_RWL_H
00021
00022
#include <rtai_sem.h>
00023
00024
struct rtai_rwlock;
00025
00026
#ifdef __KERNEL__
00027
00028
#ifndef __cplusplus
00029
00030
typedef struct rtai_rwlock {
00031
SEM wrmtx,
00032 wrsem,
00033 rdsem;
00034 }
RWL;
00035
00036
#else
00037
extern "C" {
00038
#endif
00039
00040
int rt_rwl_init(
struct rtai_rwlock *rwl);
00041
00042
int rt_rwl_delete(
struct rtai_rwlock *rwl);
00043
00044
int rt_rwl_rdlock(
struct rtai_rwlock *rwl);
00045
00046
int rt_rwl_rdlock_if(
struct rtai_rwlock *rwl);
00047
00048
int rt_rwl_rdlock_until(
struct rtai_rwlock *rwl,
00049
RTIME time);
00050
00051
int rt_rwl_rdlock_timed(
struct rtai_rwlock *rwl,
00052
RTIME delay);
00053
00054
int rt_rwl_wrlock(
struct rtai_rwlock *rwl);
00055
00056
int rt_rwl_wrlock_if(
struct rtai_rwlock *rwl);
00057
00058
int rt_rwl_wrlock_until(
struct rtai_rwlock *rwl,
00059
RTIME time);
00060
00061
int rt_rwl_wrlock_timed(
struct rtai_rwlock *rwl,
00062
RTIME delay);
00063
00064
int rt_rwl_unlock(
struct rtai_rwlock *rwl);
00065
00066
#ifdef __cplusplus
00067
}
00068
#endif
00069
00070
#else
00071
00072
#ifdef __cplusplus
00073
extern "C" {
00074
#endif
00075
00076 RTAI_PROTO(
struct rtai_rwlock *, rt_rwl_init,(
unsigned long name))
00077 {
00078
struct {
unsigned long name; } arg = { name };
00079
return (
struct rtai_rwlock *)
rtai_lxrt(
BIDX,
SIZARG,
LXRT_RWL_INIT, &arg).
v[
LOW];
00080 }
00081
00082 RTAI_PROTO(
int, rt_rwl_delete,(
struct rtai_rwlock *rwl))
00083 {
00084
struct {
struct rtai_rwlock *rwl; } arg = { rwl };
00085
return rtai_lxrt(
BIDX,
SIZARG,
LXRT_RWL_DELETE, &arg).
i[
LOW];
00086 }
00087
00088 RTAI_PROTO(
struct rtai_rwlock *, rt_named_rwl_init,(
const char *name))
00089 {
00090
struct {
const char *name; } arg = { name };
00091
return (
struct rtai_rwlock *)
rtai_lxrt(
BIDX,
SIZARG,
NAMED_RWL_INIT, &arg).
v[
LOW];
00092 }
00093
00094 RTAI_PROTO(
int, rt_named_rwl_delete,(
struct rtai_rwlock *rwl))
00095 {
00096
struct {
struct rtai_rwlock *rwl; } arg = { rwl };
00097
return rtai_lxrt(
BIDX,
SIZARG,
NAMED_RWL_DELETE, &arg).
i[
LOW];
00098 }
00099
00100 RTAI_PROTO(
int, rt_rwl_rdlock,(
struct rtai_rwlock *rwl))
00101 {
00102
struct {
struct rtai_rwlock *rwl; } arg = { rwl };
00103
return rtai_lxrt(
BIDX,
SIZARG,
RWL_RDLOCK, &arg).
i[
LOW];
00104 }
00105
00106 RTAI_PROTO(
int, rt_rwl_rdlock_if,(
struct rtai_rwlock *rwl))
00107 {
00108
struct {
void *rwl; } arg = { rwl };
00109
return rtai_lxrt(
BIDX,
SIZARG,
RWL_RDLOCK_IF, &arg).
i[
LOW];
00110 }
00111
00112 RTAI_PROTO(
int, rt_rwl_rdlock_until,(
struct rtai_rwlock *rwl,
RTIME time))
00113 {
00114
struct {
struct rtai_rwlock *rwl;
RTIME time; } arg = { rwl, time };
00115
return rtai_lxrt(
BIDX,
SIZARG,
RWL_RDLOCK_UNTIL, &arg).
i[
LOW];
00116 }
00117
00118 RTAI_PROTO(
int, rt_rwl_rdlock_timed,(
struct rtai_rwlock *rwl,
RTIME delay))
00119 {
00120
struct {
struct rtai_rwlock *rwl;
RTIME delay; } arg = { rwl, delay };
00121
return rtai_lxrt(
BIDX,
SIZARG,
RWL_RDLOCK_TIMED, &arg).
i[
LOW];
00122 }
00123
00124 RTAI_PROTO(
int, rt_rwl_wrlock,(
struct rtai_rwlock *rwl))
00125 {
00126
struct {
struct rtai_rwlock *rwl; } arg = { rwl };
00127
return rtai_lxrt(
BIDX,
SIZARG,
RWL_WRLOCK, &arg).
i[
LOW];
00128 }
00129
00130 RTAI_PROTO(
int, rt_rwl_wrlock_if,(
struct rtai_rwlock *rwl))
00131 {
00132
struct {
struct rtai_rwlock *rwl; } arg = { rwl };
00133
return rtai_lxrt(
BIDX,
SIZARG,
RWL_WRLOCK_IF, &arg).
i[
LOW];
00134 }
00135
00136 RTAI_PROTO(
int, rt_rwl_wrlock_until,(
struct rtai_rwlock *rwl,
RTIME time))
00137 {
00138
struct {
struct rtai_rwlock *rwl;
RTIME time; } arg = { rwl, time };
00139
return rtai_lxrt(
BIDX,
SIZARG,
RWL_WRLOCK_UNTIL, &arg).
i[
LOW];
00140 }
00141
00142 RTAI_PROTO(
int, rt_rwl_wrlock_timed,(
struct rtai_rwlock *rwl,
RTIME delay))
00143 {
00144
struct {
struct rtai_rwlock *rwl;
RTIME delay; } arg = { rwl, delay };
00145
return rtai_lxrt(
BIDX,
SIZARG,
RWL_WRLOCK_TIMED, &arg).
i[
LOW];
00146 }
00147
00148 RTAI_PROTO(
int, rt_rwl_unlock,(
struct rtai_rwlock *rwl))
00149 {
00150
struct {
struct rtai_rwlock *rwl; } arg = { rwl };
00151
return rtai_lxrt(
BIDX,
SIZARG,
RWL_UNLOCK, &arg).
i[
LOW];
00152 }
00153
00154
#ifdef __cplusplus
00155
}
00156
#endif
00157
00158
#endif
00159
00160
#if !defined(__KERNEL__) || defined(__cplusplus)
00161
00162 typedef struct rtai_rwlock {
00163 int opaque;
00164 }
RWL;
00165
00166
#endif
00167
00168
#endif
Generated on Thu Nov 20 11:49:50 2008 for RTAI API by
1.3.8