summaryrefslogtreecommitdiff
path: root/src/dev/intel_8254_timer.hh
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2008-10-11 01:49:39 -0700
committerGabe Black <gblack@eecs.umich.edu>2008-10-11 01:49:39 -0700
commita6600fdd8885f9765c859935a5c97d9017653745 (patch)
tree9cbb4d0ff97259066774b67f5e9a353eaed45a4e /src/dev/intel_8254_timer.hh
parent539563e04b4925e88c28cb44f5180915c3b3a5be (diff)
downloadgem5-a6600fdd8885f9765c859935a5c97d9017653745.tar.xz
Devices: Make the Intel8254Timer device only use pointers to its counters.
Diffstat (limited to 'src/dev/intel_8254_timer.hh')
-rw-r--r--src/dev/intel_8254_timer.hh31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/dev/intel_8254_timer.hh b/src/dev/intel_8254_timer.hh
index 439432aed..9391b0f9e 100644
--- a/src/dev/intel_8254_timer.hh
+++ b/src/dev/intel_8254_timer.hh
@@ -44,6 +44,7 @@
/** Programmable Interval Timer (Intel 8254) */
class Intel8254Timer : public EventManager
{
+ protected:
BitUnion8(CtrlReg)
Bitfield<7, 6> sel;
Bitfield<5, 4> rw;
@@ -173,7 +174,7 @@ class Intel8254Timer : public EventManager
const std::string &section);
};
- private:
+ protected:
std::string _name;
const std::string &name() const { return _name; }
@@ -181,16 +182,36 @@ class Intel8254Timer : public EventManager
Counter *counter[3];
public:
- /** Public way to access individual counters (avoid array accesses) */
- Counter counter0;
- Counter counter1;
- Counter counter2;
+
+ Intel8254Timer(EventManager *em, const std::string &name,
+ Counter *counter0, Counter *counter1, Counter *counter2);
Intel8254Timer(EventManager *em, const std::string &name);
/** Write control word */
void writeControl(const CtrlReg data);
+ uint8_t
+ readCounter(unsigned int num)
+ {
+ assert(num < 3);
+ return counter[num]->read();
+ }
+
+ void
+ writeCounter(unsigned int num, const uint8_t data)
+ {
+ assert(num < 3);
+ counter[num]->write(data);
+ }
+
+ bool
+ outputHigh(unsigned int num)
+ {
+ assert(num < 3);
+ return counter[num]->outputHigh();
+ }
+
/**
* Serialize this object to the given output stream.
* @param base The base name of the counter object.