[<prev] [next>] [day] [month] [year] [list]
Message-ID: <6c64c0b90612090625k473f09f7uebd56bacfcb6ed38@mail.gmail.com>
Date: Sat, 9 Dec 2006 15:25:39 +0100
From: "Sylvain Goletto" <sygoletto@...il.com>
To: linux-kernel@...r.kernel.org
Subject: HPET behavior and one-shot timer
Hello all,
I am trying to use one-shot timers with the HPET as described in the
Intel specs (http://www.intel.com/hardwaredesign/hpetspec_1.pdf).
The linux hpet driver (2.6.17.13) has no API to do that (only periodic
timers at that time) an I am looking for the best way to add this
possibility to the kernel.
At this time I have developed a module that uses
hpet_register/hpet_control to get a hpet timer and uses hpet registers
to set a one-shot timer and wait for the interrupt.
My tests gave strange results : the interrupt comes as soon as I set
the interrupt enable bit for the timer.
So I made other tests with the original driver (kernel 2.6.17.13) and
the demo code in Documentation/hpet.txt and here is what I get: the
behavior is different between the first time I launch the test and the
others.
The following hpet_test polls for 2 interrupt and the frequency is set
to 1Hz so the expired time should be around 1000000us but it is only
true for the first time I use the timer after a fresh boot :
First run after fresh boot :
[HPET]# ./hpet_test poll /dev/hpet 1 2
-hpet: executing poll
hpet_poll: expired time = 1000008 <=== 1s, good
hpet_poll: revents = 1
hpet_poll: data 0x1
hpet_poll: expired time = 999997 <=== 1s, good
hpet_poll: revents = 1
hpet_poll: data 0x1
Second run :
[HPET]# ./hpet_test poll /dev/hpet 1 2
-hpet: executing poll
hpet_poll: expired time = 2 <=== 2us, BAD !!!
hpet_poll: revents = 1
hpet_poll: data 0x1
hpet_poll: expired time = 999992 <=== 1s, good
hpet_poll: revents = 1
hpet_poll: data 0x1
As you can see, the first run gives 1s for expiration time for the all
IT, but all other runs give 2/3 us for first IT !!!
If I want to reproduce, I have to reboot.
Is this the normal behavior ?
It looks like something (driver value, hpet register, ...) is not
re-set to the initial parameters.
I am trying to find what's wrong in the hpet.c file but I can't figure
out at the moment.
I also want to add aperiodic/one-shot interrupt possibility to the
driver so the the user can tell the hpet timer to send one IT in XXX
us from now or from a timeval parameter. But this will only be
possible if the previous problem is solved. I have a working module
the sets the comparator register with the right value for but the
interrupt fires immediately so it is unusable at the time.
Thank you in advance for the help.
- Sylvain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists