File: rtai_spl.h

package info (click to toggle)
rtai 3.1.0-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 23,560 kB
  • ctags: 19,698
  • sloc: ansic: 88,861; cpp: 31,340; tcl: 14,684; sh: 10,652; xml: 760; yacc: 575; lex: 537; makefile: 394; asm: 310; php: 300; perl: 108
file content (125 lines) | stat: -rw-r--r-- 3,186 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * Copyright (C) 2002,2003 Paolo Mantegazza <mantegazza@aero.polimi.it>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef _RTAI_SPL_H
#define _RTAI_SPL_H

#include <rtai_sem.h>

struct rtai_spl;

#ifdef __KERNEL__

#ifndef __cplusplus

typedef struct rtai_spl {
    void *owndby;
    int count;
    unsigned long flags;
} SPL;

#else /* __cplusplus */
extern "C" {
#endif /* !__cplusplus */

int rt_spl_init(struct rtai_spl *spl);

int rt_spl_delete(struct rtai_spl *spl);

int rt_spl_lock(struct rtai_spl *spl);

int rt_spl_lock_if(struct rtai_spl *spl);

int rt_spl_lock_timed(struct rtai_spl *spl,
		      unsigned long ns);

int rt_spl_unlock(struct rtai_spl *spl);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#else /* !__KERNEL__ */

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

RTAI_PROTO(struct rtai_spl *, rt_spl_init,(unsigned long name))
{
	struct { unsigned long name; } arg = { name };
	return (struct rtai_spl *)rtai_lxrt(BIDX, SIZARG, LXRT_SPL_INIT, &arg).v[LOW];
}

RTAI_PROTO(int, rt_spl_delete,(struct rtai_spl *spl))
{
	struct { struct rtai_spl *spl; } arg = { spl };
	return rtai_lxrt(BIDX, SIZARG, LXRT_SPL_DELETE, &arg).i[LOW];
}

RTAI_PROTO(struct rtai_spl *, rt_named_spl_init,(const char *name))
{
        struct { const char *name; } arg = { name };
       	return (struct rtai_spl *)rtai_lxrt(BIDX, SIZARG, NAMED_SPL_INIT, &arg).v[LOW];
}

RTAI_PROTO(int, rt_named_spl_delete,(struct rtai_spl *spl))
{
	struct { struct rtai_spl *spl; } arg = { spl };
	return rtai_lxrt(BIDX, SIZARG, NAMED_SPL_DELETE, &arg).i[LOW];
}

RTAI_PROTO(int, rt_spl_lock,(struct rtai_spl *spl))
{
	struct { struct rtai_spl *spl; } arg = { spl };
	return rtai_lxrt(BIDX, SIZARG, SPL_LOCK, &arg).i[LOW];
}

RTAI_PROTO(int, rt_spl_lock_if,(struct rtai_spl *spl))
{
	struct { struct rtai_spl *spl; } arg = { spl };
	return rtai_lxrt(BIDX, SIZARG, SPL_LOCK_IF, &arg).i[LOW];
}

RTAI_PROTO(int, rt_spl_lock_timed,(struct rtai_spl *spl, RTIME delay))
{
	struct { struct rtai_spl *spl; RTIME delay; } arg = { spl, delay };
	return rtai_lxrt(BIDX, SIZARG, SPL_LOCK_TIMED, &arg).i[LOW];
}

RTAI_PROTO(int, rt_spl_unlock,(struct rtai_spl *spl))
{
	struct { struct rtai_spl *spl; } arg = { spl };
	return rtai_lxrt(BIDX, SIZARG, SPL_UNLOCK, &arg).i[LOW];
}

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __KERNEL__ */

#if !defined(__KERNEL__) || defined(__cplusplus)

typedef struct rtai_spl {
    int opaque;
} SPL;

#endif /* !__KERNEL__ || __cplusplus */

#endif /* !_RTAI_SPL_H */