mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-20 10:28:29 +00:00
52ae284a7e
add update mechanism (needed to safely handle counter rollover) and lock-free synchronization. refactor: . Counters now have Activate/Shutdown interface rather than throwing exceptions from the ctor. . whrt is responsible for caching frequency/resolution etc. . fix counterBits handling This was SVN commit r5105.
26 lines
882 B
C
26 lines
882 B
C
/**
|
|
* =========================================================================
|
|
* File : pit.h
|
|
* Project : 0 A.D.
|
|
* Description : Timer implementation using 82C53/4 PIT
|
|
* =========================================================================
|
|
*/
|
|
|
|
// license: GPL; see lib/license.txt
|
|
|
|
#ifndef INCLUDED_PIT
|
|
#define INCLUDED_PIT
|
|
|
|
// note: we don't access the PIT for two reasons:
|
|
// - it rolls over every 55 ms (1.193 MHz, 16 bit) and would have to be
|
|
// read at least that often, which would require setting high thread
|
|
// priority (dangerous).
|
|
// - reading it is slow and cannot be done by two independent users
|
|
// (the second being QPC) since the counter value must be latched.
|
|
//
|
|
// there are enough other counters anway.
|
|
|
|
static const i64 PIT_FREQ = 1193182; // (= master oscillator frequency/12)
|
|
|
|
#endif // #ifndef INCLUDED_PIT
|