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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librw11/] [Rw11CntlRK11.hpp] - Blame information for rev 31

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

Line No. Rev Author Line
1 31 wfjm
// $Id: Rw11CntlRK11.hpp 686 2015-06-04 21:08:08Z mueller $
2 20 wfjm
//
3 28 wfjm
// Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 20 wfjm
//
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 28 wfjm
// 2015-01-03   627   2.0    use Rw11RdmaDisk
17
// 2014-12-29   623   1.1    adopt to Rlink V4 attn logic
18 25 wfjm
// 2014-06-14   562   1.0.1  Add stats definitions
19 20 wfjm
// 2013-04-20   508   1.0    Initial version
20
// 2013-02-10   485   0.1    First draft
21
// ---------------------------------------------------------------------------
22
 
23
 
24
/*!
25
  \file
26 31 wfjm
  \version $Id: Rw11CntlRK11.hpp 686 2015-06-04 21:08:08Z mueller $
27 20 wfjm
  \brief   Declaration of class Rw11CntlRK11.
28
*/
29
 
30
#ifndef included_Retro_Rw11CntlRK11
31
#define included_Retro_Rw11CntlRK11 1
32
 
33
#include "Rw11CntlBase.hpp"
34
#include "Rw11UnitRK11.hpp"
35 28 wfjm
#include "Rw11RdmaDisk.hpp"
36 20 wfjm
 
