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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [include/] [RspConnection.h] - Blame information for rev 178

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 63 julius
// ----------------------------------------------------------------------------
2
 
3
// Remote Serial Protocol connection: definition
4
 
5
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
6
 
7
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8
 
9
// This file is part of the cycle accurate model of the OpenRISC 1000 based
10
// system-on-chip, ORPSoC, built using Verilator.
11
 
12
// This program is free software: you can redistribute it and/or modify it
13
// under the terms of the GNU Lesser General Public License as published by
14
// the Free Software Foundation, either version 3 of the License, or (at your
15
// option) any later version.
16
 
17
// This program is distributed in the hope that it will be useful, but WITHOUT
18
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
20
// License for more details.
21
 
22
// You should have received a copy of the GNU Lesser General Public License
23
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 
25
// ----------------------------------------------------------------------------
26
 
27
// $Id: RspConnection.h 326 2009-03-07 16:47:31Z jeremy $
28
 
29
#ifndef RSP_CONNECTION__H
30
#define RSP_CONNECTION__H
31
 
32
#include "RspPacket.h"
33
 
34
 
35
//! The default service to use if port number = 0 and no service specified
36
#define DEFAULT_RSP_SERVICE  "or1ksim-rsp"
37
 
38
 
39
//-----------------------------------------------------------------------------
40
//! Class implementing the RSP connection listener
41
 
42
//! RSP requests received from TCP/IP are queued on the output FIFO for
43
//! processing by the GDB server. Packets read from the input FIFO from the
44
//! GDB server are sent back via TCP/IP.
45
 
46
//! The packets are received serially, ie. a new packet is not sent until the
47
//! previous ones have been dealt with. Some packets need no reply, so they
48
//! will be sent one after the other. But for packets that need a reply (which
49
//! may be one or several packets), new packets are not sent until the reply
50
//! from the previous one is received.
51
 
52
//! The upshot of this is that we can avoid any risk of deadlock by always
53
//! giving priority to any outgoing reply packets.
54
 
55
//! Two threads are used, one to listen for TCP/IP connections from the
56
//! client, the other to look for FIFO packets from the GDB server to write
57
//! back to the client. Both must be non-blocking in the SystemC sense
58
//! (i.e. allow other SystemC threads to run).
59
//-----------------------------------------------------------------------------
60
class RspConnection
61
{
62
public:
63
 
64
  // Constructors and destructor
65
  RspConnection (int         _portNum);
66
  RspConnection (const char *_serviceName = DEFAULT_RSP_SERVICE);
67
  ~RspConnection ();
68
 
69
  // Public interface: manage client connections
70
  bool  rspConnect ();
71
  void  rspClose ();
72
  bool  isConnected ();
73
  char  rspSocketPeek ();
74
 
75
  // Public interface: get packets from the stream and put them out
76
  bool  getPkt (RspPacket *pkt);
77
  bool  putPkt (RspPacket *pkt);
78
 
79
  int   getRspChar ();
80
 
81
private:
82
 
83
  // Generic initializer
84
  void  rspInit (int         _portNum,
85
                 const char *_serviceName);
86
 
87
  // Internal routines to handle individual chars  
88
  bool  putRspChar (char  c);
89
  //int   getRspChar ();
90
 
91
  //! The port number to listen on
92
  int  portNum;
93
 
94
  //! The service name to listen on
95
  const char *serviceName;
96
 
97
  //! The client file descriptor
98
  int  clientFd;
99
 
100
};      // RspConnection ()
101
 
102
#endif  // RSP_CONNECTION__H

powered by: WebSVN 2.1.0

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