w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlDL11.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlDL11.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-04-26 1139 1.2 add getters& setters for dl11_buf readout
8// 2019-02-23 1114 1.1.2 use std::bind instead of lambda
9// 2018-12-15 1082 1.1.1 use lambda instead of boost::bind
10// 2017-04-16 878 1.1 add class in ctor; derive from RtclRw11CntlTermBase
11// 2013-05-04 516 1.0.1 add RxRlim support (receive interrupt rate limit)
12// 2013-03-06 495 1.0 Initial version
13// 2013-02-02 480 0.1 First draft
14// ---------------------------------------------------------------------------
15
20#include <functional>
21
23
24#include "RtclRw11CntlDL11.hpp"
25#include "RtclRw11UnitDL11.hpp"
26
27using namespace std;
28using namespace std::placeholders;
29
35// all method definitions in namespace Retro
36namespace Retro {
37
38//------------------------------------------+-----------------------------------
40
42 : RtclRw11CntlTermBase<Rw11CntlDL11>("Rw11CntlDL11","term")
43{
44 Rw11CntlDL11* pobj = &Obj();
45 fGets.Add<uint16_t> ("rxqlim", bind(&Rw11CntlDL11::RxQlim, pobj));
46 fGets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDL11::RxRlim, pobj));
47 fGets.Add<uint16_t> ("txrlim", bind(&Rw11CntlDL11::TxRlim, pobj));
48 fGets.Add<uint16_t> ("itype", bind(&Rw11CntlDL11::Itype, pobj));
49 fGets.Add<bool> ("buffered", bind(&Rw11CntlDL11::Buffered, pobj));
50 fGets.Add<uint16_t> ("fifosize", bind(&Rw11CntlDL11::FifoSize, pobj));
51
52 fSets.Add<uint16_t> ("rxqlim", bind(&Rw11CntlDL11::SetRxQlim,pobj, _1));
53 fSets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDL11::SetRxRlim,pobj, _1));
54 fSets.Add<uint16_t> ("txrlim", bind(&Rw11CntlDL11::SetTxRlim,pobj, _1));
55}
56
57//------------------------------------------+-----------------------------------
59
61{}
62
63//------------------------------------------+-----------------------------------
65
67{
68 static RtclNameSet optset("-base|-lam");
69
70 string cntlname(cpu.Obj().NextCntlName("tt"));
71 string cntlcmd = cpu.CommandName() + cntlname;
72
73 uint16_t base = Rw11CntlDL11::kIbaddr;
74 int lam = Rw11CntlDL11::kLam;
75
76 string opt;
77 while (args.NextOpt(opt, optset)) {
78 if (opt == "-base") {
79 if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
80 } else if (opt == "-lam") {
81 if (!args.GetArg("lam", lam, 0, 15)) return kERR;
82 }
83 }
84 if (!args.AllDone()) return kERR;
85
86 // configure controller
87 Obj().Config(cntlname, base, lam);
88
89 // install in CPU
90 cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
91
92 // finally create tcl command
93 CreateObjectCmd(args.Interp(), cntlcmd.c_str());
94
95 // and create unit commands
96 for (size_t i=0; i<Obj().NUnit(); i++) {
97 string unitcmd = cpu.CommandName() + Obj().UnitName(i);
98 new RtclRw11UnitDL11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
99 }
100
101 return kOK;
102}
103
104} // 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
void SetRxQlim(uint16_t qlim)
FIXME_docs.
static const int kLam
DL11 default lam.
static const uint16_t kIbaddr
DL11 default address.
uint16_t RxRlim() const
FIXME_docs.
uint16_t TxRlim() const
FIXME_docs.
uint16_t RxQlim() const
FIXME_docs.
void SetTxRlim(uint16_t rlim)
FIXME_docs.
bool Buffered() const
FIXME_docs.
uint16_t Itype() const
FIXME_docs.
uint16_t FifoSize() const
FIXME_docs.
void SetRxRlim(uint16_t rlim)
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