OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librw11/] [Rw11Cntl.cpp] - Blame information for rev 40

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 wfjm
// $Id: Rw11Cntl.cpp 495 2013-03-06 17:13:48Z mueller $
2
//
3
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2013-03-06   495   1.0    Initial version
17
// 2013-02-05   483   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id: Rw11Cntl.cpp 495 2013-03-06 17:13:48Z mueller $
23
  \brief   Implemenation of Rw11Cntl.
24
*/
25
 
26
#include "librtools/RosFill.hpp"
27
#include "librtools/RosPrintf.hpp"
28
#include "librtools/Rexception.hpp"
29
 
30
#include "Rw11Cntl.hpp"
31
 
32
using namespace std;
33
 
34
/*!
35
  \class Retro::Rw11Cntl
36
  \brief FIXME_docs
37
*/
38
 
39
// all method definitions in namespace Retro
40
namespace Retro {
41
 
42
//------------------------------------------+-----------------------------------
43
//! Constructor
44
 
45
Rw11Cntl::Rw11Cntl(const std::string& type)
46
  : fpCpu(0),
47
    fType(type),
48
    fName(),
49
    fBase(0),
50
    fLam(-1),
51
    fEnable(true),
52
    fStarted(false),
53
    fProbe(),
54
    fTraceLevel(0),
55
    fPrimClist(),
56
    fStats()
57
{
58
  fStats.Define(kStatNAttnHdl,  "NAttnHdl",  "AttnHandler() calls");
59
  fStats.Define(kStatNPrimFused,"NPrimFused","PrimInfo fused with attn cmd");
60
  fStats.Define(kStatNAttnNoAct,"NAttnNoAct","AttnHandler() no action return");
61
}
62
 
63
//------------------------------------------+-----------------------------------
64
//! Destructor
65
 
66
Rw11Cntl::~Rw11Cntl()
67
{}
68
 
69
//------------------------------------------+-----------------------------------
70
//! FIXME_docs
71
 
72
void Rw11Cntl::SetEnable(bool ena)
73
{
74
  if (fStarted)
75
    throw Rexception("Rw11Cntl::SetEnable", "only allowed before Start()");
76
  fEnable = ena;
77
  return;
78
}
79
 
80
//------------------------------------------+-----------------------------------
81
//! FIXME_docs
82
 
83
bool Rw11Cntl::Probe()
84
{
85
  return Cpu().ProbeCntl(fProbe);
86
}
87
 
88
//------------------------------------------+-----------------------------------
89
//! FIXME_docs
90
 
91
void Rw11Cntl::Start()
92
{
93
  fStarted = true;
94
  return;
95
}
96
 
97
//------------------------------------------+-----------------------------------
98
//! FIXME_docs
99
 
100
bool Rw11Cntl::BootCode(size_t unit, std::vector<uint16_t>& code,
101
                        uint16_t& aload, uint16_t& astart)
102
{
103
  code.clear();
104
  aload  = 0;
105
  astart = 0;
106
  return false;
107
}
108
 
109
//------------------------------------------+-----------------------------------
110
//! FIXME_docs
111
 
112
std::string Rw11Cntl::UnitName(size_t index) const
113
{
114
  string name = fName;
115
  if (index > 9) name += char('0' + index/10);
116
  name += char('0' + index%10);
117
  return name;
118
}
119
 
120
//------------------------------------------+-----------------------------------
121
//! FIXME_docs
122
 
123
void Rw11Cntl::Dump(std::ostream& os, int ind, const char* text) const
124
{
125
  RosFill bl(ind);
126
  os << bl << (text?text:"--") << "Rw11Cntl @ " << this << endl;
127
 
128
  os << bl << "  fpCpu:           " << fpCpu << endl;
129
  os << bl << "  fType:           " << fType << endl;
130
  os << bl << "  fName:           " << fName << endl;
131
  os << bl << "  fBase:           " << RosPrintf(fBase,"o0",6) << endl;
132
  os << bl << "  fLam:            " << fLam << endl;
133
  os << bl << "  fEnable:         " << fEnable << endl;
134
  os << bl << "  fStarted:        " << fStarted << endl;
135
  fProbe.Dump(os, ind+2, "fProbe: ");
136
  os << bl << "  fTraceLevel:     " << fTraceLevel << endl;
137
  fPrimClist.Dump(os, ind+2, "fPrimClist: ");
138
  fStats.Dump(os, ind+2, "fStats: ");
139
  return;
140
}
141
 
142
//------------------------------------------+-----------------------------------
143
//! FIXME_docs
144
 
145
void Rw11Cntl::ConfigCntl(const std::string& name, uint16_t base, int lam,
146
                          uint16_t probeoff, bool probeint, bool proberem)
147
{
148
  fName = name;
149
  fBase = base;
150
  fLam  = lam;
151
  fProbe.fAddr     = base + probeoff;
152
  fProbe.fProbeInt = probeint;
153
  fProbe.fProbeRem = proberem;
154
  return;
155
}
156
 
157
//------------------------------------------+-----------------------------------
158
//! FIXME_docs
159
 
160
void Rw11Cntl::GetPrimInfo(const RlinkServer::AttnArgs& args,
161
                           RlinkCommandList*& pclist, size_t& offset)
162
{
163
  fStats.Inc(kStatNAttnHdl);
164
 
165
  if (args.fpClist) {
166
    fStats.Inc(kStatNPrimFused);
167
    pclist = args.fpClist;
168
    offset = args.fOffset;
169
 
170
  } else {
171
    Server().Exec(fPrimClist);
172
    // FIXME_code: handle errors
173
    pclist = &fPrimClist;
174
    offset = 0;
175
  }
176
 
177
  return;
178
}
179
 
180
 
181
} // end namespace Retro

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.