// $Id: Rw11UnitDisk.cpp 509 2013-04-21 20:46:20Z mueller $
|
// $Id: Rw11UnitDisk.cpp 509 2013-04-21 20:46:20Z mueller $
|
//
|
//
|
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
//
|
//
|
// This program is free software; you may redistribute and/or modify it under
|
// This program is free software; you may redistribute and/or modify it under
|
// the terms of the GNU General Public License as published by the Free
|
// the terms of the GNU General Public License as published by the Free
|
// Software Foundation, either version 2, or at your option any later version.
|
// Software Foundation, either version 2, or at your option any later version.
|
//
|
//
|
// This program is distributed in the hope that it will be useful, but
|
// This program is distributed in the hope that it will be useful, but
|
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for complete details.
|
// for complete details.
|
//
|
//
|
// Revision History:
|
// Revision History:
|
// Date Rev Version Comment
|
// Date Rev Version Comment
|
// 2013-04-19 507 1.0 Initial version
|
// 2013-04-19 507 1.0 Initial version
|
// 2013-02-19 490 0.1 First draft
|
// 2013-02-19 490 0.1 First draft
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: Rw11UnitDisk.cpp 509 2013-04-21 20:46:20Z mueller $
|
\version $Id: Rw11UnitDisk.cpp 509 2013-04-21 20:46:20Z mueller $
|
\brief Implemenation of Rw11UnitDisk.
|
\brief Implemenation of Rw11UnitDisk.
|
*/
|
*/
|
|
|
#include "librtools/Rexception.hpp"
|
#include "librtools/Rexception.hpp"
|
|
|
#include "Rw11UnitDisk.hpp"
|
#include "Rw11UnitDisk.hpp"
|
|
|
using namespace std;
|
using namespace std;
|
|
|
/*!
|
/*!
|
\class Retro::Rw11UnitDisk
|
\class Retro::Rw11UnitDisk
|
\brief FIXME_docs
|
\brief FIXME_docs
|
*/
|
*/
|
|
|
// all method definitions in namespace Retro
|
// all method definitions in namespace Retro
|
namespace Retro {
|
namespace Retro {
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! Constructor
|
//! Constructor
|
|
|
Rw11UnitDisk::Rw11UnitDisk(Rw11Cntl* pcntl, size_t index)
|
Rw11UnitDisk::Rw11UnitDisk(Rw11Cntl* pcntl, size_t index)
|
: Rw11UnitVirt<Rw11VirtDisk>(pcntl, index),
|
: Rw11UnitVirt<Rw11VirtDisk>(pcntl, index),
|
fType(),
|
fType(),
|
fNCyl(0),
|
fNCyl(0),
|
fNHead(0),
|
fNHead(0),
|
fNSect(0),
|
fNSect(0),
|
fBlksize(0),
|
fBlksize(0),
|
fNBlock(),
|
fNBlock(),
|
fWProt(false)
|
fWProt(false)
|
{}
|
{}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! Destructor
|
//! Destructor
|
|
|
Rw11UnitDisk::~Rw11UnitDisk()
|
Rw11UnitDisk::~Rw11UnitDisk()
|
{}
|
{}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
void Rw11UnitDisk::SetType(const std::string& type)
|
void Rw11UnitDisk::SetType(const std::string& type)
|
{
|
{
|
throw Rexception("Rw11UnitDisk::<ctor>",
|
throw Rexception("Rw11UnitDisk::<ctor>",
|
string("Bad args: only type '") + fType + "' supported");
|
string("Bad args: only type '") + fType + "' supported");
|
return;
|
return;
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
bool Rw11UnitDisk::VirtRead(size_t lba, size_t nblk, uint8_t* data,
|
bool Rw11UnitDisk::VirtRead(size_t lba, size_t nblk, uint8_t* data,
|
RerrMsg& emsg)
|
RerrMsg& emsg)
|
{
|
{
|
if (!Virt()) {
|
if (!Virt()) {
|
emsg.Init("Rw11UnitDisk::VirtRead", "no disk attached");
|
emsg.Init("Rw11UnitDisk::VirtRead", "no disk attached");
|
return false;
|
return false;
|
}
|
}
|
return Virt()->Read(lba, nblk, data, emsg);
|
return Virt()->Read(lba, nblk, data, emsg);
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
bool Rw11UnitDisk::VirtWrite(size_t lba, size_t nblk, const uint8_t* data,
|
bool Rw11UnitDisk::VirtWrite(size_t lba, size_t nblk, const uint8_t* data,
|
RerrMsg& emsg)
|
RerrMsg& emsg)
|
{
|
{
|
if (!Virt()) {
|
if (!Virt()) {
|
emsg.Init("Rw11UnitDisk::VirtWrite", "no disk attached");
|
emsg.Init("Rw11UnitDisk::VirtWrite", "no disk attached");
|
return false;
|
return false;
|
}
|
}
|
return Virt()->Write(lba, nblk, data, emsg);
|
return Virt()->Write(lba, nblk, data, emsg);
|
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
void Rw11UnitDisk::Dump(std::ostream& os, int ind, const char* text) const
|
void Rw11UnitDisk::Dump(std::ostream& os, int ind, const char* text) const
|
{
|
{
|
RosFill bl(ind);
|
RosFill bl(ind);
|
os << bl << (text?text:"--") << "Rw11UnitDisk @ " << this << endl;
|
os << bl << (text?text:"--") << "Rw11UnitDisk @ " << this << endl;
|
os << bl << " fType: " << fType << endl;
|
os << bl << " fType: " << fType << endl;
|
os << bl << " fNCyl: " << fNCyl << endl;
|
os << bl << " fNCyl: " << fNCyl << endl;
|
os << bl << " fNHead: " << fNHead << endl;
|
os << bl << " fNHead: " << fNHead << endl;
|
os << bl << " fNSect: " << fNSect << endl;
|
os << bl << " fNSect: " << fNSect << endl;
|
os << bl << " fBlksize: " << fBlksize << endl;
|
os << bl << " fBlksize: " << fBlksize << endl;
|
os << bl << " fNBlock: " << fNBlock << endl;
|
os << bl << " fNBlock: " << fNBlock << endl;
|
os << bl << " fWProt: " << fWProt << endl;
|
os << bl << " fWProt: " << fWProt << endl;
|
|
|
Rw11UnitVirt<Rw11VirtDisk>::Dump(os, ind, " ^");
|
Rw11UnitVirt<Rw11VirtDisk>::Dump(os, ind, " ^");
|
return;
|
return;
|
}
|
}
|
|
|
|
|
} // end namespace Retro
|
} // end namespace Retro
|
|
|