intel_8254_timer.cc (5443:394d180e8c04) | intel_8254_timer.cc (5444:d5d0ac0b6d58) |
---|---|
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); | 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 period = count; | 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; |
151 | 156 |
152 if (period > 0) { 153 DPRINTF(Intel8254Timer, "Timer set to curTick + %d\n", 154 count * event.interval); 155 event.schedule(curTick + count * event.interval); 156 } | 157 if (period > 0) 158 event.setTo(period); 159 |
157 write_byte = LSB; 158 break; 159 } 160} 161 162void 163Intel8254Timer::Counter::setRW(int rw_val) 164{ --- 70 unchanged lines hidden (view full) --- 235 236void 237Intel8254Timer::Counter::CounterEvent::process() 238{ 239 DPRINTF(Intel8254Timer, "Timer Interrupt\n"); 240 switch (counter->mode) { 241 case InitTc: 242 counter->output_high = true; | 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; |
|
243 case RateGen: 244 case SquareWave: | 247 case RateGen: 248 case SquareWave: |
249 setTo(counter->period); |
|
245 break; 246 default: 247 panic("Unimplemented PITimer mode.\n"); 248 } 249} 250 | 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 |
|
251const char * 252Intel8254Timer::Counter::CounterEvent::description() const 253{ 254 return "tsunami 8254 Interval timer"; 255} | 266const char * 267Intel8254Timer::Counter::CounterEvent::description() const 268{ 269 return "tsunami 8254 Interval timer"; 270} |