OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [include/] [RspConnection.h] - Diff between revs 63 and 462

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 63 Rev 462
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// Remote Serial Protocol connection: definition
// Remote Serial Protocol connection: definition
 
 
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
 
 
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 
 
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// system-on-chip, ORPSoC, built using Verilator.
// system-on-chip, ORPSoC, built using Verilator.
 
 
// This program is free software: you can redistribute it and/or modify it
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at your
// the Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
// option) any later version.
 
 
// This program is distributed in the hope that it will be useful, but WITHOUT
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// License for more details.
// License for more details.
 
 
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// $Id: RspConnection.h 326 2009-03-07 16:47:31Z jeremy $
// $Id: RspConnection.h 326 2009-03-07 16:47:31Z jeremy $
 
 
#ifndef RSP_CONNECTION__H
#ifndef RSP_CONNECTION__H
#define RSP_CONNECTION__H
#define RSP_CONNECTION__H
 
 
#include "RspPacket.h"
#include "RspPacket.h"
 
 
 
 
//! The default service to use if port number = 0 and no service specified
//! The default service to use if port number = 0 and no service specified
#define DEFAULT_RSP_SERVICE  "or1ksim-rsp"
#define DEFAULT_RSP_SERVICE  "or1ksim-rsp"
 
 
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//! Class implementing the RSP connection listener
//! Class implementing the RSP connection listener
 
 
//! RSP requests received from TCP/IP are queued on the output FIFO for
//! RSP requests received from TCP/IP are queued on the output FIFO for
//! processing by the GDB server. Packets read from the input FIFO from the
//! processing by the GDB server. Packets read from the input FIFO from the
//! GDB server are sent back via TCP/IP.
//! GDB server are sent back via TCP/IP.
 
 
//! The packets are received serially, ie. a new packet is not sent until the
//! The packets are received serially, ie. a new packet is not sent until the
//! previous ones have been dealt with. Some packets need no reply, so they
//! previous ones have been dealt with. Some packets need no reply, so they
//! will be sent one after the other. But for packets that need a reply (which
//! will be sent one after the other. But for packets that need a reply (which
//! may be one or several packets), new packets are not sent until the reply
//! may be one or several packets), new packets are not sent until the reply
//! from the previous one is received.
//! from the previous one is received.
 
 
//! The upshot of this is that we can avoid any risk of deadlock by always
//! The upshot of this is that we can avoid any risk of deadlock by always
//! giving priority to any outgoing reply packets.
//! giving priority to any outgoing reply packets.
 
 
//! Two threads are used, one to listen for TCP/IP connections from the
//! Two threads are used, one to listen for TCP/IP connections from the
//! client, the other to look for FIFO packets from the GDB server to write
//! client, the other to look for FIFO packets from the GDB server to write
//! back to the client. Both must be non-blocking in the SystemC sense
//! back to the client. Both must be non-blocking in the SystemC sense
//! (i.e. allow other SystemC threads to run).
//! (i.e. allow other SystemC threads to run).
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class RspConnection
class RspConnection {
{
 
public:
public:
 
 
  // Constructors and destructor
        // Constructors and destructor
  RspConnection (int         _portNum);
        RspConnection(int _portNum);
  RspConnection (const char *_serviceName = DEFAULT_RSP_SERVICE);
         RspConnection(const char *_serviceName = DEFAULT_RSP_SERVICE);
  ~RspConnection ();
        ~RspConnection();
 
 
  // Public interface: manage client connections
        // Public interface: manage client connections
  bool  rspConnect ();
        bool rspConnect();
  void  rspClose ();
        void rspClose();
  bool  isConnected ();
        bool isConnected();
  char  rspSocketPeek ();
        char rspSocketPeek();
 
 
  // Public interface: get packets from the stream and put them out
        // Public interface: get packets from the stream and put them out
  bool  getPkt (RspPacket *pkt);
        bool getPkt(RspPacket * pkt);
  bool  putPkt (RspPacket *pkt);
        bool putPkt(RspPacket * pkt);
 
 
  int   getRspChar ();
        int getRspChar();
 
 
private:
private:
 
 
  // Generic initializer
  // Generic initializer
  void  rspInit (int         _portNum,
        void rspInit(int _portNum, const char *_serviceName);
                 const char *_serviceName);
 
 
 
  // Internal routines to handle individual chars  
        // Internal routines to handle individual chars  
  bool  putRspChar (char  c);
        bool putRspChar(char c);
  //int   getRspChar ();
        //int   getRspChar ();
 
 
  //! The port number to listen on
        //! The port number to listen on
  int  portNum;
        int portNum;
 
 
  //! The service name to listen on
        //! The service name to listen on
  const char *serviceName;
        const char *serviceName;
 
 
  //! The client file descriptor
        //! The client file descriptor
  int  clientFd;
        int clientFd;
 
 
};      // RspConnection ()
};                              // RspConnection ()
 
 
#endif  // RSP_CONNECTION__H
#endif // RSP_CONNECTION__H
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.