Xenomai API
2.6.3
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
timer.h
Go to the documentation of this file.
1
29
#ifndef _XENO_TIMER_H
30
#define _XENO_TIMER_H
31
32
#include <
native/types.h
>
33
34
#define TM_ONESHOT XN_APERIODIC_TICK
35
40
typedef
struct
rt_timer_info
{
41
42
RTIME period;
/* !< Current status (unset, aperiodic, period). */
43
RTIME date;
/* !< Current wallclock time. */
44
RTIME tsc;
/* !< Current tsc count. */
45
46
}
RT_TIMER_INFO
;
47
48
#if defined(__KERNEL__) || defined(__XENO_SIM__)
49
50
#include <
nucleus/timer.h
>
51
#ifdef __KERNEL__
52
#include <asm-generic/xenomai/timeconv.h>
53
#endif
54
55
extern
xntbase_t *__native_tbase;
56
57
#endif
/* __KERNEL__ || __XENO_SIM__ */
58
59
#ifdef __cplusplus
60
extern
"C"
{
61
#endif
62
63
#if (defined(__KERNEL__) || defined(__XENO_SIM__)) && !defined(DOXYGEN_CPP)
64
static
inline
SRTIME
rt_timer_ns2tsc
(SRTIME ns)
65
{
66
return
xnarch_ns_to_tsc(ns);
67
}
68
69
static
inline
SRTIME
rt_timer_tsc2ns
(SRTIME ticks)
70
{
71
return
xnarch_tsc_to_ns(ticks);
72
}
73
74
static
inline
RTIME
rt_timer_tsc
(
void
)
75
{
76
return
xnarch_get_cpu_tsc();
77
}
78
79
static
inline
RTIME
rt_timer_read
(
void
)
80
{
81
return
xntbase_get_time
(__native_tbase);
82
}
83
84
static
inline
SRTIME
rt_timer_ns2ticks
(SRTIME ns)
85
{
86
return
xntbase_ns2ticks(__native_tbase, ns);
87
}
88
89
static
inline
SRTIME
rt_timer_ticks2ns
(SRTIME ticks)
90
{
91
return
xntbase_ticks2ns(__native_tbase, ticks);
92
}
93
94
#else
/* !(__KERNEL__ || __XENO_SIM__) */
95
119
SRTIME
rt_timer_ns2tsc
(SRTIME ns);
120
144
SRTIME
rt_timer_tsc2ns
(SRTIME ticks);
145
167
RTIME
rt_timer_tsc
(
void
);
168
193
RTIME
rt_timer_read
(
void
);
194
218
SRTIME
rt_timer_ns2ticks
(SRTIME ns);
219
243
SRTIME
rt_timer_ticks2ns
(SRTIME ticks);
244
245
#endif
/* !(__KERNEL__ || __XENO_SIM__) */
246
247
int
rt_timer_inquire
(
RT_TIMER_INFO
*info);
248
249
RTIME
rt_timer_read
(
void
);
250
251
void
rt_timer_spin
(RTIME ns);
252
253
int
rt_timer_set_mode
(RTIME nstick);
254
255
#ifdef __cplusplus
256
}
257
#endif
258
261
#endif
/* !_XENO_TIMER_H */
include
native
timer.h
Generated on Fri Oct 4 2013 22:39:06 for Xenomai API by
1.8.1.2