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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librw11/] [Rw11UnitRHRP.cpp] - Blame information for rev 36

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

Line No. Rev Author Line
1 30 wfjm
// $Id: Rw11UnitRHRP.cpp 680 2015-05-14 13:29:46Z mueller $
2
//
3
// Copyright 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-05-14   680   1.0    Initial version
17
// 2015-03-21   659   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id: Rw11UnitRHRP.cpp 680 2015-05-14 13:29:46Z mueller $
23
  \brief   Implemenation of Rw11UnitRHRP.
24
*/
25
 
26
#include "boost/bind.hpp"
27
 
28
#include "librtools/Rexception.hpp"
29
#include "librtools/RosFill.hpp"
30
#include "Rw11CntlRHRP.hpp"
31
 
32
#include "Rw11UnitRHRP.hpp"
33
 
34
using namespace std;
35
 
36
/*!
37
  \class Retro::Rw11UnitRHRP
38
  \brief FIXME_docs
39
*/
40
 
41
// all method definitions in namespace Retro
42
namespace Retro {
43
 
44
//------------------------------------------+-----------------------------------
45
// constants definitions
46
 
47
const uint16_t Rw11UnitRHRP::kDTE_M_RM;
48
const uint16_t Rw11UnitRHRP::kDTE_RP04;
49
const uint16_t Rw11UnitRHRP::kDTE_RP06;
50
const uint16_t Rw11UnitRHRP::kDTE_RM03;
51
const uint16_t Rw11UnitRHRP::kDTE_RM80;
52
const uint16_t Rw11UnitRHRP::kDTE_RM05;
53
const uint16_t Rw11UnitRHRP::kDTE_RP07;
54
 
55
//------------------------------------------+-----------------------------------
56
//! Constructor
57
 
58
Rw11UnitRHRP::Rw11UnitRHRP(Rw11CntlRHRP* pcntl, size_t index)
59
  : Rw11UnitDiskBase<Rw11CntlRHRP>(pcntl, index),
60
    fRpdt(0),
61
    fRpds(0)
62
{
63
  // setup disk geometry: default off
64
  fType    = "off";
65
  fEnabled = false;
66
  fBlksize = 512;
67
}
68
 
69
//------------------------------------------+-----------------------------------
70
//! Destructor
71
 
72
Rw11UnitRHRP::~Rw11UnitRHRP()
73
{}
74
 
75
//------------------------------------------+-----------------------------------
76
//! FIXME_docs
77
 
78
void Rw11UnitRHRP::SetType(const std::string& type)
79
{
80
  if (Virt()) {
81
    throw Rexception("Rw11UnitRHRP::SetType",
82
                     string("Bad state: file attached"));
83
  }
84
 
85
  if (type == "off") {
86
    fRpdt    =   0;
87
    fNCyl    =   0;
88
    fNHead   =   0;
89
    fNSect   =   0;
90
  } else if (type == "rp04") {
91
    fRpdt    = kDTE_RP04;
92
    fNCyl    = 411;
93
    fNHead   =  19;
94
    fNSect   =  22;
95
  } else if (type == "rp06") {
96
    fRpdt    = kDTE_RP06;
97
    fNCyl    = 815;
98
    fNHead   =  19;
99
    fNSect   =  22;
100
  } else if (type == "rm03") {
101
    fRpdt    = kDTE_RM03;
102
    fNCyl    = 823;
103
    fNHead   =   5;
104
    fNSect   =  32;
105
  } else if (type == "rm80") {
106
    fRpdt    = kDTE_RM80;
107
    fNCyl    = 559;
108
    fNHead   =  14;
109
    fNSect   =  31;
110
  } else if (type == "rm05") {
111
    fRpdt    = kDTE_RM05;
112
    fNCyl    = 823;
113
    fNHead   =  19;
114
    fNSect   =  32;
115
  } else if (type == "rp07") {
116
    fRpdt    = kDTE_RP07;
117
    fNCyl    = 630;
118
    fNHead   =  32;
119
    fNSect   =  50;
120
  } else {
121
    throw Rexception("Rw11UnitRHRP::SetType",
122
      string("Bad args: only off or rp04,rp06,rm03,rm80,rm05,rp07 supported"));
123
  }
124
 
125
  fType    = type;
126
  fEnabled = fNCyl != 0;
127
  fNBlock  = fNCyl*fNHead*fNSect;
128
 
129
  Cntl().UnitSetup(Index());                // update hardware
130
 
131
  return;
132
}
133
 
134
//------------------------------------------+-----------------------------------
135
//! FIXME_docs
136
 
137
void Rw11UnitRHRP::Dump(std::ostream& os, int ind, const char* text) const
138
{
139
  RosFill bl(ind);
140
  os << bl << (text?text:"--") << "Rw11UnitRHRP @ " << this << endl;
141
  os << bl << "  fRpdt:           " << RosPrintf(fRpdt,"o",6)   << endl;
142
  os << bl << "  fRpds:           " << RosPrintf(fRpds,"o",6)   << endl;
143
 
144
  Rw11UnitDiskBase<Rw11CntlRHRP>::Dump(os, ind, " ^");
145
  return;
146
}
147
 
148
} // end namespace Retro

powered by: WebSVN 2.1.0

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