93c93
< : _name(name), num(_num), event(this), count(0),
---
> : _name(name), num(_num), event(this), initial_count(0),
107c107
< latched_count = count;
---
> latched_count = currentCount();
110a111,124
> int
> Intel8254Timer::Counter::currentCount()
> {
> int clocks = event.clocksLeft();
> if (clocks == -1) {
> warn_once("Reading current count from inactive timer.\n");
> return 0;
> }
> if (mode == RateGen || mode == SquareWave)
> return clocks + 1;
> else
> return clocks;
> }
>
128a143
> uint16_t count = currentCount();
149c164
< count = (count & 0xFF00) | data;
---
> initial_count = (initial_count & 0xFF00) | data;
158c173
< count = (count & 0x00FF) | (data << 8);
---
> initial_count = (initial_count & 0x00FF) | (data << 8);
162c177
< period = count - 1;
---
> period = initial_count - 1;
164c179
< period = count;
---
> period = initial_count;
207c222
< paramOut(os, base + ".count", count);
---
> paramOut(os, base + ".initial_count", initial_count);
226c241
< paramIn(cp, section, base + ".count", count);
---
> paramIn(cp, section, base + ".initial_count", initial_count);
273a289,296
> int
> Intel8254Timer::Counter::CounterEvent::clocksLeft()
> {
> if (!scheduled())
> return -1;
> return (when() - curTick + interval - 1) / interval;
> }
>