Line 1... |
Line 1... |
// $Id: Rw11CntlLP11.cpp 515 2013-05-04 17:28:59Z mueller $
|
// $Id: Rw11CntlLP11.cpp 625 2014-12-30 16:17:45Z mueller $
|
//
|
//
|
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2013-2014 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.
|
//
|
//
|
Line 11... |
Line 11... |
// 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
|
|
// 2014-12-30 625 1.2 adopt to Rlink V4 attn logic
|
|
// 2014-12-25 621 1.1 adopt to 4k word ibus window
|
// 2013-05-04 515 1.0 Initial version
|
// 2013-05-04 515 1.0 Initial version
|
// 2013-05-01 513 0.1 First draft
|
// 2013-05-01 513 0.1 First draft
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: Rw11CntlLP11.cpp 515 2013-05-04 17:28:59Z mueller $
|
\version $Id: Rw11CntlLP11.cpp 625 2014-12-30 16:17:45Z mueller $
|
\brief Implemenation of Rw11CntlLP11.
|
\brief Implemenation of Rw11CntlLP11.
|
*/
|
*/
|
|
|
#include "boost/bind.hpp"
|
#include "boost/bind.hpp"
|
|
|
Line 65... |
Line 67... |
|
|
Rw11CntlLP11::Rw11CntlLP11()
|
Rw11CntlLP11::Rw11CntlLP11()
|
: Rw11CntlBase<Rw11UnitLP11,1>("lp11"),
|
: Rw11CntlBase<Rw11UnitLP11,1>("lp11"),
|
fPC_buf(0)
|
fPC_buf(0)
|
{
|
{
|
// must here because Unit have a back-pointer (not available at Rw11CntlBase)
|
// must be here because Units have a back-ptr (not available at Rw11CntlBase)
|
for (size_t i=0; i<NUnit(); i++) {
|
for (size_t i=0; i<NUnit(); i++) {
|
fspUnit[i].reset(new Rw11UnitLP11(this, i));
|
fspUnit[i].reset(new Rw11UnitLP11(this, i));
|
}
|
}
|
}
|
}
|
|
|
Line 95... |
Line 97... |
{
|
{
|
if (fStarted || fLam<0 || !fEnable || !fProbe.Found())
|
if (fStarted || fLam<0 || !fEnable || !fProbe.Found())
|
throw Rexception("Rw11CntlLP11::Start",
|
throw Rexception("Rw11CntlLP11::Start",
|
"Bad state: started, no lam, not enable, not found");
|
"Bad state: started, no lam, not enable, not found");
|
|
|
|
// add device register address ibus and rbus mappings
|
|
// done here because now Cntl bound to Cpu and Cntl probed
|
|
Cpu().AllAddrMapInsert(Name()+".csr", Base() + kCSR);
|
|
Cpu().AllAddrMapInsert(Name()+".buf", Base() + kBUF);
|
|
|
// setup primary info clist
|
// setup primary info clist
|
fPrimClist.Clear();
|
fPrimClist.Clear();
|
Cpu().AddIbrb(fPrimClist, fBase);
|
fPrimClist.AddAttn();
|
fPC_buf = Cpu().AddRibr(fPrimClist, fBase+kBUF);
|
fPC_buf = Cpu().AddRibr(fPrimClist, fBase+kBUF);
|
|
|
// add attn handler
|
// add attn handler
|
Server().AddAttnHandler(boost::bind(&Rw11CntlLP11::AttnHandler, this, _1),
|
Server().AddAttnHandler(boost::bind(&Rw11CntlLP11::AttnHandler, this, _1),
|
uint16_t(1)<<fLam, (void*)this);
|
uint16_t(1)<<fLam, (void*)this);
|
Line 134... |
Line 141... |
}
|
}
|
|
|
//------------------------------------------+-----------------------------------
|
//------------------------------------------+-----------------------------------
|
//! FIXME_docs
|
//! FIXME_docs
|
|
|
int Rw11CntlLP11::AttnHandler(const RlinkServer::AttnArgs& args)
|
int Rw11CntlLP11::AttnHandler(RlinkServer::AttnArgs& args)
|
{
|
{
|
RlinkCommandList* pclist;
|
fStats.Inc(kStatNAttnHdl);
|
size_t off;
|
Server().GetAttnInfo(args, fPrimClist);
|
|
|
GetPrimInfo(args, pclist, off);
|
|
|
|
uint16_t buf = (*pclist)[off+fPC_buf].Data();
|
uint16_t buf = fPrimClist[fPC_buf].Data();
|
bool val = buf & kBUF_M_VAL;
|
bool val = buf & kBUF_M_VAL;
|
uint8_t ochr = buf & kBUF_M_BUF;
|
uint8_t ochr = buf & kBUF_M_BUF;
|
|
|
if (fTraceLevel>0) {
|
if (fTraceLevel>0) {
|
RlogMsg lmsg(LogFile());
|
RlogMsg lmsg(LogFile());
|
Line 184... |
Line 189... |
void Rw11CntlLP11::SetOnline(bool online)
|
void Rw11CntlLP11::SetOnline(bool online)
|
{
|
{
|
Rw11Cpu& cpu = Cpu();
|
Rw11Cpu& cpu = Cpu();
|
uint16_t csr = online ? 0 : kCSR_M_ERROR;
|
uint16_t csr = online ? 0 : kCSR_M_ERROR;
|
RlinkCommandList clist;
|
RlinkCommandList clist;
|
cpu.AddIbrb(clist, fBase);
|
|
cpu.AddWibr(clist, fBase+kCSR, csr);
|
cpu.AddWibr(clist, fBase+kCSR, csr);
|
Server().Exec(clist);
|
Server().Exec(clist);
|
return;
|
return;
|
}
|
}
|
|
|