Deleted Added
sdiff udiff text old ( 5443:394d180e8c04 ) new ( 5444:d5d0ac0b6d58 )
full compact
1/*
2 * Copyright (c) 2004, 2005
3 * The Regents of The University of Michigan
4 * All Rights Reserved
5 *
6 * This code is part of the M5 simulator.
7 *
8 * Permission is granted to use, copy, create derivative works and

--- 133 unchanged lines hidden (view full) ---

142 if (event.scheduled())
143 event.deschedule();
144 output_high = false;
145 write_byte = MSB;
146 break;
147
148 case MSB:
149 count = (count & 0x00FF) | (data << 8);
150 // In the RateGen or SquareWave modes, the timer wraps around and
151 // triggers on a value of 1, not 0.
152 if (mode == RateGen || mode == SquareWave)
153 period = count - 1;
154 else
155 period = count;
156
157 if (period > 0)
158 event.setTo(period);
159
160 write_byte = LSB;
161 break;
162 }
163}
164
165void
166Intel8254Timer::Counter::setRW(int rw_val)
167{

--- 70 unchanged lines hidden (view full) ---

238
239void
240Intel8254Timer::Counter::CounterEvent::process()
241{
242 DPRINTF(Intel8254Timer, "Timer Interrupt\n");
243 switch (counter->mode) {
244 case InitTc:
245 counter->output_high = true;
246 break;
247 case RateGen:
248 case SquareWave:
249 setTo(counter->period);
250 break;
251 default:
252 panic("Unimplemented PITimer mode.\n");
253 }
254}
255
256void
257Intel8254Timer::Counter::CounterEvent::setTo(int clocks)
258{
259 if (clocks == 0)
260 panic("Timer can't be set to go off instantly.\n");
261 DPRINTF(Intel8254Timer, "Timer set to curTick + %d\n",
262 clocks * interval);
263 schedule(curTick + clocks * interval);
264}
265
266const char *
267Intel8254Timer::Counter::CounterEvent::description() const
268{
269 return "tsunami 8254 Interval timer";
270}