summaryrefslogtreecommitdiff
path: root/src/dev/mc146818.hh
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-08-20 00:42:43 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-08-20 00:42:43 -0700
commitda3c3bfa98e7cf81010a476b0b6ceba4c936f417 (patch)
tree033a31bb94eee23f76d1825510d6f54eb49ec810 /src/dev/mc146818.hh
parente8c0ca5cd15be99ea8b56ac64824fce50e76d577 (diff)
downloadgem5-da3c3bfa98e7cf81010a476b0b6ceba4c936f417.tar.xz
X86: Make the real time clock actually keep track of time.
Diffstat (limited to 'src/dev/mc146818.hh')
-rw-r--r--src/dev/mc146818.hh26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/dev/mc146818.hh b/src/dev/mc146818.hh
index e145ad3fd..e33658903 100644
--- a/src/dev/mc146818.hh
+++ b/src/dev/mc146818.hh
@@ -64,6 +64,23 @@ class MC146818 : public EventManager
virtual const char *description() const;
};
+ /** Event for RTC periodic interrupt */
+ struct RTCTickEvent : public Event
+ {
+ MC146818 * parent;
+
+ RTCTickEvent(MC146818 * _parent) : parent(_parent)
+ {
+ parent->schedule(this, curTick + Clock::Int::s);
+ }
+
+ /** Event process to occur at interrupt*/
+ void process();
+
+ /** Event description */
+ const char *description() const;
+ };
+
private:
std::string _name;
const std::string &name() const { return _name; }
@@ -71,6 +88,9 @@ class MC146818 : public EventManager
/** RTC periodic interrupt event */
RTCEvent event;
+ /** RTC tick event */
+ RTCTickEvent tickEvent;
+
/** Data for real-time clock function */
union {
uint8_t clock_data[10];
@@ -89,6 +109,10 @@ class MC146818 : public EventManager
};
};
+ struct tm curTime;
+
+ void setTime(const struct tm time);
+
/** RTC status register A */
uint8_t stat_regA;
@@ -106,6 +130,8 @@ class MC146818 : public EventManager
/** RTC read data */
uint8_t readData(const uint8_t addr);
+ void tickClock();
+
/**
* Serialize this object to the given output stream.
* @param base The base name of the counter object.