Rename cycles() function to ticks()
[gem5.git] / src / dev / ns_gige.hh
index 2f47026f3810a6a01f66a52701d055bb98cac581..dfdd81b66c74b11adb854fbcf919e13c2756750f 100644 (file)
 
 #include "base/inet.hh"
 #include "base/statistics.hh"
+#include "dev/etherdevice.hh"
 #include "dev/etherint.hh"
 #include "dev/etherpkt.hh"
 #include "dev/io_device.hh"
 #include "dev/ns_gige_reg.h"
-#include "dev/pcidev.hh"
 #include "dev/pktfifo.hh"
+#include "params/NSGigE.hh"
 #include "sim/eventq.hh"
 
 // Hash filtering constants
@@ -114,12 +115,11 @@ struct dp_rom {
 
 class NSGigEInt;
 class Packet;
-class PciConfigAll;
 
 /**
  * NS DP83820 Ethernet device model
  */
-class NSGigE : public PciDev
+class NSGigE : public EtherDevice
 {
   public:
     /** Transmit State Machine states */
@@ -199,7 +199,7 @@ class NSGigE : public PciDev
 
     /* state machine cycle time */
     Tick clock;
-    inline Tick cycles(int numCycles) const { return numCycles * clock; }
+    inline Tick ticks(int numCycles) const { return numCycles * clock; }
 
     /* tx State Machine */
     TxState txState;
@@ -350,36 +350,17 @@ class NSGigE : public PciDev
     NSGigEInt *interface;
 
   public:
-    struct Params : public PciDev::Params
-    {
-        Tick clock;
-        Tick intr_delay;
-        Tick tx_delay;
-        Tick rx_delay;
-        bool dma_desc_free;
-        bool dma_data_free;
-        Tick dma_read_delay;
-        Tick dma_write_delay;
-        Tick dma_read_factor;
-        Tick dma_write_factor;
-        bool rx_filter;
-        Net::EthAddr eaddr;
-        uint32_t tx_fifo_size;
-        uint32_t rx_fifo_size;
-        bool rx_thread;
-        bool tx_thread;
-        bool rss;
-        bool dma_no_allocate;
-    };
-
+    typedef NSGigEParams Params;
+    const Params *params() const { return (const Params *)_params; }
     NSGigE(Params *params);
     ~NSGigE();
-    const Params *params() const { return (const Params *)_params; }
 
-    virtual void writeConfig(int offset, const uint16_t data);
+    virtual EtherInt *getEthPort(const std::string &if_name, int idx);
+
+    virtual Tick writeConfig(PacketPtr pkt);
 
-    virtual Tick read(Packet *pkt);
-    virtual Tick write(Packet *pkt);
+    virtual Tick read(PacketPtr pkt);
+    virtual Tick write(PacketPtr pkt);
 
     bool cpuIntrPending() const;
     void cpuIntrAck() { cpuIntrClear(); }
@@ -387,11 +368,11 @@ class NSGigE : public PciDev
     bool recvPacket(EthPacketPtr packet);
     void transferDone();
 
-    void setInterface(NSGigEInt *i) { assert(!interface); interface = i; }
-
     virtual void serialize(std::ostream &os);
     virtual void unserialize(Checkpoint *cp, const std::string &section);
 
+    virtual void resume();
+
   public:
     void regStats();
 
@@ -457,7 +438,8 @@ class NSGigEInt : public EtherInt
 
   public:
     NSGigEInt(const std::string &name, NSGigE *d)
-        : EtherInt(name), dev(d) { dev->setInterface(this); }
+        : EtherInt(name), dev(d)
+    { }
 
     virtual bool recvPacket(EthPacketPtr pkt) { return dev->recvPacket(pkt); }
     virtual void sendDone() { dev->transferDone(); }