Hochauflösender Linux-Kernel-Timer hrtimer
ist eine Option.http://lwn.net/Articles/167897/
Folgendes mache ich:
#include <linux/interrupt.h>
#include <linux/hrtimer.h>
#include <linux/sched.h>
static struct hrtimer htimer;
static ktime_t kt_periode;
static void timer_init(void)
{
kt_periode = ktime_set(0, 104167); //seconds,nanoseconds
hrtimer_init (& htimer, CLOCK_REALTIME, HRTIMER_MODE_REL);
htimer.function = timer_function;
hrtimer_start(& htimer, kt_periode, HRTIMER_MODE_REL);
}
static void timer_cleanup(void)
{
hrtimer_cancel(& htimer);
}
static enum hrtimer_restart timer_function(struct hrtimer * timer)
{
// @Do your work here.
hrtimer_forward_now(timer, kt_periode);
return HRTIMER_RESTART;
}