w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlRK11.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlRK11.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-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.2.1 use RtclStats::Exec()
8// 2017-04-16 878 1.2 add class in ctor; derive from RtclRw11CntlDiskBase
9// 2015-01-04 627 1.1 add Get/Set for chunksize
10// 2013-03-06 495 1.0 Initial version
11// 2013-02-02 480 0.1 First draft
12// ---------------------------------------------------------------------------
13
19
20#include "RtclRw11CntlRK11.hpp"
21#include "RtclRw11UnitRK11.hpp"
22
23using namespace std;
24
30// all method definitions in namespace Retro
31namespace Retro {
32
33//------------------------------------------+-----------------------------------
35
37 : RtclRw11CntlDiskBase<Rw11CntlRK11>("Rw11CntlRK11","disk")
38{}
39
40//------------------------------------------+-----------------------------------
42
44{}
45
46//------------------------------------------+-----------------------------------
48
50{
51 static RtclNameSet optset("-base|-lam");
52
53 string cntlname(cpu.Obj().NextCntlName("rk"));
54 string cntlcmd = cpu.CommandName() + cntlname;
55
56 uint16_t base = Rw11CntlRK11::kIbaddr;
57 int lam = Rw11CntlRK11::kLam;
58
59 string opt;
60 while (args.NextOpt(opt, optset)) {
61 if (opt == "-base") {
62 if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
63 } else if (opt == "-lam") {
64 if (!args.GetArg("lam", lam, 0, 15)) return kERR;
65 }
66 }
67 if (!args.AllDone()) return kERR;
68
69 // configure controller
70 Obj().Config(cntlname, base, lam);
71
72 // install in CPU
73 cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
74 // finally create tcl command
75 CreateObjectCmd(args.Interp(), cntlcmd.c_str());
76
77 // and create unit commands
78 for (size_t i=0; i<Obj().NUnit(); i++) {
79 string unitcmd = cpu.CommandName() + Obj().UnitName(i);
80 new RtclRw11UnitRK11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
81 }
82
83 return kOK;
84}
85
86//------------------------------------------+-----------------------------------
88
90{
92 if (!RtclStats::GetArgs(args, cntx)) return kERR;
93 if (!RtclStats::Exec(args, cntx, Obj().Stats())) return kERR;
94 if (!RtclStats::Exec(args, cntx, Obj().RdmaStats())) return kERR;
95 return kOK;
96}
97
98
99} // 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 int kLam
RK11 default lam.
static const uint16_t kIbaddr
RK11 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