Xenomai  3.1
alarm.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_ALARM_H
19 #define _XENOMAI_ALCHEMY_ALARM_H
20 
21 #include <stdint.h>
22 #include <alchemy/timer.h>
23 #include <alchemy/compat.h>
24 
30 struct RT_ALARM {
31  uintptr_t handle;
32 };
33 
34 typedef struct RT_ALARM RT_ALARM;
35 
43 struct RT_ALARM_INFO {
47  unsigned long expiries;
51  char name[XNOBJECT_NAME_LEN];
55  int active;
56 };
57 
58 typedef struct RT_ALARM_INFO RT_ALARM_INFO;
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 CURRENT_DECL(int, rt_alarm_create(RT_ALARM *alarm,
65  const char *name,
66  void (*handler)(void *arg),
67  void *arg));
68 
69 CURRENT_DECL(int, rt_alarm_delete(RT_ALARM *alarm));
70 
71 int rt_alarm_start(RT_ALARM *alarm,
72  RTIME value,
73  RTIME interval);
74 
75 int rt_alarm_stop(RT_ALARM *alarm);
76 
77 int rt_alarm_inquire(RT_ALARM *alarm,
78  RT_ALARM_INFO *info);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
86 #endif /* _XENOMAI_ALCHEMY_ALARM_H */
int rt_alarm_inquire(RT_ALARM *alarm, RT_ALARM_INFO *info)
Query alarm status.
Definition: alarm.c:392
int rt_alarm_stop(RT_ALARM *alarm)
Stop an alarm.
Definition: alarm.c:352
unsigned long expiries
Number of past expiries.
Definition: alarm.h:47
Alarm status descriptor.
Definition: alarm.h:43
int rt_alarm_start(RT_ALARM *alarm, RTIME value, RTIME interval)
Start an alarm.
Definition: alarm.c:313
char name[XNOBJECT_NAME_LEN]
Name of alarm object.
Definition: alarm.h:51
int rt_alarm_create(RT_ALARM *alarm, const char *name, void(*handler)(void *arg), void *arg)
Create an alarm object.
Definition: alarm.c:173
int active
Active flag.
Definition: alarm.h:55
int rt_alarm_delete(RT_ALARM *alarm)
Delete an alarm.
Definition: alarm.c:250