w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rw11UnitRHRP.cpp
Go to the documentation of this file.
1// $Id: Rw11UnitRHRP.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2018-12-09 1080 1.0.2 use HasVirt(); Virt() returns ref
8// 2017-04-07 868 1.0.1 Dump(): add detail arg
9// 2015-05-14 680 1.0 Initial version
10// 2015-03-21 659 0.1 First draft
11// ---------------------------------------------------------------------------
12
18#include "librtools/RosFill.hpp"
19#include "Rw11CntlRHRP.hpp"
20
21#include "Rw11UnitRHRP.hpp"
22
23using namespace std;
24
30// all method definitions in namespace Retro
31namespace Retro {
32
33//------------------------------------------+-----------------------------------
34// constants definitions
35
36const uint16_t Rw11UnitRHRP::kDTE_M_RM;
37const uint16_t Rw11UnitRHRP::kDTE_RP04;
38const uint16_t Rw11UnitRHRP::kDTE_RP06;
39const uint16_t Rw11UnitRHRP::kDTE_RM03;
40const uint16_t Rw11UnitRHRP::kDTE_RM80;
41const uint16_t Rw11UnitRHRP::kDTE_RM05;
42const uint16_t Rw11UnitRHRP::kDTE_RP07;
43
44//------------------------------------------+-----------------------------------
46
48 : Rw11UnitDiskBase<Rw11CntlRHRP>(pcntl, index),
49 fRpdt(0),
50 fRpds(0)
51{
52 // setup disk geometry: default off
53 fType = "off";
54 fEnabled = false;
55 fBlksize = 512;
56}
57
58//------------------------------------------+-----------------------------------
60
62{}
63
64//------------------------------------------+-----------------------------------
66
67void Rw11UnitRHRP::SetType(const std::string& type)
68{
69 if (HasVirt()) {
70 throw Rexception("Rw11UnitRHRP::SetType",
71 string("Bad state: file attached"));
72 }
73
74 if (type == "off") {
75 fRpdt = 0;
76 fNCyl = 0;
77 fNHead = 0;
78 fNSect = 0;
79 } else if (type == "rp04") {
81 fNCyl = 411;
82 fNHead = 19;
83 fNSect = 22;
84 } else if (type == "rp06") {
86 fNCyl = 815;
87 fNHead = 19;
88 fNSect = 22;
89 } else if (type == "rm03") {
91 fNCyl = 823;
92 fNHead = 5;
93 fNSect = 32;
94 } else if (type == "rm80") {
96 fNCyl = 559;
97 fNHead = 14;
98 fNSect = 31;
99 } else if (type == "rm05") {
101 fNCyl = 823;
102 fNHead = 19;
103 fNSect = 32;
104 } else if (type == "rp07") {
106 fNCyl = 630;
107 fNHead = 32;
108 fNSect = 50;
109 } else {
110 throw Rexception("Rw11UnitRHRP::SetType",
111 string("Bad args: only off or rp04,rp06,rm03,rm80,rm05,rp07 supported"));
112 }
113
114 fType = type;
115 fEnabled = fNCyl != 0;
117
118 Cntl().UnitSetup(Index()); // update hardware
119
120 return;
121}
122
123//------------------------------------------+-----------------------------------
125
126void Rw11UnitRHRP::Dump(std::ostream& os, int ind, const char* text,
127 int detail) const
128{
129 RosFill bl(ind);
130 os << bl << (text?text:"--") << "Rw11UnitRHRP @ " << this << endl;
131 os << bl << " fRpdt: " << RosPrintf(fRpdt,"o",6) << endl;
132 os << bl << " fRpds: " << RosPrintf(fRpds,"o",6) << endl;
133
134 Rw11UnitDiskBase<Rw11CntlRHRP>::Dump(os, ind, " ^", detail);
135 return;
136}
137
138} // end namespace Retro
FIXME_docs.
Definition: Rexception.hpp:29
I/O appicator to generate fill characters.
Definition: RosFill.hpp:24
virtual void UnitSetup(size_t ind)
FIXME_docs.
Implemenation (inline) of Rw11UnitDiskBase.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
Rw11CntlRHRP & Cntl() const
FIXME_docs.
size_t fBlksize
block size (in bytes)
bool fEnabled
unit enabled
std::string fType
drive type
uint16_t fRpds
drive status
Rw11UnitRHRP(Rw11CntlRHRP *pcntl, size_t index)
Constructor.
static const uint16_t kDTE_RM03
drive type of RM03 rm=1
~Rw11UnitRHRP()
Destructor.
static const uint16_t kDTE_RP06
drive type of RP06 rm=0
static const uint16_t kDTE_RM80
drive type of RM80 rm=1
static const uint16_t kDTE_RM05
drive type of RM05 rm=1
static const uint16_t kDTE_RP07
drive type of RP07 rm=1
static const uint16_t kDTE_RP04
drive type of RP04 rm=0
virtual void SetType(const std::string &type)
FIXME_docs.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
static const uint16_t kDTE_M_RM
rm type flag
uint16_t fRpdt
drive type (encoded)
bool HasVirt() const
FIXME_docs.
size_t Index() const
FIXME_docs.
Definition: Rw11Unit.ipp:23
RosPrintfS< bool > RosPrintf(bool value, const char *form=0, int width=0, int prec=0)
Creates a print object for the formatted output of a bool value.
Definition: RosPrintf.ipp:38
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47