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