rename AlphaConsole to AlphaBackdoor
[gem5.git] / src / dev / sinic.hh
index 1bb4c77e040237251924f5fa1a045133159f35ac..e85d93fe471154ed8aaa6cc25fedd892f5ada9ed 100644 (file)
@@ -24,6 +24,8 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Nathan Binkert
  */
 
 #ifndef __DEV_SINIC_HH__
@@ -37,6 +39,7 @@
 #include "dev/pcidev.hh"
 #include "dev/pktfifo.hh"
 #include "dev/sinicreg.hh"
+#include "params/Sinic.hh"
 #include "sim/eventq.hh"
 
 namespace Sinic {
@@ -48,7 +51,7 @@ class Base : public PciDev
     bool rxEnable;
     bool txEnable;
     Tick clock;
-    inline Tick cycles(int numCycles) const { return numCycles * clock; }
+    inline Tick ticks(int numCycles) const { return numCycles * clock; }
 
   protected:
     Tick intrDelay;
@@ -78,13 +81,9 @@ class Base : public PciDev
  * Construction/Destruction/Parameters
  */
   public:
-    struct Params : public PciDev::Params
-    {
-        Tick clock;
-        Tick intr_delay;
-    };
-
-    Base(Params *p);
+    typedef SinicParams Params;
+    const Params *params() const { return (const Params *)_params; }
+    Base(const Params *p);
 };
 
 class Device : public Base
@@ -231,7 +230,7 @@ class Device : public Base
   public:
     bool recvPacket(EthPacketPtr packet);
     void transferDone();
-    void setInterface(Interface *i) { assert(!interface); interface = i; }
+    virtual EtherInt *getEthPort(const std::string &if_name, int idx);
 
 /**
  * DMA parameters
@@ -262,8 +261,9 @@ class Device : public Base
  * Memory Interface
  */
   public:
-    virtual Tick read(Packet *pkt);
-    virtual Tick write(Packet *pkt);
+    virtual Tick read(PacketPtr pkt);
+    virtual Tick write(PacketPtr pkt);
+    virtual void resume();
 
     void prepareIO(int cpu, int index);
     void prepareRead(int cpu, int index);
@@ -310,43 +310,8 @@ class Device : public Base
     virtual void serialize(std::ostream &os);
     virtual void unserialize(Checkpoint *cp, const std::string &section);
 
-/**
- * Construction/Destruction/Parameters
- */
-  public:
-    struct Params : public Base::Params
-    {
-        Tick tx_delay;
-        Tick rx_delay;
-        bool rx_filter;
-        Net::EthAddr eaddr;
-        uint32_t rx_max_copy;
-        uint32_t tx_max_copy;
-        uint32_t rx_max_intr;
-        uint32_t rx_fifo_size;
-        uint32_t tx_fifo_size;
-        uint32_t rx_fifo_threshold;
-        uint32_t rx_fifo_low_mark;
-        uint32_t tx_fifo_high_mark;
-        uint32_t tx_fifo_threshold;
-        Tick dma_read_delay;
-        Tick dma_read_factor;
-        Tick dma_write_delay;
-        Tick dma_write_factor;
-        bool rx_thread;
-        bool tx_thread;
-        bool rss;
-        uint32_t virtual_count;
-        bool zero_copy;
-        bool delay_copy;
-        bool virtual_addr;
-    };
-
-  protected:
-    const Params *params() const { return (const Params *)_params; }
-
   public:
-    Device(Params *params);
+    Device(const Params *p);
     ~Device();
 };
 
@@ -360,7 +325,8 @@ class Interface : public EtherInt
 
   public:
     Interface(const std::string &name, Device *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(); }