intel_8254_timer.hh (5606:6da7a58b0bc8) | intel_8254_timer.hh (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 --- 30 unchanged lines hidden (view full) --- 39#include "base/bitunion.hh" 40#include "sim/eventq.hh" 41#include "sim/host.hh" 42#include "sim/serialize.hh" 43 44/** Programmable Interval Timer (Intel 8254) */ 45class Intel8254Timer : public EventManager 46{ | 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 --- 30 unchanged lines hidden (view full) --- 39#include "base/bitunion.hh" 40#include "sim/eventq.hh" 41#include "sim/host.hh" 42#include "sim/serialize.hh" 43 44/** Programmable Interval Timer (Intel 8254) */ 45class Intel8254Timer : public EventManager 46{ |
47 protected: |
|
47 BitUnion8(CtrlReg) 48 Bitfield<7, 6> sel; 49 Bitfield<5, 4> rw; 50 Bitfield<3, 1> mode; 51 Bitfield<0> bcd; 52 EndBitUnion(CtrlReg) 53 54 enum SelectVal { --- 113 unchanged lines hidden (view full) --- 168 * @param base The base name of the counter object. 169 * @param cp The checkpoint use. 170 * @param section The section name of this object 171 */ 172 void unserialize(const std::string &base, Checkpoint *cp, 173 const std::string §ion); 174 }; 175 | 48 BitUnion8(CtrlReg) 49 Bitfield<7, 6> sel; 50 Bitfield<5, 4> rw; 51 Bitfield<3, 1> mode; 52 Bitfield<0> bcd; 53 EndBitUnion(CtrlReg) 54 55 enum SelectVal { --- 113 unchanged lines hidden (view full) --- 169 * @param base The base name of the counter object. 170 * @param cp The checkpoint use. 171 * @param section The section name of this object 172 */ 173 void unserialize(const std::string &base, Checkpoint *cp, 174 const std::string §ion); 175 }; 176 |
176 private: | 177 protected: |
177 std::string _name; 178 const std::string &name() const { return _name; } 179 180 /** PIT has three seperate counters */ 181 Counter *counter[3]; 182 183 public: | 178 std::string _name; 179 const std::string &name() const { return _name; } 180 181 /** PIT has three seperate counters */ 182 Counter *counter[3]; 183 184 public: |
184 /** Public way to access individual counters (avoid array accesses) */ 185 Counter counter0; 186 Counter counter1; 187 Counter counter2; | |
188 | 185 |
186 Intel8254Timer(EventManager *em, const std::string &name, 187 Counter *counter0, Counter *counter1, Counter *counter2); 188 |
|
189 Intel8254Timer(EventManager *em, const std::string &name); 190 191 /** Write control word */ 192 void writeControl(const CtrlReg data); 193 | 189 Intel8254Timer(EventManager *em, const std::string &name); 190 191 /** Write control word */ 192 void writeControl(const CtrlReg data); 193 |
194 uint8_t 195 readCounter(unsigned int num) 196 { 197 assert(num < 3); 198 return counter[num]->read(); 199 } 200 201 void 202 writeCounter(unsigned int num, const uint8_t data) 203 { 204 assert(num < 3); 205 counter[num]->write(data); 206 } 207 208 bool 209 outputHigh(unsigned int num) 210 { 211 assert(num < 3); 212 return counter[num]->outputHigh(); 213 } 214 |
|
194 /** 195 * Serialize this object to the given output stream. 196 * @param base The base name of the counter object. 197 * @param os The stream to serialize to. 198 */ 199 void serialize(const std::string &base, std::ostream &os); 200 201 /** 202 * Reconstruct the state of this object from a checkpoint. 203 * @param base The base name of the counter object. 204 * @param cp The checkpoint use. 205 * @param section The section name of this object 206 */ 207 void unserialize(const std::string &base, Checkpoint *cp, 208 const std::string §ion); 209}; 210 211#endif // __DEV_8254_HH__ | 215 /** 216 * Serialize this object to the given output stream. 217 * @param base The base name of the counter object. 218 * @param os The stream to serialize to. 219 */ 220 void serialize(const std::string &base, std::ostream &os); 221 222 /** 223 * Reconstruct the state of this object from a checkpoint. 224 * @param base The base name of the counter object. 225 * @param cp The checkpoint use. 226 * @param section The section name of this object 227 */ 228 void unserialize(const std::string &base, Checkpoint *cp, 229 const std::string §ion); 230}; 231 232#endif // __DEV_8254_HH__ |