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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [tools/] [src/] [librw11/] [Rw11CntlTM11.hpp] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 32 wfjm
// $Id: Rw11CntlTM11.hpp 690 2015-06-07 18:23:51Z mueller $
2 31 wfjm
//
3
// Copyright 2015- 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
// 2015-06-04   686   1.0    Initial version
17
// 2015-05-17   683   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
 
21
/*!
22
  \file
23 32 wfjm
  \version $Id: Rw11CntlTM11.hpp 690 2015-06-07 18:23:51Z mueller $
24 31 wfjm
  \brief   Declaration of class Rw11CntlTM11.
25
*/
26
 
27
#ifndef included_Retro_Rw11CntlTM11
28
#define included_Retro_Rw11CntlTM11 1
29
 
30
#include "Rw11CntlBase.hpp"
31
#include "Rw11UnitTM11.hpp"
32
#include "Rw11Rdma.hpp"
33
 
34
namespace Retro {
35
 
36
  class Rw11CntlTM11 : public Rw11CntlBase<Rw11UnitTM11,4> {
37
    public:
38
 
39
                    Rw11CntlTM11();
40
                   ~Rw11CntlTM11();
41
 
42
      void          Config(const std::string& name, uint16_t base, int lam);
43
 
44
      virtual void  Start();
45
 
46
      virtual bool  BootCode(size_t unit, std::vector<uint16_t>& code,
47
                             uint16_t& aload, uint16_t& astart);
48
 
49
      virtual void  UnitSetup(size_t ind);
50
 
51
      void          SetChunkSize(size_t chunk);
52
      size_t        ChunkSize() const;
53
 
54
      const Rstats& RdmaStats() const;
55
 
56
      virtual void  Dump(std::ostream& os, int ind=0, const char* text=0) const;
57
 
58
    // some constants (also defined in cpp)
59
      static const uint16_t kIbaddr = 0172520; //!< TM11 default address
60
      static const int      kLam    = 7;       //!< TM11 default lam
61
 
62
      static const uint16_t kTMSR = 000; //!< TMSR reg offset
63
      static const uint16_t kTMCR = 002; //!< TMCR reg offset
64
      static const uint16_t kTMBC = 004; //!< TMBC reg offset
65
      static const uint16_t kTMBA = 006; //!< TMBA reg offset
66
      static const uint16_t kTMDB = 010; //!< TMDB reg offset
67
      static const uint16_t kTMRL = 012; //!< TMRL reg offset
68
 
69
      static const uint16_t kProbeOff = kTMCR; //!< probe address offset (tmcr)
70
      static const bool     kProbeInt = true;  //!< probe int active
71
      static const bool     kProbeRem = true;  //!< probr rem active
72
 
73
      static const uint16_t kTMSR_M_ICMD = kWBit15; //!< ICMD: invalid cmd
74
      static const uint16_t kTMSR_M_EOF  = kWBit14; //!< EOF: end-of-file seen
75
      static const uint16_t kTMSR_M_PAE  = kWBit12; //!< PAE: parity error
76
      static const uint16_t kTMSR_M_EOT  = kWBit10; //!< EOT: end-of-tape seen
77
      static const uint16_t kTMSR_M_RLE  = kWBit09; //!< RLE: record lgth error
78
      static const uint16_t kTMSR_M_BTE  = kWBit08; //!< BTE: bad tape error
79 32 wfjm
      static const uint16_t kTMSR_M_NXM  = kWBit07; //!< NXM: non-existent mem
80 31 wfjm
      static const uint16_t kTMSR_M_ONL  = kWBit06; //!< ONL: online
81
      static const uint16_t kTMSR_M_BOT  = kWBit05; //!< BOT: at begin-of-tape
82
      static const uint16_t kTMSR_M_WRL  = kWBit02; //!< WRL: write locked
83
      static const uint16_t kTMSR_M_REW  = kWBit01; //!< REW: tape rewound
84
      static const uint16_t kTMSR_M_TUR  = kWBit00; //!< TUR: unit ready
85
 
86
      static const uint16_t kTMCR_V_ERR  = 15;
87
      static const uint16_t kTMCR_V_DEN  = 13;
88
      static const uint16_t kTMCR_B_DEN  = 0003;
89
      static const uint16_t kTMCR_V_UNIT =  8;
90
      static const uint16_t kTMCR_B_UNIT = 0007;
91
      static const uint16_t kTMCR_M_RDY  = kWBit07;
92
      static const uint16_t kTMCR_V_EA   =  4;
93
      static const uint16_t kTMCR_B_EA   = 0003;
94
      static const uint16_t kTMCR_V_FUNC =  1;
95
      static const uint16_t kTMCR_B_FUNC = 0007;
96
      static const uint16_t kTMCR_M_GO   = kWBit00;
97
 
98
      static const uint16_t kFUNC_UNLOAD = 0;
99
      static const uint16_t kFUNC_READ   = 1;
100
      static const uint16_t kFUNC_WRITE  = 2;
101
      static const uint16_t kFUNC_WEOF   = 3;
102
      static const uint16_t kFUNC_SFORW  = 4;
103
      static const uint16_t kFUNC_SBACK  = 5;
104
      static const uint16_t kFUNC_WEIRG  = 6;
105
      static const uint16_t kFUNC_REWIND = 7;
106
      // remote function codes
107
      static const uint16_t kRFUNC_WUNIT = 1;
108
      static const uint16_t kRFUNC_DONE  = 2;
109
 
110
      // cr usage or rem func=wunit
111
      static const uint16_t kTMCR_V_RUNIT  =  4;
112
      static const uint16_t kTMCR_B_RUNIT  = 0003;
113
      // cr usage or rem func=done
114
      static const uint16_t kTMCR_M_RICMD  = kWBit15;
115
      static const uint16_t kTMCR_M_RPAE   = kWBit12;
116
      static const uint16_t kTMCR_M_RRLE   = kWBit09;
117
      static const uint16_t kTMCR_M_RBTE   = kWBit08;
118
      static const uint16_t kTMCR_M_RNXM   = kWBit07;
119
      static const uint16_t kTMCR_M_REAENA = kWBit06;
120
      static const uint16_t kTMCR_V_REA    =  4;
121
      static const uint16_t kTMCR_B_REA    = 0003;
122
 
123
      // rem usage of TMRL (used to access unit specific TMSR fields)
124
      static const uint16_t kTMRL_M_EOF  = kWBit10; //!< EOF: end-of-file seen
125
      static const uint16_t kTMRL_M_EOT  = kWBit09; //!< EOT: end-of-tape seen
126
      static const uint16_t kTMRL_M_ONL  = kWBit08; //!< ONL: online
127
      static const uint16_t kTMRL_M_BOT  = kWBit07; //!< BOT: at begin-of-tape
128
      static const uint16_t kTMRL_M_WRL  = kWBit06; //!< WRL: write locked
129
      static const uint16_t kTMRL_M_REW  = kWBit05; //!< REW: tape rewinding
130
 
131
    // statistics counter indices
132
      enum stats {
133
        kStatNFuncUnload= Rw11Cntl::kDimStat, //!< func UNLOAD
134
        kStatNFuncRead,                     //!< func READ
135
        kStatNFuncWrite,                    //!< func WRITE
136
        kStatNFuncWeof,                     //!< func WEOF
137
        kStatNFuncSforw,                    //!< func SFORW
138
        kStatNFuncSback,                    //!< func SBACK
139
        kStatNFuncWrteg,                    //!< func WRTEG
140
        kStatNFuncRewind,                   //!< func REWIND
141
        kDimStat
142
      };
143
 
144
    protected:
145
      int           AttnHandler(RlinkServer::AttnArgs& args);
146
      void          RdmaPreExecCB(int stat, size_t nwdone, size_t nwnext,
147
                                  RlinkCommandList& clist);
148
      void          RdmaPostExecCB(int stat, size_t ndone,
149
                                   RlinkCommandList& clist, size_t ncmd);
150
      void          AddErrorExit(RlinkCommandList& clist, uint16_t tmcr);
151
      void          AddFastExit(RlinkCommandList& clist, int opcode,
152
                                size_t ndone);
153
      void          AddNormalExit(RlinkCommandList& clist, size_t ndone,
154
                                  uint16_t tmcr=0);
155
      void          WriteLog(const char* func, RerrMsg&  emsg);
156
 
157
    protected:
158
      size_t        fPC_tmcr;               //!< PrimClist: tmcr index
159
      size_t        fPC_tmsr;               //!< PrimClist: tmsr index
160
      size_t        fPC_tmbc;               //!< PrimClist: tmbc index
161
      size_t        fPC_tmba;               //!< PrimClist: tmba index
162
 
163
      uint16_t      fRd_tmcr;               //!< Rdma: request tmcr
164
      uint16_t      fRd_tmsr;               //!< Rdma: request tmsr
165
      uint16_t      fRd_tmbc;               //!< Rdma: request tmbc
166
      uint16_t      fRd_tmba;               //!< Rdma: request tmba
167
      uint32_t      fRd_bc;                 //!< Rdma: request bc
168
      uint32_t      fRd_addr;               //!< Rdma: current addr
169
      uint32_t      fRd_nwrd;               //!< Rdma: current nwrd
170
      uint16_t      fRd_fu;                 //!< Rdma: request fu code
171
      int           fRd_opcode;             //!< Rdma: read opcode
172
      std::vector<uint16_t>  fBuf;          //!< data buffer
173
      Rw11Rdma      fRdma;                  //!< Rdma controller
174
  };
175
 
176
} // end namespace Retro
177
 
178
#include "Rw11CntlTM11.ipp"
179
 
180
#endif

powered by: WebSVN 2.1.0

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