w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlLP11.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlLP11.cpp 1185 2019-07-12 17:29:12Z 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-03-17 1123 1.2 add getters& setters for lp11_buf readout
8// 2017-04-16 878 1.1 add class in ctor;derive from RtclRw11CntlStreamBase
9// 2013-05-01 513 1.0 Initial version
10// ---------------------------------------------------------------------------
11
17
18#include "RtclRw11CntlLP11.hpp"
19#include "RtclRw11UnitLP11.hpp"
20
21using namespace std;
22using namespace std::placeholders;
23
29// all method definitions in namespace Retro
30namespace Retro {
31
32//------------------------------------------+-----------------------------------
34
36 : RtclRw11CntlStreamBase<Rw11CntlLP11>("Rw11CntlLP11","stream")
37{
38 Rw11CntlLP11* pobj = &Obj();
39 fGets.Add<uint16_t> ("rlim", bind(&Rw11CntlLP11::Rlim, pobj));
40 fGets.Add<uint16_t> ("itype", bind(&Rw11CntlLP11::Itype, pobj));
41 fGets.Add<bool> ("buffered", bind(&Rw11CntlLP11::Buffered, pobj));
42 fGets.Add<uint16_t> ("fifosize", bind(&Rw11CntlLP11::FifoSize, pobj));
43
44 fSets.Add<uint16_t> ("rlim", bind(&Rw11CntlLP11::SetRlim,pobj, _1));
45}
46
47//------------------------------------------+-----------------------------------
49
51{}
52
53//------------------------------------------+-----------------------------------
55
57{
58 static RtclNameSet optset("-base|-lam");
59
60 string cntlname(cpu.Obj().NextCntlName("lp"));
61 string cntlcmd = cpu.CommandName() + cntlname;
62
63 uint16_t base = Rw11CntlLP11::kIbaddr;
64 int lam = Rw11CntlLP11::kLam;
65
66 string opt;
67 while (args.NextOpt(opt, optset)) {
68 if (opt == "-base") {
69 if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
70 } else if (opt == "-lam") {
71 if (!args.GetArg("lam", lam, 0, 15)) return kERR;
72 }
73 }
74 if (!args.AllDone()) return kERR;
75
76 // configure controller
77 Obj().Config(cntlname, base, lam);
78
79 // install in CPU
80 cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
81
82 // finally create tcl command
83 CreateObjectCmd(args.Interp(), cntlcmd.c_str());
84
85 // and create unit commands
86 for (size_t i=0; i<Obj().NUnit(); i++) {
87 string unitcmd = cpu.CommandName() + Obj().UnitName(i);
88 new RtclRw11UnitLP11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
89 }
90
91 return kOK;
92}
93
94} // 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 RtclRw11CntlStreamBase.
virtual Rw11Cpu & Obj()=0
void Add(const std::string &name, set_uptr_t &&upset)
FIXME_docs.
Definition: RtclSetList.cpp:52
uint16_t FifoSize() const
FIXME_docs.
void SetRlim(uint16_t rlim)
FIXME_docs.
static const int kLam
LP11 default lam.
uint16_t Itype() const
FIXME_docs.
bool Buffered() const
FIXME_docs.
static const uint16_t kIbaddr
LP11 default address.
uint16_t Rlim() const
FIXME_docs.
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