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

Subversion Repositories w11

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

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

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

powered by: WebSVN 2.1.0

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