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 Counter *counter0, Counter *counter1, Counter *counter2) : 40 EventManager(em), _name(name) |
41{ |
42 counter[0] = counter0; 43 counter[1] = counter1; 44 counter[2] = counter2; |
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 |
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 |
76 counter[0]->serialize(base + ".counter0", os); 77 counter[1]->serialize(base + ".counter1", os); 78 counter[2]->serialize(base + ".counter2", os); |
79} 80 81void 82Intel8254Timer::unserialize(const string &base, Checkpoint *cp, 83 const string §ion) 84{ 85 // unserialze the counters |
86 counter[0]->unserialize(base + ".counter0", cp, section); 87 counter[1]->unserialize(base + ".counter1", cp, section); 88 counter[2]->unserialize(base + ".counter2", cp, section); |
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 --- |