w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rw11CntlRL11.hpp
Go to the documentation of this file.
1// $Id: Rw11CntlRL11.hpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2014-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-06-07 1160 1.0.2 RdmaStats() not longer const
8// 2017-04-02 865 1.0.1 Dump(): add detail arg
9// 2015-03-01 653 1.0 Initial version
10// 2014-06-08 561 0.1 First draft
11// ---------------------------------------------------------------------------
12
13
18#ifndef included_Retro_Rw11CntlRL11
19#define included_Retro_Rw11CntlRL11 1
20
21#include "Rw11CntlBase.hpp"
22#include "Rw11UnitRL11.hpp"
23#include "Rw11RdmaDisk.hpp"
24
25namespace Retro {
26
27 class Rw11CntlRL11 : public Rw11CntlBase<Rw11UnitRL11,4> {
28 public:
29
32
33 void Config(const std::string& name, uint16_t base, int lam);
34
35 virtual void Start();
36
37 virtual bool BootCode(size_t unit, std::vector<uint16_t>& code,
38 uint16_t& aload, uint16_t& astart);
39
40 virtual void UnitSetup(size_t ind);
41
42 void SetChunkSize(size_t chunk);
43 size_t ChunkSize() const;
44
46
47 virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
48 int detail=0) const;
49
50 // some constants (also defined in cpp)
51 static const uint16_t kIbaddr = 0174400;
52 static const int kLam = 5;
53
54 static const uint16_t kRLCS = 000;
55 static const uint16_t kRLBA = 002;
56 static const uint16_t kRLDA = 004;
57 static const uint16_t kRLMP = 006;
58
59 static const uint16_t kProbeOff = kRLCS;
60 static const bool kProbeInt = true;
61 static const bool kProbeRem = true;
62
63 static const uint16_t kRLCS_M_ERR = kWBit15;
64 static const uint16_t kRLCS_M_DE = kWBit14;
65 static const uint16_t kRLCS_V_E = 10;
66 static const uint16_t kRLCS_B_E = 0017;
67 static const uint16_t kRLCS_V_DS = 8;
68 static const uint16_t kRLCS_B_DS = 0003;
69 static const uint16_t kRLCS_M_CRDY = kWBit07;
70 static const uint16_t kRLCS_M_IE = kWBit06;
71 static const uint16_t kRLCS_M_BAE = 000060;
72 static const uint16_t kRLCS_V_BAE = 4;
73 static const uint16_t kRLCS_B_BAE = 0003;
74 static const uint16_t kRLCS_V_FUNC = 1;
75 static const uint16_t kRLCS_B_FUNC = 0007;
76 static const uint16_t kRLCS_M_DRDY = kWBit00;
77
78 static const uint16_t kFUNC_NOOP = 0; // done in ibdr
79 static const uint16_t kFUNC_WCHK = 1;
80 static const uint16_t kFUNC_GS = 2; // done in ibdr
81 static const uint16_t kFUNC_SEEK = 3; // done in ibdr
82 static const uint16_t kFUNC_RHDR = 4;
83 static const uint16_t kFUNC_WRITE = 5;
84 static const uint16_t kFUNC_READ = 6;
85 static const uint16_t kFUNC_RNHC = 7;
86
87 static const uint16_t kERR_M_DE = kWBit04; // drive error flag
88 static const uint16_t kERR_OPI = 1; // OPI Operation Incomplete
89 static const uint16_t kERR_WCHK = 2; // Read Data CRC or Write Check
90 static const uint16_t kERR_HCRC = 3; // Header CRC
91 static const uint16_t kERR_DLATE = 4; // Data Late
92 static const uint16_t kERR_HNFND = 5; // Header not found
93 static const uint16_t kERR_NXM = 8; // Non-Existant Memory
94
95 // rem usage of rlcs
96 static const uint16_t kRLCS_V_MPREM = 11;
97 static const uint16_t kRLCS_B_MPREM = 0037;
98 static const uint16_t kRLCS_V_MPLOC = 8;
99 static const uint16_t kRLCS_B_MPLOC = 0007;
100 static const uint16_t kRLCS_ENA_MPREM = kWBit05;
101 static const uint16_t kRLCS_ENA_MPLOC = kWBit04;
102
103 static const uint16_t kRFUNC_WCS = 1;
104 static const uint16_t kRFUNC_WMP = 2;
105
106 static const uint16_t kMPREM_M_MAP = kWBit04;
107 static const uint16_t kMPREM_M_SEQ = kWBit03;
108 static const uint16_t kMPREM_S_MP = 0000; // MP+STA+POS sequence
109 static const uint16_t kMPREM_S_STA = 0001;
110 static const uint16_t kMPREM_S_POS = 0002;
111
112 static const uint16_t kMPREM_MP = 0003; // mem: mp
113 static const uint16_t kMPREM_CRC = 0004; // mem: crc
114 static const uint16_t kMPREM_STA = 0010; // mem: sta array (4 units)
115 static const uint16_t kMPREM_POS = 0014; // mem: pos array (4 units)
116
117 static const uint16_t kMPREM_SEQ_MPSTAPOS = kMPREM_M_MAP|
119
120 static const uint16_t kMPLOC_MP = 0000; // 000: return imem(mp)
121 static const uint16_t kMPLOC_STA = 0001; // 001: return sta(ds)
122 static const uint16_t kMPLOC_POS = 0002; // 010: return pos(ds) -> ZERO
123 static const uint16_t kMPLOC_ZERO = 0003; // 011: return 0 -> CRC
124 static const uint16_t kMPLOC_CRC = 0004; // 100: return imem(crc)
125
126 static const uint16_t kRLDA_SE_M_DF = 0177600;
127 static const uint16_t kRLDA_SE_V_DF = 7;
128 static const uint16_t kRLDA_SE_B_DF = 0777;
129 static const uint16_t kRLDA_SE_M_HS = kWBit04;
130 static const uint16_t kRLDA_SE_M_DIR = kWBit02;
131 static const uint16_t kRLDA_SE_X_MSK = 0000153;
132 static const uint16_t kRLDA_SE_X_VAL = 0000001;
133
134 static const uint16_t kRLDA_RW_M_CA = 0177600;
135 static const uint16_t kRLDA_RW_V_CA = 7;
136 static const uint16_t kRLDA_RW_B_CA = 0777;
137 static const uint16_t kRLDA_RW_M_HS = kWBit06;
138 static const uint16_t kRLDA_RW_V_HS = 6;
139 static const uint16_t kRLDA_RW_B_HS = 001;
140 static const uint16_t kRLDA_RW_B_SA = 077;
141
142 static const uint16_t kRLDA_GS_M_RST = kWBit03;
143 static const uint16_t kRLDA_GS_X_MSK = 0000367;
144 static const uint16_t kRLDA_GS_X_VAL = 0000003;
145
146 static const uint16_t kSTA_M_WDE = kWBit15; // Write data error - 0!
147 static const uint16_t kSTA_M_CHE = kWBit14; // Current head error - 0!
148 static const uint16_t kSTA_M_WL = kWBit13; // Write lock
149 static const uint16_t kSTA_M_STO = kWBit12; // Seek time out
150 static const uint16_t kSTA_M_SPE = kWBit11; // Spin error
151 static const uint16_t kSTA_M_WGE = kWBit10; // Write gate error
152 static const uint16_t kSTA_M_VCE = kWBit09; // Volume check
153 static const uint16_t kSTA_M_DSE = kWBit08; // Drive select error
154 static const uint16_t kSTA_M_DT = kWBit07; // Drive type 1=RL02
155 static const uint16_t kSTA_M_HS = kWBit06; // Head select
156 static const uint16_t kSTA_M_CO = kWBit05; // Cover open
157 static const uint16_t kSTA_M_HO = kWBit04; // Heads out
158 static const uint16_t kSTA_M_BH = kWBit03; // Brush home - 1!
159 static const uint16_t kSTA_B_ST = 0007; // Drive state
160
161 static const uint16_t kST_LOAD = 0; // Load(ing) cartidge - used
162 static const uint16_t kST_SPIN = 1; // Spin(ing) up - !unused!
163 static const uint16_t kST_BRUSH = 2; // Brush(ing) cycle - !unused!
164 static const uint16_t kST_HLOAD = 3; // Load(ing) heads - !unused!
165 static const uint16_t kST_SEEK = 4; // Seek(ing) - ?maybe?
166 static const uint16_t kST_LOCK = 5; // Lock(ed) on - used
167 static const uint16_t kST_UNL = 6; // Unload(ing) heads - !unused!
168 static const uint16_t kST_DOWN = 7; // Spin(ing) down - !unused!
169
170 // statistics counter indices
171 enum stats {
178 };
179
180 protected:
182 void RdmaPreExecCB(int stat, size_t nwdone, size_t nwnext,
183 RlinkCommandList& clist);
184 void RdmaPostExecCB(int stat, size_t ndone,
185 RlinkCommandList& clist, size_t ncmd);
186 void LogRler(uint16_t rlerr);
187 void AddSetStatus(RlinkCommandList& clist, size_t ind,
188 uint16_t sta);
189 void AddSetPosition(RlinkCommandList& clist, size_t ind,
190 uint16_t pos);
191 void AddErrorExit(RlinkCommandList& clist, uint16_t rlerr);
192 void AddNormalExit(RlinkCommandList& clist, size_t ndone,
193 uint16_t rlerr=0);
194 uint16_t CalcCrc(size_t size, const uint16_t* data);
195
196 protected:
197 size_t fPC_rlcs;
198 size_t fPC_rlba;
199 size_t fPC_rlda;
200 size_t fPC_imp;
201 size_t fPC_wc;
202 size_t fPC_sta;
203 size_t fPC_pos;
204
205 uint16_t fRd_rlcs;
206 uint16_t fRd_rlda;
207 uint16_t fRd_rlmp;
208 uint16_t fRd_sta;
209 uint16_t fRd_pos;
210 uint32_t fRd_addr;
211 uint32_t fRd_lba;
212 uint32_t fRd_nwrd;
213 uint16_t fRd_fu;
214 bool fRd_ovr;
216 };
217
218} // end namespace Retro
219
220#include "Rw11CntlRL11.ipp"
221
222#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 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 kWBit03
Definition: Rbits.hpp:35
static const uint16_t kWBit13
Definition: Rbits.hpp:45
static const uint16_t kWBit04
Definition: Rbits.hpp:36
static const uint16_t kWBit11
Definition: Rbits.hpp:43
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: Rstats.hpp:28
Implemenation (inline) of Rw11CntlBase.
static const uint16_t kMPREM_M_SEQ
uint16_t fRd_fu
Rdma: request fu code.
static const uint16_t kRLDA_SE_M_HS
static const uint16_t kMPLOC_STA
static const uint16_t kSTA_M_HO
uint16_t fRd_rlda
Rdma: request rlda.
static const bool kProbeRem
probr rem active
static const uint16_t kSTA_M_WL
static const uint16_t kMPREM_S_MP
bool fRd_ovr
Rdma: overrun condition found.
static const uint16_t kMPREM_SEQ_MPSTAPOS
~Rw11CntlRL11()
Destructor.
static const uint16_t kERR_HCRC
static const uint16_t kFUNC_READ
void RdmaPreExecCB(int stat, size_t nwdone, size_t nwnext, RlinkCommandList &clist)
FIXME_docs.
virtual bool BootCode(size_t unit, std::vector< uint16_t > &code, uint16_t &aload, uint16_t &astart)
FIXME_docs ????
size_t fPC_imp
PrimClist: imp index.
uint16_t fRd_rlcs
Rdma: request rlcs.
uint16_t fRd_rlmp
Rdma: request rlmp (~wc)
static const uint16_t kRLCS_M_CRDY
static const uint16_t kSTA_M_STO
void AddNormalExit(RlinkCommandList &clist, size_t ndone, uint16_t rlerr=0)
FIXME_docs.
static const uint16_t kRLDA_GS_X_VAL
static const uint16_t kRLDA_RW_B_CA
static const uint16_t kRLDA_SE_B_DF
Rw11RdmaDisk fRdma
Rdma controller.
static const uint16_t kRLCS_M_IE
static const uint16_t kIbaddr
RL11 default address.
static const uint16_t kMPREM_M_MAP
static const uint16_t kST_LOAD
static const int kLam
RL11 default lam.
static const uint16_t kRFUNC_WCS
static const uint16_t kERR_NXM
static const uint16_t kRLDA_RW_V_CA
size_t fPC_rlcs
PrimClist: rlcs index.
static const uint16_t kFUNC_WCHK
static const uint16_t kRLCS_M_BAE
static const uint16_t kRLCS_V_FUNC
static const uint16_t kProbeOff
probe address offset (rlcs)
uint16_t CalcCrc(size_t size, const uint16_t *data)
FIXME_docs.
static const uint16_t kMPREM_CRC
void LogRler(uint16_t rlerr)
FIXME_docs ????
static const uint16_t kRLCS_B_MPLOC
size_t fPC_pos
PrimClist: pos index.
void AddSetPosition(RlinkCommandList &clist, size_t ind, uint16_t pos)
FIXME_docs.
uint32_t fRd_addr
Rdma: current addr.
static const uint16_t kST_BRUSH
static const uint16_t kRLCS_ENA_MPLOC
static const uint16_t kRLDA_GS_X_MSK
static const uint16_t kMPREM_S_STA
void RdmaPostExecCB(int stat, size_t ndone, RlinkCommandList &clist, size_t ncmd)
FIXME_docs.
static const uint16_t kMPREM_S_POS
int AttnHandler(RlinkServer::AttnArgs &args)
FIXME_docs.
static const uint16_t kRLDA
RLDA reg offset.
static const uint16_t kSTA_M_HS
uint32_t fRd_lba
Rdma: current lba.
static const uint16_t kMPLOC_ZERO
static const uint16_t kRLDA_SE_M_DIR
size_t fPC_sta
PrimClist: sta index.
static const uint16_t kMPLOC_CRC
static const uint16_t kERR_WCHK
static const uint16_t kRLCS_ENA_MPREM
static const uint16_t kRLDA_RW_M_CA
void Config(const std::string &name, uint16_t base, int lam)
FIXME_docs.
void AddSetStatus(RlinkCommandList &clist, size_t ind, uint16_t sta)
FIXME_docs.
static const uint16_t kRLDA_RW_B_HS
static const uint16_t kRLBA
RLBA reg offset.
static const uint16_t kRLCS_M_DE
static const uint16_t kRLDA_SE_M_DF
static const uint16_t kST_SEEK
static const uint16_t kRLCS_B_E
static const uint16_t kSTA_M_VCE
static const bool kProbeInt
probe int active
static const uint16_t kSTA_M_CHE
uint16_t fRd_pos
Rdma: initial drive position.
static const uint16_t kFUNC_WRITE
static const uint16_t kSTA_M_DSE
static const uint16_t kERR_HNFND
static const uint16_t kST_DOWN
static const uint16_t kRLCS
RLCS reg offset.
static const uint16_t kFUNC_RNHC
static const uint16_t kRLCS_V_DS
static const uint16_t kERR_OPI
size_t fPC_rlba
PrimClist: rlba index.
static const uint16_t kRLCS_M_ERR
static const uint16_t kFUNC_RHDR
static const uint16_t kSTA_M_WDE
static const uint16_t kRLDA_SE_V_DF
static const uint16_t kRLDA_SE_X_MSK
Rw11CntlRL11()
Default constructor.
static const uint16_t kST_HLOAD
static const uint16_t kERR_M_DE
size_t fPC_wc
PrimClist: wc index.
static const uint16_t kRLDA_RW_V_HS
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
static const uint16_t kMPLOC_POS
static const uint16_t kSTA_B_ST
size_t fPC_rlda
PrimClist: rlda index.
static const uint16_t kSTA_M_WGE
static const uint16_t kMPLOC_MP
static const uint16_t kRLDA_GS_M_RST
static const uint16_t kSTA_M_SPE
static const uint16_t kRLCS_M_DRDY
static const uint16_t kRLCS_B_BAE
static const uint16_t kRLCS_B_FUNC
static const uint16_t kMPREM_POS
static const uint16_t kRLCS_V_MPREM
uint16_t fRd_sta
Rdma: initial drive status.
static const uint16_t kFUNC_GS
static const uint16_t kRLCS_V_BAE
static const uint16_t kRFUNC_WMP
static const uint16_t kMPREM_MP
Rstats & RdmaStats()
FIXME_docs.
static const uint16_t kRLDA_RW_B_SA
virtual void Start()
FIXME_docs.
static const uint16_t kRLCS_V_E
static const uint16_t kFUNC_SEEK
void SetChunkSize(size_t chunk)
FIXME_docs.
static const uint16_t kFUNC_NOOP
void AddErrorExit(RlinkCommandList &clist, uint16_t rlerr)
FIXME_docs.
static const uint16_t kRLDA_SE_X_VAL
static const uint16_t kST_LOCK
static const uint16_t kST_UNL
static const uint16_t kSTA_M_DT
static const uint16_t kST_SPIN
size_t ChunkSize() const
FIXME_docs.
static const uint16_t kRLMP
RLMP reg offset.
static const uint16_t kRLCS_V_MPLOC
static const uint16_t kMPREM_STA
uint32_t fRd_nwrd
Rdma: current nwrd.
static const uint16_t kSTA_M_BH
virtual void UnitSetup(size_t ind)
FIXME_docs.
static const uint16_t kRLCS_B_MPREM
static const uint16_t kRLDA_RW_M_HS
static const uint16_t kERR_DLATE
static const uint16_t kRLCS_B_DS
static const uint16_t kSTA_M_CO
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47