etherint.hh revision 2566
11689SN/A/*
213590Srekai.gonzalezalberquilla@arm.com * Copyright (c) 2002-2005 The Regents of The University of Michigan
39920Syasuko.eckert@amd.com * All rights reserved.
47944SGiacomo.Gabrielli@arm.com *
57944SGiacomo.Gabrielli@arm.com * Redistribution and use in source and binary forms, with or without
67944SGiacomo.Gabrielli@arm.com * modification, are permitted provided that the following conditions are
77944SGiacomo.Gabrielli@arm.com * met: redistributions of source code must retain the above copyright
87944SGiacomo.Gabrielli@arm.com * notice, this list of conditions and the following disclaimer;
97944SGiacomo.Gabrielli@arm.com * redistributions in binary form must reproduce the above copyright
107944SGiacomo.Gabrielli@arm.com * notice, this list of conditions and the following disclaimer in the
117944SGiacomo.Gabrielli@arm.com * documentation and/or other materials provided with the distribution;
127944SGiacomo.Gabrielli@arm.com * neither the name of the copyright holders nor the names of its
137944SGiacomo.Gabrielli@arm.com * contributors may be used to endorse or promote products derived from
147944SGiacomo.Gabrielli@arm.com * this software without specific prior written permission.
152326SN/A *
161689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271689SN/A */
281689SN/A
291689SN/A/* @file
301689SN/A * Class representing the actual interface between two ethernet
311689SN/A * components.
321689SN/A */
331689SN/A
341689SN/A#ifndef __DEV_ETHERINT_HH__
351689SN/A#define __DEV_ETHERINT_HH__
361689SN/A
371689SN/A#include <string>
381689SN/A
391689SN/A#include "dev/etherpkt.hh"
402665Ssaidi@eecs.umich.edu#include "sim/sim_object.hh"
412665Ssaidi@eecs.umich.edu
422831Sksewell@umich.edu/*
431689SN/A * Class representing the actual interface between two ethernet
441689SN/A * components.  These components are intended to attach to another
459944Smatt.horsnell@ARM.com * ethernet interface on one side and whatever device on the other.
469944Smatt.horsnell@ARM.com */
479944Smatt.horsnell@ARM.comclass EtherInt : public SimObject
482064SN/A{
491060SN/A  protected:
501060SN/A    EtherInt *peer;
5113449Sgabeblack@google.com
522292SN/A  public:
531717SN/A    EtherInt(const std::string &name) : SimObject(name), peer(NULL) {}
548232Snate@binkert.org    virtual ~EtherInt() {}
554762Snate@binkert.org
566221Snate@binkert.org    void setPeer(EtherInt *p);
574762Snate@binkert.org
581060SN/A    void recvDone() { peer->sendDone(); }
598737Skoansin.tan@gmail.com    virtual void sendDone() = 0;
608737Skoansin.tan@gmail.com
618737Skoansin.tan@gmail.com    bool sendPacket(EthPacketPtr packet)
625529Snate@binkert.org    { return peer ? peer->recvPacket(packet) : true; }
631061SN/A    virtual bool recvPacket(EthPacketPtr packet) = 0;
6413429Srekai.gonzalezalberquilla@arm.com};
655606Snate@binkert.org
668581Ssteve.reinhardt@amd.com#endif // __DEV_ETHERINT_HH__
678581Ssteve.reinhardt@amd.com