mirror of
https://github.com/wfjm/w11.git
synced 2026-01-27 12:52:27 +00:00
add dz11 backend
- RtraceTools: TraceBuffer: add level 5 (full word dump)
- Rw11Cntl: UnitSetupAll(): now virtual
- Rw11CntlBase: add kNUnit constant
- RtclRw11CntlFactory: add DZ11
- Rw11{Cntl,Unit}DZ11: added
- rw11/util.tcl: add dz11 support
- oskit/*/*_boot.tcl: add dz11 line handling in setup_tt call
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile 1140 2019-04-28 10:21:21Z mueller $
|
||||
# $Id: Makefile 1146 2019-05-05 06:25:13Z mueller $
|
||||
#
|
||||
# Revision History:
|
||||
# Date Rev Version Comment
|
||||
@@ -30,6 +30,7 @@ OBJ_all += Rw11UnitDisk.o
|
||||
OBJ_all += Rw11UnitTape.o
|
||||
OBJ_all += Rw11UnitStream.o
|
||||
OBJ_all += Rw11CntlDL11.o Rw11UnitDL11.o
|
||||
OBJ_all += Rw11CntlDZ11.o Rw11UnitDZ11.o
|
||||
OBJ_all += Rw11CntlLP11.o Rw11UnitLP11.o
|
||||
OBJ_all += Rw11CntlPC11.o Rw11UnitPC11.o
|
||||
OBJ_all += Rw11CntlRL11.o Rw11UnitRL11.o
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: RtraceTools.cpp 1140 2019-04-28 10:21:21Z mueller $
|
||||
// $Id: RtraceTools.cpp 1149 2019-05-12 21:00:29Z mueller $
|
||||
//
|
||||
// Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2019-05-12 1149 1.0.1 add level 5 (full word dump)
|
||||
// 2019-04-27 1140 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -22,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "librtools/RosPrintBvi.hpp"
|
||||
#include "librtools/RosPrintf.hpp"
|
||||
|
||||
#include "RtraceTools.hpp"
|
||||
|
||||
@@ -85,6 +87,21 @@ void TraceBuffer(RlogMsg& lmsg, const uint16_t* pbuf, size_t done,
|
||||
if (nchar >= 6) nchar = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // level=4: full word dump -------
|
||||
for (size_t i=0; i < done; i++) {
|
||||
bool val = (pbuf[i] & 0x8000) != 0;
|
||||
uint8_t size = (pbuf[i]>>8) & 0177;
|
||||
uint8_t ochr = pbuf[i] & 0377;
|
||||
lmsg << "\n " << RosPrintf(i,"d",3)
|
||||
<< " : " << val
|
||||
<< " " << RosPrintf(size,"d",3)
|
||||
<< " " << RosPrintBvi(size,8)
|
||||
<< " : " << RosPrintBvi(ochr,8)
|
||||
<< " ";
|
||||
TraceChar(lmsg, ochr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $Id: Rw11Cntl.hpp 1131 2019-04-14 13:24:25Z mueller $
|
||||
// $Id: Rw11Cntl.hpp 1146 2019-05-05 06:25:13Z mueller $
|
||||
//
|
||||
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2019-05-04 1146 1.2.5 UnitSetupAll(): now virtual
|
||||
// 2019-04-14 1131 1.2.4 add UnitSetup(), UnitSetupAll()
|
||||
// 2018-12-16 1084 1.2.3 use =delete for noncopyable instead of boost
|
||||
// 2017-04-15 874 1.2.2 NUnit() now pure; add UnitBase()
|
||||
@@ -85,7 +86,7 @@ namespace Retro {
|
||||
virtual bool BootCode(size_t unit, std::vector<uint16_t>& code,
|
||||
uint16_t& aload, uint16_t& astart);
|
||||
virtual void UnitSetup(size_t ind);
|
||||
void UnitSetupAll();
|
||||
virtual void UnitSetupAll();
|
||||
|
||||
void SetTraceLevel(uint32_t level);
|
||||
uint32_t TraceLevel() const;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// $Id: Rw11CntlBase.hpp 1078 2018-12-08 14:19:03Z mueller $
|
||||
// $Id: Rw11CntlBase.hpp 1150 2019-05-19 17:52:54Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2019 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
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2019-05-19 1150 1.0,4 add kNUnit
|
||||
// 2018-12-07 1078 1.0.3 use std::shared_ptr instead of boost
|
||||
// 2017-04-15 874 1.0.2 add UnitBase()
|
||||
// 2017-04-02 865 1.0.1 Dump(): add detail arg
|
||||
@@ -50,6 +51,9 @@ namespace Retro {
|
||||
virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
|
||||
int detail=0) const;
|
||||
|
||||
// some constants (no cpp definition, so no references possible)
|
||||
static const size_t kNUnit = NU; //!< number of units
|
||||
|
||||
protected:
|
||||
std::shared_ptr<TU> fspUnit[NU];
|
||||
};
|
||||
|
||||
559
tools/src/librw11/Rw11CntlDZ11.cpp
Normal file
559
tools/src/librw11/Rw11CntlDZ11.cpp
Normal file
@@ -0,0 +1,559 @@
|
||||
// $Id: Rw11CntlDZ11.cpp 1150 2019-05-19 17:52:54Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-19 1150 1.0 Initial version
|
||||
// 2019-05-04 1146 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
\brief Implemenation of Rw11CntlDZ11.
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#include "librtools/RosFill.hpp"
|
||||
#include "librtools/RosPrintBvi.hpp"
|
||||
#include "librtools/RosPrintf.hpp"
|
||||
#include "librtools/Rexception.hpp"
|
||||
#include "librtools/RlogMsg.hpp"
|
||||
|
||||
#include "RtraceTools.hpp"
|
||||
#include "Rw11CntlDZ11.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
||||
/*!
|
||||
\class Retro::Rw11CntlDZ11
|
||||
\brief FIXME_docs
|
||||
*/
|
||||
|
||||
// all method definitions in namespace Retro
|
||||
namespace Retro {
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
// constants definitions
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kIbaddr;
|
||||
const int Rw11CntlDZ11::kLam;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kCNTL;
|
||||
const uint16_t Rw11CntlDZ11::kSTAT;
|
||||
const uint16_t Rw11CntlDZ11::kFUSE;
|
||||
const uint16_t Rw11CntlDZ11::kFDAT;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kProbeOff;
|
||||
const bool Rw11CntlDZ11::kProbeInt;
|
||||
const bool Rw11CntlDZ11::kProbeRem;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kFifoMaxSize;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_V_AWDTH;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_B_AWDTH;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_V_SSEL;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_B_SSEL;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_M_MSE;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_M_MAINT;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_V_DATA;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_B_DATA;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_V_RRLIM;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_B_RRLIM;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_V_TRLIM;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_B_TRLIM;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_M_RCLR;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_M_TCLR;
|
||||
const uint16_t Rw11CntlDZ11::kCNTL_M_FUNC;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kSSEL_DTLE;
|
||||
const uint16_t Rw11CntlDZ11::kSSEL_BRRK;
|
||||
const uint16_t Rw11CntlDZ11::kSSEL_CORI;
|
||||
const uint16_t Rw11CntlDZ11::kSSEL_RLCN;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kFUNC_NOOP;
|
||||
const uint16_t Rw11CntlDZ11::kFUNC_SCO;
|
||||
const uint16_t Rw11CntlDZ11::kFUNC_SRING;
|
||||
const uint16_t Rw11CntlDZ11::kFUNC_SRLIM;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kCAL_DTR;
|
||||
const uint16_t Rw11CntlDZ11::kCAL_BRK;
|
||||
const uint16_t Rw11CntlDZ11::kCAL_RXON;
|
||||
const uint16_t Rw11CntlDZ11::kCAL_CSR;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kFUSE_V_RFUSE;
|
||||
const uint16_t Rw11CntlDZ11::kFUSE_B_RFUSE;
|
||||
const uint16_t Rw11CntlDZ11::kFUSE_M_TFUSE;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kFDAT_M_VAL;
|
||||
const uint16_t Rw11CntlDZ11::kFDAT_M_LAST;
|
||||
const uint16_t Rw11CntlDZ11::kFDAT_M_FERR;
|
||||
const uint16_t Rw11CntlDZ11::kFDAT_M_CAL;
|
||||
const uint16_t Rw11CntlDZ11::kFDAT_V_LINE;
|
||||
const uint16_t Rw11CntlDZ11::kFDAT_B_LINE;
|
||||
const uint16_t Rw11CntlDZ11::kFDAT_M_BUF;
|
||||
|
||||
const uint16_t Rw11CntlDZ11::kCALCSR_M_MSE;
|
||||
const uint16_t Rw11CntlDZ11::kCALCSR_M_CLR;
|
||||
const uint16_t Rw11CntlDZ11::kCALCSR_M_MAINT;
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Default constructor
|
||||
|
||||
Rw11CntlDZ11::Rw11CntlDZ11()
|
||||
: Rw11CntlBase<Rw11UnitDZ11,8>("dz11"),
|
||||
fPC_fdat(0),
|
||||
fPC_fuse(0),
|
||||
fRxQlim(0),
|
||||
fRxRlim(0),
|
||||
fTxRlim(0),
|
||||
fModCntl(false),
|
||||
fItype(0),
|
||||
fFsize(0),
|
||||
fTxRblkSize(4),
|
||||
fTxQueBusy(false),
|
||||
fRxCurUnit(0),
|
||||
fLastFuse(0),
|
||||
fCurDtr(0),
|
||||
fCurBrk(0),
|
||||
fCurRxon(0),
|
||||
fCurCsr(0)
|
||||
{
|
||||
// must be here because Units have a back-ptr (not available at Rw11CntlBase)
|
||||
for (size_t i=0; i<NUnit(); i++) {
|
||||
fspUnit[i].reset(new Rw11UnitDZ11(this, i));
|
||||
}
|
||||
|
||||
fStats.Define(kStatNRxBlk, "NRxBlk" , "wblk done");
|
||||
fStats.Define(kStatNTxQue, "NTxQue" , "rblk queued");
|
||||
fStats.Define(kStatNCalDtr, "NCalDtr" , "cal dtr received");
|
||||
fStats.Define(kStatNCalBrk, "NCalBrk" , "cal brk received");
|
||||
fStats.Define(kStatNCalRxon, "NCalRxon" , "cal rxon received");
|
||||
fStats.Define(kStatNCalCsr, "NCalCsr" , "cal csr received");
|
||||
fStats.Define(kStatNCalBad, "NCalBad" , "cal invalid");
|
||||
fStats.Define(kStatNDropMse, "NDropMse" , "drop because mse=0");
|
||||
fStats.Define(kStatNDropMaint,"NDropMaint", "drop because maint=1");
|
||||
fStats.Define(kStatNDropRxon, "NDropRxon" , "drop because rxon=0");
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Destructor
|
||||
|
||||
Rw11CntlDZ11::~Rw11CntlDZ11()
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::Config(const std::string& name, uint16_t base, int lam)
|
||||
{
|
||||
ConfigCntl(name, base, lam, kProbeOff, kProbeInt, kProbeRem);
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::Start()
|
||||
{
|
||||
if (fStarted || fLam<0 || !fEnable || !fProbe.Found())
|
||||
throw Rexception("Rw11CntlDZ11::Start",
|
||||
"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().AllIAddrMapInsert(Name()+".csr", Base() + kCNTL);
|
||||
Cpu().AllIAddrMapInsert(Name()+".rbuf", Base() + kSTAT);
|
||||
Cpu().AllIAddrMapInsert(Name()+".tcr", Base() + kFUSE);
|
||||
Cpu().AllIAddrMapInsert(Name()+".tdr", Base() + kFDAT);
|
||||
|
||||
// detect device type
|
||||
fItype = (fProbe.DataRem()>>kCNTL_V_AWDTH) & kCNTL_B_AWDTH;
|
||||
fFsize = (1<<fItype) - 1;
|
||||
fRxQlim = fFsize;
|
||||
|
||||
// ensure unit status is initialized
|
||||
Cpu().ExecWibr(fBase+kCNTL, kCNTL_M_RCLR|kCNTL_M_TCLR); // clear rx,tx fifo
|
||||
UnitSetupAll(); // setup rlim,...
|
||||
|
||||
// setup primary info clist
|
||||
fPrimClist.Clear();
|
||||
fPrimClist.AddAttn();
|
||||
fPC_fdat = Cpu().AddRbibr(fPrimClist, fBase+kFDAT, fTxRblkSize);
|
||||
fPrimClist[fPC_fdat].SetExpectStatus(0, RlinkCommand::kStat_M_RbTout |
|
||||
RlinkCommand::kStat_M_RbNak);
|
||||
fPC_fuse = Cpu().AddRibr(fPrimClist, fBase+kFUSE);
|
||||
|
||||
// add attn handler
|
||||
Server().AddAttnHandler(bind(&Rw11CntlDZ11::AttnHandler, this, _1),
|
||||
uint16_t(1)<<fLam, this);
|
||||
fStarted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::UnitSetup(size_t /*ind*/)
|
||||
{
|
||||
UnitSetupAll();
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::UnitSetupAll()
|
||||
{
|
||||
uint16_t srlim = ((fRxRlim & kCNTL_B_RRLIM) << kCNTL_V_RRLIM) |
|
||||
((fTxRlim & kCNTL_B_TRLIM) << kCNTL_V_TRLIM) | kFUNC_SRLIM;
|
||||
// if no modem control co is all ones, otherwise the attach pattern
|
||||
uint8_t co = 0;
|
||||
if (fModCntl) {
|
||||
for (size_t i=0; i<NUnit(); i++) {
|
||||
if (fspUnit[i]->HasVirt()) co |= uint8_t(1)<<i;
|
||||
}
|
||||
} else {
|
||||
co = 0xff;
|
||||
}
|
||||
uint16_t sco = (uint16_t(co) << kCNTL_V_DATA) | kFUNC_SCO;
|
||||
|
||||
Cpu().ExecWibr(fBase+kCNTL, srlim, fBase+kCNTL, sco);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::Wakeup()
|
||||
{
|
||||
// is last know rfuse more than half fifo size get an update
|
||||
// in most cases no update will be needed
|
||||
uint16_t rfuse = (fLastFuse >>kFUSE_V_RFUSE) & kFUSE_B_RFUSE;
|
||||
if (rfuse > fFsize/2) {
|
||||
fLastFuse = Cpu().ExecRibr(fBase+kFUSE);
|
||||
}
|
||||
|
||||
RxProcess(fLastFuse);
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::SetRxQlim(uint16_t qlim)
|
||||
{
|
||||
if (qlim == 0) qlim = fFsize;
|
||||
if (qlim > fFsize)
|
||||
throw Rexception("Rw11CntlDZ11::SetRxQlim",
|
||||
"Bad args: qlim larger than fifosize");
|
||||
|
||||
fRxQlim = qlim;
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::SetRxRlim(uint16_t rlim)
|
||||
{
|
||||
if (rlim > kCNTL_B_RRLIM)
|
||||
throw Rexception("Rw11CntlDZ11::SetRxRlim","Bad args: rlim too large");
|
||||
|
||||
fRxRlim = rlim;
|
||||
UnitSetupAll();
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::SetTxRlim(uint16_t rlim)
|
||||
{
|
||||
if (rlim > kCNTL_B_TRLIM)
|
||||
throw Rexception("Rw11CntlDZ11::SetTxRlim","Bad args: rlim too large");
|
||||
|
||||
fTxRlim = rlim;
|
||||
UnitSetupAll();
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::SetModCntl(bool modcntl)
|
||||
{
|
||||
fModCntl = modcntl;
|
||||
UnitSetupAll();
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::Dump(std::ostream& os, int ind, const char* text,
|
||||
int detail) const
|
||||
{
|
||||
RosFill bl(ind);
|
||||
os << bl << (text?text:"--") << "Rw11CntlDZ11 @ " << this << endl;
|
||||
os << bl << " fPC_fdat: " << fPC_fdat << endl;
|
||||
os << bl << " fPC_fuse: " << fPC_fuse << endl;
|
||||
os << bl << " fRxQlim: " << RosPrintf(fRxQlim,"d",3) << endl;
|
||||
os << bl << " fRxRlim: " << RosPrintf(fRxRlim,"d",3) << endl;
|
||||
os << bl << " fTxRlim: " << RosPrintf(fTxRlim,"d",3) << endl;
|
||||
os << bl << " fModCntl: " << RosPrintf(fModCntl) << endl;
|
||||
os << bl << " fItype: " << RosPrintf(fItype,"d",3) << endl;
|
||||
os << bl << " fFsize: " << RosPrintf(fFsize,"d",3) << endl;
|
||||
os << bl << " fTxRblkSize: " << RosPrintf(fTxRblkSize,"d",3) << endl;
|
||||
os << bl << " fTxQueBusy: " << RosPrintf(fTxQueBusy) << endl;
|
||||
os << bl << " fRxCurUnit: " << RosPrintf(fRxCurUnit,"d",3) << endl;
|
||||
os << bl << " fLastFuse: " << RosPrintf(fLastFuse,"d",3) << endl;
|
||||
os << bl << " fCurDtr: " << RosPrintBvi(fCurDtr,2) << endl;
|
||||
os << bl << " fCurBrk: " << RosPrintBvi(fCurBrk,2) << endl;
|
||||
os << bl << " fCurRxon: " << RosPrintBvi(fCurRxon,2) << endl;
|
||||
os << bl << " fCurCsr: " << RosPrintBvi(fCurCsr,2)
|
||||
<< " mse=" << ((fCurCsr&kCALCSR_M_MSE)!=0)
|
||||
<< " maint=" << ((fCurCsr&kCALCSR_M_MAINT)!=0) << endl;
|
||||
|
||||
Rw11CntlBase<Rw11UnitDZ11,8>::Dump(os, ind, " ^", detail);
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
int Rw11CntlDZ11::AttnHandler(RlinkServer::AttnArgs& args)
|
||||
{
|
||||
fStats.Inc(kStatNAttnHdl);
|
||||
Server().GetAttnInfo(args, fPrimClist);
|
||||
|
||||
fLastFuse = fPrimClist[fPC_fuse].Data();
|
||||
|
||||
TxProcess(fPrimClist[fPC_fdat], true, fLastFuse);
|
||||
RxProcess(fLastFuse);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::RxProcess(uint16_t fuse)
|
||||
{
|
||||
uint16_t rfuse = (fuse >>kFUSE_V_RFUSE) & kFUSE_B_RFUSE;
|
||||
|
||||
if (rfuse >= fRxQlim) return; // no space in fifo -> quit
|
||||
uint16_t nmax = fRxQlim - rfuse; // limit is fifo space
|
||||
vector<uint16_t> iblock;
|
||||
iblock.reserve(nmax);
|
||||
while (iblock.size() < nmax) {
|
||||
if (!NextBusyRxUnit()) break; // find busy unit, quit if none
|
||||
size_t qsize = fspUnit[fRxCurUnit]->RcvQueueSize();
|
||||
if (qsize > nmax-iblock.size()) qsize = nmax-iblock.size();
|
||||
for (size_t i=0; i<qsize; i++) {
|
||||
uint8_t ichr = fspUnit[fRxCurUnit]->RcvQueueNext();
|
||||
uint16_t iwrd = ((uint16_t(fRxCurUnit) & kFDAT_B_LINE) << kFDAT_V_LINE) |
|
||||
ichr;
|
||||
if (!(fCurCsr & kCALCSR_M_MSE)) { // drop if mse=0
|
||||
fStats.Inc(kStatNDropMse);
|
||||
} else if (fCurCsr & kCALCSR_M_MAINT) { // drop if maint=1
|
||||
fStats.Inc(kStatNDropMaint);
|
||||
} else if (!(fCurRxon & (uint8_t(1)<<fRxCurUnit))) { // drop if rxon=0
|
||||
fStats.Inc(kStatNDropRxon);
|
||||
} else {
|
||||
iblock.push_back(iwrd);
|
||||
fspUnit[fRxCurUnit]->StatIncRx(ichr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iblock.size() == 0) return; // nothing found
|
||||
|
||||
if (fTraceLevel > 0) {
|
||||
RlogMsg lmsg(LogFile());
|
||||
lmsg << "-I " << Name() << ": rx "
|
||||
<< " rfuse=" << RosPrintf(rfuse,"d",3)
|
||||
<< " size=" << RosPrintf(iblock.size(),"d",3);
|
||||
if (fTraceLevel > 1) RtraceTools::TraceBuffer(lmsg, iblock.data(),
|
||||
iblock.size(), fTraceLevel);
|
||||
}
|
||||
|
||||
fStats.Inc(kStatNRxBlk);
|
||||
RlinkCommandList clist;
|
||||
Cpu().AddWbibr(clist, fBase+kFDAT, move(iblock));
|
||||
int ifuse = Cpu().AddRibr(clist, fBase+kFUSE);
|
||||
Server().Exec(clist);
|
||||
|
||||
fLastFuse = clist[ifuse].Data(); // remember fuse after fifo write
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11CntlDZ11::TxProcess(const RlinkCommand& cmd, bool prim, uint16_t fuse)
|
||||
{
|
||||
size_t done = cmd.BlockDone();
|
||||
if (done == 0) return;
|
||||
|
||||
uint16_t tfuse = fuse & kFUSE_M_TFUSE;
|
||||
uint16_t rfuse = (fuse >>kFUSE_V_RFUSE) & kFUSE_B_RFUSE;
|
||||
const uint16_t* xbuf = cmd.BlockPointer();
|
||||
bool lastseen = false;
|
||||
|
||||
uint8_t sndbuf[kNUnit][kFifoMaxSize+1];
|
||||
size_t sndcnt[kNUnit] = {};
|
||||
|
||||
for (size_t i=0; i < done; i++) {
|
||||
uint16_t xwrd = xbuf[i];
|
||||
bool last = (xwrd & kFDAT_M_LAST) != 0;
|
||||
bool ferr = (xwrd & kFDAT_M_FERR) != 0;
|
||||
bool cal = (xwrd & kFDAT_M_CAL) != 0;
|
||||
uint16_t line = (xwrd>>kFDAT_V_LINE) & kFDAT_B_LINE;
|
||||
uint8_t ochr = xwrd & kFDAT_M_BUF;
|
||||
if (last) lastseen = true;
|
||||
if (ferr) {
|
||||
fspUnit[line]->StatIncTx(0, true); // count
|
||||
continue; // and ignore
|
||||
}
|
||||
if (cal) {
|
||||
switch (line) {
|
||||
case kCAL_DTR:
|
||||
fCurDtr = ochr;
|
||||
fStats.Inc(kStatNCalDtr);
|
||||
if (fTraceLevel > 0) {
|
||||
RlogMsg lmsg(LogFile());
|
||||
lmsg << "-I " << Name() << ": cal dtr=" << RosPrintBvi(ochr,2);
|
||||
}
|
||||
break;
|
||||
case kCAL_BRK:
|
||||
fCurBrk = ochr;
|
||||
fStats.Inc(kStatNCalBrk);
|
||||
if (fTraceLevel > 0) {
|
||||
RlogMsg lmsg(LogFile());
|
||||
lmsg << "-I " << Name() << ": cal brk=" << RosPrintBvi(ochr,2);
|
||||
}
|
||||
break;
|
||||
case kCAL_RXON:
|
||||
fCurRxon = ochr;
|
||||
fStats.Inc(kStatNCalRxon);
|
||||
if (fTraceLevel > 0) {
|
||||
RlogMsg lmsg(LogFile());
|
||||
lmsg << "-I " << Name() << ": cal rxon=" << RosPrintBvi(ochr,2);
|
||||
}
|
||||
break;
|
||||
case kCAL_CSR:
|
||||
fCurCsr = ochr;
|
||||
fStats.Inc(kStatNCalCsr);
|
||||
if (ochr & kCALCSR_M_CLR) {
|
||||
fCurRxon = 0;
|
||||
fCurBrk = 0;
|
||||
}
|
||||
if (fTraceLevel > 0) {
|
||||
RlogMsg lmsg(LogFile());
|
||||
lmsg << "-I " << Name() << ": cal csr=" << RosPrintBvi(ochr,2)
|
||||
<< " mse=" << ((ochr&kCALCSR_M_MSE)!=0)
|
||||
<< " clr=" << ((ochr&kCALCSR_M_CLR)!=0)
|
||||
<< " maint=" << ((ochr&kCALCSR_M_MAINT)!=0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fStats.Inc(kStatNCalBad);
|
||||
if (fTraceLevel > 0) {
|
||||
RlogMsg lmsg(LogFile());
|
||||
lmsg << "-E " << Name() << ": cal code bad:" << RosPrintf(line,"d");
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fspUnit[line]->StatIncTx(ochr);
|
||||
sndbuf[line][sndcnt[line]++] = ochr;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < kNUnit; i++) {
|
||||
if (sndcnt[i]) fspUnit[i]->Snd(sndbuf[i], sndcnt[i]);
|
||||
}
|
||||
|
||||
// determine next chunk size: done+tfuse, at least 4, at most fFsize
|
||||
fTxRblkSize = uint16_t(done)+tfuse;
|
||||
fTxRblkSize = max(uint16_t(4), min(fTxRblkSize, fFsize));
|
||||
|
||||
// queue further reads when queue idle and fifo not emptied
|
||||
if ((!fTxQueBusy) && done > 0 && (!lastseen)) {
|
||||
fStats.Inc(kStatNTxQue);
|
||||
fTxQueBusy = true;
|
||||
Server().QueueAction(bind(&Rw11CntlDZ11::TxRcvHandler, this));
|
||||
}
|
||||
|
||||
if (fTraceLevel > 0) {
|
||||
RlogMsg lmsg(LogFile());
|
||||
lmsg << "-I " << Name() << ": tx "
|
||||
<< " prim=" << prim
|
||||
<< " size=" << RosPrintf(cmd.BlockSize(),"d",3)
|
||||
<< " done=" << RosPrintf(done,"d",3)
|
||||
<< " last=" << lastseen
|
||||
<< " tfuse=" << RosPrintf(tfuse,"d",3)
|
||||
<< " que=" << fTxQueBusy;
|
||||
if (prim) {
|
||||
lmsg << " rfuse=" << RosPrintf(rfuse,"d",3);
|
||||
}
|
||||
if (fTraceLevel > 1) RtraceTools::TraceBuffer(lmsg, xbuf,
|
||||
done, fTraceLevel);
|
||||
}
|
||||
|
||||
// re-sizing the prim rblk invalidates pbuf -> so must be done last
|
||||
if (prim) { // if primary list
|
||||
fPrimClist[fPC_fdat].SetBlockRead(fTxRblkSize); // setup size for next attn
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
int Rw11CntlDZ11::TxRcvHandler()
|
||||
{
|
||||
fTxQueBusy = false;
|
||||
RlinkCommandList clist;
|
||||
int ifdat = Cpu().AddRbibr(clist, fBase+kFDAT, fTxRblkSize);
|
||||
clist[ifdat].SetExpectStatus(0, RlinkCommand::kStat_M_RbTout |
|
||||
RlinkCommand::kStat_M_RbNak);
|
||||
int ifuse = Cpu().AddRibr(clist, fBase+kFUSE);
|
||||
|
||||
Server().Exec(clist);
|
||||
|
||||
fLastFuse = clist[ifuse].Data();
|
||||
TxProcess(clist[ifdat], false, fLastFuse);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
bool Rw11CntlDZ11::NextBusyRxUnit()
|
||||
{
|
||||
for (size_t i=0; i<NUnit(); i++) {
|
||||
fRxCurUnit += 1;
|
||||
if (fRxCurUnit >= NUnit()) fRxCurUnit = 0;
|
||||
if (!fspUnit[fRxCurUnit]->RcvQueueEmpty()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end namespace Retro
|
||||
173
tools/src/librw11/Rw11CntlDZ11.hpp
Normal file
173
tools/src/librw11/Rw11CntlDZ11.hpp
Normal file
@@ -0,0 +1,173 @@
|
||||
// $Id: Rw11CntlDZ11.hpp 1150 2019-05-19 17:52:54Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-19 1150 1.0 Initial version
|
||||
// 2019-05-04 1146 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*!
|
||||
\brief Declaration of class Rw11CntlDZ11.
|
||||
*/
|
||||
|
||||
#ifndef included_Retro_Rw11CntlDZ11
|
||||
#define included_Retro_Rw11CntlDZ11 1
|
||||
|
||||
#include "Rw11CntlBase.hpp"
|
||||
#include "Rw11UnitDZ11.hpp"
|
||||
|
||||
namespace Retro {
|
||||
|
||||
class Rw11CntlDZ11 : public Rw11CntlBase<Rw11UnitDZ11,8> {
|
||||
public:
|
||||
|
||||
Rw11CntlDZ11();
|
||||
~Rw11CntlDZ11();
|
||||
|
||||
void Config(const std::string& name, uint16_t base, int lam);
|
||||
|
||||
virtual void Start();
|
||||
|
||||
virtual void UnitSetup(size_t ind);
|
||||
virtual void UnitSetupAll();
|
||||
void Wakeup();
|
||||
|
||||
void SetRxQlim(uint16_t qlim);
|
||||
uint16_t RxQlim() const;
|
||||
void SetRxRlim(uint16_t rlim);
|
||||
uint16_t RxRlim() const;
|
||||
void SetTxRlim(uint16_t rlim);
|
||||
uint16_t TxRlim() const;
|
||||
void SetModCntl(bool modcntl);
|
||||
bool ModCntl() const;
|
||||
|
||||
uint16_t Itype() const;
|
||||
bool Buffered() const;
|
||||
uint16_t FifoSize() const;
|
||||
|
||||
virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
|
||||
int detail=0) const;
|
||||
|
||||
// some constants (also defined in cpp)
|
||||
static const uint16_t kIbaddr = 0160100; //!< DZ11 default address
|
||||
static const int kLam = 3; //!< DZ11 default lam
|
||||
|
||||
static const uint16_t kCNTL = 000; //!< CNTL and CSR reg offset
|
||||
static const uint16_t kSTAT = 002; //!< STAT and RBUF/LPR reg offset
|
||||
static const uint16_t kFUSE = 004; //!< FUSE and TCR reg offset
|
||||
static const uint16_t kFDAT = 006; //!< FDAT and TDR/MSR reg offset
|
||||
|
||||
static const uint16_t kProbeOff = kCNTL; //!< probe address offset (cntl)
|
||||
static const bool kProbeInt = true; //!< probe int active
|
||||
static const bool kProbeRem = true; //!< probr rem active
|
||||
|
||||
static const uint16_t kFifoMaxSize = 127; //!< maximal fifo size
|
||||
|
||||
// cntl read view
|
||||
static const uint16_t kCNTL_V_AWDTH = 8; //!< cntl.awdth shift
|
||||
static const uint16_t kCNTL_B_AWDTH = 0007; //!< cntl.awdth bit mask
|
||||
static const uint16_t kCNTL_V_SSEL = 3; //!< cntl.ssel shift
|
||||
static const uint16_t kCNTL_B_SSEL = 0003; //!< cntl.ssel bit mask
|
||||
static const uint16_t kCNTL_M_MSE = kWBit02; //!< cntl.mse mask
|
||||
static const uint16_t kCNTL_M_MAINT = kWBit01; //!< cntl.maint mask
|
||||
// cntl write view
|
||||
static const uint16_t kCNTL_V_DATA = 8; //!< cntl.data shift
|
||||
static const uint16_t kCNTL_B_DATA = 0377; //!< cntl.data bit mask
|
||||
static const uint16_t kCNTL_V_RRLIM = 12; //!< cntl.rrlim shift
|
||||
static const uint16_t kCNTL_B_RRLIM = 0007; //!< cntl.rrlim bit mask
|
||||
static const uint16_t kCNTL_V_TRLIM = 8; //!< cntl.trlim shift
|
||||
static const uint16_t kCNTL_B_TRLIM = 0007; //!< cntl.trlim bit mask
|
||||
static const uint16_t kCNTL_M_RCLR = kWBit06; //!< cntl.rclr mask
|
||||
static const uint16_t kCNTL_M_TCLR = kWBit05; //!< cntl.rclr mask
|
||||
static const uint16_t kCNTL_M_FUNC = 0007; //!< cntl.func mask
|
||||
|
||||
static const uint16_t kSSEL_DTLE = 0;
|
||||
static const uint16_t kSSEL_BRRK = 1;
|
||||
static const uint16_t kSSEL_CORI = 2;
|
||||
static const uint16_t kSSEL_RLCN = 3;
|
||||
|
||||
static const uint16_t kFUNC_NOOP = 0;
|
||||
static const uint16_t kFUNC_SCO = 1;
|
||||
static const uint16_t kFUNC_SRING = 2;
|
||||
static const uint16_t kFUNC_SRLIM = 3;
|
||||
|
||||
static const uint16_t kCAL_DTR = 0;
|
||||
static const uint16_t kCAL_BRK = 1;
|
||||
static const uint16_t kCAL_RXON = 2;
|
||||
static const uint16_t kCAL_CSR = 3;
|
||||
|
||||
static const uint16_t kFUSE_V_RFUSE = 8; //!< rfuse shift
|
||||
static const uint16_t kFUSE_B_RFUSE = 0177; //!< rfuse bit mask
|
||||
static const uint16_t kFUSE_M_TFUSE = 0177; //!< tfuse mask
|
||||
|
||||
static const uint16_t kFDAT_M_VAL = kWBit15; //!< fdat.val mask
|
||||
static const uint16_t kFDAT_M_LAST = kWBit14; //!< fdat.last mask
|
||||
static const uint16_t kFDAT_M_FERR = kWBit13; //!< fdat.ferr mask
|
||||
static const uint16_t kFDAT_M_CAL = kWBit11; //!< fdat.cal mask
|
||||
static const uint16_t kFDAT_V_LINE = 8; //!< fdat.line shift
|
||||
static const uint16_t kFDAT_B_LINE = 0007; //!< fdat.line bit mask
|
||||
static const uint16_t kFDAT_M_BUF = 0xFF; //!< fdat.buf mask
|
||||
|
||||
static const uint16_t kCALCSR_M_MSE = kWBit05; //!< fdat_cal.mse mask
|
||||
static const uint16_t kCALCSR_M_CLR = kWBit04; //!< fdat_cal.clr mask
|
||||
static const uint16_t kCALCSR_M_MAINT= kWBit03; //!< fdat_cal.maint mask
|
||||
|
||||
// statistics counter indices
|
||||
enum stats {
|
||||
kStatNRxBlk= Rw11Cntl::kDimStat, //!< done wblk
|
||||
kStatNTxQue, //!< queue rblk
|
||||
kStatNCalDtr, //!< cal dtr received
|
||||
kStatNCalBrk, //!< cal brk received
|
||||
kStatNCalRxon, //!< cal rxon received
|
||||
kStatNCalCsr, //!< cal csr received
|
||||
kStatNCalBad, //!< cal invalid
|
||||
kStatNDropMse, //!< drop because mse=0
|
||||
kStatNDropMaint, //!< drop because maint=1
|
||||
kStatNDropRxon, //!< drop because rxon=0
|
||||
kDimStat
|
||||
};
|
||||
|
||||
protected:
|
||||
int AttnHandler(RlinkServer::AttnArgs& args);
|
||||
void RxProcess(uint16_t fuse);
|
||||
void TxProcess(const RlinkCommand& cmd, bool prim,
|
||||
uint16_t fuse);
|
||||
int TxRcvHandler();
|
||||
bool NextBusyRxUnit();
|
||||
|
||||
protected:
|
||||
size_t fPC_fdat; //!< PrimClist: fdat index
|
||||
size_t fPC_fuse; //!< PrimClist: fuse index
|
||||
uint16_t fRxQlim; //!< rx queue limit
|
||||
uint16_t fRxRlim; //!< rx interrupt rate limit
|
||||
uint16_t fTxRlim; //!< tx interrupt rate limit
|
||||
bool fModCntl; //!< modem control enable
|
||||
uint16_t fItype; //!< interface type
|
||||
uint16_t fFsize; //!< fifo size
|
||||
uint16_t fTxRblkSize; //!< tx rblk chunk size
|
||||
bool fTxQueBusy; //!< tx queue busy
|
||||
size_t fRxCurUnit; //!< rx current unit
|
||||
uint16_t fLastFuse; //!< last seen fuse
|
||||
uint8_t fCurDtr; //!< current dtr
|
||||
uint8_t fCurBrk; //!< current brk
|
||||
uint8_t fCurRxon; //!< current rxon
|
||||
uint8_t fCurCsr; //!< current csr
|
||||
};
|
||||
|
||||
} // end namespace Retro
|
||||
|
||||
#include "Rw11CntlDZ11.ipp"
|
||||
|
||||
#endif
|
||||
83
tools/src/librw11/Rw11CntlDZ11.ipp
Normal file
83
tools/src/librw11/Rw11CntlDZ11.ipp
Normal file
@@ -0,0 +1,83 @@
|
||||
// $Id: Rw11CntlDZ11.ipp 1148 2019-05-12 10:10:44Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-04 1146 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
\brief Implemenation (inline) of Rw11CntlDZ11.
|
||||
*/
|
||||
|
||||
|
||||
// all method definitions in namespace Retro
|
||||
namespace Retro {
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline uint16_t Rw11CntlDZ11::RxQlim() const
|
||||
{
|
||||
return fRxQlim;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline uint16_t Rw11CntlDZ11::RxRlim() const
|
||||
{
|
||||
return fRxRlim;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline uint16_t Rw11CntlDZ11::TxRlim() const
|
||||
{
|
||||
return fTxRlim;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline bool Rw11CntlDZ11::ModCntl() const
|
||||
{
|
||||
return fModCntl;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline uint16_t Rw11CntlDZ11::Itype() const
|
||||
{
|
||||
return fItype;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline bool Rw11CntlDZ11::Buffered() const
|
||||
{
|
||||
return fFsize > 0;
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
inline uint16_t Rw11CntlDZ11::FifoSize() const
|
||||
{
|
||||
return fFsize;
|
||||
}
|
||||
|
||||
} // end namespace Retro
|
||||
64
tools/src/librw11/Rw11UnitDZ11.cpp
Normal file
64
tools/src/librw11/Rw11UnitDZ11.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
// $Id: Rw11UnitDZ11.cpp 1146 2019-05-05 06:25:13Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-04 1146 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
\file
|
||||
\brief Implemenation of Rw11UnitDZ11.
|
||||
*/
|
||||
|
||||
#include "librtools/RosFill.hpp"
|
||||
#include "Rw11CntlDZ11.hpp"
|
||||
|
||||
#include "Rw11UnitDZ11.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*!
|
||||
\class Retro::Rw11UnitDZ11
|
||||
\brief FIXME_docs
|
||||
*/
|
||||
|
||||
// all method definitions in namespace Retro
|
||||
namespace Retro {
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Constructor
|
||||
|
||||
Rw11UnitDZ11::Rw11UnitDZ11(Rw11CntlDZ11* pcntl, size_t index)
|
||||
: Rw11UnitTermBase<Rw11CntlDZ11>(pcntl, index)
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Destructor
|
||||
|
||||
Rw11UnitDZ11::~Rw11UnitDZ11()
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
void Rw11UnitDZ11::Dump(std::ostream& os, int ind, const char* text,
|
||||
int detail) const
|
||||
{
|
||||
RosFill bl(ind);
|
||||
os << bl << (text?text:"--") << "Rw11UnitDZ11 @ " << this << endl;
|
||||
Rw11UnitTermBase<Rw11CntlDZ11>::Dump(os, ind, " ^", detail);
|
||||
return;
|
||||
}
|
||||
|
||||
} // end namespace Retro
|
||||
51
tools/src/librw11/Rw11UnitDZ11.hpp
Normal file
51
tools/src/librw11/Rw11UnitDZ11.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
// $Id: Rw11UnitDZ11.hpp 1146 2019-05-05 06:25:13Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-04 1146 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*!
|
||||
\file
|
||||
\brief Declaration of class Rw11UnitDZ11.
|
||||
*/
|
||||
|
||||
#ifndef included_Retro_Rw11UnitDZ11
|
||||
#define included_Retro_Rw11UnitDZ11 1
|
||||
|
||||
#include "Rw11UnitTermBase.hpp"
|
||||
|
||||
namespace Retro {
|
||||
|
||||
class Rw11CntlDZ11; // forw decl to avoid circular incl
|
||||
|
||||
class Rw11UnitDZ11 : public Rw11UnitTermBase<Rw11CntlDZ11> {
|
||||
public:
|
||||
|
||||
Rw11UnitDZ11(Rw11CntlDZ11* pcntl, size_t index);
|
||||
~Rw11UnitDZ11();
|
||||
|
||||
virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
|
||||
int detail=0) const;
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Retro
|
||||
|
||||
//#include "Rw11UnitDZ11.ipp"
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,8 @@
|
||||
# $Id: Makefile 1100 2019-01-02 10:56:47Z mueller $
|
||||
# $Id: Makefile 1146 2019-05-05 06:25:13Z mueller $
|
||||
#
|
||||
# Revision History:
|
||||
# Date Rev Version Comment
|
||||
# 2019-05-04 1146 1.0.4 add DZ11
|
||||
# 2019-01-02 1100 1.0.3 drop boost includes
|
||||
# 2014-11-08 602 1.0.2 add TCLLIB/TCLLIBNAME to LDLIBS
|
||||
# 2013-02-01 479 1.0.1 correct so name (no digits allowed in tcl load...)
|
||||
@@ -35,6 +36,7 @@ OBJ_all += RtclRw11UnitDisk.o
|
||||
OBJ_all += RtclRw11UnitTape.o
|
||||
OBJ_all += RtclRw11UnitStream.o
|
||||
OBJ_all += RtclRw11CntlDL11.o RtclRw11UnitDL11.o
|
||||
OBJ_all += RtclRw11CntlDZ11.o RtclRw11UnitDZ11.o
|
||||
OBJ_all += RtclRw11CntlLP11.o RtclRw11UnitLP11.o
|
||||
OBJ_all += RtclRw11CntlPC11.o RtclRw11UnitPC11.o
|
||||
OBJ_all += RtclRw11CntlRK11.o RtclRw11UnitRK11.o
|
||||
|
||||
111
tools/src/librwxxtpp/RtclRw11CntlDZ11.cpp
Normal file
111
tools/src/librwxxtpp/RtclRw11CntlDZ11.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
// $Id: RtclRw11CntlDZ11.cpp 1148 2019-05-12 10:10:44Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-11 1148 1.0 Initial version
|
||||
// 2019-05-04 1146 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
\file
|
||||
\brief Implemenation of RtclRw11CntlDZ11.
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "librtcltools/RtclNameSet.hpp"
|
||||
|
||||
#include "RtclRw11CntlDZ11.hpp"
|
||||
#include "RtclRw11UnitDZ11.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
||||
/*!
|
||||
\class Retro::RtclRw11CntlDZ11
|
||||
\brief FIXME_docs
|
||||
*/
|
||||
|
||||
// all method definitions in namespace Retro
|
||||
namespace Retro {
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Constructor
|
||||
|
||||
RtclRw11CntlDZ11::RtclRw11CntlDZ11()
|
||||
: RtclRw11CntlTermBase<Rw11CntlDZ11>("Rw11CntlDZ11","term")
|
||||
{
|
||||
Rw11CntlDZ11* pobj = &Obj();
|
||||
fGets.Add<uint16_t> ("rxqlim", bind(&Rw11CntlDZ11::RxQlim, pobj));
|
||||
fGets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDZ11::RxRlim, pobj));
|
||||
fGets.Add<uint16_t> ("txrlim", bind(&Rw11CntlDZ11::TxRlim, pobj));
|
||||
fGets.Add<bool> ("modcntl", bind(&Rw11CntlDZ11::ModCntl, pobj));
|
||||
fGets.Add<uint16_t> ("itype", bind(&Rw11CntlDZ11::Itype, pobj));
|
||||
fGets.Add<bool> ("buffered", bind(&Rw11CntlDZ11::Buffered, pobj));
|
||||
fGets.Add<uint16_t> ("fifosize", bind(&Rw11CntlDZ11::FifoSize, pobj));
|
||||
|
||||
fSets.Add<uint16_t> ("rxqlim", bind(&Rw11CntlDZ11::SetRxQlim, pobj, _1));
|
||||
fSets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDZ11::SetRxRlim, pobj, _1));
|
||||
fSets.Add<uint16_t> ("txrlim", bind(&Rw11CntlDZ11::SetTxRlim, pobj, _1));
|
||||
fSets.Add<bool> ("modcntl", bind(&Rw11CntlDZ11::SetModCntl,pobj, _1));
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Destructor
|
||||
|
||||
RtclRw11CntlDZ11::~RtclRw11CntlDZ11()
|
||||
{}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! FIXME_docs
|
||||
|
||||
int RtclRw11CntlDZ11::FactoryCmdConfig(RtclArgs& args, RtclRw11Cpu& cpu)
|
||||
{
|
||||
static RtclNameSet optset("-base|-lam");
|
||||
|
||||
string cntlname(cpu.Obj().NextCntlName("dz"));
|
||||
string cntlcmd = cpu.CommandName() + cntlname;
|
||||
|
||||
uint16_t base = Rw11CntlDZ11::kIbaddr;
|
||||
int lam = Rw11CntlDZ11::kLam;
|
||||
|
||||
string opt;
|
||||
while (args.NextOpt(opt, optset)) {
|
||||
if (opt == "-base") {
|
||||
if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
|
||||
} else if (opt == "-lam") {
|
||||
if (!args.GetArg("lam", lam, 0, 15)) return kERR;
|
||||
}
|
||||
}
|
||||
if (!args.AllDone()) return kERR;
|
||||
|
||||
// configure controller
|
||||
Obj().Config(cntlname, base, lam);
|
||||
|
||||
// install in CPU
|
||||
cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
|
||||
|
||||
// finally create tcl command
|
||||
CreateObjectCmd(args.Interp(), cntlcmd.c_str());
|
||||
|
||||
// and create unit commands
|
||||
for (size_t i=0; i<Obj().NUnit(); i++) {
|
||||
string unitcmd = cpu.CommandName() + Obj().UnitName(i);
|
||||
new RtclRw11UnitDZ11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
|
||||
}
|
||||
|
||||
return kOK;
|
||||
}
|
||||
|
||||
} // end namespace Retro
|
||||
45
tools/src/librwxxtpp/RtclRw11CntlDZ11.hpp
Normal file
45
tools/src/librwxxtpp/RtclRw11CntlDZ11.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// $Id: RtclRw11CntlDZ11.hpp 1146 2019-05-05 06:25:13Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-04 1146 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*!
|
||||
\file
|
||||
\brief Declaration of class RtclRw11CntlDZ11.
|
||||
*/
|
||||
|
||||
#ifndef included_Retro_RtclRw11CntlDZ11
|
||||
#define included_Retro_RtclRw11CntlDZ11 1
|
||||
|
||||
#include "RtclRw11CntlTermBase.hpp"
|
||||
#include "librw11/Rw11CntlDZ11.hpp"
|
||||
|
||||
namespace Retro {
|
||||
|
||||
class RtclRw11CntlDZ11 : public RtclRw11CntlTermBase<Rw11CntlDZ11> {
|
||||
public:
|
||||
RtclRw11CntlDZ11();
|
||||
~RtclRw11CntlDZ11();
|
||||
|
||||
virtual int FactoryCmdConfig(RtclArgs& args, RtclRw11Cpu& cpu);
|
||||
};
|
||||
|
||||
} // end namespace Retro
|
||||
|
||||
//#include "RtclRw11CntlDZ11.ipp"
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
// $Id: RtclRw11CntlFactory.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RtclRw11CntlFactory.cpp 1146 2019-05-05 06:25:13Z mueller $
|
||||
//
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2019 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
|
||||
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2017-01-29 1146 1.1.5 add DZ11
|
||||
// 2017-01-29 847 1.1.4 add DEUNA
|
||||
// 2015-03-21 659 1.1.3 add RPRM (later renamed to RHRP)
|
||||
// 2015-01-04 630 1.1.2 RL11 back in
|
||||
@@ -33,6 +34,7 @@
|
||||
#include "RtclRw11CntlFactory.hpp"
|
||||
|
||||
#include "RtclRw11CntlDL11.hpp"
|
||||
#include "RtclRw11CntlDZ11.hpp"
|
||||
#include "RtclRw11CntlRK11.hpp"
|
||||
#include "RtclRw11CntlRL11.hpp"
|
||||
#include "RtclRw11CntlRHRP.hpp"
|
||||
@@ -60,6 +62,11 @@ int RtclRw11CntlFactory(RtclArgs& args, RtclRw11Cpu& cpu)
|
||||
if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
|
||||
pobj.release();
|
||||
|
||||
} else if (type == "dz11") { // dz11 --------------------------
|
||||
unique_ptr<RtclRw11CntlDZ11> pobj(new RtclRw11CntlDZ11());
|
||||
if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
|
||||
pobj.release();
|
||||
|
||||
} else if (type == "rk11") { // rk11 --------------------------
|
||||
unique_ptr<RtclRw11CntlRK11> pobj(new RtclRw11CntlRK11());
|
||||
if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
|
||||
|
||||
55
tools/src/librwxxtpp/RtclRw11UnitDZ11.cpp
Normal file
55
tools/src/librwxxtpp/RtclRw11UnitDZ11.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
// $Id: RtclRw11UnitDZ11.cpp 1146 2019-05-05 06:25:13Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-04 1146 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
\file
|
||||
\brief Implemenation of RtclRw11UnitDZ11.
|
||||
*/
|
||||
|
||||
#include "RtclRw11UnitDZ11.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*!
|
||||
\class Retro::RtclRw11UnitDZ11
|
||||
\brief FIXME_docs
|
||||
*/
|
||||
|
||||
// all method definitions in namespace Retro
|
||||
namespace Retro {
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Constructor
|
||||
|
||||
RtclRw11UnitDZ11::RtclRw11UnitDZ11(Tcl_Interp* interp,
|
||||
const std::string& unitcmd,
|
||||
const std::shared_ptr<Rw11UnitDZ11>& spunit)
|
||||
: RtclRw11UnitBase<Rw11UnitDZ11,Rw11UnitTerm,
|
||||
RtclRw11UnitTerm>("Rw11UnitDZ11", spunit)
|
||||
{
|
||||
SetupGetSet();
|
||||
CreateObjectCmd(interp, unitcmd.c_str());
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
//! Destructor
|
||||
|
||||
RtclRw11UnitDZ11::~RtclRw11UnitDZ11()
|
||||
{}
|
||||
|
||||
} // end namespace Retro
|
||||
51
tools/src/librwxxtpp/RtclRw11UnitDZ11.hpp
Normal file
51
tools/src/librwxxtpp/RtclRw11UnitDZ11.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
// $Id: RtclRw11UnitDZ11.hpp 1146 2019-05-05 06:25:13Z mueller $
|
||||
//
|
||||
// Copyright 2019- 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 3, 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
|
||||
// 2019-05-04 1146 1.0 Initial version
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*!
|
||||
\file
|
||||
\brief Declaration of class RtclRw11UnitDZ11.
|
||||
*/
|
||||
|
||||
#ifndef included_Retro_RtclRw11UnitDZ11
|
||||
#define included_Retro_RtclRw11UnitDZ11 1
|
||||
|
||||
#include "librw11/Rw11UnitDZ11.hpp"
|
||||
#include "librw11/Rw11CntlDZ11.hpp"
|
||||
|
||||
#include "RtclRw11UnitTerm.hpp"
|
||||
#include "RtclRw11UnitBase.hpp"
|
||||
|
||||
namespace Retro {
|
||||
|
||||
class RtclRw11UnitDZ11 : public RtclRw11UnitBase<Rw11UnitDZ11,Rw11UnitTerm,
|
||||
RtclRw11UnitTerm> {
|
||||
public:
|
||||
RtclRw11UnitDZ11(Tcl_Interp* interp,
|
||||
const std::string& unitcmd,
|
||||
const std::shared_ptr<Rw11UnitDZ11>& spunit);
|
||||
~RtclRw11UnitDZ11();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
} // end namespace Retro
|
||||
|
||||
//#include "RtclRw11UnitDZ11.ipp"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user