Xenomai 3.3.2
Loading...
Searching...
No Matches
event.h
1/*
2 * Copyright (C) 2011 Philippe Gerum <rpm@xenomai.org>.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
18#ifndef _XENOMAI_ALCHEMY_EVENT_H
19#define _XENOMAI_ALCHEMY_EVENT_H
20
21#include <stdint.h>
22#include <alchemy/timer.h>
23#include <alchemy/compat.h>
24
31#define EV_PRIO 0x1 /* Pend by task priority order. */
32#define EV_FIFO 0x0 /* Pend by FIFO order. */
33
35#define EV_ANY 0x1 /* Disjunctive wait. */
36#define EV_ALL 0x0 /* Conjunctive wait. */
37
38struct RT_EVENT {
39 uintptr_t handle;
40};
41
42typedef struct RT_EVENT RT_EVENT;
43
55 unsigned int value;
63 char name[XNOBJECT_NAME_LEN];
64};
65
66typedef struct RT_EVENT_INFO RT_EVENT_INFO;
67
68#ifdef __cplusplus
69extern "C" {
70#endif
71
72CURRENT_DECL(int, rt_event_create(RT_EVENT *event,
73 const char *name,
74 unsigned int ivalue,
75 int mode));
76
77int rt_event_delete(RT_EVENT *event);
78
79CURRENT_DECL(int, rt_event_signal(RT_EVENT *event,
80 unsigned int mask));
81
82int rt_event_wait_timed(RT_EVENT *event,
83 unsigned int mask,
84 unsigned int *mask_r,
85 int mode,
86 const struct timespec *abs_timeout);
87
88#ifndef __XENO_COMPAT__
89
90static inline
91int rt_event_wait_until(RT_EVENT *event,
92 unsigned int mask, unsigned int *mask_r,
93 int mode, RTIME timeout)
94{
95 struct timespec ts;
96 return rt_event_wait_timed(event, mask, mask_r, mode,
97 alchemy_abs_timeout(timeout, &ts));
98}
99
100static inline
101int rt_event_wait(RT_EVENT *event,
102 unsigned int mask, unsigned int *mask_r,
103 int mode, RTIME timeout)
104{
105 struct timespec ts;
106 return rt_event_wait_timed(event, mask, mask_r, mode,
107 alchemy_rel_timeout(timeout, &ts));
108}
109
110#endif /* !__XENO_COMPAT__ */
111
112CURRENT_DECL(int, rt_event_clear(RT_EVENT *event,
113 unsigned int mask,
114 unsigned int *mask_r));
115
116int rt_event_inquire(RT_EVENT *event,
117 RT_EVENT_INFO *info);
118
119int rt_event_bind(RT_EVENT *event,
120 const char *name, RTIME timeout);
121
122int rt_event_unbind(RT_EVENT *event);
123
124#ifdef __cplusplus
125}
126#endif
127
130#endif /* _XENOMAI_ALCHEMY_EVENT_H */
static int rt_event_wait(RT_EVENT *event, unsigned int mask, unsigned int *mask_r, int mode, RTIME timeout)
Wait for an arbitrary set of events (with relative scalar timeout).
Definition event.h:101
int rt_event_wait_timed(RT_EVENT *event, unsigned int mask, unsigned int *mask_r, int mode, const struct timespec *abs_timeout)
Wait for an arbitrary set of events.
Definition event.c:386
int rt_event_bind(RT_EVENT *event, const char *name, RTIME timeout)
Bind to an event flag group.
Definition event.c:594
int rt_event_create(RT_EVENT *event, const char *name, unsigned int ivalue, int mode)
Create an event flag group.
Definition event.c:172
static int rt_event_wait_until(RT_EVENT *event, unsigned int mask, unsigned int *mask_r, int mode, RTIME timeout)
Wait for an arbitrary set of events (with absolute scalar timeout).
Definition event.h:91
int rt_event_clear(RT_EVENT *event, unsigned int mask, unsigned int *mask_r)
Clear event flags.
Definition event.c:485
int rt_event_signal(RT_EVENT *event, unsigned int mask)
Signal an event.
Definition event.c:440
int rt_event_delete(RT_EVENT *event)
Delete an event flag group.
Definition event.c:248
int rt_event_inquire(RT_EVENT *event, RT_EVENT_INFO *info)
Query event flag group status.
Definition event.c:525
int rt_event_unbind(RT_EVENT *event)
Unbind from an event flag group.
Definition event.c:616
Event status descriptor .
Definition event.h:51
char name[XNOBJECT_NAME_LEN]
Name of event flag group.
Definition event.h:63
unsigned int value
Current value of the event flag group.
Definition event.h:55
int nwaiters
Number of tasks currently waiting for events.
Definition event.h:59