diff --git a/dev/tsunami_io.cc b/dev/tsunami_io.cc index eb0b9ae91..537e40a22 100644 --- a/dev/tsunami_io.cc +++ b/dev/tsunami_io.cc @@ -22,6 +22,38 @@ #include "sim/system.hh" using namespace std; +TsunamiIO::RTCEvent::RTCEvent() + : Event(&mainEventQueue) +{ + DPRINTF(Tsunami, "RTC Event Initilizing\n"); + rtc_uip = 0; + schedule(curTick + (curTick % ticksPerSecond)); +} + +void +TsunamiIO::RTCEvent::process() +{ + DPRINTF(Tsunami, "Timer Interrupt\n"); + if (rtc_uip == 0) { + rtc_uip = 1; //Signal a second has occured + schedule(curTick + (curTick % ticksPerSecond) - 10); + } + else + rtc_uip = 0; //Done signaling second has occured + schedule(curTick + (curTick % ticksPerSecond)); +} + +const char * +TsunamiIO::RTCEvent::description() +{ + return "tsunami RTC changte second"; +} + +uint8_t +TsunamiIO::RTCEvent::rtc_uip_value() +{ + return rtc_uip; +} TsunamiIO::ClockEvent::ClockEvent() : Event(&mainEventQueue) diff --git a/dev/tsunami_io.hh b/dev/tsunami_io.hh index 1336a703e..4e342523f 100644 --- a/dev/tsunami_io.hh +++ b/dev/tsunami_io.hh @@ -64,6 +64,19 @@ class TsunamiIO : public MmapDevice }; + class RTCEvent : public Event + { + protected: + Tick interval; + uint8_t rtc_uip; + + public: + RTCEvent(); + + virtual void process(); + virtual const char *description(); + uint8_t rtc_uip_value(); + }; uint8_t mask1; uint8_t mask2;