Jasper Lake EDS Vol1


ID 633935
Date 01/01/2021
Public Content

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Periodic Versus Non-Periodic Modes

Non-Periodic Mode

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.

Warning:Software must be careful when programming the comparator registers. If the value written to the register is not sufficiently far in the future, then the counter may pass the value before it reaches the register and the interrupt will be missed. The BIOS should pass a data structure to the operating system to indicate that the operating system should not attempt to program the periodic timer to a rate faster than 5 microseconds.

All of the timers support non-periodic mode.

Refer to Section of the IA-PC HPET Specification for more details of this mode.

Periodic 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.

Note:As the timer period approaches zero, the interrupts associated with the periodic timer may not get completely serviced before the next timer match occurs. Interrupts may get lost and/or system performance may be degraded in this case.

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.