etherint.hh revision 2665
11689SN/A/* 210333Smitch.hayenga@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 * Authors: Nathan Binkert 291689SN/A */ 301689SN/A 311689SN/A/* @file 321689SN/A * Class representing the actual interface between two ethernet 331689SN/A * components. 341689SN/A */ 351689SN/A 361689SN/A#ifndef __DEV_ETHERINT_HH__ 371689SN/A#define __DEV_ETHERINT_HH__ 381689SN/A 391689SN/A#include <string> 402665Ssaidi@eecs.umich.edu 412665Ssaidi@eecs.umich.edu#include "dev/etherpkt.hh" 422831Sksewell@umich.edu#include "sim/sim_object.hh" 431689SN/A 441689SN/A/* 459944Smatt.horsnell@ARM.com * Class representing the actual interface between two ethernet 469944Smatt.horsnell@ARM.com * components. These components are intended to attach to another 479944Smatt.horsnell@ARM.com * ethernet interface on one side and whatever device on the other. 482064SN/A */ 491060SN/Aclass EtherInt : public SimObject 501060SN/A{ 512292SN/A protected: 521717SN/A EtherInt *peer; 538232Snate@binkert.org 544762Snate@binkert.org public: 556221Snate@binkert.org EtherInt(const std::string &name) : SimObject(name), peer(NULL) {} 564762Snate@binkert.org virtual ~EtherInt() {} 571060SN/A 588737Skoansin.tan@gmail.com void setPeer(EtherInt *p); 598737Skoansin.tan@gmail.com 608737Skoansin.tan@gmail.com void recvDone() { peer->sendDone(); } 615529Snate@binkert.org virtual void sendDone() = 0; 621061SN/A 632292SN/A bool sendPacket(EthPacketPtr packet) 645606Snate@binkert.org { return peer ? peer->recvPacket(packet) : true; } 658581Ssteve.reinhardt@amd.com virtual bool recvPacket(EthPacketPtr packet) = 0; 668581Ssteve.reinhardt@amd.com}; 671060SN/A 682292SN/A#endif // __DEV_ETHERINT_HH__ 692292SN/A