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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librw11/] [Rw11Cntl.cpp] - Rev 24

Compare with Previous | Blame | View Log

// $Id: Rw11Cntl.cpp 495 2013-03-06 17:13:48Z mueller $
//
// 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
// 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.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for complete details.
// 
// Revision History: 
// Date         Rev Version  Comment
// 2013-03-06   495   1.0    Initial version
// 2013-02-05   483   0.1    First draft
// ---------------------------------------------------------------------------
 
/*!
  \file
  \version $Id: Rw11Cntl.cpp 495 2013-03-06 17:13:48Z mueller $
  \brief   Implemenation of Rw11Cntl.
*/
 
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintf.hpp"
#include "librtools/Rexception.hpp"
 
#include "Rw11Cntl.hpp"
 
using namespace std;
 
/*!
  \class Retro::Rw11Cntl
  \brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Constructor
 
Rw11Cntl::Rw11Cntl(const std::string& type)
  : fpCpu(0),
    fType(type),
    fName(),
    fBase(0),
    fLam(-1),
    fEnable(true),
    fStarted(false),
    fProbe(),
    fTraceLevel(0),
    fPrimClist(),
    fStats()
{
  fStats.Define(kStatNAttnHdl,  "NAttnHdl",  "AttnHandler() calls");
  fStats.Define(kStatNPrimFused,"NPrimFused","PrimInfo fused with attn cmd");
  fStats.Define(kStatNAttnNoAct,"NAttnNoAct","AttnHandler() no action return");
}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
Rw11Cntl::~Rw11Cntl()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11Cntl::SetEnable(bool ena)
{
  if (fStarted)
    throw Rexception("Rw11Cntl::SetEnable", "only allowed before Start()");
  fEnable = ena;
  return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11Cntl::Probe()
{
  return Cpu().ProbeCntl(fProbe);
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11Cntl::Start()
{
  fStarted = true;
  return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11Cntl::BootCode(size_t unit, std::vector<uint16_t>& code, 
                        uint16_t& aload, uint16_t& astart)
{
  code.clear();
  aload  = 0;
  astart = 0;
  return false;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
std::string Rw11Cntl::UnitName(size_t index) const
{
  string name = fName;
  if (index > 9) name += char('0' + index/10);
  name += char('0' + index%10);
  return name;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11Cntl::Dump(std::ostream& os, int ind, const char* text) const
{
  RosFill bl(ind);
  os << bl << (text?text:"--") << "Rw11Cntl @ " << this << endl;
 
  os << bl << "  fpCpu:           " << fpCpu << endl;
  os << bl << "  fType:           " << fType << endl;
  os << bl << "  fName:           " << fName << endl;
  os << bl << "  fBase:           " << RosPrintf(fBase,"o0",6) << endl;
  os << bl << "  fLam:            " << fLam << endl;
  os << bl << "  fEnable:         " << fEnable << endl;
  os << bl << "  fStarted:        " << fStarted << endl;
  fProbe.Dump(os, ind+2, "fProbe: ");
  os << bl << "  fTraceLevel:     " << fTraceLevel << endl;
  fPrimClist.Dump(os, ind+2, "fPrimClist: ");
  fStats.Dump(os, ind+2, "fStats: ");
  return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11Cntl::ConfigCntl(const std::string& name, uint16_t base, int lam,
                          uint16_t probeoff, bool probeint, bool proberem)
{
  fName = name;
  fBase = base;
  fLam  = lam;
  fProbe.fAddr     = base + probeoff;
  fProbe.fProbeInt = probeint;
  fProbe.fProbeRem = proberem;
  return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11Cntl::GetPrimInfo(const RlinkServer::AttnArgs& args,
                           RlinkCommandList*& pclist, size_t& offset)
{
  fStats.Inc(kStatNAttnHdl);
 
  if (args.fpClist) {
    fStats.Inc(kStatNPrimFused);
    pclist = args.fpClist;
    offset = args.fOffset;
 
  } else {
    Server().Exec(fPrimClist);
    // FIXME_code: handle errors
    pclist = &fPrimClist;
    offset = 0;
  }
 
  return;
}
 
 
} // end namespace Retro
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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