mc146818: Correctly serialize tickEvent
[gem5.git] / src / dev / etherlink.hh
index bb28548106d9da30bc49ffbfb1c49081bc55c7a6..ca17b837da708b48c60ad7d94295f420ee163c61 100644 (file)
 #ifndef __DEV_ETHERLINK_HH__
 #define __DEV_ETHERLINK_HH__
 
+#include "base/types.hh"
 #include "dev/etherint.hh"
+#include "dev/etherobject.hh"
 #include "dev/etherpkt.hh"
+#include "params/EtherLink.hh"
 #include "sim/eventq.hh"
-#include "sim/host.hh"
 #include "sim/sim_object.hh"
 
 class EtherDump;
@@ -46,7 +48,7 @@ class Checkpoint;
 /*
  * Model for a fixed bandwidth full duplex ethernet link
  */
-class EtherLink : public SimObject
+class EtherLink : public EtherObject
 {
   protected:
     class Interface;
@@ -114,16 +116,25 @@ class EtherLink : public SimObject
         Interface(const std::string &name, Link *txlink, Link *rxlink);
         bool recvPacket(EthPacketPtr packet) { return txlink->transmit(packet); }
         void sendDone() { peer->sendDone(); }
+        bool isBusy() { return txlink->busy(); }
     };
 
     Link *link[2];
-    EtherInt *interface[2];
+    Interface *interface[2];
 
   public:
-    EtherLink(const std::string &name, EtherInt *peer0, EtherInt *peer1,
-              double rate, Tick delay, Tick delayVar, EtherDump *dump);
+    typedef EtherLinkParams Params;
+    EtherLink(const Params *p);
     virtual ~EtherLink();
 
+    const Params *
+    params() const
+    {
+        return dynamic_cast<const Params *>(_params);
+    }
+
+    virtual EtherInt *getEthPort(const std::string &if_name, int idx);
+
     virtual void serialize(std::ostream &os);
     virtual void unserialize(Checkpoint *cp, const std::string &section);