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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librlink/] [RlinkConnect.hpp] - Blame information for rev 10

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

Line No. Rev Author Line
1 10 wfjm
// $Id: RlinkConnect.hpp 375 2011-04-02 07:56:47Z mueller $
2
//
3
// Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
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
// 2011-04-02   375   1.0    Initial version
17
// 2011-01-15   356   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
 
21
/*!
22
  \file
23
  \version $Id: RlinkConnect.hpp 375 2011-04-02 07:56:47Z mueller $
24
  \brief   Declaration of class \c RlinkConnect.
25
*/
26
 
27
#ifndef included_Retro_RlinkConnect
28
#define included_Retro_RlinkConnect 1
29
 
30
#include <cstdint>
31
#include <string>
32
#include <vector>
33
#include <ostream>
34
 
35
#include "librtools/RerrMsg.hpp"
36
#include "librtools/Rstats.hpp"
37
#include "librtools/RlogFile.hpp"
38
 
39
#include "RlinkPort.hpp"
40
#include "RlinkCommandList.hpp"
41
#include "RlinkPacketBuf.hpp"
42
#include "RlinkAddrMap.hpp"
43
 
44
namespace Retro {
45
 
46
  class RlinkConnect {
47
    public:
48
      struct LogOpts {
49
        size_t        baseaddr;
50
        size_t        basedata;
51
        size_t        basestat;
52
        size_t        printlevel;           // 0=off,1=err,2=chk,3=all
53
        size_t        dumplevel;            // 0=off,1=err,2=chk,3=all
54
        size_t        tracelevel;           // 0=off,1=buf,2=char
55
 
56
                      LogOpts()
57
                        : baseaddr(16), basedata(16), basestat(16),
58
                          printlevel(0), dumplevel(0), tracelevel(0)
59
                      {}
60
      };
61
 
62
                    RlinkConnect();
63
                    ~RlinkConnect();
64
 
65
      bool          Open(const std::string& name, RerrMsg& emsg);
66
      void          Close();
67
      bool          IsOpen() const;
68
      RlinkPort*    Port() const;
69
 
70
      bool          Exec(RlinkCommandList& clist, RerrMsg& emsg);
71
      bool          ExecPart(RlinkCommandList& clist, size_t ibeg, size_t iend,
72
                             RerrMsg& emsg);
73
 
74
      double        WaitAttn(double timeout, RerrMsg& emsg);
75
      bool          SndOob(uint16_t addr, uint16_t data, RerrMsg& emsg);
76
 
77
      bool          AddrMapInsert(const std::string& name, uint16_t addr);
78
      bool          AddrMapErase(const std::string& name);
79
      bool          AddrMapErase(uint16_t addr);
80
      void          AddrMapClear();
81
 
82
      const RlinkAddrMap& AddrMap() const;
83
      const Rstats& Stats() const;
84
 
85
      bool          LogOpen(const std::string& name);
86
      void          LogUseStream(std::ostream* pstr);
87
      void          SetLogOpts(const LogOpts& opts);
88
      const LogOpts&  GetLogOpts() const;
89
      RlogFile&     LogFile() const;
90
 
91
      void          Print(std::ostream& os) const;
92
      void          Dump(std::ostream& os, int ind=0, const char* text=0) const;
93
 
94
 
95
    // statistics counter indices
96
      enum stats {
97
        kStatNExec = 0,
98
        kStatNSplitVol,
99
        kStatNExecPart,
100
        kStatNCmd,
101
        kStatNRreg,
102
        kStatNRblk,
103
        kStatNWreg,
104
        kStatNWblk,
105
        kStatNStat,
106
        kStatNAttn,
107
        kStatNInit,
108
        kStatNRblkWord,
109
        kStatNWblkWord,
110
        kStatNTxPktByt,
111
        kStatNTxEsc,
112
        kStatNRxPktByt,
113
        kStatNRxEsc,
114
        kStatNRxAttn,
115
        kStatNRxIdle,
116
        kStatNRxDrop,
117
        kStatNExpData,
118
        kStatNExpStat,
119
        kStatNChkData,
120
        kStatNChkStat,
121
        kStatNSndOob,
122
        kDimStat
123
      };
124
 
125
    protected:
126
      RlinkPort*    fpPort;                 //!< ptr to port
127
      uint8_t       fSeqNumber[8];          //!< command sequence number
128
      RlinkPacketBuf fTxPkt;                //!< transmit packet buffer
129
      RlinkPacketBuf fRxPkt;                //!< receive packet buffer
130
      RlinkAddrMap  fAddrMap;               //!< name<->address mapping
131
      Rstats        fStats;                 //!< statistics
132
      LogOpts       fLogOpts;               //!< log options
133
      RlogFile      fLogFile;               //!< connection log file
134
 
135
    // RlinkConnect is not copyable and assignable
136
    private:
137
                    RlinkConnect(const RlinkConnect& rhs);
138
      RlinkConnect& operator=(const RlinkConnect& rhs);
139
  };
140
 
141
} // end namespace Retro
142
 
143
#if !(defined(Retro_NoInline) || defined(Retro_RlinkConnect_NoInline))
144
#include "RlinkConnect.ipp"
145
#endif
146
 
147
#endif

powered by: WebSVN 2.1.0

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