Thread: Use inherited baseCpu rather than cpu in SimpleThread
[gem5.git] / src / dev / etherbus.hh
index 2ff1d0a5e5cf7e1785023e34384a427b9281697a..43978b9c23e490cbef9eea1bb889f568e27fd0a5 100644 (file)
 #ifndef __ETHERBUS_H__
 #define __ETHERBUS_H__
 
-#include "sim/eventq.hh"
+#include "dev/etherobject.hh"
 #include "dev/etherpkt.hh"
+#include "params/EtherBus.hh"
+#include "sim/eventq.hh"
 #include "sim/sim_object.hh"
 
 class EtherDump;
 class EtherInt;
-class EtherBus : public SimObject
+class EtherBus : public EtherObject
 {
   protected:
     typedef std::list<EtherInt *> devlist_t;
@@ -56,10 +58,10 @@ class EtherBus : public SimObject
         EtherBus *bus;
 
       public:
-        DoneEvent(EventQueue *q, EtherBus *b)
-            : Event(q), bus(b) {}
+        DoneEvent(EtherBus *b) : bus(b) {}
         virtual void process() { bus->txDone(); }
-        virtual const char *description() { return "ethernet bus completion"; }
+        virtual const char *description() const
+            { return "ethernet bus completion"; }
     };
 
     DoneEvent event;
@@ -68,14 +70,21 @@ class EtherBus : public SimObject
     EtherDump *dump;
 
   public:
-    EtherBus(const std::string &name, double speed, bool loopback,
-             EtherDump *dump);
+    typedef EtherBusParams Params;
+    EtherBus(const Params *p);
     virtual ~EtherBus() {}
 
+    const Params *
+    params() const
+    {
+        return dynamic_cast<const Params *>(_params);
+    }
+
     void txDone();
     void reg(EtherInt *dev);
     bool busy() const { return (bool)packet; }
     bool send(EtherInt *sender, EthPacketPtr &packet);
+    virtual EtherInt *getEthPort(const std::string &if_name, int idx);
 };
 
 #endif // __ETHERBUS_H__