summaryrefslogtreecommitdiff
path: root/src/dev/mc146818.hh
diff options
context:
space:
mode:
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.