37
namespace Retro {
38
 
39
  class Rw11CntlRK11 : public Rw11CntlBase<Rw11UnitRK11,8> {
40
    public:
41
 
42
                    Rw11CntlRK11();
43
                   ~Rw11CntlRK11();
44
 
45
      void          Config(const std::string& name, uint16_t base, int lam);
46
 
47
      virtual void  Start();
48
 
49
      virtual bool  BootCode(size_t unit, std::vector<uint16_t>& code,
50
                             uint16_t& aload, uint16_t& astart);
51
 
52
      virtual void  UnitSetup(size_t ind);
53
 
54 28 wfjm
      void          SetChunkSize(size_t chunk);
55
      size_t        ChunkSize() const;
56
 
57
      const Rstats& RdmaStats() const;
58
 
59 20 wfjm
      virtual void  Dump(std::ostream& os, int ind=0, const char* text=0) const;
60
 
61
    // some constants (also defined in cpp)
62
      static const uint16_t kIbaddr = 0177400; //!< RK11 default address
63
      static const int      kLam    = 4;       //!< RK11 default lam
64
 
65 30 wfjm
      static const uint16_t kRKDS = 000; //!< RKDS reg offset
66
      static const uint16_t kRKER = 002; //!< RKER reg offset
67
      static const uint16_t kRKCS = 004; //!< RKCS reg offset
68
      static const uint16_t kRKWC = 006; //!< RKWC reg offset
69
      static const uint16_t kRKBA = 010; //!< RKBA reg offset
70
      static const uint16_t kRKDA = 012; //!< RKDA reg offset
71
      static const uint16_t kRKMR = 014; //!< RKMR reg offset
72 20 wfjm
 
73
      static const uint16_t kProbeOff = kRKCS; //!< probe address offset (rkcs)
74
      static const bool     kProbeInt = true;  //!< probe int active
75
      static const bool     kProbeRem = true;  //!< probr rem active
76
 
77
      static const uint16_t kRKDS_M_ID   = 0160000; //!< ID: drive number
78
      static const uint16_t kRKDS_V_ID   = 13;
79
      static const uint16_t kRKDS_B_ID   = 0007;
80
      static const uint16_t kRKDS_M_HDEN = kWBit11; //!< HDEN: high density drv
81
      static const uint16_t kRKDS_M_DRU  = kWBit10; //!< DRU: drive unsafe
82
      static const uint16_t kRKDS_M_SIN  = kWBit09; //!< SIN: seek incomplete
83
      static const uint16_t kRKDS_M_SOK  = kWBit08; //!< SOK: sector counter OK
84
      static const uint16_t kRKDS_M_DRY  = kWBit07; //!< DRY: drive ready
85
      static const uint16_t kRKDS_M_ADRY = kWBit06; //!< ADRY: access ready
86
      static const uint16_t kRKDS_M_WPS  = kWBit05; //!< WPS: write protect
87
      static const uint16_t kRKDS_B_SC   = 0017;    //!< SC: sector counter
88
 
89
      static const uint16_t kRKER_M_DRE  = kWBit15;
90
      static const uint16_t kRKER_M_OVR  = kWBit14;
91
      static const uint16_t kRKER_M_WLO  = kWBit13;
92
      static const uint16_t kRKER_M_PGE  = kWBit11;
93
      static const uint16_t kRKER_M_NXM  = kWBit10;
94
      static const uint16_t kRKER_M_NXD  = kWBit07;
95
      static const uint16_t kRKER_M_NXC  = kWBit06;
96
      static const uint16_t kRKER_M_NXS  = kWBit05;
97
      static const uint16_t kRKER_M_CSE  = kWBit01;
98
      static const uint16_t kRKER_M_WCE  = kWBit00;
99
 
100
      static const uint16_t kRKCS_M_MAINT= kWBit12;
101
      static const uint16_t kRKCS_M_IBA  = kWBit11;
102
      static const uint16_t kRKCS_M_FMT  = kWBit10;
103
      static const uint16_t kRKCS_M_RWA  = kWBit09;
104
      static const uint16_t kRKCS_M_SSE  = kWBit08;
105 31 wfjm
      static const uint16_t kRKCS_M_RDY  = kWBit07;
106 20 wfjm
      static const uint16_t kRKCS_M_MEX  = 000060;
107
      static const uint16_t kRKCS_V_MEX  = 4;
108
      static const uint16_t kRKCS_B_MEX  = 0003;
109
      static const uint16_t kRKCS_V_FUNC = 1;
110
      static const uint16_t kRKCS_B_FUNC = 0007;
111
      static const uint16_t kRKCS_M_GO   = kWBit00;
112
 
113 29 wfjm
      static const uint16_t kFUNC_CRESET = 0;
114
      static const uint16_t kFUNC_WRITE  = 1;
115
      static const uint16_t kFUNC_READ   = 2;
116
      static const uint16_t kFUNC_WCHK   = 3;
117
      static const uint16_t kFUNC_SEEK   = 4;
118
      static const uint16_t kFUNC_RCHK   = 5;
119
      static const uint16_t kFUNC_DRESET = 6;
120
      static const uint16_t kFUNC_WLOCK  = 7;
121
 
122 20 wfjm
      static const uint16_t kRKDA_M_DRSEL= 0160000;
123
      static const uint16_t kRKDA_V_DRSEL= 13;
124
      static const uint16_t kRKDA_B_DRSEL= 0007;
125
      static const uint16_t kRKDA_M_CYL  = 0017740;
126
      static const uint16_t kRKDA_V_CYL  =  5;
127
      static const uint16_t kRKDA_B_CYL  = 0377;
128
      static const uint16_t kRKDA_M_SUR  = 0000020;
129
      static const uint16_t kRKDA_V_SUR  =  4;
130
      static const uint16_t kRKDA_B_SUR  = 0001;
131
      static const uint16_t kRKDA_B_SC   = 0017;
132
 
133
      static const uint16_t kRKMR_M_RID  = 0160000;
134
      static const uint16_t kRKMR_V_RID  = 13;
135
      static const uint16_t kRKMR_M_CRDONE= kWBit11;
136
      static const uint16_t kRKMR_M_SBCLR = kWBit10;
137
      static const uint16_t kRKMR_M_CRESET= kWBit09;
138
      static const uint16_t kRKMR_M_FDONE = kWBit08;
139
 
140 25 wfjm
    // statistics counter indices
141
      enum stats {
142 28 wfjm
        kStatNFuncCreset = Rw11Cntl::kDimStat, //!< func CRESET
143
        kStatNFuncWrite,                    //!< func WRITE
144
        kStatNFuncRead,                     //!< func READ
145
        kStatNFuncWchk,                     //!< func WCHK
146
        kStatNFuncSeek,                     //!< func SEEK
147
        kStatNFuncRchk,                     //!< func RCHK
148
        kStatNFuncDreset,                   //!< func DRESET
149
        kStatNFuncWlock,                    //!< func WLOCK
150 25 wfjm
        kDimStat
151
      };
152
 
153 20 wfjm
    protected:
154 28 wfjm
      int           AttnHandler(RlinkServer::AttnArgs& args);
155 29 wfjm
      void          RdmaPreExecCB(int stat, size_t nwdone, size_t nwnext,
156 28 wfjm
                                  RlinkCommandList& clist);
157
      void          RdmaPostExecCB(int stat, size_t ndone,
158
                                   RlinkCommandList& clist, size_t ncmd);
159 20 wfjm
      void          LogRker(uint16_t rker);
160 28 wfjm
      void          AddErrorExit(RlinkCommandList& clist, uint16_t rker);
161
      void          AddNormalExit(RlinkCommandList& clist, size_t ndone,
162
                                  uint16_t rker=0);
163
 
164 20 wfjm
    protected:
165
      size_t        fPC_rkwc;               //!< PrimClist: rkwc index
166
      size_t        fPC_rkba;               //!< PrimClist: rkba index
167
      size_t        fPC_rkda;               //!< PrimClist: rkda index
168
      size_t        fPC_rkmr;               //!< PrimClist: rkmr index
169
      size_t        fPC_rkcs;               //!< PrimClist: rkcs index
170
 
171
      uint16_t      fRd_rkcs;               //!< Rdma: request rkcs
172
      uint16_t      fRd_rkda;               //!< Rdma: request rkda
173
      uint32_t      fRd_addr;               //!< Rdma: current addr
174
      uint32_t      fRd_lba;                //!< Rdma: current lba
175
      uint32_t      fRd_nwrd;               //!< Rdma: current nwrd
176 28 wfjm
      uint16_t      fRd_fu;                 //!< Rdma: request fu code
177 20 wfjm
      bool          fRd_ovr;                //!< Rdma: overrun condition found
178 28 wfjm
      Rw11RdmaDisk  fRdma;                  //!< Rdma controller
179 20 wfjm
  };
180
 
181
} // end namespace Retro
182
 
183 28 wfjm
#include "Rw11CntlRK11.ipp"
184 20 wfjm
 
185
#endif

powered by: WebSVN 2.1.0

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