w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rw11Cntl.cpp
Go to the documentation of this file.
1// $Id: Rw11Cntl.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-14 1131 1.1.4 add UnitSetup(), UnitSetupAll()
8// 2018-12-19 1090 1.1.3 use RosPrintf(bool)
9// 2017-04-15 874 1.1.2 remove NUnit()
10// 2017-04-02 865 1.1.1 use Dump(detail) for PrimClist
11// 2014-12-30 625 1.1 adopt to Rlink V4 attn logic
12// 2013-03-06 495 1.0 Initial version
13// 2013-02-05 483 0.1 First draft
14// ---------------------------------------------------------------------------
15
20#include "librtools/RosFill.hpp"
23
24#include "Rw11Cntl.hpp"
25
26using namespace std;
27
33// all method definitions in namespace Retro
34namespace Retro {
35
36//------------------------------------------+-----------------------------------
38
39Rw11Cntl::Rw11Cntl(const std::string& type)
40 : fpCpu(nullptr),
41 fType(type),
42 fName(),
43 fBase(0),
44 fLam(-1),
45 fEnable(true),
46 fStarted(false),
47 fProbe(),
48 fTraceLevel(0),
49 fPrimClist(),
50 fStats()
51{
52 fStats.Define(kStatNAttnHdl, "NAttnHdl", "AttnHandler() calls");
53 fStats.Define(kStatNAttnNoAct,"NAttnNoAct","AttnHandler() no action return");
54}
55
56//------------------------------------------+-----------------------------------
58
60{}
61
62//------------------------------------------+-----------------------------------
64
65void Rw11Cntl::SetEnable(bool ena)
66{
67 if (fStarted)
68 throw Rexception("Rw11Cntl::SetEnable", "only allowed before Start()");
69 fEnable = ena;
70 return;
71}
72
73//------------------------------------------+-----------------------------------
75
77{
78 return Cpu().ProbeCntl(fProbe);
79}
80
81//------------------------------------------+-----------------------------------
83
85{
86 fStarted = true;
87 return;
88}
89
90//------------------------------------------+-----------------------------------
92
93bool Rw11Cntl::BootCode(size_t /*unit*/, std::vector<uint16_t>& code,
94 uint16_t& aload, uint16_t& astart)
95{
96 code.clear();
97 aload = 0;
98 astart = 0;
99 return false;
100}
101
102//------------------------------------------+-----------------------------------
104
105void Rw11Cntl::UnitSetup(size_t /*ind*/)
106{
107 return;
108}
109
110//------------------------------------------+-----------------------------------
112
114{
115 for (size_t i=0; i<NUnit(); i++) UnitSetup(i);
116 return;
117}
118
119//------------------------------------------+-----------------------------------
121
122std::string Rw11Cntl::UnitName(size_t index) const
123{
124 string name = fName;
125 if (index > 9) name += char('0' + index/10);
126 name += char('0' + index%10);
127 return name;
128}
129
130//------------------------------------------+-----------------------------------
132
133void Rw11Cntl::Dump(std::ostream& os, int ind, const char* text,
134 int detail) const
135{
136 RosFill bl(ind);
137 os << bl << (text?text:"--") << "Rw11Cntl @ " << this << endl;
138
139 os << bl << " fpCpu: " << fpCpu << endl;
140 os << bl << " fType: " << fType << endl;
141 os << bl << " fName: " << fName << endl;
142 os << bl << " fBase: " << RosPrintf(fBase,"o0",6) << endl;
143 os << bl << " fLam: " << fLam << endl;
144 os << bl << " fEnable: " << RosPrintf(fEnable) << endl;
145 os << bl << " fStarted: " << RosPrintf(fStarted) << endl;
146 fProbe.Dump(os, ind+2, "fProbe: ");
147 os << bl << " fTraceLevel: " << fTraceLevel << endl;
148 fPrimClist.Dump(os, ind+2, "fPrimClist: ", detail-1);
149 fStats.Dump(os, ind+2, "fStats: ", detail-1);
150 return;
151}
152
153//------------------------------------------+-----------------------------------
155
156void Rw11Cntl::ConfigCntl(const std::string& name, uint16_t base, int lam,
157 uint16_t probeoff, bool probeint, bool proberem)
158{
159 fName = name;
160 fBase = base;
161 fLam = lam;
162 fProbe.fAddr = base + probeoff;
163 fProbe.fProbeInt = probeint;
164 fProbe.fProbeRem = proberem;
165 return;
166}
167
168} // end namespace Retro
FIXME_docs.
Definition: Rexception.hpp:29
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
I/O appicator to generate fill characters.
Definition: RosFill.hpp:24
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
Definition: Rstats.cpp:178
void Define(size_t ind, const std::string &name, const std::string &text)
FIXME_docs.
Definition: Rstats.cpp:72
Rw11Cpu * fpCpu
cpu back pointer
Definition: Rw11Cntl.hpp:106
virtual ~Rw11Cntl()
Destructor.
Definition: Rw11Cntl.cpp:59
int fLam
attn bit number (-1 of none)
Definition: Rw11Cntl.hpp:110
uint32_t fTraceLevel
trace level; 0=off;1=cntl
Definition: Rw11Cntl.hpp:114
std::string fType
controller type
Definition: Rw11Cntl.hpp:107
RlinkCommandList fPrimClist
clist for attn primary info
Definition: Rw11Cntl.hpp:115
void SetEnable(bool ena)
FIXME_docs.
Definition: Rw11Cntl.cpp:65
Rstats fStats
statistics
Definition: Rw11Cntl.hpp:116
virtual void UnitSetup(size_t ind)
FIXME_docs.
Definition: Rw11Cntl.cpp:105
Rw11Probe fProbe
controller probe context
Definition: Rw11Cntl.hpp:113
std::string UnitName(size_t index) const
FIXME_docs.
Definition: Rw11Cntl.cpp:122
Rw11Cpu & Cpu() const
FIXME_docs.
Definition: Rw11Cntl.ipp:32
void ConfigCntl(const std::string &name, uint16_t base, int lam, uint16_t probeoff, bool probeint, bool proberem)
FIXME_docs.
Definition: Rw11Cntl.cpp:156
virtual bool BootCode(size_t unit, std::vector< uint16_t > &code, uint16_t &aload, uint16_t &astart)
FIXME_docs.
Definition: Rw11Cntl.cpp:93
bool fStarted
true if Start() called
Definition: Rw11Cntl.hpp:112
bool fEnable
enable flag
Definition: Rw11Cntl.hpp:111
std::string fName
controller name
Definition: Rw11Cntl.hpp:108
virtual void Start()
FIXME_docs.
Definition: Rw11Cntl.cpp:84
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
Definition: Rw11Cntl.cpp:133
virtual void UnitSetupAll()
FIXME_docs.
Definition: Rw11Cntl.cpp:113
Rw11Cntl()
default ctor blocker
Definition: Rw11Cntl.hpp:103
virtual bool Probe()
FIXME_docs.
Definition: Rw11Cntl.cpp:76
virtual size_t NUnit() const =0
uint16_t fBase
controller base address
Definition: Rw11Cntl.hpp:109
bool ProbeCntl(Rw11Probe &dsc)
FIXME_docs.
Definition: Rw11Cpu.cpp:577
RosPrintfS< bool > RosPrintf(bool value, const char *form=0, int width=0, int prec=0)
Creates a print object for the formatted output of a bool value.
Definition: RosPrintf.ipp:38
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
Definition: Rw11Probe.cpp:83
uint16_t fAddr
Definition: Rw11Probe.hpp:24