HRTIMER issue in kernel module
I am trying to write a kernel module where i want timers with microsecond precision. I am using HRTimers for the same.
linux version : linux v2.6.30 kernel compiled with hrtimer support
Processor : AT91SAM9260
HRTimer Initialization is as follows:
hrtimer_init( &hr_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL );
Using hrtimer as:
------------------
ktime = ktime_set(0, (long)(100000000)); /*100 milliseconds*/
hr_timer.function = &mrtu_reset_pulse
hrtimer_start( &hr_timer, ktime, HRTIMER_MODE_REL);
at91_set_gpio_value(AT91_PIN_PA6, 1);
Callback function:
--------------------
static enum hrtimer_restart mrtu_reset_pulse(struct hrtimer *timer)
{
at91_set_gpio_value(AT91_PIN_PA6, 0);
return (HRTIMER_NORESTART);
}
When i set expiration time as 100 ms, hrtimer will expire after 110ms, and if i set expiration time as 96ms, hrtimer will expire after 100ms. How can i achieve microsecond precision using hrtimer?
|