intel_8254_timer.cc (5606:6da7a58b0bc8) | intel_8254_timer.cc (5635:b65e232e7755) |
---|---|
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 --- 21 unchanged lines hidden (view full) --- 30 * Miguel J. Serrano 31 */ 32 33#include "base/misc.hh" 34#include "dev/intel_8254_timer.hh" 35 36using namespace std; 37 | 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 --- 21 unchanged lines hidden (view full) --- 30 * Miguel J. Serrano 31 */ 32 33#include "base/misc.hh" 34#include "dev/intel_8254_timer.hh" 35 36using namespace std; 37 |
38Intel8254Timer::Intel8254Timer(EventManager *em, const string &name) 39 : EventManager(em), _name(name), 40 counter0(this, name + ".counter0"), 41 counter1(this, name + ".counter1"), 42 counter2(this, name + ".counter2") | 38Intel8254Timer::Intel8254Timer(EventManager *em, const string &name, 39 Counter *counter0, Counter *counter1, Counter *counter2) : 40 EventManager(em), _name(name) |
43{ | 41{ |
44 counter[0] = &counter0; 45 counter[1] = &counter0; 46 counter[2] = &counter0; | 42 counter[0] = counter0; 43 counter[1] = counter1; 44 counter[2] = counter2; |
47} 48 | 45} 46 |
47Intel8254Timer::Intel8254Timer(EventManager *em, const string &name) : 48 EventManager(em), _name(name) 49{ 50 counter[0] = new Counter(this, name + ".counter0"); 51 counter[1] = new Counter(this, name + ".counter1"); 52 counter[2] = new Counter(this, name + ".counter2"); 53} 54 |
|
49void 50Intel8254Timer::writeControl(const CtrlReg data) 51{ 52 int sel = data.sel; 53 54 if (sel == ReadBackCommand) 55 panic("PITimer Read-Back Command is not implemented.\n"); 56 --- 5 unchanged lines hidden (view full) --- 62 counter[sel]->setBCD(data.bcd); 63 } 64} 65 66void 67Intel8254Timer::serialize(const string &base, ostream &os) 68{ 69 // serialize the counters | 55void 56Intel8254Timer::writeControl(const CtrlReg data) 57{ 58 int sel = data.sel; 59 60 if (sel == ReadBackCommand) 61 panic("PITimer Read-Back Command is not implemented.\n"); 62 --- 5 unchanged lines hidden (view full) --- 68 counter[sel]->setBCD(data.bcd); 69 } 70} 71 72void 73Intel8254Timer::serialize(const string &base, ostream &os) 74{ 75 // serialize the counters |
70 counter0.serialize(base + ".counter0", os); 71 counter1.serialize(base + ".counter1", os); 72 counter2.serialize(base + ".counter2", os); | 76 counter[0]->serialize(base + ".counter0", os); 77 counter[1]->serialize(base + ".counter1", os); 78 counter[2]->serialize(base + ".counter2", os); |
73} 74 75void 76Intel8254Timer::unserialize(const string &base, Checkpoint *cp, 77 const string §ion) 78{ 79 // unserialze the counters | 79} 80 81void 82Intel8254Timer::unserialize(const string &base, Checkpoint *cp, 83 const string §ion) 84{ 85 // unserialze the counters |
80 counter0.unserialize(base + ".counter0", cp, section); 81 counter1.unserialize(base + ".counter1", cp, section); 82 counter2.unserialize(base + ".counter2", cp, section); | 86 counter[0]->unserialize(base + ".counter0", cp, section); 87 counter[1]->unserialize(base + ".counter1", cp, section); 88 counter[2]->unserialize(base + ".counter2", cp, section); |
83} 84 85Intel8254Timer::Counter::Counter(Intel8254Timer *p, const string &name) 86 : _name(name), event(this), count(0), latched_count(0), period(0), 87 mode(0), output_high(false), latch_on(false), read_byte(LSB), 88 write_byte(LSB), parent(p) 89{ 90 --- 181 unchanged lines hidden --- | 89} 90 91Intel8254Timer::Counter::Counter(Intel8254Timer *p, const string &name) 92 : _name(name), event(this), count(0), latched_count(0), period(0), 93 mode(0), output_high(false), latch_on(false), read_byte(LSB), 94 write_byte(LSB), parent(p) 95{ 96 --- 181 unchanged lines hidden --- |