w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlTM11.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlTM11.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2015-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-06-07 1160 1.1.1 use RtclStats::Exec()
8// 2017-04-16 878 1.1 add class in ctor; derive from RtclRw11CntlTapeBase
9// 2015-05-17 683 1.0 Initial version
10// ---------------------------------------------------------------------------
11
17
18#include "RtclRw11CntlTM11.hpp"
19#include "RtclRw11UnitTM11.hpp"
20
21using namespace std;
22
28// all method definitions in namespace Retro
29namespace Retro {
30
31//------------------------------------------+-----------------------------------
33
35 : RtclRw11CntlTapeBase<Rw11CntlTM11>("Rw11CntlTM11","tape")
36{}
37
38//------------------------------------------+-----------------------------------
40
42{}
43
44//------------------------------------------+-----------------------------------
46
48{
49 static RtclNameSet optset("-base|-lam");
50
51 string cntlname(cpu.Obj().NextCntlName("tm"));
52 string cntlcmd = cpu.CommandName() + cntlname;
53
54 uint16_t base = Rw11CntlTM11::kIbaddr;
55 int lam = Rw11CntlTM11::kLam;
56
57 string opt;
58 while (args.NextOpt(opt, optset)) {
59 if (opt == "-base") {
60 if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
61 } else if (opt == "-lam") {
62 if (!args.GetArg("lam", lam, 0, 15)) return kERR;
63 }
64 }
65 if (!args.AllDone()) return kERR;
66
67 // configure controller
68 Obj().Config(cntlname, base, lam);
69
70 // install in CPU
71 cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
72 // finally create tcl command
73 CreateObjectCmd(args.Interp(), cntlcmd.c_str());
74
75 // and create unit commands
76 for (size_t i=0; i<Obj().NUnit(); i++) {
77 string unitcmd = cpu.CommandName() + Obj().UnitName(i);
78 new RtclRw11UnitTM11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
79 }
80
81 return kOK;
82}
83
84//------------------------------------------+-----------------------------------
86
88{
90 if (!RtclStats::GetArgs(args, cntx)) return kERR;
91 if (!RtclStats::Exec(args, cntx, Obj().Stats())) return kERR;
92 if (!RtclStats::Exec(args, cntx, Obj().RdmaStats())) return kERR;
93 return kOK;
94}
95
96
97} // end namespace Retro
FIXME_docs.
Definition: RtclArgs.hpp:41
bool NextOpt(std::string &val)
FIXME_docs.
Definition: RtclArgs.cpp:368
bool GetArg(const char *name, Tcl_Obj *&pval)
FIXME_docs.
Definition: RtclArgs.cpp:114
Tcl_Interp * Interp() const
FIXME_docs.
Definition: RtclArgs.ipp:28
bool AllDone()
FIXME_docs.
Definition: RtclArgs.cpp:447
void CreateObjectCmd(Tcl_Interp *interp, const char *name)
FIXME_docs.
std::string CommandName() const
FIXME_docs.
virtual TC & Obj()
FIXME_docs.
const std::shared_ptr< TC > & ObjSPtr()
FIXME_docs.
virtual int FactoryCmdConfig(RtclArgs &args, RtclRw11Cpu &cpu)
FIXME_docs.
virtual int M_stats(RtclArgs &args)
FIXME_docs.
Implemenation (all inline) of RtclRw11CntlTapeBase.
virtual Rw11Cpu & Obj()=0
static bool Exec(RtclArgs &args, const Context &cntx, Rstats &stats)
FIXME_docs.
Definition: RtclStats.cpp:75
static bool GetArgs(RtclArgs &args, Context &cntx)
FIXME_docs.
Definition: RtclStats.cpp:37
static const int kLam
TM11 default lam.
static const uint16_t kIbaddr
TM11 default address.
std::string NextCntlName(const std::string &base) const
FIXME_docs.
Definition: Rw11Cpu.cpp:331
void AddCntl(const std::shared_ptr< Rw11Cntl > &spcntl)
FIXME_docs.
Definition: Rw11Cpu.cpp:266
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47
static const int kERR
Definition: RtclBvi.cpp:38
static const int kOK
Definition: RtclBvi.cpp:37