HPET: Difference between revisions

36 bytes added ,  29 days ago
m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
m (Bot: Replace deprecated source tag with syntaxhighlight)
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
Line 324:
To enable one-shot mode:
 
<sourcesyntaxhighlight lang="cpp">
// "time" is time in femtoseconds from now to interrupt
if (time < COUNTER_CLK_PERIOD)
Line 333:
write_register_64(timer_configuration(n), (ioapic_input << 9) | (1 << 2));
write_register_64(timer_comparator(n), read_register(main_counter) + time);
</syntaxhighlight>
</source>
 
I hope the above code is obvious. If it's not, please analyze the meaning of specific fields in registers used above.
Line 341:
To enable periodic mode:
 
<sourcesyntaxhighlight lang="cpp">
// "time" is time in femtoseconds from now to interrupt
if (time < COUNTER_CLK_PERIOD)
Line 351:
write_register_64(timer_comparator(n), read_register(main_counter) + time);
write_register_64(timer_comparator(n), time);
</syntaxhighlight>
</source>
 
This snippet requires some more comments.