18 #ifndef _XENOMAI_ALCHEMY_TIMER_H
19 #define _XENOMAI_ALCHEMY_TIMER_H
22 #include <copperplate/clockobj.h>
29 typedef ticks_t RTIME;
31 typedef sticks_t SRTIME;
35 #define TM_NONBLOCK ((RTIME)-1ULL)
58 extern struct clockobj alchemy_clock;
60 #define alchemy_abs_timeout(__t, __ts) \
62 (__t) == TM_INFINITE ? NULL : \
63 (__t) == TM_NONBLOCK ? \
64 ({ (__ts)->tv_sec = (__ts)->tv_nsec = 0; (__ts); }) : \
65 ({ clockobj_ticks_to_timespec(&alchemy_clock, (__t), (__ts)); \
69 #define alchemy_rel_timeout(__t, __ts) \
71 (__t) == TM_INFINITE ? NULL : \
72 (__t) == TM_NONBLOCK ? \
73 ({ (__ts)->tv_sec = (__ts)->tv_nsec = 0; (__ts); }) : \
74 ({ clockobj_ticks_to_timeout(&alchemy_clock, (__t), (__ts)); \
79 int alchemy_poll_mode(
const struct timespec *abs_timeout)
82 abs_timeout->tv_sec == 0 &&
83 abs_timeout->tv_nsec == 0;
106 return clockobj_get_time(&alchemy_clock);
void rt_timer_inquire(RT_TIMER_INFO *info)
Inquire about the Alchemy clock.
Definition: timer.c:88
void rt_timer_spin(RTIME ns)
Busy wait burning CPU cycles.
Definition: timer.c:108
static RTIME rt_timer_read(void)
Return the current system time.
Definition: timer.h:104
SRTIME rt_timer_ticks2ns(SRTIME ticks)
Convert Alchemy clock ticks to nanoseconds.
Definition: timer.c:72
SRTIME rt_timer_ns2ticks(SRTIME ns)
Convert nanoseconds to Alchemy clock ticks.
Definition: timer.c:50
struct rt_timer_info RT_TIMER_INFO
Timer status descriptor .
Timer status descriptor .
Definition: timer.h:44
RTIME period
Clock resolution in nanoseconds.
Definition: timer.h:48
RTIME date
Current monotonic date expressed in clock ticks.
Definition: timer.h:55