xref: /OK3568_Linux_fs/kernel/Documentation/timers/hpet.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===========================================
2*4882a593SmuzhiyunHigh Precision Event Timer Driver for Linux
3*4882a593Smuzhiyun===========================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThe High Precision Event Timer (HPET) hardware follows a specification
6*4882a593Smuzhiyunby Intel and Microsoft, revision 1.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunEach HPET has one fixed-rate counter (at 10+ MHz, hence "High Precision")
9*4882a593Smuzhiyunand up to 32 comparators.  Normally three or more comparators are provided,
10*4882a593Smuzhiyuneach of which can generate oneshot interrupts and at least one of which has
11*4882a593Smuzhiyunadditional hardware to support periodic interrupts.  The comparators are
12*4882a593Smuzhiyunalso called "timers", which can be misleading since usually timers are
13*4882a593Smuzhiyunindependent of each other ... these share a counter, complicating resets.
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunHPET devices can support two interrupt routing modes.  In one mode, the
16*4882a593Smuzhiyuncomparators are additional interrupt sources with no particular system
17*4882a593Smuzhiyunrole.  Many x86 BIOS writers don't route HPET interrupts at all, which
18*4882a593Smuzhiyunprevents use of that mode.  They support the other "legacy replacement"
19*4882a593Smuzhiyunmode where the first two comparators block interrupts from 8254 timers
20*4882a593Smuzhiyunand from the RTC.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunThe driver supports detection of HPET driver allocation and initialization
23*4882a593Smuzhiyunof the HPET before the driver module_init routine is called.  This enables
24*4882a593Smuzhiyunplatform code which uses timer 0 or 1 as the main timer to intercept HPET
25*4882a593Smuzhiyuninitialization.  An example of this initialization can be found in
26*4882a593Smuzhiyunarch/x86/kernel/hpet.c.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunThe driver provides a userspace API which resembles the API found in the
29*4882a593SmuzhiyunRTC driver framework.  An example user space program is provided in
30*4882a593Smuzhiyunfile:samples/timers/hpet_example.c
31