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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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