w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlPC11.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlPC11.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-04-14 1132 1.2 add getters& setters for pc11_buf readout
8// 2017-04-16 878 1.1 add class in ctor;derive from RtclRw11CntlStreamBase
9// 2013-05-03 515 1.0 Initial version
10// ---------------------------------------------------------------------------
11
17
18#include "RtclRw11CntlPC11.hpp"
19#include "RtclRw11UnitPC11.hpp"
20
21using namespace std;
22using namespace std::placeholders;
23
29// all method definitions in namespace Retro
30namespace Retro {
31
32//------------------------------------------+-----------------------------------
34
36 : RtclRw11CntlStreamBase<Rw11CntlPC11>("Rw11CntlPC11","stream")
37{
38 Rw11CntlPC11* pobj = &Obj();
39 fGets.Add<uint16_t> ("prqlim", bind(&Rw11CntlPC11::PrQlim, pobj));
40 fGets.Add<uint16_t> ("prrlim", bind(&Rw11CntlPC11::PrRlim, pobj));
41 fGets.Add<uint16_t> ("pprlim", bind(&Rw11CntlPC11::PpRlim, pobj));
42 fGets.Add<uint16_t> ("itype", bind(&Rw11CntlPC11::Itype, pobj));
43 fGets.Add<bool> ("buffered", bind(&Rw11CntlPC11::Buffered, pobj));
44 fGets.Add<uint16_t> ("fifosize", bind(&Rw11CntlPC11::FifoSize, pobj));
45
46 fSets.Add<uint16_t> ("prqlim", bind(&Rw11CntlPC11::SetPrQlim,pobj, _1));
47 fSets.Add<uint16_t> ("prrlim", bind(&Rw11CntlPC11::SetPrRlim,pobj, _1));
48 fSets.Add<uint16_t> ("pprlim", bind(&Rw11CntlPC11::SetPpRlim,pobj, _1));
49}
50
51//------------------------------------------+-----------------------------------
53
55{}
56
57//------------------------------------------+-----------------------------------
59
61{
62 static RtclNameSet optset("-base|-lam");
63
64 string cntlname(cpu.Obj().NextCntlName("pc"));
65 string cntlcmd = cpu.CommandName() + cntlname;
66
67 uint16_t base = Rw11CntlPC11::kIbaddr;
68 int lam = Rw11CntlPC11::kLam;
69
70 string opt;
71 while (args.NextOpt(opt, optset)) {
72 if (opt == "-base") {
73 if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
74 } else if (opt == "-lam") {
75 if (!args.GetArg("lam", lam, 0, 15)) return kERR;
76 }
77 }
78 if (!args.AllDone()) return kERR;
79
80 // configure controller
81 Obj().Config(cntlname, base, lam);
82
83 // install in CPU
84 cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
85
86 // finally create tcl command
87 CreateObjectCmd(args.Interp(), cntlcmd.c_str());
88
89 // and create unit commands
90 for (size_t i=0; i<Obj().NUnit(); i++) {
91 string unitcmd = cpu.CommandName() + Obj().UnitName(i);
92 new RtclRw11UnitPC11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
93 }
94
95 return kOK;
96}
97
98} // 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.
uint16_t Itype() const
FIXME_docs.
static const int kLam
PC11 default lam.
uint16_t PrRlim() const
FIXME_docs.
uint16_t PpRlim() const
FIXME_docs.
bool Buffered() const
FIXME_docs.
void SetPpRlim(uint16_t rlim)
FIXME_docs.
void SetPrRlim(uint16_t rlim)
FIXME_docs.
static const uint16_t kIbaddr
PC11 default address.
void SetPrQlim(uint16_t qlim)
FIXME_docs.
uint16_t PrQlim() 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