Add RTC event for uip bit
authorRon Dreslinski <rdreslin@umich.edu>
Fri, 23 Jan 2004 18:01:32 +0000 (13:01 -0500)
committerRon Dreslinski <rdreslin@umich.edu>
Fri, 23 Jan 2004 18:01:32 +0000 (13:01 -0500)
dev/tsunami_io.cc:
    Add RTC event to change the state of a uip bit
dev/tsunami_io.hh:
    Add RTC event to change state of an uip bit

--HG--
extra : convert_revision : acde7bdfe152d3e08f7ed53b4c8e910378f6ae67

dev/tsunami_io.cc
dev/tsunami_io.hh

index eb0b9ae91a11dd7c0275b0f2f71bd3a2b2b2c34c..537e40a2256c7a1266b48d3eaceead28e1118529 100644 (file)
 #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)
index 1336a703e3fda992b26252d0afb34c8a6ec20a42..4e342523f36a699e0f362bc7614372137acf9edb 100644 (file)
@@ -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;