w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlRL11.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlRL11.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2014-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 RtclRw11CntlDiskBase
9// 2015-01-10 632 1.0 Initial version
10// 2014-06-08 561 0.1 First draft
11// ---------------------------------------------------------------------------
12
18
19#include "RtclRw11CntlRL11.hpp"
20#include "RtclRw11UnitRL11.hpp"
21
22using namespace std;
23
29// all method definitions in namespace Retro
30namespace Retro {
31
32//------------------------------------------+-----------------------------------
34
36 : RtclRw11CntlDiskBase<Rw11CntlRL11>("Rw11CntlRL11","disk")
37{}
38
39//------------------------------------------+-----------------------------------
41
43{}
44
45//------------------------------------------+-----------------------------------
47
49{
50 static RtclNameSet optset("-base|-lam");
51
52 string cntlname(cpu.Obj().NextCntlName("rl"));
53 string cntlcmd = cpu.CommandName() + cntlname;
54
55 uint16_t base = Rw11CntlRL11::kIbaddr;
56 int lam = Rw11CntlRL11::kLam;
57
58 string opt;
59 while (args.NextOpt(opt, optset)) {
60 if (opt == "-base") {
61 if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
62 } else if (opt == "-lam") {
63 if (!args.GetArg("lam", lam, 0, 15)) return kERR;
64 }
65 }
66 if (!args.AllDone()) return kERR;
67
68 // configure controller
69 Obj().Config(cntlname, base, lam);
70
71 // install in CPU
72 cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
73 // finally create tcl command
74 CreateObjectCmd(args.Interp(), cntlcmd.c_str());
75
76 // and create unit commands
77 for (size_t i=0; i<Obj().NUnit(); i++) {
78 string unitcmd = cpu.CommandName() + Obj().UnitName(i);
79 new RtclRw11UnitRL11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
80 }
81
82 return kOK;
83}
84
85//------------------------------------------+-----------------------------------
87
89{
91 if (!RtclStats::GetArgs(args, cntx)) return kERR;
92 if (!RtclStats::Exec(args, cntx, Obj().Stats())) return kERR;
93 if (!RtclStats::Exec(args, cntx, Obj().RdmaStats())) return kERR;
94 return kOK;
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.
Implemenation (all inline) of RtclRw11CntlDiskBase.
virtual int M_stats(RtclArgs &args)
FIXME_docs.
virtual int FactoryCmdConfig(RtclArgs &args, RtclRw11Cpu &cpu)
FIXME_docs.
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 uint16_t kIbaddr
RL11 default address.
static const int kLam
RL11 default lam.
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