Xenomai  3.0.8
timer.h
1 /*
2  * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 #ifndef _COBALT_POSIX_TIMER_H
19 #define _COBALT_POSIX_TIMER_H
20 
21 #include <linux/types.h>
22 #include <linux/time.h>
23 #include <linux/list.h>
24 #include <cobalt/kernel/timer.h>
25 #include <xenomai/posix/signal.h>
26 #include <xenomai/posix/syscall.h>
27 
28 struct cobalt_timer {
29  struct xntimer timerbase;
30  timer_t id;
31  int overruns;
32  clockid_t clockid;
33  pid_t target;
34  struct cobalt_sigpending sigp;
35  struct cobalt_extref extref;
36 };
37 
38 int cobalt_timer_deliver(timer_t timerid);
39 
40 void cobalt_timer_reclaim(struct cobalt_process *p);
41 
42 static inline timer_t cobalt_timer_id(const struct cobalt_timer *timer)
43 {
44  return timer->id;
45 }
46 
47 struct cobalt_timer *
48 cobalt_timer_by_id(struct cobalt_process *p, timer_t timer_id);
49 
50 void cobalt_timer_handler(struct xntimer *xntimer);
51 
52 void __cobalt_timer_getval(struct xntimer *__restrict__ timer,
53  struct itimerspec *__restrict__ value);
54 
55 int __cobalt_timer_setval(struct xntimer *__restrict__ timer, int clock_flag,
56  const struct itimerspec *__restrict__ value);
57 
58 int __cobalt_timer_create(clockid_t clock,
59  const struct sigevent *sev,
60  timer_t __user *u_tm);
61 
62 int __cobalt_timer_settime(timer_t timerid, int flags,
63  const struct itimerspec *__restrict__ value,
64  struct itimerspec *__restrict__ ovalue);
65 
66 int __cobalt_timer_gettime(timer_t timerid, struct itimerspec *value);
67 
68 COBALT_SYSCALL_DECL(timer_create,
69  (clockid_t clock,
70  const struct sigevent __user *u_sev,
71  timer_t __user *u_tm));
72 
73 COBALT_SYSCALL_DECL(timer_delete, (timer_t tm));
74 
75 COBALT_SYSCALL_DECL(timer_settime,
76  (timer_t tm, int flags,
77  const struct itimerspec __user *u_newval,
78  struct itimerspec __user *u_oldval));
79 
80 COBALT_SYSCALL_DECL(timer_gettime,
81  (timer_t tm, struct itimerspec __user *u_val));
82 
83 COBALT_SYSCALL_DECL(timer_getoverrun, (timer_t tm));
84 
85 #endif /* !_COBALT_POSIX_TIMER_H */
int timer_create(clockid_t clockid, const struct sigevent *__restrict__ evp, timer_t *__restrict__ timerid)
Create a timer.
Definition: timer.c:74
int timer_gettime(timer_t timerid, struct itimerspec *value)
Get timer next expiration date and reload value.
Definition: timer.c:208
int timer_delete(timer_t timerid)
Delete a timer object.
Definition: timer.c:105
int timer_getoverrun(timer_t timerid)
Get expiration overruns count since the most recent timer expiration signal delivery.
Definition: timer.c:242
int timer_settime(timer_t timerid, int flags, const struct itimerspec *__restrict__ value, struct itimerspec *__restrict__ ovalue)
Start or stop a timer.
Definition: timer.c:165