w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlDZ11.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlDZ11.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-05-11 1148 1.0 Initial version
8// 2019-05-04 1146 0.1 First draft
9// ---------------------------------------------------------------------------
10
15#include <functional>
16
18
19#include "RtclRw11CntlDZ11.hpp"
20#include "RtclRw11UnitDZ11.hpp"
21
22using namespace std;
23using namespace std::placeholders;
24
30// all method definitions in namespace Retro
31namespace Retro {
32
33//------------------------------------------+-----------------------------------
35
37 : RtclRw11CntlTermBase<Rw11CntlDZ11>("Rw11CntlDZ11","term")
38{
39 Rw11CntlDZ11* pobj = &Obj();
40 fGets.Add<uint16_t> ("rxqlim", bind(&Rw11CntlDZ11::RxQlim, pobj));
41 fGets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDZ11::RxRlim, pobj));
42 fGets.Add<uint16_t> ("txrlim", bind(&Rw11CntlDZ11::TxRlim, pobj));
43 fGets.Add<bool> ("modcntl", bind(&Rw11CntlDZ11::ModCntl, pobj));
44 fGets.Add<uint16_t> ("itype", bind(&Rw11CntlDZ11::Itype, pobj));
45 fGets.Add<bool> ("buffered", bind(&Rw11CntlDZ11::Buffered, pobj));
46 fGets.Add<uint16_t> ("fifosize", bind(&Rw11CntlDZ11::FifoSize, pobj));
47
48 fSets.Add<uint16_t> ("rxqlim", bind(&Rw11CntlDZ11::SetRxQlim, pobj, _1));
49 fSets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDZ11::SetRxRlim, pobj, _1));
50 fSets.Add<uint16_t> ("txrlim", bind(&Rw11CntlDZ11::SetTxRlim, pobj, _1));
51 fSets.Add<bool> ("modcntl", bind(&Rw11CntlDZ11::SetModCntl,pobj, _1));
52}
53
54//------------------------------------------+-----------------------------------
56
58{}
59
60//------------------------------------------+-----------------------------------
62
64{
65 static RtclNameSet optset("-base|-lam");
66
67 string cntlname(cpu.Obj().NextCntlName("dz"));
68 string cntlcmd = cpu.CommandName() + cntlname;
69
70 uint16_t base = Rw11CntlDZ11::kIbaddr;
71 int lam = Rw11CntlDZ11::kLam;
72
73 string opt;
74 while (args.NextOpt(opt, optset)) {
75 if (opt == "-base") {
76 if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
77 } else if (opt == "-lam") {
78 if (!args.GetArg("lam", lam, 0, 15)) return kERR;
79 }
80 }
81 if (!args.AllDone()) return kERR;
82
83 // configure controller
84 Obj().Config(cntlname, base, lam);
85
86 // install in CPU
87 cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
88
89 // finally create tcl command
90 CreateObjectCmd(args.Interp(), cntlcmd.c_str());
91
92 // and create unit commands
93 for (size_t i=0; i<Obj().NUnit(); i++) {
94 string unitcmd = cpu.CommandName() + Obj().UnitName(i);
95 new RtclRw11UnitDZ11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
96 }
97
98 return kOK;
99}
100
101} // 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 Add(const std::string &name, get_uptr_t &&upget)
FIXME_docs.
Definition: RtclGetList.cpp:52
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.
Implemenation (all inline) of RtclRw11CntlTermBase.
virtual Rw11Cpu & Obj()=0
void Add(const std::string &name, set_uptr_t &&upset)
FIXME_docs.
Definition: RtclSetList.cpp:52
uint16_t RxQlim() const
FIXME_docs.
uint16_t Itype() const
FIXME_docs.
uint16_t RxRlim() const
FIXME_docs.
void SetTxRlim(uint16_t rlim)
FIXME_docs.
void SetRxQlim(uint16_t qlim)
FIXME_docs.
uint16_t TxRlim() const
FIXME_docs.
void SetRxRlim(uint16_t rlim)
FIXME_docs.
void SetModCntl(bool modcntl)
FIXME_docs.
bool ModCntl() const
FIXME_docs.
uint16_t FifoSize() const
FIXME_docs.
bool Buffered() const
FIXME_docs.
static const int kLam
DZ11 default lam.
static const uint16_t kIbaddr
DZ11 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