59 #ifdef RTIMER_CONF_CLOCK_SIZE 60 #define RTIMER_CLOCK_SIZE RTIMER_CONF_CLOCK_SIZE 63 #define RTIMER_CLOCK_SIZE 4 66 #if RTIMER_CLOCK_SIZE == 2 68 typedef uint16_t rtimer_clock_t;
69 #define RTIMER_CLOCK_DIFF(a,b) ((int16_t)((a)-(b))) 71 #elif RTIMER_CLOCK_SIZE == 4 73 typedef uint32_t rtimer_clock_t;
74 #define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b))) 76 #elif RTIMER_CLOCK_SIZE == 8 78 typedef uint64_t rtimer_clock_t;
79 #define RTIMER_CLOCK_DIFF(a,b) ((int64_t)((a)-(b))) 82 #error Unsupported rtimer size (check RTIMER_CLOCK_SIZE) 85 #define RTIMER_CLOCK_MAX ((rtimer_clock_t)-1) 86 #define RTIMER_CLOCK_LT(a, b) (RTIMER_CLOCK_DIFF((a),(b)) < 0) 88 #include "rtimer-arch.h" 100 typedef void (* rtimer_callback_t)(
struct rtimer *t,
void *ptr);
111 rtimer_callback_t func;
119 RTIMER_ERR_ALREADY_SCHEDULED,
137 rtimer_clock_t duration, rtimer_callback_t func,
void *ptr);
158 #define RTIMER_NOW() rtimer_arch_now() 171 #define RTIMER_TIME(task) ((task)->time) 177 #define RTIMER_SECOND RTIMER_ARCH_SECOND 183 #ifdef RTIMER_CONF_GUARD_TIME 184 #define RTIMER_GUARD_TIME RTIMER_CONF_GUARD_TIME 186 #define RTIMER_GUARD_TIME (RTIMER_ARCH_SECOND >> 14) int rtimer_set(struct rtimer *rtimer, rtimer_clock_t time, rtimer_clock_t duration, rtimer_callback_t func, void *ptr)
Post a real-time task.
Representation of a real-time task.
void rtimer_run_next(void)
Execute the next real-time task and schedule the next task, if any.
void rtimer_arch_init(void)
We don't need to explicitly initialise anything but this routine is required by the API...
void rtimer_init(void)
Initialize the real-time scheduler.
void rtimer_arch_schedule(rtimer_clock_t t)
Schedules an rtimer task to be triggered at time t.