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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librlink/] [RlinkPort.hpp] - Blame information for rev 40

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

Line No. Rev Author Line
1 21 wfjm
// $Id: RlinkPort.hpp 513 2013-05-01 14:02:06Z mueller $
2 10 wfjm
//
3 19 wfjm
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 10 wfjm
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16 21 wfjm
// 2013-05-01   513   1.2.1  fTraceLevel now uint32_t
17 19 wfjm
// 2013-02-23   492   1.2    use RparseUrl
18
// 2013-02-22   491   1.1    use new RlogFile/RlogMsg interfaces
19
// 2013-01-27   477   1.0.3  add RawRead(),RawWrite() methods
20 17 wfjm
// 2012-12-26   465   1.0.2  add CloseFd() method
21 12 wfjm
// 2011-04-24   380   1.0.1  use boost::noncopyable (instead of private dcl's)
22 10 wfjm
// 2011-03-27   375   1.0    Initial version
23
// 2011-01-15   356   0.1    First draft
24
// ---------------------------------------------------------------------------
25
 
26
 
27
/*!
28
  \file
29 21 wfjm
  \version $Id: RlinkPort.hpp 513 2013-05-01 14:02:06Z mueller $
30 10 wfjm
  \brief   Declaration of class RlinkPort.
31
*/
32
 
33
#ifndef included_Retro_RlinkPort
34
#define included_Retro_RlinkPort 1
35
 
36
#include <string>
37
#include <map>
38
 
39 12 wfjm
#include "boost/utility.hpp"
40
 
41 10 wfjm
#include "librtools/RerrMsg.hpp"
42
#include "librtools/RlogFile.hpp"
43
#include "librtools/Rstats.hpp"
44 19 wfjm
#include "librtools/RparseUrl.hpp"
45 10 wfjm
 
46
namespace Retro {
47
 
48 12 wfjm
  class RlinkPort : private boost::noncopyable {
49 10 wfjm
    public:
50
                    RlinkPort();
51 19 wfjm
      virtual      ~RlinkPort();
52 10 wfjm
 
53
      virtual bool  Open(const std::string& url, RerrMsg& emsg) = 0;
54
      virtual void  Close();
55
 
56
      virtual int   Read(uint8_t* buf, size_t size, double timeout,
57
                         RerrMsg& emsg);
58
      virtual int   Write(const uint8_t* buf, size_t size, RerrMsg& emsg);
59
      virtual bool  PollRead(double timeout);
60
 
61 19 wfjm
      int           RawRead(uint8_t* buf, size_t size, bool exactsize,
62
                            double timeout, double& tused, RerrMsg& emsg);
63
      int           RawWrite(const uint8_t* buf, size_t size, RerrMsg& emsg);
64
 
65 10 wfjm
      bool          IsOpen() const;
66
 
67 19 wfjm
      const RparseUrl&  Url() const;
68
 
69 10 wfjm
      int           FdRead() const;
70
      int           FdWrite() const;
71
 
72 19 wfjm
      void          SetLogFile(const boost::shared_ptr<RlogFile>& splog);
73 21 wfjm
      void          SetTraceLevel(uint32_t level);
74
      uint32_t      TraceLevel() const;
75 10 wfjm
 
76
      const Rstats& Stats() const;
77
 
78
      virtual void  Dump(std::ostream& os, int ind=0, const char* text=0) const;
79
 
80 19 wfjm
    // some constants (also defined in cpp)
81
      static const int  kEof  = 0;          //<!
82
      static const int  kTout = -1;         //<!
83
      static const int  kErr  = -2;         //<1
84 10 wfjm
 
85
    // statistics counter indices
86
      enum stats {
87
        kStatNPortWrite = 0,
88
        kStatNPortRead,
89
        kStatNPortTxByt,
90
        kStatNPortRxByt,
91 19 wfjm
        kStatNPortRawWrite,
92
        kStatNPortRawRead,
93 10 wfjm
        kDimStat
94
      };
95
 
96
    protected:
97 17 wfjm
      void          CloseFd(int& fd);
98 10 wfjm
 
99
    protected:
100
      bool          fIsOpen;                //!< is open flag
101 19 wfjm
      RparseUrl     fUrl;                   //!< parsed url
102 10 wfjm
      int           fFdRead;                //!< fd for read
103
      int           fFdWrite;               //!< fd for write
104 19 wfjm
      boost::shared_ptr<RlogFile>  fspLog;  //!< log file ptr
105 21 wfjm
      uint32_t      fTraceLevel;            //!< trace level
106 10 wfjm
      Rstats        fStats;                 //!< statistics
107
  };
108
 
109
} // end namespace Retro
110
 
111
#include "RlinkPort.ipp"
112
 
113
#endif

powered by: WebSVN 2.1.0

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