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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 wfjm
// $Id: Rw11UnitDisk.cpp 659 2015-03-22 23:15:51Z mueller $
2 20 wfjm
//
3
// Copyright 2013- 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 30 wfjm
// 2015-03-21   659   1.0.1  add fEnabled, Enabled()
17 20 wfjm
// 2013-04-19   507   1.0    Initial version
18
// 2013-02-19   490   0.1    First draft
19
// ---------------------------------------------------------------------------
20
 
21
/*!
22
  \file
23 30 wfjm
  \version $Id: Rw11UnitDisk.cpp 659 2015-03-22 23:15:51Z mueller $
24 20 wfjm
  \brief   Implemenation of Rw11UnitDisk.
25
*/
26
 
27
#include "librtools/Rexception.hpp"
28
 
29
#include "Rw11UnitDisk.hpp"
30
 
31
using namespace std;
32
 
33
/*!
34
  \class Retro::Rw11UnitDisk
35
  \brief FIXME_docs
36
*/
37
 
38
// all method definitions in namespace Retro
39
namespace Retro {
40
 
41
//------------------------------------------+-----------------------------------
42
//! Constructor
43
 
44
Rw11UnitDisk::Rw11UnitDisk(Rw11Cntl* pcntl, size_t index)
45
  : Rw11UnitVirt<Rw11VirtDisk>(pcntl, index),
46
    fType(),
47 30 wfjm
    fEnabled(false),
48 20 wfjm
    fNCyl(0),
49
    fNHead(0),
50
    fNSect(0),
51
    fBlksize(0),
52
    fNBlock(),
53
    fWProt(false)
54
{}
55
 
56
//------------------------------------------+-----------------------------------
57
//! Destructor
58
 
59
Rw11UnitDisk::~Rw11UnitDisk()
60
{}
61
 
62
//------------------------------------------+-----------------------------------
63
//! FIXME_docs
64
 
65
void Rw11UnitDisk::SetType(const std::string& type)
66
{
67 25 wfjm
  throw Rexception("Rw11UnitDisk::SetType",
68 20 wfjm
                   string("Bad args: only type '") + fType + "' supported");
69
  return;
70
}
71
 
72
//------------------------------------------+-----------------------------------
73
//! FIXME_docs
74
 
75
bool Rw11UnitDisk::VirtRead(size_t lba, size_t nblk, uint8_t* data,
76
                            RerrMsg& emsg)
77
{
78
  if (!Virt()) {
79
    emsg.Init("Rw11UnitDisk::VirtRead", "no disk attached");
80
    return false;
81
  }
82
  return Virt()->Read(lba, nblk, data, emsg);
83
}
84
 
85
//------------------------------------------+-----------------------------------
86
//! FIXME_docs
87
 
88
bool Rw11UnitDisk::VirtWrite(size_t lba, size_t nblk, const uint8_t* data,
89
                             RerrMsg& emsg)
90
{
91
  if (!Virt()) {
92
    emsg.Init("Rw11UnitDisk::VirtWrite", "no disk attached");
93
    return false;
94
  }
95
  return Virt()->Write(lba, nblk, data, emsg);
96
}
97
 
98
//------------------------------------------+-----------------------------------
99
//! FIXME_docs
100
 
101
void Rw11UnitDisk::Dump(std::ostream& os, int ind, const char* text) const
102
{
103
  RosFill bl(ind);
104
  os << bl << (text?text:"--") << "Rw11UnitDisk @ " << this << endl;
105
  os << bl << "  fType:           " << fType  << endl;
106 30 wfjm
  os << bl << "  fEnabled:        " << fEnabled << endl;
107 20 wfjm
  os << bl << "  fNCyl:           " << fNCyl  << endl;
108
  os << bl << "  fNHead:          " << fNHead << endl;
109
  os << bl << "  fNSect:          " << fNSect << endl;
110
  os << bl << "  fBlksize:        " << fBlksize << endl;
111
  os << bl << "  fNBlock:         " << fNBlock  << endl;
112
  os << bl << "  fWProt:          " << fWProt << endl;
113
 
114
  Rw11UnitVirt<Rw11VirtDisk>::Dump(os, ind, " ^");
115
  return;
116
}
117
 
118
 
119
} // end namespace Retro

powered by: WebSVN 2.1.0

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