Intel® Pentium® Silver and Intel® Celeron® Processors Datasheet, Volume 1
A newer version of this document is available. Customers should click here to go to the newest version.
Periodic Versus Non-Periodic Modes
This mode can be thought of as creating a one-shot.
When a timer is set up for non-periodic mode, it will generate an interrupt when the value in the main counter matches the value in the timer’s comparator register. Another interrupt will be generated when the main counter matches the value in the timer’s comparator register after a wrap around.
During run-time, the value in the timer’s comparator value register will not be changed by the hardware. Software can of course change the value.
The Timer 0 Comparator Value register cannot be programmed reliably by a single 64-bit write in a 32-bit environment except if only the periodic rate is being changed during run-time. If the actual Timer 0 Comparator Value needs to be reinitialized, then the following software solution will always work regardless of the environment:
- Set TIMER0_VAL_SET_CNF bit
- Set the lower 32 bits of the Timer0 Comparator Value register
- Set TIMER0_VAL_SET_CNF bit
- Set the upper 32 bits of the Timer0 Comparator Value register
Timer 0 is configurable to 32- (default) or 64-bit mode, whereas Timers 1:7 only support 32-bit mode.
All of the timers support non-periodic mode.
Refer to Section 220.127.116.11.1 of the IA-PC HPET Specification for more details of this mode.
When a timer is set up for periodic mode, the software writes a value in the timer’s comparator value register. When the main counter value matches the value in the timer’s comparator value register, an interrupt can be generated. The hardware will then automatically increase the value in the comparator value register by the last value written to that register.
To make the periodic mode work properly, the main counter is typically written with a value of 0 so that the first interrupt occurs at the right point for the comparator. If the main counter is not set to 0, interrupts may not occur as expected.
During run-time, the value in the timer’s comparator value register can be read by software to find out when the next periodic interrupt will be generated (not the rate at which it generates interrupts). Software is expected to remember the last value written to the comparator’s value register (the rate at which interrupts are generated).
If software wants to change the periodic rate, it should write a new value to the comparator value register. At the point when the timer’s comparator indicates a match, this new value will be added to derive the next matching point.
If the software resets the main counter, the value in the comparator’s value register needs to reset as well. This can be done by setting the TIMERn_VAL_SET_CNF bit. Again, to avoid race conditions, this should be done with the main counter halted. The following usage model is expected:
- Software clears the ENABLE_CNF bit to prevent any interrupts
- Software Clears the main counter by writing a value of 00h to it.
- Software sets the TIMER0_VAL_SET_CNF bit.
- Software writes the new value in the TIMER0_COMPARATOR_VAL register
Software sets the ENABLE_CNF bit to enable interrupts.
Each timer is NOT required to support the periodic mode of operation. A capabilities bit indicates if the particular timer supports periodic mode. he reason for this is that supporting the periodic mode adds a significant amount of gates.
For the Intel PCH, only timer 0 will support the periodic mode. This saves a substantial number of gates.